@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/har.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
//#region src/lib/har.ts
|
|
2
|
+
var e = new TextDecoder("utf-8", { fatal: !1 });
|
|
3
|
+
function t(t) {
|
|
4
|
+
return e.decode(t);
|
|
5
|
+
}
|
|
6
|
+
function n(e, t = " ") {
|
|
7
|
+
let n = "";
|
|
8
|
+
for (let r = 0; r < e.length; r++) n += (r && t ? t : "") + e[r].toString(16).padStart(2, "0");
|
|
9
|
+
return n.toUpperCase();
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
let t = e.replace(/[\r\n\t ]/g, "").replace(/-/g, "+").replace(/_/g, "/"), n = t.length % 4;
|
|
13
|
+
n && (t += "=".repeat(4 - n));
|
|
14
|
+
let r = atob(t), i = new Uint8Array(r.length);
|
|
15
|
+
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
16
|
+
return i;
|
|
17
|
+
}
|
|
18
|
+
function i(e) {
|
|
19
|
+
return !!e && typeof e == "object";
|
|
20
|
+
}
|
|
21
|
+
function a(e, t = "") {
|
|
22
|
+
return typeof e == "string" ? e : t;
|
|
23
|
+
}
|
|
24
|
+
function o(e, t = 0) {
|
|
25
|
+
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
26
|
+
}
|
|
27
|
+
function s(e) {
|
|
28
|
+
return e === !0;
|
|
29
|
+
}
|
|
30
|
+
function c(e) {
|
|
31
|
+
return Array.isArray(e) ? e : [];
|
|
32
|
+
}
|
|
33
|
+
function l(e) {
|
|
34
|
+
return c(e).filter(i).map((e) => ({
|
|
35
|
+
name: a(e.name),
|
|
36
|
+
value: a(e.value)
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function u(e) {
|
|
40
|
+
return c(e).filter(i).map((e) => ({
|
|
41
|
+
name: a(e.name),
|
|
42
|
+
value: a(e.value),
|
|
43
|
+
path: a(e.path) || void 0,
|
|
44
|
+
domain: a(e.domain) || void 0,
|
|
45
|
+
expires: typeof e.expires == "string" ? e.expires : null,
|
|
46
|
+
httpOnly: s(e.httpOnly),
|
|
47
|
+
secure: s(e.secure),
|
|
48
|
+
sameSite: a(e.sameSite) || void 0
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
function d(e) {
|
|
52
|
+
if (!i(e)) return;
|
|
53
|
+
let t = c(e.params).filter(i).map((e) => ({
|
|
54
|
+
name: a(e.name),
|
|
55
|
+
value: typeof e.value == "string" ? e.value : void 0,
|
|
56
|
+
fileName: a(e.fileName) || void 0,
|
|
57
|
+
contentType: a(e.contentType) || void 0
|
|
58
|
+
}));
|
|
59
|
+
return {
|
|
60
|
+
mimeType: a(e.mimeType) || void 0,
|
|
61
|
+
text: typeof e.text == "string" ? e.text : void 0,
|
|
62
|
+
params: t.length ? t : void 0,
|
|
63
|
+
encoding: a(e.encoding) || void 0,
|
|
64
|
+
comment: a(e.comment) || void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function f(e) {
|
|
68
|
+
try {
|
|
69
|
+
let t = new URL(e);
|
|
70
|
+
return {
|
|
71
|
+
scheme: t.protocol.replace(/:$/, ""),
|
|
72
|
+
host: t.host,
|
|
73
|
+
pathname: t.pathname,
|
|
74
|
+
path: t.pathname + t.search
|
|
75
|
+
};
|
|
76
|
+
} catch {
|
|
77
|
+
return {
|
|
78
|
+
scheme: "",
|
|
79
|
+
host: "",
|
|
80
|
+
pathname: e,
|
|
81
|
+
path: e
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function p(e) {
|
|
86
|
+
return (e.split(";")[0] || "").trim().toLowerCase();
|
|
87
|
+
}
|
|
88
|
+
var m = /^image\//, h = /font|woff/, g = /^(audio|video)\//;
|
|
89
|
+
function _(e, t, n, r) {
|
|
90
|
+
let i = p(e), a = i.includes("/") ? i.split("/")[1] : i, o = r.toLowerCase();
|
|
91
|
+
return t === "ws" || t === "wss" || n === 101 || o === "websocket" ? {
|
|
92
|
+
category: "ws",
|
|
93
|
+
type: "ws"
|
|
94
|
+
} : m.test(i) ? {
|
|
95
|
+
category: "img",
|
|
96
|
+
type: a === "svg+xml" ? "svg" : a
|
|
97
|
+
} : h.test(i) ? {
|
|
98
|
+
category: "font",
|
|
99
|
+
type: a.replace("x-", "") || "font"
|
|
100
|
+
} : g.test(i) ? {
|
|
101
|
+
category: "media",
|
|
102
|
+
type: a
|
|
103
|
+
} : i === "text/css" ? {
|
|
104
|
+
category: "css",
|
|
105
|
+
type: "css"
|
|
106
|
+
} : i.includes("javascript") || i.includes("ecmascript") || a === "json" ? {
|
|
107
|
+
category: i.includes("json") || a === "json" ? "xhr" : "js",
|
|
108
|
+
type: a === "json" ? "json" : "js"
|
|
109
|
+
} : i === "text/html" || i === "application/xhtml+xml" ? {
|
|
110
|
+
category: "doc",
|
|
111
|
+
type: "html"
|
|
112
|
+
} : i.includes("xml") ? {
|
|
113
|
+
category: "xhr",
|
|
114
|
+
type: "xml"
|
|
115
|
+
} : i === "application/x-www-form-urlencoded" ? {
|
|
116
|
+
category: "xhr",
|
|
117
|
+
type: "form"
|
|
118
|
+
} : i.startsWith("text/") ? {
|
|
119
|
+
category: "xhr",
|
|
120
|
+
type: a || "text"
|
|
121
|
+
} : i ? {
|
|
122
|
+
category: "other",
|
|
123
|
+
type: a || "bin"
|
|
124
|
+
} : {
|
|
125
|
+
category: "other",
|
|
126
|
+
type: ""
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function v(e) {
|
|
130
|
+
if (!e) return 0;
|
|
131
|
+
let t = Date.parse(e);
|
|
132
|
+
return Number.isFinite(t) ? t : 0;
|
|
133
|
+
}
|
|
134
|
+
function y(e, t) {
|
|
135
|
+
if (!i(e)) return null;
|
|
136
|
+
let n = i(e.request) ? e.request : null, r = i(e.response) ? e.response : null;
|
|
137
|
+
if (!n) return null;
|
|
138
|
+
let s = {
|
|
139
|
+
method: a(n.method, "GET").toUpperCase(),
|
|
140
|
+
url: a(n.url),
|
|
141
|
+
httpVersion: a(n.httpVersion) || void 0,
|
|
142
|
+
headers: l(n.headers),
|
|
143
|
+
queryString: l(n.queryString),
|
|
144
|
+
cookies: u(n.cookies),
|
|
145
|
+
headersSize: o(n.headersSize, -1),
|
|
146
|
+
bodySize: o(n.bodySize, -1),
|
|
147
|
+
postData: d(n.postData)
|
|
148
|
+
}, c = r && i(r.content) ? r.content : null, m = {
|
|
149
|
+
size: o(c?.size, -1),
|
|
150
|
+
compression: o(c?.compression, 0),
|
|
151
|
+
mimeType: a(c?.mimeType) || void 0,
|
|
152
|
+
text: typeof c?.text == "string" ? c.text : void 0,
|
|
153
|
+
encoding: a(c?.encoding) || void 0
|
|
154
|
+
}, h = {
|
|
155
|
+
status: o(r?.status, 0),
|
|
156
|
+
statusText: a(r?.statusText) || void 0,
|
|
157
|
+
httpVersion: a(r?.httpVersion) || void 0,
|
|
158
|
+
headers: l(r?.headers),
|
|
159
|
+
cookies: u(r?.cookies),
|
|
160
|
+
content: m,
|
|
161
|
+
redirectURL: a(r?.redirectURL) || void 0,
|
|
162
|
+
headersSize: o(r?.headersSize, -1),
|
|
163
|
+
bodySize: o(r?.bodySize, -1)
|
|
164
|
+
}, g = i(e.timings) ? {
|
|
165
|
+
blocked: o(e.timings.blocked, -1),
|
|
166
|
+
dns: o(e.timings.dns, -1),
|
|
167
|
+
connect: o(e.timings.connect, -1),
|
|
168
|
+
send: o(e.timings.send, -1),
|
|
169
|
+
wait: o(e.timings.wait, -1),
|
|
170
|
+
receive: o(e.timings.receive, -1),
|
|
171
|
+
ssl: o(e.timings.ssl, -1)
|
|
172
|
+
} : void 0, y = a(e.resourceType) || a(e._resourceType), b = {
|
|
173
|
+
startedDateTime: a(e.startedDateTime) || void 0,
|
|
174
|
+
time: o(e.time, -1),
|
|
175
|
+
request: s,
|
|
176
|
+
response: h,
|
|
177
|
+
timings: g,
|
|
178
|
+
serverIPAddress: a(e.serverIPAddress) || void 0,
|
|
179
|
+
connection: a(e.connection) || void 0,
|
|
180
|
+
resourceType: y || void 0
|
|
181
|
+
}, { scheme: x, host: S, pathname: C, path: w } = f(s.url), T = p(m.mimeType ?? ""), { category: E, type: D } = _(T, x, h.status, y), O = m.size != null && m.size >= 0 ? m.size : Math.max(0, h.bodySize ?? 0), k = s.bodySize != null && s.bodySize >= 0 ? s.bodySize : 0, A = b.startedDateTime ?? "";
|
|
182
|
+
return {
|
|
183
|
+
index: t,
|
|
184
|
+
method: s.method,
|
|
185
|
+
url: s.url,
|
|
186
|
+
scheme: x,
|
|
187
|
+
host: S,
|
|
188
|
+
path: w || "/",
|
|
189
|
+
pathname: C || "/",
|
|
190
|
+
status: h.status,
|
|
191
|
+
statusText: h.statusText ?? "",
|
|
192
|
+
category: E,
|
|
193
|
+
type: D,
|
|
194
|
+
mime: T,
|
|
195
|
+
size: O,
|
|
196
|
+
reqSize: k,
|
|
197
|
+
time: b.time != null && b.time >= 0 ? b.time : 0,
|
|
198
|
+
startedISO: A,
|
|
199
|
+
startedMs: v(A),
|
|
200
|
+
serverIP: b.serverIPAddress ?? "",
|
|
201
|
+
raw: b
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function b(e) {
|
|
205
|
+
let t;
|
|
206
|
+
try {
|
|
207
|
+
t = JSON.parse(e);
|
|
208
|
+
} catch (e) {
|
|
209
|
+
throw Error("不是合法的 JSON:" + (e instanceof Error ? e.message : String(e)));
|
|
210
|
+
}
|
|
211
|
+
let n = i(t) && i(t.log) ? t.log : null;
|
|
212
|
+
if (!n || !Array.isArray(n.entries)) throw Error("不是有效的 HAR 文件(缺少 log.entries)");
|
|
213
|
+
let r = [];
|
|
214
|
+
for (let e of n.entries) {
|
|
215
|
+
let t = y(e, r.length);
|
|
216
|
+
t && r.push(t);
|
|
217
|
+
}
|
|
218
|
+
if (!r.length) throw Error("HAR 中没有可解析的请求条目");
|
|
219
|
+
let o = i(n.creator) ? n.creator : null;
|
|
220
|
+
return {
|
|
221
|
+
entries: r,
|
|
222
|
+
creator: o ? `${a(o.name, "?")} ${a(o.version)}`.trim() : "",
|
|
223
|
+
version: a(n.version, "1.2")
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
var x = {
|
|
227
|
+
kind: "empty",
|
|
228
|
+
text: "",
|
|
229
|
+
mime: "",
|
|
230
|
+
size: 0,
|
|
231
|
+
wasBase64: !1,
|
|
232
|
+
isBase64Guess: !1,
|
|
233
|
+
isImage: !1,
|
|
234
|
+
dataUri: ""
|
|
235
|
+
};
|
|
236
|
+
function S(e) {
|
|
237
|
+
let t = p(e);
|
|
238
|
+
return !t || t.startsWith("text/") ? !0 : t.includes("json") || t.includes("xml") || t.includes("javascript") || t.includes("ecmascript") || t.includes("x-www-form-urlencoded") || t.includes("graphql") || t.includes("csv") || t.includes("yaml");
|
|
239
|
+
}
|
|
240
|
+
function C(e) {
|
|
241
|
+
return m.test(p(e));
|
|
242
|
+
}
|
|
243
|
+
function w(e) {
|
|
244
|
+
let t = e.trim();
|
|
245
|
+
if (t.length < 8 || t.length % 4 != 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(t)) return !1;
|
|
246
|
+
let n = t.indexOf("=");
|
|
247
|
+
return !(n !== -1 && n < t.length - 2);
|
|
248
|
+
}
|
|
249
|
+
function T(e) {
|
|
250
|
+
return e.indexOf("�") !== -1;
|
|
251
|
+
}
|
|
252
|
+
function E(e, t = 4096) {
|
|
253
|
+
let r = n(e.length > t ? e.subarray(0, t) : e);
|
|
254
|
+
return e.length > t ? r + `\n… (${e.length} bytes total)` : r;
|
|
255
|
+
}
|
|
256
|
+
function D(e, t) {
|
|
257
|
+
let n = "", r = 32768;
|
|
258
|
+
for (let t = 0; t < e.length; t += r) n += String.fromCharCode(...e.subarray(t, t + r));
|
|
259
|
+
return `data:${p(t) || "application/octet-stream"};base64,${btoa(n)}`;
|
|
260
|
+
}
|
|
261
|
+
function O(e, n, r, i) {
|
|
262
|
+
if (C(n)) return {
|
|
263
|
+
kind: "binary",
|
|
264
|
+
text: E(e),
|
|
265
|
+
mime: n,
|
|
266
|
+
size: e.length,
|
|
267
|
+
wasBase64: r,
|
|
268
|
+
isBase64Guess: i,
|
|
269
|
+
isImage: !0,
|
|
270
|
+
dataUri: D(e, n)
|
|
271
|
+
};
|
|
272
|
+
let a = t(e), o = T(a) && !S(n);
|
|
273
|
+
return {
|
|
274
|
+
kind: o ? "binary" : "text",
|
|
275
|
+
text: o ? E(e) : a,
|
|
276
|
+
mime: n,
|
|
277
|
+
size: e.length,
|
|
278
|
+
wasBase64: r,
|
|
279
|
+
isBase64Guess: i,
|
|
280
|
+
isImage: !1,
|
|
281
|
+
dataUri: ""
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function k(e) {
|
|
285
|
+
let t = 0;
|
|
286
|
+
for (let n = 0; n < e.length; n++) {
|
|
287
|
+
let r = e.charCodeAt(n);
|
|
288
|
+
r < 128 ? t += 1 : r < 2048 ? t += 2 : r >= 55296 && r <= 56319 ? (t += 4, n++) : t += 3;
|
|
289
|
+
}
|
|
290
|
+
return t;
|
|
291
|
+
}
|
|
292
|
+
function A(e) {
|
|
293
|
+
return "data:image/svg+xml;utf8," + encodeURIComponent(e);
|
|
294
|
+
}
|
|
295
|
+
function j(e, t, n) {
|
|
296
|
+
let r = p(t);
|
|
297
|
+
return {
|
|
298
|
+
kind: "text",
|
|
299
|
+
text: e,
|
|
300
|
+
mime: r,
|
|
301
|
+
size: k(e),
|
|
302
|
+
wasBase64: !1,
|
|
303
|
+
isBase64Guess: n,
|
|
304
|
+
isImage: !1,
|
|
305
|
+
dataUri: r === "image/svg+xml" ? A(e) : ""
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function M(e, t = "auto") {
|
|
309
|
+
let n = e.text ?? "", i = e.mimeType ?? "";
|
|
310
|
+
if (!n) return {
|
|
311
|
+
...x,
|
|
312
|
+
mime: p(i),
|
|
313
|
+
size: Math.max(0, e.size ?? 0)
|
|
314
|
+
};
|
|
315
|
+
let a = (e.encoding ?? "").toLowerCase() === "base64", o = w(n);
|
|
316
|
+
if (t === "base64" || t !== "raw" && (a || o)) try {
|
|
317
|
+
let e = O(r(n), i, !0, o || a);
|
|
318
|
+
return t === "auto" && !a && e.kind === "text" && T(e.text) ? j(n, i, o) : e;
|
|
319
|
+
} catch {}
|
|
320
|
+
return j(n, i, o);
|
|
321
|
+
}
|
|
322
|
+
function N(e, t = "auto") {
|
|
323
|
+
if (!e) return x;
|
|
324
|
+
let n = e.mimeType ?? "";
|
|
325
|
+
if (e.params && e.params.length) return {
|
|
326
|
+
...x,
|
|
327
|
+
kind: "form",
|
|
328
|
+
mime: p(n),
|
|
329
|
+
form: e.params,
|
|
330
|
+
size: e.params.reduce((e, t) => e + (t.value?.length ?? 0), 0)
|
|
331
|
+
};
|
|
332
|
+
let i = e.text ?? "";
|
|
333
|
+
if (!i) return {
|
|
334
|
+
...x,
|
|
335
|
+
mime: p(n)
|
|
336
|
+
};
|
|
337
|
+
let a = (e.encoding ?? "").toLowerCase() === "base64", o = w(i);
|
|
338
|
+
if (t === "base64" || t !== "raw" && (a || o)) try {
|
|
339
|
+
let e = O(r(i), n, !0, o || a);
|
|
340
|
+
return t === "auto" && !a && e.kind === "text" && T(e.text) ? j(i, n, o) : e;
|
|
341
|
+
} catch {}
|
|
342
|
+
return j(i, n, o);
|
|
343
|
+
}
|
|
344
|
+
function P(e, t) {
|
|
345
|
+
let n = p(t), r = e.trim();
|
|
346
|
+
if (n.includes("json") || (r.startsWith("{") || r.startsWith("[")) && (r.endsWith("}") || r.endsWith("]"))) try {
|
|
347
|
+
return {
|
|
348
|
+
text: JSON.stringify(JSON.parse(e), null, 2),
|
|
349
|
+
pretty: !0
|
|
350
|
+
};
|
|
351
|
+
} catch {}
|
|
352
|
+
return {
|
|
353
|
+
text: e,
|
|
354
|
+
pretty: !1
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function F(e) {
|
|
358
|
+
let t = e.startsWith("?") ? e.slice(1) : e;
|
|
359
|
+
return t ? t.split("&").map((e) => {
|
|
360
|
+
let t = e.indexOf("="), n = t === -1 ? e : e.slice(0, t), r = t === -1 ? "" : e.slice(t + 1), i = (e) => {
|
|
361
|
+
try {
|
|
362
|
+
return decodeURIComponent(e.replace(/\+/g, " "));
|
|
363
|
+
} catch {
|
|
364
|
+
return e;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
return {
|
|
368
|
+
name: i(n),
|
|
369
|
+
value: i(r)
|
|
370
|
+
};
|
|
371
|
+
}) : [];
|
|
372
|
+
}
|
|
373
|
+
var I = new Set([
|
|
374
|
+
"content-length",
|
|
375
|
+
"host",
|
|
376
|
+
"connection"
|
|
377
|
+
]);
|
|
378
|
+
function L(e) {
|
|
379
|
+
let t = e.raw.request, n = [`curl '${e.url}'`];
|
|
380
|
+
t.method && t.method !== "GET" && n.push(`-X ${t.method}`);
|
|
381
|
+
for (let e of t.headers) e.name.startsWith(":") || I.has(e.name.toLowerCase()) || n.push(`-H '${e.name}: ${e.value.replace(/'/g, "'\\''")}'`);
|
|
382
|
+
let r = N(t.postData, "auto");
|
|
383
|
+
if (r.kind === "form" && r.form) for (let e of r.form) n.push(`--data-urlencode '${e.name}=${e.value ?? ""}'`);
|
|
384
|
+
else r.text && n.push(`--data-raw '${r.text.replace(/'/g, "'\\''")}'`);
|
|
385
|
+
return n.join(" \\\n ");
|
|
386
|
+
}
|
|
387
|
+
function R(e) {
|
|
388
|
+
return e <= 0 ? "0" : e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(1) + " KB" : (e / (1024 * 1024)).toFixed(2) + " MB";
|
|
389
|
+
}
|
|
390
|
+
function z(e) {
|
|
391
|
+
return e <= 0 ? "0 ms" : e < 1e3 ? Math.round(e) + " ms" : (e / 1e3).toFixed(2) + " s";
|
|
392
|
+
}
|
|
393
|
+
function B(e) {
|
|
394
|
+
return e === 0 ? "s-pending" : e < 300 ? "s-2xx" : e < 400 ? "s-3xx" : e < 500 ? "s-4xx" : "s-5xx";
|
|
395
|
+
}
|
|
396
|
+
//#endregion
|
|
397
|
+
export { M as decodeContent, N as decodePostData, z as fmtMs, R as fmtSize, b as parseHar, F as parseQuery, P as prettyBody, B as statusClass, L as toCurl };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax-highlight `code` with highlight.js, returning escaped HTML.
|
|
3
|
+
* Unlike the original (which polled for a CDN global and could return null),
|
|
4
|
+
* highlight.js is bundled here so this always returns a string. Results are
|
|
5
|
+
* memoized so re-renders / theme toggles don't re-tokenize.
|
|
6
|
+
*/
|
|
7
|
+
export declare function highlightCode(code: string, label?: string): string;
|
|
8
|
+
export declare function escapeHtml(s: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Highlight `code` and split the result into one balanced HTML string PER SOURCE LINE.
|
|
11
|
+
*
|
|
12
|
+
* highlight.js emits the whole block as HTML where a `<span>` can span several lines (a block comment, a
|
|
13
|
+
* template literal). To render line-by-line — which the folding source view (CodeView.vue) needs — we walk
|
|
14
|
+
* that HTML and, at every newline, close all currently-open spans, emit the line, and re-open them at the
|
|
15
|
+
* start of the next, so each returned line is self-contained and valid HTML. With no / unknown language we
|
|
16
|
+
* just escape each raw line. The returned array length always equals `code.split('\n').length`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function highlightLines(code: string, label?: string): string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import e from "highlight.js";
|
|
2
|
+
//#region src/lib/highlight.ts
|
|
3
|
+
var t = /* @__PURE__ */ new Map();
|
|
4
|
+
function n(n, i) {
|
|
5
|
+
let a = `${i ?? ""} ${n}`, o = t.get(a);
|
|
6
|
+
if (o !== void 0) return o;
|
|
7
|
+
let s;
|
|
8
|
+
try {
|
|
9
|
+
s = i && e.getLanguage(i) ? e.highlight(n, {
|
|
10
|
+
language: i,
|
|
11
|
+
ignoreIllegals: !0
|
|
12
|
+
}).value : e.highlightAuto(n).value;
|
|
13
|
+
} catch {
|
|
14
|
+
s = r(n);
|
|
15
|
+
}
|
|
16
|
+
return t.set(a, s), s;
|
|
17
|
+
}
|
|
18
|
+
function r(e) {
|
|
19
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
20
|
+
}
|
|
21
|
+
function i(t, i) {
|
|
22
|
+
if (!i || !e.getLanguage(i)) return t.split("\n").map(r);
|
|
23
|
+
let a = n(t, i), o = [], s = [], c = "", l = 0, u = a.length;
|
|
24
|
+
for (; l < u;) {
|
|
25
|
+
let e = a[l];
|
|
26
|
+
if (e === "<") {
|
|
27
|
+
let e = a.indexOf(">", l), t = e === -1 ? a.slice(l) : a.slice(l, e + 1);
|
|
28
|
+
t.startsWith("</") ? s.pop() : t.endsWith("/>") || s.push(t), c += t, l += t.length;
|
|
29
|
+
} else e === "\n" ? (c += "</span>".repeat(s.length), o.push(c), c = s.join(""), l++) : (c += e, l++);
|
|
30
|
+
}
|
|
31
|
+
return c += "</span>".repeat(s.length), o.push(c), o;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { r as escapeHtml, n as highlightCode, i as highlightLines };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LangOption {
|
|
2
|
+
/** highlight.js language id ('' = plain text, no highlighting). */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Human label shown in the menu and on the selector button. */
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
/** Display name for a highlight.js language id — a curated label, else the capitalized id ('' → 纯文本). */
|
|
8
|
+
export declare function langLabel(id: string): string;
|
|
9
|
+
/** The default quick-pick list (shown when the search box is empty). */
|
|
10
|
+
export declare const COMMON_LANGS: LangOption[];
|
|
11
|
+
/**
|
|
12
|
+
* Filter the FULL set of registered highlight.js grammars by a query (matched against both the id and its
|
|
13
|
+
* label), capped so the menu stays manageable. An empty query returns {@link COMMON_LANGS} (the quick list).
|
|
14
|
+
*/
|
|
15
|
+
export declare function searchLangs(query: string): LangOption[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import e from "highlight.js";
|
|
2
|
+
//#region src/lib/highlightLangs.ts
|
|
3
|
+
var t = {
|
|
4
|
+
"": "纯文本",
|
|
5
|
+
plaintext: "纯文本",
|
|
6
|
+
json: "JSON",
|
|
7
|
+
xml: "XML / HTML",
|
|
8
|
+
yaml: "YAML",
|
|
9
|
+
ini: "INI / TOML",
|
|
10
|
+
toml: "TOML",
|
|
11
|
+
markdown: "Markdown",
|
|
12
|
+
javascript: "JavaScript",
|
|
13
|
+
typescript: "TypeScript",
|
|
14
|
+
python: "Python",
|
|
15
|
+
java: "Java",
|
|
16
|
+
kotlin: "Kotlin",
|
|
17
|
+
go: "Go",
|
|
18
|
+
rust: "Rust",
|
|
19
|
+
c: "C",
|
|
20
|
+
cpp: "C++",
|
|
21
|
+
csharp: "C#",
|
|
22
|
+
php: "PHP",
|
|
23
|
+
ruby: "Ruby",
|
|
24
|
+
swift: "Swift",
|
|
25
|
+
sql: "SQL",
|
|
26
|
+
bash: "Shell / Bash",
|
|
27
|
+
shell: "Shell",
|
|
28
|
+
powershell: "PowerShell",
|
|
29
|
+
dos: "Batch",
|
|
30
|
+
css: "CSS",
|
|
31
|
+
scss: "SCSS",
|
|
32
|
+
less: "Less",
|
|
33
|
+
dockerfile: "Dockerfile",
|
|
34
|
+
makefile: "Makefile",
|
|
35
|
+
diff: "Diff",
|
|
36
|
+
properties: "Properties",
|
|
37
|
+
perl: "Perl",
|
|
38
|
+
lua: "Lua",
|
|
39
|
+
r: "R",
|
|
40
|
+
dart: "Dart",
|
|
41
|
+
scala: "Scala",
|
|
42
|
+
groovy: "Groovy",
|
|
43
|
+
objectivec: "Objective-C",
|
|
44
|
+
graphql: "GraphQL"
|
|
45
|
+
};
|
|
46
|
+
function n(e) {
|
|
47
|
+
return e in t ? t[e] : e.charAt(0).toUpperCase() + e.slice(1);
|
|
48
|
+
}
|
|
49
|
+
var r = [
|
|
50
|
+
"json",
|
|
51
|
+
"xml",
|
|
52
|
+
"yaml",
|
|
53
|
+
"ini",
|
|
54
|
+
"markdown",
|
|
55
|
+
"javascript",
|
|
56
|
+
"typescript",
|
|
57
|
+
"python",
|
|
58
|
+
"java",
|
|
59
|
+
"kotlin",
|
|
60
|
+
"go",
|
|
61
|
+
"rust",
|
|
62
|
+
"c",
|
|
63
|
+
"cpp",
|
|
64
|
+
"csharp",
|
|
65
|
+
"php",
|
|
66
|
+
"ruby",
|
|
67
|
+
"swift",
|
|
68
|
+
"sql",
|
|
69
|
+
"bash",
|
|
70
|
+
"powershell",
|
|
71
|
+
"css",
|
|
72
|
+
"scss",
|
|
73
|
+
"dockerfile",
|
|
74
|
+
"diff"
|
|
75
|
+
].map((e) => ({
|
|
76
|
+
id: e,
|
|
77
|
+
label: n(e)
|
|
78
|
+
}));
|
|
79
|
+
function i(t) {
|
|
80
|
+
let i = t.trim().toLowerCase();
|
|
81
|
+
if (!i) return r;
|
|
82
|
+
let a = [];
|
|
83
|
+
for (let t of e.listLanguages()) {
|
|
84
|
+
let e = n(t);
|
|
85
|
+
if ((t.includes(i) || e.toLowerCase().includes(i)) && a.push({
|
|
86
|
+
id: t,
|
|
87
|
+
label: e
|
|
88
|
+
}), a.length >= 60) break;
|
|
89
|
+
}
|
|
90
|
+
return a;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { n as langLabel, i as searchLangs };
|