@l1yp/file-viewer 0.1.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 +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
package/dist/lib/rar.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createExtractorFromData as e } from "node-unrar-js";
|
|
2
|
+
import t from "node-unrar-js/esm/js/unrar.wasm?url";
|
|
3
|
+
//#region src/lib/rar.ts
|
|
4
|
+
var n = null;
|
|
5
|
+
async function r() {
|
|
6
|
+
if (!n) {
|
|
7
|
+
let e = await fetch(t);
|
|
8
|
+
if (!e.ok) throw Error(`无法加载 unrar.wasm(HTTP ${e.status})`);
|
|
9
|
+
n = await e.arrayBuffer();
|
|
10
|
+
}
|
|
11
|
+
return n;
|
|
12
|
+
}
|
|
13
|
+
async function i(t) {
|
|
14
|
+
let n = await e({
|
|
15
|
+
wasmBinary: await r(),
|
|
16
|
+
data: t
|
|
17
|
+
}), i = [...n.getFileList().fileHeaders];
|
|
18
|
+
return {
|
|
19
|
+
entries: i.map((e, t) => {
|
|
20
|
+
let n = e.name.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
21
|
+
return {
|
|
22
|
+
path: n,
|
|
23
|
+
name: n.split("/").pop() ?? n,
|
|
24
|
+
size: e.flags.directory ? 0 : e.unpSize,
|
|
25
|
+
isDir: e.flags.directory,
|
|
26
|
+
ref: t
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
extract(e) {
|
|
30
|
+
let t = i[e.ref];
|
|
31
|
+
if (!t || t.flags.directory) return new Uint8Array();
|
|
32
|
+
if (t.flags.encrypted) throw Error("该条目已加密,无法读取");
|
|
33
|
+
let r = [...n.extract({ files: [t.name] }).files], a = r.find((e) => e.fileHeader.name === t.name) ?? r[0];
|
|
34
|
+
if (!a?.extraction) throw Error("解压失败(该条目无数据)");
|
|
35
|
+
return a.extraction;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { i as openRar };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort camera-RAW preview extraction (zero-dependency).
|
|
3
|
+
*
|
|
4
|
+
* Decoding a raw sensor file (CR2/NEF/ARW/DNG/…) into an image requires a full demosaicing pipeline that's
|
|
5
|
+
* out of scope for the browser. But virtually every RAW embeds a ready-to-view JPEG preview (often full-res).
|
|
6
|
+
* This walks the file's JPEG streams properly — skipping each marker segment by its length, including the
|
|
7
|
+
* EXIF thumbnail nested in APP1, so it finds true SOI…EOI boundaries rather than cutting at the first stray
|
|
8
|
+
* `FF D9` — and returns the LARGEST embedded JPEG (the main preview). Imperfect by nature; a file with no
|
|
9
|
+
* embedded JPEG yields null.
|
|
10
|
+
*/
|
|
11
|
+
/** Return the bytes of the largest embedded JPEG in `buf` (the RAW's main preview), or null if none. */
|
|
12
|
+
export declare function extractLargestJpeg(buf: ArrayBuffer): Uint8Array | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/lib/rawPreview.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = t + 2, r = e.length;
|
|
4
|
+
for (; n < r - 1;) {
|
|
5
|
+
if (e[n] !== 255) {
|
|
6
|
+
n++;
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
let t = e[n + 1];
|
|
10
|
+
if (t === 255) {
|
|
11
|
+
n++;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (t === 217) return n + 2;
|
|
15
|
+
if (t === 1 || t >= 208 && t <= 215) {
|
|
16
|
+
n += 2;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (n + 3 >= r) return -1;
|
|
20
|
+
let i = e[n + 2] << 8 | e[n + 3];
|
|
21
|
+
if (i < 2) return -1;
|
|
22
|
+
if (t === 218) {
|
|
23
|
+
for (n += 2 + i; n < r - 1;) {
|
|
24
|
+
if (e[n] === 255) {
|
|
25
|
+
let t = e[n + 1];
|
|
26
|
+
if (t !== 0 && !(t >= 208 && t <= 215)) break;
|
|
27
|
+
}
|
|
28
|
+
n++;
|
|
29
|
+
}
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
n += 2 + i;
|
|
33
|
+
}
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
function t(t) {
|
|
37
|
+
let n = new Uint8Array(t), r = n.length, i = null, a = 0;
|
|
38
|
+
for (; a < r - 1;) {
|
|
39
|
+
if (n[a] === 255 && n[a + 1] === 216) {
|
|
40
|
+
let t = e(n, a);
|
|
41
|
+
if (t > a) {
|
|
42
|
+
(!i || t - a > i.end - i.start) && (i = {
|
|
43
|
+
start: a,
|
|
44
|
+
end: t
|
|
45
|
+
}), a = t;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
a++;
|
|
50
|
+
}
|
|
51
|
+
return i ? n.subarray(i.start, i.end) : null;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { t as extractLargestJpeg };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact RC2 (RFC 2268) CBC decryption — no dependency, no WASM.
|
|
3
|
+
*
|
|
4
|
+
* Needed for legacy PKCS#12 keystores (see lib/pkcs12.ts): certificate bags are commonly encrypted with
|
|
5
|
+
* `pbeWithSHA1And40BitRC2-CBC` (or the 128-bit variant), and WebCrypto ships no RC2. Decrypt-only. RC2 is
|
|
6
|
+
* obsolete — used here ONLY to read existing keystores. Blocks are 8 bytes; words are 16-bit little-endian.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* RC2-CBC decrypt, no padding removal (the caller strips PKCS#7). `iv` is 8 bytes; `data` must be a whole
|
|
10
|
+
* number of 8-byte blocks. `effectiveBits` defaults to the key length in bits (PKCS#12 40-bit RC2 passes 40).
|
|
11
|
+
*/
|
|
12
|
+
export declare function rc2CbcDecrypt(key: Uint8Array, iv: Uint8Array, data: Uint8Array, effectiveBits?: number): Uint8Array;
|
package/dist/lib/rc2.js
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
//#region src/lib/rc2.ts
|
|
2
|
+
var e = new Uint8Array([
|
|
3
|
+
217,
|
|
4
|
+
120,
|
|
5
|
+
249,
|
|
6
|
+
196,
|
|
7
|
+
25,
|
|
8
|
+
221,
|
|
9
|
+
181,
|
|
10
|
+
237,
|
|
11
|
+
40,
|
|
12
|
+
233,
|
|
13
|
+
253,
|
|
14
|
+
121,
|
|
15
|
+
74,
|
|
16
|
+
160,
|
|
17
|
+
216,
|
|
18
|
+
157,
|
|
19
|
+
198,
|
|
20
|
+
126,
|
|
21
|
+
55,
|
|
22
|
+
131,
|
|
23
|
+
43,
|
|
24
|
+
118,
|
|
25
|
+
83,
|
|
26
|
+
142,
|
|
27
|
+
98,
|
|
28
|
+
76,
|
|
29
|
+
100,
|
|
30
|
+
136,
|
|
31
|
+
68,
|
|
32
|
+
139,
|
|
33
|
+
251,
|
|
34
|
+
162,
|
|
35
|
+
23,
|
|
36
|
+
154,
|
|
37
|
+
89,
|
|
38
|
+
245,
|
|
39
|
+
135,
|
|
40
|
+
179,
|
|
41
|
+
79,
|
|
42
|
+
19,
|
|
43
|
+
97,
|
|
44
|
+
69,
|
|
45
|
+
109,
|
|
46
|
+
141,
|
|
47
|
+
9,
|
|
48
|
+
129,
|
|
49
|
+
125,
|
|
50
|
+
50,
|
|
51
|
+
189,
|
|
52
|
+
143,
|
|
53
|
+
64,
|
|
54
|
+
235,
|
|
55
|
+
134,
|
|
56
|
+
183,
|
|
57
|
+
123,
|
|
58
|
+
11,
|
|
59
|
+
240,
|
|
60
|
+
149,
|
|
61
|
+
33,
|
|
62
|
+
34,
|
|
63
|
+
92,
|
|
64
|
+
107,
|
|
65
|
+
78,
|
|
66
|
+
130,
|
|
67
|
+
84,
|
|
68
|
+
214,
|
|
69
|
+
101,
|
|
70
|
+
147,
|
|
71
|
+
206,
|
|
72
|
+
96,
|
|
73
|
+
178,
|
|
74
|
+
28,
|
|
75
|
+
115,
|
|
76
|
+
86,
|
|
77
|
+
192,
|
|
78
|
+
20,
|
|
79
|
+
167,
|
|
80
|
+
140,
|
|
81
|
+
241,
|
|
82
|
+
220,
|
|
83
|
+
18,
|
|
84
|
+
117,
|
|
85
|
+
202,
|
|
86
|
+
31,
|
|
87
|
+
59,
|
|
88
|
+
190,
|
|
89
|
+
228,
|
|
90
|
+
209,
|
|
91
|
+
66,
|
|
92
|
+
61,
|
|
93
|
+
212,
|
|
94
|
+
48,
|
|
95
|
+
163,
|
|
96
|
+
60,
|
|
97
|
+
182,
|
|
98
|
+
38,
|
|
99
|
+
111,
|
|
100
|
+
191,
|
|
101
|
+
14,
|
|
102
|
+
218,
|
|
103
|
+
70,
|
|
104
|
+
105,
|
|
105
|
+
7,
|
|
106
|
+
87,
|
|
107
|
+
39,
|
|
108
|
+
242,
|
|
109
|
+
29,
|
|
110
|
+
155,
|
|
111
|
+
188,
|
|
112
|
+
148,
|
|
113
|
+
67,
|
|
114
|
+
3,
|
|
115
|
+
248,
|
|
116
|
+
17,
|
|
117
|
+
199,
|
|
118
|
+
246,
|
|
119
|
+
144,
|
|
120
|
+
239,
|
|
121
|
+
62,
|
|
122
|
+
231,
|
|
123
|
+
6,
|
|
124
|
+
195,
|
|
125
|
+
213,
|
|
126
|
+
47,
|
|
127
|
+
200,
|
|
128
|
+
102,
|
|
129
|
+
30,
|
|
130
|
+
215,
|
|
131
|
+
8,
|
|
132
|
+
232,
|
|
133
|
+
234,
|
|
134
|
+
222,
|
|
135
|
+
128,
|
|
136
|
+
82,
|
|
137
|
+
238,
|
|
138
|
+
247,
|
|
139
|
+
132,
|
|
140
|
+
170,
|
|
141
|
+
114,
|
|
142
|
+
172,
|
|
143
|
+
53,
|
|
144
|
+
77,
|
|
145
|
+
106,
|
|
146
|
+
42,
|
|
147
|
+
150,
|
|
148
|
+
26,
|
|
149
|
+
210,
|
|
150
|
+
113,
|
|
151
|
+
90,
|
|
152
|
+
21,
|
|
153
|
+
73,
|
|
154
|
+
116,
|
|
155
|
+
75,
|
|
156
|
+
159,
|
|
157
|
+
208,
|
|
158
|
+
94,
|
|
159
|
+
4,
|
|
160
|
+
24,
|
|
161
|
+
164,
|
|
162
|
+
236,
|
|
163
|
+
194,
|
|
164
|
+
224,
|
|
165
|
+
65,
|
|
166
|
+
110,
|
|
167
|
+
15,
|
|
168
|
+
81,
|
|
169
|
+
203,
|
|
170
|
+
204,
|
|
171
|
+
36,
|
|
172
|
+
145,
|
|
173
|
+
175,
|
|
174
|
+
80,
|
|
175
|
+
161,
|
|
176
|
+
244,
|
|
177
|
+
112,
|
|
178
|
+
57,
|
|
179
|
+
153,
|
|
180
|
+
124,
|
|
181
|
+
58,
|
|
182
|
+
133,
|
|
183
|
+
35,
|
|
184
|
+
184,
|
|
185
|
+
180,
|
|
186
|
+
122,
|
|
187
|
+
252,
|
|
188
|
+
2,
|
|
189
|
+
54,
|
|
190
|
+
91,
|
|
191
|
+
37,
|
|
192
|
+
85,
|
|
193
|
+
151,
|
|
194
|
+
49,
|
|
195
|
+
45,
|
|
196
|
+
93,
|
|
197
|
+
250,
|
|
198
|
+
152,
|
|
199
|
+
227,
|
|
200
|
+
138,
|
|
201
|
+
146,
|
|
202
|
+
174,
|
|
203
|
+
5,
|
|
204
|
+
223,
|
|
205
|
+
41,
|
|
206
|
+
16,
|
|
207
|
+
103,
|
|
208
|
+
108,
|
|
209
|
+
186,
|
|
210
|
+
201,
|
|
211
|
+
211,
|
|
212
|
+
0,
|
|
213
|
+
230,
|
|
214
|
+
207,
|
|
215
|
+
225,
|
|
216
|
+
158,
|
|
217
|
+
168,
|
|
218
|
+
44,
|
|
219
|
+
99,
|
|
220
|
+
22,
|
|
221
|
+
1,
|
|
222
|
+
63,
|
|
223
|
+
88,
|
|
224
|
+
226,
|
|
225
|
+
137,
|
|
226
|
+
169,
|
|
227
|
+
13,
|
|
228
|
+
56,
|
|
229
|
+
52,
|
|
230
|
+
27,
|
|
231
|
+
171,
|
|
232
|
+
51,
|
|
233
|
+
255,
|
|
234
|
+
176,
|
|
235
|
+
187,
|
|
236
|
+
72,
|
|
237
|
+
12,
|
|
238
|
+
95,
|
|
239
|
+
185,
|
|
240
|
+
177,
|
|
241
|
+
205,
|
|
242
|
+
46,
|
|
243
|
+
197,
|
|
244
|
+
243,
|
|
245
|
+
219,
|
|
246
|
+
71,
|
|
247
|
+
229,
|
|
248
|
+
165,
|
|
249
|
+
156,
|
|
250
|
+
119,
|
|
251
|
+
10,
|
|
252
|
+
166,
|
|
253
|
+
32,
|
|
254
|
+
104,
|
|
255
|
+
254,
|
|
256
|
+
127,
|
|
257
|
+
193,
|
|
258
|
+
173
|
|
259
|
+
]);
|
|
260
|
+
function t(t, n) {
|
|
261
|
+
let r = new Uint8Array(128), i = t.length;
|
|
262
|
+
r.set(t.subarray(0, i));
|
|
263
|
+
let a = n, o = a + 7 >> 3, s = 255 >> (8 * o - a & 7);
|
|
264
|
+
for (let t = i; t < 128; t++) r[t] = e[r[t - 1] + r[t - i] & 255];
|
|
265
|
+
r[128 - o] = e[r[128 - o] & s];
|
|
266
|
+
for (let t = 127 - o; t >= 0; t--) r[t] = e[r[t + 1] ^ r[t + o]];
|
|
267
|
+
let c = new Uint16Array(64);
|
|
268
|
+
for (let e = 0; e < 64; e++) c[e] = r[2 * e] | r[2 * e + 1] << 8;
|
|
269
|
+
return c;
|
|
270
|
+
}
|
|
271
|
+
var n = (e, t) => (e >>> t | e << 16 - t) & 65535;
|
|
272
|
+
function r(e, t) {
|
|
273
|
+
let [r, i, a, o] = e, s = 63, c = () => {
|
|
274
|
+
o = n(o, 5), o = o - t[s--] - (a & i) - (~a & r) & 65535, a = n(a, 3), a = a - t[s--] - (i & r) - (~i & o) & 65535, i = n(i, 2), i = i - t[s--] - (r & o) - (~r & a) & 65535, r = n(r, 1), r = r - t[s--] - (o & a) - (~o & i) & 65535;
|
|
275
|
+
}, l = () => {
|
|
276
|
+
o = o - t[a & 63] & 65535, a = a - t[i & 63] & 65535, i = i - t[r & 63] & 65535, r = r - t[o & 63] & 65535;
|
|
277
|
+
};
|
|
278
|
+
for (let e = 0; e < 5; e++) c();
|
|
279
|
+
l();
|
|
280
|
+
for (let e = 0; e < 6; e++) c();
|
|
281
|
+
l();
|
|
282
|
+
for (let e = 0; e < 5; e++) c();
|
|
283
|
+
e[0] = r, e[1] = i, e[2] = a, e[3] = o;
|
|
284
|
+
}
|
|
285
|
+
function i(e, n, i, a = e.length * 8) {
|
|
286
|
+
let o = t(e, a), s = i.length - i.length % 8, c = new Uint8Array(s), l = new Uint8Array(8);
|
|
287
|
+
l.set(n.subarray(0, 8));
|
|
288
|
+
let u = [
|
|
289
|
+
0,
|
|
290
|
+
0,
|
|
291
|
+
0,
|
|
292
|
+
0
|
|
293
|
+
];
|
|
294
|
+
for (let e = 0; e < s; e += 8) u[0] = i[e] | i[e + 1] << 8, u[1] = i[e + 2] | i[e + 3] << 8, u[2] = i[e + 4] | i[e + 5] << 8, u[3] = i[e + 6] | i[e + 7] << 8, r(u, o), c[e] = u[0] & 255 ^ l[0], c[e + 1] = u[0] >> 8 & 255 ^ l[1], c[e + 2] = u[1] & 255 ^ l[2], c[e + 3] = u[1] >> 8 & 255 ^ l[3], c[e + 4] = u[2] & 255 ^ l[4], c[e + 5] = u[2] >> 8 & 255 ^ l[5], c[e + 6] = u[3] & 255 ^ l[6], c[e + 7] = u[3] >> 8 & 255 ^ l[7], l.set(i.subarray(e, e + 8));
|
|
295
|
+
return c;
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
export { i as rc2CbcDecrypt };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ViewerInput } from '../types';
|
|
2
|
+
/** A normalized source: always a fetchable URL, plus optional pre-decoded text; `dispose()` frees blob: URLs. */
|
|
3
|
+
export interface ResolvedSource {
|
|
4
|
+
name: string;
|
|
5
|
+
mime: string | null;
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Always fetchable: the real `src`, or a `blob:` URL for blob/text/load/pre-fetched sources. */
|
|
8
|
+
url: string;
|
|
9
|
+
/** Present when the input carried decoded text (text-backed viewers use it directly — no fetch). */
|
|
10
|
+
text?: string;
|
|
11
|
+
/** Release any `blob:` URL this created. No-op for a pass-through `src`. */
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a {@link ViewerInput} into a fetchable source (see docs/file-viewer-package-design.md §2).
|
|
16
|
+
*
|
|
17
|
+
* Async because AUTHENTICATED sources (`fetchConfig`/`load`) are pulled ONCE here and turned into a `blob:`
|
|
18
|
+
* URL — so the self-fetching sub-viewers keep calling plain `fetch(url)` with no auth knowledge, and the
|
|
19
|
+
* credentials live in exactly one place. A plain public `src` is passed through unchanged (streaming stays
|
|
20
|
+
* intact for the big-file viewers). `blob`/`text` become object URLs. Precedence: text > blob > load > src.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveInput(input: ViewerInput): Promise<ResolvedSource>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/lib/resolveInput.ts
|
|
2
|
+
var e = () => {};
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return e instanceof Blob ? e : new Blob([e], t ? { type: t } : void 0);
|
|
5
|
+
}
|
|
6
|
+
async function n(n) {
|
|
7
|
+
let r = n.name, i = n.mime && n.mime.trim() ? n.mime : null, a = {
|
|
8
|
+
name: r,
|
|
9
|
+
mime: i,
|
|
10
|
+
size: n.size
|
|
11
|
+
};
|
|
12
|
+
if (n.text != null) {
|
|
13
|
+
let e = URL.createObjectURL(new Blob([n.text], { type: i ?? "text/plain" }));
|
|
14
|
+
return {
|
|
15
|
+
...a,
|
|
16
|
+
url: e,
|
|
17
|
+
text: n.text,
|
|
18
|
+
dispose: () => URL.revokeObjectURL(e)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (n.blob) {
|
|
22
|
+
let e = URL.createObjectURL(n.blob);
|
|
23
|
+
return {
|
|
24
|
+
...a,
|
|
25
|
+
url: e,
|
|
26
|
+
dispose: () => URL.revokeObjectURL(e)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (n.load) {
|
|
30
|
+
let e = URL.createObjectURL(t(await n.load(), i));
|
|
31
|
+
return {
|
|
32
|
+
...a,
|
|
33
|
+
url: e,
|
|
34
|
+
dispose: () => URL.revokeObjectURL(e)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (n.src && n.fetchConfig) {
|
|
38
|
+
let e = await fetch(n.src, n.fetchConfig);
|
|
39
|
+
if (!e.ok) throw Error(`HTTP ${e.status} fetching "${r}"`);
|
|
40
|
+
let t = URL.createObjectURL(await e.blob());
|
|
41
|
+
return {
|
|
42
|
+
...a,
|
|
43
|
+
url: t,
|
|
44
|
+
dispose: () => URL.revokeObjectURL(t)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (n.src) return {
|
|
48
|
+
...a,
|
|
49
|
+
url: n.src,
|
|
50
|
+
dispose: e
|
|
51
|
+
};
|
|
52
|
+
throw Error(`ViewerInput for "${r}" has no data source (src / blob / text / load)`);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { n as resolveInput };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-dependency RTF (Rich Text Format) → HTML renderer for the side viewer's {@link RtfViewer}.
|
|
3
|
+
*
|
|
4
|
+
* RTF is a 7-bit-ASCII control-word format — `{\rtf1 … }` groups, `\word`/`\word42` control words, `\'hh` raw
|
|
5
|
+
* bytes, `\uN` unicode — so (like the eml / mht / har / asn1 parsers) we hand-roll it rather than pull a heavy
|
|
6
|
+
* canvas-based library. We interpret the document with a group state stack and emit a small, SAFE HTML tree:
|
|
7
|
+
*
|
|
8
|
+
* - paragraphs (`\par`) → `<p>` with text-align; soft breaks (`\line`) → `\n` (the container is white-space:
|
|
9
|
+
* pre-wrap, so `\tab`/`\n`/runs of spaces survive without needing `<br>`);
|
|
10
|
+
* - character runs → `<span style>` carrying ONLY whitelisted, self-computed values: bold/italic via
|
|
11
|
+
* font-weight/style, underline/strike via text-decoration, `\cfN` → `#rrggbb` from the parsed color table,
|
|
12
|
+
* `\fsN` → pt, `\fN` → a sanitized font-family stack from the font table, `\super`/`\sub` → vertical-align.
|
|
13
|
+
*
|
|
14
|
+
* Security: every byte of text is HTML-escaped and the only attributes we emit are numbers (sizes), `#rrggbb`
|
|
15
|
+
* colors, and a quote-/bracket-stripped font name — there is NO path for upstream markup, URLs, or scripts to
|
|
16
|
+
* reach the output, so the component can inline it with `v-html` (same posture as DrawioViewer/WidgetBlock's
|
|
17
|
+
* self-generated SVG). Unknown control words, binary blobs (`\bin`), pictures and other destinations we don't
|
|
18
|
+
* render are skipped, never dumped as raw text.
|
|
19
|
+
*
|
|
20
|
+
* Charset handling: `\'hh` bytes are decoded with a TextDecoder chosen from the current font's `\fcharset` (or
|
|
21
|
+
* the document's `\ansicpg`), so CJK / Cyrillic / etc. documents read correctly; `\uN` carries unicode directly
|
|
22
|
+
* (with `\ucN` fallback bytes skipped). Multi-byte `\'hh` pairs are buffered and decoded together — we only
|
|
23
|
+
* flush the byte buffer at formatting/group boundaries, never between two adjacent `\'` escapes.
|
|
24
|
+
*/
|
|
25
|
+
/** One styled text run within a paragraph. Booleans/values map 1:1 to a `<span style>` (see {@link runHtml}). */
|
|
26
|
+
export interface RtfRun {
|
|
27
|
+
text: string;
|
|
28
|
+
bold: boolean;
|
|
29
|
+
italic: boolean;
|
|
30
|
+
underline: boolean;
|
|
31
|
+
strike: boolean;
|
|
32
|
+
superscript: boolean;
|
|
33
|
+
subscript: boolean;
|
|
34
|
+
/** '#rrggbb' from the color table (`\cfN`), or null for the automatic/default color. */
|
|
35
|
+
color: string | null;
|
|
36
|
+
/** Point size (`\fsN` is half-points), or null to inherit the container's size. */
|
|
37
|
+
size: number | null;
|
|
38
|
+
/** A sanitized CSS font-family stack (e.g. `'Times New Roman', serif`), or null to inherit. */
|
|
39
|
+
font: string | null;
|
|
40
|
+
}
|
|
41
|
+
/** A paragraph: its alignment plus the styled runs it holds (empty runs ⇒ a blank line). */
|
|
42
|
+
export interface RtfPara {
|
|
43
|
+
align: 'left' | 'center' | 'right' | 'justify';
|
|
44
|
+
runs: RtfRun[];
|
|
45
|
+
}
|
|
46
|
+
export interface RtfDoc {
|
|
47
|
+
paras: RtfPara[];
|
|
48
|
+
}
|
|
49
|
+
export declare function parseRtf(bytes: Uint8Array): RtfDoc;
|
|
50
|
+
/** Render a parsed document to a safe HTML string (self-generated, fully escaped — see the file header). */
|
|
51
|
+
export declare function rtfToHtml(doc: RtfDoc): string;
|
|
52
|
+
/** Parse + render in one step: RTF bytes → safe HTML. */
|
|
53
|
+
export declare function renderRtf(bytes: Uint8Array): string;
|