@somecat/ai-assist-sdk 1.1.1 → 1.1.4
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/ai-assist-sdk.css +1 -1
- package/dist/chunks/index-CgnkZbtP.mjs +149 -0
- package/dist/react/components/Answer.d.ts +1 -2
- package/dist/react/components/answer/components/AgentThoughtBlock.d.ts +5 -0
- package/dist/react/components/answer/components/ChatInput.d.ts +13 -0
- package/dist/react/components/answer/components/MessageItem.d.ts +9 -0
- package/dist/react/components/answer/components/StreamingMarkdown.d.ts +12 -0
- package/dist/react/components/answer/components/ThinkingBlock.d.ts +6 -0
- package/dist/react/components/answer/hooks/useChatActions.d.ts +30 -0
- package/dist/react/components/answer/hooks/useMessagesBatch.d.ts +11 -0
- package/dist/react/components/answer/hooks/useSSEStream.d.ts +26 -0
- package/dist/react/components/answer/hooks/useScrollManager.d.ts +12 -0
- package/dist/react/components/answer/status.d.ts +10 -0
- package/dist/react/index.mjs +10165 -11055
- package/dist/vue/index.mjs +752 -1803
- package/package.json +11 -3
- package/dist/chunks/index-Co5SARS3.mjs +0 -152
package/dist/vue/index.mjs
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { r as
|
|
3
|
-
import { SearchOutlined as
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { defineComponent as nt, reactive as K, openBlock as g, createElementBlock as y, normalizeClass as U, Fragment as z, createStaticVNode as bt, createCommentVNode as Y, renderList as at, createElementVNode as n, createVNode as F, unref as M, toDisplayString as X, Transition as St, withCtx as Et, createBlock as j, withKeys as Rt, ref as T, nextTick as ut, computed as et, watch as wt, onMounted as q, onUnmounted as mt, withModifiers as ft, Teleport as Tt, withDirectives as gt, vShow as pt, vModelText as Dt, normalizeStyle as Mt, createApp as Ot } from "vue";
|
|
2
|
+
import { r as yt, p as kt, u as Ht, c as Pt, g as $t, s as Lt, a as Bt, b as Nt, d as Yt, e as vt, f as Qt, h as _t, i as Xt, j as Wt, k as Ct } from "../chunks/index-DctVgLU4.mjs";
|
|
3
|
+
import { SearchOutlined as Gt, CheckOutlined as Vt, CopyOutlined as Jt, RedoOutlined as Ft } from "@ant-design/icons-vue";
|
|
4
|
+
import { Icon as x } from "@iconify/vue";
|
|
5
|
+
import { f as Ut, s as it, a as jt, b as qt, c as xt } from "../chunks/index-CgnkZbtP.mjs";
|
|
6
|
+
const zt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACQNJREFUeF7lmwuMlFcVx3/nY1lYYAEX6FJ22fIIUMvDUEAaqA9aSWqCL6oRaQlPoVbUKthqNdZGY6rtsoYaKwSBhhYbU5tYSWykVvDRWgq2AUp4WGCXXSiwPMpz2d2Z65z57rc7+83sPHbv0pq5yWSSmfude+7/3Hven9DFwxgzCPg4MBYYA4wGBgLF9qMcXLSfeuAgcAB4G/i7iJzuShalK4gbYybFNjIXmAmMAzq6jgH2AltjwG0WkV2u+e0oY0l8GGNUokuBRcAtrhm19PYB64G1IqKnptOj0wAYY/oDDwDfBD7UaY6yI3AOWA38UkTOZ/dI6lkdBsAYo88uAH4O6D1/P4bqh4eAjSKi1yXn0SEAjDEVeidjd3N6zit2zQP/Up0jIjW5ks8ZAGOMbvoF4IZcF+vi+aeA2SKiYGQ9cgLAGKMK7imgMOsVru/ERuBrIqKKMquRFQDGmG7A48C3s6L6/k+qAr4rIpFMrGQEwG5ej/xnMxH7gP3/or0SaUHIBoBV/0eSD8ugSkS+k04waQGwd/63HzDJ5srO4nQ6oV0ArLZ/xbXCOwv81xiOG7hkfeTeMdduiMAoka7wpFQx3tGedUgJgLXzb7g0dc3Aq82Gg0YwRn0W/ejy1n8xIJ4wWmBagVCQq5zTz1cTOSWVn5AEgPXw/uHSyWkAtjQYTkdNy36T+A2wEBjkCZ/pKfRwC4L6Bx8Le4ypAFhoAw5ny//xKtQ0RREJpJ+ZdEWB8LleGXV0ZkJtZywSkQ2JP7VZwQY2Go878+33NMLLl6MIgsHEv3XoNWgDiIj+CPptL8edvYXxbl0ujR1GJwZQYQB+HOPtkVxhbW++3u41Zw0XI/7GEwFouf6WgzAgOr+4GywtCSBzxRWPxoDXfbYAHUhE4/lqlyFtbRM8c8ZXckkSDyEQOgAtOvLeAUJ5d2ebV0IaSt8U5BNaToAxZgXwhMul/nkRtr2XGoDg+Ot3qhHYiE/2E25X0bgdK0WkMrhqgYQ0B+c0k7PlLOy82E6YnmQFW69JnDGrMKf09ZhV4nb3wD4R0Rylr5FsDm+n62WeOwl7L2WXp0iwgr5ALHNj+whzSl1zFqc3WXOMAQB6HNL6zB1hYfMJ2H0hOwCS6FtEJvQV5t7YkdUzPrMqpgdWBADsBsZnfCTHCZtqFQD/oWSzlyDmRJEHeFkAPtJPmFee48LZTd8jIhPE5u1PdiJ13e5yG2vgrfOpT0BYCSaZQasDJvYX5msCzv1QxkoVgLtjufvn3dOH9UfhzXMhkbbnCIUZsCfg1hJh0bCu4C5O84sKwI9i0n/UxRLbTumGYe4wKO0B6w7DTusHhJVcayCU3t2dVAJLRsKFZthSB+P6w4R+LriN03hEAXjWVnE6TfUbb0BDM9xVBndXwJqDsFPj3xQ6IOMVsJ7jlAHCstHwYi386Rj06Q5VkzvNakBgswKgYa8Tkgs13jJwx40wbyT8ej/sqPevQJIrnOUepgyE+2+GTYfhleO+ptrgLhm/UwE4EissOLll87b7AHyqDOaPgl/tg9dtabM9O9+iIkOOUeAJTL0Blt8CTx+Cl+v8YGnTJ7JEL/O0owqAVmQHZJ6becZX/urf7JnlsHAMrN4Lr6l96cS4rRS+NQ42HIC/1Pr0N9/ZCYJtHz2jAFxzlfaa87fWE7BkDPxmP2w7EegAP9KNJ4MSckGBCkw6AJbRGUPgvpth3QHYWgeewO9mOAOg0SkAX30V3ms0TB0krBgLzx2BF6pTm8GklFg4PrZ7nH0TzBkOlW/716lvIayb5hYAZ1dg5S6ovgwji+Gxib4FeGyPVYJt8x1JZ6A9R+j74wU1hQ/9Bw5fgoreUKndB25G/Ao4U4JPHoRtJw3dRFh3G/TwYPHrcDVic4EJOdAk/lNoyaICYf1UaIjAkh0QiRpmDBaWj3Kz+1h1O64EnZnB187AL/b7El82UrhrMDxbDc/XpsgChxMiKUKDLw0V5lbAS+/Cmnd8uivHCNO1wcbNiJtBZ45QQxQW74LLzYaSQuGpiaDCX7EbTjSEY4K2ai9IBwZKckiRR+UEKBC4700422joUyCsmwQ9PTe7j7fduHSFla3f18Ezx6JxDmcNFpYOE45egR/sM1xsbgUhXUaoOFYX+OmHYVgvWHvUsOVdtf9wT7nHl8ucbV4JxV1hp8GQnoL79xpOq8QFllV4zCqFugb42SFDzdX0+YGKIuHhUUJZT9hyEtZU+2CW9hCeHC8UuZO+ko0HQ5oCdxoOH7oMDx4wNEb8WsDswcKCct/i//mUYWu94dCVeIDQkgYf1QtmDvL4tE3Ib6w1/OFENP5/gSc8PkYYrTU0d8MPh5WeMcZ5QmT7OUPlEUOTvdQjioT5ZR4ftZHcpQjUa9VOmwYLoY92IAA7LsDTdYYj9qQUiPDgcOF2bcVyO/yEiAWgS1Jib12CnxyOcjmhLjCo0GNqXxheBCXd/VNxtkk3DP++YKhvbL0iqgu+N8xjkvussC7bJiWmroXzpKiuUt8Ea48btp2Ptjp/KVzhsHCn9xOWl3uUOK6SJqzTmhS1p8B5WjxxUwevwkvnDNvPR7nQ3FoWC+oC6gn26+4xrRg+P9BjRE+35z1ErW1a3ALgvDCSaguq0483Qs01Q1Wd4VxzlJFFwg+HdmOo2zpgOgRTFkacl8YyyXDBO9E4ELf2EZ6ocGvf0qydujRmT4HT4mgmAOYdjnDsWpRJvT0qK6wZyPRQ5/9PXRy1AKixcVoeT8fvvUciHGs0cQBWlV+XE5C+PG5BcN4g0R4I91RHqGmMMrmXR1XZdTkB6RskLABqnJ21yKg/U3U6Qq02CQXxj0XkwDXDtag6QcIILYEnhMuFnjC/vzCxyFmXSHYtMhYErcU4aZLafsXw8MnmFq83iPbCpyLcH6Dz9GSsHuzkZGTfJBUw5qpN7nQEvn6imWNNagATRJyiJSbxgHRHeGCAxxeKO60bcm+TSwBBm6Pzs1EyAYT8bZW1+kAvYf42SyeAkJ/t8onaOm9fmAiBkL+vzCQoxvx9aSoBBDXq+fnaXOhK5OeLk2FXNm9fnU0V6eXly9Pthbwf9Nfn/wcCtr9y4amOcAAAAABJRU5ErkJggg==", Kt = {
|
|
6
7
|
key: 0,
|
|
7
8
|
class: "message-content ba-markdown"
|
|
8
|
-
},
|
|
9
|
+
}, Zt = { class: "agent-thought__spinner" }, It = { class: "agent-thought__text" }, te = ["onClick"], ee = { class: "thinking-block__title" }, ne = {
|
|
9
10
|
key: 0,
|
|
10
11
|
class: "thinking-block__content"
|
|
11
|
-
},
|
|
12
|
+
}, se = { key: 2 }, oe = ["innerHTML"], ae = {
|
|
12
13
|
key: 0,
|
|
13
14
|
class: "streaming-cursor"
|
|
14
|
-
},
|
|
15
|
+
}, ie = ["innerHTML"], le = {
|
|
15
16
|
key: 0,
|
|
16
17
|
class: "streaming-cursor"
|
|
17
|
-
},
|
|
18
|
+
}, ce = {
|
|
18
19
|
key: 3,
|
|
19
20
|
class: "message-error"
|
|
20
|
-
},
|
|
21
|
+
}, re = {
|
|
21
22
|
key: 4,
|
|
22
23
|
class: "message-toolbar"
|
|
23
|
-
},
|
|
24
|
+
}, ue = ["data-tooltip"], ve = {
|
|
24
25
|
class: "tooltip-enhanced",
|
|
25
26
|
"data-tooltip": "重新回答"
|
|
26
|
-
},
|
|
27
|
+
}, de = {
|
|
27
28
|
key: 1,
|
|
28
29
|
class: "message-content"
|
|
29
|
-
},
|
|
30
|
+
}, ge = /* @__PURE__ */ nt({
|
|
30
31
|
__name: "MessageItem",
|
|
31
32
|
props: {
|
|
32
33
|
msg: {},
|
|
@@ -37,62 +38,62 @@ const We = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
37
38
|
setMessageRef: { type: Function }
|
|
38
39
|
},
|
|
39
40
|
emits: ["regenerate"],
|
|
40
|
-
setup(t, { emit:
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
|
|
41
|
+
setup(t, { emit: v }) {
|
|
42
|
+
const a = K(/* @__PURE__ */ new Map());
|
|
43
|
+
function u(C) {
|
|
44
|
+
a.set(C, a.get(C) !== !0);
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
function
|
|
47
|
-
var
|
|
46
|
+
const i = K(/* @__PURE__ */ new Map());
|
|
47
|
+
function s(C, o) {
|
|
48
|
+
var h;
|
|
48
49
|
try {
|
|
49
|
-
let
|
|
50
|
-
if (!
|
|
51
|
-
`)),
|
|
52
|
-
const { copy:
|
|
53
|
-
|
|
50
|
+
let c = C.content;
|
|
51
|
+
if (!c && ((h = C.segments) != null && h.length) && (c = C.segments.filter((l) => l.type !== "thinking" && l.type !== "agent_thought").map((l) => l.content).join(`
|
|
52
|
+
`)), c) {
|
|
53
|
+
const { copy: l } = Ht();
|
|
54
|
+
l(c), i.set(o, !0), setTimeout(() => i.set(o, !1), 2e3);
|
|
54
55
|
}
|
|
55
56
|
} catch {
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
return (
|
|
59
|
-
var
|
|
60
|
-
return
|
|
61
|
-
class:
|
|
59
|
+
return (C, o) => {
|
|
60
|
+
var h;
|
|
61
|
+
return g(), y("div", {
|
|
62
|
+
class: U(["message", `${t.msg.type}-message`])
|
|
62
63
|
}, [
|
|
63
|
-
t.msg.type === "ai" ? (
|
|
64
|
-
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (
|
|
65
|
-
|
|
66
|
-
])])) :
|
|
67
|
-
t.msg.segments && t.msg.segments.length ? (
|
|
64
|
+
t.msg.type === "ai" ? (g(), y(z, { key: 0 }, [
|
|
65
|
+
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), y("div", Kt, [...o[2] || (o[2] = [
|
|
66
|
+
bt('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
|
|
67
|
+
])])) : Y("", !0),
|
|
68
|
+
t.msg.segments && t.msg.segments.length ? (g(), y("div", {
|
|
68
69
|
key: 1,
|
|
69
70
|
class: "message-content ba-markdown",
|
|
70
|
-
ref: (
|
|
71
|
+
ref: (c) => t.setMessageRef(c, t.index)
|
|
71
72
|
}, [
|
|
72
|
-
(
|
|
73
|
-
|
|
73
|
+
(g(!0), y(z, null, at(t.msg.segments, (c, l) => (g(), y(z, { key: l }, [
|
|
74
|
+
c.type === "agent_thought" ? (g(), y("div", {
|
|
74
75
|
key: 0,
|
|
75
|
-
class:
|
|
76
|
+
class: U(["agent-thought", { "agent-thought--done": c.duration != null }])
|
|
76
77
|
}, [
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
n("span", Zt, [
|
|
79
|
+
F(M(Gt))
|
|
79
80
|
]),
|
|
80
|
-
|
|
81
|
-
], 2)) :
|
|
81
|
+
n("span", It, X(c.duration != null ? "工具调用" : "工具调用中..."), 1)
|
|
82
|
+
], 2)) : c.type === "thinking" ? (g(), y("div", {
|
|
82
83
|
key: 1,
|
|
83
|
-
class:
|
|
84
|
-
"thinking-block--expanded":
|
|
85
|
-
"thinking-block--active":
|
|
84
|
+
class: U(["thinking-block", {
|
|
85
|
+
"thinking-block--expanded": a.get(l) === !0,
|
|
86
|
+
"thinking-block--active": c.duration == null
|
|
86
87
|
}])
|
|
87
88
|
}, [
|
|
88
|
-
|
|
89
|
+
n("div", {
|
|
89
90
|
class: "thinking-block__header",
|
|
90
|
-
onClick: (
|
|
91
|
+
onClick: (r) => u(l)
|
|
91
92
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
(
|
|
95
|
-
class:
|
|
93
|
+
o[4] || (o[4] = n("span", { class: "thinking-block__indicator" }, null, -1)),
|
|
94
|
+
n("span", ee, X(c.duration != null ? "深度思考" : "深度思考中"), 1),
|
|
95
|
+
(g(), y("svg", {
|
|
96
|
+
class: U(["thinking-block__arrow", { "thinking-block__arrow--down": a.get(l) === !0 }]),
|
|
96
97
|
viewBox: "0 0 24 24",
|
|
97
98
|
width: "14",
|
|
98
99
|
height: "14",
|
|
@@ -101,1125 +102,69 @@ const We = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
101
102
|
"stroke-width": "2.5",
|
|
102
103
|
"stroke-linecap": "round",
|
|
103
104
|
"stroke-linejoin": "round"
|
|
104
|
-
}, [...
|
|
105
|
-
|
|
105
|
+
}, [...o[3] || (o[3] = [
|
|
106
|
+
n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
|
|
106
107
|
])], 2))
|
|
107
|
-
], 8,
|
|
108
|
-
|
|
109
|
-
default:
|
|
110
|
-
|
|
108
|
+
], 8, te),
|
|
109
|
+
F(St, { name: "thinking-expand" }, {
|
|
110
|
+
default: Et(() => [
|
|
111
|
+
a.get(l) === !0 ? (g(), y("div", ne, X(c.content), 1)) : Y("", !0)
|
|
111
112
|
]),
|
|
112
113
|
_: 2
|
|
113
114
|
}, 1024)
|
|
114
|
-
], 2)) : (
|
|
115
|
-
|
|
116
|
-
innerHTML:
|
|
117
|
-
}, null, 8,
|
|
115
|
+
], 2)) : (g(), y("div", se, [
|
|
116
|
+
n("div", {
|
|
117
|
+
innerHTML: M(yt)(M(kt)(t.getSegmentDisplayContent(t.index, l, c, t.msg)))
|
|
118
|
+
}, null, 8, oe)
|
|
118
119
|
]))
|
|
119
120
|
], 64))), 128)),
|
|
120
|
-
t.msg.status === t.STATUS.ANSWERING ? (
|
|
121
|
-
], 512)) :
|
|
122
|
-
!((
|
|
121
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span", ae)) : Y("", !0)
|
|
122
|
+
], 512)) : Y("", !0),
|
|
123
|
+
!((h = t.msg.segments) != null && h.length) && t.msg.content ? (g(), y("div", {
|
|
123
124
|
key: 2,
|
|
124
125
|
class: "message-content ba-markdown",
|
|
125
|
-
ref: (
|
|
126
|
+
ref: (c) => t.setMessageRef(c, t.index)
|
|
126
127
|
}, [
|
|
127
|
-
|
|
128
|
-
innerHTML:
|
|
129
|
-
}, null, 8,
|
|
130
|
-
t.msg.status === t.STATUS.ANSWERING ? (
|
|
131
|
-
], 512)) :
|
|
132
|
-
t.msg.errorMessage ? (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
])) :
|
|
136
|
-
t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (
|
|
137
|
-
|
|
128
|
+
n("div", {
|
|
129
|
+
innerHTML: M(yt)(M(kt)(t.displayedContent.get(t.index) ?? t.msg.content))
|
|
130
|
+
}, null, 8, ie),
|
|
131
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span", le)) : Y("", !0)
|
|
132
|
+
], 512)) : Y("", !0),
|
|
133
|
+
t.msg.errorMessage ? (g(), y("div", ce, [
|
|
134
|
+
o[5] || (o[5] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
135
|
+
n("span", null, X(t.msg.errorMessage), 1)
|
|
136
|
+
])) : Y("", !0),
|
|
137
|
+
t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (g(), y("div", re, [
|
|
138
|
+
n("div", {
|
|
138
139
|
class: "tooltip-enhanced",
|
|
139
|
-
"data-tooltip":
|
|
140
|
+
"data-tooltip": i.get(t.index) ? "已复制" : "复制回答"
|
|
140
141
|
}, [
|
|
141
|
-
|
|
142
|
+
i.get(t.index) ? (g(), j(M(Vt), {
|
|
142
143
|
key: 0,
|
|
143
144
|
class: "message-toolbar__check"
|
|
144
|
-
})) : (
|
|
145
|
+
})) : (g(), j(M(Jt), {
|
|
145
146
|
key: 1,
|
|
146
|
-
onClick:
|
|
147
|
+
onClick: o[0] || (o[0] = (c) => s(t.msg, t.index))
|
|
147
148
|
}))
|
|
148
|
-
], 8,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
onClick:
|
|
149
|
+
], 8, ue),
|
|
150
|
+
n("div", ve, [
|
|
151
|
+
F(M(Ft), {
|
|
152
|
+
onClick: o[1] || (o[1] = (c) => C.$emit("regenerate"))
|
|
152
153
|
})
|
|
153
154
|
])
|
|
154
|
-
])) :
|
|
155
|
-
], 64)) : (
|
|
155
|
+
])) : Y("", !0)
|
|
156
|
+
], 64)) : (g(), y("div", de, X(t.msg.content), 1))
|
|
156
157
|
], 2);
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
}),
|
|
160
|
-
const n = t.split(":");
|
|
161
|
-
if (t.slice(0, 1) === "@") {
|
|
162
|
-
if (n.length < 2 || n.length > 3) return null;
|
|
163
|
-
o = n.shift().slice(1);
|
|
164
|
-
}
|
|
165
|
-
if (n.length > 3 || !n.length) return null;
|
|
166
|
-
if (n.length > 1) {
|
|
167
|
-
const c = n.pop(), f = n.pop(), r = {
|
|
168
|
-
provider: n.length > 0 ? n[0] : o,
|
|
169
|
-
prefix: f,
|
|
170
|
-
name: c
|
|
171
|
-
};
|
|
172
|
-
return s && !gt(r) ? null : r;
|
|
173
|
-
}
|
|
174
|
-
const i = n[0], a = i.split("-");
|
|
175
|
-
if (a.length > 1) {
|
|
176
|
-
const c = {
|
|
177
|
-
provider: o,
|
|
178
|
-
prefix: a.shift(),
|
|
179
|
-
name: a.join("-")
|
|
180
|
-
};
|
|
181
|
-
return s && !gt(c) ? null : c;
|
|
182
|
-
}
|
|
183
|
-
if (e && o === "") {
|
|
184
|
-
const c = {
|
|
185
|
-
provider: o,
|
|
186
|
-
prefix: "",
|
|
187
|
-
name: i
|
|
188
|
-
};
|
|
189
|
-
return s && !gt(c, e) ? null : c;
|
|
190
|
-
}
|
|
191
|
-
return null;
|
|
192
|
-
}, gt = (t, s) => t ? !!((s && t.prefix === "" || t.prefix) && t.name) : !1;
|
|
193
|
-
function un(t, s) {
|
|
194
|
-
const e = t.icons, o = t.aliases || /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null);
|
|
195
|
-
function i(a) {
|
|
196
|
-
if (e[a]) return n[a] = [];
|
|
197
|
-
if (!(a in n)) {
|
|
198
|
-
n[a] = null;
|
|
199
|
-
const c = o[a] && o[a].parent, f = c && i(c);
|
|
200
|
-
f && (n[a] = [c].concat(f));
|
|
201
|
-
}
|
|
202
|
-
return n[a];
|
|
203
|
-
}
|
|
204
|
-
return Object.keys(e).concat(Object.keys(o)).forEach(i), n;
|
|
205
|
-
}
|
|
206
|
-
const ne = Object.freeze({
|
|
207
|
-
left: 0,
|
|
208
|
-
top: 0,
|
|
209
|
-
width: 16,
|
|
210
|
-
height: 16
|
|
211
|
-
}), yt = Object.freeze({
|
|
212
|
-
rotate: 0,
|
|
213
|
-
vFlip: !1,
|
|
214
|
-
hFlip: !1
|
|
215
|
-
}), bt = Object.freeze({
|
|
216
|
-
...ne,
|
|
217
|
-
...yt
|
|
218
|
-
}), xt = Object.freeze({
|
|
219
|
-
...bt,
|
|
220
|
-
body: "",
|
|
221
|
-
hidden: !1
|
|
222
|
-
});
|
|
223
|
-
function fn(t, s) {
|
|
224
|
-
const e = {};
|
|
225
|
-
!t.hFlip != !s.hFlip && (e.hFlip = !0), !t.vFlip != !s.vFlip && (e.vFlip = !0);
|
|
226
|
-
const o = ((t.rotate || 0) + (s.rotate || 0)) % 4;
|
|
227
|
-
return o && (e.rotate = o), e;
|
|
228
|
-
}
|
|
229
|
-
function Qt(t, s) {
|
|
230
|
-
const e = fn(t, s);
|
|
231
|
-
for (const o in xt) o in yt ? o in t && !(o in e) && (e[o] = yt[o]) : o in s ? e[o] = s[o] : o in t && (e[o] = t[o]);
|
|
232
|
-
return e;
|
|
233
|
-
}
|
|
234
|
-
function dn(t, s, e) {
|
|
235
|
-
const o = t.icons, n = t.aliases || /* @__PURE__ */ Object.create(null);
|
|
236
|
-
let i = {};
|
|
237
|
-
function a(c) {
|
|
238
|
-
i = Qt(o[c] || n[c], i);
|
|
239
|
-
}
|
|
240
|
-
return a(s), e.forEach(a), Qt(t, i);
|
|
241
|
-
}
|
|
242
|
-
function se(t, s) {
|
|
243
|
-
const e = [];
|
|
244
|
-
if (typeof t != "object" || typeof t.icons != "object") return e;
|
|
245
|
-
t.not_found instanceof Array && t.not_found.forEach((n) => {
|
|
246
|
-
s(n, null), e.push(n);
|
|
247
|
-
});
|
|
248
|
-
const o = un(t);
|
|
249
|
-
for (const n in o) {
|
|
250
|
-
const i = o[n];
|
|
251
|
-
i && (s(n, dn(t, n, i)), e.push(n));
|
|
252
|
-
}
|
|
253
|
-
return e;
|
|
254
|
-
}
|
|
255
|
-
const hn = {
|
|
256
|
-
provider: "",
|
|
257
|
-
aliases: {},
|
|
258
|
-
not_found: {},
|
|
259
|
-
...ne
|
|
260
|
-
};
|
|
261
|
-
function St(t, s) {
|
|
262
|
-
for (const e in s) if (e in t && typeof t[e] != typeof s[e]) return !1;
|
|
263
|
-
return !0;
|
|
264
|
-
}
|
|
265
|
-
function oe(t) {
|
|
266
|
-
if (typeof t != "object" || t === null) return null;
|
|
267
|
-
const s = t;
|
|
268
|
-
if (typeof s.prefix != "string" || !t.icons || typeof t.icons != "object" || !St(t, hn)) return null;
|
|
269
|
-
const e = s.icons;
|
|
270
|
-
for (const n in e) {
|
|
271
|
-
const i = e[n];
|
|
272
|
-
if (!n || typeof i.body != "string" || !St(i, xt)) return null;
|
|
273
|
-
}
|
|
274
|
-
const o = s.aliases || /* @__PURE__ */ Object.create(null);
|
|
275
|
-
for (const n in o) {
|
|
276
|
-
const i = o[n], a = i.parent;
|
|
277
|
-
if (!n || typeof a != "string" || !e[a] && !o[a] || !St(i, xt)) return null;
|
|
278
|
-
}
|
|
279
|
-
return s;
|
|
280
|
-
}
|
|
281
|
-
const _t = /* @__PURE__ */ Object.create(null);
|
|
282
|
-
function gn(t, s) {
|
|
283
|
-
return {
|
|
284
|
-
provider: t,
|
|
285
|
-
prefix: s,
|
|
286
|
-
icons: /* @__PURE__ */ Object.create(null),
|
|
287
|
-
missing: /* @__PURE__ */ new Set()
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function nt(t, s) {
|
|
291
|
-
const e = _t[t] || (_t[t] = /* @__PURE__ */ Object.create(null));
|
|
292
|
-
return e[s] || (e[s] = gn(t, s));
|
|
293
|
-
}
|
|
294
|
-
function ie(t, s) {
|
|
295
|
-
return oe(s) ? se(s, (e, o) => {
|
|
296
|
-
o ? t.icons[e] = o : t.missing.add(e);
|
|
297
|
-
}) : [];
|
|
298
|
-
}
|
|
299
|
-
function pn(t, s, e) {
|
|
300
|
-
try {
|
|
301
|
-
if (typeof e.body == "string")
|
|
302
|
-
return t.icons[s] = { ...e }, !0;
|
|
303
|
-
} catch {
|
|
304
|
-
}
|
|
305
|
-
return !1;
|
|
306
|
-
}
|
|
307
|
-
let ut = !1;
|
|
308
|
-
function ae(t) {
|
|
309
|
-
return typeof t == "boolean" && (ut = t), ut;
|
|
310
|
-
}
|
|
311
|
-
function vn(t) {
|
|
312
|
-
const s = typeof t == "string" ? kt(t, !0, ut) : t;
|
|
313
|
-
if (s) {
|
|
314
|
-
const e = nt(s.provider, s.prefix), o = s.name;
|
|
315
|
-
return e.icons[o] || (e.missing.has(o) ? null : void 0);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function mn(t, s) {
|
|
319
|
-
const e = kt(t, !0, ut);
|
|
320
|
-
if (!e) return !1;
|
|
321
|
-
const o = nt(e.provider, e.prefix);
|
|
322
|
-
return s ? pn(o, e.name, s) : (o.missing.add(e.name), !0);
|
|
323
|
-
}
|
|
324
|
-
function yn(t, s) {
|
|
325
|
-
if (typeof t != "object") return !1;
|
|
326
|
-
if (typeof s != "string" && (s = t.provider || ""), ut && !s && !t.prefix) {
|
|
327
|
-
let o = !1;
|
|
328
|
-
return oe(t) && (t.prefix = "", se(t, (n, i) => {
|
|
329
|
-
mn(n, i) && (o = !0);
|
|
330
|
-
})), o;
|
|
331
|
-
}
|
|
332
|
-
const e = t.prefix;
|
|
333
|
-
return gt({
|
|
334
|
-
prefix: e,
|
|
335
|
-
name: "a"
|
|
336
|
-
}) ? !!ie(nt(s, e), t) : !1;
|
|
337
|
-
}
|
|
338
|
-
const re = Object.freeze({
|
|
339
|
-
width: null,
|
|
340
|
-
height: null
|
|
341
|
-
}), le = Object.freeze({
|
|
342
|
-
...re,
|
|
343
|
-
...yt
|
|
344
|
-
}), wn = /(-?[0-9.]*[0-9]+[0-9.]*)/g, kn = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
345
|
-
function Yt(t, s, e) {
|
|
346
|
-
if (s === 1) return t;
|
|
347
|
-
if (e = e || 100, typeof t == "number") return Math.ceil(t * s * e) / e;
|
|
348
|
-
if (typeof t != "string") return t;
|
|
349
|
-
const o = t.split(wn);
|
|
350
|
-
if (o === null || !o.length) return t;
|
|
351
|
-
const n = [];
|
|
352
|
-
let i = o.shift(), a = kn.test(i);
|
|
353
|
-
for (; ; ) {
|
|
354
|
-
if (a) {
|
|
355
|
-
const c = parseFloat(i);
|
|
356
|
-
isNaN(c) ? n.push(i) : n.push(Math.ceil(c * s * e) / e);
|
|
357
|
-
} else n.push(i);
|
|
358
|
-
if (i = o.shift(), i === void 0) return n.join("");
|
|
359
|
-
a = !a;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function bn(t, s = "defs") {
|
|
363
|
-
let e = "";
|
|
364
|
-
const o = t.indexOf("<" + s);
|
|
365
|
-
for (; o >= 0; ) {
|
|
366
|
-
const n = t.indexOf(">", o), i = t.indexOf("</" + s);
|
|
367
|
-
if (n === -1 || i === -1) break;
|
|
368
|
-
const a = t.indexOf(">", i);
|
|
369
|
-
if (a === -1) break;
|
|
370
|
-
e += t.slice(n + 1, i).trim(), t = t.slice(0, o).trim() + t.slice(a + 1);
|
|
371
|
-
}
|
|
372
|
-
return {
|
|
373
|
-
defs: e,
|
|
374
|
-
content: t
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
function Cn(t, s) {
|
|
378
|
-
return t ? "<defs>" + t + "</defs>" + s : s;
|
|
379
|
-
}
|
|
380
|
-
function An(t, s, e) {
|
|
381
|
-
const o = bn(t);
|
|
382
|
-
return Cn(o.defs, s + o.content + e);
|
|
383
|
-
}
|
|
384
|
-
const Sn = (t) => t === "unset" || t === "undefined" || t === "none";
|
|
385
|
-
function En(t, s) {
|
|
386
|
-
const e = {
|
|
387
|
-
...bt,
|
|
388
|
-
...t
|
|
389
|
-
}, o = {
|
|
390
|
-
...le,
|
|
391
|
-
...s
|
|
392
|
-
}, n = {
|
|
393
|
-
left: e.left,
|
|
394
|
-
top: e.top,
|
|
395
|
-
width: e.width,
|
|
396
|
-
height: e.height
|
|
397
|
-
};
|
|
398
|
-
let i = e.body;
|
|
399
|
-
[e, o].forEach((y) => {
|
|
400
|
-
const v = [], l = y.hFlip, g = y.vFlip;
|
|
401
|
-
let A = y.rotate;
|
|
402
|
-
l ? g ? A += 2 : (v.push("translate(" + (n.width + n.left).toString() + " " + (0 - n.top).toString() + ")"), v.push("scale(-1 1)"), n.top = n.left = 0) : g && (v.push("translate(" + (0 - n.left).toString() + " " + (n.height + n.top).toString() + ")"), v.push("scale(1 -1)"), n.top = n.left = 0);
|
|
403
|
-
let w;
|
|
404
|
-
switch (A < 0 && (A -= Math.floor(A / 4) * 4), A = A % 4, A) {
|
|
405
|
-
case 1:
|
|
406
|
-
w = n.height / 2 + n.top, v.unshift("rotate(90 " + w.toString() + " " + w.toString() + ")");
|
|
407
|
-
break;
|
|
408
|
-
case 2:
|
|
409
|
-
v.unshift("rotate(180 " + (n.width / 2 + n.left).toString() + " " + (n.height / 2 + n.top).toString() + ")");
|
|
410
|
-
break;
|
|
411
|
-
case 3:
|
|
412
|
-
w = n.width / 2 + n.left, v.unshift("rotate(-90 " + w.toString() + " " + w.toString() + ")");
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
A % 2 === 1 && (n.left !== n.top && (w = n.left, n.left = n.top, n.top = w), n.width !== n.height && (w = n.width, n.width = n.height, n.height = w)), v.length && (i = An(i, '<g transform="' + v.join(" ") + '">', "</g>"));
|
|
416
|
-
});
|
|
417
|
-
const a = o.width, c = o.height, f = n.width, r = n.height;
|
|
418
|
-
let u, d;
|
|
419
|
-
a === null ? (d = c === null ? "1em" : c === "auto" ? r : c, u = Yt(d, f / r)) : (u = a === "auto" ? f : a, d = c === null ? Yt(u, r / f) : c === "auto" ? r : c);
|
|
420
|
-
const p = {}, E = (y, v) => {
|
|
421
|
-
Sn(v) || (p[y] = v.toString());
|
|
422
|
-
};
|
|
423
|
-
E("width", u), E("height", d);
|
|
424
|
-
const D = [
|
|
425
|
-
n.left,
|
|
426
|
-
n.top,
|
|
427
|
-
f,
|
|
428
|
-
r
|
|
429
|
-
];
|
|
430
|
-
return p.viewBox = D.join(" "), {
|
|
431
|
-
attributes: p,
|
|
432
|
-
viewBox: D,
|
|
433
|
-
body: i
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
const Tn = /\sid="(\S+)"/g, Vt = /* @__PURE__ */ new Map();
|
|
437
|
-
function xn(t) {
|
|
438
|
-
t = t.replace(/[0-9]+$/, "") || "a";
|
|
439
|
-
const s = Vt.get(t) || 0;
|
|
440
|
-
return Vt.set(t, s + 1), s ? `${t}${s}` : t;
|
|
441
|
-
}
|
|
442
|
-
function Rn(t) {
|
|
443
|
-
const s = [];
|
|
444
|
-
let e;
|
|
445
|
-
for (; e = Tn.exec(t); ) s.push(e[1]);
|
|
446
|
-
if (!s.length) return t;
|
|
447
|
-
const o = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
|
448
|
-
return s.forEach((n) => {
|
|
449
|
-
const i = xn(n), a = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
450
|
-
t = t.replace(new RegExp('([#;"])(' + a + ')([")]|\\.[a-z])', "g"), "$1" + i + o + "$3");
|
|
451
|
-
}), t = t.replace(new RegExp(o, "g"), ""), t;
|
|
452
|
-
}
|
|
453
|
-
const Rt = /* @__PURE__ */ Object.create(null);
|
|
454
|
-
function On(t, s) {
|
|
455
|
-
Rt[t] = s;
|
|
456
|
-
}
|
|
457
|
-
function Ot(t) {
|
|
458
|
-
return Rt[t] || Rt[""];
|
|
459
|
-
}
|
|
460
|
-
function Dt(t) {
|
|
461
|
-
let s;
|
|
462
|
-
if (typeof t.resources == "string") s = [t.resources];
|
|
463
|
-
else if (s = t.resources, !(s instanceof Array) || !s.length) return null;
|
|
464
|
-
return {
|
|
465
|
-
resources: s,
|
|
466
|
-
path: t.path || "/",
|
|
467
|
-
maxURL: t.maxURL || 500,
|
|
468
|
-
rotate: t.rotate || 750,
|
|
469
|
-
timeout: t.timeout || 5e3,
|
|
470
|
-
random: t.random === !0,
|
|
471
|
-
index: t.index || 0,
|
|
472
|
-
dataAfterTimeout: t.dataAfterTimeout !== !1
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
const Lt = /* @__PURE__ */ Object.create(null), st = ["https://api.simplesvg.com", "https://api.unisvg.com"], pt = [];
|
|
476
|
-
for (; st.length > 0; ) st.length === 1 || Math.random() > 0.5 ? pt.push(st.shift()) : pt.push(st.pop());
|
|
477
|
-
Lt[""] = Dt({ resources: ["https://api.iconify.design"].concat(pt) });
|
|
478
|
-
function Mn(t, s) {
|
|
479
|
-
const e = Dt(s);
|
|
480
|
-
return e === null ? !1 : (Lt[t] = e, !0);
|
|
481
|
-
}
|
|
482
|
-
function Ht(t) {
|
|
483
|
-
return Lt[t];
|
|
484
|
-
}
|
|
485
|
-
const Pn = () => {
|
|
486
|
-
let t;
|
|
487
|
-
try {
|
|
488
|
-
if (t = fetch, typeof t == "function") return t;
|
|
489
|
-
} catch {
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
let Wt = Pn();
|
|
493
|
-
function Dn(t, s) {
|
|
494
|
-
const e = Ht(t);
|
|
495
|
-
if (!e) return 0;
|
|
496
|
-
let o;
|
|
497
|
-
if (!e.maxURL) o = 0;
|
|
498
|
-
else {
|
|
499
|
-
let n = 0;
|
|
500
|
-
e.resources.forEach((a) => {
|
|
501
|
-
n = Math.max(n, a.length);
|
|
502
|
-
});
|
|
503
|
-
const i = s + ".json?icons=";
|
|
504
|
-
o = e.maxURL - n - e.path.length - i.length;
|
|
505
|
-
}
|
|
506
|
-
return o;
|
|
507
|
-
}
|
|
508
|
-
function Ln(t) {
|
|
509
|
-
return t === 404;
|
|
510
|
-
}
|
|
511
|
-
const Hn = (t, s, e) => {
|
|
512
|
-
const o = [], n = Dn(t, s), i = "icons";
|
|
513
|
-
let a = {
|
|
514
|
-
type: i,
|
|
515
|
-
provider: t,
|
|
516
|
-
prefix: s,
|
|
517
|
-
icons: []
|
|
518
|
-
}, c = 0;
|
|
519
|
-
return e.forEach((f, r) => {
|
|
520
|
-
c += f.length + 1, c >= n && r > 0 && (o.push(a), a = {
|
|
521
|
-
type: i,
|
|
522
|
-
provider: t,
|
|
523
|
-
prefix: s,
|
|
524
|
-
icons: []
|
|
525
|
-
}, c = f.length), a.icons.push(f);
|
|
526
|
-
}), o.push(a), o;
|
|
527
|
-
};
|
|
528
|
-
function Nn(t) {
|
|
529
|
-
if (typeof t == "string") {
|
|
530
|
-
const s = Ht(t);
|
|
531
|
-
if (s) return s.path;
|
|
532
|
-
}
|
|
533
|
-
return "/";
|
|
534
|
-
}
|
|
535
|
-
const $n = (t, s, e) => {
|
|
536
|
-
if (!Wt) {
|
|
537
|
-
e("abort", 424);
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
let o = Nn(s.provider);
|
|
541
|
-
switch (s.type) {
|
|
542
|
-
case "icons": {
|
|
543
|
-
const i = s.prefix, a = s.icons.join(","), c = new URLSearchParams({ icons: a });
|
|
544
|
-
o += i + ".json?" + c.toString();
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
case "custom": {
|
|
548
|
-
const i = s.uri;
|
|
549
|
-
o += i.slice(0, 1) === "/" ? i.slice(1) : i;
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
default:
|
|
553
|
-
e("abort", 400);
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
let n = 503;
|
|
557
|
-
Wt(t + o).then((i) => {
|
|
558
|
-
const a = i.status;
|
|
559
|
-
if (a !== 200) {
|
|
560
|
-
setTimeout(() => {
|
|
561
|
-
e(Ln(a) ? "abort" : "next", a);
|
|
562
|
-
});
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
return n = 501, i.json();
|
|
566
|
-
}).then((i) => {
|
|
567
|
-
if (typeof i != "object" || i === null) {
|
|
568
|
-
setTimeout(() => {
|
|
569
|
-
i === 404 ? e("abort", i) : e("next", n);
|
|
570
|
-
});
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
setTimeout(() => {
|
|
574
|
-
e("success", i);
|
|
575
|
-
});
|
|
576
|
-
}).catch(() => {
|
|
577
|
-
e("next", n);
|
|
578
|
-
});
|
|
579
|
-
}, Fn = {
|
|
580
|
-
prepare: Hn,
|
|
581
|
-
send: $n
|
|
582
|
-
};
|
|
583
|
-
function ce(t, s) {
|
|
584
|
-
t.forEach((e) => {
|
|
585
|
-
const o = e.loaderCallbacks;
|
|
586
|
-
o && (e.loaderCallbacks = o.filter((n) => n.id !== s));
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
function jn(t) {
|
|
590
|
-
t.pendingCallbacksFlag || (t.pendingCallbacksFlag = !0, setTimeout(() => {
|
|
591
|
-
t.pendingCallbacksFlag = !1;
|
|
592
|
-
const s = t.loaderCallbacks ? t.loaderCallbacks.slice(0) : [];
|
|
593
|
-
if (!s.length) return;
|
|
594
|
-
let e = !1;
|
|
595
|
-
const o = t.provider, n = t.prefix;
|
|
596
|
-
s.forEach((i) => {
|
|
597
|
-
const a = i.icons, c = a.pending.length;
|
|
598
|
-
a.pending = a.pending.filter((f) => {
|
|
599
|
-
if (f.prefix !== n) return !0;
|
|
600
|
-
const r = f.name;
|
|
601
|
-
if (t.icons[r]) a.loaded.push({
|
|
602
|
-
provider: o,
|
|
603
|
-
prefix: n,
|
|
604
|
-
name: r
|
|
605
|
-
});
|
|
606
|
-
else if (t.missing.has(r)) a.missing.push({
|
|
607
|
-
provider: o,
|
|
608
|
-
prefix: n,
|
|
609
|
-
name: r
|
|
610
|
-
});
|
|
611
|
-
else
|
|
612
|
-
return e = !0, !0;
|
|
613
|
-
return !1;
|
|
614
|
-
}), a.pending.length !== c && (e || ce([t], i.id), i.callback(a.loaded.slice(0), a.missing.slice(0), a.pending.slice(0), i.abort));
|
|
615
|
-
});
|
|
616
|
-
}));
|
|
617
|
-
}
|
|
618
|
-
let Bn = 0;
|
|
619
|
-
function In(t, s, e) {
|
|
620
|
-
const o = Bn++, n = ce.bind(null, e, o);
|
|
621
|
-
if (!s.pending.length) return n;
|
|
622
|
-
const i = {
|
|
623
|
-
id: o,
|
|
624
|
-
icons: s,
|
|
625
|
-
callback: t,
|
|
626
|
-
abort: n
|
|
627
|
-
};
|
|
628
|
-
return e.forEach((a) => {
|
|
629
|
-
(a.loaderCallbacks || (a.loaderCallbacks = [])).push(i);
|
|
630
|
-
}), n;
|
|
631
|
-
}
|
|
632
|
-
function Qn(t) {
|
|
633
|
-
const s = {
|
|
634
|
-
loaded: [],
|
|
635
|
-
missing: [],
|
|
636
|
-
pending: []
|
|
637
|
-
}, e = /* @__PURE__ */ Object.create(null);
|
|
638
|
-
t.sort((n, i) => n.provider !== i.provider ? n.provider.localeCompare(i.provider) : n.prefix !== i.prefix ? n.prefix.localeCompare(i.prefix) : n.name.localeCompare(i.name));
|
|
639
|
-
let o = {
|
|
640
|
-
provider: "",
|
|
641
|
-
prefix: "",
|
|
642
|
-
name: ""
|
|
643
|
-
};
|
|
644
|
-
return t.forEach((n) => {
|
|
645
|
-
if (o.name === n.name && o.prefix === n.prefix && o.provider === n.provider) return;
|
|
646
|
-
o = n;
|
|
647
|
-
const i = n.provider, a = n.prefix, c = n.name, f = e[i] || (e[i] = /* @__PURE__ */ Object.create(null)), r = f[a] || (f[a] = nt(i, a));
|
|
648
|
-
let u;
|
|
649
|
-
c in r.icons ? u = s.loaded : a === "" || r.missing.has(c) ? u = s.missing : u = s.pending;
|
|
650
|
-
const d = {
|
|
651
|
-
provider: i,
|
|
652
|
-
prefix: a,
|
|
653
|
-
name: c
|
|
654
|
-
};
|
|
655
|
-
u.push(d);
|
|
656
|
-
}), s;
|
|
657
|
-
}
|
|
658
|
-
function _n(t, s = !0, e = !1) {
|
|
659
|
-
const o = [];
|
|
660
|
-
return t.forEach((n) => {
|
|
661
|
-
const i = typeof n == "string" ? kt(n, s, e) : n;
|
|
662
|
-
i && o.push(i);
|
|
663
|
-
}), o;
|
|
664
|
-
}
|
|
665
|
-
const Yn = {
|
|
666
|
-
resources: [],
|
|
667
|
-
index: 0,
|
|
668
|
-
timeout: 2e3,
|
|
669
|
-
rotate: 750,
|
|
670
|
-
random: !1,
|
|
671
|
-
dataAfterTimeout: !1
|
|
672
|
-
};
|
|
673
|
-
function Vn(t, s, e, o) {
|
|
674
|
-
const n = t.resources.length, i = t.random ? Math.floor(Math.random() * n) : t.index;
|
|
675
|
-
let a;
|
|
676
|
-
if (t.random) {
|
|
677
|
-
let m = t.resources.slice(0);
|
|
678
|
-
for (a = []; m.length > 1; ) {
|
|
679
|
-
const L = Math.floor(Math.random() * m.length);
|
|
680
|
-
a.push(m[L]), m = m.slice(0, L).concat(m.slice(L + 1));
|
|
681
|
-
}
|
|
682
|
-
a = a.concat(m);
|
|
683
|
-
} else a = t.resources.slice(i).concat(t.resources.slice(0, i));
|
|
684
|
-
const c = Date.now();
|
|
685
|
-
let f = "pending", r = 0, u, d = null, p = [], E = [];
|
|
686
|
-
typeof o == "function" && E.push(o);
|
|
687
|
-
function D() {
|
|
688
|
-
d && (clearTimeout(d), d = null);
|
|
689
|
-
}
|
|
690
|
-
function y() {
|
|
691
|
-
f === "pending" && (f = "aborted"), D(), p.forEach((m) => {
|
|
692
|
-
m.status === "pending" && (m.status = "aborted");
|
|
693
|
-
}), p = [];
|
|
694
|
-
}
|
|
695
|
-
function v(m, L) {
|
|
696
|
-
L && (E = []), typeof m == "function" && E.push(m);
|
|
697
|
-
}
|
|
698
|
-
function l() {
|
|
699
|
-
return {
|
|
700
|
-
startTime: c,
|
|
701
|
-
payload: s,
|
|
702
|
-
status: f,
|
|
703
|
-
queriesSent: r,
|
|
704
|
-
queriesPending: p.length,
|
|
705
|
-
subscribe: v,
|
|
706
|
-
abort: y
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
function g() {
|
|
710
|
-
f = "failed", E.forEach((m) => {
|
|
711
|
-
m(void 0, u);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
function A() {
|
|
715
|
-
p.forEach((m) => {
|
|
716
|
-
m.status === "pending" && (m.status = "aborted");
|
|
717
|
-
}), p = [];
|
|
718
|
-
}
|
|
719
|
-
function w(m, L, T) {
|
|
720
|
-
const k = L !== "success";
|
|
721
|
-
switch (p = p.filter((C) => C !== m), f) {
|
|
722
|
-
case "pending":
|
|
723
|
-
break;
|
|
724
|
-
case "failed":
|
|
725
|
-
if (k || !t.dataAfterTimeout) return;
|
|
726
|
-
break;
|
|
727
|
-
default:
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
if (L === "abort") {
|
|
731
|
-
u = T, g();
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
if (k) {
|
|
735
|
-
u = T, p.length || (a.length ? S() : g());
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
if (D(), A(), !t.random) {
|
|
739
|
-
const C = t.resources.indexOf(m.resource);
|
|
740
|
-
C !== -1 && C !== t.index && (t.index = C);
|
|
741
|
-
}
|
|
742
|
-
f = "completed", E.forEach((C) => {
|
|
743
|
-
C(T);
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
function S() {
|
|
747
|
-
if (f !== "pending") return;
|
|
748
|
-
D();
|
|
749
|
-
const m = a.shift();
|
|
750
|
-
if (m === void 0) {
|
|
751
|
-
if (p.length) {
|
|
752
|
-
d = setTimeout(() => {
|
|
753
|
-
D(), f === "pending" && (A(), g());
|
|
754
|
-
}, t.timeout);
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
g();
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
const L = {
|
|
761
|
-
status: "pending",
|
|
762
|
-
resource: m,
|
|
763
|
-
callback: (T, k) => {
|
|
764
|
-
w(L, T, k);
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
p.push(L), r++, d = setTimeout(S, t.rotate), e(m, s, L.callback);
|
|
768
|
-
}
|
|
769
|
-
return setTimeout(S), l;
|
|
770
|
-
}
|
|
771
|
-
function ue(t) {
|
|
772
|
-
const s = {
|
|
773
|
-
...Yn,
|
|
774
|
-
...t
|
|
775
|
-
};
|
|
776
|
-
let e = [];
|
|
777
|
-
function o() {
|
|
778
|
-
e = e.filter((a) => a().status === "pending");
|
|
779
|
-
}
|
|
780
|
-
function n(a, c, f) {
|
|
781
|
-
const r = Vn(s, a, c, (u, d) => {
|
|
782
|
-
o(), f && f(u, d);
|
|
783
|
-
});
|
|
784
|
-
return e.push(r), r;
|
|
785
|
-
}
|
|
786
|
-
function i(a) {
|
|
787
|
-
return e.find((c) => a(c)) || null;
|
|
788
|
-
}
|
|
789
|
-
return {
|
|
790
|
-
query: n,
|
|
791
|
-
find: i,
|
|
792
|
-
setIndex: (a) => {
|
|
793
|
-
s.index = a;
|
|
794
|
-
},
|
|
795
|
-
getIndex: () => s.index,
|
|
796
|
-
cleanup: o
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
function Xt() {
|
|
800
|
-
}
|
|
801
|
-
const Et = /* @__PURE__ */ Object.create(null);
|
|
802
|
-
function Wn(t) {
|
|
803
|
-
if (!Et[t]) {
|
|
804
|
-
const s = Ht(t);
|
|
805
|
-
if (!s) return;
|
|
806
|
-
Et[t] = {
|
|
807
|
-
config: s,
|
|
808
|
-
redundancy: ue(s)
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
return Et[t];
|
|
812
|
-
}
|
|
813
|
-
function Xn(t, s, e) {
|
|
814
|
-
let o, n;
|
|
815
|
-
if (typeof t == "string") {
|
|
816
|
-
const i = Ot(t);
|
|
817
|
-
if (!i)
|
|
818
|
-
return e(void 0, 424), Xt;
|
|
819
|
-
n = i.send;
|
|
820
|
-
const a = Wn(t);
|
|
821
|
-
a && (o = a.redundancy);
|
|
822
|
-
} else {
|
|
823
|
-
const i = Dt(t);
|
|
824
|
-
if (i) {
|
|
825
|
-
o = ue(i);
|
|
826
|
-
const a = Ot(t.resources ? t.resources[0] : "");
|
|
827
|
-
a && (n = a.send);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
return !o || !n ? (e(void 0, 424), Xt) : o.query(s, n, e)().abort;
|
|
831
|
-
}
|
|
832
|
-
function Gt() {
|
|
833
|
-
}
|
|
834
|
-
function Gn(t) {
|
|
835
|
-
t.iconsLoaderFlag || (t.iconsLoaderFlag = !0, setTimeout(() => {
|
|
836
|
-
t.iconsLoaderFlag = !1, jn(t);
|
|
837
|
-
}));
|
|
838
|
-
}
|
|
839
|
-
function Un(t) {
|
|
840
|
-
const s = [], e = [];
|
|
841
|
-
return t.forEach((o) => {
|
|
842
|
-
(o.match(ee) ? s : e).push(o);
|
|
843
|
-
}), {
|
|
844
|
-
valid: s,
|
|
845
|
-
invalid: e
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
function ot(t, s, e) {
|
|
849
|
-
function o() {
|
|
850
|
-
const n = t.pendingIcons;
|
|
851
|
-
s.forEach((i) => {
|
|
852
|
-
n && n.delete(i), t.icons[i] || t.missing.add(i);
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
if (e && typeof e == "object") try {
|
|
856
|
-
if (!ie(t, e).length) {
|
|
857
|
-
o();
|
|
858
|
-
return;
|
|
859
|
-
}
|
|
860
|
-
} catch (n) {
|
|
861
|
-
console.error(n);
|
|
862
|
-
}
|
|
863
|
-
o(), Gn(t);
|
|
864
|
-
}
|
|
865
|
-
function Ut(t, s) {
|
|
866
|
-
t instanceof Promise ? t.then((e) => {
|
|
867
|
-
s(e);
|
|
868
|
-
}).catch(() => {
|
|
869
|
-
s(null);
|
|
870
|
-
}) : s(t);
|
|
871
|
-
}
|
|
872
|
-
function zn(t, s) {
|
|
873
|
-
t.iconsToLoad ? t.iconsToLoad = t.iconsToLoad.concat(s).sort() : t.iconsToLoad = s, t.iconsQueueFlag || (t.iconsQueueFlag = !0, setTimeout(() => {
|
|
874
|
-
t.iconsQueueFlag = !1;
|
|
875
|
-
const { provider: e, prefix: o } = t, n = t.iconsToLoad;
|
|
876
|
-
if (delete t.iconsToLoad, !n || !n.length) return;
|
|
877
|
-
const i = t.loadIcon;
|
|
878
|
-
if (t.loadIcons && (n.length > 1 || !i)) {
|
|
879
|
-
Ut(t.loadIcons(n, o, e), (r) => {
|
|
880
|
-
ot(t, n, r);
|
|
881
|
-
});
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
if (i) {
|
|
885
|
-
n.forEach((r) => {
|
|
886
|
-
Ut(i(r, o, e), (u) => {
|
|
887
|
-
ot(t, [r], u ? {
|
|
888
|
-
prefix: o,
|
|
889
|
-
icons: { [r]: u }
|
|
890
|
-
} : null);
|
|
891
|
-
});
|
|
892
|
-
});
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
const { valid: a, invalid: c } = Un(n);
|
|
896
|
-
if (c.length && ot(t, c, null), !a.length) return;
|
|
897
|
-
const f = o.match(ee) ? Ot(e) : null;
|
|
898
|
-
if (!f) {
|
|
899
|
-
ot(t, a, null);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
f.prepare(e, o, a).forEach((r) => {
|
|
903
|
-
Xn(e, r, (u) => {
|
|
904
|
-
ot(t, r.icons, u);
|
|
905
|
-
});
|
|
906
|
-
});
|
|
907
|
-
}));
|
|
908
|
-
}
|
|
909
|
-
const Jn = (t, s) => {
|
|
910
|
-
const e = Qn(_n(t, !0, ae()));
|
|
911
|
-
if (!e.pending.length) {
|
|
912
|
-
let c = !0;
|
|
913
|
-
return s && setTimeout(() => {
|
|
914
|
-
c && s(e.loaded, e.missing, e.pending, Gt);
|
|
915
|
-
}), () => {
|
|
916
|
-
c = !1;
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
const o = /* @__PURE__ */ Object.create(null), n = [];
|
|
920
|
-
let i, a;
|
|
921
|
-
return e.pending.forEach((c) => {
|
|
922
|
-
const { provider: f, prefix: r } = c;
|
|
923
|
-
if (r === a && f === i) return;
|
|
924
|
-
i = f, a = r, n.push(nt(f, r));
|
|
925
|
-
const u = o[f] || (o[f] = /* @__PURE__ */ Object.create(null));
|
|
926
|
-
u[r] || (u[r] = []);
|
|
927
|
-
}), e.pending.forEach((c) => {
|
|
928
|
-
const { provider: f, prefix: r, name: u } = c, d = nt(f, r), p = d.pendingIcons || (d.pendingIcons = /* @__PURE__ */ new Set());
|
|
929
|
-
p.has(u) || (p.add(u), o[f][r].push(u));
|
|
930
|
-
}), n.forEach((c) => {
|
|
931
|
-
const f = o[c.provider][c.prefix];
|
|
932
|
-
f.length && zn(c, f);
|
|
933
|
-
}), s ? In(s, e, n) : Gt;
|
|
934
|
-
};
|
|
935
|
-
function qn(t, s) {
|
|
936
|
-
const e = { ...t };
|
|
937
|
-
for (const o in s) {
|
|
938
|
-
const n = s[o], i = typeof n;
|
|
939
|
-
o in re ? (n === null || n && (i === "string" || i === "number")) && (e[o] = n) : i === typeof e[o] && (e[o] = o === "rotate" ? n % 4 : n);
|
|
940
|
-
}
|
|
941
|
-
return e;
|
|
942
|
-
}
|
|
943
|
-
const Kn = /[\s,]+/;
|
|
944
|
-
function Zn(t, s) {
|
|
945
|
-
s.split(Kn).forEach((e) => {
|
|
946
|
-
switch (e.trim()) {
|
|
947
|
-
case "horizontal":
|
|
948
|
-
t.hFlip = !0;
|
|
949
|
-
break;
|
|
950
|
-
case "vertical":
|
|
951
|
-
t.vFlip = !0;
|
|
952
|
-
break;
|
|
953
|
-
}
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
function ts(t, s = 0) {
|
|
957
|
-
const e = t.replace(/^-?[0-9.]*/, "");
|
|
958
|
-
function o(n) {
|
|
959
|
-
for (; n < 0; ) n += 4;
|
|
960
|
-
return n % 4;
|
|
961
|
-
}
|
|
962
|
-
if (e === "") {
|
|
963
|
-
const n = parseInt(t);
|
|
964
|
-
return isNaN(n) ? 0 : o(n);
|
|
965
|
-
} else if (e !== t) {
|
|
966
|
-
let n = 0;
|
|
967
|
-
switch (e) {
|
|
968
|
-
case "%":
|
|
969
|
-
n = 25;
|
|
970
|
-
break;
|
|
971
|
-
case "deg":
|
|
972
|
-
n = 90;
|
|
973
|
-
}
|
|
974
|
-
if (n) {
|
|
975
|
-
let i = parseFloat(t.slice(0, t.length - e.length));
|
|
976
|
-
return isNaN(i) ? 0 : (i = i / n, i % 1 === 0 ? o(i) : 0);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
return s;
|
|
980
|
-
}
|
|
981
|
-
function es(t, s) {
|
|
982
|
-
let e = t.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
|
|
983
|
-
for (const o in s) e += " " + o + '="' + s[o] + '"';
|
|
984
|
-
return '<svg xmlns="http://www.w3.org/2000/svg"' + e + ">" + t + "</svg>";
|
|
985
|
-
}
|
|
986
|
-
function ns(t) {
|
|
987
|
-
return t.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
|
988
|
-
}
|
|
989
|
-
function ss(t) {
|
|
990
|
-
return "data:image/svg+xml," + ns(t);
|
|
991
|
-
}
|
|
992
|
-
function os(t) {
|
|
993
|
-
return 'url("' + ss(t) + '")';
|
|
994
|
-
}
|
|
995
|
-
const zt = {
|
|
996
|
-
...le,
|
|
997
|
-
inline: !1
|
|
998
|
-
}, is = {
|
|
999
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1000
|
-
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
1001
|
-
"aria-hidden": !0,
|
|
1002
|
-
role: "img"
|
|
1003
|
-
}, as = {
|
|
1004
|
-
display: "inline-block"
|
|
1005
|
-
}, Mt = {
|
|
1006
|
-
backgroundColor: "currentColor"
|
|
1007
|
-
}, fe = {
|
|
1008
|
-
backgroundColor: "transparent"
|
|
1009
|
-
}, Jt = {
|
|
1010
|
-
Image: "var(--svg)",
|
|
1011
|
-
Repeat: "no-repeat",
|
|
1012
|
-
Size: "100% 100%"
|
|
1013
|
-
}, qt = {
|
|
1014
|
-
webkitMask: Mt,
|
|
1015
|
-
mask: Mt,
|
|
1016
|
-
background: fe
|
|
1017
|
-
};
|
|
1018
|
-
for (const t in qt) {
|
|
1019
|
-
const s = qt[t];
|
|
1020
|
-
for (const e in Jt)
|
|
1021
|
-
s[t + e] = Jt[e];
|
|
1022
|
-
}
|
|
1023
|
-
const vt = {};
|
|
1024
|
-
["horizontal", "vertical"].forEach((t) => {
|
|
1025
|
-
const s = t.slice(0, 1) + "Flip";
|
|
1026
|
-
vt[t + "-flip"] = s, vt[t.slice(0, 1) + "-flip"] = s, vt[t + "Flip"] = s;
|
|
1027
|
-
});
|
|
1028
|
-
function Kt(t) {
|
|
1029
|
-
return t + (t.match(/^[-0-9.]+$/) ? "px" : "");
|
|
1030
|
-
}
|
|
1031
|
-
const Zt = (t, s) => {
|
|
1032
|
-
const e = qn(zt, s), o = { ...is }, n = s.mode || "svg", i = {}, a = s.style, c = typeof a == "object" && !(a instanceof Array) ? a : {};
|
|
1033
|
-
for (let y in s) {
|
|
1034
|
-
const v = s[y];
|
|
1035
|
-
if (v !== void 0)
|
|
1036
|
-
switch (y) {
|
|
1037
|
-
// Properties to ignore
|
|
1038
|
-
case "icon":
|
|
1039
|
-
case "style":
|
|
1040
|
-
case "onLoad":
|
|
1041
|
-
case "mode":
|
|
1042
|
-
case "ssr":
|
|
1043
|
-
case "customise":
|
|
1044
|
-
break;
|
|
1045
|
-
// Boolean attributes
|
|
1046
|
-
case "inline":
|
|
1047
|
-
case "hFlip":
|
|
1048
|
-
case "vFlip":
|
|
1049
|
-
e[y] = v === !0 || v === "true" || v === 1;
|
|
1050
|
-
break;
|
|
1051
|
-
// Flip as string: 'horizontal,vertical'
|
|
1052
|
-
case "flip":
|
|
1053
|
-
typeof v == "string" && Zn(e, v);
|
|
1054
|
-
break;
|
|
1055
|
-
// Color: override style
|
|
1056
|
-
case "color":
|
|
1057
|
-
i.color = v;
|
|
1058
|
-
break;
|
|
1059
|
-
// Rotation as string
|
|
1060
|
-
case "rotate":
|
|
1061
|
-
typeof v == "string" ? e[y] = ts(v) : typeof v == "number" && (e[y] = v);
|
|
1062
|
-
break;
|
|
1063
|
-
// Remove aria-hidden
|
|
1064
|
-
case "ariaHidden":
|
|
1065
|
-
case "aria-hidden":
|
|
1066
|
-
v !== !0 && v !== "true" && delete o["aria-hidden"];
|
|
1067
|
-
break;
|
|
1068
|
-
default: {
|
|
1069
|
-
const l = vt[y];
|
|
1070
|
-
l ? (v === !0 || v === "true" || v === 1) && (e[l] = !0) : zt[y] === void 0 && (o[y] = v);
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
const f = En(t, e), r = f.attributes;
|
|
1075
|
-
if (e.inline && (i.verticalAlign = "-0.125em"), n === "svg")
|
|
1076
|
-
return o.style = {
|
|
1077
|
-
...i,
|
|
1078
|
-
...c
|
|
1079
|
-
}, Object.assign(o, r), o.innerHTML = Rn(f.body), $t("svg", o);
|
|
1080
|
-
const { body: u, width: d, height: p } = t, E = n === "mask" || (n === "bg" ? !1 : u.indexOf("currentColor") !== -1), D = es(u, {
|
|
1081
|
-
...r,
|
|
1082
|
-
width: d + "",
|
|
1083
|
-
height: p + ""
|
|
1084
|
-
});
|
|
1085
|
-
return o.style = {
|
|
1086
|
-
...i,
|
|
1087
|
-
"--svg": os(D),
|
|
1088
|
-
width: Kt(r.width),
|
|
1089
|
-
height: Kt(r.height),
|
|
1090
|
-
...as,
|
|
1091
|
-
...E ? Mt : fe,
|
|
1092
|
-
...c
|
|
1093
|
-
}, $t("span", o);
|
|
1094
|
-
};
|
|
1095
|
-
ae(!0);
|
|
1096
|
-
On("", Fn);
|
|
1097
|
-
if (typeof document < "u" && typeof window < "u") {
|
|
1098
|
-
const t = window;
|
|
1099
|
-
if (t.IconifyPreload !== void 0) {
|
|
1100
|
-
const s = t.IconifyPreload, e = "Invalid IconifyPreload syntax.";
|
|
1101
|
-
typeof s == "object" && s !== null && (s instanceof Array ? s : [s]).forEach((o) => {
|
|
1102
|
-
try {
|
|
1103
|
-
// Check if item is an object and not null/array
|
|
1104
|
-
(typeof o != "object" || o === null || o instanceof Array || // Check for 'icons' and 'prefix'
|
|
1105
|
-
typeof o.icons != "object" || typeof o.prefix != "string" || // Add icon set
|
|
1106
|
-
!yn(o)) && console.error(e);
|
|
1107
|
-
} catch {
|
|
1108
|
-
console.error(e);
|
|
1109
|
-
}
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
if (t.IconifyProviders !== void 0) {
|
|
1113
|
-
const s = t.IconifyProviders;
|
|
1114
|
-
if (typeof s == "object" && s !== null)
|
|
1115
|
-
for (let e in s) {
|
|
1116
|
-
const o = "IconifyProviders[" + e + "] is invalid.";
|
|
1117
|
-
try {
|
|
1118
|
-
const n = s[e];
|
|
1119
|
-
if (typeof n != "object" || !n || n.resources === void 0)
|
|
1120
|
-
continue;
|
|
1121
|
-
Mn(e, n) || console.error(o);
|
|
1122
|
-
} catch {
|
|
1123
|
-
console.error(o);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
const rs = {
|
|
1129
|
-
...bt,
|
|
1130
|
-
body: ""
|
|
1131
|
-
}, Tt = q((t, { emit: s }) => {
|
|
1132
|
-
const e = M(null);
|
|
1133
|
-
function o() {
|
|
1134
|
-
var r, u;
|
|
1135
|
-
e.value && ((u = (r = e.value).abort) == null || u.call(r), e.value = null);
|
|
1136
|
-
}
|
|
1137
|
-
const n = M(!!t.ssr), i = M(""), a = ve(null);
|
|
1138
|
-
function c() {
|
|
1139
|
-
const r = t.icon;
|
|
1140
|
-
if (typeof r == "object" && r !== null && typeof r.body == "string")
|
|
1141
|
-
return i.value = "", {
|
|
1142
|
-
data: r
|
|
1143
|
-
};
|
|
1144
|
-
let u;
|
|
1145
|
-
if (typeof r != "string" || (u = kt(r, !1, !0)) === null)
|
|
1146
|
-
return null;
|
|
1147
|
-
let d = vn(u);
|
|
1148
|
-
if (!d) {
|
|
1149
|
-
const D = e.value;
|
|
1150
|
-
return (!D || D.name !== r) && (d === null ? e.value = {
|
|
1151
|
-
name: r
|
|
1152
|
-
} : e.value = {
|
|
1153
|
-
name: r,
|
|
1154
|
-
abort: Jn([u], f)
|
|
1155
|
-
}), null;
|
|
1156
|
-
}
|
|
1157
|
-
o(), i.value !== r && (i.value = r, lt(() => {
|
|
1158
|
-
s("load", r);
|
|
1159
|
-
}));
|
|
1160
|
-
const p = t.customise;
|
|
1161
|
-
if (p) {
|
|
1162
|
-
d = Object.assign({}, d);
|
|
1163
|
-
const D = p(d.body, u.name, u.prefix, u.provider);
|
|
1164
|
-
typeof D == "string" && (d.body = D);
|
|
1165
|
-
}
|
|
1166
|
-
const E = ["iconify"];
|
|
1167
|
-
return u.prefix !== "" && E.push("iconify--" + u.prefix), u.provider !== "" && E.push("iconify--" + u.provider), { data: d, classes: E };
|
|
1168
|
-
}
|
|
1169
|
-
function f() {
|
|
1170
|
-
var u;
|
|
1171
|
-
const r = c();
|
|
1172
|
-
r ? r.data !== ((u = a.value) == null ? void 0 : u.data) && (a.value = r) : a.value = null;
|
|
1173
|
-
}
|
|
1174
|
-
return n.value ? f() : W(() => {
|
|
1175
|
-
n.value = !0, f();
|
|
1176
|
-
}), Pt(() => t.icon, f), mt(o), () => {
|
|
1177
|
-
const r = a.value;
|
|
1178
|
-
if (!r)
|
|
1179
|
-
return Zt(rs, t);
|
|
1180
|
-
let u = t;
|
|
1181
|
-
return r.classes && (u = {
|
|
1182
|
-
...t,
|
|
1183
|
-
class: r.classes.join(" ")
|
|
1184
|
-
}), Zt({
|
|
1185
|
-
...bt,
|
|
1186
|
-
...r.data
|
|
1187
|
-
}, u);
|
|
1188
|
-
};
|
|
1189
|
-
}, {
|
|
1190
|
-
props: [
|
|
1191
|
-
// Icon and render mode
|
|
1192
|
-
"icon",
|
|
1193
|
-
"mode",
|
|
1194
|
-
"ssr",
|
|
1195
|
-
// Layout and style
|
|
1196
|
-
"width",
|
|
1197
|
-
"height",
|
|
1198
|
-
"style",
|
|
1199
|
-
"color",
|
|
1200
|
-
"inline",
|
|
1201
|
-
// Transformations
|
|
1202
|
-
"rotate",
|
|
1203
|
-
"hFlip",
|
|
1204
|
-
"horizontalFlip",
|
|
1205
|
-
"vFlip",
|
|
1206
|
-
"verticalFlip",
|
|
1207
|
-
"flip",
|
|
1208
|
-
// Misc
|
|
1209
|
-
"id",
|
|
1210
|
-
"ariaHidden",
|
|
1211
|
-
"customise",
|
|
1212
|
-
"title"
|
|
1213
|
-
],
|
|
1214
|
-
emits: ["load"]
|
|
1215
|
-
}), ls = { class: "input-container" }, cs = ["value", "disabled"], us = {
|
|
160
|
+
}), me = { class: "input-container" }, he = ["value", "disabled"], fe = {
|
|
1216
161
|
key: 0,
|
|
1217
162
|
class: "tooltip-enhanced stop",
|
|
1218
163
|
"data-tooltip": "停止生成"
|
|
1219
|
-
},
|
|
164
|
+
}, pe = ["data-tooltip"], ye = {
|
|
1220
165
|
key: 2,
|
|
1221
166
|
class: "moveTB"
|
|
1222
|
-
},
|
|
167
|
+
}, ke = /* @__PURE__ */ nt({
|
|
1223
168
|
__name: "ChatInput",
|
|
1224
169
|
props: {
|
|
1225
170
|
modelValue: {},
|
|
@@ -1230,498 +175,498 @@ const rs = {
|
|
|
1230
175
|
},
|
|
1231
176
|
emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
|
|
1232
177
|
setup(t) {
|
|
1233
|
-
return (
|
|
1234
|
-
|
|
178
|
+
return (v, a) => (g(), y("div", me, [
|
|
179
|
+
n("input", {
|
|
1235
180
|
value: t.modelValue,
|
|
1236
181
|
type: "text",
|
|
1237
182
|
placeholder: "给AI助手发送消息...",
|
|
1238
|
-
onInput:
|
|
1239
|
-
onKeyup:
|
|
183
|
+
onInput: a[0] || (a[0] = (u) => v.$emit("update:modelValue", u.target.value)),
|
|
184
|
+
onKeyup: a[1] || (a[1] = Rt((u) => t.modelValue.trim() && v.$emit("send"), ["enter"])),
|
|
1240
185
|
disabled: t.isGenerating
|
|
1241
|
-
}, null, 40,
|
|
1242
|
-
t.isGenerating && t.lastUserMessage ? (
|
|
1243
|
-
|
|
186
|
+
}, null, 40, he),
|
|
187
|
+
t.isGenerating && t.lastUserMessage ? (g(), y("div", fe, [
|
|
188
|
+
F(M(x), {
|
|
1244
189
|
class: "op-icon stop-icon",
|
|
1245
190
|
icon: "heroicons-solid:stop",
|
|
1246
|
-
onClick:
|
|
191
|
+
onClick: a[2] || (a[2] = (u) => v.$emit("stop"))
|
|
1247
192
|
})
|
|
1248
|
-
])) : (
|
|
193
|
+
])) : (g(), y("div", {
|
|
1249
194
|
key: 1,
|
|
1250
|
-
class:
|
|
195
|
+
class: U(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
|
|
1251
196
|
"data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
|
|
1252
197
|
}, [
|
|
1253
|
-
|
|
198
|
+
F(M(x), {
|
|
1254
199
|
class: "op-icon",
|
|
1255
200
|
icon: "fluent-color:send-16",
|
|
1256
|
-
onClick:
|
|
201
|
+
onClick: a[3] || (a[3] = (u) => t.modelValue.trim() && v.$emit("send"))
|
|
1257
202
|
})
|
|
1258
|
-
], 10,
|
|
1259
|
-
t.hasScroll && !t.isAtBottom ? (
|
|
1260
|
-
|
|
203
|
+
], 10, pe)),
|
|
204
|
+
t.hasScroll && !t.isAtBottom ? (g(), y("div", ye, [
|
|
205
|
+
F(M(x), {
|
|
1261
206
|
class: "op-icon",
|
|
1262
207
|
icon: "ep:bottom",
|
|
1263
|
-
onClick:
|
|
208
|
+
onClick: a[4] || (a[4] = (u) => v.$emit("scroll-to-bottom"))
|
|
1264
209
|
})
|
|
1265
|
-
])) :
|
|
210
|
+
])) : Y("", !0)
|
|
1266
211
|
]));
|
|
1267
212
|
}
|
|
1268
213
|
});
|
|
1269
|
-
function
|
|
1270
|
-
const
|
|
1271
|
-
function
|
|
1272
|
-
|
|
214
|
+
function we(t) {
|
|
215
|
+
const v = T(!0), a = T(!1);
|
|
216
|
+
function u() {
|
|
217
|
+
ut(() => {
|
|
1273
218
|
t.value && (t.value.scrollTop = t.value.scrollHeight);
|
|
1274
219
|
});
|
|
1275
220
|
}
|
|
1276
|
-
function
|
|
221
|
+
function i() {
|
|
1277
222
|
if (!t.value) return;
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
}
|
|
1281
|
-
return { isAtBottom:
|
|
1282
|
-
}
|
|
1283
|
-
function
|
|
1284
|
-
function t(
|
|
1285
|
-
|
|
1286
|
-
if (
|
|
1287
|
-
const
|
|
1288
|
-
if (!
|
|
1289
|
-
const
|
|
1290
|
-
if (
|
|
1291
|
-
const
|
|
1292
|
-
|
|
223
|
+
const s = t.value, C = s.scrollTop + s.clientHeight >= s.scrollHeight - 1, o = s.scrollHeight > s.clientHeight;
|
|
224
|
+
v.value = C, a.value = o;
|
|
225
|
+
}
|
|
226
|
+
return { isAtBottom: v, hasScroll: a, scrollToBottom: u, checkScrollStatus: i };
|
|
227
|
+
}
|
|
228
|
+
function Ce() {
|
|
229
|
+
function t(v) {
|
|
230
|
+
v.querySelectorAll("pre").forEach((u) => {
|
|
231
|
+
if (u.querySelector(".copy-button")) return;
|
|
232
|
+
const i = u.querySelector("code");
|
|
233
|
+
if (!i) return;
|
|
234
|
+
const C = (Array.from(i.classList).find((h) => h.startsWith("language-")) || "").replace("language-", "");
|
|
235
|
+
if (C) {
|
|
236
|
+
const h = document.createElement("span");
|
|
237
|
+
h.className = "code-lang", h.textContent = C, u.appendChild(h);
|
|
1293
238
|
}
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1296
|
-
navigator.clipboard.writeText(
|
|
1297
|
-
|
|
1298
|
-
|
|
239
|
+
const o = document.createElement("button");
|
|
240
|
+
o.className = "copy-button", o.textContent = "复制", o.onclick = () => {
|
|
241
|
+
navigator.clipboard.writeText(i.textContent || "").then(() => {
|
|
242
|
+
o.textContent = "已复制", setTimeout(() => {
|
|
243
|
+
o.textContent = "复制";
|
|
1299
244
|
}, 2e3);
|
|
1300
245
|
});
|
|
1301
|
-
},
|
|
246
|
+
}, u.appendChild(o);
|
|
1302
247
|
});
|
|
1303
248
|
}
|
|
1304
249
|
return { enhanceCodeBlocks: t };
|
|
1305
250
|
}
|
|
1306
|
-
function
|
|
1307
|
-
let
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1310
|
-
|
|
251
|
+
function Ae(t) {
|
|
252
|
+
let v = null, a = 0;
|
|
253
|
+
function u(s) {
|
|
254
|
+
v = s(v || [...t.value]), a || (a = requestAnimationFrame(() => {
|
|
255
|
+
a = 0, v && (t.value = v, v = null);
|
|
1311
256
|
}));
|
|
1312
257
|
}
|
|
1313
|
-
function
|
|
1314
|
-
|
|
258
|
+
function i() {
|
|
259
|
+
a && (cancelAnimationFrame(a), a = 0), v && (t.value = v, v = null);
|
|
1315
260
|
}
|
|
1316
|
-
return { batchMessagesUpdate:
|
|
261
|
+
return { batchMessagesUpdate: u, flushMessagesBatch: i };
|
|
1317
262
|
}
|
|
1318
|
-
function
|
|
1319
|
-
const
|
|
1320
|
-
let
|
|
1321
|
-
function
|
|
1322
|
-
if (
|
|
1323
|
-
const
|
|
1324
|
-
if (
|
|
1325
|
-
|
|
1326
|
-
let
|
|
1327
|
-
if (t.value.forEach((
|
|
1328
|
-
if (
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1331
|
-
|
|
1332
|
-
const
|
|
1333
|
-
|
|
263
|
+
function be(t, v, a) {
|
|
264
|
+
const u = K(/* @__PURE__ */ new Map()), i = T(/* @__PURE__ */ new Map());
|
|
265
|
+
let s = 0, C = 0;
|
|
266
|
+
function o() {
|
|
267
|
+
if (s) return;
|
|
268
|
+
const r = 16, R = 1, L = 40, Q = (D) => {
|
|
269
|
+
if (D - C >= r) {
|
|
270
|
+
C = D;
|
|
271
|
+
let B = !1;
|
|
272
|
+
if (t.value.forEach((d, O) => {
|
|
273
|
+
if (d.type !== "ai" || d.status !== a) return;
|
|
274
|
+
const A = d.content, k = i.value.get(O) ?? 0, P = A.length - k;
|
|
275
|
+
if (P > 0) {
|
|
276
|
+
B = !0;
|
|
277
|
+
const N = P > 15 ? Math.min(Math.ceil(P * 0.3), L) : R, b = Math.min(k + N, A.length);
|
|
278
|
+
i.value.set(O, b), u.set(O, A.slice(0, b));
|
|
1334
279
|
}
|
|
1335
|
-
}),
|
|
1336
|
-
|
|
280
|
+
}), B && v(), !t.value.some((d) => d.type === "ai" && d.status === a)) {
|
|
281
|
+
s = 0;
|
|
1337
282
|
return;
|
|
1338
283
|
}
|
|
1339
284
|
}
|
|
1340
|
-
|
|
285
|
+
s = requestAnimationFrame(Q);
|
|
1341
286
|
};
|
|
1342
|
-
|
|
287
|
+
s = requestAnimationFrame(Q);
|
|
1343
288
|
}
|
|
1344
|
-
function
|
|
1345
|
-
|
|
1346
|
-
|
|
289
|
+
function h() {
|
|
290
|
+
s && (cancelAnimationFrame(s), s = 0), t.value.forEach((r, R) => {
|
|
291
|
+
r.type === "ai" && (u.set(R, r.content), i.value.set(R, r.content.length));
|
|
1347
292
|
});
|
|
1348
293
|
}
|
|
1349
|
-
function
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1352
|
-
function
|
|
1353
|
-
if (
|
|
1354
|
-
const
|
|
1355
|
-
if (
|
|
1356
|
-
const
|
|
1357
|
-
if (
|
|
1358
|
-
let
|
|
1359
|
-
for (let
|
|
1360
|
-
|
|
1361
|
-
const
|
|
1362
|
-
return
|
|
1363
|
-
}
|
|
1364
|
-
return { displayedContent:
|
|
1365
|
-
}
|
|
1366
|
-
function
|
|
294
|
+
function c() {
|
|
295
|
+
s && (cancelAnimationFrame(s), s = 0);
|
|
296
|
+
}
|
|
297
|
+
function l(r, R, L, Q) {
|
|
298
|
+
if (L.type !== "answer" || Q.status !== a) return L.content;
|
|
299
|
+
const D = Q.segments || [];
|
|
300
|
+
if (D.slice(R + 1).some((A) => A.type === "answer")) return L.content;
|
|
301
|
+
const e = i.value.get(r);
|
|
302
|
+
if (e == null) return L.content;
|
|
303
|
+
let d = 0;
|
|
304
|
+
for (let A = 0; A < R; A++)
|
|
305
|
+
D[A].type === "answer" && (d += D[A].content.length);
|
|
306
|
+
const O = d + L.content.length;
|
|
307
|
+
return e >= O ? L.content : e <= d ? "" : L.content.slice(0, e - d);
|
|
308
|
+
}
|
|
309
|
+
return { displayedContent: u, streamingIndexRef: i, startTypewriter: o, flushTypewriter: h, getSegmentDisplayContent: l, stopTypewriter: c };
|
|
310
|
+
}
|
|
311
|
+
function Se({
|
|
1367
312
|
messages: t,
|
|
1368
|
-
isGenerating:
|
|
1369
|
-
lastUserMessage:
|
|
1370
|
-
batchMessagesUpdate:
|
|
1371
|
-
flushMessagesBatch:
|
|
1372
|
-
STATUS:
|
|
1373
|
-
cfg:
|
|
313
|
+
isGenerating: v,
|
|
314
|
+
lastUserMessage: a,
|
|
315
|
+
batchMessagesUpdate: u,
|
|
316
|
+
flushMessagesBatch: i,
|
|
317
|
+
STATUS: s,
|
|
318
|
+
cfg: C
|
|
1374
319
|
}) {
|
|
1375
|
-
const
|
|
1376
|
-
function
|
|
1377
|
-
const
|
|
1378
|
-
|
|
1379
|
-
if (
|
|
1380
|
-
const
|
|
1381
|
-
return
|
|
320
|
+
const o = T(/* @__PURE__ */ new Map()), h = T(/* @__PURE__ */ new Map()), c = T(/* @__PURE__ */ new Map()), l = T(/* @__PURE__ */ new Map()), r = T(!1);
|
|
321
|
+
function R(D) {
|
|
322
|
+
const B = o.value.get(D) || [];
|
|
323
|
+
u((e) => {
|
|
324
|
+
if (e[D]) {
|
|
325
|
+
const d = [...e];
|
|
326
|
+
return d[D] = { ...d[D], segments: B.map((O) => ({ ...O })) }, d;
|
|
1382
327
|
}
|
|
1383
|
-
return
|
|
328
|
+
return e;
|
|
1384
329
|
});
|
|
1385
330
|
}
|
|
1386
|
-
function
|
|
1387
|
-
const
|
|
1388
|
-
let
|
|
1389
|
-
|
|
1390
|
-
if (
|
|
1391
|
-
const
|
|
1392
|
-
|
|
331
|
+
function L(D) {
|
|
332
|
+
const B = o.value.get(D) || [], e = c.value.get(D);
|
|
333
|
+
let d = 0, O = !1;
|
|
334
|
+
B.forEach((A) => {
|
|
335
|
+
if (A.type === "thinking" && A.duration == null) {
|
|
336
|
+
const k = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
|
|
337
|
+
A.duration = k, d += k, O = !0;
|
|
1393
338
|
}
|
|
1394
|
-
}),
|
|
1395
|
-
if (
|
|
1396
|
-
const
|
|
1397
|
-
return
|
|
1398
|
-
...
|
|
1399
|
-
segments:
|
|
1400
|
-
thinkingDuration: (
|
|
1401
|
-
},
|
|
339
|
+
}), O && (o.value.set(D, B), u((A) => {
|
|
340
|
+
if (A[D]) {
|
|
341
|
+
const k = [...A];
|
|
342
|
+
return k[D] = {
|
|
343
|
+
...k[D],
|
|
344
|
+
segments: B.map((P) => ({ ...P })),
|
|
345
|
+
thinkingDuration: (k[D].thinkingDuration || 0) + d
|
|
346
|
+
}, k;
|
|
1402
347
|
}
|
|
1403
|
-
return
|
|
348
|
+
return A;
|
|
1404
349
|
}));
|
|
1405
350
|
}
|
|
1406
|
-
async function D
|
|
1407
|
-
|
|
351
|
+
async function Q(D, B, e, d, O = !1) {
|
|
352
|
+
r.value = !1, o.value.set(e, []), v.value = !0;
|
|
1408
353
|
try {
|
|
1409
|
-
const
|
|
1410
|
-
await
|
|
354
|
+
const A = C.baseUrl.replace(/\/+$/, "") + "/" + D.replace(/^\/+/, "");
|
|
355
|
+
await Ut(A, {
|
|
1411
356
|
method: "POST",
|
|
1412
357
|
headers: { "Content-Type": "application/json" },
|
|
1413
|
-
body: JSON.stringify({ app:
|
|
1414
|
-
signal:
|
|
358
|
+
body: JSON.stringify({ app: C.app ?? 1, data: B }),
|
|
359
|
+
signal: d,
|
|
1415
360
|
openWhenHidden: !0,
|
|
1416
|
-
async onopen(
|
|
1417
|
-
|
|
361
|
+
async onopen(k) {
|
|
362
|
+
k.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", k.status, k.statusText);
|
|
1418
363
|
},
|
|
1419
|
-
onmessage(
|
|
1420
|
-
var
|
|
364
|
+
onmessage(k) {
|
|
365
|
+
var P;
|
|
1421
366
|
try {
|
|
1422
|
-
let
|
|
1423
|
-
for (;
|
|
1424
|
-
|
|
1425
|
-
if (!
|
|
1426
|
-
let
|
|
367
|
+
let N = k.data || "";
|
|
368
|
+
for (; N.startsWith("data:"); )
|
|
369
|
+
N = N.replace(/^data:\s*/, "");
|
|
370
|
+
if (!N) return;
|
|
371
|
+
let b;
|
|
1427
372
|
try {
|
|
1428
|
-
|
|
373
|
+
b = JSON.parse(N);
|
|
1429
374
|
} catch {
|
|
1430
375
|
return;
|
|
1431
376
|
}
|
|
1432
|
-
switch (
|
|
377
|
+
switch (b.event) {
|
|
1433
378
|
case "message_start":
|
|
1434
|
-
|
|
379
|
+
O || (a.value = b.id), h.value.set(e, "answer");
|
|
1435
380
|
break;
|
|
1436
381
|
case "think_message_output_start": {
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
|
|
382
|
+
c.value.set(e, Date.now()), h.value.set(e, "thinking");
|
|
383
|
+
const m = o.value.get(e) || [];
|
|
384
|
+
o.value.set(e, [...m, { type: "thinking", content: "" }]), R(e);
|
|
1440
385
|
break;
|
|
1441
386
|
}
|
|
1442
387
|
case "agent_thought": {
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
if (
|
|
1446
|
-
const
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1449
|
-
segments:
|
|
1450
|
-
thinkingContent: (
|
|
1451
|
-
status:
|
|
1452
|
-
},
|
|
388
|
+
const m = b.thought || b.thinking || "", w = o.value.get(e) || [], p = w[w.length - 1];
|
|
389
|
+
p && p.type === "agent_thought" ? p.content += m : (h.value.set(e, "agent_thought"), w.push({ type: "agent_thought", content: m }), l.value.set(e, Date.now())), o.value.set(e, w), u((S) => {
|
|
390
|
+
if (S[e]) {
|
|
391
|
+
const H = [...S];
|
|
392
|
+
return H[e] = {
|
|
393
|
+
...H[e],
|
|
394
|
+
segments: w.map(($) => ({ ...$ })),
|
|
395
|
+
thinkingContent: (H[e].thinkingContent || "") + m,
|
|
396
|
+
status: s.THINKING
|
|
397
|
+
}, H;
|
|
1453
398
|
}
|
|
1454
|
-
return
|
|
399
|
+
return S;
|
|
1455
400
|
});
|
|
1456
401
|
break;
|
|
1457
402
|
}
|
|
1458
403
|
case "think_message": {
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
if (
|
|
1462
|
-
const
|
|
1463
|
-
return
|
|
1464
|
-
|
|
1465
|
-
segments:
|
|
1466
|
-
thinkingContent: (
|
|
1467
|
-
status:
|
|
1468
|
-
},
|
|
404
|
+
const m = b.thinking || b.answer || b.text || "", w = o.value.get(e) || [], p = w[w.length - 1];
|
|
405
|
+
p && p.type === "thinking" ? p.content += m : (w.push({ type: "thinking", content: m }), c.value.set(e, Date.now())), o.value.set(e, w), u((S) => {
|
|
406
|
+
if (S[e]) {
|
|
407
|
+
const H = [...S];
|
|
408
|
+
return H[e] = {
|
|
409
|
+
...H[e],
|
|
410
|
+
segments: w.map(($) => ({ ...$ })),
|
|
411
|
+
thinkingContent: (H[e].thinkingContent || "") + m,
|
|
412
|
+
status: s.THINKING
|
|
413
|
+
}, H;
|
|
1469
414
|
}
|
|
1470
|
-
return
|
|
415
|
+
return S;
|
|
1471
416
|
});
|
|
1472
417
|
break;
|
|
1473
418
|
}
|
|
1474
419
|
case "agent_thought_end": {
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1477
|
-
if (
|
|
1478
|
-
const
|
|
1479
|
-
return
|
|
1480
|
-
|
|
1481
|
-
segments:
|
|
1482
|
-
thinkingDuration: (
|
|
1483
|
-
},
|
|
420
|
+
const m = l.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [], S = p[p.length - 1];
|
|
421
|
+
S && S.type === "agent_thought" && (S.duration = w), o.value.set(e, p), u((H) => {
|
|
422
|
+
if (H[e]) {
|
|
423
|
+
const $ = [...H];
|
|
424
|
+
return $[e] = {
|
|
425
|
+
...$[e],
|
|
426
|
+
segments: p.map((V) => ({ ...V })),
|
|
427
|
+
thinkingDuration: ($[e].thinkingDuration || 0) + w
|
|
428
|
+
}, $;
|
|
1484
429
|
}
|
|
1485
|
-
return
|
|
430
|
+
return H;
|
|
1486
431
|
});
|
|
1487
432
|
break;
|
|
1488
433
|
}
|
|
1489
434
|
case "think_message_output_end": {
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
if (
|
|
1493
|
-
const
|
|
1494
|
-
return
|
|
1495
|
-
|
|
1496
|
-
segments:
|
|
1497
|
-
thinkingDuration: (
|
|
1498
|
-
},
|
|
435
|
+
const m = c.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [], S = p[p.length - 1];
|
|
436
|
+
S && S.type === "thinking" && (S.duration = w), o.value.set(e, p), u((H) => {
|
|
437
|
+
if (H[e]) {
|
|
438
|
+
const $ = [...H];
|
|
439
|
+
return $[e] = {
|
|
440
|
+
...$[e],
|
|
441
|
+
segments: p.map((V) => ({ ...V })),
|
|
442
|
+
thinkingDuration: ($[e].thinkingDuration || 0) + w
|
|
443
|
+
}, $;
|
|
1499
444
|
}
|
|
1500
|
-
return
|
|
445
|
+
return H;
|
|
1501
446
|
});
|
|
1502
447
|
break;
|
|
1503
448
|
}
|
|
1504
449
|
case "tool_message": {
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1507
|
-
const
|
|
1508
|
-
|
|
450
|
+
const m = b.answer || b.text || b.content || "";
|
|
451
|
+
if (!m) break;
|
|
452
|
+
const w = o.value.get(e) || [];
|
|
453
|
+
w.push({ type: "answer", content: m }), o.value.set(e, w), R(e);
|
|
1509
454
|
break;
|
|
1510
455
|
}
|
|
1511
456
|
case "message_output_start":
|
|
1512
|
-
|
|
457
|
+
h.value.set(e, "answer"), L(e);
|
|
1513
458
|
break;
|
|
1514
459
|
case "message": {
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
if (
|
|
1520
|
-
const
|
|
1521
|
-
return
|
|
1522
|
-
...
|
|
1523
|
-
segments:
|
|
1524
|
-
content:
|
|
1525
|
-
status:
|
|
1526
|
-
},
|
|
460
|
+
const m = b.answer || "", w = h.value.get(e), p = o.value.get(e) || [], S = p[p.length - 1];
|
|
461
|
+
w === "answer" && S && S.type === "answer" ? S.content += m : (L(e), h.value.set(e, "answer"), p.push({ type: "answer", content: m })), o.value.set(e, p);
|
|
462
|
+
const H = p.filter(($) => $.type === "answer").map(($) => $.content).join("");
|
|
463
|
+
u(($) => {
|
|
464
|
+
if ($[e]) {
|
|
465
|
+
const V = [...$];
|
|
466
|
+
return V[e] = {
|
|
467
|
+
...V[e],
|
|
468
|
+
segments: p.map((Z) => ({ ...Z })),
|
|
469
|
+
content: H,
|
|
470
|
+
status: r.value ? s.STOP : s.ANSWERING
|
|
471
|
+
}, V;
|
|
1527
472
|
}
|
|
1528
|
-
return
|
|
473
|
+
return $;
|
|
1529
474
|
});
|
|
1530
475
|
break;
|
|
1531
476
|
}
|
|
1532
477
|
case "message_end": {
|
|
1533
|
-
|
|
1534
|
-
const
|
|
1535
|
-
|
|
478
|
+
i();
|
|
479
|
+
const m = [...t.value];
|
|
480
|
+
m[e] && (m[e] = { ...m[e], status: r.value ? s.STOP : s.COMPLETED }), t.value = m, v.value = !1;
|
|
1536
481
|
break;
|
|
1537
482
|
}
|
|
1538
483
|
case "agent_error":
|
|
1539
484
|
case "message_failed": {
|
|
1540
|
-
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1543
|
-
...
|
|
1544
|
-
status:
|
|
1545
|
-
content:
|
|
1546
|
-
errorMessage:
|
|
1547
|
-
}, t.value =
|
|
485
|
+
i();
|
|
486
|
+
const m = [...t.value];
|
|
487
|
+
m[e] && (m[e] = {
|
|
488
|
+
...m[e],
|
|
489
|
+
status: s.ERROR,
|
|
490
|
+
content: b.error_msg || b.message || "请求失败",
|
|
491
|
+
errorMessage: b.error_msg || b.message || "请求失败"
|
|
492
|
+
}, t.value = m), v.value = !1;
|
|
1548
493
|
break;
|
|
1549
494
|
}
|
|
1550
495
|
case "message_replace": {
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1553
|
-
if (
|
|
1554
|
-
const
|
|
1555
|
-
return
|
|
1556
|
-
|
|
1557
|
-
segments:
|
|
1558
|
-
content:
|
|
1559
|
-
},
|
|
496
|
+
const m = b.answer || "", w = o.value.get(e) || [], p = (P = w.map((S, H) => ({ s: S, i: H })).reverse().find((S) => S.s.type === "answer")) == null ? void 0 : P.i;
|
|
497
|
+
p != null ? w[p] = { ...w[p], content: m } : w.push({ type: "answer", content: m }), o.value.set(e, w), u((S) => {
|
|
498
|
+
if (S[e]) {
|
|
499
|
+
const H = [...S];
|
|
500
|
+
return H[e] = {
|
|
501
|
+
...H[e],
|
|
502
|
+
segments: w.map(($) => ({ ...$ })),
|
|
503
|
+
content: m
|
|
504
|
+
}, H;
|
|
1560
505
|
}
|
|
1561
|
-
return
|
|
506
|
+
return S;
|
|
1562
507
|
});
|
|
1563
508
|
break;
|
|
1564
509
|
}
|
|
1565
510
|
case "message_cost": {
|
|
1566
|
-
const
|
|
1567
|
-
inputTokens:
|
|
1568
|
-
outputTokens:
|
|
1569
|
-
latency:
|
|
1570
|
-
latencyFirstResp:
|
|
511
|
+
const m = {
|
|
512
|
+
inputTokens: b.input_tokens || 0,
|
|
513
|
+
outputTokens: b.output_tokens || 0,
|
|
514
|
+
latency: b.latency || 0,
|
|
515
|
+
latencyFirstResp: b.latency_first_resp
|
|
1571
516
|
};
|
|
1572
|
-
|
|
1573
|
-
if (
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
517
|
+
u((w) => {
|
|
518
|
+
if (w[e]) {
|
|
519
|
+
const p = [...w];
|
|
520
|
+
return p[e] = { ...p[e], cost: m }, p;
|
|
1576
521
|
}
|
|
1577
|
-
return
|
|
522
|
+
return w;
|
|
1578
523
|
});
|
|
1579
524
|
break;
|
|
1580
525
|
}
|
|
1581
526
|
default:
|
|
1582
527
|
}
|
|
1583
|
-
} catch (
|
|
1584
|
-
console.error("[ai-assist-sdk] onmessage 解析失败:",
|
|
528
|
+
} catch (N) {
|
|
529
|
+
console.error("[ai-assist-sdk] onmessage 解析失败:", N);
|
|
1585
530
|
}
|
|
1586
531
|
},
|
|
1587
532
|
onclose() {
|
|
1588
|
-
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
...
|
|
1592
|
-
content:
|
|
1593
|
-
status:
|
|
1594
|
-
}), t.value =
|
|
533
|
+
i(), L(e), i();
|
|
534
|
+
const P = (o.value.get(e) || []).filter((b) => b.type === "answer").map((b) => b.content).join(""), N = [...t.value];
|
|
535
|
+
N[e] && N[e].status !== s.ERROR && (N[e] = {
|
|
536
|
+
...N[e],
|
|
537
|
+
content: r.value && !P ? "已停止回答" : P,
|
|
538
|
+
status: r.value ? s.STOP : s.COMPLETED
|
|
539
|
+
}), t.value = N, v.value = !1;
|
|
1595
540
|
},
|
|
1596
|
-
onerror(
|
|
1597
|
-
console.error("[ai-assist-sdk] ❌ 连接错误:",
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1600
|
-
⚠️ 请求异常,已终止`, status:
|
|
541
|
+
onerror(k) {
|
|
542
|
+
console.error("[ai-assist-sdk] ❌ 连接错误:", k), i();
|
|
543
|
+
const P = [...t.value];
|
|
544
|
+
P[e] && (P[e] = { ...P[e], content: `
|
|
545
|
+
⚠️ 请求异常,已终止`, status: s.ERROR }), t.value = P, v.value = !1;
|
|
1601
546
|
}
|
|
1602
547
|
});
|
|
1603
|
-
} catch (
|
|
1604
|
-
if (console.error("[ai-assist-sdk] doStreamRequest error:",
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1607
|
-
|
|
548
|
+
} catch (A) {
|
|
549
|
+
if (console.error("[ai-assist-sdk] doStreamRequest error:", A), !r.value) {
|
|
550
|
+
i();
|
|
551
|
+
const k = [...t.value];
|
|
552
|
+
k[e] && (k[e] = { ...k[e], content: "服务连接失败,请稍后重试", status: s.ERROR }), t.value = k, v.value = !1;
|
|
1608
553
|
}
|
|
1609
554
|
}
|
|
1610
555
|
}
|
|
1611
|
-
return { doStreamRequest:
|
|
556
|
+
return { doStreamRequest: Q, issTop: r };
|
|
1612
557
|
}
|
|
1613
|
-
function
|
|
1614
|
-
var
|
|
558
|
+
function Ee(t) {
|
|
559
|
+
var v;
|
|
1615
560
|
if (typeof t == "string") {
|
|
1616
|
-
const
|
|
1617
|
-
return
|
|
561
|
+
const a = Nt(t);
|
|
562
|
+
return Yt(a) || t;
|
|
1618
563
|
}
|
|
1619
|
-
return (t == null ? void 0 : t.answer) || ((
|
|
564
|
+
return (t == null ? void 0 : t.answer) || ((v = t == null ? void 0 : t.data) == null ? void 0 : v.answer) || String(t || "");
|
|
1620
565
|
}
|
|
1621
|
-
function
|
|
566
|
+
function Re(t) {
|
|
1622
567
|
return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
|
|
1623
568
|
}
|
|
1624
|
-
function
|
|
569
|
+
function Te({
|
|
1625
570
|
messages: t,
|
|
1626
|
-
userInput:
|
|
1627
|
-
isGenerating:
|
|
1628
|
-
lastUserMessage:
|
|
1629
|
-
conversationId:
|
|
1630
|
-
doStreamRequest:
|
|
1631
|
-
issTop:
|
|
1632
|
-
scrollToBottom:
|
|
1633
|
-
STATUS:
|
|
1634
|
-
cfg:
|
|
571
|
+
userInput: v,
|
|
572
|
+
isGenerating: a,
|
|
573
|
+
lastUserMessage: u,
|
|
574
|
+
conversationId: i,
|
|
575
|
+
doStreamRequest: s,
|
|
576
|
+
issTop: C,
|
|
577
|
+
scrollToBottom: o,
|
|
578
|
+
STATUS: h,
|
|
579
|
+
cfg: c
|
|
1635
580
|
}) {
|
|
1636
|
-
const
|
|
581
|
+
const l = c.apis, r = K({
|
|
1637
582
|
first: new AbortController(),
|
|
1638
583
|
again: new AbortController()
|
|
1639
584
|
});
|
|
1640
|
-
async function
|
|
1641
|
-
const
|
|
1642
|
-
if (!
|
|
1643
|
-
const
|
|
585
|
+
async function R() {
|
|
586
|
+
const e = v.value.trim();
|
|
587
|
+
if (!e || a.value) return;
|
|
588
|
+
const d = [
|
|
1644
589
|
...t.value,
|
|
1645
|
-
{ type: "user", content:
|
|
1646
|
-
{ type: "ai", content: "", status:
|
|
590
|
+
{ type: "user", content: e },
|
|
591
|
+
{ type: "ai", content: "", status: h.THINKING }
|
|
1647
592
|
];
|
|
1648
|
-
t.value =
|
|
1649
|
-
const
|
|
1650
|
-
if (
|
|
1651
|
-
console.log("[ai-assist-sdk] ✅ 使用流式 SSE:",
|
|
1652
|
-
Query:
|
|
1653
|
-
AppConversationID:
|
|
593
|
+
t.value = d, v.value = "", o();
|
|
594
|
+
const O = d.length - 1;
|
|
595
|
+
if (l.chatQueryStreamApi) {
|
|
596
|
+
console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", l.chatQueryStreamApi), await s(l.chatQueryStreamApi, {
|
|
597
|
+
Query: e,
|
|
598
|
+
AppConversationID: i.value,
|
|
1654
599
|
ResponseMode: "streaming"
|
|
1655
|
-
},
|
|
600
|
+
}, O, r.first.signal);
|
|
1656
601
|
return;
|
|
1657
602
|
}
|
|
1658
603
|
console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
|
|
1659
604
|
try {
|
|
1660
|
-
const
|
|
1661
|
-
app:
|
|
1662
|
-
data: { Query:
|
|
1663
|
-
}),
|
|
1664
|
-
t.value = [...t.value.slice(0, -1), { type: "ai", content:
|
|
1665
|
-
} catch (
|
|
1666
|
-
t.value = [...t.value.slice(0, -1), { type: "ai", content: (
|
|
605
|
+
const k = await Bt().post(l.chatQueryApi, {
|
|
606
|
+
app: c.app ?? 1,
|
|
607
|
+
data: { Query: e, AppConversationID: i.value }
|
|
608
|
+
}), P = Ee(k.data);
|
|
609
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: P, status: h.COMPLETED }];
|
|
610
|
+
} catch (A) {
|
|
611
|
+
t.value = [...t.value.slice(0, -1), { type: "ai", content: (A == null ? void 0 : A.message) || "服务连接失败,请稍后重试", status: h.ERROR }];
|
|
1667
612
|
}
|
|
1668
613
|
}
|
|
1669
|
-
async function
|
|
1670
|
-
if (!
|
|
1671
|
-
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
const
|
|
1675
|
-
await
|
|
1676
|
-
MessageID:
|
|
1677
|
-
AppConversationID:
|
|
614
|
+
async function L() {
|
|
615
|
+
if (!u.value || a.value) return;
|
|
616
|
+
r.again.abort(), r.again = new AbortController();
|
|
617
|
+
const e = [...t.value];
|
|
618
|
+
e.length > 0 && e[e.length - 1].type === "ai" && e.pop(), e.push({ type: "ai", content: "", status: h.RETHINKING }), t.value = e, o();
|
|
619
|
+
const d = t.value.length - 1, O = Re(l);
|
|
620
|
+
await s(O, {
|
|
621
|
+
MessageID: u.value,
|
|
622
|
+
AppConversationID: i.value,
|
|
1678
623
|
ResponseMode: "streaming"
|
|
1679
|
-
},
|
|
624
|
+
}, d, r.again.signal, !0);
|
|
1680
625
|
}
|
|
1681
|
-
async function
|
|
1682
|
-
if (!
|
|
1683
|
-
const
|
|
626
|
+
async function Q() {
|
|
627
|
+
if (!l.stopMessageApi || !a.value) return;
|
|
628
|
+
const e = t.value.length - 1 - 1;
|
|
1684
629
|
try {
|
|
1685
|
-
await
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
} catch (
|
|
1689
|
-
const
|
|
1690
|
-
|
|
630
|
+
await Lt(l, u.value);
|
|
631
|
+
const d = [...t.value];
|
|
632
|
+
d[e] && (d[e] = { ...d[e], content: d[e].content || "已停止回答", status: h.STOP }), t.value = d, a.value = !1, r.first.abort(), r.first = new AbortController(), r.again.abort(), r.again = new AbortController(), C.value = !0;
|
|
633
|
+
} catch (d) {
|
|
634
|
+
const O = [...t.value];
|
|
635
|
+
O[e] && (O[e] = { ...O[e], content: (d == null ? void 0 : d.message) || "系统繁忙,请稍后再试", status: h.ERROR }), t.value = O;
|
|
1691
636
|
}
|
|
1692
637
|
}
|
|
1693
|
-
async function
|
|
1694
|
-
var
|
|
1695
|
-
|
|
638
|
+
async function D(e) {
|
|
639
|
+
var d, O, A;
|
|
640
|
+
i.value = e;
|
|
1696
641
|
try {
|
|
1697
|
-
const
|
|
1698
|
-
|
|
1699
|
-
} catch (
|
|
1700
|
-
|
|
642
|
+
const k = await $t(l, e), P = (A = (O = (d = k == null ? void 0 : k.messages) == null ? void 0 : d[0]) == null ? void 0 : O.answerInfo) == null ? void 0 : A.answer;
|
|
643
|
+
P && (t.value = [...t.value, { type: "ai", content: P, status: h.COMPLETED }]);
|
|
644
|
+
} catch (k) {
|
|
645
|
+
it((k == null ? void 0 : k.message) || "加载历史会话失败");
|
|
1701
646
|
}
|
|
1702
647
|
}
|
|
1703
|
-
async function
|
|
1704
|
-
var
|
|
648
|
+
async function B() {
|
|
649
|
+
var e;
|
|
1705
650
|
try {
|
|
1706
|
-
const
|
|
1707
|
-
(
|
|
1708
|
-
} catch (
|
|
1709
|
-
|
|
651
|
+
const d = await Pt(l);
|
|
652
|
+
(e = d == null ? void 0 : d.conversation) != null && e.appConversationID && (i.value = d.conversation.appConversationID);
|
|
653
|
+
} catch (d) {
|
|
654
|
+
it((d == null ? void 0 : d.message) || "创建会话失败");
|
|
1710
655
|
}
|
|
1711
656
|
}
|
|
1712
|
-
return { sendMessage:
|
|
657
|
+
return { sendMessage: R, regenerateResponse: L, toggleStop: Q, goHistoryMessage: D, initConversation: B, controllers: r };
|
|
1713
658
|
}
|
|
1714
|
-
const
|
|
659
|
+
const De = { class: "container" }, Me = { class: "message ai-message greet-message" }, Oe = { class: "ai-greet" }, He = {
|
|
1715
660
|
key: 0,
|
|
1716
661
|
class: "message ai-message recommend-message"
|
|
1717
|
-
},
|
|
662
|
+
}, Pe = { class: "ai-recommend" }, $e = { class: "recommend-header" }, Le = ["src"], Be = ["onClick"], Ne = /* @__PURE__ */ nt({
|
|
1718
663
|
__name: "Answer",
|
|
1719
664
|
props: {
|
|
1720
665
|
defaultSayhello: {},
|
|
1721
666
|
defaultRecommend: {}
|
|
1722
667
|
},
|
|
1723
|
-
setup(t, { expose:
|
|
1724
|
-
const
|
|
668
|
+
setup(t, { expose: v }) {
|
|
669
|
+
const a = {
|
|
1725
670
|
THINKING: "thinking",
|
|
1726
671
|
RETHINKING: "rethinking",
|
|
1727
672
|
ANSWERING: "answering",
|
|
@@ -1729,467 +674,471 @@ const Cs = { class: "container" }, As = { class: "message ai-message greet-messa
|
|
|
1729
674
|
COMPLETED: "completed",
|
|
1730
675
|
STOP: "stop",
|
|
1731
676
|
ERROR: "error"
|
|
1732
|
-
},
|
|
1733
|
-
() =>
|
|
677
|
+
}, u = t, i = vt(), s = T([]), C = T(""), o = T(!1), h = T(""), c = T(""), l = T(null), r = K({ text1: "", text2: "" }), R = T([]), L = T(0), Q = et(
|
|
678
|
+
() => R.value[L.value % (R.value.length || 1)]
|
|
1734
679
|
);
|
|
1735
|
-
function
|
|
1736
|
-
|
|
680
|
+
function D() {
|
|
681
|
+
L.value++;
|
|
1737
682
|
}
|
|
1738
|
-
function
|
|
1739
|
-
|
|
683
|
+
function B(W) {
|
|
684
|
+
C.value = W;
|
|
1740
685
|
}
|
|
1741
|
-
const { isAtBottom:
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
), { doStreamRequest:
|
|
1746
|
-
messages:
|
|
1747
|
-
isGenerating:
|
|
1748
|
-
lastUserMessage:
|
|
1749
|
-
batchMessagesUpdate:
|
|
1750
|
-
flushMessagesBatch:
|
|
1751
|
-
STATUS:
|
|
1752
|
-
cfg:
|
|
1753
|
-
}), { sendMessage:
|
|
1754
|
-
messages:
|
|
1755
|
-
userInput:
|
|
1756
|
-
isGenerating:
|
|
1757
|
-
lastUserMessage:
|
|
1758
|
-
conversationId:
|
|
1759
|
-
doStreamRequest:
|
|
1760
|
-
issTop:
|
|
1761
|
-
scrollToBottom:
|
|
1762
|
-
STATUS:
|
|
1763
|
-
cfg:
|
|
686
|
+
const { isAtBottom: e, hasScroll: d, scrollToBottom: O, checkScrollStatus: A } = we(l), { enhanceCodeBlocks: k } = Ce(), { batchMessagesUpdate: P, flushMessagesBatch: N } = Ae(s), { displayedContent: b, streamingIndexRef: m, startTypewriter: w, stopTypewriter: p, getSegmentDisplayContent: S } = be(
|
|
687
|
+
s,
|
|
688
|
+
O,
|
|
689
|
+
a.ANSWERING
|
|
690
|
+
), { doStreamRequest: H, issTop: $ } = Se({
|
|
691
|
+
messages: s,
|
|
692
|
+
isGenerating: o,
|
|
693
|
+
lastUserMessage: h,
|
|
694
|
+
batchMessagesUpdate: P,
|
|
695
|
+
flushMessagesBatch: N,
|
|
696
|
+
STATUS: a,
|
|
697
|
+
cfg: i
|
|
698
|
+
}), { sendMessage: V, regenerateResponse: Z, toggleStop: dt, goHistoryMessage: lt, initConversation: f } = Te({
|
|
699
|
+
messages: s,
|
|
700
|
+
userInput: C,
|
|
701
|
+
isGenerating: o,
|
|
702
|
+
lastUserMessage: h,
|
|
703
|
+
conversationId: c,
|
|
704
|
+
doStreamRequest: H,
|
|
705
|
+
issTop: $,
|
|
706
|
+
scrollToBottom: O,
|
|
707
|
+
STATUS: a,
|
|
708
|
+
cfg: i
|
|
1764
709
|
});
|
|
1765
|
-
function
|
|
1766
|
-
|
|
710
|
+
function E() {
|
|
711
|
+
s.value = [], h.value = "", f();
|
|
1767
712
|
}
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
const
|
|
1771
|
-
function
|
|
1772
|
-
|
|
713
|
+
const _ = et(() => !!c.value && s.value.length === 0);
|
|
714
|
+
v({ goHistoryMessage: lt, createNewConversation: E, isEmptyConversation: _ });
|
|
715
|
+
const J = T(/* @__PURE__ */ new Map());
|
|
716
|
+
function ct(W, G) {
|
|
717
|
+
W ? J.value.set(G, W) : J.value.delete(G);
|
|
1773
718
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
}),
|
|
1779
|
-
|
|
719
|
+
wt(s, () => {
|
|
720
|
+
ut(() => {
|
|
721
|
+
s.value.forEach((W, G) => {
|
|
722
|
+
W.type === "ai" && W.status !== a.ANSWERING && (b.set(G, W.content), m.value.set(G, W.content.length));
|
|
723
|
+
}), w(), J.value.forEach((W) => {
|
|
724
|
+
k(W);
|
|
1780
725
|
});
|
|
1781
726
|
});
|
|
1782
727
|
}, { deep: !0 });
|
|
1783
|
-
let
|
|
1784
|
-
return
|
|
1785
|
-
|
|
1786
|
-
}),
|
|
1787
|
-
|
|
1788
|
-
}),
|
|
1789
|
-
|
|
728
|
+
let I = null;
|
|
729
|
+
return q(() => {
|
|
730
|
+
u.defaultSayhello && (r.text1 = u.defaultSayhello.text1, r.text2 = u.defaultSayhello.text2), u.defaultRecommend && (R.value = Qt(u.defaultRecommend));
|
|
731
|
+
}), q(() => {
|
|
732
|
+
f();
|
|
733
|
+
}), q(() => {
|
|
734
|
+
l.value && (I = () => A(), l.value.addEventListener("scroll", I));
|
|
1790
735
|
}), mt(() => {
|
|
1791
|
-
|
|
1792
|
-
}), (
|
|
1793
|
-
var
|
|
1794
|
-
return
|
|
1795
|
-
|
|
736
|
+
p(), l.value && I && l.value.removeEventListener("scroll", I);
|
|
737
|
+
}), (W, G) => {
|
|
738
|
+
var ht;
|
|
739
|
+
return g(), y("div", De, [
|
|
740
|
+
n("div", {
|
|
1796
741
|
class: "chat-box scrollWrap",
|
|
1797
742
|
ref_key: "chatBoxRef",
|
|
1798
|
-
ref:
|
|
743
|
+
ref: l
|
|
1799
744
|
}, [
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
745
|
+
n("div", Me, [
|
|
746
|
+
n("div", Oe, [
|
|
747
|
+
n("h1", null, X(r.text1), 1),
|
|
748
|
+
n("p", null, X(r.text2), 1)
|
|
1804
749
|
])
|
|
1805
750
|
]),
|
|
1806
|
-
(
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
751
|
+
(ht = Q.value) != null && ht.length ? (g(), y("div", He, [
|
|
752
|
+
n("div", Pe, [
|
|
753
|
+
n("div", $e, [
|
|
754
|
+
G[2] || (G[2] = n("span", null, "你可以尝试这样问我:", -1)),
|
|
755
|
+
n("p", {
|
|
1811
756
|
class: "refresh-btn",
|
|
1812
|
-
onClick:
|
|
757
|
+
onClick: D
|
|
1813
758
|
}, [
|
|
1814
|
-
|
|
1815
|
-
|
|
759
|
+
n("img", { src: M(zt) }, null, 8, Le),
|
|
760
|
+
G[1] || (G[1] = n("span", null, "换一换", -1))
|
|
1816
761
|
])
|
|
1817
762
|
]),
|
|
1818
|
-
|
|
1819
|
-
(
|
|
1820
|
-
key:
|
|
1821
|
-
onClick: (
|
|
1822
|
-
},
|
|
763
|
+
n("ul", null, [
|
|
764
|
+
(g(!0), y(z, null, at(Q.value, (tt, rt) => (g(), y("li", {
|
|
765
|
+
key: rt,
|
|
766
|
+
onClick: (bn) => B(tt)
|
|
767
|
+
}, X(tt), 9, Be))), 128))
|
|
1823
768
|
])
|
|
1824
769
|
])
|
|
1825
|
-
])) :
|
|
1826
|
-
(
|
|
1827
|
-
key:
|
|
770
|
+
])) : Y("", !0),
|
|
771
|
+
(g(!0), y(z, null, at(s.value, (tt, rt) => (g(), j(ge, {
|
|
772
|
+
key: rt,
|
|
1828
773
|
msg: tt,
|
|
1829
|
-
index:
|
|
1830
|
-
STATUS:
|
|
1831
|
-
displayedContent:
|
|
1832
|
-
getSegmentDisplayContent:
|
|
1833
|
-
setMessageRef:
|
|
1834
|
-
onRegenerate:
|
|
774
|
+
index: rt,
|
|
775
|
+
STATUS: a,
|
|
776
|
+
displayedContent: M(b),
|
|
777
|
+
getSegmentDisplayContent: M(S),
|
|
778
|
+
setMessageRef: ct,
|
|
779
|
+
onRegenerate: M(Z)
|
|
1835
780
|
}, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
|
|
1836
781
|
], 512),
|
|
1837
|
-
|
|
1838
|
-
modelValue:
|
|
1839
|
-
"onUpdate:modelValue":
|
|
1840
|
-
isGenerating:
|
|
1841
|
-
lastUserMessage:
|
|
1842
|
-
hasScroll:
|
|
1843
|
-
isAtBottom:
|
|
1844
|
-
onSend:
|
|
1845
|
-
onRegenerate:
|
|
1846
|
-
onStop:
|
|
1847
|
-
onScrollToBottom:
|
|
782
|
+
F(ke, {
|
|
783
|
+
modelValue: C.value,
|
|
784
|
+
"onUpdate:modelValue": G[0] || (G[0] = (tt) => C.value = tt),
|
|
785
|
+
isGenerating: o.value,
|
|
786
|
+
lastUserMessage: h.value,
|
|
787
|
+
hasScroll: M(d),
|
|
788
|
+
isAtBottom: M(e),
|
|
789
|
+
onSend: M(V),
|
|
790
|
+
onRegenerate: M(Z),
|
|
791
|
+
onStop: M(dt),
|
|
792
|
+
onScrollToBottom: M(O)
|
|
1848
793
|
}, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"])
|
|
1849
794
|
]);
|
|
1850
795
|
};
|
|
1851
796
|
}
|
|
1852
|
-
}),
|
|
797
|
+
}), Ye = { class: "ai-history" }, Qe = { class: "content" }, _e = { key: 0 }, Xe = ["onClick"], We = { class: "info-pic" }, Ge = { class: "info-content" }, Ve = { class: "info-content-title" }, Je = { class: "info-content-time" }, Fe = ["onClick"], Ue = ["src"], je = { class: "ai-modal" }, qe = { class: "ai-modal-footer" }, xe = /* @__PURE__ */ nt({
|
|
1853
798
|
__name: "History",
|
|
1854
799
|
emits: ["history-detail", "new-answer"],
|
|
1855
|
-
setup(t, { emit:
|
|
1856
|
-
const
|
|
1857
|
-
async function
|
|
800
|
+
setup(t, { emit: v }) {
|
|
801
|
+
const u = vt().apis, i = T([]), s = T(!1), C = T("");
|
|
802
|
+
async function o() {
|
|
1858
803
|
try {
|
|
1859
|
-
const
|
|
1860
|
-
|
|
1861
|
-
} catch (
|
|
1862
|
-
|
|
804
|
+
const l = await _t(u);
|
|
805
|
+
l != null && l.conversationList && (i.value = l.conversationList.filter((r) => r !== null).map((r) => ({ ...r, selected: !1 })));
|
|
806
|
+
} catch (l) {
|
|
807
|
+
it((l == null ? void 0 : l.message) || "获取历史记录失败");
|
|
1863
808
|
}
|
|
1864
809
|
}
|
|
1865
|
-
function
|
|
1866
|
-
|
|
810
|
+
function h(l) {
|
|
811
|
+
C.value = l, s.value = !0;
|
|
1867
812
|
}
|
|
1868
|
-
async function
|
|
1869
|
-
|
|
813
|
+
async function c() {
|
|
814
|
+
s.value = !1;
|
|
1870
815
|
try {
|
|
1871
|
-
await
|
|
1872
|
-
} catch (
|
|
1873
|
-
|
|
816
|
+
await Xt(u, C.value), await o();
|
|
817
|
+
} catch (l) {
|
|
818
|
+
it((l == null ? void 0 : l.message) || "删除失败"), await o();
|
|
1874
819
|
}
|
|
1875
820
|
}
|
|
1876
|
-
return
|
|
1877
|
-
|
|
1878
|
-
}), (
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
(
|
|
1882
|
-
key:
|
|
821
|
+
return q(() => {
|
|
822
|
+
o();
|
|
823
|
+
}), (l, r) => (g(), y("div", Ye, [
|
|
824
|
+
n("div", Qe, [
|
|
825
|
+
i.value.length > 0 ? (g(), y("div", _e, [
|
|
826
|
+
(g(!0), y(z, null, at(i.value, (R) => (g(), y("div", {
|
|
827
|
+
key: R.appConversationID,
|
|
1883
828
|
class: "info",
|
|
1884
|
-
onClick: (
|
|
829
|
+
onClick: (L) => l.$emit("history-detail", R.appConversationID)
|
|
1885
830
|
}, [
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
831
|
+
n("div", We, X(R.conversationName.slice(0, 1)), 1),
|
|
832
|
+
n("div", Ge, [
|
|
833
|
+
n("div", Ve, X(R.conversationName), 1),
|
|
834
|
+
n("div", Je, X(R.createTime), 1)
|
|
1890
835
|
]),
|
|
1891
|
-
|
|
836
|
+
n("div", {
|
|
1892
837
|
class: "clear-history",
|
|
1893
|
-
onClick:
|
|
1894
|
-
}, "删除", 8,
|
|
1895
|
-
], 8,
|
|
1896
|
-
])) :
|
|
838
|
+
onClick: ft((L) => h(R.appConversationID), ["stop"])
|
|
839
|
+
}, "删除", 8, Fe)
|
|
840
|
+
], 8, Xe))), 128))
|
|
841
|
+
])) : Y("", !0)
|
|
1897
842
|
]),
|
|
1898
|
-
|
|
843
|
+
n("div", {
|
|
1899
844
|
class: "ai-add",
|
|
1900
|
-
onClick:
|
|
845
|
+
onClick: r[0] || (r[0] = (R) => l.$emit("new-answer"))
|
|
1901
846
|
}, [
|
|
1902
|
-
|
|
1903
|
-
|
|
847
|
+
n("img", { src: M(jt) }, null, 8, Ue),
|
|
848
|
+
r[3] || (r[3] = n("span", { style: { color: "#333333" } }, "新建AI对话", -1))
|
|
1904
849
|
]),
|
|
1905
|
-
(
|
|
1906
|
-
|
|
850
|
+
(g(), j(Tt, { to: "body" }, [
|
|
851
|
+
s.value ? (g(), y("div", {
|
|
1907
852
|
key: 0,
|
|
1908
853
|
class: "ai-modal-overlay",
|
|
1909
|
-
onClick:
|
|
854
|
+
onClick: r[2] || (r[2] = ft((R) => s.value = !1, ["self"]))
|
|
1910
855
|
}, [
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
856
|
+
n("div", je, [
|
|
857
|
+
r[4] || (r[4] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
|
|
858
|
+
r[5] || (r[5] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
|
|
859
|
+
n("div", qe, [
|
|
860
|
+
n("button", {
|
|
1916
861
|
class: "ai-modal-btn cancel",
|
|
1917
|
-
onClick:
|
|
862
|
+
onClick: r[1] || (r[1] = (R) => s.value = !1)
|
|
1918
863
|
}, "取消"),
|
|
1919
|
-
|
|
864
|
+
n("button", {
|
|
1920
865
|
class: "ai-modal-btn confirm",
|
|
1921
|
-
onClick:
|
|
866
|
+
onClick: c
|
|
1922
867
|
}, "确定")
|
|
1923
868
|
])
|
|
1924
869
|
])
|
|
1925
|
-
])) :
|
|
870
|
+
])) : Y("", !0)
|
|
1926
871
|
]))
|
|
1927
872
|
]));
|
|
1928
873
|
}
|
|
1929
|
-
}),
|
|
1930
|
-
const
|
|
1931
|
-
for (const [
|
|
1932
|
-
|
|
1933
|
-
return
|
|
1934
|
-
},
|
|
874
|
+
}), ze = (t, v) => {
|
|
875
|
+
const a = t.__vccOpts || t;
|
|
876
|
+
for (const [u, i] of v)
|
|
877
|
+
a[u] = i;
|
|
878
|
+
return a;
|
|
879
|
+
}, Ke = /* @__PURE__ */ ze(xe, [["__scopeId", "data-v-9267d81a"]]), Ze = { class: "container info" }, Ie = { class: "info-item" }, tn = { class: "basic-content" }, en = { class: "basic-content-text" }, nn = { class: "basic-content" }, sn = { class: "basic-content-text" }, on = { class: "info-item" }, an = { class: "permission-content" }, ln = { class: "info-item" }, cn = { class: "basic-content" }, rn = { class: "basic-content-text" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = /* @__PURE__ */ nt({
|
|
1935
880
|
__name: "Info",
|
|
1936
881
|
setup(t) {
|
|
1937
|
-
const
|
|
1938
|
-
return
|
|
882
|
+
const v = vt(), a = T(null);
|
|
883
|
+
return q(async () => {
|
|
1939
884
|
try {
|
|
1940
|
-
|
|
1941
|
-
} catch (
|
|
1942
|
-
|
|
885
|
+
a.value = await Wt(v.apis);
|
|
886
|
+
} catch (u) {
|
|
887
|
+
it((u == null ? void 0 : u.message) || "获取个人信息失败");
|
|
1943
888
|
}
|
|
1944
|
-
}), (
|
|
1945
|
-
var
|
|
1946
|
-
return
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
889
|
+
}), (u, i) => {
|
|
890
|
+
var s, C, o, h, c;
|
|
891
|
+
return g(), y("div", Ze, [
|
|
892
|
+
n("div", Ie, [
|
|
893
|
+
i[2] || (i[2] = n("div", { class: "heading" }, [
|
|
894
|
+
n("div", { class: "heading-column" }),
|
|
895
|
+
n("div", { class: "heading-title" }, "基本信息")
|
|
1951
896
|
], -1)),
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
897
|
+
n("div", tn, [
|
|
898
|
+
i[0] || (i[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
|
|
899
|
+
n("div", en, X(((s = a.value) == null ? void 0 : s.name) || ""), 1)
|
|
1955
900
|
]),
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
901
|
+
n("div", nn, [
|
|
902
|
+
i[1] || (i[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
|
|
903
|
+
n("div", sn, X(((C = a.value) == null ? void 0 : C.userName) || ""), 1)
|
|
1959
904
|
])
|
|
1960
905
|
]),
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
906
|
+
n("div", on, [
|
|
907
|
+
i[3] || (i[3] = n("div", { class: "heading" }, [
|
|
908
|
+
n("div", { class: "heading-column" }),
|
|
909
|
+
n("div", { class: "heading-title" }, "数据权限")
|
|
1965
910
|
], -1)),
|
|
1966
|
-
|
|
1967
|
-
(
|
|
1968
|
-
key:
|
|
911
|
+
n("div", an, [
|
|
912
|
+
(g(!0), y(z, null, at((o = a.value) == null ? void 0 : o.ptnameList, (l, r) => (g(), y("div", {
|
|
913
|
+
key: r,
|
|
1969
914
|
class: "permission-content-text"
|
|
1970
|
-
},
|
|
915
|
+
}, X(l), 1))), 128))
|
|
1971
916
|
])
|
|
1972
917
|
]),
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
918
|
+
n("div", ln, [
|
|
919
|
+
i[6] || (i[6] = n("div", { class: "heading" }, [
|
|
920
|
+
n("div", { class: "heading-column" }),
|
|
921
|
+
n("div", { class: "heading-title" }, "帮助信息")
|
|
1977
922
|
], -1)),
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
923
|
+
n("div", cn, [
|
|
924
|
+
i[4] || (i[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
|
|
925
|
+
n("div", rn, X(((h = a.value) == null ? void 0 : h.dept) || ""), 1)
|
|
1981
926
|
]),
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
927
|
+
n("div", un, [
|
|
928
|
+
i[5] || (i[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
|
|
929
|
+
n("div", vn, X(((c = a.value) == null ? void 0 : c.email) || ""), 1)
|
|
1985
930
|
])
|
|
1986
931
|
])
|
|
1987
932
|
]);
|
|
1988
933
|
};
|
|
1989
934
|
}
|
|
1990
|
-
}),
|
|
935
|
+
}), gn = { class: "header" }, mn = { key: 1 }, hn = ["src"], fn = { class: "header-title" }, pn = { class: "setTitle" }, yn = { class: "content" }, kn = { class: "main" }, wn = { class: "btn" }, Cn = ["src"], An = 117, st = 118, At = /* @__PURE__ */ nt({
|
|
1991
936
|
__name: "AiAssist",
|
|
1992
937
|
setup(t) {
|
|
1993
|
-
const
|
|
1994
|
-
x: window.innerWidth -
|
|
1995
|
-
y: window.innerHeight / 2 -
|
|
1996
|
-
}),
|
|
1997
|
-
let
|
|
1998
|
-
const
|
|
1999
|
-
const
|
|
2000
|
-
return
|
|
2001
|
-
}),
|
|
2002
|
-
var
|
|
2003
|
-
return !((
|
|
2004
|
-
}),
|
|
2005
|
-
left: `${
|
|
2006
|
-
top: `${
|
|
2007
|
-
transition:
|
|
2008
|
-
"--direction": String(
|
|
938
|
+
const v = An / 2, a = vt(), u = T(!1), i = T(!1), s = T("answer"), C = T(!1), o = T(""), h = T(""), c = K({
|
|
939
|
+
x: window.innerWidth - v,
|
|
940
|
+
y: window.innerHeight / 2 - st / 2
|
|
941
|
+
}), l = T(!1), r = T(!1), R = T("right"), L = T("left"), Q = K({ x: 0, y: 0 }), D = T(!1), B = T(null);
|
|
942
|
+
let e = null;
|
|
943
|
+
const d = et(() => {
|
|
944
|
+
const f = window.innerWidth / 2;
|
|
945
|
+
return c.x + v < f ? 5 : -5;
|
|
946
|
+
}), O = et(() => i.value ? "" : `panel-${R.value}`), A = et(() => {
|
|
947
|
+
var f;
|
|
948
|
+
return !((f = B.value) != null && f.isEmptyConversation);
|
|
949
|
+
}), k = et(() => ({
|
|
950
|
+
left: `${c.x}px`,
|
|
951
|
+
top: `${c.y}px`,
|
|
952
|
+
transition: l.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
953
|
+
"--direction": String(d.value)
|
|
2009
954
|
}));
|
|
2010
|
-
function
|
|
2011
|
-
const
|
|
2012
|
-
|
|
955
|
+
function P() {
|
|
956
|
+
const f = window.innerWidth / 2;
|
|
957
|
+
c.x + v < f ? (R.value = "left", L.value = "right") : (R.value = "right", L.value = "left");
|
|
2013
958
|
}
|
|
2014
|
-
function
|
|
2015
|
-
const
|
|
2016
|
-
return { x:
|
|
959
|
+
function N() {
|
|
960
|
+
const f = window.innerWidth, E = Math.max(0, Math.min(c.y, window.innerHeight - st));
|
|
961
|
+
return { x: c.x + v >= f / 2 ? f - v : -v, y: E };
|
|
2017
962
|
}
|
|
2018
|
-
function
|
|
2019
|
-
|
|
2020
|
-
const
|
|
2021
|
-
|
|
2022
|
-
|
|
963
|
+
function b() {
|
|
964
|
+
r.value = !0;
|
|
965
|
+
const f = N();
|
|
966
|
+
c.x = f.x, c.y = f.y, setTimeout(() => {
|
|
967
|
+
r.value = !1, P(), m();
|
|
2023
968
|
}, 400);
|
|
2024
969
|
}
|
|
2025
|
-
function
|
|
970
|
+
function m() {
|
|
2026
971
|
try {
|
|
2027
|
-
localStorage.setItem("characterPosition", JSON.stringify({ x:
|
|
972
|
+
localStorage.setItem("characterPosition", JSON.stringify({ x: c.x, y: c.y })), localStorage.setItem("panelPosition", R.value), localStorage.setItem("backPosition", L.value);
|
|
2028
973
|
} catch {
|
|
2029
974
|
}
|
|
2030
975
|
}
|
|
2031
|
-
function
|
|
2032
|
-
const
|
|
2033
|
-
if (
|
|
2034
|
-
const
|
|
2035
|
-
|
|
976
|
+
function w() {
|
|
977
|
+
const f = localStorage.getItem("characterPosition");
|
|
978
|
+
if (f) {
|
|
979
|
+
const J = JSON.parse(f);
|
|
980
|
+
c.x = J.x, c.y = Math.min(Math.max(J.y, 0), window.innerHeight - st);
|
|
2036
981
|
} else
|
|
2037
|
-
|
|
2038
|
-
const
|
|
2039
|
-
|
|
982
|
+
c.x = window.innerWidth - v, c.y = window.innerHeight / 2 - st / 2;
|
|
983
|
+
const E = localStorage.getItem("panelPosition"), _ = localStorage.getItem("backPosition");
|
|
984
|
+
E && (R.value = E), _ && (L.value = _);
|
|
2040
985
|
}
|
|
2041
|
-
function
|
|
2042
|
-
if (!
|
|
2043
|
-
const
|
|
2044
|
-
|
|
986
|
+
function p(f) {
|
|
987
|
+
if (!l.value) return;
|
|
988
|
+
const E = "touches" in f ? f.touches[0].clientX : f.clientX, _ = "touches" in f ? f.touches[0].clientY : f.clientY, J = E - Q.x, ct = Math.max(0, Math.min(_ - Q.y, window.innerHeight - st)), I = Math.abs(J - c.x), W = Math.abs(ct - c.y);
|
|
989
|
+
I + W > 5 && (D.value = !0), c.x = J, c.y = ct;
|
|
2045
990
|
}
|
|
2046
|
-
function
|
|
2047
|
-
|
|
991
|
+
function S() {
|
|
992
|
+
l.value && (l.value = !1, D.value && (b(), D.value = !1));
|
|
2048
993
|
}
|
|
2049
|
-
function
|
|
2050
|
-
|
|
2051
|
-
const
|
|
2052
|
-
|
|
994
|
+
function H(f) {
|
|
995
|
+
r.value = !1, l.value = !0, D.value = !1;
|
|
996
|
+
const E = "touches" in f ? f.touches[0].clientX : f.clientX, _ = "touches" in f ? f.touches[0].clientY : f.clientY;
|
|
997
|
+
Q.x = E - c.x, Q.y = _ - c.y;
|
|
2053
998
|
}
|
|
2054
|
-
function
|
|
2055
|
-
!
|
|
999
|
+
function $() {
|
|
1000
|
+
!D.value && !r.value ? (P(), u.value = !0) : D.value = !1;
|
|
2056
1001
|
}
|
|
2057
|
-
function
|
|
2058
|
-
|
|
2059
|
-
var
|
|
2060
|
-
(
|
|
1002
|
+
function V(f) {
|
|
1003
|
+
s.value = "answer", ut(() => {
|
|
1004
|
+
var E;
|
|
1005
|
+
(E = B.value) == null || E.goHistoryMessage(f);
|
|
2061
1006
|
});
|
|
2062
1007
|
}
|
|
2063
|
-
function
|
|
2064
|
-
|
|
2065
|
-
var
|
|
2066
|
-
(
|
|
1008
|
+
function Z() {
|
|
1009
|
+
s.value = "answer", ut(() => {
|
|
1010
|
+
var f;
|
|
1011
|
+
(f = B.value) == null || f.createNewConversation();
|
|
2067
1012
|
});
|
|
2068
1013
|
}
|
|
2069
|
-
function
|
|
2070
|
-
|
|
1014
|
+
function dt() {
|
|
1015
|
+
h.value = o.value, C.value = !1;
|
|
2071
1016
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
}),
|
|
2075
|
-
|
|
1017
|
+
wt(i, (f) => {
|
|
1018
|
+
f ? R.value = "center" : P();
|
|
1019
|
+
}), q(() => {
|
|
1020
|
+
w();
|
|
2076
1021
|
});
|
|
2077
|
-
function
|
|
2078
|
-
|
|
1022
|
+
function lt() {
|
|
1023
|
+
e && clearTimeout(e), e = setTimeout(() => b(), 100);
|
|
2079
1024
|
}
|
|
2080
|
-
return
|
|
2081
|
-
window.addEventListener("resize",
|
|
1025
|
+
return q(() => {
|
|
1026
|
+
window.addEventListener("resize", lt);
|
|
2082
1027
|
}), mt(() => {
|
|
2083
|
-
window.removeEventListener("resize",
|
|
2084
|
-
}),
|
|
2085
|
-
document.addEventListener("mousemove",
|
|
1028
|
+
window.removeEventListener("resize", lt), e && clearTimeout(e);
|
|
1029
|
+
}), q(() => {
|
|
1030
|
+
document.addEventListener("mousemove", p), document.addEventListener("touchmove", p, { passive: !0 }), document.addEventListener("mouseup", S), document.addEventListener("touchend", S);
|
|
2086
1031
|
}), mt(() => {
|
|
2087
|
-
document.removeEventListener("mousemove",
|
|
2088
|
-
}), (
|
|
2089
|
-
|
|
1032
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("touchmove", p), document.removeEventListener("mouseup", S), document.removeEventListener("touchend", S);
|
|
1033
|
+
}), (f, E) => (g(), y("div", null, [
|
|
1034
|
+
u.value ? (g(), y("div", {
|
|
2090
1035
|
key: 0,
|
|
2091
|
-
class:
|
|
1036
|
+
class: U(["ai-panel", i.value ? "maxWrap" : "minWrap", O.value])
|
|
2092
1037
|
}, [
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
]),
|
|
2106
|
-
h("div", lo, [
|
|
2107
|
-
h("span", null, B(i.value === "info" ? "个人信息" : i.value === "history" ? "历史信息" : N(e).name), 1)
|
|
1038
|
+
n("div", gn, [
|
|
1039
|
+
s.value === "info" || s.value === "history" ? (g(), y("span", {
|
|
1040
|
+
key: 0,
|
|
1041
|
+
class: U(["back", L.value]),
|
|
1042
|
+
onClick: E[0] || (E[0] = (_) => s.value = "answer")
|
|
1043
|
+
}, [...E[7] || (E[7] = [
|
|
1044
|
+
n("span", { style: { "font-size": "14px" } }, "←", -1)
|
|
1045
|
+
])], 2)) : (g(), y("p", mn, [
|
|
1046
|
+
n("img", { src: M(qt) }, null, 8, hn)
|
|
1047
|
+
])),
|
|
1048
|
+
n("div", fn, [
|
|
1049
|
+
n("span", null, X(s.value === "info" ? "个人信息" : s.value === "history" ? "历史信息" : M(a).name), 1)
|
|
2108
1050
|
]),
|
|
2109
|
-
|
|
2110
|
-
|
|
1051
|
+
n("p", null, [
|
|
1052
|
+
gt(F(M(x), {
|
|
2111
1053
|
class: "op-icon",
|
|
2112
|
-
|
|
1054
|
+
icon: "humbleicons:plus",
|
|
1055
|
+
onClick: Z
|
|
2113
1056
|
}, null, 512), [
|
|
2114
|
-
[
|
|
1057
|
+
[pt, A.value]
|
|
2115
1058
|
]),
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
1059
|
+
s.value !== "history" ? (g(), j(M(x), {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
class: "mute",
|
|
1062
|
+
icon: "humbleicons:history",
|
|
1063
|
+
onClick: E[1] || (E[1] = (_) => s.value = "history")
|
|
1064
|
+
})) : Y("", !0),
|
|
1065
|
+
F(M(x), {
|
|
1066
|
+
onClick: E[2] || (E[2] = (_) => i.value = !i.value),
|
|
1067
|
+
icon: i.value ? "humbleicons:align-objects-right" : "humbleicons:arrows-horizontal"
|
|
1068
|
+
}, null, 8, ["icon"]),
|
|
1069
|
+
F(M(x), {
|
|
1070
|
+
onClick: E[3] || (E[3] = (_) => u.value = !1),
|
|
1071
|
+
icon: "humbleicons:times"
|
|
1072
|
+
})
|
|
2124
1073
|
])
|
|
2125
1074
|
]),
|
|
2126
|
-
|
|
1075
|
+
s.value === "answer" ? (g(), j(Ne, {
|
|
2127
1076
|
key: 0,
|
|
2128
1077
|
ref_key: "answerRef",
|
|
2129
|
-
ref:
|
|
2130
|
-
defaultSayhello:
|
|
2131
|
-
defaultRecommend:
|
|
2132
|
-
}, null, 8, ["defaultSayhello", "defaultRecommend"])) :
|
|
2133
|
-
|
|
1078
|
+
ref: B,
|
|
1079
|
+
defaultSayhello: M(a).defaultSayhello,
|
|
1080
|
+
defaultRecommend: M(a).defaultRecommend
|
|
1081
|
+
}, null, 8, ["defaultSayhello", "defaultRecommend"])) : Y("", !0),
|
|
1082
|
+
s.value === "history" ? (g(), j(Ke, {
|
|
2134
1083
|
key: 1,
|
|
2135
|
-
onHistoryDetail:
|
|
2136
|
-
onNewAnswer:
|
|
2137
|
-
})) :
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
"onUpdate:modelValue":
|
|
1084
|
+
onHistoryDetail: V,
|
|
1085
|
+
onNewAnswer: E[4] || (E[4] = (_) => s.value = "answer")
|
|
1086
|
+
})) : Y("", !0),
|
|
1087
|
+
s.value === "info" ? (g(), j(dn, { key: 2 })) : Y("", !0),
|
|
1088
|
+
gt(n("div", pn, [
|
|
1089
|
+
n("div", yn, [
|
|
1090
|
+
n("div", kn, [
|
|
1091
|
+
E[8] || (E[8] = n("p", { class: "title" }, "修改标题", -1)),
|
|
1092
|
+
gt(n("textarea", {
|
|
1093
|
+
"onUpdate:modelValue": E[5] || (E[5] = (_) => o.value = _),
|
|
2145
1094
|
placeholder: "请输入新标题"
|
|
2146
1095
|
}, null, 512), [
|
|
2147
|
-
[
|
|
1096
|
+
[Dt, o.value]
|
|
2148
1097
|
]),
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
onClick:
|
|
1098
|
+
n("p", wn, [
|
|
1099
|
+
n("span", {
|
|
1100
|
+
onClick: E[6] || (E[6] = (_) => C.value = !1)
|
|
2152
1101
|
}, "取消"),
|
|
2153
|
-
|
|
1102
|
+
n("span", { onClick: dt }, "确定")
|
|
2154
1103
|
])
|
|
2155
1104
|
])
|
|
2156
1105
|
])
|
|
2157
1106
|
], 512), [
|
|
2158
|
-
[
|
|
1107
|
+
[pt, C.value]
|
|
2159
1108
|
])
|
|
2160
|
-
], 2)) :
|
|
2161
|
-
|
|
1109
|
+
], 2)) : Y("", !0),
|
|
1110
|
+
u.value ? Y("", !0) : (g(), y("div", {
|
|
2162
1111
|
key: 1,
|
|
2163
|
-
class:
|
|
2164
|
-
style:
|
|
2165
|
-
onMousedown:
|
|
2166
|
-
onTouchstart:
|
|
2167
|
-
onClick:
|
|
1112
|
+
class: U(["character", { dragging: l.value, recycling: r.value }]),
|
|
1113
|
+
style: Mt(k.value),
|
|
1114
|
+
onMousedown: H,
|
|
1115
|
+
onTouchstart: H,
|
|
1116
|
+
onClick: $
|
|
2168
1117
|
}, [
|
|
2169
|
-
|
|
1118
|
+
n("img", { src: M(xt) }, null, 8, Cn)
|
|
2170
1119
|
], 38))
|
|
2171
1120
|
]));
|
|
2172
1121
|
}
|
|
2173
1122
|
});
|
|
2174
|
-
let
|
|
2175
|
-
const
|
|
2176
|
-
|
|
2177
|
-
},
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
},
|
|
2181
|
-
|
|
1123
|
+
let ot = null;
|
|
1124
|
+
const Mn = (t) => {
|
|
1125
|
+
Ct(t);
|
|
1126
|
+
}, On = (t) => {
|
|
1127
|
+
const v = t || document.body, a = document.createElement("div");
|
|
1128
|
+
a.id = "ai-assist-root", v.appendChild(a), ot = Ot(At), ot.mount(a);
|
|
1129
|
+
}, Hn = () => {
|
|
1130
|
+
ot && (ot.unmount(), ot = null);
|
|
2182
1131
|
const t = document.getElementById("ai-assist-root");
|
|
2183
1132
|
t && t.remove();
|
|
2184
|
-
},
|
|
2185
|
-
install(t,
|
|
2186
|
-
|
|
1133
|
+
}, Pn = {
|
|
1134
|
+
install(t, v) {
|
|
1135
|
+
Ct(v), t.component("AiAssist", At);
|
|
2187
1136
|
}
|
|
2188
1137
|
};
|
|
2189
1138
|
export {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
1139
|
+
At as AiAssist,
|
|
1140
|
+
Pn as default,
|
|
1141
|
+
Mn as initAiAssist,
|
|
1142
|
+
On as mountAiAssist,
|
|
1143
|
+
Hn as unmountAiAssist
|
|
2195
1144
|
};
|