@l1yp/file-viewer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
package/dist/lib/lzma.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
//#region src/lib/lzma.ts
|
|
2
|
+
var e = 11, t = 1 << e, n = 5, r = 1024, i = 1 << 24, a = 4, o = 12, s = 4, c = 4, l = 14, u = 128, d = 2, f = 2, p = 130, m = 258, h = 514, g = class {
|
|
3
|
+
buf;
|
|
4
|
+
code = 0;
|
|
5
|
+
range = 4294967295;
|
|
6
|
+
pos;
|
|
7
|
+
constructor(e, t) {
|
|
8
|
+
this.buf = e, this.pos = t, this.pos++;
|
|
9
|
+
for (let e = 0; e < 4; e++) this.code = (this.code << 8 | this.nextByte()) >>> 0;
|
|
10
|
+
}
|
|
11
|
+
nextByte() {
|
|
12
|
+
return this.pos < this.buf.length ? this.buf[this.pos++] : (this.pos++, 0);
|
|
13
|
+
}
|
|
14
|
+
normalize() {
|
|
15
|
+
this.range >>> 0 < i && (this.range = this.range * 256 >>> 0, this.code = this.code * 256 + this.nextByte() >>> 0);
|
|
16
|
+
}
|
|
17
|
+
decodeBit(r, i) {
|
|
18
|
+
let a = r[i], o = (this.range >>> e) * a, s;
|
|
19
|
+
return this.code >>> 0 < o ? (this.range = o, r[i] = a + (t - a >> n), s = 0) : (this.range = this.range - o >>> 0, this.code = this.code - o >>> 0, r[i] = a - (a >> n), s = 1), this.normalize(), s;
|
|
20
|
+
}
|
|
21
|
+
decodeDirectBits(e) {
|
|
22
|
+
let t = 0;
|
|
23
|
+
do {
|
|
24
|
+
this.range >>>= 1, this.code = this.code - this.range >>> 0;
|
|
25
|
+
let e = 0 - (this.code >>> 31);
|
|
26
|
+
this.code = this.code + (this.range & e) >>> 0, this.normalize(), t = t * 2 + (e + 1);
|
|
27
|
+
} while (--e);
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function _(e, t, n, r) {
|
|
32
|
+
let i = 1;
|
|
33
|
+
for (let a = 0; a < r; a++) i = (i << 1) + e.decodeBit(t, n + i);
|
|
34
|
+
return i - (1 << r);
|
|
35
|
+
}
|
|
36
|
+
function v(e, t, n, r) {
|
|
37
|
+
let i = 1, a = 0;
|
|
38
|
+
for (let o = 0; o < r; o++) {
|
|
39
|
+
let r = e.decodeBit(t, n + i);
|
|
40
|
+
i = (i << 1) + r, a |= r << o;
|
|
41
|
+
}
|
|
42
|
+
return a;
|
|
43
|
+
}
|
|
44
|
+
function y(e, t, n) {
|
|
45
|
+
return e.decodeBit(t, 0) === 0 ? _(e, t, f + n * 8, 3) : e.decodeBit(t, 1) === 0 ? 8 + _(e, t, p + n * 8, 3) : 16 + _(e, t, m, 8);
|
|
46
|
+
}
|
|
47
|
+
var b = class {
|
|
48
|
+
lc = 0;
|
|
49
|
+
lp = 0;
|
|
50
|
+
pb = 0;
|
|
51
|
+
literal = new Uint16Array();
|
|
52
|
+
isMatch = new Uint16Array(o << a);
|
|
53
|
+
isRep = new Uint16Array(o);
|
|
54
|
+
isRepG0 = new Uint16Array(o);
|
|
55
|
+
isRepG1 = new Uint16Array(o);
|
|
56
|
+
isRepG2 = new Uint16Array(o);
|
|
57
|
+
isRep0Long = new Uint16Array(o << a);
|
|
58
|
+
posSlot = new Uint16Array(s << 6);
|
|
59
|
+
specPos = new Uint16Array(u - l);
|
|
60
|
+
align = new Uint16Array(1 << c);
|
|
61
|
+
lenCoder = new Uint16Array(h);
|
|
62
|
+
repLenCoder = new Uint16Array(h);
|
|
63
|
+
state = 0;
|
|
64
|
+
rep0 = 0;
|
|
65
|
+
rep1 = 0;
|
|
66
|
+
rep2 = 0;
|
|
67
|
+
rep3 = 0;
|
|
68
|
+
setProps(e) {
|
|
69
|
+
if (e >= 225) throw Error("LZMA 属性非法");
|
|
70
|
+
this.lc = e % 9, e = e / 9 | 0, this.lp = e % 5, this.pb = e / 5 | 0;
|
|
71
|
+
let t = 768 << this.lc + this.lp;
|
|
72
|
+
this.literal.length !== t && (this.literal = new Uint16Array(t));
|
|
73
|
+
}
|
|
74
|
+
resetState() {
|
|
75
|
+
this.literal.fill(r), this.isMatch.fill(r), this.isRep.fill(r), this.isRepG0.fill(r), this.isRepG1.fill(r), this.isRepG2.fill(r), this.isRep0Long.fill(r), this.posSlot.fill(r), this.specPos.fill(r), this.align.fill(r), this.lenCoder.fill(r), this.repLenCoder.fill(r), this.state = 0, this.rep0 = this.rep1 = this.rep2 = this.rep3 = 0;
|
|
76
|
+
}
|
|
77
|
+
decode(e, t, n, r, i, o) {
|
|
78
|
+
let u = new g(e, t), f = (1 << this.pb) - 1, p = (1 << this.lp) - 1, m = this.lc, { state: h, rep0: b, rep1: x, rep2: S, rep3: C } = this;
|
|
79
|
+
for (; r < i;) {
|
|
80
|
+
let e = r - o, t = e & f;
|
|
81
|
+
if (u.decodeBit(this.isMatch, (h << a) + t) === 0) {
|
|
82
|
+
let t = r > o ? n[r - 1] : 0, i = 768 * (((e & p) << m) + (t >> 8 - m)), a = 1;
|
|
83
|
+
if (h >= 7) {
|
|
84
|
+
let e = n[r - b - 1];
|
|
85
|
+
do {
|
|
86
|
+
let t = e >> 7 & 1;
|
|
87
|
+
e = e << 1 & 255;
|
|
88
|
+
let n = u.decodeBit(this.literal, i + (1 + t << 8) + a);
|
|
89
|
+
if (a = a << 1 | n, t !== n) break;
|
|
90
|
+
} while (a < 256);
|
|
91
|
+
}
|
|
92
|
+
for (; a < 256;) a = a << 1 | u.decodeBit(this.literal, i + a);
|
|
93
|
+
n[r++] = a & 255, h = h < 4 ? 0 : h < 10 ? h - 3 : h - 6;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
let g;
|
|
97
|
+
if (u.decodeBit(this.isRep, h) !== 0) {
|
|
98
|
+
if (u.decodeBit(this.isRepG0, h) === 0) {
|
|
99
|
+
if (u.decodeBit(this.isRep0Long, (h << a) + t) === 0) {
|
|
100
|
+
h = h < 7 ? 9 : 11, n[r] = n[r - b - 1], r++;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
let e;
|
|
105
|
+
u.decodeBit(this.isRepG1, h) === 0 ? e = x : (u.decodeBit(this.isRepG2, h) === 0 ? e = S : (e = C, C = S), S = x), x = b, b = e;
|
|
106
|
+
}
|
|
107
|
+
g = y(u, this.repLenCoder, t), h = h < 7 ? 8 : 11;
|
|
108
|
+
} else {
|
|
109
|
+
C = S, S = x, x = b, g = y(u, this.lenCoder, t), h = h < 7 ? 7 : 10;
|
|
110
|
+
let e = g < s ? g : s - 1, n = _(u, this.posSlot, e << 6, 6);
|
|
111
|
+
if (n < 4) b = n;
|
|
112
|
+
else {
|
|
113
|
+
let e = (n >> 1) - 1;
|
|
114
|
+
if (b = (2 | n & 1) << e, n < l) b += v(u, this.specPos, b - n - 1, e);
|
|
115
|
+
else if (b += u.decodeDirectBits(e - c) * (1 << c), b += v(u, this.align, 0, c), b >>> 0 == 4294967295) break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
g += d;
|
|
119
|
+
let w = r - b - 1;
|
|
120
|
+
for (let e = 0; e < g && r < i; e++) n[r++] = n[w++];
|
|
121
|
+
}
|
|
122
|
+
return this.state = h, this.rep0 = b, this.rep1 = x, this.rep2 = S, this.rep3 = C, r;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
function x(e, t, n) {
|
|
126
|
+
if (t.length < 5) throw Error("LZMA 属性长度不足");
|
|
127
|
+
let r = new b();
|
|
128
|
+
r.setProps(t[0]), r.resetState();
|
|
129
|
+
let i = new Uint8Array(n);
|
|
130
|
+
return r.decode(e, 0, i, 0, n, 0), i;
|
|
131
|
+
}
|
|
132
|
+
function S(e, t, n) {
|
|
133
|
+
let r = new Uint8Array(n), i = new b(), a = 0, o = 0, s = 0, c = !0;
|
|
134
|
+
for (; a < e.length;) {
|
|
135
|
+
let t = e[a++];
|
|
136
|
+
if (t === 0) break;
|
|
137
|
+
if (t >= 128) {
|
|
138
|
+
let n = ((t & 31) << 16) + (e[a] << 8) + e[a + 1] + 1;
|
|
139
|
+
a += 2;
|
|
140
|
+
let l = (e[a] << 8) + e[a + 1] + 1;
|
|
141
|
+
a += 2;
|
|
142
|
+
let u = t >> 5 & 3;
|
|
143
|
+
if (u >= 2) i.setProps(e[a++]), c = !1;
|
|
144
|
+
else if (c) throw Error("LZMA2 缺少属性的块");
|
|
145
|
+
u >= 1 && i.resetState(), u === 3 && (s = o), i.decode(e, a, r, o, o + n, s), a += l, o += n;
|
|
146
|
+
} else {
|
|
147
|
+
if (t > 2) throw Error(`LZMA2 非法控制字节 0x${t.toString(16)}`);
|
|
148
|
+
let n = (e[a] << 8) + e[a + 1] + 1;
|
|
149
|
+
a += 2, t === 1 && (s = o, c = !0), r.set(e.subarray(a, a + n), o), a += n, o += n;
|
|
150
|
+
}
|
|
151
|
+
if (o >= n) break;
|
|
152
|
+
}
|
|
153
|
+
return r;
|
|
154
|
+
}
|
|
155
|
+
var C = [
|
|
156
|
+
!0,
|
|
157
|
+
!0,
|
|
158
|
+
!0,
|
|
159
|
+
!1,
|
|
160
|
+
!0,
|
|
161
|
+
!1,
|
|
162
|
+
!1,
|
|
163
|
+
!1
|
|
164
|
+
], w = [
|
|
165
|
+
0,
|
|
166
|
+
1,
|
|
167
|
+
2,
|
|
168
|
+
2,
|
|
169
|
+
3,
|
|
170
|
+
3,
|
|
171
|
+
3,
|
|
172
|
+
3
|
|
173
|
+
], T = (e) => e === 0 || e === 255;
|
|
174
|
+
function E(e, t = 0) {
|
|
175
|
+
let n = e.length;
|
|
176
|
+
if (n < 5) return;
|
|
177
|
+
let r = n - 5, i = 0, a = -1, o = 0;
|
|
178
|
+
for (; o <= r;) {
|
|
179
|
+
if ((e[o] & 254) != 232) {
|
|
180
|
+
o++;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
let n = o - a;
|
|
184
|
+
if (a = o, n > 3) i = 0;
|
|
185
|
+
else if (i = i << n - 1 & 7, i !== 0) {
|
|
186
|
+
let t = e[o + 4 - w[i]];
|
|
187
|
+
if (!C[i] || T(t)) {
|
|
188
|
+
i = i << 1 & 7 | 1, o++;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (T(e[o + 4])) {
|
|
193
|
+
let n = (e[o + 1] | e[o + 2] << 8 | e[o + 3] << 16 | e[o + 4] << 24) >>> 0, r = 0;
|
|
194
|
+
for (; r = n - (t + o + 5) >>> 0, i !== 0;) {
|
|
195
|
+
let e = w[i] * 8;
|
|
196
|
+
if (!T(r >>> 24 - e & 255)) break;
|
|
197
|
+
n = (r ^ (1 << 32 - e) - 1) >>> 0;
|
|
198
|
+
}
|
|
199
|
+
e[o + 4] = ~((r >>> 24 & 1) - 1) & 255, e[o + 3] = r >>> 16 & 255, e[o + 2] = r >>> 8 & 255, e[o + 1] = r & 255, o += 5, i = 0;
|
|
200
|
+
} else i = i << 1 & 7 | 1, o++;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
export { E as bcjX86Decode, S as lzma2Decode, x as lzmaDecode };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Block-level markdown → VNodes. Handles fenced code, ATX headings (## / ###),
|
|
4
|
+
* GFM pipe tables, ordered/unordered lists (with nesting + fenced code inside
|
|
5
|
+
* items), and paragraphs with hard line breaks. Faithful port of `mdNodes`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mdNodes(text: string, kp: string, depth: number): VNode[];
|
|
8
|
+
/** Top-level markdown entry (depth 0). */
|
|
9
|
+
export declare function md(text: string, kp: string): VNode[];
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import e from "../../components/CodeBlock.js";
|
|
2
|
+
import { blockMath as t } from "./math.js";
|
|
3
|
+
import { blockquoteStyle as n, headingStyle as r, hrStyle as i, listItemStyle as a, listStyle as o, paragraphStyle as s, taskCheckboxStyle as c } from "./styles.js";
|
|
4
|
+
import { inline as l } from "./inline.js";
|
|
5
|
+
import u from "../../components/MarkdownTable.js";
|
|
6
|
+
import { h as d } from "vue";
|
|
7
|
+
//#region src/lib/markdown/blocks.ts
|
|
8
|
+
function f(t, n, r, i) {
|
|
9
|
+
return d(e, {
|
|
10
|
+
key: r,
|
|
11
|
+
code: t,
|
|
12
|
+
lang: n,
|
|
13
|
+
maxHeight: i?.maxHeight,
|
|
14
|
+
margin: i?.margin
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function p(e, t, n, r) {
|
|
18
|
+
return d(u, {
|
|
19
|
+
key: r,
|
|
20
|
+
header: e,
|
|
21
|
+
aligns: t,
|
|
22
|
+
rows: n,
|
|
23
|
+
keyPrefix: r
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function m(e, u, h) {
|
|
27
|
+
let g = String(e).replace(/\t/g, " ").split("\n"), _ = [], v = s(h), y = 0, b = 0, x = (e) => e.match(/^(\s*)/)[1].length, S = (e) => /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/.test(e), C = (e) => {
|
|
28
|
+
if (e.indexOf("|") === -1) return !1;
|
|
29
|
+
let t = e.trim();
|
|
30
|
+
t.charAt(0) === "|" && (t = t.slice(1)), t.charAt(t.length - 1) === "|" && (t = t.slice(0, -1));
|
|
31
|
+
let n = t.split("|");
|
|
32
|
+
return n.length > 0 && n.every((e) => /^\s*:?-+:?\s*$/.test(e));
|
|
33
|
+
}, w = (e) => {
|
|
34
|
+
let t = e.trim();
|
|
35
|
+
t.charAt(0) === "|" && (t = t.slice(1)), t.charAt(t.length - 1) === "|" && (t = t.slice(0, -1));
|
|
36
|
+
let n = [], r = "";
|
|
37
|
+
for (let e = 0; e < t.length; e++) {
|
|
38
|
+
let i = t.charAt(e);
|
|
39
|
+
if (i === "\\" && t.charAt(e + 1) === "|") {
|
|
40
|
+
r += "|", e++;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (i === "|") {
|
|
44
|
+
n.push(r.trim()), r = "";
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
r += i;
|
|
48
|
+
}
|
|
49
|
+
return n.push(r.trim()), n;
|
|
50
|
+
};
|
|
51
|
+
for (; y < g.length;) {
|
|
52
|
+
let e = g[y];
|
|
53
|
+
if (e.trim() === "") {
|
|
54
|
+
y++;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
let s = `${u}-${b++}`, T = e.match(/^(\s*)```+\s*([^`]*)$/);
|
|
58
|
+
if (T) {
|
|
59
|
+
let e = T[1].length, t = T[2], n = [];
|
|
60
|
+
for (y++; y < g.length && !/^\s*```+\s*$/.test(g[y]);) n.push(g[y].slice(e)), y++;
|
|
61
|
+
y++, _.push(f(n.join("\n"), t, s));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
let E = e.match(/^\s*(\$\$|\\\[)/);
|
|
65
|
+
if (E) {
|
|
66
|
+
let n = E[1], r = n === "$$" ? "$$" : "\\]", i = e.slice(e.indexOf(n) + n.length), a = i.indexOf(r), o;
|
|
67
|
+
if (a !== -1) o = i.slice(0, a), y++;
|
|
68
|
+
else {
|
|
69
|
+
let e = [i];
|
|
70
|
+
for (y++; y < g.length;) {
|
|
71
|
+
let t = g[y].indexOf(r);
|
|
72
|
+
if (t !== -1) {
|
|
73
|
+
e.push(g[y].slice(0, t)), y++;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
e.push(g[y]), y++;
|
|
77
|
+
}
|
|
78
|
+
o = e.join("\n");
|
|
79
|
+
}
|
|
80
|
+
_.push(t(o.trim(), s));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (S(e)) {
|
|
84
|
+
_.push(d("hr", {
|
|
85
|
+
key: s,
|
|
86
|
+
style: i
|
|
87
|
+
})), y++;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (/^\s*>/.test(e)) {
|
|
91
|
+
let e = [];
|
|
92
|
+
for (; y < g.length;) if (/^\s*>/.test(g[y])) e.push(g[y].replace(/^\s*>\s?/, "")), y++;
|
|
93
|
+
else if (g[y].trim() === "") {
|
|
94
|
+
let t = y + 1;
|
|
95
|
+
for (; t < g.length && g[t].trim() === "";) t++;
|
|
96
|
+
if (t < g.length && /^\s*>/.test(g[t])) {
|
|
97
|
+
e.push(""), y = t;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
} else break;
|
|
102
|
+
_.push(d("blockquote", {
|
|
103
|
+
key: s,
|
|
104
|
+
style: n
|
|
105
|
+
}, m(e.join("\n"), s, h)));
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
let D = e.match(/^(#{1,6})\s+(.*)$/);
|
|
109
|
+
if (D) {
|
|
110
|
+
let e = D[1].length, t = r(e, _.length === 0);
|
|
111
|
+
_.push(d(`h${e}`, {
|
|
112
|
+
key: s,
|
|
113
|
+
style: t
|
|
114
|
+
}, l(D[2], s))), y++;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (e.indexOf("|") !== -1 && y + 1 < g.length && C(g[y + 1])) {
|
|
118
|
+
let t = w(e), n = w(g[y + 1]).map((e) => {
|
|
119
|
+
let t = e.charAt(0) === ":", n = e.charAt(e.length - 1) === ":";
|
|
120
|
+
return t && n ? "center" : n ? "right" : t ? "left" : null;
|
|
121
|
+
});
|
|
122
|
+
y += 2;
|
|
123
|
+
let r = [];
|
|
124
|
+
for (; y < g.length;) {
|
|
125
|
+
let e = g[y];
|
|
126
|
+
if (e.trim() === "" || e.indexOf("|") === -1 || /^\s*```+/.test(e) || /^#{1,6}\s/.test(e)) break;
|
|
127
|
+
r.push(w(e)), y++;
|
|
128
|
+
}
|
|
129
|
+
_.push(p(t, n, r, s));
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
let O = e.match(/^(\s*)(\d+)\.\s+/), k = e.match(/^(\s*)([-*+•])\s+/);
|
|
133
|
+
if (O || k) {
|
|
134
|
+
let e = !!O, t = (O || k)[1].length, n = e ? /^(\s*)(\d+)\.\s+([\s\S]*)$/ : /^(\s*)([-*+•])\s+([\s\S]*)$/, r = [], i = null;
|
|
135
|
+
for (; y < g.length;) {
|
|
136
|
+
let a = g[y].match(n);
|
|
137
|
+
if (a && a[1].length === t && !S(g[y])) {
|
|
138
|
+
e && i === null && (i = parseInt(a[2], 10));
|
|
139
|
+
let o = [a[3]];
|
|
140
|
+
for (y++; y < g.length;) {
|
|
141
|
+
if (g[y].trim() === "") {
|
|
142
|
+
o.push(""), y++;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let e = x(g[y]), r = g[y].match(n);
|
|
146
|
+
if (e > t && !(r && r[1].length === t)) o.push(g[y]), y++;
|
|
147
|
+
else break;
|
|
148
|
+
}
|
|
149
|
+
r.push(o);
|
|
150
|
+
} else if (g[y].trim() === "") {
|
|
151
|
+
let e = y + 1;
|
|
152
|
+
for (; e < g.length && g[e].trim() === "";) e++;
|
|
153
|
+
if (e < g.length) {
|
|
154
|
+
let r = g[e].match(n);
|
|
155
|
+
if (r && r[1].length === t && !S(g[e]) || x(g[e]) > t) {
|
|
156
|
+
y = e;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
} else break;
|
|
162
|
+
}
|
|
163
|
+
let l = o(h, e), u = a(h), f = r.map((t, n) => {
|
|
164
|
+
let r = Infinity;
|
|
165
|
+
t.slice(1).forEach((e) => {
|
|
166
|
+
e.trim() !== "" && (r = Math.min(r, x(e)));
|
|
167
|
+
}), isFinite(r) || (r = 0);
|
|
168
|
+
let i = [t[0]].concat(t.slice(1).map((e) => e.trim() === "" ? "" : e.slice(r))).join("\n").replace(/\n+$/, ""), a = e ? null : /^\[([ xX])\]\s+/.exec(i), o = !!a && a[1].toLowerCase() === "x", l = m(a ? i.slice(a[0].length) : i, `${s}-i${n}`, h + 1), f = l.length === 1 && l[0] && l[0].type === "p";
|
|
169
|
+
if (a) {
|
|
170
|
+
let e = d("span", {
|
|
171
|
+
key: "cb",
|
|
172
|
+
style: c(o),
|
|
173
|
+
"aria-hidden": "true"
|
|
174
|
+
}, o ? "✓" : ""), t = f ? [e, ...l[0].children || []] : [e, ...l];
|
|
175
|
+
return d("li", {
|
|
176
|
+
key: n,
|
|
177
|
+
style: {
|
|
178
|
+
...u,
|
|
179
|
+
listStyleType: "none"
|
|
180
|
+
}
|
|
181
|
+
}, t);
|
|
182
|
+
}
|
|
183
|
+
let p = f ? d("span", { style: {
|
|
184
|
+
display: "block",
|
|
185
|
+
fontFamily: u.fontFamily,
|
|
186
|
+
fontSize: u.fontSize,
|
|
187
|
+
lineHeight: 1.72
|
|
188
|
+
} }, l[0].children) : l;
|
|
189
|
+
return d("li", {
|
|
190
|
+
key: n,
|
|
191
|
+
style: u
|
|
192
|
+
}, p);
|
|
193
|
+
}), p = e && i && i !== 1 ? { start: i } : {};
|
|
194
|
+
_.push(d(e ? "ol" : "ul", {
|
|
195
|
+
key: s,
|
|
196
|
+
style: l,
|
|
197
|
+
...p
|
|
198
|
+
}, f));
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
let A = [e];
|
|
202
|
+
for (y++; y < g.length;) {
|
|
203
|
+
let e = g[y];
|
|
204
|
+
if (e.trim() === "" || /^\s*```+/.test(e) || /^\s*(\$\$|\\\[)/.test(e) || /^#{1,6}\s/.test(e) || /^\s*>/.test(e) || S(e) || /^\s*\d+\.\s+/.test(e) || /^\s*[-*+•]\s+/.test(e) || e.indexOf("|") !== -1 && y + 1 < g.length && C(g[y + 1])) break;
|
|
205
|
+
A.push(e), y++;
|
|
206
|
+
}
|
|
207
|
+
let j = [];
|
|
208
|
+
A.forEach((e, t) => {
|
|
209
|
+
t > 0 && j.push(d("br", { key: `br${t}` })), l(e, `${s}-l${t}`).forEach((e) => j.push(e));
|
|
210
|
+
}), _.push(d("p", {
|
|
211
|
+
key: s,
|
|
212
|
+
style: v
|
|
213
|
+
}, j));
|
|
214
|
+
}
|
|
215
|
+
return _;
|
|
216
|
+
}
|
|
217
|
+
function h(e, t) {
|
|
218
|
+
return m(e, t, 0);
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
export { h as md, m as mdNodes };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
export type InlineNode = VNode | string;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve an inline citation token to its rendered chip(s), or null to strip it. Provider-specific (ChatGPT
|
|
5
|
+
* supplies one via {@link renderInline}); the shared renderer just calls it for citation tokens it finds.
|
|
6
|
+
*/
|
|
7
|
+
export type CiteResolver = (token: string) => InlineNode[] | null;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a markdown link to custom inline nodes, or null to render a normal anchor. Lets a provider turn
|
|
10
|
+
* specific links into rich nodes — ChatGPT renders managed file-download links as file chips (preview/download)
|
|
11
|
+
* via {@link renderInline}; everything else falls through to a plain `<a>`.
|
|
12
|
+
*/
|
|
13
|
+
export type LinkResolver = (text: string, href: string) => InlineNode[] | null;
|
|
14
|
+
/** Inline resolvers a provider can install for one render pass. */
|
|
15
|
+
export interface InlineResolvers {
|
|
16
|
+
cite?: CiteResolver;
|
|
17
|
+
link?: LinkResolver;
|
|
18
|
+
}
|
|
19
|
+
/** Run [body] with the given inline [resolvers] active, restoring the previous ones afterwards. */
|
|
20
|
+
export declare function renderInline<T>(resolvers: InlineResolvers, body: () => T): T;
|
|
21
|
+
/**
|
|
22
|
+
* Render inline markdown to an array of VNodes/strings.
|
|
23
|
+
* Order matters: code first (nothing is parsed inside it), then math (`$…$` / `\(…\)`, pulled out
|
|
24
|
+
* before emphasis so TeX internals like `_` `*` `\` aren't mangled), image before link
|
|
25
|
+
* (`` contains `[…](…)`), bold (`**`/`__`) before italic (`*`/`_`).
|
|
26
|
+
* Groups: 1 code, 2 math-`$`, 3 math-`\(`, 4 img-alt, 5 img-url, 6 bold, 7 underscore-bold,
|
|
27
|
+
* 8 strike, 9 link-text, 10 link-url, 11 italic, 12 underscore-italic, 13 citation (PUA-delimited),
|
|
28
|
+
* 14 citation (`【n†…】`). The opening `$` is guarded against a following space/`$` and the closing
|
|
29
|
+
* against a following word char, so prose prices like `$5` don't trigger math. Underscore emphasis is
|
|
30
|
+
* guarded by alnum boundaries so `snake_case` stays intact.
|
|
31
|
+
* Citation tokens resolve via the active {@link CiteResolver} (or are stripped when none is set).
|
|
32
|
+
*/
|
|
33
|
+
export declare function inline(s: string, kp: string): InlineNode[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useLightbox as e } from "../../composables/useLightbox.js";
|
|
2
|
+
import { inlineMath as t } from "./math.js";
|
|
3
|
+
import { delStyle as n, emStyle as r, imgStyle as i, inlineCodeStyle as a, linkStyle as o, strongStyle as s } from "./styles.js";
|
|
4
|
+
import { h as c } from "vue";
|
|
5
|
+
//#region src/lib/markdown/inline.ts
|
|
6
|
+
var l = null, u = null;
|
|
7
|
+
function d(e, t) {
|
|
8
|
+
let n = l, r = u;
|
|
9
|
+
l = e.cite ?? null, u = e.link ?? null;
|
|
10
|
+
try {
|
|
11
|
+
return t();
|
|
12
|
+
} finally {
|
|
13
|
+
l = n, u = r;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
var f = /[\u{e200}-\u{e20f}]/gu;
|
|
17
|
+
function p(d, p) {
|
|
18
|
+
let m = [], h = (e) => {
|
|
19
|
+
let t = e.replace(f, "");
|
|
20
|
+
t && m.push(t);
|
|
21
|
+
}, g = /`([^`\n]+?)`|\$(?![ \t$])((?:\\.|[^$\n\\])+?)\$(?![\w$])|\\\(([\s\S]+?)\\\)|!\[([^\]\n]*?)\]\(([^)\s]+?)\)|\*\*([\s\S]+?)\*\*|__([^_]+?)__|~~([\s\S]+?)~~|\[([^\]\n]+?)\]\(([^)\s]+?)\)|\*([^\s*][^*]*?)\*|(?<![A-Za-z0-9_])_([^_]+?)_(?![A-Za-z0-9_])|(\u{e200}[\s\S]*?\u{e201})|(【[^】\n]*?†[^】\n]*?】)/gu, _ = 0, v, y = 0;
|
|
22
|
+
for (; v = g.exec(d);) {
|
|
23
|
+
if (v.index > _ && h(d.slice(_, v.index)), v[1] !== void 0) m.push(c("code", {
|
|
24
|
+
key: `${p}-c${y++}`,
|
|
25
|
+
style: a
|
|
26
|
+
}, v[1]));
|
|
27
|
+
else if (v[2] !== void 0) m.push(t(v[2], `${p}-m${y++}`));
|
|
28
|
+
else if (v[3] !== void 0) m.push(t(v[3], `${p}-m${y++}`));
|
|
29
|
+
else if (v[4] !== void 0) {
|
|
30
|
+
let t = v[5], n = v[4];
|
|
31
|
+
m.push(c("img", {
|
|
32
|
+
key: `${p}-img${y++}`,
|
|
33
|
+
src: t,
|
|
34
|
+
alt: n,
|
|
35
|
+
loading: "lazy",
|
|
36
|
+
style: {
|
|
37
|
+
...i,
|
|
38
|
+
cursor: "zoom-in"
|
|
39
|
+
},
|
|
40
|
+
onClick: () => e().open({
|
|
41
|
+
src: t,
|
|
42
|
+
alt: n
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
} else if (v[6] !== void 0) m.push(c("strong", {
|
|
46
|
+
key: `${p}-s${y++}`,
|
|
47
|
+
style: s
|
|
48
|
+
}, v[6]));
|
|
49
|
+
else if (v[7] !== void 0) m.push(c("strong", {
|
|
50
|
+
key: `${p}-s${y++}`,
|
|
51
|
+
style: s
|
|
52
|
+
}, v[7]));
|
|
53
|
+
else if (v[8] !== void 0) m.push(c("del", {
|
|
54
|
+
key: `${p}-d${y++}`,
|
|
55
|
+
style: n
|
|
56
|
+
}, v[8]));
|
|
57
|
+
else if (v[9] !== void 0) {
|
|
58
|
+
let e = v[10] ?? "", t = u ? u(v[9], e) : null;
|
|
59
|
+
if (t) for (let e of t) m.push(e);
|
|
60
|
+
else m.push(c("a", {
|
|
61
|
+
key: `${p}-a${y++}`,
|
|
62
|
+
href: e,
|
|
63
|
+
target: "_blank",
|
|
64
|
+
rel: "noopener noreferrer",
|
|
65
|
+
style: o
|
|
66
|
+
}, v[9]));
|
|
67
|
+
} else if (v[11] !== void 0) m.push(c("em", {
|
|
68
|
+
key: `${p}-e${y++}`,
|
|
69
|
+
style: r
|
|
70
|
+
}, v[11]));
|
|
71
|
+
else if (v[12] !== void 0) m.push(c("em", {
|
|
72
|
+
key: `${p}-e${y++}`,
|
|
73
|
+
style: r
|
|
74
|
+
}, v[12]));
|
|
75
|
+
else {
|
|
76
|
+
let e = v[13] ?? v[14] ?? "", t = l ? l(e) : null;
|
|
77
|
+
if (t) for (let e of t) m.push(e);
|
|
78
|
+
}
|
|
79
|
+
_ = g.lastIndex;
|
|
80
|
+
}
|
|
81
|
+
return _ < d.length && h(d.slice(_)), m;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { p as inline, d as renderInline };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
/** Inline formula (`$…$` / `\(…\)`) — flows within the surrounding line. */
|
|
3
|
+
export declare function inlineMath(tex: string, key: string): VNode;
|
|
4
|
+
/** Display formula (`$$…$$` / `\[…\]`) — its own centered block, scrolls sideways if too wide. */
|
|
5
|
+
export declare function blockMath(tex: string, key: string): VNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { h as e } from "vue";
|
|
2
|
+
import t from "katex";
|
|
3
|
+
//#region src/lib/markdown/math.ts
|
|
4
|
+
function n(e, n) {
|
|
5
|
+
return t.renderToString(e, {
|
|
6
|
+
displayMode: n,
|
|
7
|
+
throwOnError: !1
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function r(t, r) {
|
|
11
|
+
return e("span", {
|
|
12
|
+
key: r,
|
|
13
|
+
class: "math-inline",
|
|
14
|
+
innerHTML: n(t, !1)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function i(t, r) {
|
|
18
|
+
return e("div", {
|
|
19
|
+
key: r,
|
|
20
|
+
class: "math-block",
|
|
21
|
+
innerHTML: n(t, !0)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { i as blockMath, r as inlineMath };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Segment {
|
|
2
|
+
code: boolean;
|
|
3
|
+
text: string;
|
|
4
|
+
lang?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Split markdown into ordered segments of prose and fenced code blocks.
|
|
8
|
+
* Blank lines inside fences are preserved; blank lines around prose are trimmed.
|
|
9
|
+
* Faithful port of the original `segmentize` (used for human messages).
|
|
10
|
+
*/
|
|
11
|
+
export declare function segmentize(text: string): Segment[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/lib/markdown/segmentize.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = String(e).split("\n"), n = [], r = [], i = 0, a = () => {
|
|
4
|
+
if (r.length) {
|
|
5
|
+
let e = r.join("\n").replace(/^\n+/, "").replace(/\n+$/, "");
|
|
6
|
+
e.trim() && n.push({
|
|
7
|
+
code: !1,
|
|
8
|
+
text: e
|
|
9
|
+
}), r = [];
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
for (; i < t.length;) {
|
|
13
|
+
let e = t[i].match(/^\s*```+\s*([^`]*)$/);
|
|
14
|
+
if (e) {
|
|
15
|
+
a();
|
|
16
|
+
let r = e[1], o = [];
|
|
17
|
+
for (i++; i < t.length && !/^\s*```+\s*$/.test(t[i]);) o.push(t[i]), i++;
|
|
18
|
+
i++, n.push({
|
|
19
|
+
code: !0,
|
|
20
|
+
lang: r,
|
|
21
|
+
text: o.join("\n")
|
|
22
|
+
});
|
|
23
|
+
} else r.push(t[i]), i++;
|
|
24
|
+
}
|
|
25
|
+
return a(), n;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { e as segmentize };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Centralized typography for markdown-rendered nodes. The render functions build
|
|
4
|
+
* raw VNodes (outside any SFC), so they can't use scoped CSS — keeping every
|
|
5
|
+
* markdown style in this one file is the maintainable equivalent: tweak prose
|
|
6
|
+
* sizing/spacing here and it applies everywhere markdown is rendered.
|
|
7
|
+
*
|
|
8
|
+
* `depth` mirrors the original: 0 = top level, >0 = nested inside a list item.
|
|
9
|
+
*/
|
|
10
|
+
export declare function paragraphStyle(depth: number): CSSProperties;
|
|
11
|
+
export declare function headingStyle(level: number, first: boolean): CSSProperties;
|
|
12
|
+
export declare function listStyle(depth: number, ordered: boolean): CSSProperties;
|
|
13
|
+
export declare function listItemStyle(depth: number): CSSProperties;
|
|
14
|
+
export declare const inlineCodeStyle: CSSProperties;
|
|
15
|
+
export declare const strongStyle: CSSProperties;
|
|
16
|
+
export declare const delStyle: CSSProperties;
|
|
17
|
+
export declare const emStyle: CSSProperties;
|
|
18
|
+
export declare const linkStyle: CSSProperties;
|
|
19
|
+
/** Inline image (``). Scales down to the column, never overflows. */
|
|
20
|
+
export declare const imgStyle: CSSProperties;
|
|
21
|
+
/** Thematic break (`---` / `***` / `___`). */
|
|
22
|
+
export declare const hrStyle: CSSProperties;
|
|
23
|
+
/** Blockquote (`> …`): left rule + softened text; nests via recursion. */
|
|
24
|
+
export declare const blockquoteStyle: CSSProperties;
|
|
25
|
+
/** GFM task-list checkbox (`- [ ]` / `- [x]`) — a styled box, not a native input, for theme control. */
|
|
26
|
+
export declare function taskCheckboxStyle(checked: boolean): CSSProperties;
|