anyfile-cli 0.0.0-stage → 0.2.0
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 +56 -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-5OI4NQH7.mjs +2232 -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-HUSX3ZU3.mjs +58 -0
- package/chunks/chunk-IC3G2XE2.mjs +436 -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-UUN2DVDC.mjs +1893 -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 +278 -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 +33 -3
- 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-CLBaywBr.js +1 -0
- package/renderer-host/assets/animation-DnPo99To.js +1 -0
- package/renderer-host/assets/archive-client-CyhEmSF7.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-DrtzCzPo.js +1 -0
- package/renderer-host/assets/browser-C0pGRq_c.js +1 -0
- package/renderer-host/assets/client-Dp-p4unY.js +1 -0
- package/renderer-host/assets/container-inspection-DZoaDYQR.js +1 -0
- package/renderer-host/assets/data-table-OJQe3aN5.js +1 -0
- package/renderer-host/assets/decode-D5vB6JN8.js +1 -0
- package/renderer-host/assets/decode-tiff-BuYdKp6p.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-lNQyU1GR.js +1 -0
- package/renderer-host/assets/ext-searchbox-BIdon51Z.js +164 -0
- package/renderer-host/assets/ffmpeg-playback-QcT_NwlK.js +1 -0
- package/renderer-host/assets/gltf-Cqq-xStc.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-B1fNI3iO.js +1 -0
- package/renderer-host/assets/index-BCxD9rBl.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-CRhfhhOS.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-BnJM6Yo0.js +16 -0
- package/renderer-host/assets/model-D2YSoRt5.js +1 -0
- package/renderer-host/assets/obj-DbUZkDna.js +9 -0
- package/renderer-host/assets/off-CzR_R_Tf.js +1 -0
- package/renderer-host/assets/ogg-probe-C2TT74FL.js +1 -0
- package/renderer-host/assets/ogg-viewer-CT31JEhG.js +9 -0
- package/renderer-host/assets/packbits-DCimUQ1T.js +1 -0
- package/renderer-host/assets/paged-CX-N_Pzy.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-C-xrhUaO.js +2 -0
- package/renderer-host/assets/points.worker-CA8v75dl.js +2 -0
- package/renderer-host/assets/probe-asf-CvcaYQaR.js +14 -0
- package/renderer-host/assets/range-reader-9PeAh1Hv.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-WcZvn3-C.js +1 -0
- package/renderer-host/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/renderer-host/assets/safe-content-B61Ktgzp.js +1 -0
- package/renderer-host/assets/sanitize-D56ODnaM.js +1 -0
- package/renderer-host/assets/scene-adapter-CmaaVwsM.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-ByI1iX8S.js +1 -0
- package/renderer-host/assets/skp.worker-D9ujTXFV.js +1 -0
- package/renderer-host/assets/src-0DTp6SF8.js +1 -0
- package/renderer-host/assets/src-0QHjkpy0.js +44 -0
- package/renderer-host/assets/src-2X3Gt6Lk.js +2 -0
- package/renderer-host/assets/src-2tfD0huT.js +16 -0
- package/renderer-host/assets/src-5ZJshveh.js +29 -0
- package/renderer-host/assets/src-9k3CCYnZ.js +1 -0
- package/renderer-host/assets/src-B0zJlB0C.js +27 -0
- package/renderer-host/assets/src-B4jorJ2U.js +100 -0
- package/renderer-host/assets/src-BB6xj1UK.js +18 -0
- package/renderer-host/assets/src-BEn15PBT.js +52 -0
- package/renderer-host/assets/src-BLndk63N.js +7 -0
- package/renderer-host/assets/src-BMrLVJyB.js +169 -0
- package/renderer-host/assets/src-BPG8SYXq.js +10 -0
- package/renderer-host/assets/src-BZrNtUNO.js +2 -0
- package/renderer-host/assets/src-B_o7QilB.js +58 -0
- package/renderer-host/assets/src-BgM1jpe4.js +5 -0
- package/renderer-host/assets/src-BgUXah8O.js +1 -0
- package/renderer-host/assets/src-Bl5Lv4-d.js +1 -0
- package/renderer-host/assets/src-Blx9jp9x.js +90 -0
- package/renderer-host/assets/src-Bu1cTJNz.js +64 -0
- package/renderer-host/assets/src-BuN3y1yE.js +24 -0
- package/renderer-host/assets/src-Bw-O8ujJ.js +2 -0
- package/renderer-host/assets/src-BwZAUudm.js +2 -0
- package/renderer-host/assets/src-BydeR01n.js +1 -0
- package/renderer-host/assets/src-C2LKqLBA.js +182 -0
- package/renderer-host/assets/src-C4t_UvT8.js +8 -0
- package/renderer-host/assets/src-C5k8Ydia.js +1 -0
- package/renderer-host/assets/src-C6w9FGSB.js +1 -0
- package/renderer-host/assets/src-C9Uz3C-q.js +432 -0
- package/renderer-host/assets/src-CAdKRH5C.js +37 -0
- package/renderer-host/assets/src-CBE5sqjl.js +7 -0
- package/renderer-host/assets/src-CBo2yHRk.js +21 -0
- package/renderer-host/assets/src-CGx0nUS5.js +24 -0
- package/renderer-host/assets/src-CHNgoDf9.js +10 -0
- package/renderer-host/assets/src-CIDWSV97.js +1 -0
- package/renderer-host/assets/src-CPUYqpHZ.js +9 -0
- package/renderer-host/assets/src-CVc67mQv.js +1 -0
- package/renderer-host/assets/src-CXRrmfb0.js +7 -0
- package/renderer-host/assets/src-C_1M1IDo.js +8 -0
- package/renderer-host/assets/src-C_HAB_bn.js +5 -0
- package/renderer-host/assets/src-CeGmxOTi.js +1 -0
- package/renderer-host/assets/src-CifsQr3m.js +222 -0
- package/renderer-host/assets/src-Ck1ekdEN.js +1 -0
- package/renderer-host/assets/src-ClIHDiJ4.js +27 -0
- package/renderer-host/assets/src-Cvb3aCDG.js +10 -0
- package/renderer-host/assets/src-Cyw_3X-L.js +989 -0
- package/renderer-host/assets/src-D3OyeoQs.js +1 -0
- package/renderer-host/assets/src-D4cv_-u0.js +1 -0
- package/renderer-host/assets/src-DPm7_lsi.js +24 -0
- package/renderer-host/assets/src-DZE9IoBl.js +88 -0
- package/renderer-host/assets/src-DmzigsPg.js +7 -0
- package/renderer-host/assets/src-DpEmkhrn.js +6 -0
- package/renderer-host/assets/src-DrYYfoQO.js +7 -0
- package/renderer-host/assets/src-DsVDi0pr.js +4126 -0
- package/renderer-host/assets/src-ORHZWeVF.js +2 -0
- package/renderer-host/assets/src-Q-oKL3Dw.js +10 -0
- package/renderer-host/assets/src-QXdjrTaw.js +4 -0
- package/renderer-host/assets/src-R4bKlaNn.js +387 -0
- package/renderer-host/assets/src-TbSq3WSr.js +115 -0
- package/renderer-host/assets/src-TuTvYAR6.js +11 -0
- package/renderer-host/assets/src-eVKtGm4Q.js +17 -0
- package/renderer-host/assets/src-efHN2oAJ.js +17 -0
- package/renderer-host/assets/src-hCrza_Lf.js +1 -0
- package/renderer-host/assets/src-j_mEQ9Os.js +9 -0
- package/renderer-host/assets/src-lYIAi6Hw.js +1 -0
- package/renderer-host/assets/src-n2gsf381.js +20 -0
- package/renderer-host/assets/src-p14e1hma.js +23 -0
- package/renderer-host/assets/src-rJN_jaC5.js +1 -0
- package/renderer-host/assets/src-vPHMg1Fp.js +1 -0
- package/renderer-host/assets/src-wrrVkfrK.js +1 -0
- package/renderer-host/assets/stl-adapter-D1eozFH9.js +1 -0
- package/renderer-host/assets/stl.worker-C-anHijM.js +1 -0
- package/renderer-host/assets/three-mf-CbcWWdM8.js +2 -0
- package/renderer-host/assets/webimage-zQMH-_zR.js +1 -0
- package/renderer-host/assets/webm-_wYh_V7u.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-CDv8KjIR.js +1 -0
- package/renderer-host/assets/zip-core-custom-D3VVVj-J.js +1 -0
- package/renderer-host/assets/zip-source-C5dFTDt7.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 +261 -0
|
@@ -0,0 +1,620 @@
|
|
|
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
|
+
MAX_HEIF_SOURCE_BYTES,
|
|
4
|
+
MAX_JXL_FRAMES,
|
|
5
|
+
MAX_MODERN_RASTER_SOURCE_BYTES,
|
|
6
|
+
PROBE_BYTES,
|
|
7
|
+
ascii,
|
|
8
|
+
checkDimensions,
|
|
9
|
+
inspectModernHeader,
|
|
10
|
+
readBoxes,
|
|
11
|
+
u16be,
|
|
12
|
+
u32be,
|
|
13
|
+
u64be
|
|
14
|
+
} from "../chunks/chunk-6EVJJFOH.mjs";
|
|
15
|
+
import {
|
|
16
|
+
importRuntime
|
|
17
|
+
} from "../chunks/chunk-QOUEBPPL.mjs";
|
|
18
|
+
import {
|
|
19
|
+
AgentError,
|
|
20
|
+
HARD_READ_MAX_BYTES,
|
|
21
|
+
ViewerError,
|
|
22
|
+
abortError,
|
|
23
|
+
downscaleRgba,
|
|
24
|
+
isViewerAbortError,
|
|
25
|
+
paginateLines
|
|
26
|
+
} from "../chunks/chunk-IC3G2XE2.mjs";
|
|
27
|
+
import "../chunks/chunk-ORJ3DN65.mjs";
|
|
28
|
+
|
|
29
|
+
// ../plugins/modern-raster/src/exif.ts
|
|
30
|
+
var MAX_IFD_ENTRIES = 512;
|
|
31
|
+
var EXIF_IFD = 34665;
|
|
32
|
+
var GPS_IFD = 34853;
|
|
33
|
+
var IFD0_TAGS = {
|
|
34
|
+
271: "make",
|
|
35
|
+
272: "model",
|
|
36
|
+
274: "orientation",
|
|
37
|
+
305: "software",
|
|
38
|
+
306: "modifyDate"
|
|
39
|
+
};
|
|
40
|
+
var EXIF_TAGS = {
|
|
41
|
+
33434: "exposureTime",
|
|
42
|
+
33437: "fNumber",
|
|
43
|
+
34855: "iso",
|
|
44
|
+
36867: "dateTimeOriginal",
|
|
45
|
+
37386: "focalLength",
|
|
46
|
+
42036: "lensModel",
|
|
47
|
+
40962: "pixelWidth",
|
|
48
|
+
40963: "pixelHeight"
|
|
49
|
+
};
|
|
50
|
+
var TYPE_SIZES = { 1: 1, 2: 1, 3: 2, 4: 4, 5: 8, 7: 1, 9: 4, 10: 8 };
|
|
51
|
+
function round(value) {
|
|
52
|
+
return Math.round(value * 1e4) / 1e4;
|
|
53
|
+
}
|
|
54
|
+
function parseExifTiff(tiff) {
|
|
55
|
+
if (tiff.length < 8) return void 0;
|
|
56
|
+
const view = new DataView(tiff.buffer, tiff.byteOffset, tiff.byteLength);
|
|
57
|
+
const order = String.fromCharCode(tiff[0], tiff[1]);
|
|
58
|
+
if (order !== "II" && order !== "MM") return void 0;
|
|
59
|
+
const le = order === "II";
|
|
60
|
+
if (view.getUint16(2, le) !== 42) return void 0;
|
|
61
|
+
const out = {};
|
|
62
|
+
const visited = /* @__PURE__ */ new Set();
|
|
63
|
+
const value = (type, count, offset) => {
|
|
64
|
+
const size = (TYPE_SIZES[type] ?? 0) * count;
|
|
65
|
+
if (size === 0) return void 0;
|
|
66
|
+
const at = size <= 4 ? offset : view.getUint32(offset, le);
|
|
67
|
+
if (at + size > tiff.length) return void 0;
|
|
68
|
+
if (type === 2) {
|
|
69
|
+
const text = new TextDecoder().decode(tiff.subarray(at, at + count)).replace(/\0[\s\S]*$/, "").trim();
|
|
70
|
+
return text || void 0;
|
|
71
|
+
}
|
|
72
|
+
if (type === 3) return view.getUint16(at, le);
|
|
73
|
+
if (type === 4) return view.getUint32(at, le);
|
|
74
|
+
if (type === 9) return view.getInt32(at, le);
|
|
75
|
+
if (type === 5 || type === 10) {
|
|
76
|
+
const num = type === 5 ? view.getUint32(at, le) : view.getInt32(at, le);
|
|
77
|
+
const den = type === 5 ? view.getUint32(at + 4, le) : view.getInt32(at + 4, le);
|
|
78
|
+
return den === 0 ? void 0 : round(num / den);
|
|
79
|
+
}
|
|
80
|
+
return void 0;
|
|
81
|
+
};
|
|
82
|
+
const walk = (ifd, names) => {
|
|
83
|
+
if (visited.has(ifd) || ifd + 2 > tiff.length) return;
|
|
84
|
+
visited.add(ifd);
|
|
85
|
+
const count = view.getUint16(ifd, le);
|
|
86
|
+
if (count > MAX_IFD_ENTRIES || ifd + 2 + count * 12 > tiff.length) return;
|
|
87
|
+
for (let index = 0; index < count; index++) {
|
|
88
|
+
const entry = ifd + 2 + index * 12;
|
|
89
|
+
const tag = view.getUint16(entry, le);
|
|
90
|
+
const type = view.getUint16(entry + 2, le);
|
|
91
|
+
const valueCount = view.getUint32(entry + 4, le);
|
|
92
|
+
if (tag === EXIF_IFD) walk(view.getUint32(entry + 8, le), EXIF_TAGS);
|
|
93
|
+
else if (tag === GPS_IFD) out.gps = true;
|
|
94
|
+
else if (names[tag]) {
|
|
95
|
+
const parsed = value(type, valueCount, entry + 8);
|
|
96
|
+
if (parsed !== void 0) out[names[tag]] = parsed;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
try {
|
|
101
|
+
walk(view.getUint32(4, le), IFD0_TAGS);
|
|
102
|
+
} catch {
|
|
103
|
+
}
|
|
104
|
+
if (!("gps" in out)) out.gps = false;
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
function parseExifPayload(payload) {
|
|
108
|
+
if (payload.length < 4) return void 0;
|
|
109
|
+
const skip = (payload[0] << 24 | payload[1] << 16 | payload[2] << 8 | payload[3]) >>> 0;
|
|
110
|
+
if (4 + skip >= payload.length) return void 0;
|
|
111
|
+
let start = 4 + skip;
|
|
112
|
+
if (payload[start] === 69 && payload[start + 1] === 120 && payload[start + 4] === 0 && payload[start + 5] === 0) start += 6;
|
|
113
|
+
return parseExifTiff(payload.subarray(start));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ../plugins/modern-raster/src/heif-meta.ts
|
|
117
|
+
var MAX_ITEMS = 256;
|
|
118
|
+
var MAX_EXIF_BYTES = 1024 * 1024;
|
|
119
|
+
var IMAGE_TYPES = /* @__PURE__ */ new Set(["hvc1", "hev1", "av01", "grid", "iden", "iovl", "jpeg", "unci", "vvc1", "j2k1", "mski"]);
|
|
120
|
+
function fullBoxChildren(bytes, box, skip, budget) {
|
|
121
|
+
return readBoxes(bytes, box.contentStart + skip, box.end, 2, budget) ?? [];
|
|
122
|
+
}
|
|
123
|
+
function readSized(bytes, offset, size) {
|
|
124
|
+
if (size === 0) return 0;
|
|
125
|
+
if (size === 4) return u32be(bytes, offset);
|
|
126
|
+
if (size === 8) return u64be(bytes, offset);
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
function parseItems(bytes, iinf, budget) {
|
|
130
|
+
const countBytes = bytes[iinf.contentStart] === 0 ? 2 : 4;
|
|
131
|
+
const items = [];
|
|
132
|
+
for (const infe of fullBoxChildren(bytes, iinf, 4 + countBytes, budget)) {
|
|
133
|
+
const version = bytes[infe.contentStart];
|
|
134
|
+
if (infe.type !== "infe" || version < 2 || items.length >= MAX_ITEMS) continue;
|
|
135
|
+
const id = version === 2 ? u16be(bytes, infe.contentStart + 4) : u32be(bytes, infe.contentStart + 4);
|
|
136
|
+
const type = ascii(bytes, infe.contentStart + (version === 2 ? 8 : 10), 4);
|
|
137
|
+
if (id !== void 0 && type) items.push({ id, type });
|
|
138
|
+
}
|
|
139
|
+
return items;
|
|
140
|
+
}
|
|
141
|
+
function parseLocations(bytes, iloc) {
|
|
142
|
+
const locations = /* @__PURE__ */ new Map();
|
|
143
|
+
const version = bytes[iloc.contentStart];
|
|
144
|
+
let at = iloc.contentStart + 4;
|
|
145
|
+
const offsetSize = bytes[at] >> 4;
|
|
146
|
+
const lengthSize = bytes[at] & 15;
|
|
147
|
+
const baseSize = bytes[at + 1] >> 4;
|
|
148
|
+
const indexSize = version >= 1 ? bytes[at + 1] & 15 : 0;
|
|
149
|
+
at += 2;
|
|
150
|
+
const count = version < 2 ? u16be(bytes, at) : u32be(bytes, at);
|
|
151
|
+
at += version < 2 ? 2 : 4;
|
|
152
|
+
for (let index = 0; count !== void 0 && index < Math.min(count, MAX_ITEMS); index++) {
|
|
153
|
+
const id = version < 2 ? u16be(bytes, at) : u32be(bytes, at);
|
|
154
|
+
at += version < 2 ? 2 : 4;
|
|
155
|
+
const method = version >= 1 ? (u16be(bytes, at) ?? 0) & 15 : 0;
|
|
156
|
+
at += (version >= 1 ? 2 : 0) + 2;
|
|
157
|
+
const baseOffset = readSized(bytes, at, baseSize);
|
|
158
|
+
at += baseSize;
|
|
159
|
+
const extentCount = u16be(bytes, at);
|
|
160
|
+
at += 2;
|
|
161
|
+
if (id === void 0 || baseOffset === void 0 || extentCount === void 0 || at > iloc.end) break;
|
|
162
|
+
const extents = [];
|
|
163
|
+
for (let extent = 0; extent < extentCount; extent++) {
|
|
164
|
+
at += indexSize;
|
|
165
|
+
const offset = readSized(bytes, at, offsetSize);
|
|
166
|
+
const length = readSized(bytes, at + offsetSize, lengthSize);
|
|
167
|
+
at += offsetSize + lengthSize;
|
|
168
|
+
if (offset === void 0 || length === void 0 || at > iloc.end) return locations;
|
|
169
|
+
extents.push({ offset, length });
|
|
170
|
+
}
|
|
171
|
+
locations.set(id, { method, baseOffset, extents });
|
|
172
|
+
}
|
|
173
|
+
return locations;
|
|
174
|
+
}
|
|
175
|
+
function parseReferences(bytes, iref, budget) {
|
|
176
|
+
const refs = [];
|
|
177
|
+
const wide = bytes[iref.contentStart] === 1;
|
|
178
|
+
for (const child of fullBoxChildren(bytes, iref, 4, budget)) {
|
|
179
|
+
let at = child.contentStart;
|
|
180
|
+
const from = wide ? u32be(bytes, at) : u16be(bytes, at);
|
|
181
|
+
at += wide ? 4 : 2;
|
|
182
|
+
const count = u16be(bytes, at) ?? 0;
|
|
183
|
+
at += 2;
|
|
184
|
+
const to = [];
|
|
185
|
+
for (let index = 0; index < Math.min(count, MAX_ITEMS); index++, at += wide ? 4 : 2) {
|
|
186
|
+
const target = wide ? u32be(bytes, at) : u16be(bytes, at);
|
|
187
|
+
if (target !== void 0) to.push(target);
|
|
188
|
+
}
|
|
189
|
+
if (from !== void 0) refs.push({ type: child.type, from, to });
|
|
190
|
+
}
|
|
191
|
+
return refs;
|
|
192
|
+
}
|
|
193
|
+
function parseProperties(bytes, iprp, budget) {
|
|
194
|
+
const children = fullBoxChildren(bytes, iprp, 0, budget);
|
|
195
|
+
const ipco = children.find((child) => child.type === "ipco");
|
|
196
|
+
const properties = ipco ? readBoxes(bytes, ipco.contentStart, ipco.end, 3, budget) ?? [] : [];
|
|
197
|
+
const associations = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const ipma of children.filter((child) => child.type === "ipma")) {
|
|
199
|
+
const version = bytes[ipma.contentStart];
|
|
200
|
+
const wide = (bytes[ipma.contentStart + 3] & 1) !== 0;
|
|
201
|
+
const count = u32be(bytes, ipma.contentStart + 4) ?? 0;
|
|
202
|
+
let at = ipma.contentStart + 8;
|
|
203
|
+
for (let entry = 0; entry < Math.min(count, MAX_ITEMS) && at < ipma.end; entry++) {
|
|
204
|
+
const id = version < 1 ? u16be(bytes, at) : u32be(bytes, at);
|
|
205
|
+
at += version < 1 ? 2 : 4;
|
|
206
|
+
const n = bytes[at++] ?? 0;
|
|
207
|
+
const boxes = [];
|
|
208
|
+
for (let index = 0; index < n; index++) {
|
|
209
|
+
const raw = wide ? u16be(bytes, at) ?? 0 : bytes[at] ?? 0;
|
|
210
|
+
at += wide ? 2 : 1;
|
|
211
|
+
const property = properties[(raw & (wide ? 32767 : 127)) - 1];
|
|
212
|
+
if (property) boxes.push(property);
|
|
213
|
+
}
|
|
214
|
+
if (id !== void 0) associations.set(id, boxes);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return associations;
|
|
218
|
+
}
|
|
219
|
+
function itemData(bytes, location, idat) {
|
|
220
|
+
if (!location) return void 0;
|
|
221
|
+
const base = location.method === 1 ? idat?.contentStart : location.method === 0 ? 0 : void 0;
|
|
222
|
+
if (base === void 0) return void 0;
|
|
223
|
+
const parts = [];
|
|
224
|
+
let total = 0;
|
|
225
|
+
for (const extent of location.extents) {
|
|
226
|
+
const start = base + location.baseOffset + extent.offset;
|
|
227
|
+
const length = extent.length === 0 ? bytes.length - start : extent.length;
|
|
228
|
+
total += length;
|
|
229
|
+
if (start < 0 || length < 0 || start + length > bytes.length || total > MAX_EXIF_BYTES) return void 0;
|
|
230
|
+
parts.push(bytes.subarray(start, start + length));
|
|
231
|
+
}
|
|
232
|
+
if (parts.length === 1) return parts[0];
|
|
233
|
+
const joined = new Uint8Array(total);
|
|
234
|
+
let at = 0;
|
|
235
|
+
for (const part of parts) {
|
|
236
|
+
joined.set(part, at);
|
|
237
|
+
at += part.length;
|
|
238
|
+
}
|
|
239
|
+
return joined;
|
|
240
|
+
}
|
|
241
|
+
function readHeifMetadata(bytes) {
|
|
242
|
+
const budget = { count: 0 };
|
|
243
|
+
const top = readBoxes(bytes, 0, bytes.length, 0, budget);
|
|
244
|
+
const ftyp = top?.find((box) => box.type === "ftyp");
|
|
245
|
+
const meta = top?.find((box) => box.type === "meta");
|
|
246
|
+
if (!top || !ftyp || !meta) return void 0;
|
|
247
|
+
const brands = [];
|
|
248
|
+
for (let at = ftyp.contentStart; at + 4 <= ftyp.end; at += 4) {
|
|
249
|
+
const brand = ascii(bytes, at, 4);
|
|
250
|
+
if (brand && at !== ftyp.contentStart + 4 && !brands.includes(brand)) brands.push(brand);
|
|
251
|
+
}
|
|
252
|
+
const children = fullBoxChildren(bytes, meta, 4, budget);
|
|
253
|
+
const find = (type) => children.find((child) => child.type === type);
|
|
254
|
+
const pitm = find("pitm");
|
|
255
|
+
const primary = pitm ? bytes[pitm.contentStart] === 0 ? u16be(bytes, pitm.contentStart + 4) : u32be(bytes, pitm.contentStart + 4) : void 0;
|
|
256
|
+
const iinf = find("iinf");
|
|
257
|
+
const items = iinf ? parseItems(bytes, iinf, budget) : [];
|
|
258
|
+
const iloc = find("iloc");
|
|
259
|
+
const locations = iloc ? parseLocations(bytes, iloc) : /* @__PURE__ */ new Map();
|
|
260
|
+
const iref = find("iref");
|
|
261
|
+
const refs = iref ? parseReferences(bytes, iref, budget) : [];
|
|
262
|
+
const iprp = find("iprp");
|
|
263
|
+
const props = iprp ? parseProperties(bytes, iprp, budget) : /* @__PURE__ */ new Map();
|
|
264
|
+
const tiles = new Set(refs.filter((ref) => ref.type === "dimg").flatMap((ref) => ref.to));
|
|
265
|
+
const aux = refs.filter((ref) => ref.type === "auxl").map((ref) => ref.from);
|
|
266
|
+
const thumbnails = new Set(refs.filter((ref) => ref.type === "thmb").map((ref) => ref.from));
|
|
267
|
+
const auxKinds = aux.map((id) => {
|
|
268
|
+
const auxC = props.get(id)?.find((box) => box.type === "auxC");
|
|
269
|
+
return auxC ? new TextDecoder().decode(bytes.subarray(auxC.contentStart + 4, auxC.end)) : "";
|
|
270
|
+
});
|
|
271
|
+
const images = items.filter((item) => IMAGE_TYPES.has(item.type));
|
|
272
|
+
const topLevel = images.filter((item) => !tiles.has(item.id) && !aux.includes(item.id) && !thumbnails.has(item.id));
|
|
273
|
+
const primaryItem = items.find((item) => item.id === primary);
|
|
274
|
+
const primaryProps = primary === void 0 ? [] : props.get(primary) ?? [];
|
|
275
|
+
const firstTile = refs.find((ref) => ref.type === "dimg" && ref.from === primary)?.to[0];
|
|
276
|
+
const prop = (type) => primaryProps.find((box) => box.type === type) ?? (firstTile === void 0 ? void 0 : props.get(firstTile)?.find((box) => box.type === type));
|
|
277
|
+
const ispe = primaryProps.find((box) => box.type === "ispe");
|
|
278
|
+
const pixi = prop("pixi");
|
|
279
|
+
const irot = primaryProps.find((box) => box.type === "irot");
|
|
280
|
+
const colr = prop("colr");
|
|
281
|
+
const exifItem = items.find((item) => item.type === "Exif" && refs.some((ref) => ref.type === "cdsc" && ref.from === item.id && (primary === void 0 || ref.to.includes(primary)))) ?? items.find((item) => item.type === "Exif");
|
|
282
|
+
const exifBytes = exifItem ? itemData(bytes, locations.get(exifItem.id), find("idat")) : void 0;
|
|
283
|
+
return {
|
|
284
|
+
brands,
|
|
285
|
+
...primaryItem ? { primaryCodec: primaryItem.type } : {},
|
|
286
|
+
...ispe ? { width: u32be(bytes, ispe.contentStart + 4), height: u32be(bytes, ispe.contentStart + 8) } : {},
|
|
287
|
+
...pixi && bytes[pixi.contentStart + 4] > 0 ? { bitDepth: bytes[pixi.contentStart + 5] } : {},
|
|
288
|
+
...irot ? { rotation: (bytes[irot.contentStart] & 3) * 90 } : {},
|
|
289
|
+
mirrored: primaryProps.some((box) => box.type === "imir"),
|
|
290
|
+
...colr ? { colorProfile: ascii(bytes, colr.contentStart, 4) } : {},
|
|
291
|
+
hasAlpha: auxKinds.some((kind) => /alpha|hevc:2015:auxid:1\b/.test(kind)),
|
|
292
|
+
hasDepth: auxKinds.some((kind) => /depth|hevc:2015:auxid:2\b/.test(kind)),
|
|
293
|
+
imageCount: topLevel.length,
|
|
294
|
+
thumbnailCount: thumbnails.size,
|
|
295
|
+
itemCount: items.length,
|
|
296
|
+
...exifBytes ? { exif: parseExifPayload(exifBytes) } : {}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// ../plugins/modern-raster/src/heif-runtime.ts
|
|
301
|
+
var HEIF_ARTIFACT_VERSION = "1.23.2-anyfile.1";
|
|
302
|
+
var VENDOR_DIR = `libheif/${HEIF_ARTIFACT_VERSION}`;
|
|
303
|
+
var ASSET_ROOT = `/vendor/${VENDOR_DIR}`;
|
|
304
|
+
async function loadHeifRuntimeFromVendor(vendor) {
|
|
305
|
+
const glue = await importRuntime(await vendor.url(`${VENDOR_DIR}/heif-decoder.js`));
|
|
306
|
+
return glue.default({ wasmBinary: await vendor.bytes(`${VENDOR_DIR}/heif-decoder.wasm`) });
|
|
307
|
+
}
|
|
308
|
+
function classifyHeifError(error) {
|
|
309
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
310
|
+
if (message.startsWith("resource-limit:")) return "resource-limit";
|
|
311
|
+
if (error instanceof RangeError || /(?:out of memory|memory access out of bounds|allocation failed|bad_alloc)/i.test(message)) return "resource-limit";
|
|
312
|
+
if (message.startsWith("unsupported-environment:")) return "unsupported-environment";
|
|
313
|
+
if (message.startsWith("runtime:")) return "open-failed";
|
|
314
|
+
return "invalid-file";
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ../plugins/modern-raster/src/png-decode.ts
|
|
318
|
+
import { inflateSync } from "node:zlib";
|
|
319
|
+
var CHANNELS = { 0: 1, 2: 3, 4: 2, 6: 4 };
|
|
320
|
+
function paeth(a, b, c) {
|
|
321
|
+
const p = a + b - c;
|
|
322
|
+
const pa = Math.abs(p - a);
|
|
323
|
+
const pb = Math.abs(p - b);
|
|
324
|
+
const pc = Math.abs(p - c);
|
|
325
|
+
return pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
|
|
326
|
+
}
|
|
327
|
+
function decodePng(png) {
|
|
328
|
+
const view = new DataView(png.buffer, png.byteOffset, png.byteLength);
|
|
329
|
+
let width = 0;
|
|
330
|
+
let height = 0;
|
|
331
|
+
let bitDepth = 0;
|
|
332
|
+
let colorType = -1;
|
|
333
|
+
const idat = [];
|
|
334
|
+
for (let at = 8; at + 8 <= png.length; ) {
|
|
335
|
+
const length = view.getUint32(at);
|
|
336
|
+
const type = String.fromCharCode(...png.subarray(at + 4, at + 8));
|
|
337
|
+
const data = png.subarray(at + 8, at + 8 + length);
|
|
338
|
+
if (type === "IHDR") {
|
|
339
|
+
width = view.getUint32(at + 8);
|
|
340
|
+
height = view.getUint32(at + 12);
|
|
341
|
+
bitDepth = data[8];
|
|
342
|
+
colorType = data[9];
|
|
343
|
+
if (data[12] !== 0) throw new Error("Interlaced PNG output is not supported.");
|
|
344
|
+
} else if (type === "IDAT") idat.push(data);
|
|
345
|
+
else if (type === "IEND") break;
|
|
346
|
+
at += 12 + length;
|
|
347
|
+
}
|
|
348
|
+
const channels = CHANNELS[colorType];
|
|
349
|
+
if (!channels || bitDepth !== 8 && bitDepth !== 16 || width === 0 || height === 0) {
|
|
350
|
+
throw new Error(`Unsupported PNG layout (color type ${colorType}, ${bitDepth}-bit).`);
|
|
351
|
+
}
|
|
352
|
+
const raw = inflateSync(Buffer.concat(idat));
|
|
353
|
+
const bytesPerPixel = channels * (bitDepth / 8);
|
|
354
|
+
const stride = width * bytesPerPixel;
|
|
355
|
+
if (raw.length < (stride + 1) * height) throw new Error("PNG pixel data is truncated.");
|
|
356
|
+
const rgba = new Uint8ClampedArray(width * height * 4);
|
|
357
|
+
let previous = new Uint8Array(stride);
|
|
358
|
+
let current = new Uint8Array(stride);
|
|
359
|
+
for (let y = 0; y < height; y++) {
|
|
360
|
+
const filter = raw[y * (stride + 1)];
|
|
361
|
+
const line = raw.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1));
|
|
362
|
+
for (let x = 0; x < stride; x++) {
|
|
363
|
+
const left = x >= bytesPerPixel ? current[x - bytesPerPixel] : 0;
|
|
364
|
+
const up = previous[x];
|
|
365
|
+
const upLeft = x >= bytesPerPixel ? previous[x - bytesPerPixel] : 0;
|
|
366
|
+
const predictor = filter === 1 ? left : filter === 2 ? up : filter === 3 ? left + up >> 1 : filter === 4 ? paeth(left, up, upLeft) : 0;
|
|
367
|
+
current[x] = line[x] + predictor & 255;
|
|
368
|
+
}
|
|
369
|
+
for (let x = 0; x < width; x++) {
|
|
370
|
+
const sample = (channel) => current[(x * channels + channel) * (bitDepth / 8)];
|
|
371
|
+
const out = (y * width + x) * 4;
|
|
372
|
+
const gray = channels <= 2;
|
|
373
|
+
rgba[out] = sample(0);
|
|
374
|
+
rgba[out + 1] = gray ? sample(0) : sample(1);
|
|
375
|
+
rgba[out + 2] = gray ? sample(0) : sample(2);
|
|
376
|
+
rgba[out + 3] = channels === 2 ? sample(1) : channels === 4 ? sample(3) : 255;
|
|
377
|
+
}
|
|
378
|
+
[previous, current] = [current, previous];
|
|
379
|
+
}
|
|
380
|
+
return { width, height, bitDepth, hasAlpha: channels === 2 || channels === 4, rgba };
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// ../plugins/modern-raster/src/node-decode.ts
|
|
384
|
+
var JXL_WASM_VENDOR_PATH = "jxl-oxide-wasm/0.12.6/jxl_oxide_wasm_bg.wasm";
|
|
385
|
+
var jxlRuntime;
|
|
386
|
+
var heifRuntime;
|
|
387
|
+
function loadJxlRuntime(vendor) {
|
|
388
|
+
jxlRuntime ??= (async () => {
|
|
389
|
+
const jxl = await import("../chunks/jxl_oxide_wasm-3UN6G3YN.mjs");
|
|
390
|
+
const wasm = await vendor.bytes(JXL_WASM_VENDOR_PATH);
|
|
391
|
+
await jxl.default({ module_or_path: wasm });
|
|
392
|
+
return jxl;
|
|
393
|
+
})().catch((error) => {
|
|
394
|
+
jxlRuntime = void 0;
|
|
395
|
+
throw error;
|
|
396
|
+
});
|
|
397
|
+
return jxlRuntime;
|
|
398
|
+
}
|
|
399
|
+
function loadHeifDecoder(vendor) {
|
|
400
|
+
heifRuntime ??= loadHeifRuntimeFromVendor(vendor).catch((error) => {
|
|
401
|
+
heifRuntime = void 0;
|
|
402
|
+
throw error;
|
|
403
|
+
});
|
|
404
|
+
return heifRuntime;
|
|
405
|
+
}
|
|
406
|
+
async function openJxl(source, vendor, signal) {
|
|
407
|
+
const jxl = await loadJxlRuntime(vendor);
|
|
408
|
+
const image = new jxl.JxlImage();
|
|
409
|
+
try {
|
|
410
|
+
image.forceSrgb = true;
|
|
411
|
+
const chunkSize = 4 * 1024 * 1024;
|
|
412
|
+
for (let offset = 0; offset < source.size; offset += chunkSize) {
|
|
413
|
+
if (signal.aborted) throw abortError();
|
|
414
|
+
image.feedBytes(await source.read(offset, chunkSize, signal));
|
|
415
|
+
image.tryInit();
|
|
416
|
+
}
|
|
417
|
+
image.tryInit();
|
|
418
|
+
const { width, height } = image;
|
|
419
|
+
if (!image.loaded || width === void 0 || height === void 0) throw new Error("JPEG XL stream is incomplete or undecodable.");
|
|
420
|
+
checkDimensions(width, height);
|
|
421
|
+
return { image, width, height, frameCount: Math.max(1, image.numLoadedKeyframes), animated: image.animated === true, loops: image.numLoops ?? 0 };
|
|
422
|
+
} catch (error) {
|
|
423
|
+
image.free();
|
|
424
|
+
throw error;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function renderJxlFrame(session, frameIndex) {
|
|
428
|
+
return decodePng(session.image.render(frameIndex).encodeToPng());
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// ../plugins/modern-raster/src/extract.ts
|
|
432
|
+
var PLUGIN_ID = "modern-raster";
|
|
433
|
+
var MAX_FRAME_TARGETS = 64;
|
|
434
|
+
var MAX_EXIF_BOX_BYTES = 1024 * 1024;
|
|
435
|
+
function fail(code, message, cause) {
|
|
436
|
+
throw new AgentError(code, message, { pluginId: PLUGIN_ID, cause });
|
|
437
|
+
}
|
|
438
|
+
function mapError(error, fallback) {
|
|
439
|
+
if (error instanceof AgentError || isViewerAbortError(error)) throw error;
|
|
440
|
+
if (error instanceof ViewerError) fail(error.code === "resource-limit" ? "resource-limit" : "invalid-file", error.message, error);
|
|
441
|
+
const code = classifyHeifError(error);
|
|
442
|
+
if (code === "resource-limit") fail("resource-limit", "Image decoding exceeded the memory limit.", error);
|
|
443
|
+
fail("invalid-file", error instanceof Error && error.message ? error.message : fallback, error);
|
|
444
|
+
}
|
|
445
|
+
async function detect(context) {
|
|
446
|
+
if (context.signal.aborted) throw abortError();
|
|
447
|
+
const { source, signal } = context;
|
|
448
|
+
if (source.size > MAX_MODERN_RASTER_SOURCE_BYTES) fail("resource-limit", "Image exceeds the 256 MiB input limit.");
|
|
449
|
+
const format = source.size > 0 ? inspectModernHeader(await source.read(0, PROBE_BYTES, signal), source.size) : void 0;
|
|
450
|
+
if (!format) fail("invalid-file", "Not a valid JPEG XL or HEVC-coded HEIF/HEIC image.");
|
|
451
|
+
if (format === "HEIC" && source.size > MAX_HEIF_SOURCE_BYTES) fail("resource-limit", "HEIF image exceeds the 128 MiB input limit.");
|
|
452
|
+
return format;
|
|
453
|
+
}
|
|
454
|
+
async function readAll(context) {
|
|
455
|
+
const bytes = await context.source.read(0, context.source.size, context.signal);
|
|
456
|
+
if (context.signal.aborted) throw abortError();
|
|
457
|
+
return bytes;
|
|
458
|
+
}
|
|
459
|
+
async function withJxl(context, run) {
|
|
460
|
+
let session;
|
|
461
|
+
try {
|
|
462
|
+
session = await openJxl(context.source, context.vendor, context.signal);
|
|
463
|
+
if (session.frameCount > MAX_JXL_FRAMES) fail("resource-limit", "JPEG XL animation exceeds the 4096 frame limit.");
|
|
464
|
+
return await run(session);
|
|
465
|
+
} catch (error) {
|
|
466
|
+
return mapError(error, "JPEG XL image could not be decoded.");
|
|
467
|
+
} finally {
|
|
468
|
+
session?.image.free();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
async function readJxlExif(context) {
|
|
472
|
+
const { source, signal } = context;
|
|
473
|
+
for (let offset = 0, boxes = 0; offset + 8 <= source.size && boxes < 256; boxes++) {
|
|
474
|
+
const header = new DataView((await source.read(offset, 16, signal)).slice().buffer);
|
|
475
|
+
if (header.byteLength < 8 || offset === 0 && header.getUint32(4) !== 1247300640) return void 0;
|
|
476
|
+
const size32 = header.getUint32(0);
|
|
477
|
+
const type = String.fromCharCode(header.getUint8(4), header.getUint8(5), header.getUint8(6), header.getUint8(7));
|
|
478
|
+
const headerSize = size32 === 1 ? 16 : 8;
|
|
479
|
+
const size = size32 === 0 ? source.size - offset : size32 === 1 ? Number(header.getBigUint64(8)) : size32;
|
|
480
|
+
if (size < headerSize) return void 0;
|
|
481
|
+
if (type === "Exif" && size - headerSize <= MAX_EXIF_BOX_BYTES) {
|
|
482
|
+
return parseExifPayload(await source.read(offset + headerSize, size - headerSize, signal));
|
|
483
|
+
}
|
|
484
|
+
offset += size;
|
|
485
|
+
}
|
|
486
|
+
return void 0;
|
|
487
|
+
}
|
|
488
|
+
async function describe(context) {
|
|
489
|
+
const format = await detect(context);
|
|
490
|
+
const base = { format: format === "JXL" ? "JPEG XL" : "HEIC", sizeBytes: context.source.size };
|
|
491
|
+
if (format === "HEIC") {
|
|
492
|
+
const meta = readHeifMetadata(await readAll(context));
|
|
493
|
+
if (!meta || meta.width === void 0 || meta.height === void 0) fail("invalid-file", "HEIF container has no readable primary image.");
|
|
494
|
+
const turned = meta.rotation === 90 || meta.rotation === 270;
|
|
495
|
+
const metadata = {
|
|
496
|
+
...base,
|
|
497
|
+
width: turned ? meta.height : meta.width,
|
|
498
|
+
height: turned ? meta.width : meta.height,
|
|
499
|
+
...meta.bitDepth !== void 0 ? { bitDepth: meta.bitDepth } : {},
|
|
500
|
+
hasAlpha: meta.hasAlpha,
|
|
501
|
+
hasDepth: meta.hasDepth,
|
|
502
|
+
...meta.primaryCodec ? { primaryCodec: meta.primaryCodec } : {},
|
|
503
|
+
brands: [...meta.brands],
|
|
504
|
+
imageCount: meta.imageCount,
|
|
505
|
+
thumbnailCount: meta.thumbnailCount,
|
|
506
|
+
itemCount: meta.itemCount,
|
|
507
|
+
...meta.rotation ? { rotation: meta.rotation } : {},
|
|
508
|
+
...meta.mirrored ? { mirrored: true } : {},
|
|
509
|
+
...meta.colorProfile ? { colorProfile: meta.colorProfile } : {},
|
|
510
|
+
...meta.exif ? { exif: meta.exif } : {}
|
|
511
|
+
};
|
|
512
|
+
return { metadata, frameCount: 1 };
|
|
513
|
+
}
|
|
514
|
+
const exif = await readJxlExif(context);
|
|
515
|
+
return withJxl(context, (session) => {
|
|
516
|
+
session.image.renderingRegion = { left: 0, top: 0, width: 1, height: 1 };
|
|
517
|
+
const probe = renderJxlFrame(session, 0);
|
|
518
|
+
const metadata = {
|
|
519
|
+
...base,
|
|
520
|
+
width: session.width,
|
|
521
|
+
height: session.height,
|
|
522
|
+
bitDepth: probe.bitDepth,
|
|
523
|
+
hasAlpha: probe.hasAlpha,
|
|
524
|
+
animated: session.animated,
|
|
525
|
+
frameCount: session.frameCount,
|
|
526
|
+
...session.animated ? { loops: session.loops } : {},
|
|
527
|
+
...exif ? { exif } : {}
|
|
528
|
+
};
|
|
529
|
+
return { metadata, frameCount: session.frameCount };
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function buildTargets(frameCount) {
|
|
533
|
+
const targets = [{ id: "metadata", title: "Image metadata", kind: "metadata" }];
|
|
534
|
+
if (frameCount > 1) {
|
|
535
|
+
for (let index = 0; index < Math.min(frameCount, MAX_FRAME_TARGETS); index++) {
|
|
536
|
+
targets.push({ id: `frame:${index + 1}`, title: `Frame ${index + 1}`, kind: "frame" });
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return { targets, truncated: frameCount > MAX_FRAME_TARGETS };
|
|
540
|
+
}
|
|
541
|
+
function resolveFrame(target, frameCount) {
|
|
542
|
+
if (target === void 0 || target === "metadata") return 0;
|
|
543
|
+
const match = /^frame:([1-9]\d*)$/.exec(target);
|
|
544
|
+
const frameNumber = match ? Number(match[1]) : 0;
|
|
545
|
+
if (frameCount <= 1 || frameNumber < 1 || frameNumber > frameCount) fail("target-not-found", `Image target not found: "${target}".`);
|
|
546
|
+
return frameNumber - 1;
|
|
547
|
+
}
|
|
548
|
+
function formatValue(value) {
|
|
549
|
+
if (Array.isArray(value)) return value.join(", ");
|
|
550
|
+
if (value && typeof value === "object") return JSON.stringify(value);
|
|
551
|
+
return String(value);
|
|
552
|
+
}
|
|
553
|
+
function metadataLines(metadata, frame) {
|
|
554
|
+
const { exif, ...fields } = metadata;
|
|
555
|
+
const lines = [`# ${String(metadata.format)} image${frame === void 0 ? "" : ` \u2014 frame ${frame + 1}`}`, ""];
|
|
556
|
+
for (const [key, value] of Object.entries(fields)) lines.push(`- **${key}**: ${formatValue(value)}`);
|
|
557
|
+
if (exif && typeof exif === "object" && !Array.isArray(exif)) {
|
|
558
|
+
lines.push("", "## EXIF");
|
|
559
|
+
for (const [key, value] of Object.entries(exif)) lines.push(`- **${key}**: ${formatValue(value)}`);
|
|
560
|
+
}
|
|
561
|
+
if (frame !== void 0) lines.push("", "Use `render` with this target to view the frame pixels.");
|
|
562
|
+
return lines;
|
|
563
|
+
}
|
|
564
|
+
var modernRasterExtractor = {
|
|
565
|
+
async inspect(context) {
|
|
566
|
+
const { metadata, frameCount } = await describe(context);
|
|
567
|
+
const { targets, truncated } = buildTargets(frameCount);
|
|
568
|
+
return { metadata, targets, ...truncated ? { targetsTruncated: true } : {} };
|
|
569
|
+
},
|
|
570
|
+
async read(context, params) {
|
|
571
|
+
const { metadata, frameCount } = await describe(context);
|
|
572
|
+
const frame = params.target?.startsWith("frame:") ? resolveFrame(params.target, frameCount) : void 0;
|
|
573
|
+
if (params.target !== void 0 && params.target !== "metadata" && frame === void 0) {
|
|
574
|
+
fail("target-not-found", `Image target not found: "${params.target}".`);
|
|
575
|
+
}
|
|
576
|
+
let lines = metadataLines(metadata, frame);
|
|
577
|
+
const filter = params.filter?.trim().toLowerCase();
|
|
578
|
+
if (filter) lines = lines.filter((line) => line.toLowerCase().includes(filter));
|
|
579
|
+
const page = paginateLines(lines, params.cursor, Math.min(params.maxBytes, HARD_READ_MAX_BYTES), PLUGIN_ID);
|
|
580
|
+
return {
|
|
581
|
+
content: page.content,
|
|
582
|
+
contentType: "markdown",
|
|
583
|
+
...page.nextCursor ? { nextCursor: page.nextCursor } : {},
|
|
584
|
+
truncated: page.truncated,
|
|
585
|
+
...filter ? { filterApplied: true } : {}
|
|
586
|
+
};
|
|
587
|
+
},
|
|
588
|
+
async renderImage(context, params) {
|
|
589
|
+
if (!Number.isFinite(params.maxDimension) || params.maxDimension < 1) {
|
|
590
|
+
fail("invalid-argument", `maxDimension must be a positive number, received ${params.maxDimension}.`);
|
|
591
|
+
}
|
|
592
|
+
const format = await detect(context);
|
|
593
|
+
if (format === "JXL") {
|
|
594
|
+
return withJxl(context, (session) => {
|
|
595
|
+
const frame = renderJxlFrame(session, resolveFrame(params.target, session.frameCount));
|
|
596
|
+
return downscaleRgba({ width: frame.width, height: frame.height, data: frame.rgba }, params.maxDimension, PLUGIN_ID);
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
resolveFrame(params.target, 1);
|
|
600
|
+
const bytes = await readAll(context);
|
|
601
|
+
let decoder;
|
|
602
|
+
try {
|
|
603
|
+
decoder = await loadHeifDecoder(context.vendor);
|
|
604
|
+
} catch (error) {
|
|
605
|
+
fail("runtime-unavailable", `libheif runtime failed to load: ${error instanceof Error ? error.message : String(error)}`, error);
|
|
606
|
+
}
|
|
607
|
+
if (context.signal.aborted) throw abortError();
|
|
608
|
+
try {
|
|
609
|
+
const decoded = decoder.decodePrimary(bytes);
|
|
610
|
+
checkDimensions(decoded.width, decoded.height);
|
|
611
|
+
return downscaleRgba({ width: decoded.width, height: decoded.height, data: new Uint8ClampedArray(decoded.rgba) }, params.maxDimension, PLUGIN_ID);
|
|
612
|
+
} catch (error) {
|
|
613
|
+
return mapError(error, "HEIF primary image could not be decoded.");
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
var extract_default = modernRasterExtractor;
|
|
618
|
+
export {
|
|
619
|
+
extract_default as default
|
|
620
|
+
};
|