@poe-platform/safe-bash 0.1.802 → 0.1.804
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 +60 -33
- package/dist/image-ast/ast.d.ts +1 -0
- package/dist/image-ast/browser/ast.d.ts +1 -0
- package/dist/image-ast/browser/codecs/jpeg.d.ts +2 -2
- package/dist/image-ast/codecs/jpeg.d.ts +2 -2
- package/dist/image-ast/index.browser.js +692 -8355
- package/dist/image-ast/index.js +692 -8355
- package/dist/mp4-ast/codecs.d.ts +7 -2
- package/dist/safe-bash/chunks/{chunk-CHYGPFVM.js → chunk-22SX3F2R.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-FBUCWVTE.js → chunk-2IVBJTBD.js} +1 -1
- package/dist/safe-bash/chunks/chunk-2POETUMB.js +190 -0
- package/dist/safe-bash/chunks/{chunk-XVOSKJE2.js → chunk-47D7WBJK.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-VKNVHEX3.js → chunk-4ESI236Y.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-74GHTNJA.js → chunk-4KTMKD5W.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-55YJASTN.js → chunk-4T53AERN.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-DQP3VHSB.js → chunk-5XIFJVOO.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NZQXYWA3.js → chunk-62BOHHJT.js} +1 -2
- package/dist/safe-bash/chunks/{chunk-HZAMGT5I.js → chunk-67WIFM3N.js} +17 -6
- package/dist/safe-bash/chunks/{chunk-4D4N7IU2.js → chunk-6LNFRPW5.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-6O77NL2S.js → chunk-6SMICPI3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-4BSJLKNM.js → chunk-7O76UFQD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-44ALJ4QG.js → chunk-AW5KIT6V.js} +3549 -84
- package/dist/safe-bash/chunks/{chunk-RSTHLAF3.js → chunk-B2Z73HTZ.js} +52 -28
- package/dist/safe-bash/chunks/chunk-B3ZMOJVM.js +319 -0
- package/dist/safe-bash/chunks/{chunk-7ZBU7KYV.js → chunk-CFAWS3O4.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I5HZ4FGE.js → chunk-CL2FCTTO.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KDNSPLII.js → chunk-CTXNARJH.js} +2 -1
- package/dist/safe-bash/chunks/{chunk-TFIBK2GI.js → chunk-D5Q7NFWI.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-OQRVVGR6.js → chunk-DSOOVZ6Q.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-VTH3MLDU.js → chunk-DUTAG6ZD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-XAQMU6OY.js → chunk-EE5YGFIZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-FZE4HW6G.js → chunk-EJOYT2ME.js} +1 -1
- package/dist/safe-bash/chunks/chunk-FAAIR6EJ.js +887 -0
- package/dist/safe-bash/chunks/{chunk-OV6IHKO6.js → chunk-FOB2FZR4.js} +2 -2
- package/dist/safe-bash/chunks/chunk-G6V4RRSQ.js +14 -0
- package/dist/safe-bash/chunks/{chunk-UTBUUFDM.js → chunk-GGQAGQXQ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-K6VCD7IY.js → chunk-HIIYIJ5G.js} +2 -4
- package/dist/safe-bash/chunks/chunk-IOHH2GTI.js +56 -0
- package/dist/safe-bash/chunks/{chunk-CTVWDACF.js → chunk-IQW34XQT.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-HZ7BWKQ3.js → chunk-IS572AAT.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-AUSNDQTJ.js → chunk-JPSUHHOA.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZVD5IS4V.js → chunk-KBZ4UB2O.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-AM5ESLPH.js → chunk-KU5CVWKA.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NQCM3TYR.js → chunk-LPOVNKNB.js} +225 -176
- package/dist/safe-bash/chunks/{chunk-46Z5E5EV.js → chunk-MBOC3LZ4.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6PAVEFT3.js → chunk-N4BQFD3P.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-CS4MNM6I.js → chunk-NGKCVNWS.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-7R5BDCG7.js → chunk-OHML2BEU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-C5OWC2TL.js → chunk-OQ3AGYCZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-B7TAL7S5.js → chunk-PTAEWLSE.js} +0 -2
- package/dist/safe-bash/chunks/{chunk-LVOBFF4D.js → chunk-Q4FNLOTI.js} +1 -1
- package/dist/safe-bash/chunks/chunk-Q5XO3NAS.js +1036 -0
- package/dist/safe-bash/chunks/{chunk-GEG3BWGE.js → chunk-RHFRJIWQ.js} +1 -1
- package/dist/safe-bash/chunks/chunk-RUR6J33T.js +11 -0
- package/dist/safe-bash/chunks/{chunk-WDLGKIHD.js → chunk-S4RFUUXO.js} +841 -26
- package/dist/safe-bash/chunks/{chunk-RRR7AQ24.js → chunk-SD2ISU5L.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-3NDIFSNM.js → chunk-SUJ3NTMH.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-R3NAKOED.js → chunk-SZRUU5HS.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-PH63PLPZ.js → chunk-TC3F4UFF.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-3R3AANOR.js → chunk-TCKYOLUE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-D3ANYGMC.js → chunk-UV4X32QU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-E7OYNDGL.js → chunk-V7QT2RWC.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-SHEMU2Z7.js → chunk-W2IYOVHK.js} +839 -1211
- package/dist/safe-bash/chunks/{chunk-3HQU4OJO.js → chunk-XNGVOSGI.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-J42RIHHJ.js → chunk-XQWCQSRN.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-BJA5XNP6.js → chunk-Y7FW6GLT.js} +6 -6
- package/dist/safe-bash/chunks/{chunk-QGUV42T5.js → chunk-YL3GBUG4.js} +1 -1
- package/dist/safe-bash/chunks/chunk-YOXUCJER.js +389 -0
- package/dist/safe-bash/chunks/{chunk-HBCN24ZA.js → chunk-Z2AAYYJN.js} +2 -2
- package/dist/safe-bash/chunks/chunk-ZKYKJCZZ.js +30 -0
- package/dist/safe-bash/chunks/core-IE3AFIDX.js +85806 -0
- package/dist/safe-bash/chunks/{ffmpeg-WTC3TEFI.js → ffmpeg-YANDK6HU.js} +2 -2
- package/dist/safe-bash/chunks/{gh-6WU6PXL4.js → gh-4MBJ2S5V.js} +2 -2
- package/dist/safe-bash/chunks/{git-EFZIGJW4.js → git-2QONJNRQ.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-EIEYGWPF.js → imagemagick-JLEHGYSN.js} +2 -2
- package/dist/safe-bash/chunks/{mmdc-ROQJT5HQ.js → mmdc-6LD7A6ND.js} +2 -2
- package/dist/safe-bash/chunks/{pdfimages-DW7LWXFI.js → pdfimages-RSHL7LOP.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-TIP6XLUQ.js → pdfinfo-L3SGWPNG.js} +2 -2
- package/dist/safe-bash/chunks/{pdftk-DMG22ITZ.js → pdftk-LFBJNU5A.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-WNDYR72T.js → pdftoppm-NXXFUIHG.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-5IPZ4NI7.js → pdftotext-4IHNWT6F.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-TTX2DIUA.js → qpdf-ZEIREV63.js} +2 -2
- package/dist/safe-bash/chunks/read-builtin-A4QKAT45.js +9 -0
- package/dist/safe-bash/chunks/{sips-XYS46JPJ.js → sips-D5YBG2V3.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-TU73E5KL.js → soffice-RAJU3JUT.js} +2 -2
- package/dist/safe-bash/chunks/source-files-3XWRRHFA.js +7 -0
- package/dist/safe-bash/chunks/{wkhtmltopdf-FSZ2CHGE.js → wkhtmltopdf-7UE4FORZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-7KWZXKY6.js → chunk-26RTBV2I.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-AQJ2ROJO.js → chunk-2WYNMZR2.js} +10 -8
- package/dist/safe-bash/command-chunks/{chunk-BDSMROQZ.js → chunk-36GFRF2N.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-GC5TJZOF.js → chunk-3VIA2IA7.js} +114 -31
- package/dist/safe-bash/command-chunks/{chunk-NKFYQSES.js → chunk-4CTI3ZTX.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-WH627NJL.js → chunk-4MYP2FX4.js} +2 -1
- package/dist/safe-bash/command-chunks/chunk-4R5ADJM5.js +178 -0
- package/dist/safe-bash/command-chunks/{chunk-P2N33UMN.js → chunk-5MIKM54M.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DB453IE6.js → chunk-6FZQUOSJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WPYIOKE3.js → chunk-6GKYHPJG.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-7K6JYKPJ.js → chunk-6M2ELGEN.js} +17 -15
- package/dist/safe-bash/command-chunks/{chunk-PXEIT2O4.js → chunk-6UR7V3ET.js} +8 -1
- package/dist/safe-bash/command-chunks/{chunk-6KJ3LPI2.js → chunk-6XBS5B46.js} +26 -3
- package/dist/safe-bash/command-chunks/{chunk-5PWJG2UK.js → chunk-6YXLZX7L.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-EK6YNAXT.js → chunk-753YOR54.js} +31 -5
- package/dist/safe-bash/command-chunks/{chunk-RMWQAAO5.js → chunk-7IR4NRNE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-FZTK4MFI.js → chunk-7NM73SVK.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-NXEQ3ESQ.js → chunk-7QD5YY4F.js} +6 -11
- package/dist/safe-bash/command-chunks/{chunk-EMPU65ZK.js → chunk-A5LBSJGH.js} +1 -0
- package/dist/safe-bash/command-chunks/chunk-A7MU7762.js +200 -0
- package/dist/safe-bash/command-chunks/{chunk-ORYGZYKW.js → chunk-ARZMP2L2.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OQKC5ZU2.js → chunk-BAKFZ477.js} +62 -20
- package/dist/safe-bash/command-chunks/{chunk-QRRYN2KO.js → chunk-BC7BK6R6.js} +0 -2424
- package/dist/safe-bash/command-chunks/{chunk-F4TEEZTL.js → chunk-BOEOJS2Q.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XS72HTMA.js → chunk-BWGGLYEB.js} +5 -22
- package/dist/safe-bash/command-chunks/{chunk-PMBFZXTK.js → chunk-C5ZZKP7V.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LHIOAFWW.js → chunk-C7SEB6WU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XPT2UGBF.js → chunk-CHJKFRT7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TIOCQVUQ.js → chunk-CON26Q2O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-E55UKBIE.js → chunk-DBAT3IK2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z45N42QC.js → chunk-DPAYAVMS.js} +15 -1
- package/dist/safe-bash/command-chunks/chunk-DS3NXVUM.js +368 -0
- package/dist/safe-bash/command-chunks/{chunk-5ZMZ573Q.js → chunk-DSJ3VRL3.js} +16 -4
- package/dist/safe-bash/command-chunks/{chunk-K2GDEMEU.js → chunk-EFRCFWVR.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DZCY63VJ.js → chunk-EV6HIJ5H.js} +6 -5
- package/dist/safe-bash/command-chunks/{chunk-JDYXY44P.js → chunk-FJURV46Y.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-TZZ4WUKH.js → chunk-FZAWGKSE.js} +6 -4
- package/dist/safe-bash/command-chunks/{chunk-YHFXOX6U.js → chunk-GOCFQ6XV.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YOFC45RK.js → chunk-HH5O7DJI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HHCU5YU.js → chunk-HK7F5SDC.js} +13 -0
- package/dist/safe-bash/command-chunks/{chunk-JNZ3CVAE.js → chunk-HQBXIZC7.js} +8 -3
- package/dist/safe-bash/command-chunks/{chunk-2JRBIDAD.js → chunk-I63DBZXZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-WNE7FPVR.js → chunk-I64TLTIW.js} +24 -16
- package/dist/safe-bash/command-chunks/{chunk-QKFSRZGQ.js → chunk-ICANWOXH.js} +7 -31
- package/dist/safe-bash/command-chunks/{chunk-SQRQW3CT.js → chunk-IJ6LGLXM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5E4WAO4O.js → chunk-JD5QNRNO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-KJIMDLBB.js → chunk-JNANXVJV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TGSNCQSR.js → chunk-JT4RYCA6.js} +1771 -1663
- package/dist/safe-bash/command-chunks/{chunk-II77KPZN.js → chunk-JWW6FYBN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ZYXH3B66.js → chunk-LCJWKTCJ.js} +250 -203
- package/dist/safe-bash/command-chunks/{chunk-I237SNW5.js → chunk-LFJJQQND.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-LU4HBPP2.js +97 -0
- package/dist/safe-bash/command-chunks/{chunk-XJXU3VVH.js → chunk-LWOE65OE.js} +20 -5
- package/dist/safe-bash/command-chunks/{chunk-GMIHJYDG.js → chunk-M32HFSX7.js} +22 -6
- package/dist/safe-bash/command-chunks/{chunk-YG4EPFWC.js → chunk-M3NINRDU.js} +2880 -172
- package/dist/safe-bash/command-chunks/chunk-MQREDAL6.js +164 -0
- package/dist/safe-bash/command-chunks/{chunk-LWS62ISU.js → chunk-N6DIASO2.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-NGL7YK7O.js +188 -0
- package/dist/safe-bash/command-chunks/{chunk-PEF7K3UQ.js → chunk-NJYHWKIL.js} +40 -10
- package/dist/safe-bash/command-chunks/{chunk-VXSLJH7G.js → chunk-OJQRSCBP.js} +27 -7
- package/dist/safe-bash/command-chunks/{chunk-OQU6UT6X.js → chunk-OV3XREFN.js} +11 -0
- package/dist/safe-bash/command-chunks/{chunk-MIXBO6U7.js → chunk-PTZLF456.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ALDC4XP4.js → chunk-QILLRNES.js} +34 -10
- package/dist/safe-bash/command-chunks/{chunk-L22T3H7L.js → chunk-QR25JLKO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7U7EXOXX.js → chunk-R7C4MGZ5.js} +17 -223
- package/dist/safe-bash/command-chunks/{chunk-LCF3OB7P.js → chunk-RBME3JEH.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2KG2QLJE.js → chunk-RFWGYT7G.js} +3 -0
- package/dist/safe-bash/command-chunks/{chunk-5TBUOBDE.js → chunk-RZMVRT26.js} +27 -13
- package/dist/safe-bash/command-chunks/chunk-TFR6B3WB.js +44 -0
- package/dist/safe-bash/command-chunks/chunk-TOH3OF3O.js +179 -0
- package/dist/safe-bash/command-chunks/{chunk-VGG2DL5Q.js → chunk-TRR4MYWF.js} +4 -0
- package/dist/safe-bash/command-chunks/chunk-TT4DAFBT.js +13621 -0
- package/dist/safe-bash/command-chunks/{chunk-LWSBAWLT.js → chunk-TXI64OAG.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-TZRI7BJZ.js +496 -0
- package/dist/safe-bash/command-chunks/{chunk-QOKBZFFD.js → chunk-U3MMODA5.js} +2 -7
- package/dist/safe-bash/command-chunks/{chunk-ZYHTWNAE.js → chunk-UAW423ZL.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-C5YYCQHW.js → chunk-UXEEUGOV.js} +222 -12
- package/dist/safe-bash/command-chunks/{chunk-GY3BWK7K.js → chunk-VOZPMJRX.js} +87 -80
- package/dist/safe-bash/command-chunks/{chunk-MQFIPHIQ.js → chunk-WPANOB4A.js} +38 -35
- package/dist/safe-bash/command-chunks/{chunk-Y2WBSJG6.js → chunk-X4QZQI5Q.js} +65 -64
- package/dist/safe-bash/command-chunks/{chunk-FPVUD6TH.js → chunk-XGI57GCN.js} +10 -8
- package/dist/safe-bash/command-chunks/{chunk-5UBXNSFZ.js → chunk-XUCU7QQT.js} +1281 -1278
- package/dist/safe-bash/command-chunks/chunk-Y22VXJBD.js +296 -0
- package/dist/safe-bash/command-chunks/{chunk-WVHONVZ4.js → chunk-YMFUUPDX.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-IR2BY7EL.js → chunk-YYGIBXFZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-MSFXC3OC.js → chunk-Z4FO6OHE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6GWJUQAV.js → chunk-Z5ZZVDUD.js} +181 -133
- package/dist/safe-bash/command-chunks/{chunk-W5DNF4JH.js → chunk-ZHN3QDCI.js} +1 -1
- package/dist/safe-bash/commands/alias/index.d.ts +2 -0
- package/dist/safe-bash/commands/alias/index.js +2 -0
- package/dist/safe-bash/commands/apply-patch/index.browser.js +2 -3
- package/dist/safe-bash/commands/apply-patch/index.d.ts +0 -1
- package/dist/safe-bash/commands/apply-patch/index.js +0 -1
- package/dist/safe-bash/commands/archive/index.browser.js +2 -3
- package/dist/safe-bash/commands/archive/index.d.ts +0 -1
- package/dist/safe-bash/commands/archive/index.js +0 -1
- package/dist/safe-bash/commands/bytes/compression/index.js +54 -51
- package/dist/safe-bash/commands/bytes/index.js +2 -1
- package/dist/safe-bash/commands/chmod/index.browser.js +14 -0
- package/dist/safe-bash/commands/chmod/index.d.ts +2 -0
- package/dist/safe-bash/commands/chmod/index.js +2 -0
- package/dist/safe-bash/commands/column/index.browser.js +2 -3
- package/dist/safe-bash/commands/column/index.d.ts +0 -1
- package/dist/safe-bash/commands/column/index.js +0 -1
- package/dist/safe-bash/commands/copy-source.js +1 -0
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/csvkit/index.browser.js +72 -0
- package/dist/safe-bash/commands/csvkit/index.d.ts +0 -5
- package/dist/safe-bash/commands/csvkit/index.js +0 -50
- package/dist/safe-bash/commands/docx/index.browser.js +5 -7
- package/dist/safe-bash/commands/du/index.browser.js +2 -3
- package/dist/safe-bash/commands/du/index.d.ts +0 -1
- package/dist/safe-bash/commands/du/index.js +0 -1
- package/dist/safe-bash/commands/expr/index.browser.js +2 -3
- package/dist/safe-bash/commands/expr/index.d.ts +0 -1
- package/dist/safe-bash/commands/expr/index.js +0 -1
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/file/index.browser.js +2 -3
- package/dist/safe-bash/commands/file/index.d.ts +0 -1
- package/dist/safe-bash/commands/file/index.js +0 -1
- package/dist/safe-bash/commands/filesystem.js +1 -1
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/grep-aliases/index.browser.js +3 -3
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/html-to-markdown/index.browser.js +2 -3
- package/dist/safe-bash/commands/html-to-markdown/index.d.ts +0 -1
- package/dist/safe-bash/commands/html-to-markdown/index.js +0 -1
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -5
- package/dist/safe-bash/commands/htmlq/index.js +1 -143
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +4 -16314
- package/dist/safe-bash/commands/media/index.d.ts +1 -5
- package/dist/safe-bash/commands/media/index.js +1 -3
- package/dist/safe-bash/commands/media/plugin.d.ts +1 -18
- package/dist/safe-bash/commands/media/plugin.js +1 -90
- package/dist/safe-bash/commands/media/remote.d.ts +1 -63
- package/dist/safe-bash/commands/media/remote.js +1 -405
- package/dist/safe-bash/commands/media/settings.d.ts +1 -4
- package/dist/safe-bash/commands/media/settings.js +1 -26
- package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/chmod.js +1 -204
- package/dist/safe-bash/commands/metadata/index.browser.js +3 -8
- package/dist/safe-bash/commands/metadata/index.d.ts +0 -1
- package/dist/safe-bash/commands/metadata/index.js +2 -2
- package/dist/safe-bash/commands/metadata/internal.d.ts +1 -30
- package/dist/safe-bash/commands/metadata/internal.js +1 -76
- package/dist/safe-bash/commands/metadata/mktemp.d.ts +1 -3
- package/dist/safe-bash/commands/metadata/mktemp.js +1 -202
- package/dist/safe-bash/commands/metadata/stat.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/stat.js +1 -530
- package/dist/safe-bash/commands/mktemp/index.browser.js +13 -0
- package/dist/safe-bash/commands/mktemp/index.d.ts +2 -0
- package/dist/safe-bash/commands/mktemp/index.js +2 -0
- package/dist/safe-bash/commands/network/curl.js +1 -3
- package/dist/safe-bash/commands/network/index.browser.js +3 -4
- package/dist/safe-bash/commands/network/public.d.ts +0 -1
- package/dist/safe-bash/commands/network/public.js +0 -1
- package/dist/safe-bash/commands/network/transport.js +2 -1
- package/dist/safe-bash/commands/network/wget.js +1 -3
- package/dist/safe-bash/commands/node/browser.d.ts +0 -1
- package/dist/safe-bash/commands/node/browser.js +0 -1
- package/dist/safe-bash/commands/node/default-runtime.d.ts +3 -0
- package/dist/safe-bash/commands/node/default-runtime.js +15 -0
- package/dist/safe-bash/commands/node/index.browser.js +7 -8
- package/dist/safe-bash/commands/node/index.js +3 -3
- package/dist/safe-bash/commands/node/path.js +1 -1
- package/dist/safe-bash/commands/node/preload.d.ts +1 -1
- package/dist/safe-bash/commands/node/preload.js +4 -1
- package/dist/safe-bash/commands/node/quickjs.d.ts +2 -0
- package/dist/safe-bash/commands/node/quickjs.js +2 -0
- package/dist/safe-bash/commands/node/safejs.js +26 -12
- package/dist/safe-bash/commands/op/index.browser.js +2 -3
- package/dist/safe-bash/commands/op/index.d.ts +0 -11
- package/dist/safe-bash/commands/op/index.js +0 -84
- package/dist/safe-bash/commands/pandoc/index.browser.js +44 -0
- package/dist/safe-bash/commands/pandoc/index.d.ts +0 -1
- package/dist/safe-bash/commands/pandoc/index.js +0 -1
- package/dist/safe-bash/commands/portable-random.d.ts +1 -1
- package/dist/safe-bash/commands/portable-random.js +1 -12
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/python/docker-runner.js +4 -3
- package/dist/safe-bash/commands/python/docker.d.ts +1 -0
- package/dist/safe-bash/commands/python/docker.js +5 -2
- package/dist/safe-bash/commands/python/index.browser.js +17 -13
- package/dist/safe-bash/commands/python/index.d.ts +2 -1
- package/dist/safe-bash/commands/python/index.js +10 -8
- package/dist/safe-bash/commands/python/llm-capability.js +65 -2
- package/dist/safe-bash/commands/python/llm-dependencies.d.ts +27 -0
- package/dist/safe-bash/commands/python/llm-dependencies.js +66 -0
- package/dist/safe-bash/commands/python/llm-module.js +6 -4
- package/dist/safe-bash/commands/python/llm-reference-module.d.ts +3 -0
- package/dist/safe-bash/commands/python/llm-reference-module.js +690 -0
- package/dist/safe-bash/commands/python/worker.browser.js +2 -3
- package/dist/safe-bash/commands/python/worker.d.ts +0 -1
- package/dist/safe-bash/commands/python/worker.js +0 -1
- package/dist/safe-bash/commands/regex-execution/ere/transport/wire-engine.d.ts +1 -1
- package/dist/safe-bash/commands/regex-execution/ere/transport/wire-engine.js +3 -3
- package/dist/safe-bash/commands/regex-execution/public.browser.js +7 -7
- package/dist/safe-bash/commands/safejs/options.js +5 -1
- package/dist/safe-bash/commands/safejs/runtime.d.ts +1 -0
- package/dist/safe-bash/commands/safejs/runtime.js +1 -1
- package/dist/safe-bash/commands/split/index.browser.js +2 -3
- package/dist/safe-bash/commands/split/index.d.ts +0 -1
- package/dist/safe-bash/commands/split/index.js +0 -1
- package/dist/safe-bash/commands/ssconvert/index.browser.js +98 -0
- package/dist/safe-bash/commands/stat/index.browser.js +13 -0
- package/dist/safe-bash/commands/stat/index.d.ts +2 -0
- package/dist/safe-bash/commands/stat/index.js +2 -0
- package/dist/safe-bash/commands/stream-format/index.browser.js +3 -4
- package/dist/safe-bash/commands/stream-format/index.d.ts +0 -1
- package/dist/safe-bash/commands/stream-format/index.js +0 -1
- package/dist/safe-bash/commands/stream-inspection/index.browser.js +3 -4
- package/dist/safe-bash/commands/stream-inspection/index.d.ts +0 -1
- package/dist/safe-bash/commands/stream-inspection/index.js +0 -1
- package/dist/safe-bash/commands/streams.js +2 -1
- package/dist/safe-bash/commands/table-text/index.browser.js +3 -4
- package/dist/safe-bash/commands/table-text/index.d.ts +0 -1
- package/dist/safe-bash/commands/table-text/index.js +0 -1
- package/dist/safe-bash/commands/text.js +74 -34
- package/dist/safe-bash/commands/time-env/index.browser.js +3 -4
- package/dist/safe-bash/commands/time-env/index.d.ts +0 -1
- package/dist/safe-bash/commands/time-env/index.js +0 -1
- package/dist/safe-bash/commands/tree/index.browser.js +2 -3
- package/dist/safe-bash/commands/tree/index.d.ts +0 -1
- package/dist/safe-bash/commands/tree/index.js +0 -1
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/unalias/index.d.ts +2 -0
- package/dist/safe-bash/commands/unalias/index.js +2 -0
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +2 -2
- package/dist/safe-bash/core.browser.js +2 -2
- package/dist/safe-bash/core.d.ts +7 -1
- package/dist/safe-bash/core.js +7 -1
- package/dist/safe-bash/execution-runtime.js +2 -1
- package/dist/safe-bash/fs/s3/http/index.d.ts +2 -2
- package/dist/safe-bash/fs/s3/http/index.js +1 -1
- package/dist/safe-bash/full-core.browser.js +254 -916
- package/dist/safe-bash/internal/op/types.d.ts +1 -0
- package/dist/safe-bash/jobs.browser.js +5 -5
- package/dist/safe-bash/lazy-optional.d.ts +3 -3
- package/dist/safe-bash/lazy-optional.js +1 -1
- package/dist/safe-bash/opt-in/commands/cmp/index.js +7 -6
- package/dist/safe-bash/opt-in/commands/dd/index.js +1 -1
- package/dist/safe-bash/opt-in/commands/dd/io.js +51 -5
- package/dist/safe-bash/opt-in/commands/truncate/index.js +2 -2
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +3 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/input.js +2 -1
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +4 -2
- package/dist/safe-bash/opt-in/optional.d.ts +1 -1
- package/dist/safe-bash/opt-in/optional.js +1 -1
- package/dist/safe-bash/opt-in/shell/extensions/read/index.js +2 -344
- package/dist/safe-bash/optional-host.browser.js +19 -14
- package/dist/safe-bash/optional-host.d.ts +1 -0
- package/dist/safe-bash/optional-host.js +1 -0
- package/dist/safe-bash/playwright/controller.js +41 -3
- package/dist/safe-bash/playwright/native-storage-targets.js +4 -2
- package/dist/safe-bash/plugins/base.d.ts +1 -1
- package/dist/safe-bash/plugins/base.js +3 -3
- package/dist/safe-bash/plugins/composition.d.ts +5 -2
- package/dist/safe-bash/plugins/composition.js +10 -7
- package/dist/safe-bash/plugins/index.browser.js +44 -41
- package/dist/safe-bash/plugins/index.js +3 -2
- package/dist/safe-bash/plugins/portable-commands.d.ts +3 -0
- package/dist/safe-bash/plugins/portable-commands.js +31 -0
- package/dist/safe-bash/registry-entry.browser.js +41 -42
- package/dist/safe-bash/search.browser.js +32 -33
- package/dist/safe-bash/shell/arithmetic.js +19 -6
- package/dist/safe-bash/shell/arrays/state.js +1 -1
- package/dist/safe-bash/shell/arrays/syntax.js +4 -3
- package/dist/safe-bash/shell/index.d.ts +0 -1
- package/dist/safe-bash/shell/index.js +0 -1
- package/dist/safe-bash/shell/parser.d.ts +2 -2
- package/dist/safe-bash/shell/parser.js +268 -64
- package/dist/safe-bash/shell/read-builtin.d.ts +3 -0
- package/dist/safe-bash/shell/read-builtin.js +344 -0
- package/dist/safe-bash/shell/runtime.d.ts +24 -4
- package/dist/safe-bash/shell/runtime.js +392 -414
- package/dist/safe-bash/shell/session-state.js +25 -0
- package/dist/safe-bash/shell/shell.js +76 -154
- package/dist/safe-bash/shell/tilde-expansion.d.ts +1 -1
- package/dist/safe-bash/shell/tilde-expansion.js +2 -2
- package/dist/safe-bash/shell/types.d.ts +7 -0
- package/dist/safe-bash/shell/value-state.js +1 -1
- package/dist/safe-bash/shell/worker-limits.js +1 -0
- package/dist/safe-bash/shell-entry.browser.js +32 -33
- package/dist/safe-bash/trap.browser.js +4 -4
- package/dist/safe-bash/worker/host.js +1 -1
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-calendar-engine/time-env/calendar.d.ts +1 -1
- package/dist/safe-bash-calendar-engine/time-env/calendar.js +1 -1
- package/dist/safe-bash-calendar-engine/time-env/format.js +1 -1
- package/dist/safe-bash-command-alias/index.d.ts +13 -0
- package/dist/safe-bash-command-alias/index.js +88 -0
- package/dist/safe-bash-command-apply-patch/apply.js +3 -3
- package/dist/safe-bash-command-apply-patch/index.js +3 -3
- package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
- package/dist/safe-bash-command-apply-patch/parser.js +1 -1
- package/dist/safe-bash-command-awk/awk-pipes.js +2 -2
- package/dist/safe-bash-command-awk/awk-reader.js +1 -1
- package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
- package/dist/safe-bash-command-awk/awk.js +5 -5
- package/dist/safe-bash-command-awk/index.js +5 -5
- package/dist/safe-bash-command-bc/index.js +218 -65
- package/dist/safe-bash-command-bzip2/index.js +4 -3
- package/dist/safe-bash-command-chmod/LICENSE +21 -0
- package/dist/safe-bash-command-chmod/command.d.ts +7 -0
- package/dist/safe-bash-command-chmod/command.js +11 -0
- package/dist/safe-bash-command-chmod/index.d.ts +6 -0
- package/dist/safe-bash-command-chmod/index.js +27 -0
- package/dist/safe-bash-command-cmp/index.js +7 -6
- package/dist/safe-bash-command-column/column.js +3 -3
- package/dist/safe-bash-command-column/index.js +3 -3
- package/dist/safe-bash-command-column/layout.js +2 -2
- package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/index.js +1505 -7
- package/dist/safe-bash-command-csvkit/sync-support.js +2 -7
- package/dist/safe-bash-command-curl/curl.js +1 -1
- package/dist/safe-bash-command-curl/index.js +1 -1
- package/dist/safe-bash-command-date/date.js +1 -1
- package/dist/safe-bash-command-date/index.js +1 -1
- package/dist/safe-bash-command-dd/index.js +1 -1
- package/dist/safe-bash-command-dd/io.js +51 -5
- package/dist/safe-bash-command-diff/diff.js +1 -1
- package/dist/safe-bash-command-diff/index.js +1 -1
- package/dist/safe-bash-command-diff3/index.js +10 -13
- package/dist/safe-bash-command-exiftool/index.js +283 -55
- package/dist/safe-bash-command-exiftool/registry.d.ts +4 -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-fd/arguments.d.ts +2 -0
- package/dist/safe-bash-command-fd/index.js +42 -12
- package/dist/safe-bash-command-ffmpeg/index.js +356 -66
- package/dist/safe-bash-command-find/find-format.d.ts +3 -0
- package/dist/safe-bash-command-find/find-format.js +1 -1
- package/dist/safe-bash-command-find/find.js +2 -2
- package/dist/safe-bash-command-find/index.js +2 -2
- package/dist/safe-bash-command-fmt/index.js +10 -6
- package/dist/safe-bash-command-fold/engine.d.ts +1 -1
- package/dist/safe-bash-command-fold/family.js +2 -2
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-gzip/index.js +45 -42
- package/dist/safe-bash-command-hexdump/command.js +2 -2
- package/dist/safe-bash-command-hexdump/index.js +2 -2
- package/dist/safe-bash-command-html-to-markdown/entities.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/index.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/input.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/parser.js +2 -2
- package/dist/safe-bash-command-html-to-markdown/render.js +3 -3
- package/dist/safe-bash-command-htmlq/contracts.d.ts +5 -2
- package/dist/safe-bash-command-htmlq/index.d.ts +2 -1
- package/dist/safe-bash-command-htmlq/index.js +175 -49
- package/dist/safe-bash-command-htmlq/sync.d.ts +1 -0
- package/dist/safe-bash-command-imagemagick/index.js +59 -7
- package/dist/safe-bash-command-install/arguments.d.ts +27 -0
- package/dist/safe-bash-command-install/arguments.js +224 -0
- package/dist/safe-bash-command-install/index.d.ts +7 -0
- package/dist/safe-bash-command-install/index.js +942 -0
- package/dist/safe-bash-command-install/mode.d.ts +6 -0
- package/dist/safe-bash-command-install/mode.js +71 -0
- package/dist/safe-bash-command-install/options.d.ts +40 -0
- package/dist/safe-bash-command-install/options.js +27 -0
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-less/index.js +42 -57
- package/dist/safe-bash-command-llm/command.js +1 -1
- package/dist/safe-bash-command-llm/elevenlabs.js +2 -2
- package/dist/safe-bash-command-llm/index.js +4 -4
- package/dist/safe-bash-command-llm/openai.js +2 -2
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +2 -2
- package/dist/safe-bash-command-llm/providers/index.js +3 -3
- package/dist/safe-bash-command-llm/providers/openai.js +2 -2
- package/dist/safe-bash-command-llm/providers/shared.js +1 -1
- package/dist/{safe-bash-mcp → safe-bash-command-mcp}/index.browser.d.ts +463 -46
- package/dist/safe-bash-command-mcp/index.browser.js +19308 -0
- package/dist/{safe-bash-mcp → safe-bash-command-mcp}/index.d.ts +15 -6
- package/dist/{safe-bash-mcp → safe-bash-command-mcp}/index.js +2835 -2783
- package/dist/safe-bash-command-media/LICENSE +21 -0
- package/dist/safe-bash-command-media/index.d.ts +6 -0
- package/dist/safe-bash-command-media/index.js +30 -0
- package/dist/safe-bash-command-media/plugin.d.ts +18 -0
- package/dist/safe-bash-command-media/plugin.js +11 -0
- package/dist/safe-bash-command-media/remote.d.ts +63 -0
- package/dist/safe-bash-command-media/remote.js +11 -0
- package/dist/safe-bash-command-media/settings.d.ts +4 -0
- package/dist/safe-bash-command-media/settings.js +41 -0
- package/dist/safe-bash-command-mktemp/LICENSE +21 -0
- package/dist/safe-bash-command-mktemp/command.d.ts +3 -0
- package/dist/safe-bash-command-mktemp/command.js +9 -0
- package/dist/safe-bash-command-mktemp/index.d.ts +6 -0
- package/dist/safe-bash-command-mktemp/index.js +25 -0
- package/dist/safe-bash-command-mmdc/arguments.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/command.d.ts +2 -0
- package/dist/safe-bash-command-mmdc/contracts.d.ts +8 -1
- package/dist/safe-bash-command-mmdc/index.js +359 -7
- package/dist/safe-bash-command-nl/index.js +1 -1
- package/dist/safe-bash-command-nl/nl.js +1 -1
- package/dist/safe-bash-command-node/LICENSE +21 -0
- package/dist/safe-bash-command-node/index.d.ts +17 -0
- package/dist/safe-bash-command-node/index.js +328 -0
- package/dist/safe-bash-command-numfmt/index.js +1 -0
- package/dist/safe-bash-command-od/index.js +16 -8
- package/dist/safe-bash-command-op/index.js +62 -36
- package/dist/safe-bash-command-op/types.d.ts +1 -0
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.d.ts +1 -0
- package/dist/safe-bash-command-pandoc/index.js +5 -3
- package/dist/safe-bash-command-pandoc/sync.d.ts +1 -0
- package/dist/safe-bash-command-patch/index.js +4 -4
- package/dist/safe-bash-command-patch/patch.js +4 -4
- package/dist/safe-bash-command-pdfimages/index.js +1 -1
- package/dist/safe-bash-command-pdfinfo/index.js +30 -5
- package/dist/safe-bash-command-pdftk/index.js +21 -23
- package/dist/safe-bash-command-pdftoppm/index.js +17 -4
- package/dist/safe-bash-command-pdftotext/index.js +11 -14
- package/dist/safe-bash-command-qpdf/index.d.ts +1 -0
- package/dist/safe-bash-command-qpdf/index.js +9 -6
- package/dist/safe-bash-command-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.js +1 -1
- package/dist/safe-bash-command-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- package/dist/safe-bash-command-shuf/input.d.ts +2 -2
- package/dist/safe-bash-command-shuf/input.js +2 -1
- package/dist/safe-bash-command-shuf/shuf.js +4 -2
- package/dist/safe-bash-command-sips/index.js +15 -7
- package/dist/safe-bash-command-soffice/index.js +97 -12
- package/dist/safe-bash-command-sponge/index.js +13 -3
- package/dist/safe-bash-command-sqlite3/engine.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +510 -70
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +2 -2
- package/dist/safe-bash-command-ssconvert/index.js +44 -22
- package/dist/safe-bash-command-stat/LICENSE +21 -0
- package/dist/safe-bash-command-stat/command.d.ts +7 -0
- package/dist/safe-bash-command-stat/command.js +9 -0
- package/dist/safe-bash-command-stat/index.d.ts +6 -0
- package/dist/safe-bash-command-stat/index.js +25 -0
- package/dist/safe-bash-command-tar/create.d.ts +1 -0
- package/dist/safe-bash-command-tar/create.js +2 -2
- package/dist/safe-bash-command-tar/extract.js +2 -2
- package/dist/safe-bash-command-tar/index.js +4 -4
- package/dist/safe-bash-command-tar/modes.js +4 -4
- package/dist/safe-bash-command-tar/options.js +1 -1
- package/dist/safe-bash-command-truncate/index.js +2 -2
- package/dist/safe-bash-command-tsort/command.js +2 -2
- package/dist/safe-bash-command-tsort/index.js +2 -2
- package/dist/safe-bash-command-unalias/index.d.ts +12 -0
- package/dist/safe-bash-command-unalias/index.js +67 -0
- package/dist/safe-bash-command-unrtf/index.js +37 -5
- package/dist/safe-bash-command-xan/argv.d.ts +1 -1
- package/dist/safe-bash-command-xan/argv.js +2 -2
- package/dist/safe-bash-command-xan/budget.d.ts +0 -1
- package/dist/safe-bash-command-xan/budget.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +6 -6
- package/dist/safe-bash-command-xan/csv.js +2 -2
- package/dist/safe-bash-command-xan/index.js +8 -9
- package/dist/safe-bash-command-xan/io.js +4 -4
- package/dist/safe-bash-command-xan/options.js +1 -1
- package/dist/safe-bash-command-xan/selector.js +2 -2
- package/dist/safe-bash-command-xmllint/index.js +45 -23
- package/dist/safe-bash-command-xxd/index.js +47 -12
- package/dist/safe-bash-command-xz/command.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +3 -2
- package/dist/safe-bash-command-yq/accounting.js +1 -1
- package/dist/safe-bash-command-yq/index.js +4 -2
- package/dist/safe-bash-command-yq/native-work.js +3 -0
- package/dist/safe-bash-command-yq/parser.js +2 -2
- package/dist/safe-bash-command-yq/query.js +8 -5
- package/dist/safe-bash-command-yq/toml.js +2 -2
- package/dist/safe-bash-command-zip/index.js +3 -3
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/options.js +1 -1
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/default-executor.js +2 -2
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +6 -6
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +5 -5
- package/dist/safe-bash-contracts/http.d.ts +7 -0
- package/dist/safe-bash-contracts/index.js +8 -8
- package/dist/safe-bash-contracts/io.d.ts +2 -0
- package/dist/safe-bash-contracts/io.js +2 -2
- package/dist/safe-bash-contracts/output.js +3 -3
- package/dist/safe-bash-contracts/runtime-control.d.ts +2 -2
- package/dist/safe-bash-contracts/runtime-control.js +4 -2
- package/dist/safe-bash-contracts/signals.d.ts +2 -0
- package/dist/safe-bash-contracts/signals.js +3 -1
- package/dist/safe-bash-contracts/yield.js +1 -1
- package/dist/safe-bash-csv-engine/index.d.ts +2 -1
- package/dist/safe-bash-csv-engine/index.js +21 -15
- package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +6 -6
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +38 -18
- package/dist/safe-bash-line-ending-engine/convert.js +9 -204
- package/dist/safe-bash-line-ending-engine/encoding.js +9 -42
- package/dist/safe-bash-line-ending-engine/index.js +48 -0
- package/dist/safe-bash-line-ending-engine/info.js +9 -90
- package/dist/safe-bash-line-ending-engine/internal.js +15 -160
- package/dist/safe-bash-line-ending-engine/io.js +12 -289
- package/dist/safe-bash-line-ending-engine/stage.js +10 -160
- package/dist/safe-bash-markdown-engine/index.js +3 -3
- package/dist/safe-bash-metadata-engine/LICENSE +21 -0
- package/dist/safe-bash-metadata-engine/index.d.ts +30 -0
- package/dist/safe-bash-metadata-engine/index.js +82 -0
- package/dist/safe-bash-metadata-engine/random.d.ts +1 -0
- package/dist/safe-bash-metadata-engine/random.js +21 -0
- package/dist/safe-bash-network-engine/args.d.ts +6 -0
- package/dist/safe-bash-network-engine/args.js +4 -2
- package/dist/safe-bash-network-engine/body.js +1 -1
- package/dist/safe-bash-network-engine/fetch-transport.js +3 -1
- package/dist/safe-bash-network-engine/index.js +3 -1
- package/dist/safe-bash-network-engine/input.js +2 -2
- package/dist/safe-bash-network-engine/platform-portable.js +3 -1
- package/dist/safe-bash-query-engine/dates.d.ts +1 -1
- package/dist/safe-bash-query-engine/dates.js +1 -1
- package/dist/safe-bash-query-engine/index.js +6 -6
- package/dist/safe-bash-query-engine/interpreter.js +4 -4
- package/dist/safe-bash-query-engine/parser.js +1 -1
- package/dist/safe-bash-query-engine/query-core.js +6 -6
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +10 -0
- package/dist/safe-bash-regex-engine/index.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +1 -1
- package/dist/safe-bash-regex-engine/text/regex.js +1 -1
- package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +1 -0
- package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-search-engine/glob.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +17 -10
- package/dist/safe-bash-search-engine/matcher.d.ts +2 -2
- package/dist/safe-bash-search-engine/matcher.js +13 -9
- package/dist/safe-bash-search-engine/options.d.ts +2 -0
- package/dist/safe-bash-search-engine/options.js +1 -1
- package/dist/safe-bash-search-engine/output.js +1 -1
- package/dist/safe-bash-search-engine/shared.js +2 -2
- package/dist/safe-bash-search-engine/walk.js +15 -3
- package/dist/safe-bash-text-stream-engine/stream-format/shared.d.ts +1 -1
- package/dist/safe-bash-text-stream-engine/stream-format/shared.js +2 -1
- package/dist/safe-bash-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.js +2 -2
- package/dist/safe-bash-xml-engine/index.js +4 -4
- package/dist/safe-bash-xml-engine/io.js +7 -2
- package/dist/safe-bash-xml-engine/limits.d.ts +0 -2
- package/dist/safe-bash-xml-engine/limits.js +1 -1
- package/dist/safe-bash-xml-engine/query.js +3 -3
- 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/safety.js +1 -1
- package/dist/safe-bash-zip-engine/zip/sfx.js +3 -3
- package/dist/safe-bash-zip-engine/zip/volumes.js +1 -1
- package/dist/safe-bash-zip-engine/zip-format.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-snapshot-json.js +2 -2
- package/dist/safe-playwright-cloudflare/browser-snapshot-references.js +1 -1
- package/dist/safe-playwright-cloudflare/browser-socket-closure.js +18 -3
- package/dist/safe-playwright-cloudflare/shell-browser-resource.js +1 -1
- package/dist/xlsx-ast/xlsx.js +6 -5
- package/package.json +112 -98
- package/dist/media-cli/bytes.d.ts +0 -8
- package/dist/media-cli/bytes.js +0 -40
- package/dist/media-cli/concat.d.ts +0 -30
- package/dist/media-cli/concat.js +0 -197
- package/dist/media-cli/content.js +0 -66
- package/dist/media-cli/dependency-grammars.d.ts +0 -12
- package/dist/media-cli/dependency-grammars.js +0 -557
- package/dist/media-cli/discover.js +0 -286
- package/dist/media-cli/engine.js +0 -190
- package/dist/media-cli/filename-expression.js +0 -147
- package/dist/media-cli/filesystem.js +0 -35
- package/dist/media-cli/frontend-contract.js +0 -8
- package/dist/media-cli/frontend-issues.d.ts +0 -6
- package/dist/media-cli/frontend-issues.js +0 -9
- package/dist/media-cli/imagemagick-operand.d.ts +0 -42
- package/dist/media-cli/imagemagick-operand.js +0 -229
- package/dist/media-cli/imagemagick-references.d.ts +0 -7
- package/dist/media-cli/imagemagick-references.js +0 -42
- package/dist/media-cli/imagemagick.generated.js +0 -3254
- package/dist/media-cli/imagemagick.js +0 -615
- package/dist/media-cli/index.js +0 -12
- package/dist/media-cli/mvg.d.ts +0 -10
- package/dist/media-cli/mvg.js +0 -102
- package/dist/media-cli/network.js +0 -78
- package/dist/media-cli/options.generated.js +0 -3312
- package/dist/media-cli/preset.d.ts +0 -11
- package/dist/media-cli/preset.js +0 -57
- package/dist/media-cli/resolution-path.d.ts +0 -23
- package/dist/media-cli/resolution-path.js +0 -217
- package/dist/media-cli/resolver.js +0 -494
- package/dist/media-cli/resources.d.ts +0 -16
- package/dist/media-cli/resources.js +0 -187
- package/dist/media-cli/shim.js +0 -52
- package/dist/media-cli/tee.d.ts +0 -6
- package/dist/media-cli/tee.js +0 -38
- package/dist/office-package/zip-sync.js +0 -111
- package/dist/remote-execution/binary.js +0 -178
- package/dist/remote-execution/callback-result.js +0 -26
- package/dist/remote-execution/canonical-capabilities.d.ts +0 -5
- package/dist/remote-execution/canonical-capabilities.js +0 -45
- package/dist/remote-execution/canonical-metadata.d.ts +0 -4
- package/dist/remote-execution/canonical-metadata.js +0 -32
- package/dist/remote-execution/client.js +0 -824
- package/dist/remote-execution/deployment.js +0 -131
- package/dist/remote-execution/descriptors.js +0 -267
- package/dist/remote-execution/effects.js +0 -357
- package/dist/remote-execution/endpoint.js +0 -224
- package/dist/remote-execution/files.js +0 -291
- package/dist/remote-execution/hosting-operation.js +0 -26
- package/dist/remote-execution/hosting-request.d.ts +0 -4
- package/dist/remote-execution/hosting-request.js +0 -12
- package/dist/remote-execution/hosting-stream.d.ts +0 -8
- package/dist/remote-execution/hosting-stream.js +0 -64
- package/dist/remote-execution/index.js +0 -18
- package/dist/remote-execution/invocation-admission.d.ts +0 -3
- package/dist/remote-execution/invocation-admission.js +0 -17
- package/dist/remote-execution/job-binding.js +0 -1269
- package/dist/remote-execution/materializations.js +0 -284
- package/dist/remote-execution/modal-driver.js +0 -90
- package/dist/remote-execution/native-result.d.ts +0 -3
- package/dist/remote-execution/native-result.js +0 -16
- package/dist/remote-execution/output-freshness.d.ts +0 -4
- package/dist/remote-execution/output-freshness.js +0 -19
- package/dist/remote-execution/output-retrieval.js +0 -474
- package/dist/remote-execution/process-http.js +0 -607
- package/dist/remote-execution/process.js +0 -577
- package/dist/remote-execution/protocol.js +0 -208
- package/dist/remote-execution/relay.js +0 -91
- package/dist/remote-execution/rest-driver.js +0 -93
- package/dist/remote-execution/upload-descriptor.js +0 -201
- package/dist/remote-execution/upload-protocol.js +0 -62
- package/dist/remote-execution/uploads.js +0 -324
- package/dist/remote-execution/wire-json.d.ts +0 -4
- package/dist/remote-execution/wire-json.js +0 -44
- package/dist/remote-execution/wire-validation.js +0 -131
- package/dist/remote-execution/wire.generated.js +0 -4224
- package/dist/safe-bash/chunks/chunk-GETUOD5D.js +0 -161
- package/dist/safe-bash/chunks/chunk-IWDICZVK.js +0 -20
- package/dist/safe-bash/chunks/chunk-MHMMRCYC.js +0 -3464
- package/dist/safe-bash/chunks/chunk-UE5KZDEK.js +0 -77
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +0 -962
- package/dist/safe-bash/chunks/csvkit-TACDU7FC.js +0 -1618
- package/dist/safe-bash/chunks/implementation-MLFHUQ5M.js +0 -133
- package/dist/safe-bash/commands/csvkit/sync.js +0 -1639
- package/dist/safe-bash/commands/node/unconfigured.d.ts +0 -3
- package/dist/safe-bash/commands/node/unconfigured.js +0 -10
- package/dist/safe-bash/commands/pandoc/implementation.d.ts +0 -8
- package/dist/safe-bash/commands/pandoc/implementation.js +0 -94
- package/dist/safe-bash-mcp/index.browser.js +0 -9157
- package/dist/safe-bash/command-chunks/{chunk-ZRRBXU3M.js → chunk-GIN5GUDP.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-LAOM65EE.js → chunk-IEO4XVN6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-364TMWBT.js → chunk-MWREVL44.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-464RVBGB.js → chunk-Q5TDKFHK.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-AJR3AQYA.js → chunk-UKX3LZHR.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-XIIBTGC5.js → chunk-XPXEQKRW.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-FDBUV4HJ.js → chunk-Y4HGTG3E.js} +3 -3
- /package/dist/{safe-bash/commands/csvkit → safe-bash-command-csvkit}/sync.d.ts +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
defaultPdfLimits,
|
|
7
7
|
renderPdf,
|
|
8
8
|
suppliedDefaultFont
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BC7BK6R6.js";
|
|
10
10
|
import {
|
|
11
11
|
createZipCodec
|
|
12
12
|
} from "./chunk-5LU4UCBR.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-RDV7UCYZ.js";
|
|
16
16
|
import {
|
|
17
17
|
decodeJpegImage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-M3NINRDU.js";
|
|
19
19
|
import {
|
|
20
20
|
createLuaFilterCapability
|
|
21
21
|
} from "./chunk-3E2OIS2J.js";
|
|
@@ -44,8 +44,9 @@ import {
|
|
|
44
44
|
init_buffer
|
|
45
45
|
} from "./chunk-HX3SHTCE.js";
|
|
46
46
|
|
|
47
|
-
// packages/safe-bash-command-pandoc/dist/chunks/chunk-
|
|
47
|
+
// packages/safe-bash-command-pandoc/dist/chunks/chunk-LPEDU7DV.js
|
|
48
48
|
init_buffer();
|
|
49
|
+
import { builtInDirectContextExecutors, syncCommandEvaluators } from "../../safe-bash-contracts/runtime-control.js";
|
|
49
50
|
import * as gfm_syntax_star from "../../safe-bash-markdown-engine/gfm-syntax.js";
|
|
50
51
|
import * as commonmark_blocks_star from "../../safe-bash-markdown-engine/commonmark-blocks.js";
|
|
51
52
|
import * as commonmark_inlines_star from "../../safe-bash-markdown-engine/commonmark-inlines.js";
|
|
@@ -1958,6 +1959,95 @@ var require_saxes = __commonJS({
|
|
|
1958
1959
|
exports.SaxesParser = SaxesParser3;
|
|
1959
1960
|
}
|
|
1960
1961
|
});
|
|
1962
|
+
var languages = "abc\nactionscript\nada\nagda\napache\nasn1\nasp\nats\nawk\nbash\nbibtex\nboo\nc\nchangelog\nclojure\ncmake\ncoffee\ncoldfusion\ncomments\ncommonlisp\ncpp\ncrystal\ncs\ncss\ncurry\nd\ndart\ndebiancontrol\ndefault\ndiff\ndjangotemplate\ndockerfile\ndosbat\ndot\ndoxygen\ndoxygenlua\ndtd\neiffel\nelixir\nelm\nemail\nerlang\nfasm\nfortranfixed\nfortranfree\nfsharp\ngap\ngcc\ngdscript\ngleam\nglsl\ngnuassembler\ngo\ngpr\ngraphql\ngroovy\nhamlet\nhaskell\nhaxe\nhtml\nidris\nini\nisocpp\nj\njava\njavadoc\njavascript\njavascriptreact\njson\njsp\njulia\nkotlin\nlatex\nlex\nlilypond\nliteratecurry\nliteratehaskell\nllvm\nlua\nm4\nmakefile\nmandoc\nmarkdown\nmathematica\nmatlab\nmaxima\nmediawiki\nmetafont\nmips\nmodelines\nmodula2\nmodula3\nmonobasic\nmustache\nnasm\nnim\nnix\nnoweb\nobjectivec\nobjectivecpp\nocaml\noctave\nodin\nopencl\norgmode\npascal\nperl\nphp\npike\npostscript\npovray\npowershell\nprolog\nprotobuf\npure\npurebasic\npurescript\npython\nqml\nr\nracket\nraku\nrelaxng\nrelaxngcompact\nrest\nrhtml\nroff\nruby\nrust\nsass\nscala\nscheme\nsci\nscss\nsed\nsgml\nsml\nspdxcomments\nsql\nsqlmysql\nsqlpostgresql\nstan\nstata\nswift\nsystemverilog\ntcl\ntcsh\nterraform\ntexinfo\ntlaplus\ntoml\ntypescript\ntypst\nverilog\nvhdl\nxml\nxorg\nxslt\nxul\nyacc\nyaml\nzig\nzsh\n";
|
|
1963
|
+
var html5 = '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>\n<head>\n <meta charset="utf-8" />\n <meta name="generator" content="pandoc $pandoc-version$" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />\n$for(author-meta)$\n <meta name="author" content="$author-meta$" />\n$endfor$\n$if(date-meta)$\n <meta name="dcterms.date" content="$date-meta$" />\n$endif$\n$if(keywords)$\n <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />\n$endif$\n$if(description-meta)$\n <meta name="description" content="$description-meta$" />\n$endif$\n <title>$if(title-prefix)$$title-prefix$ \u2013 $endif$$pagetitle$</title>\n <style>\n $styles.html()$\n </style>\n$for(css)$\n <link rel="stylesheet" href="$css$" />\n$endfor$\n$for(header-includes)$\n $header-includes$\n$endfor$\n$if(math)$\n $math$\n$endif$\n</head>\n<body>\n$for(include-before)$\n$include-before$\n$endfor$\n$if(title)$\n<header id="title-block-header">\n<h1 class="title">$title$</h1>\n$if(subtitle)$\n<p class="subtitle">$subtitle$</p>\n$endif$\n$for(author)$\n<p class="author">$author$</p>\n$endfor$\n$if(date)$\n<p class="date">$date$</p>\n$endif$\n$if(abstract)$\n<div class="abstract">\n<div class="abstract-title">$abstract-title$</div>\n$abstract$\n</div>\n$endif$\n</header>\n$endif$\n$if(toc)$\n<nav id="$idprefix$TOC" role="doc-toc">\n$if(toc-title)$\n<h2 id="$idprefix$toc-title">$toc-title$</h2>\n$endif$\n$table-of-contents$\n</nav>\n$endif$\n$body$\n$for(include-after)$\n$include-after$\n$endfor$\n</body>\n</html>\n';
|
|
1964
|
+
var abbreviations = "aet.\naetat.\nal.\nApr.\nAug.\nbk.\nBros.\nc.\nCapt.\ncf.\nch.\nchap.\nchs.\nCo.\ncol.\nCorp.\ncp.\nd.\nDec.\nDr.\ne.g.\ned.\neds.\nesp.\nf.\nfasc.\nFeb.\nff.\nfig.\nfl.\nfol.\nfols.\nFr.\nGen.\nGov.\nHon.\ni.e.\nill.\nInc.\nincl.\nJan.\nJr.\nJul.\nJun.\nLtd.\nM.A.\nM.D.\nMar.\nMr.\nMrs.\nMs.\nn.\nn.b.\nnn.\nNo.\nNov.\nOct.\np.\nPh.D.\npp.\nPres.\nProf.\npt.\nq.v.\nRep.\nRev.\ns.v.\ns.vv.\nsaec.\nsec.\nSen.\nSep.\nSept.\nSgt.\nSr.\nSt.\nuniv.\nviz.\nvol.\nvs.\n";
|
|
1965
|
+
var highlightStyles = /* @__PURE__ */ new Map([["pygments", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": "#7d9029",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": "#880000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#007020",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#902000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#ba2121",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#06287e",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#008000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#007020",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#666666",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#007020",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#bc7a00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#bb6688",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#19177c",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["tango", '{\n "text-color": null,\n "background-color": "#f8f8f8",\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ef2929",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#a40000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#ce5c00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#ce5c00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#000000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["espresso", '{\n "text-color": "#bdae9d",\n "background-color": "#2a211c",\n "line-number-color": "#bdae9d",\n "line-number-background-color": "#2a211c",\n "text-styles": {\n "Alert": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#43a8ed",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "DecVal": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#ff9358",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#43a8ed",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["zenburn", '{\n "text-color": "#cccccc",\n "background-color": "#303030",\n "line-number-color": null,\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ffcfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#f0dfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#dfdfbf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#dcdccc",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#c3bf9f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#c0bed1",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#efef8f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#f0dfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#f0efd0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#efef8f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#ffcfaf",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["kate", '{\n "text-color": "#1f1c1b",\n "background-color": "#ffffff",\n "line-number-color": "#a0a0a0",\n "line-number-background-color": "#ffffff",\n "text-styles": {\n "Alert": {\n "text-color": "#bf0303",\n "background-color": "#f7e6e6",\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#ca60ca",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#644a9b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#924c9d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#898887",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#0095ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#aa5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#607880",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Extension": {\n "text-color": "#0095ff",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#644a9b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#ff5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Normal": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#006e28",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#006e28",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "RegionMarker": {\n "text-color": "#0057ae",\n "background-color": "#e0e9f8",\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#ff5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["monochrome", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": null,\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Comment": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "ControlFlow": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Documentation": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["breezedark", '{\n "text-color": "#cfcfc2",\n "background-color": "#232629",\n "line-number-color": "#7a7c7d",\n "line-number-background-color": "#232629",\n "text-styles": {\n "Alert": {\n "text-color": "#95da4c",\n "background-color": "#4d1f24",\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#3f8058",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": "#2980b9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#7f8c8d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#7a7c7d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#7f8c8d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#27aeae",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#fdbc4b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#2980b9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#a43340",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Extension": {\n "text-color": "#0099ff",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#8e44ad",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#c45b00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Normal": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "RegionMarker": {\n "text-color": "#2980b9",\n "background-color": "#153042",\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#f44f4f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#27aeae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["haddock", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#0000ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#0000ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#ff4000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#ff4000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#008000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n']]);
|
|
1966
|
+
var gfm_syntax_exports = {};
|
|
1967
|
+
__reExport(gfm_syntax_exports, gfm_syntax_star);
|
|
1968
|
+
var commonmark_blocks_exports = {};
|
|
1969
|
+
__reExport(commonmark_blocks_exports, commonmark_blocks_star);
|
|
1970
|
+
var commonmark_inlines_exports = {};
|
|
1971
|
+
__reExport(commonmark_inlines_exports, commonmark_inlines_star);
|
|
1972
|
+
var commonmark_syntax_exports = {};
|
|
1973
|
+
__reExport(commonmark_syntax_exports, commonmark_syntax_star);
|
|
1974
|
+
var readCommonMark = async (input, context, selection) => {
|
|
1975
|
+
const extensions = selection?.extensions ?? {};
|
|
1976
|
+
const text = input.text ?? await context.decodeUtf8([input.bytes]);
|
|
1977
|
+
const pending = await (0, commonmark_blocks_exports.parseCommonMarkBlocks)(text, context, input.base, extensions);
|
|
1978
|
+
async function assemble(blocks3, depth, tight = false) {
|
|
1979
|
+
context.bound("depth", depth);
|
|
1980
|
+
const result = [];
|
|
1981
|
+
for (const block2 of blocks3) {
|
|
1982
|
+
await context.cooperate();
|
|
1983
|
+
switch (block2.kind) {
|
|
1984
|
+
case "table": {
|
|
1985
|
+
const row2 = async (cells) => {
|
|
1986
|
+
const values = [];
|
|
1987
|
+
for (let i = 0; i < block2.alignments.length; i++) {
|
|
1988
|
+
const text2 = cells[i] ?? "";
|
|
1989
|
+
const inlines2 = text2 ? await (0, commonmark_inlines_exports.parseCommonMarkInlines)({ kind: "pendingInline", lines: [{ text: text2, start: block2.source.start }] }, pending.definitions, context, extensions) : [];
|
|
1990
|
+
values.push([["", [], []], "AlignDefault", 1, 1, inlines2.length ? [{ t: "Plain", c: inlines2 }] : []]);
|
|
1991
|
+
}
|
|
1992
|
+
return [["", [], []], values];
|
|
1993
|
+
};
|
|
1994
|
+
const rows = [];
|
|
1995
|
+
for (const cells of block2.rows) rows.push(await row2(cells));
|
|
1996
|
+
result.push({ t: "Table", c: [["", [], []], [null, []], block2.alignments.map((alignment2) => [alignment2, { t: "ColWidthDefault" }]), [["", [], []], [await row2(block2.header)]], [[["", [], []], 0, [], rows]], [["", [], []], []]] });
|
|
1997
|
+
break;
|
|
1998
|
+
}
|
|
1999
|
+
case "paragraph":
|
|
2000
|
+
result.push({ t: tight ? "Plain" : "Para", c: await (0, commonmark_inlines_exports.parseCommonMarkInlines)(block2.inline, pending.definitions, context, extensions) });
|
|
2001
|
+
break;
|
|
2002
|
+
case "heading":
|
|
2003
|
+
result.push({ t: "Header", c: [block2.level, ["", [], []], await (0, commonmark_inlines_exports.parseCommonMarkInlines)(block2.inline, pending.definitions, context, extensions)] });
|
|
2004
|
+
break;
|
|
2005
|
+
case "thematicBreak":
|
|
2006
|
+
result.push({ t: "HorizontalRule" });
|
|
2007
|
+
break;
|
|
2008
|
+
case "html":
|
|
2009
|
+
result.push({ t: "RawBlock", c: ["html", Object.hasOwn(extensions, "raw_html") ? (0, gfm_syntax_exports.filterGfmHtml)(block2.literal, context) : block2.literal] });
|
|
2010
|
+
break;
|
|
2011
|
+
case "code": {
|
|
2012
|
+
const info = (0, commonmark_syntax_exports.decodeSyntax)(block2.info, context).trim().split(" ")[0];
|
|
2013
|
+
result.push({ t: "CodeBlock", c: [["", info ? [info] : [], []], block2.literal] });
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
2016
|
+
case "quote":
|
|
2017
|
+
result.push({ t: "BlockQuote", c: await assemble(block2.blocks, depth + 1) });
|
|
2018
|
+
break;
|
|
2019
|
+
case "list": {
|
|
2020
|
+
const items = [];
|
|
2021
|
+
for (const item of block2.items) {
|
|
2022
|
+
const first = item.blocks[0];
|
|
2023
|
+
const text2 = first?.kind === "paragraph" ? first.inline.lines[0]?.text : void 0;
|
|
2024
|
+
const task = extensions.task_lists && text2?.startsWith("[") && text2[2] === "]" && [" ", " ", "x", "X"].includes(text2[1] ?? "") && (text2.length === 3 || text2[3] === " " || text2[3] === " ");
|
|
2025
|
+
const blocks4 = task && first?.kind === "paragraph" ? [{ ...first, inline: { ...first.inline, lines: first.inline.lines.map((line, i) => i ? line : { ...line, text: line.text.slice(4).trimStart() }) } }, ...item.blocks.slice(1)] : item.blocks;
|
|
2026
|
+
const assembled = await assemble(blocks4, depth + 1, block2.tight);
|
|
2027
|
+
const leading = assembled[0];
|
|
2028
|
+
if (task && (leading?.t === "Plain" || leading?.t === "Para")) {
|
|
2029
|
+
const marker = { t: "Span", c: [["", ["task-list-marker"], [["checked", String(text2[1] === "x" || text2[1] === "X")]]], []] };
|
|
2030
|
+
assembled[0] = { t: leading.t, c: [marker, ...leading.c] };
|
|
2031
|
+
}
|
|
2032
|
+
items.push(assembled);
|
|
2033
|
+
}
|
|
2034
|
+
result.push(block2.start === null ? { t: "BulletList", c: items } : { t: "OrderedList", c: [[block2.start, "Decimal", block2.marker === ")" ? "OneParen" : "Period"], items] });
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
return result;
|
|
2040
|
+
}
|
|
2041
|
+
return { blocks: await assemble(pending.blocks, 1), metadata: {}, resources: [] };
|
|
2042
|
+
};
|
|
2043
|
+
var commonmarkReader = { format: "commonmark", read: readCommonMark };
|
|
2044
|
+
function taskListState(node) {
|
|
2045
|
+
if (node.t !== "Span") return void 0;
|
|
2046
|
+
const [attr5, children2] = node.c;
|
|
2047
|
+
if (children2.length || attr5[0] || attr5[1].length !== 1 || attr5[1][0] !== "task-list-marker" || attr5[2].length !== 1 || attr5[2][0]?.[0] !== "checked") return void 0;
|
|
2048
|
+
const value = attr5[2][0][1];
|
|
2049
|
+
return value === "true" ? true : value === "false" ? false : void 0;
|
|
2050
|
+
}
|
|
1961
2051
|
function* placeRows(rows, columns, path, rowHeads = 0) {
|
|
1962
2052
|
const occupied = /* @__PURE__ */ new Map();
|
|
1963
2053
|
for (const [i, r] of rows.entries()) {
|
|
@@ -2014,590 +2104,164 @@ function* tableGeometry(v, p) {
|
|
|
2014
2104
|
yield;
|
|
2015
2105
|
}
|
|
2016
2106
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2107
|
+
var delimiters = { AlignLeft: ":---", AlignRight: "---:", AlignCenter: ":---:", AlignDefault: "---" };
|
|
2108
|
+
var Projection = class _Projection {
|
|
2109
|
+
constructor(context, format2, cellWriter) {
|
|
2110
|
+
this.context = context;
|
|
2111
|
+
this.format = format2;
|
|
2112
|
+
this.cellWriter = cellWriter;
|
|
2113
|
+
}
|
|
2114
|
+
context;
|
|
2115
|
+
format;
|
|
2116
|
+
cellWriter;
|
|
2117
|
+
chunks = [];
|
|
2118
|
+
length = 0;
|
|
2119
|
+
add(text) {
|
|
2120
|
+
this.context.checkpoint(text.length + 1);
|
|
2121
|
+
this.context.bound("outputBytes", this.length + text.length);
|
|
2122
|
+
this.context.charge("retainedBytes", text.length * 2);
|
|
2123
|
+
this.context.charge("references", 1);
|
|
2124
|
+
this.chunks.push(text);
|
|
2125
|
+
this.length += text.length;
|
|
2126
|
+
}
|
|
2127
|
+
finish() {
|
|
2128
|
+
this.context.charge("retainedBytes", this.length * 2);
|
|
2129
|
+
return { kind: "text", text: this.chunks.join("") };
|
|
2130
|
+
}
|
|
2131
|
+
loss(path, message) {
|
|
2132
|
+
if (!this.context.lossy) throw new PandocError("E_CAPABILITY", this.context.operation ?? "write", message, this.format, path);
|
|
2133
|
+
this.context.report({ code: "W_TABLE_LOSS", operation: this.context.operation ?? "write", format: this.format, location: path, message });
|
|
2134
|
+
}
|
|
2135
|
+
escaped(text, html) {
|
|
2136
|
+
for (const ch of text) {
|
|
2137
|
+
this.add(html ? { "&": "&", "<": "<", ">": ">", '"': """ }[ch] ?? ch : "\\`*_{}[]<>|!#".includes(ch) ? `\\${ch}` : ch === "\n" || ch === "\r" || ch === " " ? " " : ch);
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
attrs(attr5) {
|
|
2141
|
+
const pairs2 = [...attr5[0] ? [["id", attr5[0]]] : [], ...attr5[1].length ? [["class", attr5[1].join(" ")]] : [], ...attr5[2]];
|
|
2142
|
+
for (const [key, value] of pairs2) {
|
|
2143
|
+
if (!key || key.toLowerCase().startsWith("on") || [...key].some((ch) => !(ch >= "a" && ch <= "z") && !(ch >= "A" && ch <= "Z") && !(ch >= "0" && ch <= "9") && ch !== "-" && ch !== "_"))
|
|
2144
|
+
throw new PandocError("E_CAPABILITY", this.context.operation ?? "write", "Unsupported HTML attribute", this.format);
|
|
2145
|
+
this.add(` ${key}="`);
|
|
2146
|
+
this.escaped(value, true);
|
|
2147
|
+
this.add('"');
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
attributeLoss(attr5, path) {
|
|
2151
|
+
if (attr5[0] || attr5[1].length || attr5[2].length) this.loss(path, "Flattened table attributes");
|
|
2152
|
+
}
|
|
2153
|
+
textProjection(render, html) {
|
|
2154
|
+
const text = new _Projection(this.context, this.format, this.cellWriter);
|
|
2155
|
+
render(text);
|
|
2156
|
+
const value = text.finish();
|
|
2157
|
+
if (value.kind === "text") this.escaped(value.text, html);
|
|
2158
|
+
}
|
|
2040
2159
|
};
|
|
2041
|
-
function
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2160
|
+
function textInline(node, out) {
|
|
2161
|
+
switch (node.t) {
|
|
2162
|
+
case "Str":
|
|
2163
|
+
out.add(node.c);
|
|
2164
|
+
return;
|
|
2165
|
+
case "Space":
|
|
2166
|
+
case "SoftBreak":
|
|
2167
|
+
case "LineBreak":
|
|
2168
|
+
out.add(" ");
|
|
2169
|
+
return;
|
|
2170
|
+
case "Code":
|
|
2171
|
+
case "Math":
|
|
2172
|
+
case "RawInline":
|
|
2173
|
+
out.add(node.c[1]);
|
|
2174
|
+
return;
|
|
2175
|
+
case "Link":
|
|
2176
|
+
case "Image":
|
|
2177
|
+
case "Span":
|
|
2178
|
+
textInlines(node.c[1], out);
|
|
2179
|
+
return;
|
|
2180
|
+
case "Quoted":
|
|
2181
|
+
textInlines(node.c[1], out);
|
|
2182
|
+
return;
|
|
2183
|
+
case "Cite":
|
|
2184
|
+
textInlines(node.c[1], out);
|
|
2185
|
+
return;
|
|
2186
|
+
case "Note":
|
|
2187
|
+
textBlocks(node.c, out);
|
|
2188
|
+
return;
|
|
2189
|
+
default:
|
|
2190
|
+
textInlines(node.c, out);
|
|
2191
|
+
}
|
|
2045
2192
|
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
function tagged(shapes) {
|
|
2049
|
-
return (v, p) => {
|
|
2050
|
-
const r = record(v, p);
|
|
2051
|
-
if (typeof r.t !== "string" || !Object.hasOwn(shapes, r.t)) fail(`${p}.t`, "Unknown tag");
|
|
2052
|
-
const check = shapes[r.t];
|
|
2053
|
-
if (Object.keys(r).some((k) => k !== "t" && k !== "c") || (check === null ? Object.hasOwn(r, "c") : !Object.hasOwn(r, "c")))
|
|
2054
|
-
fail(p);
|
|
2055
|
-
if (check) check(r.c, `${p}.c`);
|
|
2056
|
-
};
|
|
2193
|
+
function textInlines(nodes, out) {
|
|
2194
|
+
for (const node of nodes) textInline(node, out);
|
|
2057
2195
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
citationHash: integer
|
|
2078
|
-
};
|
|
2079
|
-
if (Object.keys(r).length !== 6) fail(p);
|
|
2080
|
-
for (const [k, check] of Object.entries(checks)) check(r[k], `${p}.${k}`);
|
|
2081
|
-
};
|
|
2082
|
-
var inline = tagged({
|
|
2083
|
-
Str: str,
|
|
2084
|
-
Space: null,
|
|
2085
|
-
SoftBreak: null,
|
|
2086
|
-
LineBreak: null,
|
|
2087
|
-
Emph: inlines,
|
|
2088
|
-
Underline: inlines,
|
|
2089
|
-
Strong: inlines,
|
|
2090
|
-
Strikeout: inlines,
|
|
2091
|
-
Superscript: inlines,
|
|
2092
|
-
Subscript: inlines,
|
|
2093
|
-
SmallCaps: inlines,
|
|
2094
|
-
Quoted: tuple(choice("SingleQuote", "DoubleQuote"), inlines),
|
|
2095
|
-
Cite: tuple(array(citation), inlines),
|
|
2096
|
-
Code: tuple(attr, str),
|
|
2097
|
-
Math: tuple(choice("InlineMath", "DisplayMath"), str),
|
|
2098
|
-
RawInline: tuple(str, str),
|
|
2099
|
-
Link: tuple(attr, inlines, tuple(str, str)),
|
|
2100
|
-
Image: tuple(attr, inlines, tuple(str, str)),
|
|
2101
|
-
Note: blocks,
|
|
2102
|
-
Span: tuple(attr, inlines)
|
|
2103
|
-
});
|
|
2104
|
-
var tableShape = tuple(
|
|
2105
|
-
attr,
|
|
2106
|
-
caption,
|
|
2107
|
-
array(tuple(align, tagged({ ColWidthDefault: null, ColWidth: finite }))),
|
|
2108
|
-
head,
|
|
2109
|
-
array(tuple(attr, integer, array(row), array(row))),
|
|
2110
|
-
head
|
|
2111
|
-
);
|
|
2112
|
-
var block = tagged({
|
|
2113
|
-
Plain: inlines,
|
|
2114
|
-
Para: inlines,
|
|
2115
|
-
LineBlock: array(inlines),
|
|
2116
|
-
CodeBlock: tuple(attr, str),
|
|
2117
|
-
RawBlock: tuple(str, str),
|
|
2118
|
-
BlockQuote: blocks,
|
|
2119
|
-
OrderedList: tuple(
|
|
2120
|
-
tuple(
|
|
2121
|
-
integer,
|
|
2122
|
-
choice(
|
|
2123
|
-
"DefaultStyle",
|
|
2124
|
-
"Example",
|
|
2125
|
-
"Decimal",
|
|
2126
|
-
"LowerRoman",
|
|
2127
|
-
"UpperRoman",
|
|
2128
|
-
"LowerAlpha",
|
|
2129
|
-
"UpperAlpha"
|
|
2130
|
-
),
|
|
2131
|
-
choice("DefaultDelim", "Period", "OneParen", "TwoParens")
|
|
2132
|
-
),
|
|
2133
|
-
array(blocks)
|
|
2134
|
-
),
|
|
2135
|
-
BulletList: array(blocks),
|
|
2136
|
-
DefinitionList: array(tuple(inlines, array(blocks))),
|
|
2137
|
-
Header: tuple(positive, attr, inlines),
|
|
2138
|
-
HorizontalRule: null,
|
|
2139
|
-
Div: tuple(attr, blocks),
|
|
2140
|
-
Figure: tuple(attr, caption, blocks),
|
|
2141
|
-
Table: tableShape
|
|
2142
|
-
});
|
|
2143
|
-
var metadata = (v, p) => {
|
|
2144
|
-
for (const [k, x] of Object.entries(record(v, p))) meta(x, `${p}.${k}`);
|
|
2145
|
-
};
|
|
2146
|
-
var meta = tagged({
|
|
2147
|
-
MetaMap: metadata,
|
|
2148
|
-
MetaList: (v, p) => array(meta)(v, p),
|
|
2149
|
-
MetaBool: (v, p) => {
|
|
2150
|
-
if (typeof v !== "boolean") fail(p);
|
|
2151
|
-
},
|
|
2152
|
-
MetaString: str,
|
|
2153
|
-
MetaInlines: inlines,
|
|
2154
|
-
MetaBlocks: blocks
|
|
2155
|
-
});
|
|
2156
|
-
function validateDocument(value) {
|
|
2157
|
-
const r = record(value, "$");
|
|
2158
|
-
if (Object.keys(r).some(
|
|
2159
|
-
(k) => !["blocks", "metadata", "resources", "language", "direction"].includes(k)
|
|
2160
|
-
))
|
|
2161
|
-
fail("$");
|
|
2162
|
-
blocks(r.blocks, "$.blocks");
|
|
2163
|
-
metadata(r.metadata, "$.metadata");
|
|
2164
|
-
if (Object.hasOwn(r, "language")) str(r.language, "$.language");
|
|
2165
|
-
if (Object.hasOwn(r, "direction")) choice("ltr", "rtl", "auto")(r.direction, "$.direction");
|
|
2166
|
-
array((v, p) => {
|
|
2167
|
-
const resource = record(v, p);
|
|
2168
|
-
if (Object.keys(resource).length !== 2 || !(resource.bytes instanceof Uint8Array)) fail(p);
|
|
2169
|
-
str(resource.id, `${p}.id`);
|
|
2170
|
-
})(r.resources, "$.resources");
|
|
2171
|
-
}
|
|
2172
|
-
function* normalization(value, options, reserve, cooperate) {
|
|
2173
|
-
const ceilings = {
|
|
2174
|
-
depth: Infinity,
|
|
2175
|
-
nodes: Infinity,
|
|
2176
|
-
text: Infinity,
|
|
2177
|
-
attributes: Infinity,
|
|
2178
|
-
tableCells: Infinity,
|
|
2179
|
-
references: Infinity,
|
|
2180
|
-
resourceBytes: Infinity
|
|
2181
|
-
};
|
|
2182
|
-
const limits = { ...ceilings, ...options };
|
|
2183
|
-
for (const [k, n] of Object.entries(limits))
|
|
2184
|
-
if (!Object.hasOwn(ceilings, k) || n !== Infinity && !Number.isSafeInteger(n) || n < 0)
|
|
2185
|
-
fail(`$.limits.${k}`);
|
|
2186
|
-
let nodes = 0, text = 0, attributes = 0, cells = 0, references = 0, resourceBytes = 0, hasTable = false;
|
|
2187
|
-
const active = /* @__PURE__ */ new Set();
|
|
2188
|
-
const bound = (n, ceiling, p) => {
|
|
2189
|
-
if (!Number.isSafeInteger(n) || n > ceiling) throw new AstError("E_LIMIT", p, "AST budget exceeded");
|
|
2190
|
-
};
|
|
2191
|
-
function checkStringBody(v, p, depth) {
|
|
2192
|
-
bound(depth, limits.depth, p);
|
|
2193
|
-
bound(++nodes, limits.nodes, p);
|
|
2194
|
-
reserve("nodes", 1);
|
|
2195
|
-
bound(text += v.length, limits.text, p);
|
|
2196
|
-
reserve("text", v.length);
|
|
2197
|
-
}
|
|
2198
|
-
const stack = [{ kind: "node", v: value, p: "$", depth: 0 }];
|
|
2199
|
-
while (stack.length > 0) {
|
|
2200
|
-
const frame = stack[stack.length - 1];
|
|
2201
|
-
if (frame.kind === "arr") {
|
|
2202
|
-
if (frame.idx < frame.elemValues.length) {
|
|
2203
|
-
const i = frame.idx++;
|
|
2204
|
-
stack.push({ kind: "node", v: frame.elemValues[i], p: `${frame.p}[${i}]`, depth: frame.depth + 1 });
|
|
2205
|
-
} else {
|
|
2206
|
-
stack.pop();
|
|
2207
|
-
if (Object.keys(frame.v).length !== frame.v.length) fail(frame.p);
|
|
2208
|
-
active.delete(frame.v);
|
|
2209
|
-
}
|
|
2210
|
-
continue;
|
|
2211
|
-
}
|
|
2212
|
-
if (frame.kind === "obj") {
|
|
2213
|
-
if (frame.idx < frame.keys.length) {
|
|
2214
|
-
const k = frame.keys[frame.idx++];
|
|
2215
|
-
checkStringBody(k, frame.p, frame.depth + 1);
|
|
2216
|
-
if (cooperate) {
|
|
2217
|
-
const c = cooperate(1);
|
|
2218
|
-
if (c) yield c;
|
|
2219
|
-
}
|
|
2220
|
-
for (let i = 0; i < k.length; i++) {
|
|
2221
|
-
if (i % 256 === 0 && cooperate) {
|
|
2222
|
-
const c = cooperate(1);
|
|
2223
|
-
if (c) yield c;
|
|
2224
|
-
}
|
|
2225
|
-
const ch = k.charCodeAt(i);
|
|
2226
|
-
if (ch >= 55296 && ch <= 56319) {
|
|
2227
|
-
const next = k.charCodeAt(++i);
|
|
2228
|
-
if (!(next >= 56320 && next <= 57343)) fail(frame.p, "Invalid Unicode");
|
|
2229
|
-
} else if (ch >= 56320 && ch <= 57343) fail(frame.p, "Invalid Unicode");
|
|
2196
|
+
function textBlocks(nodes, out) {
|
|
2197
|
+
for (const [i, node] of nodes.entries()) {
|
|
2198
|
+
if (i) out.add(" ");
|
|
2199
|
+
switch (node.t) {
|
|
2200
|
+
case "Plain":
|
|
2201
|
+
case "Para":
|
|
2202
|
+
textInlines(node.c, out);
|
|
2203
|
+
break;
|
|
2204
|
+
case "Header":
|
|
2205
|
+
textInlines(node.c[2], out);
|
|
2206
|
+
break;
|
|
2207
|
+
case "CodeBlock":
|
|
2208
|
+
case "RawBlock":
|
|
2209
|
+
out.add(node.c[1]);
|
|
2210
|
+
break;
|
|
2211
|
+
case "LineBlock":
|
|
2212
|
+
for (const [j, line] of node.c.entries()) {
|
|
2213
|
+
if (j) out.add(" ");
|
|
2214
|
+
textInlines(line, out);
|
|
2230
2215
|
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
checkStringBody(v, p, depth);
|
|
2248
|
-
if (cooperate) {
|
|
2249
|
-
const c = cooperate(1);
|
|
2250
|
-
if (c) yield c;
|
|
2251
|
-
}
|
|
2252
|
-
for (let i = 0; i < v.length; i++) {
|
|
2253
|
-
if (i % 256 === 0 && cooperate) {
|
|
2254
|
-
const c = cooperate(1);
|
|
2255
|
-
if (c) yield c;
|
|
2216
|
+
break;
|
|
2217
|
+
case "BlockQuote":
|
|
2218
|
+
textBlocks(node.c, out);
|
|
2219
|
+
break;
|
|
2220
|
+
case "Div":
|
|
2221
|
+
textBlocks(node.c[1], out);
|
|
2222
|
+
break;
|
|
2223
|
+
case "Figure":
|
|
2224
|
+
textBlocks(node.c[1][1], out);
|
|
2225
|
+
out.add(" ");
|
|
2226
|
+
textBlocks(node.c[2], out);
|
|
2227
|
+
break;
|
|
2228
|
+
case "OrderedList":
|
|
2229
|
+
for (const [j, item] of node.c[1].entries()) {
|
|
2230
|
+
if (j) out.add(" ");
|
|
2231
|
+
textBlocks(item, out);
|
|
2256
2232
|
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
if (
|
|
2261
|
-
|
|
2262
|
-
}
|
|
2263
|
-
continue;
|
|
2264
|
-
}
|
|
2265
|
-
bound(depth, limits.depth, p);
|
|
2266
|
-
bound(++nodes, limits.nodes, p);
|
|
2267
|
-
reserve("nodes", 1);
|
|
2268
|
-
if (cooperate) {
|
|
2269
|
-
const c = cooperate(1);
|
|
2270
|
-
if (c) yield c;
|
|
2271
|
-
}
|
|
2272
|
-
if (v === null || typeof v === "boolean") continue;
|
|
2273
|
-
if (typeof v === "number") {
|
|
2274
|
-
if (!Number.isFinite(v)) fail(p);
|
|
2275
|
-
continue;
|
|
2276
|
-
}
|
|
2277
|
-
if (typeof v !== "object" || active.has(v)) fail(p, "Non-JSON or cyclic input");
|
|
2278
|
-
if (v instanceof Uint8Array && p.startsWith("$.resources[") && p.endsWith(".bytes")) {
|
|
2279
|
-
bound(resourceBytes += v.byteLength, limits.resourceBytes, p);
|
|
2280
|
-
reserve("resourceBytes", v.byteLength);
|
|
2281
|
-
continue;
|
|
2282
|
-
}
|
|
2283
|
-
active.add(v);
|
|
2284
|
-
if (Array.isArray(v)) {
|
|
2285
|
-
bound(nodes + v.length, limits.nodes, p);
|
|
2286
|
-
if (Object.getOwnPropertySymbols(v).length) fail(p);
|
|
2287
|
-
const elemValues = new Array(v.length);
|
|
2288
|
-
for (let i = 0; i < v.length; i++) {
|
|
2289
|
-
const d = Object.getOwnPropertyDescriptor(v, i);
|
|
2290
|
-
if (!d || !("value" in d)) fail(`${p}[${i}]`, "Accessor or sparse array");
|
|
2291
|
-
elemValues[i] = d.value;
|
|
2292
|
-
if (cooperate) {
|
|
2293
|
-
const c = cooperate(1);
|
|
2294
|
-
if (c) yield c;
|
|
2233
|
+
break;
|
|
2234
|
+
case "BulletList":
|
|
2235
|
+
for (const [j, item] of node.c.entries()) {
|
|
2236
|
+
if (j) out.add(" ");
|
|
2237
|
+
textBlocks(item, out);
|
|
2295
2238
|
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
fail(p, "Invalid spans");
|
|
2305
|
-
bound(cells += elemValues[2] * elemValues[3], limits.tableCells, p);
|
|
2306
|
-
reserve("tableCells", elemValues[2] * elemValues[3]);
|
|
2307
|
-
bound(references += elemValues[2] * elemValues[3], limits.references, p);
|
|
2308
|
-
reserve("references", elemValues[2] * elemValues[3]);
|
|
2309
|
-
}
|
|
2310
|
-
stack.push({ kind: "arr", v, elemValues, idx: 0, p, depth });
|
|
2311
|
-
} else {
|
|
2312
|
-
const keys = Object.getOwnPropertyNames(v);
|
|
2313
|
-
stack.push({ kind: "obj", v, keys, idx: 0, p, depth });
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
validateDocument(value);
|
|
2317
|
-
function* geometry(v, p) {
|
|
2318
|
-
if (v === null || typeof v !== "object" || v instanceof Uint8Array) return;
|
|
2319
|
-
if (cooperate) {
|
|
2320
|
-
const c = cooperate(1);
|
|
2321
|
-
if (c) yield c;
|
|
2322
|
-
}
|
|
2323
|
-
if ("t" in v && v.t === "Table") {
|
|
2324
|
-
const content = v.c;
|
|
2325
|
-
for (const _ of tableGeometry(content, `${p}.c`)) {
|
|
2326
|
-
if (cooperate) {
|
|
2327
|
-
const c = cooperate(1);
|
|
2328
|
-
if (c) yield c;
|
|
2239
|
+
break;
|
|
2240
|
+
case "DefinitionList":
|
|
2241
|
+
for (const [term, definitions] of node.c) {
|
|
2242
|
+
textInlines(term, out);
|
|
2243
|
+
for (const d of definitions) {
|
|
2244
|
+
out.add(" ");
|
|
2245
|
+
textBlocks(d, out);
|
|
2246
|
+
}
|
|
2329
2247
|
}
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2248
|
+
break;
|
|
2249
|
+
case "Table":
|
|
2250
|
+
for (const rows of [node.c[3][1], ...node.c[4].flatMap((b) => [b[2], b[3]]), node.c[5][1]])
|
|
2251
|
+
for (const row2 of rows) for (const cell2 of row2[1]) {
|
|
2252
|
+
textBlocks(cell2[4], out);
|
|
2253
|
+
out.add(" ");
|
|
2254
|
+
}
|
|
2255
|
+
break;
|
|
2256
|
+
case "HorizontalRule":
|
|
2257
|
+
break;
|
|
2336
2258
|
}
|
|
2337
2259
|
}
|
|
2338
|
-
if (hasTable) yield* geometry(value, "$");
|
|
2339
|
-
return structuredClone(value);
|
|
2340
|
-
}
|
|
2341
|
-
function normalizeDocument(value, options = {}) {
|
|
2342
|
-
const steps = normalization(value, options, () => {
|
|
2343
|
-
});
|
|
2344
|
-
let step = steps.next();
|
|
2345
|
-
while (!step.done) step = steps.next();
|
|
2346
|
-
return step.value;
|
|
2347
2260
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
while (!step.done) {
|
|
2353
|
-
if (step.value) await step.value;
|
|
2354
|
-
step = steps.next();
|
|
2355
|
-
}
|
|
2356
|
-
return step.value;
|
|
2357
|
-
}
|
|
2358
|
-
var gfm_syntax_exports = {};
|
|
2359
|
-
__reExport(gfm_syntax_exports, gfm_syntax_star);
|
|
2360
|
-
var commonmark_blocks_exports = {};
|
|
2361
|
-
__reExport(commonmark_blocks_exports, commonmark_blocks_star);
|
|
2362
|
-
var commonmark_inlines_exports = {};
|
|
2363
|
-
__reExport(commonmark_inlines_exports, commonmark_inlines_star);
|
|
2364
|
-
var commonmark_syntax_exports = {};
|
|
2365
|
-
__reExport(commonmark_syntax_exports, commonmark_syntax_star);
|
|
2366
|
-
var readCommonMark = async (input, context, selection) => {
|
|
2367
|
-
const extensions = selection?.extensions ?? {};
|
|
2368
|
-
const text = input.text ?? await context.decodeUtf8([input.bytes]);
|
|
2369
|
-
const pending = await (0, commonmark_blocks_exports.parseCommonMarkBlocks)(text, context, input.base, extensions);
|
|
2370
|
-
async function assemble(blocks3, depth, tight = false) {
|
|
2371
|
-
context.bound("depth", depth);
|
|
2372
|
-
const result = [];
|
|
2373
|
-
for (const block2 of blocks3) {
|
|
2374
|
-
await context.cooperate();
|
|
2375
|
-
switch (block2.kind) {
|
|
2376
|
-
case "table": {
|
|
2377
|
-
const row2 = async (cells) => {
|
|
2378
|
-
const values = [];
|
|
2379
|
-
for (let i = 0; i < block2.alignments.length; i++) {
|
|
2380
|
-
const text2 = cells[i] ?? "";
|
|
2381
|
-
const inlines2 = text2 ? await (0, commonmark_inlines_exports.parseCommonMarkInlines)({ kind: "pendingInline", lines: [{ text: text2, start: block2.source.start }] }, pending.definitions, context, extensions) : [];
|
|
2382
|
-
values.push([["", [], []], "AlignDefault", 1, 1, inlines2.length ? [{ t: "Plain", c: inlines2 }] : []]);
|
|
2383
|
-
}
|
|
2384
|
-
return [["", [], []], values];
|
|
2385
|
-
};
|
|
2386
|
-
const rows = [];
|
|
2387
|
-
for (const cells of block2.rows) rows.push(await row2(cells));
|
|
2388
|
-
result.push({ t: "Table", c: [["", [], []], [null, []], block2.alignments.map((alignment2) => [alignment2, { t: "ColWidthDefault" }]), [["", [], []], [await row2(block2.header)]], [[["", [], []], 0, [], rows]], [["", [], []], []]] });
|
|
2389
|
-
break;
|
|
2390
|
-
}
|
|
2391
|
-
case "paragraph":
|
|
2392
|
-
result.push({ t: tight ? "Plain" : "Para", c: await (0, commonmark_inlines_exports.parseCommonMarkInlines)(block2.inline, pending.definitions, context, extensions) });
|
|
2393
|
-
break;
|
|
2394
|
-
case "heading":
|
|
2395
|
-
result.push({ t: "Header", c: [block2.level, ["", [], []], await (0, commonmark_inlines_exports.parseCommonMarkInlines)(block2.inline, pending.definitions, context, extensions)] });
|
|
2396
|
-
break;
|
|
2397
|
-
case "thematicBreak":
|
|
2398
|
-
result.push({ t: "HorizontalRule" });
|
|
2399
|
-
break;
|
|
2400
|
-
case "html":
|
|
2401
|
-
result.push({ t: "RawBlock", c: ["html", Object.hasOwn(extensions, "raw_html") ? (0, gfm_syntax_exports.filterGfmHtml)(block2.literal, context) : block2.literal] });
|
|
2402
|
-
break;
|
|
2403
|
-
case "code": {
|
|
2404
|
-
const info = (0, commonmark_syntax_exports.decodeSyntax)(block2.info, context).trim().split(" ")[0];
|
|
2405
|
-
result.push({ t: "CodeBlock", c: [["", info ? [info] : [], []], block2.literal] });
|
|
2406
|
-
break;
|
|
2407
|
-
}
|
|
2408
|
-
case "quote":
|
|
2409
|
-
result.push({ t: "BlockQuote", c: await assemble(block2.blocks, depth + 1) });
|
|
2410
|
-
break;
|
|
2411
|
-
case "list": {
|
|
2412
|
-
const items = [];
|
|
2413
|
-
for (const item of block2.items) {
|
|
2414
|
-
const first = item.blocks[0];
|
|
2415
|
-
const text2 = first?.kind === "paragraph" ? first.inline.lines[0]?.text : void 0;
|
|
2416
|
-
const task = extensions.task_lists && text2?.startsWith("[") && text2[2] === "]" && [" ", " ", "x", "X"].includes(text2[1] ?? "") && (text2.length === 3 || text2[3] === " " || text2[3] === " ");
|
|
2417
|
-
const blocks4 = task && first?.kind === "paragraph" ? [{ ...first, inline: { ...first.inline, lines: first.inline.lines.map((line, i) => i ? line : { ...line, text: line.text.slice(4).trimStart() }) } }, ...item.blocks.slice(1)] : item.blocks;
|
|
2418
|
-
const assembled = await assemble(blocks4, depth + 1, block2.tight);
|
|
2419
|
-
const leading = assembled[0];
|
|
2420
|
-
if (task && (leading?.t === "Plain" || leading?.t === "Para")) {
|
|
2421
|
-
const marker = { t: "Span", c: [["", ["task-list-marker"], [["checked", String(text2[1] === "x" || text2[1] === "X")]]], []] };
|
|
2422
|
-
assembled[0] = { t: leading.t, c: [marker, ...leading.c] };
|
|
2423
|
-
}
|
|
2424
|
-
items.push(assembled);
|
|
2425
|
-
}
|
|
2426
|
-
result.push(block2.start === null ? { t: "BulletList", c: items } : { t: "OrderedList", c: [[block2.start, "Decimal", block2.marker === ")" ? "OneParen" : "Period"], items] });
|
|
2427
|
-
break;
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
return result;
|
|
2432
|
-
}
|
|
2433
|
-
return { blocks: await assemble(pending.blocks, 1), metadata: {}, resources: [] };
|
|
2434
|
-
};
|
|
2435
|
-
var commonmarkReader = { format: "commonmark", read: readCommonMark };
|
|
2436
|
-
function taskListState(node) {
|
|
2437
|
-
if (node.t !== "Span") return void 0;
|
|
2438
|
-
const [attr5, children2] = node.c;
|
|
2439
|
-
if (children2.length || attr5[0] || attr5[1].length !== 1 || attr5[1][0] !== "task-list-marker" || attr5[2].length !== 1 || attr5[2][0]?.[0] !== "checked") return void 0;
|
|
2440
|
-
const value = attr5[2][0][1];
|
|
2441
|
-
return value === "true" ? true : value === "false" ? false : void 0;
|
|
2442
|
-
}
|
|
2443
|
-
var delimiters = { AlignLeft: ":---", AlignRight: "---:", AlignCenter: ":---:", AlignDefault: "---" };
|
|
2444
|
-
var Projection = class _Projection {
|
|
2445
|
-
constructor(context, format2, cellWriter) {
|
|
2446
|
-
this.context = context;
|
|
2447
|
-
this.format = format2;
|
|
2448
|
-
this.cellWriter = cellWriter;
|
|
2449
|
-
}
|
|
2450
|
-
context;
|
|
2451
|
-
format;
|
|
2452
|
-
cellWriter;
|
|
2453
|
-
chunks = [];
|
|
2454
|
-
length = 0;
|
|
2455
|
-
add(text) {
|
|
2456
|
-
this.context.checkpoint(text.length + 1);
|
|
2457
|
-
this.context.bound("outputBytes", this.length + text.length);
|
|
2458
|
-
this.context.charge("retainedBytes", text.length * 2);
|
|
2459
|
-
this.context.charge("references", 1);
|
|
2460
|
-
this.chunks.push(text);
|
|
2461
|
-
this.length += text.length;
|
|
2462
|
-
}
|
|
2463
|
-
finish() {
|
|
2464
|
-
this.context.charge("retainedBytes", this.length * 2);
|
|
2465
|
-
return { kind: "text", text: this.chunks.join("") };
|
|
2466
|
-
}
|
|
2467
|
-
loss(path, message) {
|
|
2468
|
-
if (!this.context.lossy) throw new PandocError("E_CAPABILITY", this.context.operation ?? "write", message, this.format, path);
|
|
2469
|
-
this.context.report({ code: "W_TABLE_LOSS", operation: this.context.operation ?? "write", format: this.format, location: path, message });
|
|
2470
|
-
}
|
|
2471
|
-
escaped(text, html) {
|
|
2472
|
-
for (const ch of text) {
|
|
2473
|
-
this.add(html ? { "&": "&", "<": "<", ">": ">", '"': """ }[ch] ?? ch : "\\`*_{}[]<>|!#".includes(ch) ? `\\${ch}` : ch === "\n" || ch === "\r" || ch === " " ? " " : ch);
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
attrs(attr5) {
|
|
2477
|
-
const pairs2 = [...attr5[0] ? [["id", attr5[0]]] : [], ...attr5[1].length ? [["class", attr5[1].join(" ")]] : [], ...attr5[2]];
|
|
2478
|
-
for (const [key, value] of pairs2) {
|
|
2479
|
-
if (!key || key.toLowerCase().startsWith("on") || [...key].some((ch) => !(ch >= "a" && ch <= "z") && !(ch >= "A" && ch <= "Z") && !(ch >= "0" && ch <= "9") && ch !== "-" && ch !== "_"))
|
|
2480
|
-
throw new PandocError("E_CAPABILITY", this.context.operation ?? "write", "Unsupported HTML attribute", this.format);
|
|
2481
|
-
this.add(` ${key}="`);
|
|
2482
|
-
this.escaped(value, true);
|
|
2483
|
-
this.add('"');
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
attributeLoss(attr5, path) {
|
|
2487
|
-
if (attr5[0] || attr5[1].length || attr5[2].length) this.loss(path, "Flattened table attributes");
|
|
2488
|
-
}
|
|
2489
|
-
textProjection(render, html) {
|
|
2490
|
-
const text = new _Projection(this.context, this.format, this.cellWriter);
|
|
2491
|
-
render(text);
|
|
2492
|
-
const value = text.finish();
|
|
2493
|
-
if (value.kind === "text") this.escaped(value.text, html);
|
|
2494
|
-
}
|
|
2495
|
-
};
|
|
2496
|
-
function textInline(node, out) {
|
|
2497
|
-
switch (node.t) {
|
|
2498
|
-
case "Str":
|
|
2499
|
-
out.add(node.c);
|
|
2500
|
-
return;
|
|
2501
|
-
case "Space":
|
|
2502
|
-
case "SoftBreak":
|
|
2503
|
-
case "LineBreak":
|
|
2504
|
-
out.add(" ");
|
|
2505
|
-
return;
|
|
2506
|
-
case "Code":
|
|
2507
|
-
case "Math":
|
|
2508
|
-
case "RawInline":
|
|
2509
|
-
out.add(node.c[1]);
|
|
2510
|
-
return;
|
|
2511
|
-
case "Link":
|
|
2512
|
-
case "Image":
|
|
2513
|
-
case "Span":
|
|
2514
|
-
textInlines(node.c[1], out);
|
|
2515
|
-
return;
|
|
2516
|
-
case "Quoted":
|
|
2517
|
-
textInlines(node.c[1], out);
|
|
2518
|
-
return;
|
|
2519
|
-
case "Cite":
|
|
2520
|
-
textInlines(node.c[1], out);
|
|
2521
|
-
return;
|
|
2522
|
-
case "Note":
|
|
2523
|
-
textBlocks(node.c, out);
|
|
2524
|
-
return;
|
|
2525
|
-
default:
|
|
2526
|
-
textInlines(node.c, out);
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
function textInlines(nodes, out) {
|
|
2530
|
-
for (const node of nodes) textInline(node, out);
|
|
2531
|
-
}
|
|
2532
|
-
function textBlocks(nodes, out) {
|
|
2533
|
-
for (const [i, node] of nodes.entries()) {
|
|
2534
|
-
if (i) out.add(" ");
|
|
2535
|
-
switch (node.t) {
|
|
2536
|
-
case "Plain":
|
|
2537
|
-
case "Para":
|
|
2538
|
-
textInlines(node.c, out);
|
|
2539
|
-
break;
|
|
2540
|
-
case "Header":
|
|
2541
|
-
textInlines(node.c[2], out);
|
|
2542
|
-
break;
|
|
2543
|
-
case "CodeBlock":
|
|
2544
|
-
case "RawBlock":
|
|
2545
|
-
out.add(node.c[1]);
|
|
2546
|
-
break;
|
|
2547
|
-
case "LineBlock":
|
|
2548
|
-
for (const [j, line] of node.c.entries()) {
|
|
2549
|
-
if (j) out.add(" ");
|
|
2550
|
-
textInlines(line, out);
|
|
2551
|
-
}
|
|
2552
|
-
break;
|
|
2553
|
-
case "BlockQuote":
|
|
2554
|
-
textBlocks(node.c, out);
|
|
2555
|
-
break;
|
|
2556
|
-
case "Div":
|
|
2557
|
-
textBlocks(node.c[1], out);
|
|
2558
|
-
break;
|
|
2559
|
-
case "Figure":
|
|
2560
|
-
textBlocks(node.c[1][1], out);
|
|
2561
|
-
out.add(" ");
|
|
2562
|
-
textBlocks(node.c[2], out);
|
|
2563
|
-
break;
|
|
2564
|
-
case "OrderedList":
|
|
2565
|
-
for (const [j, item] of node.c[1].entries()) {
|
|
2566
|
-
if (j) out.add(" ");
|
|
2567
|
-
textBlocks(item, out);
|
|
2568
|
-
}
|
|
2569
|
-
break;
|
|
2570
|
-
case "BulletList":
|
|
2571
|
-
for (const [j, item] of node.c.entries()) {
|
|
2572
|
-
if (j) out.add(" ");
|
|
2573
|
-
textBlocks(item, out);
|
|
2574
|
-
}
|
|
2575
|
-
break;
|
|
2576
|
-
case "DefinitionList":
|
|
2577
|
-
for (const [term, definitions] of node.c) {
|
|
2578
|
-
textInlines(term, out);
|
|
2579
|
-
for (const d of definitions) {
|
|
2580
|
-
out.add(" ");
|
|
2581
|
-
textBlocks(d, out);
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
break;
|
|
2585
|
-
case "Table":
|
|
2586
|
-
for (const rows of [node.c[3][1], ...node.c[4].flatMap((b) => [b[2], b[3]]), node.c[5][1]])
|
|
2587
|
-
for (const row2 of rows) for (const cell2 of row2[1]) {
|
|
2588
|
-
textBlocks(cell2[4], out);
|
|
2589
|
-
out.add(" ");
|
|
2590
|
-
}
|
|
2591
|
-
break;
|
|
2592
|
-
case "HorizontalRule":
|
|
2593
|
-
break;
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
function inline2(nodes, out, path, html) {
|
|
2598
|
-
if (!html && out.cellWriter) {
|
|
2599
|
-
out.add(out.cellWriter(nodes, path));
|
|
2600
|
-
return;
|
|
2261
|
+
function inline(nodes, out, path, html) {
|
|
2262
|
+
if (!html && out.cellWriter) {
|
|
2263
|
+
out.add(out.cellWriter(nodes, path));
|
|
2264
|
+
return;
|
|
2601
2265
|
}
|
|
2602
2266
|
for (const [i, node] of nodes.entries()) {
|
|
2603
2267
|
const p = `${path}[${i}]`;
|
|
@@ -2624,7 +2288,7 @@ function inline2(nodes, out, path, html) {
|
|
|
2624
2288
|
}
|
|
2625
2289
|
const tag = { Emph: "em", Strong: "strong", Strikeout: "del" }[node.t];
|
|
2626
2290
|
out.add(`<${tag}>`);
|
|
2627
|
-
|
|
2291
|
+
inline(node.c, out, `${p}.c`, true);
|
|
2628
2292
|
out.add(`</${tag}>`);
|
|
2629
2293
|
break;
|
|
2630
2294
|
}
|
|
@@ -2650,11 +2314,11 @@ function inline2(nodes, out, path, html) {
|
|
|
2650
2314
|
out.add('"');
|
|
2651
2315
|
out.attrs(node.c[0]);
|
|
2652
2316
|
out.add(">");
|
|
2653
|
-
|
|
2317
|
+
inline(node.c[1], out, `${p}.c[1]`, true);
|
|
2654
2318
|
out.add("</a>");
|
|
2655
2319
|
} else {
|
|
2656
2320
|
out.loss(p, `Flattened cell ${node.t.toLowerCase()}`);
|
|
2657
|
-
|
|
2321
|
+
inline(node.c[1], out, `${p}.c[1]`, html);
|
|
2658
2322
|
}
|
|
2659
2323
|
break;
|
|
2660
2324
|
case "Span":
|
|
@@ -2662,11 +2326,11 @@ function inline2(nodes, out, path, html) {
|
|
|
2662
2326
|
out.add("<span");
|
|
2663
2327
|
out.attrs(node.c[0]);
|
|
2664
2328
|
out.add(">");
|
|
2665
|
-
|
|
2329
|
+
inline(node.c[1], out, `${p}.c[1]`, true);
|
|
2666
2330
|
out.add("</span>");
|
|
2667
2331
|
} else {
|
|
2668
2332
|
out.loss(p, "Flattened cell span formatting");
|
|
2669
|
-
|
|
2333
|
+
inline(node.c[1], out, `${p}.c[1]`, false);
|
|
2670
2334
|
}
|
|
2671
2335
|
break;
|
|
2672
2336
|
default:
|
|
@@ -2678,16 +2342,16 @@ function inline2(nodes, out, path, html) {
|
|
|
2678
2342
|
function simpleCell(blocks3) {
|
|
2679
2343
|
return blocks3.length === 0 || blocks3.length === 1 && (blocks3[0]?.t === "Plain" || blocks3[0]?.t === "Para");
|
|
2680
2344
|
}
|
|
2681
|
-
function
|
|
2345
|
+
function blocks(nodes, out, path, html, start = 0) {
|
|
2682
2346
|
for (const [i, node] of nodes.entries()) {
|
|
2683
2347
|
const p = `${path}[${i + start}]`;
|
|
2684
2348
|
switch (node.t) {
|
|
2685
2349
|
case "Plain":
|
|
2686
|
-
|
|
2350
|
+
inline(node.c, out, `${p}.c`, html);
|
|
2687
2351
|
break;
|
|
2688
2352
|
case "Para":
|
|
2689
2353
|
if (html) out.add("<p>");
|
|
2690
|
-
|
|
2354
|
+
inline(node.c, out, `${p}.c`, html);
|
|
2691
2355
|
if (html) out.add("</p>");
|
|
2692
2356
|
else out.add("\n\n");
|
|
2693
2357
|
break;
|
|
@@ -2714,7 +2378,7 @@ function blocks2(nodes, out, path, html, start = 0) {
|
|
|
2714
2378
|
out.add(`<${tag}`);
|
|
2715
2379
|
if (node.t === "Div") out.attrs(node.c[0]);
|
|
2716
2380
|
out.add(">");
|
|
2717
|
-
|
|
2381
|
+
blocks(node.t === "Div" ? node.c[1] : node.c, out, node.t === "Div" ? `${p}.c[1]` : `${p}.c`, true);
|
|
2718
2382
|
out.add(`</${tag}>`);
|
|
2719
2383
|
break;
|
|
2720
2384
|
}
|
|
@@ -2730,7 +2394,7 @@ function blocks2(nodes, out, path, html, start = 0) {
|
|
|
2730
2394
|
out.add(`<${tag}${node.t === "OrderedList" ? ` start="${node.c[0][0]}"` : ""}>`);
|
|
2731
2395
|
for (const [j, item] of (node.t === "BulletList" ? node.c : node.c[1]).entries()) {
|
|
2732
2396
|
out.add("<li>");
|
|
2733
|
-
|
|
2397
|
+
blocks(item, out, `${p}.c${node.t === "OrderedList" ? "[1]" : ""}[${j}]`, true);
|
|
2734
2398
|
out.add("</li>");
|
|
2735
2399
|
}
|
|
2736
2400
|
out.add(`</${tag}>`);
|
|
@@ -2741,11 +2405,11 @@ function blocks2(nodes, out, path, html, start = 0) {
|
|
|
2741
2405
|
out.add(`<h${Math.min(node.c[0], 6)}`);
|
|
2742
2406
|
out.attrs(node.c[1]);
|
|
2743
2407
|
out.add(">");
|
|
2744
|
-
|
|
2408
|
+
inline(node.c[2], out, `${p}.c[2]`, true);
|
|
2745
2409
|
out.add(`</h${Math.min(node.c[0], 6)}>`);
|
|
2746
2410
|
} else {
|
|
2747
2411
|
out.add("#".repeat(Math.min(node.c[0], 6)) + " ");
|
|
2748
|
-
|
|
2412
|
+
inline(node.c[2], out, `${p}.c[2]`, false);
|
|
2749
2413
|
out.add("\n\n");
|
|
2750
2414
|
}
|
|
2751
2415
|
break;
|
|
@@ -2787,7 +2451,7 @@ async function rectangularRows(rows, out, columns, path) {
|
|
|
2787
2451
|
out.textProjection((text) => textBlocks(cell2[4], text), false);
|
|
2788
2452
|
} else {
|
|
2789
2453
|
const block2 = cell2[4][0];
|
|
2790
|
-
if (block2?.t === "Plain" || block2?.t === "Para")
|
|
2454
|
+
if (block2?.t === "Plain" || block2?.t === "Para") inline(block2.c, out, `${placed.path}[4][0].c`, false);
|
|
2791
2455
|
}
|
|
2792
2456
|
separator();
|
|
2793
2457
|
}
|
|
@@ -2858,7 +2522,7 @@ async function writeGfm(document, context, selection, cellWriter) {
|
|
|
2858
2522
|
if (node.t === "Table") {
|
|
2859
2523
|
if (selection?.extensions.pipe_tables === false) throw new PandocError("E_CAPABILITY", context.operation ?? "write", "GFM pipe_tables is disabled", "gfm", `$.blocks[${i}]`);
|
|
2860
2524
|
await gfmTable(node, out, `$.blocks[${i}]`);
|
|
2861
|
-
} else
|
|
2525
|
+
} else blocks([node], out, "$.blocks", false, i);
|
|
2862
2526
|
}
|
|
2863
2527
|
return out.finish();
|
|
2864
2528
|
}
|
|
@@ -3029,6 +2693,28 @@ var Markdown = class {
|
|
|
3029
2693
|
}
|
|
3030
2694
|
return this.join(parts);
|
|
3031
2695
|
}
|
|
2696
|
+
paragraph(nodes, path, task) {
|
|
2697
|
+
if (this.context.wrap !== "auto" && !(this.context.wrap === void 0 && this.context.columns !== void 0)) return this.inline(nodes, path, "", task);
|
|
2698
|
+
const width = this.context.columns ?? 72;
|
|
2699
|
+
this.context.charge("references", nodes.length * 3 + 1);
|
|
2700
|
+
const parts = [];
|
|
2701
|
+
let start = 0, lineWidth = 0;
|
|
2702
|
+
let separator = "";
|
|
2703
|
+
for (let i = 0; i <= nodes.length; i++) {
|
|
2704
|
+
this.context.checkpoint();
|
|
2705
|
+
if (i < nodes.length && nodes[i].t !== "Space" && nodes[i].t !== "SoftBreak") continue;
|
|
2706
|
+
if (i > start) {
|
|
2707
|
+
const word = this.inline(nodes.slice(start, i), path, "", task && start === 0);
|
|
2708
|
+
const gap = separator && lineWidth > 0 && lineWidth + 1 + word.length > width ? "\n" : separator;
|
|
2709
|
+
parts.push(gap, word);
|
|
2710
|
+
const lastBreak = word.lastIndexOf("\n");
|
|
2711
|
+
lineWidth = lastBreak >= 0 ? word.length - lastBreak - 1 : (gap === "\n" ? 0 : lineWidth + gap.length) + word.length;
|
|
2712
|
+
separator = " ";
|
|
2713
|
+
}
|
|
2714
|
+
start = i + 1;
|
|
2715
|
+
}
|
|
2716
|
+
return this.join(parts);
|
|
2717
|
+
}
|
|
3032
2718
|
indent(text, first, rest) {
|
|
3033
2719
|
let lines = 1;
|
|
3034
2720
|
for (const ch of text) if (ch === "\n") lines++;
|
|
@@ -3045,7 +2731,7 @@ var Markdown = class {
|
|
|
3045
2731
|
switch (node.t) {
|
|
3046
2732
|
case "Plain":
|
|
3047
2733
|
case "Para":
|
|
3048
|
-
parts.push(this.
|
|
2734
|
+
parts.push(this.paragraph(node.c, `${p}.c`, task && i === 0));
|
|
3049
2735
|
break;
|
|
3050
2736
|
case "Header":
|
|
3051
2737
|
this.attrs(node.c[1], p);
|
|
@@ -3144,11 +2830,11 @@ var commonmark_default = {
|
|
|
3144
2830
|
write: true,
|
|
3145
2831
|
media: "text",
|
|
3146
2832
|
inputEncoding: "utf8",
|
|
3147
|
-
suffixes: ["
|
|
2833
|
+
suffixes: ["commonmark", "mkd", "mdown", "mdwn"],
|
|
3148
2834
|
extensions: {},
|
|
3149
2835
|
options: {
|
|
3150
2836
|
read: [],
|
|
3151
|
-
write: ["wrap"]
|
|
2837
|
+
write: ["wrap", "columns", "standalone", "metadata", "toc", "ascii", "eol", "rawContent"]
|
|
3152
2838
|
}
|
|
3153
2839
|
};
|
|
3154
2840
|
var gfm_default = {
|
|
@@ -3161,7 +2847,7 @@ var gfm_default = {
|
|
|
3161
2847
|
write: true,
|
|
3162
2848
|
media: "text",
|
|
3163
2849
|
inputEncoding: "utf8",
|
|
3164
|
-
suffixes: ["gfm", "markdown"],
|
|
2850
|
+
suffixes: ["gfm", "markdown", "md"],
|
|
3165
2851
|
extensions: {
|
|
3166
2852
|
pipe_tables: true,
|
|
3167
2853
|
raw_html: true,
|
|
@@ -3171,7 +2857,7 @@ var gfm_default = {
|
|
|
3171
2857
|
},
|
|
3172
2858
|
options: {
|
|
3173
2859
|
read: [],
|
|
3174
|
-
write: ["wrap"]
|
|
2860
|
+
write: ["wrap", "columns", "standalone", "metadata", "toc", "ascii", "eol", "rawContent"]
|
|
3175
2861
|
}
|
|
3176
2862
|
};
|
|
3177
2863
|
var html_default = {
|
|
@@ -3916,21 +3602,21 @@ async function parseStrictJson(text, context, error, number = () => {
|
|
|
3916
3602
|
return result;
|
|
3917
3603
|
}
|
|
3918
3604
|
var apiVersion = [1, 23, 1, 2];
|
|
3919
|
-
function
|
|
3605
|
+
function fail(operation, path, message) {
|
|
3920
3606
|
throw new PandocError("E_AST", operation, message, "json", path);
|
|
3921
3607
|
}
|
|
3922
|
-
function
|
|
3608
|
+
function record(value, operation, path) {
|
|
3923
3609
|
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
3924
|
-
|
|
3610
|
+
fail(operation, path, "Expected object");
|
|
3925
3611
|
return value;
|
|
3926
3612
|
}
|
|
3927
|
-
function
|
|
3613
|
+
function tuple(value, length, operation, path) {
|
|
3928
3614
|
if (!Array.isArray(value) || value.length !== length)
|
|
3929
|
-
|
|
3615
|
+
fail(operation, path, "Invalid tuple arity");
|
|
3930
3616
|
return value;
|
|
3931
3617
|
}
|
|
3932
3618
|
function list(value, operation, path) {
|
|
3933
|
-
if (!Array.isArray(value))
|
|
3619
|
+
if (!Array.isArray(value)) fail(operation, path, "Expected array");
|
|
3934
3620
|
return value;
|
|
3935
3621
|
}
|
|
3936
3622
|
function exactInteger(token, value) {
|
|
@@ -3948,10 +3634,10 @@ async function parse(text, context) {
|
|
|
3948
3634
|
return parseStrictJson(
|
|
3949
3635
|
text,
|
|
3950
3636
|
context,
|
|
3951
|
-
(offset, message) =>
|
|
3637
|
+
(offset, message) => fail("read", `$@${offset}`, message),
|
|
3952
3638
|
(token, value, offset) => {
|
|
3953
3639
|
if (!Number.isFinite(value) || Number.isInteger(value) && (!Number.isSafeInteger(value) || !exactInteger(token, value)))
|
|
3954
|
-
|
|
3640
|
+
fail("read", `$@${offset}`, "Number exceeds exact integer range or is rounded");
|
|
3955
3641
|
}
|
|
3956
3642
|
);
|
|
3957
3643
|
}
|
|
@@ -3964,69 +3650,69 @@ async function translate(value, operation, context, path) {
|
|
|
3964
3650
|
result2.push(await translate(child, operation, context, `${path}[${i}]`));
|
|
3965
3651
|
return result2;
|
|
3966
3652
|
}
|
|
3967
|
-
const source =
|
|
3653
|
+
const source = record(value, operation, path);
|
|
3968
3654
|
const result = /* @__PURE__ */ Object.create(null);
|
|
3969
3655
|
for (const [key, child] of Object.entries(source))
|
|
3970
3656
|
result[key] = await translate(child, operation, context, `${path}.${key}`);
|
|
3971
3657
|
const enumValue = (v, p) => {
|
|
3972
3658
|
if (operation === "write") {
|
|
3973
|
-
if (typeof v !== "string")
|
|
3659
|
+
if (typeof v !== "string") fail(operation, p, "Expected enum string");
|
|
3974
3660
|
return { t: v };
|
|
3975
3661
|
}
|
|
3976
|
-
const r =
|
|
3662
|
+
const r = record(v, operation, p);
|
|
3977
3663
|
if (Object.keys(r).length !== 1 || typeof r.t !== "string")
|
|
3978
|
-
|
|
3664
|
+
fail(operation, p, "Invalid enum arity");
|
|
3979
3665
|
return r.t;
|
|
3980
3666
|
};
|
|
3981
3667
|
if (result.t === "Quoted" || result.t === "Math") {
|
|
3982
|
-
const c =
|
|
3668
|
+
const c = tuple(result.c, 2, operation, `${path}.c`);
|
|
3983
3669
|
c[0] = enumValue(c[0], `${path}.c[0]`);
|
|
3984
3670
|
} else if (result.t === "Cite") {
|
|
3985
|
-
const c =
|
|
3671
|
+
const c = tuple(result.c, 2, operation, `${path}.c`);
|
|
3986
3672
|
for (const [i, citation2] of list(c[0], operation, `${path}.c[0]`).entries()) {
|
|
3987
|
-
const r =
|
|
3673
|
+
const r = record(citation2, operation, `${path}.c[0][${i}]`);
|
|
3988
3674
|
r.citationMode = enumValue(r.citationMode, `${path}.c[0][${i}].citationMode`);
|
|
3989
3675
|
}
|
|
3990
3676
|
} else if (result.t === "OrderedList") {
|
|
3991
|
-
const c =
|
|
3992
|
-
const attrs =
|
|
3677
|
+
const c = tuple(result.c, 2, operation, `${path}.c`);
|
|
3678
|
+
const attrs = tuple(c[0], 3, operation, `${path}.c[0]`);
|
|
3993
3679
|
attrs[1] = enumValue(attrs[1], `${path}.c[0][1]`);
|
|
3994
3680
|
attrs[2] = enumValue(attrs[2], `${path}.c[0][2]`);
|
|
3995
3681
|
} else if (result.t === "Table") {
|
|
3996
|
-
const c =
|
|
3682
|
+
const c = tuple(result.c, 6, operation, `${path}.c`);
|
|
3997
3683
|
for (const [i, spec] of list(c[2], operation, `${path}.c[2]`).entries()) {
|
|
3998
|
-
const s =
|
|
3684
|
+
const s = tuple(spec, 2, operation, `${path}.c[2][${i}]`);
|
|
3999
3685
|
s[0] = enumValue(s[0], `${path}.c[2][${i}][0]`);
|
|
4000
3686
|
}
|
|
4001
3687
|
const rows = (value2, p) => {
|
|
4002
3688
|
for (const [i, row2] of list(value2, operation, p).entries()) {
|
|
4003
|
-
const r =
|
|
3689
|
+
const r = tuple(row2, 2, operation, `${p}[${i}]`);
|
|
4004
3690
|
for (const [j, cell2] of list(r[1], operation, `${p}[${i}][1]`).entries()) {
|
|
4005
3691
|
const cellPath = `${p}[${i}][1][${j}]`;
|
|
4006
|
-
const cellTuple =
|
|
3692
|
+
const cellTuple = tuple(cell2, 5, operation, cellPath);
|
|
4007
3693
|
cellTuple[1] = enumValue(cellTuple[1], `${cellPath}[1]`);
|
|
4008
3694
|
}
|
|
4009
3695
|
}
|
|
4010
3696
|
};
|
|
4011
|
-
rows(
|
|
3697
|
+
rows(tuple(c[3], 2, operation, `${path}.c[3]`)[1], `${path}.c[3][1]`);
|
|
4012
3698
|
for (const [i, body] of list(c[4], operation, `${path}.c[4]`).entries()) {
|
|
4013
|
-
const b =
|
|
3699
|
+
const b = tuple(body, 4, operation, `${path}.c[4][${i}]`);
|
|
4014
3700
|
rows(b[2], `${path}.c[4][${i}][2]`);
|
|
4015
3701
|
rows(b[3], `${path}.c[4][${i}][3]`);
|
|
4016
3702
|
}
|
|
4017
|
-
rows(
|
|
3703
|
+
rows(tuple(c[5], 2, operation, `${path}.c[5]`)[1], `${path}.c[5][1]`);
|
|
4018
3704
|
}
|
|
4019
3705
|
return result;
|
|
4020
3706
|
}
|
|
4021
3707
|
var jsonReader = {
|
|
4022
3708
|
format: "json",
|
|
4023
3709
|
async read(input, context) {
|
|
4024
|
-
const root =
|
|
3710
|
+
const root = record(await parse(input.text ?? "", context), "read", "$");
|
|
4025
3711
|
if (Object.keys(root).length !== 3 || !Object.hasOwn(root, "meta") || !Object.hasOwn(root, "blocks"))
|
|
4026
|
-
|
|
4027
|
-
const version =
|
|
3712
|
+
fail("read", "$", "Expected pandoc-api-version, meta and blocks only");
|
|
3713
|
+
const version = tuple(root["pandoc-api-version"], 4, "read", "$.pandoc-api-version");
|
|
4028
3714
|
if (version.some((v, i) => v !== apiVersion[i]))
|
|
4029
|
-
|
|
3715
|
+
fail("read", "$.pandoc-api-version", "Unsupported API version; expected [1,23,1,2]");
|
|
4030
3716
|
return {
|
|
4031
3717
|
blocks: await translate(root.blocks, "read", context, "$.blocks"),
|
|
4032
3718
|
metadata: await translate(root.meta, "read", context, "$.meta"),
|
|
@@ -5310,7 +4996,7 @@ var latexReader = {
|
|
|
5310
4996
|
}
|
|
5311
4997
|
};
|
|
5312
4998
|
var formatting2 = { Emph: "emph", Strong: "textbf", Underline: "uline", Strikeout: "sout", Superscript: "textsuperscript", Subscript: "textsubscript", SmallCaps: "textsc" };
|
|
5313
|
-
var
|
|
4999
|
+
var languages2 = { en: "english", "en-US": "english", "en-GB": "british", de: "ngerman", "de-DE": "ngerman", fr: "french", es: "spanish", it: "italian", pt: "portuguese", nl: "dutch" };
|
|
5314
5000
|
var mathCommands = new Set("alpha beta gamma delta epsilon varepsilon zeta eta theta vartheta iota kappa lambda mu nu xi pi varpi rho varrho sigma varsigma tau upsilon phi varphi chi psi omega Gamma Delta Theta Lambda Xi Pi Sigma Upsilon Phi Psi Omega frac dfrac tfrac sqrt sum prod int iint iiint oint lim limsup liminf sin cos tan log ln exp min max sup inf det gcd left right middle big Big bigg Bigg cdot times div pm mp le leq ge geq ne neq approx equiv sim simeq in notin subset supset subseteq supseteq cup cap emptyset infinity infty partial nabla forall exists neg land lor to mapsto rightarrow leftarrow Rightarrow Leftarrow leftrightarrow Leftrightarrow overline underline hat widehat bar vec dot ddot text mathrm mathbf mathit mathsf mathtt mathcal mathbb mathnormal operatorname overset underset underbrace overbrace binom dbinom tbinom quad qquad hspace phantom vphantom hphantom langle rangle lbrace rbrace lvert rvert vert Vert lVert rVert ldots cdots vdots ddots degree prime ast star ell Re Im mod bmod pmod limits nolimits substack displaystyle textstyle scriptstyle scriptscriptstyle".split(" "));
|
|
5315
5001
|
var LatexWriter = class {
|
|
5316
5002
|
constructor(context) {
|
|
@@ -5770,12 +5456,12 @@ var LatexWriter = class {
|
|
|
5770
5456
|
const lang = document.metadata.lang;
|
|
5771
5457
|
if (lang && lang.t !== "MetaString") this.fail("lang metadata must be a string", "$.metadata.lang", "E_OPTION");
|
|
5772
5458
|
const language = lang?.c ?? document.language ?? "en";
|
|
5773
|
-
if (!
|
|
5459
|
+
if (!languages2[language]) this.fail("Unsupported LaTeX language", "$.metadata.lang", "E_OPTION");
|
|
5774
5460
|
const direction = document.metadata.dir;
|
|
5775
5461
|
if (direction && (direction.t !== "MetaString" || direction.c !== "ltr") || document.direction && document.direction !== "ltr") this.fail("Unsupported LaTeX direction", "$.metadata.dir", "E_OPTION");
|
|
5776
5462
|
if (this.context.standalone) {
|
|
5777
5463
|
this.add("\\documentclass{article}\n\\usepackage[T1]{fontenc}\n\\usepackage[utf8]{inputenc}\n");
|
|
5778
|
-
this.add(`\\usepackage[${
|
|
5464
|
+
this.add(`\\usepackage[${languages2[language]}]{babel}
|
|
5779
5465
|
`);
|
|
5780
5466
|
this.add("\\usepackage{amsmath,amssymb}\n\\usepackage{graphicx}\n\\usepackage{array,longtable,multirow}\n\\usepackage{enumitem}\n\\usepackage[normalem]{ulem}\n\\usepackage{hyperref}\n");
|
|
5781
5467
|
for (const key of ["title", "author", "date"]) {
|
|
@@ -5787,7 +5473,7 @@ var LatexWriter = class {
|
|
|
5787
5473
|
if (document.metadata.title) this.add("\\maketitle\n");
|
|
5788
5474
|
}
|
|
5789
5475
|
const fragmentLanguage = !this.context.standalone && (lang !== void 0 || document.language !== void 0);
|
|
5790
|
-
if (fragmentLanguage) this.add(`\\begin{otherlanguage}{${
|
|
5476
|
+
if (fragmentLanguage) this.add(`\\begin{otherlanguage}{${languages2[language]}}
|
|
5791
5477
|
`);
|
|
5792
5478
|
await this.blocks(document.blocks, "$.blocks");
|
|
5793
5479
|
await this.flushNotes();
|
|
@@ -5817,34 +5503,146 @@ var latex_default = {
|
|
|
5817
5503
|
extensions: {},
|
|
5818
5504
|
options: {
|
|
5819
5505
|
read: [],
|
|
5820
|
-
write: ["wrap", "standalone", "metadata", "rawContent"]
|
|
5506
|
+
write: ["wrap", "columns", "standalone", "metadata", "toc", "ascii", "eol", "rawContent"]
|
|
5821
5507
|
}
|
|
5822
5508
|
};
|
|
5823
5509
|
var ast_types_exports = {};
|
|
5824
5510
|
__reExport(ast_types_exports, ast_types_star);
|
|
5825
|
-
var
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
[
|
|
5847
|
-
|
|
5511
|
+
var rstAttr = () => ["", [], []];
|
|
5512
|
+
function rstError(context, at, message, code = "E_PARSE") {
|
|
5513
|
+
throw new PandocError(code, context.operation ?? "read", message, "rst", `${at.source ? `${at.source}:` : ""}${at.line}:${at.column}`);
|
|
5514
|
+
}
|
|
5515
|
+
function rstLines(text, base, source, context) {
|
|
5516
|
+
return text.split("\n").map((original, i) => {
|
|
5517
|
+
let text2 = original;
|
|
5518
|
+
if (original.includes(" ")) {
|
|
5519
|
+
text2 = "";
|
|
5520
|
+
for (const c of original) {
|
|
5521
|
+
context?.checkpoint();
|
|
5522
|
+
const value = c === " " ? " ".repeat(8 - text2.length % 8) : c;
|
|
5523
|
+
context?.charge("retainedBytes", value.length * 2);
|
|
5524
|
+
text2 += value;
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5527
|
+
return { text: text2, ...text2 === original ? {} : { original }, line: i + 1, column: 1, ...base === void 0 ? {} : { base }, ...source === void 0 ? {} : { source } };
|
|
5528
|
+
});
|
|
5529
|
+
}
|
|
5530
|
+
function indent(text) {
|
|
5531
|
+
let i = 0;
|
|
5532
|
+
while (text[i] === " ") i++;
|
|
5533
|
+
return i;
|
|
5534
|
+
}
|
|
5535
|
+
function sliceLine(line, start) {
|
|
5536
|
+
return { ...line, text: line.text.slice(start), column: line.column + start };
|
|
5537
|
+
}
|
|
5538
|
+
function dedent(lines) {
|
|
5539
|
+
const nonempty = lines.filter((l) => l.text.trim());
|
|
5540
|
+
const n = nonempty.length ? Math.min(...nonempty.map((l) => indent(l.text))) : 0;
|
|
5541
|
+
return lines.map((l) => sliceLine(l, Math.min(n, l.text.length)));
|
|
5542
|
+
}
|
|
5543
|
+
function trimLines(lines) {
|
|
5544
|
+
let a = 0, b = lines.length;
|
|
5545
|
+
while (a < b && !lines[a].text.trim()) a++;
|
|
5546
|
+
while (b > a && !lines[b - 1].text.trim()) b--;
|
|
5547
|
+
return lines.slice(a, b);
|
|
5548
|
+
}
|
|
5549
|
+
function nameOf(text) {
|
|
5550
|
+
return text.trim().toLowerCase().split(" ").filter(Boolean).join(" ");
|
|
5551
|
+
}
|
|
5552
|
+
function identifier(text) {
|
|
5553
|
+
return nameOf(text).split(" ").join("-");
|
|
5554
|
+
}
|
|
5555
|
+
function adornment(text) {
|
|
5556
|
+
const t = text.trimEnd();
|
|
5557
|
+
return t.length > 0 && "=!\"#$%&'()*+,-./:;<>?@[\\]^_`{|}~".includes(t[0]) && [...t].every((c) => c === t[0]) ? t[0] : void 0;
|
|
5558
|
+
}
|
|
5559
|
+
function roman(value) {
|
|
5560
|
+
const values = { i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1e3 };
|
|
5561
|
+
let n = 0;
|
|
5562
|
+
for (let i = 0; i < value.length; i++) {
|
|
5563
|
+
const v = values[value[i]] ?? 0;
|
|
5564
|
+
if (!v) return 0;
|
|
5565
|
+
n += v < (values[value[i + 1]] ?? 0) ? -v : v;
|
|
5566
|
+
}
|
|
5567
|
+
let rest = n, canonical = "";
|
|
5568
|
+
for (const [v, s] of [[1e3, "m"], [900, "cm"], [500, "d"], [400, "cd"], [100, "c"], [90, "xc"], [50, "l"], [40, "xl"], [10, "x"], [9, "ix"], [5, "v"], [4, "iv"], [1, "i"]]) while (rest >= v && canonical.length < 32) {
|
|
5569
|
+
canonical += s;
|
|
5570
|
+
rest -= v;
|
|
5571
|
+
}
|
|
5572
|
+
return canonical === value ? n : 0;
|
|
5573
|
+
}
|
|
5574
|
+
function listMarker(text) {
|
|
5575
|
+
if ("*+-\u2022\u2023\u2043".includes(text[0] ?? "") && text[1] === " ") {
|
|
5576
|
+
let width2 = 2;
|
|
5577
|
+
while (text[width2] === " ") width2++;
|
|
5578
|
+
return { width: width2, bullet: true, start: 1, style: "DefaultStyle", delim: "Period" };
|
|
5579
|
+
}
|
|
5580
|
+
const two = text.startsWith("(");
|
|
5581
|
+
let i = two ? 1 : 0;
|
|
5582
|
+
while (i < text.length && text[i] !== "." && text[i] !== ")" && text[i] !== " ") i++;
|
|
5583
|
+
if (i > 32 || text[i + 1] !== " " || ![".", ")"].includes(text[i] ?? "") || two && text[i] !== ")") return void 0;
|
|
5584
|
+
const token = text.slice(two ? 1 : 0, i);
|
|
5585
|
+
let start, style;
|
|
5586
|
+
if (token === "#") {
|
|
5587
|
+
start = 1;
|
|
5588
|
+
style = "DefaultStyle";
|
|
5589
|
+
} else if (token && [...token].every((c) => c >= "0" && c <= "9")) {
|
|
5590
|
+
start = Number(token);
|
|
5591
|
+
style = "Decimal";
|
|
5592
|
+
} else if (roman(token.toLowerCase()) && (token === token.toLowerCase() || token === token.toUpperCase())) {
|
|
5593
|
+
start = roman(token.toLowerCase());
|
|
5594
|
+
style = token === token.toLowerCase() ? "LowerRoman" : "UpperRoman";
|
|
5595
|
+
} else if (token.length === 1 && token.toLowerCase() >= "a" && token.toLowerCase() <= "z") {
|
|
5596
|
+
start = token.toLowerCase().charCodeAt(0) - 96;
|
|
5597
|
+
style = token === token.toLowerCase() ? "LowerAlpha" : "UpperAlpha";
|
|
5598
|
+
} else return void 0;
|
|
5599
|
+
if (!Number.isSafeInteger(start)) return void 0;
|
|
5600
|
+
let width = i + 2;
|
|
5601
|
+
while (text[width] === " ") width++;
|
|
5602
|
+
return { width, bullet: false, start, style, delim: two ? "TwoParens" : text[i] === ")" ? "OneParen" : "Period" };
|
|
5603
|
+
}
|
|
5604
|
+
function field(text) {
|
|
5605
|
+
if (!text.startsWith(":")) return void 0;
|
|
5606
|
+
const end = text.indexOf(":", 1);
|
|
5607
|
+
if (end <= 1 || end + 1 < text.length && text[end + 1] !== " ") return void 0;
|
|
5608
|
+
return { name: text.slice(1, end), width: Math.min(text.length, end + 2) };
|
|
5609
|
+
}
|
|
5610
|
+
function simpleColumns(text) {
|
|
5611
|
+
const out = [];
|
|
5612
|
+
let i = 0;
|
|
5613
|
+
while (i < text.length) {
|
|
5614
|
+
while (text[i] === " ") i++;
|
|
5615
|
+
if (i === text.length) break;
|
|
5616
|
+
const start = i;
|
|
5617
|
+
while (text[i] === "=") i++;
|
|
5618
|
+
if (i - start < 2 || i < text.length && text[i] !== " ") return void 0;
|
|
5619
|
+
out.push([start, i]);
|
|
5620
|
+
}
|
|
5621
|
+
return out.length > 1 ? out : void 0;
|
|
5622
|
+
}
|
|
5623
|
+
var ranges = [
|
|
5624
|
+
[768, 846, 0],
|
|
5625
|
+
[848, 879, 0],
|
|
5626
|
+
[888, 889, 2],
|
|
5627
|
+
[896, 899, 2],
|
|
5628
|
+
[907, 907, 2],
|
|
5629
|
+
[909, 909, 2],
|
|
5630
|
+
[930, 930, 2],
|
|
5631
|
+
[1155, 1159, 0],
|
|
5632
|
+
[1328, 1328, 2],
|
|
5633
|
+
[1367, 1368, 2],
|
|
5634
|
+
[1419, 1420, 2],
|
|
5635
|
+
[1424, 1424, 2],
|
|
5636
|
+
[1425, 1469, 0],
|
|
5637
|
+
[1471, 1471, 0],
|
|
5638
|
+
[1473, 1474, 0],
|
|
5639
|
+
[1476, 1477, 0],
|
|
5640
|
+
[1479, 1479, 0],
|
|
5641
|
+
[1480, 1487, 2],
|
|
5642
|
+
[1515, 1518, 2],
|
|
5643
|
+
[1525, 1535, 2],
|
|
5644
|
+
[1552, 1562, 0],
|
|
5645
|
+
[1565, 1565, 2],
|
|
5848
5646
|
[1611, 1631, 0],
|
|
5849
5647
|
[1648, 1648, 0],
|
|
5850
5648
|
[1750, 1756, 0],
|
|
@@ -6718,12 +6516,12 @@ function rstColumnWidth(text) {
|
|
|
6718
6516
|
}
|
|
6719
6517
|
return width;
|
|
6720
6518
|
}
|
|
6721
|
-
function
|
|
6519
|
+
function indent2(text, width) {
|
|
6722
6520
|
return text.split("\n").map((line) => line ? " ".repeat(width) + line : "").join("\n");
|
|
6723
6521
|
}
|
|
6724
6522
|
function markedBody(marker, body) {
|
|
6725
|
-
if (body.startsWith(" ")) return marker.trimEnd() + "\n\n" +
|
|
6726
|
-
return marker +
|
|
6523
|
+
if (body.startsWith(" ")) return marker.trimEnd() + "\n\n" + indent2("..\n\n" + body, marker.length);
|
|
6524
|
+
return marker + indent2(body, marker.length).slice(body ? marker.length : 0);
|
|
6727
6525
|
}
|
|
6728
6526
|
var RstWriter = class {
|
|
6729
6527
|
constructor(context) {
|
|
@@ -6757,7 +6555,7 @@ var RstWriter = class {
|
|
|
6757
6555
|
for (const ch of text) {
|
|
6758
6556
|
this.context.checkpoint();
|
|
6759
6557
|
if (ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127) this.fail("Control character in inline text", path);
|
|
6760
|
-
out += !literal && "\\`*_|<>[]
|
|
6558
|
+
out += !literal && "\\`*_|<>[]".includes(ch) ? `\\${ch}` : ch;
|
|
6761
6559
|
}
|
|
6762
6560
|
return this.retain(out);
|
|
6763
6561
|
}
|
|
@@ -6944,9 +6742,12 @@ var RstWriter = class {
|
|
|
6944
6742
|
let text;
|
|
6945
6743
|
switch (node.t) {
|
|
6946
6744
|
case "Plain":
|
|
6947
|
-
case "Para":
|
|
6745
|
+
case "Para": {
|
|
6948
6746
|
text = this.inlines(node.c, `${p}.c`);
|
|
6747
|
+
if (listMarker(text) || field(text) || adornment(text) || text.startsWith("+-") && text.endsWith("+") || text === ".." || text.startsWith(".. ")) text = "\\" + text;
|
|
6748
|
+
if (text.endsWith("::")) text = text.slice(0, -1) + "\\:";
|
|
6949
6749
|
break;
|
|
6750
|
+
}
|
|
6950
6751
|
case "Header": {
|
|
6951
6752
|
const [level, attr5, content] = node.c;
|
|
6952
6753
|
if (level > 9) this.loss("Heading level projected to level nine", p);
|
|
@@ -6959,12 +6760,12 @@ var RstWriter = class {
|
|
|
6959
6760
|
const lang = node.c[0][1][0];
|
|
6960
6761
|
if (lang && [...lang].some((ch) => !"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-+".includes(ch))) this.fail("Unsupported code language", p);
|
|
6961
6762
|
if (!node.c[1]) this.fail("Empty code block", p);
|
|
6962
|
-
text = this.attrs(node.c[0], p, true) + (lang ? `.. code:: ${lang}` : "::") + "\n\n" +
|
|
6763
|
+
text = this.attrs(node.c[0], p, true) + (lang ? `.. code:: ${lang}` : "::") + "\n\n" + indent2(node.c[1], 3);
|
|
6963
6764
|
break;
|
|
6964
6765
|
}
|
|
6965
6766
|
case "RawBlock":
|
|
6966
6767
|
this.loss("Raw block projected to literal code", p);
|
|
6967
|
-
text = "::\n\n" +
|
|
6768
|
+
text = "::\n\n" + indent2(node.c[1], 3);
|
|
6968
6769
|
break;
|
|
6969
6770
|
case "HorizontalRule":
|
|
6970
6771
|
if (i === 0 || i === nodes.length - 1 || nodes[i - 1]?.t === "Header" || nodes[i - 1]?.t === "HorizontalRule" || nodes[i + 1]?.t === "HorizontalRule") this.fail("RST transition requires content on both sides", p);
|
|
@@ -6973,7 +6774,7 @@ var RstWriter = class {
|
|
|
6973
6774
|
case "BlockQuote": {
|
|
6974
6775
|
const body = this.blocks(node.c, `${p}.c`);
|
|
6975
6776
|
if (!body) this.fail("Empty block quote", p);
|
|
6976
|
-
text =
|
|
6777
|
+
text = indent2(body.startsWith(" ") ? "..\n\n" + body : body, 3);
|
|
6977
6778
|
break;
|
|
6978
6779
|
}
|
|
6979
6780
|
case "Div": {
|
|
@@ -6982,7 +6783,7 @@ var RstWriter = class {
|
|
|
6982
6783
|
const body = this.blocks(node.c[1], `${p}.c[1]`);
|
|
6983
6784
|
text = this.attrs([id, [], attributes], p) + `.. container::${classes.length ? " " + classes.join(" ") : ""}
|
|
6984
6785
|
|
|
6985
|
-
` +
|
|
6786
|
+
` + indent2(body, 3);
|
|
6986
6787
|
break;
|
|
6987
6788
|
}
|
|
6988
6789
|
case "Figure":
|
|
@@ -7002,7 +6803,7 @@ var RstWriter = class {
|
|
|
7002
6803
|
if (!body) this.fail("Empty list item", p);
|
|
7003
6804
|
const marker = ordered ? `${node.c[0][0] + j}. ` : "* ";
|
|
7004
6805
|
const first = item[0];
|
|
7005
|
-
return first?.t === "Para" || first?.t === "Plain" ? marker +
|
|
6806
|
+
return first?.t === "Para" || first?.t === "Plain" ? marker + indent2(body, marker.length).slice(marker.length) : marker.trimEnd() + "\n\n" + indent2(body, marker.length);
|
|
7006
6807
|
}).join("\n\n");
|
|
7007
6808
|
break;
|
|
7008
6809
|
}
|
|
@@ -7011,7 +6812,7 @@ var RstWriter = class {
|
|
|
7011
6812
|
const name = this.inlines(term, `${p}.c[${j}][0]`), body = defs.map((def, k) => this.blocks(def, `${p}.c[${j}][1][${k}]`)).join("\n\n");
|
|
7012
6813
|
if (!name || !body) this.fail("Empty definition", p);
|
|
7013
6814
|
if (defs.length > 1) this.loss("Multiple definitions merged into one body", p);
|
|
7014
|
-
return name + "\n" +
|
|
6815
|
+
return name + "\n" + indent2(body.startsWith(" ") ? "..\n\n" + body : body, 3);
|
|
7015
6816
|
}).join("\n\n");
|
|
7016
6817
|
break;
|
|
7017
6818
|
case "Table": {
|
|
@@ -7082,118 +6883,6 @@ var RstWriter = class {
|
|
|
7082
6883
|
async function writeRst(document, context) {
|
|
7083
6884
|
return new RstWriter(context).write(document);
|
|
7084
6885
|
}
|
|
7085
|
-
var rstAttr = () => ["", [], []];
|
|
7086
|
-
function rstError(context, at, message, code = "E_PARSE") {
|
|
7087
|
-
throw new PandocError(code, context.operation ?? "read", message, "rst", `${at.source ? `${at.source}:` : ""}${at.line}:${at.column}`);
|
|
7088
|
-
}
|
|
7089
|
-
function rstLines(text, base, source, context) {
|
|
7090
|
-
return text.split("\n").map((original, i) => {
|
|
7091
|
-
let text2 = original;
|
|
7092
|
-
if (original.includes(" ")) {
|
|
7093
|
-
text2 = "";
|
|
7094
|
-
for (const c of original) {
|
|
7095
|
-
context?.checkpoint();
|
|
7096
|
-
const value = c === " " ? " ".repeat(8 - text2.length % 8) : c;
|
|
7097
|
-
context?.charge("retainedBytes", value.length * 2);
|
|
7098
|
-
text2 += value;
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
return { text: text2, ...text2 === original ? {} : { original }, line: i + 1, column: 1, ...base === void 0 ? {} : { base }, ...source === void 0 ? {} : { source } };
|
|
7102
|
-
});
|
|
7103
|
-
}
|
|
7104
|
-
function indent2(text) {
|
|
7105
|
-
let i = 0;
|
|
7106
|
-
while (text[i] === " ") i++;
|
|
7107
|
-
return i;
|
|
7108
|
-
}
|
|
7109
|
-
function sliceLine(line, start) {
|
|
7110
|
-
return { ...line, text: line.text.slice(start), column: line.column + start };
|
|
7111
|
-
}
|
|
7112
|
-
function dedent(lines) {
|
|
7113
|
-
const nonempty = lines.filter((l) => l.text.trim());
|
|
7114
|
-
const n = nonempty.length ? Math.min(...nonempty.map((l) => indent2(l.text))) : 0;
|
|
7115
|
-
return lines.map((l) => sliceLine(l, Math.min(n, l.text.length)));
|
|
7116
|
-
}
|
|
7117
|
-
function trimLines(lines) {
|
|
7118
|
-
let a = 0, b = lines.length;
|
|
7119
|
-
while (a < b && !lines[a].text.trim()) a++;
|
|
7120
|
-
while (b > a && !lines[b - 1].text.trim()) b--;
|
|
7121
|
-
return lines.slice(a, b);
|
|
7122
|
-
}
|
|
7123
|
-
function nameOf(text) {
|
|
7124
|
-
return text.trim().toLowerCase().split(" ").filter(Boolean).join(" ");
|
|
7125
|
-
}
|
|
7126
|
-
function identifier(text) {
|
|
7127
|
-
return nameOf(text).split(" ").join("-");
|
|
7128
|
-
}
|
|
7129
|
-
function adornment(text) {
|
|
7130
|
-
const t = text.trimEnd();
|
|
7131
|
-
return t.length > 0 && "=!\"#$%&'()*+,-./:;<>?@[\\]^_`{|}~".includes(t[0]) && [...t].every((c) => c === t[0]) ? t[0] : void 0;
|
|
7132
|
-
}
|
|
7133
|
-
function roman(value) {
|
|
7134
|
-
const values = { i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1e3 };
|
|
7135
|
-
let n = 0;
|
|
7136
|
-
for (let i = 0; i < value.length; i++) {
|
|
7137
|
-
const v = values[value[i]] ?? 0;
|
|
7138
|
-
if (!v) return 0;
|
|
7139
|
-
n += v < (values[value[i + 1]] ?? 0) ? -v : v;
|
|
7140
|
-
}
|
|
7141
|
-
let rest = n, canonical = "";
|
|
7142
|
-
for (const [v, s] of [[1e3, "m"], [900, "cm"], [500, "d"], [400, "cd"], [100, "c"], [90, "xc"], [50, "l"], [40, "xl"], [10, "x"], [9, "ix"], [5, "v"], [4, "iv"], [1, "i"]]) while (rest >= v && canonical.length < 32) {
|
|
7143
|
-
canonical += s;
|
|
7144
|
-
rest -= v;
|
|
7145
|
-
}
|
|
7146
|
-
return canonical === value ? n : 0;
|
|
7147
|
-
}
|
|
7148
|
-
function listMarker(text) {
|
|
7149
|
-
if ("*+-\u2022\u2023\u2043".includes(text[0] ?? "") && text[1] === " ") {
|
|
7150
|
-
let width2 = 2;
|
|
7151
|
-
while (text[width2] === " ") width2++;
|
|
7152
|
-
return { width: width2, bullet: true, start: 1, style: "DefaultStyle", delim: "Period" };
|
|
7153
|
-
}
|
|
7154
|
-
const two = text.startsWith("(");
|
|
7155
|
-
let i = two ? 1 : 0;
|
|
7156
|
-
while (i < text.length && text[i] !== "." && text[i] !== ")" && text[i] !== " ") i++;
|
|
7157
|
-
if (i > 32 || text[i + 1] !== " " || ![".", ")"].includes(text[i] ?? "") || two && text[i] !== ")") return void 0;
|
|
7158
|
-
const token = text.slice(two ? 1 : 0, i);
|
|
7159
|
-
let start, style;
|
|
7160
|
-
if (token === "#") {
|
|
7161
|
-
start = 1;
|
|
7162
|
-
style = "DefaultStyle";
|
|
7163
|
-
} else if (token && [...token].every((c) => c >= "0" && c <= "9")) {
|
|
7164
|
-
start = Number(token);
|
|
7165
|
-
style = "Decimal";
|
|
7166
|
-
} else if (roman(token.toLowerCase()) && (token === token.toLowerCase() || token === token.toUpperCase())) {
|
|
7167
|
-
start = roman(token.toLowerCase());
|
|
7168
|
-
style = token === token.toLowerCase() ? "LowerRoman" : "UpperRoman";
|
|
7169
|
-
} else if (token.length === 1 && token.toLowerCase() >= "a" && token.toLowerCase() <= "z") {
|
|
7170
|
-
start = token.toLowerCase().charCodeAt(0) - 96;
|
|
7171
|
-
style = token === token.toLowerCase() ? "LowerAlpha" : "UpperAlpha";
|
|
7172
|
-
} else return void 0;
|
|
7173
|
-
if (!Number.isSafeInteger(start)) return void 0;
|
|
7174
|
-
let width = i + 2;
|
|
7175
|
-
while (text[width] === " ") width++;
|
|
7176
|
-
return { width, bullet: false, start, style, delim: two ? "TwoParens" : text[i] === ")" ? "OneParen" : "Period" };
|
|
7177
|
-
}
|
|
7178
|
-
function field(text) {
|
|
7179
|
-
if (!text.startsWith(":")) return void 0;
|
|
7180
|
-
const end = text.indexOf(":", 1);
|
|
7181
|
-
if (end <= 1 || end + 1 < text.length && text[end + 1] !== " ") return void 0;
|
|
7182
|
-
return { name: text.slice(1, end), width: Math.min(text.length, end + 2) };
|
|
7183
|
-
}
|
|
7184
|
-
function simpleColumns(text) {
|
|
7185
|
-
const out = [];
|
|
7186
|
-
let i = 0;
|
|
7187
|
-
while (i < text.length) {
|
|
7188
|
-
while (text[i] === " ") i++;
|
|
7189
|
-
if (i === text.length) break;
|
|
7190
|
-
const start = i;
|
|
7191
|
-
while (text[i] === "=") i++;
|
|
7192
|
-
if (i - start < 2 || i < text.length && text[i] !== " ") return void 0;
|
|
7193
|
-
out.push([start, i]);
|
|
7194
|
-
}
|
|
7195
|
-
return out.length > 1 ? out : void 0;
|
|
7196
|
-
}
|
|
7197
6886
|
var roleTags = { emphasis: "Emph", strong: "Strong", superscript: "Superscript", sup: "Superscript", subscript: "Subscript", sub: "Subscript" };
|
|
7198
6887
|
var whitespace2 = (c) => c === " " || c === "\n" || c === " ";
|
|
7199
6888
|
var startBoundary = (s, i) => i === 0 || whitespace2(s[i - 1]) || `([{<'"/:,-`.includes(s[i - 1]);
|
|
@@ -7478,7 +7167,7 @@ var RstReader = class {
|
|
|
7478
7167
|
}
|
|
7479
7168
|
indented(lines, start) {
|
|
7480
7169
|
let i = start;
|
|
7481
|
-
while (i < lines.length && (!lines[i].text.trim() ||
|
|
7170
|
+
while (i < lines.length && (!lines[i].text.trim() || indent(lines[i].text) > 0)) {
|
|
7482
7171
|
this.context.checkpoint();
|
|
7483
7172
|
i++;
|
|
7484
7173
|
}
|
|
@@ -7539,7 +7228,7 @@ var RstReader = class {
|
|
|
7539
7228
|
}
|
|
7540
7229
|
}
|
|
7541
7230
|
if (name === "replace" && subName) {
|
|
7542
|
-
if (options.size || body.some((l) => !l.text.trim()) || argument && lines[i + 1]?.text.trim() === "" && body.length || body.some((l) => listMarker(l.text) || field(l.text) ||
|
|
7231
|
+
if (options.size || body.some((l) => !l.text.trim()) || argument && lines[i + 1]?.text.trim() === "" && body.length || body.some((l) => listMarker(l.text) || field(l.text) || indent(l.text))) return unsupported();
|
|
7543
7232
|
if (this.substitutions.has(subName)) rstError(this.context, at, `Duplicate substitution: ${subName}`);
|
|
7544
7233
|
const text = [argument, ...body.map((l) => l.text)].filter(Boolean).join("\n");
|
|
7545
7234
|
if (!text) rstError(this.context, at, "Empty replacement");
|
|
@@ -7688,7 +7377,7 @@ var RstReader = class {
|
|
|
7688
7377
|
i++;
|
|
7689
7378
|
continue;
|
|
7690
7379
|
}
|
|
7691
|
-
if (
|
|
7380
|
+
if (indent(text)) {
|
|
7692
7381
|
const end = this.indented(lines, i);
|
|
7693
7382
|
out.push({ t: "BlockQuote", c: await this.blocks(dedent(trimLines(lines.slice(i, end))), depth + 1) });
|
|
7694
7383
|
i = end;
|
|
@@ -7790,7 +7479,7 @@ var RstReader = class {
|
|
|
7790
7479
|
while (i < lines.length && (lines[i].text === "|" || lines[i].text.startsWith("| "))) {
|
|
7791
7480
|
const first = lines[i], parts2 = [first.text.slice(2)];
|
|
7792
7481
|
i++;
|
|
7793
|
-
while (i < lines.length &&
|
|
7482
|
+
while (i < lines.length && indent(lines[i].text) > 0) {
|
|
7794
7483
|
parts2.push(lines[i].text.trimStart());
|
|
7795
7484
|
i++;
|
|
7796
7485
|
}
|
|
@@ -7809,7 +7498,7 @@ var RstReader = class {
|
|
|
7809
7498
|
expected++;
|
|
7810
7499
|
const end = this.indented(lines, i + 1);
|
|
7811
7500
|
const continuation = lines.slice(i + 1, end);
|
|
7812
|
-
if (continuation.some((l) => l.text.trim() &&
|
|
7501
|
+
if (continuation.some((l) => l.text.trim() && indent(l.text) < m.width)) rstError(this.context, first, "List continuation indentation is too small");
|
|
7813
7502
|
items.push(await this.blocks([sliceLine(first, m.width), ...continuation.map((l) => sliceLine(l, Math.min(m.width, l.text.length)))], depth + 1));
|
|
7814
7503
|
i = end;
|
|
7815
7504
|
}
|
|
@@ -7829,9 +7518,9 @@ var RstReader = class {
|
|
|
7829
7518
|
out.push({ t: "DefinitionList", c: entries });
|
|
7830
7519
|
continue;
|
|
7831
7520
|
}
|
|
7832
|
-
if (lines[i + 1]?.text.trim() &&
|
|
7521
|
+
if (lines[i + 1]?.text.trim() && indent(lines[i + 1].text)) {
|
|
7833
7522
|
const entries = [];
|
|
7834
|
-
while (i < lines.length && lines[i + 1]?.text.trim() &&
|
|
7523
|
+
while (i < lines.length && lines[i + 1]?.text.trim() && indent(lines[i + 1].text)) {
|
|
7835
7524
|
const first = lines[i], end = this.indented(lines, i + 1);
|
|
7836
7525
|
entries.push([this.inline(first.text, first), [await this.blocks(dedent(trimLines(lines.slice(i + 1, end))), depth + 1)]]);
|
|
7837
7526
|
i = end;
|
|
@@ -7842,7 +7531,7 @@ var RstReader = class {
|
|
|
7842
7531
|
const parts = [];
|
|
7843
7532
|
while (i < lines.length && lines[i].text.trim()) {
|
|
7844
7533
|
const line = lines[i];
|
|
7845
|
-
if (
|
|
7534
|
+
if (indent(line.text)) rstError(this.context, line, "Unexpected paragraph indentation");
|
|
7846
7535
|
parts.push(line);
|
|
7847
7536
|
i++;
|
|
7848
7537
|
}
|
|
@@ -7851,13 +7540,13 @@ var RstReader = class {
|
|
|
7851
7540
|
let next = i;
|
|
7852
7541
|
while (next < lines.length && !lines[next].text.trim()) next++;
|
|
7853
7542
|
const literal = lines[next];
|
|
7854
|
-
if (literal && (
|
|
7543
|
+
if (literal && (indent(literal.text) || ">!\"#$%&'()+,-./:;<?@[\\]^_`{~".includes(literal.text[0]))) {
|
|
7855
7544
|
if (value === "::") value = "";
|
|
7856
7545
|
else if (value.endsWith(" ::")) value = value.slice(0, -3);
|
|
7857
7546
|
else value = value.slice(0, -1);
|
|
7858
7547
|
if (value) out.push({ t: "Para", c: this.inline(value, at) });
|
|
7859
7548
|
let end, code;
|
|
7860
|
-
if (
|
|
7549
|
+
if (indent(literal.text)) {
|
|
7861
7550
|
end = this.indented(lines, next);
|
|
7862
7551
|
code = dedent(trimLines(lines.slice(next, end)));
|
|
7863
7552
|
} else {
|
|
@@ -7906,7 +7595,7 @@ var rst_default = {
|
|
|
7906
7595
|
extensions: {},
|
|
7907
7596
|
options: {
|
|
7908
7597
|
read: [],
|
|
7909
|
-
write: ["wrap", "columns"]
|
|
7598
|
+
write: ["wrap", "columns", "standalone", "metadata", "toc", "ascii", "eol", "rawContent"]
|
|
7910
7599
|
}
|
|
7911
7600
|
};
|
|
7912
7601
|
function rtfError(context, message, code = "E_PARSE", offset = 0) {
|
|
@@ -9001,6 +8690,10 @@ var RtfWriter = class {
|
|
|
9001
8690
|
fail(message, code = "E_UNSUPPORTED_FEATURE") {
|
|
9002
8691
|
throw new PandocError(code, this.context.operation ?? "write", message, "rtf");
|
|
9003
8692
|
}
|
|
8693
|
+
loss(message) {
|
|
8694
|
+
if (!this.context.lossy) this.fail(message);
|
|
8695
|
+
this.context.report({ code: "W_PRESENTATION_LOSS", operation: this.context.operation ?? "write", format: "rtf", message });
|
|
8696
|
+
}
|
|
9004
8697
|
add(text) {
|
|
9005
8698
|
this.context.checkpoint(text.length + 1);
|
|
9006
8699
|
this.context.bound("outputBytes", this.length + text.length);
|
|
@@ -9023,7 +8716,7 @@ var RtfWriter = class {
|
|
|
9023
8716
|
}
|
|
9024
8717
|
}
|
|
9025
8718
|
attrs(attr5, paragraph = false) {
|
|
9026
|
-
if (attr5[0] || attr5[1].length) this.
|
|
8719
|
+
if (attr5[0] || attr5[1].length) this.loss("Unsupported RTF identifiers or classes");
|
|
9027
8720
|
for (const [key, value] of attr5[2]) {
|
|
9028
8721
|
if (key === "font-family") {
|
|
9029
8722
|
const id = this.fonts.indexOf(value);
|
|
@@ -9038,7 +8731,7 @@ var RtfWriter = class {
|
|
|
9038
8731
|
} else if (key === "dir" && ["ltr", "rtl"].includes(value)) this.add(`\\${value}${paragraph ? "par" : "ch"}`);
|
|
9039
8732
|
else if (key === "text-align" && paragraph && ["left", "right", "center", "justify"].includes(value))
|
|
9040
8733
|
this.add(`\\${{ left: "ql", right: "qr", center: "qc", justify: "qj" }[value]}`);
|
|
9041
|
-
else this.
|
|
8734
|
+
else this.loss(`Unsupported RTF attribute: ${key}`);
|
|
9042
8735
|
}
|
|
9043
8736
|
}
|
|
9044
8737
|
async collect(value, listDepth = 0) {
|
|
@@ -9222,7 +8915,7 @@ var RtfWriter = class {
|
|
|
9222
8915
|
await this.blocks(node.c, { ...current, indent: state.indent + 720 });
|
|
9223
8916
|
break;
|
|
9224
8917
|
case "Div":
|
|
9225
|
-
if (node.c[0][2].length || node.c[0][0] || node.c[0][1].length) this.
|
|
8918
|
+
if (node.c[0][2].length || node.c[0][0] || node.c[0][1].length) this.loss("Attributed RTF Div projected to contained blocks");
|
|
9226
8919
|
await this.blocks(node.c[1], current);
|
|
9227
8920
|
break;
|
|
9228
8921
|
case "BulletList":
|
|
@@ -10494,7 +10187,7 @@ var EncodingMode;
|
|
|
10494
10187
|
EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
|
|
10495
10188
|
EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
|
|
10496
10189
|
})(EncodingMode || (EncodingMode = {}));
|
|
10497
|
-
var
|
|
10190
|
+
var attr = ["", [], []];
|
|
10498
10191
|
async function modelContext(ctx) {
|
|
10499
10192
|
const { DocumentBudget } = await import("./src-ICMQISAA.js");
|
|
10500
10193
|
const l = ctx.limits;
|
|
@@ -10532,32 +10225,42 @@ var docxReader = { format: "docx", async read(input, ctx) {
|
|
|
10532
10225
|
return guarded(ctx, async () => {
|
|
10533
10226
|
const { Document: openDocument, Paragraph, Run } = await import("./src-ICMQISAA.js");
|
|
10534
10227
|
const model = await openDocument(input.bytes, await modelContext(ctx));
|
|
10535
|
-
const paragraph = (p) => {
|
|
10228
|
+
const paragraph = async (p) => {
|
|
10536
10229
|
const inlines2 = [];
|
|
10537
10230
|
for (const item of p.iter_inner_content()) {
|
|
10538
10231
|
ctx.checkpoint();
|
|
10539
10232
|
const runs = item instanceof Run ? [item] : item.runs;
|
|
10540
|
-
const content =
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10233
|
+
const content = [];
|
|
10234
|
+
for (const run of runs) {
|
|
10235
|
+
ctx.checkpoint();
|
|
10236
|
+
let inlines3 = run.style?.style_id === "VerbatimChar" ? [{ t: "Code", c: [attr, run.text] }] : await literalInlines(run.text, ctx);
|
|
10237
|
+
if (run.bold) inlines3 = [{ t: "Strong", c: inlines3 }];
|
|
10238
|
+
if (run.italic) inlines3 = [{ t: "Emph", c: inlines3 }];
|
|
10239
|
+
content.push(...inlines3);
|
|
10240
|
+
}
|
|
10546
10241
|
if (item instanceof Run) inlines2.push(...content);
|
|
10547
|
-
else inlines2.push({ t: "Link", c: [
|
|
10242
|
+
else inlines2.push({ t: "Link", c: [attr, content, [item.url, ""]] });
|
|
10548
10243
|
}
|
|
10549
10244
|
const name = p.style?.name ?? "";
|
|
10550
10245
|
const level = name.startsWith("Heading ") ? Number(name.slice(8)) : 0;
|
|
10551
|
-
return level >= 1 && level <= 6 ? { t: "Header", c: [level,
|
|
10246
|
+
return level >= 1 && level <= 6 ? { t: "Header", c: [level, attr, inlines2] } : { t: "Para", c: inlines2 };
|
|
10552
10247
|
};
|
|
10553
10248
|
const blocks3 = [];
|
|
10554
10249
|
for (const item of model.iter_inner_content()) {
|
|
10555
10250
|
await ctx.cooperate();
|
|
10556
|
-
if (item instanceof Paragraph) blocks3.push(paragraph(item));
|
|
10251
|
+
if (item instanceof Paragraph) blocks3.push(await paragraph(item));
|
|
10557
10252
|
else {
|
|
10558
10253
|
const rows = [];
|
|
10559
|
-
for (const row2 of item.rows)
|
|
10560
|
-
|
|
10254
|
+
for (const row2 of item.rows) {
|
|
10255
|
+
const cells = [];
|
|
10256
|
+
for (const cell2 of row2.cells) {
|
|
10257
|
+
const blocks4 = [];
|
|
10258
|
+
for (const p of cell2.paragraphs) blocks4.push(await paragraph(p));
|
|
10259
|
+
cells.push([attr, "AlignDefault", 1, 1, blocks4]);
|
|
10260
|
+
}
|
|
10261
|
+
rows.push([attr, cells]);
|
|
10262
|
+
}
|
|
10263
|
+
blocks3.push({ t: "Table", c: [attr, [null, []], Array.from({ length: item.columns.length }, () => ["AlignDefault", { t: "ColWidthDefault" }]), [attr, []], [[attr, 0, [], rows]], [attr, []]] });
|
|
10561
10264
|
}
|
|
10562
10265
|
}
|
|
10563
10266
|
return { blocks: blocks3, metadata: {}, resources: [] };
|
|
@@ -10590,14 +10293,14 @@ var docxWriter = { format: "docx", imageResources: "embed", async write(document
|
|
|
10590
10293
|
else if (node.t === "LineBreak") text = "\n";
|
|
10591
10294
|
else if (node.t === "Code") text = node.c[1];
|
|
10592
10295
|
else throw new PandocError("E_UNSUPPORTED_FEATURE", "write", `Unsupported DOCX inline: ${node.t}`, "docx");
|
|
10593
|
-
result.push({ ...style, text });
|
|
10296
|
+
result.push({ ...style, text, ...node.t === "Code" ? { code: true } : {} });
|
|
10594
10297
|
}
|
|
10595
10298
|
}
|
|
10596
10299
|
return result;
|
|
10597
10300
|
};
|
|
10598
10301
|
const paragraph = (target, content, properties, level) => {
|
|
10599
10302
|
paragraphs.push({ runs: content, properties });
|
|
10600
|
-
target.push({ kind: "paragraph", ...level === void 0 ? {} : { level }, runs: content.map(({ link: _link, strike: _strike, baseline: _baseline, image: _image, ...run }) => run) });
|
|
10303
|
+
target.push({ kind: "paragraph", ...level === void 0 ? {} : { level }, runs: content.map(({ code: _code, link: _link, strike: _strike, baseline: _baseline, image: _image, ...run }) => run) });
|
|
10601
10304
|
};
|
|
10602
10305
|
const visit5 = async (nodes, target, indent3 = 0, list2) => {
|
|
10603
10306
|
for (const block2 of nodes) {
|
|
@@ -10690,17 +10393,18 @@ var docxWriter = { format: "docx", imageResources: "embed", async write(document
|
|
|
10690
10393
|
ctx.checkpoint();
|
|
10691
10394
|
const native = nativeRuns[index];
|
|
10692
10395
|
const properties2 = native.children.find((child) => child.localName === "rPr");
|
|
10396
|
+
const codeStyle = run.code ? '<w:rStyle w:val="VerbatimChar"/>' : "";
|
|
10693
10397
|
const format2 = (run.strike ? "<w:strike/>" : "") + (run.baseline ? `<w:vertAlign w:val="${run.baseline}"/>` : "");
|
|
10694
10398
|
const edits = /* @__PURE__ */ new Map();
|
|
10695
|
-
if (properties2 && format2) edits.set(properties2, `<w:rPr>${main.sourceXml(properties2, /* @__PURE__ */ new Map(), true)}${format2}</w:rPr>`);
|
|
10696
|
-
let xml = run.image ? `<w:r>${await drawing(run.image)}</w:r>` : `<w:r>${!properties2 && format2 ? `<w:rPr>${format2}</w:rPr>` : ""}${main.sourceXml(native, edits, true)}</w:r>`;
|
|
10399
|
+
if (properties2 && (codeStyle || format2)) edits.set(properties2, `<w:rPr>${codeStyle}${main.sourceXml(properties2, /* @__PURE__ */ new Map(), true)}${format2}</w:rPr>`);
|
|
10400
|
+
let xml = run.image ? `<w:r>${await drawing(run.image)}</w:r>` : `<w:r>${!properties2 && (codeStyle || format2) ? `<w:rPr>${codeStyle}${format2}</w:rPr>` : ""}${main.sourceXml(native, edits, true)}</w:r>`;
|
|
10697
10401
|
if (run.link !== void 0) {
|
|
10698
10402
|
const anchor = run.link.startsWith("#");
|
|
10699
10403
|
const id = `rId${relationshipId++}`;
|
|
10700
10404
|
if (!anchor) linkRelationships.push(`<Relationship Id="${id}" Type="${r}/hyperlink" Target="${encodeXML(run.link)}" TargetMode="External"/>`);
|
|
10701
10405
|
xml = `<w:hyperlink ${anchor ? `w:anchor="${encodeXML(run.link.slice(1))}"` : `xmlns:r="${r}" r:id="${id}"`}>${xml}</w:hyperlink>`;
|
|
10702
10406
|
}
|
|
10703
|
-
if (format2 || run.image || run.link !== void 0) replacements.set(native, xml);
|
|
10407
|
+
if (codeStyle || format2 || run.image || run.link !== void 0) replacements.set(native, xml);
|
|
10704
10408
|
}
|
|
10705
10409
|
if (extra.properties || replacements.size) main.replaceElement(node, `<w:p xmlns:w="${w}">${!properties && extra.properties ? `<w:pPr>${extra.properties}</w:pPr>` : ""}${main.sourceXml(node, replacements, true)}</w:p>`);
|
|
10706
10410
|
} else for (const child of node.children) await edit(child);
|
|
@@ -10712,6 +10416,11 @@ var docxWriter = { format: "docx", imageResources: "embed", async write(document
|
|
|
10712
10416
|
if (numbering2.length) types.insertChildren(types.root, '<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>');
|
|
10713
10417
|
for (const entry of media.values()) types.insertChildren(types.root, `<Override xmlns="http://schemas.openxmlformats.org/package/2006/content-types" PartName="/word/${entry.name}" ContentType="${entry.type}"/>`);
|
|
10714
10418
|
const parts = /* @__PURE__ */ new Map([["word/document.xml", main.serialize()], ["word/_rels/document.xml.rels", relationships.serialize()], ["[Content_Types].xml", types.serialize()]]);
|
|
10419
|
+
if (paragraphs.some((paragraph2) => paragraph2.runs.some((run) => run.code))) {
|
|
10420
|
+
const styles = new DocumentXmlEditor(archive.members.find((member) => member.name === "word/styles.xml").bytes, {}, void 0, mc.budget);
|
|
10421
|
+
styles.insertChildren(styles.root, `<w:style xmlns:w="${w}" w:type="character" w:styleId="VerbatimChar"><w:name w:val="Verbatim Char"/><w:rPr><w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/></w:rPr></w:style>`);
|
|
10422
|
+
parts.set("word/styles.xml", styles.serialize());
|
|
10423
|
+
}
|
|
10715
10424
|
const members = archive.members.map((member) => ({ ...member, bytes: parts.get(member.name) ?? member.bytes }));
|
|
10716
10425
|
for (const entry of media.values()) members.push({ name: `word/${entry.name}`, bytes: entry.bytes, directory: false, modified: /* @__PURE__ */ new Date(0) });
|
|
10717
10426
|
if (numbering2.length) members.push({ name: "word/numbering.xml", bytes: new TextEncoder().encode(`<w:numbering xmlns:w="${w}">${numbering2.join("")}${numbering2.map((_, i) => `<w:num w:numId="${i + 1}"><w:abstractNumId w:val="${i + 1}"/></w:num>`).join("")}</w:numbering>`), directory: false, modified: /* @__PURE__ */ new Date(0) });
|
|
@@ -10846,7 +10555,7 @@ function odtPackage(ctx) {
|
|
|
10846
10555
|
}
|
|
10847
10556
|
};
|
|
10848
10557
|
}
|
|
10849
|
-
var
|
|
10558
|
+
var attr2 = ["", [], []];
|
|
10850
10559
|
var odtReader = { format: "odt", async read(input, ctx) {
|
|
10851
10560
|
const parts = await odtPackage(ctx).read(input.bytes);
|
|
10852
10561
|
const source = parts.get("content.xml") ?? odtFailure(ctx, "Missing ODT content.xml");
|
|
@@ -10910,7 +10619,7 @@ var odtReader = { format: "odt", async read(input, ctx) {
|
|
|
10910
10619
|
result.push({ t: "Str", c: " ".repeat(n) });
|
|
10911
10620
|
} else if (node.name === "tab") result.push({ t: "Str", c: " " });
|
|
10912
10621
|
else if (node.name === "line-break") result.push({ t: "LineBreak" });
|
|
10913
|
-
else if (node.name === "a") result.push({ t: "Link", c: [
|
|
10622
|
+
else if (node.name === "a") result.push({ t: "Link", c: [attr2, inlines2(node.children), [odtAttribute(node, "href", xlink), ""]] });
|
|
10914
10623
|
else if (node.name === "span") {
|
|
10915
10624
|
let content2 = inlines2(node.children);
|
|
10916
10625
|
const props = properties(odtAttribute(node, "style-name", odtNamespaces.text));
|
|
@@ -10963,9 +10672,9 @@ var odtReader = { format: "odt", async read(input, ctx) {
|
|
|
10963
10672
|
}
|
|
10964
10673
|
if (node.uri === odtNamespaces.text && ["p", "h"].includes(node.name)) {
|
|
10965
10674
|
const content2 = inlines2(node.children), names = styleChain(odtAttribute(node, "style-name", odtNamespaces.text));
|
|
10966
|
-
if (node.name === "h") result.push({ t: "Header", c: [count(odtAttribute(node, "outline-level", odtNamespaces.text), 6),
|
|
10675
|
+
if (node.name === "h") result.push({ t: "Header", c: [count(odtAttribute(node, "outline-level", odtNamespaces.text), 6), attr2, content2] });
|
|
10967
10676
|
else if (names.includes("Rule")) result.push({ t: "HorizontalRule" });
|
|
10968
|
-
else if (names.includes("Preformatted")) result.push({ t: "CodeBlock", c: [
|
|
10677
|
+
else if (names.includes("Preformatted")) result.push({ t: "CodeBlock", c: [attr2, content2.map((n) => n.t === "Str" ? n.c : n.t === "LineBreak" ? "\n" : n.t === "Space" ? " " : "").join("")] });
|
|
10969
10678
|
else if (names.some((name) => ["Quote", "Quotations"].includes(name))) result.push({ t: "BlockQuote", c: [{ t: "Para", c: content2 }] });
|
|
10970
10679
|
else result.push({ t: "Para", c: content2 });
|
|
10971
10680
|
} else if (node.uri === odtNamespaces.text && node.name === "section") result.push({ t: "Div", c: [[odtAttribute(node, "name", odtNamespaces.text), [], []], await blocks3(node.children, listLevel)] });
|
|
@@ -10991,18 +10700,18 @@ var odtReader = { format: "odt", async read(input, ctx) {
|
|
|
10991
10700
|
const content2 = await blocks3(cell2.children);
|
|
10992
10701
|
for (let i = 0; i < repeat2; i++) {
|
|
10993
10702
|
ctx.charge("tableCells", 1);
|
|
10994
|
-
cells.push([
|
|
10703
|
+
cells.push([attr2, "AlignDefault", 1, 1, content2]);
|
|
10995
10704
|
}
|
|
10996
10705
|
ctx.bound("tableColumns", cells.length);
|
|
10997
10706
|
}
|
|
10998
10707
|
columns = Math.max(columns, cells.length);
|
|
10999
10708
|
const repeat = count(odtAttribute(row2, "number-rows-repeated", odtNamespaces.table), ctx.limits.tableRows);
|
|
11000
10709
|
ctx.charge("tableCells", (repeat - 1) * cells.length);
|
|
11001
|
-
for (let i = 0; i < repeat; i++) (header ? head2 : rows).push([
|
|
10710
|
+
for (let i = 0; i < repeat; i++) (header ? head2 : rows).push([attr2, cells]);
|
|
11002
10711
|
ctx.bound("tableRows", head2.length + rows.length);
|
|
11003
10712
|
}
|
|
11004
10713
|
const specs = Array.from({ length: columns }, () => ["AlignDefault", { t: "ColWidthDefault" }]);
|
|
11005
|
-
result.push({ t: "Table", c: [
|
|
10714
|
+
result.push({ t: "Table", c: [attr2, [null, []], specs, [attr2, head2], [[attr2, 0, [], rows]], [attr2, []]] });
|
|
11006
10715
|
} else if (!(node.uri === odtNamespaces.text && ["sequence-decls", "tracked-changes"].includes(node.name))) odtFailure(ctx, `Unsupported ODT block: ${node.name}`, "E_UNSUPPORTED_FEATURE");
|
|
11007
10716
|
}
|
|
11008
10717
|
return result;
|
|
@@ -11220,7 +10929,7 @@ var pptx_default = {
|
|
|
11220
10929
|
write: ["standalone"]
|
|
11221
10930
|
}
|
|
11222
10931
|
};
|
|
11223
|
-
var
|
|
10932
|
+
var attr3 = ["", [], []];
|
|
11224
10933
|
var xlsxReader = { format: "xlsx", async read(input, ctx) {
|
|
11225
10934
|
const l = ctx.limits;
|
|
11226
10935
|
const context = {
|
|
@@ -11255,7 +10964,7 @@ var xlsxReader = { format: "xlsx", async read(input, ctx) {
|
|
|
11255
10964
|
ctx.bound("nodes", ++nodes);
|
|
11256
10965
|
const title = await literalInlines(sheet.name, ctx, nodes);
|
|
11257
10966
|
nodes += title.length;
|
|
11258
|
-
blocks3.push({ t: "Header", c: [1,
|
|
10967
|
+
blocks3.push({ t: "Header", c: [1, attr3, title] });
|
|
11259
10968
|
if (!sheet.cells.length) continue;
|
|
11260
10969
|
let height = 0, width = 0;
|
|
11261
10970
|
for (const cell2 of sheet.cells) {
|
|
@@ -11263,201 +10972,1122 @@ var xlsxReader = { format: "xlsx", async read(input, ctx) {
|
|
|
11263
10972
|
height = Math.max(height, cell2.row + 1);
|
|
11264
10973
|
width = Math.max(width, cell2.column + 1);
|
|
11265
10974
|
}
|
|
11266
|
-
ctx.bound("tableRows", height);
|
|
11267
|
-
ctx.bound("tableColumns", width);
|
|
11268
|
-
ctx.charge("tableCells", height * width);
|
|
11269
|
-
ctx.charge("retainedBytes", height * width * 128);
|
|
11270
|
-
const cells = new Map(sheet.cells.map((cell2) => [`${cell2.row}:${cell2.column}`, cell2]));
|
|
11271
|
-
const rows = [];
|
|
11272
|
-
for (let r = 0; r < height; r++) {
|
|
11273
|
-
const row2 = [];
|
|
11274
|
-
for (let c = 0; c < width; c++) {
|
|
11275
|
-
await ctx.cooperate();
|
|
11276
|
-
const cell2 = cells.get(`${r}:${c}`);
|
|
11277
|
-
const value = cell2?.cachedResult ?? cell2?.value;
|
|
11278
|
-
const text = cell2?.displayedText ?? (value && value.kind !== "blank" ? String(value.value) : "");
|
|
11279
|
-
ctx.bound("tableFieldText", text.length);
|
|
11280
|
-
const inlines2 = await literalInlines(text, ctx, nodes);
|
|
11281
|
-
nodes += inlines2.length;
|
|
11282
|
-
if (inlines2.length) ctx.bound("nodes", ++nodes);
|
|
11283
|
-
row2.push([
|
|
10975
|
+
ctx.bound("tableRows", height);
|
|
10976
|
+
ctx.bound("tableColumns", width);
|
|
10977
|
+
ctx.charge("tableCells", height * width);
|
|
10978
|
+
ctx.charge("retainedBytes", height * width * 128);
|
|
10979
|
+
const cells = new Map(sheet.cells.map((cell2) => [`${cell2.row}:${cell2.column}`, cell2]));
|
|
10980
|
+
const rows = [];
|
|
10981
|
+
for (let r = 0; r < height; r++) {
|
|
10982
|
+
const row2 = [];
|
|
10983
|
+
for (let c = 0; c < width; c++) {
|
|
10984
|
+
await ctx.cooperate();
|
|
10985
|
+
const cell2 = cells.get(`${r}:${c}`);
|
|
10986
|
+
const value = cell2?.cachedResult ?? cell2?.value;
|
|
10987
|
+
const text = cell2?.displayedText ?? (value && value.kind !== "blank" ? String(value.value) : "");
|
|
10988
|
+
ctx.bound("tableFieldText", text.length);
|
|
10989
|
+
const inlines2 = await literalInlines(text, ctx, nodes);
|
|
10990
|
+
nodes += inlines2.length;
|
|
10991
|
+
if (inlines2.length) ctx.bound("nodes", ++nodes);
|
|
10992
|
+
row2.push([attr3, "AlignDefault", 1, 1, inlines2.length ? [{ t: "Plain", c: inlines2 }] : []]);
|
|
10993
|
+
}
|
|
10994
|
+
rows.push([attr3, row2]);
|
|
10995
|
+
}
|
|
10996
|
+
ctx.bound("nodes", ++nodes);
|
|
10997
|
+
const head2 = rows.shift();
|
|
10998
|
+
blocks3.push({ t: "Table", c: [attr3, [null, []], Array.from({ length: width }, () => ["AlignDefault", { t: "ColWidthDefault" }]), [attr3, [head2]], [[attr3, 0, [], rows]], [attr3, []]] });
|
|
10999
|
+
}
|
|
11000
|
+
return { blocks: blocks3, metadata: {}, resources: [] };
|
|
11001
|
+
} catch (error) {
|
|
11002
|
+
if (error instanceof PandocError) throw error;
|
|
11003
|
+
if (ctx.signal?.aborted) ctx.signal.throwIfAborted();
|
|
11004
|
+
const code = error.code;
|
|
11005
|
+
throw new PandocError(code === "resource-limit" ? "E_LIMIT" : code === "unsupported-feature" ? "E_UNSUPPORTED_FEATURE" : "E_PARSE", "read", error instanceof Error ? error.message : "Invalid XLSX", "xlsx");
|
|
11006
|
+
}
|
|
11007
|
+
} };
|
|
11008
|
+
var xlsx_default = {
|
|
11009
|
+
reader: xlsxReader,
|
|
11010
|
+
name: "xlsx",
|
|
11011
|
+
read: true,
|
|
11012
|
+
write: false,
|
|
11013
|
+
media: "binary",
|
|
11014
|
+
inputEncoding: "bytes",
|
|
11015
|
+
suffixes: ["xlsx"],
|
|
11016
|
+
extensions: {},
|
|
11017
|
+
options: {
|
|
11018
|
+
read: [],
|
|
11019
|
+
write: []
|
|
11020
|
+
}
|
|
11021
|
+
};
|
|
11022
|
+
var coreFormats = [
|
|
11023
|
+
commonmark_default,
|
|
11024
|
+
gfm_default,
|
|
11025
|
+
html_default,
|
|
11026
|
+
html5_default,
|
|
11027
|
+
json_default,
|
|
11028
|
+
csv_default,
|
|
11029
|
+
tsv_default,
|
|
11030
|
+
plain_default,
|
|
11031
|
+
latex_default,
|
|
11032
|
+
rst_default,
|
|
11033
|
+
rtf_default,
|
|
11034
|
+
epub_default,
|
|
11035
|
+
pdf_default,
|
|
11036
|
+
docx_default,
|
|
11037
|
+
odt_default,
|
|
11038
|
+
pptx_default,
|
|
11039
|
+
xlsx_default
|
|
11040
|
+
];
|
|
11041
|
+
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
11042
|
+
function validName(name) {
|
|
11043
|
+
if (!name) return false;
|
|
11044
|
+
for (const char of name)
|
|
11045
|
+
if (!(char >= "a" && char <= "z") && !(char >= "0" && char <= "9") && char !== "_")
|
|
11046
|
+
return false;
|
|
11047
|
+
return true;
|
|
11048
|
+
}
|
|
11049
|
+
function createFormatRegistry(descriptors = coreFormats, context = {}, operation = "convert") {
|
|
11050
|
+
const fail3 = (code, message) => {
|
|
11051
|
+
throw new PandocError(code, operation, message);
|
|
11052
|
+
};
|
|
11053
|
+
const names = /* @__PURE__ */ new Set();
|
|
11054
|
+
const maps = {
|
|
11055
|
+
read: /* @__PURE__ */ new Map(),
|
|
11056
|
+
write: /* @__PURE__ */ new Map()
|
|
11057
|
+
};
|
|
11058
|
+
const formats = descriptors.map(
|
|
11059
|
+
(item) => Object.freeze({
|
|
11060
|
+
...item,
|
|
11061
|
+
...item.aliases === void 0 ? {} : {
|
|
11062
|
+
aliases: Object.freeze({
|
|
11063
|
+
...item.aliases.read === void 0 ? {} : { read: Object.freeze([...item.aliases.read]) },
|
|
11064
|
+
...item.aliases.write === void 0 ? {} : { write: Object.freeze([...item.aliases.write]) }
|
|
11065
|
+
})
|
|
11066
|
+
},
|
|
11067
|
+
suffixes: Object.freeze([...item.suffixes]),
|
|
11068
|
+
extensions: Object.freeze({ ...item.extensions }),
|
|
11069
|
+
options: Object.freeze({
|
|
11070
|
+
read: Object.freeze([...item.options.read]),
|
|
11071
|
+
write: Object.freeze([...item.options.write])
|
|
11072
|
+
})
|
|
11073
|
+
})
|
|
11074
|
+
).sort((a, b) => compare(a.name, b.name));
|
|
11075
|
+
for (const descriptor of formats) {
|
|
11076
|
+
if (!validName(descriptor.name) || names.has(descriptor.name))
|
|
11077
|
+
fail3("E_FORMAT", `Invalid or duplicate format: ${descriptor.name}`);
|
|
11078
|
+
names.add(descriptor.name);
|
|
11079
|
+
if (descriptor.reader && (!descriptor.read || descriptor.reader.format !== descriptor.name) || descriptor.writer && (!descriptor.write || descriptor.writer.format !== descriptor.name))
|
|
11080
|
+
fail3("E_CAPABILITY", `Invalid binding: ${descriptor.name}`);
|
|
11081
|
+
for (const extension of Object.keys(descriptor.extensions))
|
|
11082
|
+
if (!validName(extension)) fail3("E_EXTENSION", `Invalid extension: ${extension}`);
|
|
11083
|
+
for (const direction of ["read", "write"]) {
|
|
11084
|
+
const aliases = descriptor.aliases?.[direction] ?? [];
|
|
11085
|
+
if (aliases.length && !descriptor[direction])
|
|
11086
|
+
fail3("E_FORMAT", "Alias for rejected direction");
|
|
11087
|
+
if (!descriptor[direction]) continue;
|
|
11088
|
+
for (const name of [descriptor.name, ...aliases]) {
|
|
11089
|
+
if (!validName(name) || maps[direction].has(name))
|
|
11090
|
+
fail3("E_FORMAT", `Format collision: ${name}`);
|
|
11091
|
+
maps[direction].set(name, descriptor);
|
|
11092
|
+
}
|
|
11093
|
+
}
|
|
11094
|
+
}
|
|
11095
|
+
const reader = (descriptor) => context.reader?.format === descriptor.name ? context.reader : descriptor.reader;
|
|
11096
|
+
const writer = (descriptor) => context.writer?.format === descriptor.name ? context.writer : descriptor.writer;
|
|
11097
|
+
function parse4(source, direction) {
|
|
11098
|
+
if (typeof source !== "string" || !source)
|
|
11099
|
+
fail3("E_FORMAT_REQUIRED", "Select an explicit format");
|
|
11100
|
+
let cursor = 0;
|
|
11101
|
+
while (cursor < source.length && source[cursor] !== "+" && source[cursor] !== "-") cursor++;
|
|
11102
|
+
const name = source.slice(0, cursor);
|
|
11103
|
+
const selectedDirection = direction ?? (maps.read.has(name) ? "read" : "write");
|
|
11104
|
+
const descriptor = maps[selectedDirection].get(name);
|
|
11105
|
+
if (!descriptor) return fail3("E_FORMAT", `Unsupported ${selectedDirection} format: ${name}`);
|
|
11106
|
+
const extensions = Object.fromEntries(
|
|
11107
|
+
Object.entries(descriptor.extensions).sort(([a], [b]) => compare(a, b))
|
|
11108
|
+
);
|
|
11109
|
+
while (cursor < source.length) {
|
|
11110
|
+
const enabled = source[cursor++] === "+";
|
|
11111
|
+
const start = cursor;
|
|
11112
|
+
while (cursor < source.length && source[cursor] !== "+" && source[cursor] !== "-") cursor++;
|
|
11113
|
+
const extension = source.slice(start, cursor);
|
|
11114
|
+
if (!validName(extension) || !Object.hasOwn(extensions, extension))
|
|
11115
|
+
fail3("E_EXTENSION", `Unsupported extension: ${extension}`);
|
|
11116
|
+
extensions[extension] = enabled;
|
|
11117
|
+
}
|
|
11118
|
+
return { descriptor, extensions: Object.freeze(extensions) };
|
|
11119
|
+
}
|
|
11120
|
+
return {
|
|
11121
|
+
parse: parse4,
|
|
11122
|
+
resolve(source, direction) {
|
|
11123
|
+
const selection = parse4(source, direction);
|
|
11124
|
+
const selectedReader = reader(selection.descriptor);
|
|
11125
|
+
const selectedWriter = writer(selection.descriptor);
|
|
11126
|
+
if (!(direction === "read" ? selectedReader : selectedWriter))
|
|
11127
|
+
fail3("E_CAPABILITY", `No ${direction} capability for ${selection.descriptor.name}`);
|
|
11128
|
+
return { ...selection, reader: selectedReader, writer: selectedWriter };
|
|
11129
|
+
},
|
|
11130
|
+
list(direction) {
|
|
11131
|
+
return [...maps[direction]].filter(
|
|
11132
|
+
([, descriptor]) => direction === "read" ? reader(descriptor) : writer(descriptor)
|
|
11133
|
+
).map(([name]) => name).sort(compare);
|
|
11134
|
+
},
|
|
11135
|
+
listExtensions(source, direction) {
|
|
11136
|
+
return Object.entries(parse4(source, direction).extensions).map(
|
|
11137
|
+
([name, enabled]) => `${enabled ? "+" : "-"}${name}`
|
|
11138
|
+
);
|
|
11139
|
+
},
|
|
11140
|
+
infer(path, direction) {
|
|
11141
|
+
const dot = path.lastIndexOf(".");
|
|
11142
|
+
if (dot <= path.lastIndexOf("/") || dot < 0) return fail3("E_FORMAT", `No suffix: ${path}`);
|
|
11143
|
+
const suffix = path.slice(dot + 1).toLowerCase();
|
|
11144
|
+
const matches = formats.filter(
|
|
11145
|
+
(descriptor) => descriptor[direction] && descriptor.suffixes.includes(suffix)
|
|
11146
|
+
);
|
|
11147
|
+
if (matches.length !== 1) return fail3("E_FORMAT", `Unknown or ambiguous suffix: ${path}`);
|
|
11148
|
+
return matches[0].name;
|
|
11149
|
+
},
|
|
11150
|
+
validateOptions(source, direction, options) {
|
|
11151
|
+
const { descriptor } = parse4(source, direction);
|
|
11152
|
+
for (const option of options)
|
|
11153
|
+
if (!descriptor.options[direction].includes(option))
|
|
11154
|
+
fail3("E_OPTION", `Inapplicable option: ${option}`);
|
|
11155
|
+
},
|
|
11156
|
+
capabilities: Object.freeze(
|
|
11157
|
+
formats.map((descriptor) => {
|
|
11158
|
+
const input = maps.read.get(descriptor.name);
|
|
11159
|
+
const output = maps.write.get(descriptor.name);
|
|
11160
|
+
return Object.freeze({
|
|
11161
|
+
...descriptor,
|
|
11162
|
+
read: Object.freeze({ allowed: !!input, available: !!input && !!reader(input) }),
|
|
11163
|
+
write: Object.freeze({ allowed: !!output, available: !!output && !!writer(output) })
|
|
11164
|
+
});
|
|
11165
|
+
})
|
|
11166
|
+
)
|
|
11167
|
+
};
|
|
11168
|
+
}
|
|
11169
|
+
var formatCapabilities = createFormatRegistry().capabilities;
|
|
11170
|
+
function inspectAssets(args, context, help) {
|
|
11171
|
+
const first = args[0] ?? "";
|
|
11172
|
+
const modes = /* @__PURE__ */ new Map([
|
|
11173
|
+
["--list-highlight-languages", "languages"],
|
|
11174
|
+
["--list-highlight-styles", "styles"],
|
|
11175
|
+
["-D", "template"],
|
|
11176
|
+
["--print-default-template", "template"],
|
|
11177
|
+
["--print-default-data-file", "data"],
|
|
11178
|
+
["--print-highlight-style", "style"],
|
|
11179
|
+
["--completion", "completion"],
|
|
11180
|
+
["--bash-completion", "bash"]
|
|
11181
|
+
]);
|
|
11182
|
+
const equals = first.indexOf("=");
|
|
11183
|
+
const flag = equals < 0 ? first : first.slice(0, equals);
|
|
11184
|
+
const short = first.startsWith("-D") && first.length > 2;
|
|
11185
|
+
const mode = modes.get(short ? "-D" : flag);
|
|
11186
|
+
if (!mode) return void 0;
|
|
11187
|
+
const error = (message) => {
|
|
11188
|
+
throw new PandocError("E_OPTION", "convert", message);
|
|
11189
|
+
};
|
|
11190
|
+
if (mode === "languages" || mode === "styles" || mode === "bash") {
|
|
11191
|
+
if (args.length !== 1 || equals >= 0) return error("Use inspection flags alone");
|
|
11192
|
+
if (mode === "languages") return languages;
|
|
11193
|
+
if (mode === "styles") return [...highlightStyles.keys()].join("\n") + "\n";
|
|
11194
|
+
}
|
|
11195
|
+
const attached = short ? first.slice(2) : equals < 0 ? void 0 : first.slice(equals + 1);
|
|
11196
|
+
const value = mode === "bash" ? "bash" : attached ?? args[1];
|
|
11197
|
+
if (!value || args.length !== (mode === "bash" || attached !== void 0 ? 1 : 2))
|
|
11198
|
+
return error("Use an inspection flag with exactly one value");
|
|
11199
|
+
if (mode === "template") {
|
|
11200
|
+
if (value === "html" || value === "html5") return html5;
|
|
11201
|
+
throw new PandocError("E_CAPABILITY", "convert", `No bundled default template for ${value}`);
|
|
11202
|
+
}
|
|
11203
|
+
if (mode === "data") {
|
|
11204
|
+
if (value === "abbreviations") return abbreviations;
|
|
11205
|
+
if (value === "templates/default.html5") return html5;
|
|
11206
|
+
throw new PandocError("E_RESOURCE", "convert", `No bundled data file: ${value}`);
|
|
11207
|
+
}
|
|
11208
|
+
if (mode === "style") {
|
|
11209
|
+
const style = highlightStyles.get(value);
|
|
11210
|
+
if (style !== void 0) return style;
|
|
11211
|
+
throw new PandocError("E_CAPABILITY", "convert", `No bundled highlight style: ${value}`);
|
|
11212
|
+
}
|
|
11213
|
+
if (value !== "bash") return error("Only bash completion is available");
|
|
11214
|
+
const registry = createFormatRegistry(void 0, context);
|
|
11215
|
+
const flags = [...new Set(help().split("\nUse -- before")[0].split("\n").join(" ").split(" ").flatMap((word) => word.split("/")).filter((word) => word.startsWith("--") || word.startsWith("-") && (word.charCodeAt(1) >= 65 && word.charCodeAt(1) <= 90 || word.charCodeAt(1) >= 97 && word.charCodeAt(1) <= 122)).map((word) => word.split("=")[0].split("[")[0]))];
|
|
11216
|
+
const quote = (words) => words.join(" ").replaceAll("'", "'\\''");
|
|
11217
|
+
return `_pandoc_typescript() {
|
|
11218
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}" prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
11219
|
+
COMPREPLY=()
|
|
11220
|
+
case "$prev" in
|
|
11221
|
+
-f|-r|--from|--read) COMPREPLY=( $(compgen -W '${quote(registry.list("read"))}' -- "$cur") ) ;;
|
|
11222
|
+
-t|-w|--to|--write) COMPREPLY=( $(compgen -W '${quote(registry.list("write"))}' -- "$cur") ) ;;
|
|
11223
|
+
-D|--print-default-template) COMPREPLY=( $(compgen -W 'html html5' -- "$cur") ) ;;
|
|
11224
|
+
--print-default-data-file) COMPREPLY=( $(compgen -W 'abbreviations templates/default.html5' -- "$cur") ) ;;
|
|
11225
|
+
--print-highlight-style) COMPREPLY=( $(compgen -W '${quote([...highlightStyles.keys()])}' -- "$cur") ) ;;
|
|
11226
|
+
--completion) COMPREPLY=( $(compgen -W 'bash' -- "$cur") ) ;;
|
|
11227
|
+
*) case "$cur" in
|
|
11228
|
+
-*) COMPREPLY=( $(compgen -W '${quote(flags)}' -- "$cur") ) ;;
|
|
11229
|
+
*) COMPREPLY=( $(compgen -f -- "$cur") ) ;;
|
|
11230
|
+
esac ;;
|
|
11231
|
+
esac
|
|
11232
|
+
}
|
|
11233
|
+
complete -o filenames -o bashdefault -F _pandoc_typescript pandoc
|
|
11234
|
+
`;
|
|
11235
|
+
}
|
|
11236
|
+
function inspectCommand(args, context = {}) {
|
|
11237
|
+
if (args[0] === "--help" || args[0] === "-h") {
|
|
11238
|
+
if (!args.every((arg) => arg === "--help" || arg === "-h")) throw new PandocError("E_OPTION", "convert", "Use help flags alone");
|
|
11239
|
+
return "Usage: pandoc -f FORMAT -t FORMAT [OPTIONS] [FILE|- ...]\n--from/--read/-f/-r --to/--write/-t/-w --output/-o PATH (use - for stdout) --yes --standalone[=true|false]/-s\n--wrap=none|auto|preserve (auto/preserve: plain) --columns N (plain)\n--number-sections/-N --toc (HTML standalone) --ascii (HTML)\n--shift-heading-level-by -6..6 --strip-comments --eol=lf|crlf|native\n--metadata/-M KEY[=VALUE] (bare KEY is true) --metadata-file FILE.json --lossy --fail-if-warnings\n--defaults/-d FILE.yaml --template FILE --variable/-V KEY=VALUE --variable-json KEY:JSON\n--include-in-header/-H FILE --include-before-body/-B FILE --include-after-body/-A FILE\n--file-scope --sandbox (uses explicit VFS authority; no native sandbox guarantee)\n--resource-path DIR[:DIR] --extract-media DIR --raw-content=reject|escape|retain\n--pdf-page-size a4|letter --pdf-orientation portrait|landscape --pdf-margin POINTS\n--pdf-font FAMILY|PATH --pdf-font-size POINTS --pdf-line-height MULTIPLIER\nPDF families: mono bundled; serif/sans unavailable (E_CAPABILITY). Font paths use only the admitted VFS.\n--epub-title TEXT --epub-language TEXT --epub-identifier TEXT --epub-chapter-level 1..6\n--list-input-formats --list-output-formats --list-extensions FORMAT --help/-h --version/-v\n--list-highlight-languages --list-highlight-styles --print-highlight-style STYLE\n--print-default-template/-D html|html5 --print-default-data-file abbreviations --completion bash --bash-completion\nUse -- before literal filenames. No external PDF engines, ambient fonts, filters or network fetching.\nCapabilities (available directions):\n" + inspectFormats(["--list-input-formats", "--list-output-formats"], context);
|
|
11240
|
+
}
|
|
11241
|
+
if (args[0] === "--version" || args[0] === "-v") {
|
|
11242
|
+
if (args.length !== 1) throw new PandocError("E_OPTION", "convert", "Use --version alone");
|
|
11243
|
+
return "pandoc TypeScript converter 0.0.1 (original bounded implementation)\n";
|
|
11244
|
+
}
|
|
11245
|
+
const asset = inspectAssets(args, context, () => inspectCommand(["--help"], context));
|
|
11246
|
+
if (asset !== void 0) return asset;
|
|
11247
|
+
if (args[0]?.startsWith("--list-")) return inspectFormats(args, context);
|
|
11248
|
+
return void 0;
|
|
11249
|
+
}
|
|
11250
|
+
function inspectFormats(args, context = {}) {
|
|
11251
|
+
const registry = createFormatRegistry(void 0, context);
|
|
11252
|
+
const error = () => {
|
|
11253
|
+
throw new PandocError(
|
|
11254
|
+
"E_OPTION",
|
|
11255
|
+
"convert",
|
|
11256
|
+
"Use format listing flags alone, or --list-extensions FORMAT"
|
|
11257
|
+
);
|
|
11258
|
+
};
|
|
11259
|
+
if (args[0] === "--list-extensions" && args.length === 2)
|
|
11260
|
+
return registry.listExtensions(args[1]).map((name) => `${name}
|
|
11261
|
+
`).join("");
|
|
11262
|
+
if (args.length === 1 && args[0].startsWith("--list-extensions="))
|
|
11263
|
+
return registry.listExtensions(args[0].slice("--list-extensions=".length)).map((name) => `${name}
|
|
11264
|
+
`).join("");
|
|
11265
|
+
const directions = /* @__PURE__ */ new Set();
|
|
11266
|
+
const flags = /* @__PURE__ */ new Map([
|
|
11267
|
+
["--list-input-formats", "read"],
|
|
11268
|
+
["--list-output-formats", "write"]
|
|
11269
|
+
]);
|
|
11270
|
+
for (const arg of args) {
|
|
11271
|
+
const direction = flags.get(arg);
|
|
11272
|
+
if (!direction) return error();
|
|
11273
|
+
directions.add(direction);
|
|
11274
|
+
}
|
|
11275
|
+
if (!directions.size) return error();
|
|
11276
|
+
return ["read", "write"].filter((direction) => directions.has(direction)).map(
|
|
11277
|
+
(direction) => (directions.size === 2 ? `${direction === "read" ? "Input" : "Output"} formats:
|
|
11278
|
+
` : "") + registry.list(direction).map((name) => `${name}
|
|
11279
|
+
`).join("")
|
|
11280
|
+
).join("");
|
|
11281
|
+
}
|
|
11282
|
+
var targetOrigins = /* @__PURE__ */ new WeakMap();
|
|
11283
|
+
var missing = (error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
11284
|
+
function resourceDirectory(path, cwd = "/") {
|
|
11285
|
+
if (!path || path.includes("\\") || path.includes(":") || path.includes("\0") || path.startsWith("~"))
|
|
11286
|
+
throw new PandocError("E_OPTION", "convert", "Invalid resource directory");
|
|
11287
|
+
const parts = (path.startsWith("/") ? path : `${cwd}/${path}`).split("/");
|
|
11288
|
+
if (parts.includes("..")) throw new PandocError("E_OPTION", "convert", "Resource directories cannot traverse parents");
|
|
11289
|
+
return "/" + parts.filter((p) => p && p !== ".").join("/");
|
|
11290
|
+
}
|
|
11291
|
+
function localTarget(url, context) {
|
|
11292
|
+
const split = [url.indexOf("?"), url.indexOf("#")].filter((n) => n >= 0);
|
|
11293
|
+
const end = split.length ? Math.min(...split) : url.length;
|
|
11294
|
+
const raw = url.slice(0, end);
|
|
11295
|
+
if (!raw || raw.startsWith("/") || raw.startsWith("~") || raw.includes(":") || raw.includes("\\"))
|
|
11296
|
+
context.fail("E_CAPABILITY", "Only relative local image resources are supported");
|
|
11297
|
+
const parts = [];
|
|
11298
|
+
for (const component of raw.split("/")) {
|
|
11299
|
+
context.checkpoint();
|
|
11300
|
+
let decoded;
|
|
11301
|
+
try {
|
|
11302
|
+
decoded = decodeURIComponent(component);
|
|
11303
|
+
} catch {
|
|
11304
|
+
return context.fail("E_CAPABILITY", "Invalid image URI escape");
|
|
11305
|
+
}
|
|
11306
|
+
if (decoded.includes("/") || decoded.includes("\\") || decoded.includes(":") || [...decoded].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127))
|
|
11307
|
+
context.fail("E_CAPABILITY", "Invalid image resource component");
|
|
11308
|
+
if (!decoded || decoded === ".") continue;
|
|
11309
|
+
if (decoded === "..") {
|
|
11310
|
+
if (!parts.length) context.fail("E_CAPABILITY", "Image resource escapes its search directory");
|
|
11311
|
+
parts.pop();
|
|
11312
|
+
} else parts.push(decoded);
|
|
11313
|
+
}
|
|
11314
|
+
if (!parts.length || parts[0].startsWith("~")) context.fail("E_CAPABILITY", "Invalid image resource name");
|
|
11315
|
+
return { name: parts.join("/"), suffix: url.slice(end) };
|
|
11316
|
+
}
|
|
11317
|
+
function mediaKeyBasename(key, context) {
|
|
11318
|
+
if (!key || key.startsWith("/") || key.startsWith("~") || key.includes("\\") || key.includes(":") || key.split("/").some((p) => !p || p === "." || p === "..") || [...key].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127)) context.fail("E_CAPABILITY", "Unsafe embedded resource key");
|
|
11319
|
+
return key.split("/").at(-1);
|
|
11320
|
+
}
|
|
11321
|
+
async function inspect(fs, path, context) {
|
|
11322
|
+
let current = "";
|
|
11323
|
+
let type;
|
|
11324
|
+
const parts = path.split("/").filter(Boolean);
|
|
11325
|
+
for (let i = 0; i <= parts.length; i++) {
|
|
11326
|
+
current = i === 0 ? "/" : (current === "/" ? "" : current) + "/" + parts[i - 1];
|
|
11327
|
+
context.checkpoint();
|
|
11328
|
+
type = (await context.call(async () => {
|
|
11329
|
+
try {
|
|
11330
|
+
return await fs.lstat(current, context.signal ? { signal: context.signal } : {});
|
|
11331
|
+
} catch (error) {
|
|
11332
|
+
if (missing(error)) return void 0;
|
|
11333
|
+
throw error;
|
|
11334
|
+
}
|
|
11335
|
+
}))?.type;
|
|
11336
|
+
if (type === void 0) return void 0;
|
|
11337
|
+
if (type === "symlink") context.fail("E_CAPABILITY", "Symlink image and extraction paths are unsupported");
|
|
11338
|
+
if (i < parts.length && type !== "directory") context.fail("E_IO", "Resource ancestor is not a directory");
|
|
11339
|
+
}
|
|
11340
|
+
return type;
|
|
11341
|
+
}
|
|
11342
|
+
var ResourceSession = class {
|
|
11343
|
+
constructor(context) {
|
|
11344
|
+
this.context = context;
|
|
11345
|
+
}
|
|
11346
|
+
context;
|
|
11347
|
+
origins = targetOrigins;
|
|
11348
|
+
bag = /* @__PURE__ */ new Map();
|
|
11349
|
+
names = /* @__PURE__ */ new Set();
|
|
11350
|
+
plans = [];
|
|
11351
|
+
destination;
|
|
11352
|
+
search;
|
|
11353
|
+
allocate(basename, bytes) {
|
|
11354
|
+
if (!basename || basename === "." || basename === "..") this.context.fail("E_CAPABILITY", "Invalid extraction basename");
|
|
11355
|
+
let name = basename;
|
|
11356
|
+
const dot = basename.lastIndexOf(".");
|
|
11357
|
+
for (let n = 2; this.names.has(name); n++) {
|
|
11358
|
+
this.context.checkpoint();
|
|
11359
|
+
name = dot > 0 ? `${basename.slice(0, dot)}-${n}${basename.slice(dot)}` : `${basename}-${n}`;
|
|
11360
|
+
}
|
|
11361
|
+
this.names.add(name);
|
|
11362
|
+
const entry = { path: this.destination === void 0 ? name : `${this.destination === "/" ? "" : this.destination}/${name}`, bytes };
|
|
11363
|
+
this.context.charge("references", 1);
|
|
11364
|
+
this.context.charge("retainedBytes", entry.path.length * 2 + 64);
|
|
11365
|
+
this.plans.push(entry);
|
|
11366
|
+
return entry;
|
|
11367
|
+
}
|
|
11368
|
+
configure(options) {
|
|
11369
|
+
const cwd = resourceDirectory(this.context.context.resourceCwd ?? "/");
|
|
11370
|
+
if (options.resourcePath !== void 0) {
|
|
11371
|
+
if (!Array.isArray(options.resourcePath) || !options.resourcePath.length || options.resourcePath.some((p) => typeof p !== "string")) this.context.fail("E_OPTION", "resourcePath requires directories");
|
|
11372
|
+
this.search = options.resourcePath.map((p) => resourceDirectory(p, cwd));
|
|
11373
|
+
}
|
|
11374
|
+
if (options.extractMedia !== void 0) {
|
|
11375
|
+
if (typeof options.extractMedia !== "string") this.context.fail("E_OPTION", "extractMedia requires a directory");
|
|
11376
|
+
this.destination = resourceDirectory(options.extractMedia, cwd);
|
|
11377
|
+
if (!this.context.context.resourceFiles) this.context.fail("E_CAPABILITY", "Media extraction requires a configured VFS");
|
|
11378
|
+
}
|
|
11379
|
+
}
|
|
11380
|
+
async prepare(document, lossy, embedImages = false) {
|
|
11381
|
+
if (this.destination === void 0 && (!embedImages || !this.context.context.resourceFiles || this.context.resources)) return document;
|
|
11382
|
+
const fs = this.context.context.resourceFiles;
|
|
11383
|
+
const ctx = this.context;
|
|
11384
|
+
const embedded = /* @__PURE__ */ new Map();
|
|
11385
|
+
const imageResources = /* @__PURE__ */ new Map();
|
|
11386
|
+
const embeddedEntries = /* @__PURE__ */ new Map();
|
|
11387
|
+
for (const resource of document.resources) {
|
|
11388
|
+
if (this.destination !== void 0) mediaKeyBasename(resource.id, ctx);
|
|
11389
|
+
const previous = embedded.get(resource.id);
|
|
11390
|
+
if (previous) {
|
|
11391
|
+
if (embedImages) ctx.fail("E_RESOURCE", "Duplicate embedded resource id");
|
|
11392
|
+
if (previous.length !== resource.bytes.length) ctx.fail("E_RESOURCE", "Conflicting embedded resource keys");
|
|
11393
|
+
for (let i = 0; i < previous.length; i++) {
|
|
11394
|
+
ctx.checkpoint();
|
|
11395
|
+
if (previous[i] !== resource.bytes[i]) ctx.fail("E_RESOURCE", "Conflicting embedded resource keys");
|
|
11396
|
+
}
|
|
11397
|
+
} else embedded.set(resource.id, resource.bytes);
|
|
11398
|
+
}
|
|
11399
|
+
const validate = async (value) => {
|
|
11400
|
+
await ctx.cooperate();
|
|
11401
|
+
if (!value || typeof value !== "object" || value instanceof Uint8Array) return;
|
|
11402
|
+
if ("t" in value && value.t === "Image") {
|
|
11403
|
+
const image = value;
|
|
11404
|
+
if (!embedded.has(image.c[2][0])) {
|
|
11405
|
+
localTarget(image.c[2][0], ctx);
|
|
11406
|
+
if (!this.search) resourceDirectory(this.origins.get(image.c[2])?.base ?? ctx.context.resourceCwd ?? "/");
|
|
11407
|
+
}
|
|
11408
|
+
}
|
|
11409
|
+
for (const child of Object.values(value)) await validate(child);
|
|
11410
|
+
};
|
|
11411
|
+
await validate(document.blocks);
|
|
11412
|
+
await validate(document.metadata);
|
|
11413
|
+
if (this.destination !== void 0) {
|
|
11414
|
+
const destinationType = await inspect(fs, this.destination, ctx);
|
|
11415
|
+
if (destinationType !== void 0 && destinationType !== "directory") ctx.fail("E_IO", "Extraction destination is not a directory");
|
|
11416
|
+
}
|
|
11417
|
+
for (const [key, bytes] of embedded) {
|
|
11418
|
+
const entry = this.allocate(this.destination === void 0 ? "resource" : mediaKeyBasename(key, ctx), bytes);
|
|
11419
|
+
embeddedEntries.set(key, entry);
|
|
11420
|
+
if (embedImages) {
|
|
11421
|
+
const id = entry.path.split("/").map(encodeURIComponent).join("/");
|
|
11422
|
+
ctx.charge("references", 1);
|
|
11423
|
+
ctx.charge("retainedBytes", id.length * 2 + 64);
|
|
11424
|
+
imageResources.set(id, bytes);
|
|
11425
|
+
}
|
|
11426
|
+
}
|
|
11427
|
+
const visit5 = async (value, path) => {
|
|
11428
|
+
await ctx.cooperate();
|
|
11429
|
+
if (value === null || typeof value !== "object" || value instanceof Uint8Array) return value;
|
|
11430
|
+
if ("t" in value && value.t === "Image") {
|
|
11431
|
+
const image = value;
|
|
11432
|
+
const [url, title] = image.c[2];
|
|
11433
|
+
const origin = this.origins.get(image.c[2]) ?? {};
|
|
11434
|
+
const location = origin.source ? `${origin.source}:${path}` : path;
|
|
11435
|
+
const embeddedBytes = embedded.get(url);
|
|
11436
|
+
const target = embeddedBytes ? { name: url, suffix: "" } : localTarget(url, ctx);
|
|
11437
|
+
const roots = embeddedBytes ? [] : this.search ?? [resourceDirectory(origin.base ?? ctx.context.resourceCwd ?? "/")];
|
|
11438
|
+
let entry = embeddedEntries.get(url);
|
|
11439
|
+
for (const root of entry ? [] : roots) {
|
|
11440
|
+
const key = `${root === "/" ? "" : root}/${target.name}`;
|
|
11441
|
+
entry = this.bag.get(key);
|
|
11442
|
+
if (entry) break;
|
|
11443
|
+
const type = await inspect(fs, key, ctx);
|
|
11444
|
+
if (type === void 0) continue;
|
|
11445
|
+
if (type !== "file") ctx.fail("E_CAPABILITY", "Image resource is not a regular file");
|
|
11446
|
+
ctx.charge("resources", 1);
|
|
11447
|
+
const chunks = [];
|
|
11448
|
+
let length = 0;
|
|
11449
|
+
const readOptions = ctx.signal ? { signal: ctx.signal } : {};
|
|
11450
|
+
const producer = fs.readStream ? await ctx.call(async () => fs.readStream(key, readOptions)) : (async function* () {
|
|
11451
|
+
if (!fs.readFile) ctx.fail("E_CAPABILITY", "VFS requires explicit resource reads");
|
|
11452
|
+
let bytes2;
|
|
11453
|
+
const maxBytes = ctx.remaining("resourceBytes");
|
|
11454
|
+
try {
|
|
11455
|
+
bytes2 = await fs.readFile(key, { ...readOptions, ...maxBytes === Infinity ? {} : { maxBytes } });
|
|
11456
|
+
} catch (error) {
|
|
11457
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EFBIG") ctx.fail("E_LIMIT", "resourceBytes: VFS bounded read refused");
|
|
11458
|
+
throw error;
|
|
11459
|
+
}
|
|
11460
|
+
yield bytes2;
|
|
11461
|
+
})();
|
|
11462
|
+
await ctx.consume(producer, async (bytes2) => {
|
|
11463
|
+
ctx.charge("references", 1);
|
|
11464
|
+
chunks.push(bytes2);
|
|
11465
|
+
length += bytes2.length;
|
|
11466
|
+
}, ["resourceBytes"]);
|
|
11467
|
+
ctx.charge("retainedBytes", length);
|
|
11468
|
+
const bytes = new Uint8Array(length);
|
|
11469
|
+
let offset = 0;
|
|
11470
|
+
for (const chunk of chunks) {
|
|
11471
|
+
bytes.set(chunk, offset);
|
|
11472
|
+
offset += chunk.length;
|
|
11473
|
+
await ctx.cooperate();
|
|
11474
|
+
}
|
|
11475
|
+
entry = this.allocate(target.name.split("/").at(-1), bytes);
|
|
11476
|
+
this.bag.set(key, entry);
|
|
11477
|
+
break;
|
|
11478
|
+
}
|
|
11479
|
+
if (!entry) {
|
|
11480
|
+
if (!lossy) throw new PandocError("E_RESOURCE", ctx.operation, `Missing image resource: ${url}`, void 0, location);
|
|
11481
|
+
ctx.report({ code: "W_RESOURCE_MISSING", operation: ctx.operation, message: `Missing image resource: ${url}`, location });
|
|
11482
|
+
return image;
|
|
11483
|
+
}
|
|
11484
|
+
const outputUrl = entry.path.split("/").map(encodeURIComponent).join("/") + target.suffix;
|
|
11485
|
+
if (embedImages && !imageResources.has(outputUrl)) {
|
|
11486
|
+
ctx.charge("references", 1);
|
|
11487
|
+
ctx.charge("retainedBytes", outputUrl.length * 2 + 64);
|
|
11488
|
+
imageResources.set(outputUrl, entry.bytes);
|
|
11489
|
+
}
|
|
11490
|
+
return { ...image, c: [image.c[0], await visit5(image.c[1], `${path}.c[1]`), [outputUrl, title]] };
|
|
11491
|
+
}
|
|
11492
|
+
if (Array.isArray(value)) {
|
|
11493
|
+
const result2 = [];
|
|
11494
|
+
for (let i = 0; i < value.length; i++) result2.push(await visit5(value[i], `${path}[${i}]`));
|
|
11495
|
+
return result2;
|
|
11496
|
+
}
|
|
11497
|
+
const result = {};
|
|
11498
|
+
for (const [key, child] of Object.entries(value)) result[key] = await visit5(child, `${path}.${key}`);
|
|
11499
|
+
return result;
|
|
11500
|
+
};
|
|
11501
|
+
const prepared = { ...document, blocks: await visit5(document.blocks, "$.blocks"), metadata: await visit5(document.metadata, "$.metadata") };
|
|
11502
|
+
if (this.destination !== void 0) {
|
|
11503
|
+
for (const entry of this.plans) if (await inspect(fs, entry.path, ctx) !== void 0) ctx.fail("E_IO", `Extraction destination already exists: ${entry.path}`);
|
|
11504
|
+
}
|
|
11505
|
+
return embedImages ? { ...prepared, resources: [...imageResources].map(([id, bytes]) => ({ id, bytes })) } : prepared;
|
|
11506
|
+
}
|
|
11507
|
+
async publish() {
|
|
11508
|
+
if (this.destination === void 0 || !this.plans.length) return;
|
|
11509
|
+
const ctx = this.context;
|
|
11510
|
+
const fs = ctx.context.resourceFiles;
|
|
11511
|
+
const options = ctx.signal ? { signal: ctx.signal } : {};
|
|
11512
|
+
await ctx.call(() => fs.mkdir(this.destination, { ...options, recursive: true }));
|
|
11513
|
+
for (const entry of this.plans) {
|
|
11514
|
+
if (await inspect(fs, entry.path, ctx) !== void 0) ctx.fail("E_IO", "Extraction destination changed after preflight");
|
|
11515
|
+
await ctx.call(() => fs.writeFile(entry.path, entry.bytes, { ...options, flag: "wx" }));
|
|
11516
|
+
}
|
|
11517
|
+
}
|
|
11518
|
+
};
|
|
11519
|
+
function parseConversionArgs(args, files, signal, defaultInputs = []) {
|
|
11520
|
+
const options = {};
|
|
11521
|
+
const pdfFonts = [];
|
|
11522
|
+
const metadataJson = [];
|
|
11523
|
+
const metadataFiles = [];
|
|
11524
|
+
const operands = [];
|
|
11525
|
+
const variables = {};
|
|
11526
|
+
let destination2;
|
|
11527
|
+
let outputSeen = false;
|
|
11528
|
+
let yes = false;
|
|
11529
|
+
const names = /* @__PURE__ */ new Map([["-f", "from"], ["--from", "from"], ["-r", "from"], ["--read", "from"], ["-t", "to"], ["--to", "to"], ["-w", "to"], ["--write", "to"], ["--raw-content", "rawContent"], ["--wrap", "wrap"]]);
|
|
11530
|
+
const fail3 = (message) => {
|
|
11531
|
+
throw new PandocError("E_OPTION", "convert", message);
|
|
11532
|
+
};
|
|
11533
|
+
const source = (path, metadata2 = false) => {
|
|
11534
|
+
if (!files.readFile) fail3("File operands require an explicit readFile capability");
|
|
11535
|
+
const split = path.lastIndexOf("/");
|
|
11536
|
+
const base = resourceDirectory(split < 0 ? "." : path.slice(0, split) || "/", files.cwd ?? "/");
|
|
11537
|
+
return { source: path, base: metadata2 ? path : base, chunks: (async function* () {
|
|
11538
|
+
yield await files.readFile(path, signal);
|
|
11539
|
+
})() };
|
|
11540
|
+
};
|
|
11541
|
+
let positional = false;
|
|
11542
|
+
let stdinUsed = false;
|
|
11543
|
+
for (let i = 0; i < args.length; i++) {
|
|
11544
|
+
let arg = args[i];
|
|
11545
|
+
if (!positional && arg === "--yes") {
|
|
11546
|
+
if (yes) fail3("Repeated option: --yes");
|
|
11547
|
+
yes = true;
|
|
11548
|
+
continue;
|
|
11549
|
+
}
|
|
11550
|
+
if (!positional && (arg === "--file-scope" || arg === "--sandbox")) {
|
|
11551
|
+
options[arg === "--file-scope" ? "fileScope" : "sandbox"] = true;
|
|
11552
|
+
continue;
|
|
11553
|
+
}
|
|
11554
|
+
if (arg === "--" && !positional) {
|
|
11555
|
+
positional = true;
|
|
11556
|
+
continue;
|
|
11557
|
+
}
|
|
11558
|
+
if (arg === "-") {
|
|
11559
|
+
if (stdinUsed || !files.stdin) fail3("Stdin may be supplied once");
|
|
11560
|
+
stdinUsed = true;
|
|
11561
|
+
operands.push({ chunks: files.stdin, source: "stdin" });
|
|
11562
|
+
continue;
|
|
11563
|
+
}
|
|
11564
|
+
if (positional || !arg.startsWith("-")) {
|
|
11565
|
+
operands.push(source(arg));
|
|
11566
|
+
continue;
|
|
11567
|
+
}
|
|
11568
|
+
if (arg.length > 2 && ["-f", "-r", "-t", "-w", "-o", "-F", "-L", "-H", "-B", "-A"].includes(arg.slice(0, 2)) && arg[2] !== "=")
|
|
11569
|
+
arg = `${arg.slice(0, 2)}=${arg.slice(2)}`;
|
|
11570
|
+
if (arg === "--lossy" || arg === "--standalone" || arg === "-s" || arg === "--fail-if-warnings") {
|
|
11571
|
+
const key2 = arg === "--lossy" ? "lossy" : arg === "--fail-if-warnings" ? "failIfWarnings" : "standalone";
|
|
11572
|
+
if (options[key2] !== void 0) fail3(`Repeated option: ${arg}`);
|
|
11573
|
+
options[key2] = true;
|
|
11574
|
+
continue;
|
|
11575
|
+
}
|
|
11576
|
+
const equals = arg.indexOf("=");
|
|
11577
|
+
const name = equals < 0 ? arg : arg.slice(0, equals);
|
|
11578
|
+
const filterKind = (/* @__PURE__ */ new Map([["--filter", "json"], ["-F", "json"], ["--lua-filter", "lua"], ["-L", "lua"], ["--citeproc", "citeproc"], ["-C", "citeproc"]])).get(name);
|
|
11579
|
+
if (filterKind) {
|
|
11580
|
+
if (filterKind === "citeproc") {
|
|
11581
|
+
if (equals >= 0) fail3(`Unexpected value: ${name}`);
|
|
11582
|
+
options.filters = [...options.filters ?? [], { kind: filterKind }];
|
|
11583
|
+
} else {
|
|
11584
|
+
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11585
|
+
if (!path || path.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
11586
|
+
options.filters = [...options.filters ?? [], { kind: filterKind, path }];
|
|
11587
|
+
}
|
|
11588
|
+
continue;
|
|
11589
|
+
}
|
|
11590
|
+
const writerOption = (/* @__PURE__ */ new Map([["--columns", "columns"], ["--shift-heading-level-by", "shiftHeadingLevelBy"], ["--eol", "eol"], ["--number-sections", "numberSections"], ["-N", "numberSections"], ["--toc", "toc"], ["--table-of-contents", "toc"], ["--strip-comments", "stripComments"], ["--ascii", "ascii"], ["--standalone", "standalone"]])).get(name);
|
|
11591
|
+
if (writerOption) {
|
|
11592
|
+
const boolean = ["numberSections", "toc", "stripComments", "ascii", "standalone"].includes(writerOption);
|
|
11593
|
+
const value2 = equals < 0 ? boolean ? "true" : args[++i] : arg.slice(equals + 1);
|
|
11594
|
+
if (value2 === void 0 || value2 === "") fail3(`Missing value: ${name}`);
|
|
11595
|
+
if (boolean && value2 !== "true" && value2 !== "false") fail3(`Invalid boolean: ${name}`);
|
|
11596
|
+
if (Object.hasOwn(options, writerOption)) fail3(`Repeated option: ${name}`);
|
|
11597
|
+
Object.assign(options, { [writerOption]: boolean ? value2 === "true" : ["columns", "shiftHeadingLevelBy"].includes(writerOption) ? Number(value2) : value2 });
|
|
11598
|
+
continue;
|
|
11599
|
+
}
|
|
11600
|
+
const local = (/* @__PURE__ */ new Map([["--template", "template"], ["--include-in-header", "includeInHeader"], ["-H", "includeInHeader"], ["--include-before-body", "includeBeforeBody"], ["-B", "includeBeforeBody"], ["--include-after-body", "includeAfterBody"], ["-A", "includeAfterBody"]])).get(name);
|
|
11601
|
+
if (local) {
|
|
11602
|
+
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11603
|
+
if (!path || path.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
11604
|
+
if (local === "template") {
|
|
11605
|
+
if (options.template) fail3("Repeated template option");
|
|
11606
|
+
options.template = source(path);
|
|
11607
|
+
} else options[local] = [...options[local] ?? [], source(path)];
|
|
11608
|
+
continue;
|
|
11609
|
+
}
|
|
11610
|
+
if (name === "--variable" || name === "--variable-json" || arg.startsWith("-V")) {
|
|
11611
|
+
const value2 = arg === "-V" || equals < 0 && !arg.startsWith("-V") ? args[++i] : arg.startsWith("-V") ? arg.slice(2) : arg.slice(equals + 1);
|
|
11612
|
+
if (!value2) fail3("Missing variable value");
|
|
11613
|
+
const split = Math.min(...[value2.indexOf("="), value2.indexOf(":")].filter((n) => n >= 0));
|
|
11614
|
+
const key2 = Number.isFinite(split) ? value2.slice(0, split) : value2;
|
|
11615
|
+
if (!key2 || ["__proto__", "constructor", "prototype"].includes(key2) || [...key2].some((ch) => !(ch >= "a" && ch <= "z") && !(ch >= "A" && ch <= "Z") && !(ch >= "0" && ch <= "9") && !"_-".includes(ch))) fail3("Invalid variable key");
|
|
11616
|
+
let content = Number.isFinite(split) ? value2.slice(split + 1) : true;
|
|
11617
|
+
if (name === "--variable-json") {
|
|
11618
|
+
try {
|
|
11619
|
+
content = JSON.parse(String(content));
|
|
11620
|
+
} catch {
|
|
11621
|
+
fail3("Invalid JSON variable value");
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
if (Object.hasOwn(variables, key2)) {
|
|
11625
|
+
const previous = variables[key2];
|
|
11626
|
+
variables[key2] = [...Array.isArray(previous) ? previous : [previous], content];
|
|
11627
|
+
} else variables[key2] = content;
|
|
11628
|
+
options.variables = variables;
|
|
11629
|
+
continue;
|
|
11630
|
+
}
|
|
11631
|
+
if (name === "--pdf-engine") fail3("External PDF engines are forbidden; use the built-in TypeScript PDF writer");
|
|
11632
|
+
const publication = (/* @__PURE__ */ new Map([
|
|
11633
|
+
["--pdf-page-size", ["pdf", "pageSize"]],
|
|
11634
|
+
["--pdf-orientation", ["pdf", "orientation"]],
|
|
11635
|
+
["--pdf-margin", ["pdf", "margin"]],
|
|
11636
|
+
["--pdf-font-size", ["pdf", "fontSize"]],
|
|
11637
|
+
["--pdf-line-height", ["pdf", "lineHeight"]],
|
|
11638
|
+
["--epub-title", ["epub", "title"]],
|
|
11639
|
+
["--epub-language", ["epub", "language"]],
|
|
11640
|
+
["--epub-identifier", ["epub", "identifier"]],
|
|
11641
|
+
["--epub-chapter-level", ["epub", "chapterLevel"]]
|
|
11642
|
+
])).get(name);
|
|
11643
|
+
if (publication) {
|
|
11644
|
+
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11645
|
+
if (!value2) fail3(`Missing value: ${name}`);
|
|
11646
|
+
const [kind, key2] = publication;
|
|
11647
|
+
const numeric = ["margin", "fontSize", "lineHeight", "chapterLevel"].includes(key2);
|
|
11648
|
+
const entry = numeric ? Number(value2) : value2;
|
|
11649
|
+
options[kind] = { ...options[kind], [key2]: entry };
|
|
11650
|
+
continue;
|
|
11651
|
+
}
|
|
11652
|
+
if (name === "--pdf-font" || name === "--pdf-page") {
|
|
11653
|
+
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11654
|
+
if (!value2 || value2.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
11655
|
+
if (name === "--pdf-font") {
|
|
11656
|
+
if (["serif", "sans", "mono"].includes(value2)) options.pdf = { ...options.pdf, font: value2 };
|
|
11657
|
+
else pdfFonts.push(source(value2));
|
|
11658
|
+
} else {
|
|
11659
|
+
if (options.pdfPage !== void 0) fail3("Repeated pdf-page option");
|
|
11660
|
+
const parts = value2.split(",");
|
|
11661
|
+
if (parts.length !== 3 || parts.some((part) => !part.trim() || !Number.isFinite(Number(part)))) fail3("pdf-page requires WIDTH,HEIGHT,MARGIN in points");
|
|
11662
|
+
options.pdfPage = { width: Number(parts[0]), height: Number(parts[1]), margin: Number(parts[2]) };
|
|
11663
|
+
}
|
|
11664
|
+
continue;
|
|
11665
|
+
}
|
|
11666
|
+
if (name === "--resource-path" || name === "--extract-media") {
|
|
11667
|
+
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11668
|
+
if (!value2 || value2.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
11669
|
+
if (name === "--resource-path") {
|
|
11670
|
+
const paths = value2.split(":");
|
|
11671
|
+
if (paths.some((path) => !path)) fail3("Empty resource-path directory");
|
|
11672
|
+
options.resourcePath = paths;
|
|
11673
|
+
} else {
|
|
11674
|
+
if (options.extractMedia !== void 0) fail3("Repeated extract-media option");
|
|
11675
|
+
options.extractMedia = value2;
|
|
11676
|
+
}
|
|
11677
|
+
continue;
|
|
11678
|
+
}
|
|
11679
|
+
if (name === "--metadata-file") {
|
|
11680
|
+
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11681
|
+
if (!path || !path.endsWith(".json")) fail3("Metadata files must use .json; YAML is unsupported");
|
|
11682
|
+
metadataFiles.push(source(path, true));
|
|
11683
|
+
continue;
|
|
11684
|
+
}
|
|
11685
|
+
if (name === "-o" || name === "--output") {
|
|
11686
|
+
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11687
|
+
if (!path || outputSeen || path !== "-" && !files.writeFile) fail3("Output requires one path and an explicit writeFile capability");
|
|
11688
|
+
outputSeen = true;
|
|
11689
|
+
destination2 = path === "-" ? void 0 : path;
|
|
11690
|
+
continue;
|
|
11691
|
+
}
|
|
11692
|
+
if (arg === "--metadata" || arg.startsWith("--metadata=") || arg.startsWith("-M")) {
|
|
11693
|
+
const value2 = arg === "--metadata" || arg === "-M" ? args[++i] : arg.startsWith("--metadata=") ? arg.slice(11) : arg.slice(2);
|
|
11694
|
+
if (value2 === void 0) fail3("Missing metadata value");
|
|
11695
|
+
const split = Math.min(...[value2.indexOf("="), value2.indexOf(":")].filter((n) => n >= 0));
|
|
11696
|
+
if (split < 1 || value2 === "") fail3("Metadata requires a key");
|
|
11697
|
+
const key2 = Number.isFinite(split) ? value2.slice(0, split) : value2;
|
|
11698
|
+
if (["__proto__", "constructor", "prototype"].includes(key2) || [...key2].some((ch) => !(ch >= "a" && ch <= "z") && !(ch >= "A" && ch <= "Z") && !(ch >= "0" && ch <= "9") && ch !== "-" && ch !== "_")) fail3("Invalid metadata key");
|
|
11699
|
+
const content = Number.isFinite(split) ? value2.slice(split + 1) : "true";
|
|
11700
|
+
if (content.startsWith("{") || content.startsWith("[") || content.startsWith('"') || ["true", "false", "null"].includes(content)) {
|
|
11701
|
+
let parsed;
|
|
11702
|
+
try {
|
|
11703
|
+
parsed = JSON.parse(content);
|
|
11704
|
+
} catch {
|
|
11705
|
+
fail3("Invalid JSON metadata value");
|
|
11706
|
+
}
|
|
11707
|
+
metadataJson.push({ [key2]: parsed });
|
|
11708
|
+
} else {
|
|
11709
|
+
metadataJson.push({ [key2]: content });
|
|
11710
|
+
}
|
|
11711
|
+
continue;
|
|
11712
|
+
}
|
|
11713
|
+
const key = names.get(name);
|
|
11714
|
+
if (!key) fail3(`Unsupported option: ${name}`);
|
|
11715
|
+
if (options[key] !== void 0) fail3(`Repeated option: ${name}`);
|
|
11716
|
+
const value = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
11717
|
+
if (!value || value.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
11718
|
+
if (key === "wrap") {
|
|
11719
|
+
if (!["none", "auto", "preserve"].includes(value)) fail3("Invalid wrap policy");
|
|
11720
|
+
options.wrap = value;
|
|
11721
|
+
} else if (key === "rawContent") {
|
|
11722
|
+
if (value !== "reject" && value !== "escape" && value !== "retain") fail3("Invalid raw-content policy");
|
|
11723
|
+
options.rawContent = value;
|
|
11724
|
+
} else if (key === "from" || key === "to") options[key] = value;
|
|
11725
|
+
}
|
|
11726
|
+
if (!operands.length) for (const path of defaultInputs) {
|
|
11727
|
+
if (path === "-") {
|
|
11728
|
+
if (stdinUsed || !files.stdin) fail3("Stdin may be supplied once");
|
|
11729
|
+
stdinUsed = true;
|
|
11730
|
+
operands.push({ source: "stdin", chunks: files.stdin });
|
|
11731
|
+
} else operands.push(source(path));
|
|
11732
|
+
}
|
|
11733
|
+
const registry = createFormatRegistry();
|
|
11734
|
+
if (!options.from) {
|
|
11735
|
+
const hints = new Set(operands.filter((input) => input.source !== "stdin" && input.source !== void 0).map((input) => {
|
|
11736
|
+
const path = input.source;
|
|
11737
|
+
return path.lastIndexOf(".") > path.lastIndexOf("/") ? registry.infer(path, "read") : void 0;
|
|
11738
|
+
}).filter((hint) => hint !== void 0));
|
|
11739
|
+
if (hints.size > 1) fail3("Conflicting input suffixes; select -f explicitly");
|
|
11740
|
+
options.from = hints.values().next().value ?? "commonmark";
|
|
11741
|
+
}
|
|
11742
|
+
if (!options.to) options.to = destination2 !== void 0 && destination2.lastIndexOf(".") > destination2.lastIndexOf("/") ? registry.infer(destination2, "write") : "html5";
|
|
11743
|
+
if (destination2 !== void 0 && options.extractMedia !== void 0) {
|
|
11744
|
+
const output = resourceDirectory(destination2, files.cwd ?? "/");
|
|
11745
|
+
const media = resourceDirectory(options.extractMedia, files.cwd ?? "/");
|
|
11746
|
+
if (output === media || media === "/" || output.startsWith(`${media}/`)) fail3("Output cannot be inside the extraction directory");
|
|
11747
|
+
}
|
|
11748
|
+
return { options: { lossy: true, ...options, from: options.from, to: options.to, ...yes ? { yes: true } : {}, ...pdfFonts.length ? { pdfFonts } : {}, ...metadataJson.length ? { metadataJson } : {}, ...metadataFiles.length ? { metadataFiles } : {} }, operands: operands.length ? operands : void 0, ...destination2 === void 0 ? {} : { destination: destination2 } };
|
|
11749
|
+
}
|
|
11750
|
+
function fail2(path, message = "Invalid shape") {
|
|
11751
|
+
throw new AstError("E_AST", path, message);
|
|
11752
|
+
}
|
|
11753
|
+
var str = (v, p) => {
|
|
11754
|
+
if (typeof v !== "string") fail2(p);
|
|
11755
|
+
};
|
|
11756
|
+
var integer = (v, p) => {
|
|
11757
|
+
if (typeof v !== "number" || !Number.isSafeInteger(v)) fail2(p);
|
|
11758
|
+
};
|
|
11759
|
+
var positive = (v, p) => {
|
|
11760
|
+
integer(v, p);
|
|
11761
|
+
if (typeof v !== "number" || v < 1) fail2(p, "Invalid span or level");
|
|
11762
|
+
};
|
|
11763
|
+
var choice = (...values) => (v, p) => {
|
|
11764
|
+
if (typeof v !== "string" || !values.includes(v)) fail2(p);
|
|
11765
|
+
};
|
|
11766
|
+
var array = (check) => (v, p) => {
|
|
11767
|
+
if (!Array.isArray(v)) fail2(p);
|
|
11768
|
+
else v.forEach((x, i) => check(x, `${p}[${i}]`));
|
|
11769
|
+
};
|
|
11770
|
+
var tuple2 = (...checks) => (v, p) => {
|
|
11771
|
+
if (!Array.isArray(v) || v.length !== checks.length) fail2(p);
|
|
11772
|
+
else checks.forEach((check, i) => check(v[i], `${p}[${i}]`));
|
|
11773
|
+
};
|
|
11774
|
+
function record2(v, p) {
|
|
11775
|
+
if (v === null || typeof v !== "object" || Array.isArray(v) || Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null)
|
|
11776
|
+
fail2(p);
|
|
11777
|
+
return v;
|
|
11778
|
+
}
|
|
11779
|
+
var attr4 = tuple2(str, array(str), array(tuple2(str, str)));
|
|
11780
|
+
var align = choice("AlignLeft", "AlignRight", "AlignCenter", "AlignDefault");
|
|
11781
|
+
function tagged(shapes) {
|
|
11782
|
+
return (v, p) => {
|
|
11783
|
+
const r = record2(v, p);
|
|
11784
|
+
if (typeof r.t !== "string" || !Object.hasOwn(shapes, r.t)) fail2(`${p}.t`, "Unknown tag");
|
|
11785
|
+
const check = shapes[r.t];
|
|
11786
|
+
if (Object.keys(r).some((k) => k !== "t" && k !== "c") || (check === null ? Object.hasOwn(r, "c") : !Object.hasOwn(r, "c")))
|
|
11787
|
+
fail2(p);
|
|
11788
|
+
if (check) check(r.c, `${p}.c`);
|
|
11789
|
+
};
|
|
11790
|
+
}
|
|
11791
|
+
var inlines = (v, p) => array(inline2)(v, p);
|
|
11792
|
+
var blocks2 = (v, p) => array(block)(v, p);
|
|
11793
|
+
var caption = tuple2((v, p) => {
|
|
11794
|
+
if (v !== null) inlines(v, p);
|
|
11795
|
+
}, blocks2);
|
|
11796
|
+
var cell = tuple2(attr4, align, positive, positive, blocks2);
|
|
11797
|
+
var row = tuple2(attr4, array(cell));
|
|
11798
|
+
var head = tuple2(attr4, array(row));
|
|
11799
|
+
var finite = (v, p) => {
|
|
11800
|
+
if (typeof v !== "number" || !Number.isFinite(v) || v <= 0 || v > 1) fail2(p);
|
|
11801
|
+
};
|
|
11802
|
+
var citation = (v, p) => {
|
|
11803
|
+
const r = record2(v, p);
|
|
11804
|
+
const checks = {
|
|
11805
|
+
citationId: str,
|
|
11806
|
+
citationPrefix: inlines,
|
|
11807
|
+
citationSuffix: inlines,
|
|
11808
|
+
citationMode: choice("AuthorInText", "SuppressAuthor", "NormalCitation"),
|
|
11809
|
+
citationNoteNum: integer,
|
|
11810
|
+
citationHash: integer
|
|
11811
|
+
};
|
|
11812
|
+
if (Object.keys(r).length !== 6) fail2(p);
|
|
11813
|
+
for (const [k, check] of Object.entries(checks)) check(r[k], `${p}.${k}`);
|
|
11814
|
+
};
|
|
11815
|
+
var inline2 = tagged({
|
|
11816
|
+
Str: str,
|
|
11817
|
+
Space: null,
|
|
11818
|
+
SoftBreak: null,
|
|
11819
|
+
LineBreak: null,
|
|
11820
|
+
Emph: inlines,
|
|
11821
|
+
Underline: inlines,
|
|
11822
|
+
Strong: inlines,
|
|
11823
|
+
Strikeout: inlines,
|
|
11824
|
+
Superscript: inlines,
|
|
11825
|
+
Subscript: inlines,
|
|
11826
|
+
SmallCaps: inlines,
|
|
11827
|
+
Quoted: tuple2(choice("SingleQuote", "DoubleQuote"), inlines),
|
|
11828
|
+
Cite: tuple2(array(citation), inlines),
|
|
11829
|
+
Code: tuple2(attr4, str),
|
|
11830
|
+
Math: tuple2(choice("InlineMath", "DisplayMath"), str),
|
|
11831
|
+
RawInline: tuple2(str, str),
|
|
11832
|
+
Link: tuple2(attr4, inlines, tuple2(str, str)),
|
|
11833
|
+
Image: tuple2(attr4, inlines, tuple2(str, str)),
|
|
11834
|
+
Note: blocks2,
|
|
11835
|
+
Span: tuple2(attr4, inlines)
|
|
11836
|
+
});
|
|
11837
|
+
var tableShape = tuple2(
|
|
11838
|
+
attr4,
|
|
11839
|
+
caption,
|
|
11840
|
+
array(tuple2(align, tagged({ ColWidthDefault: null, ColWidth: finite }))),
|
|
11841
|
+
head,
|
|
11842
|
+
array(tuple2(attr4, integer, array(row), array(row))),
|
|
11843
|
+
head
|
|
11844
|
+
);
|
|
11845
|
+
var block = tagged({
|
|
11846
|
+
Plain: inlines,
|
|
11847
|
+
Para: inlines,
|
|
11848
|
+
LineBlock: array(inlines),
|
|
11849
|
+
CodeBlock: tuple2(attr4, str),
|
|
11850
|
+
RawBlock: tuple2(str, str),
|
|
11851
|
+
BlockQuote: blocks2,
|
|
11852
|
+
OrderedList: tuple2(
|
|
11853
|
+
tuple2(
|
|
11854
|
+
integer,
|
|
11855
|
+
choice(
|
|
11856
|
+
"DefaultStyle",
|
|
11857
|
+
"Example",
|
|
11858
|
+
"Decimal",
|
|
11859
|
+
"LowerRoman",
|
|
11860
|
+
"UpperRoman",
|
|
11861
|
+
"LowerAlpha",
|
|
11862
|
+
"UpperAlpha"
|
|
11863
|
+
),
|
|
11864
|
+
choice("DefaultDelim", "Period", "OneParen", "TwoParens")
|
|
11865
|
+
),
|
|
11866
|
+
array(blocks2)
|
|
11867
|
+
),
|
|
11868
|
+
BulletList: array(blocks2),
|
|
11869
|
+
DefinitionList: array(tuple2(inlines, array(blocks2))),
|
|
11870
|
+
Header: tuple2(positive, attr4, inlines),
|
|
11871
|
+
HorizontalRule: null,
|
|
11872
|
+
Div: tuple2(attr4, blocks2),
|
|
11873
|
+
Figure: tuple2(attr4, caption, blocks2),
|
|
11874
|
+
Table: tableShape
|
|
11875
|
+
});
|
|
11876
|
+
var metadata = (v, p) => {
|
|
11877
|
+
for (const [k, x] of Object.entries(record2(v, p))) meta(x, `${p}.${k}`);
|
|
11878
|
+
};
|
|
11879
|
+
var meta = tagged({
|
|
11880
|
+
MetaMap: metadata,
|
|
11881
|
+
MetaList: (v, p) => array(meta)(v, p),
|
|
11882
|
+
MetaBool: (v, p) => {
|
|
11883
|
+
if (typeof v !== "boolean") fail2(p);
|
|
11884
|
+
},
|
|
11885
|
+
MetaString: str,
|
|
11886
|
+
MetaInlines: inlines,
|
|
11887
|
+
MetaBlocks: blocks2
|
|
11888
|
+
});
|
|
11889
|
+
function validateDocument(value) {
|
|
11890
|
+
const r = record2(value, "$");
|
|
11891
|
+
if (Object.keys(r).some(
|
|
11892
|
+
(k) => !["blocks", "metadata", "resources", "language", "direction"].includes(k)
|
|
11893
|
+
))
|
|
11894
|
+
fail2("$");
|
|
11895
|
+
blocks2(r.blocks, "$.blocks");
|
|
11896
|
+
metadata(r.metadata, "$.metadata");
|
|
11897
|
+
if (Object.hasOwn(r, "language")) str(r.language, "$.language");
|
|
11898
|
+
if (Object.hasOwn(r, "direction")) choice("ltr", "rtl", "auto")(r.direction, "$.direction");
|
|
11899
|
+
array((v, p) => {
|
|
11900
|
+
const resource = record2(v, p);
|
|
11901
|
+
if (Object.keys(resource).length !== 2 || !(resource.bytes instanceof Uint8Array)) fail2(p);
|
|
11902
|
+
str(resource.id, `${p}.id`);
|
|
11903
|
+
})(r.resources, "$.resources");
|
|
11904
|
+
}
|
|
11905
|
+
function* normalization(value, options, reserve, cooperate) {
|
|
11906
|
+
const ceilings = {
|
|
11907
|
+
depth: Infinity,
|
|
11908
|
+
nodes: Infinity,
|
|
11909
|
+
text: Infinity,
|
|
11910
|
+
attributes: Infinity,
|
|
11911
|
+
tableCells: Infinity,
|
|
11912
|
+
references: Infinity,
|
|
11913
|
+
resourceBytes: Infinity
|
|
11914
|
+
};
|
|
11915
|
+
const limits = { ...ceilings, ...options };
|
|
11916
|
+
for (const [k, n] of Object.entries(limits))
|
|
11917
|
+
if (!Object.hasOwn(ceilings, k) || n !== Infinity && !Number.isSafeInteger(n) || n < 0)
|
|
11918
|
+
fail2(`$.limits.${k}`);
|
|
11919
|
+
let nodes = 0, text = 0, attributes = 0, cells = 0, references = 0, resourceBytes = 0, hasTable = false;
|
|
11920
|
+
const active = /* @__PURE__ */ new Set();
|
|
11921
|
+
const bound = (n, ceiling, p) => {
|
|
11922
|
+
if (!Number.isSafeInteger(n) || n > ceiling) throw new AstError("E_LIMIT", p, "AST budget exceeded");
|
|
11923
|
+
};
|
|
11924
|
+
function checkStringBody(v, p, depth) {
|
|
11925
|
+
bound(depth, limits.depth, p);
|
|
11926
|
+
bound(++nodes, limits.nodes, p);
|
|
11927
|
+
reserve("nodes", 1);
|
|
11928
|
+
bound(text += v.length, limits.text, p);
|
|
11929
|
+
reserve("text", v.length);
|
|
11930
|
+
}
|
|
11931
|
+
const stack = [{ kind: "node", v: value, p: "$", depth: 0 }];
|
|
11932
|
+
while (stack.length > 0) {
|
|
11933
|
+
const frame = stack[stack.length - 1];
|
|
11934
|
+
if (frame.kind === "arr") {
|
|
11935
|
+
if (frame.idx < frame.elemValues.length) {
|
|
11936
|
+
const i = frame.idx++;
|
|
11937
|
+
stack.push({ kind: "node", v: frame.elemValues[i], p: `${frame.p}[${i}]`, depth: frame.depth + 1 });
|
|
11938
|
+
} else {
|
|
11939
|
+
stack.pop();
|
|
11940
|
+
if (Object.keys(frame.v).length !== frame.v.length) fail2(frame.p);
|
|
11941
|
+
active.delete(frame.v);
|
|
11942
|
+
}
|
|
11943
|
+
continue;
|
|
11944
|
+
}
|
|
11945
|
+
if (frame.kind === "obj") {
|
|
11946
|
+
if (frame.idx < frame.keys.length) {
|
|
11947
|
+
const k = frame.keys[frame.idx++];
|
|
11948
|
+
checkStringBody(k, frame.p, frame.depth + 1);
|
|
11949
|
+
if (cooperate) {
|
|
11950
|
+
const c = cooperate(1);
|
|
11951
|
+
if (c) yield c;
|
|
11952
|
+
}
|
|
11953
|
+
for (let i = 0; i < k.length; i++) {
|
|
11954
|
+
if (i % 256 === 0 && cooperate) {
|
|
11955
|
+
const c = cooperate(1);
|
|
11956
|
+
if (c) yield c;
|
|
11957
|
+
}
|
|
11958
|
+
const ch = k.charCodeAt(i);
|
|
11959
|
+
if (ch >= 55296 && ch <= 56319) {
|
|
11960
|
+
const next = k.charCodeAt(++i);
|
|
11961
|
+
if (!(next >= 56320 && next <= 57343)) fail2(frame.p, "Invalid Unicode");
|
|
11962
|
+
} else if (ch >= 56320 && ch <= 57343) fail2(frame.p, "Invalid Unicode");
|
|
11963
|
+
}
|
|
11964
|
+
if (!Object.hasOwn(frame.v, k)) fail2(frame.p);
|
|
11965
|
+
const d = Object.getOwnPropertyDescriptor(frame.v, k);
|
|
11966
|
+
if (!d || !d.enumerable || !("value" in d) || ["__proto__", "constructor", "prototype"].includes(k))
|
|
11967
|
+
fail2(`${frame.p}.${k}`);
|
|
11968
|
+
if (k === "t" && d.value === "Table") hasTable = true;
|
|
11969
|
+
stack.push({ kind: "node", v: d.value, p: `${frame.p}.${k}`, depth: frame.depth + 1 });
|
|
11970
|
+
} else {
|
|
11971
|
+
stack.pop();
|
|
11972
|
+
if (Object.getOwnPropertySymbols(frame.v).length) fail2(frame.p);
|
|
11973
|
+
active.delete(frame.v);
|
|
11974
|
+
}
|
|
11975
|
+
continue;
|
|
11976
|
+
}
|
|
11977
|
+
stack.pop();
|
|
11978
|
+
const { v, p, depth } = frame;
|
|
11979
|
+
if (typeof v === "string") {
|
|
11980
|
+
checkStringBody(v, p, depth);
|
|
11981
|
+
if (cooperate) {
|
|
11982
|
+
const c = cooperate(1);
|
|
11983
|
+
if (c) yield c;
|
|
11984
|
+
}
|
|
11985
|
+
for (let i = 0; i < v.length; i++) {
|
|
11986
|
+
if (i % 256 === 0 && cooperate) {
|
|
11987
|
+
const c = cooperate(1);
|
|
11988
|
+
if (c) yield c;
|
|
11989
|
+
}
|
|
11990
|
+
const ch = v.charCodeAt(i);
|
|
11991
|
+
if (ch >= 55296 && ch <= 56319) {
|
|
11992
|
+
const next = v.charCodeAt(++i);
|
|
11993
|
+
if (!(next >= 56320 && next <= 57343)) fail2(p, "Invalid Unicode");
|
|
11994
|
+
} else if (ch >= 56320 && ch <= 57343) fail2(p, "Invalid Unicode");
|
|
11995
|
+
}
|
|
11996
|
+
continue;
|
|
11997
|
+
}
|
|
11998
|
+
bound(depth, limits.depth, p);
|
|
11999
|
+
bound(++nodes, limits.nodes, p);
|
|
12000
|
+
reserve("nodes", 1);
|
|
12001
|
+
if (cooperate) {
|
|
12002
|
+
const c = cooperate(1);
|
|
12003
|
+
if (c) yield c;
|
|
12004
|
+
}
|
|
12005
|
+
if (v === null || typeof v === "boolean") continue;
|
|
12006
|
+
if (typeof v === "number") {
|
|
12007
|
+
if (!Number.isFinite(v)) fail2(p);
|
|
12008
|
+
continue;
|
|
12009
|
+
}
|
|
12010
|
+
if (typeof v !== "object" || active.has(v)) fail2(p, "Non-JSON or cyclic input");
|
|
12011
|
+
if (v instanceof Uint8Array && p.startsWith("$.resources[") && p.endsWith(".bytes")) {
|
|
12012
|
+
bound(resourceBytes += v.byteLength, limits.resourceBytes, p);
|
|
12013
|
+
reserve("resourceBytes", v.byteLength);
|
|
12014
|
+
continue;
|
|
12015
|
+
}
|
|
12016
|
+
active.add(v);
|
|
12017
|
+
if (Array.isArray(v)) {
|
|
12018
|
+
bound(nodes + v.length, limits.nodes, p);
|
|
12019
|
+
if (Object.getOwnPropertySymbols(v).length) fail2(p);
|
|
12020
|
+
const elemValues = new Array(v.length);
|
|
12021
|
+
for (let i = 0; i < v.length; i++) {
|
|
12022
|
+
const d = Object.getOwnPropertyDescriptor(v, i);
|
|
12023
|
+
if (!d || !("value" in d)) fail2(`${p}[${i}]`, "Accessor or sparse array");
|
|
12024
|
+
elemValues[i] = d.value;
|
|
12025
|
+
if (cooperate) {
|
|
12026
|
+
const c = cooperate(1);
|
|
12027
|
+
if (c) yield c;
|
|
11284
12028
|
}
|
|
11285
|
-
rows.push([attr4, row2]);
|
|
11286
12029
|
}
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
12030
|
+
if (v.length === 3 && typeof elemValues[0] === "string" && Array.isArray(elemValues[1]) && Array.isArray(elemValues[2])) {
|
|
12031
|
+
const count = 1 + elemValues[1].length + elemValues[2].length;
|
|
12032
|
+
bound(attributes += count, limits.attributes, p);
|
|
12033
|
+
reserve("attributes", count);
|
|
12034
|
+
}
|
|
12035
|
+
if (v.length === 5 && Array.isArray(elemValues[0]) && typeof elemValues[1] === "string") {
|
|
12036
|
+
if (typeof elemValues[2] !== "number" || typeof elemValues[3] !== "number" || !Number.isSafeInteger(elemValues[2]) || !Number.isSafeInteger(elemValues[3]) || elemValues[2] < 1 || elemValues[3] < 1)
|
|
12037
|
+
fail2(p, "Invalid spans");
|
|
12038
|
+
bound(cells += elemValues[2] * elemValues[3], limits.tableCells, p);
|
|
12039
|
+
reserve("tableCells", elemValues[2] * elemValues[3]);
|
|
12040
|
+
bound(references += elemValues[2] * elemValues[3], limits.references, p);
|
|
12041
|
+
reserve("references", elemValues[2] * elemValues[3]);
|
|
12042
|
+
}
|
|
12043
|
+
stack.push({ kind: "arr", v, elemValues, idx: 0, p, depth });
|
|
12044
|
+
} else {
|
|
12045
|
+
const keys = Object.getOwnPropertyNames(v);
|
|
12046
|
+
stack.push({ kind: "obj", v, keys, idx: 0, p, depth });
|
|
11290
12047
|
}
|
|
11291
|
-
return { blocks: blocks3, metadata: {}, resources: [] };
|
|
11292
|
-
} catch (error) {
|
|
11293
|
-
if (error instanceof PandocError) throw error;
|
|
11294
|
-
if (ctx.signal?.aborted) ctx.signal.throwIfAborted();
|
|
11295
|
-
const code = error.code;
|
|
11296
|
-
throw new PandocError(code === "resource-limit" ? "E_LIMIT" : code === "unsupported-feature" ? "E_UNSUPPORTED_FEATURE" : "E_PARSE", "read", error instanceof Error ? error.message : "Invalid XLSX", "xlsx");
|
|
11297
|
-
}
|
|
11298
|
-
} };
|
|
11299
|
-
var xlsx_default = {
|
|
11300
|
-
reader: xlsxReader,
|
|
11301
|
-
name: "xlsx",
|
|
11302
|
-
read: true,
|
|
11303
|
-
write: false,
|
|
11304
|
-
media: "binary",
|
|
11305
|
-
inputEncoding: "bytes",
|
|
11306
|
-
suffixes: ["xlsx"],
|
|
11307
|
-
extensions: {},
|
|
11308
|
-
options: {
|
|
11309
|
-
read: [],
|
|
11310
|
-
write: []
|
|
11311
12048
|
}
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
pdf_default,
|
|
11327
|
-
docx_default,
|
|
11328
|
-
odt_default,
|
|
11329
|
-
pptx_default,
|
|
11330
|
-
xlsx_default
|
|
11331
|
-
];
|
|
11332
|
-
var compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
11333
|
-
function validName(name) {
|
|
11334
|
-
if (!name) return false;
|
|
11335
|
-
for (const char of name)
|
|
11336
|
-
if (!(char >= "a" && char <= "z") && !(char >= "0" && char <= "9") && char !== "_")
|
|
11337
|
-
return false;
|
|
11338
|
-
return true;
|
|
11339
|
-
}
|
|
11340
|
-
function createFormatRegistry(descriptors = coreFormats, context = {}, operation = "convert") {
|
|
11341
|
-
const fail3 = (code, message) => {
|
|
11342
|
-
throw new PandocError(code, operation, message);
|
|
11343
|
-
};
|
|
11344
|
-
const names = /* @__PURE__ */ new Set();
|
|
11345
|
-
const maps = {
|
|
11346
|
-
read: /* @__PURE__ */ new Map(),
|
|
11347
|
-
write: /* @__PURE__ */ new Map()
|
|
11348
|
-
};
|
|
11349
|
-
const formats = descriptors.map(
|
|
11350
|
-
(item) => Object.freeze({
|
|
11351
|
-
...item,
|
|
11352
|
-
...item.aliases === void 0 ? {} : {
|
|
11353
|
-
aliases: Object.freeze({
|
|
11354
|
-
...item.aliases.read === void 0 ? {} : { read: Object.freeze([...item.aliases.read]) },
|
|
11355
|
-
...item.aliases.write === void 0 ? {} : { write: Object.freeze([...item.aliases.write]) }
|
|
11356
|
-
})
|
|
11357
|
-
},
|
|
11358
|
-
suffixes: Object.freeze([...item.suffixes]),
|
|
11359
|
-
extensions: Object.freeze({ ...item.extensions }),
|
|
11360
|
-
options: Object.freeze({
|
|
11361
|
-
read: Object.freeze([...item.options.read]),
|
|
11362
|
-
write: Object.freeze([...item.options.write])
|
|
11363
|
-
})
|
|
11364
|
-
})
|
|
11365
|
-
).sort((a, b) => compare(a.name, b.name));
|
|
11366
|
-
for (const descriptor of formats) {
|
|
11367
|
-
if (!validName(descriptor.name) || names.has(descriptor.name))
|
|
11368
|
-
fail3("E_FORMAT", `Invalid or duplicate format: ${descriptor.name}`);
|
|
11369
|
-
names.add(descriptor.name);
|
|
11370
|
-
if (descriptor.reader && (!descriptor.read || descriptor.reader.format !== descriptor.name) || descriptor.writer && (!descriptor.write || descriptor.writer.format !== descriptor.name))
|
|
11371
|
-
fail3("E_CAPABILITY", `Invalid binding: ${descriptor.name}`);
|
|
11372
|
-
for (const extension of Object.keys(descriptor.extensions))
|
|
11373
|
-
if (!validName(extension)) fail3("E_EXTENSION", `Invalid extension: ${extension}`);
|
|
11374
|
-
for (const direction of ["read", "write"]) {
|
|
11375
|
-
const aliases = descriptor.aliases?.[direction] ?? [];
|
|
11376
|
-
if (aliases.length && !descriptor[direction])
|
|
11377
|
-
fail3("E_FORMAT", "Alias for rejected direction");
|
|
11378
|
-
if (!descriptor[direction]) continue;
|
|
11379
|
-
for (const name of [descriptor.name, ...aliases]) {
|
|
11380
|
-
if (!validName(name) || maps[direction].has(name))
|
|
11381
|
-
fail3("E_FORMAT", `Format collision: ${name}`);
|
|
11382
|
-
maps[direction].set(name, descriptor);
|
|
12049
|
+
validateDocument(value);
|
|
12050
|
+
function* geometry(v, p) {
|
|
12051
|
+
if (v === null || typeof v !== "object" || v instanceof Uint8Array) return;
|
|
12052
|
+
if (cooperate) {
|
|
12053
|
+
const c = cooperate(1);
|
|
12054
|
+
if (c) yield c;
|
|
12055
|
+
}
|
|
12056
|
+
if ("t" in v && v.t === "Table") {
|
|
12057
|
+
const content = v.c;
|
|
12058
|
+
for (const _ of tableGeometry(content, `${p}.c`)) {
|
|
12059
|
+
if (cooperate) {
|
|
12060
|
+
const c = cooperate(1);
|
|
12061
|
+
if (c) yield c;
|
|
12062
|
+
}
|
|
11383
12063
|
}
|
|
11384
12064
|
}
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
if (typeof source !== "string" || !source)
|
|
11390
|
-
fail3("E_FORMAT_REQUIRED", "Select an explicit format");
|
|
11391
|
-
let cursor = 0;
|
|
11392
|
-
while (cursor < source.length && source[cursor] !== "+" && source[cursor] !== "-") cursor++;
|
|
11393
|
-
const name = source.slice(0, cursor);
|
|
11394
|
-
const selectedDirection = direction ?? (maps.read.has(name) ? "read" : "write");
|
|
11395
|
-
const descriptor = maps[selectedDirection].get(name);
|
|
11396
|
-
if (!descriptor) return fail3("E_FORMAT", `Unsupported ${selectedDirection} format: ${name}`);
|
|
11397
|
-
const extensions = Object.fromEntries(
|
|
11398
|
-
Object.entries(descriptor.extensions).sort(([a], [b]) => compare(a, b))
|
|
11399
|
-
);
|
|
11400
|
-
while (cursor < source.length) {
|
|
11401
|
-
const enabled = source[cursor++] === "+";
|
|
11402
|
-
const start = cursor;
|
|
11403
|
-
while (cursor < source.length && source[cursor] !== "+" && source[cursor] !== "-") cursor++;
|
|
11404
|
-
const extension = source.slice(start, cursor);
|
|
11405
|
-
if (!validName(extension) || !Object.hasOwn(extensions, extension))
|
|
11406
|
-
fail3("E_EXTENSION", `Unsupported extension: ${extension}`);
|
|
11407
|
-
extensions[extension] = enabled;
|
|
12065
|
+
if (Array.isArray(v)) {
|
|
12066
|
+
for (const [index, child] of v.entries()) yield* geometry(child, `${p}[${index}]`);
|
|
12067
|
+
} else {
|
|
12068
|
+
for (const [key, child] of Object.entries(v)) yield* geometry(child, `${p}.${key}`);
|
|
11408
12069
|
}
|
|
11409
|
-
return { descriptor, extensions: Object.freeze(extensions) };
|
|
11410
12070
|
}
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
},
|
|
11431
|
-
infer(path, direction) {
|
|
11432
|
-
const dot = path.lastIndexOf(".");
|
|
11433
|
-
if (dot <= path.lastIndexOf("/") || dot < 0) return fail3("E_FORMAT", `No suffix: ${path}`);
|
|
11434
|
-
const suffix = path.slice(dot + 1).toLowerCase();
|
|
11435
|
-
const matches = formats.filter(
|
|
11436
|
-
(descriptor) => descriptor[direction] && descriptor.suffixes.includes(suffix)
|
|
11437
|
-
);
|
|
11438
|
-
if (matches.length !== 1) return fail3("E_FORMAT", `Unknown or ambiguous suffix: ${path}`);
|
|
11439
|
-
return matches[0].name;
|
|
11440
|
-
},
|
|
11441
|
-
validateOptions(source, direction, options) {
|
|
11442
|
-
const { descriptor } = parse4(source, direction);
|
|
11443
|
-
for (const option of options)
|
|
11444
|
-
if (!descriptor.options[direction].includes(option))
|
|
11445
|
-
fail3("E_OPTION", `Inapplicable option: ${option}`);
|
|
11446
|
-
},
|
|
11447
|
-
capabilities: Object.freeze(
|
|
11448
|
-
formats.map((descriptor) => {
|
|
11449
|
-
const input = maps.read.get(descriptor.name);
|
|
11450
|
-
const output = maps.write.get(descriptor.name);
|
|
11451
|
-
return Object.freeze({
|
|
11452
|
-
...descriptor,
|
|
11453
|
-
read: Object.freeze({ allowed: !!input, available: !!input && !!reader(input) }),
|
|
11454
|
-
write: Object.freeze({ allowed: !!output, available: !!output && !!writer(output) })
|
|
11455
|
-
});
|
|
11456
|
-
})
|
|
11457
|
-
)
|
|
11458
|
-
};
|
|
12071
|
+
if (hasTable) yield* geometry(value, "$");
|
|
12072
|
+
return structuredClone(value);
|
|
12073
|
+
}
|
|
12074
|
+
function normalizeDocument(value, options = {}) {
|
|
12075
|
+
const steps = normalization(value, options, () => {
|
|
12076
|
+
});
|
|
12077
|
+
let step = steps.next();
|
|
12078
|
+
while (!step.done) step = steps.next();
|
|
12079
|
+
return step.value;
|
|
12080
|
+
}
|
|
12081
|
+
async function normalizeDocumentCooperatively(value, options, cooperate, reserve = () => {
|
|
12082
|
+
}) {
|
|
12083
|
+
const steps = normalization(value, options, reserve, cooperate);
|
|
12084
|
+
let step = steps.next();
|
|
12085
|
+
while (!step.done) {
|
|
12086
|
+
if (step.value) await step.value;
|
|
12087
|
+
step = steps.next();
|
|
12088
|
+
}
|
|
12089
|
+
return step.value;
|
|
11459
12090
|
}
|
|
11460
|
-
var formatCapabilities = createFormatRegistry().capabilities;
|
|
11461
12091
|
var defaultLimits = Object.freeze({
|
|
11462
12092
|
inputBytes: Infinity,
|
|
11463
12093
|
outputBytes: Infinity,
|
|
@@ -11958,249 +12588,12 @@ var ExecutionContext = class {
|
|
|
11958
12588
|
);
|
|
11959
12589
|
await Promise.allSettled(callbacks.map(async (callback) => callback()));
|
|
11960
12590
|
});
|
|
11961
|
-
return this.closing;
|
|
11962
|
-
}
|
|
11963
|
-
};
|
|
11964
|
-
function createExecutionContext(operation, context = {}) {
|
|
11965
|
-
return new ExecutionContext(operation, context);
|
|
11966
|
-
}
|
|
11967
|
-
var targetOrigins = /* @__PURE__ */ new WeakMap();
|
|
11968
|
-
var missing = (error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
11969
|
-
function resourceDirectory(path, cwd = "/") {
|
|
11970
|
-
if (!path || path.includes("\\") || path.includes(":") || path.includes("\0") || path.startsWith("~"))
|
|
11971
|
-
throw new PandocError("E_OPTION", "convert", "Invalid resource directory");
|
|
11972
|
-
const parts = (path.startsWith("/") ? path : `${cwd}/${path}`).split("/");
|
|
11973
|
-
if (parts.includes("..")) throw new PandocError("E_OPTION", "convert", "Resource directories cannot traverse parents");
|
|
11974
|
-
return "/" + parts.filter((p) => p && p !== ".").join("/");
|
|
11975
|
-
}
|
|
11976
|
-
function localTarget(url, context) {
|
|
11977
|
-
const split = [url.indexOf("?"), url.indexOf("#")].filter((n) => n >= 0);
|
|
11978
|
-
const end = split.length ? Math.min(...split) : url.length;
|
|
11979
|
-
const raw = url.slice(0, end);
|
|
11980
|
-
if (!raw || raw.startsWith("/") || raw.startsWith("~") || raw.includes(":") || raw.includes("\\"))
|
|
11981
|
-
context.fail("E_CAPABILITY", "Only relative local image resources are supported");
|
|
11982
|
-
const parts = [];
|
|
11983
|
-
for (const component of raw.split("/")) {
|
|
11984
|
-
context.checkpoint();
|
|
11985
|
-
let decoded;
|
|
11986
|
-
try {
|
|
11987
|
-
decoded = decodeURIComponent(component);
|
|
11988
|
-
} catch {
|
|
11989
|
-
return context.fail("E_CAPABILITY", "Invalid image URI escape");
|
|
11990
|
-
}
|
|
11991
|
-
if (decoded.includes("/") || decoded.includes("\\") || decoded.includes(":") || [...decoded].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127))
|
|
11992
|
-
context.fail("E_CAPABILITY", "Invalid image resource component");
|
|
11993
|
-
if (!decoded || decoded === ".") continue;
|
|
11994
|
-
if (decoded === "..") {
|
|
11995
|
-
if (!parts.length) context.fail("E_CAPABILITY", "Image resource escapes its search directory");
|
|
11996
|
-
parts.pop();
|
|
11997
|
-
} else parts.push(decoded);
|
|
11998
|
-
}
|
|
11999
|
-
if (!parts.length || parts[0].startsWith("~")) context.fail("E_CAPABILITY", "Invalid image resource name");
|
|
12000
|
-
return { name: parts.join("/"), suffix: url.slice(end) };
|
|
12001
|
-
}
|
|
12002
|
-
function mediaKeyBasename(key, context) {
|
|
12003
|
-
if (!key || key.startsWith("/") || key.startsWith("~") || key.includes("\\") || key.includes(":") || key.split("/").some((p) => !p || p === "." || p === "..") || [...key].some((ch) => ch.charCodeAt(0) < 32 || ch.charCodeAt(0) === 127)) context.fail("E_CAPABILITY", "Unsafe embedded resource key");
|
|
12004
|
-
return key.split("/").at(-1);
|
|
12005
|
-
}
|
|
12006
|
-
async function inspect(fs, path, context) {
|
|
12007
|
-
let current = "";
|
|
12008
|
-
let type;
|
|
12009
|
-
const parts = path.split("/").filter(Boolean);
|
|
12010
|
-
for (let i = 0; i <= parts.length; i++) {
|
|
12011
|
-
current = i === 0 ? "/" : (current === "/" ? "" : current) + "/" + parts[i - 1];
|
|
12012
|
-
context.checkpoint();
|
|
12013
|
-
type = (await context.call(async () => {
|
|
12014
|
-
try {
|
|
12015
|
-
return await fs.lstat(current, context.signal ? { signal: context.signal } : {});
|
|
12016
|
-
} catch (error) {
|
|
12017
|
-
if (missing(error)) return void 0;
|
|
12018
|
-
throw error;
|
|
12019
|
-
}
|
|
12020
|
-
}))?.type;
|
|
12021
|
-
if (type === void 0) return void 0;
|
|
12022
|
-
if (type === "symlink") context.fail("E_CAPABILITY", "Symlink image and extraction paths are unsupported");
|
|
12023
|
-
if (i < parts.length && type !== "directory") context.fail("E_IO", "Resource ancestor is not a directory");
|
|
12024
|
-
}
|
|
12025
|
-
return type;
|
|
12026
|
-
}
|
|
12027
|
-
var ResourceSession = class {
|
|
12028
|
-
constructor(context) {
|
|
12029
|
-
this.context = context;
|
|
12030
|
-
}
|
|
12031
|
-
context;
|
|
12032
|
-
origins = targetOrigins;
|
|
12033
|
-
bag = /* @__PURE__ */ new Map();
|
|
12034
|
-
names = /* @__PURE__ */ new Set();
|
|
12035
|
-
plans = [];
|
|
12036
|
-
destination;
|
|
12037
|
-
search;
|
|
12038
|
-
allocate(basename, bytes) {
|
|
12039
|
-
if (!basename || basename === "." || basename === "..") this.context.fail("E_CAPABILITY", "Invalid extraction basename");
|
|
12040
|
-
let name = basename;
|
|
12041
|
-
const dot = basename.lastIndexOf(".");
|
|
12042
|
-
for (let n = 2; this.names.has(name); n++) {
|
|
12043
|
-
this.context.checkpoint();
|
|
12044
|
-
name = dot > 0 ? `${basename.slice(0, dot)}-${n}${basename.slice(dot)}` : `${basename}-${n}`;
|
|
12045
|
-
}
|
|
12046
|
-
this.names.add(name);
|
|
12047
|
-
const entry = { path: this.destination === void 0 ? name : `${this.destination === "/" ? "" : this.destination}/${name}`, bytes };
|
|
12048
|
-
this.context.charge("references", 1);
|
|
12049
|
-
this.context.charge("retainedBytes", entry.path.length * 2 + 64);
|
|
12050
|
-
this.plans.push(entry);
|
|
12051
|
-
return entry;
|
|
12052
|
-
}
|
|
12053
|
-
configure(options) {
|
|
12054
|
-
const cwd = resourceDirectory(this.context.context.resourceCwd ?? "/");
|
|
12055
|
-
if (options.resourcePath !== void 0) {
|
|
12056
|
-
if (!Array.isArray(options.resourcePath) || !options.resourcePath.length || options.resourcePath.some((p) => typeof p !== "string")) this.context.fail("E_OPTION", "resourcePath requires directories");
|
|
12057
|
-
this.search = options.resourcePath.map((p) => resourceDirectory(p, cwd));
|
|
12058
|
-
}
|
|
12059
|
-
if (options.extractMedia !== void 0) {
|
|
12060
|
-
if (typeof options.extractMedia !== "string") this.context.fail("E_OPTION", "extractMedia requires a directory");
|
|
12061
|
-
this.destination = resourceDirectory(options.extractMedia, cwd);
|
|
12062
|
-
if (!this.context.context.resourceFiles) this.context.fail("E_CAPABILITY", "Media extraction requires a configured VFS");
|
|
12063
|
-
}
|
|
12064
|
-
}
|
|
12065
|
-
async prepare(document, lossy, embedImages = false) {
|
|
12066
|
-
if (this.destination === void 0 && (!embedImages || !this.context.context.resourceFiles || this.context.resources)) return document;
|
|
12067
|
-
const fs = this.context.context.resourceFiles;
|
|
12068
|
-
const ctx = this.context;
|
|
12069
|
-
const embedded = /* @__PURE__ */ new Map();
|
|
12070
|
-
const imageResources = /* @__PURE__ */ new Map();
|
|
12071
|
-
const embeddedEntries = /* @__PURE__ */ new Map();
|
|
12072
|
-
for (const resource of document.resources) {
|
|
12073
|
-
if (this.destination !== void 0) mediaKeyBasename(resource.id, ctx);
|
|
12074
|
-
const previous = embedded.get(resource.id);
|
|
12075
|
-
if (previous) {
|
|
12076
|
-
if (embedImages) ctx.fail("E_RESOURCE", "Duplicate embedded resource id");
|
|
12077
|
-
if (previous.length !== resource.bytes.length) ctx.fail("E_RESOURCE", "Conflicting embedded resource keys");
|
|
12078
|
-
for (let i = 0; i < previous.length; i++) {
|
|
12079
|
-
ctx.checkpoint();
|
|
12080
|
-
if (previous[i] !== resource.bytes[i]) ctx.fail("E_RESOURCE", "Conflicting embedded resource keys");
|
|
12081
|
-
}
|
|
12082
|
-
} else embedded.set(resource.id, resource.bytes);
|
|
12083
|
-
}
|
|
12084
|
-
const validate = async (value) => {
|
|
12085
|
-
await ctx.cooperate();
|
|
12086
|
-
if (!value || typeof value !== "object" || value instanceof Uint8Array) return;
|
|
12087
|
-
if ("t" in value && value.t === "Image") {
|
|
12088
|
-
const image = value;
|
|
12089
|
-
if (!embedded.has(image.c[2][0])) {
|
|
12090
|
-
localTarget(image.c[2][0], ctx);
|
|
12091
|
-
if (!this.search) resourceDirectory(this.origins.get(image.c[2])?.base ?? ctx.context.resourceCwd ?? "/");
|
|
12092
|
-
}
|
|
12093
|
-
}
|
|
12094
|
-
for (const child of Object.values(value)) await validate(child);
|
|
12095
|
-
};
|
|
12096
|
-
await validate(document.blocks);
|
|
12097
|
-
await validate(document.metadata);
|
|
12098
|
-
if (this.destination !== void 0) {
|
|
12099
|
-
const destinationType = await inspect(fs, this.destination, ctx);
|
|
12100
|
-
if (destinationType !== void 0 && destinationType !== "directory") ctx.fail("E_IO", "Extraction destination is not a directory");
|
|
12101
|
-
}
|
|
12102
|
-
for (const [key, bytes] of embedded) {
|
|
12103
|
-
const entry = this.allocate(this.destination === void 0 ? "resource" : mediaKeyBasename(key, ctx), bytes);
|
|
12104
|
-
embeddedEntries.set(key, entry);
|
|
12105
|
-
if (embedImages) {
|
|
12106
|
-
const id = entry.path.split("/").map(encodeURIComponent).join("/");
|
|
12107
|
-
ctx.charge("references", 1);
|
|
12108
|
-
ctx.charge("retainedBytes", id.length * 2 + 64);
|
|
12109
|
-
imageResources.set(id, bytes);
|
|
12110
|
-
}
|
|
12111
|
-
}
|
|
12112
|
-
const visit5 = async (value, path) => {
|
|
12113
|
-
await ctx.cooperate();
|
|
12114
|
-
if (value === null || typeof value !== "object" || value instanceof Uint8Array) return value;
|
|
12115
|
-
if ("t" in value && value.t === "Image") {
|
|
12116
|
-
const image = value;
|
|
12117
|
-
const [url, title] = image.c[2];
|
|
12118
|
-
const origin = this.origins.get(image.c[2]) ?? {};
|
|
12119
|
-
const location = origin.source ? `${origin.source}:${path}` : path;
|
|
12120
|
-
const embeddedBytes = embedded.get(url);
|
|
12121
|
-
const target = embeddedBytes ? { name: url, suffix: "" } : localTarget(url, ctx);
|
|
12122
|
-
const roots = embeddedBytes ? [] : this.search ?? [resourceDirectory(origin.base ?? ctx.context.resourceCwd ?? "/")];
|
|
12123
|
-
let entry = embeddedEntries.get(url);
|
|
12124
|
-
for (const root of entry ? [] : roots) {
|
|
12125
|
-
const key = `${root === "/" ? "" : root}/${target.name}`;
|
|
12126
|
-
entry = this.bag.get(key);
|
|
12127
|
-
if (entry) break;
|
|
12128
|
-
const type = await inspect(fs, key, ctx);
|
|
12129
|
-
if (type === void 0) continue;
|
|
12130
|
-
if (type !== "file") ctx.fail("E_CAPABILITY", "Image resource is not a regular file");
|
|
12131
|
-
ctx.charge("resources", 1);
|
|
12132
|
-
const chunks = [];
|
|
12133
|
-
let length = 0;
|
|
12134
|
-
const readOptions = ctx.signal ? { signal: ctx.signal } : {};
|
|
12135
|
-
const producer = fs.readStream ? await ctx.call(async () => fs.readStream(key, readOptions)) : (async function* () {
|
|
12136
|
-
if (!fs.readFile) ctx.fail("E_CAPABILITY", "VFS requires explicit resource reads");
|
|
12137
|
-
let bytes2;
|
|
12138
|
-
const maxBytes = ctx.remaining("resourceBytes");
|
|
12139
|
-
try {
|
|
12140
|
-
bytes2 = await fs.readFile(key, { ...readOptions, ...maxBytes === Infinity ? {} : { maxBytes } });
|
|
12141
|
-
} catch (error) {
|
|
12142
|
-
if (typeof error === "object" && error !== null && "code" in error && error.code === "EFBIG") ctx.fail("E_LIMIT", "resourceBytes: VFS bounded read refused");
|
|
12143
|
-
throw error;
|
|
12144
|
-
}
|
|
12145
|
-
yield bytes2;
|
|
12146
|
-
})();
|
|
12147
|
-
await ctx.consume(producer, async (bytes2) => {
|
|
12148
|
-
ctx.charge("references", 1);
|
|
12149
|
-
chunks.push(bytes2);
|
|
12150
|
-
length += bytes2.length;
|
|
12151
|
-
}, ["resourceBytes"]);
|
|
12152
|
-
ctx.charge("retainedBytes", length);
|
|
12153
|
-
const bytes = new Uint8Array(length);
|
|
12154
|
-
let offset = 0;
|
|
12155
|
-
for (const chunk of chunks) {
|
|
12156
|
-
bytes.set(chunk, offset);
|
|
12157
|
-
offset += chunk.length;
|
|
12158
|
-
await ctx.cooperate();
|
|
12159
|
-
}
|
|
12160
|
-
entry = this.allocate(target.name.split("/").at(-1), bytes);
|
|
12161
|
-
this.bag.set(key, entry);
|
|
12162
|
-
break;
|
|
12163
|
-
}
|
|
12164
|
-
if (!entry) {
|
|
12165
|
-
if (!lossy) throw new PandocError("E_RESOURCE", ctx.operation, `Missing image resource: ${url}`, void 0, location);
|
|
12166
|
-
ctx.report({ code: "W_RESOURCE_MISSING", operation: ctx.operation, message: `Missing image resource: ${url}`, location });
|
|
12167
|
-
return image;
|
|
12168
|
-
}
|
|
12169
|
-
const outputUrl = entry.path.split("/").map(encodeURIComponent).join("/") + target.suffix;
|
|
12170
|
-
if (embedImages && !imageResources.has(outputUrl)) {
|
|
12171
|
-
ctx.charge("references", 1);
|
|
12172
|
-
ctx.charge("retainedBytes", outputUrl.length * 2 + 64);
|
|
12173
|
-
imageResources.set(outputUrl, entry.bytes);
|
|
12174
|
-
}
|
|
12175
|
-
return { ...image, c: [image.c[0], await visit5(image.c[1], `${path}.c[1]`), [outputUrl, title]] };
|
|
12176
|
-
}
|
|
12177
|
-
if (Array.isArray(value)) {
|
|
12178
|
-
const result2 = [];
|
|
12179
|
-
for (let i = 0; i < value.length; i++) result2.push(await visit5(value[i], `${path}[${i}]`));
|
|
12180
|
-
return result2;
|
|
12181
|
-
}
|
|
12182
|
-
const result = {};
|
|
12183
|
-
for (const [key, child] of Object.entries(value)) result[key] = await visit5(child, `${path}.${key}`);
|
|
12184
|
-
return result;
|
|
12185
|
-
};
|
|
12186
|
-
const prepared = { ...document, blocks: await visit5(document.blocks, "$.blocks"), metadata: await visit5(document.metadata, "$.metadata") };
|
|
12187
|
-
if (this.destination !== void 0) {
|
|
12188
|
-
for (const entry of this.plans) if (await inspect(fs, entry.path, ctx) !== void 0) ctx.fail("E_IO", `Extraction destination already exists: ${entry.path}`);
|
|
12189
|
-
}
|
|
12190
|
-
return embedImages ? { ...prepared, resources: [...imageResources].map(([id, bytes]) => ({ id, bytes })) } : prepared;
|
|
12191
|
-
}
|
|
12192
|
-
async publish() {
|
|
12193
|
-
if (this.destination === void 0 || !this.plans.length) return;
|
|
12194
|
-
const ctx = this.context;
|
|
12195
|
-
const fs = ctx.context.resourceFiles;
|
|
12196
|
-
const options = ctx.signal ? { signal: ctx.signal } : {};
|
|
12197
|
-
await ctx.call(() => fs.mkdir(this.destination, { ...options, recursive: true }));
|
|
12198
|
-
for (const entry of this.plans) {
|
|
12199
|
-
if (await inspect(fs, entry.path, ctx) !== void 0) ctx.fail("E_IO", "Extraction destination changed after preflight");
|
|
12200
|
-
await ctx.call(() => fs.writeFile(entry.path, entry.bytes, { ...options, flag: "wx" }));
|
|
12201
|
-
}
|
|
12591
|
+
return this.closing;
|
|
12202
12592
|
}
|
|
12203
12593
|
};
|
|
12594
|
+
function createExecutionContext(operation, context = {}) {
|
|
12595
|
+
return new ExecutionContext(operation, context);
|
|
12596
|
+
}
|
|
12204
12597
|
function createScanner(text, ignoreTrivia = false) {
|
|
12205
12598
|
const len = text.length;
|
|
12206
12599
|
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
@@ -13248,7 +13641,7 @@ var Session = class extends ExecutionContext {
|
|
|
13248
13641
|
if (Object.keys(options).some((key) => !allowed.includes(key)))
|
|
13249
13642
|
this.fail("E_OPTION", "Unknown or inapplicable option");
|
|
13250
13643
|
if ("wrap" in options && !["none", "auto", "preserve"].includes(options.wrap)) this.fail("E_OPTION", "Invalid wrap policy");
|
|
13251
|
-
if ("wrap" in options && options.wrap !== "none" && "to" in options && this.registry.resolve(options.to, "write").descriptor.name
|
|
13644
|
+
if ("wrap" in options && options.wrap !== "none" && "to" in options && !["plain", "commonmark", "gfm"].includes(this.registry.resolve(options.to, "write").descriptor.name)) this.fail("E_OPTION", "This writer supports only wrap none");
|
|
13252
13645
|
if ("lossy" in options && typeof options.lossy !== "boolean") this.fail("E_OPTION", "lossy must be boolean");
|
|
13253
13646
|
this.lossy = "lossy" in options && options.lossy === true;
|
|
13254
13647
|
if ("to" in options) {
|
|
@@ -13774,6 +14167,62 @@ async function convert(inputs, options, context) {
|
|
|
13774
14167
|
function convertSync(ignoredInputs, ignoredOptions, ignoredContext = {}) {
|
|
13775
14168
|
return void 0;
|
|
13776
14169
|
}
|
|
14170
|
+
function evalSyncPandoc(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
14171
|
+
try {
|
|
14172
|
+
if (opArgs.length > 0 && opArgs.every((a) => a === "--list-input-formats" || a === "--list-output-formats")) {
|
|
14173
|
+
return inspectFormats(opArgs);
|
|
14174
|
+
}
|
|
14175
|
+
for (let i = 0; i < opArgs.length; i++) {
|
|
14176
|
+
const a = opArgs[i];
|
|
14177
|
+
if (a === "-d" || a === "--defaults" || a.startsWith("-d") || a.startsWith("--defaults=")) {
|
|
14178
|
+
return void 0;
|
|
14179
|
+
}
|
|
14180
|
+
}
|
|
14181
|
+
const signal = new AbortController().signal;
|
|
14182
|
+
const parsed = parseConversionArgs(
|
|
14183
|
+
opArgs,
|
|
14184
|
+
{
|
|
14185
|
+
cwd: "/",
|
|
14186
|
+
...inBytes === void 0 ? {} : { stdin: [inBytes] },
|
|
14187
|
+
readFile: async () => new Uint8Array(0),
|
|
14188
|
+
writeFile: async () => {
|
|
14189
|
+
}
|
|
14190
|
+
},
|
|
14191
|
+
signal
|
|
14192
|
+
);
|
|
14193
|
+
const inputs = [];
|
|
14194
|
+
if (!parsed.operands) {
|
|
14195
|
+
if (inBytes === void 0 || inBytes.byteLength > 262144) return void 0;
|
|
14196
|
+
inputs.push({ bytes: inBytes });
|
|
14197
|
+
} else {
|
|
14198
|
+
for (const op of parsed.operands) {
|
|
14199
|
+
if (op.source === void 0) {
|
|
14200
|
+
if (inBytes === void 0 || inBytes.byteLength > 262144) return void 0;
|
|
14201
|
+
inputs.push({ bytes: inBytes });
|
|
14202
|
+
} else {
|
|
14203
|
+
if (parsed.destination && op.source === parsed.destination) return void 0;
|
|
14204
|
+
const b = readFileSync?.(op.source);
|
|
14205
|
+
if (!b || b.byteLength > 262144) return void 0;
|
|
14206
|
+
inputs.push({ bytes: b, source: op.source, ...op.base === void 0 ? {} : { base: op.base } });
|
|
14207
|
+
}
|
|
14208
|
+
}
|
|
14209
|
+
}
|
|
14210
|
+
const serialized = convertSync(inputs, parsed.options);
|
|
14211
|
+
if (!serialized) return void 0;
|
|
14212
|
+
if (parsed.destination !== void 0) {
|
|
14213
|
+
if (!writeFileSync) return void 0;
|
|
14214
|
+
const outBytes = serialized.kind === "binary" ? serialized.bytes : new TextEncoder().encode(serialized.text);
|
|
14215
|
+
if (!writeFileSync(parsed.destination, outBytes)) return void 0;
|
|
14216
|
+
return "";
|
|
14217
|
+
}
|
|
14218
|
+
if (serialized.kind === "text") {
|
|
14219
|
+
return serialized.text;
|
|
14220
|
+
}
|
|
14221
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(serialized.bytes);
|
|
14222
|
+
} catch {
|
|
14223
|
+
return void 0;
|
|
14224
|
+
}
|
|
14225
|
+
}
|
|
13777
14226
|
function createJsonFilterCapability(runtime) {
|
|
13778
14227
|
if (!runtime || typeof runtime.run !== "function") throw new TypeError("A JSON filter runtime is required");
|
|
13779
14228
|
return {
|
|
@@ -19889,310 +20338,79 @@ var Parser = class {
|
|
|
19889
20338
|
return {
|
|
19890
20339
|
type: "block-map",
|
|
19891
20340
|
offset: this.offset,
|
|
19892
|
-
indent: this.indent,
|
|
19893
|
-
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
19894
|
-
};
|
|
19895
|
-
}
|
|
19896
|
-
}
|
|
19897
|
-
return null;
|
|
19898
|
-
}
|
|
19899
|
-
atIndentedComment(start, indent3) {
|
|
19900
|
-
if (this.type !== "comment")
|
|
19901
|
-
return false;
|
|
19902
|
-
if (this.indent <= indent3)
|
|
19903
|
-
return false;
|
|
19904
|
-
return start.every((st) => st.type === "newline" || st.type === "space");
|
|
19905
|
-
}
|
|
19906
|
-
*documentEnd(docEnd) {
|
|
19907
|
-
if (this.type !== "doc-mode") {
|
|
19908
|
-
if (docEnd.end)
|
|
19909
|
-
docEnd.end.push(this.sourceToken);
|
|
19910
|
-
else
|
|
19911
|
-
docEnd.end = [this.sourceToken];
|
|
19912
|
-
if (this.type === "newline")
|
|
19913
|
-
yield* this.pop();
|
|
19914
|
-
}
|
|
19915
|
-
}
|
|
19916
|
-
*lineEnd(token) {
|
|
19917
|
-
switch (this.type) {
|
|
19918
|
-
case "comma":
|
|
19919
|
-
case "doc-start":
|
|
19920
|
-
case "doc-end":
|
|
19921
|
-
case "flow-seq-end":
|
|
19922
|
-
case "flow-map-end":
|
|
19923
|
-
case "map-value-ind":
|
|
19924
|
-
yield* this.pop();
|
|
19925
|
-
yield* this.step();
|
|
19926
|
-
break;
|
|
19927
|
-
case "newline":
|
|
19928
|
-
this.onKeyLine = false;
|
|
19929
|
-
// fallthrough
|
|
19930
|
-
case "space":
|
|
19931
|
-
case "comment":
|
|
19932
|
-
default:
|
|
19933
|
-
if (token.end)
|
|
19934
|
-
token.end.push(this.sourceToken);
|
|
19935
|
-
else
|
|
19936
|
-
token.end = [this.sourceToken];
|
|
19937
|
-
if (this.type === "newline")
|
|
19938
|
-
yield* this.pop();
|
|
19939
|
-
}
|
|
19940
|
-
}
|
|
19941
|
-
};
|
|
19942
|
-
function parseOptions(options) {
|
|
19943
|
-
const prettyErrors = options.prettyErrors !== false;
|
|
19944
|
-
const lineCounter = options.lineCounter || prettyErrors && new LineCounter() || null;
|
|
19945
|
-
return { lineCounter, prettyErrors };
|
|
19946
|
-
}
|
|
19947
|
-
function parseDocument(source, options = {}) {
|
|
19948
|
-
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
19949
|
-
const parser = new Parser(lineCounter?.addNewLine);
|
|
19950
|
-
const composer = new Composer(options);
|
|
19951
|
-
let doc = null;
|
|
19952
|
-
for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
|
|
19953
|
-
if (!doc)
|
|
19954
|
-
doc = _doc;
|
|
19955
|
-
else if (doc.options.logLevel !== "silent") {
|
|
19956
|
-
doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
19957
|
-
break;
|
|
19958
|
-
}
|
|
19959
|
-
}
|
|
19960
|
-
if (prettyErrors && lineCounter) {
|
|
19961
|
-
doc.errors.forEach(prettifyError(source, lineCounter));
|
|
19962
|
-
doc.warnings.forEach(prettifyError(source, lineCounter));
|
|
19963
|
-
}
|
|
19964
|
-
return doc;
|
|
19965
|
-
}
|
|
19966
|
-
function parseConversionArgs(args, files, signal, defaultInputs = []) {
|
|
19967
|
-
const options = {};
|
|
19968
|
-
const pdfFonts = [];
|
|
19969
|
-
const metadataJson = [];
|
|
19970
|
-
const metadataFiles = [];
|
|
19971
|
-
const operands = [];
|
|
19972
|
-
const variables = {};
|
|
19973
|
-
let destination2;
|
|
19974
|
-
let outputSeen = false;
|
|
19975
|
-
let yes = false;
|
|
19976
|
-
const names = /* @__PURE__ */ new Map([["-f", "from"], ["--from", "from"], ["-r", "from"], ["--read", "from"], ["-t", "to"], ["--to", "to"], ["-w", "to"], ["--write", "to"], ["--raw-content", "rawContent"], ["--wrap", "wrap"]]);
|
|
19977
|
-
const fail3 = (message) => {
|
|
19978
|
-
throw new PandocError("E_OPTION", "convert", message);
|
|
19979
|
-
};
|
|
19980
|
-
const source = (path, metadata2 = false) => {
|
|
19981
|
-
if (!files.readFile) fail3("File operands require an explicit readFile capability");
|
|
19982
|
-
const split = path.lastIndexOf("/");
|
|
19983
|
-
const base = resourceDirectory(split < 0 ? "." : path.slice(0, split) || "/", files.cwd ?? "/");
|
|
19984
|
-
return { source: path, base: metadata2 ? path : base, chunks: (async function* () {
|
|
19985
|
-
yield await files.readFile(path, signal);
|
|
19986
|
-
})() };
|
|
19987
|
-
};
|
|
19988
|
-
let positional = false;
|
|
19989
|
-
let stdinUsed = false;
|
|
19990
|
-
for (let i = 0; i < args.length; i++) {
|
|
19991
|
-
let arg = args[i];
|
|
19992
|
-
if (!positional && arg === "--yes") {
|
|
19993
|
-
if (yes) fail3("Repeated option: --yes");
|
|
19994
|
-
yes = true;
|
|
19995
|
-
continue;
|
|
19996
|
-
}
|
|
19997
|
-
if (!positional && (arg === "--file-scope" || arg === "--sandbox")) {
|
|
19998
|
-
options[arg === "--file-scope" ? "fileScope" : "sandbox"] = true;
|
|
19999
|
-
continue;
|
|
20000
|
-
}
|
|
20001
|
-
if (arg === "--" && !positional) {
|
|
20002
|
-
positional = true;
|
|
20003
|
-
continue;
|
|
20004
|
-
}
|
|
20005
|
-
if (arg === "-") {
|
|
20006
|
-
if (stdinUsed || !files.stdin) fail3("Stdin may be supplied once");
|
|
20007
|
-
stdinUsed = true;
|
|
20008
|
-
operands.push({ chunks: files.stdin, source: "stdin" });
|
|
20009
|
-
continue;
|
|
20010
|
-
}
|
|
20011
|
-
if (positional || !arg.startsWith("-")) {
|
|
20012
|
-
operands.push(source(arg));
|
|
20013
|
-
continue;
|
|
20014
|
-
}
|
|
20015
|
-
if (arg.length > 2 && ["-f", "-r", "-t", "-w", "-o", "-F", "-L", "-H", "-B", "-A"].includes(arg.slice(0, 2)) && arg[2] !== "=")
|
|
20016
|
-
arg = `${arg.slice(0, 2)}=${arg.slice(2)}`;
|
|
20017
|
-
if (arg === "--lossy" || arg === "--standalone" || arg === "-s" || arg === "--fail-if-warnings") {
|
|
20018
|
-
const key2 = arg === "--lossy" ? "lossy" : arg === "--fail-if-warnings" ? "failIfWarnings" : "standalone";
|
|
20019
|
-
if (options[key2] !== void 0) fail3(`Repeated option: ${arg}`);
|
|
20020
|
-
options[key2] = true;
|
|
20021
|
-
continue;
|
|
20022
|
-
}
|
|
20023
|
-
const equals = arg.indexOf("=");
|
|
20024
|
-
const name = equals < 0 ? arg : arg.slice(0, equals);
|
|
20025
|
-
const filterKind = (/* @__PURE__ */ new Map([["--filter", "json"], ["-F", "json"], ["--lua-filter", "lua"], ["-L", "lua"], ["--citeproc", "citeproc"], ["-C", "citeproc"]])).get(name);
|
|
20026
|
-
if (filterKind) {
|
|
20027
|
-
if (filterKind === "citeproc") {
|
|
20028
|
-
if (equals >= 0) fail3(`Unexpected value: ${name}`);
|
|
20029
|
-
options.filters = [...options.filters ?? [], { kind: filterKind }];
|
|
20030
|
-
} else {
|
|
20031
|
-
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20032
|
-
if (!path || path.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
20033
|
-
options.filters = [...options.filters ?? [], { kind: filterKind, path }];
|
|
20034
|
-
}
|
|
20035
|
-
continue;
|
|
20036
|
-
}
|
|
20037
|
-
const writerOption = (/* @__PURE__ */ new Map([["--columns", "columns"], ["--shift-heading-level-by", "shiftHeadingLevelBy"], ["--eol", "eol"], ["--number-sections", "numberSections"], ["-N", "numberSections"], ["--toc", "toc"], ["--table-of-contents", "toc"], ["--strip-comments", "stripComments"], ["--ascii", "ascii"], ["--standalone", "standalone"]])).get(name);
|
|
20038
|
-
if (writerOption) {
|
|
20039
|
-
const boolean = ["numberSections", "toc", "stripComments", "ascii", "standalone"].includes(writerOption);
|
|
20040
|
-
const value2 = equals < 0 ? boolean ? "true" : args[++i] : arg.slice(equals + 1);
|
|
20041
|
-
if (value2 === void 0 || value2 === "") fail3(`Missing value: ${name}`);
|
|
20042
|
-
if (boolean && value2 !== "true" && value2 !== "false") fail3(`Invalid boolean: ${name}`);
|
|
20043
|
-
if (Object.hasOwn(options, writerOption)) fail3(`Repeated option: ${name}`);
|
|
20044
|
-
Object.assign(options, { [writerOption]: boolean ? value2 === "true" : ["columns", "shiftHeadingLevelBy"].includes(writerOption) ? Number(value2) : value2 });
|
|
20045
|
-
continue;
|
|
20046
|
-
}
|
|
20047
|
-
const local = (/* @__PURE__ */ new Map([["--template", "template"], ["--include-in-header", "includeInHeader"], ["-H", "includeInHeader"], ["--include-before-body", "includeBeforeBody"], ["-B", "includeBeforeBody"], ["--include-after-body", "includeAfterBody"], ["-A", "includeAfterBody"]])).get(name);
|
|
20048
|
-
if (local) {
|
|
20049
|
-
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20050
|
-
if (!path || path.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
20051
|
-
if (local === "template") {
|
|
20052
|
-
if (options.template) fail3("Repeated template option");
|
|
20053
|
-
options.template = source(path);
|
|
20054
|
-
} else options[local] = [...options[local] ?? [], source(path)];
|
|
20055
|
-
continue;
|
|
20056
|
-
}
|
|
20057
|
-
if (name === "--variable" || name === "--variable-json" || arg.startsWith("-V")) {
|
|
20058
|
-
const value2 = arg === "-V" || equals < 0 && !arg.startsWith("-V") ? args[++i] : arg.startsWith("-V") ? arg.slice(2) : arg.slice(equals + 1);
|
|
20059
|
-
if (!value2) fail3("Missing variable value");
|
|
20060
|
-
const split = Math.min(...[value2.indexOf("="), value2.indexOf(":")].filter((n) => n >= 0));
|
|
20061
|
-
const key2 = Number.isFinite(split) ? value2.slice(0, split) : value2;
|
|
20062
|
-
if (!key2 || ["__proto__", "constructor", "prototype"].includes(key2) || [...key2].some((ch) => !(ch >= "a" && ch <= "z") && !(ch >= "A" && ch <= "Z") && !(ch >= "0" && ch <= "9") && !"_-".includes(ch))) fail3("Invalid variable key");
|
|
20063
|
-
let content = Number.isFinite(split) ? value2.slice(split + 1) : true;
|
|
20064
|
-
if (name === "--variable-json") {
|
|
20065
|
-
try {
|
|
20066
|
-
content = JSON.parse(String(content));
|
|
20067
|
-
} catch {
|
|
20068
|
-
fail3("Invalid JSON variable value");
|
|
20069
|
-
}
|
|
20070
|
-
}
|
|
20071
|
-
if (Object.hasOwn(variables, key2)) {
|
|
20072
|
-
const previous = variables[key2];
|
|
20073
|
-
variables[key2] = [...Array.isArray(previous) ? previous : [previous], content];
|
|
20074
|
-
} else variables[key2] = content;
|
|
20075
|
-
options.variables = variables;
|
|
20076
|
-
continue;
|
|
20077
|
-
}
|
|
20078
|
-
if (name === "--pdf-engine") fail3("External PDF engines are forbidden; use the built-in TypeScript PDF writer");
|
|
20079
|
-
const publication = (/* @__PURE__ */ new Map([
|
|
20080
|
-
["--pdf-page-size", ["pdf", "pageSize"]],
|
|
20081
|
-
["--pdf-orientation", ["pdf", "orientation"]],
|
|
20082
|
-
["--pdf-margin", ["pdf", "margin"]],
|
|
20083
|
-
["--pdf-font-size", ["pdf", "fontSize"]],
|
|
20084
|
-
["--pdf-line-height", ["pdf", "lineHeight"]],
|
|
20085
|
-
["--epub-title", ["epub", "title"]],
|
|
20086
|
-
["--epub-language", ["epub", "language"]],
|
|
20087
|
-
["--epub-identifier", ["epub", "identifier"]],
|
|
20088
|
-
["--epub-chapter-level", ["epub", "chapterLevel"]]
|
|
20089
|
-
])).get(name);
|
|
20090
|
-
if (publication) {
|
|
20091
|
-
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20092
|
-
if (!value2) fail3(`Missing value: ${name}`);
|
|
20093
|
-
const [kind, key2] = publication;
|
|
20094
|
-
const numeric = ["margin", "fontSize", "lineHeight", "chapterLevel"].includes(key2);
|
|
20095
|
-
const entry = numeric ? Number(value2) : value2;
|
|
20096
|
-
options[kind] = { ...options[kind], [key2]: entry };
|
|
20097
|
-
continue;
|
|
20098
|
-
}
|
|
20099
|
-
if (name === "--pdf-font" || name === "--pdf-page") {
|
|
20100
|
-
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20101
|
-
if (!value2 || value2.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
20102
|
-
if (name === "--pdf-font") {
|
|
20103
|
-
if (["serif", "sans", "mono"].includes(value2)) options.pdf = { ...options.pdf, font: value2 };
|
|
20104
|
-
else pdfFonts.push(source(value2));
|
|
20105
|
-
} else {
|
|
20106
|
-
if (options.pdfPage !== void 0) fail3("Repeated pdf-page option");
|
|
20107
|
-
const parts = value2.split(",");
|
|
20108
|
-
if (parts.length !== 3 || parts.some((part) => !part.trim() || !Number.isFinite(Number(part)))) fail3("pdf-page requires WIDTH,HEIGHT,MARGIN in points");
|
|
20109
|
-
options.pdfPage = { width: Number(parts[0]), height: Number(parts[1]), margin: Number(parts[2]) };
|
|
20110
|
-
}
|
|
20111
|
-
continue;
|
|
20112
|
-
}
|
|
20113
|
-
if (name === "--resource-path" || name === "--extract-media") {
|
|
20114
|
-
const value2 = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20115
|
-
if (!value2 || value2.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
20116
|
-
if (name === "--resource-path") {
|
|
20117
|
-
const paths = value2.split(":");
|
|
20118
|
-
if (paths.some((path) => !path)) fail3("Empty resource-path directory");
|
|
20119
|
-
options.resourcePath = paths;
|
|
20120
|
-
} else {
|
|
20121
|
-
if (options.extractMedia !== void 0) fail3("Repeated extract-media option");
|
|
20122
|
-
options.extractMedia = value2;
|
|
20341
|
+
indent: this.indent,
|
|
20342
|
+
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
20343
|
+
};
|
|
20123
20344
|
}
|
|
20124
|
-
continue;
|
|
20125
|
-
}
|
|
20126
|
-
if (name === "--metadata-file") {
|
|
20127
|
-
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20128
|
-
if (!path || !path.endsWith(".json")) fail3("Metadata files must use .json; YAML is unsupported");
|
|
20129
|
-
metadataFiles.push(source(path, true));
|
|
20130
|
-
continue;
|
|
20131
|
-
}
|
|
20132
|
-
if (name === "-o" || name === "--output") {
|
|
20133
|
-
const path = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20134
|
-
if (!path || outputSeen || path !== "-" && !files.writeFile) fail3("Output requires one path and an explicit writeFile capability");
|
|
20135
|
-
outputSeen = true;
|
|
20136
|
-
destination2 = path === "-" ? void 0 : path;
|
|
20137
|
-
continue;
|
|
20138
20345
|
}
|
|
20139
|
-
|
|
20140
|
-
|
|
20141
|
-
|
|
20142
|
-
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
metadataJson.push({ [key2]: content });
|
|
20157
|
-
}
|
|
20158
|
-
continue;
|
|
20346
|
+
return null;
|
|
20347
|
+
}
|
|
20348
|
+
atIndentedComment(start, indent3) {
|
|
20349
|
+
if (this.type !== "comment")
|
|
20350
|
+
return false;
|
|
20351
|
+
if (this.indent <= indent3)
|
|
20352
|
+
return false;
|
|
20353
|
+
return start.every((st) => st.type === "newline" || st.type === "space");
|
|
20354
|
+
}
|
|
20355
|
+
*documentEnd(docEnd) {
|
|
20356
|
+
if (this.type !== "doc-mode") {
|
|
20357
|
+
if (docEnd.end)
|
|
20358
|
+
docEnd.end.push(this.sourceToken);
|
|
20359
|
+
else
|
|
20360
|
+
docEnd.end = [this.sourceToken];
|
|
20361
|
+
if (this.type === "newline")
|
|
20362
|
+
yield* this.pop();
|
|
20159
20363
|
}
|
|
20160
|
-
const key = names.get(name);
|
|
20161
|
-
if (!key) fail3(`Unsupported option: ${name}`);
|
|
20162
|
-
if (options[key] !== void 0) fail3(`Repeated option: ${name}`);
|
|
20163
|
-
const value = equals < 0 ? args[++i] : arg.slice(equals + 1);
|
|
20164
|
-
if (!value || value.startsWith("-")) fail3(`Missing value: ${name}`);
|
|
20165
|
-
if (key === "wrap") {
|
|
20166
|
-
if (!["none", "auto", "preserve"].includes(value)) fail3("Invalid wrap policy");
|
|
20167
|
-
options.wrap = value;
|
|
20168
|
-
} else if (key === "rawContent") {
|
|
20169
|
-
if (value !== "reject" && value !== "escape" && value !== "retain") fail3("Invalid raw-content policy");
|
|
20170
|
-
options.rawContent = value;
|
|
20171
|
-
} else if (key === "from" || key === "to") options[key] = value;
|
|
20172
20364
|
}
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20365
|
+
*lineEnd(token) {
|
|
20366
|
+
switch (this.type) {
|
|
20367
|
+
case "comma":
|
|
20368
|
+
case "doc-start":
|
|
20369
|
+
case "doc-end":
|
|
20370
|
+
case "flow-seq-end":
|
|
20371
|
+
case "flow-map-end":
|
|
20372
|
+
case "map-value-ind":
|
|
20373
|
+
yield* this.pop();
|
|
20374
|
+
yield* this.step();
|
|
20375
|
+
break;
|
|
20376
|
+
case "newline":
|
|
20377
|
+
this.onKeyLine = false;
|
|
20378
|
+
// fallthrough
|
|
20379
|
+
case "space":
|
|
20380
|
+
case "comment":
|
|
20381
|
+
default:
|
|
20382
|
+
if (token.end)
|
|
20383
|
+
token.end.push(this.sourceToken);
|
|
20384
|
+
else
|
|
20385
|
+
token.end = [this.sourceToken];
|
|
20386
|
+
if (this.type === "newline")
|
|
20387
|
+
yield* this.pop();
|
|
20388
|
+
}
|
|
20179
20389
|
}
|
|
20180
|
-
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
|
|
20390
|
+
};
|
|
20391
|
+
function parseOptions(options) {
|
|
20392
|
+
const prettyErrors = options.prettyErrors !== false;
|
|
20393
|
+
const lineCounter = options.lineCounter || prettyErrors && new LineCounter() || null;
|
|
20394
|
+
return { lineCounter, prettyErrors };
|
|
20395
|
+
}
|
|
20396
|
+
function parseDocument(source, options = {}) {
|
|
20397
|
+
const { lineCounter, prettyErrors } = parseOptions(options);
|
|
20398
|
+
const parser = new Parser(lineCounter?.addNewLine);
|
|
20399
|
+
const composer = new Composer(options);
|
|
20400
|
+
let doc = null;
|
|
20401
|
+
for (const _doc of composer.compose(parser.parse(source), true, source.length)) {
|
|
20402
|
+
if (!doc)
|
|
20403
|
+
doc = _doc;
|
|
20404
|
+
else if (doc.options.logLevel !== "silent") {
|
|
20405
|
+
doc.errors.push(new YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
20406
|
+
break;
|
|
20407
|
+
}
|
|
20188
20408
|
}
|
|
20189
|
-
if (
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
const media = resourceDirectory(options.extractMedia, files.cwd ?? "/");
|
|
20193
|
-
if (output === media || media === "/" || output.startsWith(`${media}/`)) fail3("Output cannot be inside the extraction directory");
|
|
20409
|
+
if (prettyErrors && lineCounter) {
|
|
20410
|
+
doc.errors.forEach(prettifyError(source, lineCounter));
|
|
20411
|
+
doc.warnings.forEach(prettifyError(source, lineCounter));
|
|
20194
20412
|
}
|
|
20195
|
-
return
|
|
20413
|
+
return doc;
|
|
20196
20414
|
}
|
|
20197
20415
|
async function resolveConversionArgs(args, files, signal, context = {}) {
|
|
20198
20416
|
const execution = new ExecutionContext("convert", { ...context, signal });
|
|
@@ -20316,122 +20534,6 @@ async function resolveConversionArgs(args, files, signal, context = {}) {
|
|
|
20316
20534
|
await execution.close();
|
|
20317
20535
|
}
|
|
20318
20536
|
}
|
|
20319
|
-
var languages2 = "abc\nactionscript\nada\nagda\napache\nasn1\nasp\nats\nawk\nbash\nbibtex\nboo\nc\nchangelog\nclojure\ncmake\ncoffee\ncoldfusion\ncomments\ncommonlisp\ncpp\ncrystal\ncs\ncss\ncurry\nd\ndart\ndebiancontrol\ndefault\ndiff\ndjangotemplate\ndockerfile\ndosbat\ndot\ndoxygen\ndoxygenlua\ndtd\neiffel\nelixir\nelm\nemail\nerlang\nfasm\nfortranfixed\nfortranfree\nfsharp\ngap\ngcc\ngdscript\ngleam\nglsl\ngnuassembler\ngo\ngpr\ngraphql\ngroovy\nhamlet\nhaskell\nhaxe\nhtml\nidris\nini\nisocpp\nj\njava\njavadoc\njavascript\njavascriptreact\njson\njsp\njulia\nkotlin\nlatex\nlex\nlilypond\nliteratecurry\nliteratehaskell\nllvm\nlua\nm4\nmakefile\nmandoc\nmarkdown\nmathematica\nmatlab\nmaxima\nmediawiki\nmetafont\nmips\nmodelines\nmodula2\nmodula3\nmonobasic\nmustache\nnasm\nnim\nnix\nnoweb\nobjectivec\nobjectivecpp\nocaml\noctave\nodin\nopencl\norgmode\npascal\nperl\nphp\npike\npostscript\npovray\npowershell\nprolog\nprotobuf\npure\npurebasic\npurescript\npython\nqml\nr\nracket\nraku\nrelaxng\nrelaxngcompact\nrest\nrhtml\nroff\nruby\nrust\nsass\nscala\nscheme\nsci\nscss\nsed\nsgml\nsml\nspdxcomments\nsql\nsqlmysql\nsqlpostgresql\nstan\nstata\nswift\nsystemverilog\ntcl\ntcsh\nterraform\ntexinfo\ntlaplus\ntoml\ntypescript\ntypst\nverilog\nvhdl\nxml\nxorg\nxslt\nxul\nyacc\nyaml\nzig\nzsh\n";
|
|
20320
|
-
var html5 = '<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$$if(dir)$ dir="$dir$"$endif$>\n<head>\n <meta charset="utf-8" />\n <meta name="generator" content="pandoc $pandoc-version$" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />\n$for(author-meta)$\n <meta name="author" content="$author-meta$" />\n$endfor$\n$if(date-meta)$\n <meta name="dcterms.date" content="$date-meta$" />\n$endif$\n$if(keywords)$\n <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />\n$endif$\n$if(description-meta)$\n <meta name="description" content="$description-meta$" />\n$endif$\n <title>$if(title-prefix)$$title-prefix$ \u2013 $endif$$pagetitle$</title>\n <style>\n $styles.html()$\n </style>\n$for(css)$\n <link rel="stylesheet" href="$css$" />\n$endfor$\n$for(header-includes)$\n $header-includes$\n$endfor$\n$if(math)$\n $math$\n$endif$\n</head>\n<body>\n$for(include-before)$\n$include-before$\n$endfor$\n$if(title)$\n<header id="title-block-header">\n<h1 class="title">$title$</h1>\n$if(subtitle)$\n<p class="subtitle">$subtitle$</p>\n$endif$\n$for(author)$\n<p class="author">$author$</p>\n$endfor$\n$if(date)$\n<p class="date">$date$</p>\n$endif$\n$if(abstract)$\n<div class="abstract">\n<div class="abstract-title">$abstract-title$</div>\n$abstract$\n</div>\n$endif$\n</header>\n$endif$\n$if(toc)$\n<nav id="$idprefix$TOC" role="doc-toc">\n$if(toc-title)$\n<h2 id="$idprefix$toc-title">$toc-title$</h2>\n$endif$\n$table-of-contents$\n</nav>\n$endif$\n$body$\n$for(include-after)$\n$include-after$\n$endfor$\n</body>\n</html>\n';
|
|
20321
|
-
var abbreviations = "aet.\naetat.\nal.\nApr.\nAug.\nbk.\nBros.\nc.\nCapt.\ncf.\nch.\nchap.\nchs.\nCo.\ncol.\nCorp.\ncp.\nd.\nDec.\nDr.\ne.g.\ned.\neds.\nesp.\nf.\nfasc.\nFeb.\nff.\nfig.\nfl.\nfol.\nfols.\nFr.\nGen.\nGov.\nHon.\ni.e.\nill.\nInc.\nincl.\nJan.\nJr.\nJul.\nJun.\nLtd.\nM.A.\nM.D.\nMar.\nMr.\nMrs.\nMs.\nn.\nn.b.\nnn.\nNo.\nNov.\nOct.\np.\nPh.D.\npp.\nPres.\nProf.\npt.\nq.v.\nRep.\nRev.\ns.v.\ns.vv.\nsaec.\nsec.\nSen.\nSep.\nSept.\nSgt.\nSr.\nSt.\nuniv.\nviz.\nvol.\nvs.\n";
|
|
20322
|
-
var highlightStyles = /* @__PURE__ */ new Map([["pygments", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": "#7d9029",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": "#880000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#007020",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#902000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#ba2121",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#40a070",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#06287e",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#008000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#007020",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#666666",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#007020",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#bc7a00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#bb6688",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#19177c",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#4070a0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#60a0b0",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["tango", '{\n "text-color": null,\n "background-color": "#f8f8f8",\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ef2929",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#a40000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#0000cf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#204a87",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#ce5c00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#ce5c00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#000000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#4e9a06",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#8f5902",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["espresso", '{\n "text-color": "#bdae9d",\n "background-color": "#2a211c",\n "line-number-color": "#bdae9d",\n "line-number-background-color": "#2a211c",\n "text-styles": {\n "Alert": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Constant": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#43a8ed",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "DecVal": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#44aa43",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#ff9358",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#0066ff",\n "background-color": null,\n "bold": true,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": "#43a8ed",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#049b0a",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#ffff00",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["zenburn", '{\n "text-color": "#cccccc",\n "background-color": "#303030",\n "line-number-color": null,\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ffcfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#f0dfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#dfdfbf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#dcdccc",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#c3bf9f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#c0bed1",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#efef8f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#f0dfaf",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#f0efd0",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#efef8f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#ffcfaf",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#dca3a3",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#cc9393",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#7f9f7f",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["kate", '{\n "text-color": "#1f1c1b",\n "background-color": "#ffffff",\n "line-number-color": "#a0a0a0",\n "line-number-background-color": "#ffffff",\n "text-styles": {\n "Alert": {\n "text-color": "#bf0303",\n "background-color": "#f7e6e6",\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#ca60ca",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#644a9b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#924c9d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#898887",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#0095ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#aa5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#607880",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Extension": {\n "text-color": "#0095ff",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#644a9b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#ff5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#b08000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Normal": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#1f1c1b",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#006e28",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#006e28",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "RegionMarker": {\n "text-color": "#0057ae",\n "background-color": "#e0e9f8",\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#ff5500",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#0057ae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#bf0303",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["monochrome", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": null,\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Comment": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "CommentVar": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "ControlFlow": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Documentation": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Error": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n },\n "Keyword": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": null,\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": true,\n "underline": false\n }\n }\n}\n'], ["breezedark", '{\n "text-color": "#cfcfc2",\n "background-color": "#232629",\n "line-number-color": "#7a7c7d",\n "line-number-background-color": "#232629",\n "text-styles": {\n "Alert": {\n "text-color": "#95da4c",\n "background-color": "#4d1f24",\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#3f8058",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": "#2980b9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BaseN": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": "#7f8c8d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#7a7c7d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#7f8c8d",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": "#27aeae",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#fdbc4b",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "DataType": {\n "text-color": "#2980b9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "DecVal": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#a43340",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": true\n },\n "Extension": {\n "text-color": "#0099ff",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Float": {\n "text-color": "#f67400",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Function": {\n "text-color": "#8e44ad",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#c45b00",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Normal": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": "#cfcfc2",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#27ae60",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "RegionMarker": {\n "text-color": "#2980b9",\n "background-color": "#153042",\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#3daee9",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#f44f4f",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": "#27aeae",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#da4453",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n }\n }\n}\n'], ["haddock", '{\n "text-color": null,\n "background-color": null,\n "line-number-color": "#aaaaaa",\n "line-number-background-color": null,\n "text-styles": {\n "Alert": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Annotation": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Attribute": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "BuiltIn": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Char": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Comment": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "CommentVar": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Constant": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "ControlFlow": {\n "text-color": "#0000ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Documentation": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Error": {\n "text-color": "#ff0000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n },\n "Extension": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Import": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Information": {\n "text-color": "#008000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Keyword": {\n "text-color": "#0000ff",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Operator": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Other": {\n "text-color": "#ff4000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Preprocessor": {\n "text-color": "#ff4000",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialChar": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "SpecialString": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "String": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Variable": {\n "text-color": null,\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "VerbatimString": {\n "text-color": "#008080",\n "background-color": null,\n "bold": false,\n "italic": false,\n "underline": false\n },\n "Warning": {\n "text-color": "#008000",\n "background-color": null,\n "bold": true,\n "italic": false,\n "underline": false\n }\n }\n}\n']]);
|
|
20323
|
-
function inspectAssets(args, context, help) {
|
|
20324
|
-
const first = args[0] ?? "";
|
|
20325
|
-
const modes = /* @__PURE__ */ new Map([
|
|
20326
|
-
["--list-highlight-languages", "languages"],
|
|
20327
|
-
["--list-highlight-styles", "styles"],
|
|
20328
|
-
["-D", "template"],
|
|
20329
|
-
["--print-default-template", "template"],
|
|
20330
|
-
["--print-default-data-file", "data"],
|
|
20331
|
-
["--print-highlight-style", "style"],
|
|
20332
|
-
["--completion", "completion"],
|
|
20333
|
-
["--bash-completion", "bash"]
|
|
20334
|
-
]);
|
|
20335
|
-
const equals = first.indexOf("=");
|
|
20336
|
-
const flag = equals < 0 ? first : first.slice(0, equals);
|
|
20337
|
-
const short = first.startsWith("-D") && first.length > 2;
|
|
20338
|
-
const mode = modes.get(short ? "-D" : flag);
|
|
20339
|
-
if (!mode) return void 0;
|
|
20340
|
-
const error = (message) => {
|
|
20341
|
-
throw new PandocError("E_OPTION", "convert", message);
|
|
20342
|
-
};
|
|
20343
|
-
if (mode === "languages" || mode === "styles" || mode === "bash") {
|
|
20344
|
-
if (args.length !== 1 || equals >= 0) return error("Use inspection flags alone");
|
|
20345
|
-
if (mode === "languages") return languages2;
|
|
20346
|
-
if (mode === "styles") return [...highlightStyles.keys()].join("\n") + "\n";
|
|
20347
|
-
}
|
|
20348
|
-
const attached = short ? first.slice(2) : equals < 0 ? void 0 : first.slice(equals + 1);
|
|
20349
|
-
const value = mode === "bash" ? "bash" : attached ?? args[1];
|
|
20350
|
-
if (!value || args.length !== (mode === "bash" || attached !== void 0 ? 1 : 2))
|
|
20351
|
-
return error("Use an inspection flag with exactly one value");
|
|
20352
|
-
if (mode === "template") {
|
|
20353
|
-
if (value === "html" || value === "html5") return html5;
|
|
20354
|
-
throw new PandocError("E_CAPABILITY", "convert", `No bundled default template for ${value}`);
|
|
20355
|
-
}
|
|
20356
|
-
if (mode === "data") {
|
|
20357
|
-
if (value === "abbreviations") return abbreviations;
|
|
20358
|
-
if (value === "templates/default.html5") return html5;
|
|
20359
|
-
throw new PandocError("E_RESOURCE", "convert", `No bundled data file: ${value}`);
|
|
20360
|
-
}
|
|
20361
|
-
if (mode === "style") {
|
|
20362
|
-
const style = highlightStyles.get(value);
|
|
20363
|
-
if (style !== void 0) return style;
|
|
20364
|
-
throw new PandocError("E_CAPABILITY", "convert", `No bundled highlight style: ${value}`);
|
|
20365
|
-
}
|
|
20366
|
-
if (value !== "bash") return error("Only bash completion is available");
|
|
20367
|
-
const registry = createFormatRegistry(void 0, context);
|
|
20368
|
-
const flags = [...new Set(help().split("\nUse -- before")[0].split("\n").join(" ").split(" ").flatMap((word) => word.split("/")).filter((word) => word.startsWith("--") || word.startsWith("-") && (word.charCodeAt(1) >= 65 && word.charCodeAt(1) <= 90 || word.charCodeAt(1) >= 97 && word.charCodeAt(1) <= 122)).map((word) => word.split("=")[0].split("[")[0]))];
|
|
20369
|
-
const quote = (words) => words.join(" ").replaceAll("'", "'\\''");
|
|
20370
|
-
return `_pandoc_typescript() {
|
|
20371
|
-
local cur="\${COMP_WORDS[COMP_CWORD]}" prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
20372
|
-
COMPREPLY=()
|
|
20373
|
-
case "$prev" in
|
|
20374
|
-
-f|-r|--from|--read) COMPREPLY=( $(compgen -W '${quote(registry.list("read"))}' -- "$cur") ) ;;
|
|
20375
|
-
-t|-w|--to|--write) COMPREPLY=( $(compgen -W '${quote(registry.list("write"))}' -- "$cur") ) ;;
|
|
20376
|
-
-D|--print-default-template) COMPREPLY=( $(compgen -W 'html html5' -- "$cur") ) ;;
|
|
20377
|
-
--print-default-data-file) COMPREPLY=( $(compgen -W 'abbreviations templates/default.html5' -- "$cur") ) ;;
|
|
20378
|
-
--print-highlight-style) COMPREPLY=( $(compgen -W '${quote([...highlightStyles.keys()])}' -- "$cur") ) ;;
|
|
20379
|
-
--completion) COMPREPLY=( $(compgen -W 'bash' -- "$cur") ) ;;
|
|
20380
|
-
*) case "$cur" in
|
|
20381
|
-
-*) COMPREPLY=( $(compgen -W '${quote(flags)}' -- "$cur") ) ;;
|
|
20382
|
-
*) COMPREPLY=( $(compgen -f -- "$cur") ) ;;
|
|
20383
|
-
esac ;;
|
|
20384
|
-
esac
|
|
20385
|
-
}
|
|
20386
|
-
complete -o filenames -o bashdefault -F _pandoc_typescript pandoc
|
|
20387
|
-
`;
|
|
20388
|
-
}
|
|
20389
|
-
function inspectCommand(args, context = {}) {
|
|
20390
|
-
if (args[0] === "--help" || args[0] === "-h") {
|
|
20391
|
-
if (!args.every((arg) => arg === "--help" || arg === "-h")) throw new PandocError("E_OPTION", "convert", "Use help flags alone");
|
|
20392
|
-
return "Usage: pandoc -f FORMAT -t FORMAT [OPTIONS] [FILE|- ...]\n--from/--read/-f/-r --to/--write/-t/-w --output/-o PATH (use - for stdout) --yes --standalone[=true|false]/-s\n--wrap=none|auto|preserve (auto/preserve: plain) --columns N (plain)\n--number-sections/-N --toc (HTML standalone) --ascii (HTML)\n--shift-heading-level-by -6..6 --strip-comments --eol=lf|crlf|native\n--metadata/-M KEY[=VALUE] (bare KEY is true) --metadata-file FILE.json --lossy --fail-if-warnings\n--defaults/-d FILE.yaml --template FILE --variable/-V KEY=VALUE --variable-json KEY:JSON\n--include-in-header/-H FILE --include-before-body/-B FILE --include-after-body/-A FILE\n--file-scope --sandbox (uses explicit VFS authority; no native sandbox guarantee)\n--resource-path DIR[:DIR] --extract-media DIR --raw-content=reject|escape|retain\n--pdf-page-size a4|letter --pdf-orientation portrait|landscape --pdf-margin POINTS\n--pdf-font FAMILY|PATH --pdf-font-size POINTS --pdf-line-height MULTIPLIER\nPDF families: mono bundled; serif/sans unavailable (E_CAPABILITY). Font paths use only the admitted VFS.\n--epub-title TEXT --epub-language TEXT --epub-identifier TEXT --epub-chapter-level 1..6\n--list-input-formats --list-output-formats --list-extensions FORMAT --help/-h --version/-v\n--list-highlight-languages --list-highlight-styles --print-highlight-style STYLE\n--print-default-template/-D html|html5 --print-default-data-file abbreviations --completion bash --bash-completion\nUse -- before literal filenames. No external PDF engines, ambient fonts, filters or network fetching.\nCapabilities (available directions):\n" + inspectFormats(["--list-input-formats", "--list-output-formats"], context);
|
|
20393
|
-
}
|
|
20394
|
-
if (args[0] === "--version" || args[0] === "-v") {
|
|
20395
|
-
if (args.length !== 1) throw new PandocError("E_OPTION", "convert", "Use --version alone");
|
|
20396
|
-
return "pandoc TypeScript converter 0.0.1 (original bounded implementation)\n";
|
|
20397
|
-
}
|
|
20398
|
-
const asset = inspectAssets(args, context, () => inspectCommand(["--help"], context));
|
|
20399
|
-
if (asset !== void 0) return asset;
|
|
20400
|
-
if (args[0]?.startsWith("--list-")) return inspectFormats(args, context);
|
|
20401
|
-
return void 0;
|
|
20402
|
-
}
|
|
20403
|
-
function inspectFormats(args, context = {}) {
|
|
20404
|
-
const registry = createFormatRegistry(void 0, context);
|
|
20405
|
-
const error = () => {
|
|
20406
|
-
throw new PandocError(
|
|
20407
|
-
"E_OPTION",
|
|
20408
|
-
"convert",
|
|
20409
|
-
"Use format listing flags alone, or --list-extensions FORMAT"
|
|
20410
|
-
);
|
|
20411
|
-
};
|
|
20412
|
-
if (args[0] === "--list-extensions" && args.length === 2)
|
|
20413
|
-
return registry.listExtensions(args[1]).map((name) => `${name}
|
|
20414
|
-
`).join("");
|
|
20415
|
-
if (args.length === 1 && args[0].startsWith("--list-extensions="))
|
|
20416
|
-
return registry.listExtensions(args[0].slice("--list-extensions=".length)).map((name) => `${name}
|
|
20417
|
-
`).join("");
|
|
20418
|
-
const directions = /* @__PURE__ */ new Set();
|
|
20419
|
-
const flags = /* @__PURE__ */ new Map([
|
|
20420
|
-
["--list-input-formats", "read"],
|
|
20421
|
-
["--list-output-formats", "write"]
|
|
20422
|
-
]);
|
|
20423
|
-
for (const arg of args) {
|
|
20424
|
-
const direction = flags.get(arg);
|
|
20425
|
-
if (!direction) return error();
|
|
20426
|
-
directions.add(direction);
|
|
20427
|
-
}
|
|
20428
|
-
if (!directions.size) return error();
|
|
20429
|
-
return ["read", "write"].filter((direction) => directions.has(direction)).map(
|
|
20430
|
-
(direction) => (directions.size === 2 ? `${direction === "read" ? "Input" : "Output"} formats:
|
|
20431
|
-
` : "") + registry.list(direction).map((name) => `${name}
|
|
20432
|
-
`).join("")
|
|
20433
|
-
).join("");
|
|
20434
|
-
}
|
|
20435
20537
|
var statuses = {
|
|
20436
20538
|
E_FORMAT_REQUIRED: 2,
|
|
20437
20539
|
E_FORMAT: 2,
|
|
@@ -20482,7 +20584,7 @@ function createPandocCommand(options = {}, hasCommand) {
|
|
|
20482
20584
|
const limits = { ...options.limits };
|
|
20483
20585
|
const configuredFilters = options.filters;
|
|
20484
20586
|
const citeprocCapability = createCiteprocFilterCapability(options.citeproc);
|
|
20485
|
-
|
|
20587
|
+
const command = { name: "pandoc", description: "Convert documents with the original bounded TypeScript SDK", async execute(context) {
|
|
20486
20588
|
context.signal.throwIfAborted();
|
|
20487
20589
|
const invocation = createOutputOperation(context, { write: async () => {
|
|
20488
20590
|
} });
|
|
@@ -20669,6 +20771,11 @@ function createPandocCommand(options = {}, hasCommand) {
|
|
|
20669
20771
|
await invocation.close();
|
|
20670
20772
|
}
|
|
20671
20773
|
} };
|
|
20774
|
+
syncCommandEvaluators.evalSyncPandoc = evalSyncPandoc;
|
|
20775
|
+
if (options.limits === void 0 && options.filters === void 0 && options.jsonFilterCommand === void 0 && options.citeproc === void 0) {
|
|
20776
|
+
builtInDirectContextExecutors.add(command.execute);
|
|
20777
|
+
}
|
|
20778
|
+
return command;
|
|
20672
20779
|
}
|
|
20673
20780
|
function createPandocCommands(options = {}) {
|
|
20674
20781
|
return [createPandocCommand(options)];
|
|
@@ -20686,13 +20793,16 @@ function pandocCommands(options = {}) {
|
|
|
20686
20793
|
}
|
|
20687
20794
|
|
|
20688
20795
|
export {
|
|
20689
|
-
normalizeDocument,
|
|
20690
|
-
normalizeDocumentCooperatively,
|
|
20691
20796
|
ast_types_exports,
|
|
20692
20797
|
pdfReader,
|
|
20693
20798
|
coreFormats,
|
|
20694
20799
|
createFormatRegistry,
|
|
20695
20800
|
formatCapabilities,
|
|
20801
|
+
inspectCommand,
|
|
20802
|
+
inspectFormats,
|
|
20803
|
+
parseConversionArgs,
|
|
20804
|
+
normalizeDocument,
|
|
20805
|
+
normalizeDocumentCooperatively,
|
|
20696
20806
|
defaultLimits,
|
|
20697
20807
|
ExecutionContext,
|
|
20698
20808
|
createExecutionContext,
|
|
@@ -20700,11 +20810,9 @@ export {
|
|
|
20700
20810
|
writeDocument,
|
|
20701
20811
|
convert,
|
|
20702
20812
|
convertSync,
|
|
20813
|
+
evalSyncPandoc,
|
|
20703
20814
|
createJsonFilterCapability,
|
|
20704
|
-
parseConversionArgs,
|
|
20705
20815
|
resolveConversionArgs,
|
|
20706
|
-
inspectCommand,
|
|
20707
|
-
inspectFormats,
|
|
20708
20816
|
createPandocCommand,
|
|
20709
20817
|
createPandocCommands,
|
|
20710
20818
|
pandocCommands
|