@poe-platform/safe-bash 0.1.806 → 0.1.807
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/README.md +4 -0
- package/dist/image-ast/portable.d.ts +8 -0
- package/dist/image-ast/portable.js +2 -0
- package/dist/safe-bash/chunks/{chunk-KRA6WK4Z.js → chunk-3Y54SR4R.js} +6 -6
- package/dist/safe-bash/chunks/{chunk-OYJI4L4J.js → chunk-PPAA3LJS.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-SCROOJV7.js → chunk-XZ2Y4RWC.js} +2 -2
- package/dist/safe-bash/command-chunks/{biff-AU4VGVMD-6EQ64QPG.js → biff-YBHP7ZES-M7TU7NA5.js} +1211 -1205
- package/dist/safe-bash/command-chunks/chunk-2A6TBB4F.js +14 -0
- package/dist/safe-bash/command-chunks/chunk-2AF7J6FE.js +372 -0
- package/dist/safe-bash/command-chunks/{chunk-AITNVBXO.js → chunk-2ANW3FXH.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-2B6XWO6A.js +730 -0
- package/dist/safe-bash/command-chunks/chunk-2BKOSQD3.js +11 -0
- package/dist/safe-bash/command-chunks/chunk-2EUH5B6A.js +127 -0
- package/dist/safe-bash/command-chunks/chunk-2FOLUJLI.js +400 -0
- package/dist/safe-bash/command-chunks/{chunk-CZLX3KVF.js → chunk-2GILUQJY.js} +4 -6
- package/dist/safe-bash/command-chunks/chunk-2HHGDJ7J.js +280 -0
- package/dist/safe-bash/command-chunks/chunk-2NE2GPSF.js +546 -0
- package/dist/safe-bash/command-chunks/chunk-2P7BLWWI.js +272 -0
- package/dist/safe-bash/command-chunks/chunk-2PSVE7I5.js +101 -0
- package/dist/safe-bash/command-chunks/chunk-2UUFZMOH.js +503 -0
- package/dist/safe-bash/command-chunks/chunk-2VGAC6S6.js +393 -0
- package/dist/safe-bash/command-chunks/chunk-2W54TAGI.js +162 -0
- package/dist/safe-bash/command-chunks/chunk-326A5G42.js +328 -0
- package/dist/safe-bash/command-chunks/chunk-36KIT4DU.js +218 -0
- package/dist/safe-bash/command-chunks/chunk-3CHQG25N.js +455 -0
- package/dist/safe-bash/command-chunks/chunk-3JQ3RF2O.js +72 -0
- package/dist/safe-bash/command-chunks/chunk-3MLJWSYL.js +92 -0
- package/dist/safe-bash/command-chunks/{chunk-ASYR2LU7.js → chunk-3RQCLLQA.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-3SEQG5JH.js +521 -0
- package/dist/safe-bash/command-chunks/chunk-3SWT2KYH.js +78 -0
- package/dist/safe-bash/command-chunks/chunk-3VETFXYR.js +170 -0
- package/dist/safe-bash/command-chunks/chunk-3W6PTHHB.js +65 -0
- package/dist/safe-bash/command-chunks/chunk-457CU3IC.js +8 -0
- package/dist/safe-bash/command-chunks/chunk-45BW6MGM.js +250 -0
- package/dist/safe-bash/command-chunks/chunk-47MFDPH4.js +419 -0
- package/dist/safe-bash/command-chunks/chunk-4ATHODCG.js +444 -0
- package/dist/safe-bash/command-chunks/chunk-4DJICIFV.js +227 -0
- package/dist/safe-bash/command-chunks/chunk-4FNQPK7C.js +385 -0
- package/dist/safe-bash/command-chunks/chunk-4LXDJES2.js +65 -0
- package/dist/safe-bash/command-chunks/chunk-4QRXKUD2.js +662 -0
- package/dist/safe-bash/command-chunks/chunk-4QYNOBWZ.js +455 -0
- package/dist/safe-bash/command-chunks/{chunk-MWNWT6HG.js → chunk-4XFFIKA3.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-5AU5ENL5.js +180 -0
- package/dist/safe-bash/command-chunks/chunk-5DFZAJHL.js +324 -0
- package/dist/safe-bash/command-chunks/chunk-5GEFJROP.js +270 -0
- package/dist/safe-bash/command-chunks/chunk-5HWX4XYW.js +263 -0
- package/dist/safe-bash/command-chunks/chunk-5LKNP4IF.js +872 -0
- package/dist/safe-bash/command-chunks/chunk-5OEHUIVE.js +240 -0
- package/dist/safe-bash/command-chunks/chunk-6EHVFKM7.js +171 -0
- package/dist/safe-bash/command-chunks/chunk-6JTPLJ3B.js +155 -0
- package/dist/safe-bash/command-chunks/chunk-6KLUPQ65.js +496 -0
- package/dist/safe-bash/command-chunks/chunk-6NS5RXQ7.js +285 -0
- package/dist/safe-bash/command-chunks/chunk-6PJIQEH4.js +3472 -0
- package/dist/safe-bash/command-chunks/chunk-763ECQWB.js +566 -0
- package/dist/safe-bash/command-chunks/chunk-7DADVPKN.js +23 -0
- package/dist/safe-bash/command-chunks/chunk-7LEADSSA.js +164 -0
- package/dist/safe-bash/command-chunks/chunk-7MMSBVUP.js +732 -0
- package/dist/safe-bash/command-chunks/chunk-7OXNWLSL.js +35 -0
- package/dist/safe-bash/command-chunks/chunk-7PZASWL6.js +354 -0
- package/dist/safe-bash/command-chunks/{chunk-ZBR3UH4P.js → chunk-7QH3WAMQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-CB3HTIDK.js → chunk-7SOE7XIS.js} +11 -11
- package/dist/safe-bash/command-chunks/chunk-7Y3ZQ6FE.js +56 -0
- package/dist/safe-bash/command-chunks/chunk-A2YEQYCC.js +289 -0
- package/dist/safe-bash/command-chunks/chunk-A3XE767Q.js +502 -0
- package/dist/safe-bash/command-chunks/{chunk-MWY75E3F.js → chunk-A6LCBGE6.js} +187 -187
- package/dist/safe-bash/command-chunks/{chunk-HFUL6E5I.js → chunk-A7CE4EIU.js} +33 -151
- package/dist/safe-bash/command-chunks/chunk-A7EMM3SB.js +297 -0
- package/dist/safe-bash/command-chunks/{chunk-G3YO3JIN.js → chunk-ABH5FMMA.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-AEJZEGW7.js +1376 -0
- package/dist/safe-bash/command-chunks/chunk-AELXRNM6.js +207 -0
- package/dist/safe-bash/command-chunks/chunk-AEZIPWRI.js +260 -0
- package/dist/safe-bash/command-chunks/{chunk-AHD3CGAY.js → chunk-AFPXADZG.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-AIOB34IX.js +201 -0
- package/dist/safe-bash/command-chunks/chunk-AJEYCC4X.js +262 -0
- package/dist/safe-bash/command-chunks/chunk-ALMHXDKZ.js +321 -0
- package/dist/safe-bash/command-chunks/chunk-AQ6RTM2M.js +309 -0
- package/dist/safe-bash/command-chunks/chunk-AQNFEGMZ.js +481 -0
- package/dist/safe-bash/command-chunks/{chunk-2AKKYY5G.js → chunk-ASZ4EMKE.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-AYJGINE5.js +144 -0
- package/dist/safe-bash/command-chunks/{chunk-MRFW2E6B.js → chunk-B4UWZCQR.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-BDYKJTBQ.js +43 -0
- package/dist/safe-bash/command-chunks/chunk-BERVTMQB.js +41 -0
- package/dist/safe-bash/command-chunks/chunk-BZOY2UMP.js +275 -0
- package/dist/safe-bash/command-chunks/{chunk-W47KIMSP.js → chunk-C2EYJT4S.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-CK5Q6RDE.js +342 -0
- package/dist/safe-bash/command-chunks/chunk-CKEODJVT.js +992 -0
- package/dist/safe-bash/command-chunks/{chunk-Z7UIOPHJ.js → chunk-DCMSPMMD.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-DE66JRWJ.js +352 -0
- package/dist/safe-bash/command-chunks/chunk-DKNNYPOI.js +409 -0
- package/dist/safe-bash/command-chunks/chunk-DV745GFU.js +294 -0
- package/dist/safe-bash/command-chunks/chunk-DXX2Z2QA.js +33 -0
- package/dist/safe-bash/command-chunks/chunk-E7AYF54A.js +473 -0
- package/dist/safe-bash/command-chunks/chunk-EDSFQJAU.js +159 -0
- package/dist/safe-bash/command-chunks/{chunk-UQ3KEUCF.js → chunk-ESD5ZD74.js} +7 -1
- package/dist/safe-bash/command-chunks/chunk-EUXUCRCI.js +1739 -0
- package/dist/safe-bash/command-chunks/chunk-F2ORFLCH.js +3669 -0
- package/dist/safe-bash/command-chunks/chunk-FANIWOBM.js +311 -0
- package/dist/safe-bash/command-chunks/chunk-FOO3AXFK.js +47 -0
- package/dist/safe-bash/command-chunks/chunk-FRZ5P5AB.js +131 -0
- package/dist/safe-bash/command-chunks/chunk-FZSQMMYV.js +276 -0
- package/dist/safe-bash/command-chunks/{chunk-P6NUIMMX.js → chunk-G5F2VSQ7.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-GGOZXIGH.js +299 -0
- package/dist/safe-bash/command-chunks/chunk-GIESJLR2.js +241 -0
- package/dist/safe-bash/command-chunks/chunk-GLPIFP7N.js +385 -0
- package/dist/safe-bash/command-chunks/chunk-GZ2N24A2.js +342 -0
- package/dist/safe-bash/command-chunks/chunk-H2NWPMNW.js +216 -0
- package/dist/safe-bash/command-chunks/chunk-HHLVI2CB.js +3949 -0
- package/dist/safe-bash/command-chunks/chunk-HJDE7ZNV.js +82 -0
- package/dist/safe-bash/command-chunks/chunk-HOAM3F5I.js +124 -0
- package/dist/safe-bash/command-chunks/chunk-HPKUFWHW.js +482 -0
- package/dist/safe-bash/command-chunks/chunk-HPMVMOD2.js +109 -0
- package/dist/safe-bash/command-chunks/chunk-HQAHDJPX.js +8 -0
- package/dist/safe-bash/command-chunks/chunk-HR2Y6YEP.js +12 -0
- package/dist/safe-bash/command-chunks/chunk-HUNXIAOL.js +62 -0
- package/dist/safe-bash/command-chunks/chunk-I4JWZOSP.js +244 -0
- package/dist/safe-bash/command-chunks/chunk-I6AMDG2T.js +85 -0
- package/dist/safe-bash/command-chunks/chunk-IB2Q5CL3.js +288 -0
- package/dist/safe-bash/command-chunks/chunk-IFNLDOJ4.js +316 -0
- package/dist/safe-bash/command-chunks/chunk-IKHBXETN.js +174 -0
- package/dist/safe-bash/command-chunks/chunk-IOSWG5JS.js +228 -0
- package/dist/safe-bash/command-chunks/chunk-IQFRPIXH.js +317 -0
- package/dist/safe-bash/command-chunks/chunk-IR6ZKAUH.js +582 -0
- package/dist/safe-bash/command-chunks/chunk-IW7PEB4I.js +297 -0
- package/dist/safe-bash/command-chunks/chunk-JGGRMERW.js +36 -0
- package/dist/safe-bash/command-chunks/chunk-JHAY3KYC.js +520 -0
- package/dist/safe-bash/command-chunks/{chunk-UO25D4WG.js → chunk-JITDS55R.js} +22 -22
- package/dist/safe-bash/command-chunks/chunk-JJK3CU7Z.js +6 -0
- package/dist/safe-bash/command-chunks/{chunk-XKZWUMH4.js → chunk-JN7GNI2C.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-JQ3EJKHF.js +160 -0
- package/dist/safe-bash/command-chunks/chunk-JQE256UO.js +292 -0
- package/dist/safe-bash/command-chunks/chunk-JQZ3BXWY.js +382 -0
- package/dist/safe-bash/command-chunks/{chunk-7DLR4HCC.js → chunk-JWSOFSGI.js} +22 -22
- package/dist/safe-bash/command-chunks/chunk-K3CDZMUN.js +168 -0
- package/dist/safe-bash/command-chunks/{chunk-SUYSZJI3.js → chunk-K5COUQAQ.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-K7HUXUN2.js +489 -0
- package/dist/safe-bash/command-chunks/chunk-KB3CY3QO.js +62 -0
- package/dist/safe-bash/command-chunks/chunk-KCBVOYAY.js +92 -0
- package/dist/safe-bash/command-chunks/chunk-KD25ICP4.js +366 -0
- package/dist/safe-bash/command-chunks/chunk-KDKQ5D55.js +180 -0
- package/dist/safe-bash/command-chunks/chunk-KNKDUEDW.js +521 -0
- package/dist/safe-bash/command-chunks/chunk-KR2PQ7GD.js +174 -0
- package/dist/safe-bash/command-chunks/chunk-KS6WUDPM.js +153 -0
- package/dist/safe-bash/command-chunks/{chunk-XFHUSZBM.js → chunk-KUGV3SSL.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-L2JAP5KO.js +249 -0
- package/dist/safe-bash/command-chunks/chunk-L2KEA6SN.js +271 -0
- package/dist/safe-bash/command-chunks/chunk-L3WY5ASN.js +526 -0
- package/dist/safe-bash/command-chunks/chunk-L4XEXXVQ.js +399 -0
- package/dist/safe-bash/command-chunks/chunk-LDTUZIJK.js +90 -0
- package/dist/safe-bash/command-chunks/chunk-LHDB4QO5.js +479 -0
- package/dist/safe-bash/command-chunks/chunk-LHL6RWGJ.js +548 -0
- package/dist/safe-bash/command-chunks/chunk-LHRXDH45.js +164 -0
- package/dist/safe-bash/command-chunks/chunk-LQOKYG3O.js +153 -0
- package/dist/safe-bash/command-chunks/chunk-LRDME6WV.js +12 -0
- package/dist/safe-bash/command-chunks/chunk-LWVDJB5S.js +305 -0
- package/dist/safe-bash/command-chunks/chunk-M57GLLK4.js +27 -0
- package/dist/safe-bash/command-chunks/chunk-MAHX3IW3.js +108 -0
- package/dist/safe-bash/command-chunks/{chunk-LQZSR6DT.js → chunk-MDV7W5AS.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-MG7AJD5E.js +168 -0
- package/dist/safe-bash/command-chunks/chunk-MHJ3DQUE.js +213 -0
- package/dist/safe-bash/command-chunks/chunk-MLGNBD7V.js +552 -0
- package/dist/safe-bash/command-chunks/chunk-MN2M33JK.js +237 -0
- package/dist/safe-bash/command-chunks/chunk-MOL3TRBT.js +32 -0
- package/dist/safe-bash/command-chunks/chunk-MQFXMBGD.js +75 -0
- package/dist/safe-bash/command-chunks/chunk-MQPWE22J.js +171 -0
- package/dist/safe-bash/command-chunks/chunk-MQU6Q75R.js +523 -0
- package/dist/safe-bash/command-chunks/chunk-MWAAMNAM.js +353 -0
- package/dist/safe-bash/command-chunks/chunk-MZ4BTMTI.js +240 -0
- package/dist/safe-bash/command-chunks/chunk-N4DY4FPA.js +679 -0
- package/dist/safe-bash/command-chunks/chunk-N74TJL6X.js +183 -0
- package/dist/safe-bash/command-chunks/chunk-NA5Q4V2H.js +304 -0
- package/dist/safe-bash/command-chunks/chunk-NSM366N6.js +22 -0
- package/dist/safe-bash/command-chunks/chunk-NY4ZPV3N.js +523 -0
- package/dist/safe-bash/command-chunks/chunk-NYBF2BVE.js +17 -0
- package/dist/safe-bash/command-chunks/chunk-OBK24KGM.js +24 -0
- package/dist/safe-bash/command-chunks/{chunk-GDAS4LY7.js → chunk-OEKLEUUW.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-OGWJD5QP.js +404 -0
- package/dist/safe-bash/command-chunks/chunk-OIPATOZW.js +154 -0
- package/dist/safe-bash/command-chunks/chunk-OP6J3OLL.js +243 -0
- package/dist/safe-bash/command-chunks/chunk-OTTMIB3C.js +266 -0
- package/dist/safe-bash/command-chunks/{chunk-OZHPB4KD.js → chunk-OU4VE5CR.js} +12 -12
- package/dist/safe-bash/command-chunks/chunk-P42REFYL.js +228 -0
- package/dist/safe-bash/command-chunks/{chunk-YJ3TFZB2.js → chunk-PQOAM5SC.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-PQOIOVF2.js +444 -0
- package/dist/safe-bash/command-chunks/chunk-PRQEVUNE.js +205 -0
- package/dist/safe-bash/command-chunks/{chunk-W5OR7COJ.js → chunk-PVLPWVRH.js} +21 -21
- package/dist/safe-bash/command-chunks/{chunk-BNG4ZMZ3.js → chunk-PXL4NBYP.js} +1 -78
- package/dist/safe-bash/command-chunks/chunk-Q6W5FRZG.js +41 -0
- package/dist/safe-bash/command-chunks/{chunk-KLCHCSIV.js → chunk-QGD64UHJ.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-QHS7PDG3.js +188 -0
- package/dist/safe-bash/command-chunks/chunk-QXCSASIE.js +151 -0
- package/dist/safe-bash/command-chunks/chunk-QYCBVKFT.js +255 -0
- package/dist/safe-bash/command-chunks/chunk-R4TYL2G6.js +1529 -0
- package/dist/safe-bash/command-chunks/chunk-RAXJVM4U.js +625 -0
- package/dist/safe-bash/command-chunks/chunk-RBFZYSZZ.js +207 -0
- package/dist/safe-bash/command-chunks/chunk-RJHVJZ4H.js +185 -0
- package/dist/safe-bash/command-chunks/chunk-RKPPUYZE.js +213 -0
- package/dist/safe-bash/command-chunks/chunk-RMJNV6Q7.js +23 -0
- package/dist/safe-bash/command-chunks/{chunk-MR2RLUPV.js → chunk-RQHQCJMV.js} +11 -9
- package/dist/safe-bash/command-chunks/chunk-RR6QQ25D.js +71 -0
- package/dist/safe-bash/command-chunks/{chunk-JW3KIZU6.js → chunk-RUXY7GN5.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-RZC7QHL6.js +112 -0
- package/dist/safe-bash/command-chunks/chunk-RZJRR4UJ.js +1677 -0
- package/dist/safe-bash/command-chunks/chunk-S4OBYRNI.js +639 -0
- package/dist/safe-bash/command-chunks/{chunk-DQNDEWCI.js → chunk-S65T5JJO.js} +12 -12
- package/dist/safe-bash/command-chunks/chunk-S6PPBBXX.js +77 -0
- package/dist/safe-bash/command-chunks/chunk-SCG4LK5U.js +265 -0
- package/dist/safe-bash/command-chunks/chunk-SDTC2BLK.js +143 -0
- package/dist/safe-bash/command-chunks/chunk-SEK43FRN.js +357 -0
- package/dist/safe-bash/command-chunks/chunk-SH45NZ2P.js +194 -0
- package/dist/safe-bash/command-chunks/chunk-SM733XRT.js +250 -0
- package/dist/safe-bash/command-chunks/chunk-SSRGI476.js +116 -0
- package/dist/safe-bash/command-chunks/chunk-SUUD352U.js +127 -0
- package/dist/safe-bash/command-chunks/{chunk-B5F2KQYA.js → chunk-SWUVHT7G.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-TBAH4XGI.js +38 -0
- package/dist/safe-bash/command-chunks/chunk-TBVWTZTR.js +469 -0
- package/dist/safe-bash/command-chunks/chunk-TGHQGJNR.js +144 -0
- package/dist/safe-bash/command-chunks/{chunk-Q6JLT2EY.js → chunk-TL3KDYEM.js} +8 -110
- package/dist/safe-bash/command-chunks/chunk-TVAEX4WQ.js +473 -0
- package/dist/safe-bash/command-chunks/chunk-TZ2J6LGM.js +163 -0
- package/dist/safe-bash/command-chunks/chunk-UICO7H6S.js +186 -0
- package/dist/safe-bash/command-chunks/chunk-UJTJFMIN.js +501 -0
- package/dist/safe-bash/command-chunks/chunk-UMWWCLBG.js +109 -0
- package/dist/safe-bash/command-chunks/chunk-UPXFSGQG.js +134 -0
- package/dist/safe-bash/command-chunks/chunk-UWUYSXYT.js +272 -0
- package/dist/safe-bash/command-chunks/{chunk-5FMXQUDY.js → chunk-UZOGSYJP.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-V3RGA5PS.js +125 -0
- package/dist/safe-bash/command-chunks/chunk-VEUQWV2V.js +287 -0
- package/dist/safe-bash/command-chunks/chunk-VGKYTZT5.js +161 -0
- package/dist/safe-bash/command-chunks/chunk-VQUEIEVP.js +410 -0
- package/dist/safe-bash/command-chunks/chunk-VU3YUC3U.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-W32KW66B.js +27 -0
- package/dist/safe-bash/command-chunks/chunk-W543LSYH.js +899 -0
- package/dist/safe-bash/command-chunks/chunk-W5YFDYHO.js +387 -0
- package/dist/safe-bash/command-chunks/chunk-W6DV2CLS.js +267 -0
- package/dist/safe-bash/command-chunks/chunk-WAKYUXVQ.js +215 -0
- package/dist/safe-bash/command-chunks/chunk-WGOL3MM6.js +125 -0
- package/dist/safe-bash/command-chunks/{chunk-N2A7V3WY.js → chunk-WHNYT34N.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-WOZCIRJ5.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-WVB6ONZS.js +232 -0
- package/dist/safe-bash/command-chunks/chunk-WVESNAND.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-XDEA3TL5.js +322 -0
- package/dist/safe-bash/command-chunks/chunk-XFEUWSYG.js +357 -0
- package/dist/safe-bash/command-chunks/chunk-XFMJ4RMS.js +2849 -0
- package/dist/safe-bash/command-chunks/chunk-XH6DXJHX.js +196 -0
- package/dist/safe-bash/command-chunks/chunk-XNJ67APB.js +6 -0
- package/dist/safe-bash/command-chunks/chunk-XP6BHGZ6.js +227 -0
- package/dist/safe-bash/command-chunks/chunk-XXFHTGV2.js +142 -0
- package/dist/safe-bash/command-chunks/chunk-Y5GI5PVT.js +139 -0
- package/dist/safe-bash/command-chunks/chunk-Y6KHC3JB.js +177 -0
- package/dist/safe-bash/command-chunks/{chunk-2UWPMSME.js → chunk-Y72LPXST.js} +8 -8
- package/dist/safe-bash/command-chunks/chunk-YDRWQZNB.js +69 -0
- package/dist/safe-bash/command-chunks/{chunk-P4OJBL2B.js → chunk-YFZ6FPIC.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-YH4DC4RP.js +171 -0
- package/dist/safe-bash/command-chunks/chunk-YH7KKMMN.js +463 -0
- package/dist/safe-bash/command-chunks/{chunk-MN3BB4WW.js → chunk-YP3WWV5N.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-YPVBU7QF.js +2817 -0
- package/dist/safe-bash/command-chunks/chunk-YQYVEVUE.js +1621 -0
- package/dist/safe-bash/command-chunks/chunk-YRNBIU5U.js +175 -0
- package/dist/safe-bash/command-chunks/chunk-Z7ESJVFP.js +10 -0
- package/dist/safe-bash/command-chunks/chunk-ZTAFAHY3.js +653 -0
- package/dist/safe-bash/command-chunks/chunk-ZXKOMB24.js +85 -0
- package/dist/safe-bash/command-chunks/{clipboard-XCSQACOK-SHFXT53F.js → clipboard-6SDGQGC3-TVJ3CG7A.js} +4 -4
- package/dist/safe-bash/command-chunks/{command-engine-4TEGTXCQ.js → command-engine-KMLHVFMA.js} +356 -316
- package/dist/safe-bash/command-chunks/{engine-QDC5VCGO-LYAAFESF.js → engine-EOYR2WTY-KUFLFTDE.js} +2 -4
- package/dist/safe-bash/command-chunks/{gnumeric-OCFH63UT-YI7SG7TN.js → gnumeric-ABKSRBZJ-MPIIPXKP.js} +3 -3
- package/dist/safe-bash/command-chunks/inspection-command-ULEU7ZVV.js +7 -0
- package/dist/safe-bash/command-chunks/model-store-JUFU3RSW.js +54 -0
- package/dist/safe-bash/command-chunks/pdf-22JDKKAR-UDWNSWYB.js +338 -0
- package/dist/safe-bash/command-chunks/{pptx-XG3YSXWZ-XAG36NAB.js → pptx-YDKHIGCD-H7FU4VMJ.js} +2 -2
- package/dist/safe-bash/commands/bc/index.browser.js +2 -2
- package/dist/safe-bash/commands/diffpdf/index.d.ts +2 -0
- package/dist/safe-bash/commands/diffpdf/index.js +2 -0
- package/dist/safe-bash/commands/dot/index.d.ts +2 -0
- package/dist/safe-bash/commands/dot/index.js +2 -0
- package/dist/safe-bash/commands/llm/collections.browser.js +6 -0
- package/dist/safe-bash/commands/llm/collections.d.ts +2 -0
- package/dist/safe-bash/commands/llm/collections.js +2 -0
- package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
- package/dist/safe-bash/commands/rsvg-convert/index.d.ts +2 -0
- package/dist/safe-bash/commands/rsvg-convert/index.js +2 -0
- package/dist/safe-bash/commands/safejs/io.d.ts +1 -1
- package/dist/safe-bash/commands/safejs/io.js +1 -1
- package/dist/safe-bash/commands/safejs/options.d.ts +1 -1
- package/dist/safe-bash/commands/safejs/options.js +1 -1
- package/dist/safe-bash/commands/safejs/render.d.ts +1 -1
- package/dist/safe-bash/commands/safejs/render.js +1 -1
- package/dist/safe-bash/commands/safejs/runtime.d.ts +1 -1
- package/dist/safe-bash/commands/safejs/runtime.js +1 -1
- package/dist/safe-bash/commands/safejs/types.d.ts +1 -1
- package/dist/safe-bash/commands/safejs/types.js +1 -1
- package/dist/safe-bash/commands/wdiff/index.d.ts +2 -0
- package/dist/safe-bash/commands/wdiff/index.js +2 -0
- package/dist/safe-bash/core.d.ts +4 -0
- package/dist/safe-bash/core.js +4 -0
- package/dist/safe-bash/full-core.browser.js +59 -35
- package/dist/safe-bash/optional-host.browser.js +7 -7
- package/dist/safe-bash/plugins/index.browser.js +7 -7
- package/dist/safe-bash/registry-entry.browser.js +6 -6
- package/dist/safe-bash/search.browser.js +2 -2
- package/dist/safe-bash/shell-entry.browser.js +3 -3
- package/dist/safe-bash-checksum-engine/index.js +83 -40
- package/dist/safe-bash-checksum-engine/md5.d.ts +2 -0
- package/dist/safe-bash-checksum-engine/md5.js +7 -0
- package/dist/safe-bash-command-awk/awk-inspection.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +2 -2
- package/dist/safe-bash-command-awk/awk.js +7 -7
- package/dist/safe-bash-command-awk/index.js +7 -7
- package/dist/safe-bash-command-chmod/command.js +1 -1
- package/dist/safe-bash-command-chmod/index.js +1 -1
- package/dist/safe-bash-command-csvkit/index.js +6 -6
- package/dist/safe-bash-command-diff/index.js +3 -3
- package/dist/safe-bash-command-diffpdf/LICENSE +21 -0
- package/dist/safe-bash-command-diffpdf/index.d.ts +12 -0
- package/dist/safe-bash-command-diffpdf/index.js +107 -0
- package/dist/safe-bash-command-docx/command.d.ts +36 -0
- package/dist/{safe-bash-docx-engine → safe-bash-command-docx}/discovery.d.ts +4 -4
- package/dist/safe-bash-command-docx/index.js +1 -1
- package/dist/{safe-bash-docx-engine → safe-bash-command-docx}/inspection-command.d.ts +6 -6
- package/dist/safe-bash-command-docx/sdk.d.ts +4 -0
- package/dist/safe-bash-command-docx/sdk.js +24 -0
- package/dist/safe-bash-command-dot/LICENSE +21 -0
- package/dist/safe-bash-command-dot/index.d.ts +14 -0
- package/dist/safe-bash-command-dot/index.js +1298 -0
- package/dist/safe-bash-command-du/arguments.d.ts +1 -1
- package/dist/safe-bash-command-du/arguments.js +1 -1
- package/dist/safe-bash-command-du/du.js +2 -2
- package/dist/safe-bash-command-du/index.js +2 -2
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +16 -16
- package/dist/safe-bash-command-imagemagick/index.js +21 -53
- package/dist/safe-bash-command-llm/collections-embed.d.ts +23 -0
- package/dist/safe-bash-command-llm/collections.d.ts +38 -0
- package/dist/safe-bash-command-llm/collections.js +423 -0
- package/dist/safe-bash-command-llm/command.js +4 -2
- package/dist/safe-bash-command-llm/index.js +12 -8
- package/dist/safe-bash-command-llm/openai.js +4 -3
- package/dist/safe-bash-command-llm/providers/index.js +6 -4
- package/dist/safe-bash-command-llm/providers/openai.js +4 -3
- package/dist/safe-bash-command-node/commands/node/browser.js +9 -12
- package/dist/safe-bash-command-node/commands/node/buffer.js +2 -2
- package/dist/safe-bash-command-node/commands/node/default-runtime.js +9 -12
- package/dist/safe-bash-command-node/commands/node/filesystem.js +3 -3
- package/dist/safe-bash-command-node/commands/node/safejs.js +9 -12
- package/dist/safe-bash-command-node/commands/node/source-maps.js +2 -2
- package/dist/safe-bash-command-node/commands/node/timers.js +3 -3
- package/dist/safe-bash-command-node/commands/safejs/io.d.ts +1 -35
- package/dist/safe-bash-command-node/commands/safejs/io.js +3 -7
- package/dist/safe-bash-command-node/commands/safejs/options.d.ts +2 -22
- package/dist/safe-bash-command-node/commands/safejs/options.js +1 -1
- package/dist/safe-bash-command-node/commands/safejs/render.d.ts +1 -1
- package/dist/safe-bash-command-node/commands/safejs/render.js +3 -5
- package/dist/safe-bash-command-node/commands/safejs/runtime.d.ts +2 -25
- package/dist/safe-bash-command-node/commands/safejs/runtime.js +1 -7
- package/dist/safe-bash-command-node/commands/safejs/types.d.ts +2 -85
- package/dist/safe-bash-command-node/commands/safejs/types.js +1 -1
- package/dist/safe-bash-command-node/integrations/safejs/filesystem.d.ts +2 -5
- package/dist/safe-bash-command-node/integrations/safejs/filesystem.js +3 -3
- package/dist/safe-bash-command-node/integrations/safejs/shell.js +1 -1
- package/dist/safe-bash-command-node/integrations/safejs/values.d.ts +1 -7
- package/dist/safe-bash-command-node/integrations/safejs/values.js +1 -1
- package/dist/safe-bash-command-openssl/index.js +15452 -420
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-patch/index.js +5 -5
- package/dist/safe-bash-command-patch/patch.js +4 -4
- package/dist/safe-bash-command-playwright-cli/index.js +25 -25
- package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +8 -8
- package/dist/safe-bash-command-playwright-cli/playwright/controller.js +16 -16
- package/dist/safe-bash-command-playwright-cli/playwright/index.js +25 -25
- package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +4 -4
- package/dist/{safe-bash-pptx-engine → safe-bash-command-pptx}/command-engine.d.ts +5 -13
- package/dist/safe-bash-command-pptx/engine.d.ts +4 -0
- package/dist/safe-bash-command-pptx/engine.js +37 -0
- package/dist/safe-bash-command-pptx/index.js +1 -1
- package/dist/safe-bash-command-python/executor.js +15 -15
- package/dist/safe-bash-command-python/index.js +15 -15
- package/dist/safe-bash-command-python/jspi.js +4 -4
- package/dist/safe-bash-command-qrencode/index.js +1 -4
- package/dist/safe-bash-command-rsvg-convert/LICENSE +21 -0
- package/dist/safe-bash-command-rsvg-convert/index.d.ts +13 -0
- package/dist/safe-bash-command-rsvg-convert/index.js +84 -0
- package/dist/safe-bash-command-safejs/LICENSE +21 -0
- package/dist/safe-bash-command-safejs/filesystem.d.ts +5 -0
- package/dist/safe-bash-command-safejs/filesystem.js +7 -0
- package/dist/safe-bash-command-safejs/index.d.ts +4 -0
- package/dist/safe-bash-command-safejs/index.js +19 -0
- package/dist/safe-bash-command-safejs/io.d.ts +35 -0
- package/dist/safe-bash-command-safejs/io.js +12 -0
- package/dist/safe-bash-command-safejs/options.d.ts +22 -0
- package/dist/safe-bash-command-safejs/options.js +11 -0
- package/dist/safe-bash-command-safejs/render.d.ts +1 -0
- package/dist/safe-bash-command-safejs/render.js +9 -0
- package/dist/safe-bash-command-safejs/runtime.d.ts +25 -0
- package/dist/safe-bash-command-safejs/runtime.js +13 -0
- package/dist/safe-bash-command-safejs/types.d.ts +85 -0
- package/dist/safe-bash-command-safejs/types.js +7 -0
- package/dist/safe-bash-command-safejs/values.d.ts +7 -0
- package/dist/safe-bash-command-safejs/values.js +19 -0
- package/dist/safe-bash-command-sips/index.js +1 -14
- package/dist/safe-bash-command-ssconvert/index.js +413 -546
- package/dist/safe-bash-command-ssconvert/rendering/chart/axis.d.ts +1 -26
- package/dist/safe-bash-command-ssconvert/rendering/chart/error-bar.d.ts +1 -39
- package/dist/safe-bash-command-ssconvert/rendering/chart/layout.d.ts +1 -24
- package/dist/safe-bash-command-ssconvert/rendering/chart/line.d.ts +1 -23
- package/dist/safe-bash-command-ssconvert/rendering/chart/marker.d.ts +1 -35
- package/dist/safe-bash-command-ssconvert/rendering/chart/pie.d.ts +1 -32
- package/dist/safe-bash-command-ssconvert/rendering/images/index.d.ts +1 -26
- package/dist/safe-bash-command-ssconvert/rendering/print/header-footer.d.ts +1 -16
- package/dist/safe-bash-command-ssconvert/rendering/print/layout.d.ts +1 -65
- package/dist/safe-bash-command-ssconvert/rendering/print/pagination.d.ts +1 -34
- package/dist/safe-bash-command-tar/create.js +4 -4
- package/dist/safe-bash-command-tar/extract.js +4 -4
- package/dist/safe-bash-command-tar/index.js +16 -14
- package/dist/safe-bash-command-tar/modes.js +6 -6
- package/dist/safe-bash-command-tar/options.d.ts +3 -1
- package/dist/safe-bash-command-tar/options.js +1 -1
- package/dist/safe-bash-command-unzip/index.js +4 -4
- package/dist/safe-bash-command-wdiff/LICENSE +21 -0
- package/dist/safe-bash-command-wdiff/index.d.ts +12 -0
- package/dist/safe-bash-command-wdiff/index.js +123 -0
- package/dist/safe-bash-compression-engine/bounded-codec.js +2 -2
- package/dist/safe-bash-compression-engine/codec-loader.js +1 -1
- package/dist/safe-bash-compression-engine/files.js +5 -5
- package/dist/safe-bash-compression-engine/index.js +4 -4
- package/dist/safe-bash-compression-engine/operand.js +5 -5
- package/dist/safe-bash-compression-engine/stream.js +4 -4
- package/dist/safe-bash-compression-engine/zstd-decode.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +2 -2
- package/dist/safe-bash-contracts/index.js +15 -15
- package/dist/safe-bash-docx-engine/admission.js +31 -0
- package/dist/safe-bash-docx-engine/ancillary-resources.js +38 -0
- package/dist/safe-bash-docx-engine/archive.js +24 -0
- package/dist/safe-bash-docx-engine/argument-json.js +25 -0
- package/dist/safe-bash-docx-engine/batch-operations.d.ts +7 -0
- package/dist/safe-bash-docx-engine/batch-operations.js +95 -0
- package/dist/safe-bash-docx-engine/batch-result-schema.d.ts +2 -0
- package/dist/safe-bash-docx-engine/batch-result-schema.js +145 -0
- package/dist/safe-bash-docx-engine/batch.js +106 -0
- package/dist/safe-bash-docx-engine/bookmarks.js +43 -0
- package/dist/safe-bash-docx-engine/budget.js +18 -0
- package/dist/safe-bash-docx-engine/charts.js +35 -0
- package/dist/safe-bash-docx-engine/command-option-rules.d.ts +1 -0
- package/dist/safe-bash-docx-engine/command-option-rules.js +24 -0
- package/dist/safe-bash-docx-engine/command-properties.d.ts +1 -0
- package/dist/safe-bash-docx-engine/command-properties.js +18 -0
- package/dist/safe-bash-docx-engine/command-selection.d.ts +1 -0
- package/dist/safe-bash-docx-engine/command-selection.js +15 -0
- package/dist/safe-bash-docx-engine/comments.js +53 -0
- package/dist/safe-bash-docx-engine/control-bindings.js +45 -0
- package/dist/safe-bash-docx-engine/control-repeat.js +46 -0
- package/dist/safe-bash-docx-engine/controls.js +52 -0
- package/dist/safe-bash-docx-engine/create.js +36 -0
- package/dist/safe-bash-docx-engine/diagrams.js +43 -0
- package/dist/safe-bash-docx-engine/diff.js +33 -0
- package/dist/safe-bash-docx-engine/discovery-result-schema.d.ts +72 -0
- package/dist/safe-bash-docx-engine/discovery-result-schema.js +36 -0
- package/dist/safe-bash-docx-engine/document-properties.js +43 -0
- package/dist/safe-bash-docx-engine/equations.js +53 -0
- package/dist/safe-bash-docx-engine/extract.js +40 -0
- package/dist/safe-bash-docx-engine/fields.js +48 -0
- package/dist/safe-bash-docx-engine/font-inventory.js +40 -0
- package/dist/safe-bash-docx-engine/font-resources.js +33 -0
- package/dist/safe-bash-docx-engine/image-batch-operations.d.ts +4 -0
- package/dist/safe-bash-docx-engine/image-batch-operations.js +35 -0
- package/dist/safe-bash-docx-engine/image-insertion.js +46 -0
- package/dist/safe-bash-docx-engine/image-layout.js +43 -0
- package/dist/safe-bash-docx-engine/image-replacement.js +48 -0
- package/dist/safe-bash-docx-engine/images.js +49 -0
- package/dist/safe-bash-docx-engine/index.d.ts +1 -3
- package/dist/safe-bash-docx-engine/index.js +369 -19350
- package/dist/safe-bash-docx-engine/inspection.js +49 -0
- package/dist/safe-bash-docx-engine/invocation.d.ts +50 -0
- package/dist/safe-bash-docx-engine/invocation.js +66 -0
- package/dist/safe-bash-docx-engine/io-errors.js +11 -0
- package/dist/safe-bash-docx-engine/io.js +29 -0
- package/dist/safe-bash-docx-engine/links.js +47 -0
- package/dist/safe-bash-docx-engine/lists.js +46 -0
- package/dist/safe-bash-docx-engine/location-token.js +27 -0
- package/dist/safe-bash-docx-engine/locations.js +39 -0
- package/dist/safe-bash-docx-engine/model-context.js +15 -0
- package/dist/safe-bash-docx-engine/model-errors.js +13 -0
- package/dist/safe-bash-docx-engine/notes.js +48 -0
- package/dist/safe-bash-docx-engine/objects.js +49 -0
- package/dist/safe-bash-docx-engine/operation-json-schema.js +21 -0
- package/dist/safe-bash-docx-engine/operation-schema.js +29 -0
- package/dist/safe-bash-docx-engine/pack-uri-batch-operations.d.ts +3 -0
- package/dist/safe-bash-docx-engine/pack-uri-batch-operations.js +15 -0
- package/dist/safe-bash-docx-engine/pack.js +38 -0
- package/dist/safe-bash-docx-engine/package-view-batch-operations.d.ts +4 -0
- package/dist/safe-bash-docx-engine/package-view-batch-operations.js +47 -0
- package/dist/safe-bash-docx-engine/package-xml.js +25 -0
- package/dist/safe-bash-docx-engine/pandoc-adapter.js +55 -6
- package/dist/safe-bash-docx-engine/paragraph-edit.js +52 -0
- package/dist/safe-bash-docx-engine/part-provider.js +18 -0
- package/dist/safe-bash-docx-engine/property-values.js +46 -0
- package/dist/safe-bash-docx-engine/publication.js +40 -0
- package/dist/safe-bash-docx-engine/removal.js +44 -0
- package/dist/safe-bash-docx-engine/revision-decisions.js +46 -0
- package/dist/safe-bash-docx-engine/revision-edit.js +43 -0
- package/dist/safe-bash-docx-engine/revisions.js +42 -0
- package/dist/safe-bash-docx-engine/run-format.js +43 -0
- package/dist/safe-bash-docx-engine/sanitize.js +59 -0
- package/dist/safe-bash-docx-engine/sections.js +47 -0
- package/dist/safe-bash-docx-engine/settings.js +36 -0
- package/dist/safe-bash-docx-engine/shape-edit.js +47 -0
- package/dist/safe-bash-docx-engine/signatures.js +42 -0
- package/dist/safe-bash-docx-engine/simple-selection.d.ts +1 -1
- package/dist/safe-bash-docx-engine/stories.js +48 -0
- package/dist/safe-bash-docx-engine/structure-model-batch-operations.d.ts +3 -0
- package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +64 -0
- package/dist/safe-bash-docx-engine/style-model-batch-operations.js +57 -0
- package/dist/safe-bash-docx-engine/style-model-result-schema.d.ts +4 -0
- package/dist/safe-bash-docx-engine/style-model-result-schema.js +76 -0
- package/dist/safe-bash-docx-engine/styles.js +44 -0
- package/dist/safe-bash-docx-engine/table-edit.js +52 -0
- package/dist/safe-bash-docx-engine/table-read.js +38 -0
- package/dist/safe-bash-docx-engine/template.js +45 -0
- package/dist/safe-bash-docx-engine/text-replace.js +47 -0
- package/dist/safe-bash-docx-engine/text-resource-read.js +42 -0
- package/dist/safe-bash-docx-engine/text.js +36 -0
- package/dist/safe-bash-docx-engine/validation.js +30 -0
- package/dist/safe-bash-docx-engine/xml-parts.js +48 -0
- package/dist/safe-bash-markdown-engine/index.js +3 -3
- package/dist/safe-bash-network-engine/aggregate.js +3 -3
- package/dist/safe-bash-network-engine/args.js +3 -3
- package/dist/safe-bash-network-engine/body.js +4 -4
- package/dist/safe-bash-network-engine/decode.js +3 -3
- package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
- package/dist/safe-bash-network-engine/index.js +3 -3
- package/dist/safe-bash-network-engine/output.js +3 -3
- package/dist/safe-bash-network-engine/platform-portable.js +3 -3
- package/dist/safe-bash-network-engine/shared.js +2 -2
- package/dist/safe-bash-network-engine/transfer.js +20 -20
- package/dist/safe-bash-pptx-engine/bytes.d.ts +1 -4
- package/dist/safe-bash-pptx-engine/bytes.js +2 -11
- package/dist/safe-bash-pptx-engine/index.d.ts +1 -103
- package/dist/safe-bash-pptx-engine/index.js +1 -662
- package/dist/safe-bash-presentation-engine/LICENSE +21 -0
- package/dist/safe-bash-presentation-engine/accessibility.js +43 -0
- package/dist/safe-bash-presentation-engine/animation-editing.js +29 -0
- package/dist/safe-bash-presentation-engine/animations.js +23 -0
- package/dist/safe-bash-presentation-engine/backgrounds.js +26 -0
- package/dist/safe-bash-presentation-engine/bytes.d.ts +4 -0
- package/dist/safe-bash-presentation-engine/bytes.js +13 -0
- package/dist/safe-bash-presentation-engine/chart-editing.js +60 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-enums.d.ts +2 -2
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-object-operations.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/chart-object-operations.js +35 -0
- package/dist/safe-bash-presentation-engine/charts.js +41 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/color-enums.d.ts +5 -5
- package/dist/safe-bash-presentation-engine/command-placeholder.js +64 -0
- package/dist/safe-bash-presentation-engine/comments.js +32 -0
- package/dist/safe-bash-presentation-engine/connector-operations.js +50 -0
- package/dist/safe-bash-presentation-engine/connectors.js +49 -0
- package/dist/safe-bash-presentation-engine/content-types.js +9 -0
- package/dist/safe-bash-presentation-engine/contracts.js +0 -0
- package/dist/safe-bash-presentation-engine/creation.js +15 -0
- package/dist/safe-bash-presentation-engine/diff.js +40 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/drawing-enums.d.ts +20 -20
- package/dist/safe-bash-presentation-engine/drawing-format.js +44 -0
- package/dist/safe-bash-presentation-engine/drawing-operations.js +41 -0
- package/dist/safe-bash-presentation-engine/drawing-schema.d.ts +1549 -0
- package/dist/safe-bash-presentation-engine/drawing-schema.js +33 -0
- package/dist/safe-bash-presentation-engine/equations.js +30 -0
- package/dist/safe-bash-presentation-engine/errors.js +23 -0
- package/dist/safe-bash-presentation-engine/fields.js +32 -0
- package/dist/safe-bash-presentation-engine/font-metrics.js +12 -0
- package/dist/safe-bash-presentation-engine/image-extraction.js +29 -0
- package/dist/safe-bash-presentation-engine/image-formatting.js +43 -0
- package/dist/safe-bash-presentation-engine/image-insertion.js +26 -0
- package/dist/safe-bash-presentation-engine/image-metadata.d.ts +9 -0
- package/dist/safe-bash-presentation-engine/image-metadata.js +9 -0
- package/dist/safe-bash-presentation-engine/image-replacement.js +30 -0
- package/dist/safe-bash-presentation-engine/image-value.js +15 -0
- package/dist/safe-bash-presentation-engine/images.js +30 -0
- package/dist/safe-bash-presentation-engine/index.d.ts +100 -0
- package/dist/safe-bash-presentation-engine/index.js +791 -0
- package/dist/safe-bash-presentation-engine/layouts.js +31 -0
- package/dist/safe-bash-presentation-engine/length.js +21 -0
- package/dist/safe-bash-presentation-engine/links.js +33 -0
- package/dist/safe-bash-presentation-engine/masters.js +54 -0
- package/dist/safe-bash-presentation-engine/media-editing.js +35 -0
- package/dist/safe-bash-presentation-engine/media-extraction.js +24 -0
- package/dist/safe-bash-presentation-engine/media.js +23 -0
- package/dist/safe-bash-presentation-engine/memberships.js +24 -0
- package/dist/safe-bash-presentation-engine/notes.js +27 -0
- package/dist/safe-bash-presentation-engine/ole-enum.js +10 -0
- package/dist/safe-bash-presentation-engine/ole-insertion.js +29 -0
- package/dist/safe-bash-presentation-engine/opaque-objects.js +21 -0
- package/dist/safe-bash-presentation-engine/package-reader.js +13 -0
- package/dist/safe-bash-presentation-engine/package-tools.js +25 -0
- package/dist/safe-bash-presentation-engine/package-uri.d.ts +13 -0
- package/dist/safe-bash-presentation-engine/package-uri.js +16 -0
- package/dist/safe-bash-presentation-engine/package-writer.js +13 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/presentation-model.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/presentation-model.js +63 -0
- package/dist/safe-bash-presentation-engine/presentation-settings.js +25 -0
- package/dist/safe-bash-presentation-engine/properties.js +37 -0
- package/dist/safe-bash-presentation-engine/publication.d.ts +10 -0
- package/dist/safe-bash-presentation-engine/publication.js +0 -0
- package/dist/safe-bash-presentation-engine/relationships.js +16 -0
- package/dist/safe-bash-presentation-engine/resource-limits.js +8 -0
- package/dist/safe-bash-presentation-engine/sanitize.js +24 -0
- package/dist/safe-bash-presentation-engine/selector-schema.js +7 -0
- package/dist/safe-bash-presentation-engine/selectors.js +26 -0
- package/dist/safe-bash-presentation-engine/shape-groups.js +47 -0
- package/dist/safe-bash-presentation-engine/shape-operations.js +48 -0
- package/dist/safe-bash-presentation-engine/shape-path-operations.js +44 -0
- package/dist/safe-bash-presentation-engine/shape-paths.js +31 -0
- package/dist/safe-bash-presentation-engine/shape-presets.js +11 -0
- package/dist/safe-bash-presentation-engine/shape-selection.js +43 -0
- package/dist/safe-bash-presentation-engine/shape-transforms.js +28 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-types.d.ts +1 -1
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shapes.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/shapes.js +66 -0
- package/dist/safe-bash-presentation-engine/slide-copy.js +24 -0
- package/dist/safe-bash-presentation-engine/slide-import.js +27 -0
- package/dist/safe-bash-presentation-engine/slide-merge-split.js +33 -0
- package/dist/safe-bash-presentation-engine/slide-model.js +74 -0
- package/dist/safe-bash-presentation-engine/slide-removal.js +25 -0
- package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +17 -0
- package/dist/safe-bash-presentation-engine/slides.js +26 -0
- package/dist/safe-bash-presentation-engine/table-operations.js +51 -0
- package/dist/safe-bash-presentation-engine/table-spans.js +42 -0
- package/dist/safe-bash-presentation-engine/tables.js +45 -0
- package/dist/safe-bash-presentation-engine/tags.js +25 -0
- package/dist/safe-bash-presentation-engine/template-bindings.js +44 -0
- package/dist/safe-bash-presentation-engine/template-repeat.js +51 -0
- package/dist/safe-bash-presentation-engine/text-fitting.js +39 -0
- package/dist/safe-bash-presentation-engine/text-frames.js +52 -0
- package/dist/safe-bash-presentation-engine/text-paragraphs.js +58 -0
- package/dist/safe-bash-presentation-engine/text-reading.js +23 -0
- package/dist/safe-bash-presentation-engine/text-replacement.js +24 -0
- package/dist/safe-bash-presentation-engine/text-runs.js +45 -0
- package/dist/safe-bash-presentation-engine/themes.js +31 -0
- package/dist/safe-bash-presentation-engine/transitions.js +27 -0
- package/dist/safe-bash-presentation-engine/validation.js +14 -0
- package/dist/safe-bash-presentation-engine/xml-parts.js +25 -0
- package/dist/safe-bash-presentation-engine/xml-view.js +8 -0
- package/dist/safe-bash-presentation-engine/xml.js +8 -0
- package/dist/safe-bash-sqlite-engine/sqlite-edit-snapshot.d.ts +15 -0
- package/dist/safe-bash-sqlite-engine/sqlite-finalization.d.ts +7 -0
- package/dist/safe-bash-sqlite-engine/sqlite-pages.d.ts +18 -0
- package/dist/safe-bash-sqlite-engine/sqlite-record-read.d.ts +8 -0
- package/dist/safe-bash-sqlite-engine/sqlite-record-write.d.ts +20 -0
- package/dist/safe-bash-sqlite-engine/storage.d.ts +2 -0
- package/dist/safe-bash-sqlite-engine/storage.js +236 -55
- package/dist/safe-bash-svg-engine/LICENSE +21 -0
- package/dist/safe-bash-svg-engine/index.d.ts +8 -0
- package/dist/safe-bash-svg-engine/index.js +477 -0
- package/dist/safe-bash-zip-engine/index.js +3 -3
- package/dist/safe-bash-zip-engine/zip/repair.js +3 -3
- package/dist/safe-bash-zip-engine/zip/sfx.js +3 -3
- package/dist/safe-bash-zip-engine/zip-format.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-provider.generated.js +55 -18
- package/dist/safe-playwright-cloudflare/browser-run-code-guest.generated.js +1 -1
- package/dist/spreadsheet-engine/datasource.js +4 -1
- package/dist/spreadsheet-engine/formulas/functions/math.js +3 -1
- package/dist/spreadsheet-engine/rendering/chart/axis.d.ts +26 -0
- package/dist/spreadsheet-engine/rendering/chart/axis.js +61 -0
- package/dist/spreadsheet-engine/rendering/chart/error-bar.d.ts +39 -0
- package/dist/spreadsheet-engine/rendering/chart/error-bar.js +59 -0
- package/dist/spreadsheet-engine/rendering/chart/layout.d.ts +24 -0
- package/dist/spreadsheet-engine/rendering/chart/layout.js +54 -0
- package/dist/spreadsheet-engine/rendering/chart/line.d.ts +23 -0
- package/dist/spreadsheet-engine/rendering/chart/line.js +56 -0
- package/dist/spreadsheet-engine/rendering/chart/marker.d.ts +35 -0
- package/dist/spreadsheet-engine/rendering/chart/marker.js +52 -0
- package/dist/spreadsheet-engine/rendering/chart/pie.d.ts +32 -0
- package/dist/spreadsheet-engine/rendering/chart/pie.js +47 -0
- package/dist/{safe-bash-command-ssconvert → spreadsheet-engine}/rendering/images/codecs.d.ts +0 -1
- package/dist/spreadsheet-engine/rendering/images/codecs.js +253 -0
- package/dist/spreadsheet-engine/rendering/images/index.d.ts +26 -0
- package/dist/spreadsheet-engine/rendering/images/index.js +144 -0
- package/dist/spreadsheet-engine/rendering/images/profile-raster.d.ts +4 -0
- package/dist/spreadsheet-engine/rendering/images/profile-raster.js +72 -0
- package/dist/spreadsheet-engine/rendering/images/scene.d.ts +3 -0
- package/dist/spreadsheet-engine/rendering/images/scene.js +34 -0
- package/dist/spreadsheet-engine/rendering/print/cell-style.d.ts +10 -0
- package/dist/spreadsheet-engine/rendering/print/cell-style.js +52 -0
- package/dist/spreadsheet-engine/rendering/print/font-normalization-data.d.ts +43 -0
- package/dist/spreadsheet-engine/rendering/print/font-normalization-data.js +1558 -0
- package/dist/spreadsheet-engine/rendering/print/font-normalization.d.ts +3 -0
- package/dist/spreadsheet-engine/rendering/print/font-normalization.js +113 -0
- package/dist/spreadsheet-engine/rendering/print/font-shaping.d.ts +18 -0
- package/dist/spreadsheet-engine/rendering/print/font-shaping.js +271 -0
- package/dist/spreadsheet-engine/rendering/print/harfbuzz/data.d.ts +1 -0
- package/dist/spreadsheet-engine/rendering/print/harfbuzz/data.js +2 -0
- package/dist/spreadsheet-engine/rendering/print/header-footer.d.ts +16 -0
- package/dist/spreadsheet-engine/rendering/print/header-footer.js +92 -0
- package/dist/spreadsheet-engine/rendering/print/layout.d.ts +65 -0
- package/dist/spreadsheet-engine/rendering/print/layout.js +75 -0
- package/dist/spreadsheet-engine/rendering/print/pagination.d.ts +34 -0
- package/dist/spreadsheet-engine/rendering/print/pagination.js +126 -0
- package/dist/spreadsheet-engine/rendering/print/settings.d.ts +42 -0
- package/dist/spreadsheet-engine/rendering/print/settings.js +159 -0
- package/dist/spreadsheet-format-xls/biff-metadata.js +3 -3
- package/dist/spreadsheet-format-xls/biff-write-metadata.d.ts +1 -1
- package/dist/spreadsheet-format-xls/biff-write-metadata.js +20 -3
- package/dist/spreadsheet-format-xls/biff-write.js +1 -1
- package/package.json +239 -12
- package/third-party/spreadsheet-engine/scripts/harfbuzz/README.md +39 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/allocator.cc +18 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/build.mjs +94 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/completion.patch +98 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/config-override.h +19 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/exports.json +29 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/sources.json +274 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/verify.d.mts +10 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/verify.mjs +96 -0
- package/third-party/spreadsheet-engine/scripts/harfbuzz/verify.test.mjs +60 -0
- package/third-party/spreadsheet-engine/src/rendering/images/NOTICE.md +22 -0
- package/third-party/spreadsheet-engine/src/rendering/print/NOTICE.md +30 -0
- package/third-party/spreadsheet-engine/src/rendering/print/font-normalization-NOTICE.md +64 -0
- package/third-party/spreadsheet-engine/src/rendering/print/font-normalization-data.ts +1558 -0
- package/third-party/spreadsheet-engine/src/rendering/print/font-normalization.ts +91 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/EMSCRIPTEN-LICENSE.txt +102 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/HARFBUZZ-LICENSE.txt +42 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/LIBCXX-LICENSE.txt +311 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/LIBCXXABI-LICENSE.txt +311 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/MUSL-LICENSE.txt +193 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/NOTICE.md +41 -0
- package/third-party/spreadsheet-engine/src/rendering/print/harfbuzz/data.ts +2 -0
- package/dist/safe-bash/command-chunks/chunk-C5TUE2FE.js +0 -169
- package/dist/safe-bash/command-chunks/chunk-CVKW2YIC.js +0 -13631
- package/dist/safe-bash/command-chunks/chunk-JBGGUHQY.js +0 -17617
- package/dist/safe-bash/command-chunks/chunk-S4R2JDPL.js +0 -35
- package/dist/safe-bash/command-chunks/chunk-TU5IFVCX.js +0 -33708
- package/dist/safe-bash/command-chunks/chunk-TUWGIF22.js +0 -328
- package/dist/safe-bash/command-chunks/data-2FJOPYXA-PDKMLCGR.js +0 -8
- package/dist/safe-bash/command-chunks/index.browser-2NLML6H4.js +0 -269
- package/dist/safe-bash/command-chunks/model-store-EEI3QS4G.js +0 -10
- package/dist/safe-bash/command-chunks/pdf-M2GFAR2A-FCJMJCAP.js +0 -683
- package/dist/safe-bash-command-ssconvert/rendering/images/formats.d.ts +0 -2
- package/dist/safe-bash-docx-engine/command.d.ts +0 -65
- package/dist/safe-bash/chunks/{chunk-4T4RQYRI.js → chunk-5HRGBHZH.js} +10 -10
- package/dist/safe-bash/chunks/{chunk-QUS6X4MS.js → chunk-EOQMDRTY.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-2L3JKGUH.js → chunk-4LYZBDZF.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-EMMSXKEJ.js → chunk-4Q4R3VZU.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-5RLK2QSY.js → chunk-7JEIWA3A.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-AV6N7DDA.js → chunk-DDYPQAXN.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OOB7YCFQ.js → chunk-FMJKCVSQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FUL2C4EX.js → chunk-HFKS6AET.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-2M3WUEDX.js → chunk-J6K5Q53O.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-ATWMLV75.js → chunk-RJXZYDSN.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-JD3NSHFT.js → chunk-TVGIJ56E.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-3I33KPQH.js → chunk-X2HVVMTW.js} +6 -6
- package/dist/safe-bash/command-chunks/{odf-UKSXPNOZ-NCL5P7YL.js → odf-UKSXPNOZ-BV2LCKTB.js} +0 -0
- package/dist/{safe-bash/command-chunks/chunk-3SVT5VB7.js → safe-bash-docx-engine/operation-types.js} +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/accessibility.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/animation-editing.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/animations.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/backgrounds.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-data-model.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-editing.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-font-operations.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-model-axes.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-model-core.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-model-series.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-model.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-objects.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/chart-workbook.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/charts.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/command-placeholder.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/comments.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/connector-operations.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/connectors-model.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/connectors.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/content-types.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/contracts.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/creation.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/diagram-resources.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/diff.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/drawing-format.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/drawing-operations.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/equations.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/errors.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/fields.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/font-metrics.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/freeform-builder.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/group-model.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/image-extraction.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/image-formatting.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/image-insertion.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/image-replacement.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/image-value.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/images.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/inventory.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/language-enum.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/layouts.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/length.d.ts +0 -0
- package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/links-model.d.ts +4 -4
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/links.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/masters.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/media-editing.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/media-enum.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/media-extraction.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/media.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/memberships.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/modern-comments.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/notes.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/ole-enum.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/ole-insertion.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/opaque-objects.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/package-reader.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/package-tools.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/package-view.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/package-writer.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/paragraph-alignment.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/presentation-settings.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/properties.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/relationships.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/resource-limits.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/sanitize.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/selector-schema.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/selectors.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-adjustments.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-groups.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-operations.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-path-operations.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-paths.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-placeholder-types.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-presets.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-selection.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/shape-transforms.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-copy.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-import.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-layout-model.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-merge-split.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-model.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-removal.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slide-transfer-budget.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/slides.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/table-operations.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/table-spans.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/tables-model.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/tables.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/tags.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/template-bindings.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/template-repeat.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-fitting.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-frame-enums.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-frames.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-paragraphs.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-reading.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-replacement.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-run-color.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-runs.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/text-style-resolution.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/themes.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/transitions.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/validation.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/xml-parts.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/xml-view.d.ts +0 -0
- /package/dist/{safe-bash-pptx-engine → safe-bash-presentation-engine}/xml.d.ts +0 -0
|
@@ -0,0 +1,1677 @@
|
|
|
1
|
+
import {
|
|
2
|
+
acquireDocumentModelInput
|
|
3
|
+
} from "./chunk-ZXKOMB24.js";
|
|
4
|
+
import {
|
|
5
|
+
PackURI
|
|
6
|
+
} from "./chunk-S6PPBBXX.js";
|
|
7
|
+
import {
|
|
8
|
+
createPropertyPart
|
|
9
|
+
} from "./chunk-W32KW66B.js";
|
|
10
|
+
import {
|
|
11
|
+
inlineImageRun
|
|
12
|
+
} from "./chunk-WVESNAND.js";
|
|
13
|
+
import {
|
|
14
|
+
Image,
|
|
15
|
+
copyImageForOwner,
|
|
16
|
+
modelVfsResolver
|
|
17
|
+
} from "./chunk-A7EMM3SB.js";
|
|
18
|
+
import {
|
|
19
|
+
contextData,
|
|
20
|
+
modelContext
|
|
21
|
+
} from "./chunk-2W54TAGI.js";
|
|
22
|
+
import {
|
|
23
|
+
createDocumentArchive,
|
|
24
|
+
originalModelDefaults
|
|
25
|
+
} from "./chunk-XH6DXJHX.js";
|
|
26
|
+
import {
|
|
27
|
+
styleAllocationIds
|
|
28
|
+
} from "./chunk-MQFXMBGD.js";
|
|
29
|
+
import {
|
|
30
|
+
UnsupportedEmbeddedFontMutationError,
|
|
31
|
+
embeddedFontState
|
|
32
|
+
} from "./chunk-WOZCIRJ5.js";
|
|
33
|
+
import {
|
|
34
|
+
assertLiveCommentExtensionPartPreserved
|
|
35
|
+
} from "./chunk-IFNLDOJ4.js";
|
|
36
|
+
import {
|
|
37
|
+
retainedRelationshipTargets
|
|
38
|
+
} from "./chunk-4LXDJES2.js";
|
|
39
|
+
import {
|
|
40
|
+
SemanticValidationError,
|
|
41
|
+
validateDocumentArchive
|
|
42
|
+
} from "./chunk-3SEQG5JH.js";
|
|
43
|
+
import {
|
|
44
|
+
PublicationError
|
|
45
|
+
} from "./chunk-JGGRMERW.js";
|
|
46
|
+
import {
|
|
47
|
+
DocumentPackage,
|
|
48
|
+
documentTypes,
|
|
49
|
+
readDocumentArchive
|
|
50
|
+
} from "./chunk-GLPIFP7N.js";
|
|
51
|
+
import {
|
|
52
|
+
DocumentXmlEditor,
|
|
53
|
+
UnsupportedEditError,
|
|
54
|
+
activeXmlChildren,
|
|
55
|
+
editActiveRelationshipXml,
|
|
56
|
+
runElementOpen,
|
|
57
|
+
xmlValue
|
|
58
|
+
} from "./chunk-YPVBU7QF.js";
|
|
59
|
+
import {
|
|
60
|
+
corePropertyKeys,
|
|
61
|
+
corePropertyNamespace,
|
|
62
|
+
normalizePropertyDate,
|
|
63
|
+
readCorePropertyDate,
|
|
64
|
+
readPropertyNodes,
|
|
65
|
+
serializePropertyScalar
|
|
66
|
+
} from "./chunk-VEUQWV2V.js";
|
|
67
|
+
import {
|
|
68
|
+
collapseRelationshipScalar,
|
|
69
|
+
relationshipXmlIds,
|
|
70
|
+
relationshipXmlRows
|
|
71
|
+
} from "./chunk-2PSVE7I5.js";
|
|
72
|
+
import {
|
|
73
|
+
documentDialects
|
|
74
|
+
} from "./chunk-MG7AJD5E.js";
|
|
75
|
+
import {
|
|
76
|
+
snapshotSequence,
|
|
77
|
+
validateDocxValue
|
|
78
|
+
} from "./chunk-R4TYL2G6.js";
|
|
79
|
+
import {
|
|
80
|
+
compatibilityProfileForPart
|
|
81
|
+
} from "./chunk-GZ2N24A2.js";
|
|
82
|
+
import {
|
|
83
|
+
BoundsError,
|
|
84
|
+
MissingKeyError,
|
|
85
|
+
OwnershipError,
|
|
86
|
+
StaleHandleError
|
|
87
|
+
} from "./chunk-OBK24KGM.js";
|
|
88
|
+
import {
|
|
89
|
+
asciiKey,
|
|
90
|
+
normalizePartName,
|
|
91
|
+
relativePartTarget
|
|
92
|
+
} from "./chunk-WAKYUXVQ.js";
|
|
93
|
+
import {
|
|
94
|
+
isXmlContentType,
|
|
95
|
+
parseDocumentXml,
|
|
96
|
+
parseMediaType
|
|
97
|
+
} from "./chunk-MWAAMNAM.js";
|
|
98
|
+
import {
|
|
99
|
+
InputTypeError,
|
|
100
|
+
InvalidValueError,
|
|
101
|
+
ResourceLimitError,
|
|
102
|
+
archiveSettings
|
|
103
|
+
} from "./chunk-IQFRPIXH.js";
|
|
104
|
+
|
|
105
|
+
// packages/safe-bash-docx-engine/src/xml-element-view.ts
|
|
106
|
+
var replaceXmlScalar = /* @__PURE__ */ Symbol("replace-xml-scalar");
|
|
107
|
+
function expanded(node) {
|
|
108
|
+
return Object.freeze({ namespaceURI: node.namespace, localName: node.localName });
|
|
109
|
+
}
|
|
110
|
+
function markup(node, budget, depth = 1) {
|
|
111
|
+
budget.check("xmlDepth", depth);
|
|
112
|
+
budget.charge("work", 1);
|
|
113
|
+
if (node.kind === "text") return xmlValue(node.text);
|
|
114
|
+
if (node.kind === "comment") return `<!--${node.text}-->`;
|
|
115
|
+
if (node.kind === "processingInstruction") return `<?${node.target}${node.data ? " " + node.data : ""}?>`;
|
|
116
|
+
if (node.kind !== "element") throw new InputTypeError("Expected a structured XML element.");
|
|
117
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
118
|
+
const qualify = (name, attribute = false) => {
|
|
119
|
+
if (!name.namespaceURI) return name.localName;
|
|
120
|
+
if (name.namespaceURI === "http://www.w3.org/2000/xmlns/") throw new UnsupportedEditError("Namespace declarations are not mutable attributes.");
|
|
121
|
+
const prefix = name.namespaceURI === "http://www.w3.org/XML/1998/namespace" ? "xml" : name.namespaceURI === "http://purl.org/dc/terms/" ? "dcterms" : [...namespaces].find(([, uri]) => uri === name.namespaceURI)?.[0] ?? `x${namespaces.size}`;
|
|
122
|
+
namespaces.set(prefix, name.namespaceURI);
|
|
123
|
+
if (attribute && name.localName === "xmlns") throw new UnsupportedEditError("Namespace declarations are not mutable attributes.");
|
|
124
|
+
return `${prefix}:${name.localName}`;
|
|
125
|
+
};
|
|
126
|
+
const tag = qualify(node.name);
|
|
127
|
+
const attributes = (node.attributes ?? []).map((attribute) => ` ${qualify(attribute.name, true)}="${xmlValue(attribute.value)}"`).join("");
|
|
128
|
+
const declarations = [...namespaces].filter(([prefix]) => prefix !== "xml").map(([prefix, uri]) => ` xmlns:${prefix}="${xmlValue(uri)}"`).join("");
|
|
129
|
+
const children = (node.children ?? []).map((child) => markup(child, budget, depth + 1)).join("");
|
|
130
|
+
budget.charge("retainedBytes", (tag.length + attributes.length + declarations.length + children.length) * 2);
|
|
131
|
+
return `<${tag}${node.name.namespaceURI ? "" : ' xmlns=""'}${declarations}${attributes}>${children}</${tag}>`;
|
|
132
|
+
}
|
|
133
|
+
var XmlViewStore = class {
|
|
134
|
+
constructor(binding) {
|
|
135
|
+
this.binding = binding;
|
|
136
|
+
}
|
|
137
|
+
binding;
|
|
138
|
+
paths = /* @__PURE__ */ new Map();
|
|
139
|
+
source;
|
|
140
|
+
read() {
|
|
141
|
+
this.binding.budget.check("work", 0);
|
|
142
|
+
const xml = this.binding.read(), root = this.binding.resolve(xml);
|
|
143
|
+
const source = xml.sourceXml(root);
|
|
144
|
+
if (this.source !== void 0 && source !== this.source) {
|
|
145
|
+
for (const [view, path] of this.paths) if (path?.length) this.paths.set(view, null);
|
|
146
|
+
}
|
|
147
|
+
this.source = source;
|
|
148
|
+
return { xml, root };
|
|
149
|
+
}
|
|
150
|
+
node(view) {
|
|
151
|
+
const { xml, root } = this.read(), path = this.paths.get(view);
|
|
152
|
+
if (!path) throw new StaleHandleError("The XML view is detached.");
|
|
153
|
+
let node = root;
|
|
154
|
+
for (const index of path) {
|
|
155
|
+
this.binding.budget.charge("work", 1);
|
|
156
|
+
const child = node.children[index];
|
|
157
|
+
if (!child) throw new StaleHandleError("The XML view is detached.");
|
|
158
|
+
node = child;
|
|
159
|
+
}
|
|
160
|
+
return { xml, node };
|
|
161
|
+
}
|
|
162
|
+
view(path) {
|
|
163
|
+
this.binding.budget.charge("retainedBytes", 128 + path.length * 8);
|
|
164
|
+
const view = new XmlElementView(this);
|
|
165
|
+
this.paths.set(view, path);
|
|
166
|
+
return view;
|
|
167
|
+
}
|
|
168
|
+
change(action) {
|
|
169
|
+
this.read();
|
|
170
|
+
this.binding.change((xml2) => action(xml2, this.binding.resolve(xml2)));
|
|
171
|
+
const xml = this.binding.read();
|
|
172
|
+
this.source = xml.sourceXml(this.binding.resolve(xml));
|
|
173
|
+
}
|
|
174
|
+
shift(parent, index, remove) {
|
|
175
|
+
for (const [view, path] of this.paths) {
|
|
176
|
+
if (!path || path.length <= parent.length || !parent.every((value, offset) => path[offset] === value)) continue;
|
|
177
|
+
const position = path[parent.length];
|
|
178
|
+
if (remove && position === index) this.paths.set(view, null);
|
|
179
|
+
else if (position >= index) this.paths.set(view, [...path.slice(0, parent.length), position + (remove ? -1 : 1), ...path.slice(parent.length + 1)]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var XmlElementView = class {
|
|
184
|
+
#store;
|
|
185
|
+
constructor(store) {
|
|
186
|
+
this.#store = store;
|
|
187
|
+
Object.freeze(this);
|
|
188
|
+
}
|
|
189
|
+
get tag() {
|
|
190
|
+
return expanded(this.#store.node(this).node);
|
|
191
|
+
}
|
|
192
|
+
get localName() {
|
|
193
|
+
return this.tag.localName;
|
|
194
|
+
}
|
|
195
|
+
get namespace() {
|
|
196
|
+
return this.tag.namespaceURI;
|
|
197
|
+
}
|
|
198
|
+
get attributes() {
|
|
199
|
+
const attributes = this.#store.node(this).node.attributes;
|
|
200
|
+
this.#store.binding.budget.charge("retainedBytes", attributes.length * 128);
|
|
201
|
+
return new Map(attributes.filter((attribute) => attribute.namespace !== "http://www.w3.org/2000/xmlns/").map((attribute) => [expanded(attribute), attribute.value]));
|
|
202
|
+
}
|
|
203
|
+
get children() {
|
|
204
|
+
const { node } = this.#store.node(this), path = this.#store.paths.get(this);
|
|
205
|
+
return snapshotSequence(node.children.map((_, index) => this.#store.view([...path, index])));
|
|
206
|
+
}
|
|
207
|
+
get text() {
|
|
208
|
+
const { node } = this.#store.node(this);
|
|
209
|
+
let text = "";
|
|
210
|
+
for (const token of node.content) {
|
|
211
|
+
if (token.kind !== "text" && token.kind !== "cdata") break;
|
|
212
|
+
text += token.text;
|
|
213
|
+
}
|
|
214
|
+
return text || null;
|
|
215
|
+
}
|
|
216
|
+
set text(value) {
|
|
217
|
+
if (value !== null && typeof value !== "string") throw new InputTypeError("Expected XML text or null.");
|
|
218
|
+
this.#store.node(this);
|
|
219
|
+
const path = this.#store.paths.get(this);
|
|
220
|
+
this.#store.change((xml, root) => xml.setLeadingText(this.resolve(root, path), value));
|
|
221
|
+
}
|
|
222
|
+
[replaceXmlScalar](value) {
|
|
223
|
+
if (typeof value !== "string") throw new InputTypeError("Expected scalar XML text.");
|
|
224
|
+
this.#store.node(this);
|
|
225
|
+
const path = this.#store.paths.get(this);
|
|
226
|
+
this.#store.change((xml, root) => xml.replaceScalarText(this.resolve(root, path), value));
|
|
227
|
+
}
|
|
228
|
+
get tail() {
|
|
229
|
+
const { xml, node } = this.#store.node(this);
|
|
230
|
+
const stack = [xml.root];
|
|
231
|
+
let content = xml.root.epilog ?? [], index = 0;
|
|
232
|
+
while (stack.length) {
|
|
233
|
+
const parent = stack.pop();
|
|
234
|
+
this.#store.binding.budget.charge("work", 1);
|
|
235
|
+
if (parent.children.includes(node)) {
|
|
236
|
+
content = parent.content;
|
|
237
|
+
index = content.indexOf(node) + 1;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
for (const child of parent.children) stack.push(child);
|
|
241
|
+
}
|
|
242
|
+
let text = "";
|
|
243
|
+
for (; index < content.length; index++) {
|
|
244
|
+
const token = content[index];
|
|
245
|
+
if (token.kind !== "text" && token.kind !== "cdata") break;
|
|
246
|
+
text += token.text;
|
|
247
|
+
}
|
|
248
|
+
return text || null;
|
|
249
|
+
}
|
|
250
|
+
set tail(value) {
|
|
251
|
+
if (value !== null && typeof value !== "string") throw new InputTypeError("Expected XML tail or null.");
|
|
252
|
+
this.#store.node(this);
|
|
253
|
+
const path = this.#store.paths.get(this);
|
|
254
|
+
this.#store.change((xml, root) => xml.setElementTail(this.resolve(root, path), value));
|
|
255
|
+
}
|
|
256
|
+
set_attribute(name, value) {
|
|
257
|
+
if (!validateDocxValue("ExpandedName", name) || value !== null && typeof value !== "string") throw new InputTypeError("Expected an expanded XML attribute and string or null.");
|
|
258
|
+
this.#store.node(this);
|
|
259
|
+
const path = this.#store.paths.get(this);
|
|
260
|
+
this.#store.change((xml, root) => xml.setQualifiedAttribute(this.resolve(root, path), { namespace: name.namespaceURI, localName: name.localName }, value));
|
|
261
|
+
}
|
|
262
|
+
insert(index, node) {
|
|
263
|
+
const { node: parent } = this.#store.node(this), path = this.#store.paths.get(this);
|
|
264
|
+
if (!Number.isSafeInteger(index) || index < 0 || index > parent.children.length) throw new BoundsError("XML child index is out of range.");
|
|
265
|
+
if (!validateDocxValue("XmlNodeInput", node)) throw new InputTypeError("Expected an original structured XML node.");
|
|
266
|
+
const source = markup(node, this.#store.binding.budget);
|
|
267
|
+
this.#store.change((xml, root) => {
|
|
268
|
+
const parent2 = this.resolve(root, path);
|
|
269
|
+
xml.insertChildren(parent2, source, parent2.children[index]);
|
|
270
|
+
});
|
|
271
|
+
this.#store.binding.inserted?.(parent, node, index);
|
|
272
|
+
if (node.kind !== "element") return this;
|
|
273
|
+
this.#store.shift(path, index, false);
|
|
274
|
+
return this.#store.view([...path, index]);
|
|
275
|
+
}
|
|
276
|
+
remove() {
|
|
277
|
+
const { xml, node } = this.#store.node(this), path = this.#store.paths.get(this);
|
|
278
|
+
if (!path.length && this.#store.binding.removeRoot) {
|
|
279
|
+
this.#store.binding.removeRoot();
|
|
280
|
+
for (const view of this.#store.paths.keys()) this.#store.paths.set(view, null);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const parentPath = path.slice(0, -1), parent = path.length ? this.resolve(this.#store.binding.resolve(xml), parentPath) : void 0;
|
|
284
|
+
this.#store.change((editor, root) => editor.replaceElement(this.resolve(root, path), ""));
|
|
285
|
+
this.#store.binding.removed?.(parent, node);
|
|
286
|
+
if (!path.length) {
|
|
287
|
+
for (const view of this.#store.paths.keys()) this.#store.paths.set(view, null);
|
|
288
|
+
} else this.#store.shift(parentPath, path.at(-1), true);
|
|
289
|
+
}
|
|
290
|
+
serialize() {
|
|
291
|
+
const { xml, node } = this.#store.node(this);
|
|
292
|
+
const source = runElementOpen(node) + xml.sourceXml(node, /* @__PURE__ */ new Map(), true) + `</${node.name}>`;
|
|
293
|
+
const bytes = new TextEncoder().encode(source);
|
|
294
|
+
this.#store.binding.budget.check("serializedOutput", bytes.length);
|
|
295
|
+
this.#store.binding.budget.charge("retainedBytes", bytes.length);
|
|
296
|
+
return bytes;
|
|
297
|
+
}
|
|
298
|
+
resolve(root, path) {
|
|
299
|
+
let node = root;
|
|
300
|
+
for (const index of path) {
|
|
301
|
+
const child = node.children[index];
|
|
302
|
+
if (!child) throw new StaleHandleError("The XML view is detached.");
|
|
303
|
+
node = child;
|
|
304
|
+
}
|
|
305
|
+
return node;
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
function bindXmlElementView(binding) {
|
|
309
|
+
const store = new XmlViewStore(binding);
|
|
310
|
+
return store.view([]);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// packages/safe-bash-docx-engine/src/model-admission.ts
|
|
314
|
+
async function admitDocumentModel(input, context) {
|
|
315
|
+
const captured = modelContext(context);
|
|
316
|
+
const { template, ...rest } = captured;
|
|
317
|
+
if (template !== void 0 && input != null)
|
|
318
|
+
throw new InputTypeError("Supply document input or a context template, not both.");
|
|
319
|
+
const settings = template === void 0 ? captured : modelContext(rest);
|
|
320
|
+
let source;
|
|
321
|
+
if (input != null && !(input instanceof Uint8Array)) {
|
|
322
|
+
const record = contextData(input);
|
|
323
|
+
if (Object.hasOwn(record, "path")) {
|
|
324
|
+
contextData(input, ["path", "capability"]);
|
|
325
|
+
const resolver = modelVfsResolver(record.path, record.capability, settings);
|
|
326
|
+
const path = record.path, filesystem = resolver.filesystem;
|
|
327
|
+
input = { path, capability: record.capability };
|
|
328
|
+
source = { path, ...filesystem ? { filesystem, input: { path, stat: { ...await filesystem.lstat(path, { signal: settings.signal }) } } } : {} };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const archive = input != null ? await readDocumentArchive(await acquireDocumentModelInput(input, settings), settings) : await createDocumentArchive(
|
|
332
|
+
template === void 0 ? {
|
|
333
|
+
...settings.timestamp === void 0 ? {} : { timestamp: settings.timestamp.toISOString() },
|
|
334
|
+
author: settings.author
|
|
335
|
+
} : { template },
|
|
336
|
+
settings
|
|
337
|
+
);
|
|
338
|
+
if (source?.input && source.filesystem) {
|
|
339
|
+
const current = await source.filesystem.lstat(source.path, { signal: settings.signal });
|
|
340
|
+
if (["identityScope", "ino", "dev", "type", "revision", "size", "mode", "nlink", "mtimeMs", "ctimeMs"].some((key) => current[key] !== source.input.stat[key]))
|
|
341
|
+
throw new PublicationError("conflict", "Input changed during admission.");
|
|
342
|
+
}
|
|
343
|
+
return { archive, settings, source };
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// packages/safe-bash-docx-engine/src/package-view.ts
|
|
347
|
+
var relNamespace = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
348
|
+
var relContentType = "application/vnd.openxmlformats-package.relationships+xml";
|
|
349
|
+
var packageRegister = /* @__PURE__ */ Symbol("register");
|
|
350
|
+
var packagePart = /* @__PURE__ */ Symbol("part");
|
|
351
|
+
var packageStyleAllocationIds = /* @__PURE__ */ Symbol("style-allocation-ids");
|
|
352
|
+
var packageMetadata = /* @__PURE__ */ Symbol("metadata");
|
|
353
|
+
var packageRelationships = /* @__PURE__ */ Symbol("relationships");
|
|
354
|
+
var packageEdges = /* @__PURE__ */ Symbol("edges");
|
|
355
|
+
var packageRelationshipXml = /* @__PURE__ */ Symbol("relationshipXml");
|
|
356
|
+
var packageEditRelationships = /* @__PURE__ */ Symbol("editRelationships");
|
|
357
|
+
var packageNextRelationshipId = /* @__PURE__ */ Symbol("nextRelationshipId");
|
|
358
|
+
var packageBindXml = /* @__PURE__ */ Symbol("bindXml");
|
|
359
|
+
var packageReadXml = /* @__PURE__ */ Symbol("read-xml");
|
|
360
|
+
var packageRename = /* @__PURE__ */ Symbol("rename");
|
|
361
|
+
var packageValidate = /* @__PURE__ */ Symbol("validate");
|
|
362
|
+
var packageAdmitPart = /* @__PURE__ */ Symbol("admit-part");
|
|
363
|
+
var packageNumbering = /* @__PURE__ */ Symbol("numbering");
|
|
364
|
+
var packageCreateNative = /* @__PURE__ */ Symbol("create-native");
|
|
365
|
+
var packageModel = /* @__PURE__ */ Symbol("model");
|
|
366
|
+
var packageBindStyles = /* @__PURE__ */ Symbol("bind-styles");
|
|
367
|
+
var packageCore = /* @__PURE__ */ Symbol("core-properties");
|
|
368
|
+
var coreRead = /* @__PURE__ */ Symbol("core-read");
|
|
369
|
+
var coreWrite = /* @__PURE__ */ Symbol("core-write");
|
|
370
|
+
var packageImage = /* @__PURE__ */ Symbol("image");
|
|
371
|
+
var packageImages = /* @__PURE__ */ Symbol("images");
|
|
372
|
+
var packageAdmitImages = /* @__PURE__ */ Symbol("admit-images");
|
|
373
|
+
var packageBindImage = /* @__PURE__ */ Symbol("bind-image");
|
|
374
|
+
var packageOwnerCheckpoint = /* @__PURE__ */ Symbol("owner-checkpoint");
|
|
375
|
+
var packageLoadImage = /* @__PURE__ */ Symbol("load-image");
|
|
376
|
+
var packageStoryImage = /* @__PURE__ */ Symbol("story-image");
|
|
377
|
+
var partNames = /* @__PURE__ */ new WeakMap();
|
|
378
|
+
var validateNativePartType = /* @__PURE__ */ Symbol("validate-native-part-type");
|
|
379
|
+
var invalidateRelationshipViews = /* @__PURE__ */ Symbol("invalidate-relationship-views");
|
|
380
|
+
function relationshipName(owner) {
|
|
381
|
+
if (owner === "/") return "_rels/.rels";
|
|
382
|
+
const uri = new PackURI(owner);
|
|
383
|
+
return uri.rels_uri.membername;
|
|
384
|
+
}
|
|
385
|
+
var PackageView = class {
|
|
386
|
+
#binding;
|
|
387
|
+
#parts = /* @__PURE__ */ new Map();
|
|
388
|
+
#relationships = /* @__PURE__ */ new Map();
|
|
389
|
+
#revision = 0;
|
|
390
|
+
#admitting;
|
|
391
|
+
#cached;
|
|
392
|
+
#imageParts;
|
|
393
|
+
#images = /* @__PURE__ */ new Map();
|
|
394
|
+
#xmlReads = /* @__PURE__ */ new WeakMap();
|
|
395
|
+
constructor(binding) {
|
|
396
|
+
this.#binding = binding;
|
|
397
|
+
}
|
|
398
|
+
static async open(input, context) {
|
|
399
|
+
const settings = modelContext(context);
|
|
400
|
+
if (input == null) throw new InputTypeError("Expected explicit package input.");
|
|
401
|
+
if (settings.template !== void 0) throw new InputTypeError("A context template conflicts with package input.");
|
|
402
|
+
const admitted = await admitDocumentModel(input, settings);
|
|
403
|
+
const { ModelStore } = await import("./model-store-JUFU3RSW.js");
|
|
404
|
+
const store = new ModelStore(admitted.archive, admitted.settings, admitted.archive.mainPart, admitted.source);
|
|
405
|
+
store.package.after_unmarshal();
|
|
406
|
+
return store.package;
|
|
407
|
+
}
|
|
408
|
+
get revision() {
|
|
409
|
+
return this.#revision;
|
|
410
|
+
}
|
|
411
|
+
[packageModel](part) {
|
|
412
|
+
this[packageMetadata](part);
|
|
413
|
+
if (!this.#binding.model) throw new UnsupportedEditError("This package does not have a live document model binding.");
|
|
414
|
+
return this.#binding.model;
|
|
415
|
+
}
|
|
416
|
+
[packageOwnerCheckpoint]() {
|
|
417
|
+
const parts = new Map(this.#parts), relationships = new Map(this.#relationships), images = new Map(this.#images), revision = this.#revision;
|
|
418
|
+
const names = new Map([...parts.values()].map((part) => [part, partNames.get(part)]));
|
|
419
|
+
return () => {
|
|
420
|
+
for (const part of this.#parts.values()) if (!names.has(part)) partNames.delete(part);
|
|
421
|
+
this.#parts.clear();
|
|
422
|
+
for (const [key, part] of parts) this.#parts.set(key, part);
|
|
423
|
+
for (const [part, name] of names) partNames.set(part, name);
|
|
424
|
+
this.#relationships.clear();
|
|
425
|
+
for (const [key, value] of relationships) this.#relationships.set(key, value);
|
|
426
|
+
this.#images.clear();
|
|
427
|
+
for (const [key, image] of images) this.#images.set(key, image);
|
|
428
|
+
this.#revision = revision;
|
|
429
|
+
this.#cached = void 0;
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
current() {
|
|
433
|
+
const settings = archiveSettings(this.#binding.context);
|
|
434
|
+
settings.budget.check("work", 0);
|
|
435
|
+
const version = `${this.#revision}:${this.#binding.version()}`;
|
|
436
|
+
if (!this.#cached || this.#cached.version !== version) {
|
|
437
|
+
const archive = this.#binding.snapshot();
|
|
438
|
+
this.#cached = { version, archive, graph: new DocumentPackage(archive, settings.limits, settings.budget) };
|
|
439
|
+
}
|
|
440
|
+
return this.#cached;
|
|
441
|
+
}
|
|
442
|
+
relationshipMember(owner) {
|
|
443
|
+
const { archive, graph } = this.current();
|
|
444
|
+
const key = asciiKey("/" + relationshipName(owner));
|
|
445
|
+
archiveSettings(this.#binding.context).budget.charge("work", graph.parts.length + archive.members.length);
|
|
446
|
+
const part = graph.parts.find((part2) => asciiKey(part2.partname) === key);
|
|
447
|
+
return part && archive.members.find((member) => member.name === part.name);
|
|
448
|
+
}
|
|
449
|
+
[packageRegister](part, name) {
|
|
450
|
+
name = normalizePartName(name);
|
|
451
|
+
if (this.#parts.has(asciiKey(name))) throw new InvalidValueError("The part already has an owner view.");
|
|
452
|
+
const metadata = this.#admitting && asciiKey(this.#admitting.partname) === asciiKey(name) ? this.#admitting : this.current().graph.getPart(name);
|
|
453
|
+
if (part instanceof XmlPartView) XmlPartView[validateNativePartType](part, metadata.content_type);
|
|
454
|
+
partNames.set(part, name);
|
|
455
|
+
this.#parts.set(asciiKey(name), part);
|
|
456
|
+
}
|
|
457
|
+
[packagePart](name, metadata = this.current().graph.getPart(name)) {
|
|
458
|
+
const key = asciiKey(metadata.partname);
|
|
459
|
+
let part = this.#parts.get(key);
|
|
460
|
+
if (!part) {
|
|
461
|
+
const type = parseMediaType(metadata.content_type);
|
|
462
|
+
part = type.startsWith("image/") ? new ImagePartView(this, metadata.partname) : type === "application/vnd.openxmlformats-package.core-properties+xml" ? new CorePropertiesPartView(this, metadata.partname) : Object.values(documentTypes).includes(type) ? new DocumentPartView(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ? new NumberingPart(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ? new HeaderPart(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ? new FooterPart(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ? new CommentsPart(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ? new SettingsPart(this, metadata.partname) : type === "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ? new StylesPart(this, metadata.partname) : isXmlContentType(type) ? new XmlPartView(this, metadata.partname) : new PartView(this, metadata.partname);
|
|
463
|
+
}
|
|
464
|
+
return part;
|
|
465
|
+
}
|
|
466
|
+
[packageMetadata](part) {
|
|
467
|
+
if (part.package !== this) throw new OwnershipError("Expected a part owned by this package.");
|
|
468
|
+
if (!partNames.has(part)) throw new StaleHandleError("The part owner is detached.");
|
|
469
|
+
const metadata = this.current().graph.getPart(partNames.get(part));
|
|
470
|
+
const budget = archiveSettings(this.#binding.context).budget;
|
|
471
|
+
budget.charge("retainedBytes", metadata.bytes.length);
|
|
472
|
+
budget.charge("work", metadata.bytes.length);
|
|
473
|
+
return { ...metadata, bytes: new Uint8Array(metadata.bytes), modified: new Date(metadata.modified.getTime()) };
|
|
474
|
+
}
|
|
475
|
+
[packageStyleAllocationIds]() {
|
|
476
|
+
const budget = archiveSettings(this.#binding.context).budget;
|
|
477
|
+
return styleAllocationIds(this.current().graph.parts, budget);
|
|
478
|
+
}
|
|
479
|
+
get parts() {
|
|
480
|
+
return snapshotSequence([...this.iter_parts()]);
|
|
481
|
+
}
|
|
482
|
+
*iter_parts() {
|
|
483
|
+
for (const part of this.current().graph.iterParts()) yield this[packagePart](part.partname);
|
|
484
|
+
}
|
|
485
|
+
*iter_rels() {
|
|
486
|
+
const visited = /* @__PURE__ */ new Set(), stack = ["/"];
|
|
487
|
+
while (stack.length) {
|
|
488
|
+
const owner = stack.pop();
|
|
489
|
+
if (visited.has(asciiKey(owner))) continue;
|
|
490
|
+
visited.add(asciiKey(owner));
|
|
491
|
+
const edges = [...this[packageRelationships](owner).values()];
|
|
492
|
+
for (const edge of edges) yield edge;
|
|
493
|
+
for (const edge of edges.slice().reverse()) if (!edge.is_external) stack.push(edge.target_part.partname.toString());
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
get rels() {
|
|
497
|
+
return this[packageRelationships]("/");
|
|
498
|
+
}
|
|
499
|
+
get image_parts() {
|
|
500
|
+
return this.#imageParts ??= new ImageParts(this);
|
|
501
|
+
}
|
|
502
|
+
[packageImages]() {
|
|
503
|
+
return this.current().graph.parts.filter((part) => asciiKey(part.content_type).startsWith("image/")).map((part) => this[packagePart](part.partname));
|
|
504
|
+
}
|
|
505
|
+
[packageImage](part) {
|
|
506
|
+
const image = this.#images.get(this[packageMetadata](part).partname);
|
|
507
|
+
if (!image) throw new UnsupportedEditError("This image part has no admitted bounded raster characterization.");
|
|
508
|
+
return image;
|
|
509
|
+
}
|
|
510
|
+
[packageBindImage](part, image) {
|
|
511
|
+
if (!(part instanceof ImagePartView) || !(image instanceof Image)) throw new InputTypeError("Expected an owned image part and characterized image.");
|
|
512
|
+
const metadata = this[packageMetadata](part), bytes = image.blob;
|
|
513
|
+
if (parseMediaType(metadata.content_type) !== image.content_type || metadata.bytes.length !== bytes.length || !metadata.bytes.every((byte, i) => byte === bytes[i]))
|
|
514
|
+
throw new InvalidValueError("Image characterization conflicts with the owned part bytes.");
|
|
515
|
+
this.#images.set(metadata.partname, image);
|
|
516
|
+
}
|
|
517
|
+
async [packageAdmitImages]() {
|
|
518
|
+
for (const part of this[packageImages]()) {
|
|
519
|
+
const type = parseMediaType(part.content_type);
|
|
520
|
+
if (!["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff"].includes(type)) continue;
|
|
521
|
+
try {
|
|
522
|
+
const image = await Image.from_blob(part.blob, this.#binding.context);
|
|
523
|
+
if (image.content_type === type) this.#images.set(part.partname.toString(), image);
|
|
524
|
+
} catch (error) {
|
|
525
|
+
if (!(error instanceof UnsupportedEditError)) throw error;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
async [packageLoadImage](name, contentType, bytes) {
|
|
530
|
+
this.#binding.writable();
|
|
531
|
+
const revision = this.#revision, ownerVersion = this.#binding.version();
|
|
532
|
+
const image = bytes instanceof Image ? await Image[copyImageForOwner](bytes, this.#binding.context) : await Image.from_blob(bytes, this.#binding.context);
|
|
533
|
+
if (revision !== this.#revision || ownerVersion !== this.#binding.version()) throw new PublicationError("conflict", "Package changed during image admission.");
|
|
534
|
+
if (typeof contentType !== "string" || image.content_type !== parseMediaType(contentType)) throw new InvalidValueError("Image part content type conflicts with its byte signature.");
|
|
535
|
+
const part = this[packageAdmitPart](name, contentType, image.blob);
|
|
536
|
+
this.#images.set(part.partname.toString(), image);
|
|
537
|
+
return part;
|
|
538
|
+
}
|
|
539
|
+
async get_or_add_image_part(input) {
|
|
540
|
+
this.#binding.writable();
|
|
541
|
+
const revision = this.#revision, ownerVersion = this.#binding.version();
|
|
542
|
+
const image = await Image.from_file(input, this.#binding.context);
|
|
543
|
+
if (revision !== this.#revision || ownerVersion !== this.#binding.version()) throw new PublicationError("conflict", "Package changed during image admission.");
|
|
544
|
+
const bytes = image.blob;
|
|
545
|
+
for (const part2 of this[packageImages]()) {
|
|
546
|
+
const candidate = part2.blob;
|
|
547
|
+
if (candidate.length === bytes.length && candidate.every((value, index) => value === bytes[index])) return part2;
|
|
548
|
+
}
|
|
549
|
+
const name = this.next_partname(`/word/media/image%d.${image.ext}`);
|
|
550
|
+
const part = this[packageAdmitPart](name, image.content_type, bytes);
|
|
551
|
+
this.#images.set(part.partname.toString(), image);
|
|
552
|
+
return part;
|
|
553
|
+
}
|
|
554
|
+
async [packageStoryImage](owner, input, prepare) {
|
|
555
|
+
this.#binding.writable();
|
|
556
|
+
const metadata = this[packageMetadata](owner);
|
|
557
|
+
const { budget } = archiveSettings(this.#binding.context);
|
|
558
|
+
const namespace = parseDocumentXml(metadata.bytes, {}, budget).root.namespace;
|
|
559
|
+
const dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === namespace);
|
|
560
|
+
if (!dialect) throw new InputTypeError("Expected an admitted native story owner.");
|
|
561
|
+
const revision = this.#revision, ownerVersion = this.#binding.version();
|
|
562
|
+
const image = await Image.from_file(input, this.#binding.context);
|
|
563
|
+
if (revision !== this.#revision || ownerVersion !== this.#binding.version())
|
|
564
|
+
throw new PublicationError("conflict", "Package changed during story image admission.");
|
|
565
|
+
const restore = this[packageOwnerCheckpoint]();
|
|
566
|
+
try {
|
|
567
|
+
const bytes = image.blob, reltype = `${dialect.r}/image`, { graph } = this.current();
|
|
568
|
+
for (const candidate of this[packageImages]()) {
|
|
569
|
+
const existing = candidate.blob;
|
|
570
|
+
if (existing.length !== bytes.length || !existing.every((value, index) => value === bytes[index])) continue;
|
|
571
|
+
const retained = candidate.image;
|
|
572
|
+
const edge = graph.relationships(metadata.partname).find((edge2) => !edge2.is_external && edge2.reltype === reltype && asciiKey(edge2.target_part.partname) === asciiKey(candidate.partname.toString()));
|
|
573
|
+
const id2 = edge?.rId ?? graph.allocateRelationshipId(metadata.partname);
|
|
574
|
+
const fragment2 = prepare?.(id2, retained);
|
|
575
|
+
if (!edge) owner.load_rel(reltype, candidate, id2);
|
|
576
|
+
return Object.freeze([id2, retained, fragment2]);
|
|
577
|
+
}
|
|
578
|
+
const name = graph.allocatePartName(metadata.partname.slice(0, metadata.partname.lastIndexOf("/") + 1) + "media/image", `.${image.ext}`);
|
|
579
|
+
const id = graph.allocateRelationshipId(metadata.partname);
|
|
580
|
+
const fragment = prepare?.(id, image);
|
|
581
|
+
this[packageAdmitPart](name, image.content_type, bytes, { owner, reltype, rId: id });
|
|
582
|
+
this.#images.set(name, image);
|
|
583
|
+
return Object.freeze([id, image, fragment]);
|
|
584
|
+
} catch (error) {
|
|
585
|
+
restore();
|
|
586
|
+
throw error;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
get core_properties() {
|
|
590
|
+
const edges = [...this.rels.values()].filter((edge) => edge.reltype === "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties");
|
|
591
|
+
if (edges.length > 1 || edges[0]?.is_external) throw new InvalidValueError("Expected one owned core-properties part.");
|
|
592
|
+
let part;
|
|
593
|
+
if (edges.length) part = edges[0].target_part;
|
|
594
|
+
else {
|
|
595
|
+
this.#binding.writable();
|
|
596
|
+
const { archive, graph } = this.current();
|
|
597
|
+
const root = this.main_document_part.element.tag;
|
|
598
|
+
const dialect = root.namespaceURI === documentDialects.strict.w ? "strict" : "transitional";
|
|
599
|
+
const created = createPropertyPart({ ...archive, package: graph, dialect }, "core", archiveSettings(this.#binding.context).budget);
|
|
600
|
+
const context = this.#binding.context;
|
|
601
|
+
const timestamp = context.timestamp;
|
|
602
|
+
if (!(timestamp instanceof Date) || !Number.isFinite(Date.prototype.getTime.call(timestamp))) throw new InputTypeError("Expected admitted core-property metadata.");
|
|
603
|
+
const modified = new Date(Math.floor(Date.prototype.getTime.call(timestamp) / 1e3) * 1e3).toISOString();
|
|
604
|
+
const metadata = new TextEncoder().encode(`<cp:coreProperties xmlns:cp="${corePropertyNamespace}" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>Document</dc:title><cp:lastModifiedBy>${xmlValue(context.author ?? "")}</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:modified xsi:type="dcterms:W3CDTF">${modified}</dcterms:modified></cp:coreProperties>`);
|
|
605
|
+
created.archive = { ...created.archive, members: created.archive.members.map((member) => member.name === created.name.slice(1) ? { ...member, bytes: metadata } : member) };
|
|
606
|
+
this.commit(created.archive);
|
|
607
|
+
part = this[packagePart](created.name);
|
|
608
|
+
}
|
|
609
|
+
if (!(part instanceof CorePropertiesPartView)) throw new InvalidValueError("Core-properties relationship has an incompatible target.");
|
|
610
|
+
return part.core_properties;
|
|
611
|
+
}
|
|
612
|
+
[packageCore](part) {
|
|
613
|
+
return new CoreProperties(part, archiveSettings(this.#binding.context).budget);
|
|
614
|
+
}
|
|
615
|
+
[packageAdmitPart](name, content_type, input, relationship) {
|
|
616
|
+
this.#binding.writable();
|
|
617
|
+
if (!(input instanceof Uint8Array) || typeof content_type !== "string" || !content_type) throw new InputTypeError("Expected owned part bytes and a content type.");
|
|
618
|
+
name = normalizePartName(name instanceof PackURI ? name.toString() : name);
|
|
619
|
+
const { archive, graph } = this.current(), settings = archiveSettings(this.#binding.context);
|
|
620
|
+
if (graph.parts.some((part) => asciiKey(part.partname) === asciiKey(name))) throw new InvalidValueError("The part name is already occupied.");
|
|
621
|
+
if (input.length > settings.limits.maxEntryBytes) throw new ResourceLimitError("Part bytes exceed the admitted ceiling.");
|
|
622
|
+
settings.budget.charge("retainedBytes", input.length);
|
|
623
|
+
settings.budget.charge("work", input.length);
|
|
624
|
+
const bytes = new Uint8Array(input), types = archive.members.find((member) => asciiKey(member.name) === "[content_types].xml");
|
|
625
|
+
if (isXmlContentType(content_type)) new DocumentXmlEditor(bytes, {}, void 0, settings.budget);
|
|
626
|
+
const xml = new DocumentXmlEditor(types.bytes, {}, void 0, settings.budget);
|
|
627
|
+
let overrides = `<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="${xmlValue(name)}" ContentType="${xmlValue(content_type)}"/>`;
|
|
628
|
+
const members = [...archive.members];
|
|
629
|
+
if (relationship) {
|
|
630
|
+
const owner = this[packageMetadata](relationship.owner).partname;
|
|
631
|
+
const relName = relationshipName(owner);
|
|
632
|
+
const existing = this.relationshipMember(owner);
|
|
633
|
+
if (!existing) {
|
|
634
|
+
settings.budget.charge("insertedNodes", 1);
|
|
635
|
+
overrides += `<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="/${xmlValue(relName)}" ContentType="${relContentType}"/>`;
|
|
636
|
+
}
|
|
637
|
+
const relXml = new DocumentXmlEditor(existing?.bytes ?? new TextEncoder().encode(`<Relationships xmlns="${relNamespace}"/>`), {}, void 0, settings.budget);
|
|
638
|
+
relXml.insertChildren(relXml.root, `<Relationship xmlns="${relNamespace}" Id="${relationship.rId ?? graph.allocateRelationshipId(owner)}" Type="${xmlValue(relationship.reltype)}" Target="${xmlValue(relativePartTarget(owner, name))}"/>`);
|
|
639
|
+
const member = { name: relName, bytes: relXml.serialize(), directory: false, modified: /* @__PURE__ */ new Date("1980-01-01T00:00:00Z") };
|
|
640
|
+
if (existing) members[members.indexOf(existing)] = { ...existing, bytes: member.bytes };
|
|
641
|
+
else members.push(member);
|
|
642
|
+
}
|
|
643
|
+
xml.insertChildren(xml.root, overrides);
|
|
644
|
+
members[members.indexOf(types)] = { ...types, bytes: xml.serialize() };
|
|
645
|
+
members.push({ name: name.slice(1), bytes, directory: false, modified: /* @__PURE__ */ new Date("1980-01-01T00:00:00Z") });
|
|
646
|
+
const restore = this[packageOwnerCheckpoint]();
|
|
647
|
+
try {
|
|
648
|
+
this.#admitting = { partname: name, content_type };
|
|
649
|
+
let part;
|
|
650
|
+
try {
|
|
651
|
+
part = this[packagePart](name, this.#admitting);
|
|
652
|
+
} finally {
|
|
653
|
+
this.#admitting = void 0;
|
|
654
|
+
}
|
|
655
|
+
this.commit({ ...archive, members });
|
|
656
|
+
return part;
|
|
657
|
+
} catch (error) {
|
|
658
|
+
restore();
|
|
659
|
+
throw error;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
[packageCreateNative](kind, relationship) {
|
|
663
|
+
this.#binding.writable();
|
|
664
|
+
const restore = this[packageOwnerCheckpoint]();
|
|
665
|
+
try {
|
|
666
|
+
const owner = relationship?.owner ?? this.main_document_part, root = owner.element.tag;
|
|
667
|
+
const { graph } = this.current(), { budget } = archiveSettings(this.#binding.context);
|
|
668
|
+
const tag = { header: "hdr", footer: "ftr", comments: "comments", settings: "settings", styles: "styles" }[kind];
|
|
669
|
+
const content = kind === "header" || kind === "footer" ? "<w:p/>" : kind === "styles" ? originalModelDefaults(root.namespaceURI) : "";
|
|
670
|
+
const base = owner.partname.toString();
|
|
671
|
+
const name = graph.allocatePartName(base.slice(0, base.lastIndexOf("/") + 1) + kind, ".xml");
|
|
672
|
+
const bytes = new TextEncoder().encode(`<w:${tag} xmlns:w="${root.namespaceURI}">${content}</w:${tag}>`);
|
|
673
|
+
const parsed = parseDocumentXml(bytes, {}, budget);
|
|
674
|
+
let nodes = 0;
|
|
675
|
+
const pending = [parsed.root];
|
|
676
|
+
while (pending.length) {
|
|
677
|
+
const node = pending.pop();
|
|
678
|
+
nodes++;
|
|
679
|
+
pending.push(...node.children);
|
|
680
|
+
}
|
|
681
|
+
budget.charge("insertedNodes", nodes);
|
|
682
|
+
const dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === root.namespaceURI);
|
|
683
|
+
return this[packageAdmitPart](
|
|
684
|
+
name,
|
|
685
|
+
`application/vnd.openxmlformats-officedocument.wordprocessingml.${kind}+xml`,
|
|
686
|
+
bytes,
|
|
687
|
+
relationship ? { owner, rId: relationship.rId, reltype: `${dialect.r}/${kind}` } : void 0
|
|
688
|
+
);
|
|
689
|
+
} catch (error) {
|
|
690
|
+
restore();
|
|
691
|
+
throw error;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
[packageNumbering](owner) {
|
|
695
|
+
const metadata = this[packageMetadata](owner), { graph } = this.current();
|
|
696
|
+
const { budget } = archiveSettings(this.#binding.context);
|
|
697
|
+
const root = parseDocumentXml(metadata.bytes, {}, budget).root;
|
|
698
|
+
const dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === root.namespace);
|
|
699
|
+
if (!dialect || root.localName !== "document") throw new InvalidValueError("Expected a document numbering owner.");
|
|
700
|
+
const reltype = `${dialect.r}/numbering`;
|
|
701
|
+
const edges = graph.relationships(metadata.partname).filter((edge) => edge.reltype === reltype);
|
|
702
|
+
if (edges.length > 1 || edges[0]?.is_external) throw new InvalidValueError("Expected one internal numbering relationship.");
|
|
703
|
+
if (edges[0]) {
|
|
704
|
+
const part = this[packagePart](edges[0].target_part.partname);
|
|
705
|
+
if (!(part instanceof NumberingPart) || part.element.localName !== "numbering" || part.element.namespace !== dialect.w)
|
|
706
|
+
throw new InvalidValueError("Numbering ownership has an incompatible target.");
|
|
707
|
+
return part;
|
|
708
|
+
}
|
|
709
|
+
this.#binding.writable();
|
|
710
|
+
const name = graph.allocatePartName(metadata.partname.slice(0, metadata.partname.lastIndexOf("/") + 1) + "numbering", ".xml");
|
|
711
|
+
budget.charge("insertedNodes", 1);
|
|
712
|
+
return this[packageAdmitPart](
|
|
713
|
+
name,
|
|
714
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
|
715
|
+
new TextEncoder().encode(`<w:numbering xmlns:w="${dialect.w}"/>`),
|
|
716
|
+
{ owner, reltype }
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
get main_document_part() {
|
|
720
|
+
const edges = [...this.rels.values()].filter((edge) => Object.values(documentDialects).some((dialect) => edge.reltype === `${dialect.r}/officeDocument`) && !edge.is_external);
|
|
721
|
+
if (edges.length !== 1 || !(edges[0].target_part instanceof DocumentPartView)) throw new InvalidValueError("Expected one XML document part.");
|
|
722
|
+
return edges[0].target_part;
|
|
723
|
+
}
|
|
724
|
+
[packageRelationships](owner) {
|
|
725
|
+
const key = owner === "/" ? "/" : asciiKey(this.current().graph.getPart(owner).partname);
|
|
726
|
+
let rels = this.#relationships.get(key);
|
|
727
|
+
if (!rels) {
|
|
728
|
+
rels = new Relationships(this, owner === "/" ? null : this[packagePart](owner));
|
|
729
|
+
this.#relationships.set(key, rels);
|
|
730
|
+
}
|
|
731
|
+
return rels;
|
|
732
|
+
}
|
|
733
|
+
[packageEdges](owner) {
|
|
734
|
+
return this.current().graph.relationships(owner ? this[packageMetadata](owner).partname : "/");
|
|
735
|
+
}
|
|
736
|
+
[packageRelationshipXml](owner) {
|
|
737
|
+
const bytes = this.relationshipMember(owner ? this[packageMetadata](owner).partname : "/")?.bytes ?? new TextEncoder().encode(`<Relationships xmlns="${relNamespace}"/>`);
|
|
738
|
+
const budget = archiveSettings(this.#binding.context).budget;
|
|
739
|
+
budget.charge("work", bytes.length);
|
|
740
|
+
budget.charge("retainedBytes", bytes.length);
|
|
741
|
+
const document = parseDocumentXml(bytes, {}, budget);
|
|
742
|
+
return new TextDecoder(document.encoding, { fatal: true }).decode(bytes);
|
|
743
|
+
}
|
|
744
|
+
[packageNextRelationshipId](owner) {
|
|
745
|
+
const member = this.relationshipMember(owner ? this[packageMetadata](owner).partname : "/");
|
|
746
|
+
const { budget } = archiveSettings(this.#binding.context);
|
|
747
|
+
const ids = member ? relationshipXmlIds(parseDocumentXml(member.bytes, {}, budget).root, budget) : /* @__PURE__ */ new Set();
|
|
748
|
+
let ordinal = 1;
|
|
749
|
+
while (ids.has(`rId${ordinal}`)) {
|
|
750
|
+
budget.charge("work", 1);
|
|
751
|
+
ordinal++;
|
|
752
|
+
}
|
|
753
|
+
return `rId${ordinal}`;
|
|
754
|
+
}
|
|
755
|
+
[packageEditRelationships](owner, rows, removeUnsharedPart) {
|
|
756
|
+
this.#binding.writable();
|
|
757
|
+
const { archive } = this.current(), settings = archiveSettings(this.#binding.context);
|
|
758
|
+
const name = relationshipName(owner ? this[packageMetadata](owner).partname : "/");
|
|
759
|
+
const existing = this.relationshipMember(owner ? this[packageMetadata](owner).partname : "/");
|
|
760
|
+
let bytes = existing?.bytes ?? new TextEncoder().encode(`<Relationships xmlns="${relNamespace}"/>`);
|
|
761
|
+
const previous = this[packageEdges](owner);
|
|
762
|
+
const pending = new Map(rows.map((row) => [row.rId, row]));
|
|
763
|
+
if (pending.size !== rows.length) throw new InvalidValueError("Duplicate relationship IDs.");
|
|
764
|
+
const removed = new Set(previous.filter((row) => !pending.has(row.rId)).map((row) => row.rId));
|
|
765
|
+
if (owner && removed.size) {
|
|
766
|
+
const metadata = this[packageMetadata](owner);
|
|
767
|
+
if (isXmlContentType(metadata.content_type)) {
|
|
768
|
+
const stack = [parseDocumentXml(metadata.bytes, {}, settings.budget).root];
|
|
769
|
+
while (stack.length) {
|
|
770
|
+
const node = stack.pop();
|
|
771
|
+
settings.budget.charge("work", 1 + node.attributes.length + node.children.length);
|
|
772
|
+
for (const attribute of node.attributes) {
|
|
773
|
+
const reference = attribute.namespace === documentDialects.transitional.r || attribute.namespace === documentDialects.strict.r || attribute.namespace === "urn:schemas-microsoft-com:office:office" && attribute.localName === "relid";
|
|
774
|
+
if (reference && removed.has(attribute.value))
|
|
775
|
+
throw new UnsupportedEditError("An XML reference still requires the relationship.");
|
|
776
|
+
}
|
|
777
|
+
settings.budget.charge("retainedBytes", node.children.length * 8);
|
|
778
|
+
for (const child of node.children) stack.push(child);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
for (const row of previous) {
|
|
783
|
+
const replacement = pending.get(row.rId);
|
|
784
|
+
const changes = {};
|
|
785
|
+
if (replacement) {
|
|
786
|
+
if (replacement.reltype !== row.reltype) changes.Type = replacement.reltype;
|
|
787
|
+
if (replacement.target_ref !== row.target_ref) changes.Target = replacement.target_ref;
|
|
788
|
+
if (replacement.is_external !== row.is_external) changes.TargetMode = replacement.is_external ? "External" : null;
|
|
789
|
+
}
|
|
790
|
+
if (!replacement || Object.keys(changes).length) {
|
|
791
|
+
const xml = new DocumentXmlEditor(bytes, {}, void 0, settings.budget);
|
|
792
|
+
const node = relationshipXmlRows(xml.root, settings.budget).find((node2) => node2.rId === row.rId).element;
|
|
793
|
+
xml[editActiveRelationshipXml](node, replacement ? changes : null);
|
|
794
|
+
bytes = xml.serialize();
|
|
795
|
+
}
|
|
796
|
+
pending.delete(row.rId);
|
|
797
|
+
}
|
|
798
|
+
for (const row of pending.values()) {
|
|
799
|
+
const xml = new DocumentXmlEditor(bytes, {}, void 0, settings.budget);
|
|
800
|
+
xml.insertChildren(xml.root, `<Relationship xmlns="${relNamespace}" Id="${xmlValue(row.rId)}" Type="${xmlValue(row.reltype)}" Target="${xmlValue(row.target_ref)}"${row.is_external ? ' TargetMode="External"' : ""}/>`);
|
|
801
|
+
bytes = xml.serialize();
|
|
802
|
+
}
|
|
803
|
+
let members = archive.members.map((member) => member === existing ? { ...member, bytes } : member);
|
|
804
|
+
if (!existing) members.push({ name, bytes, directory: false, modified: /* @__PURE__ */ new Date("1980-01-01T00:00:00Z") });
|
|
805
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
806
|
+
if (removeUnsharedPart) {
|
|
807
|
+
const metadata = this[packageMetadata](removeUnsharedPart), graph = this.current().graph;
|
|
808
|
+
const excluded = [...removed].map((id) => ({ owner: owner ? this[packageMetadata](owner).partname : "/", id }));
|
|
809
|
+
if (!retainedRelationshipTargets(graph, settings.budget, excluded).has(asciiKey(metadata.partname))) {
|
|
810
|
+
deleted.add(asciiKey(metadata.partname));
|
|
811
|
+
const deletedNames = /* @__PURE__ */ new Set([metadata.name]);
|
|
812
|
+
const outgoing = this.relationshipMember(metadata.partname);
|
|
813
|
+
if (outgoing) {
|
|
814
|
+
deleted.add(asciiKey(normalizePartName("/" + outgoing.name)));
|
|
815
|
+
deletedNames.add(outgoing.name);
|
|
816
|
+
}
|
|
817
|
+
const types = members.find((member) => asciiKey(member.name) === "[content_types].xml");
|
|
818
|
+
const xml = new DocumentXmlEditor(types.bytes, {}, void 0, settings.budget);
|
|
819
|
+
for (const node of [...xml.root.children]) {
|
|
820
|
+
const partname = node.attributes.find((attribute) => !attribute.namespace && attribute.localName === "PartName")?.value;
|
|
821
|
+
if (partname && deleted.has(asciiKey(normalizePartName(partname)))) xml.replaceElement(node, "");
|
|
822
|
+
}
|
|
823
|
+
members = members.filter((member) => !deletedNames.has(member.name)).map((member) => member === types ? { ...member, bytes: xml.serialize() } : member);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
this.commit({ ...archive, members });
|
|
827
|
+
this.#relationships.get(owner ? asciiKey(owner.partname.toString()) : "/")?.[invalidateRelationshipViews](removed);
|
|
828
|
+
for (const key of deleted) {
|
|
829
|
+
const part = this.#parts.get(key);
|
|
830
|
+
if (part) partNames.delete(part);
|
|
831
|
+
this.#parts.delete(key);
|
|
832
|
+
this.#relationships.delete(key);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
[packageBindXml](part) {
|
|
836
|
+
return bindXmlElementView({
|
|
837
|
+
budget: archiveSettings(this.#binding.context).budget,
|
|
838
|
+
read: () => {
|
|
839
|
+
const metadata = this[packageMetadata](part);
|
|
840
|
+
return new DocumentXmlEditor(metadata.bytes, {}, compatibilityProfileForPart(metadata.partname), archiveSettings(this.#binding.context).budget);
|
|
841
|
+
},
|
|
842
|
+
resolve: (xml) => xml.root,
|
|
843
|
+
change: (action) => {
|
|
844
|
+
this.#binding.writable();
|
|
845
|
+
const metadata = this[packageMetadata](part), { archive, graph } = this.current();
|
|
846
|
+
const { budget, limits } = archiveSettings(this.#binding.context);
|
|
847
|
+
const xml = new DocumentXmlEditor(metadata.bytes, {}, compatibilityProfileForPart(metadata.partname), budget);
|
|
848
|
+
action(xml);
|
|
849
|
+
const bytes = xml.serialize();
|
|
850
|
+
assertLiveCommentExtensionPartPreserved(graph, metadata, bytes, budget);
|
|
851
|
+
const candidate = { ...archive, members: archive.members.map((member) => member.name === metadata.name ? { ...member, bytes } : member) };
|
|
852
|
+
if (parseMediaType(metadata.content_type) === "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml" && embeddedFontState(graph, budget) !== embeddedFontState(new DocumentPackage(candidate, limits, budget), budget))
|
|
853
|
+
throw new UnsupportedEmbeddedFontMutationError();
|
|
854
|
+
this.commit(candidate);
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
[packageReadXml](part) {
|
|
859
|
+
if (part.package !== this) throw new OwnershipError("Expected a part owned by this package.");
|
|
860
|
+
const name = partNames.get(part);
|
|
861
|
+
if (!name) throw new StaleHandleError("The part owner is detached.");
|
|
862
|
+
const metadata = this.current().graph.getPart(name), budget = archiveSettings(this.#binding.context).budget;
|
|
863
|
+
let xml = this.#xmlReads.get(metadata);
|
|
864
|
+
if (!xml) {
|
|
865
|
+
xml = new DocumentXmlEditor(metadata.bytes, {}, void 0, budget);
|
|
866
|
+
this.#xmlReads.set(metadata, xml);
|
|
867
|
+
}
|
|
868
|
+
return { xml, budget };
|
|
869
|
+
}
|
|
870
|
+
commit(archive, rename) {
|
|
871
|
+
const { budget, limits } = archiveSettings(this.#binding.context);
|
|
872
|
+
if (archive.members.length > limits.maxMembers) throw new ResourceLimitError("Package member count exceeds the admitted ceiling.");
|
|
873
|
+
let total = 0;
|
|
874
|
+
for (const member of archive.members) {
|
|
875
|
+
if (member.bytes.length > limits.maxEntryBytes) throw new ResourceLimitError("Part bytes exceed the admitted ceiling.");
|
|
876
|
+
if (member.name.length + 1 > limits.maxPathBytes || new TextEncoder().encode(member.name).length > limits.maxPathBytes || member.name.split("/").filter(Boolean).length > limits.maxDepth) throw new ResourceLimitError("Part path exceeds the admitted ceiling.");
|
|
877
|
+
total += member.bytes.length;
|
|
878
|
+
if (total > limits.maxTotalBytes) throw new ResourceLimitError("Package bytes exceed the admitted ceiling.");
|
|
879
|
+
}
|
|
880
|
+
new DocumentPackage(archive, limits, budget);
|
|
881
|
+
const report = validateDocumentArchive(archive, {}, budget);
|
|
882
|
+
if (!report.valid) throw new SemanticValidationError(report.diagnostics);
|
|
883
|
+
this.#binding.stage(archive, rename);
|
|
884
|
+
this.#revision++;
|
|
885
|
+
this.#cached = void 0;
|
|
886
|
+
}
|
|
887
|
+
[packageRename](part, name) {
|
|
888
|
+
this.#binding.writable();
|
|
889
|
+
const metadata = this[packageMetadata](part), from = metadata.partname, to = normalizePartName(name instanceof PackURI ? name.toString() : name);
|
|
890
|
+
if (from === to) return;
|
|
891
|
+
const { archive, graph } = this.current(), settings = archiveSettings(this.#binding.context);
|
|
892
|
+
if (graph.parts.some((existing) => asciiKey(existing.partname) === asciiKey(to))) throw new InvalidValueError("The part name is already occupied.");
|
|
893
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
894
|
+
const ownedRelationships = this.relationshipMember(from);
|
|
895
|
+
const renamedParts = /* @__PURE__ */ new Map([[asciiKey(from), to]]);
|
|
896
|
+
if (ownedRelationships) renamedParts.set(asciiKey(normalizePartName("/" + ownedRelationships.name)), "/" + relationshipName(to));
|
|
897
|
+
const types = archive.members.find((member) => asciiKey(member.name) === "[content_types].xml");
|
|
898
|
+
const typeEditor = new DocumentXmlEditor(types.bytes, {}, void 0, settings.budget);
|
|
899
|
+
let override = false;
|
|
900
|
+
for (const node of typeEditor.root.children) {
|
|
901
|
+
const value = node.attributes.find((attribute) => attribute.localName === "PartName")?.value;
|
|
902
|
+
if (value === void 0) continue;
|
|
903
|
+
const destination = renamedParts.get(asciiKey(normalizePartName(value)));
|
|
904
|
+
if (destination) {
|
|
905
|
+
typeEditor.setAttribute(node, "PartName", destination);
|
|
906
|
+
if (destination === to) override = true;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
if (!override) typeEditor.insertChildren(typeEditor.root, `<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="${xmlValue(to)}" ContentType="${xmlValue(metadata.content_type)}"/>`);
|
|
910
|
+
replacements.set(types.name, typeEditor.serialize());
|
|
911
|
+
for (const owner of ["/", ...graph.parts.filter((part2) => asciiKey(part2.content_type) !== relContentType).map((part2) => part2.partname)]) {
|
|
912
|
+
const edges = graph.relationships(owner), member = this.relationshipMember(owner);
|
|
913
|
+
if (!member || !edges.some((edge) => !edge.is_external && (owner === from || edge.target_part.partname === from))) continue;
|
|
914
|
+
const xml = new DocumentXmlEditor(member.bytes, {}, void 0, settings.budget);
|
|
915
|
+
for (const { element: node, rId } of relationshipXmlRows(xml.root, settings.budget)) {
|
|
916
|
+
const edge = edges.find((edge2) => edge2.rId === rId);
|
|
917
|
+
if (!edge || edge.is_external || owner !== from && edge.target_part.partname !== from) continue;
|
|
918
|
+
const target = relativePartTarget(owner === from ? to : owner, edge.target_part.partname === from ? to : edge.target_part.partname) + (edge.fragment === null ? "" : "#" + edge.fragment);
|
|
919
|
+
xml[editActiveRelationshipXml](node, { Target: target });
|
|
920
|
+
}
|
|
921
|
+
replacements.set(member.name, xml.serialize());
|
|
922
|
+
}
|
|
923
|
+
const members = archive.members.map((member) => ({
|
|
924
|
+
...member,
|
|
925
|
+
name: member.name === metadata.name ? to.slice(1) : member === ownedRelationships ? relationshipName(to) : member.name,
|
|
926
|
+
bytes: replacements.get(member.name) ?? member.bytes
|
|
927
|
+
}));
|
|
928
|
+
this.commit({ ...archive, members }, { from, to });
|
|
929
|
+
this.#parts.delete(asciiKey(from));
|
|
930
|
+
this.#parts.set(asciiKey(to), part);
|
|
931
|
+
partNames.set(part, to);
|
|
932
|
+
const image = this.#images.get(from);
|
|
933
|
+
if (image) {
|
|
934
|
+
this.#images.delete(from);
|
|
935
|
+
this.#images.set(to, image);
|
|
936
|
+
}
|
|
937
|
+
const rels = this.#relationships.get(asciiKey(from));
|
|
938
|
+
if (rels) {
|
|
939
|
+
this.#relationships.delete(asciiKey(from));
|
|
940
|
+
this.#relationships.set(asciiKey(to), rels);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
part_related_by(reltype) {
|
|
944
|
+
return this.rels.part_with_reltype(reltype);
|
|
945
|
+
}
|
|
946
|
+
relate_to(part, reltype) {
|
|
947
|
+
return this.rels.get_or_add(reltype, part).rId;
|
|
948
|
+
}
|
|
949
|
+
load_rel(reltype, target, rId, is_external = false) {
|
|
950
|
+
this.rels.add_relationship(reltype, target, rId, is_external);
|
|
951
|
+
}
|
|
952
|
+
next_partname(template) {
|
|
953
|
+
if (typeof template !== "string" || template.split("%d").length !== 2) throw new InputTypeError("Expected one numbered part-name placeholder.");
|
|
954
|
+
const [prefix, suffix] = template.split("%d");
|
|
955
|
+
return new PackURI(this.current().graph.allocatePartName(prefix, suffix));
|
|
956
|
+
}
|
|
957
|
+
after_unmarshal() {
|
|
958
|
+
this[packageValidate]();
|
|
959
|
+
this.#cached = void 0;
|
|
960
|
+
void this.current();
|
|
961
|
+
}
|
|
962
|
+
[packageValidate]() {
|
|
963
|
+
const report = validateDocumentArchive(this.#binding.snapshot(), {}, archiveSettings(this.#binding.context).budget);
|
|
964
|
+
if (!report.valid) throw new SemanticValidationError(report.diagnostics);
|
|
965
|
+
}
|
|
966
|
+
async save(output, options) {
|
|
967
|
+
this.#binding.writable();
|
|
968
|
+
this[packageValidate]();
|
|
969
|
+
await this.#binding.save(output, options);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
var PartView = class {
|
|
973
|
+
#package;
|
|
974
|
+
constructor(owner, name) {
|
|
975
|
+
this.#package = owner;
|
|
976
|
+
owner[packageRegister](this, name);
|
|
977
|
+
}
|
|
978
|
+
static async load(partname, content_type, blob, owner) {
|
|
979
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
980
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
981
|
+
}
|
|
982
|
+
get package() {
|
|
983
|
+
return this.#package;
|
|
984
|
+
}
|
|
985
|
+
get partname() {
|
|
986
|
+
const name = partNames.get(this);
|
|
987
|
+
if (!name) throw new StaleHandleError("The part owner is detached.");
|
|
988
|
+
return new PackURI(name);
|
|
989
|
+
}
|
|
990
|
+
set partname(value) {
|
|
991
|
+
this.#package[packageRename](this, value);
|
|
992
|
+
}
|
|
993
|
+
get content_type() {
|
|
994
|
+
return this.#package[packageMetadata](this).content_type;
|
|
995
|
+
}
|
|
996
|
+
get blob() {
|
|
997
|
+
const bytes = this.#package[packageMetadata](this).bytes;
|
|
998
|
+
return new Uint8Array(bytes);
|
|
999
|
+
}
|
|
1000
|
+
get rels() {
|
|
1001
|
+
return this.#package[packageRelationships](this.partname.toString());
|
|
1002
|
+
}
|
|
1003
|
+
get related_parts() {
|
|
1004
|
+
return this.rels.related_parts;
|
|
1005
|
+
}
|
|
1006
|
+
part_related_by(reltype) {
|
|
1007
|
+
return this.rels.part_with_reltype(reltype);
|
|
1008
|
+
}
|
|
1009
|
+
relate_to(target, reltype, is_external = false) {
|
|
1010
|
+
return is_external ? this.rels.get_or_add_ext_rel(reltype, target) : this.rels.get_or_add(reltype, target).rId;
|
|
1011
|
+
}
|
|
1012
|
+
load_rel(reltype, target, rId, is_external = false) {
|
|
1013
|
+
this.rels.add_relationship(reltype, target, rId, is_external);
|
|
1014
|
+
}
|
|
1015
|
+
drop_rel(rId) {
|
|
1016
|
+
this.rels.delete(rId);
|
|
1017
|
+
}
|
|
1018
|
+
target_ref(rId) {
|
|
1019
|
+
return this.rels.at(rId).target_ref;
|
|
1020
|
+
}
|
|
1021
|
+
before_marshal() {
|
|
1022
|
+
this.#package[packageValidate]();
|
|
1023
|
+
}
|
|
1024
|
+
after_unmarshal() {
|
|
1025
|
+
this.#package[packageMetadata](this);
|
|
1026
|
+
this.#package[packageValidate]();
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
var XmlPartView = class extends PartView {
|
|
1030
|
+
static nativeTypes = void 0;
|
|
1031
|
+
static [validateNativePartType](part, contentType) {
|
|
1032
|
+
const type = parseMediaType(contentType);
|
|
1033
|
+
for (const owner of [StoryPart, HeaderPart, FooterPart, CommentsPart, SettingsPart, StylesPart, DocumentPartView, NumberingPart, CorePropertiesPartView]) {
|
|
1034
|
+
if (part instanceof owner && owner.nativeTypes && !owner.nativeTypes.includes(type))
|
|
1035
|
+
throw new InputTypeError("The native part view does not match the admitted content type.");
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
#element;
|
|
1039
|
+
static async load(partname, content_type, blob, owner) {
|
|
1040
|
+
if (!(owner instanceof PackageView) || !isXmlContentType(content_type)) throw new InputTypeError("Expected an admitted XML owner package and content type.");
|
|
1041
|
+
if (this.nativeTypes && !this.nativeTypes.includes(parseMediaType(content_type)))
|
|
1042
|
+
throw new InputTypeError("The content type does not match the native part role.");
|
|
1043
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
1044
|
+
}
|
|
1045
|
+
get element() {
|
|
1046
|
+
return this.#element ??= this.package[packageBindXml](this);
|
|
1047
|
+
}
|
|
1048
|
+
get part() {
|
|
1049
|
+
this.package[packageMetadata](this);
|
|
1050
|
+
return this;
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
var StoryPart = class extends XmlPartView {
|
|
1054
|
+
static async load(partname, content_type, blob, owner) {
|
|
1055
|
+
if (!(owner instanceof PackageView) || typeof content_type !== "string" || !this.nativeTypes.includes(parseMediaType(content_type)))
|
|
1056
|
+
throw new InputTypeError("Expected an admitted owner and a native story content type.");
|
|
1057
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
1058
|
+
}
|
|
1059
|
+
get next_id() {
|
|
1060
|
+
const { xml, budget } = this.package[packageReadXml](this);
|
|
1061
|
+
let maximum = 0;
|
|
1062
|
+
budget.charge("retainedBytes", 8);
|
|
1063
|
+
const pending = [xml.root];
|
|
1064
|
+
while (pending.length) {
|
|
1065
|
+
const node = pending.pop();
|
|
1066
|
+
budget.charge("work", 1 + node.attributes.length + node.children.length);
|
|
1067
|
+
for (const attribute of node.attributes) {
|
|
1068
|
+
if (attribute.namespace || attribute.localName !== "id" || !attribute.value.length) continue;
|
|
1069
|
+
budget.charge("work", attribute.value.length * 2);
|
|
1070
|
+
let decimal = true;
|
|
1071
|
+
for (const char of attribute.value) if (char < "0" || char > "9") {
|
|
1072
|
+
decimal = false;
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
if (!decimal) continue;
|
|
1076
|
+
const value = Number(attribute.value);
|
|
1077
|
+
if (!Number.isSafeInteger(value) || value >= Number.MAX_SAFE_INTEGER)
|
|
1078
|
+
throw new ResourceLimitError("The story identifier range is exhausted.");
|
|
1079
|
+
maximum = Math.max(maximum, value);
|
|
1080
|
+
}
|
|
1081
|
+
if (node.children.length) budget.charge("retainedBytes", node.children.length * 8);
|
|
1082
|
+
for (const child of node.children) pending.push(child);
|
|
1083
|
+
}
|
|
1084
|
+
return maximum + 1;
|
|
1085
|
+
}
|
|
1086
|
+
get_style(style_id, style_type) {
|
|
1087
|
+
return this.package[packageModel](this).withStyleDefinitions((styles) => {
|
|
1088
|
+
const style = styles.get_by_id(style_id, style_type);
|
|
1089
|
+
if (!style) throw new MissingKeyError("The requested style type has no default definition.");
|
|
1090
|
+
return style;
|
|
1091
|
+
}, this.partname.toString());
|
|
1092
|
+
}
|
|
1093
|
+
get_style_id(style_or_name, style_type) {
|
|
1094
|
+
return this.package[packageModel](this).withStyleDefinitions((styles) => styles.get_style_id(style_or_name, style_type), this.partname.toString());
|
|
1095
|
+
}
|
|
1096
|
+
async get_or_add_image(input) {
|
|
1097
|
+
this.package[packageMetadata](this);
|
|
1098
|
+
const [id, image] = await this.package[packageStoryImage](this, input);
|
|
1099
|
+
return snapshotSequence([id, image]);
|
|
1100
|
+
}
|
|
1101
|
+
async new_pic_inline(input, width, height) {
|
|
1102
|
+
const { budget, xml: ownerXml } = this.package[packageReadXml](this);
|
|
1103
|
+
const dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === ownerXml.root.namespace);
|
|
1104
|
+
if (!dialect) throw new InputTypeError("Expected an admitted native story owner.");
|
|
1105
|
+
const result = await this.package[packageStoryImage](this, input, (id, image) => {
|
|
1106
|
+
const [cx, cy] = image.scaled_dimensions(width, height), drawingId = this.next_id;
|
|
1107
|
+
if (drawingId > 4294967295) throw new ResourceLimitError("The drawing identifier range is exhausted.");
|
|
1108
|
+
const markup2 = inlineImageRun(dialect, drawingId, id, { width: cx.emu, height: cy.emu, crop: "" }, { filename: image.filename }).run;
|
|
1109
|
+
budget.charge("retainedBytes", markup2.length * 3);
|
|
1110
|
+
let xml = new DocumentXmlEditor(new TextEncoder().encode(markup2), {}, void 0, budget);
|
|
1111
|
+
const resolve = (document) => {
|
|
1112
|
+
const drawing = document.root.children.find((node) => node.namespace === dialect.w && node.localName === "drawing");
|
|
1113
|
+
const inline = drawing?.children.find((node) => node.namespace === dialect.wp && node.localName === "inline");
|
|
1114
|
+
if (!inline) throw new StaleHandleError("The detached picture fragment is no longer available.");
|
|
1115
|
+
return inline;
|
|
1116
|
+
};
|
|
1117
|
+
return bindXmlElementView({
|
|
1118
|
+
budget,
|
|
1119
|
+
read: () => {
|
|
1120
|
+
this.package[packageMetadata](this);
|
|
1121
|
+
return xml;
|
|
1122
|
+
},
|
|
1123
|
+
resolve,
|
|
1124
|
+
change: (action) => {
|
|
1125
|
+
this.package[packageMetadata](this);
|
|
1126
|
+
const candidate = new DocumentXmlEditor(xml.serialize(), {}, void 0, budget);
|
|
1127
|
+
action(candidate);
|
|
1128
|
+
xml = new DocumentXmlEditor(candidate.serialize(), {}, void 0, budget);
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
});
|
|
1132
|
+
return result[2];
|
|
1133
|
+
}
|
|
1134
|
+
static nativeTypes = [
|
|
1135
|
+
...Object.values(documentTypes),
|
|
1136
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",
|
|
1137
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",
|
|
1138
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"
|
|
1139
|
+
];
|
|
1140
|
+
};
|
|
1141
|
+
var HeaderPart = class extends StoryPart {
|
|
1142
|
+
static new(owner) {
|
|
1143
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1144
|
+
return owner[packageCreateNative]("header");
|
|
1145
|
+
}
|
|
1146
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"];
|
|
1147
|
+
};
|
|
1148
|
+
var FooterPart = class extends StoryPart {
|
|
1149
|
+
static new(owner) {
|
|
1150
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1151
|
+
return owner[packageCreateNative]("footer");
|
|
1152
|
+
}
|
|
1153
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"];
|
|
1154
|
+
};
|
|
1155
|
+
var CommentsPart = class extends StoryPart {
|
|
1156
|
+
static async load(partname, content_type, blob, owner) {
|
|
1157
|
+
if (!(owner instanceof PackageView) || typeof content_type !== "string" || !this.nativeTypes.includes(parseMediaType(content_type)))
|
|
1158
|
+
throw new InputTypeError("Expected an admitted owner and the native part content type.");
|
|
1159
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
1160
|
+
}
|
|
1161
|
+
#comments;
|
|
1162
|
+
get comments() {
|
|
1163
|
+
const model = this.package[packageModel](this);
|
|
1164
|
+
if (this.#comments) {
|
|
1165
|
+
try {
|
|
1166
|
+
model.node(this.#comments.ref);
|
|
1167
|
+
return this.#comments;
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
if (!(error instanceof StaleHandleError)) throw error;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return this.#comments = model.nativeComments(this);
|
|
1173
|
+
}
|
|
1174
|
+
static default(owner) {
|
|
1175
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1176
|
+
return owner[packageCreateNative]("comments");
|
|
1177
|
+
}
|
|
1178
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"];
|
|
1179
|
+
};
|
|
1180
|
+
var SettingsPart = class extends XmlPartView {
|
|
1181
|
+
static async load(partname, content_type, blob, owner) {
|
|
1182
|
+
if (!(owner instanceof PackageView) || typeof content_type !== "string" || !this.nativeTypes.includes(parseMediaType(content_type)))
|
|
1183
|
+
throw new InputTypeError("Expected an admitted owner and the native part content type.");
|
|
1184
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
1185
|
+
}
|
|
1186
|
+
#settings;
|
|
1187
|
+
get settings() {
|
|
1188
|
+
return this.#settings ??= this.package[packageModel](this).nativeSettings(this);
|
|
1189
|
+
}
|
|
1190
|
+
static default(owner) {
|
|
1191
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1192
|
+
return owner[packageCreateNative]("settings");
|
|
1193
|
+
}
|
|
1194
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"];
|
|
1195
|
+
};
|
|
1196
|
+
var StylesPart = class extends XmlPartView {
|
|
1197
|
+
static async load(partname, content_type, blob, owner) {
|
|
1198
|
+
if (!(owner instanceof PackageView) || typeof content_type !== "string" || !this.nativeTypes.includes(parseMediaType(content_type)))
|
|
1199
|
+
throw new InputTypeError("Expected an admitted owner and the native part content type.");
|
|
1200
|
+
return owner[packageAdmitPart](partname, content_type, blob);
|
|
1201
|
+
}
|
|
1202
|
+
#styles;
|
|
1203
|
+
#styleElement;
|
|
1204
|
+
[packageBindStyles](styles, element) {
|
|
1205
|
+
if (this.#styles) throw new InvalidValueError("The styles part already has a live binding.");
|
|
1206
|
+
this.#styles = styles;
|
|
1207
|
+
this.#styleElement = element;
|
|
1208
|
+
}
|
|
1209
|
+
get styles() {
|
|
1210
|
+
return this.#styles ?? this.package[packageModel](this).nativeStyles(this);
|
|
1211
|
+
}
|
|
1212
|
+
get element() {
|
|
1213
|
+
return this.#styleElement ? this.#styleElement() : super.element;
|
|
1214
|
+
}
|
|
1215
|
+
static default(owner) {
|
|
1216
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1217
|
+
return owner[packageCreateNative]("styles");
|
|
1218
|
+
}
|
|
1219
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"];
|
|
1220
|
+
};
|
|
1221
|
+
var DocumentPartView = class extends StoryPart {
|
|
1222
|
+
async save(output, options) {
|
|
1223
|
+
this.package[packageMetadata](this);
|
|
1224
|
+
await this.package.save(output, options);
|
|
1225
|
+
}
|
|
1226
|
+
static nativeTypes = Object.values(documentTypes);
|
|
1227
|
+
get document() {
|
|
1228
|
+
return this.package[packageModel](this).nativeDocument(this);
|
|
1229
|
+
}
|
|
1230
|
+
get comments() {
|
|
1231
|
+
return this.document.comments;
|
|
1232
|
+
}
|
|
1233
|
+
get settings() {
|
|
1234
|
+
return this.document.settings;
|
|
1235
|
+
}
|
|
1236
|
+
get styles() {
|
|
1237
|
+
return this.package[packageModel](this).stylesForDocument(this.partname.toString());
|
|
1238
|
+
}
|
|
1239
|
+
get inline_shapes() {
|
|
1240
|
+
return this.document.inline_shapes;
|
|
1241
|
+
}
|
|
1242
|
+
get core_properties() {
|
|
1243
|
+
this.package[packageMetadata](this);
|
|
1244
|
+
return this.package.core_properties;
|
|
1245
|
+
}
|
|
1246
|
+
add_header_part() {
|
|
1247
|
+
const rId = this.package[packageNextRelationshipId](this);
|
|
1248
|
+
const part = this.package[packageCreateNative]("header", { owner: this, rId });
|
|
1249
|
+
return snapshotSequence([part, rId]);
|
|
1250
|
+
}
|
|
1251
|
+
add_footer_part() {
|
|
1252
|
+
const rId = this.package[packageNextRelationshipId](this);
|
|
1253
|
+
const part = this.package[packageCreateNative]("footer", { owner: this, rId });
|
|
1254
|
+
return snapshotSequence([part, rId]);
|
|
1255
|
+
}
|
|
1256
|
+
header_part(rId) {
|
|
1257
|
+
const edge = this.rels.at(rId), dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === this.element.namespace);
|
|
1258
|
+
if (edge.is_external || edge.reltype !== `${dialect.r}/header` || !(edge.target_part instanceof HeaderPart))
|
|
1259
|
+
throw new InvalidValueError("Expected an owned native header relationship.");
|
|
1260
|
+
return edge.target_part;
|
|
1261
|
+
}
|
|
1262
|
+
footer_part(rId) {
|
|
1263
|
+
const edge = this.rels.at(rId), dialect = Object.values(documentDialects).find((dialect2) => dialect2.w === this.element.namespace);
|
|
1264
|
+
if (edge.is_external || edge.reltype !== `${dialect.r}/footer` || !(edge.target_part instanceof FooterPart))
|
|
1265
|
+
throw new InvalidValueError("Expected an owned native footer relationship.");
|
|
1266
|
+
return edge.target_part;
|
|
1267
|
+
}
|
|
1268
|
+
drop_header_part(rId) {
|
|
1269
|
+
const part = this.header_part(rId), rows = this.package[packageEdges](this).filter((row) => row.rId !== rId);
|
|
1270
|
+
this.package[packageEditRelationships](this, rows, part);
|
|
1271
|
+
}
|
|
1272
|
+
static async load(partname, content_type, blob, owner) {
|
|
1273
|
+
if (typeof content_type !== "string" || !Object.values(documentTypes).includes(parseMediaType(content_type))) throw new InputTypeError("Expected a macro-free document or template content type.");
|
|
1274
|
+
return await super.load(partname, content_type, blob, owner);
|
|
1275
|
+
}
|
|
1276
|
+
get numbering_part() {
|
|
1277
|
+
return this.package[packageNumbering](this);
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
var NumberingPart = class extends XmlPartView {
|
|
1281
|
+
static nativeTypes = ["application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"];
|
|
1282
|
+
#definitions;
|
|
1283
|
+
static async load(partname, content_type, blob, owner) {
|
|
1284
|
+
if (typeof content_type !== "string" || parseMediaType(content_type) !== "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml") throw new InputTypeError("Expected the numbering content type.");
|
|
1285
|
+
return await super.load(partname, content_type, blob, owner);
|
|
1286
|
+
}
|
|
1287
|
+
static new(owner) {
|
|
1288
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1289
|
+
owner[packageValidate]();
|
|
1290
|
+
return owner[packageNumbering](owner.main_document_part);
|
|
1291
|
+
}
|
|
1292
|
+
get numbering_definitions() {
|
|
1293
|
+
if (this.package[packageReadXml](this).xml.root.localName !== "numbering") throw new InvalidValueError("Expected an owned numbering root.");
|
|
1294
|
+
return this.#definitions ??= new _NumberingDefinitions(this);
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
var _NumberingDefinitions = class {
|
|
1298
|
+
constructor(owner) {
|
|
1299
|
+
this.owner = owner;
|
|
1300
|
+
}
|
|
1301
|
+
owner;
|
|
1302
|
+
get length() {
|
|
1303
|
+
const { xml, budget } = this.owner.package[packageReadXml](this.owner), root = xml.root;
|
|
1304
|
+
if (root.localName !== "numbering" || root.namespace !== documentDialects.transitional.w && root.namespace !== documentDialects.strict.w)
|
|
1305
|
+
throw new InvalidValueError("Expected an owned numbering root.");
|
|
1306
|
+
let count = 0;
|
|
1307
|
+
for (const node of activeXmlChildren(xml, budget)(root)) {
|
|
1308
|
+
budget.charge("work", 1);
|
|
1309
|
+
if (node.namespace === root.namespace && node.localName === "num") count++;
|
|
1310
|
+
}
|
|
1311
|
+
return count;
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
var CorePropertiesPartView = class _CorePropertiesPartView extends XmlPartView {
|
|
1315
|
+
static nativeTypes = ["application/vnd.openxmlformats-package.core-properties+xml"];
|
|
1316
|
+
static default(owner) {
|
|
1317
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1318
|
+
const part = owner.core_properties.part;
|
|
1319
|
+
if (!(part instanceof _CorePropertiesPartView)) throw new InvalidValueError("Expected an owned core-properties part.");
|
|
1320
|
+
return part;
|
|
1321
|
+
}
|
|
1322
|
+
static async load(partname, content_type, blob, owner) {
|
|
1323
|
+
if (typeof content_type !== "string" || asciiKey(content_type) !== "application/vnd.openxmlformats-package.core-properties+xml") throw new InputTypeError("Expected the core-properties content type.");
|
|
1324
|
+
return await super.load(partname, content_type, blob, owner);
|
|
1325
|
+
}
|
|
1326
|
+
#properties;
|
|
1327
|
+
get core_properties() {
|
|
1328
|
+
return this.#properties ??= this.package[packageCore](this);
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
var ImagePartView = class extends PartView {
|
|
1332
|
+
static async load(partname, content_type, blob, owner) {
|
|
1333
|
+
if (!(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted owner package.");
|
|
1334
|
+
return owner[packageLoadImage](partname, content_type, blob);
|
|
1335
|
+
}
|
|
1336
|
+
static async from_image(image, partname, owner) {
|
|
1337
|
+
if (!(image instanceof Image) || !(owner instanceof PackageView)) throw new InputTypeError("Expected an admitted image and owner package.");
|
|
1338
|
+
return owner[packageLoadImage](partname, image.content_type, image);
|
|
1339
|
+
}
|
|
1340
|
+
get image() {
|
|
1341
|
+
return this.package[packageImage](this);
|
|
1342
|
+
}
|
|
1343
|
+
get filename() {
|
|
1344
|
+
return this.image.filename;
|
|
1345
|
+
}
|
|
1346
|
+
get sha1() {
|
|
1347
|
+
return this.image.sha1;
|
|
1348
|
+
}
|
|
1349
|
+
get default_cx() {
|
|
1350
|
+
return this.image.width;
|
|
1351
|
+
}
|
|
1352
|
+
get default_cy() {
|
|
1353
|
+
return this.image.height;
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
var ImageParts = class {
|
|
1357
|
+
#package;
|
|
1358
|
+
constructor(owner) {
|
|
1359
|
+
this.#package = owner;
|
|
1360
|
+
}
|
|
1361
|
+
get length() {
|
|
1362
|
+
return this.#package[packageImages]().length;
|
|
1363
|
+
}
|
|
1364
|
+
[Symbol.iterator]() {
|
|
1365
|
+
return this.#package[packageImages]()[Symbol.iterator]();
|
|
1366
|
+
}
|
|
1367
|
+
has(item) {
|
|
1368
|
+
return this.#package[packageImages]().includes(item);
|
|
1369
|
+
}
|
|
1370
|
+
append(item) {
|
|
1371
|
+
if (!(item instanceof ImagePartView)) throw new InputTypeError("Expected an image part.");
|
|
1372
|
+
if (item.package !== this.#package) throw new OwnershipError("Expected an image part owned by this package.");
|
|
1373
|
+
this.#package[packageMetadata](item);
|
|
1374
|
+
}
|
|
1375
|
+
async get_or_add_image_part(input) {
|
|
1376
|
+
const part = await this.#package.get_or_add_image_part(input);
|
|
1377
|
+
if (!this.has(part)) throw new InvalidValueError("Image admission lost collection ownership.");
|
|
1378
|
+
return part;
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
var coreStrings = ["title", "subject", "author", "keywords", "comments", "last_modified_by", "category", "content_status", "identifier", "language", "version"];
|
|
1382
|
+
var coreDates = ["created", "modified", "last_printed"];
|
|
1383
|
+
function coreKey(name) {
|
|
1384
|
+
return { last_modified_by: "lastModifiedBy", content_status: "contentStatus", last_printed: "lastPrinted" }[name] ?? name;
|
|
1385
|
+
}
|
|
1386
|
+
var CoreProperties = class {
|
|
1387
|
+
#part;
|
|
1388
|
+
#budget;
|
|
1389
|
+
constructor(part, budget) {
|
|
1390
|
+
this.#part = part;
|
|
1391
|
+
this.#budget = budget;
|
|
1392
|
+
}
|
|
1393
|
+
get part() {
|
|
1394
|
+
return this.#part;
|
|
1395
|
+
}
|
|
1396
|
+
get element() {
|
|
1397
|
+
return this.#part.element;
|
|
1398
|
+
}
|
|
1399
|
+
[coreRead](name) {
|
|
1400
|
+
const xml = new DocumentXmlEditor(this.#part.blob, {}, void 0, this.#budget), key = coreKey(name), declaration = corePropertyKeys[key];
|
|
1401
|
+
const properties = readPropertyNodes(xml.root, "core", "transitional", this.#budget);
|
|
1402
|
+
const value = properties.find((property) => property.name === key);
|
|
1403
|
+
if (declaration.type === "integer") {
|
|
1404
|
+
return typeof value?.value?.value === "number" ? value.value.value : 0;
|
|
1405
|
+
}
|
|
1406
|
+
if (declaration.type === "date") return value?.valueContent ? readCorePropertyDate(value.valueContent.filter((node) => node.kind === "text" || node.kind === "cdata").map((node) => node.text).join(""), key) : null;
|
|
1407
|
+
return typeof value?.value?.value === "string" ? value.value.value : "";
|
|
1408
|
+
}
|
|
1409
|
+
[coreWrite](name, value) {
|
|
1410
|
+
const declaration = corePropertyKeys[coreKey(name)];
|
|
1411
|
+
let text;
|
|
1412
|
+
if (declaration.type === "string") {
|
|
1413
|
+
if (typeof value !== "string" || !validateDocxValue("string", value)) throw new InputTypeError("Expected a core-property string.");
|
|
1414
|
+
if ([...value].length > 255) throw new InvalidValueError("Core-property strings exceed 255 scalar values.");
|
|
1415
|
+
text = value;
|
|
1416
|
+
} else if (declaration.type === "integer") {
|
|
1417
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) throw new InvalidValueError("Expected a positive safe revision.");
|
|
1418
|
+
text = serializePropertyScalar(value, "revision");
|
|
1419
|
+
} else {
|
|
1420
|
+
if (!(value instanceof Date) || !Number.isFinite(Date.prototype.getTime.call(value))) throw new InputTypeError("Expected a valid explicit UTC Date.");
|
|
1421
|
+
text = normalizePropertyDate(new Date(Math.floor(Date.prototype.getTime.call(value) / 1e3) * 1e3).toISOString());
|
|
1422
|
+
if (coreKey(name) === "lastPrinted" && text.slice(0, 4) === "0000") throw new InvalidValueError("XML dateTime properties require a nonzero native year.");
|
|
1423
|
+
}
|
|
1424
|
+
const view = this.#part.element;
|
|
1425
|
+
const matching = view.children.filter((node) => node.tag.namespaceURI === declaration.namespace && node.tag.localName === declaration.localName);
|
|
1426
|
+
if (matching.length > 1) throw new InvalidValueError("Core property is ambiguous.");
|
|
1427
|
+
if (matching.length) matching[0][replaceXmlScalar](text);
|
|
1428
|
+
else view.insert(view.children.length, {
|
|
1429
|
+
kind: "element",
|
|
1430
|
+
name: { namespaceURI: declaration.namespace, localName: declaration.localName },
|
|
1431
|
+
...declaration.type === "date" && declaration.namespace !== corePropertyNamespace ? { attributes: [{ name: { namespaceURI: "http://www.w3.org/2001/XMLSchema-instance", localName: "type" }, value: "dcterms:W3CDTF" }] } : {},
|
|
1432
|
+
children: [{ kind: "text", text }]
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
for (const name of [...coreStrings, ...coreDates, "revision"]) Object.defineProperty(CoreProperties.prototype, name, {
|
|
1437
|
+
get() {
|
|
1438
|
+
return this[coreRead](name);
|
|
1439
|
+
},
|
|
1440
|
+
set(value) {
|
|
1441
|
+
this[coreWrite](name, value);
|
|
1442
|
+
},
|
|
1443
|
+
enumerable: true
|
|
1444
|
+
});
|
|
1445
|
+
var RelationshipView = class {
|
|
1446
|
+
#collection;
|
|
1447
|
+
#id;
|
|
1448
|
+
#token;
|
|
1449
|
+
constructor(collection, id, token) {
|
|
1450
|
+
this.#collection = collection;
|
|
1451
|
+
this.#id = id;
|
|
1452
|
+
this.#token = token;
|
|
1453
|
+
Object.freeze(this);
|
|
1454
|
+
}
|
|
1455
|
+
belongs(collection) {
|
|
1456
|
+
return this.#collection === collection;
|
|
1457
|
+
}
|
|
1458
|
+
belongsPackage(owner) {
|
|
1459
|
+
return this.#collection.package === owner;
|
|
1460
|
+
}
|
|
1461
|
+
row() {
|
|
1462
|
+
return this.#collection.row(this.#id, this.#token);
|
|
1463
|
+
}
|
|
1464
|
+
get rId() {
|
|
1465
|
+
return this.row().rId;
|
|
1466
|
+
}
|
|
1467
|
+
get reltype() {
|
|
1468
|
+
return this.row().reltype;
|
|
1469
|
+
}
|
|
1470
|
+
get target_ref() {
|
|
1471
|
+
return this.row().target_ref;
|
|
1472
|
+
}
|
|
1473
|
+
get is_external() {
|
|
1474
|
+
return this.row().is_external;
|
|
1475
|
+
}
|
|
1476
|
+
get target_part() {
|
|
1477
|
+
const row = this.row();
|
|
1478
|
+
if (row.is_external) throw new InvalidValueError("External relationships have no owned target part.");
|
|
1479
|
+
return this.#collection.package[packagePart](row.target_part.partname);
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
var Relationships = class {
|
|
1483
|
+
#package;
|
|
1484
|
+
#owner;
|
|
1485
|
+
#views = /* @__PURE__ */ new Map();
|
|
1486
|
+
constructor(ownerPackage, owner) {
|
|
1487
|
+
this.#package = ownerPackage;
|
|
1488
|
+
this.#owner = owner;
|
|
1489
|
+
}
|
|
1490
|
+
get package() {
|
|
1491
|
+
return this.#package;
|
|
1492
|
+
}
|
|
1493
|
+
[invalidateRelationshipViews](ids) {
|
|
1494
|
+
for (const id of ids) this.#views.delete(id);
|
|
1495
|
+
}
|
|
1496
|
+
rows() {
|
|
1497
|
+
return this.#package[packageEdges](this.#owner);
|
|
1498
|
+
}
|
|
1499
|
+
row(id, token) {
|
|
1500
|
+
const row = this.rows().find((row2) => row2.rId === id);
|
|
1501
|
+
if (!row || this.#views.get(id)?.token !== token) throw new StaleHandleError("The relationship view is detached.");
|
|
1502
|
+
return row;
|
|
1503
|
+
}
|
|
1504
|
+
view(row) {
|
|
1505
|
+
let record = this.#views.get(row.rId);
|
|
1506
|
+
if (!record) {
|
|
1507
|
+
const token = {};
|
|
1508
|
+
record = { token, view: new RelationshipView(this, row.rId, token) };
|
|
1509
|
+
this.#views.set(row.rId, record);
|
|
1510
|
+
}
|
|
1511
|
+
return record.view;
|
|
1512
|
+
}
|
|
1513
|
+
get length() {
|
|
1514
|
+
return this.rows().length;
|
|
1515
|
+
}
|
|
1516
|
+
has(id) {
|
|
1517
|
+
if (typeof id !== "string") throw new InputTypeError("Expected a relationship ID.");
|
|
1518
|
+
return this.rows().some((row) => row.rId === id);
|
|
1519
|
+
}
|
|
1520
|
+
get(id, defaultValue = null) {
|
|
1521
|
+
if (typeof id !== "string") throw new InputTypeError("Expected a relationship ID.");
|
|
1522
|
+
if (defaultValue !== null && !(defaultValue instanceof RelationshipView)) throw new InputTypeError("Expected a relationship default or null.");
|
|
1523
|
+
const row = this.rows().find((row2) => row2.rId === id);
|
|
1524
|
+
return row ? this.view(row) : defaultValue;
|
|
1525
|
+
}
|
|
1526
|
+
at(id) {
|
|
1527
|
+
const view = this.get(id);
|
|
1528
|
+
if (!view) throw new MissingKeyError("Relationship ID was not found.");
|
|
1529
|
+
return view;
|
|
1530
|
+
}
|
|
1531
|
+
*keys() {
|
|
1532
|
+
for (const row of this.rows()) yield row.rId;
|
|
1533
|
+
}
|
|
1534
|
+
*values() {
|
|
1535
|
+
for (const row of this.rows()) yield this.view(row);
|
|
1536
|
+
}
|
|
1537
|
+
*items() {
|
|
1538
|
+
for (const row of this.rows()) yield snapshotSequence([row.rId, this.view(row)]);
|
|
1539
|
+
}
|
|
1540
|
+
[Symbol.iterator]() {
|
|
1541
|
+
return this.keys();
|
|
1542
|
+
}
|
|
1543
|
+
get related_parts() {
|
|
1544
|
+
return new Map([...this.values()].filter((edge) => !edge.is_external).map((edge) => [edge.rId, edge.target_part]));
|
|
1545
|
+
}
|
|
1546
|
+
get xml() {
|
|
1547
|
+
return this.#package[packageRelationshipXml](this.#owner);
|
|
1548
|
+
}
|
|
1549
|
+
add_relationship(reltype, target, rId, is_external = false) {
|
|
1550
|
+
if (typeof reltype !== "string" || typeof rId !== "string" || !rId || typeof is_external !== "boolean") throw new InputTypeError("Expected relationship metadata.");
|
|
1551
|
+
reltype = collapseRelationshipScalar(reltype);
|
|
1552
|
+
rId = collapseRelationshipScalar(rId);
|
|
1553
|
+
if (this.has(rId)) throw new InvalidValueError("Relationship ID is already occupied.");
|
|
1554
|
+
let target_ref;
|
|
1555
|
+
if (is_external) {
|
|
1556
|
+
if (typeof target !== "string") throw new InputTypeError("Expected an inert external target string.");
|
|
1557
|
+
target_ref = collapseRelationshipScalar(target);
|
|
1558
|
+
} else {
|
|
1559
|
+
if (!(target instanceof PartView)) throw new InputTypeError("Expected a target part.");
|
|
1560
|
+
if (target.package !== this.#package) throw new OwnershipError("Expected a target owned by this package.");
|
|
1561
|
+
target_ref = relativePartTarget(this.#owner?.partname.toString() ?? "/", target.partname.toString());
|
|
1562
|
+
}
|
|
1563
|
+
this.#package[packageEditRelationships](this.#owner, [...this.rows(), { rId, reltype, target_ref, is_external }]);
|
|
1564
|
+
return this.at(rId);
|
|
1565
|
+
}
|
|
1566
|
+
get_or_add(reltype, target_part) {
|
|
1567
|
+
if (typeof reltype !== "string") throw new InputTypeError("Expected a relationship type.");
|
|
1568
|
+
reltype = collapseRelationshipScalar(reltype);
|
|
1569
|
+
if (!(target_part instanceof PartView)) throw new InputTypeError("Expected a target part.");
|
|
1570
|
+
if (target_part.package !== this.#package) throw new OwnershipError("Expected an owned target part.");
|
|
1571
|
+
const found = [...this.values()].find((row) => !row.is_external && row.reltype === reltype && row.target_part === target_part);
|
|
1572
|
+
return found ?? this.add_relationship(reltype, target_part, this.#package[packageNextRelationshipId](this.#owner));
|
|
1573
|
+
}
|
|
1574
|
+
get_or_add_ext_rel(reltype, target_ref) {
|
|
1575
|
+
if (typeof reltype !== "string" || typeof target_ref !== "string") throw new InputTypeError("Expected relationship URI strings.");
|
|
1576
|
+
reltype = collapseRelationshipScalar(reltype);
|
|
1577
|
+
target_ref = collapseRelationshipScalar(target_ref);
|
|
1578
|
+
const found = [...this.values()].find((row) => row.is_external && row.reltype === reltype && row.target_ref === target_ref);
|
|
1579
|
+
return found?.rId ?? this.add_relationship(reltype, target_ref, this.#package[packageNextRelationshipId](this.#owner), true).rId;
|
|
1580
|
+
}
|
|
1581
|
+
part_with_reltype(reltype) {
|
|
1582
|
+
if (typeof reltype !== "string") throw new InputTypeError("Expected a relationship type.");
|
|
1583
|
+
const rows = [...this.values()].filter((row) => row.reltype === reltype && !row.is_external);
|
|
1584
|
+
if (!rows.length) throw new MissingKeyError("Relationship type was not found.");
|
|
1585
|
+
if (rows.length !== 1) throw new InvalidValueError("Relationship type is ambiguous.");
|
|
1586
|
+
return rows[0].target_part;
|
|
1587
|
+
}
|
|
1588
|
+
delete(id) {
|
|
1589
|
+
this.at(id);
|
|
1590
|
+
this.#package[packageEditRelationships](this.#owner, this.rows().filter((row) => row.rId !== id));
|
|
1591
|
+
this.#views.delete(id);
|
|
1592
|
+
}
|
|
1593
|
+
clear() {
|
|
1594
|
+
this.#package[packageEditRelationships](this.#owner, []);
|
|
1595
|
+
this.#views.clear();
|
|
1596
|
+
}
|
|
1597
|
+
set(id, value) {
|
|
1598
|
+
this.#package[packageEditRelationships](this.#owner, this.assignedRows([[id, value]]));
|
|
1599
|
+
}
|
|
1600
|
+
assignedRows(entries) {
|
|
1601
|
+
if (entries == null || typeof entries === "string" || typeof entries[Symbol.iterator] !== "function") throw new InputTypeError("Expected iterable relationship entries.");
|
|
1602
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
1603
|
+
for (const entry of entries) {
|
|
1604
|
+
if (!Array.isArray(entry) || entry.length !== 2) throw new InputTypeError("Expected a relationship key and value pair.");
|
|
1605
|
+
const [id, value] = entry;
|
|
1606
|
+
if (!(value instanceof RelationshipView) || typeof id !== "string" || id !== value.rId || replacements.has(id)) throw new InputTypeError("Expected matching relationship entries.");
|
|
1607
|
+
if (!value.belongsPackage(this.#package)) throw new OwnershipError("Expected same-package relationship entries.");
|
|
1608
|
+
let target_ref = value.target_ref;
|
|
1609
|
+
if (!value.is_external && !value.belongs(this)) {
|
|
1610
|
+
const hash = target_ref.indexOf("#");
|
|
1611
|
+
target_ref = relativePartTarget(this.#owner?.partname.toString() ?? "/", value.target_part.partname.toString()) + (hash < 0 ? "" : target_ref.slice(hash));
|
|
1612
|
+
}
|
|
1613
|
+
replacements.set(id, { rId: id, reltype: value.reltype, is_external: value.is_external, target_ref });
|
|
1614
|
+
}
|
|
1615
|
+
const rows = this.rows().map((row) => replacements.get(row.rId) ?? row);
|
|
1616
|
+
for (const [id, row] of replacements) if (!rows.some((existing) => existing.rId === id)) rows.push(row);
|
|
1617
|
+
return rows;
|
|
1618
|
+
}
|
|
1619
|
+
update(entries) {
|
|
1620
|
+
this.#package[packageEditRelationships](this.#owner, this.assignedRows(entries));
|
|
1621
|
+
}
|
|
1622
|
+
setdefault(id, value) {
|
|
1623
|
+
if (!(value instanceof RelationshipView)) throw new InputTypeError("Expected a relationship default.");
|
|
1624
|
+
const existing = this.get(id);
|
|
1625
|
+
if (existing) return existing;
|
|
1626
|
+
this.update([[id, value]]);
|
|
1627
|
+
return this.at(id);
|
|
1628
|
+
}
|
|
1629
|
+
pop(id, fallback) {
|
|
1630
|
+
if (fallback !== void 0 && fallback !== null && !(fallback instanceof RelationshipView)) throw new InputTypeError("Expected a relationship default or null.");
|
|
1631
|
+
const found = this.get(id);
|
|
1632
|
+
if (!found) {
|
|
1633
|
+
if (fallback !== void 0) return fallback;
|
|
1634
|
+
throw new MissingKeyError("Relationship ID was not found.");
|
|
1635
|
+
}
|
|
1636
|
+
this.delete(id);
|
|
1637
|
+
return found;
|
|
1638
|
+
}
|
|
1639
|
+
popitem() {
|
|
1640
|
+
const id = [...this.keys()].at(-1);
|
|
1641
|
+
if (id === void 0) throw new MissingKeyError("Relationship collection is empty.");
|
|
1642
|
+
return snapshotSequence([id, this.pop(id)]);
|
|
1643
|
+
}
|
|
1644
|
+
copy() {
|
|
1645
|
+
return new Map(this.items());
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
|
|
1649
|
+
export {
|
|
1650
|
+
XmlElementView,
|
|
1651
|
+
bindXmlElementView,
|
|
1652
|
+
admitDocumentModel,
|
|
1653
|
+
packagePart,
|
|
1654
|
+
packageStyleAllocationIds,
|
|
1655
|
+
packageBindStyles,
|
|
1656
|
+
packageAdmitImages,
|
|
1657
|
+
packageBindImage,
|
|
1658
|
+
packageOwnerCheckpoint,
|
|
1659
|
+
PackageView,
|
|
1660
|
+
PartView,
|
|
1661
|
+
XmlPartView,
|
|
1662
|
+
StoryPart,
|
|
1663
|
+
HeaderPart,
|
|
1664
|
+
FooterPart,
|
|
1665
|
+
CommentsPart,
|
|
1666
|
+
SettingsPart,
|
|
1667
|
+
StylesPart,
|
|
1668
|
+
DocumentPartView,
|
|
1669
|
+
NumberingPart,
|
|
1670
|
+
_NumberingDefinitions,
|
|
1671
|
+
CorePropertiesPartView,
|
|
1672
|
+
ImagePartView,
|
|
1673
|
+
ImageParts,
|
|
1674
|
+
CoreProperties,
|
|
1675
|
+
RelationshipView,
|
|
1676
|
+
Relationships
|
|
1677
|
+
};
|