@sheetxl/studio-vanilla 0.7.28-beta.4 → 0.8.0-beta.2
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.
- package/browser/cjs/{C0hGnOYkvrwxaGrw.cjs → 3a3qEmdJWFXfGW0q.cjs} +1 -1
- package/browser/cjs/9rXsWW4SnEpudhfh.cjs +1 -0
- package/browser/cjs/{J7LQgueGGNUE9emR.cjs → 9vk-L6rRvx20jeQj.cjs} +1 -1
- package/browser/cjs/{C9L-xibuJ434Mqqq2.cjs → B0FCH1gFfg2bQiPi2.cjs} +1 -1
- package/browser/cjs/B3WkiDqFBfA_xxJL2.cjs +1 -0
- package/browser/cjs/B4ANcw0mAmhe2Aeb2.cjs +1 -0
- package/browser/cjs/B6IXpae7f0J8Ocq62.cjs +1 -0
- package/browser/cjs/B6vy56yEA1I3B74O2.cjs +1 -0
- package/browser/cjs/B7QDcu7uACQA1y3h.cjs +1 -0
- package/browser/cjs/BF8ZxFWyAAnbe4mz.cjs +5 -0
- package/browser/cjs/BLAG3kDSthU0SH-E.cjs +2 -0
- package/browser/cjs/BPWKnUtyoTrtW567.cjs +1 -0
- package/browser/cjs/BQWmn92gYmxC8eWt.cjs +1 -0
- package/browser/cjs/BcROQ4pvVajDQ1em.cjs +1 -0
- package/browser/cjs/BdJvn1vLXMZvE-8h.cjs +4 -0
- package/browser/cjs/BhcbKFKbSWEavYJm.cjs +7 -0
- package/browser/cjs/Bncc0oXhFMdj_HuR2.cjs +1 -0
- package/browser/cjs/Bo7EQ8niKmwtAwo_2.cjs +1 -0
- package/browser/cjs/Bqup1MCJFqTZbLDd2.cjs +1 -0
- package/browser/cjs/BsJHSGeWLskirGXg.cjs +14 -0
- package/browser/cjs/Bsl_clm06l5cwpML.cjs +32 -0
- package/browser/cjs/BvVzIzXLyLxpBcia2.cjs +3 -0
- package/browser/cjs/BylqpwnwQYDHIWjX.cjs +5 -0
- package/browser/cjs/C-xC6h1TOBr5ZDSe2.cjs +1 -0
- package/browser/cjs/{CRx1WvmgBjT8WVyB2.cjs → C0g87ndP2zMUbX6f.cjs} +1 -1
- package/browser/cjs/{n4ZQ0-3uSrEsInbg.cjs → C19UoK2TTtKU_faS.cjs} +1 -1
- package/browser/cjs/C1tOH7BEpO_ANMsa.cjs +1 -0
- package/browser/cjs/C4cZxb9nRtzTCA40.cjs +1 -0
- package/browser/cjs/C9q3zr8iCIoYDrdA.cjs +1 -0
- package/browser/cjs/CA_ZsYjkTHSpGK0j.cjs +41 -0
- package/browser/cjs/{lEQC21-Sk4lwHy2r2.cjs → CFxueP0tbpmvY1Ip2.cjs} +1 -1
- package/browser/cjs/CH7BUjrXIKDIE7XE.cjs +93 -0
- package/browser/cjs/CKEselBM-qmMpQBW2.cjs +2 -0
- package/browser/cjs/CRcv32tHTbGSGtkh2.cjs +1 -0
- package/browser/cjs/{M19oMY91yZxf2WAR.cjs → CTDN-AYeejrfopDC.cjs} +1 -1
- package/browser/cjs/CVHc_cJddJk7J3Zt2.cjs +1 -0
- package/browser/cjs/CX7VUEYca9dtWS0N.cjs +1 -0
- package/browser/cjs/{BEJFcqVMDMKOvs11.cjs → C_T-ehCAzjaVRmTk.cjs} +1 -1
- package/browser/cjs/CaJGoNwTL6pAJ6a42.cjs +1 -0
- package/browser/cjs/CfXcRa4RlFmqU0Op2.cjs +1 -0
- package/browser/cjs/ClVLjLIRgWqX3Q-F.cjs +1 -0
- package/browser/cjs/Co31kjvOPAAYbeF-.cjs +1 -0
- package/browser/cjs/CoCKYtBIVeDXxSIq2.cjs +1 -0
- package/browser/cjs/CqPb6CbrHTRnbSKa2.cjs +8 -0
- package/browser/cjs/CtsduUtTrkcWM02v.cjs +3747 -0
- package/browser/cjs/D-N5oLosHPjoj-oG.cjs +1 -0
- package/browser/cjs/D2ZPx3v4EVejvhR2.cjs +54 -0
- package/browser/cjs/D5Gp16-G3pjMtypl2.cjs +1 -0
- package/browser/cjs/D8tkBbkGH5cZzIJP2.cjs +1 -0
- package/browser/cjs/DA0nGLC0bEkOhh7G2.cjs +1 -0
- package/browser/cjs/DCRe7NqRclU-Jr7p.cjs +1 -0
- package/browser/cjs/{EeOVMRq7TuptFKTc2.cjs → DF4l8xrxkcLkgExp2.cjs} +1 -1
- package/browser/cjs/{DtaFdoK4CppKRF6F2.cjs → DHL7SVvz96-5zSWE2.cjs} +2 -2
- package/browser/cjs/DHMQnssVXWjGBSs-.cjs +3 -0
- package/browser/cjs/{DQTBgNqDHInvxrwS.cjs → DIdPQwECld6gubdK2.cjs} +1 -1
- package/browser/cjs/DLtFM988NCD-jeBV.cjs +8 -0
- package/browser/cjs/DNnMGL1ff8hutxSd.cjs +1 -0
- package/browser/cjs/DP1pufP3NJFoDa-g.cjs +3 -0
- package/browser/cjs/{CnZfa45XxA-9Jhmp.cjs → DRmo6uoGoqtiVff82.cjs} +1 -1
- package/browser/cjs/DSXLVieENYN9qXYl2.cjs +1 -0
- package/browser/cjs/DTZiRVEB3kVK7eK-2.cjs +1 -0
- package/browser/cjs/DU2HMmI1EeHBTvuG.cjs +1 -0
- package/browser/cjs/DWzkpizTIJkaqf4J2.cjs +1 -0
- package/browser/cjs/DZBKNR9xUMTHWS_D.cjs +1 -0
- package/browser/cjs/{X1LnR885SNQaK5HZ.cjs → D_IilnLuy_hDaBmI.cjs} +1 -1
- package/browser/cjs/Dg3GaW0QWwnlqetX2.cjs +1 -0
- package/browser/cjs/Dg5fR9uTvYHyxOX62.cjs +22 -0
- package/browser/cjs/{jIxFDc3EQDDXisAC2.cjs → Dk1WS0vM-LQJx_EO2.cjs} +1 -1
- package/browser/cjs/DpFg69dDCPoOK2BY2.cjs +1 -0
- package/browser/cjs/{zEytED4Eleo5DVvS.cjs → DsqHxG-lGZxL1XgQ.cjs} +1 -1
- package/browser/cjs/DtlC63s51_88j6AY2.cjs +1 -0
- package/browser/cjs/{Du4jBiFxRIF1OjD42.cjs → Dtxj9JR14A-uliu5.cjs} +1 -1
- package/browser/cjs/{CpJJh4UnFl1_qFui.cjs → Dx7GQ4ALtNG3kshu.cjs} +1 -1
- package/browser/cjs/{DG-AY_xO8RKHtEBE.cjs → Dy50BSaRMmRISD2Y.cjs} +1 -2
- package/browser/cjs/GPlG4lbMP89VDHYJ.cjs +126 -0
- package/browser/cjs/LD1P-jAXleebK12X.cjs +7 -0
- package/browser/cjs/PmwvZPFhqmL4DO582.cjs +1 -0
- package/browser/cjs/SATfdSwNygvlOSKC2.cjs +1 -0
- package/browser/cjs/TZQc-szdIVnHDH6F.cjs +11 -0
- package/browser/cjs/{BKXFdLiztqEHIjQ_2.cjs → VgwyOcXDHhEp_NvH2.cjs} +1 -1
- package/browser/cjs/XRCcogT-Iqd3Wv6R2.cjs +1 -0
- package/browser/cjs/a4xpA8d_d22-GKos.cjs +1 -0
- package/browser/cjs/aBulzIf4cHnL7sbw.cjs +1 -0
- package/browser/cjs/cexWxRluo6g-NG_u.cjs +1 -0
- package/browser/cjs/iYn00uzmSLl2T0oN2.cjs +1 -0
- package/browser/cjs/ibvsavYh4kU-xxL8.cjs +1 -0
- package/browser/cjs/index.cjs +2 -2
- package/browser/cjs/{DIbdDzNf_3S2RYZN.cjs → p3PYFz7cN2z4XQoU.cjs} +1 -1
- package/browser/cjs/{CEpXnHhrczUmIwMa2.cjs → xTT7lHV4HUjeNdMs2.cjs} +1 -1
- package/browser/esm/{CFVzVz9BCRBowBea.mjs → 04mVsW7CTmUlxnOa.mjs} +3 -3
- package/browser/esm/0YKBRd7eLIUmcKns.mjs +35 -0
- package/browser/esm/13CH9sjvoEqt6nbt2.mjs +37 -0
- package/browser/esm/7lIMFL11BRZrMXdc2.mjs +19 -0
- package/browser/esm/9CP_UyAqmAHE7-mv.mjs +267 -0
- package/browser/esm/{ByJMrAYRARLc7uZQ2.mjs → AAHsV9V95k39t9SD.mjs} +27 -29
- package/browser/esm/{D8zyGG6yt4CsyA8K.mjs → B-Zf8W3s_WXgYxhN.mjs} +12 -12
- package/browser/esm/{hsy1zALC1oNNm5Sf.mjs → B0FNPu0uhX_WW-aJ.mjs} +1 -1
- package/browser/esm/{DmqS0kz7jvlOw3qr.mjs → B0aCnXuYD0ZopZdA.mjs} +28 -13
- package/browser/esm/B2nEJHcip8raAhdc.mjs +3342 -0
- package/browser/esm/B2vjec5TDs2ZJ1eI2.mjs +33 -0
- package/{cdn/assets/C7xBBqvPqat9oEft2.js → browser/esm/B50P0gSziuG68Umu.mjs} +95 -53
- package/browser/esm/BA6JMESdvw_1-mFg2.mjs +238 -0
- package/{cdn/assets/BGWyNjrM55ce-D1o.js → browser/esm/BBaNqp1ZjuO25FQg2.mjs} +2 -2
- package/browser/esm/BBzzLAeBBFbVvgph2.mjs +8 -0
- package/browser/esm/{pFBVGSvmImMMDMuJ.mjs → BCQgeu38866r56Dh.mjs} +97 -54
- package/{cdn/assets/DOsKUeLPwFIdzQv32.js → browser/esm/BDZAVKSYpcOp9Dve2.mjs} +1 -1
- package/browser/esm/BEWsOD2JQ8dwQCEm2.mjs +427 -0
- package/{cdn/assets/BRBHACVjnV1_6VLQ.js → browser/esm/BEYY8z4FusH7S5K-.mjs} +1 -1
- package/browser/esm/{DM4g0nYgYXgI44dL2.mjs → BF842ZtkvebA1LgR.mjs} +1 -1
- package/{cdn/assets/BF9yh58xfvR0KbSo.js → browser/esm/BG_hG8jUkf0aMzGK.mjs} +2 -2
- package/{cdn/assets/D-tQc4bi3FzGVnFg.js → browser/esm/BG_hG8jUkf0aMzGK2.mjs} +2 -2
- package/browser/esm/{5LJ1sC7IPn109Ien.mjs → BIab7njjwaSXjSEP2.mjs} +2 -2
- package/browser/esm/BJJBFdJaP2dMlug92.mjs +280 -0
- package/browser/esm/{Bc2Dp6W4U_22cv7c.mjs → BM343UBJqjbDokO62.mjs} +1 -1
- package/browser/esm/{B4fSPDN923nqCDVE2.mjs → BOhfbmK18Xj1P7-i.mjs} +2 -2
- package/browser/esm/{BgwHVPZp494SgQ0d2.mjs → BPt7dDNLBsKrZgzO2.mjs} +22 -22
- package/browser/esm/{BsP1iPcd49wYIIoP.mjs → BTNqElWtYkKW47Vg.mjs} +3 -3
- package/{cdn/assets/BO2NRW9sjHGE9tg-2.js → browser/esm/BVOTzF7NFvB20R7D.mjs} +2 -2
- package/browser/esm/BVtQCzVeMOJZq64r2.mjs +394 -0
- package/browser/esm/BZZ2IOkVKppFWNLE.mjs +27 -0
- package/browser/esm/{Cd8G1nX1dKzp-mho2.mjs → B_49GiUSgx96vBvq2.mjs} +2 -2
- package/{cdn/assets/Bfd3T36ocASPZddR.js → browser/esm/BauR0SATr44ggHRU.mjs} +1714 -939
- package/browser/esm/Bc8-re9biUn57kdl.mjs +87777 -0
- package/browser/esm/{CJ-lOo2cXlcYrg2P.mjs → BcHN_VMA7bLNKKMO.mjs} +1682 -1600
- package/{cdn/assets/DJSXXWTUJGbXqLLx.js → browser/esm/Bcjus_Q6f72kE1MK.mjs} +1 -1
- package/browser/esm/{DENx9Ts-f8adXw3Y2.mjs → Be2-C5U5LlfLTmyo2.mjs} +1 -1
- package/browser/esm/Be7--zCnU6JvLkK1.mjs +637 -0
- package/browser/esm/{Ykh10IaXTKA2XWot.mjs → Bfq8Gdqf3I7y_Hju.mjs} +1 -1
- package/browser/esm/BhGgNWNVYntkJYgU.mjs +155 -0
- package/browser/esm/{CHmSnCPoww1StSta.mjs → BiArrlzwKsOlSm00.mjs} +4 -4
- package/{cdn/assets/CJGlwQusOCSy9ZAb.js → browser/esm/Bl5xLu1ou-9zMIBZ2.mjs} +5 -5
- package/browser/esm/{6A8iYjFWJzx5PaTP2.mjs → BnFriW2cIcOJkXU42.mjs} +16 -16
- package/browser/esm/{CXDtDYyREwoFwtMJ2.mjs → Bokc-Wu4XBPWKmdt.mjs} +1 -1
- package/browser/esm/BuSBBEiK_3KnBr632.mjs +514 -0
- package/{cdn/assets/Bh4hZt6639QZusIG.js → browser/esm/Bvy9LWN5UHwJXV9i2.mjs} +2 -2
- package/{cdn/assets/DnMUizHKSRwWpO_72.js → browser/esm/C04uI3XsvTc6Cc7w2.mjs} +37 -3
- package/{cdn/assets/Bj8bWbLg1IY965tK.js → browser/esm/C1EvC_qPiGiVMrkF.mjs} +963 -946
- package/browser/esm/{BxecIrskOMQZB-Xc.mjs → C1doaJjkCzQlB_3u2.mjs} +3 -3
- package/browser/esm/{DGfzktq0BrIwcb8j.mjs → C3M_lKSZ_Fq1SQOn.mjs} +2 -2
- package/browser/esm/C3qSUuVA-FII3rMU2.mjs +298 -0
- package/{cdn/assets/BzktrYJH7SQ9GyUI2.js → browser/esm/C6X4CmElTpPxrad6.mjs} +1 -1
- package/{cdn/assets/CIgn8uIPaadIJP4a2.js → browser/esm/CA4eJpge9meoO0rj2.mjs} +17 -18
- package/browser/esm/CAVONPXgoytyiNK-.mjs +25 -0
- package/{cdn/assets/BPAEbeXV75XIAS4n.js → browser/esm/CPgOplnn6NuHwsZ_.mjs} +1 -1
- package/browser/esm/{DLArQtAbWAarI8od2.mjs → CQBSLdAdR53c7BVh2.mjs} +1 -1
- package/browser/esm/{BjYIAiuzZbD-dk822.mjs → CThP3jXwDzLlUOeI.mjs} +1 -1
- package/browser/esm/CTzKk6VuZTohsOIF2.mjs +58 -0
- package/{cdn/assets/CmYCYFWjq9KP6xw7.js → browser/esm/CU1_-PzBC9cDsm5t2.mjs} +6 -6
- package/{cdn/assets/FVJ1akngxeMiYwPa.js → browser/esm/CULlzRLL3s2Dikjg.mjs} +1 -1
- package/browser/esm/CUMu_1tXFa0LPKGV.mjs +3324 -0
- package/browser/esm/{DjS4iUli-T3uuUfK.mjs → CUYBRp4sHMdGwkLT.mjs} +1 -1
- package/browser/esm/CYU_-DiQXjh1SEU1.mjs +3343 -0
- package/browser/esm/{DxxlSejA2S6YUPWD.mjs → CaTmLXIsIxaOrLcZ.mjs} +446 -347
- package/browser/esm/CcK4ACF7d5ogFpAS.mjs +91 -0
- package/{cdn/assets/Bce8ZTUCpXr5Y_zl2.js → browser/esm/CjFOk9mcZqAngWD2.mjs} +48 -2
- package/browser/esm/{DrKUGkrCTKZHu8XC.mjs → CmSATmXaMlqwTjAe2.mjs} +1 -1
- package/browser/esm/{C4vqrW3EmJDy1otX.mjs → CnvlkxK0pS02Z3gZ.mjs} +7 -6
- package/browser/esm/{CXlA71yGA1Hqvp_S.mjs → Cvw3poNlUmn3qAh0.mjs} +6 -6
- package/{cdn/assets/CBC_MJL6Bwk7bzQz2.js → browser/esm/CwDjNuGkKnVtfJo-.mjs} +1 -1
- package/browser/esm/{L6LjzOx1G9Idjtxa2.mjs → D-egzesxukW7Z_e3.mjs} +2 -2
- package/{cdn/assets/g8dDbkwbYjhKWJM2.js → browser/esm/D13sLQRMMKrDHepu.mjs} +2 -2
- package/{cdn/assets/CsKCqLuggHhYC93k.js → browser/esm/D1bACCJy4F8kANLy.mjs} +1 -1
- package/{cdn/assets/MHuhAgQAA8zcnWkd2.js → browser/esm/D5Pa9lfPfAcCGj_N.mjs} +1 -1
- package/browser/esm/{DSWdYe7SDB5cYWo5.mjs → DBTB0moKfwOu0F47.mjs} +241 -241
- package/browser/esm/{Bz3-FDGVU67Izdnv2.mjs → DHzdEqMCGL_JPh9w2.mjs} +19 -27
- package/browser/esm/{-9NsA_4pZqcEQBX7.mjs → DMMtONCySdMHoaMU.mjs} +15 -15
- package/{cdn/assets/BGAXiHOiX_PZ1ww1.js → browser/esm/DTfDzhFtORWkuoRv.mjs} +1 -1
- package/{cdn/assets/Dgt8kua8CYlMRfdw.js → browser/esm/DYyxB53T5uaoyInL2.mjs} +2 -2
- package/browser/esm/DZLyXICwEHYRnCuO.mjs +758 -0
- package/browser/esm/{Bjx-9lUaScF5-Hki2.mjs → DbVSG7Uf7YDQbmc32.mjs} +2 -5
- package/browser/esm/Dd80tsdITZsotoCX2.mjs +47 -0
- package/browser/esm/{s4trFf5sOSGNEzr3.mjs → DeSDYBzD8e5XXnvq.mjs} +40 -40
- package/browser/esm/DeeFxCkhXDF0p1nl.mjs +87 -0
- package/{cdn/assets/D4aK0uTRJQpM63922.js → browser/esm/DgH-AoqKDdIWg0J8.mjs} +1 -1
- package/browser/esm/{CTwLETvNO4KeXbkK2.mjs → DjNR_ZGCbg-xia152.mjs} +5 -5
- package/browser/esm/DkuK8fY8vrl7aZpf2.mjs +115 -0
- package/browser/esm/{BzktrYJH7SQ9GyUI.mjs → DmPq6SwNcX1qXKct.mjs} +1 -1
- package/{cdn/assets/DtkqR-Hu7K4agnCs2.js → browser/esm/Dn8Z0WK2Hwi8MRnQ.mjs} +1 -1
- package/browser/esm/{BZkd8LNLgEd5WQXO2.mjs → DoCYcvHzw3S0MDCW.mjs} +69 -4
- package/{cdn/assets/DRAYZ0SGlbCLkftR.js → browser/esm/DtQu3vHaJfA5KM2H2.mjs} +1 -1
- package/{cdn/assets/DjfBSoaKM-vtbeqT.js → browser/esm/DtqMTXq5u5DmS5S1.mjs} +2 -2
- package/browser/esm/{BetL7yI63lEdQ0gM.mjs → DuijhgjRhgWB9sCY.mjs} +504 -331
- package/browser/esm/{C3dXBjR3SrDCdJlm.mjs → DyPe20tPiPVm1PLe.mjs} +6 -6
- package/{cdn/assets/BZXvEddjoz4C8y4w.js → browser/esm/Dz713G5R9JayR5v1.mjs} +16 -11
- package/browser/esm/{CY4ANhbzXqZMJPnL2.mjs → GDYIOITizuJ9xSUf2.mjs} +15 -15
- package/{cdn/assets/D5BuXc-kVnr6Xiae2.js → browser/esm/LfHB39-nf7mi9XC72.mjs} +1 -1
- package/browser/esm/{CRsnKeHAnKrWvuG52.mjs → LgoljOEffsYkpZZJ2.mjs} +2462 -2971
- package/browser/esm/QNvOHujamKYSXWWA2.mjs +32 -0
- package/browser/esm/{DER7-kADXFnTmK-32.mjs → R2c8rUTz1GjCQEp-2.mjs} +121 -94
- package/browser/esm/S2_pz0y2RTJFpXkS.mjs +15 -0
- package/browser/esm/{PzCXbVRf1jOHVOAw.mjs → V-oO_EfTyth0iptZ2.mjs} +1 -1
- package/browser/esm/XB269tVMhdRHj10G.mjs +674 -0
- package/browser/esm/{BJQfvwvEke-uN0_02.mjs → YC83lJ3yRZP57lBl2.mjs} +42 -4
- package/{cdn/assets/CY7qR8ENX314HrrD.js → browser/esm/ZJ32DJlBpN_9fAph.mjs} +3 -3
- package/browser/esm/{DdtDlBp6KJZjL28o.mjs → apjOZ6N9KbmyErGz.mjs} +1867 -1407
- package/browser/esm/b49cTAZ6BWPQgfYu.mjs +159 -0
- package/browser/esm/{D_8B8jIlshd3eTIO2.mjs → bvuPDJZmI2O5oihy2.mjs} +139 -137
- package/browser/esm/{BrUe0MnOhxzeOngn2.mjs → eTXmezPFvAwM_L-D2.mjs} +1 -1
- package/{cdn/assets/BaIe3fLfPLw3FbYP2.js → browser/esm/ep-IjWXOPg2b-REP2.mjs} +1 -1
- package/browser/esm/{B3tC7wY_kUGXf5sb2.mjs → f9r0yTaD2YChFtEg2.mjs} +1 -1
- package/browser/esm/fJ0eqh3Ja3O0z1QL.mjs +149 -0
- package/browser/esm/{Dwko6HB2zePBBeBu2.mjs → gAriGKwELet15RCY2.mjs} +13 -13
- package/browser/esm/gCeoOjDjiVaX8dtF2.mjs +119 -0
- package/browser/esm/iYNN3Px9AekrMEfu2.mjs +117 -0
- package/browser/esm/index.mjs +6 -6
- package/browser/esm/{Duo6t8_BzIiBDrFm.mjs → j-9DpYsIlTN1mwql.mjs} +16159 -16463
- package/{cdn/assets/esX6dx06TUUL-cRt.js → browser/esm/jQ5c7MGwQOZq4s5w.mjs} +1 -1
- package/browser/esm/kcfC6hY47HklE6Om.mjs +225 -0
- package/browser/esm/{DJk14sSSnSHiEXZ72.mjs → lHpMVBxqkkCYD6d12.mjs} +51 -11
- package/browser/esm/{B_U_UpQXdbjNRthb.mjs → nBZATD4yR1W5D4Fi.mjs} +1 -1
- package/browser/esm/{BZSAb1WGbwagUKGv2.mjs → rxlYDHBsenoxRx-K2.mjs} +6 -6
- package/browser/esm/sfOREE_huDAOcfYs.mjs +15495 -0
- package/{cdn/assets/D2Ls6urWeByV5W-B.js → browser/esm/txVgXcuMeWVNWHnZ.mjs} +1 -1
- package/{cdn/assets/CgsQuAbp76UOAPHm2.js → browser/esm/xzoxSwyGoZdH-ysh.mjs} +196 -175
- package/browser/esm/{B9t9fF8FNCLomgK_.mjs → yFldtlfN_ASKyMll.mjs} +563 -534
- package/browser/esm/yVLsr0rcaOFel2nS2.mjs +32 -0
- package/cdn/assets/13CH9sjvoEqt6nbt.js +37 -0
- package/cdn/assets/{BIPjogMyMmLRly43.js → 2QsTDWiE6SMelbNU2.js} +7 -7
- package/cdn/assets/588lLflWQypQVzce.js +27 -0
- package/cdn/assets/7lIMFL11BRZrMXdc.js +19 -0
- package/cdn/assets/{ByJMrAYRARLc7uZQ.js → AAHsV9V95k39t9SD.js} +27 -29
- package/cdn/assets/{hsy1zALC1oNNm5Sf.js → B0FNPu0uhX_WW-aJ2.js} +1 -1
- package/cdn/assets/B2vjec5TDs2ZJ1eI.js +33 -0
- package/{browser/esm/C7xBBqvPqat9oEft.mjs → cdn/assets/B50P0gSziuG68Umu2.js} +95 -53
- package/cdn/assets/{DP9sLYfGGWMDI7hL2.js → B66--qmqjDI4V95v2.js} +8 -8
- package/cdn/assets/{DGWhm91XZlY1GWHe2.js → B9hBziUoXFzKPWF02.js} +7 -7
- package/cdn/assets/{B4492m5zRjz4JWIo2.js → B9oLwnLz9m-TWSPJ2.js} +1867 -1407
- package/cdn/assets/{DpNYiOK112bFC3KK2.js → BB6k7f_6TCVysy8a.js} +41 -3
- package/{browser/esm/BGWyNjrM55ce-D1o2.mjs → cdn/assets/BBaNqp1ZjuO25FQg.js} +2 -2
- package/{browser/esm/DOsKUeLPwFIdzQv32.mjs → cdn/assets/BDZAVKSYpcOp9Dve.js} +1 -1
- package/{browser/esm/BRBHACVjnV1_6VLQ2.mjs → cdn/assets/BEYY8z4FusH7S5K-2.js} +1 -1
- package/cdn/assets/{DM4g0nYgYXgI44dL.js → BF842ZtkvebA1LgR2.js} +1 -1
- package/cdn/assets/{5LJ1sC7IPn109Ien.js → BIab7njjwaSXjSEP.js} +2 -2
- package/cdn/assets/BKouftCLbhExXXXU.js +264 -0
- package/cdn/assets/{Bc2Dp6W4U_22cv7c2.js → BM343UBJqjbDokO6.js} +1 -1
- package/cdn/assets/{Dy5Z2XIqS7-0tdjc2.js → BNm-ZCOBoBRceGXA2.js} +65 -65
- package/cdn/assets/{B4fSPDN923nqCDVE.js → BOhfbmK18Xj1P7-i2.js} +2 -2
- package/{browser/esm/DHQcJqD-EtJ0Efug2.mjs → cdn/assets/BPOi08RtEmQdlbtS2.js} +27 -26
- package/cdn/assets/{DQhvG3cP0HPB6giA2.js → BSixIKI7PxSqiUGB2.js} +5 -5
- package/{browser/esm/BQt5lpPjssz4Lvhs.mjs → cdn/assets/BT3KOuPzJsNUvy4B.js} +2 -2
- package/cdn/assets/BTB79KyzSZf-h-lm2.js +226 -0
- package/cdn/assets/{DEFEOS3OuA23llF92.js → BWtyERLPrUmI8Qbi2.js} +140 -138
- package/cdn/assets/{Cd8G1nX1dKzp-mho.js → B_49GiUSgx96vBvq.js} +2 -2
- package/cdn/assets/B_UEqzmXZIhHAEyS.js +280 -0
- package/cdn/assets/B_sKE05xgjFFafjm.js +15496 -0
- package/{browser/esm/O982fBwJ80FSdhad.mjs → cdn/assets/BaEH7HZAJkFGHtNj2.js} +203 -180
- package/{browser/esm/DJSXXWTUJGbXqLLx.mjs → cdn/assets/Bcjus_Q6f72kE1MK.js} +1 -1
- package/{browser/esm/BmTSjuGI87QqMA-a.mjs → cdn/assets/BdCn57ENgiC2kOsF.js} +2 -2
- package/cdn/assets/{DENx9Ts-f8adXw3Y.js → Be2-C5U5LlfLTmyo.js} +1 -1
- package/cdn/assets/Be_TDLQucHiVwNvT.js +268 -0
- package/cdn/assets/{Ykh10IaXTKA2XWot2.js → Bfq8Gdqf3I7y_Hju2.js} +1 -1
- package/cdn/assets/Bi9IWSBo7DDXROTC.js +8 -0
- package/{browser/esm/CJGlwQusOCSy9ZAb2.mjs → cdn/assets/Bl5xLu1ou-9zMIBZ.js} +5 -5
- package/cdn/assets/{CXDtDYyREwoFwtMJ.js → Bokc-Wu4XBPWKmdt.js} +1 -1
- package/cdn/assets/{Wb48SedqaKMZnxym.js → Bqe5WbSIlCRYLcqT.js} +4 -4
- package/cdn/assets/{DiKc6jzGM1isrN02.js → BsGz_0JrhSfOZ24Q.js} +3 -3
- package/cdn/assets/BsHFBjNwTzc_CKLq2.js +87777 -0
- package/{browser/esm/DuJ_gK9f35IbKDd6.mjs → cdn/assets/BuyRy9BcgPYo8l8W.js} +1714 -939
- package/cdn/assets/{B2BvBxjz3Kfii_Gn2.js → ByHzW_x0qXsBJMwv2.js} +2386 -2895
- package/{browser/esm/DnMUizHKSRwWpO_7.mjs → cdn/assets/C04uI3XsvTc6Cc7w.js} +37 -3
- package/cdn/assets/{BxecIrskOMQZB-Xc.js → C1doaJjkCzQlB_3u.js} +3 -3
- package/cdn/assets/C2JMpa_lWCs9k2ZI.js +3324 -0
- package/cdn/assets/{BOTU30yJHbaNehFS.js → C2X9NooB33IkSomz.js} +13 -13
- package/cdn/assets/{B0N6rTGGJN2DZPaf.js → C3KIo0iwLXhIIMG8.js} +2 -2
- package/{browser/esm/BBhB25AlKEzdoI0V.mjs → cdn/assets/C6X4CmElTpPxrad6.js} +1 -1
- package/cdn/assets/C6X4CmElTpPxrad62.js +24 -0
- package/cdn/assets/{6L6HfOFw1xzxXtf22.js → C7ZHXwoL2A_nxZjl.js} +436 -337
- package/cdn/assets/CA9oxppuFcYDyylE.js +149 -0
- package/{browser/esm/CBuulf8RrSItPZJi.mjs → cdn/assets/CAOPlenSF-pjVfqt2.js} +2 -2
- package/cdn/assets/CAVONPXgoytyiNK-.js +25 -0
- package/cdn/assets/{DY9zG4TdF0FAs_QP2.js → CBQrIDBtf5Ibwi96.js} +28 -13
- package/cdn/assets/{BdhFhDEa7Xed6dFE.js → CCTYceFrydwG3Vyt2.js} +23600 -23903
- package/cdn/assets/CDijenaMI_dBIGU-.js +3344 -0
- package/cdn/assets/{CDqMmEdh_CPaFCCi2.js → COk-0FZl3cv__3yY2.js} +566 -537
- package/cdn/assets/{DaX0_AkJxkaUnNT7.js → CP0M0z_IaCwCMGNS.js} +16 -16
- package/{browser/esm/BPAEbeXV75XIAS4n2.mjs → cdn/assets/CPgOplnn6NuHwsZ_2.js} +1 -1
- package/cdn/assets/{hClmI7sWeaBbHo3W2.js → CPjsJ0CY-AurDJgm2.js} +14 -14
- package/cdn/assets/{DLArQtAbWAarI8od.js → CQBSLdAdR53c7BVh.js} +1 -1
- package/cdn/assets/{BjYIAiuzZbD-dk82.js → CThP3jXwDzLlUOeI2.js} +1 -1
- package/cdn/assets/CTzKk6VuZTohsOIF.js +58 -0
- package/{browser/esm/CmYCYFWjq9KP6xw72.mjs → cdn/assets/CU1_-PzBC9cDsm5t.js} +6 -6
- package/{browser/esm/FVJ1akngxeMiYwPa.mjs → cdn/assets/CULlzRLL3s2Dikjg.js} +1 -1
- package/cdn/assets/{CnfGgjuCEyX-PYs_2.js → CUTnOs5iWyc3J2cN2.js} +17 -17
- package/cdn/assets/CUYBRp4sHMdGwkLT2.js +24 -0
- package/cdn/assets/CUrzB9ponX7LAYXR.js +35 -0
- package/{browser/esm/XBb7Mxqf0beXaSJt.mjs → cdn/assets/CWOPhBfYI6R0kz-p.js} +965 -944
- package/cdn/assets/CZ3JFujrzd0iX0zL2.js +428 -0
- package/cdn/assets/{xMskoOI2CK9-AmBF2.js → CheDxDxt7x0CPz9P.js} +11 -9
- package/{browser/esm/Bce8ZTUCpXr5Y_zl.mjs → cdn/assets/CjFOk9mcZqAngWD22.js} +48 -2
- package/cdn/assets/{DrKUGkrCTKZHu8XC.js → CmSATmXaMlqwTjAe.js} +1 -1
- package/cdn/assets/{C4vqrW3EmJDy1otX.js → CnvlkxK0pS02Z3gZ.js} +7 -6
- package/cdn/assets/{KJzdwvEWwCwAXuo4.js → CqI09iUEId8rHfJ9.js} +242 -242
- package/{browser/esm/CBC_MJL6Bwk7bzQz.mjs → cdn/assets/CwDjNuGkKnVtfJo-2.js} +1 -1
- package/cdn/assets/CzEHYpK2SYTRpxDm2.js +239 -0
- package/cdn/assets/{L6LjzOx1G9Idjtxa.js → D-egzesxukW7Z_e32.js} +2 -2
- package/{browser/esm/g8dDbkwbYjhKWJM22.mjs → cdn/assets/D13sLQRMMKrDHepu2.js} +2 -2
- package/{browser/esm/CsKCqLuggHhYC93k2.mjs → cdn/assets/D1bACCJy4F8kANLy2.js} +1 -1
- package/{browser/esm/MHuhAgQAA8zcnWkd.mjs → cdn/assets/D5Pa9lfPfAcCGj_N2.js} +1 -1
- package/{browser/esm/PAu9erpoOTNzgNbN.mjs → cdn/assets/D6Uwvg4vo1g0pWZa.js} +16 -11
- package/cdn/assets/{DlLXCXDokJ72EW-E.js → DI4QTfUQPCjSn0kl.js} +41 -41
- package/cdn/assets/DIlrvTRlRll76TiE2.js +496 -0
- package/cdn/assets/DJBTmv-rddT91Z-N2.js +156 -0
- package/cdn/assets/{llvXNxZaCMnYqvSm.js → DPN0a43QHMUmHgo5.js} +3 -3
- package/{browser/esm/BGAXiHOiX_PZ1ww12.mjs → cdn/assets/DTfDzhFtORWkuoRv2.js} +1 -1
- package/cdn/assets/DYCh_5thAx4qo1ns2.js +3342 -0
- package/cdn/assets/{Bjx-9lUaScF5-Hki.js → DbVSG7Uf7YDQbmc3.js} +2 -5
- package/cdn/assets/Dd80tsdITZsotoCX.js +47 -0
- package/cdn/assets/Dg26zVdGlO10MX0h2.js +159 -0
- package/{browser/esm/D4aK0uTRJQpM6392.mjs → cdn/assets/DgH-AoqKDdIWg0J8.js} +1 -1
- package/cdn/assets/{CTwLETvNO4KeXbkK.js → DjNR_ZGCbg-xia15.js} +5 -5
- package/cdn/assets/{Dr1U0I01_KIa9vgR2.js → Dlq2nAMNpWkqjt9Y.js} +16 -16
- package/cdn/assets/DmQ4uKOlhrcJfgk82.js +118 -0
- package/{browser/esm/DOIVDuyf7YyJZjcD.mjs → cdn/assets/DmRqcUu6qCPcOxgW.js} +2 -2
- package/{browser/esm/DtkqR-Hu7K4agnCs.mjs → cdn/assets/Dn8Z0WK2Hwi8MRnQ2.js} +1 -1
- package/cdn/assets/{BynqRVXFRplO7XgC.js → DoBxkE57H5PfH7Or.js} +2 -2
- package/cdn/assets/{BZkd8LNLgEd5WQXO.js → DoCYcvHzw3S0MDCW.js} +69 -4
- package/{browser/esm/DRAYZ0SGlbCLkftR2.mjs → cdn/assets/DtQu3vHaJfA5KM2H.js} +1 -1
- package/cdn/assets/{BetL7yI63lEdQ0gM2.js → DuijhgjRhgWB9sCY2.js} +504 -331
- package/cdn/assets/DvfekR32WVFv_WrS.js +394 -0
- package/cdn/assets/Dz0_oXqVesISvhbJ.js +87 -0
- package/cdn/assets/{DeFts-aGqB-RDuV1.js → I2Cn0c2NkX845WIx.js} +7 -7
- package/cdn/assets/Ifw8W-tqHjQnCWZO2.js +299 -0
- package/{browser/esm/D5BuXc-kVnr6Xiae.mjs → cdn/assets/LfHB39-nf7mi9XC7.js} +1 -1
- package/{browser/esm/BOMct7uvqiNJIS63.mjs → cdn/assets/N5PCgig3g9yqotn9.js} +2 -2
- package/cdn/assets/QNvOHujamKYSXWWA.js +32 -0
- package/cdn/assets/{DEyeWdXLwDRo2yYf2.js → QT-5i27zeGPhkyui2.js} +20 -28
- package/cdn/assets/S2_pz0y2RTJFpXkS2.js +15 -0
- package/cdn/assets/{DW2yQm-sEcHogX7E.js → UNtnFd2ssTtnrqRp.js} +1685 -1603
- package/cdn/assets/{PzCXbVRf1jOHVOAw.js → V-oO_EfTyth0iptZ.js} +1 -1
- package/cdn/assets/VEJV_bhNDNNyZAIA2.js +116 -0
- package/cdn/assets/WFkg-W8MQ-V6F1Fu.js +758 -0
- package/cdn/assets/{DJHOKENCVOJMx3aE2.js → XFQGB8ADW__0ZBoF2.js} +3 -3
- package/{browser/esm/Eszk9OugmYOhaS2s.mjs → cdn/assets/_gPnIgVx33slqynA.js} +2 -2
- package/cdn/assets/b-o8RUlQpF1RaDgI.js +675 -0
- package/cdn/assets/{BrUe0MnOhxzeOngn.js → eTXmezPFvAwM_L-D.js} +1 -1
- package/{browser/esm/BaIe3fLfPLw3FbYP2.mjs → cdn/assets/ep-IjWXOPg2b-REP2.js} +1 -1
- package/{browser/esm/Ca6NSkWoi9DvRJjQ.mjs → cdn/assets/erwt6xEgCY7lDQWp.js} +3 -3
- package/cdn/assets/f1iQWnLWVpKZ34XR2.js +91 -0
- package/cdn/assets/{B3tC7wY_kUGXf5sb.js → f9r0yTaD2YChFtEg.js} +1 -1
- package/cdn/assets/gCeoOjDjiVaX8dtF.js +119 -0
- package/cdn/assets/{CuIUyLNDoHvYMJaQ2.js → gJT4n5za0DqWXFK12.js} +75 -48
- package/{browser/esm/esX6dx06TUUL-cRt.mjs → cdn/assets/jQ5c7MGwQOZq4s5w2.js} +1 -1
- package/cdn/assets/{DJk14sSSnSHiEXZ7.js → lHpMVBxqkkCYD6d1.js} +51 -11
- package/cdn/assets/{B_U_UpQXdbjNRthb.js → nBZATD4yR1W5D4Fi.js} +1 -1
- package/{browser/esm/D2Ls6urWeByV5W-B2.mjs → cdn/assets/txVgXcuMeWVNWHnZ.js} +1 -1
- package/cdn/assets/yVLsr0rcaOFel2nS.js +32 -0
- package/cdn/index.js +2 -2
- package/package.json +3 -3
- package/browser/cjs/49_x589Na12sizKK2.cjs +0 -1
- package/browser/cjs/B4JJfKSI4ppwU8552.cjs +0 -1
- package/browser/cjs/BClFnd-voK5qaz1I.cjs +0 -88
- package/browser/cjs/BF-38Z7Z0FZOPl192.cjs +0 -1
- package/browser/cjs/BF14ZEAnaqxXroSj.cjs +0 -1
- package/browser/cjs/BFdq8CHyR6FQvmQA2.cjs +0 -1
- package/browser/cjs/BVN0uo1XwTCtE2mh.cjs +0 -7
- package/browser/cjs/BbEwESVyRYXzMlW7.cjs +0 -5
- package/browser/cjs/BjgiE9MBDkKiRL6q.cjs +0 -3
- package/browser/cjs/BnccBYHCCq9TGFx4.cjs +0 -8
- package/browser/cjs/BwLx9ix5Sq7suAYP2.cjs +0 -1
- package/browser/cjs/Byl4bQWpLnjthChn2.cjs +0 -7
- package/browser/cjs/BzsAbsb35hYT3xUc.cjs +0 -5
- package/browser/cjs/C7GpcB_YgM-RLa2P.cjs +0 -1
- package/browser/cjs/C8GZf3UAOhfisYCs.cjs +0 -1
- package/browser/cjs/C9C-pr-T_ThweQX9.cjs +0 -1
- package/browser/cjs/CEXs4eRDOv4EjbSw2.cjs +0 -1
- package/browser/cjs/CLXzYSmhCHV5LQh7.cjs +0 -1
- package/browser/cjs/CN-dCAHVcxuMSyFz.cjs +0 -1
- package/browser/cjs/CZfNBCd62H_Jpkhl.cjs +0 -12
- package/browser/cjs/C_7w8EJZpHw8ueuq.cjs +0 -1
- package/browser/cjs/C_IEgjM-hSJCv6Gm.cjs +0 -1
- package/browser/cjs/CeF0DZ-k4DB8M47I.cjs +0 -1
- package/browser/cjs/Ck7Tc5npWk73wrF3.cjs +0 -57
- package/browser/cjs/Clu7XiAsCB48GDXN.cjs +0 -1
- package/browser/cjs/CnjaTz8HJXStwuH8.cjs +0 -1
- package/browser/cjs/CoiPEZabJyiXxLta.cjs +0 -1
- package/browser/cjs/Cty5pi0fwToP1GWe.cjs +0 -7
- package/browser/cjs/Cu0UCwSpRK4OnCuP.cjs +0 -1
- package/browser/cjs/CxWeFfNAUvhHe9F-.cjs +0 -21
- package/browser/cjs/D-o-mlG9tYSuZrvy2.cjs +0 -1
- package/browser/cjs/DAA0zpvkrMOLDPxr.cjs +0 -1
- package/browser/cjs/DAXgAEDtRrsWAePT.cjs +0 -1
- package/browser/cjs/DCIlWcGDrp-5PDoA2.cjs +0 -1
- package/browser/cjs/DDPxHIqx8aIbqTRE.cjs +0 -1
- package/browser/cjs/DMp9wql2kbZKAbGe.cjs +0 -3
- package/browser/cjs/DNCC-QNp2I7saV-I.cjs +0 -1
- package/browser/cjs/DcHxh5QxfVitzdhv.cjs +0 -1
- package/browser/cjs/DgGGzl7jq3i7Cqfi.cjs +0 -1
- package/browser/cjs/Dkgu60euhL6wPoYa2.cjs +0 -1
- package/browser/cjs/DsFZgtSQpC75d1M02.cjs +0 -1
- package/browser/cjs/DsgqbxMOVQmAFSDy2.cjs +0 -1
- package/browser/cjs/Dtc_8P-koQRmNT2s.cjs +0 -33
- package/browser/cjs/FUM_3mQlC-6WPjkT.cjs +0 -4
- package/browser/cjs/IbciPMJP2Pam3ERm.cjs +0 -1
- package/browser/cjs/Kvn916ebqGc4t6hv2.cjs +0 -1
- package/browser/cjs/NzAMMcPT7SETmqPg.cjs +0 -2
- package/browser/cjs/QK9BfdSZPLmyRpGi2.cjs +0 -1
- package/browser/cjs/Y78-VwYSNffwXRVz2.cjs +0 -2
- package/browser/cjs/bpcQTcfzGVBK-rfT2.cjs +0 -1
- package/browser/cjs/fqTQ_p3ehzUvc1tF2.cjs +0 -1
- package/browser/cjs/h3dw1jAp2J5Pu4p32.cjs +0 -1
- package/browser/cjs/iyvcAhhnDFxkR8tW.cjs +0 -1
- package/browser/cjs/jev6VGWTdgEgm4Yk2.cjs +0 -1
- package/browser/cjs/kqP-W5qRIy-d-ChZ.cjs +0 -1
- package/browser/cjs/mXzhcays1ok40iiU.cjs +0 -1
- package/browser/cjs/ppSJKdLn646BZOzg.cjs +0 -1
- package/browser/cjs/sFD2bsTPq558FCMx.cjs +0 -126
- package/browser/cjs/stXrcKZOIHl0fq5U2.cjs +0 -2
- package/browser/esm/B-dSKzg5shPDd733.mjs +0 -25
- package/browser/esm/B6bX01HNxwBooBTX2.mjs +0 -514
- package/browser/esm/BPwpFe7c1-F62aAU.mjs +0 -518
- package/browser/esm/BT2mYkpZGrhWovkv2.mjs +0 -238
- package/browser/esm/BUKNpzG26V0YaAzW.mjs +0 -219
- package/browser/esm/BgNWvKfVoVgVVDB4.mjs +0 -134
- package/browser/esm/Bj3gyDL2ZJUDcxt72.mjs +0 -82
- package/browser/esm/BkBT2LB95lonIiBu.mjs +0 -152
- package/browser/esm/BqMvXD8dX4ksYjnj.mjs +0 -53
- package/browser/esm/CElACTFuqPAnCAMJ.mjs +0 -99
- package/browser/esm/CFtsbobCiLpZIzCh.mjs +0 -34
- package/browser/esm/CbJ_xQftC08KrH3E2.mjs +0 -20
- package/browser/esm/CfjG7gHJ4oN60Clj.mjs +0 -4423
- package/browser/esm/CpEgh9EOkeMvwAuj.mjs +0 -304
- package/browser/esm/CxKAnYBWCYMkUpnr.mjs +0 -824
- package/browser/esm/Cye91DfKIFwRdDpF.mjs +0 -224
- package/browser/esm/DFQGftDcmDwUGxV8.mjs +0 -27
- package/browser/esm/DdaO25i-WWFSh1W0.mjs +0 -3188
- package/browser/esm/DhW7Cqyuxk7D6zsW.mjs +0 -509
- package/browser/esm/DhgwMDb052opCiAA.mjs +0 -11273
- package/browser/esm/DimkHq0_x-d4uNdV.mjs +0 -50758
- package/browser/esm/DnCkPg9-xb3RvxD-.mjs +0 -44
- package/browser/esm/DygUxASTETZM60uN2.mjs +0 -47
- package/browser/esm/FAHIw2t7_M_rvRio.mjs +0 -149
- package/browser/esm/HFqcMD9nTL0jdLxT.mjs +0 -15
- package/browser/esm/N-koparnupMSl92y.mjs +0 -2687
- package/browser/esm/evPbHV86yom22yGf2.mjs +0 -16301
- package/browser/esm/ohVj-y1gCC9PEHJI.mjs +0 -87
- package/cdn/assets/B-dSKzg5shPDd733.js +0 -25
- package/cdn/assets/B3ZyfwskutLZMYfl2.js +0 -44
- package/cdn/assets/B6Y_HasaiihQLVYz2.js +0 -3188
- package/cdn/assets/B8ok93z6wOu1Mo5H.js +0 -27
- package/cdn/assets/BdmCBWTVHb7KuHxO2.js +0 -2687
- package/cdn/assets/BjN8kU7URKZwGlmk2.js +0 -4423
- package/cdn/assets/BouCHi6QnBrUDYkx.js +0 -16301
- package/cdn/assets/CLhSKL0Xdm8miSTy.js +0 -34
- package/cdn/assets/CSkSOhGT8E29E2Nh2.js +0 -99
- package/cdn/assets/CXrcgTVB77CopjOJ.js +0 -518
- package/cdn/assets/Cb71rZAQvCk3wnfp.js +0 -220
- package/cdn/assets/CbJ_xQftC08KrH3E.js +0 -20
- package/cdn/assets/CblzazoiTtSuaAkj.js +0 -225
- package/cdn/assets/CdPxVRKpCOqCDHI8.js +0 -824
- package/cdn/assets/CimYGZTVXcjbjrBU2.js +0 -83
- package/cdn/assets/CpEgh9EOkeMvwAuj.js +0 -304
- package/cdn/assets/D57KcDfTbBzf_NGr.js +0 -150
- package/cdn/assets/Dhq9e6LCpmlIkFod.js +0 -220
- package/cdn/assets/DjS4iUli-T3uuUfK.js +0 -24
- package/cdn/assets/DjS4iUli-T3uuUfK2.js +0 -24
- package/cdn/assets/DoJfPxuL3zziG4p62.js +0 -134
- package/cdn/assets/Dq7WxMef5CTJ47QI2.js +0 -48
- package/cdn/assets/HFqcMD9nTL0jdLxT2.js +0 -15
- package/cdn/assets/HeznPoDlSj26Q4lq.js +0 -11274
- package/cdn/assets/JL1xk8XqkuTOA_as2.js +0 -239
- package/cdn/assets/NZO3-fDBtqhmCsbB2.js +0 -50758
- package/cdn/assets/Wsgx1I_j1chJ6hwn.js +0 -152
- package/cdn/assets/XSUr59k0gaFIS1Qf2.js +0 -53
- package/cdn/assets/omgRvCRxe7suvog8.js +0 -510
- package/cdn/assets/zrS_ERBQML_OXJ4J.js +0 -87
- /package/browser/cjs/{1XrWGMP3GmsQOMIX.cjs → 1XrWGMP3GmsQOMIX2.cjs} +0 -0
- /package/browser/cjs/{507hQYooKKjnRzsZ2.cjs → 507hQYooKKjnRzsZ.cjs} +0 -0
- /package/browser/cjs/{BAxVLKkxFgI6cXnR2.cjs → BAxVLKkxFgI6cXnR.cjs} +0 -0
- /package/browser/cjs/{BWDfauDHqB6U_2ka2.cjs → BWDfauDHqB6U_2ka.cjs} +0 -0
- /package/browser/cjs/{Btc0Nzu40VYOpzLX2.cjs → Btc0Nzu40VYOpzLX.cjs} +0 -0
- /package/browser/cjs/{C2uDl8VIJqh58YF_2.cjs → C2uDl8VIJqh58YF_.cjs} +0 -0
- /package/browser/cjs/{CW-b31_-r-_raT8Y.cjs → CW-b31_-r-_raT8Y2.cjs} +0 -0
- /package/browser/cjs/{CXlzsh_WHCOsErJ12.cjs → CXlzsh_WHCOsErJ1.cjs} +0 -0
- /package/browser/cjs/{DM7-R_ltoLbA9jde2.cjs → DM7-R_ltoLbA9jde.cjs} +0 -0
- /package/browser/cjs/{DNKyaSruDogoBd2H.cjs → DNKyaSruDogoBd2H2.cjs} +0 -0
- /package/browser/cjs/{Dx79LP1-YCQg8B87.cjs → Dx79LP1-YCQg8B872.cjs} +0 -0
- /package/browser/cjs/{CbLXP9WY38wTcGn5.cjs → NcNz8RfT5V889CMT2.cjs} +0 -0
- /package/browser/cjs/{aONv0Ys3C8xmnaR8.cjs → aONv0Ys3C8xmnaR82.cjs} +0 -0
- /package/browser/cjs/{z_rZE1OHFPpdGBh42.cjs → z_rZE1OHFPpdGBh4.cjs} +0 -0
|
@@ -0,0 +1,3342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.2
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { C as e, G as t, I as n, K as r, N as i, O as a, R as o, S as s, b as c, c as l, f as u, i as d, j as f, r as p, t as m, y as h } from "./DuijhgjRhgWB9sCY.mjs";
|
|
8
|
+
import { r as g } from "./C6X4CmElTpPxrad6.mjs";
|
|
9
|
+
import { i as _, t as v } from "./B50P0gSziuG68Umu.mjs";
|
|
10
|
+
import { $t as y, A as b, B as x, Bt as S, C, Ct as w, D as T, E as ee, Et as te, Ft as ne, Gt as re, Ht as E, Jt as D, K as ie, Kt as ae, L as oe, M as se, Mt as O, N as k, O as ce, Ot as A, P as le, Pt as j, Q as ue, Qt as de, R as fe, Rt as pe, S as me, St as he, Tt as ge, U as _e, Vt as ve, X as ye, Y as be, Yt as xe, Z as Se, Zt as Ce, _ as we, at as Te, b as M, bt as N, c as Ee, cn as De, ct as Oe, d as ke, dn as P, dt as Ae, en as je, et as Me, gt as Ne, j as Pe, kt as Fe, m as Ie, mt as Le, nn as Re, o as F, p as ze, pt as Be, q as I, qt as Ve, r as He, rn as Ue, rt as We, s as Ge, tt as Ke, u as qe, ut as Je, vt as Ye, w as Xe, wt as Ze, xt as Qe, yt as L, zt as $e } from "./Bc8-re9biUn57kdl.mjs";
|
|
11
|
+
var et, tt = class extends i {
|
|
12
|
+
constructor(e, t = 50) {
|
|
13
|
+
super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
|
|
14
|
+
}
|
|
15
|
+
_undoCommits(e = this.maxStack) {
|
|
16
|
+
let t = this._transactions;
|
|
17
|
+
if (!t) return [];
|
|
18
|
+
let n = t.getLog(t.getCurrentCommit(!1).getId(), 2 ** 53 - 1), r = [];
|
|
19
|
+
for (let t = 0; t < n.length && r.length < e; t++) {
|
|
20
|
+
let e = n[t];
|
|
21
|
+
if (e.getId() === this._floorId || t === n.length - 1) break;
|
|
22
|
+
e.getDescription() && r.push(e);
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
25
|
+
}
|
|
26
|
+
_redoCommits(e = this.maxStack) {
|
|
27
|
+
let t = this._transactions;
|
|
28
|
+
if (!t) return [];
|
|
29
|
+
let n = t.getCurrentCommit(!1).getId(), r = t.getTipCommit().getId();
|
|
30
|
+
if (r === n) return [];
|
|
31
|
+
let i = t.getLog(r, 2 ** 53 - 1), a = [], o = !1;
|
|
32
|
+
for (let e of i) {
|
|
33
|
+
if (e.getId() === n) {
|
|
34
|
+
o = !0;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
a.push(e);
|
|
38
|
+
}
|
|
39
|
+
if (!o) return [];
|
|
40
|
+
a.reverse();
|
|
41
|
+
let s = [];
|
|
42
|
+
for (let t of a) if (t.getDescription() && s.push(t), s.length >= e) break;
|
|
43
|
+
return s;
|
|
44
|
+
}
|
|
45
|
+
undo(e = 1) {
|
|
46
|
+
let t = this._transactions;
|
|
47
|
+
if (!t) return;
|
|
48
|
+
let n = !1;
|
|
49
|
+
try {
|
|
50
|
+
for (let r = 0; r < e; r++) {
|
|
51
|
+
let [e] = this._undoCommits(1);
|
|
52
|
+
if (!e) break;
|
|
53
|
+
t.revert(e.getId()), n = !0;
|
|
54
|
+
}
|
|
55
|
+
} finally {
|
|
56
|
+
n && this._notifyOnStackChange();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
redo(e = 1) {
|
|
60
|
+
let t = this._transactions;
|
|
61
|
+
if (!t) return;
|
|
62
|
+
let n = !1;
|
|
63
|
+
try {
|
|
64
|
+
for (let r = 0; r < e; r++) {
|
|
65
|
+
let [e] = this._redoCommits(1);
|
|
66
|
+
if (!e) {
|
|
67
|
+
r === 0 && this._repeatOperation?.repeat();
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
t.restore(e.getId()), n = !0;
|
|
71
|
+
}
|
|
72
|
+
} finally {
|
|
73
|
+
n && this._notifyOnStackChange();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
hasUndo() {
|
|
77
|
+
return this._undoCommits(1).length > 0;
|
|
78
|
+
}
|
|
79
|
+
hasRedo() {
|
|
80
|
+
return this._redoCommits(1).length > 0 || this._repeatOperation !== null;
|
|
81
|
+
}
|
|
82
|
+
getTopUndoDescription() {
|
|
83
|
+
return this._undoCommits(1)[0]?.getDescription() ?? null;
|
|
84
|
+
}
|
|
85
|
+
getTopRedoDescription() {
|
|
86
|
+
return this._repeatOperation === null ? this._redoCommits(1)[0]?.getDescription() ?? null : this._repeatOperation.description;
|
|
87
|
+
}
|
|
88
|
+
getUndoDescriptions() {
|
|
89
|
+
return this._undoCommits().map((e) => e.getDescription());
|
|
90
|
+
}
|
|
91
|
+
getRedoDescriptions() {
|
|
92
|
+
let e = this._redoCommits().map((e) => e.getDescription());
|
|
93
|
+
return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
|
|
94
|
+
}
|
|
95
|
+
addUndoOperation() {
|
|
96
|
+
throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
|
|
97
|
+
}
|
|
98
|
+
clear(e = !0) {
|
|
99
|
+
this._transactions && (this._floorId = this._transactions.getCurrentCommit(!1).getId()), super.clear(e);
|
|
100
|
+
}
|
|
101
|
+
close() {
|
|
102
|
+
this._removeListener?.();
|
|
103
|
+
}
|
|
104
|
+
}, nt = class {
|
|
105
|
+
constructor(e, t) {
|
|
106
|
+
this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new x(this);
|
|
107
|
+
let n = this;
|
|
108
|
+
this._removeStoreListener = e.addListener({
|
|
109
|
+
onCommitEnd() {
|
|
110
|
+
n._recompute();
|
|
111
|
+
},
|
|
112
|
+
onCommitChange() {
|
|
113
|
+
n._recompute();
|
|
114
|
+
}
|
|
115
|
+
}), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
|
|
116
|
+
e.store === n._store && n.markSaved(e.commitId);
|
|
117
|
+
} });
|
|
118
|
+
}
|
|
119
|
+
getStore() {
|
|
120
|
+
return this._store;
|
|
121
|
+
}
|
|
122
|
+
isDirty() {
|
|
123
|
+
return (this._store.getCurrentCommit()?.getId() ?? null) !== this._savedCommitId;
|
|
124
|
+
}
|
|
125
|
+
getSavedCommitId() {
|
|
126
|
+
return this._savedCommitId;
|
|
127
|
+
}
|
|
128
|
+
markSaved(e = this._store.getCurrentCommit()?.getId() ?? null) {
|
|
129
|
+
e !== this._savedCommitId && (this._savedCommitId = e ?? null, this._recompute());
|
|
130
|
+
}
|
|
131
|
+
addListeners(e, t) {
|
|
132
|
+
return this._emitter.addListeners(e, t);
|
|
133
|
+
}
|
|
134
|
+
_recompute() {
|
|
135
|
+
let e = this.isDirty();
|
|
136
|
+
e !== this._dirty && (this._dirty = e, this._emitter.notify(e ? "onDirty" : "onClean", { transactional: !1 }));
|
|
137
|
+
}
|
|
138
|
+
close() {
|
|
139
|
+
this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
et ||= {};
|
|
143
|
+
var R = class e {
|
|
144
|
+
constructor(t, n = {}) {
|
|
145
|
+
this._password = null, this._emitter = new x(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
|
|
146
|
+
}
|
|
147
|
+
static _defaultCanWrite(e) {
|
|
148
|
+
return !!e && !/^(https?:|data:|blob:)/i.test(e);
|
|
149
|
+
}
|
|
150
|
+
_cleanPath() {
|
|
151
|
+
return this._path ? this._path.split(/[?#]/)[0] : null;
|
|
152
|
+
}
|
|
153
|
+
getName() {
|
|
154
|
+
if (this._name !== null && this._name !== void 0) return this._name;
|
|
155
|
+
let e = this._cleanPath();
|
|
156
|
+
return e && O(e) || null;
|
|
157
|
+
}
|
|
158
|
+
getPath() {
|
|
159
|
+
return this._path;
|
|
160
|
+
}
|
|
161
|
+
getFormat() {
|
|
162
|
+
return this._format ? this._format : this.getExtension();
|
|
163
|
+
}
|
|
164
|
+
getExtension() {
|
|
165
|
+
let e = this._cleanPath();
|
|
166
|
+
if (!e) return null;
|
|
167
|
+
let t = k(e);
|
|
168
|
+
return t ? t.toLowerCase() : null;
|
|
169
|
+
}
|
|
170
|
+
getEncryption() {
|
|
171
|
+
return this._encryption;
|
|
172
|
+
}
|
|
173
|
+
isEncrypted() {
|
|
174
|
+
return this._encryption !== null || this._password !== null;
|
|
175
|
+
}
|
|
176
|
+
setPassword(e) {
|
|
177
|
+
this._password !== (e ?? null) && (this._password = e ?? null, this._password === null && (this._encryption = null), this._emitter.notify("onChange"));
|
|
178
|
+
}
|
|
179
|
+
getPassword() {
|
|
180
|
+
return this._password;
|
|
181
|
+
}
|
|
182
|
+
getSize() {
|
|
183
|
+
return this._size;
|
|
184
|
+
}
|
|
185
|
+
getLastModified() {
|
|
186
|
+
return this._lastModified;
|
|
187
|
+
}
|
|
188
|
+
canWrite() {
|
|
189
|
+
return this._canWrite;
|
|
190
|
+
}
|
|
191
|
+
setName(e) {
|
|
192
|
+
this.update({ name: e });
|
|
193
|
+
}
|
|
194
|
+
update(e) {
|
|
195
|
+
let t = !1;
|
|
196
|
+
return e.lastModified !== void 0 && e.lastModified !== this._lastModified && (this._lastModified = e.lastModified, t = !0), e.name !== void 0 && e.name !== this._name && (this._name = e.name, t = !0), e.format !== void 0 && e.format !== this._format && (this._format = e.format, t = !0), e.size !== void 0 && e.size !== this._size && (this._size = e.size, t = !0), e.canWrite !== void 0 && e.canWrite !== this._canWrite && (this._canWrite = e.canWrite, t = !0), e.encryption !== void 0 && e.encryption !== this._encryption && (this._encryption = e.encryption, t = !0), t && this._emitter.notify("onChange"), this;
|
|
197
|
+
}
|
|
198
|
+
addListeners(e, t) {
|
|
199
|
+
return this._emitter.addListeners(e, t);
|
|
200
|
+
}
|
|
201
|
+
get [Symbol.toStringTag]() {
|
|
202
|
+
return "[Origin]";
|
|
203
|
+
}
|
|
204
|
+
toString() {
|
|
205
|
+
let e = this._cleanPath(), t = e ? e.split(/[/\\]/).pop() || e : this._name ?? "(unbound)", n = this._size;
|
|
206
|
+
if (n == null) return t;
|
|
207
|
+
if (n < 1024) return `${t} ${n}B`;
|
|
208
|
+
let r = Math.floor(Math.log(n) / Math.log(1024)), i = [
|
|
209
|
+
"B",
|
|
210
|
+
"KB",
|
|
211
|
+
"MB",
|
|
212
|
+
"GB",
|
|
213
|
+
"TB"
|
|
214
|
+
];
|
|
215
|
+
return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
|
|
216
|
+
}
|
|
217
|
+
}, z = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new Set(), rt = (e) => z.get(e) ?? null, it = () => Array.from(B, (e) => e.getOrigin()), at = class e {
|
|
218
|
+
constructor(t) {
|
|
219
|
+
this._released = !1, e._assertFree(t), this._emitter = new x(this), this._origin = t, z.set(t, this), B.add(this);
|
|
220
|
+
}
|
|
221
|
+
getOrigin() {
|
|
222
|
+
return this._origin;
|
|
223
|
+
}
|
|
224
|
+
setOrigin(t) {
|
|
225
|
+
t !== this._origin && (e._assertFree(t), this._released || (z.delete(this._origin), z.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
|
|
226
|
+
}
|
|
227
|
+
release() {
|
|
228
|
+
this._released || (this._released = !0, z.get(this._origin) === this && z.delete(this._origin), B.delete(this));
|
|
229
|
+
}
|
|
230
|
+
addListeners(e, t) {
|
|
231
|
+
return this._emitter.addListeners(e, t);
|
|
232
|
+
}
|
|
233
|
+
static _assertFree(e) {
|
|
234
|
+
if (z.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
|
|
235
|
+
}
|
|
236
|
+
}, ot = class {
|
|
237
|
+
constructor() {
|
|
238
|
+
this._defaultStringSourceType = "filepath";
|
|
239
|
+
}
|
|
240
|
+
async read(e) {
|
|
241
|
+
let t = e.options ?? {}, n = e.source;
|
|
242
|
+
if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
|
|
243
|
+
let r = n, i = await this.fileFromHandle(n);
|
|
244
|
+
i && (n = i);
|
|
245
|
+
let a = t.format, o = this._detectSourceType(n);
|
|
246
|
+
if (!o) throw Error("Unable to detect source type from provided input.");
|
|
247
|
+
let s, c, l = !1;
|
|
248
|
+
if (o === "filepath") {
|
|
249
|
+
let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
|
|
250
|
+
n = await this.filePathToFile(e), o = "file", l = !0;
|
|
251
|
+
}
|
|
252
|
+
switch (o) {
|
|
253
|
+
case "file": {
|
|
254
|
+
let e = n, r = e?.name, o = r ? `${O(r)}` : "";
|
|
255
|
+
s = await e.arrayBuffer(), c = {
|
|
256
|
+
format: a,
|
|
257
|
+
ext: k(r),
|
|
258
|
+
name: o,
|
|
259
|
+
absolutePath: r,
|
|
260
|
+
size: e.size,
|
|
261
|
+
lastModified: e.lastModified,
|
|
262
|
+
canWrite: !t.asCopy && (!!i || l && this._canWriteLocalPath())
|
|
263
|
+
};
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
case "blob": {
|
|
267
|
+
let e = n;
|
|
268
|
+
s = await e.arrayBuffer(), c = {
|
|
269
|
+
format: a,
|
|
270
|
+
size: e.size
|
|
271
|
+
};
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case "base64": {
|
|
275
|
+
let e;
|
|
276
|
+
if (n && typeof n == "object" && "base64" in n) e = n.base64;
|
|
277
|
+
else if (typeof n == "string" && n.startsWith("data:")) {
|
|
278
|
+
let [, t] = n.split(",");
|
|
279
|
+
e = t;
|
|
280
|
+
} else e = n;
|
|
281
|
+
s = m.base64ToArrayBuffer(e), c = {
|
|
282
|
+
format: a,
|
|
283
|
+
size: e.length
|
|
284
|
+
};
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "fetch": {
|
|
288
|
+
let e, t, r;
|
|
289
|
+
if (typeof n == "string") e = n;
|
|
290
|
+
else {
|
|
291
|
+
if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
|
|
292
|
+
{
|
|
293
|
+
let i = n;
|
|
294
|
+
e = i.input, t = i.init, r = i.timeout;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d = k(u);
|
|
298
|
+
try {
|
|
299
|
+
let n = await fetch(e, {
|
|
300
|
+
...t,
|
|
301
|
+
signal: o.signal
|
|
302
|
+
});
|
|
303
|
+
if (clearTimeout(l), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
|
|
304
|
+
let r = await n.arrayBuffer();
|
|
305
|
+
if (!r) throw Error(`Unable to fetched content: ${u}`);
|
|
306
|
+
s = r, c = {
|
|
307
|
+
format: a,
|
|
308
|
+
ext: d,
|
|
309
|
+
name: O(u, !0),
|
|
310
|
+
absolutePath: u
|
|
311
|
+
};
|
|
312
|
+
} catch (e) {
|
|
313
|
+
throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case "buffer":
|
|
318
|
+
s = n, c = { format: a };
|
|
319
|
+
break;
|
|
320
|
+
case "stream": {
|
|
321
|
+
let e = n.getReader(), t = [], r = 0;
|
|
322
|
+
try {
|
|
323
|
+
for (;;) {
|
|
324
|
+
let { done: n, value: i } = await e.read();
|
|
325
|
+
if (n) break;
|
|
326
|
+
t.push(i), r += i.length;
|
|
327
|
+
}
|
|
328
|
+
} finally {
|
|
329
|
+
e.releaseLock();
|
|
330
|
+
}
|
|
331
|
+
let i = new ArrayBuffer(r), o = new Uint8Array(i), l = 0;
|
|
332
|
+
for (let e of t) o.set(e, l), l += e.length;
|
|
333
|
+
s = i, c = { format: a };
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
default: throw Error(`Unsupported source type: ${o}`);
|
|
337
|
+
}
|
|
338
|
+
c.canWrite && await this.findOpenOrigin(r, c) && (c.canWrite = !1);
|
|
339
|
+
let u = await e.decode(s, {
|
|
340
|
+
sourceType: o,
|
|
341
|
+
...c
|
|
342
|
+
});
|
|
343
|
+
return u ? (await this.onWorkbookRead(u, r), u) : null;
|
|
344
|
+
}
|
|
345
|
+
async findOpenOrigin(e, t) {
|
|
346
|
+
return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
|
|
347
|
+
}
|
|
348
|
+
findOpenPath(e, t) {
|
|
349
|
+
return it().find((n) => {
|
|
350
|
+
if (n === t || !n.canWrite()) return !1;
|
|
351
|
+
let r = n.getPath();
|
|
352
|
+
return !!r && this.isSamePath(r, e);
|
|
353
|
+
}) ?? null;
|
|
354
|
+
}
|
|
355
|
+
isSamePath(e, t) {
|
|
356
|
+
return e === t;
|
|
357
|
+
}
|
|
358
|
+
async fileFromHandle(e) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
async resolveSource(e) {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
async onWorkbookRead(e, t) {}
|
|
365
|
+
_canWriteLocalPath() {
|
|
366
|
+
return !1;
|
|
367
|
+
}
|
|
368
|
+
_detectSourceType(e) {
|
|
369
|
+
if (e && typeof e == "object" && "base64" in e) return "base64";
|
|
370
|
+
if (e && typeof e == "object" && "input" in e) return "fetch";
|
|
371
|
+
if (typeof e == "string") {
|
|
372
|
+
if (e.startsWith("data:")) return "base64";
|
|
373
|
+
if (e.startsWith("http://") || e.startsWith("https://")) return "fetch";
|
|
374
|
+
if (e.startsWith("file://")) return "filepath";
|
|
375
|
+
let t = this._defaultStringSourceType;
|
|
376
|
+
return e.startsWith("./") || e.startsWith("../") || e.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(e), t;
|
|
377
|
+
}
|
|
378
|
+
if (typeof File < "u" && e instanceof File) return "file";
|
|
379
|
+
if (typeof Blob < "u" && e instanceof Blob) return "blob";
|
|
380
|
+
let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = m.isNodeBuffer(e);
|
|
381
|
+
return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
|
|
382
|
+
}
|
|
383
|
+
}, st = class extends ot {
|
|
384
|
+
constructor(e, t) {
|
|
385
|
+
super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
|
|
386
|
+
}
|
|
387
|
+
async fileFromHandle(e) {
|
|
388
|
+
return V(e) ? e.getFile() : null;
|
|
389
|
+
}
|
|
390
|
+
async resolveSource() {
|
|
391
|
+
let e = await this._getReadFormats?.() ?? [];
|
|
392
|
+
if (typeof globalThis.showOpenFilePicker == "function") try {
|
|
393
|
+
let t = function(e) {
|
|
394
|
+
let t = ct(e);
|
|
395
|
+
if (t.length <= 1) return t;
|
|
396
|
+
let n = /* @__PURE__ */ new Set(), r = {};
|
|
397
|
+
for (let e of t) for (let [t, i] of Object.entries(e.accept)) for (let e of i) n.has(e) || (n.add(e), (r[t] ??= []).push(e));
|
|
398
|
+
return [{
|
|
399
|
+
description: "All Supported",
|
|
400
|
+
accept: r
|
|
401
|
+
}, ...t];
|
|
402
|
+
}(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
|
|
403
|
+
return n;
|
|
404
|
+
} catch (e) {
|
|
405
|
+
if (e?.name === "AbortError") return null;
|
|
406
|
+
throw e;
|
|
407
|
+
}
|
|
408
|
+
let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
|
|
409
|
+
return l.openFileDialog(t);
|
|
410
|
+
}
|
|
411
|
+
async findOpenOrigin(e) {
|
|
412
|
+
return V(e) ? this._findOpenHandle(e) : null;
|
|
413
|
+
}
|
|
414
|
+
async _findOpenHandle(e, t) {
|
|
415
|
+
for (let n of it()) {
|
|
416
|
+
if (n === t || !n.canWrite()) continue;
|
|
417
|
+
let r = this._handleCache.get(n);
|
|
418
|
+
if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
|
|
419
|
+
}
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
async onWorkbookRead(e, t) {
|
|
423
|
+
if (!V(t)) return;
|
|
424
|
+
let n = e.getOrigin?.();
|
|
425
|
+
n?.canWrite() && this._handleCache.set(n, t);
|
|
426
|
+
}
|
|
427
|
+
async filePathToFile(e) {
|
|
428
|
+
throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
|
|
429
|
+
}
|
|
430
|
+
async write(e) {
|
|
431
|
+
let { origin: n, suggestedName: r, format: i, encode: a, prompt: o } = e, s = [i, ...(await this._getWriteFormats()).filter((e) => e.key !== i.key)], c = typeof globalThis.showSaveFilePicker == "function", l = !o && n.canWrite() ? this._handleCache.get(n) : void 0;
|
|
432
|
+
if (c) try {
|
|
433
|
+
if (l) {
|
|
434
|
+
let e = await async function(e) {
|
|
435
|
+
try {
|
|
436
|
+
if (typeof e.queryPermission != "function") return "granted";
|
|
437
|
+
let t = { mode: "readwrite" };
|
|
438
|
+
return await e.queryPermission(t) === "granted" || await e.requestPermission(t) === "granted" ? "granted" : "denied";
|
|
439
|
+
} catch {
|
|
440
|
+
return "unavailable";
|
|
441
|
+
}
|
|
442
|
+
}(l);
|
|
443
|
+
if (e === "denied") return null;
|
|
444
|
+
e !== "granted" && (l = void 0);
|
|
445
|
+
}
|
|
446
|
+
let o = !!l;
|
|
447
|
+
if (!o) {
|
|
448
|
+
l = await globalThis.showSaveFilePicker({
|
|
449
|
+
suggestedName: r,
|
|
450
|
+
types: ct(s)
|
|
451
|
+
});
|
|
452
|
+
let n = await this._findOpenHandle(l, e.workbook?.getOrigin?.());
|
|
453
|
+
if (n) throw new h(t("error.io.openElsewhere", { name: n.getName() ?? l.name ?? "" }));
|
|
454
|
+
}
|
|
455
|
+
let c = ut(l.name ?? r), u = s.find((e) => e.exts.some((e) => e.toLowerCase() === c)) ?? i, d = o ? n : new R(l.name ?? r, {
|
|
456
|
+
format: u.key,
|
|
457
|
+
canWrite: !0
|
|
458
|
+
}), f = await a(u.key, d);
|
|
459
|
+
if (!f) return null;
|
|
460
|
+
let p = new Blob([lt(f)], { type: u.mimeType || "application/octet-stream" }), m = await l.createWritable();
|
|
461
|
+
if (await m.write(p), await m.close(), this._handleCache.set(d, l), d instanceof R) {
|
|
462
|
+
let e = await Promise.resolve(l.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
|
|
463
|
+
d.update({
|
|
464
|
+
size: p.size,
|
|
465
|
+
lastModified: e
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
return d;
|
|
469
|
+
} catch (e) {
|
|
470
|
+
if (e?.name === "AbortError") return null;
|
|
471
|
+
if (e instanceof h) throw e;
|
|
472
|
+
}
|
|
473
|
+
let u = n.getPath(), d = u ? u.split(/[/\\]/).pop() : null, f = d && i.exts.some((e) => e.toLowerCase() === ut(d)) ? d : r, p = u !== f || n.canWrite() ? new R(f, {
|
|
474
|
+
format: i.key,
|
|
475
|
+
canWrite: !1
|
|
476
|
+
}) : n, m = await a(i.key, p);
|
|
477
|
+
if (!m) return null;
|
|
478
|
+
let g = new Blob([lt(m)], { type: i.mimeType || "application/octet-stream" });
|
|
479
|
+
return function(e, t) {
|
|
480
|
+
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
481
|
+
r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
482
|
+
}(g, f), p instanceof R && p.update({ size: g.size }), p;
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
function ct(e) {
|
|
486
|
+
return e.map((e) => {
|
|
487
|
+
let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
|
|
488
|
+
return {
|
|
489
|
+
description: e.description ?? e.key,
|
|
490
|
+
accept: { [t]: e.exts.map((e) => "." + e) }
|
|
491
|
+
};
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function V(e) {
|
|
495
|
+
return !!e && e.kind === "file" && typeof e.getFile == "function";
|
|
496
|
+
}
|
|
497
|
+
function lt(e) {
|
|
498
|
+
if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
|
|
499
|
+
let t = new ArrayBuffer(e.byteLength);
|
|
500
|
+
return new Uint8Array(t).set(new Uint8Array(e)), t;
|
|
501
|
+
}
|
|
502
|
+
return e;
|
|
503
|
+
}
|
|
504
|
+
function ut(e) {
|
|
505
|
+
let t = e.lastIndexOf(".");
|
|
506
|
+
return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
507
|
+
}
|
|
508
|
+
var dt = class {
|
|
509
|
+
constructor(e) {
|
|
510
|
+
this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
|
|
511
|
+
}
|
|
512
|
+
toJSON() {
|
|
513
|
+
return this._private.input;
|
|
514
|
+
}
|
|
515
|
+
getFamily() {
|
|
516
|
+
return this._private.name;
|
|
517
|
+
}
|
|
518
|
+
getPitch() {
|
|
519
|
+
return this._private.pitch;
|
|
520
|
+
}
|
|
521
|
+
getPanose() {
|
|
522
|
+
return this._private.panose;
|
|
523
|
+
}
|
|
524
|
+
toString() {
|
|
525
|
+
return typeof this._private.input == "string" ? this._private.input : JSON.stringify(this._private.input);
|
|
526
|
+
}
|
|
527
|
+
get isIFont() {
|
|
528
|
+
return !0;
|
|
529
|
+
}
|
|
530
|
+
}, ft = g({
|
|
531
|
+
findBestMatch: () => bt,
|
|
532
|
+
getFontList: () => gt,
|
|
533
|
+
setFontList: () => W
|
|
534
|
+
}), pt = [
|
|
535
|
+
"Arial",
|
|
536
|
+
"Arial Black",
|
|
537
|
+
"Brush Script MT",
|
|
538
|
+
"Calibri",
|
|
539
|
+
"Comic Sans MS",
|
|
540
|
+
"Courier New",
|
|
541
|
+
"Garamond",
|
|
542
|
+
"Georgia",
|
|
543
|
+
"Impact",
|
|
544
|
+
"Luminari",
|
|
545
|
+
"Palatino Linotype",
|
|
546
|
+
"Tahoma",
|
|
547
|
+
"Times New Roman",
|
|
548
|
+
"Trebuchet MS",
|
|
549
|
+
"Verdana"
|
|
550
|
+
], H = /* @__PURE__ */ new Map();
|
|
551
|
+
H.set(M.GenericName.Serif, ["Tahoma"]), H.set(M.GenericName.SanSerif, ["Calibri"]), H.set(M.GenericName.MonoSpace, ["Courier New"]), H.set(M.GenericName.Cursive, ["Comic Sans MS"]), H.set(M.GenericName.Fantasy, ["Luminari"]), H.set(M.GenericName.UISystem, ["Arial"]), H.set(M.GenericName.UISerif, ["Tahoma"]), H.set(M.GenericName.UISanSerif, ["Arial"]), H.set(M.GenericName.UIMonoSpace, ["Courier New"]), H.set(M.GenericName.UIRounded, ["Arial"]), H.set(M.GenericName.Math, []), H.set(M.GenericName.Emoji, []), H.set(M.GenericName.Fangsong, []);
|
|
552
|
+
var U = /* @__PURE__ */ new Map(), mt = [];
|
|
553
|
+
W(pt);
|
|
554
|
+
var ht = eval;
|
|
555
|
+
function W(e) {
|
|
556
|
+
e || W(pt);
|
|
557
|
+
let t = [];
|
|
558
|
+
for (let n = 0; n < e.length; n++) {
|
|
559
|
+
let r = e[n];
|
|
560
|
+
typeof r == "string" && (r = new dt(r));
|
|
561
|
+
let i = !0;
|
|
562
|
+
try {
|
|
563
|
+
i = ht(`document.fonts.check('12px ${r.getFamily()}')`);
|
|
564
|
+
} catch {}
|
|
565
|
+
let a = {
|
|
566
|
+
fontRef: r,
|
|
567
|
+
loaded: i
|
|
568
|
+
};
|
|
569
|
+
t.push(a), U.set(r.getFamily(), a);
|
|
570
|
+
}
|
|
571
|
+
mt = Object.freeze(t);
|
|
572
|
+
}
|
|
573
|
+
function gt() {
|
|
574
|
+
return mt;
|
|
575
|
+
}
|
|
576
|
+
var _t, vt, G, yt, K = /* @__PURE__ */ new Map();
|
|
577
|
+
function bt(e, t) {
|
|
578
|
+
let n = K.get(e);
|
|
579
|
+
if (n) return n.fontRef === null ? null : n;
|
|
580
|
+
let r = [e];
|
|
581
|
+
t?.fallbacks && (r = r.concat(t.fallbacks));
|
|
582
|
+
let i = null;
|
|
583
|
+
for (let e = 0; !i && e < r.length; e++) {
|
|
584
|
+
let t = r[e];
|
|
585
|
+
if (i = U.get(t), !i) {
|
|
586
|
+
let e = H.get(t);
|
|
587
|
+
if (e) for (let t = 0; !i && t < e.length; t++) i = U.get(e[t]);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return i ? K.set(e, i) : K.set(e, {
|
|
591
|
+
fontRef: null,
|
|
592
|
+
loaded: !1
|
|
593
|
+
}), i;
|
|
594
|
+
}
|
|
595
|
+
var xt = g({
|
|
596
|
+
DefaultFontSizes: () => St,
|
|
597
|
+
findNextFontSize: () => Ct
|
|
598
|
+
}), St = Object.freeze([
|
|
599
|
+
8,
|
|
600
|
+
9,
|
|
601
|
+
10,
|
|
602
|
+
11,
|
|
603
|
+
12,
|
|
604
|
+
14,
|
|
605
|
+
16,
|
|
606
|
+
18,
|
|
607
|
+
20,
|
|
608
|
+
22,
|
|
609
|
+
24,
|
|
610
|
+
26,
|
|
611
|
+
28,
|
|
612
|
+
30,
|
|
613
|
+
36,
|
|
614
|
+
48,
|
|
615
|
+
72
|
|
616
|
+
]);
|
|
617
|
+
function Ct(e, t = !0, n = St) {
|
|
618
|
+
if (!n || n.length === 0) return e;
|
|
619
|
+
if (e === void 0) return n[0];
|
|
620
|
+
if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
|
|
621
|
+
let r = o.findEqualOrGreater(n, e);
|
|
622
|
+
return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
|
|
623
|
+
}
|
|
624
|
+
(_t ||= {}).SortOn = {
|
|
625
|
+
Value: "value",
|
|
626
|
+
FillColor: "fillColor",
|
|
627
|
+
FontColor: "fontColor",
|
|
628
|
+
Icon: "icon"
|
|
629
|
+
}, (G = vt ||= {}).Compound = {
|
|
630
|
+
Single: "sng",
|
|
631
|
+
Double: "dbl",
|
|
632
|
+
ThickThin: "thickThin",
|
|
633
|
+
ThinThick: "thinThick",
|
|
634
|
+
Triple: "tri"
|
|
635
|
+
}, G.Align = {
|
|
636
|
+
Center: "ctr",
|
|
637
|
+
Inset: "in",
|
|
638
|
+
Outset: "outset"
|
|
639
|
+
}, G.LineCap = {
|
|
640
|
+
Butt: "butt",
|
|
641
|
+
Round: "round",
|
|
642
|
+
Square: "square"
|
|
643
|
+
}, G.LineJoin = {
|
|
644
|
+
Bevel: "bevel",
|
|
645
|
+
Miter: "miter",
|
|
646
|
+
Round: "round"
|
|
647
|
+
}, G.PresetMarkerShape = {
|
|
648
|
+
Single: "none",
|
|
649
|
+
Double: "double",
|
|
650
|
+
ThickThin: "thickThin",
|
|
651
|
+
ThinThick: "thinThick"
|
|
652
|
+
}, G.StrokeStyle = {
|
|
653
|
+
None: "none",
|
|
654
|
+
Dashed: "dashed",
|
|
655
|
+
Dotted: "dotted",
|
|
656
|
+
LargeDash: "lgDash",
|
|
657
|
+
LargeDashDot: "lgDashDot",
|
|
658
|
+
LargeDashDotDot: "lgDashDotDot",
|
|
659
|
+
Solid: "solid",
|
|
660
|
+
SysDash: "sysDash",
|
|
661
|
+
SysDashDot: "sysDashDot",
|
|
662
|
+
SysDashDotDot: "sysDashDotDot",
|
|
663
|
+
SysDot: "sysDot"
|
|
664
|
+
}, (yt ||= {}).Type = {
|
|
665
|
+
OuterShadow: "outerShadow",
|
|
666
|
+
InnerShadow: "innerShadow",
|
|
667
|
+
PresetShadow: "presetShadow",
|
|
668
|
+
Glow: "glow",
|
|
669
|
+
SoftEdge: "softEdge",
|
|
670
|
+
Reflection: "reflection"
|
|
671
|
+
};
|
|
672
|
+
var wt, Tt, Et, Dt, q = Ke.BuiltInName, Ot = {
|
|
673
|
+
[q.Normal]: e("style.builtin.normal"),
|
|
674
|
+
[q.Comma]: e("style.builtin.comma"),
|
|
675
|
+
[q.Currency]: e("style.builtin.currency"),
|
|
676
|
+
[q.Percent]: e("style.builtin.percent"),
|
|
677
|
+
[q.Comma0]: e("style.builtin.comma0"),
|
|
678
|
+
[q.Currency0]: e("style.builtin.currency0"),
|
|
679
|
+
[q.Hyperlink]: e("style.builtin.hyperlink"),
|
|
680
|
+
[q.FollowedHyperlink]: e("style.builtin.followedHyperlink"),
|
|
681
|
+
[q.Note]: e("style.builtin.note"),
|
|
682
|
+
[q.WarningText]: e("style.builtin.warningText"),
|
|
683
|
+
[q.Title]: e("style.builtin.title"),
|
|
684
|
+
[q.Input]: e("style.builtin.input"),
|
|
685
|
+
[q.Output]: e("style.builtin.output"),
|
|
686
|
+
[q.Calculation]: e("style.builtin.calculation"),
|
|
687
|
+
[q.CheckCell]: e("style.builtin.checkCell"),
|
|
688
|
+
[q.LinkedCell]: e("style.builtin.linkedCell"),
|
|
689
|
+
[q.Total]: e("style.builtin.total"),
|
|
690
|
+
[q.Good]: e("style.builtin.good"),
|
|
691
|
+
[q.Bad]: e("style.builtin.bad"),
|
|
692
|
+
[q.Neutral]: e("style.builtin.neutral"),
|
|
693
|
+
[q.ExplanatoryText]: e("style.builtin.explanatoryText")
|
|
694
|
+
}, kt = e("style.builtin.heading"), At = e("style.builtin.accent"), jt = e("style.builtin.accentTint"), Mt = /^Heading ([1-4])$/, Nt = /^Accent([1-6])$/, Pt = /^(20|40|60)% - Accent([1-6])$/;
|
|
695
|
+
function Ft(e) {
|
|
696
|
+
let t = Ot[e];
|
|
697
|
+
if (t) return { key: t };
|
|
698
|
+
let n = Mt.exec(e);
|
|
699
|
+
return n ? {
|
|
700
|
+
key: kt,
|
|
701
|
+
params: { n: +n[1] }
|
|
702
|
+
} : (n = Nt.exec(e), n ? {
|
|
703
|
+
key: At,
|
|
704
|
+
params: { n: +n[1] }
|
|
705
|
+
} : (n = Pt.exec(e), n ? {
|
|
706
|
+
key: jt,
|
|
707
|
+
params: {
|
|
708
|
+
pct: +n[1],
|
|
709
|
+
n: +n[2]
|
|
710
|
+
}
|
|
711
|
+
} : null));
|
|
712
|
+
}
|
|
713
|
+
var It = (e, n, r, i, a) => {
|
|
714
|
+
let o = JSON.parse(JSON.stringify(e.definition));
|
|
715
|
+
o.adjs ||= [];
|
|
716
|
+
let s = "", c = 0, l = 0;
|
|
717
|
+
n > 0 ? (l = n, c = 100 - n, s = t("op.lighterPercent", { percent: n })) : n < 0 && (c = 100 + n, s = t("op.darkerPercent", { percent: -n })), c && o.adjs.push({ [E.AdjustmentType.LumMod]: c }), l && o.adjs.push({ [E.AdjustmentType.LumOff]: l });
|
|
718
|
+
let u = new Ue({
|
|
719
|
+
val: o.val,
|
|
720
|
+
adjs: o.adjs
|
|
721
|
+
}, r), d = u.toString();
|
|
722
|
+
i?.set(d, u);
|
|
723
|
+
let f = u.toRGBA().toString();
|
|
724
|
+
return a?.set(f, u), {
|
|
725
|
+
description: e.description + ", " + s,
|
|
726
|
+
definition: o
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
function Lt(e) {
|
|
730
|
+
let t, n = e.trim();
|
|
731
|
+
if (!n) return;
|
|
732
|
+
try {
|
|
733
|
+
let e = Ie.shared().tokenize(n, !1);
|
|
734
|
+
if (e.errors.length > 0) return;
|
|
735
|
+
t = e.tokens;
|
|
736
|
+
} catch {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
let r = 0, i = 0;
|
|
740
|
+
if (t.length === 2) {
|
|
741
|
+
let e = t[0].tokenType?.name;
|
|
742
|
+
e === "MinOp" ? (r = -1, i = 1) : e === "PlusOp" && (r = 1, i = 1);
|
|
743
|
+
}
|
|
744
|
+
if (t.length - i !== 1) return;
|
|
745
|
+
let a = t[i], o = a.image;
|
|
746
|
+
try {
|
|
747
|
+
switch (a.tokenType?.name) {
|
|
748
|
+
case "NumberToken":
|
|
749
|
+
case "ScientificDigit":
|
|
750
|
+
case "DigitToken": {
|
|
751
|
+
let e = Ve(o).value;
|
|
752
|
+
return r === 0 ? e : r * e;
|
|
753
|
+
}
|
|
754
|
+
case "StringToken": return r === 0 ? ne(o).value : void 0;
|
|
755
|
+
case "BooleanToken": return r === 0 ? te(o).value : void 0;
|
|
756
|
+
case "LiteralError":
|
|
757
|
+
case "RefError": return r === 0 ? Ae(o).value : void 0;
|
|
758
|
+
default: return;
|
|
759
|
+
}
|
|
760
|
+
} catch {
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
function Rt(e, t) {
|
|
765
|
+
let n = zt(e), r = zt(t);
|
|
766
|
+
return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : _.isError(e) && _.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
|
|
767
|
+
}
|
|
768
|
+
function zt(e) {
|
|
769
|
+
if (e === null) return 0;
|
|
770
|
+
switch (typeof e) {
|
|
771
|
+
case "number": return 1;
|
|
772
|
+
case "string": return 2;
|
|
773
|
+
case "boolean": return 3;
|
|
774
|
+
default: return _.isError(e) ? 4 : 5;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
(wt ||= {}).buildPalette = function(e, t, n, r) {
|
|
778
|
+
let i = [];
|
|
779
|
+
for (let a = 0; a < e.length; a++) {
|
|
780
|
+
let o = [];
|
|
781
|
+
i.push(o);
|
|
782
|
+
let s = (i) => {
|
|
783
|
+
for (let s = 0; s < i.length; s++) o.push(It(e[a], i[s], t, n, r));
|
|
784
|
+
}, c = new Ue({
|
|
785
|
+
val: e[a].definition.val,
|
|
786
|
+
adjs: e[a].definition.adjs
|
|
787
|
+
}, t).toHSLA().lum;
|
|
788
|
+
s(c === 0 ? [
|
|
789
|
+
50,
|
|
790
|
+
35,
|
|
791
|
+
25,
|
|
792
|
+
15,
|
|
793
|
+
5
|
|
794
|
+
] : c === 100 ? [
|
|
795
|
+
-5,
|
|
796
|
+
-15,
|
|
797
|
+
-25,
|
|
798
|
+
-35,
|
|
799
|
+
-50
|
|
800
|
+
] : c <= 20 ? [
|
|
801
|
+
90,
|
|
802
|
+
75,
|
|
803
|
+
50,
|
|
804
|
+
25,
|
|
805
|
+
10
|
|
806
|
+
] : c >= 80 ? [
|
|
807
|
+
-10,
|
|
808
|
+
-25,
|
|
809
|
+
-50,
|
|
810
|
+
-75,
|
|
811
|
+
-90
|
|
812
|
+
] : [
|
|
813
|
+
80,
|
|
814
|
+
60,
|
|
815
|
+
40,
|
|
816
|
+
-25,
|
|
817
|
+
-50
|
|
818
|
+
]);
|
|
819
|
+
}
|
|
820
|
+
return i;
|
|
821
|
+
}, Tt ||= {}, Et ||= {}, Dt ||= {};
|
|
822
|
+
var Bt = class {
|
|
823
|
+
constructor(e) {
|
|
824
|
+
this._children = e;
|
|
825
|
+
}
|
|
826
|
+
getCoords() {
|
|
827
|
+
let e = this._children, t = null;
|
|
828
|
+
for (let n = 0; n < e.length; n++) {
|
|
829
|
+
let r = e[n].getCoords();
|
|
830
|
+
r && (t = t ? {
|
|
831
|
+
rowStart: Math.min(t.rowStart, r.rowStart),
|
|
832
|
+
colStart: Math.min(t.colStart, r.colStart),
|
|
833
|
+
rowEnd: Math.max(t.rowEnd, r.rowEnd),
|
|
834
|
+
colEnd: Math.max(t.colEnd, r.colEnd)
|
|
835
|
+
} : r);
|
|
836
|
+
}
|
|
837
|
+
return t;
|
|
838
|
+
}
|
|
839
|
+
getSize() {
|
|
840
|
+
let e = this._children, t = e.length, n = 0;
|
|
841
|
+
for (let r = 0; r < t; r++) n += e[r].getSize();
|
|
842
|
+
return n;
|
|
843
|
+
}
|
|
844
|
+
getCount() {
|
|
845
|
+
let e = this._children, t = e.length, n = 0;
|
|
846
|
+
for (let r = 0; r < t; r++) n += e[r].getCount();
|
|
847
|
+
return n;
|
|
848
|
+
}
|
|
849
|
+
getAggregates(e) {
|
|
850
|
+
if (e) return this._mergeAggregates(e);
|
|
851
|
+
let t = this._aggregates;
|
|
852
|
+
return t || (t = this._mergeAggregates(), this._aggregates = t), t;
|
|
853
|
+
}
|
|
854
|
+
getSnappedSum(e) {
|
|
855
|
+
let t = e ?? this.getAggregates().sum ?? 0, n = this._children;
|
|
856
|
+
for (let e = n.length - 1; e >= 0; e--) if (n[e].getAggregates().numericalCount > 0) return n[e].getSnappedSum(t);
|
|
857
|
+
return t;
|
|
858
|
+
}
|
|
859
|
+
getSortedNumbers() {
|
|
860
|
+
let e = this._sortedNumbers;
|
|
861
|
+
if (!e) {
|
|
862
|
+
let t = this._children, n = t.length, r = [];
|
|
863
|
+
for (let e = 0; e < n; e++) {
|
|
864
|
+
let n = t[e].getSortedNumbers().getValues();
|
|
865
|
+
n.length > 0 && r.push(n);
|
|
866
|
+
}
|
|
867
|
+
e = new Oe(function(e) {
|
|
868
|
+
let t = e.length;
|
|
869
|
+
if (t === 0) return Vt;
|
|
870
|
+
if (t === 1) return e[0];
|
|
871
|
+
let n = e[0];
|
|
872
|
+
for (let r = 1; r < t; r++) n = Ht(n, e[r]);
|
|
873
|
+
return Object.freeze(n);
|
|
874
|
+
}(r)), this._sortedNumbers = e;
|
|
875
|
+
}
|
|
876
|
+
return e;
|
|
877
|
+
}
|
|
878
|
+
getRanked(e) {
|
|
879
|
+
return T(this._children, e, Rt)[Symbol.iterator]();
|
|
880
|
+
}
|
|
881
|
+
getFrequencies(e) {
|
|
882
|
+
if (e) return this._mergeFrequencies(e);
|
|
883
|
+
let t = this._frequencies;
|
|
884
|
+
return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
|
|
885
|
+
}
|
|
886
|
+
_mergeFrequencies(e) {
|
|
887
|
+
let t = e?.keyFn ?? Le, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
|
|
888
|
+
for (let l = 0; l < a; l++) {
|
|
889
|
+
let a = i[l].getFrequencies(e);
|
|
890
|
+
o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
|
|
891
|
+
let u = a.getValueCounts(), d = u.next();
|
|
892
|
+
for (; !d.done;) {
|
|
893
|
+
let [e, i] = d.value, a = t(e), o = r.get(a);
|
|
894
|
+
o ? o.count += i : n === void 0 || r.size < n ? r.set(a, {
|
|
895
|
+
value: e,
|
|
896
|
+
count: i
|
|
897
|
+
}) : c = !0, d = u.next();
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return Fe.fromGroups(r, t, e, Rt, o, s, c);
|
|
901
|
+
}
|
|
902
|
+
getTypedCounts(e) {
|
|
903
|
+
let t = this._typedCounts;
|
|
904
|
+
if (!t) {
|
|
905
|
+
let e = {
|
|
906
|
+
[v.Number]: 0,
|
|
907
|
+
[v.String]: 0,
|
|
908
|
+
[v.Boolean]: 0,
|
|
909
|
+
[v.Error]: 0,
|
|
910
|
+
[v.RichData]: 0,
|
|
911
|
+
[v.Null]: 0
|
|
912
|
+
}, n = this._children, r = n.length;
|
|
913
|
+
for (let t = 0; t < r; t++) {
|
|
914
|
+
let r = n[t].getTypedCounts();
|
|
915
|
+
e[v.Number] += r[v.Number] ?? 0, e[v.String] += r[v.String] ?? 0, e[v.Boolean] += r[v.Boolean] ?? 0, e[v.Error] += r[v.Error] ?? 0, e[v.RichData] += r[v.RichData] ?? 0, e[v.Null] += r[v.Null] ?? 0;
|
|
916
|
+
}
|
|
917
|
+
t = Object.freeze(e), this._typedCounts = t;
|
|
918
|
+
}
|
|
919
|
+
if (e === void 0) return t;
|
|
920
|
+
let n = {}, r = e.length;
|
|
921
|
+
for (let i = 0; i < r; i++) n[e[i]] = t[e[i]] ?? 0;
|
|
922
|
+
return n;
|
|
923
|
+
}
|
|
924
|
+
get isIRangeStats() {
|
|
925
|
+
return !0;
|
|
926
|
+
}
|
|
927
|
+
_mergeAggregates(e) {
|
|
928
|
+
let t = this._children, n = t.length, r = {
|
|
929
|
+
count: 0,
|
|
930
|
+
min: void 0,
|
|
931
|
+
max: void 0,
|
|
932
|
+
numericalCount: 0,
|
|
933
|
+
sum: 0,
|
|
934
|
+
sumSq: 0,
|
|
935
|
+
typed: {
|
|
936
|
+
[v.Number]: 0,
|
|
937
|
+
[v.String]: 0,
|
|
938
|
+
[v.Boolean]: 0,
|
|
939
|
+
[v.Error]: 0,
|
|
940
|
+
[v.RichData]: 0,
|
|
941
|
+
[v.Null]: 0
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
for (let i = 0; i < n; i++) {
|
|
945
|
+
let n = t[i].getAggregates(e);
|
|
946
|
+
r.count += n.count;
|
|
947
|
+
let a = n.numericalCount;
|
|
948
|
+
a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
|
|
949
|
+
}
|
|
950
|
+
return _e(r);
|
|
951
|
+
}
|
|
952
|
+
}, Vt = Object.freeze([]);
|
|
953
|
+
function Ht(e, t) {
|
|
954
|
+
let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
|
|
955
|
+
for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
|
|
956
|
+
for (; a < n;) i[s++] = e[a++];
|
|
957
|
+
for (; o < r;) i[s++] = t[o++];
|
|
958
|
+
return i;
|
|
959
|
+
}
|
|
960
|
+
var Ut = class {
|
|
961
|
+
constructor(e, t) {
|
|
962
|
+
this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
|
|
963
|
+
}
|
|
964
|
+
getId() {
|
|
965
|
+
return this._json.id;
|
|
966
|
+
}
|
|
967
|
+
getDisplayName() {
|
|
968
|
+
return this._json.displayName;
|
|
969
|
+
}
|
|
970
|
+
getUserId() {
|
|
971
|
+
return this._json.userId ?? null;
|
|
972
|
+
}
|
|
973
|
+
getProviderId() {
|
|
974
|
+
return this._json.providerId ?? null;
|
|
975
|
+
}
|
|
976
|
+
delete() {
|
|
977
|
+
this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
|
|
978
|
+
}
|
|
979
|
+
isDeleted() {
|
|
980
|
+
return this._deleted;
|
|
981
|
+
}
|
|
982
|
+
toJSON() {
|
|
983
|
+
return { ...this._json };
|
|
984
|
+
}
|
|
985
|
+
get [Symbol.toStringTag]() {
|
|
986
|
+
return "[Person]";
|
|
987
|
+
}
|
|
988
|
+
toString() {
|
|
989
|
+
return `Person:${this.getDisplayName()}`;
|
|
990
|
+
}
|
|
991
|
+
get isIPerson() {
|
|
992
|
+
return !0;
|
|
993
|
+
}
|
|
994
|
+
}, Wt = class extends qe {
|
|
995
|
+
constructor(e) {
|
|
996
|
+
super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
|
|
997
|
+
}
|
|
998
|
+
_getItems() {
|
|
999
|
+
return this._items ??= Array.from(this._byId.values());
|
|
1000
|
+
}
|
|
1001
|
+
getCount() {
|
|
1002
|
+
return this._byId.size;
|
|
1003
|
+
}
|
|
1004
|
+
add(e) {
|
|
1005
|
+
let t = typeof e == "string" ? { displayName: e } : e, n = t.id;
|
|
1006
|
+
if (n) {
|
|
1007
|
+
let e = this._byId.get(n);
|
|
1008
|
+
if (e) return e;
|
|
1009
|
+
}
|
|
1010
|
+
let r = t.displayName ?? "";
|
|
1011
|
+
if (!n) {
|
|
1012
|
+
let e = this._byDisplayName.get(r);
|
|
1013
|
+
if (e) return e;
|
|
1014
|
+
}
|
|
1015
|
+
let i = new Ut({
|
|
1016
|
+
...t,
|
|
1017
|
+
displayName: r,
|
|
1018
|
+
id: n ?? o.uuidV4().toUpperCase()
|
|
1019
|
+
}, (e) => this._remove(e));
|
|
1020
|
+
return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
|
|
1021
|
+
}
|
|
1022
|
+
getById(e) {
|
|
1023
|
+
return typeof e == "string" ? this._byId.get(e) ?? null : null;
|
|
1024
|
+
}
|
|
1025
|
+
getByDisplayName(e) {
|
|
1026
|
+
return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
|
|
1027
|
+
}
|
|
1028
|
+
getCurrent() {
|
|
1029
|
+
return this._current ??= this.add("Author");
|
|
1030
|
+
}
|
|
1031
|
+
setCurrent(e) {
|
|
1032
|
+
if (e !== null) {
|
|
1033
|
+
if (typeof e == "object" && e.isIPerson) {
|
|
1034
|
+
let t = e;
|
|
1035
|
+
this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
this._current = this.add(e);
|
|
1039
|
+
} else this._current = null;
|
|
1040
|
+
}
|
|
1041
|
+
_remove(e) {
|
|
1042
|
+
this._byId.get(e.getId()) === e && (this._byId.delete(e.getId()), this._byDisplayName.get(e.getDisplayName()) === e && this._byDisplayName.delete(e.getDisplayName()), this._current === e && (this._current = null), this._items = null, this._notifyCollectionChange());
|
|
1043
|
+
}
|
|
1044
|
+
toJSON() {
|
|
1045
|
+
return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
|
|
1046
|
+
}
|
|
1047
|
+
fromJSON(e) {
|
|
1048
|
+
if (!e) return;
|
|
1049
|
+
let t = e.length;
|
|
1050
|
+
for (let n = 0; n < t; n++) {
|
|
1051
|
+
let t = e[n];
|
|
1052
|
+
t && typeof t.id == "string" && this.add(t);
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
get isIPersonCollection() {
|
|
1056
|
+
return !0;
|
|
1057
|
+
}
|
|
1058
|
+
}, Gt = class {
|
|
1059
|
+
constructor(e) {
|
|
1060
|
+
this._options = e, this._emitter = new x(this), this._initState();
|
|
1061
|
+
}
|
|
1062
|
+
_initState() {}
|
|
1063
|
+
getModules() {
|
|
1064
|
+
return this._modules;
|
|
1065
|
+
}
|
|
1066
|
+
_builtInNames() {
|
|
1067
|
+
try {
|
|
1068
|
+
let e = this._options.getBuiltInFunctions?.();
|
|
1069
|
+
if (!e) return o.EmptyArray;
|
|
1070
|
+
let t = [];
|
|
1071
|
+
for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
|
|
1072
|
+
return t;
|
|
1073
|
+
} catch {
|
|
1074
|
+
return o.EmptyArray;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
async createModule(e) {
|
|
1078
|
+
let t = await (await import("./CcK4ACF7d5ogFpAS.mjs").then((e) => e.n)).ScriptCompiler.compile({
|
|
1079
|
+
builtInNames: this._builtInNames(),
|
|
1080
|
+
...e
|
|
1081
|
+
});
|
|
1082
|
+
return t.module ? await P(ke.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
|
|
1083
|
+
}
|
|
1084
|
+
addModule(e, t, n) {
|
|
1085
|
+
this._modules.add(e, t, n);
|
|
1086
|
+
}
|
|
1087
|
+
async addModuleFromJSON(e, t, n) {
|
|
1088
|
+
let r = await P(e, t);
|
|
1089
|
+
return this.addModule(e, r, n), r;
|
|
1090
|
+
}
|
|
1091
|
+
executeMacro(e, t, n) {
|
|
1092
|
+
let r = this._modules.getItems({ name: t }), i = r.length;
|
|
1093
|
+
for (let t = 0; t < i; t++) {
|
|
1094
|
+
let i = r[t].getFunctions().getByName(e);
|
|
1095
|
+
if (i) return i.execute(this._options.workbook, {
|
|
1096
|
+
applyResult: !0,
|
|
1097
|
+
...n
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
throw Error(`No macro ${e} found.`);
|
|
1101
|
+
}
|
|
1102
|
+
async run(e, t) {
|
|
1103
|
+
try {
|
|
1104
|
+
let n = typeof e == "string" ? await this.createModule({ source: e }) : await P(ke.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
|
|
1105
|
+
return await this._runModule(n, r, t);
|
|
1106
|
+
} catch (e) {
|
|
1107
|
+
return {
|
|
1108
|
+
ok: !1,
|
|
1109
|
+
error: e
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
async _runModule(e, t, n) {
|
|
1114
|
+
let r = this._options?.workbook;
|
|
1115
|
+
if (!e) return {
|
|
1116
|
+
ok: !1,
|
|
1117
|
+
error: Error("The script did not compile to a module.")
|
|
1118
|
+
};
|
|
1119
|
+
let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
|
|
1120
|
+
if (a.length > 0) {
|
|
1121
|
+
let e = Error(((e, t) => {
|
|
1122
|
+
let n = [0];
|
|
1123
|
+
for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
|
|
1124
|
+
let r = t.map((e) => ` ${((e) => {
|
|
1125
|
+
let t = 0, r = n.length - 1;
|
|
1126
|
+
for (; t < r;) {
|
|
1127
|
+
let i = t + r + 1 >> 1;
|
|
1128
|
+
n[i] <= e ? t = i : r = i - 1;
|
|
1129
|
+
}
|
|
1130
|
+
return `${t + 1}:${e - n[t] + 1}`;
|
|
1131
|
+
})(e.start)} ${e.code}: ${e.message}`), i = t.length;
|
|
1132
|
+
return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
|
|
1133
|
+
})(t, a));
|
|
1134
|
+
return e.diagnostics = a, {
|
|
1135
|
+
ok: !1,
|
|
1136
|
+
error: e,
|
|
1137
|
+
diagnostics: i
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
let o = e.getFunctions(), s = (await o.search({ type: "autoRun" }))[0] ?? (await o.search({ type: "macro" }))[0] ?? null;
|
|
1141
|
+
if (!s) return {
|
|
1142
|
+
ok: !1,
|
|
1143
|
+
error: Error("The script has no runnable entry. Export a default function taking the script context, e.g. `export default function run(ctx: IScript.ScriptContext) { ... }` (the workbook is `ctx.wb`; a macro may instead take its target first, e.g. `(sheet: ISheet, ctx)`).")
|
|
1144
|
+
};
|
|
1145
|
+
let c = await s.execute(r, n);
|
|
1146
|
+
return {
|
|
1147
|
+
ok: !0,
|
|
1148
|
+
result: c?.results,
|
|
1149
|
+
commitId: c?.commitId,
|
|
1150
|
+
diagnostics: i
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
async _searchable(e) {
|
|
1154
|
+
let t = [];
|
|
1155
|
+
if (e?.includeBuiltIn) {
|
|
1156
|
+
await this._options.workbook?.getCalculation()?.start();
|
|
1157
|
+
let e = this._options.getBuiltInFunctions?.();
|
|
1158
|
+
e && t.push(e);
|
|
1159
|
+
}
|
|
1160
|
+
let n = this._modules;
|
|
1161
|
+
if (!n || n.getCount() === 0) return t;
|
|
1162
|
+
let r = e?.moduleName, i = r ? n.getItems({ name: r }) : n.getItems(), a = i.length;
|
|
1163
|
+
for (let e = 0; e < a; e++) t.push(i[e].getFunctions());
|
|
1164
|
+
return t;
|
|
1165
|
+
}
|
|
1166
|
+
async searchFunctions(e) {
|
|
1167
|
+
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1168
|
+
let t = await this._searchable(e);
|
|
1169
|
+
if (t.length === 0) return o.EmptyArray;
|
|
1170
|
+
let n, r = e?.limit, i = r === void 0 ? e : {
|
|
1171
|
+
...e,
|
|
1172
|
+
limit: void 0
|
|
1173
|
+
}, a = /* @__PURE__ */ new Set();
|
|
1174
|
+
for (let e = 0; e < t.length; e++) {
|
|
1175
|
+
let r = await t[e].search(i);
|
|
1176
|
+
if (r.length !== 0) {
|
|
1177
|
+
n ||= [];
|
|
1178
|
+
for (let e = 0; e < r.length; e++) {
|
|
1179
|
+
let t = r[e], i = t.getName().toUpperCase();
|
|
1180
|
+
a.has(i) || (a.add(i), n.push(t));
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
if (!n || n.length === 0) return o.EmptyArray;
|
|
1185
|
+
let s = e?.text ? e.text.trim().toUpperCase() : null;
|
|
1186
|
+
return s && t.length > 1 && Ge(n, s), r !== void 0 && n.length > r ? n.slice(0, r) : n;
|
|
1187
|
+
}
|
|
1188
|
+
async getFunctionCategories(e) {
|
|
1189
|
+
await this._emitter.notify("onBeforeSearch", { async: !0 });
|
|
1190
|
+
let t = await this._searchable(e);
|
|
1191
|
+
if (t.length === 0) return o.EmptyArray;
|
|
1192
|
+
if (t.length === 1) return t[0].getCategories(e);
|
|
1193
|
+
let n = e?.includeDeprecated ?? !1, r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
1194
|
+
let t = e.toUpperCase(), n = r.get(t);
|
|
1195
|
+
n ? n.count++ : r.set(t, {
|
|
1196
|
+
name: e,
|
|
1197
|
+
count: 1
|
|
1198
|
+
});
|
|
1199
|
+
};
|
|
1200
|
+
for (let n of await t[0].getCategories(e)) r.set(n.name.toUpperCase(), {
|
|
1201
|
+
name: n.name,
|
|
1202
|
+
count: n.count
|
|
1203
|
+
});
|
|
1204
|
+
for (let r = 1; r < t.length; r++) {
|
|
1205
|
+
let a = await t[r].search(e?.type ? { type: e.type } : void 0);
|
|
1206
|
+
for (let e = 0; e < a.length; e++) {
|
|
1207
|
+
let o = a[e], s = o.getName().toUpperCase(), c = !1;
|
|
1208
|
+
for (let e = 0; e < r && !c; e++) c = !!t[e].getByName(s);
|
|
1209
|
+
if (c) continue;
|
|
1210
|
+
let l = await o.getDescriptor().catch(() => null);
|
|
1211
|
+
!n && l?.isDeprecated() || i(l?.getCategory() ?? "Uncategorized");
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
let a = Array.from(r.values());
|
|
1215
|
+
return a.sort((e, t) => e.name.localeCompare(t.name)), a;
|
|
1216
|
+
}
|
|
1217
|
+
async start() {
|
|
1218
|
+
if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
|
|
1219
|
+
this._startPromise = void 0;
|
|
1220
|
+
})), this._startPromise;
|
|
1221
|
+
}
|
|
1222
|
+
async _doStart() {
|
|
1223
|
+
let e = this._options?.workbook, t = this._options?.json, n = {};
|
|
1224
|
+
if (t) {
|
|
1225
|
+
let r = Object.keys(t);
|
|
1226
|
+
for (let i = 0; i < r.length; i++) {
|
|
1227
|
+
let a = r[i], o = t[a];
|
|
1228
|
+
try {
|
|
1229
|
+
n[a] = await P(a, o, !1, [], o?.scope === "workbook" ? e : null);
|
|
1230
|
+
} catch (e) {
|
|
1231
|
+
d.error(`Could not load script '${a}'; it will be unavailable.`, e);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
let r = this, i = new ge({
|
|
1236
|
+
transactions: this._options?.transactions,
|
|
1237
|
+
initial: n,
|
|
1238
|
+
isReadOnly: () => r.isReadOnly(),
|
|
1239
|
+
onRemove: (e, t) => {
|
|
1240
|
+
r._options?.onRemove?.(e, t);
|
|
1241
|
+
},
|
|
1242
|
+
onAdd: (e, t) => {
|
|
1243
|
+
r._emitter.notify("onChange"), r._options?.onAdd?.(e, t);
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
this._modules = i;
|
|
1247
|
+
let a = i.getItems();
|
|
1248
|
+
if (a.length === 0) return Promise.resolve(o.EmptyArray);
|
|
1249
|
+
let s = a.length;
|
|
1250
|
+
for (let t = 0; t < s; t++) {
|
|
1251
|
+
let n = a[t];
|
|
1252
|
+
try {
|
|
1253
|
+
let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
|
|
1254
|
+
for (let n = 0; n < r; n++) await t[n].execute(e);
|
|
1255
|
+
} catch (e) {
|
|
1256
|
+
d.error("Error executing autoRun script:", e);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
addListeners(e, t) {
|
|
1261
|
+
return this._emitter.addListeners(e, t);
|
|
1262
|
+
}
|
|
1263
|
+
isReadOnly() {
|
|
1264
|
+
return this._options.workbook?._isStructureProtected?.() ?? !1;
|
|
1265
|
+
}
|
|
1266
|
+
toJSON() {
|
|
1267
|
+
this._emitter.notify("onBeforeSave");
|
|
1268
|
+
let e = this._modules;
|
|
1269
|
+
if (!e) throw Error("Scripts is initializing.");
|
|
1270
|
+
return e.toJSON();
|
|
1271
|
+
}
|
|
1272
|
+
get isIScript() {
|
|
1273
|
+
return !0;
|
|
1274
|
+
}
|
|
1275
|
+
}, Kt = class {
|
|
1276
|
+
constructor(e, t, n, r) {
|
|
1277
|
+
this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? u.EmptyCell, this._sheet = new L({
|
|
1278
|
+
runtime: e,
|
|
1279
|
+
styles: this._styles,
|
|
1280
|
+
calcOnLoad: "none",
|
|
1281
|
+
container: {
|
|
1282
|
+
getName: () => r,
|
|
1283
|
+
getIndex: () => 1
|
|
1284
|
+
}
|
|
1285
|
+
}), this._builder = this._sheet.getEntireRange().createSparseBuilder();
|
|
1286
|
+
}
|
|
1287
|
+
applyCSSStyle(e, t) {
|
|
1288
|
+
let n = !1;
|
|
1289
|
+
e.style || (e.style = {}, n = !0);
|
|
1290
|
+
let r = e.style, i = { ...t };
|
|
1291
|
+
if (t.msoIgnore) {
|
|
1292
|
+
let e = t.msoIgnore.split(","), n = Object.keys(i);
|
|
1293
|
+
for (let t = 0; t < n.length; t++) {
|
|
1294
|
+
let r = n[t];
|
|
1295
|
+
e.includes(r) && delete i[r];
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
let a = ve(i.fontFamily);
|
|
1299
|
+
r.font = {}, a && (r.font.family = a.family, r.font.fallbacks = a.fallbacks, r.font.size = a.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
|
|
1300
|
+
let o = y(i.textDecoration);
|
|
1301
|
+
r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = De(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = me(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = I.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = I.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = I.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = M.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = M.VerticalAlignment.Sub : r.alignment.vertical = Se(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = I.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = i.whiteSpace === "no-wrap" || i.whiteSpace === "nowrap" ? I.Overflow.Visible : I.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = I.Overflow.Shrink);
|
|
1302
|
+
let s = null;
|
|
1303
|
+
if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
|
|
1304
|
+
let e = he(i.msoPattern);
|
|
1305
|
+
e && (e.patternType === ee.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== ee.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
|
|
1306
|
+
}
|
|
1307
|
+
i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = Ze(i.msoRotate));
|
|
1308
|
+
let c = (e, t) => {
|
|
1309
|
+
e && (r.borders ||= {}, r.borders[e] = t);
|
|
1310
|
+
};
|
|
1311
|
+
i.border && i.border !== "none" && (c("top", i.border), c("left", i.border), c("right", i.border), c("bottom", i.border)), i.borderTop && c("top", i.borderTop), i.borderLeft && c("left", i.borderLeft), i.borderRight && c("right", i.borderRight), i.borderBottom && c("bottom", i.borderBottom), i.msoDiagonalUp && c("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && c("diagonalDown", i.msoDiagonalDown);
|
|
1312
|
+
let l = r.numberFormat;
|
|
1313
|
+
i.msoNumberFormat && (l = Re(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = j.Styles.lookupStyle(r.numberFormat).formatType === j.Type.Number ? null : j.Type.Number : l === "Percent" && (l = j.Styles.lookupStyle(r.numberFormat).formatType === j.Type.Percentage ? null : j.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
|
|
1314
|
+
}
|
|
1315
|
+
onCell(e, t, n, r, i) {
|
|
1316
|
+
let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
|
|
1317
|
+
if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
|
|
1318
|
+
let e = o.style, t = e?.font ?? {};
|
|
1319
|
+
(i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = M.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = M.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = M.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = M.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
|
|
1320
|
+
let n = i.querySelectorAll("a");
|
|
1321
|
+
if (n.length > 0) {
|
|
1322
|
+
let e = n[0].getAttribute("href");
|
|
1323
|
+
e && (o.hyperlink = e);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (!u.isSingleCell(e)) {
|
|
1327
|
+
let t = {
|
|
1328
|
+
rowStart: this._topLeft.rowIndex + e.rowStart,
|
|
1329
|
+
colStart: this._topLeft.colIndex + e.colStart,
|
|
1330
|
+
rowEnd: this._topLeft.rowIndex + e.rowEnd,
|
|
1331
|
+
colEnd: this._topLeft.colIndex + e.colEnd
|
|
1332
|
+
};
|
|
1333
|
+
this._mergedReading.push(t);
|
|
1334
|
+
}
|
|
1335
|
+
if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
|
|
1336
|
+
let s = this._builder, c = this._topLeft;
|
|
1337
|
+
if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !u.isSingleCell(e) && a.msoIgnore) {
|
|
1338
|
+
if (a.msoIgnore.includes("colspan")) {
|
|
1339
|
+
let t = {};
|
|
1340
|
+
a && this.applyCSSStyle(t, a);
|
|
1341
|
+
let n = e.colEnd - e.colStart, r = c.rowIndex + e.rowStart;
|
|
1342
|
+
for (let i = 1; i <= n; i++) s.pushAt(r, c.colIndex + e.colStart + i, t);
|
|
1343
|
+
e = {
|
|
1344
|
+
...e,
|
|
1345
|
+
colEnd: e.colStart
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
a.msoIgnore.includes("rowspan") && (e = {
|
|
1349
|
+
...e,
|
|
1350
|
+
rowEnd: e.rowStart
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
onNoTable(e, t, n) {
|
|
1355
|
+
this.onCell({
|
|
1356
|
+
rowStart: this._topLeft.rowIndex,
|
|
1357
|
+
colStart: this._topLeft.colIndex,
|
|
1358
|
+
rowEnd: this._topLeft.rowIndex,
|
|
1359
|
+
colEnd: this._topLeft.colIndex
|
|
1360
|
+
}, e, null, t, n);
|
|
1361
|
+
}
|
|
1362
|
+
onRowStart(e, t, n, r) {
|
|
1363
|
+
let i = n(r);
|
|
1364
|
+
if (i.msoHeightSource !== "userset" || !r) return;
|
|
1365
|
+
let a = r.getAttribute("height") ?? i.height, o = null;
|
|
1366
|
+
if (a && (o = S(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
|
|
1367
|
+
let t = r.cells[e], i = S(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
|
|
1368
|
+
i !== null && (o = Math.max(i, o ?? 0));
|
|
1369
|
+
}
|
|
1370
|
+
o !== null && this._rowsReading.push({
|
|
1371
|
+
address: {
|
|
1372
|
+
min: this._topLeft.rowIndex + e,
|
|
1373
|
+
max: this._topLeft.rowIndex + e + t - 1
|
|
1374
|
+
},
|
|
1375
|
+
update: { size: o * M.getDeviceScale() }
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
onColumn(e, t, n, r) {
|
|
1379
|
+
let i = n(r);
|
|
1380
|
+
if (i.msoWidthSource !== "userset" || !r) return;
|
|
1381
|
+
let a = r.getAttribute("width") ?? i.width, o = null;
|
|
1382
|
+
a && (o = S(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
|
|
1383
|
+
address: {
|
|
1384
|
+
min: this._topLeft.colIndex + e,
|
|
1385
|
+
max: this._topLeft.colIndex + e + t - 1
|
|
1386
|
+
},
|
|
1387
|
+
update: { size: o * M.getDeviceScale() }
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
onDone() {
|
|
1391
|
+
this._colsReading.length > 0 && this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading), this._rowsReading.length > 0 && this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading), this._sheet.doBatch(() => {
|
|
1392
|
+
this._builder.apply();
|
|
1393
|
+
}), this._mergedReading.length > 0 && this._sheet.getRanges(this._mergedReading).merge();
|
|
1394
|
+
}
|
|
1395
|
+
sheet() {
|
|
1396
|
+
return this._sheet;
|
|
1397
|
+
}
|
|
1398
|
+
}, qt = class {
|
|
1399
|
+
constructor(e) {
|
|
1400
|
+
if (!e) throw new s("snapshot is required.");
|
|
1401
|
+
this._snapshot = e;
|
|
1402
|
+
}
|
|
1403
|
+
getItemType() {
|
|
1404
|
+
return "range";
|
|
1405
|
+
}
|
|
1406
|
+
getItem() {
|
|
1407
|
+
return this._snapshot;
|
|
1408
|
+
}
|
|
1409
|
+
editMode() {
|
|
1410
|
+
return this._snapshot?.getMarkOptions().editMode ?? null;
|
|
1411
|
+
}
|
|
1412
|
+
isCut() {
|
|
1413
|
+
return this._snapshot?.getMarkOptions().isCut ?? !1;
|
|
1414
|
+
}
|
|
1415
|
+
getName() {
|
|
1416
|
+
return this._snapshot.getName();
|
|
1417
|
+
}
|
|
1418
|
+
toText() {
|
|
1419
|
+
return this._snapshot.toText();
|
|
1420
|
+
}
|
|
1421
|
+
toHtml() {
|
|
1422
|
+
return this._snapshot.toHtml();
|
|
1423
|
+
}
|
|
1424
|
+
toImage() {
|
|
1425
|
+
return this._snapshot.toImage();
|
|
1426
|
+
}
|
|
1427
|
+
get isClipboardItem() {
|
|
1428
|
+
return !0;
|
|
1429
|
+
}
|
|
1430
|
+
}, Jt = class {
|
|
1431
|
+
constructor(e, t, n, r, i) {
|
|
1432
|
+
if (this._parsed = void 0, this._runtime = e, !t) throw new s("nativeItems are required.");
|
|
1433
|
+
this._topLeft = n ?? u.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
|
|
1434
|
+
}
|
|
1435
|
+
getItemType() {
|
|
1436
|
+
return "range";
|
|
1437
|
+
}
|
|
1438
|
+
isCut() {
|
|
1439
|
+
return !1;
|
|
1440
|
+
}
|
|
1441
|
+
toText() {
|
|
1442
|
+
return this._native?.text;
|
|
1443
|
+
}
|
|
1444
|
+
toHtml() {
|
|
1445
|
+
return this._native?.html?.documentElement.outerHTML || null;
|
|
1446
|
+
}
|
|
1447
|
+
toImage() {
|
|
1448
|
+
return this._native?.image;
|
|
1449
|
+
}
|
|
1450
|
+
getItem() {
|
|
1451
|
+
let e = this._parsed;
|
|
1452
|
+
if (e === void 0) throw Error("Must call 'parse()' before getItem().");
|
|
1453
|
+
if (e === null) return null;
|
|
1454
|
+
if (this._snapshot) return this._snapshot;
|
|
1455
|
+
let t = this;
|
|
1456
|
+
return this._snapshot = {
|
|
1457
|
+
copyTo: (n, r) => e.copyTo(n, {
|
|
1458
|
+
...t._markOptions,
|
|
1459
|
+
...r
|
|
1460
|
+
}),
|
|
1461
|
+
getMarkOptions: () => t._markOptions,
|
|
1462
|
+
getName: () => e?.getName() ?? "Clipboard Data",
|
|
1463
|
+
getCoords: () => e?.getCoords?.() ?? null,
|
|
1464
|
+
toText: () => t.toText(),
|
|
1465
|
+
toHtml: () => t.toHtml(),
|
|
1466
|
+
toImage: () => t.toImage(),
|
|
1467
|
+
getSource: () => e?.getSource?.() ?? null,
|
|
1468
|
+
isISnapshot: !0
|
|
1469
|
+
}, this._snapshot;
|
|
1470
|
+
}
|
|
1471
|
+
async parse() {
|
|
1472
|
+
let t, r = this._native?.text, i = this._native.html;
|
|
1473
|
+
if (i === null && r && r.includes("<table")) try {
|
|
1474
|
+
let e = new DOMParser().parseFromString(r, n.Html), t = e.querySelector("parsererror");
|
|
1475
|
+
if (t) throw new h("Unable to parse: " + t);
|
|
1476
|
+
i = e, r = null;
|
|
1477
|
+
} catch {
|
|
1478
|
+
console.warn("Discovered text as html table but could could not parse.");
|
|
1479
|
+
}
|
|
1480
|
+
try {
|
|
1481
|
+
let e, n = new Kt(this._runtime, this._topLeft, this._styles, i ? "HTML" : "Text"), a = await Promise.resolve(r ? je(r) : [[]]);
|
|
1482
|
+
if (ze(i, a, n) ? (t = n.sheet(), e = t.getUsedRange()) : i = null, e) return this._parsed = {
|
|
1483
|
+
copyTo: async (t, n) => (await t.copyFrom(e, n))?.getCoords() ?? null,
|
|
1484
|
+
getCoords: () => e.getCoords(),
|
|
1485
|
+
getSource: () => t,
|
|
1486
|
+
getName: () => t.getName()
|
|
1487
|
+
}, !0;
|
|
1488
|
+
} catch (e) {
|
|
1489
|
+
throw e;
|
|
1490
|
+
}
|
|
1491
|
+
if (!r && !i && this._native.image) {
|
|
1492
|
+
let t = this;
|
|
1493
|
+
return this._parsed = {
|
|
1494
|
+
async copyTo(n, r) {
|
|
1495
|
+
let i = n.getSheet(), a = await t._native.image.arrayBuffer(), o = await i.getMovables().addPicture({ source: { buffer: a } }, {
|
|
1496
|
+
type: "picture",
|
|
1497
|
+
description: e("op.copyImageFromClipboard")
|
|
1498
|
+
});
|
|
1499
|
+
return i.getView().selectMovables([o]), null;
|
|
1500
|
+
},
|
|
1501
|
+
getName: () => "Image"
|
|
1502
|
+
}, !0;
|
|
1503
|
+
}
|
|
1504
|
+
return this._parsed = null, !1;
|
|
1505
|
+
}
|
|
1506
|
+
get isClipboardItem() {
|
|
1507
|
+
return !0;
|
|
1508
|
+
}
|
|
1509
|
+
}, J = {
|
|
1510
|
+
showFormulaBar: !0,
|
|
1511
|
+
showTabs: !0,
|
|
1512
|
+
tabRatio: 600,
|
|
1513
|
+
showHorizontalScrollbar: !0,
|
|
1514
|
+
showVerticalScrollbar: !0,
|
|
1515
|
+
showStatusBar: !0,
|
|
1516
|
+
activeSheetId: 0
|
|
1517
|
+
}, Yt = class {
|
|
1518
|
+
constructor(e) {
|
|
1519
|
+
this._id = o.uuidV4(), this._emitter = new x(this), this._state = { ...J }, e?.json && this._fromJSON(e?.json);
|
|
1520
|
+
}
|
|
1521
|
+
getId() {
|
|
1522
|
+
return this._id;
|
|
1523
|
+
}
|
|
1524
|
+
isShowFormulaBar() {
|
|
1525
|
+
return this._state.showFormulaBar;
|
|
1526
|
+
}
|
|
1527
|
+
setShowFormulaBar(e) {
|
|
1528
|
+
return this._state.showFormulaBar = e, this._emitter.notify("onViewChange"), this;
|
|
1529
|
+
}
|
|
1530
|
+
isShowTabs() {
|
|
1531
|
+
return this._state.showTabs;
|
|
1532
|
+
}
|
|
1533
|
+
setShowTabs(e) {
|
|
1534
|
+
return this._state.showTabs = e, this._emitter.notify("onViewChange"), this;
|
|
1535
|
+
}
|
|
1536
|
+
getTabRatio() {
|
|
1537
|
+
return this._state.tabRatio;
|
|
1538
|
+
}
|
|
1539
|
+
setTabRatio(e) {
|
|
1540
|
+
return this._state.tabRatio = e, this._emitter.notify("onViewChange"), this;
|
|
1541
|
+
}
|
|
1542
|
+
isShowHorizontalScrollbar() {
|
|
1543
|
+
return this._state.showHorizontalScrollbar;
|
|
1544
|
+
}
|
|
1545
|
+
setShowHorizontalScrollbar(e) {
|
|
1546
|
+
return this._state.showHorizontalScrollbar = e, this._emitter.notify("onViewChange"), this;
|
|
1547
|
+
}
|
|
1548
|
+
isShowVerticalScrollbar() {
|
|
1549
|
+
return this._state.showVerticalScrollbar;
|
|
1550
|
+
}
|
|
1551
|
+
setShowVerticalScrollbar(e) {
|
|
1552
|
+
return this._state.showVerticalScrollbar = e, this._emitter.notify("onViewChange"), this;
|
|
1553
|
+
}
|
|
1554
|
+
isShowStatusBar() {
|
|
1555
|
+
return this._state.showStatusBar;
|
|
1556
|
+
}
|
|
1557
|
+
setShowStatusBar(e) {
|
|
1558
|
+
return this._state.showStatusBar = e, this._emitter.notify("onViewChange"), this;
|
|
1559
|
+
}
|
|
1560
|
+
getActiveSheetId() {
|
|
1561
|
+
return this._state.activeSheetId;
|
|
1562
|
+
}
|
|
1563
|
+
setActiveSheetId(e) {
|
|
1564
|
+
let t = this._state, n = t.activeSheetId;
|
|
1565
|
+
return t.activeSheetId = e, n !== e && this._emitter.notify("onViewChange"), this;
|
|
1566
|
+
}
|
|
1567
|
+
addListeners(e, t) {
|
|
1568
|
+
return this._emitter.addListeners(e, t);
|
|
1569
|
+
}
|
|
1570
|
+
toJSON() {
|
|
1571
|
+
let e = {}, t = Object.keys(this._state), n = t.length;
|
|
1572
|
+
for (let r = 0; r < n; r++) {
|
|
1573
|
+
let n = t[r], i = this._state[n];
|
|
1574
|
+
i != null && i !== J[n] && (e[n] = i);
|
|
1575
|
+
}
|
|
1576
|
+
return Object.keys(e).length === 0 && (e = null), e;
|
|
1577
|
+
}
|
|
1578
|
+
_fromJSON(e, t = !0) {
|
|
1579
|
+
let n = e || {};
|
|
1580
|
+
this.update(n, t);
|
|
1581
|
+
}
|
|
1582
|
+
update(e, t = !0) {
|
|
1583
|
+
this._state = {
|
|
1584
|
+
...J,
|
|
1585
|
+
...this._state,
|
|
1586
|
+
...e
|
|
1587
|
+
}, t && this._emitter.notify("onViewChange");
|
|
1588
|
+
}
|
|
1589
|
+
get [Symbol.toStringTag]() {
|
|
1590
|
+
return "[WorkbookView]";
|
|
1591
|
+
}
|
|
1592
|
+
toString() {
|
|
1593
|
+
let e = this.toJSON();
|
|
1594
|
+
return e ? JSON.stringify(e) : "DefaultWorkbookView";
|
|
1595
|
+
}
|
|
1596
|
+
get isIWorkbookView() {
|
|
1597
|
+
return !0;
|
|
1598
|
+
}
|
|
1599
|
+
}, Xt = Object.freeze({
|
|
1600
|
+
structure: !1,
|
|
1601
|
+
windows: !1,
|
|
1602
|
+
revision: !1,
|
|
1603
|
+
password: null,
|
|
1604
|
+
revisionsPassword: null
|
|
1605
|
+
}), Y = class extends be {
|
|
1606
|
+
isWindowsAllowed() {
|
|
1607
|
+
return this._isPropertyAllowed("windows");
|
|
1608
|
+
}
|
|
1609
|
+
isRevisionAllowed() {
|
|
1610
|
+
return this._isPropertyAllowed("revision");
|
|
1611
|
+
}
|
|
1612
|
+
isStructureAllowed() {
|
|
1613
|
+
return this._isPropertyAllowed("structure");
|
|
1614
|
+
}
|
|
1615
|
+
_getAllowedKey() {
|
|
1616
|
+
return "workbook";
|
|
1617
|
+
}
|
|
1618
|
+
_fromJSON(e) {
|
|
1619
|
+
this._properties = e;
|
|
1620
|
+
}
|
|
1621
|
+
_toJSON(e) {
|
|
1622
|
+
let t = this._properties;
|
|
1623
|
+
if (t) {
|
|
1624
|
+
let n = Object.keys(t), r = n.length;
|
|
1625
|
+
for (let i = 0; i < r; i++) {
|
|
1626
|
+
let r = n[i], a = t[r];
|
|
1627
|
+
a != null && a !== Xt[r] && (e[r] = a);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
return super._toJSON(e);
|
|
1631
|
+
}
|
|
1632
|
+
get [Symbol.toStringTag]() {
|
|
1633
|
+
return "[WorkbookProtection]";
|
|
1634
|
+
}
|
|
1635
|
+
get isIWorkbookProtection() {
|
|
1636
|
+
return !0;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
function X(e) {
|
|
1640
|
+
return t("error.workbook.invalidSheetKey", { key: e });
|
|
1641
|
+
}
|
|
1642
|
+
var Zt, Qt, $t, en, tn = class extends qe {
|
|
1643
|
+
constructor(e, t, n) {
|
|
1644
|
+
super(), this._add = e, this._get = t, this._addListeners = n;
|
|
1645
|
+
}
|
|
1646
|
+
add(e) {
|
|
1647
|
+
return this._add(e);
|
|
1648
|
+
}
|
|
1649
|
+
_getItems(e) {
|
|
1650
|
+
return this._get(e?.name, e?.visibility);
|
|
1651
|
+
}
|
|
1652
|
+
getByName(e) {
|
|
1653
|
+
return this._get(e)?.[0] ?? null;
|
|
1654
|
+
}
|
|
1655
|
+
addListeners(e, t) {
|
|
1656
|
+
return this._addListeners(e, t);
|
|
1657
|
+
}
|
|
1658
|
+
get isISheetCollection() {
|
|
1659
|
+
return !0;
|
|
1660
|
+
}
|
|
1661
|
+
}, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), nn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
|
|
1662
|
+
function rn(n) {
|
|
1663
|
+
let r = t(e("workbook.defaultSheetName"), { n: n + 1 });
|
|
1664
|
+
return r === "workbook.defaultSheetName" ? `Sheet${n + 1}` : r;
|
|
1665
|
+
}
|
|
1666
|
+
function an(e, t) {
|
|
1667
|
+
return {
|
|
1668
|
+
...He,
|
|
1669
|
+
getSheet: () => null,
|
|
1670
|
+
toString: () => D(e, t)
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
function on(e, n = !1) {
|
|
1674
|
+
if (!e) throw Error(t("error.workbook.sheetNameBlank"));
|
|
1675
|
+
if (Z.test(e)) {
|
|
1676
|
+
if (!n) throw Error(function(e) {
|
|
1677
|
+
return e ? t("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : t("error.workbook.sheetNameInvalidChars");
|
|
1678
|
+
}(e));
|
|
1679
|
+
e = e.replace(Z, "");
|
|
1680
|
+
}
|
|
1681
|
+
if (e.length === 0) throw Error(t("error.workbook.sheetNameBlank"));
|
|
1682
|
+
let r = e.length;
|
|
1683
|
+
if (r > 31) {
|
|
1684
|
+
if (!n) throw Error(t("error.workbook.sheetNameTooLong"));
|
|
1685
|
+
e = e.substring(0, 31);
|
|
1686
|
+
}
|
|
1687
|
+
if (e.charAt(0) === "'" || e.charAt(r - 1) === "'") {
|
|
1688
|
+
if (!n) throw Error(t("error.workbook.sheetNameQuotes"));
|
|
1689
|
+
e = e.replace(/^'|'$/g, "");
|
|
1690
|
+
}
|
|
1691
|
+
return e;
|
|
1692
|
+
}
|
|
1693
|
+
var sn, cn = "workbook.activeSheet", Q = class e extends oe {
|
|
1694
|
+
constructor(e, t, n, r) {
|
|
1695
|
+
super(e, t, r), this._workbook = n;
|
|
1696
|
+
}
|
|
1697
|
+
getSource() {
|
|
1698
|
+
return this._workbook;
|
|
1699
|
+
}
|
|
1700
|
+
_createRanges(t, n) {
|
|
1701
|
+
let r = this._options;
|
|
1702
|
+
return n && (r = {
|
|
1703
|
+
...this._options,
|
|
1704
|
+
getOptions: F(this._options?.getOptions, n)
|
|
1705
|
+
}), new e(t, this._internal, this._workbook, r);
|
|
1706
|
+
}
|
|
1707
|
+
_createRange(e, t) {
|
|
1708
|
+
let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, N.Visibility.VeryHidden) : null;
|
|
1709
|
+
if (!r) {
|
|
1710
|
+
let e = this._workbook.getSelectedSheet();
|
|
1711
|
+
return delete n?.scope, an(n, n ? {
|
|
1712
|
+
scope: b,
|
|
1713
|
+
...e.getEntireRange().getCoords()
|
|
1714
|
+
} : null);
|
|
1715
|
+
}
|
|
1716
|
+
let i = this._options;
|
|
1717
|
+
return t && (i = {
|
|
1718
|
+
...this._options,
|
|
1719
|
+
getOptions: F(this._options.getOptions, t)
|
|
1720
|
+
}), new ln(e, A(r.sheet), this._workbook, i);
|
|
1721
|
+
}
|
|
1722
|
+
async select(e) {
|
|
1723
|
+
let t = [], n = null, r = this.getCoords();
|
|
1724
|
+
for (let e = 0; e < r.length; e++) {
|
|
1725
|
+
let i = r[e];
|
|
1726
|
+
i && (n ||= i.scope, i && i.scope === n && t.push(i));
|
|
1727
|
+
}
|
|
1728
|
+
n ||= this._workbook.getSelectedSheet().getName();
|
|
1729
|
+
let i = this._workbook.getSheets().getByName(n);
|
|
1730
|
+
if (!i) return;
|
|
1731
|
+
let a = await i.getRanges(t).select(e), o = this._workbook._rangesAddressToCoords(a.getCoords());
|
|
1732
|
+
return this._createRanges(o);
|
|
1733
|
+
}
|
|
1734
|
+
addListener(e, t) {
|
|
1735
|
+
if (!this.getCoords()) return () => {};
|
|
1736
|
+
let n = this._workbook._sheetToWBEvent(e);
|
|
1737
|
+
return super.addListener(n, t);
|
|
1738
|
+
}
|
|
1739
|
+
get [Symbol.toStringTag]() {
|
|
1740
|
+
return "[WorkbookRanges]";
|
|
1741
|
+
}
|
|
1742
|
+
getAddress(e) {
|
|
1743
|
+
let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
|
|
1744
|
+
return Ye(this.getCoords(), {
|
|
1745
|
+
...n,
|
|
1746
|
+
scope: t.getName()
|
|
1747
|
+
}, D, ce, e);
|
|
1748
|
+
}
|
|
1749
|
+
toString() {
|
|
1750
|
+
return this.getAddress();
|
|
1751
|
+
}
|
|
1752
|
+
}, ln = class e extends pe {
|
|
1753
|
+
constructor(e, t, n, r) {
|
|
1754
|
+
super(e, t, r), this._workbook = n;
|
|
1755
|
+
}
|
|
1756
|
+
_createRanges(e, t) {
|
|
1757
|
+
let n = this._options;
|
|
1758
|
+
return t && (n = {
|
|
1759
|
+
...this._options,
|
|
1760
|
+
getOptions: F(this._options?.getOptions, t)
|
|
1761
|
+
}), new Q(e, this._internal, this._workbook, n);
|
|
1762
|
+
}
|
|
1763
|
+
_createRange(t, n) {
|
|
1764
|
+
let r = this._internal;
|
|
1765
|
+
if (!t) return Ne(r.getSheet(), r.getSheet().getEntireCoords());
|
|
1766
|
+
if (r.validateCoords(t), r.getSheet().isClosed()) return Ne(null, r.getSheet().getEntireCoords(), t);
|
|
1767
|
+
let i = this._options;
|
|
1768
|
+
return n && (i = {
|
|
1769
|
+
...this._options,
|
|
1770
|
+
getOptions: F(this._options?.getOptions, n)
|
|
1771
|
+
}), new e(t, this._internal, this._workbook, i);
|
|
1772
|
+
}
|
|
1773
|
+
addListener(e, t) {
|
|
1774
|
+
if (!this.getCoords()) return () => {};
|
|
1775
|
+
let n = this._workbook._sheetToWBEvent(e);
|
|
1776
|
+
return super.addListener(n, t);
|
|
1777
|
+
}
|
|
1778
|
+
get [Symbol.toStringTag]() {
|
|
1779
|
+
return "[WorkbookRange]";
|
|
1780
|
+
}
|
|
1781
|
+
getAddress(e) {
|
|
1782
|
+
let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
|
|
1783
|
+
return D(this.getCoords(), {
|
|
1784
|
+
...n,
|
|
1785
|
+
scope: t.getName()
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
toString() {
|
|
1789
|
+
return this.getAddress();
|
|
1790
|
+
}
|
|
1791
|
+
}, un = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", dn = class {
|
|
1792
|
+
constructor(t) {
|
|
1793
|
+
this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new Ee(() => {
|
|
1794
|
+
let e = [];
|
|
1795
|
+
for (let t of this.getSheets()) e.push(...t.getPivotTables());
|
|
1796
|
+
return e;
|
|
1797
|
+
}), this._people = new Wt(), this._commentCollection = new C(null, (e, t, n) => {
|
|
1798
|
+
let r = [];
|
|
1799
|
+
for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
|
|
1800
|
+
address: e,
|
|
1801
|
+
ignoreHidden: t,
|
|
1802
|
+
fullyContained: n
|
|
1803
|
+
} : {
|
|
1804
|
+
ignoreHidden: t,
|
|
1805
|
+
fullyContained: n
|
|
1806
|
+
}));
|
|
1807
|
+
return r;
|
|
1808
|
+
}, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
|
|
1809
|
+
e.onCollectionChange(this._commentCollection);
|
|
1810
|
+
} : void 0 }, t)), this._restoringSheets = !1, this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
|
|
1811
|
+
let n = typeof t == "string" ? { origin: t } : { ...t }, r = n.origin;
|
|
1812
|
+
this._ownOriginProvider = !un(r), this._originProvider = un(r) ? r : new at(typeof r == "string" ? new R(null, { name: r }) : r ?? new R(null)), delete n.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
|
|
1813
|
+
let i = n.json;
|
|
1814
|
+
delete n.json, this._transactions = n.transactions ?? new Je(), this._id = this._transactions.create(), this._ownTransactions = !n.transactions, this._emitter = new x(this, this._transactions), this._runtime = n.runtime ?? new Be("Workbook Runtime", {
|
|
1815
|
+
isDate1904: () => this._isDate1904,
|
|
1816
|
+
getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
|
|
1817
|
+
getLocale: () => this._locale ?? ae() ?? xe(),
|
|
1818
|
+
getLocaleOverrides: () => this._localeOverrides
|
|
1819
|
+
}), this._listenerLanguage = a.addChangeListener(() => {
|
|
1820
|
+
this._closed || this._notifyAllChange();
|
|
1821
|
+
});
|
|
1822
|
+
let s = this, c = this._beginCommit({ description: e(i ? "op.openWorkbook" : "op.newWorkbook") });
|
|
1823
|
+
try {
|
|
1824
|
+
this._strings = n.strings ?? new fe(), this._ownStrings = !n.strings, this._resources = n.resources ?? new Pe(), this._ownResources = !n.resources, this._createSheetName = n.createSheetNameCallback ?? rn;
|
|
1825
|
+
let e = n.createSheetCallback;
|
|
1826
|
+
e ||= (e) => new L(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, a, o) => {
|
|
1827
|
+
let c = null, l = {
|
|
1828
|
+
runtime: s._runtime,
|
|
1829
|
+
readonly: s._options.readonly ?? !1,
|
|
1830
|
+
disableLoadAutoFit: s._options.disableLoadAutoFit ?? !1,
|
|
1831
|
+
opener: s._options.opener,
|
|
1832
|
+
transactions: s._transactions,
|
|
1833
|
+
styles: s._styles,
|
|
1834
|
+
strings: s._strings,
|
|
1835
|
+
resources: s._resources,
|
|
1836
|
+
names: s._names,
|
|
1837
|
+
workbook: s,
|
|
1838
|
+
calculation: s._calculation,
|
|
1839
|
+
resolveRange: (e) => s._options.resolveRange?.(e) ?? s.getRange(e),
|
|
1840
|
+
container: {
|
|
1841
|
+
beforeFromJSON: (e) => {
|
|
1842
|
+
c = e, s._addSheetRef({
|
|
1843
|
+
name: n,
|
|
1844
|
+
id: t,
|
|
1845
|
+
visibility: r ?? N.Visibility.Visible,
|
|
1846
|
+
sheetId: a,
|
|
1847
|
+
sheet: e
|
|
1848
|
+
}, i);
|
|
1849
|
+
},
|
|
1850
|
+
getName: () => {
|
|
1851
|
+
let e = s._getSheetRef(c);
|
|
1852
|
+
return e ? e.name : n;
|
|
1853
|
+
},
|
|
1854
|
+
setName: (e, t) => {
|
|
1855
|
+
s._getSheetRef(c) && s._setSheetName(c, e, t);
|
|
1856
|
+
},
|
|
1857
|
+
setNameChangeCallback: (e) => {
|
|
1858
|
+
s._sheetOnNameChange.set(t, e);
|
|
1859
|
+
},
|
|
1860
|
+
getVisibility: () => {
|
|
1861
|
+
let e = s._getSheetRef(c);
|
|
1862
|
+
return e ? e.visibility : N.Visibility.Visible;
|
|
1863
|
+
},
|
|
1864
|
+
setVisibility: (e, t) => {
|
|
1865
|
+
s._setSheetVisibility(c, e, t);
|
|
1866
|
+
},
|
|
1867
|
+
setVisibilityCallback: (e) => {
|
|
1868
|
+
s._sheetOnVisibilityChange.set(t, e);
|
|
1869
|
+
},
|
|
1870
|
+
duplicate: () => s._duplicateSheet(c),
|
|
1871
|
+
getIndex: () => {
|
|
1872
|
+
let e = s._getSheetRef(c);
|
|
1873
|
+
return e ? s._getOffsetForId(e.id, s._getSheetRefs(N.Visibility.VeryHidden)) : i;
|
|
1874
|
+
},
|
|
1875
|
+
setIndex: (e, t) => {
|
|
1876
|
+
let n = s._getSheetRef(c, N.Visibility.VeryHidden);
|
|
1877
|
+
return !!n && (s._moveSheet(n, e, t), !0);
|
|
1878
|
+
},
|
|
1879
|
+
setIndexCallback: (e) => {
|
|
1880
|
+
s._sheetOnIndexChange.set(t, e);
|
|
1881
|
+
},
|
|
1882
|
+
requestSelect: async () => (s._setSelectedSheet(c), await this._emitter.notify("onRequestSelect", {
|
|
1883
|
+
source: s,
|
|
1884
|
+
params: c,
|
|
1885
|
+
async: !0
|
|
1886
|
+
}), s.getSelectedSheet() === c)
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
return o && (l.json = o), c = e(l, n, i, r), c;
|
|
1890
|
+
}, this._namedTableSource = new Ce({
|
|
1891
|
+
getSheets: () => s._sheets ? s.getSheets().getItems() : o.EmptyArray,
|
|
1892
|
+
addSheetsListener: (e, t) => s.addListeners({ onSheetsChange: e }, t)
|
|
1893
|
+
}), this._names = n.names ?? new Me({
|
|
1894
|
+
addressToRanges: (e) => s.getRanges(e),
|
|
1895
|
+
getCurrentScope: () => s.getSelectedSheet().getName(),
|
|
1896
|
+
isReadOnly: () => (s._options.readonly ?? !1) || s._isStructureProtected(),
|
|
1897
|
+
transactions: s._transactions,
|
|
1898
|
+
getSources: () => s._calculation ? [s._calculation.getNamedFormulas(), s._namedTableSource] : o.EmptyArray
|
|
1899
|
+
}), this._ownNames = !n.names, this._calculation = n.calculation ?? new ue({
|
|
1900
|
+
runtime: s._runtime,
|
|
1901
|
+
functions: n.functions,
|
|
1902
|
+
json: i?.calc,
|
|
1903
|
+
isNamesReadOnly: () => s._isStructureProtected(),
|
|
1904
|
+
getActiveCell: () => {
|
|
1905
|
+
let e = s.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
|
|
1906
|
+
return t ? {
|
|
1907
|
+
rowIndex: t.rowStart,
|
|
1908
|
+
colIndex: t.colStart,
|
|
1909
|
+
scope: e.getId()
|
|
1910
|
+
} : null;
|
|
1911
|
+
},
|
|
1912
|
+
getRange: s.getRange.bind(s),
|
|
1913
|
+
getRanges: s.getRanges.bind(s),
|
|
1914
|
+
createGraphRanges: (e, t) => s._createGraphRanges(e, t),
|
|
1915
|
+
getSheetIndex: (e) => {
|
|
1916
|
+
if (e === void 0) {
|
|
1917
|
+
let e = s.getSelectedSheet();
|
|
1918
|
+
return e ? this._getSheetRefs(N.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
|
|
1919
|
+
}
|
|
1920
|
+
let t = this._getSheetRefs(N.Visibility.VeryHidden);
|
|
1921
|
+
e = e.toLowerCase();
|
|
1922
|
+
let n = t.length;
|
|
1923
|
+
for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
|
|
1924
|
+
try {
|
|
1925
|
+
fn.address = e;
|
|
1926
|
+
let t = this._names.getItems(fn);
|
|
1927
|
+
if (!t || t.length === 0) return -1;
|
|
1928
|
+
let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
|
|
1929
|
+
if (!n) return -1;
|
|
1930
|
+
let r = this._getSheetRefs(N.Visibility.VeryHidden);
|
|
1931
|
+
n = n.toLowerCase();
|
|
1932
|
+
let i = r.length;
|
|
1933
|
+
for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
|
|
1934
|
+
} catch {
|
|
1935
|
+
return -1;
|
|
1936
|
+
}
|
|
1937
|
+
return -1;
|
|
1938
|
+
},
|
|
1939
|
+
getSheetCount: () => s.getSheets().getItems({ visibility: N.Visibility.VeryHidden }).length,
|
|
1940
|
+
getSheetIds: () => s._sheets?.getItems({ visibility: N.Visibility.VeryHidden }).map((e) => e.getId()) ?? [],
|
|
1941
|
+
addSheetsListener: (e, t) => s.addListeners({ onSheetsChange: () => {
|
|
1942
|
+
s._restoringSheets || e();
|
|
1943
|
+
} }, t),
|
|
1944
|
+
getSheetById: (e) => {
|
|
1945
|
+
let t = s.getSheets().getItems({ visibility: N.Visibility.VeryHidden }), n = t.length;
|
|
1946
|
+
for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
|
|
1947
|
+
return null;
|
|
1948
|
+
},
|
|
1949
|
+
externalBooks: i?.externalBooks,
|
|
1950
|
+
externalBookResolver: n.externalBookResolver,
|
|
1951
|
+
namedCollection: s._names,
|
|
1952
|
+
strings: s._strings,
|
|
1953
|
+
transactions: s._transactions,
|
|
1954
|
+
names: i?.names
|
|
1955
|
+
}), this._ownCalculation = !n.calculation, this._scripts = this._createScripts(i?.modules), this._ownNames = !n.names, this._options = Object.freeze({ ...n });
|
|
1956
|
+
let t = n.calcOnLoad ?? "auto", r = !1, a = (async () => {
|
|
1957
|
+
try {
|
|
1958
|
+
if (this._ownCalculation && t !== "none" && (t === "full" || t === "auto" && !0 === i?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
|
|
1959
|
+
await this._scripts.start();
|
|
1960
|
+
} finally {
|
|
1961
|
+
r = !0, this._starting = null;
|
|
1962
|
+
}
|
|
1963
|
+
})();
|
|
1964
|
+
r || (this._starting = a), this._starting?.catch(() => {}), i ? this._fromJSON(i) : (this._initState(), this._addSheet(!1)), this._sheets = new tn((e) => s._addSheetOptions(e), (e, t) => {
|
|
1965
|
+
if (e) {
|
|
1966
|
+
let n = this._getSheetRef(e, t);
|
|
1967
|
+
return n ? [n.sheet] : o.EmptyArray;
|
|
1968
|
+
}
|
|
1969
|
+
return this._getSheets(t);
|
|
1970
|
+
}, (e, t) => {
|
|
1971
|
+
let n = e.onCollectionChange, r = e.onInvalidated;
|
|
1972
|
+
return s._emitter.addListeners({
|
|
1973
|
+
onSheetsChange: n ? () => {
|
|
1974
|
+
n(s._sheets);
|
|
1975
|
+
} : void 0,
|
|
1976
|
+
onInvalidated: r ? () => {
|
|
1977
|
+
r(s._sheets);
|
|
1978
|
+
} : void 0
|
|
1979
|
+
}, t);
|
|
1980
|
+
}), this._ownCalculation && (n.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? c.amend() : c.commit();
|
|
1981
|
+
} catch (e) {
|
|
1982
|
+
throw c.rollback(), e;
|
|
1983
|
+
}
|
|
1984
|
+
this._initializing = !1;
|
|
1985
|
+
}
|
|
1986
|
+
_initState() {
|
|
1987
|
+
let e = this._getSheetRefs();
|
|
1988
|
+
for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
|
|
1989
|
+
let t = this._options;
|
|
1990
|
+
this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new Te().getDefaultTheme(), this._styles = t?.styles ?? new ie(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Yt()), this._listenerProtection?.(), this._protection = new Y(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
1991
|
+
n._emitter.notify("onProtectionChange");
|
|
1992
|
+
} });
|
|
1993
|
+
let n = this;
|
|
1994
|
+
this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
|
|
1995
|
+
async onAfterStateChange(e, t, r, i, a) {
|
|
1996
|
+
let o = n._view, s = a?.[cn], c = r ? s?.before : s?.after, l = s?.viewId === o.getId() && c != null, u = l ? c : o.getActiveSheetId(), d = l && t.getId() === n._lastTransactionUUID ? n._getSheetRef({ id: u }) : null;
|
|
1997
|
+
if (d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), r || i) {
|
|
1998
|
+
n._restoringSheets = !0;
|
|
1999
|
+
try {
|
|
2000
|
+
n._emitter.notify("onSheetsChange");
|
|
2001
|
+
} finally {
|
|
2002
|
+
n._restoringSheets = !1;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
|
|
2006
|
+
},
|
|
2007
|
+
onRestoreOrRevert() {
|
|
2008
|
+
n._ownCalculation, n._emitter.notify("onInvalidated");
|
|
2009
|
+
}
|
|
2010
|
+
});
|
|
2011
|
+
let r = this._getState();
|
|
2012
|
+
r?.listenersSheets && (r?.listenersSheets.forEach((e) => {
|
|
2013
|
+
e();
|
|
2014
|
+
}), r?.listenersSheets.clear()), this._updateState({
|
|
2015
|
+
sheetRefsAll: [],
|
|
2016
|
+
sheetRefsVisibleAndHidden: [],
|
|
2017
|
+
sheetRefsVisible: [],
|
|
2018
|
+
refsById: /* @__PURE__ */ new Map(),
|
|
2019
|
+
sheetsById: /* @__PURE__ */ new Map(),
|
|
2020
|
+
refsByLowerCaseName: /* @__PURE__ */ new Map(),
|
|
2021
|
+
sheetsByLowerCaseName: /* @__PURE__ */ new Map(),
|
|
2022
|
+
refsByInstance: /* @__PURE__ */ new Map(),
|
|
2023
|
+
lastId: -1,
|
|
2024
|
+
sheetsCreated: /* @__PURE__ */ new Set(),
|
|
2025
|
+
listenersSheets: /* @__PURE__ */ new Map()
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
getId() {
|
|
2029
|
+
return this._id;
|
|
2030
|
+
}
|
|
2031
|
+
getVersionId() {
|
|
2032
|
+
return this._transactions.getVersionId(this._id);
|
|
2033
|
+
}
|
|
2034
|
+
getName() {
|
|
2035
|
+
return this._closed ? null : this._origin.getName();
|
|
2036
|
+
}
|
|
2037
|
+
getOrigin() {
|
|
2038
|
+
return this._originProvider.getOrigin();
|
|
2039
|
+
}
|
|
2040
|
+
_onOriginChange() {
|
|
2041
|
+
if (this._closed) return;
|
|
2042
|
+
let e = this._originProvider.getOrigin();
|
|
2043
|
+
if (e === this._origin) return;
|
|
2044
|
+
this._listenerOrigin?.();
|
|
2045
|
+
let t = this._lastOriginName;
|
|
2046
|
+
this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
|
|
2047
|
+
}
|
|
2048
|
+
_bindOrigin(e) {
|
|
2049
|
+
this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
|
|
2050
|
+
if (this._closed) return;
|
|
2051
|
+
let t = e.getName();
|
|
2052
|
+
t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
|
|
2053
|
+
} });
|
|
2054
|
+
}
|
|
2055
|
+
getView() {
|
|
2056
|
+
return this._view;
|
|
2057
|
+
}
|
|
2058
|
+
setView(e) {
|
|
2059
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2060
|
+
if (!e) throw new h(t("error.sheet.emptyView"));
|
|
2061
|
+
this._listenerWorkbookView?.();
|
|
2062
|
+
let n = this, r = -1;
|
|
2063
|
+
return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
|
|
2064
|
+
let t = n._getState(), i = this._view.getActiveSheetId(), a = t.sheetRefsVisible, o = this._getOffsetForId(i, a);
|
|
2065
|
+
this._activeSheetOffset = o, n._emitter.notify("onViewChange"), r !== i && (n._emitter.notify("onSelectionChange"), n._emitter.notify("onSelectedSheetChange")), r = i;
|
|
2066
|
+
} }), this._view = e, n._emitter.notify("onViewChange"), this;
|
|
2067
|
+
}
|
|
2068
|
+
getRuntime() {
|
|
2069
|
+
return this._runtime;
|
|
2070
|
+
}
|
|
2071
|
+
setDate1904(e) {
|
|
2072
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2073
|
+
return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
|
|
2074
|
+
}
|
|
2075
|
+
getLocale() {
|
|
2076
|
+
return this._runtime.getLocale();
|
|
2077
|
+
}
|
|
2078
|
+
getPinnedLocale() {
|
|
2079
|
+
return this._locale;
|
|
2080
|
+
}
|
|
2081
|
+
setLocale(e) {
|
|
2082
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2083
|
+
if (e) try {
|
|
2084
|
+
new Intl.Locale(e);
|
|
2085
|
+
} catch {
|
|
2086
|
+
throw Error(t("error.workbook.invalidLocale", { locale: e }));
|
|
2087
|
+
}
|
|
2088
|
+
return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
|
|
2089
|
+
}
|
|
2090
|
+
getLocaleOverrides() {
|
|
2091
|
+
return this._localeOverrides;
|
|
2092
|
+
}
|
|
2093
|
+
setLocaleOverrides(e) {
|
|
2094
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2095
|
+
let n = e && Object.keys(e).length > 0 ? e : null;
|
|
2096
|
+
return this._localeOverrides = n, this._emitter.notify("onRegionalChange"), this;
|
|
2097
|
+
}
|
|
2098
|
+
getStyles() {
|
|
2099
|
+
return this._styles;
|
|
2100
|
+
}
|
|
2101
|
+
getResources() {
|
|
2102
|
+
return this._resources;
|
|
2103
|
+
}
|
|
2104
|
+
getTransactions() {
|
|
2105
|
+
return this._transactions;
|
|
2106
|
+
}
|
|
2107
|
+
getStrings() {
|
|
2108
|
+
return this._strings;
|
|
2109
|
+
}
|
|
2110
|
+
getExternalBooks() {
|
|
2111
|
+
return this._calculation.getExternalBooks();
|
|
2112
|
+
}
|
|
2113
|
+
getUpdateLinks() {
|
|
2114
|
+
return this._updateLinks;
|
|
2115
|
+
}
|
|
2116
|
+
setUpdateLinks(e) {
|
|
2117
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2118
|
+
return this._updateLinks = e, this;
|
|
2119
|
+
}
|
|
2120
|
+
getPivotTables() {
|
|
2121
|
+
return this._pivotTableCollection;
|
|
2122
|
+
}
|
|
2123
|
+
getComments() {
|
|
2124
|
+
return this._commentCollection;
|
|
2125
|
+
}
|
|
2126
|
+
getPeople() {
|
|
2127
|
+
return this._people;
|
|
2128
|
+
}
|
|
2129
|
+
getTheme() {
|
|
2130
|
+
return this._theme;
|
|
2131
|
+
}
|
|
2132
|
+
setTheme(e) {
|
|
2133
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2134
|
+
if (!e) throw new h(t("error.workbook.notSetValue"));
|
|
2135
|
+
let n = this._theme;
|
|
2136
|
+
return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), n;
|
|
2137
|
+
}
|
|
2138
|
+
getSelectedSheetIndex() {
|
|
2139
|
+
return this._activeSheetOffset;
|
|
2140
|
+
}
|
|
2141
|
+
getSelectedSheet() {
|
|
2142
|
+
let e = this._getSheetRef(this.getSelectedSheetIndex());
|
|
2143
|
+
return e ? e?.sheet : null;
|
|
2144
|
+
}
|
|
2145
|
+
getSheet(e, n = N.Visibility.Visible) {
|
|
2146
|
+
if (e === void 0) return this.getSelectedSheet();
|
|
2147
|
+
if (!e) throw Error(t("error.workbook.sheetNameNotProvided"));
|
|
2148
|
+
let i = this._getSheetRef(e, n);
|
|
2149
|
+
if (!i) throw new r(t("error.workbook.sheetNameNotFound", { sheetName: e }));
|
|
2150
|
+
return i.sheet;
|
|
2151
|
+
}
|
|
2152
|
+
getSheetAt(e, n = N.Visibility.Visible) {
|
|
2153
|
+
let i = this._getSheetRef(e, n);
|
|
2154
|
+
if (!i) throw new r(function(e) {
|
|
2155
|
+
return t("error.workbook.sheetIndexNotFound", { index: e });
|
|
2156
|
+
}(e));
|
|
2157
|
+
return i.sheet;
|
|
2158
|
+
}
|
|
2159
|
+
getSheets() {
|
|
2160
|
+
return this._sheets;
|
|
2161
|
+
}
|
|
2162
|
+
addSheet(e) {
|
|
2163
|
+
return this.getSheets().add(e);
|
|
2164
|
+
}
|
|
2165
|
+
_getSheets(e = N.Visibility.Visible) {
|
|
2166
|
+
let t = this._getSheetRefs(e), n = [], r = t.length;
|
|
2167
|
+
for (let e = 0; e < r; e++) n.push(t[e].sheet);
|
|
2168
|
+
return n;
|
|
2169
|
+
}
|
|
2170
|
+
_getSheetRefs(e = N.Visibility.Visible) {
|
|
2171
|
+
let t = this._getState();
|
|
2172
|
+
return t ? e === N.Visibility.Visible ? t.sheetRefsVisible : e === N.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === N.Visibility.VeryHidden ? t.sheetRefsAll : o.EmptyArray : [];
|
|
2173
|
+
}
|
|
2174
|
+
_getSheetRef(e, t = N.Visibility.Visible) {
|
|
2175
|
+
let n = null;
|
|
2176
|
+
return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof L ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
|
|
2177
|
+
}
|
|
2178
|
+
_validateNewSheetName(e, n = !0) {
|
|
2179
|
+
if (e == null) return e;
|
|
2180
|
+
if (on(e), n && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new h(t("error.workbook.nameTaken"));
|
|
2181
|
+
return e.substring(0, 31);
|
|
2182
|
+
}
|
|
2183
|
+
findValidSheetName(e) {
|
|
2184
|
+
e &&= on(e, !0);
|
|
2185
|
+
try {
|
|
2186
|
+
return function(e, t) {
|
|
2187
|
+
try {
|
|
2188
|
+
if (t(e)) return e;
|
|
2189
|
+
} catch {}
|
|
2190
|
+
let n, r, i = nn.exec(e);
|
|
2191
|
+
for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
|
|
2192
|
+
r++;
|
|
2193
|
+
let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
|
|
2194
|
+
try {
|
|
2195
|
+
if (t(i)) return i;
|
|
2196
|
+
} catch {}
|
|
2197
|
+
}
|
|
2198
|
+
throw Error(e + " is not a valid sheet name");
|
|
2199
|
+
}(e, (e) => this._validateNewSheetName(e));
|
|
2200
|
+
} catch {
|
|
2201
|
+
return this._nextSheetName();
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
isValidSheetNameCharacter(e) {
|
|
2205
|
+
return !Z.test(e);
|
|
2206
|
+
}
|
|
2207
|
+
_isStructureProtected() {
|
|
2208
|
+
return !this._initializing && !this.getProtection().isStructureAllowed();
|
|
2209
|
+
}
|
|
2210
|
+
_addSheetOptions(n) {
|
|
2211
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2212
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2213
|
+
let r, i = null;
|
|
2214
|
+
r = typeof n == "string" ? { name: n } : typeof n == "number" ? { index: n } : n, r = {
|
|
2215
|
+
...r,
|
|
2216
|
+
description: r?.description ?? e("op.addSheet")
|
|
2217
|
+
};
|
|
2218
|
+
let a = this.beginCommit(r);
|
|
2219
|
+
try {
|
|
2220
|
+
let e = r?.autoSelect ?? !1;
|
|
2221
|
+
i = this._addSheet(!0, r.name, r.index ?? null);
|
|
2222
|
+
let n = this.getView().getActiveSheetId();
|
|
2223
|
+
if (e && this._recordActiveSheet(a, n, this._getSheetRef(i).id), a.commit({ description: t("op.addSheetNamed", { name: i.getName() }) }), !1 !== e) {
|
|
2224
|
+
let t = typeof e == "boolean" ? void 0 : e;
|
|
2225
|
+
i.select(t);
|
|
2226
|
+
}
|
|
2227
|
+
} catch (e) {
|
|
2228
|
+
throw a.rollback(), e;
|
|
2229
|
+
}
|
|
2230
|
+
return i;
|
|
2231
|
+
}
|
|
2232
|
+
_nextSheetName(e = null) {
|
|
2233
|
+
let n = e ? e.toLowerCase() : null, r = this._getState(), i = r.sheetsByLowerCaseName;
|
|
2234
|
+
if (e && i.has(n)) throw new h(function(e) {
|
|
2235
|
+
return t("error.workbook.nameDuplicate", { sheetName: e });
|
|
2236
|
+
}(e));
|
|
2237
|
+
n = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
|
|
2238
|
+
let a = r.lastId + 1;
|
|
2239
|
+
for (; !e;) {
|
|
2240
|
+
let t = this._createSheetName(a), n = t.toLowerCase();
|
|
2241
|
+
i.has(n) ? a++ : e = t;
|
|
2242
|
+
}
|
|
2243
|
+
return this._updateState({ lastId: a }), e;
|
|
2244
|
+
}
|
|
2245
|
+
_addSheet(e, n = null, r = null) {
|
|
2246
|
+
n = this._nextSheetName(n);
|
|
2247
|
+
let i = this._getState(), a = this._createSheet(i.lastId, n, N.Visibility.Visible, r, void 0, null);
|
|
2248
|
+
if (!a) throw new h(t("error.workbook.sheetNameBlank"));
|
|
2249
|
+
return e && this._emitter.notify("onSheetsChange"), a;
|
|
2250
|
+
}
|
|
2251
|
+
_updateSheetRefStates(e) {
|
|
2252
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2253
|
+
if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2254
|
+
let n = e, r = [], i = [], a = n.length;
|
|
2255
|
+
for (let e = 0; e < a; e++) n[e].visibility === N.Visibility.Visible ? (r.push(n[e]), i.push(n[e])) : n[e].visibility === N.Visibility.Hidden && i.push(n[e]);
|
|
2256
|
+
this._updateState({
|
|
2257
|
+
sheetRefsAll: n,
|
|
2258
|
+
sheetRefsVisible: r,
|
|
2259
|
+
sheetRefsVisibleAndHidden: i
|
|
2260
|
+
});
|
|
2261
|
+
}
|
|
2262
|
+
_addSheetRef(e, n = null) {
|
|
2263
|
+
let r = this._getState(), i = r.sheetRefsAll, a = Math.max(0, Math.min(i.length, n ?? i.length)), o = [
|
|
2264
|
+
...i.slice(0, a),
|
|
2265
|
+
e,
|
|
2266
|
+
...i.slice(a)
|
|
2267
|
+
];
|
|
2268
|
+
this._updateSheetRefStates(o);
|
|
2269
|
+
let s = e.sheet, c = e.name.toLowerCase(), l = new Map(r.refsById);
|
|
2270
|
+
l.set(e.id, e);
|
|
2271
|
+
let u = new Map(r.refsByLowerCaseName);
|
|
2272
|
+
u.set(c, e);
|
|
2273
|
+
let d = new Map(r.refsByInstance);
|
|
2274
|
+
d.set(s, e);
|
|
2275
|
+
let f = new Map(r.sheetsById);
|
|
2276
|
+
f.set(e.id, s);
|
|
2277
|
+
let p = new Map(r.sheetsByLowerCaseName);
|
|
2278
|
+
p.set(c, s);
|
|
2279
|
+
let m = this, h = r.listenersSheets;
|
|
2280
|
+
if (s !== void 0) {
|
|
2281
|
+
let n = s.addListeners({
|
|
2282
|
+
onBeforeDelete: (e) => {
|
|
2283
|
+
m._validateDeleteSheet(e);
|
|
2284
|
+
},
|
|
2285
|
+
onDelete(e) {
|
|
2286
|
+
let n = m._getSheetRef(e, N.Visibility.VeryHidden);
|
|
2287
|
+
if (!n) return;
|
|
2288
|
+
let r = m._beginCommit({ description: t("op.deleteSheet", { name: n.name }) });
|
|
2289
|
+
try {
|
|
2290
|
+
let t = m._getState(), i = t.sheetRefsAll, a = m._getOffsetForId(n.id, i), o = [...i];
|
|
2291
|
+
o.splice(a, 1), m._updateSheetRefStates(o);
|
|
2292
|
+
let c = new Map(t.refsById);
|
|
2293
|
+
c.delete(n.id);
|
|
2294
|
+
let l = new Map(t.sheetsById);
|
|
2295
|
+
l.delete(n.id);
|
|
2296
|
+
let u = n.name.toLowerCase(), d = new Map(t.refsByLowerCaseName);
|
|
2297
|
+
d.delete(u);
|
|
2298
|
+
let f = new Map(t.sheetsByLowerCaseName);
|
|
2299
|
+
f.delete(u);
|
|
2300
|
+
let p = new Map(t.refsByInstance);
|
|
2301
|
+
p.delete(e), t.listenersSheets.get(n.id)();
|
|
2302
|
+
let h = new Map(t.listenersSheets);
|
|
2303
|
+
h.delete(n.id), m._adjustRemoveSelectionIfRequired(a, n.id), m._adjustSheetNamesIfRequired(), m._sheetOnNameChange.delete(n.id), m._sheetOnVisibilityChange.delete(n.id), m._sheetOnIndexChange.delete(n.id), m._emitter.notify("onSheetsChange");
|
|
2304
|
+
let g = new Set(t.sheetsCreated);
|
|
2305
|
+
g.has(s) && g.delete(s), m._updateState({
|
|
2306
|
+
refsById: c,
|
|
2307
|
+
sheetsById: l,
|
|
2308
|
+
refsByLowerCaseName: d,
|
|
2309
|
+
sheetsByLowerCaseName: f,
|
|
2310
|
+
refsByInstance: p,
|
|
2311
|
+
sheetsCreated: g,
|
|
2312
|
+
listenersSheets: h
|
|
2313
|
+
}), r.commit();
|
|
2314
|
+
} catch (e) {
|
|
2315
|
+
throw r.rollback(), e;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}), i = s.addListeners({ onSelectionChange: (e) => {
|
|
2319
|
+
m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
|
|
2320
|
+
source: m,
|
|
2321
|
+
params: e
|
|
2322
|
+
});
|
|
2323
|
+
} }, { transactional: !1 });
|
|
2324
|
+
h = new Map(r.listenersSheets), h.set(e.id, () => {
|
|
2325
|
+
n(), i();
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
let g = r.lastId;
|
|
2329
|
+
g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
|
|
2330
|
+
refsById: l,
|
|
2331
|
+
refsByLowerCaseName: u,
|
|
2332
|
+
refsByInstance: d,
|
|
2333
|
+
sheetsById: f,
|
|
2334
|
+
sheetsByLowerCaseName: p,
|
|
2335
|
+
listenersSheets: h
|
|
2336
|
+
}), this._adjustSheetNamesIfRequired();
|
|
2337
|
+
let _ = new Set(this._getState().sheetsCreated);
|
|
2338
|
+
return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), e;
|
|
2339
|
+
}
|
|
2340
|
+
_recordActiveSheet(e, t, n) {
|
|
2341
|
+
let r = this.getView().getId();
|
|
2342
|
+
e.setIntent(cn, (e) => ({
|
|
2343
|
+
viewId: r,
|
|
2344
|
+
before: e?.before ?? t,
|
|
2345
|
+
after: n
|
|
2346
|
+
}));
|
|
2347
|
+
}
|
|
2348
|
+
_resyncActiveSheet(e, t) {
|
|
2349
|
+
let n = t?.sheetRefsVisible;
|
|
2350
|
+
if (!n?.length) return;
|
|
2351
|
+
let r = -1, i = n.length;
|
|
2352
|
+
for (let t = 0; t < i; t++) if (n[t].id === e) {
|
|
2353
|
+
r = t;
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
|
|
2357
|
+
let a = n[r].id;
|
|
2358
|
+
this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
|
|
2359
|
+
}
|
|
2360
|
+
_adjustRemoveSelectionIfRequired(e, t) {
|
|
2361
|
+
if (this._view.getActiveSheetId() === t) {
|
|
2362
|
+
let t, n = this._getState().sheetRefsVisible;
|
|
2363
|
+
t = e < n.length ? n[e].id : n[e - 1].id, this._view.setActiveSheetId(t);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
_adjustSheetNamesIfRequired() {
|
|
2367
|
+
let e = this._getState(), t = e.lastId;
|
|
2368
|
+
if (t === -1) return;
|
|
2369
|
+
let n = this._view.getActiveSheetId();
|
|
2370
|
+
n ??= (this._view.setActiveSheetId(t), t);
|
|
2371
|
+
let r = e.refsById.get(n);
|
|
2372
|
+
r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === N.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
|
|
2373
|
+
}
|
|
2374
|
+
_validateDeleteSheet(e) {
|
|
2375
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2376
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2377
|
+
let n = this._getSheetRef(e);
|
|
2378
|
+
if (!n) throw new h(function(e) {
|
|
2379
|
+
return t("error.workbook.deleteKey", { key: e });
|
|
2380
|
+
}(e));
|
|
2381
|
+
let r = this._getState().sheetRefsVisible;
|
|
2382
|
+
if (r.length === 1 && r[0].id === n.id) throw new h(t("error.workbook.sheetOne"));
|
|
2383
|
+
}
|
|
2384
|
+
_getOffsetForId(e, n) {
|
|
2385
|
+
let r = n.length;
|
|
2386
|
+
for (let t = 0; t < r; t++) if (n[t].id === e) return t;
|
|
2387
|
+
throw new h(t("error.workbook.noVisibleRefs"));
|
|
2388
|
+
}
|
|
2389
|
+
find(e) {
|
|
2390
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2391
|
+
let n = this._getSheets();
|
|
2392
|
+
if (n.length === 1) return n[0].find(e);
|
|
2393
|
+
typeof e == "string" && (e = { text: e });
|
|
2394
|
+
let r = !e?.reverse, i = e?.disableWrap ?? !1, a = this.getSelectedSheetIndex(), o = a, s = n[o], c = !1;
|
|
2395
|
+
e = {
|
|
2396
|
+
...e,
|
|
2397
|
+
disableWrap: !0
|
|
2398
|
+
};
|
|
2399
|
+
let l, d = s.find(e), f = d.next(), p = !1;
|
|
2400
|
+
if (e?.from) {
|
|
2401
|
+
let t = this._rangesAddressToCoords(e?.from);
|
|
2402
|
+
l = {
|
|
2403
|
+
colIndex: t[0].colStart,
|
|
2404
|
+
rowIndex: t[0].rowStart
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
let m = u.createCellComparator(e?.axis, e?.reverse);
|
|
2408
|
+
delete (e = { ...e }).from;
|
|
2409
|
+
let h = () => {
|
|
2410
|
+
if (!p && f.done && (c && o === a ? p = !0 : r ? (o++, o > n.length - 1 && (o = 0, c = !0)) : (o--, o < 0 && (o = n.length - 1, c = !0)), i && c && (p = !0), p || l || !c || o !== a || (p = !0), !p)) {
|
|
2411
|
+
s = n[o], d = s.find(e);
|
|
2412
|
+
let t = f;
|
|
2413
|
+
return f = d.next(), t;
|
|
2414
|
+
}
|
|
2415
|
+
if (!p && c && o === a && (f.done || !l || !f.done && m(f.value.getCoords(), l) >= 0) && (p = !0), p) {
|
|
2416
|
+
let e = f;
|
|
2417
|
+
return f = we, e;
|
|
2418
|
+
}
|
|
2419
|
+
let t = f;
|
|
2420
|
+
return f = d.next(), t;
|
|
2421
|
+
};
|
|
2422
|
+
return { next: () => {
|
|
2423
|
+
let e = h();
|
|
2424
|
+
for (; !p && e.done;) e = h();
|
|
2425
|
+
return e;
|
|
2426
|
+
} };
|
|
2427
|
+
}
|
|
2428
|
+
replace(n, r, i) {
|
|
2429
|
+
let a = 0, o = null, s = typeof r == "function", c = i?.maxCount ?? 2 ** 53 - 1, l = !i?.maxCount, u = "", d = typeof r == "string" ? se(r) : null, f = i?.description ?? e("op.replace"), p = this._transactions.beginCommit({ description: f });
|
|
2430
|
+
try {
|
|
2431
|
+
let f = null, m = null, h = n.next();
|
|
2432
|
+
for (; !h.done && a < c;) {
|
|
2433
|
+
let e = h.value, t = e.getSheet();
|
|
2434
|
+
t !== f && (f = t, m !== null && m.apply(), m = f.getEntireRange().createSparseBuilder({
|
|
2435
|
+
axis: i?.axis,
|
|
2436
|
+
allowUnorderedWrites: !0
|
|
2437
|
+
}));
|
|
2438
|
+
let c = s ? r(e) : r;
|
|
2439
|
+
c !== void 0 && c !== e && (m.push(e, c), a++, o = e), h = n.next();
|
|
2440
|
+
}
|
|
2441
|
+
m?.apply(), a === 1 && c === 1 && o && (u = o.getAddress()), a === 0 ? p.rollback() : p.commit({ description: i?.description ?? (l ? d === null ? e("op.replaceAll") : t("op.replaceAllWith", { value: d }) : u ? d === null ? t("op.replaceAt", { address: u }) : t("op.replaceAtWith", {
|
|
2442
|
+
address: u,
|
|
2443
|
+
value: d
|
|
2444
|
+
}) : d === null ? e("op.replace") : t("op.replaceWith", { value: d })) });
|
|
2445
|
+
} catch (e) {
|
|
2446
|
+
throw p.rollback(), e;
|
|
2447
|
+
}
|
|
2448
|
+
return {
|
|
2449
|
+
count: a,
|
|
2450
|
+
last: o
|
|
2451
|
+
};
|
|
2452
|
+
}
|
|
2453
|
+
_nextSheetIndex(e, t = this._getSheetRefs()) {
|
|
2454
|
+
let n = t.length;
|
|
2455
|
+
return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) >= n - 1 ? 0 : e + 1);
|
|
2456
|
+
}
|
|
2457
|
+
_prevSheetIndex(e, t = this._getSheetRefs()) {
|
|
2458
|
+
let n = t.length;
|
|
2459
|
+
return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
|
|
2460
|
+
}
|
|
2461
|
+
getNextSheet(e) {
|
|
2462
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2463
|
+
let n = this._getSheetRefs();
|
|
2464
|
+
return n[this._nextSheetIndex(e, n)]?.sheet ?? null;
|
|
2465
|
+
}
|
|
2466
|
+
getPreviousSheet(e) {
|
|
2467
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2468
|
+
let n = this._getSheetRefs();
|
|
2469
|
+
return n[this._prevSheetIndex(e, n)]?.sheet ?? null;
|
|
2470
|
+
}
|
|
2471
|
+
async _duplicateSheet(e) {
|
|
2472
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2473
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2474
|
+
let n = this._getSheetRefs(), r = this.getSelectedSheetIndex(), i = null;
|
|
2475
|
+
if (e) {
|
|
2476
|
+
if (i = this._getSheetRef(e), !i) throw new h(X(i));
|
|
2477
|
+
} else i = n[r];
|
|
2478
|
+
if (!i) return null;
|
|
2479
|
+
let a = i.sheet, o = this._strings.beginPersist(), s = this.getResources().beginPersist(), c = this.getStyles().beginPersist(), l = null, u = this.beginCommit(t("op.duplicateNamed", { name: a.getName() }));
|
|
2480
|
+
try {
|
|
2481
|
+
let e = this._getState().refsByInstance.get(a), t = await a.toJSON(), i = n.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(i, o, e.visibility, r, void 0, t);
|
|
2482
|
+
this._emitter.notify("onSheetsChange"), l = s, u.commit();
|
|
2483
|
+
} catch (e) {
|
|
2484
|
+
throw u.rollback(), e;
|
|
2485
|
+
} finally {
|
|
2486
|
+
c.endPersist(), s.endPersist(), o.endPersist();
|
|
2487
|
+
}
|
|
2488
|
+
return l;
|
|
2489
|
+
}
|
|
2490
|
+
_createRange(e, n) {
|
|
2491
|
+
let r = e ? { ...e } : null, i = r ? this._getSheetRef(r.scope, N.Visibility.VeryHidden) : null;
|
|
2492
|
+
if (!i) {
|
|
2493
|
+
let e = this.getSelectedSheet();
|
|
2494
|
+
return e ? (delete r?.scope, an(r, r ? {
|
|
2495
|
+
scope: b,
|
|
2496
|
+
...e.getEntireRange().getCoords()
|
|
2497
|
+
} : null)) : void console.warn(t("error.workbook.noVisibleRefs"));
|
|
2498
|
+
}
|
|
2499
|
+
let a = i.sheet, o = null;
|
|
2500
|
+
return n && (o = { getOptions: n }), new ln(e, A(a), this, o);
|
|
2501
|
+
}
|
|
2502
|
+
_createRanges(e, t) {
|
|
2503
|
+
let n = this.getSelectedSheet(), r = null;
|
|
2504
|
+
return t && (r = { getOptions: t }), new Q(e, A(n), this, r);
|
|
2505
|
+
}
|
|
2506
|
+
getRange(e, n) {
|
|
2507
|
+
if (e === void 0) return this.getSelectedRange(n);
|
|
2508
|
+
try {
|
|
2509
|
+
let r = this._rangesAddressToCoords(e);
|
|
2510
|
+
if (r.length !== 1) throw new h(t("error.address.singleRangeOnlyAlt"));
|
|
2511
|
+
return this._createRange(r[0], n);
|
|
2512
|
+
} catch (t) {
|
|
2513
|
+
throw t instanceof r ? new r(t.message) : new h(t.message ?? ye(e));
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
getCell(e) {
|
|
2517
|
+
if (e === void 0) return this.getSelectedCell();
|
|
2518
|
+
let n = this.getRange(e);
|
|
2519
|
+
if (n.size > 1) throw new h(t("error.address.singleCellOnly"));
|
|
2520
|
+
return n.getCell();
|
|
2521
|
+
}
|
|
2522
|
+
getRanges(e, t) {
|
|
2523
|
+
let n = this._rangesAddressToCoords(e);
|
|
2524
|
+
if (n.length === 0) throw new h(ye(e));
|
|
2525
|
+
return this._createRanges(n, t);
|
|
2526
|
+
}
|
|
2527
|
+
_createGraphRanges(e, t) {
|
|
2528
|
+
let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
|
|
2529
|
+
for (let e = 0; e < t.length; e++) {
|
|
2530
|
+
let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, N.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
|
|
2531
|
+
a && n.push(new de(i, r, A(a), null));
|
|
2532
|
+
}
|
|
2533
|
+
for (let t = 0; t < e.length; t++) n.push(e[t]);
|
|
2534
|
+
return n.length === 0 ? null : new Q(n, A(this.getSelectedSheet()), this, null);
|
|
2535
|
+
}
|
|
2536
|
+
getStats(e) {
|
|
2537
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2538
|
+
let n = this._getSheets(N.Visibility.VeryHidden), r = n.length;
|
|
2539
|
+
if (r === 1) return n[0].getStats(e);
|
|
2540
|
+
let i = Array(r);
|
|
2541
|
+
for (let t = 0; t < r; t++) i[t] = n[t].getStats(e);
|
|
2542
|
+
return new Bt(i);
|
|
2543
|
+
}
|
|
2544
|
+
_activeRangeCoords() {
|
|
2545
|
+
let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
|
|
2546
|
+
for (let e = 0; e < r; e++) {
|
|
2547
|
+
let r = t[e];
|
|
2548
|
+
i[e] = {
|
|
2549
|
+
colStart: r.colStart,
|
|
2550
|
+
colEnd: r.colEnd,
|
|
2551
|
+
rowStart: r.rowStart,
|
|
2552
|
+
rowEnd: r.rowEnd,
|
|
2553
|
+
scope: n
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
return i;
|
|
2557
|
+
}
|
|
2558
|
+
getSelectedRange(e) {
|
|
2559
|
+
return this.getRange(this._activeRangeCoords()[0], e);
|
|
2560
|
+
}
|
|
2561
|
+
getSelectedRanges(e) {
|
|
2562
|
+
return this.getRanges(this._activeRangeCoords(), e);
|
|
2563
|
+
}
|
|
2564
|
+
getSelectedCell() {
|
|
2565
|
+
return this.getSelectedSheet().getSelectedCell();
|
|
2566
|
+
}
|
|
2567
|
+
_rangesAddressToCoords(e, n = !0, r = N.Visibility.Hidden) {
|
|
2568
|
+
if (!e) throw new h(t("error.address.noAddress"));
|
|
2569
|
+
let i = this.getSelectedSheet(), a = { ...i?.getEntireRange().getCoords() }, o = i?.getName();
|
|
2570
|
+
if (o && (a.scope = o), typeof e == "string") {
|
|
2571
|
+
let t = e.trim().toLowerCase();
|
|
2572
|
+
if (t === "r" || t === "c") {
|
|
2573
|
+
let n = this.getSelectedCell().getCoords(), r = {};
|
|
2574
|
+
t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
let s = this, c = Qe(e, a, $e, (e) => {
|
|
2578
|
+
if (!n) return null;
|
|
2579
|
+
if (typeof e == "string") {
|
|
2580
|
+
let t = s.getNames().getByName(e)?.getRanges?.();
|
|
2581
|
+
if (t) return t.getCoords();
|
|
2582
|
+
}
|
|
2583
|
+
throw new h(`Invalid sheet reference '${e}'.`);
|
|
2584
|
+
}), l = c.length;
|
|
2585
|
+
for (let e = 0; e < l; e++) this._validateCoords(c[e], r);
|
|
2586
|
+
return c;
|
|
2587
|
+
}
|
|
2588
|
+
_validateCoords(e, n = N.Visibility.Visible, i = t("error.sheet.oobRange")) {
|
|
2589
|
+
if (e === null) return;
|
|
2590
|
+
let a = this.getSheet(e.scope, n).getEntireRange().getCoords();
|
|
2591
|
+
if (!u.isRangeWithinRange(e, a)) throw new r(i);
|
|
2592
|
+
if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new h(t("error.address.invalidRangeInverted"));
|
|
2593
|
+
}
|
|
2594
|
+
_updateSheetRef(e, t) {
|
|
2595
|
+
let n = this._getState(), r = [...n.sheetRefsAll];
|
|
2596
|
+
r[this._getOffsetForId(e.id, n.sheetRefsAll)] = t, this._updateSheetRefStates(r);
|
|
2597
|
+
let i = new Map(n.refsById);
|
|
2598
|
+
i.set(e.id, t);
|
|
2599
|
+
let a = e.name.toLowerCase(), o = t.name.toLowerCase(), s = new Map(n.refsByLowerCaseName);
|
|
2600
|
+
s.delete(a), s.set(o, t);
|
|
2601
|
+
let c = new Map(n.sheetsByLowerCaseName), l = c.get(a);
|
|
2602
|
+
c.delete(a), c.set(o, l);
|
|
2603
|
+
let u = new Map(n.refsByInstance);
|
|
2604
|
+
return u.set(l, t), this._updateState({
|
|
2605
|
+
refsById: i,
|
|
2606
|
+
refsByLowerCaseName: s,
|
|
2607
|
+
sheetsByLowerCaseName: c,
|
|
2608
|
+
refsByInstance: u
|
|
2609
|
+
}), t;
|
|
2610
|
+
}
|
|
2611
|
+
_setSheetName(n, r, i) {
|
|
2612
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2613
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2614
|
+
let a = this._getSheetRef(n);
|
|
2615
|
+
if (!a) throw new h(X(n));
|
|
2616
|
+
if (r === a.name) return a.sheet;
|
|
2617
|
+
if ((r = this._validateNewSheetName(r)) == null) throw new h(t("error.workbook.sheetNameNotProvided"));
|
|
2618
|
+
let o = Object.freeze({
|
|
2619
|
+
...a,
|
|
2620
|
+
name: r
|
|
2621
|
+
}), s = null, c = this.beginCommit(e("op.renameSheet"));
|
|
2622
|
+
try {
|
|
2623
|
+
let e = this._updateSheetRef(a, o);
|
|
2624
|
+
this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
|
|
2625
|
+
a.id === t && e();
|
|
2626
|
+
}), this._emitter.notify("onSheetsChange"), a.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), s = e.sheet, c.commit(i);
|
|
2627
|
+
} catch (e) {
|
|
2628
|
+
throw c.rollback(), e;
|
|
2629
|
+
}
|
|
2630
|
+
return s;
|
|
2631
|
+
}
|
|
2632
|
+
_setSheetVisibility(n, r = N.Visibility.Visible, i) {
|
|
2633
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2634
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2635
|
+
let a = this._getSheetRef(n, N.Visibility.VeryHidden);
|
|
2636
|
+
if (!a) return null;
|
|
2637
|
+
if (r === a.visibility) return;
|
|
2638
|
+
let o = null, s = "";
|
|
2639
|
+
r === N.Visibility.Visible ? s = e("op.unhideSheet") : r === N.Visibility.Hidden ? s = e("op.hideSheet") : r === N.Visibility.VeryHidden && (s = e("op.veryHideSheet"));
|
|
2640
|
+
let c = this.beginCommit(s);
|
|
2641
|
+
try {
|
|
2642
|
+
let e = this._getState().sheetRefsVisible;
|
|
2643
|
+
if (r !== N.Visibility.Visible && e.length === 1 && e[0].id === a.id) throw new h(t("error.workbook.sheetOne"));
|
|
2644
|
+
let n = {
|
|
2645
|
+
...a,
|
|
2646
|
+
visibility: r
|
|
2647
|
+
}, s = -1;
|
|
2648
|
+
r !== N.Visibility.Visible && (s = this._getOffsetForId(a.id, e)), o = this._updateSheetRef(a, n).sheet, r !== N.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, a.id), this._adjustSheetNamesIfRequired(), c.commit(i);
|
|
2649
|
+
} catch (e) {
|
|
2650
|
+
throw c.rollback(), e;
|
|
2651
|
+
}
|
|
2652
|
+
return this._sheetOnVisibilityChange.forEach((e, t) => {
|
|
2653
|
+
a.id === t && e();
|
|
2654
|
+
}), this._emitter.notify("onSheetsChange"), o;
|
|
2655
|
+
}
|
|
2656
|
+
_moveSheet(e, n, r) {
|
|
2657
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2658
|
+
if (!this.getProtection().isStructureAllowed()) throw new f(t("error.workbook.protection"));
|
|
2659
|
+
let i = null, a = this.beginCommit(t("op.moveSheetNamed", { name: e.name }));
|
|
2660
|
+
try {
|
|
2661
|
+
let t = this._getState(), o = t.sheetRefsVisible;
|
|
2662
|
+
if (n < 0 || n > o.length - 1) throw new h(`Invalid to index: ${n}`);
|
|
2663
|
+
let s = this.getView().getActiveSheetId(), c = t.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[n].id, c);
|
|
2664
|
+
if (l === u) return;
|
|
2665
|
+
let d = c[l], f = [...c];
|
|
2666
|
+
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) => {
|
|
2667
|
+
t >= l && t <= u && e();
|
|
2668
|
+
}), this._emitter.notify("onSheetsChange"), i = d.sheet, this._recordActiveSheet(a, s, this.getView().getActiveSheetId()), a.commit(r);
|
|
2669
|
+
} catch (e) {
|
|
2670
|
+
throw a.rollback(), e;
|
|
2671
|
+
}
|
|
2672
|
+
return i;
|
|
2673
|
+
}
|
|
2674
|
+
_setSelectedSheet(e) {
|
|
2675
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2676
|
+
let n = this._getSheetRef(e);
|
|
2677
|
+
if (!n) throw new h(X(e));
|
|
2678
|
+
let r = null;
|
|
2679
|
+
return n.visibility !== N.Visibility.Visible && this._setSheetVisibility(n, N.Visibility.Visible), this._view.setActiveSheetId(n.id), r = n.sheet, r;
|
|
2680
|
+
}
|
|
2681
|
+
getProtection() {
|
|
2682
|
+
return this._protection;
|
|
2683
|
+
}
|
|
2684
|
+
getCodeName() {
|
|
2685
|
+
return this._codeName;
|
|
2686
|
+
}
|
|
2687
|
+
getNames() {
|
|
2688
|
+
return this._names;
|
|
2689
|
+
}
|
|
2690
|
+
getCalculation() {
|
|
2691
|
+
return this._calculation;
|
|
2692
|
+
}
|
|
2693
|
+
createFormula(e, t, n) {
|
|
2694
|
+
return this.getCalculation().createFormula(e, t, n);
|
|
2695
|
+
}
|
|
2696
|
+
evaluate(e, t) {
|
|
2697
|
+
return this.getCalculation().evaluate(e, t);
|
|
2698
|
+
}
|
|
2699
|
+
whenCalculationReady() {
|
|
2700
|
+
let e = this._starting;
|
|
2701
|
+
return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
|
|
2702
|
+
}
|
|
2703
|
+
getScripts() {
|
|
2704
|
+
return this._scripts ||= this._createScripts(), this._scripts;
|
|
2705
|
+
}
|
|
2706
|
+
getModules() {
|
|
2707
|
+
return this.getScripts().getModules();
|
|
2708
|
+
}
|
|
2709
|
+
_notifyAllChange() {
|
|
2710
|
+
this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
|
|
2711
|
+
}
|
|
2712
|
+
addListeners(e, t) {
|
|
2713
|
+
return this._emitter.addListeners(e, t);
|
|
2714
|
+
}
|
|
2715
|
+
_sheetToWBEvent(e) {
|
|
2716
|
+
let t = this;
|
|
2717
|
+
return (n) => {
|
|
2718
|
+
let r = () => {
|
|
2719
|
+
let e = n.getSource();
|
|
2720
|
+
if (e.isInvalid()) return e;
|
|
2721
|
+
if (e.isICellRanges) {
|
|
2722
|
+
let n = [...e.getCoords()], r = n.length;
|
|
2723
|
+
for (let t = 0; t < r; t++) {
|
|
2724
|
+
let r = n[t];
|
|
2725
|
+
!r.scope && e.getSheet().getName() && (n[t] = {
|
|
2726
|
+
...r,
|
|
2727
|
+
scope: e.getSheet().getName()
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
return t.getRanges(n);
|
|
2731
|
+
}
|
|
2732
|
+
if (e.isICellRange) {
|
|
2733
|
+
let n = e.getCoords(), r = e.getSheet().getName();
|
|
2734
|
+
return t.getRange({
|
|
2735
|
+
...n,
|
|
2736
|
+
scope: r
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
e({
|
|
2741
|
+
getSource: r,
|
|
2742
|
+
trigger: n.trigger,
|
|
2743
|
+
getFrom: () => t.getRanges(n.getFrom()),
|
|
2744
|
+
getTo: () => t.getRange(n.getTo()),
|
|
2745
|
+
isDataChange: n.isDataChange,
|
|
2746
|
+
getTransactionId: n.getTransactionId,
|
|
2747
|
+
isUndo: n.isUndo,
|
|
2748
|
+
toString: () => `WorkbookRangeEvent: ('${n.trigger}', ${r().toString()})`,
|
|
2749
|
+
timeStamp: Date.now()
|
|
2750
|
+
});
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
_fromJSON(e) {
|
|
2754
|
+
if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new h(t("error.workbook.sheetOne"));
|
|
2755
|
+
e.theme && (this._theme = new re(e.theme), this._styles.setTheme(this._theme));
|
|
2756
|
+
let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
|
|
2757
|
+
try {
|
|
2758
|
+
n.fromJSON(e.strings), r.fromJSON(e.resources), i.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
|
|
2759
|
+
let t = [], a = e.pivotCaches;
|
|
2760
|
+
if (a) {
|
|
2761
|
+
let e = r.fromResourceId.bind(r);
|
|
2762
|
+
for (let n = 0; n < a.length; n++) {
|
|
2763
|
+
let r = a[n];
|
|
2764
|
+
r && typeof r.cacheId == "number" && t.push({
|
|
2765
|
+
cacheId: r.cacheId,
|
|
2766
|
+
part: Xe.fromJSON(r.part, e)
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
this._pivotCaches = t, this._people.fromJSON(e.people);
|
|
2771
|
+
let o = e.sheets, s = o.length, c = e.view.activeSheetId ?? null;
|
|
2772
|
+
c !== null && (c = Math.min(Math.max(0, c), s - 1));
|
|
2773
|
+
let l = null, u = null;
|
|
2774
|
+
this._isLoadingSheets = !0;
|
|
2775
|
+
for (let e = 0; e < s; e++) {
|
|
2776
|
+
let t = o[e], n = t.visibility || N.Visibility.Visible, r = e;
|
|
2777
|
+
u = r, n === N.Visibility.Visible ? l === null && (l = r) : c !== null && c === r && (c = null);
|
|
2778
|
+
try {
|
|
2779
|
+
this._createSheet(r, t.name, n, e, t.sheetId, t.sheet);
|
|
2780
|
+
} catch (e) {
|
|
2781
|
+
throw this._isLoadingSheets = !1, e;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
this._isLoadingSheets = !1, this._updateState({ lastId: u }), e.view.activeSheetId = c ?? l, this.setView(new Yt({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
|
|
2785
|
+
let d = this;
|
|
2786
|
+
this._protection = new Y(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
|
|
2787
|
+
d._emitter.notify("onProtectionChange", { source: e });
|
|
2788
|
+
} }), this._emitter.notify("onLoad");
|
|
2789
|
+
} finally {
|
|
2790
|
+
i.endPersist(), r.endPersist(), n.endPersist();
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
_createScripts(e) {
|
|
2794
|
+
let t = this;
|
|
2795
|
+
return new Gt({
|
|
2796
|
+
transactions: this._transactions,
|
|
2797
|
+
json: e,
|
|
2798
|
+
workbook: t,
|
|
2799
|
+
getBuiltInFunctions: () => t._calculation?.getFunctions(),
|
|
2800
|
+
onAdd: (e, n) => {
|
|
2801
|
+
let r = t._calculation;
|
|
2802
|
+
r.getStatus() !== le.Status.Off && r.start().then(async () => {
|
|
2803
|
+
let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
|
|
2804
|
+
for (let n = 0; n < t; n++) {
|
|
2805
|
+
let t = e[n];
|
|
2806
|
+
try {
|
|
2807
|
+
await this._calculation.getFunctions().add(t);
|
|
2808
|
+
} catch (e) {
|
|
2809
|
+
d.error(e?.message ?? String(e), e);
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
}).catch(() => {});
|
|
2813
|
+
},
|
|
2814
|
+
onRemove: (e, t) => {}
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
async toJSON(e) {
|
|
2818
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2819
|
+
await Promise.resolve(this._starting);
|
|
2820
|
+
let n = this.getCalculation();
|
|
2821
|
+
n.getStatus() !== le.Status.Off && (await n.ready(), await n._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
|
|
2822
|
+
let r = { sheets: [] }, i = e?.ignoreStyles ?? !1;
|
|
2823
|
+
if (!i) {
|
|
2824
|
+
let e = this._theme.toJSON();
|
|
2825
|
+
(e ? Object.keys(e).length : 0) > 0 && (r.theme = e);
|
|
2826
|
+
}
|
|
2827
|
+
if (this._scripts) {
|
|
2828
|
+
let e = this._scripts.toJSON();
|
|
2829
|
+
e && Object.keys(e).length > 0 && (r.modules = e);
|
|
2830
|
+
}
|
|
2831
|
+
this._isDate1904 && (r.date1904 = !0), this._codeName && (r.codeName = this._codeName), this._updateLinks && (r.updateLinks = this._updateLinks), this._locale && (r.locale = this._locale), this._localeOverrides && (r.localeOverrides = this._localeOverrides);
|
|
2832
|
+
let a = e?.resources ?? "embed", o = a === "ignore", s = this._strings.beginPersist(), c = o ? null : this._resources.beginPersist(), l = this._styles.beginPersist();
|
|
2833
|
+
try {
|
|
2834
|
+
let t = this._getSheetRef(this.getSelectedSheetIndex()).id, n = t, u = null, d = this._getState(), f = d.sheetRefsAll, p = d.sheetsById, m = f.length;
|
|
2835
|
+
for (let i = 0; i < m; i++) {
|
|
2836
|
+
let a = f[i], o = i + 1, s = await p.get(a.id).toJSON(e), c = {
|
|
2837
|
+
name: a.name,
|
|
2838
|
+
sheet: s
|
|
2839
|
+
};
|
|
2840
|
+
a.sheetId !== void 0 && (c.sheetId = a.sheetId), a.visibility === N.Visibility.Visible ? u === null && (u = o) : c.visibility = a.visibility, a.id === t && (n = o), r.sheets.push(c);
|
|
2841
|
+
}
|
|
2842
|
+
if (!i) {
|
|
2843
|
+
let e = l.toJSON();
|
|
2844
|
+
e && Object.keys(e).length > 0 && (r.styles = e);
|
|
2845
|
+
}
|
|
2846
|
+
let h = this.getProtection().toJSON();
|
|
2847
|
+
h && (r.protection = h);
|
|
2848
|
+
let g = this._calculation.toJSON();
|
|
2849
|
+
Object.keys(g).length > 0 && (r.calc = g);
|
|
2850
|
+
let _ = await s.toJSONAsync();
|
|
2851
|
+
_ && _.length > 0 && (r.strings = _);
|
|
2852
|
+
let v = this._calculation.getExternalBooks().toJSON();
|
|
2853
|
+
v && (r.externalBooks = v);
|
|
2854
|
+
let y = this._pivotCaches;
|
|
2855
|
+
if (y.length > 0) {
|
|
2856
|
+
let e = c ? c.toResourceId.bind(c) : () => null, t = [];
|
|
2857
|
+
for (let n = 0; n < y.length; n++) {
|
|
2858
|
+
let r = { cacheId: y[n].cacheId }, i = Xe.toJSON(y[n].part, e);
|
|
2859
|
+
i && (r.part = i), t.push(r);
|
|
2860
|
+
}
|
|
2861
|
+
t.length > 0 && (r.pivotCaches = t);
|
|
2862
|
+
}
|
|
2863
|
+
let b = this._people.toJSON();
|
|
2864
|
+
if (b && (r.people = b), !o) {
|
|
2865
|
+
let e = await c.toJSONAsync(typeof a == "function" ? a : void 0);
|
|
2866
|
+
e && e.length > 0 && (r.resources = e);
|
|
2867
|
+
}
|
|
2868
|
+
let x = this._calculation.getNamedFormulas().toJSON();
|
|
2869
|
+
x && x.length > 0 && (r.names = x);
|
|
2870
|
+
let S = this._view.toJSON();
|
|
2871
|
+
S && (n === u ? delete S.activeSheetId : S.activeSheetId = n, Object.keys(S).length > 0 && (r.view = S));
|
|
2872
|
+
} finally {
|
|
2873
|
+
l.endPersist(), o || c.endPersist(), s.endPersist();
|
|
2874
|
+
}
|
|
2875
|
+
return this._emitter.notify("onSave", { params: r }), r;
|
|
2876
|
+
}
|
|
2877
|
+
isClosed() {
|
|
2878
|
+
return this._closed;
|
|
2879
|
+
}
|
|
2880
|
+
close() {
|
|
2881
|
+
if (this._closed) return;
|
|
2882
|
+
this._emitter.notify("onClose");
|
|
2883
|
+
let e = this._getState();
|
|
2884
|
+
e.listenersSheets.forEach((e) => {
|
|
2885
|
+
e();
|
|
2886
|
+
}), e.listenersSheets.clear();
|
|
2887
|
+
let t = e.sheetRefsAll;
|
|
2888
|
+
for (let e = t.length - 1; e >= 0; e--) try {
|
|
2889
|
+
t[e].sheet.close();
|
|
2890
|
+
} catch (e) {
|
|
2891
|
+
console.warn("error on close", e);
|
|
2892
|
+
}
|
|
2893
|
+
this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof at && this._originProvider.release(), this._closed = !0;
|
|
2894
|
+
}
|
|
2895
|
+
beginCommit(e) {
|
|
2896
|
+
if (this._closed) throw Error(t("error.workbook.modelClosed"));
|
|
2897
|
+
return this._beginCommit(typeof e == "string" ? { description: e } : e);
|
|
2898
|
+
}
|
|
2899
|
+
doBatch(t, n) {
|
|
2900
|
+
let r = this;
|
|
2901
|
+
return n = typeof n == "string" ? { description: n } : {
|
|
2902
|
+
description: e("op.updateWorkbook"),
|
|
2903
|
+
...n
|
|
2904
|
+
}, this._transactions.doBatch(t, n, (e, t) => {
|
|
2905
|
+
e.getDepth() === 0 && (r._lastTransactionUUID = e.getId());
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
_beginCommit(e) {
|
|
2909
|
+
let t = this;
|
|
2910
|
+
return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e, (e) => {
|
|
2911
|
+
e.getDepth() === 0 && (t._lastTransactionUUID = e.getId());
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
_getState() {
|
|
2915
|
+
return this._transactions.getState(this._id);
|
|
2916
|
+
}
|
|
2917
|
+
_updateState(t, n = e("op.updateWorkbook"), r) {
|
|
2918
|
+
if (!t) return;
|
|
2919
|
+
let i = this._beginCommit(n);
|
|
2920
|
+
try {
|
|
2921
|
+
i.updateState(this._id, t), i.commit(r);
|
|
2922
|
+
} catch (e) {
|
|
2923
|
+
throw i.rollback(), e;
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
get options() {
|
|
2927
|
+
return this._options;
|
|
2928
|
+
}
|
|
2929
|
+
get [Symbol.toStringTag]() {
|
|
2930
|
+
return "[Workbook]";
|
|
2931
|
+
}
|
|
2932
|
+
toString() {
|
|
2933
|
+
return `[${this.getName() ?? "(untitled)"}]`;
|
|
2934
|
+
}
|
|
2935
|
+
get isIWorkbook() {
|
|
2936
|
+
return !0;
|
|
2937
|
+
}
|
|
2938
|
+
}, fn = { address: null }, pn = class {
|
|
2939
|
+
constructor() {
|
|
2940
|
+
this._readFormats = [], this._writeFormats = [], this._encryptions = [];
|
|
2941
|
+
}
|
|
2942
|
+
async registerReadFormat(e) {
|
|
2943
|
+
this._readFormats = await this._registerFormatType(e, this._readFormats);
|
|
2944
|
+
}
|
|
2945
|
+
async registerWriteFormat(e) {
|
|
2946
|
+
this._writeFormats = await this._registerFormatType(e, this._writeFormats);
|
|
2947
|
+
}
|
|
2948
|
+
async registerEncryption(e) {
|
|
2949
|
+
if (!e) throw Error("encryption must be provided.");
|
|
2950
|
+
if (!e.key) throw Error("encryption.key must be provided.");
|
|
2951
|
+
let t = e.key.toLowerCase(), n = this._encryptions.findIndex((e) => e.key.toLowerCase() === t);
|
|
2952
|
+
if (n !== -1) {
|
|
2953
|
+
let t = [...this._encryptions];
|
|
2954
|
+
t[n] = e, this._encryptions = Object.freeze(t);
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
this._encryptions = Object.freeze([...this._encryptions, e]);
|
|
2958
|
+
}
|
|
2959
|
+
async getEncryption(e) {
|
|
2960
|
+
return this.peekEncryption(e);
|
|
2961
|
+
}
|
|
2962
|
+
peekEncryption(e) {
|
|
2963
|
+
if (!e) return this._encryptions[0] ?? null;
|
|
2964
|
+
let t = e.toLowerCase();
|
|
2965
|
+
return this._encryptions.find((e) => e.key.toLowerCase() === t) ?? null;
|
|
2966
|
+
}
|
|
2967
|
+
async detectEncryption(e) {
|
|
2968
|
+
for (let t of this._encryptions) if (await t.detect(e)) return t;
|
|
2969
|
+
return null;
|
|
2970
|
+
}
|
|
2971
|
+
async getReadFormats(e) {
|
|
2972
|
+
return e ? this._filterFormats(e, this._readFormats) : [...this._readFormats];
|
|
2973
|
+
}
|
|
2974
|
+
async getWriteFormats(e) {
|
|
2975
|
+
return this._writeFormats ? e ? this._filterFormats(e, this._writeFormats) : [...this._writeFormats] : [];
|
|
2976
|
+
}
|
|
2977
|
+
async _registerFormatType(e, t) {
|
|
2978
|
+
return this._registerFormatTypeSync(e, t);
|
|
2979
|
+
}
|
|
2980
|
+
_registerFormatTypeSync(e, t) {
|
|
2981
|
+
if (!e) throw Error("format must be provided.");
|
|
2982
|
+
if (!e.key) throw Error("format.key must be provided.");
|
|
2983
|
+
let n = e.key.toLowerCase(), r = t.findIndex((e) => e.key.toLowerCase() === n);
|
|
2984
|
+
if (r !== -1) {
|
|
2985
|
+
let n = [...t];
|
|
2986
|
+
return n[r] = e, Object.freeze(n);
|
|
2987
|
+
}
|
|
2988
|
+
return Object.freeze([...t, e]);
|
|
2989
|
+
}
|
|
2990
|
+
_filterFormats(e, t, n) {
|
|
2991
|
+
if (!e || Object.keys(e).length === 0) {
|
|
2992
|
+
if (!n) return [...t];
|
|
2993
|
+
e = { ext: n };
|
|
2994
|
+
}
|
|
2995
|
+
let r = e.search?.toLocaleLowerCase();
|
|
2996
|
+
return t.filter((t) => {
|
|
2997
|
+
if (r) {
|
|
2998
|
+
let e = t.key.toLocaleLowerCase().includes(r), n = !!t.exts && t.exts.some((e) => e.toLocaleLowerCase().includes(r)), i = !!t.mimeType && t.mimeType.toLocaleLowerCase().includes(r), a = !!t.tags && t.tags.some((e) => e.toLocaleLowerCase().includes(r)), o = !!t.description && t.description.toLocaleLowerCase().includes(r);
|
|
2999
|
+
if (!(e || n || i || a || o)) return !1;
|
|
3000
|
+
}
|
|
3001
|
+
let i = e.ext || n;
|
|
3002
|
+
if (i) {
|
|
3003
|
+
let e = i.toLocaleLowerCase();
|
|
3004
|
+
if (!t.exts.some((t) => t.toLocaleLowerCase() === e)) return !1;
|
|
3005
|
+
}
|
|
3006
|
+
if (e.mimeType && t.mimeType !== e.mimeType || e.key && t.key.toLocaleLowerCase() !== e.key.toLocaleLowerCase()) return !1;
|
|
3007
|
+
if (e.tags) {
|
|
3008
|
+
let n = t.tags || [];
|
|
3009
|
+
if (!(typeof e.tags == "string" ? [e.tags] : e.tags).every((e) => n.includes(e))) return !1;
|
|
3010
|
+
}
|
|
3011
|
+
return !0;
|
|
3012
|
+
});
|
|
3013
|
+
}
|
|
3014
|
+
}, $ = /* @__PURE__ */ new WeakMap(), mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", hn = new class {
|
|
3015
|
+
constructor() {
|
|
3016
|
+
this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new x(this), this._registry = new pn(), this._defaultStore = new st(() => this.getWriteFormats(), () => this.getReadFormats());
|
|
3017
|
+
}
|
|
3018
|
+
getBackingStore() {
|
|
3019
|
+
return this._backingStore ?? this._defaultStore;
|
|
3020
|
+
}
|
|
3021
|
+
setBackingStore(e) {
|
|
3022
|
+
this._backingStore = e ?? null;
|
|
3023
|
+
}
|
|
3024
|
+
canWrite() {
|
|
3025
|
+
return typeof this.getBackingStore().write == "function";
|
|
3026
|
+
}
|
|
3027
|
+
canRead() {
|
|
3028
|
+
return typeof this.getBackingStore().read == "function";
|
|
3029
|
+
}
|
|
3030
|
+
async install(e) {
|
|
3031
|
+
this._setInstalled.has(e) || (await e.register(this._registry), this._setInstalled.add(e));
|
|
3032
|
+
}
|
|
3033
|
+
addListeners(e, t) {
|
|
3034
|
+
return this._emitter.addListeners(e, t);
|
|
3035
|
+
}
|
|
3036
|
+
addCommitListener(e) {
|
|
3037
|
+
return this._emitter.addListeners({ onWrite: (t, n) => {
|
|
3038
|
+
n.save && e.onCommit?.({
|
|
3039
|
+
store: n.workbook.getTransactions(),
|
|
3040
|
+
commitId: n.commitId
|
|
3041
|
+
});
|
|
3042
|
+
} });
|
|
3043
|
+
}
|
|
3044
|
+
async getReadFormats(e) {
|
|
3045
|
+
return this._registry.getReadFormats(e);
|
|
3046
|
+
}
|
|
3047
|
+
async getWriteFormats(e) {
|
|
3048
|
+
return this._registry.getWriteFormats(e);
|
|
3049
|
+
}
|
|
3050
|
+
getOrigin(e) {
|
|
3051
|
+
return new R(e);
|
|
3052
|
+
}
|
|
3053
|
+
async read(e) {
|
|
3054
|
+
let t = null;
|
|
3055
|
+
if (typeof e == "string") e = { source: e };
|
|
3056
|
+
else if (mn(e)) {
|
|
3057
|
+
let n = e.getPath();
|
|
3058
|
+
if (!n) throw Error("Cannot read from an unbound origin (no path).");
|
|
3059
|
+
rt(e) ? e = {
|
|
3060
|
+
source: n,
|
|
3061
|
+
asCopy: !0
|
|
3062
|
+
} : (t = e, e = { source: n });
|
|
3063
|
+
}
|
|
3064
|
+
let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
|
|
3065
|
+
return (a.read ? a : this._defaultStore).read({
|
|
3066
|
+
source: r,
|
|
3067
|
+
options: i,
|
|
3068
|
+
decode: (e, r) => this._decodeBuffer(e, r, n, t)
|
|
3069
|
+
});
|
|
3070
|
+
}
|
|
3071
|
+
async _decodeBuffer(e, n = {}, r, i = null) {
|
|
3072
|
+
let a = n.format, o = n.ext;
|
|
3073
|
+
if (!a && !o) throw Error("Either format or file extension must be provided to determine read type.");
|
|
3074
|
+
let s = (await this._registry.getReadFormats({
|
|
3075
|
+
search: a,
|
|
3076
|
+
ext: o
|
|
3077
|
+
}))[0];
|
|
3078
|
+
if (!s) throw new h(t("error.io.readFormatUnavailable", { format: a ?? o }));
|
|
3079
|
+
let c = r?.typedCreateWorkbookOptions, l = c ? Object.keys(c).find((e) => e.toLowerCase() === s.key.toLowerCase()) : void 0, u = {
|
|
3080
|
+
...r,
|
|
3081
|
+
...l === void 0 ? void 0 : c[l]
|
|
3082
|
+
};
|
|
3083
|
+
delete u.typedCreateWorkbookOptions, delete u.source, delete u.asCopy;
|
|
3084
|
+
let d = i ?? new R(n.absolutePath ?? null, {
|
|
3085
|
+
name: n.name ?? null,
|
|
3086
|
+
format: s.key,
|
|
3087
|
+
size: n.size ?? null,
|
|
3088
|
+
lastModified: n.lastModified ?? null,
|
|
3089
|
+
canWrite: n.canWrite ?? !1
|
|
3090
|
+
});
|
|
3091
|
+
i instanceof R && i.update({
|
|
3092
|
+
format: s.key,
|
|
3093
|
+
size: n.size ?? null,
|
|
3094
|
+
lastModified: n.lastModified ?? null
|
|
3095
|
+
}), u.createWorkbookOptions = {
|
|
3096
|
+
...u.createWorkbookOptions || {},
|
|
3097
|
+
origin: d
|
|
3098
|
+
}, u.readonly !== void 0 && (u.createWorkbookOptions = {
|
|
3099
|
+
readonly: u.readonly,
|
|
3100
|
+
...u.createWorkbookOptions
|
|
3101
|
+
}, delete u.readonly), u.calcOnly && (u.createWorkbookOptions = {
|
|
3102
|
+
disableLoadAutoFit: !0,
|
|
3103
|
+
...u.createWorkbookOptions
|
|
3104
|
+
});
|
|
3105
|
+
let f = await this._decrypt(e, d, u);
|
|
3106
|
+
if (f === null) return null;
|
|
3107
|
+
e = f.bytes;
|
|
3108
|
+
let p = u?.progress?.onStart?.bind(u.progress);
|
|
3109
|
+
p && await Promise.resolve(p(d, n.size));
|
|
3110
|
+
try {
|
|
3111
|
+
let t = await this._readArrayBuffer(e, s, u);
|
|
3112
|
+
return f.password !== null && d.setPassword(f.password), u?.progress?.onComplete?.(d), this._emitter.notify("onRead", {
|
|
3113
|
+
params: {
|
|
3114
|
+
workbook: t,
|
|
3115
|
+
origin: d
|
|
3116
|
+
},
|
|
3117
|
+
transactional: !1
|
|
3118
|
+
}), t;
|
|
3119
|
+
} catch (e) {
|
|
3120
|
+
throw u?.progress?.onError?.(e), u?.progress?.onComplete?.(null), e;
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
async _decrypt(e, n, r) {
|
|
3124
|
+
let i = await this._registry.detectEncryption(e);
|
|
3125
|
+
if (n instanceof R && n.update({ encryption: i ? i.key : null }), !i) return {
|
|
3126
|
+
bytes: e,
|
|
3127
|
+
password: null
|
|
3128
|
+
};
|
|
3129
|
+
let a = null, o = async (t) => {
|
|
3130
|
+
try {
|
|
3131
|
+
return a = await i.decode(e, t), !0;
|
|
3132
|
+
} catch (e) {
|
|
3133
|
+
if (!(e instanceof p)) throw e;
|
|
3134
|
+
return !1;
|
|
3135
|
+
}
|
|
3136
|
+
};
|
|
3137
|
+
if (r?.password && await o(r.password)) return {
|
|
3138
|
+
bytes: a,
|
|
3139
|
+
password: r.password
|
|
3140
|
+
};
|
|
3141
|
+
if (!r?.onPassword) {
|
|
3142
|
+
let e = n.getName();
|
|
3143
|
+
throw new c(e ? t("error.io.passwordRequired", { name: e }) : t("error.io.passwordRequiredUnnamed"));
|
|
3144
|
+
}
|
|
3145
|
+
let s = await Promise.resolve(r.onPassword({
|
|
3146
|
+
origin: n,
|
|
3147
|
+
encryption: i.key,
|
|
3148
|
+
validate: o
|
|
3149
|
+
}));
|
|
3150
|
+
if (s == null) return null;
|
|
3151
|
+
if (a !== null || await o(s)) return {
|
|
3152
|
+
bytes: a,
|
|
3153
|
+
password: s
|
|
3154
|
+
};
|
|
3155
|
+
throw new p(t("error.io.passwordIncorrect"));
|
|
3156
|
+
}
|
|
3157
|
+
async writeArrayBuffer(e, n) {
|
|
3158
|
+
if (!n?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
|
|
3159
|
+
let r = (await this._registry.getWriteFormats({ search: n.format }))[0];
|
|
3160
|
+
if (!r) throw new h(t("error.io.writeFormatUnavailable", { format: n.format }));
|
|
3161
|
+
return this._writeArrayBuffer(e, r, n);
|
|
3162
|
+
}
|
|
3163
|
+
async write(e, t, n) {
|
|
3164
|
+
return typeof t == "string" || mn(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
|
|
3165
|
+
}
|
|
3166
|
+
async writeAs(e, t, n) {
|
|
3167
|
+
if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
|
|
3168
|
+
return this._write(e, t, !0, n);
|
|
3169
|
+
}
|
|
3170
|
+
async _write(e, n, r, i) {
|
|
3171
|
+
if (!e) throw Error("Workbook must be provided.");
|
|
3172
|
+
if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
|
|
3173
|
+
let a, o = typeof n == "string" ? this.getOrigin(n) : n, s = o.getFormat();
|
|
3174
|
+
if ((i?.format || s) && (a = (await this._registry.getWriteFormats({ search: i?.format ?? s ?? void 0 }))[0]), a || o.getPath() && o.canWrite() && o.getExtension() || (a = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !a) throw new h(t("error.io.writeFormatUnresolved"));
|
|
3175
|
+
let l = o.getExtension();
|
|
3176
|
+
if (i?.format && l && o.getPath() && o.canWrite() && !a.exts.includes(l)) {
|
|
3177
|
+
let e = (await this._registry.getWriteFormats({ ext: l }))[0];
|
|
3178
|
+
if (e && e.key !== a.key) {
|
|
3179
|
+
let e = o.getPath().split(/[/\\]/).pop();
|
|
3180
|
+
throw new h(t("error.io.writeFormatMismatch", {
|
|
3181
|
+
format: i.format,
|
|
3182
|
+
file: e
|
|
3183
|
+
}));
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
if (typeof n == "string") {
|
|
3187
|
+
let e = o.getPath();
|
|
3188
|
+
o = new R(k(e) ? e : `${e}.${a.exts[0]}`, { format: a.key });
|
|
3189
|
+
}
|
|
3190
|
+
let u = o.getEncryption(), d = e.getOrigin?.(), f = (o instanceof R ? o.getPassword() : null) ?? (d instanceof R ? d.getPassword() : null), p = o.isEncrypted() || (d?.isEncrypted() ?? !1), m = i?.password === void 0 ? f ?? (p ? void 0 : null) : i.password, g = null;
|
|
3191
|
+
if (m === void 0) {
|
|
3192
|
+
if (p) {
|
|
3193
|
+
let e = o.getName();
|
|
3194
|
+
throw new c(e ? t("error.io.passwordRequiredSave", { name: e }) : t("error.io.passwordRequiredSaveUnnamed"));
|
|
3195
|
+
}
|
|
3196
|
+
} else if (m !== null && (g = await this._registry.getEncryption(u), !g)) throw new h(t("error.io.encryptionUnavailable"));
|
|
3197
|
+
let _ = `${o.getName() ?? t("workbook.defaultName")}.${a.exts[0]}`, v = i?.progress, y = !o.getPath() || !o.canWrite() || !!i?.prompt, b = !1, x = this, S = null, C = [], w = {
|
|
3198
|
+
workbook: e,
|
|
3199
|
+
format: a,
|
|
3200
|
+
origin: o,
|
|
3201
|
+
suggestedName: _,
|
|
3202
|
+
prompt: i?.prompt,
|
|
3203
|
+
async encode(t, n) {
|
|
3204
|
+
let s = n ?? o;
|
|
3205
|
+
await (async (e) => {
|
|
3206
|
+
b || (b = !0, v?.onStart && await Promise.resolve(v.onStart(e)));
|
|
3207
|
+
})(s), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
|
|
3208
|
+
let c = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? a : a, l = [], u = ((e, t) => ({
|
|
3209
|
+
onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
|
|
3210
|
+
onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
|
|
3211
|
+
onError: e?.onError ? (t) => e.onError(t) : void 0,
|
|
3212
|
+
onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
|
|
3213
|
+
onWarning: (n, r) => {
|
|
3214
|
+
t.push({
|
|
3215
|
+
message: n ?? "",
|
|
3216
|
+
context: r
|
|
3217
|
+
}), e?.onWarning?.(n, r);
|
|
3218
|
+
}
|
|
3219
|
+
}))(v, l), d = await x._writeArrayBuffer(e, c, {
|
|
3220
|
+
...i,
|
|
3221
|
+
progress: u
|
|
3222
|
+
}), f = $.get(s);
|
|
3223
|
+
if (l.some((e) => !f?.has(e.message)) && i?.onWarnings) {
|
|
3224
|
+
let t = await Promise.resolve(i.onWarnings({
|
|
3225
|
+
workbook: e,
|
|
3226
|
+
origin: s,
|
|
3227
|
+
warnings: l,
|
|
3228
|
+
save: r,
|
|
3229
|
+
canCancel: !y
|
|
3230
|
+
}));
|
|
3231
|
+
if (!y && !1 === t) return null;
|
|
3232
|
+
}
|
|
3233
|
+
return C = l, g ? g.encode(d, m) : d;
|
|
3234
|
+
}
|
|
3235
|
+
}, T = null;
|
|
3236
|
+
try {
|
|
3237
|
+
let t = this.getBackingStore();
|
|
3238
|
+
if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
|
|
3239
|
+
if (T = await t.write(w), T) {
|
|
3240
|
+
if (m !== void 0 && T instanceof R && (T.setPassword(m), T.update({ encryption: g ? g.key : null })), C.length) {
|
|
3241
|
+
let e = $.get(T) ?? /* @__PURE__ */ new Set();
|
|
3242
|
+
for (let t of C) e.add(t.message);
|
|
3243
|
+
$.set(T, e);
|
|
3244
|
+
}
|
|
3245
|
+
r && T !== e.getOrigin() && rt(e.getOrigin())?.setOrigin(T);
|
|
3246
|
+
let t = S ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
|
|
3247
|
+
this._emitter.notify("onWrite", {
|
|
3248
|
+
params: {
|
|
3249
|
+
workbook: e,
|
|
3250
|
+
origin: T,
|
|
3251
|
+
commitId: t?.getId() ?? null,
|
|
3252
|
+
save: r
|
|
3253
|
+
},
|
|
3254
|
+
transactional: !1
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
v?.onComplete && await Promise.resolve(v.onComplete(T));
|
|
3258
|
+
} catch (e) {
|
|
3259
|
+
let n = e instanceof Error ? e : Error(String(e));
|
|
3260
|
+
throw v?.onError && await Promise.resolve(v.onError(n)), v?.onComplete && await Promise.resolve(v.onComplete(null)), n instanceof h ? n : Error(t("error.io.writeFailed", { reason: n.message }), { cause: e });
|
|
3261
|
+
}
|
|
3262
|
+
return T;
|
|
3263
|
+
}
|
|
3264
|
+
_stripExtension(e) {
|
|
3265
|
+
let t = k(e);
|
|
3266
|
+
return t ? e.slice(0, e.length - t.length - 1) : e;
|
|
3267
|
+
}
|
|
3268
|
+
_baseName(e) {
|
|
3269
|
+
if (!e) return null;
|
|
3270
|
+
let t = e.split(/[?#]/)[0], n = t.split(/[/\\]/).pop() ?? t;
|
|
3271
|
+
return this._stripExtension(n) || null;
|
|
3272
|
+
}
|
|
3273
|
+
async _writeArrayBuffer(e, t, n) {
|
|
3274
|
+
if (!t) throw Error("A write format must be provided.");
|
|
3275
|
+
let r = t.handler;
|
|
3276
|
+
if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
|
|
3277
|
+
return r(e, {
|
|
3278
|
+
...n,
|
|
3279
|
+
format: t.key
|
|
3280
|
+
});
|
|
3281
|
+
}
|
|
3282
|
+
async _readArrayBuffer(e, n, r) {
|
|
3283
|
+
if (!e) throw Error("ArrayBuffer must be specified.");
|
|
3284
|
+
if (!n) throw Error("format must be specified.");
|
|
3285
|
+
if (e.byteLength === 0) return new dn(r?.createWorkbookOptions);
|
|
3286
|
+
let i, a = n.handler;
|
|
3287
|
+
if (!a) throw Error(`Unable to resolve a read handler for '${n.key}'.`);
|
|
3288
|
+
try {
|
|
3289
|
+
i = await a(e, r);
|
|
3290
|
+
} catch (e) {
|
|
3291
|
+
throw e instanceof h ? e : new h(t("error.io.readFailed", {
|
|
3292
|
+
format: n.description ?? n.key,
|
|
3293
|
+
reason: e?.message ?? String(e)
|
|
3294
|
+
}), { cause: e });
|
|
3295
|
+
}
|
|
3296
|
+
return i;
|
|
3297
|
+
}
|
|
3298
|
+
get isIWorkbookIO() {
|
|
3299
|
+
return !0;
|
|
3300
|
+
}
|
|
3301
|
+
}();
|
|
3302
|
+
[
|
|
3303
|
+
".woff2",
|
|
3304
|
+
".woff",
|
|
3305
|
+
".ttf",
|
|
3306
|
+
".otf",
|
|
3307
|
+
".ttc"
|
|
3308
|
+
].map((e) => ({
|
|
3309
|
+
suffix: e,
|
|
3310
|
+
place: (e, t) => t ? `${t}/${e}` : e
|
|
3311
|
+
})), Zt ||= {}, Qt ||= {}, (en = $t ||= {}).PathFill = {
|
|
3312
|
+
Darken: "darken",
|
|
3313
|
+
DarkenLess: "darkenLess",
|
|
3314
|
+
Lighten: "lighten",
|
|
3315
|
+
LightenLess: "lightenLess",
|
|
3316
|
+
None: "none",
|
|
3317
|
+
Normal: "normal"
|
|
3318
|
+
}, en.PresetGeometry = {
|
|
3319
|
+
Line: "line",
|
|
3320
|
+
LineInv: "lineInv",
|
|
3321
|
+
triangle: "triangle",
|
|
3322
|
+
rtTriangle: "rtTriangle",
|
|
3323
|
+
Rect: "rect"
|
|
3324
|
+
}, sn ||= {};
|
|
3325
|
+
var gn = class extends We {
|
|
3326
|
+
constructor(e) {
|
|
3327
|
+
super(e);
|
|
3328
|
+
}
|
|
3329
|
+
_initializeOptions(e) {
|
|
3330
|
+
return e = {
|
|
3331
|
+
...e,
|
|
3332
|
+
coords: {
|
|
3333
|
+
colStart: 0,
|
|
3334
|
+
rowStart: 0,
|
|
3335
|
+
colEnd: (e?.size?.width ?? 5) - 1,
|
|
3336
|
+
rowEnd: (e?.size?.height ?? 5) - 1
|
|
3337
|
+
},
|
|
3338
|
+
getRanges: (e) => new w(null)
|
|
3339
|
+
}, super._initializeOptions(e);
|
|
3340
|
+
}
|
|
3341
|
+
}, _n = "0.8.0-beta.2";
|
|
3342
|
+
export { gn as _, Lt as a, R as c, hn as d, xt as f, dn as g, vt as h, nt as i, qt as l, ft as m, Jt as n, Ft as o, yt as p, tt as r, _n as s, wt as t, _t as u };
|