react-docs-ui 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DocsApp-VPcFusTM.js → DocsApp-Cx8m3Qn3.js} +2895 -2810
- package/dist/{MdxContent-CH9GcMIg.js → MdxContent-BdbPnB6O.js} +307 -226
- package/dist/{MdxContent.lazy-D7XJ-ZHl.js → MdxContent.lazy-SjGAqyn3.js} +1 -1
- package/dist/docs-app.es.js +1 -1
- package/dist/react-docs-ui.css +1 -1
- package/dist/react-docs-ui.es.js +2 -2
- package/dist/types/components/MdxContent.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3,27 +3,27 @@ import { S as t, b as n, c as r, d as i, h as a, l as o, p as s, s as c, t as l,
|
|
|
3
3
|
import { t as p } from "./use-toast-DK69oadB.js";
|
|
4
4
|
import { l as m, r as h, t as g, u as _ } from "./dialog-D8otbqQL.js";
|
|
5
5
|
import * as v from "react";
|
|
6
|
-
import { Check as y, Copy as b, Download as
|
|
7
|
-
import { Link as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { SKIP as
|
|
17
|
-
import
|
|
6
|
+
import { Check as y, Copy as b, Download as x, ExternalLink as S, Maximize as ee, Minimize as te, RefreshCw as ne, RotateCcw as re, RotateCw as ie, Search as ae, X as oe, ZoomIn as se, ZoomOut as ce } from "lucide-react";
|
|
7
|
+
import { Link as le, useParams as C } from "react-router-dom";
|
|
8
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
9
|
+
import D from "remark-gfm";
|
|
10
|
+
import O from "remark-math";
|
|
11
|
+
import k from "react-markdown";
|
|
12
|
+
import A from "rehype-autolink-headings";
|
|
13
|
+
import j from "rehype-slug";
|
|
14
|
+
import M from "rehype-raw";
|
|
15
|
+
import N from "rehype-katex";
|
|
16
|
+
import { SKIP as P, visit as F } from "unist-util-visit";
|
|
17
|
+
import I from "katex-physics";
|
|
18
18
|
//#region src/lib/rehype-component.ts
|
|
19
|
-
function
|
|
19
|
+
function L(e) {
|
|
20
20
|
let t = /* @__PURE__ */ new Map();
|
|
21
21
|
for (let [n] of Object.entries(e)) {
|
|
22
22
|
let e = n.toLowerCase(), r = e.replace(/\./g, "-");
|
|
23
23
|
t.set(e, n), t.set(r, n);
|
|
24
24
|
}
|
|
25
25
|
return () => (e) => {
|
|
26
|
-
|
|
26
|
+
F(e, "element", (e) => {
|
|
27
27
|
let n = e.tagName.toLowerCase(), r = t.get(n);
|
|
28
28
|
r && (e.tagName = r, e.properties = e.properties || {}, e.properties.isComponent = !0);
|
|
29
29
|
});
|
|
@@ -31,7 +31,7 @@ function F(e) {
|
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/lib/image-viewer.ts
|
|
34
|
-
var
|
|
34
|
+
var R = {
|
|
35
35
|
"zh-cn": {
|
|
36
36
|
preview: "预览图片",
|
|
37
37
|
zoomIn: "放大",
|
|
@@ -73,27 +73,27 @@ var I = {
|
|
|
73
73
|
imageLoadError: "Failed to load image"
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
function
|
|
76
|
+
function ue(e = "zh-cn", t) {
|
|
77
77
|
return {
|
|
78
|
-
...
|
|
78
|
+
...R[e === "en" ? "en" : "zh-cn"],
|
|
79
79
|
...t
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/components/ImageViewer.tsx
|
|
84
|
-
var
|
|
85
|
-
function
|
|
86
|
-
return Math.min(
|
|
84
|
+
var de = .2, fe = 5, pe = .2;
|
|
85
|
+
function z(e) {
|
|
86
|
+
return Math.min(fe, Math.max(de, Number(e.toFixed(2))));
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function me(e, t, n) {
|
|
89
89
|
let r = (t || n || "image").trim().split("").map((e) => e.charCodeAt(0) < 32 || "<>:\"/\\|?*".includes(e) ? "-" : e).join("");
|
|
90
90
|
return (e.split("?")[0]?.split("#")[0] ?? e).split("/").pop()?.trim() || r || "image";
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function he(e, t) {
|
|
93
93
|
let n = document.createElement("a");
|
|
94
94
|
n.href = e, n.download = t, n.rel = "noopener noreferrer", document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function ge(e) {
|
|
97
97
|
if (e.startsWith("blob:") || e.startsWith("data:")) return !0;
|
|
98
98
|
try {
|
|
99
99
|
return new URL(e, window.location.href).origin === window.location.origin;
|
|
@@ -101,66 +101,66 @@ function he(e) {
|
|
|
101
101
|
return !1;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
let y = v.useMemo(() =>
|
|
104
|
+
function B({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-cn", labels: l }) {
|
|
105
|
+
let y = v.useMemo(() => ue(c, l), [c, l]), b = v.useRef(null), le = v.useRef(null), [C, w] = v.useState(1), [D, O] = v.useState(0), [k, A] = v.useState("fit"), [j, M] = v.useState(!1), [N, P] = v.useState(!1), [F, I] = v.useState({
|
|
106
106
|
x: 0,
|
|
107
107
|
y: 0
|
|
108
|
-
}), [
|
|
109
|
-
|
|
108
|
+
}), [L, R] = v.useState(!1), B = v.useRef(/* @__PURE__ */ new Map()), V = v.useRef(null), H = v.useRef(null), U = o?.trim() || s?.trim() || y.imageAltFallback, W = v.useCallback(() => {
|
|
109
|
+
w(1), O(0), A("fit"), P(!1), I({
|
|
110
110
|
x: 0,
|
|
111
111
|
y: 0
|
|
112
|
-
}),
|
|
112
|
+
}), R(!1), B.current.clear(), V.current = null, H.current = null;
|
|
113
113
|
}, []);
|
|
114
114
|
v.useEffect(() => {
|
|
115
115
|
if (r) {
|
|
116
|
-
|
|
116
|
+
W();
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
}, [r,
|
|
121
|
-
document.fullscreenElement ||
|
|
119
|
+
M(!1);
|
|
120
|
+
}, [r, W]), v.useEffect(() => {
|
|
121
|
+
document.fullscreenElement || M(!1);
|
|
122
122
|
}, [r]), v.useEffect(() => {
|
|
123
123
|
let e = () => {
|
|
124
|
-
|
|
124
|
+
M(!!document.fullscreenElement);
|
|
125
125
|
};
|
|
126
126
|
return document.addEventListener("fullscreenchange", e), () => {
|
|
127
127
|
document.removeEventListener("fullscreenchange", e);
|
|
128
128
|
};
|
|
129
129
|
}, []);
|
|
130
|
-
let
|
|
131
|
-
transform: `translate(${
|
|
132
|
-
transition:
|
|
133
|
-
cursor:
|
|
130
|
+
let _e = v.useMemo(() => ({
|
|
131
|
+
transform: `translate(${F.x}px, ${F.y}px) scale(${C}) rotate(${D}deg)`,
|
|
132
|
+
transition: L ? "none" : "transform 160ms ease",
|
|
133
|
+
cursor: N ? "default" : L ? "grabbing" : "grab"
|
|
134
134
|
}), [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
]),
|
|
142
|
-
|
|
135
|
+
L,
|
|
136
|
+
N,
|
|
137
|
+
D,
|
|
138
|
+
C,
|
|
139
|
+
F.x,
|
|
140
|
+
F.y
|
|
141
|
+
]), G = v.useCallback(() => {
|
|
142
|
+
A("actual"), w((e) => z(e + pe));
|
|
143
|
+
}, []), K = v.useCallback(() => {
|
|
144
|
+
A("actual"), w((e) => z(e - pe));
|
|
143
145
|
}, []), q = v.useCallback(() => {
|
|
144
|
-
|
|
145
|
-
}, []), J = v.useCallback(() => {
|
|
146
|
-
k("fit"), C(1), P({
|
|
146
|
+
A("fit"), w(1), I({
|
|
147
147
|
x: 0,
|
|
148
148
|
y: 0
|
|
149
149
|
});
|
|
150
|
-
}, []),
|
|
151
|
-
|
|
150
|
+
}, []), J = v.useCallback(() => {
|
|
151
|
+
A("actual"), w(1), I({
|
|
152
152
|
x: 0,
|
|
153
153
|
y: 0
|
|
154
154
|
});
|
|
155
|
+
}, []), Y = v.useCallback(() => {
|
|
156
|
+
O((e) => e - 90);
|
|
155
157
|
}, []), X = v.useCallback(() => {
|
|
156
|
-
|
|
157
|
-
}, []), Z = v.useCallback(() => {
|
|
158
|
-
|
|
159
|
-
}, []), _e = v.useCallback(async () => {
|
|
160
|
-
let e = pe(a, s, o), t = null;
|
|
158
|
+
O((e) => e + 90);
|
|
159
|
+
}, []), Z = v.useCallback(async () => {
|
|
160
|
+
let e = me(a, s, o), t = null;
|
|
161
161
|
try {
|
|
162
|
-
if (
|
|
163
|
-
|
|
162
|
+
if (ge(a)) {
|
|
163
|
+
he(a, e), p({ description: y.downloadSuccess });
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
} catch {}
|
|
@@ -168,7 +168,7 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
168
168
|
let n = await fetch(a, { mode: "cors" });
|
|
169
169
|
if (!n.ok) throw Error(`Failed to fetch image: ${n.status}`);
|
|
170
170
|
let r = await n.blob();
|
|
171
|
-
t = URL.createObjectURL(r),
|
|
171
|
+
t = URL.createObjectURL(r), he(t, e), p({ description: y.downloadSuccess });
|
|
172
172
|
} catch {
|
|
173
173
|
p({
|
|
174
174
|
variant: "destructive",
|
|
@@ -207,7 +207,7 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
207
207
|
v.useEffect(() => {
|
|
208
208
|
if (!r) return;
|
|
209
209
|
let e = (e) => {
|
|
210
|
-
e.key === "+" ? (e.preventDefault(),
|
|
210
|
+
e.key === "+" ? (e.preventDefault(), G()) : e.key === "-" ? (e.preventDefault(), K()) : e.key === "0" ? (e.preventDefault(), W()) : e.key === "f" || e.key === "F" ? (e.preventDefault(), Q()) : e.key === "[" ? (e.preventDefault(), Y()) : e.key === "]" && (e.preventDefault(), X());
|
|
211
211
|
};
|
|
212
212
|
return window.addEventListener("keydown", e), () => {
|
|
213
213
|
window.removeEventListener("keydown", e);
|
|
@@ -215,15 +215,15 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
215
215
|
}, [
|
|
216
216
|
Q,
|
|
217
217
|
r,
|
|
218
|
-
|
|
218
|
+
W,
|
|
219
|
+
Y,
|
|
219
220
|
X,
|
|
220
|
-
|
|
221
|
-
K
|
|
222
|
-
q
|
|
221
|
+
G,
|
|
222
|
+
K
|
|
223
223
|
]);
|
|
224
224
|
let $ = v.useCallback((e) => {
|
|
225
|
-
e.preventDefault(), e.stopPropagation(), e.deltaY < 0 ?
|
|
226
|
-
}, [
|
|
225
|
+
e.preventDefault(), e.stopPropagation(), e.deltaY < 0 ? G() : K();
|
|
226
|
+
}, [G, K]);
|
|
227
227
|
v.useEffect(() => {
|
|
228
228
|
if (!r) return;
|
|
229
229
|
let e = b.current;
|
|
@@ -232,50 +232,50 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
232
232
|
};
|
|
233
233
|
}, [$, r]);
|
|
234
234
|
let ye = v.useCallback((e) => {
|
|
235
|
-
|
|
235
|
+
B.current.set(e.pointerId, {
|
|
236
236
|
x: e.clientX,
|
|
237
237
|
y: e.clientY
|
|
238
238
|
});
|
|
239
|
-
let t = Array.from(
|
|
240
|
-
if (t.length === 2 &&
|
|
241
|
-
let [e, n] = t, r = Math.hypot(n.x - e.x, n.y - e.y), i =
|
|
242
|
-
|
|
239
|
+
let t = Array.from(B.current.values());
|
|
240
|
+
if (t.length === 2 && H.current) {
|
|
241
|
+
let [e, n] = t, r = Math.hypot(n.x - e.x, n.y - e.y), i = z(H.current.startScale * (r / H.current.startDistance));
|
|
242
|
+
A("actual"), w(i);
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
let n =
|
|
246
|
-
!n || n.pointerId !== e.pointerId ||
|
|
245
|
+
let n = V.current;
|
|
246
|
+
!n || n.pointerId !== e.pointerId || I({
|
|
247
247
|
x: n.originX + (e.clientX - n.startX),
|
|
248
248
|
y: n.originY + (e.clientY - n.startY)
|
|
249
249
|
});
|
|
250
250
|
}, []), be = v.useCallback((e) => {
|
|
251
|
-
e && b.current?.hasPointerCapture(e.pointerId) && b.current.releasePointerCapture(e.pointerId), e &&
|
|
251
|
+
e && b.current?.hasPointerCapture(e.pointerId) && b.current.releasePointerCapture(e.pointerId), e && B.current.delete(e.pointerId), V.current = null, B.current.size < 2 && (H.current = null), R(!1);
|
|
252
252
|
}, []), xe = v.useCallback((e) => {
|
|
253
|
-
if (e.button !== 0 ||
|
|
254
|
-
e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture(e.pointerId),
|
|
253
|
+
if (e.button !== 0 || N) return;
|
|
254
|
+
e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture(e.pointerId), B.current.set(e.pointerId, {
|
|
255
255
|
x: e.clientX,
|
|
256
256
|
y: e.clientY
|
|
257
257
|
});
|
|
258
|
-
let t = Array.from(
|
|
258
|
+
let t = Array.from(B.current.values());
|
|
259
259
|
if (t.length === 2) {
|
|
260
260
|
let [e, n] = t;
|
|
261
|
-
|
|
261
|
+
H.current = {
|
|
262
262
|
startDistance: Math.max(1, Math.hypot(n.x - e.x, n.y - e.y)),
|
|
263
|
-
startScale:
|
|
264
|
-
},
|
|
263
|
+
startScale: C
|
|
264
|
+
}, V.current = null, R(!1);
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
V.current = {
|
|
268
268
|
pointerId: e.pointerId,
|
|
269
269
|
startX: e.clientX,
|
|
270
270
|
startY: e.clientY,
|
|
271
|
-
originX:
|
|
272
|
-
originY:
|
|
273
|
-
},
|
|
271
|
+
originX: F.x,
|
|
272
|
+
originY: F.y
|
|
273
|
+
}, R(!0);
|
|
274
274
|
}, [
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
N,
|
|
276
|
+
C,
|
|
277
|
+
F.x,
|
|
278
|
+
F.y
|
|
279
279
|
]);
|
|
280
280
|
v.useEffect(() => {
|
|
281
281
|
if (!r) return;
|
|
@@ -294,78 +294,78 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
294
294
|
{
|
|
295
295
|
key: "zoom-in",
|
|
296
296
|
label: y.zoomIn,
|
|
297
|
-
icon:
|
|
298
|
-
onClick:
|
|
299
|
-
disabled:
|
|
297
|
+
icon: se,
|
|
298
|
+
onClick: G,
|
|
299
|
+
disabled: N || C >= fe
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
key: "zoom-out",
|
|
303
303
|
label: y.zoomOut,
|
|
304
|
-
icon:
|
|
305
|
-
onClick:
|
|
306
|
-
disabled:
|
|
304
|
+
icon: ce,
|
|
305
|
+
onClick: K,
|
|
306
|
+
disabled: N || C <= de
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
key: "fit",
|
|
310
310
|
label: y.fit,
|
|
311
|
-
icon:
|
|
312
|
-
onClick:
|
|
313
|
-
disabled:
|
|
311
|
+
icon: te,
|
|
312
|
+
onClick: q,
|
|
313
|
+
disabled: N
|
|
314
314
|
},
|
|
315
315
|
{
|
|
316
316
|
key: "actual-size",
|
|
317
317
|
label: y.actualSize,
|
|
318
|
-
icon:
|
|
319
|
-
onClick:
|
|
320
|
-
disabled:
|
|
318
|
+
icon: ae,
|
|
319
|
+
onClick: J,
|
|
320
|
+
disabled: N
|
|
321
321
|
},
|
|
322
322
|
{
|
|
323
323
|
key: "reset",
|
|
324
324
|
label: y.reset,
|
|
325
|
-
icon:
|
|
326
|
-
onClick:
|
|
327
|
-
disabled:
|
|
325
|
+
icon: ne,
|
|
326
|
+
onClick: W,
|
|
327
|
+
disabled: N
|
|
328
328
|
},
|
|
329
329
|
{
|
|
330
330
|
key: "rotate-left",
|
|
331
331
|
label: y.rotateLeft,
|
|
332
|
-
icon:
|
|
333
|
-
onClick:
|
|
334
|
-
disabled:
|
|
332
|
+
icon: re,
|
|
333
|
+
onClick: Y,
|
|
334
|
+
disabled: N
|
|
335
335
|
},
|
|
336
336
|
{
|
|
337
337
|
key: "rotate-right",
|
|
338
338
|
label: y.rotateRight,
|
|
339
|
-
icon:
|
|
340
|
-
onClick:
|
|
341
|
-
disabled:
|
|
339
|
+
icon: ie,
|
|
340
|
+
onClick: X,
|
|
341
|
+
disabled: N
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
key: "fullscreen",
|
|
345
345
|
label: y.fullscreen,
|
|
346
|
-
icon:
|
|
346
|
+
icon: ee,
|
|
347
347
|
onClick: () => void Q(),
|
|
348
348
|
disabled: !1
|
|
349
349
|
},
|
|
350
350
|
{
|
|
351
351
|
key: "download",
|
|
352
352
|
label: y.download,
|
|
353
|
-
icon:
|
|
354
|
-
onClick:
|
|
355
|
-
disabled:
|
|
353
|
+
icon: x,
|
|
354
|
+
onClick: Z,
|
|
355
|
+
disabled: N
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
key: "new-tab",
|
|
359
359
|
label: y.openInNewTab,
|
|
360
|
-
icon:
|
|
360
|
+
icon: S,
|
|
361
361
|
onClick: ve,
|
|
362
362
|
disabled: !1
|
|
363
363
|
}
|
|
364
364
|
], [
|
|
365
|
-
|
|
365
|
+
Z,
|
|
366
366
|
Q,
|
|
367
367
|
ve,
|
|
368
|
-
|
|
368
|
+
N,
|
|
369
369
|
y.actualSize,
|
|
370
370
|
y.download,
|
|
371
371
|
y.fit,
|
|
@@ -376,42 +376,42 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
376
376
|
y.rotateRight,
|
|
377
377
|
y.zoomIn,
|
|
378
378
|
y.zoomOut,
|
|
379
|
-
|
|
380
|
-
X,
|
|
381
|
-
Z,
|
|
382
|
-
S,
|
|
379
|
+
W,
|
|
383
380
|
Y,
|
|
381
|
+
X,
|
|
382
|
+
C,
|
|
384
383
|
J,
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
q,
|
|
385
|
+
G,
|
|
386
|
+
K
|
|
387
387
|
]);
|
|
388
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ T(g, {
|
|
389
389
|
open: r,
|
|
390
390
|
onOpenChange: i,
|
|
391
|
-
children: /* @__PURE__ */
|
|
391
|
+
children: /* @__PURE__ */ E(h, {
|
|
392
392
|
showCloseButton: !1,
|
|
393
393
|
className: "flex h-[min(94vh,980px)] w-[calc(100vw-0.75rem)] sm:w-[40rem] md:w-[52rem] lg:w-[64rem] xl:w-[74rem] 2xl:w-[86rem] max-w-[calc(100vw-0.75rem)] flex-col gap-3 border-zinc-800 bg-zinc-950 p-3 text-zinc-50 sm:max-w-[calc(100vw-2rem)] sm:p-4",
|
|
394
394
|
children: [
|
|
395
|
-
/* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ T(_, { children: U }),
|
|
396
|
+
/* @__PURE__ */ T(m, { children: y.close }),
|
|
397
|
+
/* @__PURE__ */ E(n, {
|
|
398
398
|
delayDuration: 100,
|
|
399
|
-
children: [/* @__PURE__ */
|
|
399
|
+
children: [/* @__PURE__ */ E("div", {
|
|
400
400
|
className: "flex items-center justify-between gap-3 rounded-lg border border-zinc-800 bg-zinc-900/80 px-3 py-2",
|
|
401
|
-
children: [/* @__PURE__ */
|
|
401
|
+
children: [/* @__PURE__ */ E("div", {
|
|
402
402
|
className: "min-w-0",
|
|
403
|
-
children: [/* @__PURE__ */
|
|
403
|
+
children: [/* @__PURE__ */ T("p", {
|
|
404
404
|
className: "truncate text-sm font-medium",
|
|
405
|
-
children:
|
|
406
|
-
}), /* @__PURE__ */
|
|
405
|
+
children: U
|
|
406
|
+
}), /* @__PURE__ */ E("p", {
|
|
407
407
|
className: "text-xs text-zinc-400",
|
|
408
408
|
children: [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
k === "fit" ? y.fit : `${Math.round(C * 100)}%`,
|
|
410
|
+
D === 0 ? "" : ` · ${D}deg`,
|
|
411
|
+
j ? ` · ${y.fullscreen}` : ""
|
|
412
412
|
]
|
|
413
413
|
})]
|
|
414
|
-
}), /* @__PURE__ */
|
|
414
|
+
}), /* @__PURE__ */ T(t, {
|
|
415
415
|
type: "button",
|
|
416
416
|
size: "icon",
|
|
417
417
|
variant: "ghost",
|
|
@@ -419,17 +419,17 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
419
419
|
onClick: () => i(!1),
|
|
420
420
|
"aria-label": y.close,
|
|
421
421
|
title: y.close,
|
|
422
|
-
children: /* @__PURE__ */
|
|
422
|
+
children: /* @__PURE__ */ T(oe, { className: "h-4 w-4" })
|
|
423
423
|
})]
|
|
424
|
-
}), /* @__PURE__ */
|
|
424
|
+
}), /* @__PURE__ */ T("div", {
|
|
425
425
|
className: "overflow-x-auto rounded-lg border border-zinc-800 bg-zinc-900/80 px-2 py-2",
|
|
426
|
-
children: /* @__PURE__ */
|
|
426
|
+
children: /* @__PURE__ */ T("div", {
|
|
427
427
|
className: "flex min-w-max items-center gap-2",
|
|
428
428
|
children: Se.map((e) => {
|
|
429
429
|
let n = e.icon;
|
|
430
|
-
return /* @__PURE__ */
|
|
430
|
+
return /* @__PURE__ */ E(u, { children: [/* @__PURE__ */ T(d, {
|
|
431
431
|
asChild: !0,
|
|
432
|
-
children: /* @__PURE__ */
|
|
432
|
+
children: /* @__PURE__ */ T(t, {
|
|
433
433
|
type: "button",
|
|
434
434
|
size: "icon",
|
|
435
435
|
variant: "secondary",
|
|
@@ -438,43 +438,43 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
438
438
|
disabled: e.disabled,
|
|
439
439
|
"aria-label": e.label,
|
|
440
440
|
title: e.label,
|
|
441
|
-
children: /* @__PURE__ */
|
|
441
|
+
children: /* @__PURE__ */ T(n, { className: "h-4 w-4" })
|
|
442
442
|
})
|
|
443
|
-
}), /* @__PURE__ */
|
|
443
|
+
}), /* @__PURE__ */ T(f, { children: e.label })] }, e.key);
|
|
444
444
|
})
|
|
445
445
|
})
|
|
446
446
|
})]
|
|
447
447
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ T("div", {
|
|
449
449
|
ref: b,
|
|
450
450
|
className: "relative flex min-h-0 flex-1 items-center justify-center overflow-hidden rounded-xl border border-zinc-800 bg-[radial-gradient(circle_at_top,_rgba(255,255,255,0.08),_transparent_40%),linear-gradient(180deg,_rgba(24,24,27,0.9),_rgba(9,9,11,1))] p-4 touch-none",
|
|
451
451
|
onPointerDown: xe,
|
|
452
452
|
onPointerMove: ye,
|
|
453
453
|
onPointerUp: be,
|
|
454
454
|
onPointerCancel: be,
|
|
455
|
-
children:
|
|
455
|
+
children: N ? /* @__PURE__ */ E("div", {
|
|
456
456
|
className: "flex flex-col items-center gap-2 text-center",
|
|
457
457
|
children: [
|
|
458
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ T("div", {
|
|
459
459
|
className: "rounded-full border border-red-500/40 bg-red-500/10 p-3 text-red-300",
|
|
460
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ T(ae, { className: "h-5 w-5" })
|
|
461
461
|
}),
|
|
462
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ T("p", {
|
|
463
463
|
className: "text-sm font-medium",
|
|
464
464
|
children: y.imageLoadError
|
|
465
465
|
}),
|
|
466
|
-
/* @__PURE__ */
|
|
466
|
+
/* @__PURE__ */ T("p", {
|
|
467
467
|
className: "max-w-md text-xs text-zinc-400",
|
|
468
468
|
children: a
|
|
469
469
|
})
|
|
470
470
|
]
|
|
471
|
-
}) : /* @__PURE__ */
|
|
472
|
-
ref:
|
|
471
|
+
}) : /* @__PURE__ */ T("img", {
|
|
472
|
+
ref: le,
|
|
473
473
|
src: a,
|
|
474
|
-
alt:
|
|
475
|
-
className: e("max-h-full max-w-full select-none rounded-lg object-contain shadow-2xl",
|
|
476
|
-
style:
|
|
477
|
-
onError: () =>
|
|
474
|
+
alt: U,
|
|
475
|
+
className: e("max-h-full max-w-full select-none rounded-lg object-contain shadow-2xl", k === "fit" ? "h-auto w-auto" : ""),
|
|
476
|
+
style: _e,
|
|
477
|
+
onError: () => P(!0),
|
|
478
478
|
draggable: !1
|
|
479
479
|
})
|
|
480
480
|
})
|
|
@@ -484,10 +484,10 @@ function V({ open: r, onOpenChange: i, src: a, alt: o, title: s, lang: c = "zh-c
|
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
486
|
//#region src/components/MdxContent.tsx
|
|
487
|
-
function
|
|
487
|
+
function V() {
|
|
488
488
|
return (e) => {
|
|
489
|
-
|
|
490
|
-
if (e.tagName === "p" && n && typeof t == "number" && e.children.some((e) => e.type === "element" && (
|
|
489
|
+
F(e, "element", (e, t, n) => {
|
|
490
|
+
if (e.tagName === "p" && n && typeof t == "number" && e.children.some((e) => e.type === "element" && (H(e) || e.tagName === "pre"))) {
|
|
491
491
|
let r = [], i = [], a = () => {
|
|
492
492
|
i.length > 0 && (r.push({
|
|
493
493
|
type: "element",
|
|
@@ -496,29 +496,75 @@ function H() {
|
|
|
496
496
|
children: i
|
|
497
497
|
}), i = []);
|
|
498
498
|
};
|
|
499
|
-
for (let t of e.children) t.type === "element" && (
|
|
500
|
-
return a(), n.children.splice(t, 1, ...r), [
|
|
499
|
+
for (let t of e.children) t.type === "element" && (H(t) || t.tagName === "pre") ? (a(), r.push(t)) : i.push(t);
|
|
500
|
+
return a(), n.children.splice(t, 1, ...r), [P, t];
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function H(e) {
|
|
506
506
|
if ((e.properties || {}).isComponent) return !0;
|
|
507
507
|
let t = e.tagName;
|
|
508
508
|
return t.charAt(0) === t.charAt(0).toUpperCase() && t.charAt(0) !== t.charAt(0).toLowerCase();
|
|
509
509
|
}
|
|
510
|
+
function U(e) {
|
|
511
|
+
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
512
|
+
if (typeof e != "string") return;
|
|
513
|
+
let t = e.trim();
|
|
514
|
+
if (t) return /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t;
|
|
515
|
+
}
|
|
510
516
|
function W(e) {
|
|
517
|
+
if (typeof e == "boolean") return e;
|
|
518
|
+
if (typeof e != "string") return;
|
|
519
|
+
let t = e.trim().toLowerCase();
|
|
520
|
+
if ([
|
|
521
|
+
"true",
|
|
522
|
+
"1",
|
|
523
|
+
"yes",
|
|
524
|
+
"on"
|
|
525
|
+
].includes(t)) return !0;
|
|
526
|
+
if ([
|
|
527
|
+
"false",
|
|
528
|
+
"0",
|
|
529
|
+
"no",
|
|
530
|
+
"off"
|
|
531
|
+
].includes(t)) return !1;
|
|
532
|
+
}
|
|
533
|
+
function _e(e, t) {
|
|
534
|
+
let n = {
|
|
535
|
+
title: e,
|
|
536
|
+
width: U(t?.width),
|
|
537
|
+
height: U(t?.height),
|
|
538
|
+
inline: W(t?.["data-inline"] ?? t?.inline),
|
|
539
|
+
offsetX: U(t?.["data-offset-x"] ?? t?.offsetX ?? t?.offsetx ?? t?.x),
|
|
540
|
+
offsetY: U(t?.["data-offset-y"] ?? t?.offsetY ?? t?.offsety ?? t?.y),
|
|
541
|
+
preview: W(t?.["data-preview"] ?? t?.preview)
|
|
542
|
+
};
|
|
543
|
+
if (!e || !/(^|\s)(width|height|w|h|size|preview|inline|x|y|offsetx|offsety)=/i.test(e)) return n;
|
|
544
|
+
let r = e;
|
|
545
|
+
return r = r.replace(/(^|\s)(width|height|w|h|size|preview|inline|x|y|offsetx|offsety)=(?:"([^"]+)"|'([^']+)'|([^\s]+))/gi, (e, t, r, i, a, o) => {
|
|
546
|
+
let s = String(r).toLowerCase(), c = i ?? a ?? o ?? "";
|
|
547
|
+
if (s === "preview") n.preview = W(c) ?? n.preview;
|
|
548
|
+
else if (s === "inline") n.inline = W(c) ?? n.inline;
|
|
549
|
+
else if (s === "size") {
|
|
550
|
+
let [e, t] = c.split("x");
|
|
551
|
+
n.width = U(e) ?? n.width, n.height = U(t ?? e) ?? n.height;
|
|
552
|
+
} else s === "width" || s === "w" ? n.width = U(c) ?? n.width : s === "height" || s === "h" ? n.height = U(c) ?? n.height : s === "x" || s === "offsetx" ? n.offsetX = U(c) ?? n.offsetX : (s === "y" || s === "offsety") && (n.offsetY = U(c) ?? n.offsetY);
|
|
553
|
+
return t;
|
|
554
|
+
}), n.title = r.replace(/\s{2,}/g, " ").trim() || void 0, n;
|
|
555
|
+
}
|
|
556
|
+
function G(e) {
|
|
511
557
|
let t = e, n = "";
|
|
512
558
|
for (; t !== n;) n = t, t = t.replace(/<([A-Z][a-zA-Z0-9]*(?:\.[A-Z][a-zA-Z0-9]*)*)(\s+[^>]*)>([\s\S]*?)<\/\1>/g, (e, t, n, r) => {
|
|
513
|
-
let i =
|
|
559
|
+
let i = K(n), a = t.toLowerCase().replace(/\./g, "-");
|
|
514
560
|
return `<${a}${i}>${r}</${a}>`;
|
|
515
561
|
}).replace(/<([A-Z][a-zA-Z0-9]*(?:\.[A-Z][a-zA-Z0-9]*)*)(\s+[^>]*?)\s*\/>/g, (e, t, n) => {
|
|
516
|
-
let r =
|
|
562
|
+
let r = K(n), i = t.toLowerCase().replace(/\./g, "-");
|
|
517
563
|
return `<${i}${r}></${i}>`;
|
|
518
564
|
});
|
|
519
565
|
return t;
|
|
520
566
|
}
|
|
521
|
-
function
|
|
567
|
+
function K(e) {
|
|
522
568
|
if (!e) return "";
|
|
523
569
|
let t = [], n = /(\w+)=(?:{([^}]+)}|"([^"]*)"|'([^']*)')/g, r;
|
|
524
570
|
for (; (r = n.exec(e)) !== null;) {
|
|
@@ -527,7 +573,7 @@ function G(e) {
|
|
|
527
573
|
}
|
|
528
574
|
return t.length > 0 ? " " + t.join(" ") : "";
|
|
529
575
|
}
|
|
530
|
-
function
|
|
576
|
+
function q(e) {
|
|
531
577
|
let t = {};
|
|
532
578
|
for (let [n, r] of Object.entries(e)) if (n.startsWith("data-")) {
|
|
533
579
|
let e = n.slice(5);
|
|
@@ -550,7 +596,7 @@ function ge(e) {
|
|
|
550
596
|
}
|
|
551
597
|
return t;
|
|
552
598
|
}
|
|
553
|
-
var
|
|
599
|
+
var J = {
|
|
554
600
|
js: "JavaScript",
|
|
555
601
|
javascript: "JavaScript",
|
|
556
602
|
ts: "TypeScript",
|
|
@@ -592,8 +638,8 @@ var K = {
|
|
|
592
638
|
diff: "Diff",
|
|
593
639
|
text: "Text"
|
|
594
640
|
};
|
|
595
|
-
function
|
|
596
|
-
let [s, l] = v.useState(""), [u, d] = v.useState(!1), [f, p] = v.useState(!1), m = v.useMemo(() => n?.toLowerCase().includes("showlinenumbers") ?? !1, [n]), h = /language-(\w+)/.exec(e || ""), g = h ? h[1] : "text", _ = i(g),
|
|
641
|
+
function Y({ className: e, children: t, meta: n, codeHighlight: r, shikiBundle: a }) {
|
|
642
|
+
let [s, l] = v.useState(""), [u, d] = v.useState(!1), [f, p] = v.useState(!1), m = v.useMemo(() => n?.toLowerCase().includes("showlinenumbers") ?? !1, [n]), h = /language-(\w+)/.exec(e || ""), g = h ? h[1] : "text", _ = i(g), x = J[g.toLowerCase()] || g.toUpperCase(), S = v.useMemo(() => {
|
|
597
643
|
let e = "";
|
|
598
644
|
return e = typeof t == "string" ? t : v.Children.count(t) === 1 && typeof t == "string" ? String(t) : v.Children.toArray(t).map((e) => {
|
|
599
645
|
if (typeof e == "string") return e;
|
|
@@ -618,20 +664,20 @@ function q({ className: e, children: t, meta: n, codeHighlight: r, shikiBundle:
|
|
|
618
664
|
attributeFilter: ["class"]
|
|
619
665
|
}), () => t.disconnect();
|
|
620
666
|
}, []), v.useEffect(() => {
|
|
621
|
-
o(
|
|
667
|
+
o(S, {
|
|
622
668
|
lang: _,
|
|
623
669
|
theme: c(u, r, a),
|
|
624
670
|
showLineNumbers: m
|
|
625
671
|
}, r, a).then(l);
|
|
626
672
|
}, [
|
|
627
|
-
|
|
673
|
+
S,
|
|
628
674
|
_,
|
|
629
675
|
u,
|
|
630
676
|
m,
|
|
631
677
|
r,
|
|
632
678
|
a
|
|
633
679
|
]);
|
|
634
|
-
let
|
|
680
|
+
let ee = v.useCallback(async () => {
|
|
635
681
|
let e = async (e) => {
|
|
636
682
|
if (navigator.clipboard && window.isSecureContext) await navigator.clipboard.writeText(e);
|
|
637
683
|
else {
|
|
@@ -645,72 +691,100 @@ function q({ className: e, children: t, meta: n, codeHighlight: r, shikiBundle:
|
|
|
645
691
|
}
|
|
646
692
|
};
|
|
647
693
|
try {
|
|
648
|
-
await e(
|
|
694
|
+
await e(S), p(!0), setTimeout(() => p(!1), 2e3);
|
|
649
695
|
} catch (e) {
|
|
650
696
|
console.error("Failed to copy:", e);
|
|
651
697
|
}
|
|
652
|
-
}, [
|
|
653
|
-
return s ? /* @__PURE__ */
|
|
698
|
+
}, [S]);
|
|
699
|
+
return s ? /* @__PURE__ */ E("div", {
|
|
654
700
|
className: "code-block-wrapper",
|
|
655
701
|
children: [
|
|
656
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ T("span", {
|
|
657
703
|
className: "code-lang-label",
|
|
658
|
-
children:
|
|
704
|
+
children: x
|
|
659
705
|
}),
|
|
660
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ T("button", {
|
|
661
707
|
className: "code-copy-btn",
|
|
662
|
-
onClick:
|
|
708
|
+
onClick: ee,
|
|
663
709
|
title: f ? "已复制" : "复制代码",
|
|
664
710
|
"aria-label": "复制代码",
|
|
665
|
-
children: f ? /* @__PURE__ */
|
|
711
|
+
children: f ? /* @__PURE__ */ T(y, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ T(b, { className: "h-4 w-4" })
|
|
666
712
|
}),
|
|
667
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ T("pre", {
|
|
668
714
|
className: `shiki-code-block${m ? " show-line-numbers" : ""}`,
|
|
669
715
|
dangerouslySetInnerHTML: { __html: s }
|
|
670
716
|
})
|
|
671
717
|
]
|
|
672
|
-
}) : /* @__PURE__ */
|
|
718
|
+
}) : /* @__PURE__ */ T("div", {
|
|
673
719
|
className: "code-block-wrapper",
|
|
674
|
-
children: /* @__PURE__ */
|
|
720
|
+
children: /* @__PURE__ */ T("pre", {
|
|
675
721
|
className: "shiki-code-block",
|
|
676
|
-
children: /* @__PURE__ */
|
|
722
|
+
children: /* @__PURE__ */ T("code", { children: S })
|
|
677
723
|
})
|
|
678
724
|
});
|
|
679
725
|
}
|
|
680
|
-
function
|
|
681
|
-
let [c, l] = v.useState(!1), u = v.useMemo(() =>
|
|
682
|
-
|
|
726
|
+
function X({ lang: e, viewerConfig: t, src: n, alt: r, title: i, className: a, node: o, ...s }) {
|
|
727
|
+
let [c, l] = v.useState(!1), u = v.useMemo(() => ue(e, t?.labels), [e, t?.labels]), d = v.useMemo(() => _e(i, s), [s, i]), f = d.preview ?? t?.enabled !== !1, p = d.inline === !0, m = !!(d.width || d.height), h = v.useMemo(() => ({
|
|
728
|
+
...s.style,
|
|
729
|
+
width: d.width ?? s.style?.width,
|
|
730
|
+
height: d.height ?? s.style?.height,
|
|
731
|
+
transform: [s.style?.transform, d.offsetX || d.offsetY ? `translate(${d.offsetX ?? "0px"}, ${d.offsetY ?? "0px"})` : void 0].filter(Boolean).join(" ") || void 0
|
|
732
|
+
}), [
|
|
733
|
+
d.height,
|
|
734
|
+
d.offsetX,
|
|
735
|
+
d.offsetY,
|
|
736
|
+
d.width,
|
|
737
|
+
s.style
|
|
738
|
+
]);
|
|
739
|
+
return n ? f ? m || p ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("button", {
|
|
740
|
+
type: "button",
|
|
741
|
+
className: "not-prose inline-flex max-w-full cursor-zoom-in align-middle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
742
|
+
onClick: () => l(!0),
|
|
743
|
+
"aria-label": u.preview,
|
|
744
|
+
title: u.preview,
|
|
745
|
+
children: /* @__PURE__ */ T("img", {
|
|
746
|
+
...s,
|
|
747
|
+
src: n,
|
|
748
|
+
alt: r || u.imageAltFallback,
|
|
749
|
+
title: d.title,
|
|
750
|
+
className: a ?? (p ? "inline-block align-middle" : void 0),
|
|
751
|
+
style: h
|
|
752
|
+
})
|
|
753
|
+
}), /* @__PURE__ */ T(B, {
|
|
754
|
+
open: c,
|
|
755
|
+
onOpenChange: l,
|
|
683
756
|
src: n,
|
|
684
|
-
alt: r
|
|
685
|
-
title:
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}) : /* @__PURE__ */
|
|
757
|
+
alt: r,
|
|
758
|
+
title: d.title,
|
|
759
|
+
lang: e,
|
|
760
|
+
labels: t?.labels
|
|
761
|
+
})] }) : /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("span", {
|
|
689
762
|
className: "not-prose group relative my-6 block",
|
|
690
|
-
children: [/* @__PURE__ */
|
|
763
|
+
children: [/* @__PURE__ */ T("button", {
|
|
691
764
|
type: "button",
|
|
692
765
|
className: "block w-full cursor-zoom-in overflow-hidden rounded-2xl border border-border/60 bg-muted/20 shadow-sm transition duration-200 hover:-translate-y-0.5 hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
693
766
|
onClick: () => l(!0),
|
|
694
767
|
"aria-label": u.preview,
|
|
695
768
|
title: u.preview,
|
|
696
|
-
children: /* @__PURE__ */
|
|
769
|
+
children: /* @__PURE__ */ T("img", {
|
|
770
|
+
...s,
|
|
697
771
|
src: n,
|
|
698
772
|
alt: r || u.imageAltFallback,
|
|
699
|
-
title:
|
|
773
|
+
title: d.title,
|
|
700
774
|
className: a ?? "h-auto w-full rounded-2xl object-contain",
|
|
701
|
-
|
|
775
|
+
style: h
|
|
702
776
|
})
|
|
703
|
-
}), /* @__PURE__ */
|
|
777
|
+
}), /* @__PURE__ */ E("button", {
|
|
704
778
|
type: "button",
|
|
705
779
|
className: "absolute right-3 top-3 inline-flex items-center gap-2 rounded-full border border-white/20 bg-black/65 px-3 py-1.5 text-xs font-medium text-white opacity-0 shadow-lg transition group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",
|
|
706
780
|
onClick: () => l(!0),
|
|
707
781
|
"aria-label": u.preview,
|
|
708
782
|
children: [
|
|
709
|
-
/* @__PURE__ */
|
|
783
|
+
/* @__PURE__ */ T("span", {
|
|
710
784
|
className: "sr-only",
|
|
711
785
|
children: u.preview
|
|
712
786
|
}),
|
|
713
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ E("svg", {
|
|
714
788
|
"aria-hidden": "true",
|
|
715
789
|
viewBox: "0 0 24 24",
|
|
716
790
|
className: "h-3.5 w-3.5",
|
|
@@ -719,27 +793,34 @@ function J({ lang: e, viewerConfig: t, src: n, alt: r, title: i, className: a, n
|
|
|
719
793
|
strokeWidth: "2",
|
|
720
794
|
strokeLinecap: "round",
|
|
721
795
|
strokeLinejoin: "round",
|
|
722
|
-
children: [/* @__PURE__ */
|
|
796
|
+
children: [/* @__PURE__ */ T("path", { d: "M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z" }), /* @__PURE__ */ T("circle", {
|
|
723
797
|
cx: "12",
|
|
724
798
|
cy: "12",
|
|
725
799
|
r: "3"
|
|
726
800
|
})]
|
|
727
801
|
}),
|
|
728
|
-
/* @__PURE__ */
|
|
802
|
+
/* @__PURE__ */ T("span", { children: u.preview })
|
|
729
803
|
]
|
|
730
804
|
})]
|
|
731
|
-
}), /* @__PURE__ */
|
|
805
|
+
}), /* @__PURE__ */ T(B, {
|
|
732
806
|
open: c,
|
|
733
807
|
onOpenChange: l,
|
|
734
808
|
src: n,
|
|
735
809
|
alt: r,
|
|
736
|
-
title:
|
|
810
|
+
title: d.title,
|
|
737
811
|
lang: e,
|
|
738
812
|
labels: t?.labels
|
|
739
|
-
})] }) :
|
|
813
|
+
})] }) : /* @__PURE__ */ T("img", {
|
|
814
|
+
...s,
|
|
815
|
+
src: n,
|
|
816
|
+
alt: r || u.imageAltFallback,
|
|
817
|
+
title: d.title,
|
|
818
|
+
className: a ?? (p ? "inline-block align-middle" : void 0),
|
|
819
|
+
style: h
|
|
820
|
+
}) : null;
|
|
740
821
|
}
|
|
741
|
-
function
|
|
742
|
-
let c =
|
|
822
|
+
function Z({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, shikiBundle: o }) {
|
|
823
|
+
let c = C(), u = c.lang || "zh-cn", d = c.version, f = s();
|
|
743
824
|
v.useEffect(() => {
|
|
744
825
|
r(i, o);
|
|
745
826
|
}, [i, o]);
|
|
@@ -747,11 +828,11 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
747
828
|
if (!t) return e;
|
|
748
829
|
let n = e.split("\n"), r = !1;
|
|
749
830
|
return n.filter((e) => !r && e.startsWith("# ") ? (r = !0, !1) : !0).join("\n");
|
|
750
|
-
}, [e, t]), m = v.useMemo(() =>
|
|
831
|
+
}, [e, t]), m = v.useMemo(() => G(p), [p]), h = v.useMemo(() => {
|
|
751
832
|
let e = /* @__PURE__ */ new Map();
|
|
752
833
|
return f && Object.entries(f).forEach(([t, n]) => {
|
|
753
834
|
let r = v.memo(({ children: e, ...t }) => {
|
|
754
|
-
let r =
|
|
835
|
+
let r = q(t);
|
|
755
836
|
return v.createElement(n, r, e);
|
|
756
837
|
});
|
|
757
838
|
if (e.set(t, r), t.includes(".")) {
|
|
@@ -760,17 +841,17 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
760
841
|
}
|
|
761
842
|
}), e;
|
|
762
843
|
}, [f]), g = v.useMemo(() => Object.fromEntries(h), [h]);
|
|
763
|
-
return /* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ T("div", {
|
|
764
845
|
className: "prose dark:prose-invert max-w-none",
|
|
765
|
-
children: /* @__PURE__ */
|
|
766
|
-
remarkPlugins: [
|
|
846
|
+
children: /* @__PURE__ */ T(k, {
|
|
847
|
+
remarkPlugins: [D, O],
|
|
767
848
|
rehypePlugins: [
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
[
|
|
773
|
-
[
|
|
849
|
+
j,
|
|
850
|
+
M,
|
|
851
|
+
L(g),
|
|
852
|
+
V,
|
|
853
|
+
[A, { behavior: "append" }],
|
|
854
|
+
[N, {
|
|
774
855
|
strict: !1,
|
|
775
856
|
trust: !0,
|
|
776
857
|
macros: {
|
|
@@ -779,16 +860,16 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
779
860
|
"\\Z": "\\mathbb{Z}",
|
|
780
861
|
"\\Q": "\\mathbb{Q}",
|
|
781
862
|
"\\C": "\\mathbb{C}",
|
|
782
|
-
...
|
|
863
|
+
...I
|
|
783
864
|
}
|
|
784
865
|
}]
|
|
785
866
|
],
|
|
786
867
|
components: {
|
|
787
868
|
...g,
|
|
788
869
|
table({ children: e, ...t }) {
|
|
789
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ T("div", {
|
|
790
871
|
className: "overflow-x-auto",
|
|
791
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ T("table", {
|
|
792
873
|
...t,
|
|
793
874
|
children: e
|
|
794
875
|
})
|
|
@@ -800,7 +881,7 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
800
881
|
let e = n.props, t = e?.className || "", r = /language-(\w+)/.exec(t), a = r ? r[1].toLowerCase() : "text", s = e?.node, c = e?.children, u = e?.["data-raw-value"];
|
|
801
882
|
u && (c = u);
|
|
802
883
|
let d = s?.data?.meta || "";
|
|
803
|
-
return a === "mermaid" ? /* @__PURE__ */
|
|
884
|
+
return a === "mermaid" ? /* @__PURE__ */ T(l, { chart: typeof c == "string" ? c : String(c || "") }) : /* @__PURE__ */ T(Y, {
|
|
804
885
|
className: t,
|
|
805
886
|
meta: d,
|
|
806
887
|
codeHighlight: i,
|
|
@@ -808,33 +889,33 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
808
889
|
children: c
|
|
809
890
|
});
|
|
810
891
|
}
|
|
811
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ T("pre", {
|
|
812
893
|
...t,
|
|
813
894
|
children: e
|
|
814
895
|
});
|
|
815
896
|
},
|
|
816
897
|
a({ href: e, children: t, ...n }) {
|
|
817
|
-
return e ? e.startsWith("#") ? /* @__PURE__ */
|
|
898
|
+
return e ? e.startsWith("#") ? /* @__PURE__ */ T("a", {
|
|
818
899
|
href: e,
|
|
819
900
|
...n,
|
|
820
901
|
children: t
|
|
821
|
-
}) : /^(https?:)?\/\//i.test(e) || e.startsWith("mailto:") || e.startsWith("tel:") ? /* @__PURE__ */
|
|
902
|
+
}) : /^(https?:)?\/\//i.test(e) || e.startsWith("mailto:") || e.startsWith("tel:") ? /* @__PURE__ */ T("a", {
|
|
822
903
|
href: e,
|
|
823
904
|
target: "_blank",
|
|
824
905
|
rel: "noopener noreferrer",
|
|
825
906
|
...n,
|
|
826
907
|
children: t
|
|
827
|
-
}) : /* @__PURE__ */
|
|
908
|
+
}) : /* @__PURE__ */ T(le, {
|
|
828
909
|
to: a(u, e.startsWith("/") ? e : `/${e}`, d),
|
|
829
910
|
...n,
|
|
830
911
|
children: t
|
|
831
|
-
}) : /* @__PURE__ */
|
|
912
|
+
}) : /* @__PURE__ */ T("a", {
|
|
832
913
|
...n,
|
|
833
914
|
children: t
|
|
834
915
|
});
|
|
835
916
|
},
|
|
836
917
|
img({ src: e, alt: t, title: r, className: i, node: a, ...o }) {
|
|
837
|
-
return /* @__PURE__ */
|
|
918
|
+
return /* @__PURE__ */ T(X, {
|
|
838
919
|
lang: u,
|
|
839
920
|
viewerConfig: n,
|
|
840
921
|
src: e,
|
|
@@ -851,4 +932,4 @@ function Y({ source: e, skipFirstH1: t = !1, imageViewer: n, codeHighlight: i, s
|
|
|
851
932
|
});
|
|
852
933
|
}
|
|
853
934
|
//#endregion
|
|
854
|
-
export {
|
|
935
|
+
export { B as n, Z as t };
|