@sheetxl/mcp 0.8.0-beta.23 → 0.8.0-beta.25

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 (215) hide show
  1. package/assets/{qjyVXZeVSr_qZfX5.js → 45FAgD1JyG2a1Rti.js} +2 -2
  2. package/assets/{L9RIicOHtZd2Rx8g.js → 70weNsvW2LMx5QcW.js} +1 -1
  3. package/assets/{CndRpNCcV89ncnqz.js → APcHum0Riw3QhLBQ.js} +1 -1
  4. package/assets/{NDe-uS1n_Q7u1H3m.js → Abkx7KJ6_X5avkR4.js} +3 -3
  5. package/assets/{2xkoVdiI70Gpaxoc.js → B0FfnXdiZxExcdjB.js} +2 -2
  6. package/assets/{DV3PnM9lo0AW-YOA.js → B6e_DsVO4i91IYEO.js} +3 -3
  7. package/assets/{D-PYDPXobSWiPh1D.js → B940vbTfpMYACpDE.js} +2 -2
  8. package/assets/{BZaXHnsJ6RkCZsnz.js → BAowTO-7Utmg0UvM.js} +3 -3
  9. package/assets/{CCBQDcCHI47PZ0YQ.js → BBccc8pDH-6AJdoT.js} +5 -5
  10. package/assets/{CQCPJBQD0qv9y8qE.js → BD3Bc7ZHxenj4S7Q.js} +1 -1
  11. package/assets/{dep8oZGwBmUpxjHl.js → BFKj2ik7h-yM6oCR.js} +1 -1
  12. package/assets/{BcWSfKJ9Atkc0X_p.js → BHIi-cAKnh_sAifV.js} +1 -1
  13. package/assets/{CSisGJ4hiDhTi19U.js → BHeXL-Lo390ZSNV0.js} +1 -1
  14. package/assets/{a9lvcAd7rWsWSWAo.js → BNvsIyBwweYnfUz3.js} +1 -1
  15. package/assets/{t4qTfgdlstczTs2z.js → BSJ_L1gNOejEih6N.js} +40 -40
  16. package/assets/{CeVCLRwjkH3_OXJu.js → BV13tLgNXZ8MDaE_.js} +1 -1
  17. package/assets/{CHG4ZuzhyjGRuKBg.js → BW8ReYzx-CEJ-lAG.js} +1 -1
  18. package/assets/{DcO0gub7cRKVw4xB.js → BXxUz-sB48Z9nSFi.js} +1 -1
  19. package/assets/{DL7_uGw6KiZhlvR8.js → B_GZxEqqpKtEPbWC.js} +1 -1
  20. package/assets/{BPorbjbkH-VoV1M0.js → Bb7ZxgjHwiKgARXs.js} +1 -1
  21. package/assets/{BomatnedZsGMF7MW.js → BbfSzxx5EzAvn-_F.js} +1432 -1352
  22. package/assets/{CGLapmkNccH1g_ZJ.js → BktUuVP0Jew8_-ff.js} +1 -1
  23. package/assets/{BBuB6ffvyg2Cd7V5.js → Brlza6Jd2oGGX9vB.js} +1 -1
  24. package/assets/{DZt1ONN8CTTfmHGn.js → BtNEVWQWEp_Ie1nT.js} +642 -642
  25. package/assets/{jKIDENA_QP4bEX49.js → Bwk-CZuGiTRT2ox_.js} +4 -4
  26. package/assets/{CyhngJo16o7G18lq.js → BzLwCwXsh7eXQpeK.js} +1 -1
  27. package/assets/{CPZgEZ2jKoo7hS6g.js → BzU8BhgrkSoh-XJF.js} +8 -8
  28. package/assets/{DrKr8dXQEQ3Aukmt.js → C-FJab2sVwBbOTiA.js} +1 -1
  29. package/assets/{KhdF512BKcJXZMvq.js → C-Vt758qtn8QeCrw.js} +1 -1
  30. package/assets/{aTxgpOOxLenli4af.js → C2kYWrsx5mg4XOES.js} +1 -1
  31. package/assets/{2XwVsSfo5wF5K-HA.js → C6Vsz4e_ASJdx3LP.js} +1 -1
  32. package/assets/{DN1RRp4qQfCq3JAO.js → C9DvPNfuz_0hun6C.js} +1 -1
  33. package/assets/{PiFW6uPRJABzK3V1.js → CAI8p60cuWlgnlko.js} +14 -14
  34. package/assets/{BI8kb-rd9dW85XJs.js → CCOaNx5_BfWCc9yz.js} +1 -1
  35. package/assets/{B2zUUqxAJ1RiM7YI.js → CD2yoEhIT8DyXBou.js} +52 -52
  36. package/assets/{DPjWOMoJ-elAAOmS.js → CDiutOsLAzu4c0Ej.js} +1 -1
  37. package/assets/{DfBERTJjS9LP0RSp.js → CFrOPd_UcD7qclCq.js} +1 -1
  38. package/assets/{CH8DNTUgM79xk8Tt.js → CGS7apShLtnlmF8D.js} +1 -1
  39. package/assets/{CgYef9dYxY8YyUTE.js → CGdayif_qNMtoATI.js} +1 -1
  40. package/assets/{bsnhRuD-K-qhW-y5.js → CJubVukzHBNJb_Wf.js} +91 -91
  41. package/assets/{MzfM7zDcnyOFK1lK.js → COXWiXy3DCfmXSm5.js} +1 -1
  42. package/assets/{Bbmh8_bdk_HrQ5Y6.js → COZ-bhj463kGINFA.js} +1 -1
  43. package/assets/{BdUFL3lVdwifHrf0.js → CSMsn9bKgR9kWG0m.js} +1 -1
  44. package/assets/{WH1Vl-MDWX3vSMn1.js → CVWoX7wNwrZwm5XB.js} +2 -2
  45. package/assets/{DLuQ_rdu0XjYF7Jq.js → CX-KrjVgXM-7o--S.js} +2 -2
  46. package/assets/{BNEBXKAh-N4Tygk7.js → CYtkZMCX6dyEqjb9.js} +44 -44
  47. package/assets/{CE5DhB5As59VJ-Ig.js → Cb7FKT3S78r6IYHi.js} +1 -1
  48. package/assets/{Cidwv57sKqhIrpHP.js → CcTDxlAqw6HuYmmm.js} +42 -42
  49. package/assets/CehVpkp73IfWGN_b.js +14 -0
  50. package/assets/{f_dBJuakO_BJ7Tvm.js → CfWSdzSpbErVA_1h.js} +309 -309
  51. package/assets/{E-KM5RFByUxjlkId.js → Ci3R5B7bLke8NZRo.js} +6 -6
  52. package/assets/{DbbNJyL67KdOK7nc.js → ClRgSo0axU3lAOwR.js} +1 -1
  53. package/assets/{DJ2jlogB1DWlGM-J.js → Cmf4eJow6AIuPH_w.js} +1 -1
  54. package/assets/{CE-9VKh5-Xwxnxmu.js → Cplall3oc-_3AhCB.js} +1 -1
  55. package/assets/{BJMeWtr7TiLNpt17.js → Cu4ok_jTnQif8QtX.js} +1 -1
  56. package/assets/{D7oYfHgO0kEqAnPV.js → D053O1kZ7JtMwiqh.js} +1 -1
  57. package/assets/{BPtf3_nlovO4r9Bm.js → D5aWcMLJ2wyLm9Ws.js} +1 -1
  58. package/assets/{B3YRTBFhX61z6rJv.js → D6qQAWN_5p3FAshK.js} +375 -370
  59. package/assets/{DvkBNkPyR5kuS0Uo.js → D7NjohknztgMLqhT.js} +2 -2
  60. package/assets/{CBMMHYgUAhgiJhJE.js → D8cqT2lbcP5Yp1Or.js} +3 -3
  61. package/assets/{DACd4ZjYwzNE7Koc.js → D8wjcRGgRdU34Ata.js} +1 -1
  62. package/assets/{DtETpSxSR8C1voac.js → DAnTpFc2vx3CmP8e.js} +83 -83
  63. package/assets/{BWeaY19OpTJK5v0n.js → DB2MrmDLZ-OzVRQu.js} +2 -2
  64. package/assets/{ChbkkN_JqbAGrUwB.js → DBgHcEP-FcgSHLvx.js} +332 -332
  65. package/assets/{CnUYevzhUJYNqLad.js → DFd0JAiw5dkbnULM.js} +1 -1
  66. package/assets/{CC7EfXPwp7_nSBIz.js → DG9KGapq8eHlcTC7.js} +1 -1
  67. package/assets/{C6_KHS3-ROddeSbS.js → DHCl7HWDbT3xqx8W.js} +2 -2
  68. package/assets/{BDSNdgf_hbhX1DhN.js → DJlQxf99HCszeCCD.js} +1 -1
  69. package/assets/{DiJexWBIzdGj1H0H.js → DLW76uSURiQM07DD.js} +1 -1
  70. package/assets/{Cx1bc-Dsja7W3GlB.js → DQBqVPRLkZFb2P_x.js} +2 -2
  71. package/assets/{D60N4r1a2YsNEwqj.js → DQlLgxA592HvgKzh.js} +1 -1
  72. package/assets/{D5O3m16KeyU_oXqH.js → DRvzD5Tkcb2OU0G2.js} +1 -1
  73. package/assets/{5MnsnJcajdtAujE2.js → DUfrvQDZKh_22F91.js} +1 -1
  74. package/assets/{DL8wUEe2Kx7bjDYP.js → DX94YgmfoL_ngS60.js} +1 -1
  75. package/assets/{BazhmjGvrL7pqVQP.js → DXDhH3F4N4OOigqN.js} +1 -1
  76. package/assets/{CpyybSV2kR6b-SIB.js → DXVfJfT6ftWk5kYi.js} +497 -497
  77. package/assets/{DSyZaCML62gSnudE.js → DYx_I-o0yjx056Dq.js} +1 -1
  78. package/assets/{YtxPcFPURJF6CxWu.js → DZBfVpnngvY9Ra3C.js} +1 -1
  79. package/assets/{Dawi8y7JWn6A9gAx.js → DZOzgVEOXfHTE3YC.js} +1 -1
  80. package/assets/{PVGDjdR9C4stMNpM.js → DZTVTdrwu05fNZk_.js} +1 -1
  81. package/assets/{BYbzf-TVwbKQPCyK.js → DaB9iRVJj3TmKH92.js} +3 -3
  82. package/assets/{BLr8y5StL65VZQxG.js → DbHVXEt9qwlb8Gou.js} +154 -155
  83. package/assets/{wKkW4LO-iUp92LVC.js → DbXqd8hGNQEyS-s0.js} +1 -1
  84. package/assets/{BULbMlvQuB2WFBFE.js → DcHo7BC8Ny3hWq0j.js} +2 -2
  85. package/assets/{DAliB9N1z6qnw4NO.js → DcHvH_I64hbnNh9G.js} +1 -1
  86. package/assets/{DoP6myQHGI-X1gNy.js → DfaQvLAaU7HHPnSe.js} +89 -89
  87. package/assets/{BVUfaOAGhdMim8yB.js → DgE30NwKzEjZI1W6.js} +3 -3
  88. package/assets/{KMTTqSwDthnXnD4F.js → Djl7cjJyCIS_Qvbd.js} +1 -1
  89. package/assets/{CzoRlNMlpFz4iax3.js → DkS3EQvuEuPDvCws.js} +2 -2
  90. package/assets/{CrTLWpsRNBSyTLor.js → DkT0-_t9Xgp4l-Mh.js} +1 -1
  91. package/assets/{DuQU8JjPLBIK804w.js → DlOCT6DI5bhPtQ8j.js} +26 -26
  92. package/assets/{Bjk1Twm0RFO_3fS8.js → DpGFb3hbAT5Murcv.js} +1 -1
  93. package/assets/{D5PpcRuJYSv0i2y9.js → DunKnm-bQd0oHn9n.js} +2 -2
  94. package/assets/{Bz08KxFupjbdsoFx.js → Duw8QQGcrPmesb-M.js} +1 -1
  95. package/assets/{DUytcsu0MV3GnsrM.js → DvkgborRc2vRq8E-.js} +1 -1
  96. package/assets/{WuKVkvMPAOmRaCDY.js → DwmlBb640xWfAMV2.js} +2 -2
  97. package/assets/{CtlrxXVgZDIOcuc1.js → GfAXkT_vctdRX_9f.js} +162 -162
  98. package/assets/{Dg5QmWm0uBTEjZy4.js → H40qXR3Gazmnq4Mv.js} +1 -1
  99. package/assets/{DgLQfXTWavoBetna.js → HLtC2gb8SfNmJU5q.js} +5 -5
  100. package/assets/{1J1R3dclFOh322Yr.js → H_6CBe3t27jHlBHk.js} +182 -182
  101. package/assets/{Dol52NFQzLCbObuC.js → LQNEL4KjDxwZNwWq.js} +176 -176
  102. package/assets/{Cl8_HMhRgzPzqFc7.js → O8YGVK4vtz39jQ84.js} +1 -1
  103. package/assets/{gver5Sz7ZO6ZyrOi.js → TqxFLhPz3zbgi95t.js} +1 -1
  104. package/assets/{C8G_px4dGuR2KjJh.js → UdhH9UX9jQ4IV11J.js} +1 -1
  105. package/assets/{BEsnJS5jYwkHNcZd.js → V4pGXJr6fe-CPg7i.js} +1 -1
  106. package/assets/{DXmebUOAhtW4V6BO.js → V_VVW06vjWkmlbdh.js} +463 -463
  107. package/assets/{Cg1tSmK_AGJa2VeI.js → VkeNTI1TMsA1ZbGz.js} +3 -3
  108. package/assets/{BbU6aT_c6-4tkcCw.js → cTLYCAhDs2fR2ITC.js} +1 -1
  109. package/assets/{BynbAjhJnLjyP7HH.js → cU78RT4WJKAp5mU_.js} +1 -1
  110. package/assets/{Cl04_aSpBHTwfsQR.js → ckvxz2tZRlY1UPpg.js} +11464 -11420
  111. package/assets/{CwrOCbcS4IHLsERQ.js → eCD6fmcTsgv76IZm.js} +90 -90
  112. package/assets/{q1rCdlJA6Z7tA6om.js → irrAIfw6CnCOHmPE.js} +1 -1
  113. package/assets/{DIAQ_WlBCWhgHt-z.js → ixHQtoul8ubEJfWS.js} +12 -7
  114. package/assets/{CEsRqYMd5IjnAzzX.js → kmiMiNIUc6rS8DG8.js} +4 -4
  115. package/assets/{CqP4H_-kRRjcxO91.js → m9BgbF-NgPIYW4kc.js} +1 -1
  116. package/assets/{BlhJHu9ni2T9IaM1.js → s56uiNHMGbBV6xgZ.js} +1 -1
  117. package/assets/{BKpicdc9H5WnZPb-.js → u8xtjHo43n-S_O6j.js} +1 -1
  118. package/assets/{sIWsnPhnHm_MeeM9.js → u9le-qZ3tbYKK1kU.js} +2 -2
  119. package/assets/{BGxwDpW8DkO8W0Ig.js → xMi-tFxI2s6e18L1.js} +1 -1
  120. package/assets/{DKKLWACR9GsidnkS.js → xSUMX6J9-MJIGgmG.js} +2 -2
  121. package/index.js +191 -191
  122. package/lib.js +1 -1
  123. package/licenses/dependencies.txt +69 -69
  124. package/package.json +2 -2
  125. package/screenshot-page/assets/{DMbFr7oWja7Qpsm6.js → 0P0DnZolMnjPhiea.js} +2 -2
  126. package/screenshot-page/assets/3L7CY5dA_kT2UBjv.js +1 -0
  127. package/screenshot-page/assets/{FcTM4SB17cEX1M3X.js → 5Y11BWntgqmzo9dz.js} +1 -1
  128. package/screenshot-page/assets/{CXwbGzavyvYgDbWU.js → B0CDAMDdxSN4en9k.js} +1 -1
  129. package/screenshot-page/assets/B6UwT0pG4sQeG7fA.js +3 -0
  130. package/screenshot-page/assets/BCmGLxQEUabeee6Q.js +2 -0
  131. package/screenshot-page/assets/{Cengqc8q8BTmNfb_.js → BGIujWi3UayyIWlg.js} +1 -1
  132. package/screenshot-page/assets/BH2IWQ-8AfNbhYZJ.js +39 -0
  133. package/screenshot-page/assets/BNjmzbnQlBmX-HPQ.js +1 -0
  134. package/screenshot-page/assets/{DcrVJCyDwGKeil2U.js → BQTLEc84Eql61S2m.js} +1 -1
  135. package/screenshot-page/assets/{BjJ_nnNDZEPLpapa.js → BVnzv_sY_58zEJyM.js} +1 -1
  136. package/screenshot-page/assets/{Cx1kZ2u_8JFV2Q8D.js → BiRVjUOUI8Qv0CE1.js} +1 -1
  137. package/screenshot-page/assets/BkU12U7IqW7qjopk.js +13 -0
  138. package/screenshot-page/assets/{D4hvW_TF7vwc-Xlq.js → Bne-AygyF1USkPAy.js} +2 -2
  139. package/screenshot-page/assets/{Dkf51CnZh2zPEGMd.js → BpJaTpbR_CQzXj9M.js} +1 -1
  140. package/screenshot-page/assets/Bs-IXwX9BKsCxwcJ.js +2 -0
  141. package/screenshot-page/assets/{ONNSfQ8RDOqBDsvw.js → Bt7fKk5ZupUuo_xD.js} +2 -2
  142. package/screenshot-page/assets/{CGx-ZSMV9cPOzbu4.js → C-2hBFk27roWkIrQ.js} +2 -2
  143. package/screenshot-page/assets/C7MXfx6zf_uTwcpu.js +1 -0
  144. package/screenshot-page/assets/CALWodHqzUTIv9le.js +5 -0
  145. package/screenshot-page/assets/{Ce8b0lOBuWKlfLzJ.js → CCYEWK5QyGSnUAfh.js} +1 -1
  146. package/screenshot-page/assets/{CEL5lzj2NDYwJ-HC.js → CFS0h-wE9YlZRk_1.js} +1 -1
  147. package/screenshot-page/assets/CKdQfdZJGJFgnrr9.js +586 -0
  148. package/screenshot-page/assets/{DvRXbyteeo_8sy8T.js → CL_hAngRQwm_KGdR.js} +1 -1
  149. package/screenshot-page/assets/{BTKdl-XR9TlWaFe7.js → CMryHLEhCyKGuRSW.js} +6 -6
  150. package/screenshot-page/assets/COL9dj40ytErlGak.js +2 -0
  151. package/screenshot-page/assets/{BAxPBeFudRJ3OqIC.js → CRtk9ixuBWxhPfPU.js} +1 -1
  152. package/screenshot-page/assets/CUQsrLir5jYpnRPM.js +1 -0
  153. package/screenshot-page/assets/CUgX7ETRCJsvqa2x.js +1 -0
  154. package/screenshot-page/assets/{C7mXat-6esc1AmRD.js → CXeDqC02BZcixiHS.js} +2 -2
  155. package/screenshot-page/assets/{Cv0zGWEBpmC07Jps.js → CZaKvnrRdlLj1_X8.js} +1 -1
  156. package/screenshot-page/assets/CfD1bn6b-NM38iZV.js +1 -0
  157. package/screenshot-page/assets/{BJct69niPZc8L_gZ.js → Ck5onwb1w_19WrtG.js} +1 -1
  158. package/screenshot-page/assets/{DyxJBLjUkeDuu96F.js → CltB1nb5HHSmYrNG.js} +1 -1
  159. package/screenshot-page/assets/{D6Yv5cc1JE7DGd6j.js → CqBSIwwGzWl8mrBe.js} +1 -1
  160. package/screenshot-page/assets/CvBPH5c-gnUG8Jen.js +1 -0
  161. package/screenshot-page/assets/D-jd_TJCN7AAn125.js +48 -0
  162. package/screenshot-page/assets/{ChSvXfVMLxZsP9zG.js → D4RZZdlItfrgQHcE.js} +1 -1
  163. package/screenshot-page/assets/{B2PWru6Ty7ODc2Ie.js → D53hpXNHxIgSWl80.js} +1 -1
  164. package/screenshot-page/assets/{J73KTOmdZGNmnq-z.js → D72Rp__0TEqJ972a.js} +1 -1
  165. package/screenshot-page/assets/D8EmNst-H2v0eWcf.js +1 -0
  166. package/screenshot-page/assets/{Cbbl3H042tb0krfe.js → D98PlIA4qQ_6ciCu.js} +2 -2
  167. package/screenshot-page/assets/{Tj3B5At0OAN3tDza.js → DACqwpSwlZka3b7s.js} +1 -1
  168. package/screenshot-page/assets/{CI3Z1f4amZ9G2rPD.js → DJebrQ5mu8uxpX3b.js} +1 -1
  169. package/screenshot-page/assets/{DtQFcMvZesaQ4xRf.js → DTAKTGn53yF_B621.js} +1 -1
  170. package/screenshot-page/assets/{CaOsWPeN_FXseSNg.js → DYYzsN95gWMsxOaj.js} +1 -1
  171. package/screenshot-page/assets/{C5-sm7wuk62Nzm_p.js → Da_VIghRFdNrmfZT.js} +1 -1
  172. package/screenshot-page/assets/{Be1S5czBx0lxhYLW.js → DbnmgPTSEii4OGkB.js} +1 -1
  173. package/screenshot-page/assets/{0UZBKpOOsp7P-DkP.js → DdmX3djBOA6UCZtf.js} +2 -2
  174. package/screenshot-page/assets/{DEpn6VGd30cHEJOS.js → DfQS5zAy3pN31xNb.js} +1 -1
  175. package/screenshot-page/assets/{BT2nkqpteSR9booH.js → DkTX5ZjGNQ5SrwJa.js} +1 -1
  176. package/screenshot-page/assets/{Bml69dFBVggmVWda.js → DmIjTb4kKfUHxWaF.js} +9 -9
  177. package/screenshot-page/assets/DqOrgSpuJhQRhMoG.js +4 -0
  178. package/screenshot-page/assets/{JM0_BaBZ3yF6lnHC.js → Dz_yLNMXKWGx1O6V.js} +2 -2
  179. package/screenshot-page/assets/{B-8IMo2f1yGNXOyz.js → GxbRmvyoKhHl0ZYY.js} +13 -8
  180. package/screenshot-page/assets/{C-n8BDiksNjX6Orz.js → MqGbtsji4DVGCAMR.js} +1 -1
  181. package/screenshot-page/assets/{zvxBjll3jnL0-vNn.js → Np3jWxG724t5hLHZ.js} +2 -2
  182. package/screenshot-page/assets/eR9_DaySoB72PvMo.js +1 -0
  183. package/screenshot-page/assets/hB5riGkPy0wXVIig.js +1 -0
  184. package/screenshot-page/assets/hHvAGynpTvAb97GX.js +1 -0
  185. package/screenshot-page/assets/{CiFaOHqsDQTE4RRi.js → jKvAZg0Tp701aw1o.js} +2 -2
  186. package/screenshot-page/assets/{DACSL7FA_J91Z_H7.js → jteb4n23QwBT9m_4.js} +1 -1
  187. package/screenshot-page/assets/mzrDp0emvkWnkXBt.js +1 -0
  188. package/screenshot-page/assets/x1O923k1mN-CduO_.js +1 -0
  189. package/screenshot-page/index.html +15 -15
  190. package/types/scripting-api.json +5745 -5743
  191. package/types/scripting.d.ts +23 -4
  192. package/assets/DU2Dzzu0oY_eDN6i.js +0 -14
  193. package/screenshot-page/assets/37LAUhU1_yKtsBlH.js +0 -2
  194. package/screenshot-page/assets/B3c6NBI22E5SZWG-.js +0 -1
  195. package/screenshot-page/assets/B3yyoGGGl8ICyeoC.js +0 -39
  196. package/screenshot-page/assets/B56KxTxcAXDom0g4.js +0 -13
  197. package/screenshot-page/assets/BPMQ22uISGOm3ymr.js +0 -1
  198. package/screenshot-page/assets/Bh2DVAOWvWfylt77.js +0 -1
  199. package/screenshot-page/assets/BoiQQ-37KQn6NcLT.js +0 -1
  200. package/screenshot-page/assets/C9a-cNha8mBw5q-l.js +0 -1
  201. package/screenshot-page/assets/CAQ7QWes7j7Fq8o5.js +0 -2
  202. package/screenshot-page/assets/CaP_vH0sJFjNrSkW.js +0 -1
  203. package/screenshot-page/assets/CcVllJMjVF6SvVVq.js +0 -2
  204. package/screenshot-page/assets/CyfTQE0Z76Rp4Fbt.js +0 -586
  205. package/screenshot-page/assets/D2CxEHjkPQMAxzWl.js +0 -1
  206. package/screenshot-page/assets/D7Y0npF3FMsGUjgO.js +0 -1
  207. package/screenshot-page/assets/DEAD_MduPNVoT_T6.js +0 -5
  208. package/screenshot-page/assets/DMhOGCTy8V0N14gY.js +0 -1
  209. package/screenshot-page/assets/DVQnEWIisXaOXb_G.js +0 -4
  210. package/screenshot-page/assets/DXbOBAxx4_2rt5KM.js +0 -1
  211. package/screenshot-page/assets/DgLZb-StwCd9ftop.js +0 -1
  212. package/screenshot-page/assets/DrnzLCa7NIirMxno.js +0 -3
  213. package/screenshot-page/assets/EOw6vVvEfYNga9b4.js +0 -1
  214. package/screenshot-page/assets/_zzVe2R8R4vwuc5q.js +0 -48
  215. package/screenshot-page/assets/qFyplGXRu7IepHio.js +0 -1
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BNjmzbnQlBmX-HPQ.js","./CnXLpFE_vFrJ5Jbf.js","./BiRVjUOUI8Qv0CE1.js","./D4RZZdlItfrgQHcE.js","./HclGiUj8dZXDFmoM.js","./CQukCzhuewMuFOlO.js","./Np3jWxG724t5hLHZ.js","./CnPgk3HcIziOcskY.js","./3Ls_kOvlQseMV8Q0.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./HclGiUj8dZXDFmoM.js";import{C as t,F as n,I as r,O as i,Z as a,_ as o,d as s,f as c,g as l,k as u,m as d,o as f,r as p,t as m,u as h,w as g,y as _}from"./D4RZZdlItfrgQHcE.js";import{t as v}from"./3Ls_kOvlQseMV8Q0.js";import{c as y,i as b,s as x}from"./BQTLEc84Eql61S2m.js";import{$t as S,Ct as C,I as w,It as T,M as ee,Nt as te,P as ne,Q as re,Qt as ie,S as ae,Tt as oe,Wt as se,Y as E,an as D,bt as ce,gt as le,q as ue,vt as O,z as de}from"./COL9dj40ytErlGak.js";import{i as k,t as A}from"./CQukCzhuewMuFOlO.js";import{$ as j,$n as M,$t as N,An as fe,Ar as pe,B as me,Br as he,Bt as ge,C as P,Ci as _e,Fr as ve,Ft as ye,Gi as F,Gn as be,Gt as I,H as xe,Hr as L,Jt as Se,Kn as Ce,Ln as we,Ma as Te,N as Ee,Nt as De,Ri as Oe,Sn as ke,Ti as Ae,Ui as je,Ut as Me,Wt as Ne,Zi as Pe,Zn as Fe,Zt as Ie,an as Le,ar as Re,bn as ze,bt as Be,ci as Ve,cn as He,di as Ue,ei as We,er as Ge,fr as Ke,gn as qe,ii as Je,j as R,ja as Ye,ji as z,jt as Xe,ka as Ze,kn as Qe,l as $e,ln as et,lt as tt,mi as nt,na as rt,ot as it,pi as B,pn as at,qi as ot,tr as st,vi as ct,vr as lt,vt as V,x as ut,xi as dt,z as ft,zi as pt,zt as mt}from"./CKdQfdZJGJFgnrr9.js";var ht,gt=class extends u{constructor(e,t=50){super(t),this._transactions=e,this._floorId=e?e.getCurrentCommit(!1).getId():null,this._removeListener=e?.addListener({onCommitChange:()=>this._notifyOnStackChange()})}_undoCommits(e=this.maxStack){let t=this._transactions;if(!t)return[];let n=t.getLog(t.getCurrentCommit(!1).getId(),2**53-1),r=[];for(let t=0;t<n.length&&r.length<e;t++){let e=n[t];if(e.getId()===this._floorId||t===n.length-1)break;e.getDescription()&&r.push(e)}return r}_redoCommits(e=this.maxStack){let t=this._transactions;if(!t)return[];let n=t.getCurrentCommit(!1).getId(),r=t.getTipCommit().getId();if(r===n)return[];let i=t.getLog(r,2**53-1),a=[],o=!1;for(let e of i){if(e.getId()===n){o=!0;break}a.push(e)}if(!o)return[];a.reverse();let s=[];for(let t of a)if(t.getDescription()&&s.push(t),s.length>=e)break;return s}undo(e=1){let t=this._transactions;if(!t)return;let n=!1;try{for(let r=0;r<e;r++){let[e]=this._undoCommits(1);if(!e)break;t.revert(e.getId()),n=!0}}finally{n&&this._notifyOnStackChange()}}redo(e=1){let t=this._transactions;if(!t)return;let n=!1;try{for(let r=0;r<e;r++){let[e]=this._redoCommits(1);if(!e){r===0&&this._repeatOperation?.repeat();break}t.restore(e.getId()),n=!0}}finally{n&&this._notifyOnStackChange()}}hasUndo(){return this._undoCommits(1).length>0}hasRedo(){return this._redoCommits(1).length>0||this._repeatOperation!==null}getTopUndoDescription(){return this._undoCommits(1)[0]?.getDescription()??null}getTopRedoDescription(){return this._repeatOperation===null?this._redoCommits(1)[0]?.getDescription()??null:this._repeatOperation.description}getUndoDescriptions(){return this._undoCommits().map(e=>e.getDescription())}getRedoDescriptions(){let e=this._redoCommits().map(e=>e.getDescription());return e.length===0&&this._repeatOperation!==null&&e.push(this._repeatOperation.description),Object.freeze(e)}getUndoEntries(){return this._undoCommits().map(vt)}getRedoEntries(){let e=this._redoCommits().map(vt);return e.length===0&&this._repeatOperation!==null&&e.push({description:this._repeatOperation.description,author:null,meta:_t}),Object.freeze(e)}addUndoOperation(){throw Error(`TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.`)}clear(e=!0){this._transactions&&(this._floorId=this._transactions.getCurrentCommit(!1).getId()),super.clear(e)}close(){this._removeListener?.()}},_t=Object.freeze({}),vt=e=>({description:e.getDescription(),author:e.getAuthor(),meta:e.getMeta()??_t});ht||={};var yt,H=class e{constructor(t,n={}){this._password=null,this._emitter=new b(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}static _defaultCanWrite(e){return!!e&&!/^(https?:|data:|blob:)/i.test(e)}_cleanPath(){return this._path?this._path.split(/[?#]/)[0]:null}getName(){if(this._name!==null&&this._name!==void 0)return this._name;let e=this._cleanPath();return e&&M(e)||null}getPath(){return this._path}getFormat(){return this._format?this._format:this.getExtension()}getExtension(){let e=this._cleanPath();if(!e)return null;let t=F(e);return t?t.toLowerCase():null}getEncryption(){return this._encryption}isEncrypted(){return this._encryption!==null||this._password!==null}setPassword(e){this._password!==(e??null)&&(this._password=e??null,this._password===null&&(this._encryption=null),this._emitter.notify(`onChange`))}getPassword(){return this._password}getSize(){return this._size}getLastModified(){return this._lastModified}canWrite(){return this._canWrite}setName(e){this.update({name:e})}update(e){let t=!1;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}addListeners(e,t){return this._emitter.addListeners(e,t)}get[Symbol.toStringTag](){return`[Origin]`}toString(){let e=this._cleanPath(),t=e?e.split(/[/\\]/).pop()||e:this._name??`(unbound)`,n=this._size;if(n==null)return t;if(n<1024)return`${t} ${n}B`;let r=Math.floor(Math.log(n)/Math.log(1024)),i=[`B`,`KB`,`MB`,`GB`,`TB`];return`${t} ${(n/1024**r).toFixed(2)}${i[Math.min(r,i.length-1)]}`}},U=new WeakMap,W=new Set,bt=e=>U.get(e)??null,xt=()=>Array.from(W,e=>e.getOrigin()),St=class e{constructor(t){this._released=!1,e._assertFree(t),this._emitter=new b(this),this._origin=t,U.set(t,this),W.add(this)}getOrigin(){return this._origin}setOrigin(t){t!==this._origin&&(e._assertFree(t),this._released||(U.delete(this._origin),U.set(t,this)),this._origin=t,this._emitter.notify(`onOriginChange`))}release(){this._released||(this._released=!0,U.get(this._origin)===this&&U.delete(this._origin),W.delete(this))}addListeners(e,t){return this._emitter.addListeners(e,t)}static _assertFree(e){if(U.has(e))throw Error(`This origin already backs an open workbook; an origin backs one workbook at a time.`)}},Ct=class{constructor(){this._defaultStringSourceType=`filepath`}async read(e){let t=e.options??{},r=e.source;if(typeof r==`function`&&(r=r()),r&&typeof r==`object`&&typeof r.then==`function`&&(r=await Promise.resolve(r)),r==null&&(r=await this.resolveSource(e),r==null))return null;let i=r,a=await this.fileFromHandle(r);a&&(r=a);let o=t.format,s=this._detectSourceType(r);if(!s)throw Error(`Unable to detect source type from provided input.`);let c,l,u=!1;if(s===`filepath`){let e=typeof r==`string`&&r.startsWith(`file://`)?r.slice(7):r;r=await this.filePathToFile(e),s=`file`,u=!0}switch(s){case`file`:{let e=r,n=e?.name,i=n?`${M(n)}`:``;c=await e.arrayBuffer(),l={format:o,ext:F(n),name:i,absolutePath:n,size:e.size,lastModified:e.lastModified,canWrite:!t.asCopy&&(!!a||u&&this._canWriteLocalPath())};break}case`blob`:{let e=r;c=await e.arrayBuffer(),l={format:o,size:e.size};break}case`base64`:{let e;if(r&&typeof r==`object`&&`base64`in r)e=r.base64;else if(typeof r==`string`&&r.startsWith(`data:`)){let[,t]=r.split(`,`);e=t}else e=r;c=n.base64ToArrayBuffer(e),l={format:o,size:e.length};break}case`fetch`:{let e,t,n;if(typeof r==`string`)e=r;else{if(!r||typeof r!=`object`||!(`input`in r))throw Error(`Invalid fetch source provided.`);{let i=r;e=i.input,t=i.init,n=i.timeout}}let i=n||3e4,a=new AbortController,s=setTimeout(()=>a.abort(),i),u=typeof e==`string`?e:e.toString(),d=F(u);try{let n=await fetch(e,{...t,signal:a.signal});if(clearTimeout(s),!n.ok)throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);let r=await n.arrayBuffer();if(!r)throw Error(`Unable to fetched content: ${u}`);c=r,l={format:o,ext:d,name:M(u,!0),absolutePath:u}}catch(e){throw clearTimeout(s),e.name===`AbortError`?Error(`Fetch timeout after ${i}ms: ${u}`):e}break}case`buffer`:c=r,l={format:o};break;case`stream`:{let e=r.getReader(),t=[],n=0;try{for(;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}}finally{e.releaseLock()}let i=new ArrayBuffer(n),a=new Uint8Array(i),s=0;for(let e of t)a.set(e,s),s+=e.length;c=i,l={format:o};break}default:throw Error(`Unsupported source type: ${s}`)}l.canWrite&&await this.findOpenOrigin(i,l)&&(l.canWrite=!1);let d=await e.decode(c,{sourceType:s,...l});return d?(await this.onWorkbookRead(d,i),d):null}async findOpenOrigin(e,t){return t.absolutePath?this.findOpenPath(t.absolutePath):null}findOpenPath(e,t){return xt().find(n=>{if(n===t||!n.canWrite())return!1;let r=n.getPath();return!!r&&this.isSamePath(r,e)})??null}isSamePath(e,t){return e===t}async fileFromHandle(e){return null}async resolveSource(e){return null}async onWorkbookRead(e,t){}_canWriteLocalPath(){return!1}_detectSourceType(e){if(e&&typeof e==`object`&&`base64`in e)return`base64`;if(e&&typeof e==`object`&&`input`in e)return`fetch`;if(typeof e==`string`){if(e.startsWith(`data:`))return`base64`;if(e.startsWith(`http://`)||e.startsWith(`https://`))return`fetch`;if(e.startsWith(`file://`))return`filepath`;let t=this._defaultStringSourceType;return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`/`)||/^[a-zA-Z]:[/\\]/.test(e),t}if(typeof File<`u`&&e instanceof File)return`file`;if(typeof Blob<`u`&&e instanceof Blob)return`blob`;let t=e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`,r=ArrayBuffer.isView(e),i=n.isNodeBuffer(e);return t||r||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}},wt=class extends Ct{constructor(e,t){super(),this._getWriteFormats=e,this._getReadFormats=t,this._defaultStringSourceType=`fetch`,this._handleCache=new WeakMap}async fileFromHandle(e){return G(e)?e.getFile():null}async resolveSource(){let e=await this._getReadFormats?.()??[];if(typeof globalThis.showOpenFilePicker==`function`)try{let t=function(e){let t=Tt(e);if(t.length<=1)return t;let n=new Set,r={};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));return[{description:`All Supported`,accept:r},...t]}(e),[n]=await globalThis.showOpenFilePicker(t.length?{types:t}:void 0);return n}catch(e){if(e?.name===`AbortError`)return null;throw e}let n=e.flatMap(e=>e.exts.map(e=>`.`+e)).join(`, `);return t.openFileDialog(n)}async findOpenOrigin(e){return G(e)?this._findOpenHandle(e):null}async _findOpenHandle(e,t){for(let n of xt()){if(n===t||!n.canWrite())continue;let r=this._handleCache.get(n);if(r&&typeof r.isSameEntry==`function`&&await r.isSameEntry(e))return n}return null}async onWorkbookRead(e,t){if(!G(t))return;let n=e.getOrigin?.();n?.canWrite()&&this._handleCache.set(n,t)}async filePathToFile(e){throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`)}async write(e){let{origin:t,suggestedName:n,format:r,encode:i,prompt:a,formatNamed:o}=e,s=[r,...(o?[]:await this._getWriteFormats()).filter(e=>e.key!==r.key)],c=typeof globalThis.showSaveFilePicker==`function`,l=!a&&t.canWrite()?this._handleCache.get(t):void 0;if(c)try{if(l){let e=await async function(e){try{if(typeof e.queryPermission!=`function`)return`granted`;let t={mode:`readwrite`};return await e.queryPermission(t)===`granted`||await e.requestPermission(t)===`granted`?`granted`:`denied`}catch{return`unavailable`}}(l);if(e===`denied`)return null;e!==`granted`&&(l=void 0)}let a=!!l;if(!a){l=await globalThis.showSaveFilePicker({suggestedName:n,types:Tt(s)});let t=await this._findOpenHandle(l,e.workbook?.getOrigin?.());if(t)throw new h(_(`error.io.openElsewhere`,{name:t.getName()??l.name??``}))}let o=function(e,t,n){let r=(e,t)=>e.exts.some(e=>e.toLowerCase()===t),i=K(e);if(r(t,i))return t;let a=e.lastIndexOf(`.`);return r(t,K((a>=0?e.slice(0,a):e).replace(/\s*\(\d+\)$/,``)))?t:n.find(e=>r(e,i))??t}(l.name??n,r,s),c=a?t:new H(l.name??n,{format:o.key,canWrite:!0}),u=await i(o.key,c);if(!u)return null;let d=new Blob([Et(u)],{type:o.mimeType||`application/octet-stream`}),f=await l.createWritable();if(await f.write(d),await f.close(),this._handleCache.set(c,l),c instanceof H){let e=await Promise.resolve(l.getFile?.()).then(e=>e?.lastModified??null,()=>null);c.update({size:d.size,lastModified:e})}return c}catch(e){if(e?.name===`AbortError`)return null;if(e instanceof h)throw e}let u=t.getPath(),d=u?u.split(/[/\\]/).pop():null,f=d&&r.exts.some(e=>e.toLowerCase()===K(d))?d:n,p=u!==f||t.canWrite()?new H(f,{format:r.key,canWrite:!1}):t,m=await i(r.key,p);if(!m)return null;let g=new Blob([Et(m)],{type:r.mimeType||`application/octet-stream`});return function(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.style.display=`none`,r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}(g,f),p instanceof H&&p.update({size:g.size}),p}};function Tt(e){return e.map(e=>{let t=e.mimeType&&e.mimeType.includes(`/`)?e.mimeType:`application/octet-stream`;return{description:e.description??e.key,accept:{[t]:e.exts.map(e=>`.`+e)}}})}function G(e){return!!e&&e.kind===`file`&&typeof e.getFile==`function`}function Et(e){if(typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}return e}function K(e){let t=e.lastIndexOf(`.`);return t>=0?e.slice(t+1).toLowerCase():``}(yt||={}).SortOn={Value:`value`,FillColor:`fillColor`,FontColor:`fontColor`,Icon:`icon`};var Dt={TopLeft:`tl`,Top:`t`,TopRight:`tr`,Left:`l`,Center:`ctr`,Right:`r`,BottomLeft:`bl`,Bottom:`b`,BottomRight:`br`},q=oe.BuiltInName;q.Normal,a(`style.builtin.normal`),q.Comma,a(`style.builtin.comma`),q.Currency,a(`style.builtin.currency`),q.Percent,a(`style.builtin.percent`),q.Comma0,a(`style.builtin.comma0`),q.Currency0,a(`style.builtin.currency0`),q.Hyperlink,a(`style.builtin.hyperlink`),q.FollowedHyperlink,a(`style.builtin.followedHyperlink`),q.Note,a(`style.builtin.note`),q.WarningText,a(`style.builtin.warningText`),q.Title,a(`style.builtin.title`),q.Input,a(`style.builtin.input`),q.Output,a(`style.builtin.output`),q.Calculation,a(`style.builtin.calculation`),q.CheckCell,a(`style.builtin.checkCell`),q.LinkedCell,a(`style.builtin.linkedCell`),q.Total,a(`style.builtin.total`),q.Good,a(`style.builtin.good`),q.Bad,a(`style.builtin.bad`),q.Neutral,a(`style.builtin.neutral`),q.ExplanatoryText,a(`style.builtin.explanatoryText`),a(`style.builtin.heading`),a(`style.builtin.accent`),a(`style.builtin.accentTint`);var Ot,kt,At,jt,Mt=(e,t,n,r,i)=>{let a=JSON.parse(JSON.stringify(e.definition));a.adjs||=[];let o=``,s=0,c=0;t>0?(c=t,s=100-t,o=_(`op.lighterPercent`,{percent:t})):t<0&&(s=100+t,o=_(`op.darkerPercent`,{percent:-t})),s&&a.adjs.push({[ae.AdjustmentType.LumMod]:s}),c&&a.adjs.push({[ae.AdjustmentType.LumOff]:c});let l=new ce({val:a.val,adjs:a.adjs},n),u=l.toString();r?.set(u,l);let d=l.toRGBA().toString();return i?.set(d,l),{description:e.description+`, `+o,definition:a}};function Nt(e,t,n,r){let i=[];for(let a=0;a<e.length;a++){let o=[];i.push(o);let s=i=>{for(let s=0;s<i.length;s++)o.push(Mt(e[a],i[s],t,n,r))},c=new ce({val:e[a].definition.val,adjs:e[a].definition.adjs},t).toHSLA().lum;s(c===0?[50,35,25,15,5]:c===100?[-5,-15,-25,-35,-50]:c<=20?[90,75,50,25,10]:c>=80?[-10,-25,-50,-75,-90]:[80,60,40,-25,-50])}return i}(Ot||={}).buildPalette=Nt,kt||={},At||={},jt||={};var Pt;function Ft(e){return be.peek()?.readFormulaLiteral(e)}function It(e,t){let n=Lt(e),r=Lt(t);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:k.isError(e)&&k.isError(t)?e.getCode()-t.getCode():0:n-r}function Lt(e){if(e===null)return 0;switch(typeof e){case`number`:return 1;case`string`:return 2;case`boolean`:return 3;default:return k.isError(e)?4:5}}(function(e){function t(e){return be.peek()?.getFunctionDeclaration(e)??null}e.get=t,e.has=function(e){return t(e)!==null}})(Pt||={});var Rt=class{constructor(e){this._children=e}getCoords(){let e=this._children,t=null;for(let n=0;n<e.length;n++){let r=e[n].getCoords();r&&(t=t?{rowStart:Math.min(t.rowStart,r.rowStart),colStart:Math.min(t.colStart,r.colStart),rowEnd:Math.max(t.rowEnd,r.rowEnd),colEnd:Math.max(t.colEnd,r.colEnd)}:r)}return t}getSize(){let e=this._children,t=e.length,n=0;for(let r=0;r<t;r++)n+=e[r].getSize();return n}getCount(){let e=this._children,t=e.length,n=0;for(let r=0;r<t;r++)n+=e[r].getCount();return n}getAggregates(e){if(e)return this._mergeAggregates(e);let t=this._aggregates;return t||(t=this._mergeAggregates(),this._aggregates=t),t}getSnappedSum(e){let t=e??this.getAggregates().sum??0,n=this._children;for(let e=n.length-1;e>=0;e--)if(n[e].getAggregates().numericalCount>0)return n[e].getSnappedSum(t);return t}getSortedNumbers(){let e=this._sortedNumbers;if(!e){let t=this._children,n=t.length,r=[];for(let e=0;e<n;e++){let n=t[e].getSortedNumbers().getValues();n.length>0&&r.push(n)}e=new Be(function(e){let t=e.length;if(t===0)return zt;if(t===1)return e[0];let n=e[0];for(let r=1;r<t;r++)n=Bt(n,e[r]);return Object.freeze(n)}(r)),this._sortedNumbers=e}return e}getRanked(e){return $e(this._children,e,It)[Symbol.iterator]()}getFrequencies(e){if(e)return this._mergeFrequencies(e);let t=this._frequencies;return t||(t=this._mergeFrequencies(),this._frequencies=t),t}_mergeFrequencies(e){let t=e?.keyFn??he,n=e?.limit,r=new Map,i=this._children,a=i.length,o=0,s=0,c=!1;for(let l=0;l<a;l++){let a=i[l].getFrequencies(e);o+=a.getVisitedCount(),s+=a.getTotalCount(),c||=a.isTruncated();let u=a.getValueCounts(),d=u.next();for(;!d.done;){let[e,i]=d.value,a=t(e),o=r.get(a);o?o.count+=i:n===void 0||r.size<n?r.set(a,{value:e,count:i}):c=!0,d=u.next()}}return Ue.fromGroups(r,t,e,It,o,s,c)}getTypedCounts(e){let t=this._typedCounts;if(!t){let e={[A.Number]:0,[A.String]:0,[A.Boolean]:0,[A.Error]:0,[A.RichData]:0,[A.Null]:0},n=this._children,r=n.length;for(let t=0;t<r;t++){let r=n[t].getTypedCounts();e[A.Number]+=r[A.Number]??0,e[A.String]+=r[A.String]??0,e[A.Boolean]+=r[A.Boolean]??0,e[A.Error]+=r[A.Error]??0,e[A.RichData]+=r[A.RichData]??0,e[A.Null]+=r[A.Null]??0}t=Object.freeze(e),this._typedCounts=t}if(e===void 0)return t;let n={},r=e.length;for(let i=0;i<r;i++)n[e[i]]=t[e[i]]??0;return n}get isIRangeStats(){return!0}_mergeAggregates(e){let t=this._children,n=t.length,r={count:0,min:void 0,max:void 0,numericalCount:0,sum:0,sumSq:0,typed:{[A.Number]:0,[A.String]:0,[A.Boolean]:0,[A.Error]:0,[A.RichData]:0,[A.Null]:0}};for(let i=0;i<n;i++){let n=t[i].getAggregates(e);r.count+=n.count;let a=n.numericalCount;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))}return rt(r)}},zt=Object.freeze([]);function Bt(e,t){let n=e.length,r=t.length,i=Array(n+r),a=0,o=0,s=0;for(;a<n&&o<r;)i[s++]=e[a]<=t[o]?e[a++]:t[o++];for(;a<n;)i[s++]=e[a++];for(;o<r;)i[s++]=t[o++];return i}var J,Y=class e{constructor(e,t){this._source=null,this._fresh=new WeakSet,this._unwatch=null,this.cacheId=e,this._store=t,this._fresh.add(t.get())}static dataOf(t,n){let r=e.modelOf(t);return{part:j.fromJSON(t.part,n),model:r,partFormats:!r&&t.partFormats?t.partFormats:null,source:!r&&t.source?t.source:null}}static modelOf(e){if(!e.fields)return null;let{cacheId:t,part:n,partFormats:r,...i}=e;return i}get part(){return this._store.get().part}get _model(){return this._store.get().model}_getData(){return this._store.get()}_replace(e){let t={part:null,model:e,partFormats:null,source:null};this._store.set(t),this._fresh.add(t)}_restate(e){let t=this._fresh.has(this._store.get()),n={part:null,model:e,partFormats:null,source:null};this._store.set(n),t&&this._fresh.add(n)}_hold(e,t){if(this._source)return;let{ref:n,sheet:r,name:i}=this._sourceAsRead()??{},a=null,o=null;if(n&&r&&!n.includes(`#REF!`)?(a=e(r),o=`${it(r)}!${at(n)}`):!i||n||r?i&&r&&!n&&(a=e(r),o=`${it(r)}!${i}`):(a=t(i),o=`${i}[#All]`),!a||!o)return;let s={formula:null,wired:null,last:null};this._source=s,a(o,e=>{s.formula=e.formula;let t=e.formula.getExpression();s.wired??=t,e.formula.hasRefError()||(s.last=t)})}_sourceAsRead(){let e=this._model?.source??this._store.get().source;return e?{ref:e.ref??null,sheet:e.sheet??null,name:e.name??null}:null}_watchSource(e,t,n){if(this._unwatch)return;let{ref:r,sheet:i,name:a}=this._sourceAsRead()??{},o=null,s=null;if(r&&i&&!r.includes(`#REF!`)?s=e(i,r):a&&!r&&(o=i?null:t(a),s=o?.getRange()??n(a,i??null)),!s||s.isInvalid())return;let c=e=>`${e.getRowCount()}x${e.getColumnCount()}`,l=c(s),u=[],d=()=>{this._fresh=new WeakSet},f=e=>{let t=l;return l=c(e),l!==t};u.push(s.addListener(e=>{if(e.getTrigger()===`data`)return void(e.getCommit()!==null&&d());let t=e.getSource();(t.isInvalid()||f(t))&&d()},{transactional:!1})),o&&u.push(s.getWorksheet().addListeners({onTablesChange:()=>{!o.isDeleted()&&f(o.getRange())&&d()}})),this._unwatch=()=>{this._unwatch=null;for(let e of u)e()}}_isStale(){return!this._fresh.has(this._store.get())}_moved(){let e=this._source;if(!e?.formula)return null;let t=e.formula.hasRefError()?e.last:e.formula.getExpression();if(t===null||t===e.wired)return null;let n=this._sourceAsRead();if(n?.name&&n.sheet){let e=N(t)?.sheet;return e?{sheet:e}:null}let r=/^(.+)\[#All\]$/.exec(t)?.[1];if(r)return{name:r};let i=N(t);return i?{name:null,ref:ze(i.reference),sheet:i.sheet}:{ref:ze(t)}}_getSource(){let e=this._sourceAsRead();if(!e)return null;let t={};e.ref&&(t.ref=e.ref),e.sheet&&(t.sheet=e.sheet),e.name&&(t.name=e.name);let n=this._moved();if(n)for(let e of[`ref`,`sheet`,`name`]){let r=n[e];r===null?delete t[e]:r!==void 0&&(t[e]=r)}return t}toJSON(e){let t={cacheId:this.cacheId},n=j.toJSON(this.part,e);if(n){t.part=n;let e=this._store.get().partFormats;e&&(t.partFormats=e)}let r=this._model;r&&Object.assign(t,r);let i=this._getSource();return i&&(t.source=i),t}},Vt=class{constructor(e,t){this._deleted=!1,this._json={...e},this._deleteFromCollection=t??null}getId(){return this._json.id}getDisplayName(){return this._json.displayName}getUserId(){return this._json.userId??null}getProviderId(){return this._json.providerId??null}delete(){this._deleted||(this._deleted=!0,this._deleteFromCollection?.(this))}isDeleted(){return this._deleted}toJSON(){return{...this._json}}get[Symbol.toStringTag](){return`[Person]`}toString(){return`Person:${this.getDisplayName()}`}get isIPerson(){return!0}},Ht=class extends Ne{constructor(e){super(),this._byId=new Map,this._byDisplayName=new Map,this._items=null,this._current=null,e&&this.fromJSON(e)}_getItems(){return this._items??=Array.from(this._byId.values())}getCount(){return this._byId.size}add(e){let t=typeof e==`string`?{displayName:e}:e,n=t.id;if(n){let e=this._byId.get(n);if(e)return e}let i=t.displayName??``;if(!n){let e=this._byDisplayName.get(i);if(e)return e}let a=new Vt({...t,displayName:i,id:n??r.uuidV4().toUpperCase()},e=>this._remove(e));return this._byId.set(a.getId(),a),i&&!this._byDisplayName.has(i)&&this._byDisplayName.set(i,a),this._items=null,this._notifyCollectionChange(),a}getById(e){return typeof e==`string`?this._byId.get(e)??null:null}getByDisplayName(e){return typeof e==`string`?this._byDisplayName.get(e)??null:null}getCurrent(){return this._current??=this.add(`Author`)}setCurrent(e){if(e!==null){if(typeof e==`object`&&e.isIPerson){let t=e;this._current=this.getById(t.getId())??this.add(t.toJSON());return}this._current=this.add(e)}else this._current=null}_remove(e){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())}toJSON(){return this._byId.size===0?null:this._getItems().map(e=>e.toJSON())}fromJSON(e){if(!e)return;let t=e.length;for(let n=0;n<t;n++){let t=e[n];t&&typeof t.id==`string`&&this.add(t)}}get isIPersonCollection(){return!0}},Ut=(e,t)=>{let n=[0];for(let t=0;t<e.length;t++)e[t]===`
3
+ `&&n.push(t+1);let r=t.map(e=>` ${(e=>{let t=0,r=n.length-1;for(;t<r;){let i=t+r+1>>1;n[i]<=e?t=i:r=i-1}return`${t+1}:${e-n[t]+1}`})(e.start)} ${e.code}: ${e.message}`),i=t.length;return`Script has ${i} compile error${i===1?``:`s`}:\n${r.join(`
4
+ `)}`},Wt=class{constructor(e){this._options=e,this._emitter=new b(this),this._initState()}_initState(){}getModules(){return this._modules}_builtInNames(){try{let e=this._options.getBuiltInFunctions?.();if(!e)return r.EmptyArray;let t=[];for(let n of e.getItems({includeHidden:!0}))n.isBuiltIn()&&t.push(n.getName());return t}catch{return r.EmptyArray}}async createModule(t){let n=await(await e(async()=>{let{ScriptCompiler:e}=await import(`./BNjmzbnQlBmX-HPQ.js`);return{ScriptCompiler:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ScriptCompiler.compile({builtInNames:this._builtInNames(),minify:!0,...t});return n.module?await B(ke.DEFAULT_MODULE,n.module,t?.declarationsOnly??!1,n.diagnostics):null}addModule(e,t,n){this._modules.add(e,t,n)}async addModuleFromJSON(e,t,n){let r=await B(e,t);return this.addModule(e,r,n),r}async executeMacro(e,t,n){await z.assertUsable(`scripts`);let r=this._modules.getItems({name:t}),i=r.length;for(let t=0;t<i;t++){let i=r[t].getFunctions().getByName(e);if(i)return i.execute(this._options.workbook,{applyResult:!0,...n})}throw Error(`No macro ${e} found.`)}async run(e,t){try{await z.assertUsable(`scripts`);let n=typeof e==`string`?await this.createModule({source:e}):await B(ke.DEFAULT_MODULE,e),r=typeof e==`string`?e:e?.source??``;return await this._runModule(n,r,t)}catch(e){return{ok:!1,error:e}}}async _runModule(e,t,n){let r=this._options?.workbook;if(!e)return{ok:!1,error:Error(`The script did not compile to a module.`)};let i=e.getDiagnostics(),a=i.filter(e=>e.severity===`error`);if(a.length>0){let e=Error(Ut(t,a));return e.diagnostics=a,{ok:!1,error:e,diagnostics:i}}let o=e.getFunctions(),s=o.getItems({type:`autoRun`,includeHidden:!0})[0]??o.getItems({type:`macro`,includeHidden:!0})[0]??null;if(!s)return{ok:!1,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)`).")};let c=await s.execute(r,n);return{ok:!0,result:c?.results,commitId:c?.commitId,diagnostics:i}}_searchable(e){let t=this._modules;return t&&t.getCount()!==0?(e?t.getItems({name:e}):t.getItems()).map(e=>e.getFunctions()):r.EmptyArray}async searchFunctions(e){await this._emitter.notify(`onBeforeSearch`,{async:!0});let t=this._searchable(e?.moduleName);if(t.length===0)return r.EmptyArray;if(t.length===1)return t[0].search(e);let n=e?.limit,i=n===void 0?e:{...e,limit:void 0},a,o=new Set;for(let e=0;e<t.length;e++){let n=await t[e].search(i);if(n.length!==0){a||=[];for(let e=0;e<n.length;e++){let t=n[e],r=t.getName().toUpperCase();o.has(r)||(o.add(r),a.push(t))}}}if(!a||a.length===0)return r.EmptyArray;let s=e?.text?e.text.trim().toUpperCase():null;return s?ot(a,s):a.sort((e,t)=>{let n=e.getName().toUpperCase(),r=t.getName().toUpperCase();return n<r?-1:+(n>r)}),n!==void 0&&a.length>n?a.slice(0,n):a}async start(){return this._startPromise||(this._startPromise=this._doStart(),this._startPromise.catch(()=>{this._startPromise=void 0})),this._startPromise}_load(){return this._loadPromise||(this._loadPromise=this._doLoad(),this._loadPromise.catch(()=>{this._loadPromise=void 0})),this._loadPromise}async _doStart(){await this._load();let e=this._options?.workbook,t=this._modules.getItems(),n=t.length;for(let r=0;r<n;r++){let n=t[r];try{let t=n.getFunctions().getItems({type:`autoRun`,includeHidden:!0}),r=t.length;for(let n=0;n<r;n++)await t[n].execute(e)}catch(e){m.error(`Error executing autoRun script:`,e)}}}async _doLoad(){let e=this._options?.workbook,t=this._options?.json,n={};if(t){let r=Object.keys(t);for(let i=0;i<r.length;i++){let a=r[i],o=t[a];try{n[a]=await B(a,o,!1,[],o?.scope===`workbook`?e:null)}catch(e){m.error(`Could not load script '${a}'; it will be unavailable.`,e)}}}let r=this,i=new qe({transactions:this._options?.transactions,initial:n,isReadOnly:()=>r.isReadOnly(),onRemove:(e,t)=>{r._options?.onRemove?.(e,t)},onAdd:(e,t)=>{r._emitter.notify(`onChange`),r._options?.onAdd?.(e,t)}});this._modules=i}addListeners(e,t){return this._emitter.addListeners(e,t)}isReadOnly(){return this._options.workbook?._isStructureProtected?.()??!1}toJSON(){this._emitter.notify(`onBeforeSave`);let e=this._modules;if(!e)throw Error(`Scripts is initializing.`);return e.toJSON()}get isIScript(){return!0}},Gt=/^([a-z][a-z0-9+.-]*):/i,Kt=e=>{let t=e.toLowerCase();return t.endsWith(`:`)?t:t+`:`},qt=async(e,t)=>{try{return await globalThis.fetch(e,t)}catch(n){throw n instanceof TypeError&&await(async(e,t)=>{let n=globalThis.location;if(!n||t?.method&&t.method.toUpperCase()!==`GET`)return!1;let r=new AbortController,i=setTimeout(()=>r.abort(),5e3);try{return new URL(e,n.href).origin!==n.origin&&(await globalThis.fetch(e,{mode:`no-cors`,credentials:`omit`,signal:r.signal}),!0)}catch{return!1}finally{clearTimeout(i),r.abort()}})(e,t)?new k.Blocked(`This site is restricted: it doesn't allow web apps to read its data, so the browser blocked the request for security.`,{cause:n}):n}},Jt=class{constructor(){this._handlers=new Map([[`http:`,qt],[`https:`,qt]])}fetch(e,t){let n=Gt.exec(e)?.[1],r=this._handlers.get(n?Kt(n):`https:`);if(!r)return Promise.reject(TypeError(`No fetcher serves '${n}:'.`));try{return r(e,t)}catch(e){return Promise.reject(e)}}register(e,t){let n=Kt(e),r=this._handlers.get(n);return this._handlers.set(n,t),()=>{this._handlers.get(n)===t&&(r?this._handlers.set(n,r):this._handlers.delete(n))}}get isIFetcher(){return!0}},Yt=new Set([101,103,204,205,304]),X=e=>new Response(Yt.has(e.status)?null:e.body,{status:e.status,statusText:e.statusText,headers:e.headers}),Xt=class{constructor(e,t){this._kept=new Map,this._cached=new Map,this._inFlight=new Map,this._resources=e,this._fetcher=t}getFetcher(){return this._fetcher}async fetch(e,t){if((e=>!e||(!e.method||e.method.toUpperCase()===`GET`)&&!e.body)(t)&&t?.cache!==`reload`){let n=this._kept.get(e)??this._findHeld(e);if(n&&!n.isClosed())return this._fromKept(n);let r=this._cached.get(e);if(r)return X(r);let i=this._inFlight.get(e);return i||(i=this._request(e,{...t,signal:void 0}).finally(()=>{this._inFlight.delete(e)}),this._inFlight.set(e,i)),X(await((e,t)=>t?t.aborted?Promise.reject(t.reason):new Promise((n,r)=>{let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>t.removeEventListener(`abort`,i))}):e)(i,t?.signal))}return X(await this._request(e,t))}adopt(e){for(let t of e){let e=t.getFetchedFrom();e&&!t.isClosed()&&this.keep(e,t)}}keep(e,t){let n=this._kept.get(e);n!==t&&(t.addReference(this),this._kept.set(e,t),n&&!n.isClosed()&&n.deleteReference(this))}_findHeld(e){for(let t of this._resources.getItems())if(t.getFetchedFrom()===e&&!t.isClosed())return this.keep(e,t),t;return null}async _fromKept(e){let[t,n]=await Promise.all([e.toBuffer(),e.getType()]);return X({status:200,statusText:`OK`,headers:n?[[`content-type`,n.mime]]:[],body:t})}async _request(e,t){let n=await this._fetcher.fetch(e,t),r=Yt.has(n.status)?null:await n.arrayBuffer(),i=[];n.headers.forEach((e,t)=>{i.push([t,e])});let a={status:n.status,statusText:n.statusText,headers:i,body:r};if(n.ok&&r&&r.byteLength>0){let t=await new Xe({source:{buffer:r}}).getType();t?.mime.startsWith(`image/`)?(a.headers=i.filter(([e])=>e.toLowerCase()!==`content-type`),a.headers.push([`content-type`,t.mime])):this._cached.set(e,a)}return a}},Zt=class{constructor(e,t,n,r){this._mergedReading=[],this._colsReading=[],this._rowsReading=[],this._styles=n,this._topLeft=t??o.EmptyCell,this._sheet=new V({runtime:e,styles:this._styles,calcOnLoad:`none`,container:{getName:()=>r,getIndex:()=>1}}),this._builder=this._sheet.getEntireRange().createSparseBuilder()}applyCSSStyle(e,t){let n=!1;e.style||(e.style={},n=!0);let r=e.style,i={...t};if(t.msoIgnore){let e=t.msoIgnore.split(`,`),n=Object.keys(i);for(let t=0;t<n.length;t++){let r=n[t];e.includes(r)&&delete i[r]}}let a=le(i.fontFamily);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;let o=te(i.textDecoration);r.font.underline=o.underline,r.font.strike=o.strike?w.StrikeStyle.Single:w.StrikeStyle.None,i.textUnderlineStyle&&(r.font.underline=ne(i.textUnderlineStyle)),r.alignment={},i?.textAlign&&(r.alignment.horizontal=C(i.textAlign)),i?.textAlign&&!r.alignment.horizontal&&i?.textAlign!==`general`&&(i.textAlign===`center-across`?r.alignment.horizontal=O.HorizontalAlignment.CenterContinuous:i.textAlign===`fill`?r.alignment.horizontal=O.HorizontalAlignment.Fill:i.textAlign===`121`||i.textAlign===`010`?(r.alignment.horizontal=O.HorizontalAlignment.Distributed,r.alignment.justifyLastLine=i.textAlign===`121`):console.warn(`unknown text-align`,i.textAlign)),i.verticalAlign&&(i.verticalAlign.toLowerCase()===`super`?r.font.baseline=E.Baseline.Superscript:i.verticalAlign.toLowerCase()===`sub`?r.font.baseline=E.Baseline.Subscript:r.alignment.vertical=se(i.verticalAlign),r.alignment.vertical||(i.verticalAlign===`121`?r.alignment.vertical=O.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`?O.Overflow.Visible:O.Overflow.Wrap),i.msoTextControl===`shrinktofit`&&(r.alignment.overflow=O.Overflow.Shrink);let s=null;if(i.background?s=i.background:i.backgroundColor&&(s=i.backgroundColor),s&&(r.fill={color:s}),i.msoPattern){let e=ue(i.msoPattern);e&&(e.patternType===re.BuiltInSheetPattern.Solid?r.fill={color:e.foreground}:e.patternType!==re.BuiltInSheetPattern.None&&(s&&(e.background=s),r.fill=e))}i.layoutFlow===`vertical`||i.layoutFlow===`vertical-ideographic`?r.alignment.stacked=!0:i.msoRotate!==void 0&&(r.alignment.rotation=ie(i.msoRotate));let c=(e,t)=>{e&&(r.borders||={},r.borders[e]=t)};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);let l=r.numberFormat;i.msoNumberFormat&&(l=ee(i.msoNumberFormat),l.includes(`\\`)?l=null:l===`Fixed`?l=D.Styles.lookupStyle(r.numberFormat).formatType===D.Type.Number?null:D.Type.Number:l===`Percent`&&(l=D.Styles.lookupStyle(r.numberFormat).formatType===D.Type.Percentage?null:D.Type.Percentage)),l&&(r.numberFormat=l),e.style=this._styles.normalize(r),n&&Object.keys(e.style).length===0&&delete e.style}onCell(e,t,n,r,i){let a=r(i),s={value:t===void 0?n??``:t};if(typeof s.value==`string`&&s.value.length===0&&(s.value=void 0),a&&this.applyCSSStyle(s,a),typeof s.value==`string`&&/^#+$/.test(s.value)){let e=s.style?.numberFormat;e&&(de(e)||T(e))&&(s.value=k.BuiltIn.Num)}if(i?.tagName.toUpperCase()===`TD`){let e=s.style,t=e?.font??{};(i.querySelectorAll(`s`).length>0||i.querySelectorAll(`strike`).length>0)&&(t.strike=w.StrikeStyle.Single),i.querySelectorAll(`sub`).length>0&&(t.baseline=E.Baseline.Subscript),i.querySelectorAll(`sup`).length>0&&(t.baseline=E.Baseline.Superscript),(i.querySelectorAll(`b`).length>0||i.querySelectorAll(`strong`).length>0)&&(t.weight=700),i.querySelectorAll(`i`).length>0&&(t.style=w.Style.Italic),i.querySelectorAll(`u`).length>0&&(t.underline=w.UnderlineStyle.Single),Object.keys(t).length>0&&(e||(e={},s.style=e),e.font||(e.font=t));let n=i.querySelectorAll(`a`);if(n.length>0){let e=n[0].getAttribute(`href`);e&&(s.hyperlink=e)}}if(!o.isSingleCell(e)){let t={rowStart:this._topLeft.rowIndex+e.rowStart,colStart:this._topLeft.colIndex+e.colStart,rowEnd:this._topLeft.rowIndex+e.rowEnd,colEnd:this._topLeft.colIndex+e.colEnd};this._mergedReading.push(t)}if(s.value===void 0&&!s.style&&Object.keys(s).length<=1)return;let c=this._builder,l=this._topLeft;if(c.pushAt(l.rowIndex+e.rowStart,l.colIndex+e.colStart,s),!o.isSingleCell(e)&&a.msoIgnore){if(a.msoIgnore.includes(`colspan`)){let t={};a&&this.applyCSSStyle(t,a);let n=e.colEnd-e.colStart,r=l.rowIndex+e.rowStart;for(let i=1;i<=n;i++)c.pushAt(r,l.colIndex+e.colStart+i,t);e={...e,colEnd:e.colStart}}a.msoIgnore.includes(`rowspan`)&&(e={...e,rowEnd:e.rowStart})}}onNoTable(e,t,n){this.onCell({rowStart:this._topLeft.rowIndex,colStart:this._topLeft.colIndex,rowEnd:this._topLeft.rowIndex,colEnd:this._topLeft.colIndex},e,null,t,n)}onRowStart(e,t,n,r){let i=n(r);if(i.msoHeightSource!==`userset`||!r)return;let a=r.getAttribute(`height`)??i.height,o=null;if(a&&(o=S(a,this._styles.getNormal().getFont().getSize(),`px`)),o===null)for(let e=0;e<r.cells.length;e++){let t=r.cells[e],i=t.getAttribute(`height`)??n(t).height,a=S(i,this._styles.getNormal().getFont().getSize(),`px`);a!==null&&(o=Math.max(a,o??0))}o!==null&&this._rowsReading.push({address:{min:this._topLeft.rowIndex+e,max:this._topLeft.rowIndex+e+t-1},update:{size:o*w.getDeviceScale()}})}onColumn(e,t,n,r){let i=n(r);if(i.msoWidthSource!==`userset`||!r)return;let a=r.getAttribute(`width`)??i.width,o=null;a&&(o=S(a,this._styles.getNormal().getFont().getSize(),`px`)),o!==null&&this._colsReading.push({address:{min:this._topLeft.colIndex+e,max:this._topLeft.colIndex+e+t-1},update:{size:o*w.getDeviceScale()}})}onDone(){this._colsReading.length>0&&this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading),this._rowsReading.length>0&&this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading),this._sheet.doBatch(()=>{this._builder.apply()}),this._mergedReading.length>0&&this._sheet.getRanges(this._mergedReading).merge()}sheet(){return this._sheet}},Qt=class{constructor(e){if(!e)throw new s(`snapshot is required.`);this._snapshot=e}getItemType(){return`range`}getItem(){return this._snapshot}editMode(){return this._snapshot?.getMarkOptions().editMode??null}isCut(){return this._snapshot?.getMarkOptions().isCut??!1}getName(){return this._snapshot.getName()}toText(){return this._snapshot.toText()}toHtml(){return this._snapshot.toHtml()}toImage(){return this._snapshot.toImage()}get isClipboardItem(){return!0}},$t=class{constructor(e,t,n,r,i){if(this._parsed=void 0,this._runtime=e,!t)throw new s(`nativeItems are required.`);this._topLeft=n??o.EmptyCell,this._native=t,this._markOptions=Object.freeze(r??{}),this._styles=i}getItemType(){return`range`}isCut(){return!1}toText(){return this._native?.text}toHtml(){return this._native?.html?.documentElement.outerHTML||null}toImage(){return this._native?.image}getItem(){let e=this._parsed;if(e===void 0)throw Error(`Must call 'parse()' before getItem().`);if(e===null)return null;if(this._snapshot)return this._snapshot;let t=this;return this._snapshot={prepare:(n,r)=>e.prepare?.(n,{...t._markOptions,...r}),copyTo:(n,r)=>e.copyTo(n,{...t._markOptions,...r}),getMarkOptions:()=>t._markOptions,getName:()=>e?.getName()??`Clipboard Data`,getCoords:()=>e?.getCoords?.()??null,toText:()=>t.toText(),toHtml:()=>t.toHtml(),toImage:()=>t.toImage(),getSource:()=>e?.getSource?.()??null,isISnapshot:!0},this._snapshot}async parse(){let e,t=this._native?.text,n=this._native.html;if(n===null&&t&&t.includes(`<table`))try{let e=new DOMParser().parseFromString(t,p.Html),r=e.querySelector(`parsererror`);if(r)throw new h(`Unable to parse: `+r);n=e,t=null}catch{console.warn(`Discovered text as html table but could could not parse.`)}try{let r=new Zt(this._runtime,this._topLeft,this._styles,n?`HTML`:`Text`),i=await Promise.resolve(t?lt(t):[[]]),a;if(Oe(n,i,r)?(e=r.sheet(),a=e.getUsedRange()):n=null,a){let t=a.getSnapshot();return this._parsed={prepare:(e,n)=>t.prepare?.(e,n),copyTo:(e,n)=>t.copyTo(e,n),getCoords:()=>a.getCoords(),getSource:()=>e,getName:()=>e.getName()},!0}}catch(e){throw e}if(!t&&!n&&this._native.image){let e=await this._native.image.arrayBuffer(),t=i.getPngStatedSize(e),n=null;return this._parsed={async prepare(r){let i=r.getWorksheet();n={sheet:i,options:await i.getMovables()._preparePicture({source:{buffer:e}},{type:`picture`,description:a(`op.copyImageFromClipboard`),autoSelect:!0,...t&&{bounds:t}})}},copyTo(e,t){let r=e.getWorksheet();if(n?.sheet!==r)throw Error(`The image was not prepared for this sheet.`);return r.getMovables()._insertNow(n.options),null},getName:()=>`Image`},!0}return this._parsed=null,!1}get isClipboardItem(){return!0}},en=class{constructor(e){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 b(this,this._transactions)}getKind(){return this._kind}getId(){return this._id}getName(){return this._container.getName()}setName(e,t){return this._assertOpen(),this._container.setName(e,t),this}getVisibility(){return this._closed?I.Visibility.VeryHidden:this._container.getVisibility()}setVisibility(e=!0,t){let n;return this._assertOpen(),n=!0===e?I.Visibility.Visible:!1===e?I.Visibility.Hidden:e,this._container.setVisibility(n,t),this}getIndex(){return this._container.getIndex()}setIndex(e,t){return this._assertOpen(),this._container.setIndex(e,t),this}getTabColor(){return this._tabColor}setTabColor(e){return this._assertOpen(),this._tabColor=typeof e==`string`?this._styles.parseColor(e):e??null,this._notify(`onTabColorChange`),this}getWorkbook(){return this._workbook}async select(e){return await this._container.requestSelect(e),this}delete(){if(this._closed)return;let e=this._transactions.beginCommit({description:_(`op.deleteSheet`,{name:this.getName()})});try{try{this._notify(`onBeforeDelete`)}catch(e){throw e instanceof Error?e:new h(e?.message??_(`error.sheet.modelDelete`))}this._notify(`onDelete`),e.commit()}catch(t){throw e.rollback(),t}}isDeleted(){return!this._container.isAttached()}addListeners(e,t){return this._emitter.addListeners(e,t)}close(){this._closed||=(this._notify(`onClose`),this._emitter.close(),!0)}isClosed(){return this._closed}_getPart(){return this._part}_notify(e){this._emitter.notify(e)}_assertOpen(){if(this._closed)throw Error(_(`error.sheet.modelClosed`))}get[Symbol.toStringTag](){return`[OpaqueSheet]`}toString(){return`[${this.getName()??`(untitled)`}]`}get isISheet(){return!0}get isIOpaqueSheet(){return!0}};(J||={}).Visibility={Visible:`visible`,Hidden:`hidden`,VeryHidden:`veryHidden`};var Z,Q={showFormulaBar:!0,showTabs:!0,tabRatio:600,showHorizontalScrollbar:!0,showVerticalScrollbar:!0,showStatusBar:!0,activeSheetId:0,firstTab:0,windowBounds:null,minimized:!1,visibility:J.Visibility.Visible,autoFilterDateGrouping:!0},tn=class{constructor(e){this._id=r.uuidV4(),this._emitter=new b(this),this._state={...Q},e?.json&&this._fromJSON(e?.json)}getId(){return this._id}isShowFormulaBar(){return this._state.showFormulaBar}setShowFormulaBar(e){return this._state.showFormulaBar=e,this._emitter.notify(`onViewChange`),this}isShowTabs(){return this._state.showTabs}setShowTabs(e){return this._state.showTabs=e,this._emitter.notify(`onViewChange`),this}getTabRatio(){return this._state.tabRatio}setTabRatio(e){return this._state.tabRatio=e,this._emitter.notify(`onViewChange`),this}isShowHorizontalScrollbar(){return this._state.showHorizontalScrollbar}setShowHorizontalScrollbar(e){return this._state.showHorizontalScrollbar=e,this._emitter.notify(`onViewChange`),this}isShowVerticalScrollbar(){return this._state.showVerticalScrollbar}setShowVerticalScrollbar(e){return this._state.showVerticalScrollbar=e,this._emitter.notify(`onViewChange`),this}isShowStatusBar(){return this._state.showStatusBar}setShowStatusBar(e){return this._state.showStatusBar=e,this._emitter.notify(`onViewChange`),this}getActiveSheetId(){return this._state.activeSheetId}setActiveSheetId(e){let t=this._state,n=t.activeSheetId;return t.activeSheetId=e,n!==e&&this._emitter.notify(`onViewChange`),this}getFirstTab(){return this._state.firstTab}setFirstTab(e){return this._set(`firstTab`,Math.max(0,Math.trunc(e)))}getWindowBounds(){return this._state.windowBounds}setWindowBounds(e){return this._set(`windowBounds`,e?Object.freeze({...e}):null)}isMinimized(){return this._state.minimized}setMinimized(e){return this._set(`minimized`,e)}getVisibility(){return this._state.visibility}setVisibility(e){return this._set(`visibility`,e)}isAutoFilterDateGrouping(){return this._state.autoFilterDateGrouping}setAutoFilterDateGrouping(e){return this._set(`autoFilterDateGrouping`,e)}_set(e,t){return this._state[e]===t||(this._state[e]=t,this._emitter.notify(`onViewChange`)),this}addListeners(e,t){return this._emitter.addListeners(e,t)}toJSON(){let e={},t=Object.keys(this._state),n=t.length;for(let r=0;r<n;r++){let n=t[r],i=this._state[n];i!=null&&i!==Q[n]&&(e[n]=i)}return Object.keys(e).length===0&&(e=null),e}_fromJSON(e,t=!0){let n=e||{};this.update(n,t)}update(e,t=!0){this._state={...Q,...this._state,...e},t&&this._emitter.notify(`onViewChange`)}get[Symbol.toStringTag](){return`[WorkbookView]`}toString(){let e=this.toJSON();return e?JSON.stringify(e):`DefaultWorkbookView`}get isIWorkbookView(){return!0}},nn=Object.freeze({structure:!1,windows:!1,revision:!0,password:null,revisionsPassword:null}),rn=class extends Ce{isWindowsAllowed(){return this._isPropertyAllowed(`windows`)}isRevisionAllowed(){return this.isLocked()&&this._properties?.revision===void 0?!this._isReadOnly:this._isPropertyAllowed(`revision`)}isStructureAllowed(){return this._isPropertyAllowed(`structure`)}_getAllowedKey(){return`workbook`}_fromJSON(e){this._properties=e}_toJSON(e){let t=this._properties;if(t){let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=n[i],a=t[r];a!=null&&a!==nn[r]&&(e[r]=a)}}return super._toJSON(e)}get[Symbol.toStringTag](){return`[WorkbookProtection]`}get isIWorkbookProtection(){return!0}};(Z||={}).Type={Number:`number`,Boolean:`boolean`,Date:`date`,String:`string`,Float:`float`};var an=e=>{if(typeof e==`string`)return{type:Z.Type.String,value:e};if(typeof e==`boolean`)return{type:Z.Type.Boolean,value:e};if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`A custom property value must be a finite number.`);return{type:Number.isInteger(e)&&e>=-2147483648&&e<=2147483647?Z.Type.Number:Z.Type.Float,value:e}}if(e instanceof Date){if(isNaN(e.getTime()))throw Error(`A custom property value must be a valid date.`);return{type:Z.Type.Date,value:e.toISOString()}}throw Error(`A custom property value must be a string, number, boolean or Date.`)},on=class{constructor(e,t){this._json=e,this._owner=t}getKey(){return this._json.key}getType(){return this._json.type}getLinkTarget(){return this._json.linkTarget??null}getValue(){let{type:e,value:t}=this._json;return e===Z.Type.Date?new Date(t):t}setValue(e){this._owner._assertCustomEditable(this),this._json={...this._json,...an(e)}}delete(){this._owner._removeCustom(this)}toJSON(){return{...this._json}}},sn=class{constructor(e){this._json={},this._custom=[],this._assertOpen=e}_text(e){return this._json[e]??null}_setText(e,t){return this._assertOpen(),t==null||t===``?delete this._json[e]:this._json[e]=t,this}getAuthor(){return this._text(`author`)}setAuthor(e){return this._setText(`author`,e)}getCategory(){return this._text(`category`)}setCategory(e){return this._setText(`category`,e)}getComments(){return this._text(`comments`)}setComments(e){return this._setText(`comments`,e)}getCompany(){return this._text(`company`)}setCompany(e){return this._setText(`company`,e)}getContentStatus(){return this._text(`contentStatus`)}setContentStatus(e){return this._setText(`contentStatus`,e)}getCreationDate(){let e=this._json.creationDate;if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}getKeywords(){return this._text(`keywords`)}setKeywords(e){return this._setText(`keywords`,e)}getLastAuthor(){return this._json.lastAuthor??null}getManager(){return this._text(`manager`)}setManager(e){return this._setText(`manager`,e)}getRevisionNumber(){return this._json.revisionNumber??null}setRevisionNumber(e){return this._assertOpen(),e!=null&&Number.isFinite(e)?this._json.revisionNumber=e:delete this._json.revisionNumber,this}getSubject(){return this._text(`subject`)}setSubject(e){return this._setText(`subject`,e)}getTitle(){return this._text(`title`)}setTitle(e){return this._setText(`title`,e)}getCustom(){return this._custom.slice()}getCustomProperty(e){let t=e.toLowerCase();return this._custom.find(e=>e.getKey().toLowerCase()===t)}addCustomProperty(e,t){if(this._assertOpen(),typeof e!=`string`||e===``)throw Error(`A custom property needs a name.`);let n=this.getCustomProperty(e);if(n)return n.setValue(t),n;let r=new on({key:e,...an(t)},this);return this._custom.push(r),r}deleteAllCustomProperties(){this._assertOpen(),this._custom=[]}_assertCustomEditable(e){if(this._assertOpen(),!this._custom.includes(e))throw Error(`The custom property has been deleted.`)}_removeCustom(e){this._assertCustomEditable(e),this._custom=this._custom.filter(t=>t!==e)}fromJSON(e){let{custom:t,...n}=e??{};this._json=n,this._custom=(t??[]).map(e=>new on({...e},this))}toJSON(){let e={...this._json};return this._custom.length>0&&(e.custom=this._custom.map(e=>e.toJSON())),e}};function cn(e){return _(`error.workbook.invalidSheetKey`,{key:e})}function ln(e){return _(`error.workbook.sheetNameNotFound`,{sheetName:e})}function un(e,t){return _(t===`chart`?`error.workbook.sheetIsChart`:t===`macro`?`error.workbook.sheetIsMacro`:`error.workbook.sheetIsDialog`,{sheetName:e})}function dn(e,t){return t===`chart`?_(`error.workbook.selectedIsChart`,{sheetName:e}):t===`macro`?_(`error.workbook.selectedIsMacro`,{sheetName:e}):t===`dialog`?_(`error.workbook.selectedIsDialog`,{sheetName:e}):_(`error.workbook.noWorksheet`)}var fn=class extends Ne{constructor(e,t,n,r){super(),this._add=e,this._get=t,this._addListeners=n,this._getSelected=r}getActive(){return this._getSelected()}getAt(e){return this.getItems()[e]??null}getByIndex(e){return this.getItems()[e]??null}getAll(){return this.getItems()}add(e){return this._add(e)}_getItems(e){return this._get(e?.name,e?.visibility)}getByName(e){return this._get(e)?.[0]??null}addListeners(e,t){return this._addListeners(e,t)}get isIWorksheetCollection(){return!0}},pn=new RegExp(/[\\/\\*?:[\]]+/),mn=new RegExp(/\(((\d+)(?!.*\d))\)$/,`g`);function hn(e){let t=_(a(`workbook.defaultSheetName`),{n:e+1});return t===`workbook.defaultSheetName`?`Sheet${e+1}`:t}function gn(e,t){return{...Le,getWorksheet:()=>null,toString:()=>R(e,t)}}function _n(e,t=!1){if(!e)throw Error(_(`error.workbook.sheetNameBlank`));if(pn.test(e)){if(!t)throw Error(function(e){return e?_(`error.workbook.sheetNameInvalidCharsNamed`,{sheetName:e}):_(`error.workbook.sheetNameInvalidChars`)}(e));e=e.replace(pn,``)}if(e.length===0)throw Error(_(`error.workbook.sheetNameBlank`));let n=e.length;if(n>31){if(!t)throw Error(_(`error.workbook.sheetNameTooLong`));e=e.substring(0,31)}if(e.charAt(0)===`'`||e.charAt(n-1)===`'`){if(!t)throw Error(_(`error.workbook.sheetNameQuotes`));e=e.replace(/^'|'$/g,``)}return e}var vn=`workbook.activeSheet`,yn=class e extends Pe{constructor(e,t,n,r){super(e,t,r),this._workbook=n}getSource(){return this._workbook}_createRanges(t,n){let r=this._options;return n&&(r={...this._options,getOptions:L(this._options?.getOptions,n)}),new e(t,this._internal,this._workbook,r)}_createRange(e,t){let n=e?{...e}:null,r=this._workbook,i=n?r._getSheetRef(n.scope,I.Visibility.VeryHidden):null;if(i&&!i.sheet.isIWorksheet)throw new h(un(i.name,i.sheet.getKind()));if(!i){let e=r._anchorWorksheet();return delete n?.scope,gn(n,n?{scope:ve,...e.getEntireRange().getCoords()}:null)}let a=this._options;return t&&(a={...this._options,getOptions:L(this._options.getOptions,t)}),new bn(e,P(i.sheet),this._workbook,a)}async select(e){let t=[],n=null,r=this.getCoords();for(let e=0;e<r.length;e++){let i=r[e];i&&(n||=i.scope,i&&i.scope===n&&t.push(i))}n||=this._workbook.getWorksheet().getName();let i=this._workbook.getWorksheets().getByName(n);if(!i)return;let a=await i.getRanges(t).select(e),o=this._workbook._rangesAddressToCoords(a.getCoords());return this._createRanges(o)}addListener(e,t){if(!this.getCoords())return()=>{};let n=this._workbook._sheetToWBEvent(e);return super.addListener(n,t)}get[Symbol.toStringTag](){return`[WorkbookRanges]`}getAddress(e){let t=this._internal.getSheet(),n=t.getEntireRange().getCoords();return ge(this.getCoords(),{...n,scope:t.getName()},R,xe,e)}toString(){return this.getAddress()}},bn=class e extends pe{constructor(e,t,n,r){super(e,t,r),this._workbook=n}_createRanges(e,t){let n=this._options;return t&&(n={...this._options,getOptions:L(this._options?.getOptions,t)}),new yn(e,this._internal,this._workbook,n)}_createRange(t,n){let r=this._internal;if(!t)return We(r.getSheet(),r.getSheet().getEntireCoords());if(r.validateCoords(t),r.getSheet().isClosed())return We(null,r.getSheet().getEntireCoords(),t);let i=this._options;return n&&(i={...this._options,getOptions:L(this._options?.getOptions,n)}),new e(t,this._internal,this._workbook,i)}addListener(e,t){if(!this.getCoords())return()=>{};let n=this._workbook._sheetToWBEvent(e);return super.addListener(n,t)}get[Symbol.toStringTag](){return`[WorkbookRange]`}getAddress(e){let t=this._internal.getSheet(),n=t?.getEntireRange().getCoords()??null;return R(this.getCoords(),{...n,scope:t.getName()})}toString(){return this.getAddress()}},xn=e=>!!e&&typeof e==`object`&&typeof e.getOrigin==`function`,Sn=class{constructor(t){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 dt(()=>{let e=[];for(let t of this.getWorksheets().getItems({visibility:I.Visibility.VeryHidden}))e.push(...t.getPivotTables());return e},(e,t)=>this.doBatch(e,t)),this._people=new Ht,this._commentCollection=new ft(null,(e,t,n)=>{let r=[];for(let i of this.getWorksheets().getItems({visibility:I.Visibility.VeryHidden}))r.push(...i.getComments().getItems(e?{address:e,ignoreHidden:t,fullyContained:n}:{ignoreHidden:t,fullyContained:n}));return r},(e,t)=>this.addListeners({onSheetsChange:e.onCollectionChange?()=>{e.onCollectionChange(this._commentCollection)}:void 0},t)),this._isDate1904=!1,this._codeName=null,this._updateLinks=null,this._hiddenPivotFieldList=!1,this._documentProperties=new sn(()=>{if(this._closed)throw Error(_(`error.workbook.modelClosed`))}),this._locale=null,this._localeOverrides=null,this._startModules=new WeakSet;let n=typeof t==`string`?{origin:t}:{...t},i=n.origin;this._ownOriginProvider=!xn(i),this._originProvider=xn(i)?i:new St(typeof i==`string`?new H(null,{name:i}):i??new H(null)),delete n.origin,this._bindOrigin(this._originProvider.getOrigin()),this._listenerOriginProvider=this._originProvider.addListeners({onOriginChange:()=>this._onOriginChange()});let o=n.json;delete n.json,this._transactions=n.transactions??new x,this._id=this._transactions.create(),this._ownTransactions=!n.transactions,this._emitter=new b(this,this._transactions),this._runtime=n.runtime??new mt(`Workbook Runtime`,{isDate1904:()=>this._isDate1904,getNow:()=>this._transactions.getCurrentCommit().getTimestamp(),getLocale:()=>this._locale??we()??Qe(),getLocaleOverrides:()=>this._localeOverrides}),this._listenerLanguage=g.addChangeListener(()=>{this._closed||this._notifyAllChange()});let s=this,c=this._beginCommit({description:a(o?`op.openWorkbook`:`op.newWorkbook`)});try{this._strings=n.strings??new Te,this._ownStrings=!n.strings,this._richValues=n.richData??new Je,this._resources=n.resources??new Se,this._ownResources=!n.resources,this._fetch=new Xt(this._resources,n.fetcher??new Jt),this._createSheetName=n.createSheetNameCallback??hn;let t=n.createWorksheetCallback;t||=e=>new V(e),this._sheetOnNameChange=new Map,this._sheetOnVisibilityChange=new Map,this._sheetOnIndexChange=new Map,this._createSheet=(e,n,r,i,a,o,c)=>{let l=null,u={runtime:s._runtime,readonly:s._options.readonly??!1,disableLoadAutoFit:s._options.disableLoadAutoFit??!1,opener:s._options.opener,transactions:s._transactions,styles:s._styles,strings:s._strings,richData:s._richValues,resources:s._resources,names:s._names,workbook:s,calculation:s._calculation,resolveRange:e=>s._options.resolveRange?.(e)??s.getRange(e),container:{beforeFromJSON:t=>{l=t,s._addSheetRef({name:n,id:e,visibility:r??I.Visibility.Visible,sheetId:a,sheet:t},i)},getName:()=>{let e=s._getSheetRef(l);return e?e.name:n},setName:(e,t)=>{s._getSheetRef(l)&&s._setSheetName(l,e,t)},setNameChangeCallback:t=>{s._sheetOnNameChange.set(e,t)},getVisibility:()=>{let e=s._getSheetRef(l);return e?e.visibility:I.Visibility.Visible},setVisibility:(e,t)=>{s._setSheetVisibility(l,e,t)},setVisibilityCallback:t=>{s._sheetOnVisibilityChange.set(e,t)},duplicate:()=>s._duplicateSheet(l),getIndex:()=>{let e=s._getSheetRef(l);return e?s._getOffsetForId(e.id,s._getSheetRefs(I.Visibility.VeryHidden)):i},setIndex:(e,t)=>{let n=s._getSheetRef(l,I.Visibility.VeryHidden);return!!n&&(s._moveSheet(n,e,t),!0)},setIndexCallback:t=>{s._sheetOnIndexChange.set(e,t)},requestSelect:()=>s._requestSelect(l)}};return o&&(u.json=o),c!==void 0&&(u.uid=()=>c),l=t(u,n,i,r),l},this._namedTableSource=new je({getSheets:()=>s._sheets?s.getWorksheets().getItems({visibility:I.Visibility.VeryHidden}):r.EmptyArray,addSheetsListener:(e,t)=>s.addListeners({onSheetsChange:e},t)}),this._names=n.names??new me({addressToRanges:e=>s.getRanges(e),getCurrentScope:()=>s.getSelectedWorksheet()?.getName()??null,isReadOnly:()=>(s._options.readonly??!1)||s._isStructureProtected(),transactions:s._transactions,getSources:()=>s._calculation?[s._calculation.getNamedFormulas(),s._namedTableSource]:r.EmptyArray}),this._ownNames=!n.names,this._calculation=n.calculation??new _e({runtime:s._runtime,functions:n.functions,json:o?.calc,isNamesReadOnly:()=>s._isStructureProtected(),getActiveCell:()=>{let e=s.getSelectedWorksheet(),t=e?.getSelectedRange()?.getCoords();return e&&t?{rowIndex:t.rowStart,colIndex:t.colStart,scope:e.getId()}:null},getRange:s.getRange.bind(s),getRanges:s.getRanges.bind(s),createGraphRanges:(e,t)=>s._createGraphRanges(e,t),getSheetIndex:e=>{if(e===void 0){let e=s.getSelectedSheet();return e?this._getSheetRefs(I.Visibility.VeryHidden).findIndex(t=>t.sheet===e):-1}let t=this._getSheetRefs(I.Visibility.VeryHidden);e=e.toLowerCase();let n=t.length;for(let r=0;r<n;r++)if(t[r].name.toLowerCase()===e)return r;try{Cn.address=e;let t=this._names.getItems(Cn);if(!t||t.length===0)return-1;let n=t[0].getRanges?.()?.getCoords()?.[0]?.scope;if(!n)return-1;let r=this._getSheetRefs(I.Visibility.VeryHidden);n=n.toLowerCase();let i=r.length;for(let e=0;e<i;e++)if(r[e].name.toLowerCase()===n)return e}catch{return-1}return-1},getSheetCount:()=>s._getSheetRefs(I.Visibility.VeryHidden).length,externalBooks:o?.externalBooks,externalBookResolver:n.externalBookResolver,namedCollection:s._names,strings:s._strings,get resources(){return s._resources},fetch:(e,t)=>s._fetch.fetch(e,t),parseText:(t,n)=>(async(t,n,r)=>{let i=await e(()=>import(`./CnPgk3HcIziOcskY.js`).then(e=>v(e.default,1)),__vite__mapDeps([7,8]),import.meta.url),a=(i.default??i).parse(n,{delimiter:r?.delimiter??`,`,skipEmptyLines:!1}).data,o=a.length,s=a[o-1];s&&s.length===1&&s[0]===``&&o--;let c=0;for(let e=0;e<o;e++)a[e].length>c&&(c=a[e].length);let l=Array(o);for(let e=0;e<o;e++){let n=a[e],r=Array(c);for(let e=0;e<c;e++){let i=n[e];r[e]=i===void 0||i===``?null:Ee(t,i).value}l[e]=r}return l})(s._runtime,t,n),startFunctions:()=>s._startFunctions(),transactions:s._transactions,names:o?.names}),this._ownCalculation=!n.calculation,this._scripts=this._createScripts(o?.modules),this._ownNames=!n.names,this._options=Object.freeze({...n});let i=o?.sheets?.length?o.sheets.map(e=>e.name):[this._createSheetName(0)],a=i.map(e=>e+`-`+r.uuidV4()),l=e=>{let t=o?.sheets?.[e]?.kind;return!!t&&t!==I.Kind.Worksheet};this._calculation._setSheets(i.map((e,t)=>l(t)?[a[t],e,!0]:[a[t],e]));let u=n.calcOnLoad??`auto`,d=!1,f=(async()=>{try{if(this._ownCalculation&&u!==`none`&&(u===`full`||u===`auto`&&!0===o?.calc?.fullCalcOnLoad?await this._calculation._calculateForLoad():await this._calculation.start(),this._closed||(await this._refreshPivotCachesOnLoad(),this._closed)))return;await this._scripts.start()}finally{d=!0,this._starting=null}})();d||(this._starting=f),this._starting?.catch(()=>{}),o?this._fromJSON(o,a):(this._initState(),this._addSheet(!1,i[0],null,a[0])),this._sheets=new fn(e=>s._addSheetOptions(e),(e,t)=>{if(e){let n=this._getSheetRef(e,t);return n&&$(n)?[n.sheet]:r.EmptyArray}return this._getWorksheets(t)},(e,t)=>{let n=e.onCollectionChange,r=e.onInvalidated;return s._emitter.addListeners({onSheetsChange:n?()=>{n(s._sheets)}:void 0,onInvalidated:r?()=>{r(s._sheets)}:void 0},t)},()=>s.getSelectedWorksheet()),this._ownCalculation&&(n.calcOnLoad??`auto`)!==`none`&&(this._calculation.hydrateNames(),this._holdPivotCaches()),this._emitter.notify(`onLoad`),this._ownTransactions?c.amend():c.commit()}catch(e){throw c.rollback(),e}this._initializing=!1}_initState(){let e=this._getSheetRefs();for(let t=(e?e.length:0)-1;t>=0;t--);let t=this._options;this._isDate1904=t.runtime?.isDate1904()??!1,this._locale=null,this._localeOverrides=null,this._theme=t.theme??new He().getDefaultTheme(),this._styles=t?.styles??new De(this._theme),this._ownStyles=!t.styles,this._styles.getTheme()||this._styles.setTheme(this.getTheme()),this._activeSheetOffset=0,this.setView(new tn),this._listenerProtection?.(),this._protection=new rn(void 0,this._options.readonly??!1),this._listenerProtection=this._protection.addListeners({onChange:e=>{n._emitter.notify(`onProtectionChange`)}});let n=this;this._transactionsRemoveListener=this._transactions.addStateListener(this._id,{async onAfterStateChange(e,t,r,i,a){let o=n._view,s=a?.[vn],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;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`)},onRestoreOrRevert(){n._ownCalculation,n._emitter.notify(`onInvalidated`)}});let r=this._getState();r?.listenersSheets&&(r?.listenersSheets.forEach(e=>{e()}),r?.listenersSheets.clear()),this._updateState({sheetRefsAll:[],sheetRefsVisibleAndHidden:[],sheetRefsVisible:[],refsById:new Map,sheetsById:new Map,refsByLowerCaseName:new Map,sheetsByLowerCaseName:new Map,refsByInstance:new Map,lastId:-1,sheetsCreated:new Set,listenersSheets:new Map,pivotCacheData:new Map})}getId(){return this._id}getVersionId(){return this._transactions.getVersionId(this._id)}getName(){return this._closed?null:this._origin.getName()}getOrigin(){return this._originProvider.getOrigin()}_onOriginChange(){if(this._closed)return;let e=this._originProvider.getOrigin();if(e===this._origin)return;this._listenerOrigin?.();let t=this._lastOriginName;this._bindOrigin(e),this._emitter.notify(`onOriginChange`),this._lastOriginName!==t&&this._emitter.notify(`onNameChange`)}_bindOrigin(e){this._origin=e,this._lastOriginName=e.getName(),this._listenerOrigin=e.addListeners({onChange:()=>{if(this._closed)return;let t=e.getName();t!==this._lastOriginName&&(this._lastOriginName=t,this._emitter.notify(`onNameChange`))}})}getView(){return this._view}setView(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!e)throw new h(_(`error.sheet.emptyView`));this._listenerWorkbookView?.();let t=this,n=-1;return this._listenerWorkbookView=e.addListeners({onViewChange:e=>{let r=t._getState(),i=this._view.getActiveSheetId(),a=r.sheetRefsVisible,o=this._getOffsetForId(i,a);this._activeSheetOffset=o,t._emitter.notify(`onViewChange`),n!==i&&(t._emitter.notify(`onSelectionChange`),t._emitter.notify(`onSelectedSheetChange`)),n=i}}),this._view=e,t._emitter.notify(`onViewChange`),this}getRuntime(){return this._runtime}setDate1904(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._isDate1904===e||(this._isDate1904=e,this._emitter.notify(`onRegionalChange`)),this}getLocale(){return this._runtime.getLocale()}getPinnedLocale(){return this._locale}setLocale(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(e)try{new Intl.Locale(e)}catch{throw Error(_(`error.workbook.invalidLocale`,{locale:e}))}return this._locale===e||(this._locale=e,this._emitter.notify(`onRegionalChange`)),this}getLocaleOverrides(){return this._localeOverrides}setLocaleOverrides(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=e&&Object.keys(e).length>0?e:null;return this._localeOverrides=t,this._emitter.notify(`onRegionalChange`),this}getStyles(){return this._styles}getResources(){return this._resources}getFetcher(){return this._fetch.getFetcher()}fetch(e,t){return this._fetch.fetch(e,t)}getTransactions(){return this._transactions}getChanges(e){let t=this._transactions,[n,r]=t.getLog(e??t.getCurrentCommit(!1).getId(),2),i=[],a=this.getWorksheets().getItems({visibility:I.Visibility.VeryHidden});for(let e=0;e<a.length;e++){let t=a[e];t instanceof V&&i.push(...t._changeEventsOf(n,r??null))}return i}getStrings(){return this._strings}getExternalBooks(){return this._calculation.getExternalBooks()}getUpdateLinks(){return this._updateLinks}setUpdateLinks(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._updateLinks=e,this}getPivotTables(){return this._pivotTableCollection}getComments(){return this._commentCollection}getPeople(){return this._people}getTheme(){return this._theme}setTheme(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!e)throw new h(_(`error.workbook.notSetValue`));let t=this._theme;return this._theme=e,this.getStyles().setTheme(e),this._emitter.notify(`onThemeChange`),t}getSelectedSheetIndex(){return this._activeSheetOffset}getSelectedSheet(){let e=this._getSheetRef(this.getSelectedSheetIndex());return e?e.sheet:null}getSelectedWorksheet(){let e=this._getSheetRef(this.getSelectedSheetIndex());return e&&$(e)?e.sheet:null}getActiveSheet(){return this.getSelectedWorksheet()}getActiveWorksheet(){return this.getSelectedWorksheet()}getSheets(e){let t=this._getSheetRefs(e?.visibility??I.Visibility.Visible),n=Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[e].sheet;return n}getSheet(e){if(e===void 0)return this.getSelectedSheet();if(!e)throw Error(_(`error.workbook.sheetNameNotProvided`));let t=this._getSheetRef(e);if(!t)throw new d(ln(e));return t.sheet}getWorksheet(e,t=I.Visibility.Visible){if(typeof e==`number`)return this.getWorksheetAt(e,t);if(e===void 0)return this._requireSelectedWorksheet();if(!e)throw Error(_(`error.workbook.sheetNameNotProvided`));let n=this._getSheetRef(e,t);if(!n)throw new d(ln(e));if(!$(n))throw new d(un(n.name,n.sheet.getKind()));return n.sheet}getWorksheetAt(e,t=I.Visibility.Visible){let n=this._getWorksheets(t)[e];if(!n)throw new d(function(e){return _(`error.workbook.sheetIndexNotFound`,{index:e})}(e));return n}_requireSelectedWorksheet(){let e=this.getSelectedWorksheet();if(e)return e;let t=this.getSelectedSheet();throw new h(dn(t?.getName()??``,t?.getKind()??I.Kind.Worksheet))}_anchorWorksheet(){return this.getSelectedWorksheet()||(this._getWorksheets(I.Visibility.VeryHidden)[0]??null)}getWorksheets(){return this._sheets}addWorksheet(e){return this.getWorksheets().add(e)}_getWorksheets(e=I.Visibility.Visible){let t=this._getSheetRefs(e),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];$(r)&&n.push(r.sheet)}return n}_getSheetRefs(e=I.Visibility.Visible){let t=this._getState();return t?e===I.Visibility.Visible?t.sheetRefsVisible:e===I.Visibility.Hidden?t.sheetRefsVisibleAndHidden:e===I.Visibility.VeryHidden?t.sheetRefsAll:r.EmptyArray:[]}_getSheetRef(e,t=I.Visibility.Visible){let n=null;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)}_validateNewSheetName(e,t=!0){if(e==null)return e;if(_n(e),t&&this._getState().sheetsByLowerCaseName.has(e.toLowerCase()))throw new h(_(`error.workbook.nameTaken`));return e.substring(0,31)}findValidSheetName(e){e&&=_n(e,!0);try{return function(e,t){try{if(t(e))return e}catch{}let n,r,i=mn.exec(e);for(i===null?(n=e+` `,r=1):(n=e.substring(0,i.index),r=parseFloat(i[1]));r<256;){r++;let e=`(`+r+`)`,i=n.substring(0,31-e.length)+e;try{if(t(i))return i}catch{}}throw Error(e+` is not a valid sheet name`)}(e,e=>this._validateNewSheetName(e))}catch{return this._nextSheetName()}}isValidSheetNameCharacter(e){return!pn.test(e)}_isStructureProtected(){return!this._initializing&&!this.getProtection().isStructureAllowed()}_addSheetOptions(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t,n=null;t=typeof e==`string`?{name:e}:typeof e==`number`?{index:e}:e,t={...t,description:t?.description??a(`op.addSheet`)};let r=this.beginCommit(t);try{let e=t?.autoSelect??!1;n=this._addSheet(!0,t.name,t.index??null);let i=this.getView().getActiveSheetId();if(e&&this._recordActiveSheet(r,i,this._getSheetRef(n).id),r.commit({description:_(`op.addSheetNamed`,{name:n.getName()})}),!1!==e){let t=typeof e==`boolean`?void 0:e;n.select(t)}}catch(e){throw r.rollback(),e}return n}_nextSheetName(e=null){let t=e?e.toLowerCase():null,n=this._getState(),r=n.sheetsByLowerCaseName;if(e&&r.has(t))throw new h(function(e){return _(`error.workbook.nameDuplicate`,{sheetName:e})}(e));t=(e=this._validateNewSheetName(e))?e.toLowerCase():null;let i=n.lastId+1;for(;!e;){let t=this._createSheetName(i),n=t.toLowerCase();r.has(n)?i++:e=t}return this._updateState({lastId:i}),e}_addSheet(e,t=null,n=null,r){t=this._nextSheetName(t);let i=this._getState(),a=this._createSheet(i.lastId,t,I.Visibility.Visible,n,void 0,null,r);if(!a)throw new h(_(`error.workbook.sheetNameBlank`));return e&&(this._tellSheets(),this._emitter.notify(`onSheetsChange`)),a}_createOpaqueSheet(e,t,n,i,a,o,s,c,l){let u=this,d=null;return d=new en({kind:o,id:l??t+`-`+r.uuidV4(),part:s,tabColor:c,styles:this._styles,transactions:this._transactions,workbook:this,container:{getName:()=>u._getSheetRef(d)?.name??t,setName:(e,t)=>{u._setSheetName(d,e,t)},getVisibility:()=>u._getSheetRef(d,I.Visibility.VeryHidden)?.visibility??I.Visibility.Visible,setVisibility:(e,t)=>{u._setSheetVisibility(d,e,t)},getIndex:()=>{let e=u._getSheetRef(d,I.Visibility.VeryHidden);return e?u._getOffsetForId(e.id,u._getSheetRefs(I.Visibility.VeryHidden)):-1},setIndex:(e,t)=>{let n=u._getSheetRef(d,I.Visibility.VeryHidden);n&&u._moveSheet(n,e,t)},requestSelect:()=>u._requestSelect(d),isAttached:()=>!!u._getSheetRef(d,I.Visibility.VeryHidden)}}),this._sheetOnNameChange.set(e,()=>d._notify(`onNameChange`)),this._sheetOnVisibilityChange.set(e,()=>d._notify(`onVisibilityChange`)),this._sheetOnIndexChange.set(e,()=>d._notify(`onIndexChange`)),this._addSheetRef({name:t,id:e,visibility:n??I.Visibility.Visible,sheetId:a,sheet:d},i),d}async _requestSelect(e){let t=this._transactions.getPendingTransaction(),n=t?this.getView().getActiveSheetId():null;return this._setSelectedSheet(e),t?(this._recordActiveSheet(t,n,this.getView().getActiveSheetId()),this.getSelectedSheet()===e):(await this._emitter.notify(`onRequestSelect`,{source:this,params:e,async:!0}),this.getSelectedSheet()===e)}_updateSheetRefStates(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this._initializing&&!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=e,n=[],r=[],i=t.length;for(let e=0;e<i;e++)t[e].visibility===I.Visibility.Visible?(n.push(t[e]),r.push(t[e])):t[e].visibility===I.Visibility.Hidden&&r.push(t[e]);this._updateState({sheetRefsAll:t,sheetRefsVisible:n,sheetRefsVisibleAndHidden:r})}_tellSheets(){if(this._isLoadingSheets)return;let e=this._getState().sheetRefsAll;this._calculation._setSheets(e.map(e=>$(e)?[e.sheet.getId(),e.name]:[e.sheet.getId(),e.name,!0]))}_addSheetRef(e,t=null){let n=this._getState(),r=n.sheetRefsAll,i=Math.max(0,Math.min(r.length,t??r.length)),a=[...r.slice(0,i),e,...r.slice(i)];this._updateSheetRefStates(a);let o=e.sheet,s=e.name.toLowerCase(),c=new Map(n.refsById);c.set(e.id,e);let l=new Map(n.refsByLowerCaseName);l.set(s,e);let u=new Map(n.refsByInstance);u.set(o,e);let d=new Map(n.sheetsById);d.set(e.id,o);let f=new Map(n.sheetsByLowerCaseName);f.set(s,o);let p=this,m=n.listenersSheets;if(o!==void 0){let t=o.addListeners({onBeforeDelete:e=>{p._validateDeleteSheet(e)},onDelete(e){let t=p._getSheetRef(e,I.Visibility.VeryHidden);if(!t)return;let n=p._beginCommit({description:_(`op.deleteSheet`,{name:t.name})});try{let r=p._getState(),i=r.sheetRefsAll,a=p._getOffsetForId(t.id,i),s=[...i];s.splice(a,1),p._updateSheetRefStates(s);let c=new Map(r.refsById);c.delete(t.id);let l=new Map(r.sheetsById);l.delete(t.id);let u=t.name.toLowerCase(),d=new Map(r.refsByLowerCaseName);d.delete(u);let f=new Map(r.sheetsByLowerCaseName);f.delete(u);let m=new Map(r.refsByInstance);m.delete(e),r.listenersSheets.get(t.id)();let h=new Map(r.listenersSheets);h.delete(t.id),p._adjustRemoveSelectionIfRequired(a,t.id),p._adjustSheetNamesIfRequired(),p._sheetOnNameChange.delete(t.id),p._sheetOnVisibilityChange.delete(t.id),p._sheetOnIndexChange.delete(t.id),p._tellSheets(),p._emitter.notify(`onSheetsChange`);let g=new Set(r.sheetsCreated);g.has(o)&&g.delete(o),p._updateState({refsById:c,sheetsById:l,refsByLowerCaseName:d,sheetsByLowerCaseName:f,refsByInstance:m,sheetsCreated:g,listenersSheets:h}),n.commit()}catch(e){throw n.rollback(),e}}},{transactional:!0}),r=$(e)?e.sheet.addListeners({onSelectionChange:e=>{p.getView().getActiveSheetId()===p._getSheetRef(e)?.id&&p._emitter.notify(`onSelectionChange`,{source:p,params:e})}},{transactional:!1}):null;m=new Map(n.listenersSheets),m.set(e.id,()=>{t(),r?.()})}let h=n.lastId;h!==-1&&(h=Math.max(h,e.id)),this._updateState({lastId:h}),this._updateState({refsById:c,refsByLowerCaseName:l,refsByInstance:u,sheetsById:d,sheetsByLowerCaseName:f,listenersSheets:m}),this._adjustSheetNamesIfRequired();let g=new Set(this._getState().sheetsCreated);return g.add(e.sheet),this._updateState({sheetsCreated:g}),this._tellSheets(),e}_recordActiveSheet(e,t,n){let r=this.getView().getId();e.setIntent(vn,e=>({viewId:r,before:e?.before??t,after:n}))}_resyncActiveSheet(e,t){let n=t?.sheetRefsVisible;if(!n?.length)return;let r=-1,i=n.length;for(let t=0;t<i;t++)if(n[t].id===e){r=t;break}r===-1&&(r=Math.min(Math.max(this._activeSheetOffset,0),i-1));let a=n[r].id;this._view.getActiveSheetId()===a?this._activeSheetOffset=r:this._view.setActiveSheetId(a)}_adjustRemoveSelectionIfRequired(e,t){if(this._view.getActiveSheetId()===t){let t,n=this._getState().sheetRefsVisible;t=e<n.length?n[e].id:n[e-1].id,this._view.setActiveSheetId(t)}}_adjustSheetNamesIfRequired(){let e=this._getState(),t=e.lastId;if(t===-1)return;let n=this._view.getActiveSheetId();n??=(this._view.setActiveSheetId(t),t);let r=e.refsById.get(n);r||(this._view.setActiveSheetId(t),r=e.refsById.get(t),n=t),r.visibility===I.Visibility.Visible&&(this._activeSheetOffset=this._getOffsetForId(n,e.sheetRefsVisible))}_validateDeleteSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=this._getSheetRef(e);if(!t)throw new h(function(e){return _(`error.workbook.deleteKey`,{key:e})}(e));let n=this._getState().sheetRefsVisible;if(n.length===1&&n[0].id===t.id)throw new h(_(`error.workbook.sheetOne`))}_getOffsetForId(e,t){let n=t.length;for(let r=0;r<n;r++)if(t[r].id===e)return r;throw new h(_(`error.workbook.noVisibleRefs`))}find(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getWorksheets();if(t.length===0)return{next:()=>Ze};if(t.length===1)return t[0].find(e);typeof e==`string`&&(e={text:e});let n=!e?.reverse,r=e?.disableWrap??!1,i=this._worksheetOffsetFrom(this.getSelectedSheetIndex(),t),a=i,s=t[a],c=!1;e={...e,disableWrap:!0};let l,u=s.find(e),d=u.next(),f=!1;if(e?.from){let t=this._rangesAddressToCoords(e?.from);l={colIndex:t[0].colStart,rowIndex:t[0].rowStart}}let p=o.createCellComparator(e?.axis,e?.reverse);delete(e={...e}).from;let m=()=>{if(!f&&d.done&&(c&&a===i?f=!0:n?(a++,a>t.length-1&&(a=0,c=!0)):(a--,a<0&&(a=t.length-1,c=!0)),r&&c&&(f=!0),f||l||!c||a!==i||(f=!0),!f)){s=t[a],u=s.find(e);let n=d;return d=u.next(),n}if(!f&&c&&a===i&&(d.done||!l||!d.done&&p(d.value.getCoords(),l)>=0)&&(f=!0),f){let e=d;return d=Ze,e}let o=d;return d=u.next(),o};return{next:()=>{let e=m();for(;!f&&e.done;)e=m();return e}}}replace(e,t,n){let r=0,i=null,o=typeof t==`function`,s=n?.maxCount??2**53-1,c=!n?.maxCount,l=``,u=typeof t==`string`?Ke(t):null,d=n?.description??a(`op.replace`),f=this._transactions.beginCommit({description:d});try{let d=null,p=null,m=e.next();for(;!m.done&&r<s;){let a=m.value,s=a.getWorksheet();s!==d&&(d=s,p!==null&&p.apply(),p=d.getEntireRange().createSparseBuilder({axis:n?.axis,allowUnorderedWrites:!0}));let c=o?t(a):t;c!==void 0&&c!==a&&(p.push(a,c),r++,i=a),m=e.next()}p?.apply(),r===1&&s===1&&i&&(l=i.getAddress()),r===0?f.rollback():f.commit({description:n?.description??(c?u===null?a(`op.replaceAll`):_(`op.replaceAllWith`,{value:u}):l?u===null?_(`op.replaceAt`,{address:l}):_(`op.replaceAtWith`,{address:l,value:u}):u===null?a(`op.replace`):_(`op.replaceWith`,{value:u}))})}catch(e){throw f.rollback(),e}return{count:r,last:i}}_nextSheetIndex(e,t=this._getSheetRefs()){let n=t.length;return n===1?0:(e===void 0&&(e=this.getSelectedSheetIndex()),(e=Math.max(0,Math.min(e,n-1)))>=n-1?0:e+1)}_prevSheetIndex(e,t=this._getSheetRefs()){let n=t.length;return n===1?0:(e===void 0&&(e=this.getSelectedSheetIndex()),(e=Math.max(0,Math.min(e,n-1)))<=0?n-1:e-1)}_worksheetOffsetFrom(e,t){let n=this._getSheetRefs(),r=n.length;for(let i=0;i<r;i++){let a=n[(e+i)%r];if(!$(a))continue;let o=t.indexOf(a.sheet);if(o!==-1)return o}return 0}getNextSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRefs();return t[this._nextSheetIndex(e,t)]?.sheet??null}getPreviousSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRefs();return t[this._prevSheetIndex(e,t)]?.sheet??null}async _duplicateSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let t=this._getSheetRefs(),n=this.getSelectedSheetIndex(),r=null;if(e){if(r=this._getSheetRef(e),!r)throw new h(cn(r))}else r=t[n];if(!r)return null;if(!$(r))throw new h((i=r.name,_(`error.workbook.sheetNotDuplicable`,{sheetName:i})));var i;let a=r.sheet,o=t.indexOf(r),s=this._strings.beginPersist(),l=this.getResources().beginPersist(),u=this.getStyles().beginPersist(),d=this._richValues.beginPersist(),f=null,p=this.beginCommit(_(`op.duplicateNamed`,{name:a.getName()}));try{let e=this._getState().refsByInstance.get(a),n=await a.toJSON(),r=t.length+1,i=this.findValidSheetName(e.name),s=this._createSheet(r,i,e.visibility,o,void 0,n);this._tellSheets(),this._emitter.notify(`onSheetsChange`),f=s,p.commit()}catch(e){throw p.rollback(),e}finally{d.endPersist(),u.endPersist(),l.endPersist(),s.endPersist()}return f}_createRange(e,t){let n=e?{...e}:null,r=n?this._getSheetRef(n.scope,I.Visibility.VeryHidden):null;if(r&&!$(r))throw new h(un(r.name,r.sheet.getKind()));if(!r){let e=this._anchorWorksheet();return e?(delete n?.scope,gn(n,n?{scope:ve,...e.getEntireRange().getCoords()}:null)):void console.warn(_(`error.workbook.noVisibleRefs`))}let i=r.sheet,a=null;return t&&(a={getOptions:t}),new bn(e,P(i),this,a)}_createRanges(e,t){let n=this._anchorWorksheet();if(!n)throw new h(dn(``,I.Kind.Worksheet));let r=null;return t&&(r={getOptions:t}),new yn(e,P(n),this,r)}getRange(e,t){if(e===void 0)return this.getSelectedRange(t);typeof e==`number`&&(e=ct(arguments),t=void 0);try{let n=this._rangesAddressToCoords(e);if(n.length!==1)throw new h(_(`error.address.singleRangeOnlyAlt`));return this._createRange(n[0],t)}catch(t){throw t instanceof d?new d(t.message):new h(t.message??Re(e))}}getCell(e){if(e===void 0)return this.getSelectedCell();let t=this.getRange(e);if(t.size>1)throw new h(_(`error.address.singleCellOnly`));return t.getCell()}getRanges(e,t){let n=this._rangesAddressToCoords(e);if(n.length===0)throw new h(Re(e));return this._createRanges(n,t)}_createGraphRanges(e,t){let n=[],r=this.getCalculation()?.getNamedFormulas()??null;for(let e=0;e<t.length;e++){let i=t[e],a=i.sheetName?this._getSheetRef(i.sheetName,I.Visibility.VeryHidden):null,o=a&&$(a)?a.sheet:this._anchorWorksheet();o&&n.push(new Ge(i,r,P(o),null))}for(let t=0;t<e.length;t++)n.push(e[t]);let i=this._anchorWorksheet();return n.length!==0&&i?new yn(n,P(i),this,null):null}getAnomalies(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=Ae(e),n=this._getWorksheets(I.Visibility.VeryHidden).map(e=>{let t=P(e);return{bounds:t.getSheet().getEntireCoords(),internal:t,qualified:!0}});return new Ve(n,()=>(this.getSelectedWorksheet()??this._getWorksheets(I.Visibility.VeryHidden)[0]).getEntireRange(),t)}getStats(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getWorksheets(I.Visibility.VeryHidden),n=t.length;if(n===1)return t[0].getStats(e);let r=Array(n);for(let i=0;i<n;i++)r[i]=t[i].getStats(e);return new Rt(r)}_activeRangeCoords(){let e=this._requireSelectedWorksheet(),t=e.getSelection().getRanges().getCoords(),n=e.getName(),r=t.length,i=Array(r);for(let e=0;e<r;e++){let r=t[e];i[e]={colStart:r.colStart,colEnd:r.colEnd,rowStart:r.rowStart,rowEnd:r.rowEnd,scope:n}}return i}getSelectedRange(e){return this.getRange(this._activeRangeCoords()[0],e)}getSelectedRanges(e){return this.getRanges(this._activeRangeCoords(),e)}getSelectedCell(){return this._requireSelectedWorksheet().getSelectedCell()}_rangesAddressToCoords(e,t=!0,n=I.Visibility.Hidden){if(!e)throw new h(_(`error.address.noAddress`));let r=this.getSelectedWorksheet(),i={...(r??this._anchorWorksheet())?.getEntireRange().getCoords()},a=r?.getName();if(a&&(i.scope=a),typeof e==`string`){let t=e.trim().toLowerCase();if(t===`r`||t===`c`){let n=this.getSelectedCell().getCoords(),r={};t===`r`?r.rowStart=r.rowEnd=n.rowIndex:r.colStart=r.colEnd=n.colIndex,e=r}}let o=this,s=Fe(e,i,fe,e=>{if(!t)return null;if(typeof e==`string`){let t=pt(e,{getTable:e=>nt(o.getNames().getByName(e)),getAnchor:()=>r?{sheet:r,coords:r.getSelectedCell().getCoords()}:null});if(t)return[t];let n=o.getNames().getByName(e)?.getRanges?.();if(n)return n.getCoords()}throw new h(`Invalid sheet reference '${e}'.`)}),c=s.length;for(let e=0;e<c;e++)this._validateCoords(s[e],n);return s}_validateCoords(e,t=I.Visibility.Visible,n=_(`error.sheet.oobRange`)){if(e===null)return;let r=this.getWorksheet(e.scope??void 0,t).getEntireRange().getCoords();if(!o.isRangeWithinRange(e,r))throw new d(n);if(e.rowEnd<e.rowStart||e.colEnd<e.colStart)throw new h(_(`error.address.invalidRangeInverted`))}_updateSheetRef(e,t){let n=this._getState(),r=[...n.sheetRefsAll];r[this._getOffsetForId(e.id,n.sheetRefsAll)]=t,this._updateSheetRefStates(r);let i=new Map(n.refsById);i.set(e.id,t);let a=e.name.toLowerCase(),o=t.name.toLowerCase(),s=new Map(n.refsByLowerCaseName);s.delete(a),s.set(o,t);let c=new Map(n.sheetsByLowerCaseName),l=c.get(a);c.delete(a),c.set(o,l);let u=new Map(n.refsByInstance);return u.set(l,t),this._updateState({refsById:i,refsByLowerCaseName:s,sheetsByLowerCaseName:c,refsByInstance:u}),this._tellSheets(),t}_setSheetName(e,t,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=this._getSheetRef(e);if(!r)throw new h(cn(e));if(t===r.name)return r.sheet;if((t=this._validateNewSheetName(t))==null)throw new h(_(`error.workbook.sheetNameNotProvided`));let i=Object.freeze({...r,name:t}),o=null,s=this.beginCommit(a(`op.renameSheet`));try{let e=this._updateSheetRef(r,i);this._adjustSheetNamesIfRequired(),this._sheetOnNameChange.forEach((e,t)=>{r.id===t&&e()}),this._emitter.notify(`onSheetsChange`),r.id===this.getView().getActiveSheetId()&&this._emitter.notify(`onSelectionChange`),o=e.sheet,s.commit(n)}catch(e){throw s.rollback(),e}return o}_setSheetVisibility(e,t=I.Visibility.Visible,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=this._getSheetRef(e,I.Visibility.VeryHidden);if(!r)return null;if(t===r.visibility)return;let i=null,o=``;t===I.Visibility.Visible?o=a(`op.unhideSheet`):t===I.Visibility.Hidden?o=a(`op.hideSheet`):t===I.Visibility.VeryHidden&&(o=a(`op.veryHideSheet`));let s=this.beginCommit(o);try{let e=this._getState().sheetRefsVisible;if(t!==I.Visibility.Visible&&e.length===1&&e[0].id===r.id)throw new h(_(`error.workbook.sheetOne`));let a={...r,visibility:t},o=-1;t!==I.Visibility.Visible&&(o=this._getOffsetForId(r.id,e)),i=this._updateSheetRef(r,a).sheet,t!==I.Visibility.Visible&&this._adjustRemoveSelectionIfRequired(o,r.id),this._adjustSheetNamesIfRequired(),s.commit(n)}catch(e){throw s.rollback(),e}return this._sheetOnVisibilityChange.forEach((e,t)=>{r.id===t&&e()}),this._emitter.notify(`onSheetsChange`),i}_moveSheet(e,t,n){if(this._closed)throw Error(_(`error.workbook.modelClosed`));if(!this.getProtection().isStructureAllowed())throw new c(_(`error.workbook.protection`));let r=null,i=this.beginCommit(_(`op.moveSheetNamed`,{name:e.name}));try{let a=this._getState(),o=a.sheetRefsVisible;if(t<0||t>o.length-1)throw new h(`Invalid to index: ${t}`);let s=this.getView().getActiveSheetId(),c=a.sheetRefsAll,l=this._getOffsetForId(e.id,c),u=this._getOffsetForId(o[t].id,c);if(l===u)return;let d=c[l],f=[...c];f.splice(l,1),f.splice(u,0,d),this._updateSheetRefStates(f),this._calculation._replaceSheetSpans?.(c.map(e=>e.sheet.getId()),f.map(e=>e.sheet.getId()),d.sheet.getId()),this._adjustSheetNamesIfRequired(),this._sheetOnIndexChange.forEach((e,t)=>{t>=l&&t<=u&&e()}),this._tellSheets(),this._emitter.notify(`onSheetsChange`),r=d.sheet,this._recordActiveSheet(i,s,this.getView().getActiveSheetId()),i.commit(n)}catch(e){throw i.rollback(),e}return r}_setSelectedSheet(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));let t=this._getSheetRef(e);if(!t)throw new h(cn(e));let n=null;return t.visibility!==I.Visibility.Visible&&this._setSheetVisibility(t,I.Visibility.Visible),this._view.setActiveSheetId(t.id),n=t.sheet,n}getProtection(){return this._protection}getProperties(){return this._documentProperties}getCodeName(){return this._codeName}getNames(){return this._names}getCalculation(){return this._calculation}getFonts(){return tt.getShared()}createFormula(e,t,n){return this.getCalculation().createFormula(e,t,n)}evaluate(e,t){return this.getCalculation().evaluate(e,t)}async whenCalculationReady(){let e=this._starting;return e?e.then(()=>this.getCalculation().ready()):this.getCalculation().ready()}whenFontsReady(){return this.getFonts().whenReady()}async whenReady(){await Promise.all([this.whenCalculationReady(),this.whenFontsReady()])}getScripts(){return this._scripts||=this._createScripts(),this._scripts}getModules(){return this.getScripts().getModules()}_notifyAllChange(){this._emitter.notify(`onSheetsChange`),this._emitter.notify(`onSelectedSheetChange`),this._emitter.notify(`onViewChange`)}addListeners(e,t){return this._emitter.addListeners(e,t)}_sheetToWBEvent(e){let t=this,n=e=>{if(e.isInvalid())return e;let n=e.getWorksheet().getName();if(e.isICellRanges){let r=e.getCoords().map(e=>e.scope?e:{...e,scope:n});return t.getRanges(r)}let r=e.getCoords();return t.getRange(r.scope?r:{...r,scope:n})};return t=>{e({getSource:()=>n(t.getSource()),getRanges:()=>{let e=t.getRanges();return e?n(e):null},getPreviousAddress:()=>t.getPreviousAddress(),getEdits:()=>t.getEdits(),getTrigger:()=>t.getTrigger(),isUndo:()=>t.isUndo(),getCommit:()=>t.getCommit(),toString:()=>`WorkbookRangeEvent: ('${t.getTrigger()}', ${n(t.getSource()).toString()})`,getTimeStamp:()=>t.getTimeStamp()})}}_holdPivotCaches(){let e=this._pivotCaches;if(e.length===0)return;let t=e=>{let t=this._getSheetRef(e),n=t&&$(t)?t.sheet:null;return n?n._contentAddWatch(()=>null):null},n=e=>{for(let t of this._getSheetRefs(I.Visibility.VeryHidden)){if(!$(t))continue;let n=t.sheet;if(n.getTables().getByName(e))return n._contentAddWatch(()=>null)}return null},r=(e,t)=>{let n=this._getSheetRef(e);return n&&$(n)?n.sheet.getRange(t):null},i=e=>{for(let t of this._getSheetRefs(I.Visibility.VeryHidden)){if(!$(t))continue;let n=t.sheet.getTables().getByName(e);if(n)return n}return null},a=(e,t)=>{let n=this._pivotSourceNamed(e,t)?.getValue(),i=typeof n==`string`?N(n):null;return i&&/^\$?[A-Za-z]+\$?\d+(?::\$?[A-Za-z]+\$?\d+)?$/.test(i.reference)?r(i.sheet,i.reference.replaceAll(`$`,``)):null};for(let o=0;o<e.length;o++)this._getState().pivotCacheData.has(e[o].cacheId)&&(e[o]._hold(t,n),e[o]._watchSource(r,i,a))}_pivotCacheStore(e){return{get:()=>this._getState().pivotCacheData.get(e),set:t=>{this._updateState(n=>({...n,pivotCacheData:new Map(n.pivotCacheData).set(e,t)}),a(`op.refreshPivotTable`))}}}_getPivotCache(e){return this._getState().pivotCacheData.has(e)?this._pivotCaches.find(t=>t.cacheId===e)??null:null}_pivotSourceOf(e,t){if(e.isITable)return{name:e.getName()};let n=null;if(typeof e==`string`){for(let t of this._getSheetRefs(I.Visibility.VeryHidden))if($(t)&&t.sheet.getTables().getByName(e))return{name:e};if(this.getNames().getByName(e))return{name:e};if(t.getNames().getByName(e)?.getScope())return{name:e,sheet:t.getName()};let r=N(e),i=r?this._getSheetRef(r.sheet):null;if(r&&(!i||!$(i)))return null;try{n=r?i.sheet.getRange(r.reference):t.getRange(e)}catch(e){if(!(e instanceof h))throw e;return null}}else n=e.isICellRange?e:t.getRange(e);if(!n||n.isInvalid())return null;let{rowStart:r,colStart:i,rowEnd:a,colEnd:o}=n.getCoords();return{ref:Ye({rowStart:r,colStart:i,rowEnd:a,colEnd:o}),sheet:n.getWorksheet().getName()}}_findPivotCache(e){let t=(e,t)=>(e??``).toLocaleLowerCase()===(t??``).toLocaleLowerCase();return this._pivotCaches.find(n=>{if(!this._getPivotCache(n.cacheId)||!n._getData().model||n._isStale())return!1;let r=n._getSource();return!!r&&t(r.ref,e.ref)&&t(r.sheet,e.sheet)&&t(r.name,e.name)})??null}_addPivotCache(e){let t=this._pivotCaches.reduce((e,t)=>Math.max(e,t.cacheId),-1)+1,n=this._pivotCacheStore(t);n.set({part:null,model:e,partFormats:null,source:null});let r=new Y(t,n);return this._pivotCaches.push(r),this._holdPivotCaches(),r}async _refreshPivotCaches(e,t){let n=[];for(let t of this._getSheetRefs(I.Visibility.VeryHidden))if($(t))for(let r of t.sheet.getPivotTables().getItems())e.has(r.getCacheId())&&n.push(r);for(let e of n)e._assertRefreshAllowed();for(let r of e){let e=this._getPivotCache(r),i=e?await this._pivotSourceRangeOf(e._getSource()):null;if(!e||!i)throw new h(_(`error.pivotTable.refreshSourceUnsupported`));if(i.getRowCount()<2)throw new h(_(`error.pivotTable.refreshSourceTooSmall`));i.getWorksheet()._cellBuffer?.release();let a=e.toJSON();if(!a.fields)throw new h(_(`error.pivotTable.refreshSourceUnsupported`));let{model:o,remap:s}=t.refreshPivotCache(a,t.readPivotSource(i),e._getSource()??void 0,this._isDate1904);e._replace(o);for(let e of n)e.getCacheId()===r&&e._remapCache(s,t)}for(let e of n)await e._prepareRelayout(t);for(let e of n)e._refresh(t)}async _refreshPivotCachesOnLoad(){let e=this._pivotCaches.filter(e=>!!e._getData().model?.refreshOnLoad);if(e.length===0)return;let t=await st.load();for(let n of e){if(this._closed)return;try{await this._transactions.doBatch(()=>this._refreshPivotCaches(new Set([n.cacheId]),t))}catch(e){if(!(e instanceof h||e instanceof c))throw e}}}async _pivotSourceRangeOf(e){if(!e)return null;if(e.ref){if(!e.sheet||e.ref.includes(`#REF!`))return null;let t=this._getSheetRef(e.sheet);return t&&$(t)?t.sheet.getRange(e.ref):null}if(!e.name)return null;if(!e.sheet)for(let t of this._getSheetRefs(I.Visibility.VeryHidden)){if(!$(t))continue;let n=t.sheet.getTables().getByName(e.name);if(!n||n.isDeleted())continue;let{rowEnd:r}=n.getDataRange().getCoords();return t.sheet.getRange({...n.getRange().getCoords(),rowEnd:r})}let t=await this._pivotSourceNamed(e.name,e.sheet??null)?.evaluate(),n=t?.isIReferenceRange?t.getCoords():null;if(!n?.scope)return null;let r=this._getSheetRef(n.scope);return r&&$(r)?r.sheet.getRange(n):null}_pivotSourceNamed(e,t){if(!t)return this.getNames().getByName(e);let n=this._getSheetRef(t);if(!n||!$(n))return null;let r=n.sheet.getNames().getByName(e);return r?.getScope()?r:null}_holdPivotSlicers(){let e=(e,t)=>{let n=this._getSheetRef(e);return(n&&$(n)?n.sheet:null)?.getPivotTables().getByName(t)??null};for(let t of this._getSheetRefs(I.Visibility.VeryHidden)){if(!$(t))continue;let n=t.sheet.getMovables().getItems();for(let t=0;t<n.length;t++){let r=n[t].getContent();r.isISlicer&&r._holdPivotTables(e)}}}_fromJSON(e,t){if(this._emitter.notify(`onBeforeLoad`,{params:e}),this._initState(),!e.sheets||e.sheets.length===0)throw new h(_(`error.workbook.sheetOne`));e.theme&&(this._theme=new ut(e.theme),this._styles.setTheme(this._theme));let n=this._strings.beginPersist(),r=this._resources.beginPersist(),i=this._styles.beginPersist(),a=this._richValues.beginPersist();try{n.fromJSON(e.strings),r.fromJSON(e.resources),this._fetch.adopt(this._resources.getItems()),i.fromJSON(e.styles),a.fromJSON(e.richData,{resources:this._resources,strings:this._strings,fromResourceId:e=>r.fromResourceId(e)??null},e.richTypes),e.date1904&&(this._isDate1904=!0),this._codeName=e.codeName??null,this._updateLinks=e.updateLinks??null,this._hiddenPivotFieldList=!0===e.hiddenPivotFieldList,this._documentProperties.fromJSON(e.properties),e.locale&&(this._locale=e.locale),e.localeOverrides&&(this._localeOverrides=e.localeOverrides),e.view||={};let o=[],s=new Map,c=e.pivotCaches;if(c){let e=r.fromResourceId.bind(r);for(let t=0;t<c.length;t++){let n=c[t];n&&typeof n.cacheId==`number`&&!s.has(n.cacheId)&&s.set(n.cacheId,Y.dataOf(n,e))}}this._updateState({pivotCacheData:s});for(let e of s.keys())o.push(new Y(e,this._pivotCacheStore(e)));this._pivotCaches=o,this._people.fromJSON(e.people);let l=e.sheets,u=l.length,d=e.view.activeSheetId??null;d!==null&&(d=Math.min(Math.max(0,d),u-1));let f=null,p=null;this._isLoadingSheets=!0;for(let e=0;e<u;e++){let n=l[e],i=n.visibility||I.Visibility.Visible,a=e;p=a,i===I.Visibility.Visible?f===null&&(f=a):d!==null&&d===a&&(d=null);try{let o=n.kind??I.Kind.Worksheet;if(o!==I.Kind.Worksheet){let s=n.sheet,c=j.fromJSON(s?.part,r.fromResourceId.bind(r));if(!c)throw new h(_(`error.workbook.sheetPartMissing`,{sheetName:n.name}));this._createOpaqueSheet(a,n.name,i,e,n.sheetId,o,c,s?.tabColor??null,t?.[e])}else this._createSheet(a,n.name,i,e,n.sheetId,n.sheet,t?.[e])}catch(e){throw this._isLoadingSheets=!1,e}}this._isLoadingSheets=!1,this._tellSheets(),this._holdPivotCaches(),this._holdPivotSlicers();for(let e of this._getSheetRefs(I.Visibility.VeryHidden))$(e)&&e.sheet._tellPivots();this._updateState({lastId:p}),e.view.activeSheetId=d??f,this.setView(new tn({json:e.view})),this._adjustSheetNamesIfRequired(),this._listenerProtection?.();let m=this;this._protection=new rn(e?.protection,this._options?.readonly),this._listenerProtection=this._protection.addListeners({onChange:e=>{m._emitter.notify(`onProtectionChange`,{source:e})}}),this._emitter.notify(`onLoad`)}finally{a.endPersist(),i.endPersist(),r.endPersist(),n.endPersist()}}async _startFunctions(){let e=this._scripts;if(!e)return r.EmptyArray;await e._load();let t=[];for(let n of e.getModules().getItems())this._startModules.add(n),t.push(...n.getFunctions().getItems({type:`formula`,includeHidden:!0}));return t}_createScripts(e){let t=this;return new Wt({transactions:this._transactions,json:e,workbook:t,getBuiltInFunctions:()=>t._calculation?.getFunctions(),onAdd:(e,n)=>{let r=t._calculation;r.getStatus()!==ye.Status.Off&&r.start().then(async()=>{if(t._startModules.has(n))return;let e=n.getFunctions().getItems({type:`formula`,includeHidden:!0}),r=e.length;for(let t=0;t<r;t++){let n=e[t];try{await this._calculation.getFunctions().add(n)}catch(e){m.error(e?.message??String(e),e)}}}).catch(()=>{})},onRemove:(e,t)=>{}})}async toJSON(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));await Promise.resolve(this._starting);let t=this.getCalculation();t.getStatus()!==ye.Status.Off&&(await t.ready(),await t._whenRequestsSettled?.()),await this._emitter.notify(`onBeforeSave`,{async:!0});let n={sheets:[]},r=e?.ignoreStyles??!1;if(!r){let e=this._theme.toJSON();(e?Object.keys(e).length:0)>0&&(n.theme=e)}if(this._scripts){let e=this._scripts.toJSON();e&&Object.keys(e).length>0&&(n.modules=e)}this._isDate1904&&(n.date1904=!0),this._codeName&&(n.codeName=this._codeName),this._updateLinks&&(n.updateLinks=this._updateLinks),this._hiddenPivotFieldList&&(n.hiddenPivotFieldList=!0);let i=this._documentProperties.toJSON();Object.keys(i).length>0&&(n.properties=i),this._locale&&(n.locale=this._locale),this._localeOverrides&&(n.localeOverrides=this._localeOverrides);let a=e?.resources??`embed`,o=a===`ignore`,s=this._strings.beginPersist(),c=o?null:this._resources.beginPersist(),l=this._styles.beginPersist(),u=this._richValues.beginPersist();try{let t=this._getSheetRef(this.getSelectedSheetIndex()).id,i=t,d=null,f=this._getState(),p=f.sheetRefsAll,m=f.sheetsById,h=p.length;for(let r=0;r<h;r++){let a=p[r],o=r+1,s,l=m.get(a.id);if($(a))s={name:a.name,sheet:await a.sheet.toJSON(e)};else{let e=l,t=c?c.toResourceId.bind(c):()=>null,n={part:j.toJSON(e._getPart(),t)},r=e.getTabColor();r&&(n.tabColor=r.toString()),s={name:a.name,kind:e.getKind(),sheet:n}}a.sheetId!==void 0&&(s.sheetId=a.sheetId),a.visibility===I.Visibility.Visible?d===null&&(d=o):s.visibility=a.visibility,a.id===t&&(i=o),n.sheets.push(s)}if(!r){let e=l.toJSON();e&&Object.keys(e).length>0&&(n.styles=e)}let g=this.getProtection().toJSON();g&&(n.protection=g);let _=this._calculation.toJSON();Object.keys(_).length>0&&(n.calc=_);let v=await s.toJSONAsync();v&&v.length>0&&(n.strings=v);let y=await u.toJSONAsync(c?c.toResourceId.bind(c):void 0);if(y.length>0){n.richData=y;let e=u.toKindsJSON();e.length>0&&(n.richTypes=e)}let b=this._calculation.getExternalBooks().toJSON();b&&(n.externalBooks=b);let x=this._pivotCaches;if(x.length>0){let e=c?c.toResourceId.bind(c):()=>null,t=new Set;for(let e of this.getPivotTables())t.add(e.getCacheId());let r=Ie(this);for(let e=0;e<r.length;e++){let n=r[e].toJSON()?.pivot?.cacheId;n!==void 0&&t.add(n)}let i=[];for(let n=0;n<x.length;n++)t.has(x[n].cacheId)&&i.push(x[n].toJSON(e));i.length>0&&(n.pivotCaches=i)}let S=this._people.toJSON();if(S&&(n.people=S),!o){let e=await c.toJSONAsync(typeof a==`function`?a:void 0);e&&e.length>0&&(n.resources=e)}let C=this._calculation.getNamedFormulas().toJSON();C&&C.length>0&&(n.names=C);let w=this._view.toJSON();w&&(i===d?delete w.activeSheetId:w.activeSheetId=i,Object.keys(w).length>0&&(n.view=w))}finally{u.endPersist(),l.endPersist(),o||c.endPersist(),s.endPersist()}return this._emitter.notify(`onSave`,{params:n}),n}isClosed(){return this._closed}close(){if(this._closed)return;this._emitter.notify(`onClose`);let e=this._getState();e.listenersSheets.forEach(e=>{e()}),e.listenersSheets.clear();let t=e.sheetRefsAll;for(let e=t.length-1;e>=0;e--)try{t[e].sheet.close()}catch(e){console.warn(`error on close`,e)}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 St&&this._originProvider.release(),this._closed=!0}beginCommit(e){if(this._closed)throw Error(_(`error.workbook.modelClosed`));return this._beginCommit(typeof e==`string`?{description:e}:e)}doBatch(e,t){let n=this;t=typeof t==`string`?{description:t}:{description:a(`op.updateWorkbook`),...t};let r=y.bind(this._transactions,this,e);return this._transactions.doBatch(r.callback,{...t,onChildCommit:r.onChildCommit},(e,t)=>{r.close(),e.getDepth()===0&&(n._lastTransactionUUID=e.getId())})}_beginCommit(e){let t=this;return this._transactions.beginCommit(typeof e==`string`?{description:e}:e,e=>{e.getDepth()===0&&(t._lastTransactionUUID=e.getId())})}_getState(){return this._transactions.getState(this._id)}_updateState(e,t=a(`op.updateWorkbook`),n){if(!e)return;let r=this._beginCommit(t);try{r.updateState(this._id,e),r.commit(n)}catch(e){throw r.rollback(),e}}get options(){return this._options}get[Symbol.toStringTag](){return`[Workbook]`}toString(){return`[${this.getName()??`(untitled)`}]`}get isIWorkbook(){return!0}},Cn={address:null},$=e=>e.sheet.getKind()===I.Kind.Worksheet,wn=class{constructor(){this._readFormats=[],this._writeFormats=[],this._encryptions=[]}async registerReadFormat(e){this._readFormats=await this._registerFormatType(e,this._readFormats)}async registerWriteFormat(e){this._writeFormats=await this._registerFormatType(e,this._writeFormats)}async registerEncryption(e){if(!e)throw Error(`encryption must be provided.`);if(!e.key)throw Error(`encryption.key must be provided.`);let t=e.key.toLowerCase(),n=this._encryptions.findIndex(e=>e.key.toLowerCase()===t);if(n!==-1){let t=[...this._encryptions];t[n]=e,this._encryptions=Object.freeze(t)}else this._encryptions=Object.freeze([...this._encryptions,e])}async getEncryption(e){return this.peekEncryption(e)}peekEncryption(e){if(!e)return this._encryptions[0]??null;let t=e.toLowerCase();return this._encryptions.find(e=>e.key.toLowerCase()===t)??null}async detectEncryption(e){for(let t of this._encryptions)if(await t.detect(e))return t;return null}async getReadFormats(e){return e?this._filterFormats(e,this._readFormats):[...this._readFormats]}async getWriteFormats(e){return this._writeFormats?e?this._filterFormats(e,this._writeFormats):[...this._writeFormats]:[]}async _registerFormatType(e,t){return this._registerFormatTypeSync(e,t)}_registerFormatTypeSync(e,t){if(!e)throw Error(`format must be provided.`);if(!e.key)throw Error(`format.key must be provided.`);let n=e.key.toLowerCase(),r=t.findIndex(e=>e.key.toLowerCase()===n);if(r!==-1){let n=[...t];return n[r]=e,Object.freeze(n)}return Object.freeze([...t,e])}_filterFormats(e,t,n){if(!e||Object.keys(e).length===0){if(!n)return[...t];e={ext:n}}let r=e.search?.toLocaleLowerCase();return t.filter(t=>{if(r){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);if(!(e||n||i||a||o))return!1}let i=e.ext||n;if(i){let e=i.toLocaleLowerCase();if(!t.exts.some(t=>t.toLocaleLowerCase()===e))return!1}if(e.mimeType&&t.mimeType!==e.mimeType||e.key&&t.key.toLocaleLowerCase()!==e.key.toLocaleLowerCase())return!1;if(e.tags){let n=t.tags||[];if(!(typeof e.tags==`string`?[e.tags]:e.tags).every(e=>n.includes(e)))return!1}return!0})}},Tn=new WeakMap,En=e=>!!e&&typeof e==`object`&&typeof e.getPath==`function`&&typeof e.canWrite==`function`,Dn=new class{constructor(){this._setInstalled=new WeakSet,this._backingStore=null,this._emitter=new b(this),this._registry=new wn,this._defaultStore=new wt(()=>this.getWriteFormats(),()=>this.getReadFormats())}getBackingStore(){return this._backingStore??this._defaultStore}setBackingStore(e){this._backingStore=e??null}canWrite(){return typeof this.getBackingStore().write==`function`}canRead(){return typeof this.getBackingStore().read==`function`}async install(e){this._setInstalled.has(e)||(await e.register(this._registry),this._setInstalled.add(e))}addListeners(e,t){return this._emitter.addListeners(e,t)}addCommitListener(e){return this._emitter.addListeners({onWrite:(t,n)=>{n.save&&e.onCommit?.({store:n.workbook.getTransactions(),commitId:n.commitId})}})}async getReadFormats(e){return this._registry.getReadFormats(e)}async getWriteFormats(e){return this._registry.getWriteFormats(e)}getOrigin(e){return new H(e)}async read(e){let t=null;if(typeof e==`string`)e={source:e};else if(En(e)){let n=e.getPath();if(!n)throw Error(`Cannot read from an unbound origin (no path).`);bt(e)?e={source:n,asCopy:!0}:(t=e,e={source:n})}let n=e??{},{source:r=null,...i}=n,a=this.getBackingStore();return(a.read?a:this._defaultStore).read({source:r,options:i,decode:(e,r)=>this._decodeBuffer(e,r,n,t)})}async _decodeBuffer(e,t={},n,r=null){let i=t.format,a=t.ext;if(!i&&!a)throw Error(`Either format or file extension must be provided to determine read type.`);let o=(await this._registry.getReadFormats(i?{search:i}:{ext:a}))[0];if(!o)throw new h(_(`error.io.readFormatUnavailable`,{format:i??a}));let s=n?.typedCreateWorkbookOptions,c=s?Object.keys(s).find(e=>e.toLowerCase()===o.key.toLowerCase()):void 0,l={...n,...c===void 0?void 0:s[c]};delete l.typedCreateWorkbookOptions,delete l.source,delete l.asCopy;let u=r??new H(t.absolutePath??null,{name:t.name??null,format:o.key,size:t.size??null,lastModified:t.lastModified??null,canWrite:t.canWrite??!1});r instanceof H&&r.update({format:o.key,size:t.size??null,lastModified:t.lastModified??null}),l.createWorkbookOptions={...l.createWorkbookOptions||{},origin:u},l.readonly!==void 0&&(l.createWorkbookOptions={readonly:l.readonly,...l.createWorkbookOptions},delete l.readonly),l.calcOnly&&(l.createWorkbookOptions={disableLoadAutoFit:!0,...l.createWorkbookOptions});let d=await this._decrypt(e,u,l);if(d===null)return null;e=d.bytes;let f=l?.progress?.onStart?.bind(l.progress);f&&await Promise.resolve(f(u,t.size));try{let t=await this._readArrayBuffer(e,o,l);return d.password!==null&&u.setPassword(d.password),l?.progress?.onComplete?.(u),this._emitter.notify(`onRead`,{params:{workbook:t,origin:u},transactional:!1}),t}catch(e){throw l?.progress?.onError?.(e),l?.progress?.onComplete?.(null),e}}async _decrypt(e,t,n){let r=await this._registry.detectEncryption(e);if(t instanceof H&&t.update({encryption:r?r.key:null}),!r)return{bytes:e,password:null};let i=null,a=async t=>{try{return i=await r.decode(e,t),!0}catch(e){if(!(e instanceof f))throw e;return!1}};if(n?.password&&await a(n.password))return{bytes:i,password:n.password};if(!n?.onPassword){let e=t.getName();throw new l(e?_(`error.io.passwordRequired`,{name:e}):_(`error.io.passwordRequiredUnnamed`))}let o=await Promise.resolve(n.onPassword({origin:t,encryption:r.key,validate:a}));if(o==null)return null;if(i!==null||await a(o))return{bytes:i,password:o};throw new f(_(`error.io.passwordIncorrect`))}async writeArrayBuffer(e,t){if(!t?.format)throw Error(`A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).`);let n=(await this._registry.getWriteFormats({search:t.format}))[0];if(!n)throw new h(_(`error.io.writeFormatUnavailable`,{format:t.format}));return this._writeArrayBuffer(e,n,t)}async write(e,t,n){return typeof t==`string`||En(t)?this._write(e,t,!1,n):this._write(e,e?.getOrigin?.(),!0,t??n)}async writeAs(e,t,n){if(!t)throw Error(`A target must be provided for writeAs (use write(workbook) for a plain save).`);return this._write(e,t,!0,n)}async _write(e,t,n,r){if(!e)throw Error(`Workbook must be provided.`);if(!e.isIWorkbook)throw Error(`Invalid workbook model provided. Must be an instance of IWorkbook.`);let i=typeof t==`string`?this.getOrigin(t):t,a=i.getFormat(),o;if((r?.format||a)&&(o=(await this._registry.getWriteFormats({search:r?.format??a??void 0}))[0]),o||i.getPath()&&i.canWrite()&&i.getExtension()||(o=(await this._registry.getWriteFormats({ext:`sxl`}))[0]??(await this._registry.getWriteFormats())[0]),!o)throw new h(_(`error.io.writeFormatUnresolved`));let s=i.getExtension();if(r?.format&&s&&i.getPath()&&i.canWrite()&&!o.exts.includes(s)){let e=(await this._registry.getWriteFormats({ext:s}))[0];if(e&&e.key!==o.key){let e=i.getPath().split(/[/\\]/).pop();throw new h(_(`error.io.writeFormatMismatch`,{format:r.format,file:e}))}}if(typeof t==`string`){let e=i.getPath();i=new H(F(e)?e:`${e}.${o.exts[0]}`,{format:o.key})}let c=i.getEncryption(),u=e.getOrigin?.(),d=(i instanceof H?i.getPassword():null)??(u instanceof H?u.getPassword():null),f=i.isEncrypted()||(u?.isEncrypted()??!1),p=r?.password===void 0?d??(f?void 0:null):r.password,m=null;if(p===void 0){if(f){let e=i.getName();throw new l(e?_(`error.io.passwordRequiredSave`,{name:e}):_(`error.io.passwordRequiredSaveUnnamed`))}}else if(p!==null&&(m=await this._registry.getEncryption(c),!m))throw new h(_(`error.io.encryptionUnavailable`));let g=`${i.getName()??_(`workbook.defaultName`)}.${o.exts[0]}`,v=r?.progress,y=!i.getPath()||!i.canWrite()||!!r?.prompt,b=!1,x=this,S=null,C=[],w={workbook:e,format:o,formatNamed:!!r?.format,origin:i,suggestedName:g,prompt:r?.prompt,async encode(t,a){let s=a??i;await(async e=>{b||(b=!0,v?.onStart&&await Promise.resolve(v.onStart(e)))})(s),S=e.getTransactions?.()?.getCurrentCommit()??S;let c=t?(await x._registry.getWriteFormats({search:t}))[0]??o:o,l=[],u=((e,t)=>({onStart:e?.onStart?(t,n)=>e.onStart(t,n):void 0,onProgress:e?.onProgress?(t,n)=>e.onProgress(t,n):void 0,onError:e?.onError?t=>e.onError(t):void 0,onComplete:e?.onComplete?t=>e.onComplete(t):void 0,onWarning:(n,r)=>{t.push({message:n??``,context:r}),e?.onWarning?.(n,r)}}))(v,l),d=await x._writeArrayBuffer(e,c,{...r,progress:u}),f=Tn.get(s);if(l.some(e=>!f?.has(e.message))&&r?.onWarnings){let t=await Promise.resolve(r.onWarnings({workbook:e,origin:s,warnings:l,save:n,canCancel:!y}));if(!y&&!1===t)return null}return C=l,m?m.encode(d,p):d}},T=null;try{let t=this.getBackingStore();if(!t.write)throw Error(`The active backing store is read-only (no write implementation).`);if(T=await t.write(w),T){if(p!==void 0&&T instanceof H&&(T.setPassword(p),T.update({encryption:m?m.key:null})),C.length){let e=Tn.get(T)??new Set;for(let t of C)e.add(t.message);Tn.set(T,e)}n&&T!==e.getOrigin()&&bt(e.getOrigin())?.setOrigin(T);let t=S??e.getTransactions?.()?.getCurrentCommit()??null;this._emitter.notify(`onWrite`,{params:{workbook:e,origin:T,commitId:t?.getId()??null,save:n},transactional:!1})}v?.onComplete&&await Promise.resolve(v.onComplete(T))}catch(e){let t=e instanceof Error?e:Error(String(e));throw v?.onError&&await Promise.resolve(v.onError(t)),v?.onComplete&&await Promise.resolve(v.onComplete(null)),t instanceof h?t:Error(_(`error.io.writeFailed`,{reason:t.message}),{cause:e})}return T}_stripExtension(e){let t=F(e);return t?e.slice(0,e.length-t.length-1):e}_baseName(e){if(!e)return null;let t=e.split(/[?#]/)[0],n=t.split(/[/\\]/).pop()??t;return this._stripExtension(n)||null}async _writeArrayBuffer(e,t,n){if(!t)throw Error(`A write format must be provided.`);let r=t.handler;if(!r)throw Error(`Unable to resolve a write handler for '${t.key}'.`);return Me(t.key)||await z.assertUsable(`exports`,0),r(e,{...n,format:t.key})}async _readArrayBuffer(e,t,n){if(!e)throw Error(`ArrayBuffer must be specified.`);if(!t)throw Error(`format must be specified.`);if(e.byteLength===0)return new Sn(n?.createWorkbookOptions);let r=t.handler;if(!r)throw Error(`Unable to resolve a read handler for '${t.key}'.`);let i;try{i=await r(e,n)}catch(e){throw e instanceof h?e:new h(_(`error.io.readFailed`,{format:t.description??t.key,reason:e?.message??String(e)}),{cause:e})}return await et(),i}get isIWorkbookIO(){return!0}},On=[`.woff2`,`.woff`,`.ttf`,`.otf`,`.ttc`,`.otc`].map(e=>({suffix:e,place:(e,t)=>t?`${t}/${e}`:e})),kn={suffix:`.metrics.json`,async extract(e){let t=await e.readJson();return t?.format===`sheetxl-font-metrics/1`?{family:t.family,weight:t.weight,italic:t.italic}:null},place:(e,t)=>t?`${t}/${e}`:e};[kn.place,kn.place,...On];var An;An||={};var jn,Mn,Nn;jn||={},(Mn||={}).Type={Button:`button`,CheckBox:`checkBox`,OptionButton:`optionButton`,ListBox:`listBox`,DropDown:`dropDown`,ScrollBar:`scrollBar`,Spinner:`spinner`,GroupBox:`groupBox`,Label:`label`,EditBox:`editBox`,Dialog:`dialog`,Unknown:`formControl`},(Nn||={}).DropStyle={Combo:`combo`,ComboEdit:`comboEdit`,Simple:`simple`};export{Ht as a,yt as c,Dt as d,Dn as f,Qt as i,Sn as l,H as n,$t as o,Pt as p,gt as r,Z as s,Ft as t,J as u};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Ce8b0lOBuWKlfLzJ.js","./DVQnEWIisXaOXb_G.js","./HclGiUj8dZXDFmoM.js","./ChSvXfVMLxZsP9zG.js","./3Ls_kOvlQseMV8Q0.js","./DcrVJCyDwGKeil2U.js","./CAQ7QWes7j7Fq8o5.js","./nHThFXCAZFOM_npq.js","./CQukCzhuewMuFOlO.js","./CyfTQE0Z76Rp4Fbt.js","./BQnELVV0uR4T4ItQ.js","./CnXLpFE_vFrJ5Jbf.js","./zvxBjll3jnL0-vNn.js","./Cenh1POxiGMxIQlv.js","./-i_fTASJeu9NdNH_.js","./CEL5lzj2NDYwJ-HC.js","./9w0ECZmzGUyk3F_O.js","./KoxRo2J_cwB_yOd5.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./HclGiUj8dZXDFmoM.js";import{B as t}from"./ChSvXfVMLxZsP9zG.js";import{n}from"./Cbbl3H042tb0krfe.js";import{r}from"./9w0ECZmzGUyk3F_O.js";var i=r({MAX_WORKBOOK_NAME_SIZE:()=>96,isReservedFileNameChar:()=>s,isValidFileName:()=>c}),a=/^(con|prn|aux|nul|com\d|lpt\d)$/i,o=/[<>:"/\\|?*\u0000-\u001F]/,s=e=>o.test(e),c=e=>!(!e||e.length>255)&&!o.test(e)&&!a.test(e)&&e!==`.`&&e!==`..`,l=t(`io:sxlReader`,()=>e(()=>import(`./Ce8b0lOBuWKlfLzJ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)),u=t(`io:sxlWriter`,()=>e(()=>import(`./-i_fTASJeu9NdNH_.js`),__vite__mapDeps([14,13]),import.meta.url)),d=async(e,t)=>(await l.load()).readSXL(e,t),f=e=>async(t,n)=>(await u.load()).writeSXL(t,{...n,compress:n?.compress??e.compress,whiteSpace:n?.whiteSpace??e.whiteSpace}),p={key:`SheetXL`,description:`SheetXL Workbook`,mimeType:`application/vnd.sheetxl.sheet`,exts:[`sxl`],handler:d},m={key:`JSON`,description:`SheetXL Workbook (JSON)`,mimeType:`application/json`,exts:[`json`],handler:d},h={key:`SheetXL`,mimeType:`application/vnd.sheetxl.sheet`,description:`SheetXL Workbook`,exts:[`sxl`],handler:f({compress:!0,whiteSpace:0})},g={key:`JSON`,mimeType:`application/json`,description:`SheetXL Workbook (JSON)`,exts:[`json`],advanced:!0,handler:f({compress:!1,whiteSpace:2})},_={name:`SXLPlugin`,version:`0.8.0-beta.23`,description:`Import and export SXL format`,author:`SheetXL`,async register(e){await e.registerReadFormat(p),await e.registerReadFormat(m),await e.registerWriteFormat(h),await e.registerWriteFormat(g)}},v=t(`io:csvReader`,()=>e(()=>import(`./CEL5lzj2NDYwJ-HC.js`),__vite__mapDeps([15,2,8,1,3,4,5,6,7,9,10,11,12,16]),import.meta.url)),y=t(`io:csvWriter`,()=>e(()=>import(`./KoxRo2J_cwB_yOd5.js`),__vite__mapDeps([17,2,16]),import.meta.url)),b={key:`CSV`,description:`Comma Separated Values`,mimeType:`text/csv`,exts:[`csv`],handler:async(e,t)=>(await v.load()).readCSV(e,t)},x={key:`CSV`,mimeType:`text/csv`,description:`Comma Separated Values`,exts:[`csv`],handler:async(e,t)=>(await y.load()).writeCSV(e,t)},S={name:`CSVPlugin`,version:`0.8.0-beta.23`,description:`Import and export CSV format`,author:`SheetXL`,async register(e){await e.registerReadFormat(b),await e.registerWriteFormat(x)}},C={name:`@sheetxl/io`,version:`0.8.0-beta.23`,description:`Built-in I/O formats for SheetXL`,author:`SheetXL`,async register(e){await _.register(e),await S.register(e),await n.register(e)}};export{S as CSVPlugin,C as IOPlugin,i as IOUtils,_ as SXLPlugin};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CCYEWK5QyGSnUAfh.js","./DqOrgSpuJhQRhMoG.js","./HclGiUj8dZXDFmoM.js","./D4RZZdlItfrgQHcE.js","./3Ls_kOvlQseMV8Q0.js","./BQTLEc84Eql61S2m.js","./COL9dj40ytErlGak.js","./nHThFXCAZFOM_npq.js","./CQukCzhuewMuFOlO.js","./CKdQfdZJGJFgnrr9.js","./BQnELVV0uR4T4ItQ.js","./CnXLpFE_vFrJ5Jbf.js","./Np3jWxG724t5hLHZ.js","./Cenh1POxiGMxIQlv.js","./-i_fTASJeu9NdNH_.js","./CFS0h-wE9YlZRk_1.js","./9w0ECZmzGUyk3F_O.js","./KoxRo2J_cwB_yOd5.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./HclGiUj8dZXDFmoM.js";import{B as t}from"./D4RZZdlItfrgQHcE.js";import{n}from"./D98PlIA4qQ_6ciCu.js";import{r}from"./9w0ECZmzGUyk3F_O.js";var i=r({MAX_WORKBOOK_NAME_SIZE:()=>96,isReservedFileNameChar:()=>s,isValidFileName:()=>c}),a=/^(con|prn|aux|nul|com\d|lpt\d)$/i,o=/[<>:"/\\|?*\u0000-\u001F]/,s=e=>o.test(e),c=e=>!(!e||e.length>255)&&!o.test(e)&&!a.test(e)&&e!==`.`&&e!==`..`,l=t(`io:sxlReader`,()=>e(()=>import(`./CCYEWK5QyGSnUAfh.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)),u=t(`io:sxlWriter`,()=>e(()=>import(`./-i_fTASJeu9NdNH_.js`),__vite__mapDeps([14,13]),import.meta.url)),d=async(e,t)=>(await l.load()).readSXL(e,t),f=e=>async(t,n)=>(await u.load()).writeSXL(t,{...n,compress:n?.compress??e.compress,whiteSpace:n?.whiteSpace??e.whiteSpace}),p={key:`SheetXL`,description:`SheetXL Workbook`,mimeType:`application/vnd.sheetxl.sheet`,exts:[`sxl`],handler:d},m={key:`JSON`,description:`SheetXL Workbook (JSON)`,mimeType:`application/json`,exts:[`json`],handler:d},h={key:`SheetXL`,mimeType:`application/vnd.sheetxl.sheet`,description:`SheetXL Workbook`,exts:[`sxl`],handler:f({compress:!0,whiteSpace:0})},g={key:`JSON`,mimeType:`application/json`,description:`SheetXL Workbook (JSON)`,exts:[`json`],advanced:!0,handler:f({compress:!1,whiteSpace:2})},_={name:`SXLPlugin`,version:`0.8.0-beta.25`,description:`Import and export SXL format`,author:`SheetXL`,async register(e){await e.registerReadFormat(p),await e.registerReadFormat(m),await e.registerWriteFormat(h),await e.registerWriteFormat(g)}},v=t(`io:csvReader`,()=>e(()=>import(`./CFS0h-wE9YlZRk_1.js`),__vite__mapDeps([15,2,8,1,3,4,5,6,7,9,10,11,12,16]),import.meta.url)),y=t(`io:csvWriter`,()=>e(()=>import(`./KoxRo2J_cwB_yOd5.js`),__vite__mapDeps([17,2,16]),import.meta.url)),b={key:`CSV`,description:`Comma Separated Values`,mimeType:`text/csv`,exts:[`csv`],handler:async(e,t)=>(await v.load()).readCSV(e,t)},x={key:`CSV`,mimeType:`text/csv`,description:`Comma Separated Values`,exts:[`csv`],handler:async(e,t)=>(await y.load()).writeCSV(e,t)},S={name:`CSVPlugin`,version:`0.8.0-beta.25`,description:`Import and export CSV format`,author:`SheetXL`,async register(e){await e.registerReadFormat(b),await e.registerWriteFormat(x)}},C={name:`@sheetxl/io`,version:`0.8.0-beta.25`,description:`Built-in I/O formats for SheetXL`,author:`SheetXL`,async register(e){await _.register(e),await S.register(e),await n.register(e)}};export{S as CSVPlugin,C as IOPlugin,i as IOUtils,_ as SXLPlugin};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Tj3B5At0OAN3tDza.js","./HclGiUj8dZXDFmoM.js","./ChSvXfVMLxZsP9zG.js","./CnXLpFE_vFrJ5Jbf.js","./Cx1kZ2u_8JFV2Q8D.js","./CQukCzhuewMuFOlO.js","./DRrM-dY9nM7nDRpV.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DACqwpSwlZka3b7s.js","./HclGiUj8dZXDFmoM.js","./D4RZZdlItfrgQHcE.js","./CnXLpFE_vFrJ5Jbf.js","./BiRVjUOUI8Qv0CE1.js","./CQukCzhuewMuFOlO.js","./DRrM-dY9nM7nDRpV.js"])))=>i.map(i=>d[i]);
2
2
  import{t as e}from"./HclGiUj8dZXDFmoM.js";var t=class{constructor(e){this._worker=null,this._nextId=1,this._pendingRequests=new Map,this._workerFactory=e}start(){if(typeof Worker>`u`)throw Error(`Web Workers are not supported in this environment.`);return this._worker||(this._worker=this._workerFactory(),this._worker.onmessage=e=>{let{id:t,result:n,error:r}=e.data,i=this._pendingRequests.get(t);if(i){if(this._pendingRequests.delete(t),r){let e=Error(r.message);e.stack=r.stack,r.cause&&(e.cause=r.cause),i.reject(e)}else i.resolve(n)}},this._worker.onerror=e=>{console.error(`Worker error:`,e),this._pendingRequests.forEach(t=>{t.reject(Error(`Worker failed: ${e.message}`))}),this._pendingRequests.clear(),this._worker=null}),Promise.resolve()}execute(e){if(!this._worker)throw Error(`Worker is not initialized. Call start() first.`);let t=this._nextId++;return new Promise((n,r)=>{this._pendingRequests.set(t,{resolve:n,reject:r}),this._worker.postMessage({id:t,params:e})})}terminate(){this._worker&&=(this._worker.terminate(),null)}},n=class{constructor(e){this._onExecute=e}execute(e){return this._onExecute(e)}start(){return Promise.resolve()}terminate(){}},r=`var _t = Object.defineProperty, ar = (e, t, r) => () => {
3
3
  if (r) throw r[0];
4
4
  try {
@@ -994,15 +994,20 @@ var oi, $e = (e, t) => {
994
994
  let A = e[S], L = A >> 1;
995
995
  if (1 & A) {
996
996
  let h = n[L];
997
- if (f <= h && b(f, h), d > 1) {
998
- let y = d - 1;
999
- for (; y >= 0 && c[y] !== L;) y--;
1000
- y !== -1 && (c[y] = c[d - 1]);
997
+ f <= h && b(f, h);
998
+ let y = d - 1;
999
+ for (; y >= 0 && c[y] !== L;) y--;
1000
+ if (y !== -1) {
1001
+ for (let w = y + 1; w < d; w++) c[w - 1] = c[w];
1002
+ d--;
1001
1003
  }
1002
- d--, f = h + 1;
1004
+ f = h + 1;
1003
1005
  } else {
1004
1006
  let h = r[L];
1005
- d > 0 && f < h && b(f, h - 1), d >= c.length && (c = this._overlaps = $e(c, d + 1)), c[d++] = L, f = h;
1007
+ d > 0 && f < h && b(f, h - 1), d >= c.length && (c = this._overlaps = $e(c, d + 1));
1008
+ let y = d;
1009
+ for (; y > 0 && c[y - 1] > L;) c[y] = c[y - 1], y--;
1010
+ c[y] = L, d++, f = h;
1006
1011
  }
1007
1012
  }
1008
1013
  l[o] = m, this._rCount = o, this._region = -1, this._rInter = null;
@@ -3939,4 +3944,4 @@ self.addEventListener("message", async (e) => {
3939
3944
  });
3940
3945
  }
3941
3946
  });
3942
- `,i=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,r],{type:`text/javascript;charset=utf-8`});function a(e){let t;try{if(t=i&&(self.URL||self.webkitURL).createObjectURL(i),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(r),{type:`module`,name:e?.name})}}async function o(){if(globalThis.process?.versions?.node&&typeof Worker>`u`)return await s();if(typeof Worker<`u`){let e=new t(()=>new a);try{return await e.start(),e}catch(e){console.error(`Failed to start TypescriptCompiler worker reverting to fallback:`,e)}}return await s()}var s=async()=>{let{compileModule:t}=await e(async()=>{let{compileModule:e}=await import(`./Tj3B5At0OAN3tDza.js`);return{compileModule:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),r=new n(e=>t(e));return await r.start(),r};export{o as createCompilerWorker};
3947
+ `,i=typeof self<`u`&&self.Blob&&new Blob([`URL.revokeObjectURL(import.meta.url);`,r],{type:`text/javascript;charset=utf-8`});function a(e){let t;try{if(t=i&&(self.URL||self.webkitURL).createObjectURL(i),!t)throw``;let n=new Worker(t,{type:`module`,name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(r),{type:`module`,name:e?.name})}}async function o(){if(globalThis.process?.versions?.node&&typeof Worker>`u`)return await s();if(typeof Worker<`u`){let e=new t(()=>new a);try{return await e.start(),e}catch(e){console.error(`Failed to start TypescriptCompiler worker reverting to fallback:`,e)}}return await s()}var s=async()=>{let{compileModule:t}=await e(async()=>{let{compileModule:e}=await import(`./DACqwpSwlZka3b7s.js`);return{compileModule:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),r=new n(e=>t(e));return await r.start(),r};export{o as createCompilerWorker};
@@ -1 +1 @@
1
- import{I as e}from"./ChSvXfVMLxZsP9zG.js";import{c as t,i as n}from"./CQukCzhuewMuFOlO.js";import{Jt as r,Pa as i,Si as a,it as o,ln as s,ni as c,tn as l,zn as u}from"./CyfTQE0Z76Rp4Fbt.js";var d=t=>{let n=t.ext;return n===null&&(n=t.ext={spillDependents:e.EmptyArray,spillRowStart:-1,spillColStart:-1,spillRowEnd:-1,spillColEnd:-1,fixedRef:null,demandValue:void 0,cycleGroup:0,cycleNext:null,shownGroup:0}),n},f=e=>{let t=e.precedents;return t===null?e.block.getPrecedentsAt(e.rowIndex,e.colIndex):t},p=e=>{let t=e.precedents;return t===null?e.block.paramLength:t.length},m=e=>{if(e instanceof c)return new l(e);let t=!0===e.isIRepeatingList?e:null,r=t?t.getPeriod():e.length,a=Array.isArray(e);if(!t&&!a&&!g(e))return new l(e);let o=null;for(let t=0;t<r;t++)if(h(a?e[t]:e.at(t))){if(o===null){o=Array(r);for(let t=0;t<r;t++)o[t]=a?e[t]:e.at(t)}o[t]=n.BuiltIn.Calc}return new l(o===null?e:t?new i(o,e.length):o)},h=e=>typeof e==`object`&&!!e&&!n.isError(e)&&!0!==e.isIRichData&&!a(e),g=e=>{let t=!1;return l.forEachLeaf(e,(e,n,r,i)=>{if(t||e instanceof c)return;let a=n+i-r;!0===e.isIRepeatingList&&(a=Math.min(a,n+e.getPeriod()-1));for(let r=n;!t&&r<=a;r++)t=h(e.at(r))}),t},_=class extends o{constructor(e,t){super(),this.nodes=e,this.count=t}},v=class extends o{constructor(e){super(),this.node=e}},y=class extends o{constructor(e){super(),this.node=e}};function b(e,n=0,i=0){let a=(e=e._materializeEmpty())._values,o=e._coords,s=a.getRuns({bounds:o}),c=a.getAxis()!==t.Axis.Row,l=c?o.colStart:o.rowStart,u=c?o.rowStart:o.colStart,d=new r.Builder(null,n,i),f=s.next();for(;!f.done;){let e=f.value;d.pushMultipleAt(e[0]-l,e[1]-u,e[2]),f=s.next()}return d.build()}function x(e){if(typeof e!=`object`||!e||!0!==e.isIRange)return e;let t=e,n=t._values,r=new u({axis:n.getAxis(),createRun:m}),i=b(t);return i&&r.setValues(i.tuples),new s(t._runtime,r,{colStart:0,rowStart:0,colEnd:t.getColumnCount()-1,rowEnd:t.getRowCount()-1})}function S(e,t,i){let a=t.rowEnd-t.rowStart+1,o=t.colEnd-t.colStart+1,s=function(e,t,r){let i=e?.isIRange?e:null,a=i?i.getRowCount():1,o=i?i.getColumnCount():1,s=Array(t);for(let c=0;c<t;c++){let t=Array(r),l=a===1?0:c<a?c:-1;for(let a=0;a<r;a++){let r=o===1?0:a<o?a:-1;t[a]=l<0||r<0?n.BuiltIn.NA:i?i.getValueAt(l,r):e}s[c]=t}return s}(e,a,o),c=i?o:a,l=i?a:o,u=i?t.colStart:t.rowStart,d=i?t.rowStart:t.colStart,f=new r.Builder(null),p=!0;for(let e=0;e<c;e++){let t=null,n=0;for(let r=0;r<l;r++){let a=i?s[r][e]:s[e][r];a==null?t&&=(f.pushMultipleAt(u+e,d+n,t),null):(t||(t=[],n=r,p=!1),t.push(a))}t&&f.pushMultipleAt(u+e,d+n,t)}return p?null:f.build()}function C(e){let t=e.value;if(t.$absRowStart!==t.$absRowEnd||t.$absColStart!==t.$absColEnd)return!1;let n=e.rowEnd-e.rowStart-(t.$absRowEnd?0:t.formulaBlockHeight-1),r=e.colEnd-e.colStart-(t.$absColEnd?0:t.formulaBlockWidth-1);return n===0&&r===0}function w(e,t,n,r,i=null){let a=e.value,o=a.formulaBlockWidth,s=a.formulaBlockHeight,c=a.formulaEntry.value,l=n-e.colStart,u=t-e.rowStart,d=e.rowEnd-e.rowStart-(s-1),f=e.colEnd-e.colStart-(o-1),p=a.$absRowEnd?0:Math.max(0,u-d),m=a.$absRowStart?s-1:Math.min(s-1,u),h=a.$absColEnd?0:Math.max(0,l-f),g=a.$absColStart?o-1:Math.min(o-1,l),_=c.ref;i===null?c.forEachNodeIn(_.rowStart+p,_.rowStart+m,_.colStart+h,_.colStart+g,r):i(c,_.rowStart+p,_.rowStart+m,_.colStart+h,_.colStart+g,r)}function T(e,t,n,r,i,a){if(C(e))return void w(e,t,n,r,i);let o=e.value,s=o.formulaBlockWidth,c=o.formulaBlockHeight,l=o.formulaEntry.value,u=l.ref,d=n-e.colStart,f=t-e.rowStart,p=e.rowEnd-e.rowStart-(c-1),m=e.colEnd-e.colStart-(s-1),h=u.rowStart+(o.$absRowEnd?0:Math.max(0,f-p)),g=u.rowStart+(o.$absRowStart?c-1:Math.min(c-1,f)),_=u.colStart+(o.$absColEnd?0:Math.max(0,d-m)),v=u.colStart+(o.$absColStart?s-1:Math.min(s-1,d));if(h>g||_>v)return;let y=a.get(o);if(y===void 0)return a.set(o,{rowFrom:h,rowTo:g,colFrom:_,colTo:v}),void i(l,h,g,_,v,r);if(h>=y.rowFrom&&g<=y.rowTo&&_>=y.colFrom&&v<=y.colTo)return;let b=h<=u.rowStart&&g>=u.rowEnd&&_<=u.colStart&&v>=u.colEnd;!b&&_===y.colFrom&&v===y.colTo&&h<=y.rowTo+1&&g>=y.rowFrom-1?(h<y.rowFrom&&i(l,h,y.rowFrom-1,_,v,r),g>y.rowTo&&i(l,y.rowTo+1,g,_,v,r),h<y.rowFrom&&(y.rowFrom=h),g>y.rowTo&&(y.rowTo=g)):!b&&h===y.rowFrom&&g===y.rowTo&&_<=y.colTo+1&&v>=y.colFrom-1?(_<y.colFrom&&i(l,h,g,_,y.colFrom-1,r),v>y.colTo&&i(l,h,g,y.colTo+1,v,r),_<y.colFrom&&(y.colFrom=_),v>y.colTo&&(y.colTo=v)):(i(l,h,g,_,v,r),(g-h+1)*(v-_+1)>(y.rowTo-y.rowFrom+1)*(y.colTo-y.colFrom+1)&&(y.rowFrom=h,y.rowTo=g,y.colFrom=_,y.colTo=v))}function E(e,t,n,r,i,a,o,s,c=null){let l=e.value,u=l.formulaBlockWidth,d=l.formulaBlockHeight,f=Math.max(r,e.rowStart),p=Math.min(a,e.rowEnd);if(f>p)return;let m=Math.max(i,e.colStart),h=Math.min(o,e.colEnd);if(m>h)return;let g=e.rowEnd-e.rowStart-(d-1),_=e.colEnd-e.colStart-(u-1),v=l.$absRowEnd?0:Math.max(0,f-e.rowStart-g),y=l.$absRowStart?d-1:Math.min(d-1,p-e.rowStart),b=l.$absColEnd?0:Math.max(0,m-e.colStart-_),x=l.$absColStart?u-1:Math.min(u-1,h-e.colStart);if(v>y||b>x)return;let S=1,C=0,w=1,T=0;if(t>=e.rowStart&&t<=e.rowEnd&&n>=e.colStart&&n<=e.colEnd){let r=t-e.rowStart,i=n-e.colStart;S=l.$absRowEnd?0:Math.max(0,r-g),C=l.$absRowStart?d-1:Math.min(d-1,r),w=l.$absColEnd?0:Math.max(0,i-_),T=l.$absColStart?u-1:Math.min(u-1,i)}let E=l.formulaEntry.value,D=E.ref,O=e=>{let t=e.rowIndex-D.rowStart,n=e.colIndex-D.colStart;t>=S&&t<=C&&n>=w&&n<=T||s(e)};c===null?E.forEachNodeIn(D.rowStart+v,D.rowStart+y,D.colStart+b,D.colStart+x,O):c(E,D.rowStart+v,D.rowStart+y,D.colStart+b,D.colStart+x,O)}function D(e){let{row:t,col:n,rows:r,cols:i,rowInput:a,colInput:o}=e,s=(e,t,n,r)=>({rowStart:e,colStart:t,rowEnd:n,colEnd:r}),c=s(t-1,n,t-1,n+i-1),l=s(t,n-1,t+r-1,n-1);return a!==null&&o!==null?[s(t-1,n-1,t-1,n-1),c,l]:o===null?[l,c]:[c,l]}var O=(e,t,n)=>{let{gridId:r,row:i,col:a}=e;return e.rowInput!==null&&e.colInput!==null?{gridId:r,row:i-1,col:a-1}:e.colInput===null?{gridId:r,row:i+t,col:a-1}:{gridId:r,row:i-1,col:a+n}},k=(e,t)=>({gridId:e.gridId,row:e.row-1,col:e.col+t}),A=(e,t)=>({gridId:e.gridId,row:e.row+t,col:e.col-1}),j=(e,t)=>32768*e+t;function M(e,t){let r=e.getPrecedents(),i=e.getDynamics(),a=new Map,o=[],s=!1,c=[],l=e=>{if(e.block.hasDataTable())return;let t=e.gridId;if(!t)return;let n=a.get(t);n||(n={byCell:new Map,spills:[]},a.set(t,n));let r=j(e.rowIndex,e.colIndex);n.byCell.has(r)||(n.byCell.set(r,e),e.cachedValue?.isIRange&&n.spills.push(e),o.push(e))},u=(e,t,n,r,i)=>{if(e.unanchored)return;let a=e.ref;e.mintNodesIn(a.rowStart+t,a.rowStart+n,a.colStart+r,a.colStart+i,l)},d=(e,t)=>{if(t.unanchored||t.hasDataTable())return;s=!0;let n=t.ref;t.mintNodesIn(n.rowStart,n.rowEnd,n.colStart,n.colEnd,l)},p={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:t.gridId},m=(e,t,n,i,a)=>{p.rowStart=t,p.colStart=n,p.rowEnd=i,p.colEnd=a,p.scope=e,function(e,t,n,r,i){n.length=0,e.search(t,!1,!1,n);let a=n.length;if(a===0)return;let o=t.colStart,s=t.rowStart,c=t.colEnd-o,l=t.rowEnd-s;for(let e=0;e<a;e++){let t=n[e],a=t.value,u=a.formulaEntry.value;if(a.index<0){i(t,u);continue}let d=u.ref,f=d.colEnd-d.colStart,p=d.rowEnd-d.rowStart,m=t.colEnd-t.colStart-f,h=t.rowEnd-t.rowStart-p,g=0,_=p,v=0,y=f,b=s-t.rowStart,x=o-t.colStart;a.$absRowEnd||(g=Math.min(Math.max(b-h,0),p)),a.$absRowStart||(_=Math.min(b+l,p)),a.$absColEnd||(v=Math.min(Math.max(x-m,0),f)),a.$absColStart||(y=Math.min(c+x,f)),r(u,g,_,v,y)}}(r,p,c,u,d)},{rowInput:h,colInput:g}=t;h&&m(t.gridId,h.rowIndex,h.colIndex,h.rowIndex,h.colIndex),g&&m(t.gridId,g.rowIndex,g.colIndex,g.rowIndex,g.colIndex);for(let e=0;e<o.length;e++){let t=o[e],n=t.gridId,r=t.rowIndex,a=t.colIndex,c=t.cachedValue;c?.isIRange?m(n,r,a,r+c.getRowCount()-1,a+c.getColumnCount()-1):m(n,r,a,r,a),!s&&i.has(t.block)&&(s=!0)}if(o.length===0)return o;let _=[],v=e=>{let t=a.get(e.gridId)?.byCell.get(j(e.row,e.col))??null;t===null||_.includes(t)||_.push(t)};for(let e=0;e<t.rows;e++){g&&v(A(t,e));for(let n=0;n<t.cols;n++)v(O(t,e,n))}if(h)for(let e=0;e<t.cols;e++)v(k(t,e));if(_.length===0)return[];let y=[],b=new Set,x=new Set,S=e=>{if(b.has(e)||x.has(e))return;x.add(e);let t=(e=>{let t=[],r=f(e);for(let i=0;i<r.length;i++){let o=r[i];if(n.isError(o))continue;let s=a.get(o.scope??e.gridId);if(!s)continue;let c=o.rowStart,l=o.colStart,u=o.rowEnd,d=o.colEnd;if(c===u&&l===d){let e=s.byCell.get(j(c,l));e&&!t.includes(e)&&t.push(e)}else for(let e of s.byCell.values()){let n=e.rowIndex,r=e.colIndex;n>=c&&n<=u&&r>=l&&r<=d&&!t.includes(e)&&t.push(e)}let f=s.spills;for(let e=0;e<f.length;e++){let n=f[e],r=n.cachedValue,i=n.rowIndex,a=n.colIndex;i<=u&&i+r.getRowCount()-1>=c&&a<=d&&a+r.getColumnCount()-1>=l&&!t.includes(n)&&t.push(n)}}return t})(e);for(let e=0;e<t.length;e++)S(t[e]);x.delete(e),b.add(e),y.push(e)};if(s)for(let e=0;e<o.length;e++)S(o[e]);else for(let e=0;e<_.length;e++)S(_[e]);return y}function N(e,t,n){let{rows:r,cols:i,rowInput:a,colInput:o,gridId:s}=t,c=Array(r);for(let e=0;e<r;e++)c[e]=Array(i);let l=t=>e.layerFor(t.gridId).getValueAt(t.row,t.col)??null,u=(t,n)=>{e.layerFor(s).set(t.rowIndex,t.colIndex,n)},d=(t,n)=>{let r=e.layerFor(t.gridId),i=t.rowIndex,a=t.colIndex,o=n;if(o?.isIRange){let e=o.getRowCount(),t=o.getColumnCount();for(let n=0;n<e;n++)for(let e=0;e<t;e++)r.set(i+n,a+e,o.getValueAt(n,e)??null)}else r.set(i,a,n)},f=()=>{for(let t=0;t<n.length;t++){let r=n[t];d(r,e.evaluate(r))}};for(let e=0;e<r;e++){o!==null&&(u(o,l(A(t,e))),a===null&&f());for(let n=0;n<i;n++)a!==null&&(u(a,l(k(t,n))),f()),c[e][n]=l(O(t,e,n))}return c}export{y as _,N as a,_ as c,f as d,m as f,x as g,w as h,M as i,b as l,v as m,D as n,S as o,p,E as r,T as s,C as t,d as u};
1
+ import{I as e}from"./D4RZZdlItfrgQHcE.js";import{c as t,i as n}from"./CQukCzhuewMuFOlO.js";import{Cn as r,Ii as i,Or as a,Sa as o,Xt as s,dn as c,dr as l,ut as u}from"./CKdQfdZJGJFgnrr9.js";var d=t=>{let n=t.ext;return n===null&&(n=t.ext={spillDependents:e.EmptyArray,spillRowStart:-1,spillColStart:-1,spillRowEnd:-1,spillColEnd:-1,fixedRef:null,demandValue:void 0,cycleGroup:0,cycleNext:null,shownGroup:0}),n},f=e=>{let t=e.precedents;return t===null?e.block.getPrecedentsAt(e.rowIndex,e.colIndex):t},p=e=>{let t=e.precedents;return t===null?e.block.paramLength:t.length},m=e=>{if(e instanceof l)return new o(e);let t=!0===e.isIRepeatingList?e:null,r=t?t.getPeriod():e.length,i=Array.isArray(e);if(!t&&!i&&!g(e))return new o(e);let a=null;for(let t=0;t<r;t++)if(h(i?e[t]:e.at(t))){if(a===null){a=Array(r);for(let t=0;t<r;t++)a[t]=i?e[t]:e.at(t)}a[t]=n.BuiltIn.Calc}return new o(a===null?e:t?new s(a,e.length):a)},h=e=>typeof e==`object`&&!!e&&!n.isError(e)&&!0!==e.isIRichData&&!a(e),g=e=>{let t=!1;return o.forEachLeaf(e,(e,n,r,i)=>{if(t||e instanceof l)return;let a=n+i-r;!0===e.isIRepeatingList&&(a=Math.min(a,n+e.getPeriod()-1));for(let r=n;!t&&r<=a;r++)t=h(e.at(r))}),t},_=class extends i{constructor(e,t){super(),this.nodes=e,this.count=t}},v=class extends i{constructor(e){super(),this.node=e}},y=class extends i{constructor(e){super(),this.node=e}};function b(e,n=0,r=0){let i=(e=e._materializeEmpty())._values,a=e._coords,o=i.getRuns({bounds:a}),s=i.getAxis()!==t.Axis.Row,c=s?a.colStart:a.rowStart,l=s?a.rowStart:a.colStart,d=new u.Builder(null,n,r),f=o.next();for(;!f.done;){let e=f.value;d.pushMultipleAt(e[0]-c,e[1]-l,e[2]),f=o.next()}return d.build()}function x(e){if(typeof e!=`object`||!e||!0!==e.isIRange)return e;let t=e,n=t._values,i=new r({axis:n.getAxis(),createRun:m}),a=b(t);return a&&i.setValues(a.tuples),new c(t._runtime,i,{colStart:0,rowStart:0,colEnd:t.getColumnCount()-1,rowEnd:t.getRowCount()-1})}function S(e,t,r){let i=t.rowEnd-t.rowStart+1,a=t.colEnd-t.colStart+1,o=function(e,t,r){let i=e?.isIRange?e:null,a=i?i.getRowCount():1,o=i?i.getColumnCount():1,s=Array(t);for(let c=0;c<t;c++){let t=Array(r),l=a===1?0:c<a?c:-1;for(let a=0;a<r;a++){let r=o===1?0:a<o?a:-1;t[a]=l<0||r<0?n.BuiltIn.NA:i?i.getValueAt(l,r):e}s[c]=t}return s}(e,i,a),s=r?a:i,c=r?i:a,l=r?t.colStart:t.rowStart,d=r?t.rowStart:t.colStart,f=new u.Builder(null),p=!0;for(let e=0;e<s;e++){let t=null,n=0;for(let i=0;i<c;i++){let a=r?o[i][e]:o[e][i];a==null?t&&=(f.pushMultipleAt(l+e,d+n,t),null):(t||(t=[],n=i,p=!1),t.push(a))}t&&f.pushMultipleAt(l+e,d+n,t)}return p?null:f.build()}function C(e){let t=e.value;if(t.$absRowStart!==t.$absRowEnd||t.$absColStart!==t.$absColEnd)return!1;let n=e.rowEnd-e.rowStart-(t.$absRowEnd?0:t.formulaBlockHeight-1),r=e.colEnd-e.colStart-(t.$absColEnd?0:t.formulaBlockWidth-1);return n===0&&r===0}function w(e,t,n,r,i=null){let a=e.value,o=a.formulaBlockWidth,s=a.formulaBlockHeight,c=a.formulaEntry.value,l=n-e.colStart,u=t-e.rowStart,d=e.rowEnd-e.rowStart-(s-1),f=e.colEnd-e.colStart-(o-1),p=a.$absRowEnd?0:Math.max(0,u-d),m=a.$absRowStart?s-1:Math.min(s-1,u),h=a.$absColEnd?0:Math.max(0,l-f),g=a.$absColStart?o-1:Math.min(o-1,l),_=c.ref;i===null?c.forEachNodeIn(_.rowStart+p,_.rowStart+m,_.colStart+h,_.colStart+g,r):i(c,_.rowStart+p,_.rowStart+m,_.colStart+h,_.colStart+g,r)}function T(e,t,n,r,i,a){if(C(e))return void w(e,t,n,r,i);let o=e.value,s=o.formulaBlockWidth,c=o.formulaBlockHeight,l=o.formulaEntry.value,u=l.ref,d=n-e.colStart,f=t-e.rowStart,p=e.rowEnd-e.rowStart-(c-1),m=e.colEnd-e.colStart-(s-1),h=u.rowStart+(o.$absRowEnd?0:Math.max(0,f-p)),g=u.rowStart+(o.$absRowStart?c-1:Math.min(c-1,f)),_=u.colStart+(o.$absColEnd?0:Math.max(0,d-m)),v=u.colStart+(o.$absColStart?s-1:Math.min(s-1,d));if(h>g||_>v)return;let y=a.get(o);if(y===void 0)return a.set(o,{rowFrom:h,rowTo:g,colFrom:_,colTo:v}),void i(l,h,g,_,v,r);if(h>=y.rowFrom&&g<=y.rowTo&&_>=y.colFrom&&v<=y.colTo)return;let b=h<=u.rowStart&&g>=u.rowEnd&&_<=u.colStart&&v>=u.colEnd;!b&&_===y.colFrom&&v===y.colTo&&h<=y.rowTo+1&&g>=y.rowFrom-1?(h<y.rowFrom&&i(l,h,y.rowFrom-1,_,v,r),g>y.rowTo&&i(l,y.rowTo+1,g,_,v,r),h<y.rowFrom&&(y.rowFrom=h),g>y.rowTo&&(y.rowTo=g)):!b&&h===y.rowFrom&&g===y.rowTo&&_<=y.colTo+1&&v>=y.colFrom-1?(_<y.colFrom&&i(l,h,g,_,y.colFrom-1,r),v>y.colTo&&i(l,h,g,y.colTo+1,v,r),_<y.colFrom&&(y.colFrom=_),v>y.colTo&&(y.colTo=v)):(i(l,h,g,_,v,r),(g-h+1)*(v-_+1)>(y.rowTo-y.rowFrom+1)*(y.colTo-y.colFrom+1)&&(y.rowFrom=h,y.rowTo=g,y.colFrom=_,y.colTo=v))}function E(e,t,n,r,i,a,o,s,c=null){let l=e.value,u=l.formulaBlockWidth,d=l.formulaBlockHeight,f=Math.max(r,e.rowStart),p=Math.min(a,e.rowEnd);if(f>p)return;let m=Math.max(i,e.colStart),h=Math.min(o,e.colEnd);if(m>h)return;let g=e.rowEnd-e.rowStart-(d-1),_=e.colEnd-e.colStart-(u-1),v=l.$absRowEnd?0:Math.max(0,f-e.rowStart-g),y=l.$absRowStart?d-1:Math.min(d-1,p-e.rowStart),b=l.$absColEnd?0:Math.max(0,m-e.colStart-_),x=l.$absColStart?u-1:Math.min(u-1,h-e.colStart);if(v>y||b>x)return;let S=1,C=0,w=1,T=0;if(t>=e.rowStart&&t<=e.rowEnd&&n>=e.colStart&&n<=e.colEnd){let r=t-e.rowStart,i=n-e.colStart;S=l.$absRowEnd?0:Math.max(0,r-g),C=l.$absRowStart?d-1:Math.min(d-1,r),w=l.$absColEnd?0:Math.max(0,i-_),T=l.$absColStart?u-1:Math.min(u-1,i)}let E=l.formulaEntry.value,D=E.ref,O=e=>{let t=e.rowIndex-D.rowStart,n=e.colIndex-D.colStart;t>=S&&t<=C&&n>=w&&n<=T||s(e)};c===null?E.forEachNodeIn(D.rowStart+v,D.rowStart+y,D.colStart+b,D.colStart+x,O):c(E,D.rowStart+v,D.rowStart+y,D.colStart+b,D.colStart+x,O)}function D(e){let{row:t,col:n,rows:r,cols:i,rowInput:a,colInput:o}=e,s=(e,t,n,r)=>({rowStart:e,colStart:t,rowEnd:n,colEnd:r}),c=s(t-1,n,t-1,n+i-1),l=s(t,n-1,t+r-1,n-1);return a!==null&&o!==null?[s(t-1,n-1,t-1,n-1),c,l]:o===null?[l,c]:[c,l]}var O=(e,t,n)=>{let{gridId:r,row:i,col:a}=e;return e.rowInput!==null&&e.colInput!==null?{gridId:r,row:i-1,col:a-1}:e.colInput===null?{gridId:r,row:i+t,col:a-1}:{gridId:r,row:i-1,col:a+n}},k=(e,t)=>({gridId:e.gridId,row:e.row-1,col:e.col+t}),A=(e,t)=>({gridId:e.gridId,row:e.row+t,col:e.col-1}),j=(e,t)=>32768*e+t;function M(e,t){let r=e.getPrecedents(),i=e.getDynamics(),a=new Map,o=[],s=!1,c=[],l=e=>{if(e.block.hasDataTable())return;let t=e.gridId;if(!t)return;let n=a.get(t);n||(n={byCell:new Map,spills:[]},a.set(t,n));let r=j(e.rowIndex,e.colIndex);n.byCell.has(r)||(n.byCell.set(r,e),e.cachedValue?.isIRange&&n.spills.push(e),o.push(e))},u=(e,t,n,r,i)=>{if(e.unanchored)return;let a=e.ref;e.mintNodesIn(a.rowStart+t,a.rowStart+n,a.colStart+r,a.colStart+i,l)},d=(e,t)=>{if(t.unanchored||t.hasDataTable())return;s=!0;let n=t.ref;t.mintNodesIn(n.rowStart,n.rowEnd,n.colStart,n.colEnd,l)},p={colStart:0,rowStart:0,colEnd:0,rowEnd:0,scope:t.gridId},m=(e,t,n,i,a)=>{p.rowStart=t,p.colStart=n,p.rowEnd=i,p.colEnd=a,p.scope=e,function(e,t,n,r,i){n.length=0,e.search(t,!1,!1,n);let a=n.length;if(a===0)return;let o=t.colStart,s=t.rowStart,c=t.colEnd-o,l=t.rowEnd-s;for(let e=0;e<a;e++){let t=n[e],a=t.value,u=a.formulaEntry.value;if(a.index<0){i(t,u);continue}let d=u.ref,f=d.colEnd-d.colStart,p=d.rowEnd-d.rowStart,m=t.colEnd-t.colStart-f,h=t.rowEnd-t.rowStart-p,g=0,_=p,v=0,y=f,b=s-t.rowStart,x=o-t.colStart;a.$absRowEnd||(g=Math.min(Math.max(b-h,0),p)),a.$absRowStart||(_=Math.min(b+l,p)),a.$absColEnd||(v=Math.min(Math.max(x-m,0),f)),a.$absColStart||(y=Math.min(c+x,f)),r(u,g,_,v,y)}}(r,p,c,u,d)},{rowInput:h,colInput:g}=t;h&&m(t.gridId,h.rowIndex,h.colIndex,h.rowIndex,h.colIndex),g&&m(t.gridId,g.rowIndex,g.colIndex,g.rowIndex,g.colIndex);for(let e=0;e<o.length;e++){let t=o[e],n=t.gridId,r=t.rowIndex,a=t.colIndex,c=t.cachedValue;c?.isIRange?m(n,r,a,r+c.getRowCount()-1,a+c.getColumnCount()-1):m(n,r,a,r,a),!s&&i.has(t.block)&&(s=!0)}if(o.length===0)return o;let _=[],v=e=>{let t=a.get(e.gridId)?.byCell.get(j(e.row,e.col))??null;t===null||_.includes(t)||_.push(t)};for(let e=0;e<t.rows;e++){g&&v(A(t,e));for(let n=0;n<t.cols;n++)v(O(t,e,n))}if(h)for(let e=0;e<t.cols;e++)v(k(t,e));if(_.length===0)return[];let y=[],b=new Set,x=new Set,S=e=>{if(b.has(e)||x.has(e))return;x.add(e);let t=(e=>{let t=[],r=f(e);for(let i=0;i<r.length;i++){let o=r[i];if(n.isError(o))continue;let s=a.get(o.scope??e.gridId);if(!s)continue;let c=o.rowStart,l=o.colStart,u=o.rowEnd,d=o.colEnd;if(c===u&&l===d){let e=s.byCell.get(j(c,l));e&&!t.includes(e)&&t.push(e)}else for(let e of s.byCell.values()){let n=e.rowIndex,r=e.colIndex;n>=c&&n<=u&&r>=l&&r<=d&&!t.includes(e)&&t.push(e)}let f=s.spills;for(let e=0;e<f.length;e++){let n=f[e],r=n.cachedValue,i=n.rowIndex,a=n.colIndex;i<=u&&i+r.getRowCount()-1>=c&&a<=d&&a+r.getColumnCount()-1>=l&&!t.includes(n)&&t.push(n)}}return t})(e);for(let e=0;e<t.length;e++)S(t[e]);x.delete(e),b.add(e),y.push(e)};if(s)for(let e=0;e<o.length;e++)S(o[e]);else for(let e=0;e<_.length;e++)S(_[e]);return y}function N(e,t,n){let{rows:r,cols:i,rowInput:a,colInput:o,gridId:s}=t,c=Array(r);for(let e=0;e<r;e++)c[e]=Array(i);let l=t=>e.layerFor(t.gridId).getValueAt(t.row,t.col)??null,u=(t,n)=>{e.layerFor(s).set(t.rowIndex,t.colIndex,n)},d=(t,n)=>{let r=e.layerFor(t.gridId),i=t.rowIndex,a=t.colIndex,o=n;if(o?.isIRange){let e=o.getRowCount(),t=o.getColumnCount();for(let n=0;n<e;n++)for(let e=0;e<t;e++)r.set(i+n,a+e,o.getValueAt(n,e)??null)}else r.set(i,a,n)},f=()=>{for(let t=0;t<n.length;t++){let r=n[t];d(r,e.evaluate(r))}};for(let e=0;e<r;e++){o!==null&&(u(o,l(A(t,e))),a===null&&f());for(let n=0;n<i;n++)a!==null&&(u(a,l(k(t,n))),f()),c[e][n]=l(O(t,e,n))}return c}export{y as _,N as a,_ as c,f as d,m as f,x as g,w as h,M as i,b as l,v as m,D as n,S as o,p,E as r,T as s,C as t,d as u};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bz9v1lgjvbu4QnOs.js","./DRrM-dY9nM7nDRpV.js","./DVueE--eOrZPrqrm.js","./HclGiUj8dZXDFmoM.js","./C7mXat-6esc1AmRD.js","./DMhOGCTy8V0N14gY.js","./Cx1kZ2u_8JFV2Q8D.js","./ChSvXfVMLxZsP9zG.js","./CQukCzhuewMuFOlO.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./HclGiUj8dZXDFmoM.js";import{I as t}from"./ChSvXfVMLxZsP9zG.js";import{t as n}from"./CnXLpFE_vFrJ5Jbf.js";var r=n({RUN_INTERRUPTED:()=>s,abort:()=>d,check:()=>u,isInterrupted:()=>p,release:()=>f}),i=new Map,a=256,o=16,s=`RunInterrupted`;function c(e){let t=Error(e);return t.name=s,t}function l(e){let t=i.get(e);if(!t){if(i.size>=a){let e=i.keys().next().value;e!==void 0&&i.delete(e)}t={started:Date.now(),calls:0,stopped:null},i.set(e,t)}return t}function u(e,t){let n=l(e);if(n.stopped)throw n.stopped;if(++n.calls%o===0&&Date.now()-n.started>t)throw n.stopped=c(`Run stopped: it exceeded the ${Math.round(t/1e3)} s time limit.`),n.stopped}function d(e,t=`Run cancelled.`){l(e).stopped=c(t)}function f(e){i.delete(e)}function p(e){return e?.name===s}async function m(t,n){let{loadCompiledModule:r}=await e(async()=>{let{loadCompiledModule:e}=await import(`./Bz9v1lgjvbu4QnOs.js`);return{loadCompiledModule:e}},__vite__mapDeps([0,1]),import.meta.url);return r(t,n)}var h=null,g=null,_=null,v=null;async function y(){return v||(v=(async()=>{let t=await(await e(async()=>{let{initialize:e}=await import(`./DVueE--eOrZPrqrm.js`);return{initialize:e}},__vite__mapDeps([2,3]),import.meta.url)).initialize();if(!t)throw Error(`TypeScript could not be loaded. Check your connection and try again.`);return t})()).catch(()=>{v=null}),v}var b=Object.freeze({compile:async function(n){if(!n?.source)return{module:null,diagnostics:[]};if(g&&t.deepEqual(g,n))return h;let r=await(await(async function(){if(_)return _;let{TypeScriptCompiler:t}=await e(async()=>{let{TypeScriptCompiler:e}=await import(`./C7mXat-6esc1AmRD.js`);return{TypeScriptCompiler:e}},__vite__mapDeps([4,3]),import.meta.url);return _=new t})()).compileModule(n);return h=r,g=n,r},lint:async function(t,n){if(!t)return[];let[r,{lintScript:i}]=await Promise.all([y(),e(()=>import(`./DMhOGCTy8V0N14gY.js`),__vite__mapDeps([5,6,7,3,8]),import.meta.url)]);return i(r,t,n)},cleanup:function(){_&&(_.terminate(),_=null,h=null)}});export{m as n,b as r,r as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Bz9v1lgjvbu4QnOs.js","./DRrM-dY9nM7nDRpV.js","./DVueE--eOrZPrqrm.js","./HclGiUj8dZXDFmoM.js","./CXeDqC02BZcixiHS.js","./mzrDp0emvkWnkXBt.js","./BiRVjUOUI8Qv0CE1.js","./D4RZZdlItfrgQHcE.js","./CQukCzhuewMuFOlO.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./HclGiUj8dZXDFmoM.js";import{I as t}from"./D4RZZdlItfrgQHcE.js";import{t as n}from"./CnXLpFE_vFrJ5Jbf.js";var r=n({RUN_INTERRUPTED:()=>s,abort:()=>d,check:()=>u,isInterrupted:()=>p,release:()=>f}),i=new Map,a=256,o=16,s=`RunInterrupted`;function c(e){let t=Error(e);return t.name=s,t}function l(e){let t=i.get(e);if(!t){if(i.size>=a){let e=i.keys().next().value;e!==void 0&&i.delete(e)}t={started:Date.now(),calls:0,stopped:null},i.set(e,t)}return t}function u(e,t){let n=l(e);if(n.stopped)throw n.stopped;if(++n.calls%o===0&&Date.now()-n.started>t)throw n.stopped=c(`Run stopped: it exceeded the ${Math.round(t/1e3)} s time limit.`),n.stopped}function d(e,t=`Run cancelled.`){l(e).stopped=c(t)}function f(e){i.delete(e)}function p(e){return e?.name===s}async function m(t,n){let{loadCompiledModule:r}=await e(async()=>{let{loadCompiledModule:e}=await import(`./Bz9v1lgjvbu4QnOs.js`);return{loadCompiledModule:e}},__vite__mapDeps([0,1]),import.meta.url);return r(t,n)}var h=null,g=null,_=null,v=null;async function y(){return v||(v=(async()=>{let t=await(await e(async()=>{let{initialize:e}=await import(`./DVueE--eOrZPrqrm.js`);return{initialize:e}},__vite__mapDeps([2,3]),import.meta.url)).initialize();if(!t)throw Error(`TypeScript could not be loaded. Check your connection and try again.`);return t})()).catch(()=>{v=null}),v}var b=Object.freeze({compile:async function(n){if(!n?.source)return{module:null,diagnostics:[]};if(g&&t.deepEqual(g,n))return h;let r=await(await(async function(){if(_)return _;let{TypeScriptCompiler:t}=await e(async()=>{let{TypeScriptCompiler:e}=await import(`./CXeDqC02BZcixiHS.js`);return{TypeScriptCompiler:e}},__vite__mapDeps([4,3]),import.meta.url);return _=new t})()).compileModule(n);return h=r,g=n,r},lint:async function(t,n){if(!t)return[];let[r,{lintScript:i}]=await Promise.all([y(),e(()=>import(`./mzrDp0emvkWnkXBt.js`),__vite__mapDeps([5,6,7,3,8]),import.meta.url)]);return i(r,t,n)},cleanup:function(){_&&(_.terminate(),_=null,h=null)}});export{m as n,b as r,r as t};
@@ -0,0 +1 @@
1
+ export{t as PictureEditor}from"./hB5riGkPy0wXVIig.js";
@@ -0,0 +1 @@
1
+ import{n as e}from"./CbXtAM7H-Jg_J0dk.js";import{i as t,t as n}from"./gU2zeJaXoNh7QI_e.js";import{n as r}from"./CQ-33-es3XJ56pR4.js";import{t as i}from"./Bdb0azxGoCh6NBDk.js";import{$ as a,L as o,Z as s,q as c}from"./DJebrQ5mu8uxpX3b.js";import{n as l}from"./D72Rp__0TEqJ972a.js";import{A as u}from"./jteb4n23QwBT9m_4.js";import{i as ee,n as te,r as ne}from"./D8EmNst-H2v0eWcf.js";var d=e(t(),1),f=n(),p=e=>Math.round(1e3*e)/1e3,m=(e,t,n)=>{let r=p(50*(1-e.width/(n*t.width))),i=p(50*(1-e.height/(n*t.height)));return{left:r,right:r,top:i,bottom:i}},h=(e,t)=>m(e,t,Math.max(e.width/t.width,e.height/t.height)),g=(e,t)=>m(e,t,Math.min(e.width/t.width,e.height/t.height)),_=(e,t,n)=>{let r=Math.min(e.width,e.height*n),i=r/n,{left:a=0,top:o=0,right:s=0,bottom:c=0}=t,l=(e.width-r)/2/e.width*(100-a-s),u=(e.height-i)/2/e.height*(100-o-c);return{bounds:{x:e.x+(e.width-r)/2,y:e.y+(e.height-i)/2,width:r,height:i},crop:{left:p(a+l),right:p(s+l),top:p(o+u),bottom:p(c+u)}}},v=`data:image/webp;base64,UklGRhIPAABXRUJQVlA4TAYPAAAv/8F/EM8HIZJtWU0fdlTh3wRCIMlkE+EqkiTFyt57/KQ8/zKeEf5iaseNJClS1DGDxWcwvhfuCo5tW88SHw8Xh5ypbC3tnf8QHEfOB/D97w4PuFHBIx6MHJ74zvj/0aLdlH9AYWEjHiwOJR5M7Q+FAigmTRQOJRqczrVUKABQSMYgoAFFAhIwBkgaYEkBSABowDGgcYakUZirArQhRMUIIHGLBIAEEoDRfyokIAEAMhrSRmEOSPyS/jvR+BYFIWkUhLQhCpLGGQ2rhPiCOKPxDIVQmAZQDMYIjCTfNQXVJv8pnQqhuAonnczGDPv0VwFw/w+uGiAwQYjJXxffaJzROKPHoArGAPA+6o9AtiIj4XgAWGKCwAQBVNMSHQNEjTMqOSWPQEFRHOVl4vp/nnhI/DBNK8CGXCpeFvONip/jvPn67qb957v+Nssyv96/Jwg/xzT9yORhfR4fb6vF9ef39Nt62g55v37/7dRzfx9xFLRtIyX8ae+/AxARE8APxbCQtkidoqVGDBDxR3r8/59vo88vnW07v9nrY+l0tn0zemuSnn03W83Otn2zcarbfIrZqnG7Ykr77/nS5PP+/E6/iP7DgiRJiZX13F2QhYM/OrBtm7at/ZB927Zt27ZtPr/oK7Jt27b9x7dtGxcv1sFcc/R1woj+S2IkSZGkaXMpD2sZhqf3R5Y/23+2/2z/2f6z/Wf7z/af7T/bf7b/bP/97S8/r8tpn2+Rafa98ufeMc3nfK8v3V9QZHWVtFs5f/i2z8bd7+E/nX/Vuk9+uO6dF3IuWEy12r0S9eGUdA5q0RtuvnxxXpUFVPf5eQlfe7jG8j58Q6+uZZZNRGmv+GgOidbMMHMMy/WbJu7az/wcUqUk9C01LJNj5tZsDsnuizfPWh/F3WdN4FDO/eiYow4LozJuhpfDoPtcywyr8pAYDpv2RlmOB1TF7fBymPXAqA4Wwskrp3JY9oVZZA2efmm8m8O2Xa796tcoMprDvA2DAprXfkYWC9C0eflat2xrBgtRrKuDwgXemsKS5I6vr2zVzq9ZnLbUUzSHL5lFast+JTPi1rJUZWzN1bBuSSxZ7pvqaFfeVpYub2QtzaqI3McCtsppqPXPTWc0C9kjB3TqyFcsZ54b8/XpXJSHRW23qU1LJrC4PdFRlWsMzWCJ815ZpUYDU1no7mqiQ7VvYbnz9zIUaOkqFr3tZ7XnfKSHhe/+ON3pNJblL8N1QXEG+xlCXzXXmvKZjKJYn9IWKV7POMqIqlaYVtEMpU0l6lq46Eo3g2lvO2WtRPoB48m/SFXjwt3JiMqYp6eJkHWTGVQ3BZSky30Mq0/KVMTnZ2BN6aggV2UwtPa0UI+rGV1pylkm1RjB+IpZqpoxRG5ghGW/oZjr9xlj+xarZSiBBEaZe5BSxhK4jXHmeVElj/2Bkeb2KeQVzWKs7eumDnMZbemtlGEU4236UVUYyojb3UATK5Yx5lY30sOqRVlBn3YPdqKCgrexZ7SwcknQP13bfjWC6nD1XEcreHs8QgXOTg369bDmlxFQNU28mRpwYUMNXDcTQVXC2woYTOo2DrJxk1+ZQ9/9PIeNprjRs72ij4H2wbdZjdzdTDYizUXG9P3gnfZGDVy3gFMxD5ZBN9U7BWoJpoK2OpBvHvbYArWBUlFDgXu8QG2BVJanG2xLxC/UckNZZ6Om5VZmnd1NQfvtrRJzByPGXHr8ohqyn/eOr0MIZXAJZFvF1zGAUvC0AuzT+LpgXxJ7K/BuK/jA8LpiXhpPwZ3dcFN4XbIukUVgnVR01Y4WhVi19KLTC6Ca/vD4uevReM40PgHVY9GFMC2bHkAtG10Qy9K5rzHOLQkcGVwYwxJ6H+fspuAC2ZVSG5Rbjg0ulFk5Ta2FcUHTvcqtGrCo7aqZFo2EaK3oOXi0mpOO+xoinOB8cGgF2JTYrQC9EFoRJqV2Gp6Z3oisEItymxKBbniR+yIrxqDsBoCzUGQFpS+93fnYNiO4Z6FVwxc1WjXpotdCc0HoXHRMPucfY0qQTXJ6L+jqGCY0EzekcaOm+LY/g4PSCGCuirwgDtJ4dePy/uCvg2tJ8wNkhDzmObBsJDkhj7OagtL3rrwAhX84mnWiv8Yz+M/IXgyZHTFNc3jZ7dLYfSNo5uA2EpLzJT/c8b1liOY47CtHKOEfj+xcyRJ2vCqAx0MyRR2zE88uwr4hV9RxkoHGeIDv93Cf8aVotiT/uiTb0X+uKfFgnCw5Y473FWJxu7whx/wull0JkMwhx5MMJJ6UPeKYjyCZ43iw/BHHTwOxtAQAOPafwGEExem+vKd794bhxzckhNFvDgGbYbhCgoAbe46jcKsw0MbcH4Qv3hAH2vgOHIsbg4CNPScxuFcoWGPuhWFX8WnO/gt7hufPIVhSEstIOjN7ChF4WDhIY34RwcqGb4uHWfjnPZwmAQGN73PI7xkh4Yy5nvzuFhPOeKj4OkhQsqeJF9qz0DXAWB45sBFU7K6QXoKENTLOzPyC9PYIDGR8sfBOscikTwfzHp3MJlOPcujyB2TnYjiEMbeUfn0jOoRxP9GVeRgPYPyk6FqH3AaAUh5ZkOL4hpC/XLOim8/yXQ3yxXxWck9o4gb3h85/inFrhLfLQf3iIZIPNfmWLFQvniG4DyUPtYvHij7V0UXl4uxqua0vG3WLOUduNxjdELBn98vm8Jroy5z5jCSzJpY9m/CWnF43NYtvlHu8CclKxeJPxDabzNQrfkBsZ8pNteLMCKmdIDu1irmj1LaRn1rFraT2oAxVKh4oNcuHj7aRx9FNhof3pPaq5Djyzsi2RD3sDXmCSAejD/wqmeIM3y7JzS1b9YkfkfpAIchXdeI1Yu9ZqrHaxNOFdqGcVSbmgMyW974v2DmPb3A+lMhsbcl6rMrMXCCz9WSuKnFDmW0gdzWJc2S2suxVJO4s9YiT/uoRt5TZ1gJQjbitzMaJQC3iFVJfqhAElYiX6M3VCQ7FijMOokpYIfSTMFQLbYV+QQhlobUXtDJB9dBZ6OnOAFVEjtDznfyribpCz3e2ryoKLP9yJ4Uyu9x+rsmYUS2zS7yrjDSpjwuidbXxtdCmda46NghtGuPq4yOphx071LYKeZ+E7hXXamTk37XjTjzo+gqq0ThI7L2Nq9X7Z7Gexp1aq1ofnovVNO7cmfX67FyspXEnP/P74qxa1uho3Omrm6ZePpF73PkPzL41q5gbSOzu8PrOvGbek9uoXvF2Z1bKbQOvd8yajU3kdpHRx+W6yY4QfGfjfT4tV87dJLfBD1y+Kqudm0jwjjX5orx6+ol+ISM9viernxV/5+53wqw94f3OSCHJ/XII3Z/23S+tgPeHH5DovQgYoAWye5ovQkdldwpehNIDspuOLkSPkfDdCXaXo+7Pdj8G87pGemPRgnRI/Eua2/Pd78zMMvH3OhxtZhw/I/G7AytM78lvS6o4lQI4YuRQcbofwH5n//w6UqDeJwDtSBSpNyEcXSigSHkgHIqUqXq6x53xGUFoV56ZdHwZg41hYuU5jsF0b6AE6zEC0fEk0RqAwpIg0XKXwDiC6G9ghGsLwWgXolUZFzVxWAxjph3TgRyLsuFHIATsfQLS1gQRWw7laOMARGyyQUi61z5k/QiKRd1Dtq8Qi79e847ZDst/3Al+ROO7N6xn5HGtQWh62DdqiwiOWWyjtipAeLrXNGzvQjq40J5hu/ccIoPvOcbtUlBnFMF8VdZFswowGX6U4Yl+2KOLQHWiW+D2NUPl5/29Ijcb2NEGtYqc/ySw0wlzV2+038muI2AtFXWS2zCsewq3gsl+ZytEZnC/Xmi/011M0FpQYSPW/QRcwWC/80WfA3fcCXdOr2+ElFz+/U74CoFrnkPjFCy97I2tInRdo9T6RkgGku93yrYEz68HZdY3QrKQungC2DoKVCQTifM3g3g6yfboZfY76zCC2CeKHAvMNmPW/U47vogw9kKo4KzkLGMFzONOfFSo0Myk3O3A3xLMLlKowOxk3O/MtQlnj8QKy1C+/U69koCa6/BYQVnK1kcEtUV6kP1OvqsRVkOuV+wYMpuOqfY7ew8C26/7B+s6Y4maQXC7VMG6zFqaHigmvK0aravMZfm5E7SFfMJhdo/WRfZy/NwZ5hHk5vkgWscByNAj1YS5CxStwxCUb3dTQt2T4ToKQvGfO0kbgu3f28J1EIbCP3eWKwl40x8Yrm0ginaLQcg79ZCgX7UJRcEmnSPsncBBv2oZjGLF5sA/70y3oj/vTIcVcIpRHw3+nS1mnLHIzH1JAdV+MPhXk4WkRC5SQU1Sg3711QgJSnwfRWjhFPPuQ33e2b4oIi30WgZDblUd0kPzIbsvhzTRMMCm1yNddClc3iPqOO+ULrD2HSJ15EiEyr2YFFJVPFCeHqSSAh/gvPsZtZx32ptQPkd3xZx24NkYX1EbIsVczQUotivppivhSW1J2undDHDzGhqQfno+HZmHCkhDtYzG5fZzpKOOTUblxmrSUic2gjrv9KSoym8GJH0l6SozC40J9UlbHUnB4vETpK9OPorkZURWkcY6H4VjEbPupLWe9WKwriHpreZfIniyqPOkuSLmuaU3rRtpr4N7hf9/4yfSX+d2Sj6tqZdBKsx5j9Tu6EBa7IRLZLt6OUiRHZoqr62NSJddiHTLKsVJ+uzAWElXLBheRhrN4ZwmpcdakFarNS9bxDnMToMUW9148cTMKyfldvpu0WTecJz0mxEn1x2e+DzScQ6fTAsmZ2xtTz+n5juS5bGlM+m66meSZPl7Y2dnUnjLtmaIsSpxVEdSerkuvwiTmOedIMV38uKUcHfXqwFSflVL4zPDeJxhV3uyBB2/cnx4+sK8QJahqm47Y8PNg9c0JItRedyM2PAxMWqZQVakyrgZMeFg7y8PsS7VeuO70P4bxP3ZRaUGWZ6OmVv9oSk63llBVqkLh4Zt9IaW1Tt6tjfIYhWRY86YGCKH/WWGmUOWraaHxzw1yV2DMxQ2zHq51Tmyfl2o99bI25Jig2vP54ljDp9ykLWsdj3fkO9vvWPKtL8wndo7YeztOy8bcKh5OVncyhq2XNrd96ZpLrjy5/qYb/l8S7q2r1NJlj/bf7b/bP/Z/rP9Z/vP9p/tP9t/tv9s//3djwA=`,y={left:`0%`,top:`0%`,width:`100%`,height:`100%`},b={position:`absolute`,left:0,top:0,width:`100%`,height:`100%`,display:`block`,pointerEvents:`none`},re=(0,d.memo)((0,d.forwardRef)((e,t)=>{let{children:n,disabled:p,style:m,picture:h,movable:g,zoom:_=1,gesture:re,description:ie,tile:x,offsetX:S=0,offsetY:C=0,isDragging:w,onHide:ae,onShow:oe,onDragZone:se,onTap:T,adornmentHost:ce,flip:E,onKeyDownCapture:le,onFocus:ue,onBlur:de,loadingPanel:fe,...pe}=e,[D,O]=(0,d.useState)(!1),[k,me]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),[he,P]=(0,d.useReducer)(e=>e+1,0);r(h,{onAnyChange:P}),r(g??null,{onBoundsChange:P,onSelectionChange:P});let ge=i(),F=o(),I=h.toJSON(),{width:L,height:R,rotation:z}=te(g),B=L>0&&R>0,V=!!I.fill||!!I.stroke||I.geometry!==void 0&&I.geometry!==`rect`,_e=I.adjustments?JSON.stringify(I.adjustments):``,[H,U]=(0,d.useState)(null),[ve,W]=(0,d.useState)(!1);(0,d.useEffect)(()=>{if(!V||!B)return U(null),void W(!1);let e=!0;return h.getGeometry(L,R).then(t=>{e&&(U(t),W(!0))},()=>{e&&(U(null),W(!0))}),()=>{e=!1}},[h,V,B,I.geometry,_e]);let G=(0,d.useMemo)(()=>H&&B?H.getWidth()===L&&H.getHeight()===R?H:H.resize(L,R):null,[H,B,L,R]),[ye,be]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!x||!A)return;let e=!0,t=new Image;return t.src=A,(typeof t.decode==`function`?t.decode():Promise.resolve()).catch(()=>{}).then(()=>{e&&be(A)}),()=>{e=!1}},[x,A]),s(!D&&(x?ye!==A||!A:!k)||V&&B&&!ve);let K=ge?.getStyles()??null,q=(0,d.useMemo)(()=>V?ne({fill:I.fill,stroke:I.stroke,style:null},K):null,[V,I.fill,I.stroke,K]),J=`${(0,d.useId)().replace(/[^A-Za-z0-9_-]/g,``)}-clip`,Y=(0,d.useMemo)(()=>{if(!G||I.geometry===void 0||I.geometry===`rect`)return null;let e=[];return G.forEachPath(t=>{t.layer===`fill`&&e.push(t.d)}),e.length>0?e.join(` `):null},[G,I.geometry]),xe=E?.horizontal??!1,Se=E?.vertical??!1,Ce=(0,d.useMemo)(()=>z%360==0&&B?{dpr:a.getDevicePixelRatio(),zoom:_,width:L,height:R,flipH:xe,flipV:Se}:null,[z,B,_,L,R,xe,Se]),X=h.getHyperlink?.()??null,Z=u(l,null),Q=(0,d.useRef)(null);(0,d.useEffect)(()=>()=>{Q.current?.(),Z(e=>e===h?null:e)},[h,Z]),(0,d.useEffect)(()=>{X||Z(e=>e===h?null:e)},[!X,h,Z]);let $=(0,d.useCallback)(e=>{g?.unselect(),e.open().catch(e=>{F.showError?.(e instanceof Error?e:String(e))})},[g,F]);(0,d.useEffect)(()=>{T?.(()=>{let e=h.getHyperlink?.();return!!e&&($(e),!0)})},[T,h,$]),(0,d.useEffect)(()=>{j(null),h.getDetails().then(e=>{O(!1),j(e.asUrl()),N(e.asSVGText?.()||null)}).catch(e=>{console.warn(e),O(!0),j(v),N(null)})},[h,he]);let we=c(t,()=>({isPictureEditor:()=>!0}),[]),Te=I.image?.sourceRect,Ee=(0,d.useMemo)(()=>(e=>{let{left:t=0,top:n=0,right:r=0,bottom:i=0}=e??{},a=(100-t-r)/100,o=(100-n-i)/100;return{left:-t/a+`%`,top:-n/o+`%`,width:100/a+`%`,height:100/o+`%`}})(Te),[Te]),De=(0,d.useMemo)(()=>{if(A||M)return x?(0,f.jsx)(`div`,{style:{backgroundPosition:`${S}px ${C}px`,backgroundImage:`url(${A})`,backgroundRepeat:`repeat`,backgroundSize:`auto`,width:`100%`,height:`100%`,filter:`var(--_sxl-image-filter)`}}):(0,f.jsx)(`img`,{style:{position:`absolute`,...D?y:Ee,border:D?`var(--sxl-color-neutral, grey) solid 1px`:void 0,backgroundColor:D?`var(--sxl-color-base-100, white)`:void 0,boxShadow:D?`0px 0px 3px var(--sxl-color-error, red)`:void 0,objectFit:D?`contain`:void 0,opacity:+!!k,filter:`var(--_sxl-image-filter)`},draggable:!1,src:A??void 0,onLoad:()=>{me(!0)},onError:({currentTarget:e})=>{console.log(`error`),e.onerror=null,j(v),O(!0)},alt:ie??`${h.getType()}`})},[k,h,A,M,w,x,S,C,Ee,D,ie]);if(h.isDeleted())return;let Oe=E&&(E.horizontal||E.vertical)?`scale(${E.horizontal?-1:1}, ${E.vertical?-1:1})`:void 0,ke=m?.pointerEvents===`none`?`none`:`visiblePainted`,{left:Ae=0,top:je=0,right:Me=0,bottom:Ne=0}=I.image?.stretch??{};return(0,f.jsxs)(`div`,{className:`sxl-picture-editor`,style:{position:`relative`,display:`flex`,flex:`1 1 100%`,filter:w?`drop-shadow(1px 1px 1.5px var(--sxl-color-shadow, rgba(0, 0, 0, .25)))`:void 0,transform:Oe,transformOrigin:`center`,...m,pointerEvents:`none`,width:`100%`,height:`100%`},...pe,onPointerDownCapture:X?e=>{if(e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||!g||g.isSelected())return;Q.current?.();let t=e.currentTarget.ownerDocument,{pointerId:n,clientX:r,clientY:i,timeStamp:a}=e.nativeEvent,o=e=>{if(e.pointerId!==n||(Q.current?.(),!(Math.abs(e.clientX-r)<=4&&Math.abs(e.clientY-i)<=4&&e.timeStamp-a<=500)))return;let t=h.getHyperlink();t&&$(t)},s=e=>{e.pointerId===n&&Q.current?.()};t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,s),Q.current=()=>{Q.current=null,t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,s)}}:void 0,onPointerEnter:X?()=>{Z(h)}:void 0,onPointerLeave:X?()=>{Z(e=>e===h?null:e)}:void 0,onKeyDownCapture:e=>{le?.(e)},ref:we,children:[G&&q?(0,f.jsx)(`svg`,{className:`sxl-picture-fill`,viewBox:`0 0 ${L} ${R}`,preserveAspectRatio:`none`,overflow:`visible`,style:b,children:(0,f.jsx)(ee,{geometry:G,style:{...q,stroke:null,strokeGradient:void 0,strokeWidth:0},zoom:_,grid:Ce,hit:ke})}):null,Y?(0,f.jsx)(`svg`,{width:0,height:0,style:{position:`absolute`},"aria-hidden":!0,children:(0,f.jsx)(`defs`,{children:(0,f.jsx)(`clipPath`,{id:J,clipPathUnits:`objectBoundingBox`,children:(0,f.jsx)(`path`,{d:Y,transform:`scale(${1/L} ${1/R})`})})})}):null,(0,f.jsx)(`div`,{className:`sxl-picture-clip`,style:{position:`absolute`,...y,clipPath:Y?`url(#${J})`:void 0,pointerEvents:m?.pointerEvents??`auto`,cursor:X&&!g?.isSelected()?`pointer`:void 0},children:(0,f.jsxs)(`div`,{className:`sxl-picture-image`,style:{position:`absolute`,left:`${Ae}%`,top:`${je}%`,right:`${Me}%`,bottom:`${Ne}%`,overflow:`hidden`},children:[k||D?void 0:fe,De]})}),G&&q&&q.strokeWidth>0?(0,f.jsx)(`svg`,{className:`sxl-picture-border`,viewBox:`0 0 ${L} ${R}`,preserveAspectRatio:`none`,overflow:`visible`,style:b,children:(0,f.jsx)(ee,{geometry:G,style:{...q,fill:null,gradient:void 0,image:void 0},zoom:_,grid:Ce,hit:ke})}):null]})}));re.displayName=`PictureEditor`;export{_ as i,g as n,h as r,re as t};
@@ -0,0 +1 @@
1
+ export{r as t}from"./BpJaTpbR_CQzXj9M.js";
@@ -1,2 +1,2 @@
1
- import{Z as e,u as t}from"./ChSvXfVMLxZsP9zG.js";import{a as n}from"./DcrVJCyDwGKeil2U.js";import{A as r,C as i,K as a,Nt as o,Q as s,Tt as c,Zt as l,ct as u,f as d,o as f,on as p,q as m,vt as h,zt as g}from"./CAQ7QWes7j7Fq8o5.js";var _=Object.freeze({}),v=/^(line|lineInv|straightConnector\d|bentConnector\d|curvedConnector\d)$/,y=()=>{},b=class extends n{constructor(e){super(e),this._textSource=null,this._textFrame=null,this._resources=null,this._connectorFormat=null,this._style=null,this._drawn=null,this._drawnPending=null,this._getStyles=e.getStyles??null,e.json&&(this._updateState({data:e.json}),this._resources=D(e.json,e.fromResourceId))}_processAfterStateChange(e,t){super._processAfterStateChange(e,t),p()}getResource(e){return this._resources?.get(e)??null}getType(){return`shape`}getShapeType(){let e=this._getState()?.data?.geometry;return typeof e==`string`?e:e?`custom`:`rect`}setShapeType(n,r){let i=r?.description??e(`op.setShapeType`);if(this._protectionCheck(i),!n||typeof n!=`string`||n===`custom`)throw new t(`Invalid shape type: ${n}.`);if(this.isConnector()!==v.test(n))throw new t(this.isConnector()?`A line or connector cannot be changed to another shape.`:`A shape cannot be changed to a line or connector.`);let a={...this._getState()?.data??{},geometry:n};delete a.adjustments;let o=this._beginCommit(i);try{this._updateState({data:a},{...r,description:i},[`onAnyChange`]),this._notifyPlacementChange(),o.commit()}catch(e){throw o.rollback(),e}return this}getTextFrame(){let e=this._getState()?.data??null;if(e===this._textSource)return this._textFrame;let t=T(e);return this._textSource=e,this._textFrame=t===null?null:Object.freeze({getText:()=>t}),this._textFrame}getStyle(){return this._style?this._style:this._style=new f({getData:()=>this._getState()?.data??null,getStyles:()=>this._getStyles?.()??null,getTheme:()=>this._theme(),getMovable:()=>this.getMovable(),getResource:e=>this.getResource(e),write:(e,t)=>this._writeStyle(e,t)})}_writeStyle(t,n){let r=n.description??e(`op.setShapeStyle`);this._protectionCheck(r);let i={...this._getState()?.data??{}};for(let e of Object.keys(t)){let n=t[e];n===void 0?delete i[e]:i[e]=n}this._updateState({data:i},{...n,description:r},[`onAnyChange`])}getAdjustments(){return this._getState()?.data?.adjustments??_}setAdjustments(t,n){let r=n?.description??e(`op.setShapeAdjustments`);this._protectionCheck(r);let i={...this._getState()?.data??{}};t&&Object.keys(t).length>0?i.adjustments={...t}:delete i.adjustments;let a=this._beginCommit(r);try{this._updateState({data:i},{...n,description:r},[`onAnyChange`]),this._notifyPlacementChange(),a.commit()}catch(e){throw a.rollback(),e}return this}_setRoute(t,n){let r={...this._getState()?.data??{},geometry:t};n?r.adjustments={...n}:delete r.adjustments,this._updateState({data:r},{description:e(`op.setShapeAdjustments`)},[`onAnyChange`])}isConnector(){return this._getState()?.data?.type===i.Type.Connector}getConnectorFormat(){return this.isConnector()?(this._connectorFormat??=new x(this),this._connectorFormat):null}async getConnectionSiteCount(){let e=await this.getGeometry(),t=0;return e?.forEachConnection(()=>{t++}),t}_connectedEnd(e){return(this._getState()?.data)?.connectorEnds?.[e]??null}_connectedMovable(e){let t=this._connectedEnd(e),n=this.getMovable()?.getRange().getWorksheet()??null;return t&&n?c(n,t.id):null}_connect(n,r,i,a){let o=a?.description??e(`op.connectShape`);this._protectionCheck(o);let s=this.getMovable(),c=s?.getRange().getWorksheet()??null;if(!s||!c)throw new t(`A connector is glued on a sheet.`);if(r===s)throw new t(`A connector cannot be glued to itself.`);if(r.getRange().getWorksheet()!==c)throw new t(`A connector is glued to a movable on the same sheet.`);if(!(Number.isInteger(i)&&i>=0))throw new t(`Invalid connection site: ${i}.`);let d=this._beginCommit(o);try{let e={id:h(r,()=>u(c)),index:i};this._writeEnd(n,e,{...a,description:o});let t=()=>{this.isDeleted()||s.isDeleted()||this._amend(()=>l(c,s,t))};l(c,s,t),d.commit()}catch(e){throw d.rollback(),e}}_disconnect(t,n){let r=n?.description??e(`op.connectShape`);this._protectionCheck(r),this._connectedEnd(t)&&this._writeEnd(t,null,{...n,description:r})}_writeEnd(e,t,n){let r={...this._getState()?.data??{}},i={...r.connectorEnds};t?i[e]=t:delete i[e],i.start||i.end?r.connectorEnds=i:delete r.connectorEnds,this._updateState({data:r},n,[`onAnyChange`])}_notifyPlacementChange(){this.getMovable()?._notifyPlacementChange?.()}_amend(e){let t=this._transactions;return t.amend(t.getCurrentCommit(!1).getId(),()=>e())}async getGeometry(e,t,n){if(e===void 0||t===void 0){let n=this.getMovable()?.getBounds();if(!n)return null;e??=n.width,t??=n.height}let i=this._getState()?.data??{},a=n?S(i,n):i,o=await r(a,this._theme(),e,t);return o&&a===i&&this._getState()?.data===a&&!this._drawnPending&&(this._drawn={data:a,width:e,height:t,geometry:o,rect:d(o),connections:C(o)}),o}_getDrawnRect(e,t,n){let r=this._evaluated(e,t,n);if(!r?.rect)return null;let i=r.width>0?e/r.width:1,a=r.height>0?t/r.height:1,o=r.rect;return{l:o.l*i,t:o.t*a,r:o.r*i,b:o.b*a}}getConnections(e,t,n){let r=n?.adjustments,i=this._evaluated(e,t,n?.onReady??y);if(!i)return null;if(r!==void 0){let n=i.geometry?.withAdjustments(r)??null;return n?C(n.getWidth()===e&&n.getHeight()===t?n:n.resize(e,t)):null}if(i.width===e&&i.height===t)return i.connections;let a=i.width>0?e/i.width:1,o=i.height>0?t/i.height:1;return i.connections.map(e=>({...e,x:e.x*a,y:e.y*o}))}_evaluated(e,t,n){let i=this._getState()?.data;if(!i)return null;let a=this._drawn;if(!a||a.data!==i||a.width!==e||a.height!==t){let a=this._drawnPending;if(!a||a.data!==i||a.width!==e||a.height!==t){let a={data:i,width:e,height:t};this._drawnPending=a,r(i,this._theme(),e,t).then(e=>{this._drawnPending===a&&(this._drawnPending=null,this._drawn={...a,geometry:e,rect:e?d(e):null,connections:e?C(e):[]},n())},()=>{this._drawnPending===a&&(this._drawnPending=null)})}}return a}_theme(){try{return this._getStyles?.()?.getTheme()?.toJSON()??null}catch{return null}}toJSON(e){let t=this._getState(),n=null;return t&&t.data&&(n=e?O(t.data,this._resources,e):t.data),n}getTypeDescription(){return`Shape`}acceptRotation(e){return e}acceptFlip(e){return e}get isIShape(){return!0}get[Symbol.toStringTag](){return`[Shape]`}toString(){return this.getTypeDescription()}},x=class{constructor(e){this._shape=e}getEndPoints(e){let t=e??(this._shape.getMovable()?g(this._shape.getMovable()):null);return t?m(t):null}placeEnds(e,t){return s(e,t,this._shape.getMovable()?.getRotation()||0)}getGluedRoute(e){let t=this._shape.getMovable(),n=t?.getRange().getWorksheet()??null;if(!t||!n)return null;let r=o(n,t,e??g,y);return r?{placement:r.placement,shapeType:r.route?.geometry??null,adjustments:r.route?.adjustments??null}:null}getConnectorType(){let e=this._shape.getShapeType();return e.startsWith(`bentConnector`)?i.ConnectorType.Elbow:e.startsWith(`curvedConnector`)?i.ConnectorType.Curved:i.ConnectorType.Straight}isStartConnected(){return this._shape._connectedEnd(`start`)!==null}getStartConnectedMovable(){return this._shape._connectedMovable(`start`)}getStartConnectionSite(){return this._shape._connectedEnd(`start`)?.index??null}startConnect(e,t,n){this._shape._connect(`start`,e,t,n)}startDisconnect(e){this._shape._disconnect(`start`,e)}isEndConnected(){return this._shape._connectedEnd(`end`)!==null}getEndConnectedMovable(){return this._shape._connectedMovable(`end`)}getEndConnectionSite(){return this._shape._connectedEnd(`end`)?.index??null}endConnect(e,t,n){this._shape._connect(`end`,e,t,n)}endDisconnect(e){this._shape._disconnect(`end`,e)}},S=(e,t)=>{let n={...e};return t.shapeType!==void 0&&(n.geometry=t.shapeType),t.adjustments===null?delete n.adjustments:t.adjustments!==void 0&&(n.adjustments={...t.adjustments}),n},C=e=>{let t=[];return e.forEachConnection(e=>t.push(e)),t},w=e=>e.runs.map(e=>e.text??``).join(``),T=e=>e&&e.text?(e=>{let t=e.paragraphs.map(w),n=0,r=t.length;for(;n<r&&t[n].trim()===``;)n++;for(;r>n&&t[r-1].trim()===``;)r--;return t.slice(n,r).join(`
2
- `)})(e.text):null,E=e=>{let t=e.fill;return t?.type===a.Type.Image?t:void 0},D=(e,t)=>{let n=E(e)?.resId,r=n===void 0?void 0:t?.(n);return r?new Map([[n,r]]):null},O=(e,t,n)=>{let r=E(e);if(r?.resId===void 0)return e;let i=t?.get(r.resId),a=(i?n(i):null)??void 0;if(a===r.resId)return e;let{resId:o,...s}=r;return{...e,fill:a===void 0?s:{...s,resId:a}}};export{b as Shape};
1
+ import{Z as e,u as t}from"./D4RZZdlItfrgQHcE.js";import{a as n}from"./BQTLEc84Eql61S2m.js";import{Et as r,H as i,Ht as a,K as o,Ot as s,Q as c,Zt as l,b as u,c as d,j as f,kt as p,n as m,sn as h,st as g}from"./COL9dj40ytErlGak.js";var _=Object.freeze({}),v=/^(line|lineInv|straightConnector\d|bentConnector\d|curvedConnector\d)$/,y=()=>{},b=class extends n{constructor(e){super(e),this._textSource=null,this._textFrame=null,this._resources=null,this._connectorFormat=null,this._style=null,this._drawn=null,this._drawnPending=null,this._getStyles=e.getStyles??null,e.json&&(this._updateState({data:e.json}),this._resources=D(e.json,e.fromResourceId))}_processAfterStateChange(e,t){super._processAfterStateChange(e,t),g()}getResource(e){return this._resources?.get(e)??null}getType(){return`shape`}getShapeType(){let e=this._getState()?.data?.geometry;return typeof e==`string`?e:e?`custom`:`rect`}setShapeType(n,r){let i=r?.description??e(`op.setShapeType`);if(this._protectionCheck(i),!n||typeof n!=`string`||n===`custom`)throw new t(`Invalid shape type: ${n}.`);if(this.isConnector()!==v.test(n))throw new t(this.isConnector()?`A line or connector cannot be changed to another shape.`:`A shape cannot be changed to a line or connector.`);let a={...this._getState()?.data??{},geometry:n};delete a.adjustments;let o=this._beginCommit(i);try{this._updateState({data:a},{...r,description:i},[`onAnyChange`]),this._notifyPlacementChange(),o.commit()}catch(e){throw o.rollback(),e}return this}getTextFrame(){let e=this._getState()?.data??null;if(e===this._textSource)return this._textFrame;let t=T(e);return this._textSource=e,this._textFrame=t===null?null:Object.freeze({getText:()=>t}),this._textFrame}getStyle(){return this._style?this._style:this._style=new d({getData:()=>this._getState()?.data??null,getStyles:()=>this._getStyles?.()??null,getTheme:()=>this._theme(),getMovable:()=>this.getMovable(),getResource:e=>this.getResource(e),write:(e,t)=>this._writeStyle(e,t)})}_writeStyle(t,n){let r=n.description??e(`op.setShapeStyle`);this._protectionCheck(r);let i={...this._getState()?.data??{}};for(let e of Object.keys(t)){let n=t[e];n===void 0?delete i[e]:i[e]=n}this._updateState({data:i},{...n,description:r},[`onAnyChange`])}getAdjustments(){return this._getState()?.data?.adjustments??_}setAdjustments(t,n){let r=n?.description??e(`op.setShapeAdjustments`);this._protectionCheck(r);let i={...this._getState()?.data??{}};t&&Object.keys(t).length>0?i.adjustments={...t}:delete i.adjustments;let a=this._beginCommit(r);try{this._updateState({data:i},{...n,description:r},[`onAnyChange`]),this._notifyPlacementChange(),a.commit()}catch(e){throw a.rollback(),e}return this}_setRoute(t,n){let r={...this._getState()?.data??{},geometry:t};n?r.adjustments={...n}:delete r.adjustments,this._updateState({data:r},{description:e(`op.setShapeAdjustments`)},[`onAnyChange`])}isConnector(){return this._getState()?.data?.type===u.Type.Connector}getConnectorFormat(){return this.isConnector()?(this._connectorFormat??=new x(this),this._connectorFormat):null}async getConnectionSiteCount(){let e=await this.getGeometry(),t=0;return e?.forEachConnection(()=>{t++}),t}_connectedEnd(e){return(this._getState()?.data)?.connectorEnds?.[e]??null}_connectedMovable(e){let t=this._connectedEnd(e),n=this.getMovable()?.getRange().getWorksheet()??null;return t&&n?a(n,t.id):null}_connect(n,r,a,o){let s=o?.description??e(`op.connectShape`);this._protectionCheck(s);let c=this.getMovable(),u=c?.getRange().getWorksheet()??null;if(!c||!u)throw new t(`A connector is glued on a sheet.`);if(r===c)throw new t(`A connector cannot be glued to itself.`);if(r.getRange().getWorksheet()!==u)throw new t(`A connector is glued to a movable on the same sheet.`);if(!(Number.isInteger(a)&&a>=0))throw new t(`Invalid connection site: ${a}.`);let d=this._beginCommit(s);try{let e={id:l(r,()=>p(u)),index:a};this._writeEnd(n,e,{...o,description:s});let t=()=>{this.isDeleted()||c.isDeleted()||this._amend(()=>i(u,c,t))};i(u,c,t),d.commit()}catch(e){throw d.rollback(),e}}_disconnect(t,n){let r=n?.description??e(`op.connectShape`);this._protectionCheck(r),this._connectedEnd(t)&&this._writeEnd(t,null,{...n,description:r})}_writeEnd(e,t,n){let r={...this._getState()?.data??{}},i={...r.connectorEnds};t?i[e]=t:delete i[e],i.start||i.end?r.connectorEnds=i:delete r.connectorEnds,this._updateState({data:r},n,[`onAnyChange`])}_notifyPlacementChange(){this.getMovable()?._notifyPlacementChange?.()}_amend(e){let t=this._transactions;return t.amend(t.getCurrentCommit(!1).getId(),()=>e())}async getGeometry(e,t,n){if(e===void 0||t===void 0){let n=this.getMovable()?.getBounds();if(!n)return null;e??=n.width,t??=n.height}let r=this._getState()?.data??{},i=n?S(r,n):r,a=await o(i,this._theme(),e,t);return a&&i===r&&this._getState()?.data===i&&!this._drawnPending&&(this._drawn={data:i,width:e,height:t,geometry:a,rect:f(a),connections:C(a)}),a}_getDrawnRect(e,t,n){let r=this._evaluated(e,t,n);if(!r?.rect)return null;let i=r.width>0?e/r.width:1,a=r.height>0?t/r.height:1,o=r.rect;return{l:o.l*i,t:o.t*a,r:o.r*i,b:o.b*a}}getConnections(e,t,n){let r=n?.adjustments,i=this._evaluated(e,t,n?.onReady??y);if(!i)return null;if(r!==void 0){let n=i.geometry?.withAdjustments(r)??null;return n?C(n.getWidth()===e&&n.getHeight()===t?n:n.resize(e,t)):null}if(i.width===e&&i.height===t)return i.connections;let a=i.width>0?e/i.width:1,o=i.height>0?t/i.height:1;return i.connections.map(e=>({...e,x:e.x*a,y:e.y*o}))}_evaluated(e,t,n){let r=this._getState()?.data;if(!r)return null;let i=this._drawn;if(!i||i.data!==r||i.width!==e||i.height!==t){let i=this._drawnPending;if(!i||i.data!==r||i.width!==e||i.height!==t){let i={data:r,width:e,height:t};this._drawnPending=i,o(r,this._theme(),e,t).then(e=>{this._drawnPending===i&&(this._drawnPending=null,this._drawn={...i,geometry:e,rect:e?f(e):null,connections:e?C(e):[]},n())},()=>{this._drawnPending===i&&(this._drawnPending=null)})}}return i}_theme(){try{return this._getStyles?.()?.getTheme()?.toJSON()??null}catch{return null}}toJSON(e){let t=this._getState(),n=null;return t&&t.data&&(n=e?O(t.data,this._resources,e):t.data),n}getTypeDescription(){return`Shape`}acceptRotation(e){return e}acceptFlip(e){return e}get isIShape(){return!0}get[Symbol.toStringTag](){return`[Shape]`}toString(){return this.getTypeDescription()}},x=class{constructor(e){this._shape=e}getEndPoints(e){let t=e??(this._shape.getMovable()?s(this._shape.getMovable()):null);return t?m(t):null}placeEnds(e,t){return r(e,t,this._shape.getMovable()?.getRotation()||0)}getGluedRoute(e){let t=this._shape.getMovable(),n=t?.getRange().getWorksheet()??null;if(!t||!n)return null;let r=h(n,t,e??s,y);return r?{placement:r.placement,shapeType:r.route?.geometry??null,adjustments:r.route?.adjustments??null}:null}getConnectorType(){let e=this._shape.getShapeType();return e.startsWith(`bentConnector`)?u.ConnectorType.Elbow:e.startsWith(`curvedConnector`)?u.ConnectorType.Curved:u.ConnectorType.Straight}isStartConnected(){return this._shape._connectedEnd(`start`)!==null}getStartConnectedMovable(){return this._shape._connectedMovable(`start`)}getStartConnectionSite(){return this._shape._connectedEnd(`start`)?.index??null}startConnect(e,t,n){this._shape._connect(`start`,e,t,n)}startDisconnect(e){this._shape._disconnect(`start`,e)}isEndConnected(){return this._shape._connectedEnd(`end`)!==null}getEndConnectedMovable(){return this._shape._connectedMovable(`end`)}getEndConnectionSite(){return this._shape._connectedEnd(`end`)?.index??null}endConnect(e,t,n){this._shape._connect(`end`,e,t,n)}endDisconnect(e){this._shape._disconnect(`end`,e)}},S=(e,t)=>{let n={...e};return t.shapeType!==void 0&&(n.geometry=t.shapeType),t.adjustments===null?delete n.adjustments:t.adjustments!==void 0&&(n.adjustments={...t.adjustments}),n},C=e=>{let t=[];return e.forEachConnection(e=>t.push(e)),t},w=e=>e.runs.map(e=>e.text??``).join(``),T=e=>e&&e.text?(e=>{let t=e.paragraphs.map(w),n=0,r=t.length;for(;n<r&&t[n].trim()===``;)n++;for(;r>n&&t[r-1].trim()===``;)r--;return t.slice(n,r).join(`
2
+ `)})(e.text):null,E=e=>{let t=e.fill;return t?.type===c.Type.Image?t:void 0},D=(e,t)=>{let n=E(e)?.resId,r=n===void 0?void 0:t?.(n);return r?new Map([[n,r]]):null},O=(e,t,n)=>{let r=E(e);if(r?.resId===void 0)return e;let i=t?.get(r.resId),a=(i?n(i):null)??void 0;if(a===r.resId)return e;let{resId:o,...s}=r;return{...e,fill:a===void 0?s:{...s,resId:a}}};export{b as Shape};