@matechat/core 1.6.0 → 1.7.0-alpha.1
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/Bubble/index.css +1 -1
- package/Input/index.js +120 -112
- package/Locale/index.js +25 -19
- package/MarkdownCard/MermaidService-cIIuQ-0H.js +103 -0
- package/MarkdownCard/index.css +1 -1
- package/MarkdownCard/index.js +427 -245
- package/README.md +5 -9
- package/package.json +1 -1
- package/MarkdownCard/MermaidService-BAyBWx9t.js +0 -48
package/MarkdownCard/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as oe, ref as T, computed as z, watch as j, nextTick as _, onMounted as re, createElementBlock as I, openBlock as N, normalizeClass as A, renderSlot as F, createVNode as pe, createElementVNode as M, toDisplayString as X, createCommentVNode as S, unref as L, Transition as ye, withCtx as fe, isVNode as le, h as w, useSlots as Me, Fragment as U, createBlock as Ne, resolveDynamicComponent as Ie } from "vue";
|
|
3
3
|
import D from "highlight.js";
|
|
4
|
-
import
|
|
5
|
-
import { debounce as
|
|
6
|
-
import { getDefaultWhiteList as
|
|
7
|
-
import { useMcI18n as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
4
|
+
import we from "markdown-it";
|
|
5
|
+
import { debounce as ve } from "lodash-es";
|
|
6
|
+
import { getDefaultWhiteList as Ce, getDefaultCSSWhiteList as Le, filterXSS as De } from "xss";
|
|
7
|
+
import { useMcI18n as Te } from "@matechat/core/Locale";
|
|
8
|
+
const xe = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eenlarge%3c/title%3e%3cg%20id='enlarge'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.16666667,1%20C10.572409,1%2013.3333333,3.76092429%2013.3333333,7.16666667%20C13.3333333,8.68984984%2012.781084,10.0840543%2011.8658888,11.1599767%20L14.4225201,13.7154466%20C14.6177822,13.9107088%2014.6177822,14.2272912%2014.4225201,14.4225534%20C14.2489537,14.5961197%2013.9795293,14.6154049%2013.7846612,14.4804088%20L13.7154133,14.4225534%20L11.158968,11.8667467%20C10.083183,12.7814291%208.68937384,13.3333333%207.16666667,13.3333333%20C3.76092429,13.3333333%201,10.572409%201,7.16666667%20C1,3.76092429%203.76092429,1%207.16666667,1%20Z%20M7.16666667,2%20C4.31320904,2%202,4.31320904%202,7.16666667%20C2,10.0201243%204.31320904,12.3333333%207.16666667,12.3333333%20C10.0201243,12.3333333%2012.3333333,10.0201243%2012.3333333,7.16666667%20C12.3333333,4.31320904%2010.0201243,2%207.16666667,2%20Z%20M7.16666667,4.66666667%20C7.41212656,4.66666667%207.61627504,4.84354183%207.658611,5.07679103%20L7.66666667,5.16666667%20L7.666,6.668%20L9.16601582,6.66666666%20C9.44215796,6.66630764%209.66630679,6.88987368%209.66666668,7.16601582%20C9.66698576,7.4114755%209.49037648,7.61585405%209.25718258,7.65849359%20L9.16731751,7.66666666%20L7.666,7.668%20L7.66666667,9.16666667%20C7.66666667,9.44280904%207.44280904,9.66666667%207.16666667,9.66666667%20C6.92120678,9.66666667%206.7170583,9.48979151%206.67472234,9.2565423%20L6.66666667,9.16666667%20L6.666,7.669%20L5.17251751,7.67186668%20C4.89637537,7.6722257%204.67222654,7.44865965%204.67186666,7.17251751%20C4.67154758,6.92705783%204.84815685,6.72267929%205.08135075,6.68003974%20L5.17121582,6.67186709%20L6.666,6.669%20L6.66666667,5.16666667%20C6.66666667,4.89052429%206.89052429,4.66666667%207.16666667,4.66666667%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", Ae = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3ezoom-out%3c/title%3e%3cg%20id='zoom-out'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M7.16666667,1%20C10.572409,1%2013.3333333,3.76092429%2013.3333333,7.16666667%20C13.3333333,8.68984984%2012.781084,10.0840543%2011.8658888,11.1599767%20L14.4225201,13.7154466%20C14.6177822,13.9107088%2014.6177822,14.2272912%2014.4225201,14.4225534%20C14.2489537,14.5961197%2013.9795293,14.6154049%2013.7846612,14.4804088%20L13.7154133,14.4225534%20L11.158968,11.8667467%20C10.083183,12.7814291%208.68937384,13.3333333%207.16666667,13.3333333%20C3.76092429,13.3333333%201,10.572409%201,7.16666667%20C1,3.76092429%203.76092429,1%207.16666667,1%20Z%20M7.16666667,2%20C4.31320904,2%202,4.31320904%202,7.16666667%20C2,10.0201243%204.31320904,12.3333333%207.16666667,12.3333333%20C10.0201243,12.3333333%2012.3333333,10.0201243%2012.3333333,7.16666667%20C12.3333333,4.31320904%2010.0201243,2%207.16666667,2%20Z%20M9.16601582,6.66666666%20C9.44215796,6.66630764%209.66630679,6.88987368%209.66666668,7.16601582%20C9.66698576,7.4114755%209.49037648,7.61585405%209.25718258,7.65849359%20L9.16731751,7.66666666%20L5.17251751,7.67186668%20C4.89637537,7.6722257%204.67222654,7.44865965%204.67186666,7.17251751%20C4.67154758,6.92705783%204.84815685,6.72267929%205.08135075,6.68003974%20L5.17121582,6.67186709%20L9.16601582,6.66666666%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", je = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e全部收起%3c/title%3e%3cg%20id='全部收起'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cpath%20d='M4.715694,14.4114091%20C4.910563,14.5464051%205.179987,14.5271201%205.353553,14.3535531%20L5.353553,14.3535531%20L7.99999988,11.7070001%20L10.646447,14.3535531%20L10.715694,14.4114091%20C10.910563,14.5464051%2011.179987,14.5271201%2011.353553,14.3535531%20C11.548816,14.1582911%2011.548816,13.8417091%2011.353553,13.6464471%20L11.353553,13.6464471%20L8.353553,10.6464471%20L8.284306,10.5885911%20C8.089437,10.4535951%207.820013,10.4728801%207.646447,10.6464471%20L7.646447,10.6464471%20L4.646447,13.6464471%20L4.588591,13.7156941%20C4.453595,13.9105631%204.47288,14.1799871%204.646447,14.3535531%20L4.646447,14.3535531%20L4.715694,14.4114091%20Z%20M14.5,7.50000012%20C14.776142,7.50000012%2015,7.72385812%2015,8.00000012%20C15,8.27614212%2014.776142,8.50000012%2014.5,8.50000012%20L1.5,8.50000012%20C1.223858,8.50000012%201,8.27614212%201,8.00000012%20C1,7.72385812%201.223858,7.50000012%201.5,7.50000012%20L14.5,7.50000012%20Z%20M8.284306,5.41140912%20L8.353553,5.35355312%20L11.353553,2.35355312%20C11.548816,2.15829112%2011.548816,1.84170912%2011.353553,1.64644712%20C11.179987,1.47288012%2010.910563,1.45359512%2010.715694,1.58859112%20L10.646447,1.64644712%20L7.99999988,4.29300012%20L5.353553,1.64644712%20C5.179987,1.47288012%204.910563,1.45359512%204.715694,1.58859112%20L4.646447,1.64644712%20C4.47288,1.82001312%204.453595,2.08943712%204.588591,2.28430612%20L4.646447,2.35355312%20L7.646447,5.35355312%20C7.820013,5.52712012%208.089437,5.54640512%208.284306,5.41140912%20Z'%20id='形状结合'%20fill='%2371757F'%20fill-rule='nonzero'%3e%3c/path%3e%3c/g%3e%3c/svg%3e", be = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+ZnVuY3Rpb24gaWNvbi9jb3B5PC90aXRsZT4KICAgIDxnIGlkPSLpobXpnaItMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9IkFQSS1zdGFydGVyLeWbvuagh+WFpeW6kyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTU5Mi4wMDAwMDAsIC0yMDQuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLmlrnmoLzlpIfku70tMTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDU2MC4wMDAwMDAsIDE4MC4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDx0ZXh0IGlkPSLlm77moIciIGZvbnQtZmFtaWx5PSJQaW5nRmFuZ1NDLVJlZ3VsYXIsIFBpbmdGYW5nIFNDIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0ibm9ybWFsIiBsaW5lLXNwYWNpbmc9IjE2IiBmaWxsPSIjNzE3NTdGIj4KICAgICAgICAgICAgICAgICAgICA8dHNwYW4geD0iMjcuMTM2IiB5PSI2MSI+5aSN5Yi2PC90c3Bhbj4KICAgICAgICAgICAgICAgIDwvdGV4dD4KICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8cGF0aCBkPSJNNjA0LjUsMjA2IEM2MDUuMjc5Njk2LDIwNiA2MDUuOTIwNDQ5LDIwNi41OTQ4ODggNjA1Ljk5MzEzMywyMDcuMzU1NTQgTDYwNiwyMDcuNSBMNjA2LDIxNC41IEM2MDYsMjE1LjI3OTY5NiA2MDUuNDA1MTEyLDIxNS45MjA0NDkgNjA0LjY0NDQ2LDIxNS45OTMxMzMgTDYwNC41LDIxNiBMNjA0LDIxNiBMNjA0LDIxNi41IEM2MDQsMjE3LjI3OTY5NiA2MDMuNDA1MTEyLDIxNy45MjA0NDkgNjAyLjY0NDQ2LDIxNy45OTMxMzMgTDYwMi41LDIxOCBMNTk1LjUsMjE4IEM1OTQuNjcxNTczLDIxOCA1OTQsMjE3LjMyODQyNyA1OTQsMjE2LjUgTDU5NCwyMTYuNSBMNTk0LDIwOS41IEM1OTQsMjA4LjY3MTU3MyA1OTQuNjcxNTczLDIwOCA1OTUuNSwyMDggTDU5NS41LDIwOCBMNTk2LDIwOCBMNTk2LDIwNy41IEM1OTYsMjA2LjcyMDMwNCA1OTYuNTk0ODg4LDIwNi4wNzk1NTEgNTk3LjM1NTU0LDIwNi4wMDY4NjcgTDU5Ny41LDIwNiBMNjA0LjUsMjA2IFogTTYwMi41LDIwOSBMNTk1LjUsMjA5IEM1OTUuMjIzODU4LDIwOSA1OTUsMjA5LjIyMzg1OCA1OTUsMjA5LjUgTDU5NSwyMDkuNSBMNTk1LDIxNi41IEM1OTUsMjE2Ljc3NjE0MiA1OTUuMjIzODU4LDIxNyA1OTUuNSwyMTcgTDU5NS41LDIxNyBMNjAyLjUsMjE3IEM2MDIuNzc2MTQyLDIxNyA2MDMsMjE2Ljc3NjE0MiA2MDMsMjE2LjUgTDYwMywyMTYuNSBMNjAzLDIwOS41IEM2MDMsMjA5LjIyMzg1OCA2MDIuNzc2MTQyLDIwOSA2MDIuNSwyMDkgTDYwMi41LDIwOSBaIE02MDQuNSwyMDcgTDU5Ny41LDIwNyBDNTk3LjI1NDU0LDIwNyA1OTcuMDUwMzkyLDIwNy4xNzY4NzUgNTk3LjAwODA1NiwyMDcuNDEwMTI0IEw1OTcsMjA3LjUgTDU5NywyMDggTDYwMi41LDIwOCBDNjAzLjI3OTY5NiwyMDggNjAzLjkyMDQ0OSwyMDguNTk0ODg4IDYwMy45OTMxMzMsMjA5LjM1NTU0IEw2MDQsMjA5LjUgTDYwNCwyMTUgTDYwNC41LDIxNSBDNjA0Ljc0NTQ2LDIxNSA2MDQuOTQ5NjA4LDIxNC44MjMxMjUgNjA0Ljk5MTk0NCwyMTQuNTg5ODc2IEw2MDUsMjE0LjUgTDYwNSwyMDcuNSBDNjA1LDIwNy4yNTQ1NCA2MDQuODIzMTI1LDIwNy4wNTAzOTIgNjA0LjU4OTg3NiwyMDcuMDA4MDU2IEw2MDQuNSwyMDcgWiIgaWQ9IuW9oueKtue7k+WQiCIgZmlsbD0iIzcxNzU3RiIgZmlsbC1ydWxlPSJub256ZXJvIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=", ke = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3estatus/whiteBG/correct%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3cpolygon%20id='path-1'%20points='6.53553391%209.77817459%2012.1923882%204.12132034%2013.6066017%205.53553391%206.53553391%2012.6066017%203%209.07106781%204.41421356%207.65685425%206.53553391%209.77817459'%3e%3c/polygon%3e%3c/defs%3e%3cg%20id='status/whiteBG/correct'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cmask%20id='mask-2'%20fill='white'%3e%3cuse%20xlink:href='%23path-1'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='Mask'%20fill='%233DCCA6'%20xlink:href='%23path-1'%3e%3c/use%3e%3c/g%3e%3c/svg%3e";
|
|
9
|
+
class ce {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.xssWhiteList =
|
|
11
|
+
this.xssWhiteList = Ce(), this.cssWhiteList = Le(), this.setDefaultXss();
|
|
12
12
|
}
|
|
13
13
|
setDefaultXss() {
|
|
14
14
|
this.xssWhiteList.input = ["type", "checked", "disabled", "class"], this.xssWhiteList.label = ["for"], this.xssWhiteList.ul = ["class"], this.xssWhiteList.div = ["class"], this.xssWhiteList.a = ["href", "class", "target", "name"], this.xssWhiteList.ol = ["start"], this.xssWhiteList.p = ["class"], this.xssWhiteList.span = ["style", "class", "title", "id"], this.xssWhiteList.svg = ["style", "class", "width", "height", "viewbox", "preserveaspectratio", "id", "fill", "stroke"], this.xssWhiteList.path = ["style", "class", "d", "id", "fill", "stroke"], this.xssWhiteList.th = ["style"], this.xssWhiteList.td = ["style"];
|
|
15
15
|
}
|
|
16
|
-
onIgnoreTagAttr(s,
|
|
17
|
-
if (!
|
|
18
|
-
return
|
|
16
|
+
onIgnoreTagAttr(s, o, d, n) {
|
|
17
|
+
if (!n && (o === "id" || s === "span" && o === "style"))
|
|
18
|
+
return o + "=" + d;
|
|
19
19
|
}
|
|
20
20
|
getXssWhiteList() {
|
|
21
21
|
return this.xssWhiteList;
|
|
@@ -24,18 +24,18 @@ class $ {
|
|
|
24
24
|
this.xssWhiteList = s;
|
|
25
25
|
}
|
|
26
26
|
setCustomXssRules(s) {
|
|
27
|
-
s && s.forEach((
|
|
28
|
-
|
|
27
|
+
s && s.forEach((o) => {
|
|
28
|
+
o.value === null ? delete this.xssWhiteList[o.key] : this.xssWhiteList[o.key] = o.value;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
setMdPlugins(s,
|
|
32
|
-
s && s.length && s.forEach((
|
|
33
|
-
const { plugin:
|
|
34
|
-
|
|
31
|
+
setMdPlugins(s, o) {
|
|
32
|
+
s && s.length && s.forEach((d) => {
|
|
33
|
+
const { plugin: n, opts: u } = d;
|
|
34
|
+
o.use(n, u);
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
filterHtml(s) {
|
|
38
|
-
return
|
|
38
|
+
return De(s, {
|
|
39
39
|
whiteList: this.xssWhiteList,
|
|
40
40
|
onIgnoreTagAttr: this.onIgnoreTagAttr,
|
|
41
41
|
css: {
|
|
@@ -49,19 +49,22 @@ class $ {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const Se = {
|
|
53
53
|
key: 0,
|
|
54
54
|
class: "mc-code-block-header"
|
|
55
|
-
},
|
|
55
|
+
}, Oe = { class: "mc-code-lang" }, Ee = { class: "mc-code-block-actions" }, Be = {
|
|
56
56
|
key: 0,
|
|
57
57
|
style: { "margin-right": "8px" }
|
|
58
|
-
},
|
|
58
|
+
}, Ue = ["title"], ze = ["title"], _e = ["title"], We = ["title"], Ye = {
|
|
59
59
|
key: 0,
|
|
60
|
-
src:
|
|
61
|
-
},
|
|
60
|
+
src: be
|
|
61
|
+
}, Ze = {
|
|
62
62
|
key: 1,
|
|
63
|
-
src:
|
|
64
|
-
},
|
|
63
|
+
src: ke
|
|
64
|
+
}, Qe = { key: 0 }, Pe = {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: "mc-mermaid-content"
|
|
67
|
+
}, Ge = { key: 1 }, He = ["innerHTML"], Fe = /* @__PURE__ */ oe({
|
|
65
68
|
__name: "CodeBlock",
|
|
66
69
|
props: {
|
|
67
70
|
code: {
|
|
@@ -89,112 +92,131 @@ const ue = {
|
|
|
89
92
|
default: () => ({})
|
|
90
93
|
}
|
|
91
94
|
},
|
|
92
|
-
setup(
|
|
93
|
-
const s =
|
|
94
|
-
let
|
|
95
|
-
const u =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
setup(i) {
|
|
96
|
+
const s = i, { t: o } = Te(), d = new ce();
|
|
97
|
+
let n = null;
|
|
98
|
+
const u = T(!0), g = T(!1);
|
|
99
|
+
T("");
|
|
100
|
+
const r = T(!0), a = z(() => {
|
|
101
|
+
var t;
|
|
102
|
+
return s.enableMermaid && ((t = s.language) == null ? void 0 : t.toLowerCase()) === "mermaid";
|
|
103
|
+
}), y = z(() => {
|
|
99
104
|
try {
|
|
100
|
-
const
|
|
101
|
-
let
|
|
102
|
-
return s.language && D.getLanguage(s.language) ?
|
|
105
|
+
const t = s.code.indexOf('<span class="mc-typewriter');
|
|
106
|
+
let l;
|
|
107
|
+
return s.language && D.getLanguage(s.language) ? t !== -1 ? l = D.highlight(s.code.slice(0, t), { language: s.language }).value + s.code.slice(t) : l = D.highlight(s.code, { language: s.language }).value : typeof D.highlightAuto !== void 0 ? t !== -1 ? l = D.highlightAuto(s.code.slice(0, t)).value + s.code.slice(t) : l = D.highlightAuto(s.code).value : l = d.filterHtml(s.code), l;
|
|
103
108
|
} catch {
|
|
104
109
|
}
|
|
105
|
-
}),
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
}), v = T(null), O = () => {
|
|
111
|
+
var l;
|
|
112
|
+
const t = (l = v.value) == null ? void 0 : l.querySelector(".mc-mermaid-content");
|
|
113
|
+
t && n && n.zoomIn(t);
|
|
114
|
+
}, C = () => {
|
|
115
|
+
var l;
|
|
116
|
+
const t = (l = v.value) == null ? void 0 : l.querySelector(".mc-mermaid-content");
|
|
117
|
+
t && n && n.zoomOut(t);
|
|
118
|
+
}, b = async () => {
|
|
119
|
+
if (!(!a.value || !s.code)) {
|
|
120
|
+
if (!n)
|
|
108
121
|
try {
|
|
109
|
-
const { MermaidService:
|
|
122
|
+
const { MermaidService: t } = await import("./MermaidService-cIIuQ-0H.js"), l = {
|
|
110
123
|
theme: s.theme === "dark" ? "dark" : "default",
|
|
111
124
|
...s.mermaidConfig
|
|
112
125
|
};
|
|
113
|
-
|
|
114
|
-
} catch (
|
|
115
|
-
console.error("Failed to load MermaidService:",
|
|
126
|
+
n = new t(l);
|
|
127
|
+
} catch (t) {
|
|
128
|
+
console.error("Failed to load MermaidService:", t);
|
|
116
129
|
return;
|
|
117
130
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
131
|
+
_(async () => {
|
|
132
|
+
var l;
|
|
133
|
+
const t = (l = v.value) == null ? void 0 : l.querySelector(".mc-mermaid-content");
|
|
134
|
+
t && await n.renderToContainer(t, s.code.replace(/<span[^>]*\bclass\s*=\s*['"]mc-typewriter[^>]*>([\s\S]*?)<\/span>/g, "$1"), s.theme);
|
|
135
|
+
});
|
|
123
136
|
}
|
|
124
|
-
},
|
|
137
|
+
}, x = () => {
|
|
125
138
|
u.value = !u.value;
|
|
126
|
-
},
|
|
127
|
-
const
|
|
139
|
+
}, E = ve((t) => {
|
|
140
|
+
const l = t.target;
|
|
128
141
|
if (navigator.clipboard)
|
|
129
142
|
navigator.clipboard.writeText(s.code);
|
|
130
143
|
else {
|
|
131
|
-
const
|
|
132
|
-
|
|
144
|
+
const e = document.createElement("textarea");
|
|
145
|
+
e.style.position = "fixed", e.style.top = "-9999px", e.style.left = "-9999px", e.style.zIndex = "-1", e.value = s.code, document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
|
|
133
146
|
}
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
l.classList.remove("icon-copy-new"), g.value = !0, setTimeout(() => {
|
|
148
|
+
g.value = !1;
|
|
136
149
|
}, 1500);
|
|
137
|
-
}, 300),
|
|
138
|
-
|
|
139
|
-
},
|
|
150
|
+
}, 300), Y = (t) => {
|
|
151
|
+
t.dataset || (t.dataset = {}), t.style.height && (t.dataset.height = t.style.height), t.style.maxHeight = 0;
|
|
152
|
+
}, Z = (t) => {
|
|
140
153
|
requestAnimationFrame(() => {
|
|
141
|
-
|
|
154
|
+
t.dataset.oldOverflow = t.style.overflow, t.dataset.height ? t.style.maxHeight = t.dataset.height : t.scrollHeight !== 0 ? t.style.maxHeight = `${t.scrollHeight}px` : t.style.maxHeight = 0, t.style.overflow = "hidden";
|
|
142
155
|
});
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
}, B = (
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
}, Q = (t) => {
|
|
157
|
+
t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow;
|
|
158
|
+
}, B = (t) => {
|
|
159
|
+
t.dataset || (t.dataset = {}), t.dataset.oldOverflow = t.style.overflow, t.style.maxHeight = `${t.scrollHeight}px`, t.style.overflow = "hidden";
|
|
160
|
+
}, k = (t) => {
|
|
161
|
+
t.scrollHeight !== 0 && (t.style.maxHeight = 0);
|
|
162
|
+
}, P = (t) => {
|
|
163
|
+
t.style.maxHeight = "", t.style.overflow = t.dataset.oldOverflow;
|
|
164
|
+
}, G = z(() => s.theme === "dark" ? "mc-code-block-dark" : "mc-code-block-light");
|
|
165
|
+
return j(() => [s.code, s.theme, s.enableMermaid], () => {
|
|
166
|
+
a.value && _(() => {
|
|
167
|
+
b();
|
|
155
168
|
});
|
|
156
|
-
}, { immediate: !0 }),
|
|
157
|
-
|
|
158
|
-
|
|
169
|
+
}, { immediate: !0 }), j(
|
|
170
|
+
() => r.value,
|
|
171
|
+
(t) => {
|
|
172
|
+
t && a.value && _(() => {
|
|
173
|
+
b();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
), re(() => {
|
|
177
|
+
a.value && b();
|
|
178
|
+
}), (t, l) => (N(), I(
|
|
159
179
|
"div",
|
|
160
180
|
{
|
|
161
|
-
class:
|
|
181
|
+
class: A(["mc-code-block", G.value]),
|
|
182
|
+
ref_key: "rootRef",
|
|
183
|
+
ref: v
|
|
162
184
|
},
|
|
163
185
|
[
|
|
164
|
-
|
|
165
|
-
|
|
186
|
+
t.$slots.header ? F(t.$slots, "header", { key: 1 }, void 0, !0) : (N(), I("div", Se, [
|
|
187
|
+
M(
|
|
166
188
|
"span",
|
|
167
|
-
|
|
168
|
-
|
|
189
|
+
Oe,
|
|
190
|
+
X(i.language),
|
|
169
191
|
1
|
|
170
192
|
/* TEXT */
|
|
171
193
|
),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
194
|
+
F(t.$slots, "actions", {}, () => [
|
|
195
|
+
M("div", Ee, [
|
|
196
|
+
a.value ? (N(), I("div", Be, [
|
|
197
|
+
M(
|
|
176
198
|
"ul",
|
|
177
199
|
{
|
|
178
|
-
class:
|
|
200
|
+
class: A(["mc-diagram-switch", { "mc-show-code": !r.value }])
|
|
179
201
|
},
|
|
180
202
|
[
|
|
181
|
-
|
|
203
|
+
M(
|
|
182
204
|
"li",
|
|
183
205
|
{
|
|
184
|
-
onClick:
|
|
185
|
-
class:
|
|
206
|
+
onClick: l[0] || (l[0] = (e) => r.value = !0),
|
|
207
|
+
class: A({ "mc-diagram-switch-active": r.value })
|
|
186
208
|
},
|
|
187
|
-
|
|
209
|
+
X(L(o)("Md.diagram")),
|
|
188
210
|
3
|
|
189
211
|
/* TEXT, CLASS */
|
|
190
212
|
),
|
|
191
|
-
|
|
213
|
+
M(
|
|
192
214
|
"li",
|
|
193
215
|
{
|
|
194
|
-
onClick:
|
|
195
|
-
class:
|
|
216
|
+
onClick: l[1] || (l[1] = (e) => r.value = !1),
|
|
217
|
+
class: A({ "mc-diagram-switch-active": !r.value })
|
|
196
218
|
},
|
|
197
|
-
|
|
219
|
+
X(L(o)("Md.code")),
|
|
198
220
|
3
|
|
199
221
|
/* TEXT, CLASS */
|
|
200
222
|
)
|
|
@@ -202,53 +224,77 @@ const ue = {
|
|
|
202
224
|
2
|
|
203
225
|
/* CLASS */
|
|
204
226
|
)
|
|
205
|
-
])) :
|
|
206
|
-
|
|
227
|
+
])) : S("v-if", !0),
|
|
228
|
+
a.value && r.value ? (N(), I("div", {
|
|
229
|
+
key: 1,
|
|
230
|
+
class: "mc-action-btn mc-toggle-btn",
|
|
231
|
+
title: L(o)("Md.zoomIn"),
|
|
232
|
+
onClick: O
|
|
233
|
+
}, l[3] || (l[3] = [
|
|
234
|
+
M(
|
|
235
|
+
"img",
|
|
236
|
+
{ src: xe },
|
|
237
|
+
null,
|
|
238
|
+
-1
|
|
239
|
+
/* CACHED */
|
|
240
|
+
)
|
|
241
|
+
]), 8, Ue)) : S("v-if", !0),
|
|
242
|
+
a.value && r.value ? (N(), I("div", {
|
|
243
|
+
key: 2,
|
|
207
244
|
class: "mc-action-btn mc-toggle-btn",
|
|
208
|
-
title:
|
|
209
|
-
onClick:
|
|
210
|
-
},
|
|
211
|
-
|
|
245
|
+
title: L(o)("Md.zoomOut"),
|
|
246
|
+
onClick: C
|
|
247
|
+
}, l[4] || (l[4] = [
|
|
248
|
+
M(
|
|
212
249
|
"img",
|
|
213
|
-
{ src:
|
|
250
|
+
{ src: Ae },
|
|
214
251
|
null,
|
|
215
252
|
-1
|
|
216
253
|
/* CACHED */
|
|
217
254
|
)
|
|
218
|
-
]), 8,
|
|
219
|
-
|
|
255
|
+
]), 8, ze)) : S("v-if", !0),
|
|
256
|
+
M("div", {
|
|
257
|
+
class: "mc-action-btn mc-toggle-btn",
|
|
258
|
+
title: L(o)("Md.toggle"),
|
|
259
|
+
onClick: x
|
|
260
|
+
}, l[5] || (l[5] = [
|
|
261
|
+
M(
|
|
262
|
+
"img",
|
|
263
|
+
{ src: je },
|
|
264
|
+
null,
|
|
265
|
+
-1
|
|
266
|
+
/* CACHED */
|
|
267
|
+
)
|
|
268
|
+
]), 8, _e),
|
|
269
|
+
M("div", {
|
|
220
270
|
class: "mc-action-btn mc-copy-btn",
|
|
221
|
-
title:
|
|
222
|
-
onClick:
|
|
223
|
-
(...
|
|
271
|
+
title: L(o)("Md.copy"),
|
|
272
|
+
onClick: l[2] || (l[2] = //@ts-ignore
|
|
273
|
+
(...e) => L(E) && L(E)(...e))
|
|
224
274
|
}, [
|
|
225
|
-
|
|
226
|
-
], 8,
|
|
275
|
+
g.value ? (N(), I("img", Ze)) : (N(), I("img", Ye))
|
|
276
|
+
], 8, We)
|
|
227
277
|
])
|
|
228
278
|
], !0)
|
|
229
279
|
])),
|
|
230
|
-
|
|
280
|
+
pe(ye, {
|
|
231
281
|
name: "collapse-transition",
|
|
232
|
-
onBeforeEnter:
|
|
233
|
-
onEnter:
|
|
234
|
-
onAfterEnter:
|
|
282
|
+
onBeforeEnter: Y,
|
|
283
|
+
onEnter: Z,
|
|
284
|
+
onAfterEnter: Q,
|
|
235
285
|
onBeforeLeave: B,
|
|
236
|
-
onLeave:
|
|
237
|
-
onAfterLeave:
|
|
286
|
+
onLeave: k,
|
|
287
|
+
onAfterLeave: P
|
|
238
288
|
}, {
|
|
239
|
-
default:
|
|
240
|
-
u.value ? (
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
h("code", {
|
|
247
|
-
class: C(`hljs language-${d.language}`),
|
|
248
|
-
innerHTML: L.value
|
|
249
|
-
}, null, 10, Ne)
|
|
289
|
+
default: fe(() => [
|
|
290
|
+
u.value ? (N(), I("div", Qe, [
|
|
291
|
+
a.value && r.value && !t.$slots.content ? (N(), I("div", Pe)) : t.$slots.content ? F(t.$slots, "content", { key: 2 }, void 0, !0) : (N(), I("pre", Ge, [
|
|
292
|
+
M("code", {
|
|
293
|
+
class: A(`hljs language-${i.language}`),
|
|
294
|
+
innerHTML: y.value
|
|
295
|
+
}, null, 10, He)
|
|
250
296
|
]))
|
|
251
|
-
])) :
|
|
297
|
+
])) : S("v-if", !0)
|
|
252
298
|
]),
|
|
253
299
|
_: 3
|
|
254
300
|
/* FORWARDED */
|
|
@@ -258,16 +304,16 @@ const ue = {
|
|
|
258
304
|
/* CLASS */
|
|
259
305
|
));
|
|
260
306
|
}
|
|
261
|
-
}),
|
|
262
|
-
const
|
|
263
|
-
for (const [
|
|
264
|
-
|
|
265
|
-
return
|
|
266
|
-
},
|
|
307
|
+
}), ae = (i, s) => {
|
|
308
|
+
const o = i.__vccOpts || i;
|
|
309
|
+
for (const [d, n] of s)
|
|
310
|
+
o[d] = n;
|
|
311
|
+
return o;
|
|
312
|
+
}, Xe = /* @__PURE__ */ ae(Fe, [["__scopeId", "data-v-3a712b93"]]), ne = {
|
|
267
313
|
step: 2,
|
|
268
314
|
interval: 50,
|
|
269
315
|
style: "normal"
|
|
270
|
-
},
|
|
316
|
+
}, $e = {
|
|
271
317
|
content: {
|
|
272
318
|
type: String,
|
|
273
319
|
default: ""
|
|
@@ -324,168 +370,304 @@ const ue = {
|
|
|
324
370
|
type: Object,
|
|
325
371
|
default: () => ({})
|
|
326
372
|
}
|
|
327
|
-
},
|
|
373
|
+
}, Re = (i, s) => {
|
|
374
|
+
const o = (i == null ? void 0 : i.content) || "", d = (s == null ? void 0 : s.content) || "", n = o.match(/<(\w+)/), u = d.match(/<\/(\w+)/);
|
|
375
|
+
return n && u ? n[1] === u[1] : !1;
|
|
376
|
+
}, Ke = (i) => {
|
|
377
|
+
const s = i.content || "";
|
|
378
|
+
if (s.match(/<(\w+)[^>]*\/>/))
|
|
379
|
+
return !0;
|
|
380
|
+
const o = [], d = /<(\w+)[^>]*>/g, n = /<\/(\w+)>/g;
|
|
381
|
+
let u, g;
|
|
382
|
+
d.lastIndex = 0, n.lastIndex = 0;
|
|
383
|
+
const r = [];
|
|
384
|
+
for (; (u = d.exec(s)) !== null; )
|
|
385
|
+
r.push({
|
|
386
|
+
type: "open",
|
|
387
|
+
tagName: u[1],
|
|
388
|
+
index: u.index
|
|
389
|
+
});
|
|
390
|
+
for (; (g = n.exec(s)) !== null; )
|
|
391
|
+
r.push({
|
|
392
|
+
type: "close",
|
|
393
|
+
tagName: g[1],
|
|
394
|
+
index: g.index
|
|
395
|
+
});
|
|
396
|
+
r.sort((a, y) => a.index - y.index);
|
|
397
|
+
for (const a of r)
|
|
398
|
+
if (a.type === "open")
|
|
399
|
+
o.push(a.tagName);
|
|
400
|
+
else {
|
|
401
|
+
if (o.length === 0 || o[o.length - 1] !== a.tagName)
|
|
402
|
+
return !1;
|
|
403
|
+
o.pop();
|
|
404
|
+
}
|
|
405
|
+
return o.length === 0;
|
|
406
|
+
}, $ = (i) => ({
|
|
407
|
+
nodeType: i ? i.type.replace("_open", "") : "root",
|
|
408
|
+
openNode: i,
|
|
409
|
+
closeNode: null,
|
|
410
|
+
children: [],
|
|
411
|
+
vNodeKey: (i == null ? void 0 : i.vNodeKey) || ""
|
|
412
|
+
}), Ve = (i, s) => {
|
|
413
|
+
const o = i.content.startsWith("</");
|
|
414
|
+
if (!s.length) {
|
|
415
|
+
i.nesting = o ? 0 : 1, s.push(i);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
const d = s[s.length - 1];
|
|
419
|
+
Re(d, i) ? (i.nesting = -1, s.pop()) : o ? i.nesting = 0 : (i.nesting = 1, s.push(i));
|
|
420
|
+
}, de = (i) => {
|
|
421
|
+
const s = (r) => {
|
|
422
|
+
const a = $(r);
|
|
423
|
+
return r.children && r.children.length > 0 && (a.children = de(r.children)), a;
|
|
424
|
+
}, o = $(null);
|
|
425
|
+
let d = o;
|
|
426
|
+
const n = [], u = [], g = [];
|
|
427
|
+
return i.forEach((r, a) => {
|
|
428
|
+
if (r.vNodeKey = `mc-markdown-content-key-${a}`, r.tokenIndex = a, r.type.includes("html_")) {
|
|
429
|
+
if (Ke(r)) {
|
|
430
|
+
r.nesting = 0;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const y = r.type === "html_block" ? g : u;
|
|
434
|
+
Ve(r, y);
|
|
435
|
+
}
|
|
436
|
+
}), i.forEach((r, a) => {
|
|
437
|
+
let y;
|
|
438
|
+
if (r.nesting === 1)
|
|
439
|
+
y = $(r), d.children.push(y), n.push(d), d = y;
|
|
440
|
+
else if (r.nesting === -1) {
|
|
441
|
+
if (d.closeNode = r, !n.length)
|
|
442
|
+
throw new Error("AST stack underflow.");
|
|
443
|
+
y = n.pop(), d = y;
|
|
444
|
+
} else if (r.nesting === 0)
|
|
445
|
+
if (r.type === "inline" && r.children && r.children.length > 0) {
|
|
446
|
+
const v = s(r);
|
|
447
|
+
d.children.push(v);
|
|
448
|
+
} else
|
|
449
|
+
d.children.push(r);
|
|
450
|
+
else
|
|
451
|
+
throw new Error(`Invalid nesting level found in token index ${a}.`);
|
|
452
|
+
}), o.children;
|
|
453
|
+
}, R = (i) => {
|
|
454
|
+
if (!i || !i.trim()) return [];
|
|
455
|
+
const o = new DOMParser().parseFromString(`<body>${i}</body>`, "text/html"), d = [];
|
|
456
|
+
return o.body.childNodes.forEach((n, u) => {
|
|
457
|
+
const g = ge(n);
|
|
458
|
+
(le(g) || typeof g == "string") && (typeof g == "object" && (g.key = u), d.push(g));
|
|
459
|
+
}), d;
|
|
460
|
+
}, ge = (i) => {
|
|
461
|
+
if (i.nodeType === Node.TEXT_NODE) return i.textContent;
|
|
462
|
+
if (i.nodeType !== Node.ELEMENT_NODE) return i.textContent || "";
|
|
463
|
+
const s = i, o = {};
|
|
464
|
+
if (s.hasAttributes() && s.attributes)
|
|
465
|
+
for (const n of Array.from(s.attributes))
|
|
466
|
+
o[n.name] = n.value;
|
|
467
|
+
const d = [];
|
|
468
|
+
return s.childNodes.length > 0 && s.childNodes.forEach((n) => {
|
|
469
|
+
const u = ge(n);
|
|
470
|
+
(le(u) || typeof u == "string") && d.push(u);
|
|
471
|
+
}), W(s.tagName) ? w(s.tagName.toLowerCase(), o, d) : (i == null ? void 0 : i.textContent) || "";
|
|
472
|
+
}, W = (i) => {
|
|
473
|
+
if (!i) return !1;
|
|
474
|
+
try {
|
|
475
|
+
return document.createElement(i), !0;
|
|
476
|
+
} catch {
|
|
477
|
+
return !1;
|
|
478
|
+
}
|
|
479
|
+
}, Je = /* @__PURE__ */ oe({
|
|
328
480
|
__name: "mdCard",
|
|
329
|
-
props:
|
|
481
|
+
props: $e,
|
|
330
482
|
emits: ["afterMdtInit", "typingStart", "typing", "typingEnd"],
|
|
331
|
-
setup(
|
|
332
|
-
const
|
|
333
|
-
let
|
|
334
|
-
const
|
|
483
|
+
setup(i, { expose: s, emit: o }) {
|
|
484
|
+
const d = new ce(), n = i, u = o, g = Me();
|
|
485
|
+
let r = null;
|
|
486
|
+
const a = we({
|
|
335
487
|
breaks: !0,
|
|
336
488
|
linkify: !0,
|
|
337
489
|
html: !0,
|
|
338
|
-
highlight: (
|
|
339
|
-
if (
|
|
490
|
+
highlight: (e, c) => {
|
|
491
|
+
if (c && D.getLanguage(c))
|
|
340
492
|
try {
|
|
341
|
-
return D.highlight(
|
|
493
|
+
return D.highlight(e, { language: c }).value;
|
|
342
494
|
} catch {
|
|
343
495
|
}
|
|
344
496
|
return "";
|
|
345
497
|
},
|
|
346
|
-
...
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
let t = i.content || "";
|
|
355
|
-
if (i.typing && N.value) {
|
|
356
|
-
t = i.content.slice(0, L.value) || "";
|
|
357
|
-
const n = { ...Q, ...i == null ? void 0 : i.typingOptions };
|
|
358
|
-
n.style === "cursor" ? t += '<span class="mc-typewriter mc-typewriter-cursor">|</span>' : (n.style === "color" || n.style === "gradient") && (t = t.slice(0, -5) + `<span class="mc-typewriter mc-typewriter-${n.style}">${t.slice(-5)}</span>`);
|
|
498
|
+
...n.mdOptions
|
|
499
|
+
}), y = T(0), v = T(!1), O = T(), C = () => {
|
|
500
|
+
var p;
|
|
501
|
+
let e = n.content || "";
|
|
502
|
+
if (n.typing && v.value) {
|
|
503
|
+
e = n.content.slice(0, y.value) || "";
|
|
504
|
+
const f = { ...ne, ...n == null ? void 0 : n.typingOptions };
|
|
505
|
+
f.style === "cursor" ? e += '<span class="mc-typewriter mc-typewriter-cursor">|</span>' : (f.style === "color" || f.style === "gradient") && (e = e.slice(0, -5) + `<span class="mc-typewriter mc-typewriter-${f.style}">${e.slice(-5)}</span>`);
|
|
359
506
|
}
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
|
|
507
|
+
if (n.enableThink) {
|
|
508
|
+
const f = ((p = n.thinkOptions) == null ? void 0 : p.customClass) || "mc-think-block";
|
|
509
|
+
e = (e == null ? void 0 : e.replace("<think>", `<div class="${f}">`).replace("</think>", "</div>")) || "";
|
|
363
510
|
}
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
511
|
+
const c = a.parse(e, {}), h = de(c), m = b(h);
|
|
512
|
+
O.value = w(U, m);
|
|
513
|
+
}, b = (e) => e.map((c) => x(c)), x = (e) => {
|
|
514
|
+
var c, h;
|
|
515
|
+
if (e.nodeType === "html_inline" || e.nodeType === "html_block") {
|
|
516
|
+
const m = R(((c = e.openNode) == null ? void 0 : c.content) || "")[0];
|
|
517
|
+
if (m) {
|
|
518
|
+
const p = (m == null ? void 0 : m.children) || [];
|
|
519
|
+
return Array.isArray(p) ? m.children = [...p, ...e.children.map((f) => x(f))] : m.children = [p, ...e.children.map((f) => x(f))], m;
|
|
520
|
+
} else
|
|
521
|
+
return ((h = e.openNode) == null ? void 0 : h.content) || "";
|
|
522
|
+
}
|
|
523
|
+
if (e.nodeType === "inline") {
|
|
524
|
+
const m = a.renderer.render([e.openNode], a.options, {}), p = R(m);
|
|
525
|
+
return w(U, p);
|
|
526
|
+
}
|
|
527
|
+
return E(e) ? Y(e) : Q(e);
|
|
528
|
+
}, E = (e) => "type" in e && "content" in e, Y = (e) => {
|
|
529
|
+
if (e.type === "text")
|
|
530
|
+
return e.content;
|
|
531
|
+
if (e.type === "inline")
|
|
532
|
+
return Z(e);
|
|
533
|
+
if (e.type === "fence")
|
|
534
|
+
return B(e);
|
|
535
|
+
if (e.type === "softbreak")
|
|
536
|
+
return a.options.breaks ? w("br") : `
|
|
537
|
+
`;
|
|
538
|
+
if (e.type === "html_block" || e.type === "html_inline")
|
|
539
|
+
return e.type === "html_block" ? w("div", { innerHTML: e.content }) : w("span", { innerHTML: e.content });
|
|
540
|
+
if (e.tag) {
|
|
541
|
+
const c = W(e.tag) ? e.tag : "div", h = k(e.attrs || []);
|
|
542
|
+
return w(c, { ...h, key: e.vNodeKey }, e.content);
|
|
543
|
+
}
|
|
544
|
+
return e.content;
|
|
545
|
+
}, Z = (e) => {
|
|
546
|
+
const c = a.renderer.render([e], a.options, {}), h = R(c);
|
|
547
|
+
return w(U, h);
|
|
548
|
+
}, Q = (e) => {
|
|
549
|
+
var p, f, K, V, J, q, ee, te, se;
|
|
550
|
+
let c = "div";
|
|
551
|
+
(p = e.openNode) != null && p.tag && W((f = e.openNode) == null ? void 0 : f.tag) && (c = (K = e.openNode) == null ? void 0 : K.tag);
|
|
552
|
+
const h = k(((V = e.openNode) == null ? void 0 : V.attrs) || []);
|
|
553
|
+
if (((J = e.openNode) == null ? void 0 : J.type) === "fence")
|
|
554
|
+
return B(e.openNode);
|
|
555
|
+
if ((q = e.openNode) != null && q.tag) {
|
|
556
|
+
let H = W((ee = e.openNode) == null ? void 0 : ee.tag) ? (te = e.openNode) == null ? void 0 : te.tag : "div";
|
|
557
|
+
const ue = e.children.map((me) => x(me)), he = k(((se = e.openNode) == null ? void 0 : se.attrs) || []);
|
|
558
|
+
return w(H, { ...he, key: e.vNodeKey }, ue);
|
|
559
|
+
}
|
|
560
|
+
const m = e.children.map((H) => x(H));
|
|
561
|
+
return w(c, { ...h, key: e.vNodeKey }, m);
|
|
562
|
+
}, B = (e) => {
|
|
563
|
+
var m;
|
|
564
|
+
const c = ((m = e.info) == null ? void 0 : m.replace(/<span\b[^>]*>/i, "").replace("</span>", "")) || "", h = e.content;
|
|
565
|
+
return P(c, h, e.tokenIndex);
|
|
566
|
+
}, k = (e) => e.reduce((c, [h, m]) => (c[h] = m, c), {});
|
|
567
|
+
j(
|
|
368
568
|
() => {
|
|
369
|
-
var
|
|
370
|
-
return [
|
|
569
|
+
var e;
|
|
570
|
+
return [n.enableThink, (e = n.thinkOptions) == null ? void 0 : e.customClass, n.theme];
|
|
371
571
|
},
|
|
372
572
|
() => {
|
|
373
|
-
|
|
573
|
+
C();
|
|
374
574
|
}
|
|
375
575
|
);
|
|
376
|
-
const
|
|
377
|
-
const
|
|
378
|
-
actions:
|
|
379
|
-
|
|
380
|
-
|
|
576
|
+
const P = (e, c, h) => {
|
|
577
|
+
const m = {
|
|
578
|
+
actions: g.actions ? () => {
|
|
579
|
+
var p;
|
|
580
|
+
return ((p = g.actions) == null ? void 0 : p.call(g, { codeBlockData: { code: c, language: e } })) || null;
|
|
581
|
+
} : void 0,
|
|
582
|
+
header: g.header ? () => {
|
|
583
|
+
var p;
|
|
584
|
+
return ((p = g.header) == null ? void 0 : p.call(g, { codeBlockData: { code: c, language: e } })) || null;
|
|
585
|
+
} : void 0,
|
|
586
|
+
content: g.content ? () => {
|
|
587
|
+
var p;
|
|
588
|
+
return ((p = g.content) == null ? void 0 : p.call(g, { codeBlockData: { code: c, language: e } })) || null;
|
|
589
|
+
} : void 0
|
|
381
590
|
};
|
|
382
|
-
return
|
|
383
|
-
|
|
591
|
+
return w(
|
|
592
|
+
Xe,
|
|
384
593
|
{
|
|
385
|
-
language:
|
|
386
|
-
code:
|
|
387
|
-
blockIndex:
|
|
388
|
-
theme:
|
|
389
|
-
enableMermaid:
|
|
390
|
-
mermaidConfig:
|
|
391
|
-
key: `code-block-${
|
|
594
|
+
language: e,
|
|
595
|
+
code: c,
|
|
596
|
+
blockIndex: h,
|
|
597
|
+
theme: n.theme,
|
|
598
|
+
enableMermaid: n.enableMermaid,
|
|
599
|
+
mermaidConfig: n.mermaidConfig,
|
|
600
|
+
key: `code-block-${h}`
|
|
392
601
|
},
|
|
393
|
-
|
|
602
|
+
m
|
|
394
603
|
);
|
|
604
|
+
}, G = () => {
|
|
605
|
+
clearTimeout(r), v.value = !0, u("typingStart");
|
|
606
|
+
const e = { ...ne, ...n == null ? void 0 : n.typingOptions }, c = () => {
|
|
607
|
+
let h = e.step;
|
|
608
|
+
if (Array.isArray(e.step) && (h = e.step[0] + Math.floor(Math.random() * (e.step[1] - e.step[0]))), y.value += h, C(), u("typing"), y.value >= n.content.length) {
|
|
609
|
+
t(), C();
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
r = setTimeout(c, e.interval);
|
|
613
|
+
};
|
|
614
|
+
r = setTimeout(c);
|
|
395
615
|
};
|
|
396
|
-
|
|
397
|
-
() =>
|
|
398
|
-
(
|
|
399
|
-
if (!
|
|
400
|
-
|
|
616
|
+
j(
|
|
617
|
+
() => n.content,
|
|
618
|
+
(e, c) => {
|
|
619
|
+
if (!n.typing) {
|
|
620
|
+
y.value = (e == null ? void 0 : e.length) || 0, C();
|
|
401
621
|
return;
|
|
402
622
|
}
|
|
403
|
-
|
|
623
|
+
e.indexOf(c) === -1 && (y.value = 0), _(() => G());
|
|
404
624
|
},
|
|
405
625
|
{ immediate: !0 }
|
|
406
626
|
);
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
b(), p();
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
f = setTimeout(o, t.interval);
|
|
418
|
-
};
|
|
419
|
-
f = setTimeout(o);
|
|
420
|
-
}, S = T(() => ({
|
|
421
|
-
name: "MarkdownRenderer",
|
|
422
|
-
render() {
|
|
423
|
-
var Y;
|
|
424
|
-
if (typeof document > "u")
|
|
425
|
-
return A("div");
|
|
426
|
-
const { html: t, tokens: o } = I.value, l = [];
|
|
427
|
-
let e = 0, n;
|
|
428
|
-
const c = /<!----MC_MARKDOWN_CODE_BLOCK_(\d+)---->/g;
|
|
429
|
-
let _ = 0, z = 0;
|
|
430
|
-
for (; n = c.exec(t), !!n; ) {
|
|
431
|
-
n.index > e && l.push(
|
|
432
|
-
A("div", {
|
|
433
|
-
innerHTML: t.slice(e, n.index),
|
|
434
|
-
key: `markdown-segment-${z++}`
|
|
435
|
-
})
|
|
436
|
-
);
|
|
437
|
-
const j = o[Number.parseInt(n[1])], F = ((Y = j == null ? void 0 : j.info) == null ? void 0 : Y.replace(/<span\b[^>]*>/i, "").replace("</span>", "")) || "", R = j.content;
|
|
438
|
-
l.push(x(F, R, _)), _++, e = c.lastIndex;
|
|
439
|
-
}
|
|
440
|
-
return e < t.length && l.push(
|
|
441
|
-
A("div", {
|
|
442
|
-
innerHTML: t.slice(e),
|
|
443
|
-
key: `markdown-segment-${z++}`
|
|
444
|
-
})
|
|
445
|
-
), A("div", l);
|
|
446
|
-
}
|
|
447
|
-
}));
|
|
448
|
-
k(
|
|
449
|
-
() => i.customXssRules,
|
|
450
|
-
(t) => {
|
|
451
|
-
g.setCustomXssRules(t), p();
|
|
627
|
+
const t = () => {
|
|
628
|
+
v.value = !1, u("typingEnd");
|
|
629
|
+
};
|
|
630
|
+
j(
|
|
631
|
+
() => n.customXssRules,
|
|
632
|
+
(e) => {
|
|
633
|
+
d.setCustomXssRules(e), C();
|
|
452
634
|
},
|
|
453
635
|
{ deep: !1 }
|
|
454
|
-
),
|
|
455
|
-
() =>
|
|
456
|
-
(
|
|
457
|
-
|
|
636
|
+
), j(
|
|
637
|
+
() => n.mdPlugins,
|
|
638
|
+
(e) => {
|
|
639
|
+
d.setMdPlugins(e, a), C();
|
|
458
640
|
},
|
|
459
641
|
{ immediate: !0, deep: !1 }
|
|
460
642
|
);
|
|
461
|
-
const
|
|
462
|
-
return
|
|
463
|
-
u("afterMdtInit",
|
|
464
|
-
}), s({ mdt:
|
|
465
|
-
|
|
643
|
+
const l = z(() => n.theme === "dark" ? "mc-markdown-render-dark" : "mc-markdown-render-light");
|
|
644
|
+
return re(() => {
|
|
645
|
+
u("afterMdtInit", a);
|
|
646
|
+
}), s({ mdt: a }), (e, c) => (N(), I(
|
|
647
|
+
U,
|
|
466
648
|
null,
|
|
467
649
|
[
|
|
468
|
-
|
|
650
|
+
M(
|
|
469
651
|
"div",
|
|
470
652
|
{
|
|
471
|
-
class:
|
|
653
|
+
class: A(["mc-markdown-render", l.value])
|
|
472
654
|
},
|
|
473
655
|
[
|
|
474
|
-
(
|
|
656
|
+
(N(), Ne(Ie(O.value)))
|
|
475
657
|
],
|
|
476
658
|
2
|
|
477
659
|
/* CLASS */
|
|
478
660
|
),
|
|
479
|
-
|
|
661
|
+
S("v-if", !0)
|
|
480
662
|
],
|
|
481
663
|
64
|
|
482
664
|
/* STABLE_FRAGMENT */
|
|
483
665
|
));
|
|
484
666
|
}
|
|
485
|
-
}),
|
|
486
|
-
|
|
487
|
-
|
|
667
|
+
}), ie = /* @__PURE__ */ ae(Je, [["__scopeId", "data-v-d14b3723"]]);
|
|
668
|
+
ie.install = (i) => {
|
|
669
|
+
i.component("McMarkdownCard", ie);
|
|
488
670
|
};
|
|
489
671
|
export {
|
|
490
|
-
|
|
672
|
+
ie as McMarkdownCard
|
|
491
673
|
};
|