anyfile-cli 0.0.0-stage → 0.2.1
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/LICENSE +177 -0
- package/README.md +55 -2
- package/SKILL.md +101 -0
- package/chunks/browser-probe-5STDX455.mjs +17 -0
- package/chunks/browser-probe-F5RX44T3.mjs +24 -0
- package/chunks/chunk-2C34VMNV.mjs +108 -0
- package/chunks/chunk-3OZ56PUH.mjs +97 -0
- package/chunks/chunk-3YRWCQGV.mjs +38 -0
- package/chunks/chunk-53MJMIN4.mjs +23 -0
- package/chunks/chunk-5LOC7IST.mjs +372 -0
- package/chunks/chunk-5XTYLZF3.mjs +559 -0
- package/chunks/chunk-5ZHDYRGV.mjs +64 -0
- package/chunks/chunk-6CQL4K2K.mjs +21 -0
- package/chunks/chunk-6EVJJFOH.mjs +243 -0
- package/chunks/chunk-6NWSQGYE.mjs +68 -0
- package/chunks/chunk-7O5JLQE7.mjs +1 -0
- package/chunks/chunk-A6AQI6DF.mjs +321 -0
- package/chunks/chunk-AYF63UBE.mjs +79 -0
- package/chunks/chunk-B27PR6Q4.mjs +17 -0
- package/chunks/chunk-BP7LORL4.mjs +13 -0
- package/chunks/chunk-BVCRJLCD.mjs +109 -0
- package/chunks/chunk-CLSEE3VA.mjs +28 -0
- package/chunks/chunk-CO2ZAQIK.mjs +52 -0
- package/chunks/chunk-CQWM5GMU.mjs +167 -0
- package/chunks/chunk-CZFFYCMJ.mjs +136 -0
- package/chunks/chunk-D3CS6TIK.mjs +419 -0
- package/chunks/chunk-DJLFVMDJ.mjs +807 -0
- package/chunks/chunk-DJXVCKIO.mjs +30 -0
- package/chunks/chunk-EMXODK3K.mjs +94 -0
- package/chunks/chunk-EOJ7ZCDK.mjs +227 -0
- package/chunks/chunk-H4TBN22D.mjs +100 -0
- package/chunks/chunk-HI7TURZM.mjs +2256 -0
- package/chunks/chunk-HUSX3ZU3.mjs +58 -0
- package/chunks/chunk-IC3G2XE2.mjs +436 -0
- package/chunks/chunk-IGEGIF35.mjs +2034 -0
- package/chunks/chunk-IZGTVZHE.mjs +90 -0
- package/chunks/chunk-J4G7LUPA.mjs +117 -0
- package/chunks/chunk-JBAJW66L.mjs +4220 -0
- package/chunks/chunk-JKQUF2MM.mjs +438 -0
- package/chunks/chunk-KAMPC5TK.mjs +131 -0
- package/chunks/chunk-KSKEMJVC.mjs +145 -0
- package/chunks/chunk-LRHHRZLE.mjs +29 -0
- package/chunks/chunk-M37ZOAUG.mjs +93 -0
- package/chunks/chunk-MG7LUDXO.mjs +187 -0
- package/chunks/chunk-NGVHHTQD.mjs +125 -0
- package/chunks/chunk-NQ7J2NH6.mjs +50 -0
- package/chunks/chunk-NUMNHVSI.mjs +60 -0
- package/chunks/chunk-ORJ3DN65.mjs +58 -0
- package/chunks/chunk-QOUEBPPL.mjs +15 -0
- package/chunks/chunk-QR3Y3UKM.mjs +194 -0
- package/chunks/chunk-RFKYE7SE.mjs +50 -0
- package/chunks/chunk-SH57XOAV.mjs +33 -0
- package/chunks/chunk-TB5ISPA4.mjs +1 -0
- package/chunks/chunk-UGAU3V4V.mjs +206 -0
- package/chunks/chunk-WDN6NMVU.mjs +36 -0
- package/chunks/chunk-WWTLSPEG.mjs +3999 -0
- package/chunks/chunk-XDW56XVX.mjs +69 -0
- package/chunks/chunk-XRT7TAAY.mjs +27 -0
- package/chunks/chunk-XTW4HNIJ.mjs +418 -0
- package/chunks/chunk-YPLWNGCC.mjs +17 -0
- package/chunks/chunk-ZBR7RQQE.mjs +64 -0
- package/chunks/chunk-ZUHJIGHP.mjs +300 -0
- package/chunks/deflate-IINN6MRE.mjs +19 -0
- package/chunks/jpeg-N3DSYEAQ.mjs +964 -0
- package/chunks/jxl_oxide_wasm-3UN6G3YN.mjs +589 -0
- package/chunks/lerc-5LP7Q554.mjs +2086 -0
- package/chunks/lzw-Z2ZZBEWD.mjs +137 -0
- package/chunks/packbits-3S2JASDB.mjs +34 -0
- package/chunks/pdf.worker-PUGU2NS2.mjs +67416 -0
- package/chunks/probe-22WNVZ3I.mjs +17 -0
- package/chunks/probe-2P4CTFCY.mjs +14 -0
- package/chunks/probe-2QBNDPYK.mjs +18 -0
- package/chunks/probe-34TOVXUI.mjs +11 -0
- package/chunks/probe-3W2HOWBM.mjs +20 -0
- package/chunks/probe-42OBMD35.mjs +23 -0
- package/chunks/probe-43RVHUBG.mjs +17 -0
- package/chunks/probe-4O362IEX.mjs +18 -0
- package/chunks/probe-4WF34ZXS.mjs +11 -0
- package/chunks/probe-5ZITS3T5.mjs +40 -0
- package/chunks/probe-5ZS5DHFP.mjs +21 -0
- package/chunks/probe-62RFYKCP.mjs +14 -0
- package/chunks/probe-64JTFRH4.mjs +41 -0
- package/chunks/probe-6YJQJJ3R.mjs +518 -0
- package/chunks/probe-6YMOOV53.mjs +39 -0
- package/chunks/probe-BYBD2WAK.mjs +239 -0
- package/chunks/probe-CZZNJOHV.mjs +20 -0
- package/chunks/probe-DJMPK6HU.mjs +11 -0
- package/chunks/probe-FMWIF4LX.mjs +33 -0
- package/chunks/probe-FYPH6CYY.mjs +206 -0
- package/chunks/probe-G6PPXKBE.mjs +15 -0
- package/chunks/probe-GJ5OUOQ3.mjs +32 -0
- package/chunks/probe-H6J7TUY2.mjs +95 -0
- package/chunks/probe-IGZ47OE3.mjs +68 -0
- package/chunks/probe-IL5HO3OK.mjs +46 -0
- package/chunks/probe-INYCDZHO.mjs +27 -0
- package/chunks/probe-JFH545GO.mjs +11 -0
- package/chunks/probe-JZYDRITV.mjs +18 -0
- package/chunks/probe-K3WW5O5K.mjs +26 -0
- package/chunks/probe-KB4T466L.mjs +70 -0
- package/chunks/probe-KY7SIIXD.mjs +13 -0
- package/chunks/probe-L2P263WT.mjs +16 -0
- package/chunks/probe-LEP3RQPD.mjs +11 -0
- package/chunks/probe-M2QWULOI.mjs +119 -0
- package/chunks/probe-M7AYZBD3.mjs +35 -0
- package/chunks/probe-MEN3BMBB.mjs +22 -0
- package/chunks/probe-MNIGKDWT.mjs +163 -0
- package/chunks/probe-NFVFWB4M.mjs +56 -0
- package/chunks/probe-NJGSTL6R.mjs +161 -0
- package/chunks/probe-O73EHWT3.mjs +14 -0
- package/chunks/probe-OG2XYCG2.mjs +25 -0
- package/chunks/probe-OTKJKTNS.mjs +10 -0
- package/chunks/probe-OZKO3C2V.mjs +27 -0
- package/chunks/probe-PBL4KITG.mjs +12 -0
- package/chunks/probe-PEFZNH2T.mjs +21 -0
- package/chunks/probe-R4SSEXES.mjs +27 -0
- package/chunks/probe-RCAUVV27.mjs +29 -0
- package/chunks/probe-RPGBKGPI.mjs +20 -0
- package/chunks/probe-S2I46SEO.mjs +10 -0
- package/chunks/probe-SGDD4U4Q.mjs +165 -0
- package/chunks/probe-SPQO5LHI.mjs +9 -0
- package/chunks/probe-TBR6UGRZ.mjs +19 -0
- package/chunks/probe-TNKNILAW.mjs +21 -0
- package/chunks/probe-TVRJBPXH.mjs +48 -0
- package/chunks/probe-UESMTUQ5.mjs +33 -0
- package/chunks/probe-VDXFEZ5Q.mjs +16 -0
- package/chunks/probe-VX7JCDW6.mjs +39 -0
- package/chunks/probe-W7M55OPE.mjs +64 -0
- package/chunks/probe-XUBTIWGE.mjs +13 -0
- package/chunks/probe-ZF7KIRHO.mjs +36 -0
- package/chunks/raw-JJRPYAXO.mjs +16 -0
- package/chunks/tiff-metadata-7MWLNVW2.mjs +2990 -0
- package/chunks/webimage-D6XSCCTJ.mjs +56 -0
- package/chunks/zip-reader-YUGANW4Z.mjs +92 -0
- package/chunks/zstd-AH2S24PU.mjs +121 -0
- package/cli-main.mjs +297 -0
- package/cli.mjs +3 -0
- package/extractors/apple-plist.mjs +145 -0
- package/extractors/archive-metadata-viewer.mjs +1401 -0
- package/extractors/bittorrent-metadata.mjs +369 -0
- package/extractors/calendar-contacts.mjs +328 -0
- package/extractors/camera-raw.mjs +201 -0
- package/extractors/chm-reader.mjs +1842 -0
- package/extractors/comic-book-reader.mjs +307 -0
- package/extractors/design-source.mjs +1801 -0
- package/extractors/dev-array-viewer.mjs +825 -0
- package/extractors/dev-native-binary-viewer.mjs +1661 -0
- package/extractors/dev-source-map-viewer.mjs +416 -0
- package/extractors/dev-wasm-viewer.mjs +506 -0
- package/extractors/dicom.mjs +383 -0
- package/extractors/djvu-reader.mjs +337 -0
- package/extractors/duckdb-data.mjs +49174 -0
- package/extractors/epub-reader.mjs +222 -0
- package/extractors/excel-workbook.mjs +27057 -0
- package/extractors/fictionbook-reader.mjs +362 -0
- package/extractors/font-viewer.mjs +441 -0
- package/extractors/general-raster.mjs +444 -0
- package/extractors/hdr-image.mjs +1685 -0
- package/extractors/http-archive.mjs +306 -0
- package/extractors/ifc.mjs +341 -0
- package/extractors/iwork.mjs +640 -0
- package/extractors/microsoft-project.mjs +174 -0
- package/extractors/mind-map.mjs +607 -0
- package/extractors/ml-weights.mjs +649 -0
- package/extractors/modern-raster.mjs +620 -0
- package/extractors/ofd-reader.mjs +973 -0
- package/extractors/outlook-pst.mjs +997 -0
- package/extractors/pdfjs-pdf.mjs +32056 -0
- package/extractors/photoshop-document.mjs +17448 -0
- package/extractors/safe-svg.mjs +163 -0
- package/extractors/scientific-data.mjs +2041 -0
- package/extractors/sqlite-database.mjs +333 -0
- package/extractors/statistical-data.mjs +297 -0
- package/extractors/visio.mjs +141 -0
- package/extractors/x509-certificate.mjs +588 -0
- package/extractors/xps-reader.mjs +896 -0
- package/index.mjs +83 -0
- package/licenses/dicom-parser/1.8.21/LICENSE +21 -0
- package/licenses/libraw-wasm/1.6.0/COPYRIGHT.LibRaw +27 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.Emscripten +102 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.LibRaw-CDDL-1.0 +340 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.Little-CMS-MIT +22 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.libpng +134 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.libraw-wasm-ISC +15 -0
- package/licenses/libraw-wasm/1.6.0/LICENSE.zlib +22 -0
- package/licenses/libraw-wasm/1.6.0/NOTICE.IJG-libjpeg +49 -0
- package/licenses/libraw-wasm/1.6.0/SOURCE.md +25 -0
- package/licenses/libraw-wasm/1.6.0/THIRD_PARTY_NOTICES.md +14 -0
- package/licenses/mediabunny/1.55.3/MPL-2.0.txt +373 -0
- package/licenses/mediabunny/1.55.3/SOURCE.md +16 -0
- package/licenses/openskp/1.3.0/LICENSE +21 -0
- package/package.json +34 -4
- package/renderer-host/assets/ColladaComposer-TCm9fgZa.js +1 -0
- package/renderer-host/assets/ColladaParser-BHTzbhBz.js +3 -0
- package/renderer-host/assets/FBXLoader-D1vDnL3o.js +8 -0
- package/renderer-host/assets/agent-CKvDbj87.js +1 -0
- package/renderer-host/assets/amf-BkE--DNX.js +1 -0
- package/renderer-host/assets/animation-Dt0WW2cB.js +1 -0
- package/renderer-host/assets/archive-client-CL5yOgwH.js +1 -0
- package/renderer-host/assets/archive.worker-CcLnJ9FC.js +1 -0
- package/renderer-host/assets/audio-visualizer-CiyGNhY2.js +1 -0
- package/renderer-host/assets/basedecoder-BuG7fe0q.js +1 -0
- package/renderer-host/assets/book-source-28BQcBKR.js +1 -0
- package/renderer-host/assets/book-worker-DUt14LJO.js +1 -0
- package/renderer-host/assets/browser-C0pGRq_c.js +1 -0
- package/renderer-host/assets/client-CU2ERPtk.js +1 -0
- package/renderer-host/assets/container-inspection-ekEPWWcy.js +1 -0
- package/renderer-host/assets/data-table-OJQe3aN5.js +1 -0
- package/renderer-host/assets/decode-hBroL8C1.js +1 -0
- package/renderer-host/assets/decode-tiff-CP1xdrF_.js +5 -0
- package/renderer-host/assets/decoder-worker-B0sdTVlF.js +1 -0
- package/renderer-host/assets/decoder-worker-CBiHE971.js +3 -0
- package/renderer-host/assets/decoder-worker-Cr5oP97p.js +5 -0
- package/renderer-host/assets/decoder-worker-DIdLFebY.js +11 -0
- package/renderer-host/assets/decoder-worker-DLeuEYxq.js +1 -0
- package/renderer-host/assets/decoder.worker-BXAaF0Qj.js +1 -0
- package/renderer-host/assets/decoder.worker-yaM6uups.js +1 -0
- package/renderer-host/assets/deflate-DPjr4M2G.js +1 -0
- package/renderer-host/assets/deflate-S3QmZI-f.js +1 -0
- package/renderer-host/assets/dual-track-playback-CxjGms-W.js +1 -0
- package/renderer-host/assets/ext-searchbox-BIdon51Z.js +164 -0
- package/renderer-host/assets/ffmpeg-playback-DzCJz9Ny.js +1 -0
- package/renderer-host/assets/gltf-PozNLKNg.js +1 -0
- package/renderer-host/assets/hdf5.worker-BO3TrRup.js +1 -0
- package/renderer-host/assets/heif-worker-CC9DI3ZR.js +1 -0
- package/renderer-host/assets/id3-uzaDmDwy.js +1 -0
- package/renderer-host/assets/ifc.worker-KIbgAIsy.js +1 -0
- package/renderer-host/assets/image-load-SK3ULGWm.js +1 -0
- package/renderer-host/assets/index-DtiyOy_J.js +2 -0
- package/renderer-host/assets/jpeg-AGQ46WDa.js +1 -0
- package/renderer-host/assets/jpeg-Dm0yBuYB.js +1 -0
- package/renderer-host/assets/jszip.min-DCdQ6XWv.js +2 -0
- package/renderer-host/assets/jxl_oxide_wasm-BJKDqoXP.js +1 -0
- package/renderer-host/assets/jxl_oxide_wasm_bg-C5JqlrFv.wasm +0 -0
- package/renderer-host/assets/kernel.worker-B58X9XWu.js +1 -0
- package/renderer-host/assets/kernel.worker-BcQYKb39.js +8 -0
- package/renderer-host/assets/kernel.worker-BdWmPdqg.js +1 -0
- package/renderer-host/assets/kernel.worker-C7qxomuK.js +1 -0
- package/renderer-host/assets/kernel.worker-D88TbQnz.js +1 -0
- package/renderer-host/assets/laz-Lt10LsWd.js +1 -0
- package/renderer-host/assets/lerc-BxVqCKaH.js +3 -0
- package/renderer-host/assets/lerc-Cuor-Zm2.js +1 -0
- package/renderer-host/assets/lzw-D2FslT4L.js +1 -0
- package/renderer-host/assets/lzw-DODNa9l5.js +1 -0
- package/renderer-host/assets/mediabunny-viewer-BniHVEWJ.js +16 -0
- package/renderer-host/assets/model-Drd3vqcF.js +1 -0
- package/renderer-host/assets/obj-B3p81LL2.js +9 -0
- package/renderer-host/assets/off-QQbiKPTX.js +1 -0
- package/renderer-host/assets/ogg-probe-C2TT74FL.js +1 -0
- package/renderer-host/assets/ogg-viewer-Dc8K-tas.js +9 -0
- package/renderer-host/assets/packbits-DCimUQ1T.js +1 -0
- package/renderer-host/assets/paged-C8AQD7sX.js +319 -0
- package/renderer-host/assets/pako.esm-0UYEm1Jg.js +2 -0
- package/renderer-host/assets/pako.esm-CtVA0R7W.js +1 -0
- package/renderer-host/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
- package/renderer-host/assets/ply-C3_RRA7n.js +2 -0
- package/renderer-host/assets/points.worker-CA8v75dl.js +2 -0
- package/renderer-host/assets/probe-asf-C_UpCBly.js +14 -0
- package/renderer-host/assets/range-reader-BMfLhWcp.js +1 -0
- package/renderer-host/assets/raw-A-vJRPpa.js +1 -0
- package/renderer-host/assets/resource-cache-CHocY8K3.js +1 -0
- package/renderer-host/assets/resources-6AmS6O5e.js +1 -0
- package/renderer-host/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/renderer-host/assets/safe-content-CWHf8jex.js +1 -0
- package/renderer-host/assets/sanitize-D56ODnaM.js +1 -0
- package/renderer-host/assets/scene-adapter-CaCLr1am.js +1 -0
- package/renderer-host/assets/scene.worker-CJViWLYo.js +24 -0
- package/renderer-host/assets/scene.worker-D7koFZY8.js +2 -0
- package/renderer-host/assets/skp-adapter-jl6q24fW.js +1 -0
- package/renderer-host/assets/skp.worker-D9ujTXFV.js +1 -0
- package/renderer-host/assets/src-1Won7FxU.js +88 -0
- package/renderer-host/assets/src-3RoHqOkA.js +7 -0
- package/renderer-host/assets/src-4zBOL6Jt.js +1 -0
- package/renderer-host/assets/src-6v8-hoR3.js +24 -0
- package/renderer-host/assets/src-8Jx9gbII.js +1 -0
- package/renderer-host/assets/src-B1WA0dRu.js +64 -0
- package/renderer-host/assets/src-B5ijbemo.js +9 -0
- package/renderer-host/assets/src-B8DH2GJe.js +17 -0
- package/renderer-host/assets/src-B9t_iEO3.js +58 -0
- package/renderer-host/assets/src-BCC58C0X.js +1 -0
- package/renderer-host/assets/src-BCwENs26.js +1 -0
- package/renderer-host/assets/src-BEirBh4c.js +27 -0
- package/renderer-host/assets/src-BHR6n7Fj.js +1 -0
- package/renderer-host/assets/src-BIlLq0QT.js +169 -0
- package/renderer-host/assets/src-BKlK1jcN.js +1 -0
- package/renderer-host/assets/src-BN0FUJhs.js +8 -0
- package/renderer-host/assets/src-BWElAdlq.js +52 -0
- package/renderer-host/assets/src-BXg11IjY.js +4 -0
- package/renderer-host/assets/src-BbBdnTjJ.js +2 -0
- package/renderer-host/assets/src-BbFZbZsL.js +2 -0
- package/renderer-host/assets/src-BdPbFRd-.js +24 -0
- package/renderer-host/assets/src-BpbGaBrT.js +182 -0
- package/renderer-host/assets/src-BwIl76_H.js +7 -0
- package/renderer-host/assets/src-C2e6QJIj.js +10 -0
- package/renderer-host/assets/src-C2gNidHF.js +989 -0
- package/renderer-host/assets/src-C9Uz3C-q.js +432 -0
- package/renderer-host/assets/src-CBUhG6W5.js +7 -0
- package/renderer-host/assets/src-CQDGi3Qa.js +10 -0
- package/renderer-host/assets/src-CRLCRg0N.js +21 -0
- package/renderer-host/assets/src-CS5rqxBy.js +10 -0
- package/renderer-host/assets/src-CWZdSJQw.js +7 -0
- package/renderer-host/assets/src-CXnpsVpU.js +27 -0
- package/renderer-host/assets/src-CnhXvqQY.js +8 -0
- package/renderer-host/assets/src-CpExg0ZA.js +9 -0
- package/renderer-host/assets/src-CrLmL3wU.js +5 -0
- package/renderer-host/assets/src-CrYEJ5uz.js +2 -0
- package/renderer-host/assets/src-D-iIkSqZ.js +222 -0
- package/renderer-host/assets/src-D6sH9uTT.js +23 -0
- package/renderer-host/assets/src-D8zHDJh_.js +10 -0
- package/renderer-host/assets/src-D9OFaPNV.js +1 -0
- package/renderer-host/assets/src-DCI_ff7c.js +1 -0
- package/renderer-host/assets/src-DCrbiTpH.js +18 -0
- package/renderer-host/assets/src-DK8DvtMd.js +115 -0
- package/renderer-host/assets/src-DWGlOVjt.js +17 -0
- package/renderer-host/assets/src-DbvEX_Ct.js +6 -0
- package/renderer-host/assets/src-Dezc2dj1.js +1 -0
- package/renderer-host/assets/src-Dh5VD1lL.js +11 -0
- package/renderer-host/assets/src-DlwABqw5.js +1 -0
- package/renderer-host/assets/src-DlxETlTh.js +44 -0
- package/renderer-host/assets/src-Dmd6BvBh.js +387 -0
- package/renderer-host/assets/src-DpgvaJNJ.js +24 -0
- package/renderer-host/assets/src-DpjRB2sv.js +1 -0
- package/renderer-host/assets/src-Dvn41FR7.js +90 -0
- package/renderer-host/assets/src-DwcPYp7X.js +1 -0
- package/renderer-host/assets/src-HUxhcDlO.js +2 -0
- package/renderer-host/assets/src-Jhqg3J8L.js +2 -0
- package/renderer-host/assets/src-MO5bLsLj.js +4126 -0
- package/renderer-host/assets/src-N8XBQaK4.js +20 -0
- package/renderer-host/assets/src-XZ_0U972.js +1 -0
- package/renderer-host/assets/src-Y6mXl4vh.js +29 -0
- package/renderer-host/assets/src-b9aXVJde.js +100 -0
- package/renderer-host/assets/src-d2U6neq8.js +37 -0
- package/renderer-host/assets/src-hCrza_Lf.js +1 -0
- package/renderer-host/assets/src-jUGjKzOV.js +1 -0
- package/renderer-host/assets/src-rJN_jaC5.js +1 -0
- package/renderer-host/assets/src-vOBd-1zk.js +5 -0
- package/renderer-host/assets/src-wrrVkfrK.js +1 -0
- package/renderer-host/assets/src-yCrAObB-.js +1 -0
- package/renderer-host/assets/src-zrBiCtay.js +7 -0
- package/renderer-host/assets/stl-adapter-CLkWHoOn.js +1 -0
- package/renderer-host/assets/stl.worker-C-anHijM.js +1 -0
- package/renderer-host/assets/three-mf-BSrcsdQD.js +2 -0
- package/renderer-host/assets/webimage-zQMH-_zR.js +1 -0
- package/renderer-host/assets/webm-14HHwfWy.js +1 -0
- package/renderer-host/assets/worker-QK2gViTu.js +1 -0
- package/renderer-host/assets/x6-dng-worker-CNf3zUP-.js +1 -0
- package/renderer-host/assets/xml.browser-CC8-XAyN.js +1 -0
- package/renderer-host/assets/zip-core-base-DD8akpjq.js +1 -0
- package/renderer-host/assets/zip-core-custom-CfPFs1lw.js +1 -0
- package/renderer-host/assets/zip-source-CLF3Hfcg.js +1 -0
- package/renderer-host/assets/zstd-CmwSLjHB.js +1 -0
- package/renderer-host/assets/zstd-i4Jwubnx.js +1 -0
- package/renderer-host/index.html +65 -0
- package/vendor-manifest.json +1433 -0
- package/worker.mjs +262 -0
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { createRequire as __anyfileCreateRequire } from "node:module"; import { dirname as __anyfileDirname } from "node:path"; import { fileURLToPath as __anyfileFileURLToPath } from "node:url"; const require = __anyfileCreateRequire(import.meta.url); const __filename = __anyfileFileURLToPath(import.meta.url); const __dirname = __anyfileDirname(__filename);
|
|
2
|
+
import {
|
|
3
|
+
sanitizeSvg
|
|
4
|
+
} from "../chunks/chunk-3OZ56PUH.mjs";
|
|
5
|
+
import {
|
|
6
|
+
openBookZip
|
|
7
|
+
} from "../chunks/chunk-NGVHHTQD.mjs";
|
|
8
|
+
import {
|
|
9
|
+
readBookZipCatalog
|
|
10
|
+
} from "../chunks/chunk-ZBR7RQQE.mjs";
|
|
11
|
+
import "../chunks/chunk-KSKEMJVC.mjs";
|
|
12
|
+
import "../chunks/chunk-XDW56XVX.mjs";
|
|
13
|
+
import "../chunks/chunk-D3CS6TIK.mjs";
|
|
14
|
+
import "../chunks/chunk-WWTLSPEG.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ProtectedBookError
|
|
17
|
+
} from "../chunks/chunk-BP7LORL4.mjs";
|
|
18
|
+
import {
|
|
19
|
+
parseXmlDocument
|
|
20
|
+
} from "../chunks/chunk-53MJMIN4.mjs";
|
|
21
|
+
import {
|
|
22
|
+
AgentError,
|
|
23
|
+
ViewerError,
|
|
24
|
+
abortError,
|
|
25
|
+
isViewerAbortError,
|
|
26
|
+
markdownDocumentHeader,
|
|
27
|
+
readPagedTextDocument
|
|
28
|
+
} from "../chunks/chunk-IC3G2XE2.mjs";
|
|
29
|
+
import "../chunks/chunk-ORJ3DN65.mjs";
|
|
30
|
+
|
|
31
|
+
// ../plugins/mind-map/src/assets.ts
|
|
32
|
+
var MAX_ASSET = 16 * 1024 ** 2;
|
|
33
|
+
var MAX_TOTAL = 64 * 1024 ** 2;
|
|
34
|
+
var mimeTypes = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp", svg: "image/svg+xml" };
|
|
35
|
+
async function loadAssets(sheets, signal, zip, workspace) {
|
|
36
|
+
const assets = /* @__PURE__ */ new Map(), attachmentText = /* @__PURE__ */ new Map();
|
|
37
|
+
const images = /* @__PURE__ */ new Set(), attachments = /* @__PURE__ */ new Map();
|
|
38
|
+
function visit(t) {
|
|
39
|
+
if (t.image) images.add(t.image);
|
|
40
|
+
for (const a of t.attachments) attachments.set(a.path, a.name);
|
|
41
|
+
t.children.forEach(visit);
|
|
42
|
+
}
|
|
43
|
+
sheets.forEach((s) => visit(s.root));
|
|
44
|
+
let total = 0;
|
|
45
|
+
for (const reference of /* @__PURE__ */ new Set([...images, ...attachments.keys()])) {
|
|
46
|
+
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
|
47
|
+
const inline = /^data:(image\/(?:png|jpeg|gif|webp));base64,([A-Za-z0-9+/=]+)$/.exec(reference);
|
|
48
|
+
if (inline) {
|
|
49
|
+
if (inline[2].length > MAX_ASSET * 4 / 3 + 4) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
|
|
50
|
+
const bytes2 = Uint8Array.from(atob(inline[2]), (c) => c.charCodeAt(0));
|
|
51
|
+
total += bytes2.byteLength;
|
|
52
|
+
if (total > MAX_TOTAL) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
|
|
53
|
+
assets.set(reference, new Blob([bytes2], { type: inline[1] }));
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (!zip && reference.startsWith("/")) continue;
|
|
57
|
+
const path = reference.replace(/^xap:/, "").replace(/^\//, "");
|
|
58
|
+
if (!path || /[\\:]/.test(path) || path.split("/").some((p) => !p || p === "." || p === "..")) continue;
|
|
59
|
+
const extension = (attachments.get(reference) || path).split(".").pop()?.toLowerCase() || "";
|
|
60
|
+
let mime = mimeTypes[extension];
|
|
61
|
+
const isText = /^(txt|md|csv|json|xml|log)$/.test(extension);
|
|
62
|
+
if (!mime && !isText && !images.has(reference)) continue;
|
|
63
|
+
let bytes;
|
|
64
|
+
if (zip?.entries.has(path)) bytes = await zip.read(path, MAX_ASSET, signal);
|
|
65
|
+
else if (!zip && workspace) {
|
|
66
|
+
const file = await workspace.open(path, { signal });
|
|
67
|
+
if (!file) continue;
|
|
68
|
+
if (file.size > MAX_ASSET) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
|
|
69
|
+
bytes = new Uint8Array(await file.arrayBuffer());
|
|
70
|
+
}
|
|
71
|
+
if (!bytes) continue;
|
|
72
|
+
total += bytes.byteLength;
|
|
73
|
+
if (total > MAX_TOTAL) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
|
|
74
|
+
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
|
75
|
+
if (!mime && images.has(reference)) {
|
|
76
|
+
if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) mime = "image/png";
|
|
77
|
+
else if (bytes[0] === 255 && bytes[1] === 216) mime = "image/jpeg";
|
|
78
|
+
else if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70) mime = "image/gif";
|
|
79
|
+
}
|
|
80
|
+
if (mime === "image/svg+xml") {
|
|
81
|
+
const clean = sanitizeSvg(bytes);
|
|
82
|
+
if (clean) assets.set(reference, new Blob([clean.source], { type: mime }));
|
|
83
|
+
} else if (mime) assets.set(reference, new Blob([bytes], { type: mime }));
|
|
84
|
+
else if (isText && bytes.length <= 1024 ** 2) attachmentText.set(reference, new TextDecoder().decode(bytes));
|
|
85
|
+
}
|
|
86
|
+
sheets.forEach((s) => {
|
|
87
|
+
s.assets = assets;
|
|
88
|
+
s.attachmentText = attachmentText;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ../plugins/mind-map/src/model.ts
|
|
93
|
+
var finite = (value) => {
|
|
94
|
+
if (value === null || value === void 0 || value === "") return void 0;
|
|
95
|
+
const n = Number(value);
|
|
96
|
+
return Number.isFinite(n) && Math.abs(n) <= 1e6 ? n : void 0;
|
|
97
|
+
};
|
|
98
|
+
function color(value) {
|
|
99
|
+
return typeof value === "string" && /^#[\da-f]{3,8}$/i.test(value) ? value : void 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ../plugins/mind-map/src/visual-data.ts
|
|
103
|
+
var obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
104
|
+
var str = (v) => typeof v === "string" ? v : "";
|
|
105
|
+
var arr = (v) => Array.isArray(v) ? v : [];
|
|
106
|
+
var direct = (e, name) => e ? Array.from(e.children).filter((c) => c.localName === name) : [];
|
|
107
|
+
var first = (e, name) => direct(e, name)[0];
|
|
108
|
+
var attr = (e, name) => e ? Array.from(e.attributes).find((a) => a.localName === name)?.value ?? "" : "";
|
|
109
|
+
var managerColor = (v) => /^[\da-f]{8}$/i.test(v) ? `#${v.slice(2)}${v.slice(0, 2)}` : void 0;
|
|
110
|
+
function range(value) {
|
|
111
|
+
const match = /^\((\d+),(\d+)\)$/.exec(value);
|
|
112
|
+
return match ? { start: Number(match[1]), end: Number(match[2]) } : void 0;
|
|
113
|
+
}
|
|
114
|
+
function jsonVisual(topic, data) {
|
|
115
|
+
topic.id = str(data.id) || topic.id;
|
|
116
|
+
topic.structure = str(data.structureClass);
|
|
117
|
+
topic.folded = data.branch === "folded";
|
|
118
|
+
const position = obj(data.position), x = finite(position.x), y = finite(position.y);
|
|
119
|
+
if (x !== void 0 && y !== void 0) topic.position = { x, y };
|
|
120
|
+
const p = obj(obj(data.style).properties);
|
|
121
|
+
topic.style = {
|
|
122
|
+
color: color(p["fo:color"]),
|
|
123
|
+
fill: color(p["svg:fill"]),
|
|
124
|
+
stroke: color(p["line-color"]),
|
|
125
|
+
fontSize: finite(str(p["fo:font-size"]).replace(/pt$/, "")),
|
|
126
|
+
bold: p["fo:font-weight"] === "bold",
|
|
127
|
+
italic: p["fo:font-style"] === "italic",
|
|
128
|
+
shape: str(p["shape-class"])
|
|
129
|
+
};
|
|
130
|
+
if (topic.link.startsWith("xap:")) topic.attachments.push({ name: topic.title || topic.link.split("/").pop(), path: topic.link });
|
|
131
|
+
const image = obj(data.image);
|
|
132
|
+
topic.image = str(image.src) || void 0;
|
|
133
|
+
topic.imageWidth = finite(image.width);
|
|
134
|
+
topic.imageHeight = finite(image.height);
|
|
135
|
+
topic.markers = arr(data.markers).map((m) => str(obj(m).markerId)).filter(Boolean);
|
|
136
|
+
topic.labels = arr(data.labels).map(str).filter(Boolean);
|
|
137
|
+
for (const [key, value] of Object.entries(obj(data.task))) if (typeof value === "string" || typeof value === "number") topic.metadata[key] = String(value);
|
|
138
|
+
for (const entry of arr(data.boundaries)) {
|
|
139
|
+
const b = obj(entry), r = range(str(b.range));
|
|
140
|
+
if (r) topic.boundaries.push({ ...r, title: str(b.title) });
|
|
141
|
+
}
|
|
142
|
+
for (const entry of arr(data.summaries)) {
|
|
143
|
+
const b = obj(entry), r = range(str(b.range));
|
|
144
|
+
if (r) topic.boundaries.push({ ...r, title: "", summaryId: str(b.topicId) });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function jsonRelationships(value) {
|
|
148
|
+
return arr(value).map((v) => {
|
|
149
|
+
const r = obj(v);
|
|
150
|
+
return { from: str(r.end1Id), to: str(r.end2Id), title: str(r.title) };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function xmlVisual(topic, element, format) {
|
|
154
|
+
topic.id = attr(element, format === "mm" ? "ID" : format === "mmap" ? "OId" : "id") || topic.id;
|
|
155
|
+
if (format === "mm") {
|
|
156
|
+
const font = first(element, "font"), edge = first(element, "edge");
|
|
157
|
+
topic.style = {
|
|
158
|
+
color: color(attr(element, "COLOR")),
|
|
159
|
+
fill: color(attr(element, "BACKGROUND_COLOR")),
|
|
160
|
+
stroke: color(attr(edge, "COLOR")),
|
|
161
|
+
fontSize: finite(attr(font, "SIZE")),
|
|
162
|
+
bold: attr(font, "BOLD") === "true",
|
|
163
|
+
italic: attr(font, "ITALIC") === "true",
|
|
164
|
+
shape: attr(element, "STYLE")
|
|
165
|
+
};
|
|
166
|
+
topic.direction = attr(element, "POSITION") === "left" ? "left" : attr(element, "POSITION") === "right" ? "right" : void 0;
|
|
167
|
+
topic.folded = attr(element, "FOLDED") === "true";
|
|
168
|
+
topic.markers = direct(element, "icon").map((e) => attr(e, "BUILTIN"));
|
|
169
|
+
topic.relationships = direct(element, "arrowlink").map((e) => ({ from: topic.id, to: attr(e, "DESTINATION"), title: attr(e, "MIDDLE_LABEL") }));
|
|
170
|
+
for (const e of direct(element, "attribute")) topic.metadata[attr(e, "NAME")] = attr(e, "VALUE");
|
|
171
|
+
const image = Array.from(element.querySelectorAll("richcontent img")).find((e) => e.closest("node") === element);
|
|
172
|
+
topic.image = attr(image, "src") || void 0;
|
|
173
|
+
topic.imageWidth = finite(attr(image, "width"));
|
|
174
|
+
topic.imageHeight = finite(attr(image, "height"));
|
|
175
|
+
} else if (format === "mmap") {
|
|
176
|
+
const font = first(first(element, "Text"), "Font"), c = first(element, "Color");
|
|
177
|
+
topic.style = {
|
|
178
|
+
color: managerColor(attr(font, "Color")),
|
|
179
|
+
fill: managerColor(attr(c, "FillColor")),
|
|
180
|
+
stroke: managerColor(attr(c, "LineColor")),
|
|
181
|
+
fontSize: finite(attr(font, "Size")),
|
|
182
|
+
bold: attr(font, "Bold") === "true",
|
|
183
|
+
italic: attr(font, "Italic") === "true",
|
|
184
|
+
shape: attr(first(element, "SubTopicShape") ?? first(element, "TopicShape"), "SubTopicShape")
|
|
185
|
+
};
|
|
186
|
+
topic.folded = attr(first(first(element, "TopicViewGroup"), "Collapsed"), "Collapsed") === "true";
|
|
187
|
+
const shape = first(element, "SubTopicsShape");
|
|
188
|
+
topic.structure = attr(shape, "SubTopicsGrowthDirection");
|
|
189
|
+
if (topic.structure.endsWith(":Right")) topic.structure = "logic.right";
|
|
190
|
+
if (topic.structure.endsWith(":Left")) topic.structure = "logic.left";
|
|
191
|
+
if (topic.structure.endsWith(":Left")) topic.direction = "left";
|
|
192
|
+
if (topic.structure.endsWith(":Right")) topic.direction = "right";
|
|
193
|
+
const position = first(element, "Position");
|
|
194
|
+
const x = finite(attr(position, "X")), y = finite(attr(position, "Y"));
|
|
195
|
+
if (x !== void 0 && y !== void 0) topic.position = { x: x * 3.78, y: y * 3.78 };
|
|
196
|
+
for (const group of direct(element, "Task")) for (const a of Array.from(group.attributes)) {
|
|
197
|
+
if (!["Dirty", "Gen", "OId"].includes(a.name)) topic.metadata[a.localName] = a.value;
|
|
198
|
+
}
|
|
199
|
+
for (const group of direct(element, "TaskGroup")) for (const e of Array.from(group.children)) for (const a of Array.from(e.attributes)) {
|
|
200
|
+
if (!["Dirty", "Gen", "OId"].includes(a.name)) topic.metadata[a.localName] = a.value;
|
|
201
|
+
}
|
|
202
|
+
const image = first(first(element, "OneImage"), "Image");
|
|
203
|
+
const imageData = first(image, "ImageData");
|
|
204
|
+
topic.image = attr(imageData, "ExternalBinaryLocation") || void 0;
|
|
205
|
+
if (!topic.image) {
|
|
206
|
+
const mime = { "urn:mindjet:PngImage": "image/png", "urn:mindjet:JpegImage": "image/jpeg", "urn:mindjet:GifImage": "image/gif" }[attr(imageData, "ImageType")];
|
|
207
|
+
const encoded = first(imageData, "Base64")?.textContent?.replace(/\s/g, "");
|
|
208
|
+
if (mime && encoded) topic.image = `data:${mime};base64,${encoded}`;
|
|
209
|
+
}
|
|
210
|
+
topic.imageWidth = finite(attr(first(image, "ImageSize"), "Width"));
|
|
211
|
+
topic.imageHeight = finite(attr(first(image, "ImageSize"), "Height"));
|
|
212
|
+
topic.attachments = direct(first(element, "AttachmentGroup"), "AttachmentData").map((e) => ({ name: attr(e, "FileName"), path: attr(e, "ExternalBinaryLocation") }));
|
|
213
|
+
topic.labels = direct(first(element, "TextLabels"), "TextLabel").map((e) => attr(e, "TextLabelName"));
|
|
214
|
+
} else {
|
|
215
|
+
if (topic.link.startsWith("xap:")) topic.attachments.push({ name: topic.title || topic.link.split("/").pop(), path: topic.link });
|
|
216
|
+
topic.structure = attr(element, "structure-class");
|
|
217
|
+
topic.folded = attr(element, "branch") === "folded";
|
|
218
|
+
const position = first(element, "position"), x = finite(attr(position, "x")), y = finite(attr(position, "y"));
|
|
219
|
+
if (x !== void 0 && y !== void 0) topic.position = { x, y };
|
|
220
|
+
const image = first(element, "img");
|
|
221
|
+
topic.image = image?.getAttributeNS("http://www.w3.org/1999/xlink", "src") || attr(image, "src") || void 0;
|
|
222
|
+
topic.imageWidth = finite(attr(image, "width"));
|
|
223
|
+
topic.imageHeight = finite(attr(image, "height"));
|
|
224
|
+
topic.markers = direct(first(element, "marker-refs"), "marker-ref").map((e) => attr(e, "marker-id"));
|
|
225
|
+
topic.labels = direct(first(element, "labels"), "label").map((e) => e.textContent ?? "");
|
|
226
|
+
for (const e of direct(first(element, "boundaries"), "boundary")) {
|
|
227
|
+
const r = range(attr(e, "range"));
|
|
228
|
+
if (r) topic.boundaries.push({ ...r, title: first(e, "title")?.textContent ?? "" });
|
|
229
|
+
}
|
|
230
|
+
for (const e of direct(first(element, "summaries"), "summary")) {
|
|
231
|
+
const r = range(attr(e, "range"));
|
|
232
|
+
if (r) topic.boundaries.push({ ...r, title: "", summaryId: attr(e, "topic-id") });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function xmlRelationships(sheet) {
|
|
237
|
+
return direct(first(sheet, "relationships"), "relationship").map((e) => ({ from: attr(e, "end1"), to: attr(e, "end2"), title: first(e, "title")?.textContent ?? "" }));
|
|
238
|
+
}
|
|
239
|
+
function kind(value) {
|
|
240
|
+
return ["detached", "summary", "callout"].includes(value) ? value : "attached";
|
|
241
|
+
}
|
|
242
|
+
function applyLegacyStyles(sheets, source) {
|
|
243
|
+
const doc = parseXmlDocument(source, "application/xml");
|
|
244
|
+
const styles = new Map(Array.from(doc.getElementsByTagNameNS("*", "style")).map((e) => [attr(e, "id"), first(e, "topic-properties")]));
|
|
245
|
+
function visit(t) {
|
|
246
|
+
const p = styles.get(t.metadata.styleId);
|
|
247
|
+
if (p) t.style = {
|
|
248
|
+
color: color(attr(p, "color")),
|
|
249
|
+
fill: color(attr(p, "fill")),
|
|
250
|
+
stroke: color(attr(p, "line-color")),
|
|
251
|
+
fontSize: finite(attr(p, "font-size").replace(/pt$/, "")),
|
|
252
|
+
bold: attr(p, "font-weight") === "bold",
|
|
253
|
+
italic: attr(p, "font-style") === "italic",
|
|
254
|
+
shape: attr(p, "shape-class")
|
|
255
|
+
};
|
|
256
|
+
delete t.metadata.styleId;
|
|
257
|
+
t.children.forEach(visit);
|
|
258
|
+
}
|
|
259
|
+
sheets.forEach((s) => visit(s.root));
|
|
260
|
+
}
|
|
261
|
+
function managerRelationships(root) {
|
|
262
|
+
return direct(first(root, "Relationships"), "Relationship").map((e) => {
|
|
263
|
+
const ends = direct(e, "ConnectionGroup").sort((a, b) => Number(attr(a, "Index")) - Number(attr(b, "Index")));
|
|
264
|
+
return { from: attr(first(ends[0], "Connection"), "OIdRef"), to: attr(first(ends[1], "Connection"), "OIdRef"), title: "" };
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function managerDefaults(element, root, depth) {
|
|
268
|
+
const styles = first(root, "StyleGroup");
|
|
269
|
+
const levels = direct(styles, "RootSubTopicDefaultsGroup");
|
|
270
|
+
const defaults = depth === 0 ? first(styles, "RootTopicDefaultsGroup") : levels.find((e) => Number(attr(e, "Level")) === depth - 1) ?? levels.at(-1);
|
|
271
|
+
for (const name of ["Color", "SubTopicsShape", "SubTopicShape", "Text"]) {
|
|
272
|
+
const original = first(defaults, `Default${name}`);
|
|
273
|
+
if (!original) continue;
|
|
274
|
+
let target = first(element, name);
|
|
275
|
+
if (!target) {
|
|
276
|
+
target = element.ownerDocument.createElementNS(element.namespaceURI, name);
|
|
277
|
+
element.append(target);
|
|
278
|
+
}
|
|
279
|
+
if (name === "Text") {
|
|
280
|
+
const sourceFont = first(original, "Font");
|
|
281
|
+
if (!sourceFont) continue;
|
|
282
|
+
let font = first(target, "Font");
|
|
283
|
+
if (!font) {
|
|
284
|
+
font = sourceFont.cloneNode(true);
|
|
285
|
+
target.append(font);
|
|
286
|
+
} else for (const a of Array.from(sourceFont.attributes)) if (!font.hasAttribute(a.name)) font.setAttribute(a.name, a.value);
|
|
287
|
+
} else for (const a of Array.from(original.attributes)) if (!target.hasAttribute(a.name)) target.setAttribute(a.name, a.value);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// ../plugins/mind-map/src/parse.ts
|
|
292
|
+
var LIMITS = { file: 128 * 1024 ** 2, content: 16 * 1024 ** 2, nodes: 2e4, depth: 128, sheets: 128, text: 4 * 1024 ** 2 };
|
|
293
|
+
function checkAbort(signal) {
|
|
294
|
+
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
|
295
|
+
}
|
|
296
|
+
var invalid = () => new ViewerError("invalid-file", "Invalid mind map.");
|
|
297
|
+
var limit = () => new ViewerError("resource-limit", "Mind map limit exceeded.");
|
|
298
|
+
var children = (element, name) => element ? Array.from(element.children).filter((child2) => child2.localName === name) : [];
|
|
299
|
+
var child = (element, name) => children(element, name)[0];
|
|
300
|
+
var text = (element) => element?.textContent?.trim() ?? "";
|
|
301
|
+
var record = (value) => {
|
|
302
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid();
|
|
303
|
+
return value;
|
|
304
|
+
};
|
|
305
|
+
var string = (value) => typeof value === "string" ? value : "";
|
|
306
|
+
function xml(source) {
|
|
307
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(source)) throw invalid();
|
|
308
|
+
const doc = parseXmlDocument(source, "application/xml");
|
|
309
|
+
if (doc.getElementsByTagName("parsererror").length || !doc.documentElement) throw invalid();
|
|
310
|
+
return doc.documentElement;
|
|
311
|
+
}
|
|
312
|
+
function richText(element) {
|
|
313
|
+
if (!element) return "";
|
|
314
|
+
const output = [];
|
|
315
|
+
const stack = [element];
|
|
316
|
+
while (stack.length) {
|
|
317
|
+
const node = stack.pop();
|
|
318
|
+
if (node.nodeType === 3) output.push(node.textContent ?? "");
|
|
319
|
+
else if (node.nodeType === 1) {
|
|
320
|
+
const tag = node.localName.toLowerCase();
|
|
321
|
+
if (["script", "style", "iframe", "object"].includes(tag)) continue;
|
|
322
|
+
if (["p", "div", "br", "li"].includes(tag)) output.push("\n");
|
|
323
|
+
for (let i = node.childNodes.length - 1; i >= 0; i--) stack.push(node.childNodes[i]);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return output.join("").trim();
|
|
327
|
+
}
|
|
328
|
+
function parseContent(source, format, signal) {
|
|
329
|
+
checkAbort(signal);
|
|
330
|
+
if (source.length > LIMITS.content) throw limit();
|
|
331
|
+
let count = 0, textSize = 0;
|
|
332
|
+
function topic(title, notes, link, depth) {
|
|
333
|
+
checkAbort(signal);
|
|
334
|
+
textSize += title.length + notes.length + link.length;
|
|
335
|
+
if (++count > LIMITS.nodes || depth > LIMITS.depth || textSize > LIMITS.text) throw limit();
|
|
336
|
+
return { id: `topic-${count}`, title, notes, link, children: [], kind: "attached", style: {}, structure: "", folded: false, markers: [], labels: [], metadata: {}, boundaries: [], relationships: [], attachments: [] };
|
|
337
|
+
}
|
|
338
|
+
function jsonTopic(value, depth, theme = {}, topicKind = "attached") {
|
|
339
|
+
const data = record(value);
|
|
340
|
+
const notes = data.notes == null ? {} : record(data.notes);
|
|
341
|
+
const plain = notes.plain == null ? {} : record(notes.plain);
|
|
342
|
+
const result = topic(string(data.title), string(plain.content), string(data.href), depth);
|
|
343
|
+
const styleName = depth === 0 ? "centralTopic" : topicKind === "detached" ? "floatingTopic" : topicKind === "summary" ? "summaryTopic" : topicKind === "callout" ? "calloutTopic" : depth === 1 ? "mainTopic" : "subTopic";
|
|
344
|
+
const base = theme[styleName] ? record(theme[styleName]) : {};
|
|
345
|
+
const own = data.style ? record(data.style) : {};
|
|
346
|
+
jsonVisual(result, { ...data, style: { properties: { ...base.properties ? record(base.properties) : {}, ...own.properties ? record(own.properties) : {} } } });
|
|
347
|
+
if (data.children != null) {
|
|
348
|
+
const groups = record(data.children);
|
|
349
|
+
for (const key of ["attached", "detached", "summary", "callout"]) {
|
|
350
|
+
if (groups[key] == null) continue;
|
|
351
|
+
if (!Array.isArray(groups[key])) throw invalid();
|
|
352
|
+
for (const item of groups[key]) {
|
|
353
|
+
const node = jsonTopic(item, depth + 1, theme, key);
|
|
354
|
+
node.kind = kind(key);
|
|
355
|
+
result.children.push(node);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
let managerRoot;
|
|
362
|
+
function xmlTopic(element, depth) {
|
|
363
|
+
let title, notes, link, nested;
|
|
364
|
+
if (format === "mm") {
|
|
365
|
+
const rich = children(element, "richcontent");
|
|
366
|
+
title = element.getAttribute("TEXT") ?? richText(rich.find((item) => item.getAttribute("TYPE") === "NODE")).split("\n").map((line) => line.trim()).filter(Boolean).join("\n");
|
|
367
|
+
notes = rich.filter((item) => ["NOTE", "DETAILS"].includes(item.getAttribute("TYPE") ?? "")).map(richText).join("\n");
|
|
368
|
+
link = element.getAttribute("LINK") ?? "";
|
|
369
|
+
nested = children(element, "node");
|
|
370
|
+
} else if (format === "mmap") {
|
|
371
|
+
title = child(element, "Text")?.getAttribute("PlainText") ?? "";
|
|
372
|
+
const note = child(child(element, "NotesGroup"), "NotesXhtmlData");
|
|
373
|
+
notes = richText(note);
|
|
374
|
+
if (note && !note.children.length && /^\s*</.test(notes)) notes = richText(xml(notes));
|
|
375
|
+
link = (child(element, "Hyperlink") ?? child(child(element, "HyperlinkGroup"), "Hyperlink") ?? child(child(element, "HyperlinkGroup"), "IndexedHyperlink"))?.getAttribute("Url") ?? "";
|
|
376
|
+
nested = [...children(child(element, "SubTopics"), "Topic"), ...children(child(element, "FloatingTopics"), "Topic")];
|
|
377
|
+
} else {
|
|
378
|
+
title = text(child(element, "title"));
|
|
379
|
+
const note = child(element, "notes");
|
|
380
|
+
notes = text(child(note, "plain")) || richText(child(note, "html"));
|
|
381
|
+
link = element.getAttributeNS("http://www.w3.org/1999/xlink", "href") ?? element.getAttribute("href") ?? "";
|
|
382
|
+
nested = children(child(element, "children"), "topics").flatMap((group) => children(group, "topic"));
|
|
383
|
+
}
|
|
384
|
+
const result = topic(title, notes, link, depth);
|
|
385
|
+
if (format === "mmap" && managerRoot) managerDefaults(element, managerRoot, depth);
|
|
386
|
+
xmlVisual(result, element, format);
|
|
387
|
+
if (format === "xmind-xml") result.metadata.styleId = element.getAttribute("style-id") ?? "";
|
|
388
|
+
for (const item of nested) {
|
|
389
|
+
const node = xmlTopic(item, depth + 1);
|
|
390
|
+
if (format === "xmind-xml") node.kind = kind(item.parentElement?.getAttribute("type") ?? "");
|
|
391
|
+
if (format === "mmap" && item.parentElement?.localName === "FloatingTopics") node.kind = "detached";
|
|
392
|
+
result.children.push(node);
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
let sheets;
|
|
397
|
+
if (format === "xmind-json") {
|
|
398
|
+
const data = JSON.parse(source);
|
|
399
|
+
if (!Array.isArray(data) || !data.length) throw invalid();
|
|
400
|
+
if (data.length > LIMITS.sheets) throw limit();
|
|
401
|
+
sheets = data.map((value) => {
|
|
402
|
+
const sheet = record(value);
|
|
403
|
+
return { title: string(sheet.title), root: jsonTopic(sheet.rootTopic, 0, sheet.theme ? record(sheet.theme) : {}), relationships: jsonRelationships(sheet.relationships) };
|
|
404
|
+
});
|
|
405
|
+
} else {
|
|
406
|
+
const root = xml(source);
|
|
407
|
+
if (format === "mm") {
|
|
408
|
+
if (root.localName !== "map" || children(root, "node").length !== 1) throw invalid();
|
|
409
|
+
const node = xmlTopic(child(root, "node"), 0);
|
|
410
|
+
sheets = [{ title: node.title, root: node }];
|
|
411
|
+
} else if (format === "mmap") {
|
|
412
|
+
const topics = children(child(root, "OneTopic"), "Topic");
|
|
413
|
+
if (root.localName !== "Map" || topics.length !== 1) throw invalid();
|
|
414
|
+
managerRoot = root;
|
|
415
|
+
const node = xmlTopic(topics[0], 0);
|
|
416
|
+
sheets = [{ title: node.title, root: node, relationships: managerRelationships(root) }];
|
|
417
|
+
} else {
|
|
418
|
+
if (root.localName !== "xmap-content") throw invalid();
|
|
419
|
+
const items = children(root, "sheet");
|
|
420
|
+
if (!items.length) throw invalid();
|
|
421
|
+
if (items.length > LIMITS.sheets) throw limit();
|
|
422
|
+
sheets = items.map((item) => {
|
|
423
|
+
if (children(item, "topic").length !== 1) throw invalid();
|
|
424
|
+
return { title: text(child(item, "title")), root: xmlTopic(child(item, "topic"), 0), relationships: xmlRelationships(item) };
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
checkAbort(signal);
|
|
429
|
+
return sheets;
|
|
430
|
+
}
|
|
431
|
+
async function readText(file, signal) {
|
|
432
|
+
const reader = file.slice(0, file.size).stream().getReader();
|
|
433
|
+
const cancel = () => {
|
|
434
|
+
void reader.cancel().catch(() => {
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
438
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
439
|
+
const parts = [];
|
|
440
|
+
let size = 0;
|
|
441
|
+
try {
|
|
442
|
+
while (true) {
|
|
443
|
+
checkAbort(signal);
|
|
444
|
+
const result = await reader.read();
|
|
445
|
+
checkAbort(signal);
|
|
446
|
+
if (result.done) break;
|
|
447
|
+
size += result.value.byteLength;
|
|
448
|
+
if (size > LIMITS.content) throw limit();
|
|
449
|
+
parts.push(decoder.decode(result.value, { stream: true }));
|
|
450
|
+
}
|
|
451
|
+
parts.push(decoder.decode());
|
|
452
|
+
return parts.join("");
|
|
453
|
+
} finally {
|
|
454
|
+
signal.removeEventListener("abort", cancel);
|
|
455
|
+
await reader.cancel().catch(() => {
|
|
456
|
+
});
|
|
457
|
+
reader.releaseLock();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async function readMindMap(file, signal, workspace, { assets = true } = {}) {
|
|
461
|
+
checkAbort(signal);
|
|
462
|
+
if (file.size > LIMITS.file) throw limit();
|
|
463
|
+
if (/\.mm$/i.test(file.name)) {
|
|
464
|
+
const sheets = parseContent(await readText(file, signal), "mm", signal);
|
|
465
|
+
if (assets) await loadAssets(sheets, signal, void 0, workspace);
|
|
466
|
+
return sheets;
|
|
467
|
+
}
|
|
468
|
+
if (!/\.(xmind|mmap)$/i.test(file.name)) throw invalid();
|
|
469
|
+
const zip = await openBookZip(file, signal);
|
|
470
|
+
try {
|
|
471
|
+
const isXmind = /\.xmind$/i.test(file.name);
|
|
472
|
+
const path = isXmind ? zip.entries.has("content.json") ? "content.json" : "content.xml" : "Document.xml";
|
|
473
|
+
if (!zip.entries.has(path)) throw invalid();
|
|
474
|
+
const bytes = await zip.read(path, LIMITS.content, signal);
|
|
475
|
+
const source = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
476
|
+
const sheets = parseContent(source, isXmind ? path.endsWith("json") ? "xmind-json" : "xmind-xml" : "mmap", signal);
|
|
477
|
+
if (zip.entries.has("styles.xml")) {
|
|
478
|
+
const styles = new TextDecoder().decode(await zip.read("styles.xml", LIMITS.content, signal));
|
|
479
|
+
xml(styles);
|
|
480
|
+
applyLegacyStyles(sheets, styles);
|
|
481
|
+
}
|
|
482
|
+
if (assets) await loadAssets(sheets, signal, zip);
|
|
483
|
+
return sheets;
|
|
484
|
+
} finally {
|
|
485
|
+
await zip.dispose();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// ../plugins/mind-map/src/extract.ts
|
|
490
|
+
var PLUGIN_ID = "mind-map";
|
|
491
|
+
var KIND_LABELS = { detached: "floating", summary: "summary", callout: "callout" };
|
|
492
|
+
function mapError(error) {
|
|
493
|
+
if (error instanceof AgentError || isViewerAbortError(error)) throw error;
|
|
494
|
+
if (error instanceof ProtectedBookError) {
|
|
495
|
+
throw new AgentError("encrypted-file", "The mind map archive is encrypted.", { pluginId: PLUGIN_ID, cause: error });
|
|
496
|
+
}
|
|
497
|
+
if (error instanceof ViewerError && error.code === "resource-limit") {
|
|
498
|
+
throw new AgentError("resource-limit", "The mind map exceeds safety limits.", { pluginId: PLUGIN_ID, cause: error });
|
|
499
|
+
}
|
|
500
|
+
throw new AgentError("invalid-file", "The file is not a readable mind map.", { pluginId: PLUGIN_ID, cause: error });
|
|
501
|
+
}
|
|
502
|
+
async function formatName(file, signal) {
|
|
503
|
+
if (/\.mm$/i.test(file.name)) return "FreeMind / Freeplane";
|
|
504
|
+
if (/\.mmap$/i.test(file.name)) return "MindManager";
|
|
505
|
+
const { names } = await readBookZipCatalog(file, signal);
|
|
506
|
+
return names.has("content.json") ? "XMind" : "XMind (legacy XML)";
|
|
507
|
+
}
|
|
508
|
+
async function loadSheets(context) {
|
|
509
|
+
if (context.signal.aborted) throw abortError();
|
|
510
|
+
try {
|
|
511
|
+
const sheets = await readMindMap(context.file, context.signal, void 0, { assets: false });
|
|
512
|
+
return { format: await formatName(context.file, context.signal), sheets };
|
|
513
|
+
} catch (error) {
|
|
514
|
+
return mapError(error);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
function countTopics(topic) {
|
|
518
|
+
let count = 0;
|
|
519
|
+
const stack = [topic];
|
|
520
|
+
while (stack.length) {
|
|
521
|
+
const next = stack.pop();
|
|
522
|
+
count += 1;
|
|
523
|
+
stack.push(...next.children);
|
|
524
|
+
}
|
|
525
|
+
return count;
|
|
526
|
+
}
|
|
527
|
+
var oneLine = (value) => value.replace(/\s+/g, " ").trim();
|
|
528
|
+
var sheetTitle = (sheet, index) => oneLine(sheet.title) || oneLine(sheet.root.title) || `Sheet ${index + 1}`;
|
|
529
|
+
function sheetOutline(sheet, index) {
|
|
530
|
+
const lines = [`## Sheet ${index + 1}: ${sheetTitle(sheet, index)}`, ""];
|
|
531
|
+
const titles = /* @__PURE__ */ new Map();
|
|
532
|
+
const stack = [{ topic: sheet.root, depth: 0 }];
|
|
533
|
+
while (stack.length) {
|
|
534
|
+
const { topic, depth } = stack.pop();
|
|
535
|
+
const title = oneLine(topic.title) || "(untitled)";
|
|
536
|
+
titles.set(topic.id, title);
|
|
537
|
+
const indent = " ".repeat(depth);
|
|
538
|
+
const extras = [
|
|
539
|
+
KIND_LABELS[topic.kind] ? `(${KIND_LABELS[topic.kind]})` : "",
|
|
540
|
+
topic.labels.length ? `[labels: ${topic.labels.join(", ")}]` : "",
|
|
541
|
+
topic.markers.length ? `[markers: ${topic.markers.join(", ")}]` : "",
|
|
542
|
+
topic.link ? `<${topic.link}>` : "",
|
|
543
|
+
topic.attachments.length ? `[attachments: ${topic.attachments.map((item) => item.name || item.path).join(", ")}]` : ""
|
|
544
|
+
].filter(Boolean);
|
|
545
|
+
lines.push(`${indent}- ${[title, ...extras].join(" ")}`);
|
|
546
|
+
for (const note of topic.notes.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)) {
|
|
547
|
+
lines.push(`${indent} > ${note}`);
|
|
548
|
+
}
|
|
549
|
+
for (let child2 = topic.children.length - 1; child2 >= 0; child2 -= 1) {
|
|
550
|
+
stack.push({ topic: topic.children[child2], depth: depth + 1 });
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
const relationships = [...sheet.relationships ?? []];
|
|
554
|
+
const visit = [sheet.root];
|
|
555
|
+
while (visit.length) {
|
|
556
|
+
const topic = visit.pop();
|
|
557
|
+
relationships.push(...topic.relationships);
|
|
558
|
+
visit.push(...topic.children);
|
|
559
|
+
}
|
|
560
|
+
if (relationships.length) {
|
|
561
|
+
lines.push("", "Relationships:");
|
|
562
|
+
for (const link of relationships) {
|
|
563
|
+
const label = oneLine(link.title);
|
|
564
|
+
lines.push(`- ${titles.get(link.from) ?? link.from} \u2192 ${titles.get(link.to) ?? link.to}${label ? `: ${label}` : ""}`);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return lines.join("\n");
|
|
568
|
+
}
|
|
569
|
+
var mindMapExtractor = {
|
|
570
|
+
async inspect(context) {
|
|
571
|
+
const { format, sheets } = await loadSheets(context);
|
|
572
|
+
const counts = sheets.map((sheet) => countTopics(sheet.root));
|
|
573
|
+
return {
|
|
574
|
+
metadata: {
|
|
575
|
+
format,
|
|
576
|
+
sizeBytes: context.source.size,
|
|
577
|
+
sheetCount: sheets.length,
|
|
578
|
+
topicCount: counts.reduce((sum, count) => sum + count, 0),
|
|
579
|
+
sheets: sheets.map((sheet, index) => ({
|
|
580
|
+
title: sheetTitle(sheet, index),
|
|
581
|
+
rootTopic: oneLine(sheet.root.title),
|
|
582
|
+
topics: counts[index]
|
|
583
|
+
}))
|
|
584
|
+
},
|
|
585
|
+
targets: sheets.map((sheet, index) => ({
|
|
586
|
+
id: `sheet:${index + 1}`,
|
|
587
|
+
title: sheetTitle(sheet, index),
|
|
588
|
+
kind: "sheet",
|
|
589
|
+
size: counts[index]
|
|
590
|
+
}))
|
|
591
|
+
};
|
|
592
|
+
},
|
|
593
|
+
async read(context, params) {
|
|
594
|
+
const { format, sheets } = await loadSheets(context);
|
|
595
|
+
return readPagedTextDocument({
|
|
596
|
+
pageCount: sheets.length,
|
|
597
|
+
targetPrefix: "sheet",
|
|
598
|
+
header: () => markdownDocumentHeader(context.file.name, { Format: format, Sheets: String(sheets.length) }),
|
|
599
|
+
page: async (index) => sheetOutline(sheets[index], index)
|
|
600
|
+
}, params, PLUGIN_ID);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
var extract_default = mindMapExtractor;
|
|
604
|
+
export {
|
|
605
|
+
extract_default as default,
|
|
606
|
+
sheetOutline
|
|
607
|
+
};
|