@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,279 @@
|
|
|
1
|
+
import { fileExt as e, isDicomFile as t, isTextFile as n } from "../lib/fileType.js";
|
|
2
|
+
import { canToggleView as r, classifyViewerFile as i, mediaMimeForName as a } from "../lib/viewerKind.js";
|
|
3
|
+
import { formatBytes as o } from "../lib/format.js";
|
|
4
|
+
import s from "./icons/Icon.js";
|
|
5
|
+
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createVNode as m, defineAsyncComponent as h, defineComponent as g, normalizeClass as _, normalizeStyle as ee, onBeforeUnmount as te, onMounted as v, openBlock as y, reactive as b, ref as x, renderList as S, toDisplayString as C, unref as w, watch as ne } from "vue";
|
|
6
|
+
//#region src/components/ArchiveBrowser.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var re = { class: "ar" }, ie = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "ar__msg"
|
|
10
|
+
}, ae = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "ar__msg ar__msg--error"
|
|
13
|
+
}, oe = { class: "ar__bar" }, se = ["title"], ce = { class: "ar__bsize" }, le = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "ar__view",
|
|
16
|
+
role: "group",
|
|
17
|
+
"aria-label": "渲染或源码"
|
|
18
|
+
}, ue = ["title"], de = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "ar__msg"
|
|
21
|
+
}, fe = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "ar__msg ar__msg--error"
|
|
24
|
+
}, pe = { class: "ar__summary" }, me = { class: "ar__scroll ar__tree" }, he = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "ar__msg"
|
|
27
|
+
}, ge = ["onClick"], _e = { class: "ar__twisty" }, T = { class: "ar__rowicon" }, E = { class: "ar__rowname" }, D = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "ar__rowsize"
|
|
30
|
+
}, O = /*@__PURE__*/ g({
|
|
31
|
+
__name: "ArchiveBrowser",
|
|
32
|
+
props: {
|
|
33
|
+
url: {},
|
|
34
|
+
name: {},
|
|
35
|
+
kind: {}
|
|
36
|
+
},
|
|
37
|
+
setup(g) {
|
|
38
|
+
let O = h(() => import("./DicomViewer.js")), ve = h(() => import("./FileViewerBody.js")), k = g, A = x("loading"), j = x(""), M = null, N = x([]), P = x({
|
|
39
|
+
name: "",
|
|
40
|
+
path: "",
|
|
41
|
+
isDir: !0,
|
|
42
|
+
size: 0,
|
|
43
|
+
children: []
|
|
44
|
+
}), F = b(/* @__PURE__ */ new Set()), ye = l(() => N.value.reduce((e, t) => e + +!t.isDir, 0)), be = l(() => N.value.reduce((e, t) => e + (t.isDir ? 0 : t.size), 0));
|
|
45
|
+
function xe(e) {
|
|
46
|
+
let t = {
|
|
47
|
+
name: "",
|
|
48
|
+
path: "",
|
|
49
|
+
isDir: !0,
|
|
50
|
+
size: 0,
|
|
51
|
+
children: []
|
|
52
|
+
}, n = new Map([["", t]]), r = (e) => {
|
|
53
|
+
let r = t, i = "";
|
|
54
|
+
for (let t of e) {
|
|
55
|
+
i = i ? `${i}/${t}` : t;
|
|
56
|
+
let e = n.get(i);
|
|
57
|
+
e || (e = {
|
|
58
|
+
name: t,
|
|
59
|
+
path: i,
|
|
60
|
+
isDir: !0,
|
|
61
|
+
size: 0,
|
|
62
|
+
children: []
|
|
63
|
+
}, n.set(i, e), r.children.push(e)), r = e;
|
|
64
|
+
}
|
|
65
|
+
return r;
|
|
66
|
+
};
|
|
67
|
+
for (let t of e) {
|
|
68
|
+
let e = t.path.split("/").filter(Boolean);
|
|
69
|
+
if (t.isDir) {
|
|
70
|
+
r(e);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
let n = e.pop();
|
|
74
|
+
n && r(e).children.push({
|
|
75
|
+
name: n,
|
|
76
|
+
path: t.path,
|
|
77
|
+
isDir: !1,
|
|
78
|
+
size: t.size,
|
|
79
|
+
entry: t,
|
|
80
|
+
children: []
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return I(t), t;
|
|
84
|
+
}
|
|
85
|
+
function I(e) {
|
|
86
|
+
e.children.sort((e, t) => e.isDir === t.isDir ? e.name.localeCompare(t.name) : e.isDir ? -1 : 1);
|
|
87
|
+
for (let t of e.children) t.isDir && I(t);
|
|
88
|
+
}
|
|
89
|
+
let L = l(() => {
|
|
90
|
+
let e = [], t = (n, r) => {
|
|
91
|
+
for (let i of n) e.push({
|
|
92
|
+
node: i,
|
|
93
|
+
depth: r
|
|
94
|
+
}), i.isDir && F.has(i.path) && t(i.children, r + 1);
|
|
95
|
+
};
|
|
96
|
+
return t(P.value.children, 0), e;
|
|
97
|
+
});
|
|
98
|
+
async function R() {
|
|
99
|
+
A.value = "loading", j.value = "", z.value = null, M = null, X(), q.value = [];
|
|
100
|
+
let e = k.url;
|
|
101
|
+
try {
|
|
102
|
+
let t = await fetch(e);
|
|
103
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
104
|
+
let n = await t.arrayBuffer(), r = k.kind === "rar" ? await (await import("../lib/rar.js")).openRar(n) : await (await import("../lib/tarball.js")).openTarball(n, k.name);
|
|
105
|
+
if (k.url !== e) return;
|
|
106
|
+
M = r, N.value = r.entries, P.value = xe(r.entries), F.clear(), A.value = "ready";
|
|
107
|
+
} catch (e) {
|
|
108
|
+
j.value = e instanceof Error ? e.message : String(e), A.value = "error";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let z = x(null), B = x("ready"), V = x(""), H = x(""), U = x(null), W = x(!1), G = x("render"), K = x(""), q = x([]), J = x(0), Y = x(""), Se = l(() => q.value.reduce((e, t) => e + (t.size ?? 0), 0)), Ce = l(() => r(U.value, H.value));
|
|
112
|
+
function X() {
|
|
113
|
+
K.value &&= (URL.revokeObjectURL(K.value), "");
|
|
114
|
+
}
|
|
115
|
+
function Z(e) {
|
|
116
|
+
let t = e.lastIndexOf("/");
|
|
117
|
+
return t < 0 ? "" : e.slice(0, t);
|
|
118
|
+
}
|
|
119
|
+
function we(e) {
|
|
120
|
+
let n = Z(e.path);
|
|
121
|
+
return N.value.filter((e) => !e.isDir && t(e.name) && Z(e.path) === n).sort((e, t) => e.path.localeCompare(t.path, void 0, {
|
|
122
|
+
numeric: !0,
|
|
123
|
+
sensitivity: "base"
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
function Te(t, r) {
|
|
127
|
+
if (n(r)) return !0;
|
|
128
|
+
if (e(r)) return !1;
|
|
129
|
+
let i = Math.min(t.length, 4096);
|
|
130
|
+
for (let e = 0; e < i; e++) if (t[e] === 0) return !1;
|
|
131
|
+
return !0;
|
|
132
|
+
}
|
|
133
|
+
function Ee(e) {
|
|
134
|
+
let t = new ArrayBuffer(e.byteLength);
|
|
135
|
+
return new Uint8Array(t).set(e), t;
|
|
136
|
+
}
|
|
137
|
+
async function De(e) {
|
|
138
|
+
if (z.value = e, B.value = "loading", V.value = "", H.value = "", U.value = null, W.value = !1, G.value = "render", X(), q.value = [], !M) return;
|
|
139
|
+
let n = M;
|
|
140
|
+
try {
|
|
141
|
+
if (t(e.name)) {
|
|
142
|
+
let t = we(e);
|
|
143
|
+
if (t.length > 1) {
|
|
144
|
+
q.value = t.map((e) => ({
|
|
145
|
+
name: e.name,
|
|
146
|
+
size: e.size,
|
|
147
|
+
load: async () => Ee(await n.extract(e))
|
|
148
|
+
})), J.value = Math.max(0, t.findIndex((t) => t.path === e.path)), Y.value = Z(e.path).split("/").pop() || e.name, W.value = !0, B.value = "ready";
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let r = await n.extract(e);
|
|
153
|
+
if (z.value !== e) return;
|
|
154
|
+
K.value = URL.createObjectURL(new Blob([r], { type: a(e.name) })), U.value = i({
|
|
155
|
+
name: e.name,
|
|
156
|
+
url: K.value,
|
|
157
|
+
size: e.size,
|
|
158
|
+
textHint: Te(r, e.name)
|
|
159
|
+
}), B.value = "ready";
|
|
160
|
+
} catch (e) {
|
|
161
|
+
V.value = e instanceof Error ? e.message : String(e), B.value = "error";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function Oe(e) {
|
|
165
|
+
e.isDir ? F.has(e.path) ? F.delete(e.path) : F.add(e.path) : e.entry && De(e.entry);
|
|
166
|
+
}
|
|
167
|
+
function ke() {
|
|
168
|
+
z.value = null, H.value = "", U.value = null, W.value = !1, X(), q.value = [];
|
|
169
|
+
}
|
|
170
|
+
async function Ae(e) {
|
|
171
|
+
if (M) try {
|
|
172
|
+
let t = URL.createObjectURL(new Blob([await M.extract(e)])), n = document.createElement("a");
|
|
173
|
+
n.href = t, n.download = e.name, document.body.appendChild(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 1e3);
|
|
174
|
+
} catch {}
|
|
175
|
+
}
|
|
176
|
+
let Q = x(!1), $;
|
|
177
|
+
async function je() {
|
|
178
|
+
try {
|
|
179
|
+
await navigator.clipboard?.writeText(H.value);
|
|
180
|
+
} catch {}
|
|
181
|
+
Q.value = !0, clearTimeout($), $ = setTimeout(() => Q.value = !1, 1400);
|
|
182
|
+
}
|
|
183
|
+
return v(R), ne(() => k.url, R), te(() => {
|
|
184
|
+
X(), clearTimeout($);
|
|
185
|
+
}), (e, t) => (y(), f("div", re, [A.value === "loading" ? (y(), f("p", ie, "正在解压…")) : A.value === "error" ? (y(), f("div", ae, [p("p", null, C(j.value), 1), p("button", {
|
|
186
|
+
type: "button",
|
|
187
|
+
class: "ar__retry",
|
|
188
|
+
onClick: R
|
|
189
|
+
}, "重试")])) : z.value ? (y(), f(c, { key: 2 }, [p("div", oe, [
|
|
190
|
+
p("button", {
|
|
191
|
+
type: "button",
|
|
192
|
+
class: "ar__back",
|
|
193
|
+
title: "返回列表",
|
|
194
|
+
onClick: ke
|
|
195
|
+
}, [m(s, {
|
|
196
|
+
name: "arrowLeft",
|
|
197
|
+
size: 16
|
|
198
|
+
})]),
|
|
199
|
+
p("span", {
|
|
200
|
+
class: "ar__path",
|
|
201
|
+
title: z.value.path
|
|
202
|
+
}, C(z.value.path), 9, se),
|
|
203
|
+
p("span", ce, C(w(o)(z.value.size)), 1),
|
|
204
|
+
Ce.value ? (y(), f("div", le, [p("button", {
|
|
205
|
+
type: "button",
|
|
206
|
+
class: _(["ar__vbtn", { "ar__vbtn--on": G.value === "render" }]),
|
|
207
|
+
title: "渲染",
|
|
208
|
+
onClick: t[0] ||= (e) => G.value = "render"
|
|
209
|
+
}, [m(s, {
|
|
210
|
+
name: "eye",
|
|
211
|
+
size: 14
|
|
212
|
+
})], 2), p("button", {
|
|
213
|
+
type: "button",
|
|
214
|
+
class: _(["ar__vbtn", { "ar__vbtn--on": G.value === "source" }]),
|
|
215
|
+
title: "源码",
|
|
216
|
+
onClick: t[1] ||= (e) => G.value = "source"
|
|
217
|
+
}, [m(s, {
|
|
218
|
+
name: "code",
|
|
219
|
+
size: 14
|
|
220
|
+
})], 2)])) : d("", !0),
|
|
221
|
+
H.value && B.value === "ready" ? (y(), f("button", {
|
|
222
|
+
key: 1,
|
|
223
|
+
type: "button",
|
|
224
|
+
class: "ar__act",
|
|
225
|
+
title: Q.value ? "已复制" : "复制",
|
|
226
|
+
onClick: je
|
|
227
|
+
}, [m(s, {
|
|
228
|
+
name: "copy",
|
|
229
|
+
size: 14
|
|
230
|
+
})], 8, ue)) : d("", !0),
|
|
231
|
+
p("button", {
|
|
232
|
+
type: "button",
|
|
233
|
+
class: "ar__act",
|
|
234
|
+
title: "下载",
|
|
235
|
+
onClick: t[2] ||= (e) => Ae(z.value)
|
|
236
|
+
}, [m(s, {
|
|
237
|
+
name: "download",
|
|
238
|
+
size: 15
|
|
239
|
+
})])
|
|
240
|
+
]), B.value === "loading" ? (y(), f("p", de, "读取中…")) : B.value === "error" ? (y(), f("div", fe, [p("p", null, C(V.value), 1)])) : W.value ? (y(), u(w(O), {
|
|
241
|
+
key: 2,
|
|
242
|
+
slices: q.value,
|
|
243
|
+
start: J.value,
|
|
244
|
+
name: Y.value,
|
|
245
|
+
size: Se.value
|
|
246
|
+
}, null, 8, [
|
|
247
|
+
"slices",
|
|
248
|
+
"start",
|
|
249
|
+
"name",
|
|
250
|
+
"size"
|
|
251
|
+
])) : U.value ? (y(), u(w(ve), {
|
|
252
|
+
key: 3,
|
|
253
|
+
file: U.value,
|
|
254
|
+
mode: G.value,
|
|
255
|
+
onLoaded: t[3] ||= (e) => H.value = e
|
|
256
|
+
}, null, 8, ["file", "mode"])) : d("", !0)], 64)) : (y(), f(c, { key: 3 }, [p("div", pe, C(ye.value) + " 个文件 · " + C(w(o)(be.value)), 1), p("div", me, [L.value.length === 0 ? (y(), f("p", he, "空压缩包")) : d("", !0), (y(!0), f(c, null, S(L.value, (e) => (y(), f("button", {
|
|
257
|
+
key: e.node.path,
|
|
258
|
+
type: "button",
|
|
259
|
+
class: _(["ar__row", { "ar__row--dir": e.node.isDir }]),
|
|
260
|
+
style: ee({ paddingLeft: `${12 + e.depth * 14}px` }),
|
|
261
|
+
onClick: (t) => Oe(e.node)
|
|
262
|
+
}, [
|
|
263
|
+
p("span", _e, [e.node.isDir ? (y(), u(s, {
|
|
264
|
+
key: 0,
|
|
265
|
+
name: "chevronRight",
|
|
266
|
+
size: 13,
|
|
267
|
+
class: _({ "ar__twisty--open": F.has(e.node.path) })
|
|
268
|
+
}, null, 8, ["class"])) : d("", !0)]),
|
|
269
|
+
p("span", T, [m(s, {
|
|
270
|
+
name: e.node.isDir ? "folder" : "fileOutline",
|
|
271
|
+
size: 15
|
|
272
|
+
}, null, 8, ["name"])]),
|
|
273
|
+
p("span", E, C(e.node.name), 1),
|
|
274
|
+
e.node.isDir ? d("", !0) : (y(), f("span", D, C(w(o)(e.node.size)), 1))
|
|
275
|
+
], 14, ge))), 128))])], 64))]));
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
//#endregion
|
|
279
|
+
export { O as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./AudioViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/AudioViewer.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-25d25cbe"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-viewer audio player. Fetches the bytes from the download URL and plays them through a native
|
|
3
|
+
* <audio> element from a typed Blob URL — the download endpoint serves octet-stream + attachment, so a
|
|
4
|
+
* direct `<audio src=downloadUrl>` won't decode (same reason the video lightbox fetches a blob). Covers
|
|
5
|
+
* mp3 / wav / flac / ogg / m4a / aac / opus — whatever the browser's media stack can decode.
|
|
6
|
+
*
|
|
7
|
+
* Two best-effort exceptions for formats browsers can't play natively, both detected by file-header magic
|
|
8
|
+
* (NOT the extension) after the bytes are fetched:
|
|
9
|
+
* - AMR / SILK voice clips (.amr/.silk/.slk; a WeChat `.amr` is often actually SILK) are DECODED to WAV
|
|
10
|
+
* in-browser via WASM (see lib/speechAudio.ts) and played from that, with a "download WAV" action.
|
|
11
|
+
* - MIDI (.mid/.midi) CAN'T be played (browsers have no synthesizer, and self-hosting a soundfont is out of
|
|
12
|
+
* scope), so the bytes are parsed (lib/midi.ts) and shown as a piano-roll visualization — download to listen.
|
|
13
|
+
*/
|
|
14
|
+
type __VLS_Props = {
|
|
15
|
+
url?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { fileExt as e } from "../lib/fileType.js";
|
|
2
|
+
import { formatBytes as t } from "../lib/format.js";
|
|
3
|
+
import n from "./icons/Icon.js";
|
|
4
|
+
import { parseMidi as r } from "../lib/midi.js";
|
|
5
|
+
import { decodeSpeechToWav as i, sniffSpeechCodec as a } from "../lib/speechAudio.js";
|
|
6
|
+
import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, onBeforeUnmount as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, watch as y } from "vue";
|
|
7
|
+
//#region src/components/AudioViewer.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var b = { class: "au" }, x = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "au__msg"
|
|
11
|
+
}, S = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "au__msg"
|
|
14
|
+
}, C = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "au__msg au__gate"
|
|
17
|
+
}, w = {
|
|
18
|
+
key: 3,
|
|
19
|
+
class: "au__msg au__msg--error"
|
|
20
|
+
}, ee = {
|
|
21
|
+
key: 4,
|
|
22
|
+
class: "au__player"
|
|
23
|
+
}, te = { class: "au__name" }, ne = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "au__meta"
|
|
26
|
+
}, T = { class: "au__badge" }, E = { key: 0 }, D = ["src"], O = ["href", "download"], k = { class: "au__head" }, A = { key: 0 }, j = { class: "au__roll" }, M = [
|
|
27
|
+
"width",
|
|
28
|
+
"height",
|
|
29
|
+
"viewBox"
|
|
30
|
+
], N = [
|
|
31
|
+
"x",
|
|
32
|
+
"y",
|
|
33
|
+
"width",
|
|
34
|
+
"height",
|
|
35
|
+
"fill"
|
|
36
|
+
], P = {
|
|
37
|
+
key: 1,
|
|
38
|
+
class: "au__msg"
|
|
39
|
+
}, F = {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: "au__trunc"
|
|
42
|
+
}, I = 80 * 1024 * 1024, L = 6e3, R = /*@__PURE__*/ f({
|
|
43
|
+
__name: "AudioViewer",
|
|
44
|
+
props: {
|
|
45
|
+
url: {},
|
|
46
|
+
name: {},
|
|
47
|
+
size: {}
|
|
48
|
+
},
|
|
49
|
+
setup(f) {
|
|
50
|
+
let R = f, z = h("loading"), B = h(""), V = h(""), H = h(null), U = h(null), W = s(() => {
|
|
51
|
+
let t = e(R.name);
|
|
52
|
+
return t === "mid" || t === "midi";
|
|
53
|
+
}), G = {
|
|
54
|
+
silk: "SILK",
|
|
55
|
+
"amr-nb": "AMR-NB",
|
|
56
|
+
"amr-wb": "AMR-WB"
|
|
57
|
+
}, K = s(() => {
|
|
58
|
+
let t = R.name || "audio", n = e(t);
|
|
59
|
+
return n ? t.slice(0, t.length - n.length - 1) : t;
|
|
60
|
+
}), q = s(() => `${K.value}.wav`);
|
|
61
|
+
function J(e) {
|
|
62
|
+
switch (e) {
|
|
63
|
+
case "mp3": return "audio/mpeg";
|
|
64
|
+
case "wav": return "audio/wav";
|
|
65
|
+
case "flac": return "audio/flac";
|
|
66
|
+
case "m4a": return "audio/mp4";
|
|
67
|
+
case "aac": return "audio/aac";
|
|
68
|
+
case "oga":
|
|
69
|
+
case "ogg":
|
|
70
|
+
case "opus": return "audio/ogg";
|
|
71
|
+
case "weba": return "audio/webm";
|
|
72
|
+
default: return "audio/mpeg";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function Y() {
|
|
76
|
+
V.value &&= (URL.revokeObjectURL(V.value), "");
|
|
77
|
+
}
|
|
78
|
+
function X(e) {
|
|
79
|
+
(!Number.isFinite(e) || e < 0) && (e = 0);
|
|
80
|
+
let t = Math.floor(e / 60), n = Math.round(e % 60);
|
|
81
|
+
return `${t}:${String(n).padStart(2, "0")}`;
|
|
82
|
+
}
|
|
83
|
+
let Z = [
|
|
84
|
+
"#3b82f6",
|
|
85
|
+
"#e8590c",
|
|
86
|
+
"#2f9e44",
|
|
87
|
+
"#ae3ec9",
|
|
88
|
+
"#d6336c",
|
|
89
|
+
"#1098ad",
|
|
90
|
+
"#f08c00",
|
|
91
|
+
"#5f3dc4"
|
|
92
|
+
], Q = s(() => {
|
|
93
|
+
let e = H.value;
|
|
94
|
+
if (!e || !e.notes.length) return null;
|
|
95
|
+
let t = 127, n = 0;
|
|
96
|
+
for (let r of e.notes) r.pitch < t && (t = r.pitch), r.pitch > n && (n = r.pitch);
|
|
97
|
+
t = Math.max(0, t - 1), n = Math.min(127, n + 1);
|
|
98
|
+
let r = n - t + 1, i = 48 / e.division;
|
|
99
|
+
return {
|
|
100
|
+
width: Math.max(200, Math.ceil(e.totalTicks * i) + 8),
|
|
101
|
+
height: r * 7,
|
|
102
|
+
rects: e.notes.slice(0, L).map((e) => ({
|
|
103
|
+
x: e.startTick * i,
|
|
104
|
+
y: (n - e.pitch) * 7,
|
|
105
|
+
w: Math.max(1.5, (e.endTick - e.startTick) * i),
|
|
106
|
+
h: 6,
|
|
107
|
+
color: Z[e.track % Z.length]
|
|
108
|
+
})),
|
|
109
|
+
truncated: e.notes.length > L
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
async function $() {
|
|
113
|
+
if (R.url) {
|
|
114
|
+
z.value = "loading", B.value = "", Y(), H.value = null, U.value = null;
|
|
115
|
+
try {
|
|
116
|
+
let t = await fetch(R.url);
|
|
117
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
118
|
+
let n = await t.arrayBuffer();
|
|
119
|
+
if (W.value) H.value = r(n);
|
|
120
|
+
else {
|
|
121
|
+
let t = new Uint8Array(n);
|
|
122
|
+
if (a(t)) {
|
|
123
|
+
z.value = "decoding", await new Promise((e) => setTimeout(e, 0));
|
|
124
|
+
let e = await i(t);
|
|
125
|
+
U.value = {
|
|
126
|
+
codec: e.codec,
|
|
127
|
+
sampleRate: e.sampleRate,
|
|
128
|
+
durationSec: e.durationSec
|
|
129
|
+
}, V.value = URL.createObjectURL(new Blob([e.wav], { type: "audio/wav" }));
|
|
130
|
+
} else V.value = URL.createObjectURL(new Blob([n], { type: J(e(R.name)) }));
|
|
131
|
+
}
|
|
132
|
+
z.value = "ready";
|
|
133
|
+
} catch (e) {
|
|
134
|
+
B.value = e instanceof Error ? e.message : String(e), z.value = "error";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function re() {
|
|
139
|
+
if (R.size && R.size > I) {
|
|
140
|
+
z.value = "gate";
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
$();
|
|
144
|
+
}
|
|
145
|
+
return y(() => R.url, re, { immediate: !0 }), p(Y), (e, r) => (m(), l("div", b, [z.value === "loading" ? (m(), l("p", x, "正在加载…")) : z.value === "decoding" ? (m(), l("p", S, "正在解码…")) : z.value === "gate" ? (m(), l("div", C, [u("p", null, "该文件较大(" + _(v(t)(R.size)) + "),将在浏览器内加载。是否继续?", 1), u("button", {
|
|
146
|
+
type: "button",
|
|
147
|
+
class: "au__btn",
|
|
148
|
+
onClick: $
|
|
149
|
+
}, "加载并预览")])) : z.value === "error" ? (m(), l("div", w, [u("p", null, "加载失败:" + _(B.value), 1), u("button", {
|
|
150
|
+
type: "button",
|
|
151
|
+
class: "au__btn",
|
|
152
|
+
onClick: $
|
|
153
|
+
}, "重试")])) : W.value ? H.value ? (m(), l(o, { key: 5 }, [
|
|
154
|
+
u("div", k, [
|
|
155
|
+
r[2] ||= u("span", { class: "au__badge" }, "MIDI", -1),
|
|
156
|
+
u("span", null, "格式 " + _(H.value.format), 1),
|
|
157
|
+
u("span", null, _(H.value.trackCount) + " 轨", 1),
|
|
158
|
+
u("span", null, _(H.value.tempoBpm) + " BPM", 1),
|
|
159
|
+
u("span", null, _(H.value.notes.length) + " 音符", 1),
|
|
160
|
+
H.value.durationSec > 0 ? (m(), l("span", A, _(X(H.value.durationSec)), 1)) : c("", !0)
|
|
161
|
+
]),
|
|
162
|
+
r[3] ||= u("p", { class: "au__note" }, " 浏览器不支持直接播放 MIDI,此处仅作可视化预览;如需试听请下载后用本地播放器打开。 ", -1),
|
|
163
|
+
u("div", j, [Q.value ? (m(), l("svg", {
|
|
164
|
+
key: 0,
|
|
165
|
+
width: Q.value.width,
|
|
166
|
+
height: Q.value.height,
|
|
167
|
+
viewBox: `0 0 ${Q.value.width} ${Q.value.height}`
|
|
168
|
+
}, [(m(!0), l(o, null, g(Q.value.rects, (e, t) => (m(), l("rect", {
|
|
169
|
+
key: t,
|
|
170
|
+
x: e.x,
|
|
171
|
+
y: e.y,
|
|
172
|
+
width: e.w,
|
|
173
|
+
height: e.h,
|
|
174
|
+
fill: e.color,
|
|
175
|
+
rx: "1.5"
|
|
176
|
+
}, null, 8, N))), 128))], 8, M)) : (m(), l("p", P, "未解析到音符。"))]),
|
|
177
|
+
Q.value?.truncated ? (m(), l("p", F, "音符过多,仅渲染前 " + _(L) + " 个。")) : c("", !0)
|
|
178
|
+
], 64)) : c("", !0) : (m(), l("div", ee, [
|
|
179
|
+
r[1] ||= u("div", { class: "au__icon" }, "♪", -1),
|
|
180
|
+
u("div", te, _(R.name), 1),
|
|
181
|
+
U.value ? (m(), l("div", ne, [u("span", T, _(G[U.value.codec]) + " · 已解码为 WAV", 1), U.value.durationSec > 0 ? (m(), l("span", E, _(X(U.value.durationSec)), 1)) : c("", !0)])) : c("", !0),
|
|
182
|
+
u("audio", {
|
|
183
|
+
class: "au__audio",
|
|
184
|
+
src: V.value,
|
|
185
|
+
controls: "",
|
|
186
|
+
preload: "metadata"
|
|
187
|
+
}, null, 8, D),
|
|
188
|
+
U.value ? (m(), l("a", {
|
|
189
|
+
key: 1,
|
|
190
|
+
class: "au__dl",
|
|
191
|
+
href: V.value,
|
|
192
|
+
download: q.value
|
|
193
|
+
}, [d(n, {
|
|
194
|
+
name: "download",
|
|
195
|
+
size: 14
|
|
196
|
+
}), r[0] ||= u("span", null, "下载 WAV", -1)], 8, O)) : c("", !0)
|
|
197
|
+
]))]));
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
//#endregion
|
|
201
|
+
export { R as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./BinObjBrowser.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/BinObjBrowser.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-c0cc2754"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The side viewer's binary-object mode: fetch a `.so`/`.dll`'s bytes, parse its symbol table entirely
|
|
3
|
+
* in-browser (see lib/binobj.ts), and list the function symbols. Mirrors ZipBrowser — the bytes come from
|
|
4
|
+
* the same download endpoint as any other file and never leave the browser. No disassembly: this answers
|
|
5
|
+
* "what functions does this library define?", and clicking a symbol copies its name.
|
|
6
|
+
*
|
|
7
|
+
* Large-file gate: a `.so`/`.dll` can be tens of MB, and parsing needs the whole file in memory. So unless
|
|
8
|
+
* the manifest size is known to be small (≤ LARGE_THRESHOLD), we don't auto-fetch — we show a confirm card
|
|
9
|
+
* and only download when the user clicks. Unknown size is treated as "large" (better to ask than to pull
|
|
10
|
+
* tens of MB unprompted).
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
url: string;
|
|
14
|
+
name: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { formatBytes as e } from "../lib/format.js";
|
|
2
|
+
import t from "./icons/Icon.js";
|
|
3
|
+
import { UnsupportedBinaryError as n, parseBinObj as r } from "../lib/binobj.js";
|
|
4
|
+
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, vModelText as y, watch as b, withDirectives as x } from "vue";
|
|
5
|
+
//#region src/components/BinObjBrowser.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var ee = { class: "bo" }, te = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "bo__confirm"
|
|
9
|
+
}, ne = ["title"], re = { class: "bo__confirm-sub" }, ie = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "bo__msg"
|
|
12
|
+
}, S = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "bo__msg bo__msg--error"
|
|
15
|
+
}, C = { class: "bo__summary" }, w = { class: "bo__fmt" }, T = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "bo__tag",
|
|
18
|
+
title: "无完整符号表,仅列动态/导出符号"
|
|
19
|
+
}, E = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "bo__meta"
|
|
22
|
+
}, D = ["src", "alt"], O = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "bo__metalist"
|
|
25
|
+
}, k = { class: "bo__metakey" }, A = { class: "bo__metaval" }, j = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "bo__search"
|
|
28
|
+
}, M = {
|
|
29
|
+
key: 2,
|
|
30
|
+
class: "bo__note"
|
|
31
|
+
}, N = { class: "bo__list" }, P = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "bo__msg"
|
|
34
|
+
}, F = ["title", "onClick"], I = { class: "bo__name" }, L = { class: "bo__meta" }, ae = {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: "bo__copied"
|
|
37
|
+
}, R = { class: "bo__addr" }, z = {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "bo__bsize"
|
|
40
|
+
}, B = {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "bo__more"
|
|
43
|
+
}, V = 5 * 1024 * 1024, H = 2e3, U = /*@__PURE__*/ u({
|
|
44
|
+
__name: "BinObjBrowser",
|
|
45
|
+
props: {
|
|
46
|
+
url: {},
|
|
47
|
+
name: {},
|
|
48
|
+
size: {}
|
|
49
|
+
},
|
|
50
|
+
setup(u) {
|
|
51
|
+
let U = u, W = h("loading"), G = h(""), K = h(null), q = h("");
|
|
52
|
+
function J() {
|
|
53
|
+
K.value = null, q.value = "", G.value = "", U.size != null && U.size <= V ? Y() : W.value = "confirm";
|
|
54
|
+
}
|
|
55
|
+
async function Y() {
|
|
56
|
+
W.value = "loading", G.value = "";
|
|
57
|
+
try {
|
|
58
|
+
let e = await fetch(U.url);
|
|
59
|
+
if (!e.ok) throw Error(`HTTP ${e.status}`);
|
|
60
|
+
K.value = r(await e.arrayBuffer()), W.value = "ready";
|
|
61
|
+
} catch (e) {
|
|
62
|
+
G.value = e instanceof n || e instanceof Error ? e.message : String(e), W.value = "error";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let X = a(() => {
|
|
66
|
+
let e = K.value?.symbols ?? [], t = q.value.trim().toLowerCase();
|
|
67
|
+
return t ? e.filter((e) => e.name.toLowerCase().includes(t)) : e;
|
|
68
|
+
}), oe = a(() => X.value.slice(0, H)), se = a(() => X.value.length > H);
|
|
69
|
+
function ce(e) {
|
|
70
|
+
return `0x${e.toString(16)}`;
|
|
71
|
+
}
|
|
72
|
+
function le(e) {
|
|
73
|
+
return e.kind === "export" ? "EXP" : e.kind === "ifunc" ? "IFN" : "FN";
|
|
74
|
+
}
|
|
75
|
+
let Z = h(""), Q;
|
|
76
|
+
async function $(e) {
|
|
77
|
+
try {
|
|
78
|
+
await navigator.clipboard?.writeText(e);
|
|
79
|
+
} catch {}
|
|
80
|
+
Z.value = e, clearTimeout(Q), Q = setTimeout(() => Z.value = "", 1200);
|
|
81
|
+
}
|
|
82
|
+
return p(J), b(() => U.url, J), f(() => clearTimeout(Q)), (n, r) => (m(), s("div", ee, [W.value === "confirm" ? (m(), s("div", te, [
|
|
83
|
+
l(t, {
|
|
84
|
+
name: "code",
|
|
85
|
+
size: 32
|
|
86
|
+
}),
|
|
87
|
+
c("p", {
|
|
88
|
+
class: "bo__confirm-title",
|
|
89
|
+
title: u.name
|
|
90
|
+
}, _(u.name), 9, ne),
|
|
91
|
+
c("p", re, _(u.size == null ? "文件大小未知" : `文件较大(${v(e)(u.size)})`) + ",解析需将整个文件下载到浏览器。 ", 1),
|
|
92
|
+
c("button", {
|
|
93
|
+
type: "button",
|
|
94
|
+
class: "bo__btn",
|
|
95
|
+
onClick: Y
|
|
96
|
+
}, "加载并解析符号")
|
|
97
|
+
])) : W.value === "loading" ? (m(), s("p", ie, "正在解析符号…")) : W.value === "error" ? (m(), s("div", S, [c("p", null, _(G.value), 1), c("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
class: "bo__retry",
|
|
100
|
+
onClick: Y
|
|
101
|
+
}, "重试")])) : W.value === "ready" && K.value ? (m(), s(i, { key: 3 }, [
|
|
102
|
+
c("div", C, [
|
|
103
|
+
c("span", w, _(K.value.format.toUpperCase()), 1),
|
|
104
|
+
c("span", null, _(K.value.arch), 1),
|
|
105
|
+
c("span", null, _(K.value.bits) + "-bit", 1),
|
|
106
|
+
c("span", null, _(K.value.symbols.length) + " 个函数", 1),
|
|
107
|
+
K.value.stripped ? (m(), s("span", T, "已剥离")) : o("", !0)
|
|
108
|
+
]),
|
|
109
|
+
K.value.iconDataUrl || K.value.meta.length ? (m(), s("div", E, [K.value.iconDataUrl ? (m(), s("img", {
|
|
110
|
+
key: 0,
|
|
111
|
+
class: "bo__icon",
|
|
112
|
+
src: K.value.iconDataUrl,
|
|
113
|
+
alt: u.name
|
|
114
|
+
}, null, 8, D)) : o("", !0), K.value.meta.length ? (m(), s("dl", O, [(m(!0), s(i, null, g(K.value.meta, (e, t) => (m(), s(i, { key: t }, [c("dt", k, _(e.label), 1), c("dd", A, _(e.value), 1)], 64))), 128))])) : o("", !0)])) : o("", !0),
|
|
115
|
+
K.value.symbols.length ? (m(), s("div", j, [x(c("input", {
|
|
116
|
+
"onUpdate:modelValue": r[0] ||= (e) => q.value = e,
|
|
117
|
+
type: "search",
|
|
118
|
+
class: "bo__input",
|
|
119
|
+
placeholder: "搜索函数名…"
|
|
120
|
+
}, null, 512), [[y, q.value]])])) : o("", !0),
|
|
121
|
+
K.value.note ? (m(), s("p", M, _(K.value.note), 1)) : o("", !0),
|
|
122
|
+
c("div", N, [
|
|
123
|
+
K.value.symbols.length && X.value.length === 0 ? (m(), s("p", P, "无匹配函数")) : o("", !0),
|
|
124
|
+
(m(!0), s(i, null, g(oe.value, (t, n) => (m(), s("button", {
|
|
125
|
+
key: n,
|
|
126
|
+
type: "button",
|
|
127
|
+
class: "bo__row",
|
|
128
|
+
title: `点击复制:${t.name}`,
|
|
129
|
+
onClick: (e) => $(t.name)
|
|
130
|
+
}, [
|
|
131
|
+
c("span", { class: d(["bo__kind", { "bo__kind--weak": t.bind === "weak" }]) }, _(le(t)), 3),
|
|
132
|
+
c("span", I, _(t.name), 1),
|
|
133
|
+
c("span", L, [Z.value === t.name ? (m(), s("span", ae, "已复制")) : (m(), s(i, { key: 1 }, [c("span", R, _(ce(t.address)), 1), t.size ? (m(), s("span", z, _(v(e)(t.size)), 1)) : o("", !0)], 64))])
|
|
134
|
+
], 8, F))), 128)),
|
|
135
|
+
se.value ? (m(), s("p", B, " 仅显示前 " + _(H) + " 个,输入关键词缩小范围(共 " + _(X.value.length) + " 个) ", 1)) : o("", !0)
|
|
136
|
+
])
|
|
137
|
+
], 64)) : o("", !0)]));
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
//#endregion
|
|
141
|
+
export { U as default };
|