@l1yp/file-viewer 0.1.0 → 0.1.2
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/README.md +2 -0
- package/dist/FileViewer.js +2 -0
- package/dist/FileViewer.js.map +1 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/AppxViewer.js +2 -0
- package/dist/components/AppxViewer.js.map +1 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ArchiveBrowser.js +2 -0
- package/dist/components/ArchiveBrowser.js.map +1 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/AudioViewer.js +2 -0
- package/dist/components/AudioViewer.js.map +1 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/BinObjBrowser.js +2 -0
- package/dist/components/BinObjBrowser.js.map +1 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/CertViewer.js +2 -0
- package/dist/components/CertViewer.js.map +1 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ClassViewer.js +2 -0
- package/dist/components/ClassViewer.js.map +1 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/CodeBlock.js +2 -0
- package/dist/components/CodeBlock.js.map +1 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/CodeView.js +2 -0
- package/dist/components/CodeView.js.map +1 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/CsvViewer.js +2 -0
- package/dist/components/CsvViewer.js.map +1 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DicomViewer.js +2 -0
- package/dist/components/DicomViewer.js.map +1 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DocxNavigationPane.js +9 -0
- package/dist/components/DocxNavigationPane.js.map +1 -0
- package/dist/components/DocxNavigationPane.vue.d.ts +23 -0
- package/dist/components/DocxNavigationPane.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/components/DocxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DocxViewer.js +3 -1
- package/dist/components/DocxViewer.js.map +1 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +72 -37
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DrawioViewer.js +2 -0
- package/dist/components/DrawioViewer.js.map +1 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DxfViewer.js +2 -0
- package/dist/components/DxfViewer.js.map +1 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/EbookViewer.js +2 -0
- package/dist/components/EbookViewer.js.map +1 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/EmlViewer.js +2 -0
- package/dist/components/EmlViewer.js.map +1 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/EplViewer.js +2 -0
- package/dist/components/EplViewer.js.map +1 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FileViewerBody.js +3 -1
- package/dist/components/FileViewerBody.js.map +1 -0
- package/dist/components/FileViewerBody.vue.d.ts +5 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +250 -247
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FileViewerPanel.js +2 -0
- package/dist/components/FileViewerPanel.js.map +1 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FontViewer.js +2 -0
- package/dist/components/FontViewer.js.map +1 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/FrontmatterCard.js +2 -0
- package/dist/components/FrontmatterCard.js.map +1 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/GeoViewer.js +2 -0
- package/dist/components/GeoViewer.js.map +1 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/HarViewer.js +2 -0
- package/dist/components/HarViewer.js.map +1 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/HexViewer.js +2 -0
- package/dist/components/HexViewer.js.map +1 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/HprofViewer.js +2 -0
- package/dist/components/HprofViewer.js.map +1 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ImageLightbox.js +2 -0
- package/dist/components/ImageLightbox.js.map +1 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/InlineText.js +2 -0
- package/dist/components/InlineText.js.map +1 -0
- package/dist/components/JksViewer.js +2 -0
- package/dist/components/JksViewer.js.map +1 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/JsonlViewer.js +2 -0
- package/dist/components/JsonlViewer.js.map +1 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/LogViewer.js +2 -0
- package/dist/components/LogViewer.js.map +1 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/LrcViewer.js +2 -0
- package/dist/components/LrcViewer.js.map +1 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MarkdownTable.js +2 -0
- package/dist/components/MarkdownTable.js.map +1 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MarkdownText.js +2 -0
- package/dist/components/MarkdownText.js.map +1 -0
- package/dist/components/MhtViewer.js +2 -0
- package/dist/components/MhtViewer.js.map +1 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MindMapView.js +2 -0
- package/dist/components/MindMapView.js.map +1 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MissingDependency.js +2 -0
- package/dist/components/MissingDependency.js.map +1 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ModelViewer.js +2 -0
- package/dist/components/ModelViewer.js.map +1 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/MsiViewer.js +2 -0
- package/dist/components/MsiViewer.js.map +1 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/NotebookViewer.js +2 -0
- package/dist/components/NotebookViewer.js.map +1 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PdfViewer.js +2 -0
- package/dist/components/PdfViewer.js.map +1 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PptxNavigationPane.js +9 -0
- package/dist/components/PptxNavigationPane.js.map +1 -0
- package/dist/components/PptxNavigationPane.vue.d.ts +20 -0
- package/dist/components/PptxNavigationPane.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/PptxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PptxViewer.js +3 -1
- package/dist/components/PptxViewer.js.map +1 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +71 -39
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/PsdViewer.js +2 -0
- package/dist/components/PsdViewer.js.map +1 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/QmcAudioViewer.js +2 -0
- package/dist/components/QmcAudioViewer.js.map +1 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/RasterViewer.js +2 -0
- package/dist/components/RasterViewer.js.map +1 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/RtfViewer.js +2 -0
- package/dist/components/RtfViewer.js.map +1 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SevenZipBrowser.js +2 -0
- package/dist/components/SevenZipBrowser.js.map +1 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SqliteViewer.js +2 -0
- package/dist/components/SqliteViewer.js.map +1 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/SubtitleViewer.js +2 -0
- package/dist/components/SubtitleViewer.js.map +1 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxChart.js +2 -0
- package/dist/components/XlsxChart.js.map +1 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxViewer.js +3 -1
- package/dist/components/XlsxViewer.js.map +1 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +301 -304
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XmindViewer.js +2 -0
- package/dist/components/XmindViewer.js.map +1 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ZipBrowser.js +3 -1
- package/dist/components/ZipBrowser.js.map +1 -0
- package/dist/components/ZipBrowser.vue.d.ts +3 -1
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +154 -122
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ZoomImage.js +2 -0
- package/dist/components/ZoomImage.js.map +1 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplCodeBlock.js +2 -0
- package/dist/components/epl/EplCodeBlock.js.map +1 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplDoc.js +2 -0
- package/dist/components/epl/EplDoc.js.map +1 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplMethod.js +2 -0
- package/dist/components/epl/EplMethod.js.map +1 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplResource.js +2 -0
- package/dist/components/epl/EplResource.js.map +1 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplTree.js +2 -0
- package/dist/components/epl/EplTree.js.map +1 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/EplVarTable.js +2 -0
- package/dist/components/epl/EplVarTable.js.map +1 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/epl/numbering.js +2 -0
- package/dist/components/epl/numbering.js.map +1 -0
- package/dist/components/icons/Icon.js +2 -0
- package/dist/components/icons/Icon.js.map +1 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/icons/iconPaths.js +2 -0
- package/dist/components/icons/iconPaths.js.map +1 -0
- package/dist/components/optionalViewer.js +2 -0
- package/dist/components/optionalViewer.js.map +1 -0
- package/dist/components/ui/ClampBlock.js +2 -0
- package/dist/components/ui/ClampBlock.js.map +1 -0
- package/dist/composables/useElementNavigation.d.ts +21 -0
- package/dist/composables/useElementNavigation.js +63 -0
- package/dist/composables/useElementNavigation.js.map +1 -0
- package/dist/composables/useFileViewer.js +2 -0
- package/dist/composables/useFileViewer.js.map +1 -0
- package/dist/composables/useLightbox.js +2 -0
- package/dist/composables/useLightbox.js.map +1 -0
- package/dist/composables/useLogRules.js +2 -0
- package/dist/composables/useLogRules.js.map +1 -0
- package/dist/lib/aes.js +2 -0
- package/dist/lib/aes.js.map +1 -0
- package/dist/lib/appx.js +2 -0
- package/dist/lib/appx.js.map +1 -0
- package/dist/lib/archiveHtml.d.ts +49 -0
- package/dist/lib/archiveHtml.js +377 -0
- package/dist/lib/archiveHtml.js.map +1 -0
- package/dist/lib/asn1.js +2 -0
- package/dist/lib/asn1.js.map +1 -0
- package/dist/lib/binobj.js +2 -0
- package/dist/lib/binobj.js.map +1 -0
- package/dist/lib/brotli.js +2 -0
- package/dist/lib/brotli.js.map +1 -0
- package/dist/lib/bzip2.js +2 -0
- package/dist/lib/bzip2.js.map +1 -0
- package/dist/lib/classfile.js +2 -0
- package/dist/lib/classfile.js.map +1 -0
- package/dist/lib/codePreview.js +2 -0
- package/dist/lib/codePreview.js.map +1 -0
- package/dist/lib/codefold.js +2 -0
- package/dist/lib/codefold.js.map +1 -0
- package/dist/lib/codeformat.js +2 -0
- package/dist/lib/codeformat.js.map +1 -0
- package/dist/lib/csv.js +2 -0
- package/dist/lib/csv.js.map +1 -0
- package/dist/lib/des.js +2 -0
- package/dist/lib/des.js.map +1 -0
- package/dist/lib/diagram.js +2 -0
- package/dist/lib/diagram.js.map +1 -0
- package/dist/lib/dicom.js +2 -0
- package/dist/lib/dicom.js.map +1 -0
- package/dist/lib/dicomCodecs.js +2 -0
- package/dist/lib/dicomCodecs.js.map +1 -0
- package/dist/lib/dicomRender.js +2 -0
- package/dist/lib/dicomRender.js.map +1 -0
- package/dist/lib/docxNavigation.d.ts +31 -0
- package/dist/lib/docxNavigation.js +65 -0
- package/dist/lib/docxNavigation.js.map +1 -0
- package/dist/lib/dxf.js +2 -0
- package/dist/lib/dxf.js.map +1 -0
- package/dist/lib/eml.js +2 -0
- package/dist/lib/eml.js.map +1 -0
- package/dist/lib/encoding.js +2 -0
- package/dist/lib/encoding.js.map +1 -0
- package/dist/lib/epl/code/codeDataParser.js +2 -0
- package/dist/lib/epl/code/codeDataParser.js.map +1 -0
- package/dist/lib/epl/code/codeLines.js +2 -0
- package/dist/lib/epl/code/codeLines.js.map +1 -0
- package/dist/lib/epl/code/textCode.js +2 -0
- package/dist/lib/epl/code/textCode.js.map +1 -0
- package/dist/lib/epl/eplDocument.js +2 -0
- package/dist/lib/epl/eplDocument.js.map +1 -0
- package/dist/lib/epl/imageList.js +2 -0
- package/dist/lib/epl/imageList.js.map +1 -0
- package/dist/lib/epl/index.js +2 -0
- package/dist/lib/epl/index.js.map +1 -0
- package/dist/lib/epl/io/binaryReader.js +2 -0
- package/dist/lib/epl/io/binaryReader.js.map +1 -0
- package/dist/lib/epl/io/encoding.js +2 -0
- package/dist/lib/epl/io/encoding.js.map +1 -0
- package/dist/lib/epl/model/eplSystemId.js +2 -0
- package/dist/lib/epl/model/eplSystemId.js.map +1 -0
- package/dist/lib/epl/names/eplLibData.js +2 -0
- package/dist/lib/epl/names/eplLibData.js.map +1 -0
- package/dist/lib/epl/names/idToNameMap.js +2 -0
- package/dist/lib/epl/names/idToNameMap.js.map +1 -0
- package/dist/lib/epl/names/libNameProvider.js +2 -0
- package/dist/lib/epl/names/libNameProvider.js.map +1 -0
- package/dist/lib/epl/program.js +2 -0
- package/dist/lib/epl/program.js.map +1 -0
- package/dist/lib/epl/projectFileReader.js +2 -0
- package/dist/lib/epl/projectFileReader.js.map +1 -0
- package/dist/lib/fb2.js +2 -0
- package/dist/lib/fb2.js.map +1 -0
- package/dist/lib/fileType.js +2 -0
- package/dist/lib/fileType.js.map +1 -0
- package/dist/lib/fonts.js +2 -0
- package/dist/lib/fonts.js.map +1 -0
- package/dist/lib/format.js +2 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/frontmatter.js +2 -0
- package/dist/lib/frontmatter.js.map +1 -0
- package/dist/lib/geo.js +2 -0
- package/dist/lib/geo.js.map +1 -0
- package/dist/lib/har.js +2 -0
- package/dist/lib/har.js.map +1 -0
- package/dist/lib/highlight.js +2 -0
- package/dist/lib/highlight.js.map +1 -0
- package/dist/lib/highlightLangs.js +2 -0
- package/dist/lib/highlightLangs.js.map +1 -0
- package/dist/lib/hprof.js +2 -0
- package/dist/lib/hprof.js.map +1 -0
- package/dist/lib/ipynb.js +2 -0
- package/dist/lib/ipynb.js.map +1 -0
- package/dist/lib/jks.js +2 -0
- package/dist/lib/jks.js.map +1 -0
- package/dist/lib/jsonl.js +2 -0
- package/dist/lib/jsonl.js.map +1 -0
- package/dist/lib/lrc.js +2 -0
- package/dist/lib/lrc.js.map +1 -0
- package/dist/lib/lzma.js +2 -0
- package/dist/lib/lzma.js.map +1 -0
- package/dist/lib/markdown/blocks.js +2 -0
- package/dist/lib/markdown/blocks.js.map +1 -0
- package/dist/lib/markdown/inline.js +2 -0
- package/dist/lib/markdown/inline.js.map +1 -0
- package/dist/lib/markdown/math.js +2 -0
- package/dist/lib/markdown/math.js.map +1 -0
- package/dist/lib/markdown/segmentize.js +2 -0
- package/dist/lib/markdown/segmentize.js.map +1 -0
- package/dist/lib/markdown/styles.js +2 -0
- package/dist/lib/markdown/styles.js.map +1 -0
- package/dist/lib/mht.js +2 -0
- package/dist/lib/mht.js.map +1 -0
- package/dist/lib/midi.js +2 -0
- package/dist/lib/midi.js.map +1 -0
- package/dist/lib/mime.js +2 -0
- package/dist/lib/mime.js.map +1 -0
- package/dist/lib/mindmap.js +2 -0
- package/dist/lib/mindmap.js.map +1 -0
- package/dist/lib/mobi.js +2 -0
- package/dist/lib/mobi.js.map +1 -0
- package/dist/lib/msi.js +2 -0
- package/dist/lib/msi.js.map +1 -0
- package/dist/lib/optionalDep.js +2 -0
- package/dist/lib/optionalDep.js.map +1 -0
- package/dist/lib/pkcs12.js +2 -0
- package/dist/lib/pkcs12.js.map +1 -0
- package/dist/lib/pptxNavigation.d.ts +7 -0
- package/dist/lib/pptxNavigation.js +29 -0
- package/dist/lib/pptxNavigation.js.map +1 -0
- package/dist/lib/qmc.js +2 -0
- package/dist/lib/qmc.js.map +1 -0
- package/dist/lib/rar.js +2 -0
- package/dist/lib/rar.js.map +1 -0
- package/dist/lib/rawPreview.js +2 -0
- package/dist/lib/rawPreview.js.map +1 -0
- package/dist/lib/rc2.js +2 -0
- package/dist/lib/rc2.js.map +1 -0
- package/dist/lib/resolveInput.js +2 -0
- package/dist/lib/resolveInput.js.map +1 -0
- package/dist/lib/rtf.js +2 -0
- package/dist/lib/rtf.js.map +1 -0
- package/dist/lib/sevenZip.js +2 -0
- package/dist/lib/sevenZip.js.map +1 -0
- package/dist/lib/sha1.js +2 -0
- package/dist/lib/sha1.js.map +1 -0
- package/dist/lib/sha256.js +2 -0
- package/dist/lib/sha256.js.map +1 -0
- package/dist/lib/speechAudio.js +2 -0
- package/dist/lib/speechAudio.js.map +1 -0
- package/dist/lib/sqlite.js +2 -0
- package/dist/lib/sqlite.js.map +1 -0
- package/dist/lib/subtitle.js +2 -0
- package/dist/lib/subtitle.js.map +1 -0
- package/dist/lib/tarball.js +2 -0
- package/dist/lib/tarball.js.map +1 -0
- package/dist/lib/viewerFormats.js +2 -0
- package/dist/lib/viewerFormats.js.map +1 -0
- package/dist/lib/viewerKind.js +2 -0
- package/dist/lib/viewerKind.js.map +1 -0
- package/dist/lib/x509.js +2 -0
- package/dist/lib/x509.js.map +1 -0
- package/dist/lib/xlsx.js +2 -0
- package/dist/lib/xlsx.js.map +1 -0
- package/dist/lib/xlsxCharts.js +2 -0
- package/dist/lib/xlsxCharts.js.map +1 -0
- package/dist/lib/xmind.js +2 -0
- package/dist/lib/xmind.js.map +1 -0
- package/dist/lib/zip.js +2 -0
- package/dist/lib/zip.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useElementNavigation.js","names":[],"sources":["../../src/composables/useElementNavigation.ts"],"sourcesContent":["import { onBeforeUnmount, shallowRef, watch, type ShallowRef } from 'vue'\n\nexport interface ElementNavigationItem {\n id: string\n title: string\n level: number\n target: HTMLElement\n}\n\n/**\n * Scroll-spy + in-container navigation for DOM-backed document viewers.\n *\n * The rendered document remains the only source of scroll state. Navigation entries retain their target\n * elements, while this composable exposes readonly-by-convention refs and explicit mutation actions.\n */\nexport function useElementNavigation(scrollRoot: Readonly<ShallowRef<HTMLElement | null>>) {\n const outlineItems = shallowRef<ElementNavigationItem[]>([])\n const pageItems = shallowRef<ElementNavigationItem[]>([])\n const activeOutlineId = shallowRef('')\n const activePageId = shallowRef('')\n\n let frame = 0\n let listeningRoot: HTMLElement | null = null\n\n function activeItem(items: readonly ElementNavigationItem[], line: number) {\n if (!items.length) return undefined\n let active = items[0]\n for (const item of items) {\n if (item.target.getBoundingClientRect().top > line) break\n active = item\n }\n return active\n }\n\n function refreshActive(): void {\n frame = 0\n const root = scrollRoot.value\n if (!root) return\n const line = root.getBoundingClientRect().top + 32\n activeOutlineId.value = activeItem(outlineItems.value, line)?.id ?? ''\n activePageId.value = activeItem(pageItems.value, line)?.id ?? ''\n }\n\n function queueRefresh(): void {\n if (frame) return\n if (typeof requestAnimationFrame === 'undefined') {\n refreshActive()\n return\n }\n frame = requestAnimationFrame(refreshActive)\n }\n\n function bindRoot(root: HTMLElement | null): void {\n listeningRoot?.removeEventListener('scroll', queueRefresh)\n listeningRoot = root\n listeningRoot?.addEventListener('scroll', queueRefresh, { passive: true })\n queueRefresh()\n }\n\n const stopRootWatch = watch(scrollRoot, bindRoot, { immediate: true, flush: 'post' })\n\n function setItems(\n outline: readonly ElementNavigationItem[],\n pages: readonly ElementNavigationItem[],\n ): void {\n outlineItems.value = [...outline]\n pageItems.value = [...pages]\n activeOutlineId.value = outline[0]?.id ?? ''\n activePageId.value = pages[0]?.id ?? ''\n queueRefresh()\n }\n\n function navigate(item: ElementNavigationItem): void {\n const root = scrollRoot.value\n if (!root) return\n const rootTop = root.getBoundingClientRect().top\n const targetTop = item.target.getBoundingClientRect().top\n root.scrollTo({ top: root.scrollTop + targetTop - rootTop - 18, behavior: 'smooth' })\n }\n\n onBeforeUnmount(() => {\n stopRootWatch()\n listeningRoot?.removeEventListener('scroll', queueRefresh)\n if (frame && typeof cancelAnimationFrame !== 'undefined') cancelAnimationFrame(frame)\n })\n\n return {\n outlineItems,\n pageItems,\n activeOutlineId,\n activePageId,\n setItems,\n navigate,\n }\n}\n"],"mappings":";;AAeA,SAAgB,EAAqB,GAAsD;CACzF,IAAM,IAAe,EAAoC,CAAC,CAAC,GACrD,IAAY,EAAoC,CAAC,CAAC,GAClD,IAAkB,EAAW,EAAE,GAC/B,IAAe,EAAW,EAAE,GAE9B,IAAQ,GACR,IAAoC;CAExC,SAAS,EAAW,GAAyC,GAAc;EACzE,IAAI,CAAC,EAAM,QAAQ;EACnB,IAAI,IAAS,EAAM;EACnB,KAAK,IAAM,KAAQ,GAAO;GACxB,IAAI,EAAK,OAAO,sBAAsB,CAAC,CAAC,MAAM,GAAM;GACpD,IAAS;EACX;EACA,OAAO;CACT;CAEA,SAAS,IAAsB;EAC7B,IAAQ;EACR,IAAM,IAAO,EAAW;EACxB,IAAI,CAAC,GAAM;EACX,IAAM,IAAO,EAAK,sBAAsB,CAAC,CAAC,MAAM;EAEhD,AADA,EAAgB,QAAQ,EAAW,EAAa,OAAO,CAAI,CAAC,EAAE,MAAM,IACpE,EAAa,QAAQ,EAAW,EAAU,OAAO,CAAI,CAAC,EAAE,MAAM;CAChE;CAEA,SAAS,IAAqB;EACxB,QACJ;OAAI,OAAO,wBAA0B,KAAa;IAChD,EAAc;IACd;GACF;GACA,IAAQ,sBAAsB,CAAa;EAD3C;CAEF;CAEA,SAAS,EAAS,GAAgC;EAIhD,AAHA,GAAe,oBAAoB,UAAU,CAAY,GACzD,IAAgB,GAChB,GAAe,iBAAiB,UAAU,GAAc,EAAE,SAAS,GAAK,CAAC,GACzE,EAAa;CACf;CAEA,IAAM,IAAgB,EAAM,GAAY,GAAU;EAAE,WAAW;EAAM,OAAO;CAAO,CAAC;CAEpF,SAAS,EACP,GACA,GACM;EAKN,AAJA,EAAa,QAAQ,CAAC,GAAG,CAAO,GAChC,EAAU,QAAQ,CAAC,GAAG,CAAK,GAC3B,EAAgB,QAAQ,EAAQ,EAAE,EAAE,MAAM,IAC1C,EAAa,QAAQ,EAAM,EAAE,EAAE,MAAM,IACrC,EAAa;CACf;CAEA,SAAS,EAAS,GAAmC;EACnD,IAAM,IAAO,EAAW;EACxB,IAAI,CAAC,GAAM;EACX,IAAM,IAAU,EAAK,sBAAsB,CAAC,CAAC,KACvC,IAAY,EAAK,OAAO,sBAAsB,CAAC,CAAC;EACtD,EAAK,SAAS;GAAE,KAAK,EAAK,YAAY,IAAY,IAAU;GAAI,UAAU;EAAS,CAAC;CACtF;CAQA,OANA,QAAsB;EAGpB,AAFA,EAAc,GACd,GAAe,oBAAoB,UAAU,CAAY,GACrD,KAAS,OAAO,uBAAyB,OAAa,qBAAqB,CAAK;CACtF,CAAC,GAEM;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileViewer.js","names":[],"sources":["../../src/composables/useFileViewer.ts"],"sourcesContent":["import { computed, ref } from 'vue'\n\n/** A file opened in the side viewer: its display name, fetch/download URL, and highlight language. */\nexport interface ViewerFile {\n name: string\n /** Download endpoint URL — fetched as text and reused by the download button. Omit when `content` is set. */\n url?: string\n /** highlight.js language id, '' for plain text, or 'markdown' (the panel renders markdown instead of highlighting). */\n lang: string\n /** HTML document: the panel offers a render/source toggle, rendering the markup in a sandboxed iframe. */\n html?: boolean\n /** SVG document: the panel offers a render/source toggle — render shows the picture, source the XML. */\n svg?: boolean\n /** ZIP archive: the panel fetches the bytes and hands them to the in-browser archive browser. */\n zip?: boolean\n /** 7z archive: the panel fetches the bytes and hands them to the in-browser 7z browser. */\n sevenZip?: boolean\n /**\n * tar-family ('tar': tar/gz/tgz/xz/txz/bz2/tbz2) or rar ('rar') archive: the panel hands the URL + this\n * kind to the generic in-browser ArchiveBrowser, which decompresses the bytes and browses the entries.\n */\n archive?: 'tar' | 'rar'\n /** Native binary object (.so/.dll): the panel hands the URL to the in-browser symbol browser. */\n binobj?: boolean\n /** E-language (.e/.ec) project: the panel hands the URL to the in-browser EPL viewer (parse + decompile). */\n epl?: boolean\n /** DICOM (.dcm) medical image: the panel hands the URL to the in-browser DICOM viewer. */\n dicom?: boolean\n /** Word (.docx) document: the panel hands the URL to the in-browser Word viewer (docx-preview). */\n docx?: boolean\n /** Excel (.xlsx/.xlsm) workbook: the panel hands the URL to the in-browser spreadsheet viewer (exceljs). */\n xlsx?: boolean\n /** PowerPoint (.pptx/.pptm/.ppsx) deck: the panel hands the URL to the in-browser slide viewer (pptx-renderer). */\n pptx?: boolean\n /** Rich Text (.rtf) document: the panel hands the URL to the in-browser rich-text viewer (hand-rolled RTF parser). */\n rtf?: boolean\n /** PDF (.pdf) document: the panel hands the URL to the in-browser PDF viewer (pdfjs-dist). */\n pdf?: boolean\n /** OPML / FreeMind (.opml/.mm) outline: the panel fetches the text and renders it as an interactive mind map. */\n mindmap?: boolean\n /** XMind workbook (.xmind): the panel hands the URL to the in-browser XMind viewer (unzip → mind-map tree). */\n xmind?: boolean\n /** Email (.eml) message: the panel hands the URL to the in-browser email viewer (MIME parser). */\n eml?: boolean\n /** Web archive (.mht/.mhtml): the panel hands the URL to the in-browser web-archive viewer (MIME parser). */\n mht?: boolean\n /** HAR (.har) capture: the panel hands the URL to the in-browser HAR viewer (hand-rolled JSON parser). */\n har?: boolean\n /** SQLite database (.sqlite/.db/…): the panel hands the URL to the in-browser SQLite viewer (sql.js). */\n sqlite?: boolean\n /** Certificate / key (.pem/.crt/.der/.csr/.p12/…): the panel hands the URL to the in-browser cert viewer (ASN.1/X.509). */\n cert?: boolean\n /** Keystore (.jks/.keystore/.jceks + PKCS#12 .p12/.pfx): the panel hands the URL to the in-browser keystore viewer (sniffs format, parse + password decrypt). */\n jks?: boolean\n /** Subtitle (.srt/.vtt/.ass/.ssa): the panel renders the fetched text as a parsed cue list (render/source toggle). */\n subtitle?: boolean\n /** CSV / TSV (.csv/.tsv): the panel renders the fetched text as a parsed table (render/source toggle). */\n csv?: boolean\n /** JSON Lines (.jsonl/.ndjson): the panel renders the fetched text as a record list — truncated rows, click to expand (render/source toggle). */\n jsonl?: boolean\n /** Java bytecode (.class): the panel hands the URL to the in-browser class viewer (parse structure → fields/methods). */\n javaClass?: boolean\n /** JVM heap dump (.hprof): the panel hands the URL to the in-browser HPROF viewer (stream-parse → class histogram + per-class object drill-in). */\n hprof?: boolean\n /** Windows Installer (.msi/.msp/.msm): the panel hands the URL to the in-browser MSI viewer (OLE compound file → product identity + summary). */\n msi?: boolean\n /** Windows app package (.appx/.msix/.appxbundle/.msixbundle): the panel hands the URL to the in-browser APPX viewer (unzip manifest → identity/deps/capabilities). */\n appx?: boolean\n /** Font (.ttf/.otf/.woff/.woff2): the panel hands the URL to the in-browser font specimen (FontFace API). */\n font?: boolean\n /** Jupyter Notebook (.ipynb): the panel hands the URL to the in-browser notebook viewer (hand-rolled JSON parser). */\n ipynb?: boolean\n /** Geodata (.geojson/.kml/.gpx): the panel renders the fetched text as an offline SVG map (render/source toggle). */\n geo?: boolean\n /** Audio (mp3/wav/flac/ogg/m4a/aac/opus, or .mid): the panel hands the URL to the in-browser audio player. */\n audio?: boolean\n /** QQ Music encrypted audio (.mflac/.mgg/…): the panel hands the URL to the QMC player (decrypts in-browser, then plays). */\n qmc?: boolean\n /** LRC lyrics (.lrc): the panel hands the URL to the lyrics viewer (self-fetches + sniffs GBK, then renders synced lines). */\n lrc?: boolean\n /** Large text / `.log`: the panel hands the URL to the in-browser streaming log viewer (virtual-scrolled). */\n log?: boolean\n /** 3D model (.stl/.obj/.ply/.glb/.gltf): the panel hands the URL to the in-browser three.js model viewer. */\n model?: boolean\n /** Decoding image (TIFF/PSD/HEIC/RAW): the panel hands the URL + kind to the in-browser raster viewer. */\n raster?: 'tiff' | 'psd' | 'heic' | 'raw'\n /** E-book (EPUB/FB2/MOBI/DjVu): the panel hands the URL + kind to the in-browser e-book reader. */\n ebook?: 'epub' | 'fb2' | 'mobi' | 'djvu'\n /** Diagram (.drawio/.excalidraw): the panel renders the fetched text as an SVG (render/source toggle). */\n diagram?: 'drawio' | 'excalidraw'\n /** DXF (.dxf) CAD drawing: the panel hands the URL to the in-browser DXF viewer (parse → SVG, pan/zoom/layers). */\n dxf?: boolean\n /**\n * Raster image (png/jpg/…/svg-as-picture): rendered inline as a zoomable picture. The main FileChip flow\n * routes images to the LIGHTBOX, so this is set only for archive entries (browsed inside the side viewer,\n * where there is no lightbox) — see classifyViewerFile.\n */\n image?: boolean\n /** Video (mp4/webm/…): rendered inline with a native <video> player. Like {@link image}, set only for archive entries. */\n video?: boolean\n /** Unpreviewable binary: the body shows a \"can't preview — download\" card. Set only for archive entries with no matching viewer. */\n binary?: boolean\n /**\n * Hex dump: the panel hands the URL to the in-browser hex viewer (offset + raw bytes + ASCII gutter). Never\n * auto-detected — set only when the user picks \"十六进制\" from the unpreviewable-binary card's \"open with\"\n * chooser (any bytes can be inspected this way), see FileViewerBody.\n */\n hex?: boolean\n /** File size in bytes (from the manifest) when known — drives the symbol browser's large-file gate. */\n size?: number\n /** Inline text to render directly (e.g. a loaded skill's SKILL.md) — when set, the panel skips fetching. */\n content?: string\n}\n\n// Module-level singleton: a file chip (deep in the message tree) opens the viewer, and the panel\n// (mounted by DetailView) reads the same ref. The detail view closes it on navigation/unmount.\nconst current = ref<ViewerFile | null>(null)\n\n// Shared panel width (px), driven by the drag splitter. DetailView feeds it into `--fv-width` so the\n// conversation column reflows and the panel resizes together; the panel reads it for the drag baseline.\nconst MIN_WIDTH = 360\nconst MAX_WIDTH = 760\n\n// Open at the viewer's original responsive width — clamp(360, 42vw, 760) — so it starts wide; the\n// drag splitter adjusts from there. (No window under SSR: fall back to a sensible fixed default.)\nfunction defaultWidth(): number {\n if (typeof window === 'undefined') return 680\n return Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, Math.round(window.innerWidth * 0.42)))\n}\nconst width = ref(defaultWidth())\n\n/** Clamp to a sane range: never narrower than MIN_WIDTH, and always leave ~320px for the conversation. */\nfunction setWidth(px: number): void {\n const max = typeof window !== 'undefined' ? Math.max(MIN_WIDTH, window.innerWidth - 320) : 900\n width.value = Math.min(max, Math.max(MIN_WIDTH, Math.round(px)))\n}\n\nexport function useFileViewer() {\n return {\n current,\n width,\n setWidth,\n isOpen: computed(() => current.value !== null),\n open(file: ViewerFile): void {\n current.value = file\n },\n close(): void {\n current.value = null\n },\n }\n}\n"],"mappings":";;AAoHA,IAAM,IAAU,EAAuB,IAAI,GAIrC,IAAY,KACZ,IAAY;AAIlB,SAAS,IAAuB;CAE9B,OADI,OAAO,SAAW,MAAoB,MACnC,KAAK,IAAI,GAAW,KAAK,IAAI,GAAW,KAAK,MAAM,OAAO,aAAa,GAAI,CAAC,CAAC;AACtF;AACA,IAAM,IAAQ,EAAI,EAAa,CAAC;AAGhC,SAAS,EAAS,GAAkB;CAClC,IAAM,IAAM,OAAO,SAAW,MAAc,KAAK,IAAI,GAAW,OAAO,aAAa,GAAG,IAAI;CAC3F,EAAM,QAAQ,KAAK,IAAI,GAAK,KAAK,IAAI,GAAW,KAAK,MAAM,CAAE,CAAC,CAAC;AACjE;AAEA,SAAgB,IAAgB;CAC9B,OAAO;EACL;EACA;EACA;EACA,QAAQ,QAAe,EAAQ,UAAU,IAAI;EAC7C,KAAK,GAAwB;GAC3B,EAAQ,QAAQ;EAClB;EACA,QAAc;GACZ,EAAQ,QAAQ;EAClB;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLightbox.js","names":[],"sources":["../../src/composables/useLightbox.ts"],"sourcesContent":["import { computed, ref } from 'vue'\n\n/** Media shown full-screen in the lightbox: its source URL, an alt/title, and the kind to render. */\nexport interface LightboxImage {\n src: string\n alt?: string\n /** 'video' fetches the source and plays it in a <video> (blob-backed); default 'image' shows an <img>. */\n kind?: 'image' | 'video'\n /** A \"long image\" (tall screenshot): show it at a readable width inside a vertical-scroll frame, not letterboxed. */\n long?: boolean\n}\n\n// Module-level singleton: a thumbnail anywhere in the message tree opens the lightbox, and the single\n// ImageLightbox overlay (mounted in App.vue) reads the same ref. Mirrors useFileViewer's pattern.\nconst current = ref<LightboxImage | null>(null)\n\nexport function useLightbox() {\n return {\n current,\n isOpen: computed(() => current.value !== null),\n open(img: LightboxImage): void {\n if (img.src) current.value = img\n },\n close(): void {\n current.value = null\n },\n }\n}\n"],"mappings":";;AAcA,IAAM,IAAU,EAA0B,IAAI;AAE9C,SAAgB,IAAc;CAC5B,OAAO;EACL;EACA,QAAQ,QAAe,EAAQ,UAAU,IAAI;EAC7C,KAAK,GAA0B;GAC7B,AAAI,EAAI,QAAK,EAAQ,QAAQ;EAC/B;EACA,QAAc;GACZ,EAAQ,QAAQ;EAClB;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogRules.js","names":[],"sources":["../../src/composables/useLogRules.ts"],"sourcesContent":["import { ref, watch } from 'vue'\n\n/**\n * A single line-coloring rule for the log viewer: match lines by substring or regex, then paint their\n * background and/or text. Rules apply top-to-bottom, first match wins (see LogViewer's `styleFor`).\n */\nexport interface ColorRule {\n id: string\n pattern: string\n regex: boolean // treat `pattern` as a RegExp instead of a plain substring\n caseSensitive: boolean\n bgOn: boolean\n bg: string // hex background color, applied when bgOn\n fgOn: boolean\n fg: string // hex text color, applied when fgOn\n enabled: boolean\n}\n\nconst STORAGE_KEY = 'viewer-log-color-rules'\n\nfunction newId(): string {\n try {\n return crypto.randomUUID()\n } catch {\n // Non-secure contexts / very old engines lack randomUUID — a timestamp-ish id is unique enough for a\n // local, per-browser preference list.\n return 'r' + Date.now().toString(36) + Math.floor(Math.random() * 1e9).toString(36)\n }\n}\n\nexport function defaultRule(): ColorRule {\n return {\n id: newId(),\n pattern: '',\n regex: false,\n caseSensitive: false,\n bgOn: true,\n bg: '#fde68a',\n fgOn: false,\n fg: '#111827',\n enabled: true,\n }\n}\n\n// Tolerate absent / partial / garbled persisted entries by filling each field from a default.\nfunction sanitize(x: unknown): ColorRule | null {\n if (!x || typeof x !== 'object') return null\n const o = x as Record<string, unknown>\n const d = defaultRule()\n return {\n id: typeof o.id === 'string' ? o.id : d.id,\n pattern: typeof o.pattern === 'string' ? o.pattern : '',\n regex: !!o.regex,\n caseSensitive: !!o.caseSensitive,\n bgOn: o.bgOn !== false,\n bg: typeof o.bg === 'string' ? o.bg : d.bg,\n fgOn: !!o.fgOn,\n fg: typeof o.fg === 'string' ? o.fg : d.fg,\n enabled: o.enabled !== false,\n }\n}\n\nfunction readInitial(): ColorRule[] {\n if (typeof localStorage !== 'undefined') {\n try {\n const raw = localStorage.getItem(STORAGE_KEY)\n if (raw) {\n const arr = JSON.parse(raw)\n if (Array.isArray(arr)) {\n return arr.map(sanitize).filter((r): r is ColorRule => r !== null)\n }\n }\n } catch {\n // Malformed JSON — ignore and start empty.\n }\n }\n return []\n}\n\n// Module-level singleton so rules persist across files, viewer re-mounts, and reloads.\nconst rules = ref<ColorRule[]>(readInitial())\nwatch(\n rules,\n (v) => {\n if (typeof localStorage !== 'undefined') {\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(v))\n } catch {\n // Storage full / disabled — the rules still work for this session.\n }\n }\n },\n { deep: true },\n)\n\n/**\n * Persisted, browser-global line-coloring rules for the log viewer. A singleton (like {@link useListPrefs})\n * so the set sticks across navigation and reloads; every mutation reassigns/deep-touches `rules` so the\n * watcher writes through to localStorage.\n */\nexport function useLogRules() {\n function add(): void {\n rules.value = [...rules.value, defaultRule()]\n }\n function remove(id: string): void {\n rules.value = rules.value.filter((r) => r.id !== id)\n }\n // Reorder (first-match precedence): swap a rule with its neighbor.\n function move(id: string, dir: -1 | 1): void {\n const arr = [...rules.value]\n const i = arr.findIndex((r) => r.id === id)\n const j = i + dir\n if (i < 0 || j < 0 || j >= arr.length) return\n ;[arr[i], arr[j]] = [arr[j], arr[i]]\n rules.value = arr\n }\n return { rules, add, remove, move }\n}\n"],"mappings":";;AAkBA,IAAM,IAAc;AAEpB,SAAS,IAAgB;CACvB,IAAI;EACF,OAAO,OAAO,WAAW;CAC3B,QAAQ;EAGN,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,SAAS,EAAE,IAAI,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE;CACpF;AACF;AAEA,SAAgB,IAAyB;CACvC,OAAO;EACL,IAAI,EAAM;EACV,SAAS;EACT,OAAO;EACP,eAAe;EACf,MAAM;EACN,IAAI;EACJ,MAAM;EACN,IAAI;EACJ,SAAS;CACX;AACF;AAGA,SAAS,EAAS,GAA8B;CAC9C,IAAI,CAAC,KAAK,OAAO,KAAM,UAAU,OAAO;CACxC,IAAM,IAAI,GACJ,IAAI,EAAY;CACtB,OAAO;EACL,IAAI,OAAO,EAAE,MAAO,WAAW,EAAE,KAAK,EAAE;EACxC,SAAS,OAAO,EAAE,WAAY,WAAW,EAAE,UAAU;EACrD,OAAO,CAAC,CAAC,EAAE;EACX,eAAe,CAAC,CAAC,EAAE;EACnB,MAAM,EAAE,SAAS;EACjB,IAAI,OAAO,EAAE,MAAO,WAAW,EAAE,KAAK,EAAE;EACxC,MAAM,CAAC,CAAC,EAAE;EACV,IAAI,OAAO,EAAE,MAAO,WAAW,EAAE,KAAK,EAAE;EACxC,SAAS,EAAE,YAAY;CACzB;AACF;AAEA,SAAS,IAA2B;CAClC,IAAI,OAAO,eAAiB,KAC1B,IAAI;EACF,IAAM,IAAM,aAAa,QAAQ,CAAW;EAC5C,IAAI,GAAK;GACP,IAAM,IAAM,KAAK,MAAM,CAAG;GAC1B,IAAI,MAAM,QAAQ,CAAG,GACnB,OAAO,EAAI,IAAI,CAAQ,CAAC,CAAC,QAAQ,MAAsB,MAAM,IAAI;EAErE;CACF,QAAQ,CAER;CAEF,OAAO,CAAC;AACV;AAGA,IAAM,IAAQ,EAAiB,EAAY,CAAC;AAC5C,EACE,IACC,MAAM;CACL,IAAI,OAAO,eAAiB,KAC1B,IAAI;EACF,aAAa,QAAQ,GAAa,KAAK,UAAU,CAAC,CAAC;CACrD,QAAQ,CAER;AAEJ,GACA,EAAE,MAAM,GAAK,CACf;AAOA,SAAgB,IAAc;CAC5B,SAAS,IAAY;EACnB,EAAM,QAAQ,CAAC,GAAG,EAAM,OAAO,EAAY,CAAC;CAC9C;CACA,SAAS,EAAO,GAAkB;EAChC,EAAM,QAAQ,EAAM,MAAM,QAAQ,MAAM,EAAE,OAAO,CAAE;CACrD;CAEA,SAAS,EAAK,GAAY,GAAmB;EAC3C,IAAM,IAAM,CAAC,GAAG,EAAM,KAAK,GACrB,IAAI,EAAI,WAAW,MAAM,EAAE,OAAO,CAAE,GACpC,IAAI,IAAI;EACV,IAAI,KAAK,IAAI,KAAK,KAAK,EAAI,WAC9B,CAAC,EAAI,IAAI,EAAI,MAAM,CAAC,EAAI,IAAI,EAAI,EAAE,GACnC,EAAM,QAAQ;CAChB;CACA,OAAO;EAAE;EAAO;EAAK;EAAQ;CAAK;AACpC"}
|
package/dist/lib/aes.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aes.js","names":[],"sources":["../../src/lib/aes.ts"],"sourcesContent":["/**\n * Compact AES shared by the in-browser archive viewers — no dependency, no WASM.\n *\n * The FORWARD cipher drives CTR mode (WinZip-AES ZIP extraction, see {@link lib/zip.ts}); the INVERSE\n * cipher drives CBC decryption (AES-256 encrypted 7z extraction, see {@link lib/sevenZip.ts}). The S-box is\n * generated from the GF(2^8) affine transform (not tabled); the inverse S-box and the GF multiplies for\n * InvMixColumns are derived from it. Key derivation (PBKDF2 / SHA-256) stays in each caller via WebCrypto —\n * this module is pure block/mode math and stays synchronous.\n *\n * State layout is column-major: byte `s[4*col + row]`, matching the AES spec's column words. Encrypt and\n * decrypt share the key schedule and AddRoundKey; only Sub/Shift/Mix differ (forward vs inverse).\n */\n\n// S-box generated from the affine transform over GF(2^8).\nconst SBOX = /* @__PURE__ */ (() => {\n const sbox = new Uint8Array(256)\n const rotl8 = (x: number, s: number): number => ((x << s) | (x >> (8 - s))) & 0xff\n let p = 1\n let q = 1\n do {\n p = (p ^ (p << 1) ^ (p & 0x80 ? 0x11b : 0)) & 0xff\n q ^= q << 1\n q ^= q << 2\n q ^= q << 4\n q &= 0xff\n if (q & 0x80) q ^= 0x09\n q &= 0xff\n sbox[p] = (q ^ rotl8(q, 1) ^ rotl8(q, 2) ^ rotl8(q, 3) ^ rotl8(q, 4) ^ 0x63) & 0xff\n } while (p !== 1)\n sbox[0] = 0x63\n return sbox\n})()\n// Inverse S-box: INV_SBOX[SBOX[i]] = i.\nconst INV_SBOX = /* @__PURE__ */ (() => {\n const inv = new Uint8Array(256)\n for (let i = 0; i < 256; i++) inv[SBOX[i]] = i\n return inv\n})()\nconst RCON = new Uint8Array([0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c])\nconst xtime = (a: number): number => ((a << 1) ^ (a & 0x80 ? 0x11b : 0)) & 0xff\n// GF(2^8) multiply (peasant) — only InvMixColumns needs the {09,0b,0d,0e} multiplies.\nfunction gmul(a: number, b: number): number {\n let p = 0\n for (let i = 0; i < 8 && b; i++) {\n if (b & 1) p ^= a\n const hi = a & 0x80\n a = (a << 1) & 0xff\n if (hi) a ^= 0x1b\n b >>= 1\n }\n return p & 0xff\n}\n\n/** Expand a 16/24/32-byte key into the round-key word schedule. */\nexport function aesKeySchedule(key: Uint8Array): Uint32Array {\n const Nk = key.length / 4\n const Nr = Nk + 6\n const w = new Uint32Array(4 * (Nr + 1))\n for (let i = 0; i < Nk; i++) {\n w[i] =\n ((key[4 * i] << 24) | (key[4 * i + 1] << 16) | (key[4 * i + 2] << 8) | key[4 * i + 3]) >>> 0\n }\n const sub = (x: number): number =>\n ((SBOX[(x >>> 24) & 0xff] << 24) |\n (SBOX[(x >>> 16) & 0xff] << 16) |\n (SBOX[(x >>> 8) & 0xff] << 8) |\n SBOX[x & 0xff]) >>>\n 0\n const rot = (x: number): number => ((x << 8) | (x >>> 24)) >>> 0\n for (let i = Nk; i < w.length; i++) {\n let t = w[i - 1]\n if (i % Nk === 0) t = (sub(rot(t)) ^ (RCON[i / Nk - 1] << 24)) >>> 0\n else if (Nk > 6 && i % Nk === 4) t = sub(t)\n w[i] = (w[i - Nk] ^ t) >>> 0\n }\n return w\n}\n\nfunction addRoundKey(s: Uint8Array, w: Uint32Array, round: number): void {\n for (let c = 0; c < 4; c++) {\n const k = w[round * 4 + c]\n s[4 * c] ^= (k >>> 24) & 0xff\n s[4 * c + 1] ^= (k >>> 16) & 0xff\n s[4 * c + 2] ^= (k >>> 8) & 0xff\n s[4 * c + 3] ^= k & 0xff\n }\n}\n\n/** Encrypt one 16-byte block in place into `out` (forward cipher). */\nexport function aesEncryptBlock(w: Uint32Array, block: Uint8Array, out: Uint8Array): void {\n const Nr = w.length / 4 - 1\n const s = out\n s.set(block)\n addRoundKey(s, w, 0)\n for (let round = 1; round <= Nr; round++) {\n for (let i = 0; i < 16; i++) s[i] = SBOX[s[i]]\n // ShiftRows (row r rotates LEFT by r)\n let tmp = s[1]\n s[1] = s[5]\n s[5] = s[9]\n s[9] = s[13]\n s[13] = tmp\n tmp = s[2]\n s[2] = s[10]\n s[10] = tmp\n tmp = s[6]\n s[6] = s[14]\n s[14] = tmp\n tmp = s[15]\n s[15] = s[11]\n s[11] = s[7]\n s[7] = s[3]\n s[3] = tmp\n if (round < Nr) {\n for (let c = 0; c < 4; c++) {\n const i = 4 * c\n const a0 = s[i]\n const a1 = s[i + 1]\n const a2 = s[i + 2]\n const a3 = s[i + 3]\n const t = a0 ^ a1 ^ a2 ^ a3\n s[i] ^= t ^ xtime(a0 ^ a1)\n s[i + 1] ^= t ^ xtime(a1 ^ a2)\n s[i + 2] ^= t ^ xtime(a2 ^ a3)\n s[i + 3] ^= t ^ xtime(a3 ^ a0)\n }\n }\n addRoundKey(s, w, round)\n }\n}\n\n/** Decrypt one 16-byte block in place into `out` (inverse cipher). */\nexport function aesDecryptBlock(w: Uint32Array, block: Uint8Array, out: Uint8Array): void {\n const Nr = w.length / 4 - 1\n const s = out\n s.set(block)\n addRoundKey(s, w, Nr)\n for (let round = Nr - 1; round >= 0; round--) {\n // InvShiftRows (row r rotates RIGHT by r)\n let tmp = s[13]\n s[13] = s[9]\n s[9] = s[5]\n s[5] = s[1]\n s[1] = tmp\n tmp = s[2]\n s[2] = s[10]\n s[10] = tmp\n tmp = s[6]\n s[6] = s[14]\n s[14] = tmp\n tmp = s[3]\n s[3] = s[7]\n s[7] = s[11]\n s[11] = s[15]\n s[15] = tmp\n for (let i = 0; i < 16; i++) s[i] = INV_SBOX[s[i]]\n addRoundKey(s, w, round)\n if (round > 0) {\n for (let c = 0; c < 4; c++) {\n const i = 4 * c\n const a0 = s[i]\n const a1 = s[i + 1]\n const a2 = s[i + 2]\n const a3 = s[i + 3]\n s[i] = gmul(a0, 14) ^ gmul(a1, 11) ^ gmul(a2, 13) ^ gmul(a3, 9)\n s[i + 1] = gmul(a0, 9) ^ gmul(a1, 14) ^ gmul(a2, 11) ^ gmul(a3, 13)\n s[i + 2] = gmul(a0, 13) ^ gmul(a1, 9) ^ gmul(a2, 14) ^ gmul(a3, 11)\n s[i + 3] = gmul(a0, 11) ^ gmul(a1, 13) ^ gmul(a2, 9) ^ gmul(a3, 14)\n }\n }\n }\n}\n\n/** WinZip AES-CTR keystream (counter is a 16-byte LITTLE-endian integer starting at 1) XORed over `data`. */\nexport function aesCtrXor(key: Uint8Array, data: Uint8Array): Uint8Array {\n const w = aesKeySchedule(key)\n const out = new Uint8Array(data.length)\n const counter = new Uint8Array(16)\n const ks = new Uint8Array(16)\n let block = 1\n for (let off = 0; off < data.length; off += 16) {\n let v = block++\n for (let i = 0; i < 8; i++) {\n counter[i] = v & 0xff\n v = Math.floor(v / 256)\n }\n aesEncryptBlock(w, counter, ks)\n const n = Math.min(16, data.length - off)\n for (let i = 0; i < n; i++) out[off + i] = data[off + i] ^ ks[i]\n }\n return out\n}\n\n/**\n * AES-CBC decrypt (no padding removal — 7z stores the real output length separately and its ciphertext is a\n * whole number of blocks). `iv` is 16 bytes; only full 16-byte blocks of `data` are processed.\n */\nexport function aesCbcDecrypt(key: Uint8Array, iv: Uint8Array, data: Uint8Array): Uint8Array {\n const w = aesKeySchedule(key)\n const n = data.length - (data.length % 16)\n const out = new Uint8Array(n)\n const dec = new Uint8Array(16)\n const prev = new Uint8Array(16)\n prev.set(iv.subarray(0, 16))\n for (let off = 0; off < n; off += 16) {\n const block = data.subarray(off, off + 16)\n aesDecryptBlock(w, block, dec)\n for (let i = 0; i < 16; i++) out[off + i] = dec[i] ^ prev[i]\n prev.set(block)\n }\n return out\n}\n"],"mappings":";AAcA,IAAM,IAAuB,uBAAO;CAClC,IAAM,IAAO,IAAI,WAAW,GAAG,GACzB,KAAS,GAAW,OAAwB,KAAK,IAAM,KAAM,IAAI,KAAO,KAC1E,IAAI,GACJ,IAAI;CACR;EAQE,AAPA,KAAK,IAAK,KAAK,KAAM,IAAI,MAAO,MAAQ,MAAM,KAC9C,KAAK,KAAK,GACV,KAAK,KAAK,GACV,KAAK,KAAK,GACV,KAAK,KACD,IAAI,QAAM,KAAK,IACnB,KAAK,KACL,EAAK,MAAM,IAAI,EAAM,GAAG,CAAC,IAAI,EAAM,GAAG,CAAC,IAAI,EAAM,GAAG,CAAC,IAAI,EAAM,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,EAAK,SAAS,GAAK,IAAM,EAAE;EACzC,EAAgB,GAAG,GAAO,CAAG;EAC7B,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,EAAI,IAAM,KAAK,EAAI,KAAK,EAAK;EAC1D,EAAK,IAAI,CAAK;CAChB;CACA,OAAO;AACT"}
|
package/dist/lib/appx.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appx.js","names":[],"sources":["../../src/lib/appx.ts"],"sourcesContent":["/**\n * In-browser APPX / MSIX package reader — no dependency beyond the project's own ZIP reader.\n *\n * An `.appx`/`.msix` (and `.appxbundle`/`.msixbundle`) is NOT a PE and NOT an OLE compound file — it's an\n * **OPC ZIP archive** (the same container `.docx`/`.jar` use). Its metadata lives in an XML manifest inside:\n * - a single package: `AppxManifest.xml` — `<Identity>` (name/version/arch/publisher), `<Properties>`\n * (display + publisher names), `<Dependencies>` (target OS + package deps), `<Capabilities>`,\n * `<Applications>`, and the declared `<Resources>` languages.\n * - a bundle: `AppxMetadata/AppxBundleManifest.xml` — `<Identity>` + the list of contained `<Package>`s.\n *\n * We decompress just the manifest with the project's ZIP reader (lib/zip.ts — browser-native DEFLATE) and\n * read the fields with the DOM (namespace-agnostic local-name matching, since real manifests sprinkle uap/\n * rescap/wincap prefixes). The manifest structure was checked against a real Microsoft Store `.appx`.\n *\n * Used by AppxViewer (the side viewer's APPX mode): the bytes come from the same download endpoint as any\n * other file, are unzipped + parsed entirely client-side, and never leave the browser.\n */\n\nimport { readZip, extractZipEntry, type ZipEntry } from '@/lib/zip'\n\nexport interface AppxVersionRef {\n name: string\n minVersion?: string\n maxVersionTested?: string\n publisher?: string\n}\nexport interface AppxApp {\n id: string\n displayName?: string\n description?: string\n}\nexport interface AppxBundlePackage {\n type?: string\n architecture?: string\n version?: string\n fileName?: string\n}\n\nexport interface AppxInfo {\n kind: 'package' | 'bundle'\n /** Identity (`<Identity>`): the package family identity. */\n name?: string\n version?: string\n architecture?: string\n /** Raw publisher distinguished name, e.g. \"CN=Microsoft Corporation, …\". */\n publisher?: string\n /** `<Properties>` display fields (DisplayName may be an `ms-resource:…` reference we can't resolve here). */\n displayName?: string\n publisherDisplayName?: string\n description?: string\n /** `<Dependencies>`: target OS families + package dependencies. */\n targetDeviceFamilies: AppxVersionRef[]\n packageDependencies: AppxVersionRef[]\n /** `<Capabilities>` declared capability names (restricted/device ones included). */\n capabilities: string[]\n /** `<Applications>` entry points. */\n applications: AppxApp[]\n /** Declared resource languages (`<Resources><Resource Language=…>`). */\n languages: string[]\n /** For a bundle: the contained packages. */\n bundlePackages: AppxBundlePackage[]\n /** Number of files in the archive. */\n fileCount: number\n notes: string[]\n}\n\n/** Thrown when the bytes aren't an APPX/MSIX (not a zip, or no manifest inside). */\nexport class NotAppxError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'NotAppxError'\n }\n}\n\nexport async function parseAppx(buf: ArrayBuffer): Promise<AppxInfo> {\n let entries: ZipEntry[]\n try {\n entries = readZip(buf)\n } catch {\n throw new NotAppxError('不是有效的 APPX/MSIX(无法读取 ZIP 容器)')\n }\n const find = (path: string): ZipEntry | undefined =>\n entries.find((e) => e.path.toLowerCase() === path.toLowerCase())\n const pkgEntry = find('AppxManifest.xml')\n const bundleEntry = find('AppxMetadata/AppxBundleManifest.xml') ?? find('AppxBundleManifest.xml')\n const manifestEntry = pkgEntry ?? bundleEntry\n if (!manifestEntry) {\n throw new NotAppxError('未找到 AppxManifest.xml(不是 APPX/MSIX 包)')\n }\n\n const bytes = await extractZipEntry(buf, manifestEntry)\n const xml = new TextDecoder('utf-8').decode(bytes)\n const doc = new DOMParser().parseFromString(xml, 'application/xml')\n if (doc.getElementsByTagName('parsererror').length > 0) {\n throw new NotAppxError('AppxManifest.xml 解析失败(XML 无效)')\n }\n const fileCount = entries.filter((e) => !e.isDir).length\n return pkgEntry ? parsePackage(doc, fileCount) : parseBundle(doc, fileCount)\n}\n\n// ── DOM helpers (namespace-agnostic: match by localName, since prefixes vary uap/uap4/rescap/wincap/…) ──\nfunction byLocal(root: Element | Document, local: string): Element[] {\n const all = root.getElementsByTagName('*')\n const out: Element[] = []\n for (let i = 0; i < all.length; i++) if (all[i].localName === local) out.push(all[i])\n return out\n}\nfunction firstLocal(root: Element | Document | null, local: string): Element | null {\n if (!root) return null\n const all = root.getElementsByTagName('*')\n for (let i = 0; i < all.length; i++) if (all[i].localName === local) return all[i]\n return null\n}\nfunction attr(el: Element | null, name: string): string | undefined {\n const v = el?.getAttribute(name)\n return v == null || v === '' ? undefined : v\n}\nfunction textOf(root: Element | null, local: string): string | undefined {\n const t = firstLocal(root, local)?.textContent?.trim()\n return t ? t : undefined\n}\n\nfunction parsePackage(doc: Document, fileCount: number): AppxInfo {\n const identity = firstLocal(doc, 'Identity')\n const props = firstLocal(doc, 'Properties')\n\n const targetDeviceFamilies = byLocal(doc, 'TargetDeviceFamily').map((e) => ({\n name: attr(e, 'Name') ?? '',\n minVersion: attr(e, 'MinVersion'),\n maxVersionTested: attr(e, 'MaxVersionTested'),\n }))\n const packageDependencies = byLocal(doc, 'PackageDependency').map((e) => ({\n name: attr(e, 'Name') ?? '',\n minVersion: attr(e, 'MinVersion'),\n publisher: attr(e, 'Publisher'),\n }))\n\n // Capabilities: any child of <Capabilities> carrying a Name (Capability / rescap:Capability / DeviceCapability…).\n const capabilities: string[] = []\n const capsRoot = firstLocal(doc, 'Capabilities')\n if (capsRoot) {\n const kids = capsRoot.getElementsByTagName('*')\n for (let i = 0; i < kids.length; i++) {\n const n = attr(kids[i], 'Name')\n if (n && !capabilities.includes(n)) capabilities.push(n)\n }\n }\n\n const applications = byLocal(doc, 'Application').map((a) => {\n const ve = firstLocal(a, 'VisualElements')\n return {\n id: attr(a, 'Id') ?? '',\n displayName: attr(ve, 'DisplayName'),\n description: attr(ve, 'Description'),\n }\n })\n\n const languages: string[] = []\n for (const r of byLocal(doc, 'Resource')) {\n const l = attr(r, 'Language')\n if (l && !languages.includes(l)) languages.push(l)\n }\n\n return {\n kind: 'package',\n name: attr(identity, 'Name'),\n version: attr(identity, 'Version'),\n architecture: attr(identity, 'ProcessorArchitecture'),\n publisher: attr(identity, 'Publisher'),\n displayName: textOf(props, 'DisplayName'),\n publisherDisplayName: textOf(props, 'PublisherDisplayName'),\n description: textOf(props, 'Description'),\n targetDeviceFamilies,\n packageDependencies,\n capabilities,\n applications,\n languages,\n bundlePackages: [],\n fileCount,\n notes: [],\n }\n}\n\nfunction parseBundle(doc: Document, fileCount: number): AppxInfo {\n const identity = firstLocal(doc, 'Identity')\n // A bundle manifest lists its contained packages; skip the <Resources> (per-package language slivers).\n const bundlePackages = byLocal(doc, 'Package').map((p) => ({\n type: attr(p, 'Type'),\n architecture: attr(p, 'Architecture'),\n version: attr(p, 'Version'),\n fileName: attr(p, 'FileName'),\n }))\n return {\n kind: 'bundle',\n name: attr(identity, 'Name'),\n version: attr(identity, 'Version'),\n architecture: undefined,\n publisher: attr(identity, 'Publisher'),\n targetDeviceFamilies: [],\n packageDependencies: [],\n capabilities: [],\n applications: [],\n languages: [],\n bundlePackages,\n fileCount,\n notes: [],\n }\n}\n"],"mappings":";;AAmEA,IAAa,IAAb,cAAkC,MAAM;CACtC,YAAY,GAAiB;EAE3B,AADA,MAAM,CAAO,GACb,KAAK,OAAO;CACd;AACF;AAEA,eAAsB,EAAU,GAAqC;CACnE,IAAI;CACJ,IAAI;EACF,IAAU,EAAQ,CAAG;CACvB,QAAQ;EACN,MAAM,IAAI,EAAa,8BAA8B;CACvD;CACA,IAAM,KAAQ,MACZ,EAAQ,MAAM,MAAM,EAAE,KAAK,YAAY,MAAM,EAAK,YAAY,CAAC,GAC3D,IAAW,EAAK,kBAAkB,GAClC,IAAc,EAAK,qCAAqC,KAAK,EAAK,wBAAwB,GAC1F,IAAgB,KAAY;CAClC,IAAI,CAAC,GACH,MAAM,IAAI,EAAa,sCAAsC;CAG/D,IAAM,IAAQ,MAAM,EAAgB,GAAK,CAAa,GAChD,IAAM,IAAI,YAAY,OAA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,IAAM,IAAW,EAAW,GAAK,UAAU,GAErC,IAAiB,EAAQ,GAAK,SAAS,CAAC,CAAC,KAAK,OAAO;EACzD,MAAM,EAAK,GAAG,MAAM;EACpB,cAAc,EAAK,GAAG,cAAc;EACpC,SAAS,EAAK,GAAG,SAAS;EAC1B,UAAU,EAAK,GAAG,UAAU;CAC9B,EAAE;CACF,OAAO;EACL,MAAM;EACN,MAAM,EAAK,GAAU,MAAM;EAC3B,SAAS,EAAK,GAAU,SAAS;EACjC,cAAc,KAAA;EACd,WAAW,EAAK,GAAU,WAAW;EACrC,sBAAsB,CAAC;EACvB,qBAAqB,CAAC;EACtB,cAAc,CAAC;EACf,cAAc,CAAC;EACf,WAAW,CAAC;EACZ;EACA;EACA,OAAO,CAAC;CACV;AACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a renderable HTML document from one entry inside an archive.
|
|
3
|
+
*
|
|
4
|
+
* A selected ZIP entry normally gets a single `blob:` URL. That is enough for the HTML bytes themselves, but
|
|
5
|
+
* relative references such as `./assets/app.js` and `./styles/site.css` have nowhere to resolve: blob URLs have
|
|
6
|
+
* no archive directory behind them. This module treats the archive's flat entry list as a tiny read-only web
|
|
7
|
+
* root, extracts only resources referenced by the selected document, and rewrites those references to `data:`
|
|
8
|
+
* URLs before the document reaches FileViewerBody's sandboxed iframe.
|
|
9
|
+
*
|
|
10
|
+
* `data:` is deliberate rather than `blob:`. FileViewerBody's opt-in interactive iframe uses `allow-scripts`
|
|
11
|
+
* WITHOUT `allow-same-origin`, giving it an opaque origin. Chromium correctly refuses subresource blob URLs
|
|
12
|
+
* minted by the parent from that opaque frame, while data URLs remain loadable. Scripts therefore still run
|
|
13
|
+
* only after the existing explicit opt-in, but both inert CSS/image preview and interactive JS work reliably.
|
|
14
|
+
*/
|
|
15
|
+
export interface ArchiveHtmlEntry {
|
|
16
|
+
path: string;
|
|
17
|
+
name: string;
|
|
18
|
+
size: number;
|
|
19
|
+
isDir: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ArchiveHtmlPreviewOptions<T extends ArchiveHtmlEntry> {
|
|
22
|
+
html: string;
|
|
23
|
+
documentPath: string;
|
|
24
|
+
entries: readonly T[];
|
|
25
|
+
loadEntry: (entry: T) => Uint8Array | Promise<Uint8Array>;
|
|
26
|
+
/** Maximum number of distinct dependency entries automatically extracted. */
|
|
27
|
+
maxResources?: number;
|
|
28
|
+
/** Maximum declared/decoded bytes across automatically extracted dependencies. */
|
|
29
|
+
maxTotalBytes?: number;
|
|
30
|
+
/** Maximum declared/decoded bytes for one dependency. */
|
|
31
|
+
maxEntryBytes?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ArchiveHtmlPreview {
|
|
34
|
+
html: string;
|
|
35
|
+
loadedResources: number;
|
|
36
|
+
skippedResources: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function createArchiveEntryResolver<T extends ArchiveHtmlEntry>(entries: readonly T[]): (ref: string, basePath: string) => T | undefined;
|
|
39
|
+
/** Rewrite CSS `@import` and `url(...)` references through an async archive resource resolver. */
|
|
40
|
+
export declare function rewriteArchiveCssReferences(css: string, resolve: (ref: string, kind: 'css' | 'raw') => string | null | Promise<string | null>): Promise<string>;
|
|
41
|
+
/** Best-effort rewrite for static/dynamic ESM imports and `new URL(x, import.meta.url)` assets. */
|
|
42
|
+
export declare function rewriteArchiveModuleReferences(source: string, resolve: (ref: string, kind: 'module' | 'raw') => string | null | Promise<string | null>): Promise<string>;
|
|
43
|
+
/** Resolve bare ESM specifiers against inline import maps while paths still refer to archive entries. */
|
|
44
|
+
export declare function createArchiveImportMapResolver(sources: readonly string[], documentPath: string): (specifier: string, referrerPath: string) => string | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve one archive HTML entry plus its reachable dependencies into a complete iframe document.
|
|
47
|
+
* Browser-only: DOMParser parses inertly; it neither executes scripts nor fetches the original references.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildArchiveHtmlPreview<T extends ArchiveHtmlEntry>(options: ArchiveHtmlPreviewOptions<T>): Promise<ArchiveHtmlPreview>;
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { fileExt as e } from "./fileType.js";
|
|
2
|
+
import { decodeTextSniff as t } from "./encoding.js";
|
|
3
|
+
import { bytesToBinary as n } from "./mime.js";
|
|
4
|
+
//#region src/lib/archiveHtml.ts
|
|
5
|
+
var r = 512, i = 64 * 1024 * 1024, a = 32 * 1024 * 1024, o = {
|
|
6
|
+
css: "text/css",
|
|
7
|
+
js: "text/javascript",
|
|
8
|
+
mjs: "text/javascript",
|
|
9
|
+
cjs: "text/javascript",
|
|
10
|
+
json: "application/json",
|
|
11
|
+
map: "application/json",
|
|
12
|
+
wasm: "application/wasm",
|
|
13
|
+
html: "text/html",
|
|
14
|
+
htm: "text/html",
|
|
15
|
+
xhtml: "application/xhtml+xml",
|
|
16
|
+
xml: "application/xml",
|
|
17
|
+
svg: "image/svg+xml",
|
|
18
|
+
png: "image/png",
|
|
19
|
+
jpg: "image/jpeg",
|
|
20
|
+
jpeg: "image/jpeg",
|
|
21
|
+
gif: "image/gif",
|
|
22
|
+
webp: "image/webp",
|
|
23
|
+
bmp: "image/bmp",
|
|
24
|
+
ico: "image/x-icon",
|
|
25
|
+
avif: "image/avif",
|
|
26
|
+
mp3: "audio/mpeg",
|
|
27
|
+
wav: "audio/wav",
|
|
28
|
+
ogg: "audio/ogg",
|
|
29
|
+
opus: "audio/opus",
|
|
30
|
+
flac: "audio/flac",
|
|
31
|
+
mp4: "video/mp4",
|
|
32
|
+
webm: "video/webm",
|
|
33
|
+
mov: "video/quicktime",
|
|
34
|
+
woff: "font/woff",
|
|
35
|
+
woff2: "font/woff2",
|
|
36
|
+
ttf: "font/ttf",
|
|
37
|
+
otf: "font/otf",
|
|
38
|
+
eot: "application/vnd.ms-fontobject",
|
|
39
|
+
txt: "text/plain"
|
|
40
|
+
};
|
|
41
|
+
function s(t) {
|
|
42
|
+
return o[e(t)] ?? "application/octet-stream";
|
|
43
|
+
}
|
|
44
|
+
function c(e, t) {
|
|
45
|
+
return `data:${t};base64,${btoa(n(e))}`;
|
|
46
|
+
}
|
|
47
|
+
function l(e) {
|
|
48
|
+
let t = e.search(/[?#]/);
|
|
49
|
+
return t < 0 ? e : e.slice(0, t);
|
|
50
|
+
}
|
|
51
|
+
function u(e) {
|
|
52
|
+
try {
|
|
53
|
+
return decodeURIComponent(e);
|
|
54
|
+
} catch {
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function d(e) {
|
|
59
|
+
let t = [];
|
|
60
|
+
for (let n of u(e).replace(/\\/g, "/").split("/")) if (!(!n || n === ".")) {
|
|
61
|
+
if (n === "..") {
|
|
62
|
+
if (!t.length) return null;
|
|
63
|
+
t.pop();
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
t.push(n);
|
|
67
|
+
}
|
|
68
|
+
return t.join("/");
|
|
69
|
+
}
|
|
70
|
+
function f(e) {
|
|
71
|
+
let t = e.lastIndexOf("/");
|
|
72
|
+
return t < 0 ? "" : e.slice(0, t);
|
|
73
|
+
}
|
|
74
|
+
function p(e) {
|
|
75
|
+
let t = e.trim();
|
|
76
|
+
return !t || t.startsWith("#") || t.startsWith("?") || t.startsWith("//") || /^[a-z][a-z\d+.-]*:/i.test(t);
|
|
77
|
+
}
|
|
78
|
+
function m(e, t) {
|
|
79
|
+
if (p(e)) return [];
|
|
80
|
+
let n = l(e.trim());
|
|
81
|
+
if (!n) return [];
|
|
82
|
+
let r = d(t) ?? "", i = f(r), a = n.replace(/\\/g, "/"), o = [];
|
|
83
|
+
if (a.startsWith("/")) {
|
|
84
|
+
let e = d(a.slice(1));
|
|
85
|
+
e && o.push(e);
|
|
86
|
+
let t = r.split("/")[0];
|
|
87
|
+
if (t && r.includes("/") && e) {
|
|
88
|
+
let n = d(`${t}/${e}`);
|
|
89
|
+
n && o.push(n);
|
|
90
|
+
}
|
|
91
|
+
if (i && e) {
|
|
92
|
+
let t = d(`${i}/${e}`);
|
|
93
|
+
t && o.push(t);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
let e = d(i ? `${i}/${a}` : a);
|
|
97
|
+
e && o.push(e);
|
|
98
|
+
}
|
|
99
|
+
return o;
|
|
100
|
+
}
|
|
101
|
+
function h(e) {
|
|
102
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
103
|
+
for (let r of e) {
|
|
104
|
+
if (r.isDir) continue;
|
|
105
|
+
let e = d(r.path);
|
|
106
|
+
if (!e) continue;
|
|
107
|
+
t.set(e, r);
|
|
108
|
+
let i = e.toLocaleLowerCase();
|
|
109
|
+
n.has(i) ? n.set(i, null) : n.set(i, r);
|
|
110
|
+
}
|
|
111
|
+
let r = (e) => t.get(e) || (n.get(e.toLocaleLowerCase()) ?? void 0);
|
|
112
|
+
return (e, t) => {
|
|
113
|
+
for (let n of m(e, t)) {
|
|
114
|
+
let e = r(n);
|
|
115
|
+
if (e) return e;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async function g(e, t, n) {
|
|
120
|
+
let r = t.flags.includes("g") ? t.flags : t.flags + "g", i = new RegExp(t.source, r), a = "", o = 0, s;
|
|
121
|
+
for (; (s = i.exec(e)) !== null;) a += e.slice(o, s.index), a += await n(s), o = s.index + s[0].length, s[0].length === 0 && i.lastIndex++;
|
|
122
|
+
return a + e.slice(o);
|
|
123
|
+
}
|
|
124
|
+
async function _(e, t) {
|
|
125
|
+
let n = await g(e, /@import\s+(?:url\(\s*)?(['"]?)([^'"\s)]+)\1\s*\)?/gi, async (e) => {
|
|
126
|
+
let n = await t(e[2], "css");
|
|
127
|
+
return n ? `@import url("${n}")` : e[0];
|
|
128
|
+
});
|
|
129
|
+
return n = await g(n, /url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, async (e) => {
|
|
130
|
+
let n = await t(e[2].trim(), "raw");
|
|
131
|
+
return n ? `url("${n}")` : e[0];
|
|
132
|
+
}), n;
|
|
133
|
+
}
|
|
134
|
+
async function v(e, t) {
|
|
135
|
+
let n = await g(e, /\b((?:import|export)[^'";]*?\bfrom\s*)(['"])([^'"]+)\2/g, async (e) => {
|
|
136
|
+
let n = await t(e[3], "module");
|
|
137
|
+
return n ? `${e[1]}${e[2]}${n}${e[2]}` : e[0];
|
|
138
|
+
});
|
|
139
|
+
return n = await g(n, /\b(import\s*)(['"])([^'"]+)\2/g, async (e) => {
|
|
140
|
+
let n = await t(e[3], "module");
|
|
141
|
+
return n ? `${e[1]}${e[2]}${n}${e[2]}` : e[0];
|
|
142
|
+
}), n = await g(n, /\b(import\s*\(\s*)(['"])([^'"]+)\2(\s*\))/g, async (e) => {
|
|
143
|
+
let n = await t(e[3], "module");
|
|
144
|
+
return n ? `${e[1]}${e[2]}${n}${e[2]}${e[4]}` : e[0];
|
|
145
|
+
}), n = await g(n, /\bnew\s+URL\(\s*(['"])([^'"]+)\1\s*,\s*import\.meta\.url\s*\)/g, async (e) => {
|
|
146
|
+
let n = await t(e[2], "raw");
|
|
147
|
+
return n ? `new URL(${JSON.stringify(n)})` : e[0];
|
|
148
|
+
}), n;
|
|
149
|
+
}
|
|
150
|
+
function y(e) {
|
|
151
|
+
let t = {}, n = {};
|
|
152
|
+
for (let r of e) try {
|
|
153
|
+
let e = JSON.parse(r);
|
|
154
|
+
if (!e || typeof e != "object" || Array.isArray(e)) continue;
|
|
155
|
+
let i = e;
|
|
156
|
+
if (i.imports && typeof i.imports == "object" && !Array.isArray(i.imports)) for (let [e, n] of Object.entries(i.imports)) !(e in t) && (typeof n == "string" || n === null) && (t[e] = n);
|
|
157
|
+
if (i.scopes && typeof i.scopes == "object" && !Array.isArray(i.scopes)) for (let [e, t] of Object.entries(i.scopes)) {
|
|
158
|
+
if (!t || typeof t != "object" || Array.isArray(t)) continue;
|
|
159
|
+
let r = n[e] ??= {};
|
|
160
|
+
for (let [e, n] of Object.entries(t)) !(e in r) && (typeof n == "string" || n === null) && (r[e] = n);
|
|
161
|
+
}
|
|
162
|
+
} catch {}
|
|
163
|
+
return {
|
|
164
|
+
imports: t,
|
|
165
|
+
scopes: n
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function b(e, t) {
|
|
169
|
+
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
170
|
+
let n = "";
|
|
171
|
+
for (let r of Object.keys(e)) r.endsWith("/") && t.startsWith(r) && r.length > n.length && (n = r);
|
|
172
|
+
if (!n) return;
|
|
173
|
+
let r = e[n];
|
|
174
|
+
return r === null || !r.endsWith("/") ? null : r + t.slice(n.length);
|
|
175
|
+
}
|
|
176
|
+
function x(e, t) {
|
|
177
|
+
let n = y(e);
|
|
178
|
+
return (e, r) => {
|
|
179
|
+
let i;
|
|
180
|
+
for (let [e, a] of Object.entries(n.scopes)) for (let n of m(e, t)) {
|
|
181
|
+
let e = n.replace(/\/$/, "");
|
|
182
|
+
(r === e || r.startsWith(`${e}/`)) && (!i || e.length > i.prefix.length) && (i = {
|
|
183
|
+
prefix: e,
|
|
184
|
+
entries: a
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
let a = i ? b(i.entries, e) : void 0;
|
|
188
|
+
return a === void 0 ? b(n.imports, e) : a;
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function S(t, n) {
|
|
192
|
+
if (n !== "module") return n;
|
|
193
|
+
let r = e(t.name);
|
|
194
|
+
return r === "css" ? "css" : r === "html" || r === "htm" || r === "xhtml" ? "html" : r === "js" || r === "mjs" || r === "cjs" ? "module" : "raw";
|
|
195
|
+
}
|
|
196
|
+
async function C(e) {
|
|
197
|
+
let n = h(e.entries), o = e.maxResources ?? r, l = e.maxTotalBytes ?? i, u = e.maxEntryBytes ?? a, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set(), g = 0, y = 0, b = 0, C = 0, w = (t) => {
|
|
198
|
+
let n = d.get(t);
|
|
199
|
+
if (n) return n;
|
|
200
|
+
let r = (async () => {
|
|
201
|
+
if (d.size >= o || t.size > u || y + t.size > l) return C++, null;
|
|
202
|
+
y += t.size;
|
|
203
|
+
try {
|
|
204
|
+
let n = await e.loadEntry(t);
|
|
205
|
+
return n.byteLength > u || y - t.size + n.byteLength > l ? (C++, null) : (y += n.byteLength - t.size, b++, n);
|
|
206
|
+
} catch {
|
|
207
|
+
return C++, null;
|
|
208
|
+
}
|
|
209
|
+
})();
|
|
210
|
+
return d.set(t, r), r;
|
|
211
|
+
}, T = async (e, r, i) => {
|
|
212
|
+
let a = S(e, r), o = `${e.path}\u0000${a}\u0000${a === "module" ? i?.id ?? "" : ""}`;
|
|
213
|
+
if (m.has(o)) return null;
|
|
214
|
+
let l = f.get(o);
|
|
215
|
+
if (l) return l;
|
|
216
|
+
m.add(o);
|
|
217
|
+
let u = (async () => {
|
|
218
|
+
let r = await w(e);
|
|
219
|
+
if (!r) return null;
|
|
220
|
+
if (a === "css") {
|
|
221
|
+
let a = await _(t(r), async (t, r) => {
|
|
222
|
+
let a = n(t, e.path);
|
|
223
|
+
return a ? T(a, r, i) : null;
|
|
224
|
+
});
|
|
225
|
+
return c(new TextEncoder().encode(a), "text/css");
|
|
226
|
+
}
|
|
227
|
+
if (a === "module") {
|
|
228
|
+
let n = await v(t(r), async (t, n) => E(t, e.path, n, i));
|
|
229
|
+
return c(new TextEncoder().encode(n), "text/javascript");
|
|
230
|
+
}
|
|
231
|
+
if (a === "html") {
|
|
232
|
+
let n = await O(t(r), e.path);
|
|
233
|
+
return c(new TextEncoder().encode(n), "text/html");
|
|
234
|
+
}
|
|
235
|
+
return c(r, s(e.name));
|
|
236
|
+
})().finally(() => m.delete(o));
|
|
237
|
+
return f.set(o, u), u;
|
|
238
|
+
}, E = async (e, t, r, i) => {
|
|
239
|
+
let a = e, o = t;
|
|
240
|
+
if (r === "module" && i) {
|
|
241
|
+
let n = i.resolve(e, t);
|
|
242
|
+
if (n === null) return null;
|
|
243
|
+
if (n !== void 0 && (a = n, o = i.documentPath, p(a))) return a;
|
|
244
|
+
}
|
|
245
|
+
let s = n(a, o);
|
|
246
|
+
if (!s) return null;
|
|
247
|
+
let c = await T(s, r, i);
|
|
248
|
+
if (!c) return null;
|
|
249
|
+
let l = a.indexOf("#");
|
|
250
|
+
return l < 0 ? c : c + a.slice(l);
|
|
251
|
+
}, D = async (e, t) => {
|
|
252
|
+
let n = e.split(","), r = [];
|
|
253
|
+
for (let e of n) {
|
|
254
|
+
let n = e.trim();
|
|
255
|
+
if (!n) continue;
|
|
256
|
+
let i = n.split(/\s+/), a = await E(i[0], t, "raw");
|
|
257
|
+
a && (i[0] = a), r.push(i.join(" "));
|
|
258
|
+
}
|
|
259
|
+
return r.join(", ");
|
|
260
|
+
}, O = async (e, t) => {
|
|
261
|
+
let n = new DOMParser().parseFromString(e, "text/html"), r = Array.from(n.querySelectorAll("script[type=\"importmap\"]:not([src])")), i = {
|
|
262
|
+
id: ++g,
|
|
263
|
+
documentPath: t,
|
|
264
|
+
resolve: x(r.map((e) => e.textContent ?? ""), t)
|
|
265
|
+
};
|
|
266
|
+
n.querySelectorAll("base").forEach((e) => e.remove()), n.querySelectorAll("meta[http-equiv]").forEach((e) => {
|
|
267
|
+
let t = (e.getAttribute("http-equiv") ?? "").toLocaleLowerCase();
|
|
268
|
+
(t === "content-security-policy" || t === "refresh") && e.remove();
|
|
269
|
+
});
|
|
270
|
+
for (let e of Array.from(n.querySelectorAll("link[href]"))) {
|
|
271
|
+
let n = e.getAttribute("href");
|
|
272
|
+
if (!n) continue;
|
|
273
|
+
let r = (e.getAttribute("rel") ?? "").toLocaleLowerCase().split(/\s+/), a = r.includes("stylesheet") ? "css" : r.includes("modulepreload") ? "module" : "raw", o = await E(n, t, a, i);
|
|
274
|
+
o && (e.setAttribute("href", o), (a === "css" || a === "module") && e.removeAttribute("integrity"));
|
|
275
|
+
}
|
|
276
|
+
for (let e of Array.from(n.querySelectorAll("script[src]"))) {
|
|
277
|
+
let n = e.getAttribute("src");
|
|
278
|
+
if (!n) continue;
|
|
279
|
+
let r = (e.getAttribute("type") ?? "").toLocaleLowerCase() === "module" ? "module" : "raw", a = await E(n, t, r, i);
|
|
280
|
+
a && (e.setAttribute("src", a), r === "module" && e.removeAttribute("integrity"));
|
|
281
|
+
}
|
|
282
|
+
for (let e of Array.from(n.querySelectorAll("script[type=\"module\"]:not([src])"))) e.textContent = await v(e.textContent ?? "", async (e, n) => E(e, t, n, i));
|
|
283
|
+
r.forEach((e) => e.remove());
|
|
284
|
+
for (let [e, r, i] of [
|
|
285
|
+
[
|
|
286
|
+
"img[src]",
|
|
287
|
+
"src",
|
|
288
|
+
"raw"
|
|
289
|
+
],
|
|
290
|
+
[
|
|
291
|
+
"input[type=\"image\"][src]",
|
|
292
|
+
"src",
|
|
293
|
+
"raw"
|
|
294
|
+
],
|
|
295
|
+
[
|
|
296
|
+
"source[src]",
|
|
297
|
+
"src",
|
|
298
|
+
"raw"
|
|
299
|
+
],
|
|
300
|
+
[
|
|
301
|
+
"video[src]",
|
|
302
|
+
"src",
|
|
303
|
+
"raw"
|
|
304
|
+
],
|
|
305
|
+
[
|
|
306
|
+
"video[poster]",
|
|
307
|
+
"poster",
|
|
308
|
+
"raw"
|
|
309
|
+
],
|
|
310
|
+
[
|
|
311
|
+
"audio[src]",
|
|
312
|
+
"src",
|
|
313
|
+
"raw"
|
|
314
|
+
],
|
|
315
|
+
[
|
|
316
|
+
"track[src]",
|
|
317
|
+
"src",
|
|
318
|
+
"raw"
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
"embed[src]",
|
|
322
|
+
"src",
|
|
323
|
+
"raw"
|
|
324
|
+
],
|
|
325
|
+
[
|
|
326
|
+
"object[data]",
|
|
327
|
+
"data",
|
|
328
|
+
"raw"
|
|
329
|
+
],
|
|
330
|
+
[
|
|
331
|
+
"iframe[src]",
|
|
332
|
+
"src",
|
|
333
|
+
"html"
|
|
334
|
+
],
|
|
335
|
+
[
|
|
336
|
+
"image[href]",
|
|
337
|
+
"href",
|
|
338
|
+
"raw"
|
|
339
|
+
],
|
|
340
|
+
[
|
|
341
|
+
"use[href]",
|
|
342
|
+
"href",
|
|
343
|
+
"raw"
|
|
344
|
+
]
|
|
345
|
+
]) for (let a of Array.from(n.querySelectorAll(e))) {
|
|
346
|
+
let e = a.getAttribute(r);
|
|
347
|
+
if (!e) continue;
|
|
348
|
+
let n = await E(e, t, i);
|
|
349
|
+
n && a.setAttribute(r, n);
|
|
350
|
+
}
|
|
351
|
+
for (let e of Array.from(n.querySelectorAll("image, use"))) {
|
|
352
|
+
let n = e.getAttribute("xlink:href");
|
|
353
|
+
if (!n) continue;
|
|
354
|
+
let r = await E(n, t, "raw");
|
|
355
|
+
r && e.setAttribute("xlink:href", r);
|
|
356
|
+
}
|
|
357
|
+
for (let e of Array.from(n.querySelectorAll("img[srcset], source[srcset]"))) {
|
|
358
|
+
let n = e.getAttribute("srcset");
|
|
359
|
+
n && e.setAttribute("srcset", await D(n, t));
|
|
360
|
+
}
|
|
361
|
+
for (let e of Array.from(n.querySelectorAll("[style]"))) {
|
|
362
|
+
let n = e.getAttribute("style");
|
|
363
|
+
n && e.setAttribute("style", await _(n, async (e, n) => E(e, t, n)));
|
|
364
|
+
}
|
|
365
|
+
for (let e of Array.from(n.querySelectorAll("style"))) e.textContent = await _(e.textContent ?? "", async (e, n) => E(e, t, n));
|
|
366
|
+
return "<!doctype html>\n" + n.documentElement.outerHTML;
|
|
367
|
+
};
|
|
368
|
+
return {
|
|
369
|
+
html: await O(e.html, e.documentPath),
|
|
370
|
+
loadedResources: b,
|
|
371
|
+
skippedResources: C
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
export { C as buildArchiveHtmlPreview };
|
|
376
|
+
|
|
377
|
+
//# sourceMappingURL=archiveHtml.js.map
|