@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for outline / mind-map files into a common tree, shared by the side viewer's MindMapView.
|
|
3
|
+
*
|
|
4
|
+
* Two input formats, both XML, both fundamentally a tree:
|
|
5
|
+
* - OPML (.opml): `<opml><head><title/></head><body><outline text=… _note=… url=…>…</outline></body></opml>`,
|
|
6
|
+
* `<outline>` nests arbitrarily. Used for RSS feed lists, outlines, and some mind-map exports.
|
|
7
|
+
* - FreeMind / Freeplane (.mm): `<map><node TEXT=… LINK=… COLOR=… FOLDED=…>…</node></map>`, `<node>` nests;
|
|
8
|
+
* a node's label can also live in `<richcontent TYPE="NODE">…html…</richcontent>`, notes in `TYPE="NOTE"`.
|
|
9
|
+
*
|
|
10
|
+
* We parse with the browser DOMParser (guarded for SSR — the viewer is client-only, but stay defensive) and
|
|
11
|
+
* normalize both into {@link MindNode}. Node ids are assigned during parse and are stable for the lifetime of a
|
|
12
|
+
* parsed tree (the viewer caches the parse by file text), so they key the collapse/expand state.
|
|
13
|
+
*
|
|
14
|
+
* `.mm` is ALSO the Objective-C++ source extension, so callers must content-sniff with {@link looksLikeMindMap}
|
|
15
|
+
* before treating a `.mm` as a mind map — an Objective-C++ `.mm` is not XML and would (rightly) fail this gate.
|
|
16
|
+
*/
|
|
17
|
+
export interface MindNode {
|
|
18
|
+
/** Stable id within one parsed tree — keys collapse/expand state. */
|
|
19
|
+
id: number;
|
|
20
|
+
/** Plain-text label (markup/whitespace flattened). */
|
|
21
|
+
text: string;
|
|
22
|
+
/** Optional note (OPML `_note`, FreeMind `<richcontent TYPE="NOTE">`) — shown as a hover tooltip. */
|
|
23
|
+
note?: string;
|
|
24
|
+
/** Optional hyperlink (OPML `url`/`htmlUrl`/`xmlUrl`, FreeMind `LINK`) — rendered as an open-in-new-tab glyph. */
|
|
25
|
+
link?: string;
|
|
26
|
+
/** Explicit text color (FreeMind `COLOR`), `#rgb`/`#rrggbb` only. */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** Explicit background color (FreeMind `BACKGROUND_COLOR`), `#rgb`/`#rrggbb` only. */
|
|
29
|
+
bg?: string;
|
|
30
|
+
/** Authored initial fold state (FreeMind `FOLDED="true"`) — the viewer seeds collapse from this. */
|
|
31
|
+
foldedInit?: boolean;
|
|
32
|
+
children: MindNode[];
|
|
33
|
+
}
|
|
34
|
+
export interface MindMap {
|
|
35
|
+
format: 'opml' | 'freemind' | 'xmind';
|
|
36
|
+
title: string;
|
|
37
|
+
root: MindNode;
|
|
38
|
+
/** Total node count (incl. root), for the viewer's summary line. */
|
|
39
|
+
count: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parse OPML or FreeMind XML into a {@link MindMap}. `kind` picks the parser, but the actual root element wins
|
|
43
|
+
* if it disagrees (so a mislabeled file still parses). Throws on malformed XML or an unrecognized root.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseMindMap(text: string, kind: 'opml' | 'mm', fallbackTitle?: string): MindMap;
|
|
46
|
+
/**
|
|
47
|
+
* Cheap content sniff to confirm a file really is a mind map before showing the diagram. `.opml` is unambiguous;
|
|
48
|
+
* `.mm` is gated because the extension is shared with Objective-C++ — a non-XML `.mm` fails here and falls back
|
|
49
|
+
* to plain highlighted source. Only the file head is inspected.
|
|
50
|
+
*/
|
|
51
|
+
export declare function looksLikeMindMap(text: string, ext: string): boolean;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//#region src/lib/mindmap.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = [];
|
|
4
|
+
for (let r of Array.from(e.children)) r.tagName.toLowerCase() === t && n.push(r);
|
|
5
|
+
return n;
|
|
6
|
+
}
|
|
7
|
+
function t(e, t, r) {
|
|
8
|
+
for (let i of Array.from(e.children)) if (i.tagName.toLowerCase() === t && !(r && (n(i, "TYPE") || "").toLowerCase() !== r.toLowerCase())) return i;
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
function n(e, ...t) {
|
|
12
|
+
for (let n of t) {
|
|
13
|
+
let t = e.getAttribute(n);
|
|
14
|
+
if (t != null) return t;
|
|
15
|
+
}
|
|
16
|
+
let n = t.map((e) => e.toLowerCase());
|
|
17
|
+
for (let t of Array.from(e.attributes)) if (n.includes(t.name.toLowerCase())) return t.value;
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function r(e) {
|
|
21
|
+
return (e || "").replace(/\s+/g, " ").trim();
|
|
22
|
+
}
|
|
23
|
+
function i(e) {
|
|
24
|
+
if (e) return /^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(e.trim()) ? e.trim() : void 0;
|
|
25
|
+
}
|
|
26
|
+
function a() {
|
|
27
|
+
let e = 0;
|
|
28
|
+
return () => e++;
|
|
29
|
+
}
|
|
30
|
+
function o(t, i) {
|
|
31
|
+
let a = n(t, "text", "title") ?? "", c = r(a.includes("<") ? s(a) : a), l = r(n(t, "_note", "note") ?? ""), u = n(t, "url", "htmlUrl", "xmlUrl") ?? void 0;
|
|
32
|
+
return {
|
|
33
|
+
id: i(),
|
|
34
|
+
text: c,
|
|
35
|
+
note: l || void 0,
|
|
36
|
+
link: u || void 0,
|
|
37
|
+
children: e(t, "outline").map((e) => o(e, i))
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function s(e) {
|
|
41
|
+
return e.replace(/<[^>]*>/g, " ");
|
|
42
|
+
}
|
|
43
|
+
function c(a, o) {
|
|
44
|
+
let s = n(a, "TEXT");
|
|
45
|
+
if (s == null) {
|
|
46
|
+
let e = t(a, "richcontent", "NODE") ?? t(a, "richcontent");
|
|
47
|
+
s = e ? e.textContent : "";
|
|
48
|
+
}
|
|
49
|
+
let l = t(a, "richcontent", "NOTE");
|
|
50
|
+
return {
|
|
51
|
+
id: o(),
|
|
52
|
+
text: r(s),
|
|
53
|
+
note: l && r(l.textContent) || void 0,
|
|
54
|
+
link: n(a, "LINK") ?? void 0,
|
|
55
|
+
color: i(n(a, "COLOR")),
|
|
56
|
+
bg: i(n(a, "BACKGROUND_COLOR")),
|
|
57
|
+
foldedInit: (n(a, "FOLDED") || "").toLowerCase() === "true",
|
|
58
|
+
children: e(a, "node").map((e) => c(e, o))
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function l(e) {
|
|
62
|
+
let t = 1;
|
|
63
|
+
for (let n of e.children) t += l(n);
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
function u(t, n, i = "") {
|
|
67
|
+
if (typeof DOMParser > "u") return {
|
|
68
|
+
format: n === "opml" ? "opml" : "freemind",
|
|
69
|
+
title: i,
|
|
70
|
+
root: {
|
|
71
|
+
id: 0,
|
|
72
|
+
text: i,
|
|
73
|
+
children: []
|
|
74
|
+
},
|
|
75
|
+
count: 1
|
|
76
|
+
};
|
|
77
|
+
let s = new DOMParser().parseFromString(t, "application/xml");
|
|
78
|
+
if (s.querySelector("parsererror")) throw Error("XML 解析失败");
|
|
79
|
+
let u = a(), d = s.querySelector("opml"), f = s.querySelector("map");
|
|
80
|
+
if (d || n === "opml" && !f) {
|
|
81
|
+
let t = d ?? s.documentElement, n = t.querySelector("head > title") ?? s.querySelector("head > title"), a = r(n?.textContent) || i || "大纲", c = t.querySelector("body") ?? s.querySelector("body"), f = c ? e(c, "outline") : [], p;
|
|
82
|
+
return p = !r(n?.textContent) && f.length === 1 ? o(f[0], u) : {
|
|
83
|
+
id: u(),
|
|
84
|
+
text: a,
|
|
85
|
+
children: f.map((e) => o(e, u))
|
|
86
|
+
}, {
|
|
87
|
+
format: "opml",
|
|
88
|
+
title: p.text || a,
|
|
89
|
+
root: p,
|
|
90
|
+
count: l(p)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (f) {
|
|
94
|
+
let t = e(f, "node")[0], n = t ? c(t, u) : {
|
|
95
|
+
id: u(),
|
|
96
|
+
text: i || "思维导图",
|
|
97
|
+
children: []
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
format: "freemind",
|
|
101
|
+
title: n.text || i || "思维导图",
|
|
102
|
+
root: n,
|
|
103
|
+
count: l(n)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
throw Error("无法识别的文件结构(既非 OPML 也非 FreeMind)");
|
|
107
|
+
}
|
|
108
|
+
function d(e, t) {
|
|
109
|
+
let n = (e || "").slice(0, 4096);
|
|
110
|
+
return t === "opml" ? /<opml[\s>]/i.test(n) : t === "mm" ? /<map[\s>]/i.test(n) && /<node[\s>]/i.test(n) : !1;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { d as looksLikeMindMap, u as parseMindMap };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-rolled, zero-dependency BEST-EFFORT MOBI / AZW3 text extractor for the side viewer.
|
|
3
|
+
*
|
|
4
|
+
* Kindle formats are a Palm Database (PDB) holding a MOBI/KF8 header plus text records. This parses the PDB,
|
|
5
|
+
* reads the PalmDOC/MOBI header, strips each text record's trailing-data entries, decompresses (PalmDOC LZ77,
|
|
6
|
+
* or uncompressed), and concatenates the result into the book's HTML — which the viewer shows in a sandboxed
|
|
7
|
+
* iframe. It is intentionally PARTIAL: HUFF/CDIC-compressed books (compression 17480) and DRM'd books can't
|
|
8
|
+
* be read here, and inline images (`<img recindex>`) are dropped (we don't resolve image records). Such files
|
|
9
|
+
* should be downloaded and opened in a real reader.
|
|
10
|
+
*/
|
|
11
|
+
export interface ParsedMobi {
|
|
12
|
+
title: string;
|
|
13
|
+
html: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseMobi(buf: ArrayBuffer): ParsedMobi;
|
package/dist/lib/mobi.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/lib/mobi.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = 0;
|
|
4
|
+
for (let r = Math.max(0, t - 4); r < t; r++) {
|
|
5
|
+
let t = e[r];
|
|
6
|
+
t & 128 && (n = 0), n = n << 7 | t & 127;
|
|
7
|
+
}
|
|
8
|
+
return n;
|
|
9
|
+
}
|
|
10
|
+
function t(t, n) {
|
|
11
|
+
let r = 0, i = n >> 1;
|
|
12
|
+
for (; i;) i & 1 && (r += e(t, t.length - r)), i >>= 1;
|
|
13
|
+
return n & 1 && (r += (t[t.length - r - 1] & 3) + 1), r;
|
|
14
|
+
}
|
|
15
|
+
function n(e) {
|
|
16
|
+
let t = [], n = 0, r = e.length;
|
|
17
|
+
for (; n < r;) {
|
|
18
|
+
let i = e[n++];
|
|
19
|
+
if (i === 0) t.push(0);
|
|
20
|
+
else if (i <= 8) for (let a = 0; a < i && n < r; a++) t.push(e[n++]);
|
|
21
|
+
else if (i <= 127) t.push(i);
|
|
22
|
+
else if (i <= 191) {
|
|
23
|
+
let r = (i << 8 | e[n++]) & 16383, a = r >> 3, o = (r & 7) + 3, s = t.length - a;
|
|
24
|
+
if (s < 0) break;
|
|
25
|
+
for (let e = 0; e < o; e++) t.push(t[s++]);
|
|
26
|
+
} else t.push(32, i ^ 128);
|
|
27
|
+
}
|
|
28
|
+
return Uint8Array.from(t);
|
|
29
|
+
}
|
|
30
|
+
function r(e, t) {
|
|
31
|
+
let n = t === 65001 ? "utf-8" : "windows-1252";
|
|
32
|
+
try {
|
|
33
|
+
return new TextDecoder(n).decode(e);
|
|
34
|
+
} catch {
|
|
35
|
+
return new TextDecoder("utf-8").decode(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function i(e) {
|
|
39
|
+
let i = new DataView(e);
|
|
40
|
+
if (e.byteLength < 80) throw Error("文件过小,不是有效的 MOBI");
|
|
41
|
+
let a = i.getUint16(76);
|
|
42
|
+
if (!a) throw Error("MOBI 没有记录");
|
|
43
|
+
let o = [];
|
|
44
|
+
for (let e = 0; e < a; e++) o.push(i.getUint32(78 + e * 8));
|
|
45
|
+
o.push(e.byteLength);
|
|
46
|
+
let s = (t) => new Uint8Array(e, o[t], o[t + 1] - o[t]), c = s(0), l = new DataView(c.buffer, c.byteOffset, c.byteLength), u = l.getUint16(0), d = l.getUint16(8);
|
|
47
|
+
if (u === 17480) throw Error("该 MOBI 使用 HUFF/CDIC 压缩,暂不支持浏览器内解析(请下载后用阅读器打开)");
|
|
48
|
+
let f = c.length > 20 && String.fromCharCode(c[16], c[17], c[18], c[19]) === "MOBI", p = f ? l.getUint32(28) : 1252, m = f && c.length > 244 ? l.getUint16(242) : 0, h = "";
|
|
49
|
+
if (f && c.length >= 92) {
|
|
50
|
+
let e = l.getUint32(84), t = l.getUint32(88);
|
|
51
|
+
e + t <= c.length && (h = r(c.subarray(e, e + t), p).trim());
|
|
52
|
+
}
|
|
53
|
+
let g = [], _ = Math.min(d, a - 1);
|
|
54
|
+
for (let e = 1; e <= _; e++) {
|
|
55
|
+
let i = s(e), a = m ? t(i, m) : 0;
|
|
56
|
+
a > 0 && a < i.length && (i = i.subarray(0, i.length - a));
|
|
57
|
+
let o = u === 2 ? n(i) : i;
|
|
58
|
+
g.push(r(o, p));
|
|
59
|
+
}
|
|
60
|
+
let v = g.join("");
|
|
61
|
+
if (!v.trim()) throw Error("未能从该 MOBI 提取正文");
|
|
62
|
+
return v = v.replace(/<img[^>]*recindex[^>]*>/gi, ""), {
|
|
63
|
+
title: h,
|
|
64
|
+
html: v
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { i as parseMobi };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal in-browser MSI (Windows Installer) reader — no dependency, no WASM.
|
|
3
|
+
*
|
|
4
|
+
* An `.msi` is NOT a PE executable (that's `.exe`/`.dll` — see lib/binobj.ts), and NOT a zip (that's
|
|
5
|
+
* `.appx`/`.msix` — see lib/appx.ts). It's an OLE2 **Compound File** (a.k.a. structured storage / CFBF):
|
|
6
|
+
* a mini-filesystem of "streams" inside one file (the same container legacy `.doc`/`.xls`/`.msg` use). The
|
|
7
|
+
* install metadata we surface lives in two of those streams:
|
|
8
|
+
* - the standard **SummaryInformation** property set (`\x05SummaryInformation`): title / subject / author /
|
|
9
|
+
* comments, the target platform+language template, the package (revision) code, the authoring tool, dates.
|
|
10
|
+
* - the **Property table** (ProductName / ProductVersion / ProductCode / UpgradeCode / Manufacturer / …),
|
|
11
|
+
* spread across the MSI string pool (`_StringData` + `_StringPool`) and the `Property` table stream.
|
|
12
|
+
*
|
|
13
|
+
* We parse only what a "what is this installer?" view needs — never the embedded cabinet / payload files.
|
|
14
|
+
* The logic is validated byte-for-byte against real installers using the Windows `WindowsInstaller.Installer`
|
|
15
|
+
* COM automation as an oracle (the Property table + SummaryInformation match it exactly).
|
|
16
|
+
*
|
|
17
|
+
* Used by MsiViewer (the side viewer's MSI mode): the bytes come from the same download endpoint as any
|
|
18
|
+
* other file, are parsed entirely client-side, and never leave the browser.
|
|
19
|
+
*/
|
|
20
|
+
export interface MsiMeta {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
export interface MsiProperty {
|
|
25
|
+
name: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MsiInfo {
|
|
29
|
+
/** Resolved product identity from the Property table (any field may be absent if the table is unreadable). */
|
|
30
|
+
productName?: string;
|
|
31
|
+
productVersion?: string;
|
|
32
|
+
manufacturer?: string;
|
|
33
|
+
productCode?: string;
|
|
34
|
+
upgradeCode?: string;
|
|
35
|
+
/** Install language: a human label when the LCID is recognized (with the raw id), else the raw id. */
|
|
36
|
+
language?: string;
|
|
37
|
+
/** Full Property table (name → value), in stored order. Empty if the table couldn't be decoded. */
|
|
38
|
+
properties: MsiProperty[];
|
|
39
|
+
/** SummaryInformation rows, pre-labeled (Chinese), in display order. */
|
|
40
|
+
summary: MsiMeta[];
|
|
41
|
+
/** Decoded names of the database tables present — a quick "shape of the installer" cue. */
|
|
42
|
+
tables: string[];
|
|
43
|
+
/** Non-fatal notes (e.g. the Property table was unreadable but SummaryInformation succeeded). */
|
|
44
|
+
notes: string[];
|
|
45
|
+
}
|
|
46
|
+
/** Thrown when the bytes aren't an OLE compound file at all (so the viewer can show a clear message). */
|
|
47
|
+
export declare class NotMsiError extends Error {
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
}
|
|
50
|
+
export declare function parseMsi(buf: ArrayBuffer): MsiInfo;
|
package/dist/lib/msi.js
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
//#region src/lib/msi.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
constructor(e) {
|
|
4
|
+
super(e), this.name = "NotMsiError";
|
|
5
|
+
}
|
|
6
|
+
}, t = [
|
|
7
|
+
208,
|
|
8
|
+
207,
|
|
9
|
+
17,
|
|
10
|
+
224,
|
|
11
|
+
161,
|
|
12
|
+
177,
|
|
13
|
+
26,
|
|
14
|
+
225
|
|
15
|
+
], n = 4294967294, r = 4294967295, i = class {
|
|
16
|
+
dv;
|
|
17
|
+
buf;
|
|
18
|
+
sectorSize;
|
|
19
|
+
miniSectorSize;
|
|
20
|
+
miniCutoff;
|
|
21
|
+
fat = [];
|
|
22
|
+
miniFat = [];
|
|
23
|
+
miniStream = new Uint8Array();
|
|
24
|
+
entries = [];
|
|
25
|
+
constructor(i) {
|
|
26
|
+
this.buf = i;
|
|
27
|
+
let a = new DataView(i);
|
|
28
|
+
if (this.dv = a, i.byteLength < 512) throw new e("文件过小,不是有效的复合文件");
|
|
29
|
+
for (let n = 0; n < 8; n++) if (a.getUint8(n) !== t[n]) throw new e("不是 OLE 复合文件(缺少 D0CF11E0 魔数)");
|
|
30
|
+
let o = a.getUint16(26, !0);
|
|
31
|
+
this.sectorSize = 1 << a.getUint16(30, !0), this.miniSectorSize = 1 << a.getUint16(32, !0);
|
|
32
|
+
let s = a.getUint32(48, !0);
|
|
33
|
+
this.miniCutoff = a.getUint32(56, !0);
|
|
34
|
+
let c = a.getUint32(60, !0), l = a.getUint32(68, !0), u = this.sectorSize / 4, d = [];
|
|
35
|
+
for (let e = 0; e < 109; e++) {
|
|
36
|
+
let t = a.getUint32(76 + e * 4, !0);
|
|
37
|
+
t !== r && t !== n && d.push(t);
|
|
38
|
+
}
|
|
39
|
+
let f = l, p = 0;
|
|
40
|
+
for (; f !== n && f !== r && p++ < 1e6;) {
|
|
41
|
+
let e = this.sectorOffset(f);
|
|
42
|
+
for (let t = 0; t < u - 1; t++) {
|
|
43
|
+
let n = a.getUint32(e + t * 4, !0);
|
|
44
|
+
n !== r && d.push(n);
|
|
45
|
+
}
|
|
46
|
+
f = a.getUint32(e + (u - 1) * 4, !0);
|
|
47
|
+
}
|
|
48
|
+
for (let e of d) {
|
|
49
|
+
let t = this.sectorOffset(e);
|
|
50
|
+
for (let e = 0; e < u; e++) this.fat.push(a.getUint32(t + e * 4, !0));
|
|
51
|
+
}
|
|
52
|
+
let m = this.readFatStream(s, this.chain(s).length * this.sectorSize), h = new DataView(m.buffer, m.byteOffset, m.byteLength);
|
|
53
|
+
for (let e = 0; e + 128 <= m.length; e += 128) {
|
|
54
|
+
let t = h.getUint8(e + 66);
|
|
55
|
+
if (t === 0) continue;
|
|
56
|
+
let n = h.getUint16(e + 64, !0), r = "";
|
|
57
|
+
for (let t = 0; t + 1 < n; t += 2) {
|
|
58
|
+
let n = h.getUint16(e + t, !0);
|
|
59
|
+
if (n === 0) break;
|
|
60
|
+
r += String.fromCharCode(n);
|
|
61
|
+
}
|
|
62
|
+
let i = h.getUint32(e + 116, !0), a = o <= 3 ? h.getUint32(e + 120, !0) : Number(h.getBigUint64(e + 120, !0));
|
|
63
|
+
this.entries.push({
|
|
64
|
+
name: r,
|
|
65
|
+
type: t,
|
|
66
|
+
start: i,
|
|
67
|
+
size: a
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
let g = this.entries.find((e) => e.type === 5);
|
|
71
|
+
g && (this.miniStream = this.readFatStream(g.start, g.size));
|
|
72
|
+
for (let e of this.chain(c)) {
|
|
73
|
+
let t = this.sectorOffset(e);
|
|
74
|
+
for (let e = 0; e < u; e++) this.miniFat.push(a.getUint32(t + e * 4, !0));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
sectorOffset(e) {
|
|
78
|
+
return (e + 1) * this.sectorSize;
|
|
79
|
+
}
|
|
80
|
+
chain(e) {
|
|
81
|
+
let t = [], i = e, a = 0;
|
|
82
|
+
for (; i !== n && i !== r && i < this.fat.length && a++ < 1e7;) t.push(i), i = this.fat[i];
|
|
83
|
+
return t;
|
|
84
|
+
}
|
|
85
|
+
sectorBytes(e) {
|
|
86
|
+
let t = this.sectorOffset(e), n = Math.min(this.buf.byteLength, t + this.sectorSize), r = new Uint8Array(this.sectorSize);
|
|
87
|
+
return t < this.buf.byteLength && r.set(new Uint8Array(this.buf, t, n - t)), r;
|
|
88
|
+
}
|
|
89
|
+
readFatStream(e, t) {
|
|
90
|
+
let n = this.chain(e), r = new Uint8Array(n.length * this.sectorSize);
|
|
91
|
+
for (let e = 0; e < n.length; e++) r.set(this.sectorBytes(n[e]), e * this.sectorSize);
|
|
92
|
+
return r.subarray(0, t);
|
|
93
|
+
}
|
|
94
|
+
readMiniStream(e, t) {
|
|
95
|
+
let i = Math.ceil(t / this.miniSectorSize), a = new Uint8Array(i * this.miniSectorSize), o = e, s = 0;
|
|
96
|
+
for (; o !== n && o !== r && s < i;) {
|
|
97
|
+
let e = o * this.miniSectorSize;
|
|
98
|
+
a.set(this.miniStream.subarray(e, e + this.miniSectorSize), s * this.miniSectorSize), s++, o = this.miniFat[o];
|
|
99
|
+
}
|
|
100
|
+
return a.subarray(0, t);
|
|
101
|
+
}
|
|
102
|
+
stream(e) {
|
|
103
|
+
return e.size === 0 ? new Uint8Array() : e.type === 5 || e.size >= this.miniCutoff ? this.readFatStream(e.start, e.size) : this.readMiniStream(e.start, e.size);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
function a(e) {
|
|
107
|
+
return e < 10 ? String.fromCharCode(e + 48) : e < 36 ? String.fromCharCode(e - 10 + 65) : e < 62 ? String.fromCharCode(e - 36 + 97) : e === 62 ? "." : "_";
|
|
108
|
+
}
|
|
109
|
+
function o(e) {
|
|
110
|
+
let t = "", n = !1;
|
|
111
|
+
for (let r = 0; r < e.length; r++) {
|
|
112
|
+
let i = e.charCodeAt(r);
|
|
113
|
+
if (i >= 14336 && i < 18432) {
|
|
114
|
+
let e = i - 14336;
|
|
115
|
+
t += a(e & 63) + a(e >> 6 & 63);
|
|
116
|
+
} else i >= 18432 && i < 18496 ? t += a(i - 18432) : i === 18496 ? n = !0 : t += String.fromCharCode(i);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
name: t,
|
|
120
|
+
isTable: n
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function s(e) {
|
|
124
|
+
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = t.getUint32(44, !0), r = t.getUint32(n + 4, !0), i = [];
|
|
125
|
+
for (let e = 0; e < r; e++) {
|
|
126
|
+
let r = t.getUint32(n + 8 + e * 8, !0), a = t.getUint32(n + 8 + e * 8 + 4, !0);
|
|
127
|
+
i.push({
|
|
128
|
+
pid: r,
|
|
129
|
+
abs: n + a
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
let a = 1252, o = i.find((e) => e.pid === 1);
|
|
133
|
+
if (o && t.getUint32(o.abs, !0) === 2) {
|
|
134
|
+
let e = t.getInt16(o.abs + 4, !0);
|
|
135
|
+
e < 0 && (e += 65536), a = e;
|
|
136
|
+
}
|
|
137
|
+
let s = new TextDecoder(p(a)), c = /* @__PURE__ */ new Map();
|
|
138
|
+
for (let { pid: n, abs: r } of i) {
|
|
139
|
+
let i = t.getUint32(r, !0);
|
|
140
|
+
if (i === 2) c.set(n, {
|
|
141
|
+
type: i,
|
|
142
|
+
value: t.getInt16(r + 4, !0)
|
|
143
|
+
});
|
|
144
|
+
else if (i === 3) c.set(n, {
|
|
145
|
+
type: i,
|
|
146
|
+
value: t.getInt32(r + 4, !0)
|
|
147
|
+
});
|
|
148
|
+
else if (i === 30) {
|
|
149
|
+
let a = e.subarray(r + 8, r + 8 + t.getUint32(r + 4, !0)), o = a.indexOf(0);
|
|
150
|
+
o >= 0 && (a = a.subarray(0, o)), c.set(n, {
|
|
151
|
+
type: i,
|
|
152
|
+
value: s.decode(a)
|
|
153
|
+
});
|
|
154
|
+
} else i === 64 && c.set(n, {
|
|
155
|
+
type: i,
|
|
156
|
+
value: m(t.getUint32(r + 4, !0), t.getUint32(r + 8, !0))
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
codepage: a,
|
|
161
|
+
props: c
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function c(e) {
|
|
165
|
+
let t = [], n = (n, r, i) => {
|
|
166
|
+
let a = e.get(n);
|
|
167
|
+
if (a == null) return;
|
|
168
|
+
let o = i ? i(a.value) : String(a.value);
|
|
169
|
+
o && t.push({
|
|
170
|
+
label: r,
|
|
171
|
+
value: o
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
return n(3, "主题", String), n(4, "作者 / 厂商", String), n(6, "备注", String), n(2, "标题", String), n(5, "关键字", String), n(7, "平台 / 语言", (e) => h(String(e))), n(9, "包代码", String), n(18, "制作工具", String), n(12, "创建时间", String), n(13, "上次保存", String), n(14, "架构版本", (e) => g(Number(e))), n(15, "源类型", (e) => _(Number(e))), n(19, "安全", (e) => v(Number(e))), t;
|
|
175
|
+
}
|
|
176
|
+
function l(e, t, n) {
|
|
177
|
+
let r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = r.getUint16(0, !0) | r.getUint16(2, !0) << 16, a = (i & 2147483648) != 0, o = i & 2147483647;
|
|
178
|
+
o === 0 && (o = n || 1252);
|
|
179
|
+
let s = new TextDecoder(p(o)), c = [""], l = 0, u = Math.floor(e.length / 4);
|
|
180
|
+
for (let e = 1; e < u; e++) {
|
|
181
|
+
let n = r.getUint16(e * 4, !0);
|
|
182
|
+
if (n === 0) {
|
|
183
|
+
c.push("");
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
c.push(s.decode(t.subarray(l, l + n))), l += n;
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
strings: c,
|
|
190
|
+
longRefs: a
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function u(e, t) {
|
|
194
|
+
let n = t.longRefs ? 3 : 2, r = new DataView(e.buffer, e.byteOffset, e.byteLength), i = Math.floor(e.length / (n * 2)), a = (e) => {
|
|
195
|
+
let t = e * n, i = r.getUint16(t, !0);
|
|
196
|
+
return n === 3 && (i += r.getUint8(t + 2) << 16), i;
|
|
197
|
+
}, o = [];
|
|
198
|
+
for (let e = 0; e < i; e++) {
|
|
199
|
+
let n = t.strings[a(e)] ?? "", r = t.strings[a(i + e)] ?? "";
|
|
200
|
+
n && o.push({
|
|
201
|
+
name: n,
|
|
202
|
+
value: r
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return o;
|
|
206
|
+
}
|
|
207
|
+
function d(e) {
|
|
208
|
+
let t = new i(e), n = t.entries.map((e) => ({
|
|
209
|
+
e,
|
|
210
|
+
...o(e.name)
|
|
211
|
+
})), r = [], a = n.filter((e) => e.isTable).map((e) => e.name).sort((e, t) => e.localeCompare(t)), d = [], p = 0, m = n.find((e) => e.name === "SummaryInformation");
|
|
212
|
+
if (m) try {
|
|
213
|
+
let e = s(t.stream(m.e));
|
|
214
|
+
p = e.codepage, d = c(e.props);
|
|
215
|
+
} catch (e) {
|
|
216
|
+
r.push("SummaryInformation 解析失败:" + f(e));
|
|
217
|
+
}
|
|
218
|
+
let h = [], g = n.find((e) => e.name === "_StringData"), _ = n.find((e) => e.name === "_StringPool"), v = n.find((e) => e.name === "Property");
|
|
219
|
+
if (g && _ && v) try {
|
|
220
|
+
let e = l(t.stream(_.e), t.stream(g.e), p);
|
|
221
|
+
h = u(t.stream(v.e), e);
|
|
222
|
+
} catch (e) {
|
|
223
|
+
r.push("Property 表解析失败:" + f(e));
|
|
224
|
+
}
|
|
225
|
+
let y = new Map(h.map((e) => [e.name, e.value])), x = y.get("ProductLanguage"), S = {
|
|
226
|
+
productName: y.get("ProductName"),
|
|
227
|
+
productVersion: y.get("ProductVersion"),
|
|
228
|
+
manufacturer: y.get("Manufacturer"),
|
|
229
|
+
productCode: y.get("ProductCode"),
|
|
230
|
+
upgradeCode: y.get("UpgradeCode"),
|
|
231
|
+
language: x ? b(x) : void 0,
|
|
232
|
+
properties: h,
|
|
233
|
+
summary: d,
|
|
234
|
+
tables: a,
|
|
235
|
+
notes: r
|
|
236
|
+
};
|
|
237
|
+
return !h.length && !d.length && r.push("未找到 MSI 摘要信息或属性表(可能是别的复合文件,而非 MSI 数据库)"), S;
|
|
238
|
+
}
|
|
239
|
+
function f(e) {
|
|
240
|
+
return e instanceof Error ? e.message : String(e);
|
|
241
|
+
}
|
|
242
|
+
function p(e) {
|
|
243
|
+
switch (e) {
|
|
244
|
+
case 65001: return "utf-8";
|
|
245
|
+
case 1200: return "utf-16le";
|
|
246
|
+
case 1201: return "utf-16be";
|
|
247
|
+
case 932: return "shift_jis";
|
|
248
|
+
case 936: return "gbk";
|
|
249
|
+
case 949: return "euc-kr";
|
|
250
|
+
case 950: return "big5";
|
|
251
|
+
case 1250: return "windows-1250";
|
|
252
|
+
case 1251: return "windows-1251";
|
|
253
|
+
case 1253: return "windows-1253";
|
|
254
|
+
case 1254: return "windows-1254";
|
|
255
|
+
case 1255: return "windows-1255";
|
|
256
|
+
case 1256: return "windows-1256";
|
|
257
|
+
case 1257: return "windows-1257";
|
|
258
|
+
case 1258: return "windows-1258";
|
|
259
|
+
default: return "windows-1252";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function m(e, t) {
|
|
263
|
+
let n = t * 4294967296 + e;
|
|
264
|
+
if (!n) return "";
|
|
265
|
+
let r = n / 1e4 - 0xa9730b66800, i = new Date(r);
|
|
266
|
+
if (Number.isNaN(i.getTime())) return "";
|
|
267
|
+
let a = (e) => String(e).padStart(2, "0");
|
|
268
|
+
return `${i.getUTCFullYear()}-${a(i.getUTCMonth() + 1)}-${a(i.getUTCDate())} ${a(i.getUTCHours())}:${a(i.getUTCMinutes())} UTC`;
|
|
269
|
+
}
|
|
270
|
+
function h(e) {
|
|
271
|
+
let [t, n] = e.split(";"), r = (n ?? "").split(",").map((e) => e.trim()).filter(Boolean).map((e) => b(e)), i = [];
|
|
272
|
+
return t && t.trim() && i.push(t.trim()), r.length && i.push(r.join(", ")), i.join(" · ") || e;
|
|
273
|
+
}
|
|
274
|
+
function g(e) {
|
|
275
|
+
return e ? `${Math.floor(e / 100)}.${String(e % 100).padStart(2, "0")}` : "";
|
|
276
|
+
}
|
|
277
|
+
function _(e) {
|
|
278
|
+
let t = [];
|
|
279
|
+
return t.push(e & 2 ? "压缩 (cabinet)" : "未压缩"), e & 1 && t.push("短文件名"), e & 4 && t.push("管理映像"), e & 8 && t.push("从源运行"), t.join(" · ");
|
|
280
|
+
}
|
|
281
|
+
function v(e) {
|
|
282
|
+
switch (e) {
|
|
283
|
+
case 0: return "无限制";
|
|
284
|
+
case 1: return "建议只读";
|
|
285
|
+
case 2: return "强制只读";
|
|
286
|
+
case 4: return "已锁定";
|
|
287
|
+
default: return String(e);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
var y = {
|
|
291
|
+
0: "语言中性",
|
|
292
|
+
1025: "阿拉伯语",
|
|
293
|
+
1028: "中文(繁体)",
|
|
294
|
+
1029: "捷克语",
|
|
295
|
+
1030: "丹麦语",
|
|
296
|
+
1031: "德语",
|
|
297
|
+
1032: "希腊语",
|
|
298
|
+
1033: "英语(美国)",
|
|
299
|
+
1034: "西班牙语",
|
|
300
|
+
1035: "芬兰语",
|
|
301
|
+
1036: "法语",
|
|
302
|
+
1037: "希伯来语",
|
|
303
|
+
1038: "匈牙利语",
|
|
304
|
+
1040: "意大利语",
|
|
305
|
+
1041: "日语",
|
|
306
|
+
1042: "韩语",
|
|
307
|
+
1043: "荷兰语",
|
|
308
|
+
1044: "挪威语",
|
|
309
|
+
1045: "波兰语",
|
|
310
|
+
1046: "葡萄牙语(巴西)",
|
|
311
|
+
1049: "俄语",
|
|
312
|
+
1051: "斯洛伐克语",
|
|
313
|
+
1053: "瑞典语",
|
|
314
|
+
1054: "泰语",
|
|
315
|
+
1055: "土耳其语",
|
|
316
|
+
1057: "印尼语",
|
|
317
|
+
1058: "乌克兰语",
|
|
318
|
+
1060: "斯洛文尼亚语",
|
|
319
|
+
1066: "越南语",
|
|
320
|
+
2052: "中文(简体)",
|
|
321
|
+
2057: "英语(英国)",
|
|
322
|
+
2070: "葡萄牙语",
|
|
323
|
+
3076: "中文(香港)",
|
|
324
|
+
3082: "西班牙语(西班牙)",
|
|
325
|
+
4100: "中文(新加坡)"
|
|
326
|
+
};
|
|
327
|
+
function b(e) {
|
|
328
|
+
let t = y[Number(e)];
|
|
329
|
+
return t ? `${t} (${e})` : e;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
export { e as NotMsiError, d as parseMsi };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ShallowRef } from 'vue';
|
|
2
|
+
export type OptionalDepStatus = 'loading' | 'ready' | 'missing' | 'error';
|
|
3
|
+
export interface OptionalDep<T> {
|
|
4
|
+
status: ShallowRef<OptionalDepStatus>;
|
|
5
|
+
mod: ShallowRef<T | null>;
|
|
6
|
+
error: ShallowRef<unknown>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Does this error mean "the module isn't installed / couldn't be loaded" (→ tell the user to install it),
|
|
10
|
+
* as opposed to a real error thrown from INSIDE the module once it loaded? We match the bundler/browser
|
|
11
|
+
* shapes for an unresolved dynamic import. Heuristic by necessity — err on "missing" only for these.
|
|
12
|
+
*
|
|
13
|
+
* Exported so viewers that `import()` their optional engine at runtime (geo/raster/psd/ebook) can decide,
|
|
14
|
+
* in their own catch, whether to show the {@link MissingDependency} card vs a generic error.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isMissingModule(e: unknown): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Load an OPTIONAL peer dependency at runtime (see docs/file-viewer-package-design.md §4). Because the dep is
|
|
19
|
+
* `external` in the library build, it resolves from the CONSUMER's node_modules:
|
|
20
|
+
* - present → `ready`, `mod` holds the module;
|
|
21
|
+
* - absent → `missing` — the viewer renders a {@link MissingDependency} card telling the user to install it;
|
|
22
|
+
* - throws → `error` (a genuine failure inside the module after it loaded).
|
|
23
|
+
*
|
|
24
|
+
* Usage: `const dep = loadOptionalDep(() => import('pdfjs-dist'))`, then branch on `dep.status.value`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function loadOptionalDep<T = unknown>(importer: () => Promise<T>): OptionalDep<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowRef as e } from "vue";
|
|
2
|
+
//#region src/lib/optionalDep.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
5
|
+
return /Failed to (fetch|resolve) dynamically imported module|Cannot find module|Importing a module script failed|ERR_MODULE_NOT_FOUND|Failed to load module/i.test(t);
|
|
6
|
+
}
|
|
7
|
+
function n(n) {
|
|
8
|
+
let r = e("loading"), i = e(null), a = e(null);
|
|
9
|
+
return n().then((e) => {
|
|
10
|
+
i.value = e, r.value = "ready";
|
|
11
|
+
}, (e) => {
|
|
12
|
+
a.value = e, r.value = t(e) ? "missing" : "error";
|
|
13
|
+
}), {
|
|
14
|
+
status: r,
|
|
15
|
+
mod: i,
|
|
16
|
+
error: a
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as isMissingModule, n as loadOptionalDep };
|