@glodon-aiot/agent-cli-ui 3.3.2-beta.8 → 3.3.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/es/AgentClientUI.mjs +32 -34
- package/dist/es/Dialog/AgentChat/HistoryItem/index.mjs +142 -156
- package/dist/es/Dialog/AgentChat/index.mjs +147 -150
- package/dist/es/index.mjs +81 -87
- package/dist/es/packages/react-components/dist/es/components/Markdown/ATag/index.mjs +25 -27
- package/dist/es/packages/react-components/dist/es/components/Markdown/Image/index.mjs +27 -29
- package/dist/es/packages/react-components/dist/es/components/Markdown/index.mjs +48 -58
- package/dist/es/packages/react-components/dist/es/index.mjs +1 -1
- package/dist/es/src/style10.css +1 -1
- package/dist/es/src/style11.css +1 -1
- package/dist/es/src/style12.css +1 -1
- package/dist/es/src/style13.css +1 -1
- package/dist/es/src/style14.css +1 -1
- package/dist/es/src/style15.css +1 -1
- package/dist/es/src/style16.css +1 -1
- package/dist/es/src/style17.css +1 -1
- package/dist/es/src/style19.css +1 -1
- package/dist/es/src/style20.css +1 -1
- package/dist/es/src/style23.css +1 -1
- package/dist/es/src/style24.css +1 -1
- package/dist/es/src/style26.css +1 -1
- package/dist/es/src/style27.css +1 -1
- package/dist/es/src/style28.css +1 -1
- package/dist/es/src/style4.css +1 -1
- package/dist/es/src/style5.css +1 -1
- package/dist/es/src/style7.css +1 -1
- package/dist/es/src/style8.css +1 -1
- package/dist/es/src/style9.css +1 -1
- package/dist/lib/index.js +51 -51
- package/dist/src/Dialog/AgentChat/HistoryItem/index.d.ts +0 -2
- package/dist/src/ReactTextGenerationUI/components/TextSiders/index.d.ts +22 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSource/fetch.d.ts +44 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSource/index.d.ts +1 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSource/parse.d.ts +36 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/fetch.d.ts +44 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/index.d.ts +1 -0
- package/dist/src/ReactTextGenerationUI/components/fetchEventSourcea/parse.d.ts +36 -0
- package/dist/src/ReactTextGenerationUI/index.d.ts +4 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/types.d.ts +0 -3
- package/dist/src/utils/reactCompatibility.d.ts +27 -0
- package/package.json +3 -3
package/dist/es/index.mjs
CHANGED
|
@@ -2,71 +2,68 @@ var Z = Object.defineProperty, q = Object.defineProperties;
|
|
|
2
2
|
var ee = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var J = Object.getOwnPropertySymbols;
|
|
4
4
|
var ie = Object.prototype.hasOwnProperty, te = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var w = (g, i, s) => i in g ? Z(g, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : g[i] = s, o = (g, i) => {
|
|
6
6
|
for (var s in i || (i = {}))
|
|
7
|
-
ie.call(i, s) &&
|
|
7
|
+
ie.call(i, s) && w(g, s, i[s]);
|
|
8
8
|
if (J)
|
|
9
9
|
for (var s of J(i))
|
|
10
|
-
te.call(i, s) &&
|
|
10
|
+
te.call(i, s) && w(g, s, i[s]);
|
|
11
11
|
return g;
|
|
12
12
|
}, m = (g, i) => q(g, ee(i));
|
|
13
|
-
var
|
|
13
|
+
var a = (g, i, s) => (w(g, typeof i != "symbol" ? i + "" : i, s), s);
|
|
14
14
|
import { jsx as Q, Fragment as oe } from "react/jsx-runtime";
|
|
15
15
|
import l from "lodash/merge";
|
|
16
16
|
import G from "react-dom";
|
|
17
17
|
import se from "./AgentClientUI.mjs";
|
|
18
18
|
import { notification as K } from "antd";
|
|
19
|
-
import
|
|
20
|
-
import { defaultUIConfig as
|
|
19
|
+
import ne from "axios";
|
|
20
|
+
import { defaultUIConfig as re, defaultApiUrl as he, defaultDovViewerUrl as ae } from "./constant.mjs";
|
|
21
21
|
import { ApiUrl as ge } from "./types.mjs";
|
|
22
22
|
/* empty css */import { BotClientApi as le } from "@glodon-aiot/apis";
|
|
23
23
|
import { JWT as de, isExpired as fe } from "./utils/index.mjs";
|
|
24
|
-
import { configuration as ce, configure as ue } from "@glodon-aiot/bot-client-sdk";
|
|
25
24
|
const b = {};
|
|
26
|
-
class
|
|
25
|
+
class xe {
|
|
27
26
|
constructor(i) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O, P;
|
|
27
|
+
a(this, "_token");
|
|
28
|
+
a(this, "_activeSession", null);
|
|
29
|
+
a(this, "_applicationId");
|
|
30
|
+
a(this, "_defaultInputText", "");
|
|
31
|
+
a(this, "_inputDisabled", !1);
|
|
32
|
+
a(this, "_defatulSessionId", "");
|
|
33
|
+
a(this, "apiUrl");
|
|
34
|
+
a(this, "docViewerUrl");
|
|
35
|
+
a(this, "env", "prod");
|
|
36
|
+
a(this, "service");
|
|
37
|
+
a(this, "rId", 0);
|
|
38
|
+
a(this, "_mode", "float");
|
|
39
|
+
a(this, "uiConfig", re);
|
|
40
|
+
a(this, "errorHandlers", {});
|
|
41
|
+
a(this, "wrapper", document.createElement("div"));
|
|
42
|
+
var _, y, x, U, S, B, H, z, L, M, V, A, N, E, F, D, j, T, R, W, $, O, P;
|
|
45
43
|
const {
|
|
46
44
|
env: s,
|
|
47
45
|
token: d,
|
|
48
46
|
mode: f = "float",
|
|
49
47
|
triggerButton: p,
|
|
50
|
-
size:
|
|
51
|
-
apiUrl:
|
|
48
|
+
size: h,
|
|
49
|
+
apiUrl: n,
|
|
52
50
|
docViewerUrl: t,
|
|
53
|
-
errorHandlers:
|
|
51
|
+
errorHandlers: r,
|
|
54
52
|
features: e,
|
|
55
53
|
sessionId: u,
|
|
56
54
|
icon: X,
|
|
57
|
-
logo: Y
|
|
55
|
+
logo: Y
|
|
58
56
|
// greeting,
|
|
59
|
-
stream: w
|
|
60
57
|
} = i;
|
|
61
58
|
this.uiConfig.icon = X || this.uiConfig.icon, this.uiConfig.logo = Y || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = m(o({}, this.uiConfig.features), {
|
|
62
|
-
greeting: o(o({}, typeof ((
|
|
59
|
+
greeting: o(o({}, typeof ((_ = this.uiConfig.features) == null ? void 0 : _.greeting) != "object" ? {} : (y = this.uiConfig.features) == null ? void 0 : y.greeting), e.greeting)
|
|
63
60
|
}) : this.uiConfig.features = m(o({}, this.uiConfig.features), {
|
|
64
61
|
greeting: e.greeting
|
|
65
|
-
})), this._token = d, this.rId = 0, this._defatulSessionId = u, this.errorHandlers = o(o({}, this.errorHandlers),
|
|
66
|
-
const
|
|
62
|
+
})), console.log("this.uiConfig.features?.greeting", (x = this.uiConfig.features) == null ? void 0 : x.greeting), this._token = d, this.rId = 0, this._defatulSessionId = u, this.errorHandlers = o(o({}, this.errorHandlers), r);
|
|
63
|
+
const k = {
|
|
67
64
|
sessionOpen: f === "float",
|
|
68
65
|
sessionList: f === "float"
|
|
69
|
-
},
|
|
66
|
+
}, I = (B = (S = (U = e == null ? void 0 : e.botMessageBox) == null ? void 0 : U.footer) == null ? void 0 : S.items) == null ? void 0 : B.find((c) => c.componentName === "AnswerAgain");
|
|
70
67
|
(L = (z = (H = e == null ? void 0 : e.botMessageBox) == null ? void 0 : H.footer) == null ? void 0 : z.items) == null || L.find((c) => c.componentName === "Copy");
|
|
71
68
|
const C = {
|
|
72
69
|
sessionList: e == null ? void 0 : e.sessionList,
|
|
@@ -77,7 +74,7 @@ class Be {
|
|
|
77
74
|
userPrompt: e == null ? void 0 : e.fileUpload,
|
|
78
75
|
prompt: e == null ? void 0 : e.prompts,
|
|
79
76
|
relate: (A = e == null ? void 0 : e.botMessageBox) == null ? void 0 : A.relatedQuesions,
|
|
80
|
-
again: !(
|
|
77
|
+
again: !(I && I.visible === !1),
|
|
81
78
|
reference: {
|
|
82
79
|
iconVisible: (E = (N = e == null ? void 0 : e.botMessageBox) == null ? void 0 : N.reference) == null ? void 0 : E.file,
|
|
83
80
|
referenceFirst: (F = e == null ? void 0 : e.botMessageBox) == null ? void 0 : F.referenceFirst,
|
|
@@ -108,26 +105,24 @@ class Be {
|
|
|
108
105
|
maxWidth: "100%",
|
|
109
106
|
maxHeight: "100%",
|
|
110
107
|
minWidth: "100%"
|
|
111
|
-
},
|
|
108
|
+
}, h),
|
|
112
109
|
theme: l(this.uiConfig.theme, b),
|
|
113
110
|
history: !0
|
|
114
111
|
};
|
|
115
112
|
this.uiConfig = m(o(o(o(o({}, this.uiConfig), i), c), v), {
|
|
116
|
-
transform: o(o(o(o({}, this.uiConfig.transform),
|
|
113
|
+
transform: o(o(o(o({}, this.uiConfig.transform), k), i.transform), C)
|
|
117
114
|
}), this.wrapper = this.uiConfig.getContainer();
|
|
118
115
|
} else {
|
|
119
116
|
const c = {
|
|
120
117
|
triggerButton: l(this.uiConfig.triggerButton, p),
|
|
121
|
-
size: l(this.uiConfig.size, o({},
|
|
118
|
+
size: l(this.uiConfig.size, o({}, h)),
|
|
122
119
|
theme: l(this.uiConfig.theme, b)
|
|
123
120
|
};
|
|
124
121
|
this.uiConfig = m(o(o(o(o(o({}, this.uiConfig), i), c), v), C), {
|
|
125
|
-
transform: o(o(o(o({}, this.uiConfig.transform),
|
|
122
|
+
transform: o(o(o(o({}, this.uiConfig.transform), k), i.transform), C)
|
|
126
123
|
}), this.uiConfig.getContainer().append(this.wrapper);
|
|
127
124
|
}
|
|
128
|
-
this._mode = f, this.env = s || "prod", this.
|
|
129
|
-
stream: this.stream
|
|
130
|
-
}), this._applicationId = de(d).rid, this.apiUrl = r || ge[this.env] || ae, this.docViewerUrl = t || he, this.service = this.setService(), this.render();
|
|
125
|
+
this._mode = f, this.env = s || "prod", this._applicationId = de(d).rid, this.apiUrl = n || ge[this.env] || he, this.docViewerUrl = t || ae, this.service = this.setService(), this.render();
|
|
131
126
|
}
|
|
132
127
|
get token() {
|
|
133
128
|
return this._token;
|
|
@@ -176,10 +171,10 @@ class Be {
|
|
|
176
171
|
setService() {
|
|
177
172
|
const i = this.apiUrl, s = (t) => {
|
|
178
173
|
var e;
|
|
179
|
-
const
|
|
180
|
-
if (!
|
|
174
|
+
const r = this.token;
|
|
175
|
+
if (!r)
|
|
181
176
|
return t;
|
|
182
|
-
if (fe(
|
|
177
|
+
if (fe(r)) {
|
|
183
178
|
const u = "token is timeout";
|
|
184
179
|
this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
|
|
185
180
|
// @ts-ignore
|
|
@@ -192,16 +187,16 @@ class Be {
|
|
|
192
187
|
) : console.error("errorHandlers.token is not a function") : console.error(u);
|
|
193
188
|
}
|
|
194
189
|
return t.headers = (e = t.headers) != null ? e : {}, t.headers = m(o({}, t.headers), {
|
|
195
|
-
Authorization:
|
|
190
|
+
Authorization: r ? `Bearer ${r}` : ""
|
|
196
191
|
}), t;
|
|
197
192
|
};
|
|
198
|
-
function d(t,
|
|
199
|
-
const e = `${i}${t}`, u =
|
|
193
|
+
function d(t, r = !0) {
|
|
194
|
+
const e = `${i}${t}`, u = ne.create({
|
|
200
195
|
baseURL: e
|
|
201
196
|
});
|
|
202
|
-
return
|
|
197
|
+
return r && u.interceptors.request.use(s), u;
|
|
203
198
|
}
|
|
204
|
-
const f = (t,
|
|
199
|
+
const f = (t, r) => {
|
|
205
200
|
if (t === 401) {
|
|
206
201
|
const e = "token is invalid";
|
|
207
202
|
this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
|
|
@@ -214,14 +209,14 @@ class Be {
|
|
|
214
209
|
})
|
|
215
210
|
) : console.error("errorHandlers.token is not a function") : console.error(e);
|
|
216
211
|
}
|
|
217
|
-
}, p = (t,
|
|
212
|
+
}, p = (t, r, e) => {
|
|
218
213
|
t !== 10001 && t !== 10215 && (e || (K.config({
|
|
219
214
|
getContainer: this.uiConfig.getContainer
|
|
220
215
|
}), K.error({
|
|
221
|
-
message:
|
|
216
|
+
message: r
|
|
222
217
|
})));
|
|
223
|
-
},
|
|
224
|
-
return new le(
|
|
218
|
+
}, h = d("");
|
|
219
|
+
return new le(h, () => this.token, {
|
|
225
220
|
onHttpStatusError: f,
|
|
226
221
|
onAppStatusError: p
|
|
227
222
|
});
|
|
@@ -279,60 +274,60 @@ class Be {
|
|
|
279
274
|
disabled: this._inputDisabled,
|
|
280
275
|
sider: this.uiConfig.sider,
|
|
281
276
|
footer: this.uiConfig.footer,
|
|
282
|
-
onComment: (
|
|
283
|
-
var
|
|
277
|
+
onComment: (h) => {
|
|
278
|
+
var n, t;
|
|
284
279
|
try {
|
|
285
|
-
(t = (
|
|
286
|
-
} catch (
|
|
287
|
-
console.error(
|
|
280
|
+
(t = (n = this.uiConfig.eventListeners) == null ? void 0 : n.comment) == null || t.call(n, h);
|
|
281
|
+
} catch (r) {
|
|
282
|
+
console.error(r);
|
|
288
283
|
}
|
|
289
284
|
},
|
|
290
|
-
onMessage: (
|
|
291
|
-
var
|
|
292
|
-
if (
|
|
285
|
+
onMessage: (h) => {
|
|
286
|
+
var n, t;
|
|
287
|
+
if (h.message.messageId)
|
|
293
288
|
try {
|
|
294
|
-
(t = (
|
|
295
|
-
} catch (
|
|
296
|
-
console.error(
|
|
289
|
+
(t = (n = this.uiConfig.eventListeners) == null ? void 0 : n.message) == null || t.call(n, h);
|
|
290
|
+
} catch (r) {
|
|
291
|
+
console.error(r);
|
|
297
292
|
}
|
|
298
293
|
},
|
|
299
|
-
beforeMessageSend: (
|
|
300
|
-
var
|
|
301
|
-
if (!((
|
|
294
|
+
beforeMessageSend: (h) => {
|
|
295
|
+
var n, t, r;
|
|
296
|
+
if (!((n = this.uiConfig.eventListeners) != null && n.beforemessagesend))
|
|
302
297
|
return !0;
|
|
303
298
|
try {
|
|
304
|
-
return ((
|
|
299
|
+
return ((r = (t = this.uiConfig.eventListeners) == null ? void 0 : t.beforemessagesend) == null ? void 0 : r.call(t, h)) || !1;
|
|
305
300
|
} catch (e) {
|
|
306
301
|
return console.error(e), !1;
|
|
307
302
|
}
|
|
308
303
|
},
|
|
309
|
-
onSessionUnload: (
|
|
310
|
-
var
|
|
304
|
+
onSessionUnload: (h) => {
|
|
305
|
+
var n, t;
|
|
311
306
|
this._activeSession = null;
|
|
312
307
|
try {
|
|
313
|
-
(t = (
|
|
314
|
-
} catch (
|
|
315
|
-
console.error(
|
|
308
|
+
(t = (n = this.uiConfig.eventListeners) == null ? void 0 : n.sessionunload) == null || t.call(n, h);
|
|
309
|
+
} catch (r) {
|
|
310
|
+
console.error(r);
|
|
316
311
|
}
|
|
317
312
|
},
|
|
318
|
-
onSessionLoad: (
|
|
319
|
-
var
|
|
320
|
-
if (((
|
|
321
|
-
this._activeSession =
|
|
313
|
+
onSessionLoad: (h) => {
|
|
314
|
+
var n, t, r;
|
|
315
|
+
if (((n = this._activeSession) == null ? void 0 : n.id) === h.sessionId)
|
|
316
|
+
this._activeSession = h.session;
|
|
322
317
|
else {
|
|
323
|
-
this._activeSession =
|
|
318
|
+
this._activeSession = h.session;
|
|
324
319
|
try {
|
|
325
|
-
(
|
|
320
|
+
(r = (t = this.uiConfig.eventListeners) == null ? void 0 : t.sessionload) == null || r.call(t, h);
|
|
326
321
|
} catch (e) {
|
|
327
322
|
console.error(e);
|
|
328
323
|
}
|
|
329
324
|
}
|
|
330
325
|
},
|
|
331
|
-
onHistoryLoad: (
|
|
332
|
-
var
|
|
333
|
-
if (((
|
|
326
|
+
onHistoryLoad: (h) => {
|
|
327
|
+
var n, t, r;
|
|
328
|
+
if (((n = this._activeSession) == null ? void 0 : n.id) === h.sessionId)
|
|
334
329
|
try {
|
|
335
|
-
(
|
|
330
|
+
(r = (t = this.uiConfig.eventListeners) == null ? void 0 : t.historyload) == null || r.call(t, h);
|
|
336
331
|
} catch (e) {
|
|
337
332
|
console.error(e);
|
|
338
333
|
}
|
|
@@ -340,8 +335,7 @@ class Be {
|
|
|
340
335
|
defaultInput: this._defaultInputText !== void 0 ? {
|
|
341
336
|
text: this._defaultInputText
|
|
342
337
|
} : void 0,
|
|
343
|
-
bodyStyle: this.uiConfig.bodyStyle
|
|
344
|
-
stream: this.stream
|
|
338
|
+
bodyStyle: this.uiConfig.bodyStyle
|
|
345
339
|
}), this.wrapper), this._defaultInputText = "";
|
|
346
340
|
}
|
|
347
341
|
destroy(i) {
|
|
@@ -349,5 +343,5 @@ class Be {
|
|
|
349
343
|
}
|
|
350
344
|
}
|
|
351
345
|
export {
|
|
352
|
-
|
|
346
|
+
xe as default
|
|
353
347
|
};
|
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
import { jsx as f, jsxs as h, Fragment as O } from "react/jsx-runtime";
|
|
2
|
-
var
|
|
3
|
-
for (var
|
|
4
|
-
u.call(e,
|
|
2
|
+
var m = Object.defineProperty, g = Object.defineProperties, j = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, d = Object.prototype.propertyIsEnumerable, s = (r, e, a) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[e] = a, p = (r, e) => {
|
|
3
|
+
for (var a in e || (e = {}))
|
|
4
|
+
u.call(e, a) && s(r, a, e[a]);
|
|
5
5
|
if (l)
|
|
6
|
-
for (var
|
|
7
|
-
d.call(e,
|
|
6
|
+
for (var a of l(e))
|
|
7
|
+
d.call(e, a) && s(r, a, e[a]);
|
|
8
8
|
return r;
|
|
9
|
-
}, y = (r, e) =>
|
|
10
|
-
var
|
|
11
|
-
for (var
|
|
12
|
-
u.call(r,
|
|
9
|
+
}, y = (r, e) => g(r, j(e)), x = (r, e) => {
|
|
10
|
+
var a = {};
|
|
11
|
+
for (var t in r)
|
|
12
|
+
u.call(r, t) && e.indexOf(t) < 0 && (a[t] = r[t]);
|
|
13
13
|
if (r != null && l)
|
|
14
|
-
for (var
|
|
15
|
-
e.indexOf(
|
|
16
|
-
return
|
|
14
|
+
for (var t of l(r))
|
|
15
|
+
e.indexOf(t) < 0 && d.call(r, t) && (a[t] = r[t]);
|
|
16
|
+
return a;
|
|
17
17
|
};
|
|
18
18
|
const P = (r) => {
|
|
19
|
-
var e,
|
|
20
|
-
const
|
|
19
|
+
var e, a;
|
|
20
|
+
const t = r, {
|
|
21
21
|
node: o
|
|
22
|
-
} =
|
|
22
|
+
} = t, i = x(t, [
|
|
23
23
|
"node"
|
|
24
24
|
]);
|
|
25
25
|
if (o.tagName === "a" && ((e = o.children) == null ? void 0 : e.length) > 0) {
|
|
26
|
-
const
|
|
27
|
-
let
|
|
26
|
+
const v = ((a = o.children[0]) == null ? void 0 : a.value) || "";
|
|
27
|
+
let w = /(^https?:\/\/|^www\.)(?:www\.)?[\w\-]+(\.[\w\-]+)+(\/[\w\- .\/?%&=]*)?/g, c = v.match(w), b = v.replace(w, "").trim();
|
|
28
28
|
if (!(c != null && c.length))
|
|
29
|
-
return /* @__PURE__ */ f("a",
|
|
30
|
-
const
|
|
29
|
+
return /* @__PURE__ */ f("a", p({}, i));
|
|
30
|
+
const n = c[0];
|
|
31
31
|
return /* @__PURE__ */ h(O, {
|
|
32
|
-
children: [/* @__PURE__ */ f("a", y(
|
|
33
|
-
href: /^www\./.test(
|
|
34
|
-
|
|
35
|
-
}, i), {
|
|
36
|
-
children: t
|
|
32
|
+
children: [/* @__PURE__ */ f("a", y(p({}, i), {
|
|
33
|
+
href: /^www\./.test(n) ? "//" + n : n,
|
|
34
|
+
children: n
|
|
37
35
|
})), b]
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
return /* @__PURE__ */ f("a",
|
|
41
|
-
},
|
|
38
|
+
return /* @__PURE__ */ f("a", p({}, i));
|
|
39
|
+
}, k = P;
|
|
42
40
|
export {
|
|
43
|
-
|
|
41
|
+
k as default
|
|
44
42
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { Image as
|
|
1
|
+
import { jsx as e, jsxs as p, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { Image as b } from "antd";
|
|
3
3
|
import "../../../../../../../node_modules/antd-mobile/es/global/index.mjs";
|
|
4
|
-
import
|
|
5
|
-
import { useState as
|
|
6
|
-
import { isMobile as
|
|
7
|
-
import
|
|
8
|
-
import { checkMediaType as
|
|
9
|
-
var
|
|
4
|
+
import u from "../../../../../../../node_modules/antd-mobile/es/components/image-viewer/index.mjs";
|
|
5
|
+
import { useState as c, useEffect as v } from "react";
|
|
6
|
+
import { isMobile as y } from "../../../../../../../node_modules/react-device-detect/dist/lib.mjs";
|
|
7
|
+
import d from "../Video/index.mjs";
|
|
8
|
+
import { checkMediaType as g } from "../../../utils/markdown/index.mjs";
|
|
9
|
+
var j = Object.defineProperty, O = Object.defineProperties, w = Object.getOwnPropertyDescriptors, l = Object.getOwnPropertySymbols, h = Object.prototype.hasOwnProperty, k = Object.prototype.propertyIsEnumerable, a = (r, o, t) => o in r ? j(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t, x = (r, o) => {
|
|
10
10
|
for (var t in o || (o = {}))
|
|
11
|
-
|
|
12
|
-
if (
|
|
13
|
-
for (var t of
|
|
14
|
-
|
|
11
|
+
h.call(o, t) && a(r, t, o[t]);
|
|
12
|
+
if (l)
|
|
13
|
+
for (var t of l(o))
|
|
14
|
+
k.call(o, t) && a(r, t, o[t]);
|
|
15
15
|
return r;
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
const [o, t] =
|
|
19
|
-
return
|
|
20
|
-
r.src &&
|
|
21
|
-
}, [r.src]),
|
|
16
|
+
}, P = (r, o) => O(r, w(o));
|
|
17
|
+
const C = (r) => {
|
|
18
|
+
const [o, t] = c(!1), [n, i] = c();
|
|
19
|
+
return v(() => {
|
|
20
|
+
r.src && i(g(r.src));
|
|
21
|
+
}, [r.src]), n == "video" ? /* @__PURE__ */ e(d, {
|
|
22
22
|
src: r.src,
|
|
23
23
|
controls: !0
|
|
24
|
-
}) :
|
|
25
|
-
children: [/* @__PURE__ */ e("img",
|
|
24
|
+
}) : y ? /* @__PURE__ */ p(f, {
|
|
25
|
+
children: [/* @__PURE__ */ e("img", {
|
|
26
26
|
style: {
|
|
27
27
|
maxWidth: "100%"
|
|
28
28
|
},
|
|
@@ -30,29 +30,27 @@ const M = (r) => {
|
|
|
30
30
|
onClick: () => {
|
|
31
31
|
t(!0);
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}), /* @__PURE__ */ e(u, {
|
|
34
34
|
image: (r == null ? void 0 : r.src) || "",
|
|
35
35
|
visible: o,
|
|
36
36
|
onClose: () => {
|
|
37
37
|
t(!1);
|
|
38
38
|
}
|
|
39
39
|
})]
|
|
40
|
-
}) : /* @__PURE__ */ e(
|
|
40
|
+
}) : /* @__PURE__ */ e(b, P(x({
|
|
41
41
|
style: {
|
|
42
42
|
maxWidth: "100%"
|
|
43
43
|
}
|
|
44
44
|
}, r), {
|
|
45
|
-
onClick: (
|
|
46
|
-
var
|
|
47
|
-
(
|
|
48
|
-
target: (n = (a = s.target) == null ? void 0 : a.offsetParent) == null ? void 0 : n.children[0]
|
|
49
|
-
}));
|
|
45
|
+
onClick: (m) => {
|
|
46
|
+
var s;
|
|
47
|
+
return (s = r.onClick) == null ? void 0 : s.call(r, m);
|
|
50
48
|
},
|
|
51
49
|
onError: () => {
|
|
52
50
|
console.log(r), console.warn("图片加载失败");
|
|
53
51
|
}
|
|
54
52
|
}));
|
|
55
|
-
},
|
|
53
|
+
}, T = C;
|
|
56
54
|
export {
|
|
57
|
-
|
|
55
|
+
T as default
|
|
58
56
|
};
|
|
@@ -1,78 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
/* empty css */import
|
|
4
|
-
import
|
|
5
|
-
import { replaceLatexDelimiters as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u } from "react";
|
|
3
|
+
/* empty css */import v from "./Image/index.mjs";
|
|
4
|
+
import y from "./Code/index.mjs";
|
|
5
|
+
import { replaceLatexDelimiters as b } from "../../utils/markdown/index.mjs";
|
|
6
|
+
import h from "./ATag/index.mjs";
|
|
7
|
+
import w from "./Video/index.mjs";
|
|
8
8
|
import { Markdown as O } from "../../../../../../node_modules/react-markdown/lib/index.mjs";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
9
|
+
import k from "../../../../../../node_modules/rehype-katex/lib/index.mjs";
|
|
10
|
+
import g from "../../../../../../node_modules/rehype-raw/lib/index.mjs";
|
|
11
|
+
import x from "../../../../../../node_modules/rehype-external-links/lib/index.mjs";
|
|
12
12
|
import j from "../../../../../../node_modules/remark-math/lib/index.mjs";
|
|
13
|
-
import
|
|
14
|
-
var
|
|
15
|
-
for (var
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var
|
|
19
|
-
|
|
13
|
+
import P from "../../../../../../node_modules/remark-gfm/lib/index.mjs";
|
|
14
|
+
var L = Object.defineProperty, M = Object.defineProperties, $ = Object.getOwnPropertyDescriptors, n = Object.getOwnPropertySymbols, f = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable, l = (r, e, t) => e in r ? L(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, i = (r, e) => {
|
|
15
|
+
for (var t in e || (e = {}))
|
|
16
|
+
f.call(e, t) && l(r, t, e[t]);
|
|
17
|
+
if (n)
|
|
18
|
+
for (var t of n(e))
|
|
19
|
+
c.call(e, t) && l(r, t, e[t]);
|
|
20
20
|
return r;
|
|
21
|
-
}, D = (r, e) =>
|
|
22
|
-
var
|
|
23
|
-
for (var
|
|
24
|
-
|
|
25
|
-
if (r != null &&
|
|
26
|
-
for (var
|
|
27
|
-
e.indexOf(
|
|
28
|
-
return
|
|
21
|
+
}, D = (r, e) => M(r, $(e)), E = (r, e) => {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var o in r)
|
|
24
|
+
f.call(r, o) && e.indexOf(o) < 0 && (t[o] = r[o]);
|
|
25
|
+
if (r != null && n)
|
|
26
|
+
for (var o of n(r))
|
|
27
|
+
e.indexOf(o) < 0 && c.call(r, o) && (t[o] = r[o]);
|
|
28
|
+
return t;
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const H = (r) => {
|
|
31
31
|
var e = r, {
|
|
32
|
-
showLatex:
|
|
33
|
-
components:
|
|
34
|
-
componentProps: a,
|
|
32
|
+
showLatex: t = !0,
|
|
33
|
+
components: o = {},
|
|
35
34
|
children: p
|
|
36
|
-
} = e,
|
|
35
|
+
} = e, s = E(e, [
|
|
37
36
|
"showLatex",
|
|
38
37
|
"components",
|
|
39
|
-
"componentProps",
|
|
40
38
|
"children"
|
|
41
39
|
]);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
code(m) {
|
|
47
|
-
return /* @__PURE__ */ l(h, n(n({}, m), a == null ? void 0 : a.code));
|
|
48
|
-
},
|
|
49
|
-
video(m) {
|
|
50
|
-
return /* @__PURE__ */ l(g, n(n({}, m), a == null ? void 0 : a.video));
|
|
51
|
-
},
|
|
52
|
-
a(m) {
|
|
53
|
-
return /* @__PURE__ */ l(b, n(n({}, m), a == null ? void 0 : a.a));
|
|
54
|
-
}
|
|
55
|
-
}, t);
|
|
56
|
-
return /* @__PURE__ */ l("div", {
|
|
57
|
-
ref: u,
|
|
58
|
-
children: /* @__PURE__ */ l(O, D(n({
|
|
40
|
+
const d = u(null);
|
|
41
|
+
return /* @__PURE__ */ a("div", {
|
|
42
|
+
ref: d,
|
|
43
|
+
children: /* @__PURE__ */ a(O, D(i({
|
|
59
44
|
className: "markdown",
|
|
60
|
-
rehypePlugins: [
|
|
45
|
+
rehypePlugins: [k, g, [x, {
|
|
61
46
|
target: "_blank"
|
|
62
47
|
}]],
|
|
63
|
-
remarkPlugins: [j, [
|
|
48
|
+
remarkPlugins: [j, [P, {
|
|
64
49
|
singleTilde: !1
|
|
65
50
|
}]]
|
|
66
|
-
},
|
|
67
|
-
children:
|
|
68
|
-
components:
|
|
51
|
+
}, s), {
|
|
52
|
+
children: t ? b(p) : p,
|
|
53
|
+
components: i({
|
|
54
|
+
img(m) {
|
|
55
|
+
return /* @__PURE__ */ a(v, i({}, m));
|
|
56
|
+
},
|
|
57
|
+
code(m) {
|
|
58
|
+
return /* @__PURE__ */ a(y, i({}, m));
|
|
59
|
+
},
|
|
60
|
+
video: w,
|
|
61
|
+
a: h
|
|
62
|
+
}, o)
|
|
69
63
|
}))
|
|
70
64
|
});
|
|
71
65
|
};
|
|
72
66
|
export {
|
|
73
|
-
|
|
74
|
-
b as MarkdownATag,
|
|
75
|
-
h as MarkdownCode,
|
|
76
|
-
y as MarkdownImage,
|
|
77
|
-
g as MarkdownVideo
|
|
67
|
+
H as Markdown
|
|
78
68
|
};
|