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