vue-stream-markdown 0.0.0-alpha.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.md +21 -0
- package/README.md +96 -0
- package/dist/angular-Chs-UKBr.js +29 -0
- package/dist/angular-component-Cc_FANXU.js +29 -0
- package/dist/apache-COYnc6xR.js +35 -0
- package/dist/asciidoc-BabXBDAL.js +24 -0
- package/dist/assembly-CDqKhexW.js +35 -0
- package/dist/astro-C9kftzFG.js +28 -0
- package/dist/bash-Ce4pNIkV.js +27 -0
- package/dist/batch-CHQBRjFL.js +23 -0
- package/dist/bicep-8jxWtuBF.js +46 -0
- package/dist/blockquote-DFANmQEB.css +13 -0
- package/dist/blockquote-DdEg2gww.js +83 -0
- package/dist/button-BClRCjnc.js +5 -0
- package/dist/button-C12sn_G5.css +24 -0
- package/dist/button-D8xx1WIP.js +202 -0
- package/dist/c-FBUef746.js +25 -0
- package/dist/check-C4xOk8um.js +25 -0
- package/dist/chevron-down-cnOJ4h1g.js +25 -0
- package/dist/circle-alert-CLX-h5rZ.js +28 -0
- package/dist/clojure-BulUroSy.js +18 -0
- package/dist/cmake-CW3vz1Mo.js +35 -0
- package/dist/cobol-CIn3oFju.js +24 -0
- package/dist/code-CP6mPwkq.js +106 -0
- package/dist/code-D8LSp8rK.js +25 -0
- package/dist/code-NAXHb0o2.css +4 -0
- package/dist/code-block-C4D_QNTq.js +408 -0
- package/dist/code-block-D2zjJAww.css +57 -0
- package/dist/code-block-Dzw63Lki.js +9 -0
- package/dist/codeowners-CJggXF_b.js +27 -0
- package/dist/coffeescript-CBrVvzGY.js +23 -0
- package/dist/composables-qhB1h_ed.js +1567 -0
- package/dist/copy-Cabve0xf.js +31 -0
- package/dist/cpp-BTKeuyd-.js +31 -0
- package/dist/crystal-DyIYvZbm.js +24 -0
- package/dist/csharp-NqZ1vyF9.js +22 -0
- package/dist/css-BpR5Lajb.js +26 -0
- package/dist/csv-eCMFnKKK.js +24 -0
- package/dist/cue-TY97dGOQ.js +32 -0
- package/dist/d-NftUsdTd.js +24 -0
- package/dist/dart-DJpwZZbk.js +23 -0
- package/dist/database-aZwE71Px.js +24 -0
- package/dist/delete-BdWzKJCy.js +83 -0
- package/dist/delete-Ci7IJDoT.css +4 -0
- package/dist/diff-CYRzypaU.js +35 -0
- package/dist/docker-CxHBuukH.js +24 -0
- package/dist/download-Bnn7rtYw.js +24 -0
- package/dist/dropdown-Ca_PKF_d.js +5 -0
- package/dist/elixir-BKSxVc1h.js +24 -0
- package/dist/elm-DScuAf3X.js +24 -0
- package/dist/emphasis-BseYvUae.css +4 -0
- package/dist/emphasis-CTuGt1Ok.js +83 -0
- package/dist/en-US-Bfc50l3I.js +27 -0
- package/dist/env-CDAKsodl.js +24 -0
- package/dist/erlang-D2M1ZL3m.js +23 -0
- package/dist/error-component-BIPPxd-M.css +21 -0
- package/dist/error-component-CLEJmPmM.js +4 -0
- package/dist/error-component-CzarUjhh.js +61 -0
- package/dist/eye-CdeX8PhP.js +28 -0
- package/dist/fortran-CORyQ0wt.js +24 -0
- package/dist/fsharp-BJz_Jgpl.js +24 -0
- package/dist/git-DgrlTr1E.js +28 -0
- package/dist/gleam-t_xad9Kw.js +29 -0
- package/dist/go-Cvlh1xtL.js +24 -0
- package/dist/graphql-ApIm0mDD.js +24 -0
- package/dist/groovy-CaLnK8PV.js +23 -0
- package/dist/haml-MwijEO_6.js +35 -0
- package/dist/handlebars-CKdUPI9h.js +24 -0
- package/dist/haskell-NPOXEnck.js +24 -0
- package/dist/haxe-DyKBMsDE.js +23 -0
- package/dist/heading-2vpQQtTH.js +88 -0
- package/dist/heading-KxpVX3-u.css +30 -0
- package/dist/html-C5_wsY4-.css +5 -0
- package/dist/html-CMgES1dE.js +28 -0
- package/dist/html-DL0PcUXX.js +102 -0
- package/dist/http-B9FFNmUr.js +23 -0
- package/dist/image-B77jbMUB.css +46 -0
- package/dist/image-CMZAakWu.js +39 -0
- package/dist/image-heJSlrNv.js +215 -0
- package/dist/index.css +43 -0
- package/dist/index.d.ts +762 -0
- package/dist/index.js +18674 -0
- package/dist/inline-code-CBoqhfz7.js +81 -0
- package/dist/inline-code-Eo65bj3F.css +12 -0
- package/dist/inline-math-B4XO1wMP.js +110 -0
- package/dist/inline-math-DgBjIrPT.css +7 -0
- package/dist/java-iU-L9wJz.js +35 -0
- package/dist/javascript-DtnWdTFC.js +23 -0
- package/dist/jinja-CoWszo_D.js +24 -0
- package/dist/json-C80qKCnh.js +24 -0
- package/dist/julia-DG2BCBLx.js +35 -0
- package/dist/kdl-7twRfIlJ.js +40 -0
- package/dist/kotlin-BjrOgP7R.js +18 -0
- package/dist/latex-DIQfUvG8.js +24 -0
- package/dist/less-BJ1yEAWt.js +24 -0
- package/dist/link-BA_j8di3.css +12 -0
- package/dist/link-DOtoFtxu.js +107 -0
- package/dist/link-DeV4CQOB.js +24 -0
- package/dist/liquid-BqKFZ1wQ.js +24 -0
- package/dist/lisp-oekhB2ti.js +23 -0
- package/dist/list-BCiFKGaz.js +88 -0
- package/dist/list-CcVBNIly.css +11 -0
- package/dist/list-item-Y6Cphjrp.css +15 -0
- package/dist/list-item-p-OLUR_9.js +95 -0
- package/dist/log-D1XEqR9q.js +23 -0
- package/dist/lua-C5Q97-1D.js +28 -0
- package/dist/luau-BT8KwqZ2.js +28 -0
- package/dist/makefile-B4a0ciG4.js +28 -0
- package/dist/markdown-DvNyKsiJ.js +24 -0
- package/dist/marko-BzsIf6bg.js +18 -0
- package/dist/math-Byka28HI.js +110 -0
- package/dist/math-Cq89zpB6.css +11 -0
- package/dist/matlab-cMBkmDhQ.js +28 -0
- package/dist/maximize-4PIqBONS.js +25 -0
- package/dist/mermaid-8JIH2gkQ.js +24 -0
- package/dist/mermaid-C9ZUejzK.css +8 -0
- package/dist/mermaid-X0AFRzfF.js +203 -0
- package/dist/minimize-BJ8htyDF.js +25 -0
- package/dist/modal-CWdgVkH_.css +48 -0
- package/dist/modal-CuQR21UD.js +71 -0
- package/dist/modal-DcpxxDDX.js +3 -0
- package/dist/nextflow-DNmqU1xg.js +24 -0
- package/dist/nginx-DDfYF_rj.js +23 -0
- package/dist/nim-D9xEmy4k.js +24 -0
- package/dist/nix-BV1Deshw.js +18 -0
- package/dist/node-list-C9O-A1aZ.css +11 -0
- package/dist/node-list-CGr_EVtn.js +199 -0
- package/dist/node-list-lgY1wbfQ.js +3 -0
- package/dist/ocaml-BkFn4LL3.js +27 -0
- package/dist/paragraph-DYjqr_Sa.js +83 -0
- package/dist/paragraph-wRNmMYAI.css +6 -0
- package/dist/perl-BytUHDE7.js +24 -0
- package/dist/php-BImJJtNM.js +24 -0
- package/dist/postcss-CrZ9_0sT.js +18 -0
- package/dist/powershell-DYSGu7TM.js +23 -0
- package/dist/previewers-Drlf7IQF.js +10 -0
- package/dist/prisma-BhRvcOFY.js +24 -0
- package/dist/prolog-DuaCKek_.js +24 -0
- package/dist/properties-BbIJwuP-.js +24 -0
- package/dist/proto-CE0aVW11.js +18 -0
- package/dist/pug-B1-IC-Tc.js +24 -0
- package/dist/puppet-8nYquiMG.js +24 -0
- package/dist/python-DhRyfBrD.js +35 -0
- package/dist/r-Cjje17IA.js +28 -0
- package/dist/racket-Dx0gMnpg.js +28 -0
- package/dist/razor-DPht_bdD.js +24 -0
- package/dist/renderer-CZ41eK_V.js +43 -0
- package/dist/ruby-B8RxtCzI.js +24 -0
- package/dist/rust-Cjtli6yf.js +23 -0
- package/dist/sass-Dv3DMzjs.js +24 -0
- package/dist/scala-B7bZGKXq.js +24 -0
- package/dist/scheme-B2PsEdVN.js +24 -0
- package/dist/segmented-BEtO1eyl.js +69 -0
- package/dist/segmented-CWoQcX-H.js +6 -0
- package/dist/segmented-DLmggl-e.css +8 -0
- package/dist/shader-BZzu3zGr.js +24 -0
- package/dist/shiki-CMgjqKKu.css +20 -0
- package/dist/shiki-vToM7Pz1.js +114 -0
- package/dist/solidity-CLieFYpL.js +24 -0
- package/dist/spin-B2FU3Sx6.css +19 -0
- package/dist/spin-Bz4zGBEo.js +3 -0
- package/dist/spin-Ds5W7qC_.js +23 -0
- package/dist/stata-C0yUiO47.js +33 -0
- package/dist/strong-CvOjLZiq.js +83 -0
- package/dist/strong-DpeQmP2J.css +4 -0
- package/dist/svelte-rtF4yNGL.js +23 -0
- package/dist/swift-CzvYoIM0.js +24 -0
- package/dist/table-4ec9FVB_.js +59 -0
- package/dist/table-BWn_kG8W.css +19 -0
- package/dist/table-CJzlDdmv.css +34 -0
- package/dist/table-CZLbUHiJ.js +3 -0
- package/dist/table-DjkiVd9L.js +188 -0
- package/dist/terraform-CD_BZGb-.js +24 -0
- package/dist/text-D098eCyi.css +5 -0
- package/dist/text-D1-vbZ7l.js +23 -0
- package/dist/text-DuONUqRA.js +81 -0
- package/dist/thematic-break-C5zxgoE9.css +6 -0
- package/dist/thematic-break-CcNPEI9Y.js +81 -0
- package/dist/theme.css +67 -0
- package/dist/toml-C6jUF0Xd.js +24 -0
- package/dist/tooltip-Ac_2x9ps.js +4 -0
- package/dist/tooltip-DAngu9Wp.css +5 -0
- package/dist/tooltip-RiXixMIt.js +71 -0
- package/dist/twig-C4dfP84J.js +30 -0
- package/dist/typescript-Bk-pp-cK.js +23 -0
- package/dist/typst-DPCpaVSH.js +24 -0
- package/dist/v-nRGMJ2Ki.js +23 -0
- package/dist/vala-B78bKcY0.js +24 -0
- package/dist/vanilla-BZ8bn5Yz.css +4 -0
- package/dist/vanilla-CA9QO96X.js +3 -0
- package/dist/vanilla-DkX6g0dm.js +87 -0
- package/dist/verilog-CRpkl76S.js +23 -0
- package/dist/vim-DpKnut7b.js +24 -0
- package/dist/vue-D5eadhjo.js +23 -0
- package/dist/xml-Dvx5F-hl.js +24 -0
- package/dist/yaml-DJHrmzSe.js +94 -0
- package/dist/yaml-McBkYbxI.css +5 -0
- package/dist/yaml-n1S8nAOh.js +24 -0
- package/dist/zh-CN-CL1XGe0H.js +27 -0
- package/dist/zig-R-iFzxfW.js +24 -0
- package/dist/zoom-container-BDEP09K9.js +6 -0
- package/dist/zoom-container-BENM7TpV.css +28 -0
- package/dist/zoom-container-BfUO3Ocp.js +113 -0
- package/dist/zoomIn-CEukuh3x.js +28 -0
- package/dist/zoomOut-qlzQyQli.js +28 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1567 @@
|
|
|
1
|
+
import { computed, defineAsyncComponent, inject, provide, ref, unref, watch, watchEffect } from "vue";
|
|
2
|
+
import { setDefaultProps } from "vue-tippy";
|
|
3
|
+
import "tippy.js/dist/tippy.css";
|
|
4
|
+
import "tippy.js/themes/light.css";
|
|
5
|
+
import "tippy.js/dist/border.css";
|
|
6
|
+
import "tippy.js/dist/svg-arrow.css";
|
|
7
|
+
|
|
8
|
+
//#region src/composables/use-context.ts
|
|
9
|
+
const CONTEXT_KEY = Symbol("stream-markdown-context");
|
|
10
|
+
function useContext() {
|
|
11
|
+
const context = injectContext();
|
|
12
|
+
const isDark = computed(() => unref(context.isDark) ?? false);
|
|
13
|
+
function provideContext(ctx) {
|
|
14
|
+
provide(CONTEXT_KEY, {
|
|
15
|
+
...injectContext(),
|
|
16
|
+
...ctx
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function injectContext() {
|
|
20
|
+
return inject(CONTEXT_KEY, {}) || {};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
context,
|
|
24
|
+
provideContext,
|
|
25
|
+
injectContext,
|
|
26
|
+
isDark,
|
|
27
|
+
get getContainer() {
|
|
28
|
+
return context.getContainer || (() => void 0);
|
|
29
|
+
},
|
|
30
|
+
get onCopied() {
|
|
31
|
+
return context.onCopied || (() => {});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/composables/use-controls.ts
|
|
38
|
+
function useControls(options) {
|
|
39
|
+
const controls = computed(() => unref(options.controls) ?? true);
|
|
40
|
+
function isControlEnabled(key) {
|
|
41
|
+
try {
|
|
42
|
+
const config = controls.value;
|
|
43
|
+
if (typeof config === "boolean") return config;
|
|
44
|
+
const path = key.split(".");
|
|
45
|
+
let current = config;
|
|
46
|
+
for (const part of path) {
|
|
47
|
+
if (current === void 0 || current === null || typeof current !== "object") return true;
|
|
48
|
+
current = current[part];
|
|
49
|
+
if (typeof current === "boolean") return current;
|
|
50
|
+
}
|
|
51
|
+
return current === true;
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { isControlEnabled };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/constants/code.ts
|
|
61
|
+
const DEFAULT_LIGHT_THEME = "github-light";
|
|
62
|
+
const DEFAULT_DARK_THEME = "github-dark";
|
|
63
|
+
const LANGUAGE_ALIAS = {};
|
|
64
|
+
const LANGUAGE_EXTENSIONS = {
|
|
65
|
+
"1c-query": "1cq",
|
|
66
|
+
"1c": "1c",
|
|
67
|
+
"文言": "wy",
|
|
68
|
+
"abap": "abap",
|
|
69
|
+
"actionscript-3": "as",
|
|
70
|
+
"ada": "ada",
|
|
71
|
+
"adoc": "adoc",
|
|
72
|
+
"angular-html": "html",
|
|
73
|
+
"angular-ts": "ts",
|
|
74
|
+
"apache": "conf",
|
|
75
|
+
"apex": "cls",
|
|
76
|
+
"apl": "apl",
|
|
77
|
+
"applescript": "applescript",
|
|
78
|
+
"ara": "ara",
|
|
79
|
+
"asciidoc": "adoc",
|
|
80
|
+
"asm": "asm",
|
|
81
|
+
"astro": "astro",
|
|
82
|
+
"awk": "awk",
|
|
83
|
+
"ballerina": "bal",
|
|
84
|
+
"bash": "sh",
|
|
85
|
+
"bat": "bat",
|
|
86
|
+
"batch": "bat",
|
|
87
|
+
"be": "be",
|
|
88
|
+
"beancount": "beancount",
|
|
89
|
+
"berry": "berry",
|
|
90
|
+
"bibtex": "bib",
|
|
91
|
+
"bicep": "bicep",
|
|
92
|
+
"blade": "blade.php",
|
|
93
|
+
"bsl": "bsl",
|
|
94
|
+
"c": "c",
|
|
95
|
+
"c#": "cs",
|
|
96
|
+
"c++": "cpp",
|
|
97
|
+
"cadence": "cdc",
|
|
98
|
+
"cairo": "cairo",
|
|
99
|
+
"cdc": "cdc",
|
|
100
|
+
"clarity": "clar",
|
|
101
|
+
"clj": "clj",
|
|
102
|
+
"clojure": "clj",
|
|
103
|
+
"closure-templates": "soy",
|
|
104
|
+
"cmake": "cmake",
|
|
105
|
+
"cmd": "cmd",
|
|
106
|
+
"cobol": "cob",
|
|
107
|
+
"codeowners": "CODEOWNERS",
|
|
108
|
+
"codeql": "ql",
|
|
109
|
+
"coffee": "coffee",
|
|
110
|
+
"coffeescript": "coffee",
|
|
111
|
+
"common-lisp": "lisp",
|
|
112
|
+
"console": "sh",
|
|
113
|
+
"coq": "v",
|
|
114
|
+
"cpp": "cpp",
|
|
115
|
+
"cql": "cql",
|
|
116
|
+
"crystal": "cr",
|
|
117
|
+
"cs": "cs",
|
|
118
|
+
"csharp": "cs",
|
|
119
|
+
"css": "css",
|
|
120
|
+
"csv": "csv",
|
|
121
|
+
"cue": "cue",
|
|
122
|
+
"cypher": "cql",
|
|
123
|
+
"d": "d",
|
|
124
|
+
"dart": "dart",
|
|
125
|
+
"dax": "dax",
|
|
126
|
+
"desktop": "desktop",
|
|
127
|
+
"diff": "diff",
|
|
128
|
+
"docker": "dockerfile",
|
|
129
|
+
"dockerfile": "dockerfile",
|
|
130
|
+
"dotenv": "env",
|
|
131
|
+
"dream-maker": "dm",
|
|
132
|
+
"edge": "edge",
|
|
133
|
+
"elisp": "el",
|
|
134
|
+
"elixir": "ex",
|
|
135
|
+
"elm": "elm",
|
|
136
|
+
"emacs-lisp": "el",
|
|
137
|
+
"erb": "erb",
|
|
138
|
+
"erl": "erl",
|
|
139
|
+
"erlang": "erl",
|
|
140
|
+
"f": "f",
|
|
141
|
+
"f#": "fs",
|
|
142
|
+
"f03": "f03",
|
|
143
|
+
"f08": "f08",
|
|
144
|
+
"f18": "f18",
|
|
145
|
+
"f77": "f77",
|
|
146
|
+
"f90": "f90",
|
|
147
|
+
"f95": "f95",
|
|
148
|
+
"fennel": "fnl",
|
|
149
|
+
"fish": "fish",
|
|
150
|
+
"fluent": "ftl",
|
|
151
|
+
"for": "for",
|
|
152
|
+
"fortran-fixed-form": "f",
|
|
153
|
+
"fortran-free-form": "f90",
|
|
154
|
+
"fs": "fs",
|
|
155
|
+
"fsharp": "fs",
|
|
156
|
+
"fsl": "fsl",
|
|
157
|
+
"ftl": "ftl",
|
|
158
|
+
"gdresource": "tres",
|
|
159
|
+
"gdscript": "gd",
|
|
160
|
+
"gdshader": "gdshader",
|
|
161
|
+
"genie": "gs",
|
|
162
|
+
"gherkin": "feature",
|
|
163
|
+
"git-commit": "gitcommit",
|
|
164
|
+
"git-rebase": "gitrebase",
|
|
165
|
+
"gjs": "js",
|
|
166
|
+
"gleam": "gleam",
|
|
167
|
+
"glimmer-js": "js",
|
|
168
|
+
"glimmer-ts": "ts",
|
|
169
|
+
"glsl": "glsl",
|
|
170
|
+
"gnuplot": "plt",
|
|
171
|
+
"go": "go",
|
|
172
|
+
"gql": "gql",
|
|
173
|
+
"graphql": "graphql",
|
|
174
|
+
"groovy": "groovy",
|
|
175
|
+
"gts": "gts",
|
|
176
|
+
"hack": "hack",
|
|
177
|
+
"haml": "haml",
|
|
178
|
+
"handlebars": "hbs",
|
|
179
|
+
"haskell": "hs",
|
|
180
|
+
"haxe": "hx",
|
|
181
|
+
"hbs": "hbs",
|
|
182
|
+
"hcl": "hcl",
|
|
183
|
+
"hjson": "hjson",
|
|
184
|
+
"hlsl": "hlsl",
|
|
185
|
+
"hs": "hs",
|
|
186
|
+
"html-derivative": "html",
|
|
187
|
+
"html": "html",
|
|
188
|
+
"http": "http",
|
|
189
|
+
"hxml": "hxml",
|
|
190
|
+
"hy": "hy",
|
|
191
|
+
"imba": "imba",
|
|
192
|
+
"ini": "ini",
|
|
193
|
+
"jade": "jade",
|
|
194
|
+
"java": "java",
|
|
195
|
+
"javascript": "js",
|
|
196
|
+
"jinja": "jinja",
|
|
197
|
+
"jison": "jison",
|
|
198
|
+
"jl": "jl",
|
|
199
|
+
"js": "js",
|
|
200
|
+
"json": "json",
|
|
201
|
+
"json5": "json5",
|
|
202
|
+
"jsonc": "jsonc",
|
|
203
|
+
"jsonl": "jsonl",
|
|
204
|
+
"jsonnet": "jsonnet",
|
|
205
|
+
"jssm": "jssm",
|
|
206
|
+
"jsx": "jsx",
|
|
207
|
+
"julia": "jl",
|
|
208
|
+
"kotlin": "kt",
|
|
209
|
+
"kql": "kql",
|
|
210
|
+
"kt": "kt",
|
|
211
|
+
"kts": "kts",
|
|
212
|
+
"kusto": "kql",
|
|
213
|
+
"latex": "tex",
|
|
214
|
+
"lean": "lean",
|
|
215
|
+
"lean4": "lean",
|
|
216
|
+
"less": "less",
|
|
217
|
+
"liquid": "liquid",
|
|
218
|
+
"lisp": "lisp",
|
|
219
|
+
"lit": "lit",
|
|
220
|
+
"llvm": "ll",
|
|
221
|
+
"log": "log",
|
|
222
|
+
"logo": "logo",
|
|
223
|
+
"lua": "lua",
|
|
224
|
+
"luau": "luau",
|
|
225
|
+
"make": "mak",
|
|
226
|
+
"makefile": "mak",
|
|
227
|
+
"markdown": "md",
|
|
228
|
+
"marko": "marko",
|
|
229
|
+
"matlab": "m",
|
|
230
|
+
"md": "md",
|
|
231
|
+
"mdc": "mdc",
|
|
232
|
+
"mdx": "mdx",
|
|
233
|
+
"mediawiki": "wiki",
|
|
234
|
+
"mermaid": "mmd",
|
|
235
|
+
"mips": "s",
|
|
236
|
+
"mipsasm": "s",
|
|
237
|
+
"mmd": "mmd",
|
|
238
|
+
"mojo": "mojo",
|
|
239
|
+
"move": "move",
|
|
240
|
+
"nar": "nar",
|
|
241
|
+
"narrat": "narrat",
|
|
242
|
+
"nextflow": "nf",
|
|
243
|
+
"nf": "nf",
|
|
244
|
+
"nginx": "conf",
|
|
245
|
+
"nim": "nim",
|
|
246
|
+
"nix": "nix",
|
|
247
|
+
"nu": "nu",
|
|
248
|
+
"nushell": "nu",
|
|
249
|
+
"objc": "m",
|
|
250
|
+
"objective-c": "m",
|
|
251
|
+
"objective-cpp": "mm",
|
|
252
|
+
"ocaml": "ml",
|
|
253
|
+
"pascal": "pas",
|
|
254
|
+
"perl": "pl",
|
|
255
|
+
"perl6": "p6",
|
|
256
|
+
"php": "php",
|
|
257
|
+
"plsql": "pls",
|
|
258
|
+
"po": "po",
|
|
259
|
+
"polar": "polar",
|
|
260
|
+
"postcss": "pcss",
|
|
261
|
+
"pot": "pot",
|
|
262
|
+
"potx": "potx",
|
|
263
|
+
"powerquery": "pq",
|
|
264
|
+
"powershell": "ps1",
|
|
265
|
+
"prisma": "prisma",
|
|
266
|
+
"prolog": "pl",
|
|
267
|
+
"properties": "properties",
|
|
268
|
+
"proto": "proto",
|
|
269
|
+
"protobuf": "proto",
|
|
270
|
+
"ps": "ps",
|
|
271
|
+
"ps1": "ps1",
|
|
272
|
+
"pug": "pug",
|
|
273
|
+
"puppet": "pp",
|
|
274
|
+
"purescript": "purs",
|
|
275
|
+
"py": "py",
|
|
276
|
+
"python": "py",
|
|
277
|
+
"ql": "ql",
|
|
278
|
+
"qml": "qml",
|
|
279
|
+
"qmldir": "qmldir",
|
|
280
|
+
"qss": "qss",
|
|
281
|
+
"r": "r",
|
|
282
|
+
"racket": "rkt",
|
|
283
|
+
"raku": "raku",
|
|
284
|
+
"razor": "cshtml",
|
|
285
|
+
"rb": "rb",
|
|
286
|
+
"reg": "reg",
|
|
287
|
+
"regex": "regex",
|
|
288
|
+
"regexp": "regexp",
|
|
289
|
+
"rel": "rel",
|
|
290
|
+
"riscv": "s",
|
|
291
|
+
"rs": "rs",
|
|
292
|
+
"rst": "rst",
|
|
293
|
+
"ruby": "rb",
|
|
294
|
+
"rust": "rs",
|
|
295
|
+
"sas": "sas",
|
|
296
|
+
"sass": "sass",
|
|
297
|
+
"scala": "scala",
|
|
298
|
+
"scheme": "scm",
|
|
299
|
+
"scss": "scss",
|
|
300
|
+
"sdbl": "sdbl",
|
|
301
|
+
"sh": "sh",
|
|
302
|
+
"shader": "shader",
|
|
303
|
+
"shaderlab": "shader",
|
|
304
|
+
"shell": "sh",
|
|
305
|
+
"shellscript": "sh",
|
|
306
|
+
"shellsession": "sh",
|
|
307
|
+
"smalltalk": "st",
|
|
308
|
+
"solidity": "sol",
|
|
309
|
+
"soy": "soy",
|
|
310
|
+
"sparql": "rq",
|
|
311
|
+
"spl": "spl",
|
|
312
|
+
"splunk": "spl",
|
|
313
|
+
"sql": "sql",
|
|
314
|
+
"ssh-config": "config",
|
|
315
|
+
"stata": "do",
|
|
316
|
+
"styl": "styl",
|
|
317
|
+
"stylus": "styl",
|
|
318
|
+
"svelte": "svelte",
|
|
319
|
+
"swift": "swift",
|
|
320
|
+
"system-verilog": "sv",
|
|
321
|
+
"systemd": "service",
|
|
322
|
+
"talon": "talon",
|
|
323
|
+
"talonscript": "talon",
|
|
324
|
+
"tasl": "tasl",
|
|
325
|
+
"tcl": "tcl",
|
|
326
|
+
"templ": "templ",
|
|
327
|
+
"terraform": "tf",
|
|
328
|
+
"tex": "tex",
|
|
329
|
+
"tf": "tf",
|
|
330
|
+
"tfvars": "tfvars",
|
|
331
|
+
"toml": "toml",
|
|
332
|
+
"ts-tags": "ts",
|
|
333
|
+
"ts": "ts",
|
|
334
|
+
"tsp": "tsp",
|
|
335
|
+
"tsv": "tsv",
|
|
336
|
+
"tsx": "tsx",
|
|
337
|
+
"turtle": "ttl",
|
|
338
|
+
"twig": "twig",
|
|
339
|
+
"typ": "typ",
|
|
340
|
+
"typescript": "ts",
|
|
341
|
+
"typespec": "tsp",
|
|
342
|
+
"typst": "typ",
|
|
343
|
+
"v": "v",
|
|
344
|
+
"vala": "vala",
|
|
345
|
+
"vb": "vb",
|
|
346
|
+
"verilog": "v",
|
|
347
|
+
"vhdl": "vhdl",
|
|
348
|
+
"vim": "vim",
|
|
349
|
+
"viml": "vim",
|
|
350
|
+
"vimscript": "vim",
|
|
351
|
+
"vue-html": "html",
|
|
352
|
+
"vue-vine": "vine",
|
|
353
|
+
"vue": "vue",
|
|
354
|
+
"vy": "vy",
|
|
355
|
+
"vyper": "vy",
|
|
356
|
+
"wasm": "wasm",
|
|
357
|
+
"wenyan": "wy",
|
|
358
|
+
"wgsl": "wgsl",
|
|
359
|
+
"wiki": "wiki",
|
|
360
|
+
"wikitext": "wiki",
|
|
361
|
+
"wit": "wit",
|
|
362
|
+
"wl": "wl",
|
|
363
|
+
"wolfram": "wl",
|
|
364
|
+
"xml": "xml",
|
|
365
|
+
"xsl": "xsl",
|
|
366
|
+
"yaml": "yaml",
|
|
367
|
+
"yml": "yml",
|
|
368
|
+
"zenscript": "zs",
|
|
369
|
+
"zig": "zig",
|
|
370
|
+
"zsh": "zsh"
|
|
371
|
+
};
|
|
372
|
+
const LANGUAGE_ICONS = {
|
|
373
|
+
"adoc": defineAsyncComponent(() => import("./asciidoc-BabXBDAL.js")),
|
|
374
|
+
"angular-html": defineAsyncComponent(() => import("./angular-Chs-UKBr.js")),
|
|
375
|
+
"angular-ts": defineAsyncComponent(() => import("./angular-component-Cc_FANXU.js")),
|
|
376
|
+
"apache": defineAsyncComponent(() => import("./apache-COYnc6xR.js")),
|
|
377
|
+
"asciidoc": defineAsyncComponent(() => import("./asciidoc-BabXBDAL.js")),
|
|
378
|
+
"asm": defineAsyncComponent(() => import("./assembly-CDqKhexW.js")),
|
|
379
|
+
"astro": defineAsyncComponent(() => import("./astro-C9kftzFG.js")),
|
|
380
|
+
"bash": defineAsyncComponent(() => import("./bash-Ce4pNIkV.js")),
|
|
381
|
+
"bat": defineAsyncComponent(() => import("./batch-CHQBRjFL.js")),
|
|
382
|
+
"batch": defineAsyncComponent(() => import("./batch-CHQBRjFL.js")),
|
|
383
|
+
"bicep": defineAsyncComponent(() => import("./bicep-8jxWtuBF.js")),
|
|
384
|
+
"c": defineAsyncComponent(() => import("./c-FBUef746.js")),
|
|
385
|
+
"c#": defineAsyncComponent(() => import("./csharp-NqZ1vyF9.js")),
|
|
386
|
+
"c++": defineAsyncComponent(() => import("./cpp-BTKeuyd-.js")),
|
|
387
|
+
"cjs": defineAsyncComponent(() => import("./javascript-DtnWdTFC.js")),
|
|
388
|
+
"clj": defineAsyncComponent(() => import("./clojure-BulUroSy.js")),
|
|
389
|
+
"clojure": defineAsyncComponent(() => import("./clojure-BulUroSy.js")),
|
|
390
|
+
"cmake": defineAsyncComponent(() => import("./cmake-CW3vz1Mo.js")),
|
|
391
|
+
"cmd": defineAsyncComponent(() => import("./batch-CHQBRjFL.js")),
|
|
392
|
+
"cobol": defineAsyncComponent(() => import("./cobol-CIn3oFju.js")),
|
|
393
|
+
"codeowners": defineAsyncComponent(() => import("./codeowners-CJggXF_b.js")),
|
|
394
|
+
"coffee": defineAsyncComponent(() => import("./coffeescript-CBrVvzGY.js")),
|
|
395
|
+
"coffeescript": defineAsyncComponent(() => import("./coffeescript-CBrVvzGY.js")),
|
|
396
|
+
"cpp": defineAsyncComponent(() => import("./cpp-BTKeuyd-.js")),
|
|
397
|
+
"crystal": defineAsyncComponent(() => import("./crystal-DyIYvZbm.js")),
|
|
398
|
+
"cs": defineAsyncComponent(() => import("./csharp-NqZ1vyF9.js")),
|
|
399
|
+
"csharp": defineAsyncComponent(() => import("./csharp-NqZ1vyF9.js")),
|
|
400
|
+
"css": defineAsyncComponent(() => import("./css-BpR5Lajb.js")),
|
|
401
|
+
"csv": defineAsyncComponent(() => import("./csv-eCMFnKKK.js")),
|
|
402
|
+
"cts": defineAsyncComponent(() => import("./typescript-Bk-pp-cK.js")),
|
|
403
|
+
"cue": defineAsyncComponent(() => import("./cue-TY97dGOQ.js")),
|
|
404
|
+
"d": defineAsyncComponent(() => import("./d-NftUsdTd.js")),
|
|
405
|
+
"dart": defineAsyncComponent(() => import("./dart-DJpwZZbk.js")),
|
|
406
|
+
"diff": defineAsyncComponent(() => import("./diff-CYRzypaU.js")),
|
|
407
|
+
"docker": defineAsyncComponent(() => import("./docker-CxHBuukH.js")),
|
|
408
|
+
"dockerfile": defineAsyncComponent(() => import("./docker-CxHBuukH.js")),
|
|
409
|
+
"dotenv": defineAsyncComponent(() => import("./env-CDAKsodl.js")),
|
|
410
|
+
"elixir": defineAsyncComponent(() => import("./elixir-BKSxVc1h.js")),
|
|
411
|
+
"elm": defineAsyncComponent(() => import("./elm-DScuAf3X.js")),
|
|
412
|
+
"erb": defineAsyncComponent(() => import("./ruby-B8RxtCzI.js")),
|
|
413
|
+
"erl": defineAsyncComponent(() => import("./erlang-D2M1ZL3m.js")),
|
|
414
|
+
"erlang": defineAsyncComponent(() => import("./erlang-D2M1ZL3m.js")),
|
|
415
|
+
"f": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
416
|
+
"f#": defineAsyncComponent(() => import("./fsharp-BJz_Jgpl.js")),
|
|
417
|
+
"f03": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
418
|
+
"f08": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
419
|
+
"f18": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
420
|
+
"f77": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
421
|
+
"f90": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
422
|
+
"f95": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
423
|
+
"for": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
424
|
+
"fortran-fixed-form": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
425
|
+
"fortran-free-form": defineAsyncComponent(() => import("./fortran-CORyQ0wt.js")),
|
|
426
|
+
"fs": defineAsyncComponent(() => import("./fsharp-BJz_Jgpl.js")),
|
|
427
|
+
"fsharp": defineAsyncComponent(() => import("./fsharp-BJz_Jgpl.js")),
|
|
428
|
+
"git-commit": defineAsyncComponent(() => import("./git-DgrlTr1E.js")),
|
|
429
|
+
"git-rebase": defineAsyncComponent(() => import("./git-DgrlTr1E.js")),
|
|
430
|
+
"gleam": defineAsyncComponent(() => import("./gleam-t_xad9Kw.js")),
|
|
431
|
+
"go": defineAsyncComponent(() => import("./go-Cvlh1xtL.js")),
|
|
432
|
+
"gql": defineAsyncComponent(() => import("./graphql-ApIm0mDD.js")),
|
|
433
|
+
"graphql": defineAsyncComponent(() => import("./graphql-ApIm0mDD.js")),
|
|
434
|
+
"groovy": defineAsyncComponent(() => import("./groovy-CaLnK8PV.js")),
|
|
435
|
+
"haml": defineAsyncComponent(() => import("./haml-MwijEO_6.js")),
|
|
436
|
+
"handlebars": defineAsyncComponent(() => import("./handlebars-CKdUPI9h.js")),
|
|
437
|
+
"haskell": defineAsyncComponent(() => import("./haskell-NPOXEnck.js")),
|
|
438
|
+
"haxe": defineAsyncComponent(() => import("./haxe-DyKBMsDE.js")),
|
|
439
|
+
"hbs": defineAsyncComponent(() => import("./handlebars-CKdUPI9h.js")),
|
|
440
|
+
"hs": defineAsyncComponent(() => import("./haskell-NPOXEnck.js")),
|
|
441
|
+
"html": defineAsyncComponent(() => import("./html-CMgES1dE.js")),
|
|
442
|
+
"http": defineAsyncComponent(() => import("./http-B9FFNmUr.js")),
|
|
443
|
+
"jade": defineAsyncComponent(() => import("./pug-B1-IC-Tc.js")),
|
|
444
|
+
"java": defineAsyncComponent(() => import("./java-iU-L9wJz.js")),
|
|
445
|
+
"javascript": defineAsyncComponent(() => import("./javascript-DtnWdTFC.js")),
|
|
446
|
+
"jinja": defineAsyncComponent(() => import("./jinja-CoWszo_D.js")),
|
|
447
|
+
"jl": defineAsyncComponent(() => import("./julia-DG2BCBLx.js")),
|
|
448
|
+
"js": defineAsyncComponent(() => import("./javascript-DtnWdTFC.js")),
|
|
449
|
+
"json": defineAsyncComponent(() => import("./json-C80qKCnh.js")),
|
|
450
|
+
"json5": defineAsyncComponent(() => import("./json-C80qKCnh.js")),
|
|
451
|
+
"jsonc": defineAsyncComponent(() => import("./json-C80qKCnh.js")),
|
|
452
|
+
"jsonl": defineAsyncComponent(() => import("./json-C80qKCnh.js")),
|
|
453
|
+
"jsx": defineAsyncComponent(() => import("./javascript-DtnWdTFC.js")),
|
|
454
|
+
"julia": defineAsyncComponent(() => import("./julia-DG2BCBLx.js")),
|
|
455
|
+
"kdl": defineAsyncComponent(() => import("./kdl-7twRfIlJ.js")),
|
|
456
|
+
"kotlin": defineAsyncComponent(() => import("./kotlin-BjrOgP7R.js")),
|
|
457
|
+
"kt": defineAsyncComponent(() => import("./kotlin-BjrOgP7R.js")),
|
|
458
|
+
"kts": defineAsyncComponent(() => import("./kotlin-BjrOgP7R.js")),
|
|
459
|
+
"latex": defineAsyncComponent(() => import("./latex-DIQfUvG8.js")),
|
|
460
|
+
"less": defineAsyncComponent(() => import("./less-BJ1yEAWt.js")),
|
|
461
|
+
"liquid": defineAsyncComponent(() => import("./liquid-BqKFZ1wQ.js")),
|
|
462
|
+
"lisp": defineAsyncComponent(() => import("./lisp-oekhB2ti.js")),
|
|
463
|
+
"log": defineAsyncComponent(() => import("./log-D1XEqR9q.js")),
|
|
464
|
+
"lua": defineAsyncComponent(() => import("./lua-C5Q97-1D.js")),
|
|
465
|
+
"luau": defineAsyncComponent(() => import("./luau-BT8KwqZ2.js")),
|
|
466
|
+
"make": defineAsyncComponent(() => import("./makefile-B4a0ciG4.js")),
|
|
467
|
+
"makefile": defineAsyncComponent(() => import("./makefile-B4a0ciG4.js")),
|
|
468
|
+
"markdown": defineAsyncComponent(() => import("./markdown-DvNyKsiJ.js")),
|
|
469
|
+
"marko": defineAsyncComponent(() => import("./marko-BzsIf6bg.js")),
|
|
470
|
+
"matlab": defineAsyncComponent(() => import("./matlab-cMBkmDhQ.js")),
|
|
471
|
+
"md": defineAsyncComponent(() => import("./markdown-DvNyKsiJ.js")),
|
|
472
|
+
"mdc": defineAsyncComponent(() => import("./markdown-DvNyKsiJ.js")),
|
|
473
|
+
"mdx": defineAsyncComponent(() => import("./markdown-DvNyKsiJ.js")),
|
|
474
|
+
"mermaid": defineAsyncComponent(() => import("./mermaid-8JIH2gkQ.js")),
|
|
475
|
+
"mjs": defineAsyncComponent(() => import("./javascript-DtnWdTFC.js")),
|
|
476
|
+
"mmd": defineAsyncComponent(() => import("./mermaid-8JIH2gkQ.js")),
|
|
477
|
+
"mts": defineAsyncComponent(() => import("./typescript-Bk-pp-cK.js")),
|
|
478
|
+
"nextflow": defineAsyncComponent(() => import("./nextflow-DNmqU1xg.js")),
|
|
479
|
+
"nf": defineAsyncComponent(() => import("./nextflow-DNmqU1xg.js")),
|
|
480
|
+
"nginx": defineAsyncComponent(() => import("./nginx-DDfYF_rj.js")),
|
|
481
|
+
"nim": defineAsyncComponent(() => import("./nim-D9xEmy4k.js")),
|
|
482
|
+
"nix": defineAsyncComponent(() => import("./nix-BV1Deshw.js")),
|
|
483
|
+
"ocaml": defineAsyncComponent(() => import("./ocaml-BkFn4LL3.js")),
|
|
484
|
+
"perl": defineAsyncComponent(() => import("./perl-BytUHDE7.js")),
|
|
485
|
+
"php": defineAsyncComponent(() => import("./php-BImJJtNM.js")),
|
|
486
|
+
"postcss": defineAsyncComponent(() => import("./postcss-CrZ9_0sT.js")),
|
|
487
|
+
"powershell": defineAsyncComponent(() => import("./powershell-DYSGu7TM.js")),
|
|
488
|
+
"prisma": defineAsyncComponent(() => import("./prisma-BhRvcOFY.js")),
|
|
489
|
+
"prolog": defineAsyncComponent(() => import("./prolog-DuaCKek_.js")),
|
|
490
|
+
"properties": defineAsyncComponent(() => import("./properties-BbIJwuP-.js")),
|
|
491
|
+
"proto": defineAsyncComponent(() => import("./proto-CE0aVW11.js")),
|
|
492
|
+
"protobuf": defineAsyncComponent(() => import("./proto-CE0aVW11.js")),
|
|
493
|
+
"ps": defineAsyncComponent(() => import("./powershell-DYSGu7TM.js")),
|
|
494
|
+
"ps1": defineAsyncComponent(() => import("./powershell-DYSGu7TM.js")),
|
|
495
|
+
"pug": defineAsyncComponent(() => import("./pug-B1-IC-Tc.js")),
|
|
496
|
+
"puppet": defineAsyncComponent(() => import("./puppet-8nYquiMG.js")),
|
|
497
|
+
"py": defineAsyncComponent(() => import("./python-DhRyfBrD.js")),
|
|
498
|
+
"python": defineAsyncComponent(() => import("./python-DhRyfBrD.js")),
|
|
499
|
+
"r": defineAsyncComponent(() => import("./r-Cjje17IA.js")),
|
|
500
|
+
"racket": defineAsyncComponent(() => import("./racket-Dx0gMnpg.js")),
|
|
501
|
+
"razor": defineAsyncComponent(() => import("./razor-DPht_bdD.js")),
|
|
502
|
+
"rb": defineAsyncComponent(() => import("./ruby-B8RxtCzI.js")),
|
|
503
|
+
"rs": defineAsyncComponent(() => import("./rust-Cjtli6yf.js")),
|
|
504
|
+
"ruby": defineAsyncComponent(() => import("./ruby-B8RxtCzI.js")),
|
|
505
|
+
"rust": defineAsyncComponent(() => import("./rust-Cjtli6yf.js")),
|
|
506
|
+
"sass": defineAsyncComponent(() => import("./sass-Dv3DMzjs.js")),
|
|
507
|
+
"scala": defineAsyncComponent(() => import("./scala-B7bZGKXq.js")),
|
|
508
|
+
"scheme": defineAsyncComponent(() => import("./scheme-B2PsEdVN.js")),
|
|
509
|
+
"scss": defineAsyncComponent(() => import("./sass-Dv3DMzjs.js")),
|
|
510
|
+
"sh": defineAsyncComponent(() => import("./bash-Ce4pNIkV.js")),
|
|
511
|
+
"shader": defineAsyncComponent(() => import("./shader-BZzu3zGr.js")),
|
|
512
|
+
"shell": defineAsyncComponent(() => import("./bash-Ce4pNIkV.js")),
|
|
513
|
+
"shellscript": defineAsyncComponent(() => import("./bash-Ce4pNIkV.js")),
|
|
514
|
+
"solidity": defineAsyncComponent(() => import("./solidity-CLieFYpL.js")),
|
|
515
|
+
"sql": defineAsyncComponent(() => import("./database-aZwE71Px.js")),
|
|
516
|
+
"stata": defineAsyncComponent(() => import("./stata-C0yUiO47.js")),
|
|
517
|
+
"styl": defineAsyncComponent(() => import("./sass-Dv3DMzjs.js")),
|
|
518
|
+
"stylus": defineAsyncComponent(() => import("./sass-Dv3DMzjs.js")),
|
|
519
|
+
"svelte": defineAsyncComponent(() => import("./svelte-rtF4yNGL.js")),
|
|
520
|
+
"swift": defineAsyncComponent(() => import("./swift-CzvYoIM0.js")),
|
|
521
|
+
"terraform": defineAsyncComponent(() => import("./terraform-CD_BZGb-.js")),
|
|
522
|
+
"tex": defineAsyncComponent(() => import("./latex-DIQfUvG8.js")),
|
|
523
|
+
"text": defineAsyncComponent(() => import("./text-D1-vbZ7l.js")),
|
|
524
|
+
"tf": defineAsyncComponent(() => import("./terraform-CD_BZGb-.js")),
|
|
525
|
+
"tfvars": defineAsyncComponent(() => import("./terraform-CD_BZGb-.js")),
|
|
526
|
+
"toml": defineAsyncComponent(() => import("./toml-C6jUF0Xd.js")),
|
|
527
|
+
"ts": defineAsyncComponent(() => import("./typescript-Bk-pp-cK.js")),
|
|
528
|
+
"tsv": defineAsyncComponent(() => import("./csv-eCMFnKKK.js")),
|
|
529
|
+
"tsx": defineAsyncComponent(() => import("./typescript-Bk-pp-cK.js")),
|
|
530
|
+
"twig": defineAsyncComponent(() => import("./twig-C4dfP84J.js")),
|
|
531
|
+
"typ": defineAsyncComponent(() => import("./typst-DPCpaVSH.js")),
|
|
532
|
+
"typescript": defineAsyncComponent(() => import("./typescript-Bk-pp-cK.js")),
|
|
533
|
+
"typst": defineAsyncComponent(() => import("./typst-DPCpaVSH.js")),
|
|
534
|
+
"v": defineAsyncComponent(() => import("./v-nRGMJ2Ki.js")),
|
|
535
|
+
"vala": defineAsyncComponent(() => import("./vala-B78bKcY0.js")),
|
|
536
|
+
"verilog": defineAsyncComponent(() => import("./verilog-CRpkl76S.js")),
|
|
537
|
+
"vim": defineAsyncComponent(() => import("./vim-DpKnut7b.js")),
|
|
538
|
+
"viml": defineAsyncComponent(() => import("./vim-DpKnut7b.js")),
|
|
539
|
+
"vimscript": defineAsyncComponent(() => import("./vim-DpKnut7b.js")),
|
|
540
|
+
"vue-html": defineAsyncComponent(() => import("./vue-D5eadhjo.js")),
|
|
541
|
+
"vue-vine": defineAsyncComponent(() => import("./vue-D5eadhjo.js")),
|
|
542
|
+
"vue": defineAsyncComponent(() => import("./vue-D5eadhjo.js")),
|
|
543
|
+
"xml": defineAsyncComponent(() => import("./xml-Dvx5F-hl.js")),
|
|
544
|
+
"xsl": defineAsyncComponent(() => import("./xml-Dvx5F-hl.js")),
|
|
545
|
+
"yaml": defineAsyncComponent(() => import("./yaml-n1S8nAOh.js")),
|
|
546
|
+
"yml": defineAsyncComponent(() => import("./yaml-n1S8nAOh.js")),
|
|
547
|
+
"zig": defineAsyncComponent(() => import("./zig-R-iFzxfW.js")),
|
|
548
|
+
"zsh": defineAsyncComponent(() => import("./bash-Ce4pNIkV.js"))
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/constants/harden.ts
|
|
553
|
+
const DEFAULT_HARDEN_OPTIONS = {
|
|
554
|
+
allowedLinkPrefixes: ["*"],
|
|
555
|
+
allowedImagePrefixes: ["*"],
|
|
556
|
+
allowedProtocols: ["*"],
|
|
557
|
+
allowDataImages: true
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/constants/icons.ts
|
|
562
|
+
const ICONS = {
|
|
563
|
+
check: defineAsyncComponent(() => import("./check-C4xOk8um.js")),
|
|
564
|
+
code: defineAsyncComponent(() => import("./code-D8LSp8rK.js")),
|
|
565
|
+
collapse: defineAsyncComponent(() => import("./chevron-down-cnOJ4h1g.js")),
|
|
566
|
+
copy: defineAsyncComponent(() => import("./copy-Cabve0xf.js")),
|
|
567
|
+
download: defineAsyncComponent(() => import("./download-Bnn7rtYw.js")),
|
|
568
|
+
error: defineAsyncComponent(() => import("./circle-alert-CLX-h5rZ.js")),
|
|
569
|
+
image: defineAsyncComponent(() => import("./image-CMZAakWu.js")),
|
|
570
|
+
link: defineAsyncComponent(() => import("./link-DeV4CQOB.js")),
|
|
571
|
+
maximize: defineAsyncComponent(() => import("./maximize-4PIqBONS.js")),
|
|
572
|
+
mermaid: defineAsyncComponent(() => import("./mermaid-8JIH2gkQ.js")),
|
|
573
|
+
minimize: defineAsyncComponent(() => import("./minimize-BJ8htyDF.js")),
|
|
574
|
+
preview: defineAsyncComponent(() => import("./eye-CdeX8PhP.js")),
|
|
575
|
+
zoomIn: defineAsyncComponent(() => import("./zoomIn-CEukuh3x.js")),
|
|
576
|
+
zoomOut: defineAsyncComponent(() => import("./zoomOut-qlzQyQli.js"))
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/utils/harden.ts
|
|
581
|
+
const safeProtocols = new Set([
|
|
582
|
+
"https:",
|
|
583
|
+
"http:",
|
|
584
|
+
"irc:",
|
|
585
|
+
"ircs:",
|
|
586
|
+
"mailto:",
|
|
587
|
+
"xmpp:",
|
|
588
|
+
"blob:"
|
|
589
|
+
]);
|
|
590
|
+
const blockedProtocols = new Set([
|
|
591
|
+
"javascript:",
|
|
592
|
+
"data:",
|
|
593
|
+
"file:",
|
|
594
|
+
"vbscript:"
|
|
595
|
+
]);
|
|
596
|
+
function parseUrl(url, defaultOrigin) {
|
|
597
|
+
if (typeof url !== "string") return null;
|
|
598
|
+
try {
|
|
599
|
+
return new URL(url);
|
|
600
|
+
} catch {
|
|
601
|
+
if (defaultOrigin) try {
|
|
602
|
+
return new URL(url, defaultOrigin);
|
|
603
|
+
} catch {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function isPathRelativeUrl(url) {
|
|
610
|
+
if (typeof url !== "string") return false;
|
|
611
|
+
return url.startsWith("/");
|
|
612
|
+
}
|
|
613
|
+
function transformUrl(url, allowedPrefixes, defaultOrigin, allowDataImages = false, isImage = false, allowedProtocols = []) {
|
|
614
|
+
if (!url) return null;
|
|
615
|
+
if (typeof url === "string" && url.startsWith("#") && !isImage) try {
|
|
616
|
+
if (new URL(url, "http://example.com").hash === url) return url;
|
|
617
|
+
} catch {}
|
|
618
|
+
if (typeof url === "string" && url.startsWith("data:")) {
|
|
619
|
+
if (isImage && allowDataImages && url.startsWith("data:image/")) return url;
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
if (typeof url === "string" && url.startsWith("blob:")) {
|
|
623
|
+
try {
|
|
624
|
+
if (new URL(url).protocol === "blob:" && url.length > 5) {
|
|
625
|
+
const afterProtocol = url.substring(5);
|
|
626
|
+
if (afterProtocol && afterProtocol.length > 0 && afterProtocol !== "invalid") return url;
|
|
627
|
+
}
|
|
628
|
+
} catch {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
const parsedUrl = parseUrl(url, defaultOrigin);
|
|
634
|
+
if (!parsedUrl) return null;
|
|
635
|
+
if (blockedProtocols.has(parsedUrl.protocol)) return null;
|
|
636
|
+
if (!(safeProtocols.has(parsedUrl.protocol) || allowedProtocols.includes(parsedUrl.protocol) || allowedProtocols.includes("*"))) return null;
|
|
637
|
+
if (parsedUrl.protocol === "mailto:" || !parsedUrl.protocol.match(/^https?:$/)) return parsedUrl.href;
|
|
638
|
+
const inputWasRelative = isPathRelativeUrl(url);
|
|
639
|
+
if (parsedUrl && allowedPrefixes.some((prefix) => {
|
|
640
|
+
const parsedPrefix = parseUrl(prefix, defaultOrigin);
|
|
641
|
+
if (!parsedPrefix) return false;
|
|
642
|
+
if (parsedPrefix.origin !== parsedUrl.origin) return false;
|
|
643
|
+
return parsedUrl.href.startsWith(parsedPrefix.href);
|
|
644
|
+
})) {
|
|
645
|
+
if (inputWasRelative) return parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
|
|
646
|
+
return parsedUrl.href;
|
|
647
|
+
}
|
|
648
|
+
if (allowedPrefixes.includes("*")) {
|
|
649
|
+
if (parsedUrl.protocol !== "https:" && parsedUrl.protocol !== "http:") return null;
|
|
650
|
+
if (inputWasRelative) return parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
|
|
651
|
+
return parsedUrl.href;
|
|
652
|
+
}
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/utils/helper.ts
|
|
658
|
+
function flow(fns) {
|
|
659
|
+
return (input) => fns.reduce((acc, fn) => fn(acc), input);
|
|
660
|
+
}
|
|
661
|
+
function save(filename, content, mimeType) {
|
|
662
|
+
const blob = typeof content === "string" ? new Blob([content], { type: mimeType }) : content;
|
|
663
|
+
const url = URL.createObjectURL(blob);
|
|
664
|
+
const a = document.createElement("a");
|
|
665
|
+
a.href = url;
|
|
666
|
+
a.download = filename;
|
|
667
|
+
document.body.appendChild(a);
|
|
668
|
+
a.click();
|
|
669
|
+
document.body.removeChild(a);
|
|
670
|
+
URL.revokeObjectURL(url);
|
|
671
|
+
}
|
|
672
|
+
function svgToPngBlob(svgString, options) {
|
|
673
|
+
const scale = (options === null || options === void 0 ? void 0 : options.scale) ?? 5;
|
|
674
|
+
return new Promise((resolve, reject) => {
|
|
675
|
+
const encoded = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(svgString)))}`;
|
|
676
|
+
const img = new Image();
|
|
677
|
+
img.crossOrigin = "anonymous";
|
|
678
|
+
img.onload = () => {
|
|
679
|
+
const canvas = document.createElement("canvas");
|
|
680
|
+
const w = img.width * scale;
|
|
681
|
+
const h$1 = img.height * scale;
|
|
682
|
+
canvas.width = w;
|
|
683
|
+
canvas.height = h$1;
|
|
684
|
+
const ctx = canvas.getContext("2d");
|
|
685
|
+
if (!ctx) {
|
|
686
|
+
reject(/* @__PURE__ */ new Error("Failed to create 2D canvas context for PNG export"));
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
ctx.drawImage(img, 0, 0, w, h$1);
|
|
690
|
+
canvas.toBlob((blob) => {
|
|
691
|
+
if (!blob) {
|
|
692
|
+
reject(/* @__PURE__ */ new Error("Failed to create PNG blob"));
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
resolve(blob);
|
|
696
|
+
}, "image/png");
|
|
697
|
+
};
|
|
698
|
+
img.onerror = () => reject(/* @__PURE__ */ new Error("Failed to load SVG image"));
|
|
699
|
+
img.src = encoded;
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/utils/module.ts
|
|
705
|
+
async function hasShiki() {
|
|
706
|
+
try {
|
|
707
|
+
await import("shiki");
|
|
708
|
+
return true;
|
|
709
|
+
} catch {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
async function hasMermaid() {
|
|
714
|
+
try {
|
|
715
|
+
await import("mermaid");
|
|
716
|
+
return true;
|
|
717
|
+
} catch {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
async function hasKatex() {
|
|
722
|
+
try {
|
|
723
|
+
await import("katex");
|
|
724
|
+
return true;
|
|
725
|
+
} catch {
|
|
726
|
+
return false;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region src/utils/parser.ts
|
|
732
|
+
function findLastLeafNode(nodes) {
|
|
733
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
734
|
+
const node = nodes[i];
|
|
735
|
+
const nodeWithChildren = node;
|
|
736
|
+
if (nodeWithChildren.children && nodeWithChildren.children.length > 0) {
|
|
737
|
+
const found = findLastLeafNode(nodeWithChildren.children);
|
|
738
|
+
if (found) return found;
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
return node;
|
|
742
|
+
}
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
function findNodeParent(targetNode, nodes, parent) {
|
|
746
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
747
|
+
if (nodes[i] === targetNode && parent) return {
|
|
748
|
+
parent,
|
|
749
|
+
index: i
|
|
750
|
+
};
|
|
751
|
+
const node = nodes[i];
|
|
752
|
+
if (node.children) {
|
|
753
|
+
const result = findNodeParent(targetNode, node.children, node);
|
|
754
|
+
if (result) return result;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return null;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/utils/table.ts
|
|
762
|
+
function extractTableDataFromElement(tableElement) {
|
|
763
|
+
const headers = [];
|
|
764
|
+
const rows = [];
|
|
765
|
+
const headerCells = Array.from(tableElement.querySelectorAll("thead th"));
|
|
766
|
+
for (const cell of headerCells) {
|
|
767
|
+
var _cell$textContent;
|
|
768
|
+
headers.push(((_cell$textContent = cell.textContent) === null || _cell$textContent === void 0 ? void 0 : _cell$textContent.trim()) || "");
|
|
769
|
+
}
|
|
770
|
+
const bodyRows = Array.from(tableElement.querySelectorAll("tbody tr"));
|
|
771
|
+
for (const row of bodyRows) {
|
|
772
|
+
const rowData = [];
|
|
773
|
+
const cells = Array.from(row.querySelectorAll("td"));
|
|
774
|
+
for (const cell of cells) {
|
|
775
|
+
var _cell$textContent2;
|
|
776
|
+
rowData.push(((_cell$textContent2 = cell.textContent) === null || _cell$textContent2 === void 0 ? void 0 : _cell$textContent2.trim()) || "");
|
|
777
|
+
}
|
|
778
|
+
rows.push(rowData);
|
|
779
|
+
}
|
|
780
|
+
return {
|
|
781
|
+
headers,
|
|
782
|
+
rows
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function tableDataToCSV(data) {
|
|
786
|
+
const { headers, rows } = data;
|
|
787
|
+
const escapeCSV = (value) => {
|
|
788
|
+
let needsEscaping = false;
|
|
789
|
+
let hasQuote = false;
|
|
790
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
791
|
+
const char = value[i];
|
|
792
|
+
if (char === "\"") {
|
|
793
|
+
needsEscaping = true;
|
|
794
|
+
hasQuote = true;
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
if (char === "," || char === "\n") needsEscaping = true;
|
|
798
|
+
}
|
|
799
|
+
if (!needsEscaping) return value;
|
|
800
|
+
if (hasQuote) return `"${value.replace(/"/g, "\"\"")}"`;
|
|
801
|
+
return `"${value}"`;
|
|
802
|
+
};
|
|
803
|
+
const totalRows = headers.length > 0 ? rows.length + 1 : rows.length;
|
|
804
|
+
const csvRows = Array.from({ length: totalRows });
|
|
805
|
+
let rowIndex = 0;
|
|
806
|
+
if (headers.length > 0) {
|
|
807
|
+
csvRows[rowIndex] = headers.map(escapeCSV).join(",");
|
|
808
|
+
rowIndex += 1;
|
|
809
|
+
}
|
|
810
|
+
for (const row of rows) {
|
|
811
|
+
csvRows[rowIndex] = row.map(escapeCSV).join(",");
|
|
812
|
+
rowIndex += 1;
|
|
813
|
+
}
|
|
814
|
+
return csvRows.join("\n");
|
|
815
|
+
}
|
|
816
|
+
function tableDataToTSV(data) {
|
|
817
|
+
const { headers, rows } = data;
|
|
818
|
+
const escapeTSV = (value) => {
|
|
819
|
+
let needsEscaping = false;
|
|
820
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
821
|
+
const char = value[i];
|
|
822
|
+
if (char === " " || char === "\n" || char === "\r") {
|
|
823
|
+
needsEscaping = true;
|
|
824
|
+
break;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if (!needsEscaping) return value;
|
|
828
|
+
const parts = [];
|
|
829
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
830
|
+
const char = value[i];
|
|
831
|
+
if (char === " ") parts.push("\\t");
|
|
832
|
+
else if (char === "\n") parts.push("\\n");
|
|
833
|
+
else if (char === "\r") parts.push("\\r");
|
|
834
|
+
else parts.push(char);
|
|
835
|
+
}
|
|
836
|
+
return parts.join("");
|
|
837
|
+
};
|
|
838
|
+
const totalRows = headers.length > 0 ? rows.length + 1 : rows.length;
|
|
839
|
+
const tsvRows = Array.from({ length: totalRows });
|
|
840
|
+
let rowIndex = 0;
|
|
841
|
+
if (headers.length > 0) {
|
|
842
|
+
tsvRows[rowIndex] = headers.map(escapeTSV).join(" ");
|
|
843
|
+
rowIndex += 1;
|
|
844
|
+
}
|
|
845
|
+
for (const row of rows) {
|
|
846
|
+
tsvRows[rowIndex] = row.map(escapeTSV).join(" ");
|
|
847
|
+
rowIndex += 1;
|
|
848
|
+
}
|
|
849
|
+
return tsvRows.join("\n");
|
|
850
|
+
}
|
|
851
|
+
function escapeMarkdownTableCell(cell) {
|
|
852
|
+
let needsEscaping = false;
|
|
853
|
+
for (let i = 0; i < cell.length; i += 1) {
|
|
854
|
+
const char = cell[i];
|
|
855
|
+
if (char === "\\" || char === "|") {
|
|
856
|
+
needsEscaping = true;
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
if (!needsEscaping) return cell;
|
|
861
|
+
const parts = [];
|
|
862
|
+
for (let i = 0; i < cell.length; i += 1) {
|
|
863
|
+
const char = cell[i];
|
|
864
|
+
if (char === "\\") parts.push("\\\\");
|
|
865
|
+
else if (char === "|") parts.push("\\|");
|
|
866
|
+
else parts.push(char);
|
|
867
|
+
}
|
|
868
|
+
return parts.join("");
|
|
869
|
+
}
|
|
870
|
+
function tableDataToMarkdown(data) {
|
|
871
|
+
const { headers, rows } = data;
|
|
872
|
+
if (headers.length === 0) return "";
|
|
873
|
+
const markdownRows = Array.from({ length: rows.length + 2 });
|
|
874
|
+
let rowIndex = 0;
|
|
875
|
+
markdownRows[rowIndex] = `| ${headers.map((h$1) => escapeMarkdownTableCell(h$1)).join(" | ")} |`;
|
|
876
|
+
rowIndex += 1;
|
|
877
|
+
const separatorParts = Array.from({ length: headers.length });
|
|
878
|
+
for (let i = 0; i < headers.length; i += 1) separatorParts[i] = "---";
|
|
879
|
+
markdownRows[rowIndex] = `| ${separatorParts.join(" | ")} |`;
|
|
880
|
+
rowIndex += 1;
|
|
881
|
+
for (const row of rows) if (row.length < headers.length) {
|
|
882
|
+
const paddedRow = Array.from({ length: headers.length });
|
|
883
|
+
for (let i = 0; i < headers.length; i += 1) paddedRow[i] = i < row.length ? escapeMarkdownTableCell(row[i]) : "";
|
|
884
|
+
markdownRows[rowIndex] = `| ${paddedRow.join(" | ")} |`;
|
|
885
|
+
rowIndex += 1;
|
|
886
|
+
} else {
|
|
887
|
+
markdownRows[rowIndex] = `| ${row.map((cell) => escapeMarkdownTableCell(cell)).join(" | ")} |`;
|
|
888
|
+
rowIndex += 1;
|
|
889
|
+
}
|
|
890
|
+
return markdownRows.join("\n");
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/composables/use-harden-sanitizers.ts
|
|
895
|
+
function useHardenSanitizers(options) {
|
|
896
|
+
const hardenOptions = computed(() => unref(options.hardenOptions) ?? DEFAULT_HARDEN_OPTIONS);
|
|
897
|
+
const loading = computed(() => unref(options.loading) ?? false);
|
|
898
|
+
const allowedLinkPrefixes = computed(() => hardenOptions.value.allowedLinkPrefixes ?? ["*"]);
|
|
899
|
+
const allowedImagePrefixes = computed(() => hardenOptions.value.allowedImagePrefixes ?? ["*"]);
|
|
900
|
+
const allowedProtocols = computed(() => hardenOptions.value.allowedProtocols ?? ["*"]);
|
|
901
|
+
const allowDataImages = computed(() => hardenOptions.value.allowDataImages ?? true);
|
|
902
|
+
const defaultOrigin = computed(() => hardenOptions.value.defaultOrigin ?? "");
|
|
903
|
+
const isImage = computed(() => unref(options.isImage) ?? false);
|
|
904
|
+
const url = computed(() => unref(options.url) ?? "");
|
|
905
|
+
const transformedUrl = computed(() => transformHardenUrl(url.value));
|
|
906
|
+
const isHardenUrl = computed(() => transformedUrl.value === null);
|
|
907
|
+
function transformHardenUrl(url$1) {
|
|
908
|
+
if (!url$1 || loading.value) return url$1;
|
|
909
|
+
return transformUrl(url$1, isImage.value ? allowedImagePrefixes.value : allowedLinkPrefixes.value, defaultOrigin.value, allowDataImages.value, isImage.value, allowedProtocols.value);
|
|
910
|
+
}
|
|
911
|
+
return {
|
|
912
|
+
hardenOptions,
|
|
913
|
+
transformHardenUrl,
|
|
914
|
+
transformedUrl,
|
|
915
|
+
isHardenUrl
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/composables/use-hsl-theme.ts
|
|
921
|
+
function useHslTheme() {}
|
|
922
|
+
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region src/locales/index.ts
|
|
925
|
+
const SUPPORT_LANGUAGES = ["en-US", "zh-CN"];
|
|
926
|
+
const localesGlob = {
|
|
927
|
+
"./en-US.json": () => import("./en-US-Bfc50l3I.js"),
|
|
928
|
+
"./zh-CN.json": () => import("./zh-CN-CL1XGe0H.js")
|
|
929
|
+
};
|
|
930
|
+
const localeMessages = ref();
|
|
931
|
+
const currentLocale = ref("en-US");
|
|
932
|
+
async function loadLocaleMessages(language) {
|
|
933
|
+
const load = async (language$1) => {
|
|
934
|
+
localeMessages.value = await localesGlob[`./${language$1}.json`]();
|
|
935
|
+
currentLocale.value = language$1;
|
|
936
|
+
};
|
|
937
|
+
try {
|
|
938
|
+
if (typeof language === "string") await load(language);
|
|
939
|
+
else localeMessages.value = language;
|
|
940
|
+
} catch {
|
|
941
|
+
await load("en-US");
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
loadLocaleMessages("en-US");
|
|
945
|
+
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region src/composables/use-i18n.ts
|
|
948
|
+
function useI18n() {
|
|
949
|
+
function getI18nText(key) {
|
|
950
|
+
try {
|
|
951
|
+
const messages = localeMessages.value;
|
|
952
|
+
if (!messages) return key;
|
|
953
|
+
const result = key.split(".").reduce((obj, k) => {
|
|
954
|
+
if (obj && typeof obj === "object" && k in obj) return obj[k];
|
|
955
|
+
}, messages);
|
|
956
|
+
return typeof result === "string" ? result : key;
|
|
957
|
+
} catch {
|
|
958
|
+
return key;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return { t: getI18nText };
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/composables/use-katex.ts
|
|
966
|
+
let existingKatex = false;
|
|
967
|
+
function useKatex() {
|
|
968
|
+
const installed = ref(false);
|
|
969
|
+
async function render(code, options = {}) {
|
|
970
|
+
const { renderToString } = await import("katex");
|
|
971
|
+
try {
|
|
972
|
+
return { html: renderToString(code, {
|
|
973
|
+
output: "html",
|
|
974
|
+
strict: "ignore",
|
|
975
|
+
...options
|
|
976
|
+
}) };
|
|
977
|
+
} catch (error) {
|
|
978
|
+
return { error: error.message };
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
async function preload() {
|
|
982
|
+
if (await hasKatex()) import("katex/dist/katex.min.css");
|
|
983
|
+
}
|
|
984
|
+
function dispose() {}
|
|
985
|
+
(async () => {
|
|
986
|
+
if (existingKatex === true) {
|
|
987
|
+
installed.value = true;
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
installed.value = await hasKatex();
|
|
991
|
+
existingKatex = installed.value;
|
|
992
|
+
})();
|
|
993
|
+
return {
|
|
994
|
+
installed,
|
|
995
|
+
render,
|
|
996
|
+
preload,
|
|
997
|
+
dispose
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
|
|
1003
|
+
function _typeof(o) {
|
|
1004
|
+
"@babel/helpers - typeof";
|
|
1005
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
1006
|
+
return typeof o$1;
|
|
1007
|
+
} : function(o$1) {
|
|
1008
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
1009
|
+
}, _typeof(o);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
|
|
1014
|
+
function toPrimitive(t, r) {
|
|
1015
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1016
|
+
var e = t[Symbol.toPrimitive];
|
|
1017
|
+
if (void 0 !== e) {
|
|
1018
|
+
var i = e.call(t, r || "default");
|
|
1019
|
+
if ("object" != _typeof(i)) return i;
|
|
1020
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1021
|
+
}
|
|
1022
|
+
return ("string" === r ? String : Number)(t);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
//#endregion
|
|
1026
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
|
|
1027
|
+
function toPropertyKey(t) {
|
|
1028
|
+
var i = toPrimitive(t, "string");
|
|
1029
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
|
|
1034
|
+
function _defineProperty(e, r, t) {
|
|
1035
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1036
|
+
value: t,
|
|
1037
|
+
enumerable: !0,
|
|
1038
|
+
configurable: !0,
|
|
1039
|
+
writable: !0
|
|
1040
|
+
}) : e[r] = t, e;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/checkPrivateRedeclaration.js
|
|
1045
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
1046
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/classPrivateFieldInitSpec.js
|
|
1051
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
1052
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
//#endregion
|
|
1056
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/assertClassBrand.js
|
|
1057
|
+
function _assertClassBrand(e, t, n) {
|
|
1058
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
1059
|
+
throw new TypeError("Private element is not present on this object");
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
//#endregion
|
|
1063
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/classPrivateFieldGet2.js
|
|
1064
|
+
function _classPrivateFieldGet2(s, a) {
|
|
1065
|
+
return s.get(_assertClassBrand(s, a));
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/classPrivateFieldSet2.js
|
|
1070
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
1071
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
|
|
1076
|
+
let _Symbol$iterator;
|
|
1077
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1078
|
+
function randomStr(size = 16, dict = urlAlphabet) {
|
|
1079
|
+
let id = "";
|
|
1080
|
+
let i = size;
|
|
1081
|
+
const len = dict.length;
|
|
1082
|
+
while (i--) id += dict[Math.random() * len | 0];
|
|
1083
|
+
return id;
|
|
1084
|
+
}
|
|
1085
|
+
var Node = class {
|
|
1086
|
+
constructor(value) {
|
|
1087
|
+
_defineProperty(this, "value", void 0);
|
|
1088
|
+
_defineProperty(this, "next", void 0);
|
|
1089
|
+
this.value = value;
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
var _head = /* @__PURE__ */ new WeakMap();
|
|
1093
|
+
var _tail = /* @__PURE__ */ new WeakMap();
|
|
1094
|
+
var _size = /* @__PURE__ */ new WeakMap();
|
|
1095
|
+
_Symbol$iterator = Symbol.iterator;
|
|
1096
|
+
var Queue = class {
|
|
1097
|
+
constructor() {
|
|
1098
|
+
_classPrivateFieldInitSpec(this, _head, void 0);
|
|
1099
|
+
_classPrivateFieldInitSpec(this, _tail, void 0);
|
|
1100
|
+
_classPrivateFieldInitSpec(this, _size, void 0);
|
|
1101
|
+
this.clear();
|
|
1102
|
+
}
|
|
1103
|
+
enqueue(value) {
|
|
1104
|
+
var _this$size;
|
|
1105
|
+
const node = new Node(value);
|
|
1106
|
+
if (_classPrivateFieldGet2(_head, this)) {
|
|
1107
|
+
_classPrivateFieldGet2(_tail, this).next = node;
|
|
1108
|
+
_classPrivateFieldSet2(_tail, this, node);
|
|
1109
|
+
} else {
|
|
1110
|
+
_classPrivateFieldSet2(_head, this, node);
|
|
1111
|
+
_classPrivateFieldSet2(_tail, this, node);
|
|
1112
|
+
}
|
|
1113
|
+
_classPrivateFieldSet2(_size, this, (_this$size = _classPrivateFieldGet2(_size, this), _this$size++, _this$size));
|
|
1114
|
+
}
|
|
1115
|
+
dequeue() {
|
|
1116
|
+
var _this$size3;
|
|
1117
|
+
const current = _classPrivateFieldGet2(_head, this);
|
|
1118
|
+
if (!current) return;
|
|
1119
|
+
_classPrivateFieldSet2(_head, this, _classPrivateFieldGet2(_head, this).next);
|
|
1120
|
+
_classPrivateFieldSet2(_size, this, (_this$size3 = _classPrivateFieldGet2(_size, this), _this$size3--, _this$size3));
|
|
1121
|
+
return current.value;
|
|
1122
|
+
}
|
|
1123
|
+
peek() {
|
|
1124
|
+
if (!_classPrivateFieldGet2(_head, this)) return;
|
|
1125
|
+
return _classPrivateFieldGet2(_head, this).value;
|
|
1126
|
+
}
|
|
1127
|
+
clear() {
|
|
1128
|
+
_classPrivateFieldSet2(_head, this, void 0);
|
|
1129
|
+
_classPrivateFieldSet2(_tail, this, void 0);
|
|
1130
|
+
_classPrivateFieldSet2(_size, this, 0);
|
|
1131
|
+
}
|
|
1132
|
+
get size() {
|
|
1133
|
+
return _classPrivateFieldGet2(_size, this);
|
|
1134
|
+
}
|
|
1135
|
+
*[_Symbol$iterator]() {
|
|
1136
|
+
let current = _classPrivateFieldGet2(_head, this);
|
|
1137
|
+
while (current) {
|
|
1138
|
+
yield current.value;
|
|
1139
|
+
current = current.next;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
*drain() {
|
|
1143
|
+
while (_classPrivateFieldGet2(_head, this)) yield this.dequeue();
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
/**
|
|
1147
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
1148
|
+
* execution of handlers on events like resize and scroll.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
1151
|
+
* are most useful.
|
|
1152
|
+
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
1153
|
+
* as-is, to `callback` when the throttled-function is executed.
|
|
1154
|
+
* @param {object} [options] - An object to configure options.
|
|
1155
|
+
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
1156
|
+
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
1157
|
+
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
1158
|
+
* `delay` milliseconds, the internal counter is reset).
|
|
1159
|
+
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
1160
|
+
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
1161
|
+
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
1162
|
+
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
1163
|
+
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
1164
|
+
*
|
|
1165
|
+
* @returns {Function} A new, throttled, function.
|
|
1166
|
+
*/
|
|
1167
|
+
function throttle$1(delay, callback, options) {
|
|
1168
|
+
var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
|
|
1169
|
+
var timeoutID;
|
|
1170
|
+
var cancelled = false;
|
|
1171
|
+
var lastExec = 0;
|
|
1172
|
+
function clearExistingTimeout() {
|
|
1173
|
+
if (timeoutID) clearTimeout(timeoutID);
|
|
1174
|
+
}
|
|
1175
|
+
function cancel(options$1) {
|
|
1176
|
+
var _ref2$upcomingOnly = (options$1 || {}).upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
1177
|
+
clearExistingTimeout();
|
|
1178
|
+
cancelled = !upcomingOnly;
|
|
1179
|
+
}
|
|
1180
|
+
function wrapper() {
|
|
1181
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) arguments_[_key] = arguments[_key];
|
|
1182
|
+
var self = this;
|
|
1183
|
+
var elapsed = Date.now() - lastExec;
|
|
1184
|
+
if (cancelled) return;
|
|
1185
|
+
function exec() {
|
|
1186
|
+
lastExec = Date.now();
|
|
1187
|
+
callback.apply(self, arguments_);
|
|
1188
|
+
}
|
|
1189
|
+
function clear() {
|
|
1190
|
+
timeoutID = void 0;
|
|
1191
|
+
}
|
|
1192
|
+
if (!noLeading && debounceMode && !timeoutID) exec();
|
|
1193
|
+
clearExistingTimeout();
|
|
1194
|
+
if (debounceMode === void 0 && elapsed > delay) if (noLeading) {
|
|
1195
|
+
lastExec = Date.now();
|
|
1196
|
+
if (!noTrailing) timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
1197
|
+
} else exec();
|
|
1198
|
+
else if (noTrailing !== true) timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
|
|
1199
|
+
}
|
|
1200
|
+
wrapper.cancel = cancel;
|
|
1201
|
+
return wrapper;
|
|
1202
|
+
}
|
|
1203
|
+
function throttle(...args) {
|
|
1204
|
+
return throttle$1(...args);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region src/composables/use-math-renderer.ts
|
|
1209
|
+
function useMathRenderer(options) {
|
|
1210
|
+
const { installed, render: renderKatex } = useKatex();
|
|
1211
|
+
const renderFlag = ref(false);
|
|
1212
|
+
const renderingCode = ref("");
|
|
1213
|
+
const html = ref("");
|
|
1214
|
+
const errorMessage = ref("");
|
|
1215
|
+
const node = computed(() => unref(options.node));
|
|
1216
|
+
const katexOptions = computed(() => {
|
|
1217
|
+
var _unref;
|
|
1218
|
+
return ((_unref = unref(options.katexOptions)) === null || _unref === void 0 ? void 0 : _unref.config) ?? {};
|
|
1219
|
+
});
|
|
1220
|
+
const throttleTime = computed(() => unref(options.throttle) ?? 150);
|
|
1221
|
+
const code = computed(() => node.value.value);
|
|
1222
|
+
const loading = computed(() => node.value.loading);
|
|
1223
|
+
const isDisplayMode = computed(() => node.value.type !== "inlineMath");
|
|
1224
|
+
const error = computed(() => {
|
|
1225
|
+
if (!installed.value) return true;
|
|
1226
|
+
if (errorMessage.value && renderFlag.value && renderingCode.value === code.value) return true;
|
|
1227
|
+
return false;
|
|
1228
|
+
});
|
|
1229
|
+
watch(() => [code.value, loading.value], throttle(throttleTime, async () => {
|
|
1230
|
+
const { html: data, error: error$1 } = await renderKatex(code.value, {
|
|
1231
|
+
...katexOptions,
|
|
1232
|
+
displayMode: isDisplayMode.value
|
|
1233
|
+
});
|
|
1234
|
+
renderFlag.value = true;
|
|
1235
|
+
if (data) {
|
|
1236
|
+
html.value = data;
|
|
1237
|
+
errorMessage.value = "";
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
if (error$1) errorMessage.value = error$1;
|
|
1241
|
+
else errorMessage.value = "";
|
|
1242
|
+
}), { immediate: true });
|
|
1243
|
+
return {
|
|
1244
|
+
html,
|
|
1245
|
+
error,
|
|
1246
|
+
errorMessage
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region src/composables/use-mermaid.ts
|
|
1252
|
+
let mermaid = null;
|
|
1253
|
+
function useMermaid(options) {
|
|
1254
|
+
const installed = ref(false);
|
|
1255
|
+
const mermaidConfig = computed(() => {
|
|
1256
|
+
var _unref;
|
|
1257
|
+
return ((_unref = unref(options === null || options === void 0 ? void 0 : options.mermaidOptions)) === null || _unref === void 0 ? void 0 : _unref.config) ?? {};
|
|
1258
|
+
});
|
|
1259
|
+
const mermaidTheme = computed(() => {
|
|
1260
|
+
var _unref2;
|
|
1261
|
+
return ((_unref2 = unref(options === null || options === void 0 ? void 0 : options.mermaidOptions)) === null || _unref2 === void 0 ? void 0 : _unref2.theme) ?? ["neutral", "dark"];
|
|
1262
|
+
});
|
|
1263
|
+
const isDark = computed(() => unref(options === null || options === void 0 ? void 0 : options.isDark) ?? false);
|
|
1264
|
+
const lightTheme = computed(() => mermaidTheme.value[0] ?? "neutral");
|
|
1265
|
+
const darkTheme = computed(() => mermaidTheme.value[1] ?? "dark");
|
|
1266
|
+
const theme = computed(() => isDark.value ? darkTheme.value : lightTheme.value);
|
|
1267
|
+
const chart = ref("");
|
|
1268
|
+
async function getMermaid() {
|
|
1269
|
+
if (mermaid) return mermaid;
|
|
1270
|
+
const { default: module } = await import("mermaid");
|
|
1271
|
+
module.initialize({
|
|
1272
|
+
startOnLoad: false,
|
|
1273
|
+
securityLevel: "loose",
|
|
1274
|
+
...mermaidConfig.value
|
|
1275
|
+
});
|
|
1276
|
+
mermaid = module;
|
|
1277
|
+
return mermaid;
|
|
1278
|
+
}
|
|
1279
|
+
function wrapThemeCode(code) {
|
|
1280
|
+
if (code.startsWith("%%{")) return code;
|
|
1281
|
+
return `${`%%{init: {"theme": "${theme.value}"}}%%\n`}${code}`;
|
|
1282
|
+
}
|
|
1283
|
+
async function parseMermaid(code) {
|
|
1284
|
+
try {
|
|
1285
|
+
const mermaid$1 = await getMermaid();
|
|
1286
|
+
chart.value = wrapThemeCode(code);
|
|
1287
|
+
await mermaid$1.parse(chart.value);
|
|
1288
|
+
return true;
|
|
1289
|
+
} catch {
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
async function renderMermaid(code) {
|
|
1294
|
+
if (!await parseMermaid(code)) return null;
|
|
1295
|
+
const id = `mermaid-${randomStr()}`;
|
|
1296
|
+
try {
|
|
1297
|
+
return (await (await getMermaid()).render(id, wrapThemeCode(code))).svg;
|
|
1298
|
+
} catch {
|
|
1299
|
+
const element = document.getElementById(`d${id}`);
|
|
1300
|
+
if (element) element.remove();
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
async function saveMermaid(format, code = chart.value, onError) {
|
|
1305
|
+
try {
|
|
1306
|
+
const svg = await renderMermaid(code);
|
|
1307
|
+
if (!svg) {
|
|
1308
|
+
onError === null || onError === void 0 || onError(/* @__PURE__ */ new Error("SVG not found. Please wait for the diagram to render."));
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
if (format === "svg") save("diagram.svg", svg, "image/svg+xml");
|
|
1312
|
+
if (format === "png") save("diagram.png", await svgToPngBlob(svg), "image/png");
|
|
1313
|
+
} catch (error) {
|
|
1314
|
+
onError === null || onError === void 0 || onError(error);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
async function preload() {
|
|
1318
|
+
if (mermaid) return;
|
|
1319
|
+
installed.value = await hasMermaid();
|
|
1320
|
+
if (installed.value) await getMermaid();
|
|
1321
|
+
}
|
|
1322
|
+
function dispose() {
|
|
1323
|
+
chart.value = "";
|
|
1324
|
+
}
|
|
1325
|
+
(async () => {
|
|
1326
|
+
if (mermaid) {
|
|
1327
|
+
installed.value = true;
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
installed.value = await hasMermaid();
|
|
1331
|
+
})();
|
|
1332
|
+
return {
|
|
1333
|
+
installed,
|
|
1334
|
+
getMermaid,
|
|
1335
|
+
parseMermaid,
|
|
1336
|
+
renderMermaid,
|
|
1337
|
+
saveMermaid,
|
|
1338
|
+
preload,
|
|
1339
|
+
dispose
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
//#endregion
|
|
1344
|
+
//#region src/composables/use-shiki.ts
|
|
1345
|
+
let highlighter = null;
|
|
1346
|
+
function useShiki(options) {
|
|
1347
|
+
const installed = ref(false);
|
|
1348
|
+
const lang = computed(() => unref(options === null || options === void 0 ? void 0 : options.lang) ?? "plaintext");
|
|
1349
|
+
const shikiTheme = computed(() => {
|
|
1350
|
+
var _unref;
|
|
1351
|
+
return ((_unref = unref(options === null || options === void 0 ? void 0 : options.shikiOptions)) === null || _unref === void 0 ? void 0 : _unref.theme) ?? [DEFAULT_LIGHT_THEME, DEFAULT_DARK_THEME];
|
|
1352
|
+
});
|
|
1353
|
+
const lightTheme = computed(() => shikiTheme.value[0] ?? DEFAULT_LIGHT_THEME);
|
|
1354
|
+
const darkTheme = computed(() => shikiTheme.value[1] ?? DEFAULT_DARK_THEME);
|
|
1355
|
+
const langAlias = computed(() => {
|
|
1356
|
+
var _unref2;
|
|
1357
|
+
return ((_unref2 = unref(options === null || options === void 0 ? void 0 : options.shikiOptions)) === null || _unref2 === void 0 ? void 0 : _unref2.langAlias) ?? {};
|
|
1358
|
+
});
|
|
1359
|
+
const codeToTokenOptions = computed(() => {
|
|
1360
|
+
var _unref3;
|
|
1361
|
+
return ((_unref3 = unref(options === null || options === void 0 ? void 0 : options.shikiOptions)) === null || _unref3 === void 0 ? void 0 : _unref3.codeToTokenOptions) ?? {};
|
|
1362
|
+
});
|
|
1363
|
+
const isDark = computed(() => unref(options === null || options === void 0 ? void 0 : options.isDark) ?? false);
|
|
1364
|
+
async function getThemes() {
|
|
1365
|
+
const { bundledThemesInfo } = await import("shiki");
|
|
1366
|
+
return [lightTheme.value, darkTheme.value].filter((theme) => bundledThemesInfo.find((t) => t.id === theme));
|
|
1367
|
+
}
|
|
1368
|
+
async function getTheme() {
|
|
1369
|
+
const { bundledThemesInfo } = await import("shiki");
|
|
1370
|
+
const theme = bundledThemesInfo.find((t) => t.id === (isDark.value ? darkTheme.value : lightTheme.value));
|
|
1371
|
+
if (!theme) return isDark.value ? DEFAULT_DARK_THEME : DEFAULT_LIGHT_THEME;
|
|
1372
|
+
return theme.id;
|
|
1373
|
+
}
|
|
1374
|
+
async function getLanguage() {
|
|
1375
|
+
if (LANGUAGE_ALIAS[lang.value]) return LANGUAGE_ALIAS[lang.value];
|
|
1376
|
+
const { bundledLanguagesInfo } = await import("shiki");
|
|
1377
|
+
const language = bundledLanguagesInfo.find((l) => {
|
|
1378
|
+
var _l$aliases;
|
|
1379
|
+
return l.id === lang.value || ((_l$aliases = l.aliases) === null || _l$aliases === void 0 ? void 0 : _l$aliases.includes(lang.value));
|
|
1380
|
+
});
|
|
1381
|
+
if (language) return language.id;
|
|
1382
|
+
return "plaintext";
|
|
1383
|
+
}
|
|
1384
|
+
async function getHighlighter() {
|
|
1385
|
+
if (highlighter) {
|
|
1386
|
+
const loadedLangs = highlighter.getLoadedLanguages();
|
|
1387
|
+
const loadedThemes = highlighter.getLoadedThemes();
|
|
1388
|
+
const language = await getLanguage();
|
|
1389
|
+
const themes = await getThemes();
|
|
1390
|
+
if (!loadedLangs.includes(language)) await highlighter.loadLanguage(language);
|
|
1391
|
+
for (const theme of themes) if (!loadedThemes.includes(theme)) await highlighter.loadTheme(theme);
|
|
1392
|
+
return highlighter;
|
|
1393
|
+
}
|
|
1394
|
+
const { createHighlighter } = await import("shiki");
|
|
1395
|
+
highlighter = await createHighlighter({
|
|
1396
|
+
themes: [await getTheme()],
|
|
1397
|
+
langs: [await getLanguage()],
|
|
1398
|
+
langAlias: {
|
|
1399
|
+
...LANGUAGE_ALIAS,
|
|
1400
|
+
...langAlias.value
|
|
1401
|
+
}
|
|
1402
|
+
});
|
|
1403
|
+
return highlighter;
|
|
1404
|
+
}
|
|
1405
|
+
async function codeToTokens(code) {
|
|
1406
|
+
return (await getHighlighter()).codeToTokens(code, {
|
|
1407
|
+
theme: await getTheme(),
|
|
1408
|
+
lang: await getLanguage(),
|
|
1409
|
+
...codeToTokenOptions.value
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
async function preload() {
|
|
1413
|
+
if (highlighter) return;
|
|
1414
|
+
installed.value = await hasShiki();
|
|
1415
|
+
if (installed.value) await getHighlighter();
|
|
1416
|
+
}
|
|
1417
|
+
function dispose() {
|
|
1418
|
+
highlighter === null || highlighter === void 0 || highlighter.dispose();
|
|
1419
|
+
highlighter = null;
|
|
1420
|
+
}
|
|
1421
|
+
(async () => {
|
|
1422
|
+
if (highlighter) {
|
|
1423
|
+
installed.value = true;
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
installed.value = await hasShiki();
|
|
1427
|
+
})();
|
|
1428
|
+
return {
|
|
1429
|
+
installed,
|
|
1430
|
+
getHighlighter,
|
|
1431
|
+
codeToTokens,
|
|
1432
|
+
preload,
|
|
1433
|
+
dispose
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/composables/use-tippy.ts
|
|
1439
|
+
function useTippy(options) {
|
|
1440
|
+
const isDark = computed(() => unref(options === null || options === void 0 ? void 0 : options.isDark) ?? false);
|
|
1441
|
+
const tippyOptions = computed(() => unref(options === null || options === void 0 ? void 0 : options.options) ?? {});
|
|
1442
|
+
function initTippy() {
|
|
1443
|
+
setDefaultProps({
|
|
1444
|
+
allowHTML: true,
|
|
1445
|
+
delay: [100, 100],
|
|
1446
|
+
theme: isDark.value ? "" : "light",
|
|
1447
|
+
...tippyOptions
|
|
1448
|
+
});
|
|
1449
|
+
watchEffect(() => {
|
|
1450
|
+
setDefaultProps({
|
|
1451
|
+
theme: isDark.value ? "" : "light",
|
|
1452
|
+
...tippyOptions.value
|
|
1453
|
+
});
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
return { initTippy };
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
//#endregion
|
|
1460
|
+
//#region src/composables/use-zoom.ts
|
|
1461
|
+
function useZoom(options = {}) {
|
|
1462
|
+
const { minZoom = .5, maxZoom = 3, zoomStep = .1, wheelSensitivity = .01, initialZoom = 1, initialTranslateX = 0, initialTranslateY = 0 } = options;
|
|
1463
|
+
const zoom = ref(initialZoom);
|
|
1464
|
+
const translateX = ref(initialTranslateX);
|
|
1465
|
+
const translateY = ref(initialTranslateY);
|
|
1466
|
+
const isDragging = ref(false);
|
|
1467
|
+
const dragStart = ref({
|
|
1468
|
+
x: 0,
|
|
1469
|
+
y: 0
|
|
1470
|
+
});
|
|
1471
|
+
const transformStyle = computed(() => ({ transform: `translate(${translateX.value}px, ${translateY.value}px) scale(${zoom.value})` }));
|
|
1472
|
+
function zoomIn() {
|
|
1473
|
+
if (zoom.value < maxZoom) zoom.value = Math.min(zoom.value + zoomStep, maxZoom);
|
|
1474
|
+
}
|
|
1475
|
+
function zoomOut() {
|
|
1476
|
+
if (zoom.value > minZoom) zoom.value = Math.max(zoom.value - zoomStep, minZoom);
|
|
1477
|
+
}
|
|
1478
|
+
function resetZoom() {
|
|
1479
|
+
zoom.value = initialZoom;
|
|
1480
|
+
translateX.value = initialTranslateX;
|
|
1481
|
+
translateY.value = initialTranslateY;
|
|
1482
|
+
}
|
|
1483
|
+
function setZoom(value) {
|
|
1484
|
+
zoom.value = Math.min(Math.max(value, minZoom), maxZoom);
|
|
1485
|
+
}
|
|
1486
|
+
function startDrag(e) {
|
|
1487
|
+
isDragging.value = true;
|
|
1488
|
+
if (e instanceof MouseEvent) dragStart.value = {
|
|
1489
|
+
x: e.clientX - translateX.value,
|
|
1490
|
+
y: e.clientY - translateY.value
|
|
1491
|
+
};
|
|
1492
|
+
else dragStart.value = {
|
|
1493
|
+
x: e.touches[0].clientX - translateX.value,
|
|
1494
|
+
y: e.touches[0].clientY - translateY.value
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
function onDrag(e) {
|
|
1498
|
+
if (!isDragging.value) return;
|
|
1499
|
+
let clientX;
|
|
1500
|
+
let clientY;
|
|
1501
|
+
if (e instanceof MouseEvent) {
|
|
1502
|
+
clientX = e.clientX;
|
|
1503
|
+
clientY = e.clientY;
|
|
1504
|
+
} else {
|
|
1505
|
+
clientX = e.touches[0].clientX;
|
|
1506
|
+
clientY = e.touches[0].clientY;
|
|
1507
|
+
}
|
|
1508
|
+
translateX.value = clientX - dragStart.value.x;
|
|
1509
|
+
translateY.value = clientY - dragStart.value.y;
|
|
1510
|
+
}
|
|
1511
|
+
function stopDrag() {
|
|
1512
|
+
isDragging.value = false;
|
|
1513
|
+
}
|
|
1514
|
+
function handleWheel(event, containerElement) {
|
|
1515
|
+
if (event.ctrlKey || event.metaKey) {
|
|
1516
|
+
event.preventDefault();
|
|
1517
|
+
const rect = containerElement.getBoundingClientRect();
|
|
1518
|
+
const mouseX = event.clientX - rect.left;
|
|
1519
|
+
const mouseY = event.clientY - rect.top;
|
|
1520
|
+
const containerCenterX = rect.width / 2;
|
|
1521
|
+
const containerCenterY = rect.height / 2;
|
|
1522
|
+
const offsetX = mouseX - containerCenterX;
|
|
1523
|
+
const offsetY = mouseY - containerCenterY;
|
|
1524
|
+
const contentMouseX = (offsetX - translateX.value) / zoom.value;
|
|
1525
|
+
const contentMouseY = (offsetY - translateY.value) / zoom.value;
|
|
1526
|
+
const delta = -event.deltaY * wheelSensitivity;
|
|
1527
|
+
const newZoom = Math.min(Math.max(zoom.value + delta, minZoom), maxZoom);
|
|
1528
|
+
if (newZoom !== zoom.value) {
|
|
1529
|
+
translateX.value = offsetX - contentMouseX * newZoom;
|
|
1530
|
+
translateY.value = offsetY - contentMouseY * newZoom;
|
|
1531
|
+
zoom.value = newZoom;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
function getState() {
|
|
1536
|
+
return {
|
|
1537
|
+
zoom: zoom.value,
|
|
1538
|
+
translateX: translateX.value,
|
|
1539
|
+
translateY: translateY.value
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
function setState(state) {
|
|
1543
|
+
if (state.zoom) zoom.value = Math.min(Math.max(state.zoom, minZoom), maxZoom);
|
|
1544
|
+
if (state.translateX) translateX.value = state.translateX;
|
|
1545
|
+
if (state.translateY) translateY.value = state.translateY;
|
|
1546
|
+
}
|
|
1547
|
+
return {
|
|
1548
|
+
zoom,
|
|
1549
|
+
translateX,
|
|
1550
|
+
translateY,
|
|
1551
|
+
isDragging,
|
|
1552
|
+
transformStyle,
|
|
1553
|
+
zoomIn,
|
|
1554
|
+
zoomOut,
|
|
1555
|
+
resetZoom,
|
|
1556
|
+
setZoom,
|
|
1557
|
+
startDrag,
|
|
1558
|
+
onDrag,
|
|
1559
|
+
stopDrag,
|
|
1560
|
+
handleWheel,
|
|
1561
|
+
getState,
|
|
1562
|
+
setState
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
//#endregion
|
|
1567
|
+
export { transformUrl as A, findNodeParent as C, flow as D, hasShiki as E, LANGUAGE_ALIAS as F, LANGUAGE_EXTENSIONS as I, LANGUAGE_ICONS as L, DEFAULT_HARDEN_OPTIONS as M, DEFAULT_DARK_THEME as N, save as O, DEFAULT_LIGHT_THEME as P, useControls as R, findLastLeafNode as S, hasMermaid as T, escapeMarkdownTableCell as _, useMathRenderer as a, tableDataToMarkdown as b, useKatex as c, currentLocale as d, loadLocaleMessages as f, useHardenSanitizers as g, useHslTheme as h, useMermaid as i, ICONS as j, svgToPngBlob as k, useI18n as l, localesGlob as m, useTippy as n, throttle as o, localeMessages as p, useShiki as r, _defineProperty as s, useZoom as t, SUPPORT_LANGUAGES as u, extractTableDataFromElement as v, hasKatex as w, tableDataToTSV as x, tableDataToCSV as y, useContext as z };
|