@ibiz-template-plugin/ai-chat 0.0.16 → 0.0.17
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/index.es.js +820 -755
- package/dist/index.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/chat-toolbar/chat-toolbar-item/chat-toolbar-item.d.ts +45 -0
- package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +7 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/types/components/{chart-minimize/chart-minimize.d.ts → chat-minimize/chat-minimize.d.ts} +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './style.css';
|
|
2
2
|
var Cn = Object.defineProperty;
|
|
3
3
|
var Tn = (n, e, t) => e in n ? Cn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
4
|
-
var
|
|
4
|
+
var x = (n, e, t) => (Tn(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
5
5
|
import He from "interactjs";
|
|
6
6
|
import Ut from "cherry-markdown";
|
|
7
|
-
var Ae, w, Wt, Vt, te,
|
|
8
|
-
function
|
|
7
|
+
var Ae, w, Wt, Vt, te, rt, qt, qe, jt, re = {}, Yt = [], xn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Ie = Array.isArray;
|
|
8
|
+
function G(n, e) {
|
|
9
9
|
for (var t in e)
|
|
10
10
|
n[t] = e[t];
|
|
11
11
|
return n;
|
|
@@ -14,26 +14,26 @@ function Xt(n) {
|
|
|
14
14
|
var e = n.parentNode;
|
|
15
15
|
e && e.removeChild(n);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
var i, s, o,
|
|
17
|
+
function j(n, e, t) {
|
|
18
|
+
var i, s, o, r = {};
|
|
19
19
|
for (o in e)
|
|
20
|
-
o == "key" ? i = e[o] : o == "ref" ? s = e[o] :
|
|
21
|
-
if (arguments.length > 2 && (
|
|
20
|
+
o == "key" ? i = e[o] : o == "ref" ? s = e[o] : r[o] = e[o];
|
|
21
|
+
if (arguments.length > 2 && (r.children = arguments.length > 3 ? Ae.call(arguments, 2) : t), typeof n == "function" && n.defaultProps != null)
|
|
22
22
|
for (o in n.defaultProps)
|
|
23
|
-
|
|
24
|
-
return Te(n,
|
|
23
|
+
r[o] === void 0 && (r[o] = n.defaultProps[o]);
|
|
24
|
+
return Te(n, r, i, s, null);
|
|
25
25
|
}
|
|
26
26
|
function Te(n, e, t, i, s) {
|
|
27
27
|
var o = { type: n, props: e, key: t, ref: i, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: s == null ? ++Wt : s };
|
|
28
28
|
return s == null && w.vnode != null && w.vnode(o), o;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function at() {
|
|
31
31
|
return { current: null };
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Y(n) {
|
|
34
34
|
return n.children;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function F(n, e) {
|
|
37
37
|
this.props = n, this.context = e;
|
|
38
38
|
}
|
|
39
39
|
function _e(n, e) {
|
|
@@ -56,19 +56,19 @@ function Zt(n) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function je(n) {
|
|
59
|
-
(!n.__d && (n.__d = !0) && te.push(n) && !ke.__r++ ||
|
|
59
|
+
(!n.__d && (n.__d = !0) && te.push(n) && !ke.__r++ || rt !== w.debounceRendering) && ((rt = w.debounceRendering) || qt)(ke);
|
|
60
60
|
}
|
|
61
61
|
function ke() {
|
|
62
|
-
var n, e, t, i, s, o,
|
|
62
|
+
var n, e, t, i, s, o, r, a, u;
|
|
63
63
|
for (te.sort(qe); n = te.shift(); )
|
|
64
|
-
n.__d && (e = te.length, i = void 0, s = void 0, o = void 0,
|
|
64
|
+
n.__d && (e = te.length, i = void 0, s = void 0, o = void 0, a = (r = (t = n).__v).__e, (u = t.__P) && (i = [], s = [], (o = G({}, r)).__v = r.__v + 1, Ke(u, r, o, t.__n, u.ownerSVGElement !== void 0, r.__h != null ? [a] : null, i, a == null ? _e(r) : a, r.__h, s), Qt(i, r, s), r.__e != a && Zt(r)), te.length > e && te.sort(qe));
|
|
65
65
|
ke.__r = 0;
|
|
66
66
|
}
|
|
67
|
-
function Gt(n, e, t, i, s, o,
|
|
68
|
-
var l, v,
|
|
69
|
-
for (t.__k = [], l = 0; l <
|
|
70
|
-
(d = t.__k[l] = (d = e[l]) == null || typeof d == "boolean" || typeof d == "function" ? null : typeof d == "string" || typeof d == "number" || typeof d == "bigint" ? Te(null, d, null, null, d) : Ie(d) ? Te(
|
|
71
|
-
for (t.__e =
|
|
67
|
+
function Gt(n, e, t, i, s, o, r, a, u, h, p) {
|
|
68
|
+
var l, v, _, d, f, m, b, g, T, C = 0, S = i && i.__k || Yt, O = S.length, I = O, U = e.length;
|
|
69
|
+
for (t.__k = [], l = 0; l < U; l++)
|
|
70
|
+
(d = t.__k[l] = (d = e[l]) == null || typeof d == "boolean" || typeof d == "function" ? null : typeof d == "string" || typeof d == "number" || typeof d == "bigint" ? Te(null, d, null, null, d) : Ie(d) ? Te(Y, { children: d }, null, null, null) : d.__b > 0 ? Te(d.type, d.props, d.key, d.ref ? d.ref : null, d.__v) : d) != null ? (d.__ = t, d.__b = t.__b + 1, (g = Sn(d, S, b = l + C, I)) === -1 ? _ = re : (_ = S[g] || re, S[g] = void 0, I--), Ke(n, d, _, s, o, r, a, u, h, p), f = d.__e, (v = d.ref) && _.ref != v && (_.ref && Qe(_.ref, null, d), p.push(v, d.__c || f, d)), f != null && (m == null && (m = f), (T = _ === re || _.__v === null) ? g == -1 && C-- : g !== b && (g === b + 1 ? C++ : g > b ? I > U - b ? C += g - b : C-- : C = g < b && g == b - 1 ? g - b : 0), b = l + C, typeof d.type != "function" || g === b && _.__k !== d.__k ? typeof d.type == "function" || g === b && !T ? d.__d !== void 0 ? (u = d.__d, d.__d = void 0) : u = f.nextSibling : u = Kt(n, f, u) : u = Jt(d, u, n), typeof t.type == "function" && (t.__d = u))) : (_ = S[l]) && _.key == null && _.__e && (_.__e == u && (_.__ = i, u = _e(_)), Ye(_, _, !1), S[l] = null);
|
|
71
|
+
for (t.__e = m, l = O; l--; )
|
|
72
72
|
S[l] != null && (typeof t.type == "function" && S[l].__e != null && S[l].__e == t.__d && (t.__d = S[l].__e.nextSibling), Ye(S[l], S[l]));
|
|
73
73
|
}
|
|
74
74
|
function Jt(n, e, t) {
|
|
@@ -85,20 +85,20 @@ function Kt(n, e, t) {
|
|
|
85
85
|
return t == null || t.parentNode !== n ? n.insertBefore(e, null) : e == t && e.parentNode != null || n.insertBefore(e, t), e.nextSibling;
|
|
86
86
|
}
|
|
87
87
|
function Sn(n, e, t, i) {
|
|
88
|
-
var s = n.key, o = n.type,
|
|
88
|
+
var s = n.key, o = n.type, r = t - 1, a = t + 1, u = e[t];
|
|
89
89
|
if (u === null || u && s == u.key && o === u.type)
|
|
90
90
|
return t;
|
|
91
91
|
if (i > (u != null ? 1 : 0))
|
|
92
|
-
for (;
|
|
93
|
-
if (
|
|
94
|
-
if ((u = e[a]) && s == u.key && o === u.type)
|
|
95
|
-
return a;
|
|
96
|
-
a--;
|
|
97
|
-
}
|
|
98
|
-
if (r < e.length) {
|
|
92
|
+
for (; r >= 0 || a < e.length; ) {
|
|
93
|
+
if (r >= 0) {
|
|
99
94
|
if ((u = e[r]) && s == u.key && o === u.type)
|
|
100
95
|
return r;
|
|
101
|
-
r
|
|
96
|
+
r--;
|
|
97
|
+
}
|
|
98
|
+
if (a < e.length) {
|
|
99
|
+
if ((u = e[a]) && s == u.key && o === u.type)
|
|
100
|
+
return a;
|
|
101
|
+
a++;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
return -1;
|
|
@@ -136,7 +136,7 @@ function Ne(n, e, t, i, s) {
|
|
|
136
136
|
try {
|
|
137
137
|
n[e] = t == null ? "" : t;
|
|
138
138
|
break e;
|
|
139
|
-
} catch (
|
|
139
|
+
} catch (r) {
|
|
140
140
|
}
|
|
141
141
|
typeof t == "function" || (t == null || t === !1 && e[4] !== "-" ? n.removeAttribute(e) : n.setAttribute(e, t));
|
|
142
142
|
}
|
|
@@ -153,30 +153,30 @@ function lt(n) {
|
|
|
153
153
|
function ut(n) {
|
|
154
154
|
return this.l[n.type + !0](w.event ? w.event(n) : n);
|
|
155
155
|
}
|
|
156
|
-
function Ke(n, e, t, i, s, o,
|
|
157
|
-
var p, l, v,
|
|
156
|
+
function Ke(n, e, t, i, s, o, r, a, u, h) {
|
|
157
|
+
var p, l, v, _, d, f, m, b, g, T, C, S, O, I, U, D = e.type;
|
|
158
158
|
if (e.constructor !== void 0)
|
|
159
159
|
return null;
|
|
160
|
-
t.__h != null && (u = t.__h,
|
|
160
|
+
t.__h != null && (u = t.__h, a = e.__e = t.__e, e.__h = null, o = [a]), (p = w.__b) && p(e);
|
|
161
161
|
e:
|
|
162
162
|
if (typeof D == "function")
|
|
163
163
|
try {
|
|
164
|
-
if (
|
|
164
|
+
if (b = e.props, g = (p = D.contextType) && i[p.__c], T = p ? g ? g.props.value : p.__ : i, t.__c ? m = (l = e.__c = t.__c).__ = l.__E : ("prototype" in D && D.prototype.render ? e.__c = l = new D(b, T) : (e.__c = l = new F(b, T), l.constructor = D, l.render = Nn), g && g.sub(l), l.props = b, l.state || (l.state = {}), l.context = T, l.__n = i, v = l.__d = !0, l.__h = [], l._sb = []), l.__s == null && (l.__s = l.state), D.getDerivedStateFromProps != null && (l.__s == l.state && (l.__s = G({}, l.__s)), G(l.__s, D.getDerivedStateFromProps(b, l.__s))), _ = l.props, d = l.state, l.__v = e, v)
|
|
165
165
|
D.getDerivedStateFromProps == null && l.componentWillMount != null && l.componentWillMount(), l.componentDidMount != null && l.__h.push(l.componentDidMount);
|
|
166
166
|
else {
|
|
167
|
-
if (D.getDerivedStateFromProps == null &&
|
|
168
|
-
for (e.__v !== t.__v && (l.props =
|
|
169
|
-
|
|
167
|
+
if (D.getDerivedStateFromProps == null && b !== _ && l.componentWillReceiveProps != null && l.componentWillReceiveProps(b, T), !l.__e && (l.shouldComponentUpdate != null && l.shouldComponentUpdate(b, l.__s, T) === !1 || e.__v === t.__v)) {
|
|
168
|
+
for (e.__v !== t.__v && (l.props = b, l.state = l.__s, l.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(be) {
|
|
169
|
+
be && (be.__ = e);
|
|
170
170
|
}), C = 0; C < l._sb.length; C++)
|
|
171
171
|
l.__h.push(l._sb[C]);
|
|
172
|
-
l._sb = [], l.__h.length &&
|
|
172
|
+
l._sb = [], l.__h.length && r.push(l);
|
|
173
173
|
break e;
|
|
174
174
|
}
|
|
175
|
-
l.componentWillUpdate != null && l.componentWillUpdate(
|
|
176
|
-
l.componentDidUpdate(
|
|
175
|
+
l.componentWillUpdate != null && l.componentWillUpdate(b, l.__s, T), l.componentDidUpdate != null && l.__h.push(function() {
|
|
176
|
+
l.componentDidUpdate(_, d, f);
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
if (l.context =
|
|
179
|
+
if (l.context = T, l.props = b, l.__P = n, l.__e = !1, S = w.__r, O = 0, "prototype" in D && D.prototype.render) {
|
|
180
180
|
for (l.state = l.__s, l.__d = !1, S && S(e), p = l.render(l.props, l.state, l.context), I = 0; I < l._sb.length; I++)
|
|
181
181
|
l.__h.push(l._sb[I]);
|
|
182
182
|
l._sb = [];
|
|
@@ -184,12 +184,12 @@ function Ke(n, e, t, i, s, o, a, r, u, h) {
|
|
|
184
184
|
do
|
|
185
185
|
l.__d = !1, S && S(e), p = l.render(l.props, l.state, l.context), l.state = l.__s;
|
|
186
186
|
while (l.__d && ++O < 25);
|
|
187
|
-
l.state = l.__s, l.getChildContext != null && (i =
|
|
188
|
-
} catch (
|
|
189
|
-
e.__v = null, (u || o != null) && (e.__e =
|
|
187
|
+
l.state = l.__s, l.getChildContext != null && (i = G(G({}, i), l.getChildContext())), v || l.getSnapshotBeforeUpdate == null || (f = l.getSnapshotBeforeUpdate(_, d)), Gt(n, Ie(U = p != null && p.type === Y && p.key == null ? p.props.children : p) ? U : [U], e, t, i, s, o, r, a, u, h), l.base = e.__e, e.__h = null, l.__h.length && r.push(l), m && (l.__E = l.__ = null);
|
|
188
|
+
} catch (be) {
|
|
189
|
+
e.__v = null, (u || o != null) && (e.__e = a, e.__h = !!u, o[o.indexOf(a)] = null), w.__e(be, e, t);
|
|
190
190
|
}
|
|
191
191
|
else
|
|
192
|
-
o == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = En(t.__e, e, t, i, s, o,
|
|
192
|
+
o == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = En(t.__e, e, t, i, s, o, r, u, h);
|
|
193
193
|
(p = w.diffed) && p(e);
|
|
194
194
|
}
|
|
195
195
|
function Qt(n, e, t) {
|
|
@@ -205,8 +205,8 @@ function Qt(n, e, t) {
|
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
function En(n, e, t, i, s, o,
|
|
209
|
-
var h, p, l, v = t.props,
|
|
208
|
+
function En(n, e, t, i, s, o, r, a, u) {
|
|
209
|
+
var h, p, l, v = t.props, _ = e.props, d = e.type, f = 0;
|
|
210
210
|
if (d === "svg" && (s = !0), o != null) {
|
|
211
211
|
for (; f < o.length; f++)
|
|
212
212
|
if ((h = o[f]) && "setAttribute" in h == !!d && (d ? h.localName === d : h.nodeType === 3)) {
|
|
@@ -216,24 +216,24 @@ function En(n, e, t, i, s, o, a, r, u) {
|
|
|
216
216
|
}
|
|
217
217
|
if (n == null) {
|
|
218
218
|
if (d === null)
|
|
219
|
-
return document.createTextNode(
|
|
220
|
-
n = s ? document.createElementNS("http://www.w3.org/2000/svg", d) : document.createElement(d,
|
|
219
|
+
return document.createTextNode(_);
|
|
220
|
+
n = s ? document.createElementNS("http://www.w3.org/2000/svg", d) : document.createElement(d, _.is && _), o = null, a = !1;
|
|
221
221
|
}
|
|
222
222
|
if (d === null)
|
|
223
|
-
v ===
|
|
223
|
+
v === _ || a && n.data === _ || (n.data = _);
|
|
224
224
|
else {
|
|
225
|
-
if (o = o && Ae.call(n.childNodes), p = (v = t.props ||
|
|
225
|
+
if (o = o && Ae.call(n.childNodes), p = (v = t.props || re).dangerouslySetInnerHTML, l = _.dangerouslySetInnerHTML, !a) {
|
|
226
226
|
if (o != null)
|
|
227
227
|
for (v = {}, f = 0; f < n.attributes.length; f++)
|
|
228
228
|
v[n.attributes[f].name] = n.attributes[f].value;
|
|
229
229
|
(l || p) && (l && (p && l.__html == p.__html || l.__html === n.innerHTML) || (n.innerHTML = l && l.__html || ""));
|
|
230
230
|
}
|
|
231
|
-
if (kn(n,
|
|
231
|
+
if (kn(n, _, v, s, a), l)
|
|
232
232
|
e.__k = [];
|
|
233
|
-
else if (Gt(n, Ie(f = e.props.children) ? f : [f], e, t, i, s && d !== "foreignObject", o,
|
|
233
|
+
else if (Gt(n, Ie(f = e.props.children) ? f : [f], e, t, i, s && d !== "foreignObject", o, r, o ? o[0] : t.__k && _e(t, 0), a, u), o != null)
|
|
234
234
|
for (f = o.length; f--; )
|
|
235
235
|
o[f] != null && Xt(o[f]);
|
|
236
|
-
|
|
236
|
+
a || ("value" in _ && (f = _.value) !== void 0 && (f !== n.value || d === "progress" && !f || d === "option" && f !== v.value) && Ne(n, "value", f, v.value, !1), "checked" in _ && (f = _.checked) !== void 0 && f !== n.checked && Ne(n, "checked", f, v.checked, !1));
|
|
237
237
|
}
|
|
238
238
|
return n;
|
|
239
239
|
}
|
|
@@ -263,9 +263,9 @@ function Ye(n, e, t) {
|
|
|
263
263
|
function Nn(n, e, t) {
|
|
264
264
|
return this.constructor(n, t);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
var i, s, o,
|
|
268
|
-
w.__ && w.__(n, e), s = (i = typeof t == "function") ? null : t && t.__k || e.__k, o = [],
|
|
266
|
+
function oe(n, e, t) {
|
|
267
|
+
var i, s, o, r;
|
|
268
|
+
w.__ && w.__(n, e), s = (i = typeof t == "function") ? null : t && t.__k || e.__k, o = [], r = [], Ke(e, n = (!i && t || e).__k = j(Y, null, [n]), s || re, re, e.ownerSVGElement !== void 0, !i && t ? [t] : s ? null : e.firstChild ? Ae.call(e.childNodes) : null, o, !i && t ? t : s ? s.__e : e.firstChild, i, r), Qt(o, n, r);
|
|
269
269
|
}
|
|
270
270
|
function Mn(n, e) {
|
|
271
271
|
var t = { __c: e = "__cC" + jt++, __: n, Consumer: function(i, s) {
|
|
@@ -274,46 +274,46 @@ function Mn(n, e) {
|
|
|
274
274
|
var s, o;
|
|
275
275
|
return this.getChildContext || (s = [], (o = {})[e] = this, this.getChildContext = function() {
|
|
276
276
|
return o;
|
|
277
|
-
}, this.shouldComponentUpdate = function(
|
|
278
|
-
this.props.value !==
|
|
279
|
-
|
|
277
|
+
}, this.shouldComponentUpdate = function(r) {
|
|
278
|
+
this.props.value !== r.value && s.some(function(a) {
|
|
279
|
+
a.__e = !0, je(a);
|
|
280
280
|
});
|
|
281
|
-
}, this.sub = function(
|
|
282
|
-
s.push(
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
s.splice(s.indexOf(
|
|
281
|
+
}, this.sub = function(r) {
|
|
282
|
+
s.push(r);
|
|
283
|
+
var a = r.componentWillUnmount;
|
|
284
|
+
r.componentWillUnmount = function() {
|
|
285
|
+
s.splice(s.indexOf(r), 1), a && a.call(r);
|
|
286
286
|
};
|
|
287
287
|
}), i.children;
|
|
288
288
|
} };
|
|
289
289
|
return t.Provider.__ = t.Consumer.contextType = t;
|
|
290
290
|
}
|
|
291
291
|
Ae = Yt.slice, w = { __e: function(n, e, t, i) {
|
|
292
|
-
for (var s, o,
|
|
292
|
+
for (var s, o, r; e = e.__; )
|
|
293
293
|
if ((s = e.__c) && !s.__)
|
|
294
294
|
try {
|
|
295
|
-
if ((o = s.constructor) && o.getDerivedStateFromError != null && (s.setState(o.getDerivedStateFromError(n)),
|
|
295
|
+
if ((o = s.constructor) && o.getDerivedStateFromError != null && (s.setState(o.getDerivedStateFromError(n)), r = s.__d), s.componentDidCatch != null && (s.componentDidCatch(n, i || {}), r = s.__d), r)
|
|
296
296
|
return s.__E = s;
|
|
297
|
-
} catch (
|
|
298
|
-
n =
|
|
297
|
+
} catch (a) {
|
|
298
|
+
n = a;
|
|
299
299
|
}
|
|
300
300
|
throw n;
|
|
301
301
|
} }, Wt = 0, Vt = function(n) {
|
|
302
302
|
return n != null && n.constructor === void 0;
|
|
303
|
-
},
|
|
303
|
+
}, F.prototype.setState = function(n, e) {
|
|
304
304
|
var t;
|
|
305
|
-
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s =
|
|
306
|
-
},
|
|
305
|
+
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = G({}, this.state), typeof n == "function" && (n = n(G({}, t), this.props)), n && G(t, n), n != null && this.__v && (e && this._sb.push(e), je(this));
|
|
306
|
+
}, F.prototype.forceUpdate = function(n) {
|
|
307
307
|
this.__v && (this.__e = !0, n && this.__h.push(n), je(this));
|
|
308
|
-
},
|
|
308
|
+
}, F.prototype.render = Y, te = [], qt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, qe = function(n, e) {
|
|
309
309
|
return n.__v.__b - e.__v.__b;
|
|
310
310
|
}, ke.__r = 0, jt = 0;
|
|
311
311
|
const $n = "ibiz", An = "is-";
|
|
312
|
-
function
|
|
312
|
+
function Q(n, e, t, i, s) {
|
|
313
313
|
let o = "".concat(n, "-").concat(e);
|
|
314
314
|
return t && (o += "-".concat(t)), i && (o += "__".concat(i)), s && (o += "--".concat(s)), o;
|
|
315
315
|
}
|
|
316
|
-
class
|
|
316
|
+
class N {
|
|
317
317
|
/**
|
|
318
318
|
* Creates an instance of Namespace.
|
|
319
319
|
*
|
|
@@ -330,7 +330,7 @@ class M {
|
|
|
330
330
|
* @date 2023-11-03 10:11:31
|
|
331
331
|
* @type {string}
|
|
332
332
|
*/
|
|
333
|
-
|
|
333
|
+
x(this, "namespace");
|
|
334
334
|
this.block = e, this.namespace = t || $n;
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
@@ -343,7 +343,7 @@ class M {
|
|
|
343
343
|
* @return {*} {string}
|
|
344
344
|
*/
|
|
345
345
|
b(e = "") {
|
|
346
|
-
return
|
|
346
|
+
return Q(this.namespace, this.block, e, "", "");
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* namespace-block__element
|
|
@@ -354,7 +354,7 @@ class M {
|
|
|
354
354
|
* @return {*} {string}
|
|
355
355
|
*/
|
|
356
356
|
e(e) {
|
|
357
|
-
return e ?
|
|
357
|
+
return e ? Q(this.namespace, this.block, "", e, "") : "";
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
360
360
|
* namespace-block--modifier
|
|
@@ -365,7 +365,7 @@ class M {
|
|
|
365
365
|
* @return {*} {string}
|
|
366
366
|
*/
|
|
367
367
|
m(e) {
|
|
368
|
-
return e ?
|
|
368
|
+
return e ? Q(this.namespace, this.block, "", "", e) : "";
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
371
|
* namespace-block-blockSuffix__element
|
|
@@ -377,7 +377,7 @@ class M {
|
|
|
377
377
|
* @return {*} {string}
|
|
378
378
|
*/
|
|
379
379
|
be(e, t) {
|
|
380
|
-
return e && t ?
|
|
380
|
+
return e && t ? Q(this.namespace, this.block, e, t, "") : "";
|
|
381
381
|
}
|
|
382
382
|
/**
|
|
383
383
|
* namespace-block__element--modifier
|
|
@@ -389,7 +389,7 @@ class M {
|
|
|
389
389
|
* @return {*} {string}
|
|
390
390
|
*/
|
|
391
391
|
em(e, t) {
|
|
392
|
-
return e && t ?
|
|
392
|
+
return e && t ? Q(this.namespace, this.block, "", e, t) : "";
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
395
|
* namespace-block-blockSuffix--modifier
|
|
@@ -401,7 +401,7 @@ class M {
|
|
|
401
401
|
* @return {*} {string}
|
|
402
402
|
*/
|
|
403
403
|
bm(e, t) {
|
|
404
|
-
return e && t ?
|
|
404
|
+
return e && t ? Q(this.namespace, this.block, e, "", t) : "";
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
407
407
|
* namespace-block-blockSuffix__element--modifier
|
|
@@ -414,7 +414,7 @@ class M {
|
|
|
414
414
|
* @return {*} {string}
|
|
415
415
|
*/
|
|
416
416
|
bem(e, t, i) {
|
|
417
|
-
return e && t && i ?
|
|
417
|
+
return e && t && i ? Q(this.namespace, this.block, e, t, i) : "";
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* 返回状态 class
|
|
@@ -482,40 +482,40 @@ class M {
|
|
|
482
482
|
return "--".concat(this.namespace, "-").concat(this.block, "-").concat(e);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function W(n) {
|
|
486
486
|
if (typeof n != "string")
|
|
487
487
|
throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
|
|
488
488
|
}
|
|
489
489
|
function dt(n, e) {
|
|
490
|
-
for (var t = "", i = 0, s = -1, o = 0,
|
|
491
|
-
if (
|
|
492
|
-
|
|
490
|
+
for (var t = "", i = 0, s = -1, o = 0, r, a = 0; a <= n.length; ++a) {
|
|
491
|
+
if (a < n.length)
|
|
492
|
+
r = n.charCodeAt(a);
|
|
493
493
|
else {
|
|
494
|
-
if (
|
|
494
|
+
if (r === 47)
|
|
495
495
|
break;
|
|
496
|
-
|
|
496
|
+
r = 47;
|
|
497
497
|
}
|
|
498
|
-
if (
|
|
499
|
-
if (!(s ===
|
|
500
|
-
if (s !==
|
|
498
|
+
if (r === 47) {
|
|
499
|
+
if (!(s === a - 1 || o === 1))
|
|
500
|
+
if (s !== a - 1 && o === 2) {
|
|
501
501
|
if (t.length < 2 || i !== 2 || t.charCodeAt(t.length - 1) !== 46 || t.charCodeAt(t.length - 2) !== 46) {
|
|
502
502
|
if (t.length > 2) {
|
|
503
503
|
var u = t.lastIndexOf("/");
|
|
504
504
|
if (u !== t.length - 1) {
|
|
505
|
-
u === -1 ? (t = "", i = 0) : (t = t.slice(0, u), i = t.length - 1 - t.lastIndexOf("/")), s =
|
|
505
|
+
u === -1 ? (t = "", i = 0) : (t = t.slice(0, u), i = t.length - 1 - t.lastIndexOf("/")), s = a, o = 0;
|
|
506
506
|
continue;
|
|
507
507
|
}
|
|
508
508
|
} else if (t.length === 2 || t.length === 1) {
|
|
509
|
-
t = "", i = 0, s =
|
|
509
|
+
t = "", i = 0, s = a, o = 0;
|
|
510
510
|
continue;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
e && (t.length > 0 ? t += "/.." : t = "..", i = 2);
|
|
514
514
|
} else
|
|
515
|
-
t.length > 0 ? t += "/" + n.slice(s + 1,
|
|
516
|
-
s =
|
|
515
|
+
t.length > 0 ? t += "/" + n.slice(s + 1, a) : t = n.slice(s + 1, a), i = a - s - 1;
|
|
516
|
+
s = a, o = 0;
|
|
517
517
|
} else
|
|
518
|
-
|
|
518
|
+
r === 46 && o !== -1 ? ++o : o = -1;
|
|
519
519
|
}
|
|
520
520
|
return t;
|
|
521
521
|
}
|
|
@@ -528,66 +528,66 @@ var fe = {
|
|
|
528
528
|
resolve: function() {
|
|
529
529
|
for (var e = "", t = !1, i, s = arguments.length - 1; s >= -1 && !t; s--) {
|
|
530
530
|
var o;
|
|
531
|
-
s >= 0 ? o = arguments[s] : (i === void 0 && (i = process.cwd()), o = i),
|
|
531
|
+
s >= 0 ? o = arguments[s] : (i === void 0 && (i = process.cwd()), o = i), W(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
|
|
532
532
|
}
|
|
533
533
|
return e = dt(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
|
|
534
534
|
},
|
|
535
535
|
normalize: function(e) {
|
|
536
|
-
if (
|
|
536
|
+
if (W(e), e.length === 0)
|
|
537
537
|
return ".";
|
|
538
538
|
var t = e.charCodeAt(0) === 47, i = e.charCodeAt(e.length - 1) === 47;
|
|
539
539
|
return e = dt(e, !t), e.length === 0 && !t && (e = "."), e.length > 0 && i && (e += "/"), t ? "/" + e : e;
|
|
540
540
|
},
|
|
541
541
|
isAbsolute: function(e) {
|
|
542
|
-
return
|
|
542
|
+
return W(e), e.length > 0 && e.charCodeAt(0) === 47;
|
|
543
543
|
},
|
|
544
544
|
join: function() {
|
|
545
545
|
if (arguments.length === 0)
|
|
546
546
|
return ".";
|
|
547
547
|
for (var e, t = 0; t < arguments.length; ++t) {
|
|
548
548
|
var i = arguments[t];
|
|
549
|
-
|
|
549
|
+
W(i), i.length > 0 && (e === void 0 ? e = i : e += "/" + i);
|
|
550
550
|
}
|
|
551
551
|
return e === void 0 ? "." : fe.normalize(e);
|
|
552
552
|
},
|
|
553
553
|
relative: function(e, t) {
|
|
554
|
-
if (
|
|
554
|
+
if (W(e), W(t), e === t || (e = fe.resolve(e), t = fe.resolve(t), e === t))
|
|
555
555
|
return "";
|
|
556
556
|
for (var i = 1; i < e.length && e.charCodeAt(i) === 47; ++i)
|
|
557
557
|
;
|
|
558
|
-
for (var s = e.length, o = s - i,
|
|
558
|
+
for (var s = e.length, o = s - i, r = 1; r < t.length && t.charCodeAt(r) === 47; ++r)
|
|
559
559
|
;
|
|
560
|
-
for (var
|
|
560
|
+
for (var a = t.length, u = a - r, h = o < u ? o : u, p = -1, l = 0; l <= h; ++l) {
|
|
561
561
|
if (l === h) {
|
|
562
562
|
if (u > h) {
|
|
563
|
-
if (t.charCodeAt(
|
|
564
|
-
return t.slice(
|
|
563
|
+
if (t.charCodeAt(r + l) === 47)
|
|
564
|
+
return t.slice(r + l + 1);
|
|
565
565
|
if (l === 0)
|
|
566
|
-
return t.slice(
|
|
566
|
+
return t.slice(r + l);
|
|
567
567
|
} else
|
|
568
568
|
o > h && (e.charCodeAt(i + l) === 47 ? p = l : l === 0 && (p = 0));
|
|
569
569
|
break;
|
|
570
570
|
}
|
|
571
|
-
var v = e.charCodeAt(i + l),
|
|
572
|
-
if (v !==
|
|
571
|
+
var v = e.charCodeAt(i + l), _ = t.charCodeAt(r + l);
|
|
572
|
+
if (v !== _)
|
|
573
573
|
break;
|
|
574
574
|
v === 47 && (p = l);
|
|
575
575
|
}
|
|
576
576
|
var d = "";
|
|
577
577
|
for (l = i + p + 1; l <= s; ++l)
|
|
578
578
|
(l === s || e.charCodeAt(l) === 47) && (d.length === 0 ? d += ".." : d += "/..");
|
|
579
|
-
return d.length > 0 ? d + t.slice(
|
|
579
|
+
return d.length > 0 ? d + t.slice(r + p) : (r += p, t.charCodeAt(r) === 47 && ++r, t.slice(r));
|
|
580
580
|
},
|
|
581
581
|
_makeLong: function(e) {
|
|
582
582
|
return e;
|
|
583
583
|
},
|
|
584
584
|
dirname: function(e) {
|
|
585
|
-
if (
|
|
585
|
+
if (W(e), e.length === 0)
|
|
586
586
|
return ".";
|
|
587
|
-
for (var t = e.charCodeAt(0), i = t === 47, s = -1, o = !0,
|
|
588
|
-
if (t = e.charCodeAt(
|
|
587
|
+
for (var t = e.charCodeAt(0), i = t === 47, s = -1, o = !0, r = e.length - 1; r >= 1; --r)
|
|
588
|
+
if (t = e.charCodeAt(r), t === 47) {
|
|
589
589
|
if (!o) {
|
|
590
|
-
s =
|
|
590
|
+
s = r;
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
593
593
|
} else
|
|
@@ -597,51 +597,51 @@ var fe = {
|
|
|
597
597
|
basename: function(e, t) {
|
|
598
598
|
if (t !== void 0 && typeof t != "string")
|
|
599
599
|
throw new TypeError('"ext" argument must be a string');
|
|
600
|
-
|
|
601
|
-
var i = 0, s = -1, o = !0,
|
|
600
|
+
W(e);
|
|
601
|
+
var i = 0, s = -1, o = !0, r;
|
|
602
602
|
if (t !== void 0 && t.length > 0 && t.length <= e.length) {
|
|
603
603
|
if (t.length === e.length && t === e)
|
|
604
604
|
return "";
|
|
605
|
-
var
|
|
606
|
-
for (
|
|
607
|
-
var h = e.charCodeAt(
|
|
605
|
+
var a = t.length - 1, u = -1;
|
|
606
|
+
for (r = e.length - 1; r >= 0; --r) {
|
|
607
|
+
var h = e.charCodeAt(r);
|
|
608
608
|
if (h === 47) {
|
|
609
609
|
if (!o) {
|
|
610
|
-
i =
|
|
610
|
+
i = r + 1;
|
|
611
611
|
break;
|
|
612
612
|
}
|
|
613
613
|
} else
|
|
614
|
-
u === -1 && (o = !1, u =
|
|
614
|
+
u === -1 && (o = !1, u = r + 1), a >= 0 && (h === t.charCodeAt(a) ? --a === -1 && (s = r) : (a = -1, s = u));
|
|
615
615
|
}
|
|
616
616
|
return i === s ? s = u : s === -1 && (s = e.length), e.slice(i, s);
|
|
617
617
|
} else {
|
|
618
|
-
for (
|
|
619
|
-
if (e.charCodeAt(
|
|
618
|
+
for (r = e.length - 1; r >= 0; --r)
|
|
619
|
+
if (e.charCodeAt(r) === 47) {
|
|
620
620
|
if (!o) {
|
|
621
|
-
i =
|
|
621
|
+
i = r + 1;
|
|
622
622
|
break;
|
|
623
623
|
}
|
|
624
624
|
} else
|
|
625
|
-
s === -1 && (o = !1, s =
|
|
625
|
+
s === -1 && (o = !1, s = r + 1);
|
|
626
626
|
return s === -1 ? "" : e.slice(i, s);
|
|
627
627
|
}
|
|
628
628
|
},
|
|
629
629
|
extname: function(e) {
|
|
630
|
-
|
|
631
|
-
for (var t = -1, i = 0, s = -1, o = !0,
|
|
632
|
-
var u = e.charCodeAt(
|
|
630
|
+
W(e);
|
|
631
|
+
for (var t = -1, i = 0, s = -1, o = !0, r = 0, a = e.length - 1; a >= 0; --a) {
|
|
632
|
+
var u = e.charCodeAt(a);
|
|
633
633
|
if (u === 47) {
|
|
634
634
|
if (!o) {
|
|
635
|
-
i =
|
|
635
|
+
i = a + 1;
|
|
636
636
|
break;
|
|
637
637
|
}
|
|
638
638
|
continue;
|
|
639
639
|
}
|
|
640
|
-
s === -1 && (o = !1, s =
|
|
640
|
+
s === -1 && (o = !1, s = a + 1), u === 46 ? t === -1 ? t = a : r !== 1 && (r = 1) : t !== -1 && (r = -1);
|
|
641
641
|
}
|
|
642
642
|
return t === -1 || s === -1 || // We saw a non-dot character immediately before the dot
|
|
643
|
-
|
|
644
|
-
|
|
643
|
+
r === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
644
|
+
r === 1 && t === s - 1 && t === i + 1 ? "" : e.slice(t, s);
|
|
645
645
|
},
|
|
646
646
|
format: function(e) {
|
|
647
647
|
if (e === null || typeof e != "object")
|
|
@@ -649,25 +649,25 @@ var fe = {
|
|
|
649
649
|
return In("/", e);
|
|
650
650
|
},
|
|
651
651
|
parse: function(e) {
|
|
652
|
-
|
|
652
|
+
W(e);
|
|
653
653
|
var t = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
654
654
|
if (e.length === 0)
|
|
655
655
|
return t;
|
|
656
656
|
var i = e.charCodeAt(0), s = i === 47, o;
|
|
657
657
|
s ? (t.root = "/", o = 1) : o = 0;
|
|
658
|
-
for (var
|
|
658
|
+
for (var r = -1, a = 0, u = -1, h = !0, p = e.length - 1, l = 0; p >= o; --p) {
|
|
659
659
|
if (i = e.charCodeAt(p), i === 47) {
|
|
660
660
|
if (!h) {
|
|
661
|
-
|
|
661
|
+
a = p + 1;
|
|
662
662
|
break;
|
|
663
663
|
}
|
|
664
664
|
continue;
|
|
665
665
|
}
|
|
666
|
-
u === -1 && (h = !1, u = p + 1), i === 46 ?
|
|
666
|
+
u === -1 && (h = !1, u = p + 1), i === 46 ? r === -1 ? r = p : l !== 1 && (l = 1) : r !== -1 && (l = -1);
|
|
667
667
|
}
|
|
668
|
-
return
|
|
668
|
+
return r === -1 || u === -1 || // We saw a non-dot character immediately before the dot
|
|
669
669
|
l === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
670
|
-
l === 1 &&
|
|
670
|
+
l === 1 && r === u - 1 && r === a + 1 ? u !== -1 && (a === 0 && s ? t.base = t.name = e.slice(1, u) : t.base = t.name = e.slice(a, u)) : (a === 0 && s ? (t.name = e.slice(1, r), t.base = e.slice(1, u)) : (t.name = e.slice(a, r), t.base = e.slice(a, u)), t.ext = e.slice(r, u)), a > 0 ? t.dir = e.slice(0, a - 1) : s && (t.dir = "/"), t;
|
|
671
671
|
},
|
|
672
672
|
sep: "/",
|
|
673
673
|
delimiter: ":",
|
|
@@ -675,11 +675,11 @@ var fe = {
|
|
|
675
675
|
posix: null
|
|
676
676
|
};
|
|
677
677
|
fe.posix = fe;
|
|
678
|
-
function
|
|
678
|
+
function Z() {
|
|
679
679
|
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
680
680
|
}
|
|
681
681
|
function et() {
|
|
682
|
-
return "".concat(
|
|
682
|
+
return "".concat(Z() + Z(), "-").concat(Z(), "-").concat(Z(), "-").concat(Z(), "-").concat(Z()).concat(Z()).concat(Z());
|
|
683
683
|
}
|
|
684
684
|
const Dn = /<svg\b[^>]*>[\s\S]*?<\/svg>/;
|
|
685
685
|
function tt(n) {
|
|
@@ -706,7 +706,7 @@ class en {
|
|
|
706
706
|
* @private
|
|
707
707
|
* @type {(HTMLInputElement | null)}
|
|
708
708
|
*/
|
|
709
|
-
|
|
709
|
+
x(en, "inputElement", null);
|
|
710
710
|
const y = class y {
|
|
711
711
|
/**
|
|
712
712
|
* 检查数据库是否存在
|
|
@@ -731,12 +731,12 @@ const y = class y {
|
|
|
731
731
|
static async deleteDatabase(e) {
|
|
732
732
|
var t, i;
|
|
733
733
|
return y.lastLink && ((i = (t = y.lastLink).close) == null || i.call(t)), new Promise((s, o) => {
|
|
734
|
-
const
|
|
735
|
-
|
|
734
|
+
const r = indexedDB.deleteDatabase(e);
|
|
735
|
+
r.onsuccess = () => {
|
|
736
736
|
s(!0);
|
|
737
|
-
},
|
|
737
|
+
}, r.onerror = () => {
|
|
738
738
|
s(!1);
|
|
739
|
-
},
|
|
739
|
+
}, r.onblocked = () => {
|
|
740
740
|
console.warn("删除数据库 ".concat(e, " 被阻塞,可能有其他连接正在使用该数据库。")), o(new Error("删除数据库 ".concat(e, " 被阻塞")));
|
|
741
741
|
};
|
|
742
742
|
});
|
|
@@ -751,15 +751,15 @@ const y = class y {
|
|
|
751
751
|
*/
|
|
752
752
|
static async checkTableExists(e, t) {
|
|
753
753
|
return await y.checkDataBaseExists(e) ? new Promise((s, o) => {
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
y.db =
|
|
757
|
-
},
|
|
758
|
-
y.db =
|
|
754
|
+
const r = indexedDB.open(e);
|
|
755
|
+
r.onupgradeneeded = (a) => {
|
|
756
|
+
y.db = a.target.result, y.version = y.db.version;
|
|
757
|
+
}, r.onsuccess = (a) => {
|
|
758
|
+
y.db = a.target.result, y.lastLink = r.result;
|
|
759
759
|
const u = y.db.objectStoreNames.contains(t);
|
|
760
|
-
|
|
761
|
-
},
|
|
762
|
-
o(
|
|
760
|
+
r.result.close(), s(u);
|
|
761
|
+
}, r.onerror = (a) => {
|
|
762
|
+
o(a.target.error);
|
|
763
763
|
};
|
|
764
764
|
}) : !1;
|
|
765
765
|
}
|
|
@@ -774,17 +774,17 @@ const y = class y {
|
|
|
774
774
|
*/
|
|
775
775
|
static async createTable(e, t, i, s = !1) {
|
|
776
776
|
return new Promise((o) => {
|
|
777
|
-
var
|
|
778
|
-
y.version += 1, y.lastLink && ((u = (
|
|
779
|
-
const
|
|
780
|
-
|
|
777
|
+
var a, u;
|
|
778
|
+
y.version += 1, y.lastLink && ((u = (a = y.lastLink).close) == null || u.call(a));
|
|
779
|
+
const r = indexedDB.open(e, y.version);
|
|
780
|
+
r.onupgradeneeded = (h) => {
|
|
781
781
|
if (y.db = h.target.result, !y.db.objectStoreNames.contains(t)) {
|
|
782
782
|
const p = {};
|
|
783
783
|
i ? p.keyPath = i : s && (p.autoIncrement = !0), y.db.createObjectStore(t, p);
|
|
784
784
|
}
|
|
785
|
-
},
|
|
786
|
-
y.lastLink =
|
|
787
|
-
},
|
|
785
|
+
}, r.onsuccess = () => {
|
|
786
|
+
y.lastLink = r.result, r.result.close(), o(!0);
|
|
787
|
+
}, r.onerror = () => {
|
|
788
788
|
o(!1);
|
|
789
789
|
};
|
|
790
790
|
});
|
|
@@ -798,13 +798,13 @@ const y = class y {
|
|
|
798
798
|
*/
|
|
799
799
|
static async deleteTable(e, t) {
|
|
800
800
|
return new Promise((i) => {
|
|
801
|
-
var o,
|
|
802
|
-
y.version += 1, y.lastLink && ((
|
|
801
|
+
var o, r;
|
|
802
|
+
y.version += 1, y.lastLink && ((r = (o = y.lastLink).close) == null || r.call(o));
|
|
803
803
|
const s = indexedDB.open(e, y.version);
|
|
804
|
-
s.onupgradeneeded = (
|
|
805
|
-
y.db =
|
|
806
|
-
}, s.onsuccess = (
|
|
807
|
-
y.db =
|
|
804
|
+
s.onupgradeneeded = (a) => {
|
|
805
|
+
y.db = a.target.result, y.lastLink = s.result, y.db.objectStoreNames.contains(t) && y.db.deleteObjectStore(t);
|
|
806
|
+
}, s.onsuccess = (a) => {
|
|
807
|
+
y.db = a.target.result, y.lastLink = s.result, s.result.close(), i(!0);
|
|
808
808
|
}, s.onerror = () => {
|
|
809
809
|
s.result.close(), i(!1);
|
|
810
810
|
};
|
|
@@ -820,9 +820,9 @@ const y = class y {
|
|
|
820
820
|
*/
|
|
821
821
|
static async addData(e, t, i) {
|
|
822
822
|
return new Promise((s, o) => {
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
if (y.db =
|
|
823
|
+
const r = indexedDB.open(e);
|
|
824
|
+
r.onsuccess = (a) => {
|
|
825
|
+
if (y.db = a.target.result, y.lastLink = r.result, y.db.objectStoreNames.contains(t)) {
|
|
826
826
|
const p = y.db.transaction([t], "readwrite").objectStore(t).add(i);
|
|
827
827
|
p.onsuccess = (l) => {
|
|
828
828
|
s(i);
|
|
@@ -830,9 +830,9 @@ const y = class y {
|
|
|
830
830
|
s(null);
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
|
|
834
|
-
},
|
|
835
|
-
|
|
833
|
+
r.result.close();
|
|
834
|
+
}, r.onerror = () => {
|
|
835
|
+
r.result.close(), o();
|
|
836
836
|
};
|
|
837
837
|
});
|
|
838
838
|
}
|
|
@@ -846,9 +846,9 @@ const y = class y {
|
|
|
846
846
|
*/
|
|
847
847
|
static async deleteData(e, t, i) {
|
|
848
848
|
return new Promise((s, o) => {
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
if (y.db =
|
|
849
|
+
const r = indexedDB.open(e);
|
|
850
|
+
r.onsuccess = (a) => {
|
|
851
|
+
if (y.db = a.target.result, y.lastLink = r.result, y.db.objectStoreNames.contains(t)) {
|
|
852
852
|
const p = y.db.transaction([t], "readwrite").objectStore(t).delete(i);
|
|
853
853
|
p.onsuccess = (l) => {
|
|
854
854
|
s(!0);
|
|
@@ -856,9 +856,9 @@ const y = class y {
|
|
|
856
856
|
s(!1);
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
|
|
860
|
-
},
|
|
861
|
-
|
|
859
|
+
r.result.close();
|
|
860
|
+
}, r.onerror = () => {
|
|
861
|
+
r.result.close(), o();
|
|
862
862
|
};
|
|
863
863
|
});
|
|
864
864
|
}
|
|
@@ -872,9 +872,9 @@ const y = class y {
|
|
|
872
872
|
*/
|
|
873
873
|
static async updateData(e, t, i) {
|
|
874
874
|
return new Promise((s, o) => {
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
if (y.db =
|
|
875
|
+
const r = indexedDB.open(e);
|
|
876
|
+
r.onsuccess = (a) => {
|
|
877
|
+
if (y.db = a.target.result, y.lastLink = r.result, y.db.objectStoreNames.contains(t)) {
|
|
878
878
|
const p = y.db.transaction([t], "readwrite").objectStore(t).put(i);
|
|
879
879
|
p.onsuccess = (l) => {
|
|
880
880
|
s(i);
|
|
@@ -882,9 +882,9 @@ const y = class y {
|
|
|
882
882
|
s(i);
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
|
|
886
|
-
},
|
|
887
|
-
|
|
885
|
+
r.result.close();
|
|
886
|
+
}, r.onerror = () => {
|
|
887
|
+
r.result.close(), o();
|
|
888
888
|
};
|
|
889
889
|
});
|
|
890
890
|
}
|
|
@@ -898,9 +898,9 @@ const y = class y {
|
|
|
898
898
|
*/
|
|
899
899
|
static async getData(e, t, i) {
|
|
900
900
|
return new Promise((s, o) => {
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
if (y.db =
|
|
901
|
+
const r = indexedDB.open(e);
|
|
902
|
+
r.onsuccess = (a) => {
|
|
903
|
+
if (y.db = a.target.result, y.lastLink = r.result, y.db.objectStoreNames.contains(t)) {
|
|
904
904
|
const p = y.db.transaction([t], "readonly").objectStore(t).get(i);
|
|
905
905
|
p.onsuccess = (l) => {
|
|
906
906
|
s(p.result);
|
|
@@ -908,9 +908,9 @@ const y = class y {
|
|
|
908
908
|
o(new Error("未找到数据".concat(i)));
|
|
909
909
|
};
|
|
910
910
|
}
|
|
911
|
-
|
|
912
|
-
},
|
|
913
|
-
|
|
911
|
+
r.result.close();
|
|
912
|
+
}, r.onerror = () => {
|
|
913
|
+
r.result.close(), o();
|
|
914
914
|
};
|
|
915
915
|
});
|
|
916
916
|
}
|
|
@@ -924,8 +924,8 @@ const y = class y {
|
|
|
924
924
|
static async getAllData(e, t) {
|
|
925
925
|
return new Promise((i, s) => {
|
|
926
926
|
const o = indexedDB.open(e);
|
|
927
|
-
o.onsuccess = (
|
|
928
|
-
if (y.db =
|
|
927
|
+
o.onsuccess = (r) => {
|
|
928
|
+
if (y.db = r.target.result, y.lastLink = o.result, y.db.objectStoreNames.contains(t)) {
|
|
929
929
|
const h = y.db.transaction([t], "readonly").objectStore(t).getAll();
|
|
930
930
|
h.onsuccess = (p) => {
|
|
931
931
|
i(h.result);
|
|
@@ -941,11 +941,11 @@ const y = class y {
|
|
|
941
941
|
}
|
|
942
942
|
};
|
|
943
943
|
// 数据库版本
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
let
|
|
948
|
-
class
|
|
944
|
+
x(y, "version", 1), // 数据库连接句柄
|
|
945
|
+
x(y, "db", null), // 上一个连接
|
|
946
|
+
x(y, "lastLink");
|
|
947
|
+
let q = y;
|
|
948
|
+
class Ln {
|
|
949
949
|
/**
|
|
950
950
|
* Creates an instance of FileUploader.
|
|
951
951
|
* @author tony001
|
|
@@ -953,7 +953,7 @@ class zn {
|
|
|
953
953
|
* @param {FileUploaderOptions<T>} options
|
|
954
954
|
*/
|
|
955
955
|
constructor(e) {
|
|
956
|
-
|
|
956
|
+
x(this, "options");
|
|
957
957
|
this.options = {
|
|
958
958
|
multiple: !0,
|
|
959
959
|
accept: "*/*",
|
|
@@ -979,8 +979,8 @@ class zn {
|
|
|
979
979
|
if (e.length === 0)
|
|
980
980
|
return;
|
|
981
981
|
const t = e.filter((o) => {
|
|
982
|
-
var
|
|
983
|
-
return this.options.maxSize && o.size > this.options.maxSize ? ((
|
|
982
|
+
var r, a;
|
|
983
|
+
return this.options.maxSize && o.size > this.options.maxSize ? ((a = (r = this.options).onError) == null || a.call(r, new Error("文件大小超过限制 (".concat(this.formatSize(o.size), " > ").concat(this.formatSize(this.options.maxSize), ")")), o), !1) : !0;
|
|
984
984
|
});
|
|
985
985
|
(s = (i = this.options).onSelect) == null || s.call(i, t), await Promise.all(t.map((o) => this.processFile(o)));
|
|
986
986
|
}
|
|
@@ -988,7 +988,7 @@ class zn {
|
|
|
988
988
|
* 处理单个文件上传
|
|
989
989
|
*/
|
|
990
990
|
async processFile(e) {
|
|
991
|
-
var t, i, s, o,
|
|
991
|
+
var t, i, s, o, r, a;
|
|
992
992
|
try {
|
|
993
993
|
const u = (p) => {
|
|
994
994
|
var l, v;
|
|
@@ -996,7 +996,7 @@ class zn {
|
|
|
996
996
|
}, h = await this.options.onUpload(e, u);
|
|
997
997
|
(i = (t = this.options).onProgress) == null || i.call(t, e, 100), (o = (s = this.options).onSuccess) == null || o.call(s, h, e);
|
|
998
998
|
} catch (u) {
|
|
999
|
-
(
|
|
999
|
+
(a = (r = this.options).onError) == null || a.call(r, u instanceof Error ? u : new Error("上传失败"), e);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
/**
|
|
@@ -1038,12 +1038,12 @@ class tn {
|
|
|
1038
1038
|
static parse(e) {
|
|
1039
1039
|
const i = new DOMParser().parseFromString(e, "text/xml");
|
|
1040
1040
|
return Array.from(i.querySelectorAll("resource")).map((o) => {
|
|
1041
|
-
const
|
|
1041
|
+
const r = o.getAttribute("type") || "", a = o.querySelector("data"), u = o.querySelector("metadata");
|
|
1042
1042
|
try {
|
|
1043
|
-
const h = this.getCdataContent(
|
|
1043
|
+
const h = this.getCdataContent(a), p = this.getCdataContent(u), l = h ? JSON.parse(h) : {}, v = p ? JSON.parse(p) : {};
|
|
1044
1044
|
return {
|
|
1045
1045
|
id: l.id,
|
|
1046
|
-
type:
|
|
1046
|
+
type: r,
|
|
1047
1047
|
data: l,
|
|
1048
1048
|
metadata: v
|
|
1049
1049
|
};
|
|
@@ -1074,17 +1074,17 @@ class tn {
|
|
|
1074
1074
|
remainingText: e,
|
|
1075
1075
|
hasResources: !1
|
|
1076
1076
|
};
|
|
1077
|
-
const [s] = i, o = i.index,
|
|
1077
|
+
const [s] = i, o = i.index, r = o + s.length, a = (e.slice(0, o) + e.slice(r)).replace(/\n/g, "");
|
|
1078
1078
|
try {
|
|
1079
1079
|
return {
|
|
1080
1080
|
resources: this.parse(s),
|
|
1081
|
-
remainingText:
|
|
1081
|
+
remainingText: a,
|
|
1082
1082
|
hasResources: !0
|
|
1083
1083
|
};
|
|
1084
1084
|
} catch (u) {
|
|
1085
1085
|
return {
|
|
1086
1086
|
resources: [],
|
|
1087
|
-
remainingText:
|
|
1087
|
+
remainingText: a,
|
|
1088
1088
|
hasResources: !0,
|
|
1089
1089
|
error: "资源解析失败: ".concat(u.message)
|
|
1090
1090
|
};
|
|
@@ -1102,22 +1102,22 @@ class tn {
|
|
|
1102
1102
|
static stringify(e) {
|
|
1103
1103
|
const t = document.implementation.createDocument(null, null, null), i = t.createElement("resources");
|
|
1104
1104
|
i.setAttribute("version", "1.0");
|
|
1105
|
-
const s = (
|
|
1106
|
-
return e.forEach((
|
|
1105
|
+
const s = (r) => "\n".concat(" ".repeat(r)), o = 1;
|
|
1106
|
+
return e.forEach((r) => {
|
|
1107
1107
|
i.appendChild(t.createTextNode(s(o)));
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1108
|
+
const a = t.createElement("resource");
|
|
1109
|
+
a.setAttribute("type", r.type), a.setAttribute("version", "1.0");
|
|
1110
1110
|
const u = (h, p) => {
|
|
1111
1111
|
const l = t.createElement(h);
|
|
1112
1112
|
l.appendChild(t.createTextNode(s(o + 1)));
|
|
1113
1113
|
const v = t.createCDATASection(JSON.stringify(p));
|
|
1114
1114
|
return l.appendChild(v), l.appendChild(t.createTextNode(s(o))), l;
|
|
1115
1115
|
};
|
|
1116
|
-
|
|
1116
|
+
a.appendChild(t.createTextNode(s(o + 1))), a.appendChild(u("data", r.data)), a.appendChild(t.createTextNode(s(o + 1))), a.appendChild(u("metadata", r.metadata)), a.appendChild(t.createTextNode(s(o))), i.appendChild(a);
|
|
1117
1117
|
}), i.appendChild(t.createTextNode("\n")), t.appendChild(i), new XMLSerializer().serializeToString(t).replace(/></g, ">\n<");
|
|
1118
1118
|
}
|
|
1119
1119
|
}
|
|
1120
|
-
class
|
|
1120
|
+
class zn {
|
|
1121
1121
|
/**
|
|
1122
1122
|
* 从XML元素中提取CDATA内容
|
|
1123
1123
|
*
|
|
@@ -1146,11 +1146,11 @@ class Ln {
|
|
|
1146
1146
|
static parse(e) {
|
|
1147
1147
|
const i = new DOMParser().parseFromString(e, "text/xml");
|
|
1148
1148
|
return Array.from(i.querySelectorAll("suggestion")).map((o) => {
|
|
1149
|
-
const
|
|
1149
|
+
const r = o.getAttribute("type") || "", a = o.querySelector("data"), u = o.querySelector("metadata");
|
|
1150
1150
|
try {
|
|
1151
|
-
const h = this.getCdataContent(
|
|
1151
|
+
const h = this.getCdataContent(a), p = this.getCdataContent(u), l = h ? JSON.parse(h) : {}, v = p ? JSON.parse(p) : {};
|
|
1152
1152
|
return {
|
|
1153
|
-
type:
|
|
1153
|
+
type: r,
|
|
1154
1154
|
data: l,
|
|
1155
1155
|
metadata: v
|
|
1156
1156
|
};
|
|
@@ -1181,17 +1181,17 @@ class Ln {
|
|
|
1181
1181
|
remainingText: e,
|
|
1182
1182
|
hasSuggestions: !1
|
|
1183
1183
|
};
|
|
1184
|
-
const [s] = i, o = i.index,
|
|
1184
|
+
const [s] = i, o = i.index, r = o + s.length, a = (e.slice(0, o) + e.slice(r)).replace(/\n/g, "");
|
|
1185
1185
|
try {
|
|
1186
1186
|
return {
|
|
1187
1187
|
suggestions: this.parse(s),
|
|
1188
|
-
remainingText:
|
|
1188
|
+
remainingText: a,
|
|
1189
1189
|
hasSuggestions: !0
|
|
1190
1190
|
};
|
|
1191
1191
|
} catch (u) {
|
|
1192
1192
|
return {
|
|
1193
1193
|
suggestions: [],
|
|
1194
|
-
remainingText:
|
|
1194
|
+
remainingText: a,
|
|
1195
1195
|
hasSuggestions: !0,
|
|
1196
1196
|
error: "资源解析失败: ".concat(u.message)
|
|
1197
1197
|
};
|
|
@@ -1209,18 +1209,18 @@ class Ln {
|
|
|
1209
1209
|
static stringify(e) {
|
|
1210
1210
|
const t = document.implementation.createDocument(null, null, null), i = t.createElement("suggestions");
|
|
1211
1211
|
i.setAttribute("version", "1.0");
|
|
1212
|
-
const s = (
|
|
1213
|
-
return e.forEach((
|
|
1212
|
+
const s = (r) => "\n".concat(" ".repeat(r)), o = 1;
|
|
1213
|
+
return e.forEach((r) => {
|
|
1214
1214
|
i.appendChild(t.createTextNode(s(o)));
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1215
|
+
const a = t.createElement("suggestion");
|
|
1216
|
+
a.setAttribute("type", r.type), a.setAttribute("version", "1.0");
|
|
1217
1217
|
const u = (h, p) => {
|
|
1218
1218
|
const l = t.createElement(h);
|
|
1219
1219
|
l.appendChild(t.createTextNode(s(o + 1)));
|
|
1220
1220
|
const v = t.createCDATASection(JSON.stringify(p));
|
|
1221
1221
|
return l.appendChild(v), l.appendChild(t.createTextNode(s(o))), l;
|
|
1222
1222
|
};
|
|
1223
|
-
|
|
1223
|
+
a.appendChild(t.createTextNode(s(o + 1))), a.appendChild(u("data", r.data)), a.appendChild(t.createTextNode(s(o + 1))), a.appendChild(u("metadata", r.metadata)), a.appendChild(t.createTextNode(s(o))), i.appendChild(a);
|
|
1224
1224
|
}), i.appendChild(t.createTextNode("\n")), t.appendChild(i), new XMLSerializer().serializeToString(t).replace(/></g, ">\n<");
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
@@ -1228,28 +1228,28 @@ function Xe(n) {
|
|
|
1228
1228
|
return n.x >= 0 && n.x <= 1 && n.y >= 0 && n.y <= 1;
|
|
1229
1229
|
}
|
|
1230
1230
|
function nn(n, e, t, i) {
|
|
1231
|
-
const s = n / window.innerWidth, o = e / window.innerHeight,
|
|
1231
|
+
const s = n / window.innerWidth, o = e / window.innerHeight, r = Math.max(0, Math.min(s, 1 - t)), a = Math.max(0, Math.min(o, 1 - i));
|
|
1232
1232
|
return {
|
|
1233
|
-
x:
|
|
1234
|
-
y:
|
|
1233
|
+
x: r,
|
|
1234
|
+
y: a
|
|
1235
1235
|
};
|
|
1236
1236
|
}
|
|
1237
|
-
var
|
|
1237
|
+
var ce, k, Oe, ht, ge = 0, sn = [], xe = [], pt = w.__b, ft = w.__r, vt = w.diffed, mt = w.__c, _t = w.unmount;
|
|
1238
1238
|
function De(n, e) {
|
|
1239
1239
|
w.__h && w.__h(k, n, ge || e), ge = 0;
|
|
1240
1240
|
var t = k.__H || (k.__H = { __: [], __h: [] });
|
|
1241
1241
|
return n >= t.__.length && t.__.push({ __V: xe }), t.__[n];
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return ge = 1, Hn(
|
|
1243
|
+
function ne(n) {
|
|
1244
|
+
return ge = 1, Hn(an, n);
|
|
1245
1245
|
}
|
|
1246
1246
|
function Hn(n, e, t) {
|
|
1247
|
-
var i = De(
|
|
1248
|
-
if (i.t = n, !i.__c && (i.__ = [t ? t(e) :
|
|
1249
|
-
var u = i.__N ? i.__N[0] : i.__[0], h = i.t(u,
|
|
1247
|
+
var i = De(ce++, 2);
|
|
1248
|
+
if (i.t = n, !i.__c && (i.__ = [t ? t(e) : an(void 0, e), function(a) {
|
|
1249
|
+
var u = i.__N ? i.__N[0] : i.__[0], h = i.t(u, a);
|
|
1250
1250
|
u !== h && (i.__N = [h, i.__[1]], i.__c.setState({}));
|
|
1251
1251
|
}], i.__c = k, !k.u)) {
|
|
1252
|
-
var s = function(
|
|
1252
|
+
var s = function(a, u, h) {
|
|
1253
1253
|
if (!i.__c.__H)
|
|
1254
1254
|
return !0;
|
|
1255
1255
|
var p = i.__c.__H.__.filter(function(v) {
|
|
@@ -1258,47 +1258,47 @@ function Hn(n, e, t) {
|
|
|
1258
1258
|
if (p.every(function(v) {
|
|
1259
1259
|
return !v.__N;
|
|
1260
1260
|
}))
|
|
1261
|
-
return !o || o.call(this,
|
|
1261
|
+
return !o || o.call(this, a, u, h);
|
|
1262
1262
|
var l = !1;
|
|
1263
1263
|
return p.forEach(function(v) {
|
|
1264
1264
|
if (v.__N) {
|
|
1265
|
-
var
|
|
1266
|
-
v.__ = v.__N, v.__N = void 0,
|
|
1265
|
+
var _ = v.__[0];
|
|
1266
|
+
v.__ = v.__N, v.__N = void 0, _ !== v.__[0] && (l = !0);
|
|
1267
1267
|
}
|
|
1268
|
-
}), !(!l && i.__c.props ===
|
|
1268
|
+
}), !(!l && i.__c.props === a) && (!o || o.call(this, a, u, h));
|
|
1269
1269
|
};
|
|
1270
1270
|
k.u = !0;
|
|
1271
|
-
var o = k.shouldComponentUpdate,
|
|
1272
|
-
k.componentWillUpdate = function(
|
|
1271
|
+
var o = k.shouldComponentUpdate, r = k.componentWillUpdate;
|
|
1272
|
+
k.componentWillUpdate = function(a, u, h) {
|
|
1273
1273
|
if (this.__e) {
|
|
1274
1274
|
var p = o;
|
|
1275
|
-
o = void 0, s(
|
|
1275
|
+
o = void 0, s(a, u, h), o = p;
|
|
1276
1276
|
}
|
|
1277
|
-
|
|
1277
|
+
r && r.call(this, a, u, h);
|
|
1278
1278
|
}, k.shouldComponentUpdate = s;
|
|
1279
1279
|
}
|
|
1280
1280
|
return i.__N || i.__;
|
|
1281
1281
|
}
|
|
1282
1282
|
function H(n, e) {
|
|
1283
|
-
var t = De(
|
|
1284
|
-
!w.__s &&
|
|
1283
|
+
var t = De(ce++, 3);
|
|
1284
|
+
!w.__s && rn(t.__H, e) && (t.__ = n, t.i = e, k.__H.__h.push(t));
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return ge = 5,
|
|
1286
|
+
function P(n) {
|
|
1287
|
+
return ge = 5, X(function() {
|
|
1288
1288
|
return { current: n };
|
|
1289
1289
|
}, []);
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1292
|
-
var t = De(
|
|
1293
|
-
return
|
|
1291
|
+
function X(n, e) {
|
|
1292
|
+
var t = De(ce++, 7);
|
|
1293
|
+
return rn(t.__H, e) ? (t.__V = n(), t.i = e, t.__h = n, t.__V) : t.__;
|
|
1294
1294
|
}
|
|
1295
1295
|
function Be(n, e) {
|
|
1296
|
-
return ge = 8,
|
|
1296
|
+
return ge = 8, X(function() {
|
|
1297
1297
|
return n;
|
|
1298
1298
|
}, e);
|
|
1299
1299
|
}
|
|
1300
1300
|
function on(n) {
|
|
1301
|
-
var e = k.context[n.__c], t = De(
|
|
1301
|
+
var e = k.context[n.__c], t = De(ce++, 9);
|
|
1302
1302
|
return t.c = n, e ? (t.__ == null && (t.__ = !0, e.sub(k)), e.props.value) : n.__;
|
|
1303
1303
|
}
|
|
1304
1304
|
function On() {
|
|
@@ -1313,11 +1313,11 @@ function On() {
|
|
|
1313
1313
|
w.__b = function(n) {
|
|
1314
1314
|
k = null, pt && pt(n);
|
|
1315
1315
|
}, w.__r = function(n) {
|
|
1316
|
-
ft && ft(n),
|
|
1316
|
+
ft && ft(n), ce = 0;
|
|
1317
1317
|
var e = (k = n.__c).__H;
|
|
1318
1318
|
e && (Oe === k ? (e.__h = [], k.__h = [], e.__.forEach(function(t) {
|
|
1319
1319
|
t.__N && (t.__ = t.__N), t.__V = xe, t.__N = t.i = void 0;
|
|
1320
|
-
})) : (e.__h.forEach(Se), e.__h.forEach(Ze), e.__h = [],
|
|
1320
|
+
})) : (e.__h.forEach(Se), e.__h.forEach(Ze), e.__h = [], ce = 0)), Oe = k;
|
|
1321
1321
|
}, w.diffed = function(n) {
|
|
1322
1322
|
vt && vt(n);
|
|
1323
1323
|
var e = n.__c;
|
|
@@ -1362,15 +1362,15 @@ function Ze(n) {
|
|
|
1362
1362
|
var e = k;
|
|
1363
1363
|
n.__c = n.__(), k = e;
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function rn(n, e) {
|
|
1366
1366
|
return !n || n.length !== e.length || e.some(function(t, i) {
|
|
1367
1367
|
return t !== n[i];
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function an(n, e) {
|
|
1371
1371
|
return typeof e == "function" ? e(n) : e;
|
|
1372
1372
|
}
|
|
1373
|
-
function
|
|
1373
|
+
function Le() {
|
|
1374
1374
|
throw new Error("Cycle detected");
|
|
1375
1375
|
}
|
|
1376
1376
|
var Pn = Symbol.for("preact-signals");
|
|
@@ -1449,10 +1449,10 @@ Object.defineProperty(A.prototype, "value", { get: function() {
|
|
|
1449
1449
|
var n = cn(this);
|
|
1450
1450
|
return n !== void 0 && (n.i = this.i), this.v;
|
|
1451
1451
|
}, set: function(n) {
|
|
1452
|
-
if (E instanceof
|
|
1452
|
+
if (E instanceof K && function() {
|
|
1453
1453
|
throw new Error("Computed cannot have side-effects");
|
|
1454
1454
|
}(), n !== this.v) {
|
|
1455
|
-
Ge > 100 &&
|
|
1455
|
+
Ge > 100 && Le(), this.v = n, this.i++, Me++, ae++;
|
|
1456
1456
|
try {
|
|
1457
1457
|
for (var e = this.t; e !== void 0; e = e.x)
|
|
1458
1458
|
e.t.N();
|
|
@@ -1461,7 +1461,7 @@ Object.defineProperty(A.prototype, "value", { get: function() {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
} });
|
|
1464
|
-
function
|
|
1464
|
+
function J(n) {
|
|
1465
1465
|
return new A(n);
|
|
1466
1466
|
}
|
|
1467
1467
|
function ln(n) {
|
|
@@ -1486,10 +1486,10 @@ function dn(n) {
|
|
|
1486
1486
|
}
|
|
1487
1487
|
n.s = t;
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function K(n) {
|
|
1490
1490
|
A.call(this, void 0), this.x = n, this.s = void 0, this.g = Me - 1, this.f = 4;
|
|
1491
1491
|
}
|
|
1492
|
-
(
|
|
1492
|
+
(K.prototype = new A()).h = function() {
|
|
1493
1493
|
if (this.f &= -3, 1 & this.f)
|
|
1494
1494
|
return !1;
|
|
1495
1495
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === Me))
|
|
@@ -1506,7 +1506,7 @@ function J(n) {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
return E = n, dn(this), this.f &= -2, !0;
|
|
1508
1508
|
};
|
|
1509
|
-
|
|
1509
|
+
K.prototype.S = function(n) {
|
|
1510
1510
|
if (this.t === void 0) {
|
|
1511
1511
|
this.f |= 36;
|
|
1512
1512
|
for (var e = this.s; e !== void 0; e = e.n)
|
|
@@ -1514,34 +1514,34 @@ J.prototype.S = function(n) {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
A.prototype.S.call(this, n);
|
|
1516
1516
|
};
|
|
1517
|
-
|
|
1517
|
+
K.prototype.U = function(n) {
|
|
1518
1518
|
if (this.t !== void 0 && (A.prototype.U.call(this, n), this.t === void 0)) {
|
|
1519
1519
|
this.f &= -33;
|
|
1520
1520
|
for (var e = this.s; e !== void 0; e = e.n)
|
|
1521
1521
|
e.S.U(e);
|
|
1522
1522
|
}
|
|
1523
1523
|
};
|
|
1524
|
-
|
|
1524
|
+
K.prototype.N = function() {
|
|
1525
1525
|
if (!(2 & this.f)) {
|
|
1526
1526
|
this.f |= 6;
|
|
1527
1527
|
for (var n = this.t; n !== void 0; n = n.x)
|
|
1528
1528
|
n.t.N();
|
|
1529
1529
|
}
|
|
1530
1530
|
};
|
|
1531
|
-
|
|
1532
|
-
if (this.h() ||
|
|
1531
|
+
K.prototype.peek = function() {
|
|
1532
|
+
if (this.h() || Le(), 16 & this.f)
|
|
1533
1533
|
throw this.v;
|
|
1534
1534
|
return this.v;
|
|
1535
1535
|
};
|
|
1536
|
-
Object.defineProperty(
|
|
1537
|
-
1 & this.f &&
|
|
1536
|
+
Object.defineProperty(K.prototype, "value", { get: function() {
|
|
1537
|
+
1 & this.f && Le();
|
|
1538
1538
|
var n = cn(this);
|
|
1539
1539
|
if (this.h(), n !== void 0 && (n.i = this.i), 16 & this.f)
|
|
1540
1540
|
throw this.v;
|
|
1541
1541
|
return this.v;
|
|
1542
1542
|
} });
|
|
1543
1543
|
function hn(n) {
|
|
1544
|
-
return new
|
|
1544
|
+
return new K(n);
|
|
1545
1545
|
}
|
|
1546
1546
|
function pn(n) {
|
|
1547
1547
|
var e = n.u;
|
|
@@ -1583,7 +1583,7 @@ we.prototype.c = function() {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
};
|
|
1585
1585
|
we.prototype.S = function() {
|
|
1586
|
-
1 & this.f &&
|
|
1586
|
+
1 & this.f && Le(), this.f |= 1, this.f &= -9, pn(this), un(this), ae++;
|
|
1587
1587
|
var n = E;
|
|
1588
1588
|
return E = this, Rn.bind(this, n);
|
|
1589
1589
|
};
|
|
@@ -1602,7 +1602,7 @@ function st(n) {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
return e.d.bind(e);
|
|
1604
1604
|
}
|
|
1605
|
-
var
|
|
1605
|
+
var ze, Pe;
|
|
1606
1606
|
function le(n, e) {
|
|
1607
1607
|
w[n] = e.bind(null, w[n] || function() {
|
|
1608
1608
|
});
|
|
@@ -1613,18 +1613,18 @@ function $e(n) {
|
|
|
1613
1613
|
function fn(n) {
|
|
1614
1614
|
var e = this, t = n.data, i = z(t);
|
|
1615
1615
|
i.value = t;
|
|
1616
|
-
var s =
|
|
1616
|
+
var s = X(function() {
|
|
1617
1617
|
for (var o = e.__v; o = o.__; )
|
|
1618
1618
|
if (o.__c) {
|
|
1619
1619
|
o.__c.__$f |= 4;
|
|
1620
1620
|
break;
|
|
1621
1621
|
}
|
|
1622
1622
|
return e.__$u.c = function() {
|
|
1623
|
-
var
|
|
1624
|
-
!Vt(s.peek()) && ((
|
|
1623
|
+
var r;
|
|
1624
|
+
!Vt(s.peek()) && ((r = e.base) == null ? void 0 : r.nodeType) === 3 ? e.base.data = s.peek() : (e.__$f |= 1, e.setState({}));
|
|
1625
1625
|
}, hn(function() {
|
|
1626
|
-
var
|
|
1627
|
-
return
|
|
1626
|
+
var r = i.value.value;
|
|
1627
|
+
return r === 0 ? 0 : r === !0 ? "" : r || "";
|
|
1628
1628
|
});
|
|
1629
1629
|
}, []);
|
|
1630
1630
|
return s.value;
|
|
@@ -1654,22 +1654,22 @@ le("__r", function(n, e) {
|
|
|
1654
1654
|
}), o.c = function() {
|
|
1655
1655
|
i.__$f |= 1, i.setState({});
|
|
1656
1656
|
}, o;
|
|
1657
|
-
}())),
|
|
1657
|
+
}())), ze = i, $e(t), n(e);
|
|
1658
1658
|
});
|
|
1659
1659
|
le("__e", function(n, e, t, i) {
|
|
1660
|
-
$e(),
|
|
1660
|
+
$e(), ze = void 0, n(e, t, i);
|
|
1661
1661
|
});
|
|
1662
1662
|
le("diffed", function(n, e) {
|
|
1663
|
-
$e(),
|
|
1663
|
+
$e(), ze = void 0;
|
|
1664
1664
|
var t;
|
|
1665
1665
|
if (typeof e.type == "string" && (t = e.__e)) {
|
|
1666
1666
|
var i = e.__np, s = e.props;
|
|
1667
1667
|
if (i) {
|
|
1668
1668
|
var o = t.U;
|
|
1669
1669
|
if (o)
|
|
1670
|
-
for (var
|
|
1671
|
-
var
|
|
1672
|
-
|
|
1670
|
+
for (var r in o) {
|
|
1671
|
+
var a = o[r];
|
|
1672
|
+
a !== void 0 && !(r in i) && (a.d(), o[r] = void 0);
|
|
1673
1673
|
}
|
|
1674
1674
|
else
|
|
1675
1675
|
t.U = o = {};
|
|
@@ -1682,12 +1682,12 @@ le("diffed", function(n, e) {
|
|
|
1682
1682
|
n(e);
|
|
1683
1683
|
});
|
|
1684
1684
|
function Fn(n, e, t, i) {
|
|
1685
|
-
var s = e in n && n.ownerSVGElement === void 0, o =
|
|
1686
|
-
return { o: function(
|
|
1687
|
-
o.value =
|
|
1685
|
+
var s = e in n && n.ownerSVGElement === void 0, o = J(t);
|
|
1686
|
+
return { o: function(r, a) {
|
|
1687
|
+
o.value = r, i = a;
|
|
1688
1688
|
}, d: st(function() {
|
|
1689
|
-
var
|
|
1690
|
-
i[e] !==
|
|
1689
|
+
var r = o.value.value;
|
|
1690
|
+
i[e] !== r && (i[e] = r, s ? n[e] = r : r ? n.setAttribute(e, r) : n.removeAttribute(e));
|
|
1691
1691
|
}) };
|
|
1692
1692
|
}
|
|
1693
1693
|
le("unmount", function(n, e) {
|
|
@@ -1704,10 +1704,10 @@ le("unmount", function(n, e) {
|
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
1706
|
} else {
|
|
1707
|
-
var
|
|
1708
|
-
if (
|
|
1709
|
-
var
|
|
1710
|
-
|
|
1707
|
+
var r = e.__c;
|
|
1708
|
+
if (r) {
|
|
1709
|
+
var a = r.__$u;
|
|
1710
|
+
a && (r.__$u = void 0, a.d());
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
1713
|
n(e);
|
|
@@ -1715,7 +1715,7 @@ le("unmount", function(n, e) {
|
|
|
1715
1715
|
le("__h", function(n, e, t, i) {
|
|
1716
1716
|
(i < 3 || i === 9) && (e.__$f |= 2), n(e, t, i);
|
|
1717
1717
|
});
|
|
1718
|
-
|
|
1718
|
+
F.prototype.shouldComponentUpdate = function(n, e) {
|
|
1719
1719
|
var t = this.__$u;
|
|
1720
1720
|
if (!(t && t.s !== void 0 || 4 & this.__$f) || 3 & this.__$f)
|
|
1721
1721
|
return !0;
|
|
@@ -1730,13 +1730,13 @@ P.prototype.shouldComponentUpdate = function(n, e) {
|
|
|
1730
1730
|
return !1;
|
|
1731
1731
|
};
|
|
1732
1732
|
function z(n) {
|
|
1733
|
-
return
|
|
1734
|
-
return
|
|
1733
|
+
return X(function() {
|
|
1734
|
+
return J(n);
|
|
1735
1735
|
}, []);
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1738
|
-
var e =
|
|
1739
|
-
return e.current = n,
|
|
1737
|
+
function B(n) {
|
|
1738
|
+
var e = P(n);
|
|
1739
|
+
return e.current = n, ze.__$f |= 4, X(function() {
|
|
1740
1740
|
return hn(function() {
|
|
1741
1741
|
return e.current();
|
|
1742
1742
|
});
|
|
@@ -1744,13 +1744,13 @@ function L(n) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
var Un = 0;
|
|
1746
1746
|
function c(n, e, t, i, s, o) {
|
|
1747
|
-
var
|
|
1748
|
-
for (
|
|
1749
|
-
|
|
1750
|
-
var h = { type: n, props: u, key: t, ref:
|
|
1751
|
-
if (typeof n == "function" && (
|
|
1752
|
-
for (
|
|
1753
|
-
u[
|
|
1747
|
+
var r, a, u = {};
|
|
1748
|
+
for (a in e)
|
|
1749
|
+
a == "ref" ? r = e[a] : u[a] = e[a];
|
|
1750
|
+
var h = { type: n, props: u, key: t, ref: r, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --Un, __source: s, __self: o };
|
|
1751
|
+
if (typeof n == "function" && (r = n.defaultProps))
|
|
1752
|
+
for (a in r)
|
|
1753
|
+
u[a] === void 0 && (u[a] = r[a]);
|
|
1754
1754
|
return w.vnode && w.vnode(h), h;
|
|
1755
1755
|
}
|
|
1756
1756
|
const Wn = () => c("svg", {
|
|
@@ -1867,7 +1867,7 @@ const Wn = () => c("svg", {
|
|
|
1867
1867
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
1868
1868
|
children: Array.from({
|
|
1869
1869
|
length: 4
|
|
1870
|
-
}).map((
|
|
1870
|
+
}).map((a, u) => {
|
|
1871
1871
|
const p = u * (146.66666666666666 + 140), l = 1e3 / 2 - 250 / 2, v = 1e3 / 2 - 500 / 2;
|
|
1872
1872
|
return c("rect", {
|
|
1873
1873
|
fill: "currentColor",
|
|
@@ -1986,7 +1986,7 @@ const Wn = () => c("svg", {
|
|
|
1986
1986
|
d: "M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",
|
|
1987
1987
|
fill: "currentColor"
|
|
1988
1988
|
})]
|
|
1989
|
-
}),
|
|
1989
|
+
}), ri = () => c("svg", {
|
|
1990
1990
|
className: "icon",
|
|
1991
1991
|
viewBox: "0 0 1024 1024",
|
|
1992
1992
|
version: "1.1",
|
|
@@ -1997,7 +1997,7 @@ const Wn = () => c("svg", {
|
|
|
1997
1997
|
d: "M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z",
|
|
1998
1998
|
fill: "currentColor"
|
|
1999
1999
|
})
|
|
2000
|
-
}),
|
|
2000
|
+
}), ai = () => c("svg", {
|
|
2001
2001
|
className: "icon",
|
|
2002
2002
|
viewBox: "0 0 1024 1024",
|
|
2003
2003
|
version: "1.1",
|
|
@@ -2080,42 +2080,42 @@ const Wn = () => c("svg", {
|
|
|
2080
2080
|
const fi = (n) => {
|
|
2081
2081
|
const {
|
|
2082
2082
|
items: e
|
|
2083
|
-
} = n, t = z([]), i = new
|
|
2083
|
+
} = n, t = z([]), i = new N("chat-thought-chain"), s = z([]);
|
|
2084
2084
|
H(() => {
|
|
2085
|
-
s.value = e.filter((
|
|
2086
|
-
|
|
2085
|
+
s.value = e.filter((r) => r.description), s.value.length > 0 && s.value.forEach((r, a) => {
|
|
2086
|
+
r.done && (t.value = [...t.value, a]);
|
|
2087
2087
|
});
|
|
2088
2088
|
}, [e]);
|
|
2089
|
-
const o = (
|
|
2090
|
-
t.value.includes(
|
|
2089
|
+
const o = (r) => {
|
|
2090
|
+
t.value.includes(r) ? t.value = t.value.filter((a) => a !== r) : t.value = [...t.value, r];
|
|
2091
2091
|
};
|
|
2092
2092
|
return s.value.length === 0 ? null : c("div", {
|
|
2093
2093
|
className: "".concat(i.b(), " ").concat(i.is("single", s.value.length === 1)),
|
|
2094
|
-
children: s.value.map((
|
|
2095
|
-
if (!
|
|
2094
|
+
children: s.value.map((r, a) => {
|
|
2095
|
+
if (!r.description)
|
|
2096
2096
|
return;
|
|
2097
|
-
const u = t.value.includes(
|
|
2097
|
+
const u = t.value.includes(a);
|
|
2098
2098
|
return c("div", {
|
|
2099
2099
|
className: "".concat(i.e("item"), " ").concat(i.is("collapsed", u)),
|
|
2100
2100
|
children: [c("div", {
|
|
2101
2101
|
className: i.e("item-icon"),
|
|
2102
|
-
children:
|
|
2103
|
-
children:
|
|
2102
|
+
children: r.icon || c("span", {
|
|
2103
|
+
children: a
|
|
2104
2104
|
})
|
|
2105
2105
|
}), c("div", {
|
|
2106
2106
|
className: i.e("item-content"),
|
|
2107
2107
|
children: [c("div", {
|
|
2108
2108
|
className: i.e("item-title"),
|
|
2109
|
-
onClick: () => o(
|
|
2110
|
-
children: [
|
|
2109
|
+
onClick: () => o(a),
|
|
2110
|
+
children: [r.title, c(si, {
|
|
2111
2111
|
className: i.e("icon")
|
|
2112
2112
|
})]
|
|
2113
2113
|
}), c("div", {
|
|
2114
2114
|
className: i.e("item-description"),
|
|
2115
|
-
children:
|
|
2115
|
+
children: r.description
|
|
2116
2116
|
})]
|
|
2117
2117
|
})]
|
|
2118
|
-
},
|
|
2118
|
+
}, a);
|
|
2119
2119
|
})
|
|
2120
2120
|
});
|
|
2121
2121
|
};
|
|
@@ -2123,26 +2123,26 @@ const vi = (n) => {
|
|
|
2123
2123
|
const {
|
|
2124
2124
|
items: e,
|
|
2125
2125
|
onItemClick: t
|
|
2126
|
-
} = n, i = (o,
|
|
2127
|
-
t == null || t(o,
|
|
2128
|
-
}, s = new
|
|
2126
|
+
} = n, i = (o, r) => {
|
|
2127
|
+
t == null || t(o, r);
|
|
2128
|
+
}, s = new N("chat-suggestions");
|
|
2129
2129
|
return c("div", {
|
|
2130
2130
|
className: "".concat(s.b()),
|
|
2131
|
-
children: e.map((o,
|
|
2131
|
+
children: e.map((o, r) => c("div", {
|
|
2132
2132
|
className: "".concat(s.e("item"), " ").concat(s.is("action", o.type === "action")),
|
|
2133
|
-
onClick: (
|
|
2133
|
+
onClick: (a) => i(o, a),
|
|
2134
2134
|
title: o.metadata.content_name,
|
|
2135
2135
|
children: [o.metadata.content_name, c(pi, {
|
|
2136
2136
|
className: "".concat(s.e("item-icon"))
|
|
2137
2137
|
})]
|
|
2138
|
-
},
|
|
2138
|
+
}, r))
|
|
2139
2139
|
});
|
|
2140
2140
|
};
|
|
2141
|
-
const
|
|
2141
|
+
const ee = new N("markdown-message"), mi = (n) => {
|
|
2142
2142
|
const {
|
|
2143
2143
|
message: e,
|
|
2144
2144
|
size: t
|
|
2145
|
-
} = n, i = z(et()), s = z(null), o =
|
|
2145
|
+
} = n, i = z(et()), s = z(null), o = X(() => e.state === 20 && e.completed !== !0, [e.state, e.completed]), r = X(() => e.state === 20 && e.completed === !0, [e.state, e.completed]), a = z({
|
|
2146
2146
|
title: "",
|
|
2147
2147
|
description: "",
|
|
2148
2148
|
icon: c(Fe, {})
|
|
@@ -2157,15 +2157,15 @@ const Q = new M("markdown-message"), mi = (n) => {
|
|
|
2157
2157
|
hasSuggestions: !1,
|
|
2158
2158
|
suggestions: []
|
|
2159
2159
|
};
|
|
2160
|
-
}, p = (v,
|
|
2161
|
-
n.controller.handleSuggestionClick(n.message, v,
|
|
2160
|
+
}, p = (v, _) => {
|
|
2161
|
+
n.controller.handleSuggestionClick(n.message, v, _);
|
|
2162
2162
|
}, l = (v) => {
|
|
2163
|
-
const
|
|
2164
|
-
let f = "",
|
|
2165
|
-
return d === -1 ? (
|
|
2166
|
-
isThoughtCompleted:
|
|
2163
|
+
const _ = v.indexOf("<think>"), d = v.indexOf("</think>");
|
|
2164
|
+
let f = "", m = "", b = !1;
|
|
2165
|
+
return d === -1 ? (b = !1, f = v.slice(_ + 7), m = "") : (b = !0, f = v.slice(_ + 7, d), m = v.slice(d + 8)), {
|
|
2166
|
+
isThoughtCompleted: b,
|
|
2167
2167
|
thoughtContent: f,
|
|
2168
|
-
answerContent:
|
|
2168
|
+
answerContent: m
|
|
2169
2169
|
};
|
|
2170
2170
|
};
|
|
2171
2171
|
return H(() => {
|
|
@@ -2173,10 +2173,10 @@ const Q = new M("markdown-message"), mi = (n) => {
|
|
|
2173
2173
|
if (e.content.indexOf("<think>") !== -1) {
|
|
2174
2174
|
const {
|
|
2175
2175
|
isThoughtCompleted: v,
|
|
2176
|
-
thoughtContent:
|
|
2176
|
+
thoughtContent: _,
|
|
2177
2177
|
answerContent: d
|
|
2178
2178
|
} = l(e.content);
|
|
2179
|
-
v ? (
|
|
2179
|
+
v ? (a.value.icon = c(Re, {}), a.value.title = "思考完成") : e.completed === !0 ? (a.value.icon = c(Re, {}), a.value.title = "思考已停止") : (a.value.icon = c(Fe, {}), a.value.title = "思考中..."), a.value.description = _ || "", s.value.setMarkdown(d || "");
|
|
2180
2180
|
} else
|
|
2181
2181
|
s.value.setMarkdown(e.content || "");
|
|
2182
2182
|
h(e.suggestions);
|
|
@@ -2185,14 +2185,14 @@ const Q = new M("markdown-message"), mi = (n) => {
|
|
|
2185
2185
|
let v = "";
|
|
2186
2186
|
if (e.content.indexOf("<think>") !== -1) {
|
|
2187
2187
|
const {
|
|
2188
|
-
isThoughtCompleted:
|
|
2188
|
+
isThoughtCompleted: _,
|
|
2189
2189
|
thoughtContent: d,
|
|
2190
2190
|
answerContent: f
|
|
2191
2191
|
} = l(e.content);
|
|
2192
|
-
|
|
2193
|
-
title:
|
|
2192
|
+
a.value = {
|
|
2193
|
+
title: _ ? "思考完成" : e.completed === !0 ? "思考已停止" : "思考中...",
|
|
2194
2194
|
description: d || "",
|
|
2195
|
-
icon:
|
|
2195
|
+
icon: _ || e.completed === !0 ? c(Re, {}) : c(Fe, {})
|
|
2196
2196
|
}, f && (v = f);
|
|
2197
2197
|
} else
|
|
2198
2198
|
v = e.content;
|
|
@@ -2204,39 +2204,39 @@ const Q = new M("markdown-message"), mi = (n) => {
|
|
|
2204
2204
|
}
|
|
2205
2205
|
});
|
|
2206
2206
|
}, []), c("div", {
|
|
2207
|
-
className: "".concat(
|
|
2207
|
+
className: "".concat(ee.b(), " ").concat(ee.is("loading", o)),
|
|
2208
2208
|
children: [c("div", {
|
|
2209
|
-
className:
|
|
2209
|
+
className: ee.b("header"),
|
|
2210
2210
|
children: [c("div", {
|
|
2211
|
-
className:
|
|
2211
|
+
className: ee.be("header", "caption"),
|
|
2212
2212
|
children: "AI "
|
|
2213
|
-
}), n.children,
|
|
2214
|
-
className:
|
|
2213
|
+
}), n.children, r ? c("div", {
|
|
2214
|
+
className: ee.be("header", "timeout"),
|
|
2215
2215
|
children: "请求超时"
|
|
2216
2216
|
}) : null]
|
|
2217
2217
|
}), c("div", {
|
|
2218
|
-
className: "".concat(
|
|
2218
|
+
className: "".concat(ee.b("content"), " pre-wrap-container"),
|
|
2219
2219
|
children: [c(fi, {
|
|
2220
|
-
items: [
|
|
2220
|
+
items: [a.value]
|
|
2221
2221
|
}), c("div", {
|
|
2222
2222
|
id: i
|
|
2223
2223
|
})]
|
|
2224
2224
|
}), c("div", {
|
|
2225
|
-
className:
|
|
2225
|
+
className: ee.b("footer"),
|
|
2226
2226
|
children: u.value.hasSuggestions ? c(vi, {
|
|
2227
2227
|
items: u.value.suggestions,
|
|
2228
|
-
onItemClick: (v,
|
|
2229
|
-
p(v,
|
|
2228
|
+
onItemClick: (v, _) => {
|
|
2229
|
+
p(v, _);
|
|
2230
2230
|
}
|
|
2231
2231
|
}) : null
|
|
2232
2232
|
})]
|
|
2233
2233
|
});
|
|
2234
2234
|
};
|
|
2235
|
-
const ue = new
|
|
2236
|
-
const e =
|
|
2235
|
+
const ue = new N("ossfile-material"), _i = (n) => {
|
|
2236
|
+
const e = B(() => n.material.data.name), t = B(() => n.material.metadata.size), i = B(() => {
|
|
2237
2237
|
const o = n.material.metadata.state;
|
|
2238
2238
|
return o === "successed" ? "上传成功" : o === "uploading" ? "上传中" : o === "failed" ? "上传失败" : "未知状态";
|
|
2239
|
-
}), s =
|
|
2239
|
+
}), s = B(() => {
|
|
2240
2240
|
switch (n.material.metadata.state) {
|
|
2241
2241
|
case "successed":
|
|
2242
2242
|
return "#1890ff";
|
|
@@ -2273,24 +2273,24 @@ const ue = new M("ossfile-material"), _i = (n) => {
|
|
|
2273
2273
|
})]
|
|
2274
2274
|
});
|
|
2275
2275
|
};
|
|
2276
|
-
const de = new
|
|
2277
|
-
var i, s, o,
|
|
2278
|
-
const e = (i = n.controller.opts.questionToolbarItems) == null ? void 0 : i.find((
|
|
2276
|
+
const de = new N("common-material"), gi = (n) => {
|
|
2277
|
+
var i, s, o, r;
|
|
2278
|
+
const e = (i = n.controller.opts.questionToolbarItems) == null ? void 0 : i.find((a) => a.id === n.material.metadata.actionId), t = B(() => n.material.metadata.name);
|
|
2279
2279
|
return c("div", {
|
|
2280
2280
|
className: de.b(),
|
|
2281
2281
|
children: [c("div", {
|
|
2282
2282
|
className: de.b("left"),
|
|
2283
|
-
children: e && e.icon ? typeof e.icon == "function" ? e.icon() : ((s = e.icon) == null ? void 0 : s.showIcon) && c(
|
|
2283
|
+
children: e && e.icon ? typeof e.icon == "function" ? e.icon() : ((s = e.icon) == null ? void 0 : s.showIcon) && c(Y, {
|
|
2284
2284
|
children: (o = e.icon) != null && o.cssClass ? c("i", {
|
|
2285
2285
|
className: e.icon.cssClass
|
|
2286
|
-
}) : (
|
|
2286
|
+
}) : (r = e.icon) != null && r.imagePath ? tt(e.icon.imagePath) ? c("div", {
|
|
2287
2287
|
dangerouslySetInnerHTML: {
|
|
2288
2288
|
__html: e.icon.imagePath
|
|
2289
2289
|
}
|
|
2290
2290
|
}) : c("img", {
|
|
2291
2291
|
src: e.icon.imagePath
|
|
2292
2292
|
}) : null
|
|
2293
|
-
}) : c(
|
|
2293
|
+
}) : c(ai, {})
|
|
2294
2294
|
}), c("div", {
|
|
2295
2295
|
className: de.b("right"),
|
|
2296
2296
|
children: [c("div", {
|
|
@@ -2306,7 +2306,7 @@ const de = new M("common-material"), gi = (n) => {
|
|
|
2306
2306
|
})]
|
|
2307
2307
|
});
|
|
2308
2308
|
};
|
|
2309
|
-
const Ue = new
|
|
2309
|
+
const Ue = new N("chat-input-material-item"), mn = (n) => {
|
|
2310
2310
|
const {
|
|
2311
2311
|
material: e
|
|
2312
2312
|
} = n;
|
|
@@ -2326,15 +2326,15 @@ const Ue = new M("chat-input-material-item"), mn = (n) => {
|
|
|
2326
2326
|
children: [c("div", {
|
|
2327
2327
|
className: Ue.e("icon"),
|
|
2328
2328
|
onClick: i,
|
|
2329
|
-
children: c(
|
|
2330
|
-
}),
|
|
2329
|
+
children: c(ri, {})
|
|
2330
|
+
}), j(t, {
|
|
2331
2331
|
material: e,
|
|
2332
2332
|
controller: n.controller
|
|
2333
2333
|
})]
|
|
2334
2334
|
});
|
|
2335
2335
|
};
|
|
2336
|
-
const
|
|
2337
|
-
const e = z(et()), t = z(null), i =
|
|
2336
|
+
const ie = new N("user-message-question"), wi = (n) => {
|
|
2337
|
+
const e = z(et()), t = z(null), i = B(() => n.message.content), s = B(() => tn.parseMixedContent(i.value));
|
|
2338
2338
|
return H(() => {
|
|
2339
2339
|
t.value = new Ut({
|
|
2340
2340
|
id: e,
|
|
@@ -2344,19 +2344,19 @@ const ne = new M("user-message-question"), wi = (n) => {
|
|
|
2344
2344
|
}
|
|
2345
2345
|
});
|
|
2346
2346
|
}, [s.value.remainingText]), c("div", {
|
|
2347
|
-
className:
|
|
2347
|
+
className: ie.b(),
|
|
2348
2348
|
children: [c("div", {
|
|
2349
|
-
className:
|
|
2349
|
+
className: ie.e("user-header"),
|
|
2350
2350
|
children: [n.children, c("div", {
|
|
2351
|
-
className:
|
|
2351
|
+
className: ie.e("user"),
|
|
2352
2352
|
children: "我"
|
|
2353
2353
|
})]
|
|
2354
2354
|
}), c("div", {
|
|
2355
|
-
className:
|
|
2355
|
+
className: ie.e("content"),
|
|
2356
2356
|
children: c("div", {
|
|
2357
|
-
className:
|
|
2357
|
+
className: ie.em("content", "body"),
|
|
2358
2358
|
children: [s.value.hasResources && c("div", {
|
|
2359
|
-
className:
|
|
2359
|
+
className: ie.em("content", "material"),
|
|
2360
2360
|
children: s.value.resources.map((o) => c(mn, {
|
|
2361
2361
|
material: o,
|
|
2362
2362
|
disabled: !0,
|
|
@@ -2372,32 +2372,32 @@ const ne = new M("user-message-question"), wi = (n) => {
|
|
|
2372
2372
|
})]
|
|
2373
2373
|
});
|
|
2374
2374
|
};
|
|
2375
|
-
const
|
|
2376
|
-
const e =
|
|
2375
|
+
const ye = new N("error-message"), bi = (n) => {
|
|
2376
|
+
const e = B(() => n.message.content);
|
|
2377
2377
|
return c("div", {
|
|
2378
|
-
className:
|
|
2378
|
+
className: ye.b(),
|
|
2379
2379
|
children: [c("div", {
|
|
2380
|
-
className:
|
|
2380
|
+
className: ye.b("header"),
|
|
2381
2381
|
children: [c("div", {
|
|
2382
|
-
className:
|
|
2382
|
+
className: ye.be("header", "caption"),
|
|
2383
2383
|
children: "AI "
|
|
2384
2384
|
}), n.children]
|
|
2385
2385
|
}), c("div", {
|
|
2386
|
-
className: "".concat(
|
|
2386
|
+
className: "".concat(ye.e("content"), " pre-wrap-container"),
|
|
2387
2387
|
children: c("span", {
|
|
2388
2388
|
children: e
|
|
2389
2389
|
})
|
|
2390
2390
|
})]
|
|
2391
2391
|
});
|
|
2392
2392
|
};
|
|
2393
|
-
const
|
|
2394
|
-
className:
|
|
2393
|
+
const bt = new N("unknown-message"), yi = (n) => c("div", {
|
|
2394
|
+
className: bt.b(),
|
|
2395
2395
|
children: c("div", {
|
|
2396
|
-
className: "".concat(
|
|
2396
|
+
className: "".concat(bt.e("content"), " pre-wrap-container"),
|
|
2397
2397
|
children: ["暂未支持的消息类型: ", n.message.type]
|
|
2398
2398
|
})
|
|
2399
2399
|
});
|
|
2400
|
-
const Ci = new
|
|
2400
|
+
const Ci = new N("chat-message-item"), Ti = (n) => {
|
|
2401
2401
|
const {
|
|
2402
2402
|
message: e,
|
|
2403
2403
|
size: t
|
|
@@ -2408,14 +2408,14 @@ const Ci = new M("chat-message-item"), Ti = (n) => {
|
|
|
2408
2408
|
i = e.role === "ASSISTANT" ? mi : wi;
|
|
2409
2409
|
break;
|
|
2410
2410
|
case "ERROR":
|
|
2411
|
-
i =
|
|
2411
|
+
i = bi;
|
|
2412
2412
|
break;
|
|
2413
2413
|
default:
|
|
2414
|
-
i =
|
|
2414
|
+
i = yi;
|
|
2415
2415
|
}
|
|
2416
2416
|
return c("div", {
|
|
2417
2417
|
className: Ci.b(),
|
|
2418
|
-
children:
|
|
2418
|
+
children: j(i, {
|
|
2419
2419
|
size: t,
|
|
2420
2420
|
message: e,
|
|
2421
2421
|
controller: n.controller,
|
|
@@ -2423,7 +2423,7 @@ const Ci = new M("chat-message-item"), Ti = (n) => {
|
|
|
2423
2423
|
})
|
|
2424
2424
|
});
|
|
2425
2425
|
};
|
|
2426
|
-
class
|
|
2426
|
+
class V {
|
|
2427
2427
|
constructor(e) {
|
|
2428
2428
|
this.msg = e;
|
|
2429
2429
|
}
|
|
@@ -2523,37 +2523,120 @@ class We {
|
|
|
2523
2523
|
return this.material.data;
|
|
2524
2524
|
}
|
|
2525
2525
|
}
|
|
2526
|
-
const
|
|
2526
|
+
const L = new N("chat-toolbar-item"), xi = (n) => {
|
|
2527
|
+
var f, m, b;
|
|
2528
|
+
const {
|
|
2529
|
+
model: e,
|
|
2530
|
+
data: t,
|
|
2531
|
+
className: i,
|
|
2532
|
+
disabled: s = !1,
|
|
2533
|
+
buttonType: o = "default",
|
|
2534
|
+
onClick: r
|
|
2535
|
+
} = n, [a, u] = ne(!1), h = P(null), p = (g) => typeof g.hidden == "function" ? g.hidden(t) : g.hidden === !0;
|
|
2536
|
+
if (p(e))
|
|
2537
|
+
return c(Y, {});
|
|
2538
|
+
const l = (g) => s ? !0 : typeof g.disabled == "function" ? g.disabled(t) : g.disabled === !0, v = (g) => {
|
|
2539
|
+
var T, C, S, O;
|
|
2540
|
+
if (typeof g.icon == "function")
|
|
2541
|
+
return g.icon();
|
|
2542
|
+
if ((T = g.icon) != null && T.showIcon && ((C = g.icon) != null && C.cssClass))
|
|
2543
|
+
return c("i", {
|
|
2544
|
+
className: g.icon.cssClass
|
|
2545
|
+
});
|
|
2546
|
+
if ((S = g.icon) != null && S.showIcon && ((O = g.icon) != null && O.imagePath))
|
|
2547
|
+
return tt(g.icon.imagePath) ? c("div", {
|
|
2548
|
+
dangerouslySetInnerHTML: {
|
|
2549
|
+
__html: g.icon.imagePath
|
|
2550
|
+
}
|
|
2551
|
+
}) : c("img", {
|
|
2552
|
+
src: g.icon.imagePath
|
|
2553
|
+
});
|
|
2554
|
+
}, _ = (g) => {
|
|
2555
|
+
l(e) || u(!0);
|
|
2556
|
+
}, d = (g, T) => {
|
|
2557
|
+
l(T) || (u(!1), r(g, T));
|
|
2558
|
+
};
|
|
2559
|
+
return H(() => {
|
|
2560
|
+
const g = (T) => {
|
|
2561
|
+
h.current && h.current.contains(T.target) || u(!1);
|
|
2562
|
+
};
|
|
2563
|
+
return a && document.addEventListener("mousedown", g), () => {
|
|
2564
|
+
document.removeEventListener("mousedown", g);
|
|
2565
|
+
};
|
|
2566
|
+
}, [a]), c("div", {
|
|
2567
|
+
className: "".concat(L.b(), " ").concat(L.b(o), " ").concat(e.customClass || "", " ").concat(i || "", " ").concat(L.is("disabled", l(e)), " ").concat(L.is("more", !!((f = e.children) != null && f.length))),
|
|
2568
|
+
children: [c("div", {
|
|
2569
|
+
title: e.title,
|
|
2570
|
+
className: L.e("content"),
|
|
2571
|
+
onClick: (g) => d(g, e),
|
|
2572
|
+
children: [c("div", {
|
|
2573
|
+
className: L.em("content", "icon"),
|
|
2574
|
+
children: v(e)
|
|
2575
|
+
}), c("div", {
|
|
2576
|
+
className: L.em("content", "label"),
|
|
2577
|
+
children: e.label
|
|
2578
|
+
})]
|
|
2579
|
+
}), ((m = e.children) == null ? void 0 : m.length) && c("div", {
|
|
2580
|
+
title: "更多",
|
|
2581
|
+
className: L.e("more"),
|
|
2582
|
+
onClick: _,
|
|
2583
|
+
children: c("i", {
|
|
2584
|
+
"aria-hidden": "true",
|
|
2585
|
+
className: "fa fa-angle-down ".concat(L.em("more", "icon"))
|
|
2586
|
+
})
|
|
2587
|
+
}), a && c("div", {
|
|
2588
|
+
ref: h,
|
|
2589
|
+
className: L.b("dropdown"),
|
|
2590
|
+
children: (b = e.children) == null ? void 0 : b.map((g, T) => {
|
|
2591
|
+
if (!p(g))
|
|
2592
|
+
return c("div", {
|
|
2593
|
+
title: g.title,
|
|
2594
|
+
onClick: (C) => d(C, g),
|
|
2595
|
+
className: "".concat(L.be("dropdown", "item"), " ").concat(g.customClass || "", " ").concat(L.is("disabled", l(g))),
|
|
2596
|
+
children: [c("div", {
|
|
2597
|
+
className: L.bem("dropdown", "item", "icon"),
|
|
2598
|
+
children: v(g)
|
|
2599
|
+
}), c("div", {
|
|
2600
|
+
className: L.bem("dropdown", "item", "label"),
|
|
2601
|
+
children: g.label
|
|
2602
|
+
})]
|
|
2603
|
+
}, T);
|
|
2604
|
+
})
|
|
2605
|
+
})]
|
|
2606
|
+
});
|
|
2607
|
+
};
|
|
2608
|
+
const Si = new N("chat-toolbar"), Je = (n) => {
|
|
2527
2609
|
const {
|
|
2528
2610
|
controller: e,
|
|
2529
2611
|
items: t = [],
|
|
2530
2612
|
data: i,
|
|
2531
2613
|
type: s,
|
|
2532
2614
|
className: o
|
|
2533
|
-
} = n,
|
|
2534
|
-
let
|
|
2535
|
-
const
|
|
2615
|
+
} = n, r = on(ot);
|
|
2616
|
+
let a = [];
|
|
2617
|
+
const u = [{
|
|
2536
2618
|
label: "重置对话",
|
|
2537
2619
|
title: "重置对话",
|
|
2538
2620
|
icon: () => c(di, {}),
|
|
2539
2621
|
onClick: () => {
|
|
2540
2622
|
e.resetTopic();
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2623
|
+
},
|
|
2624
|
+
children: [{
|
|
2625
|
+
label: "清空对话",
|
|
2626
|
+
title: "清空对话",
|
|
2627
|
+
icon: () => c(ui, {}),
|
|
2628
|
+
onClick: () => {
|
|
2629
|
+
e.clearTopic();
|
|
2630
|
+
}
|
|
2631
|
+
}, {
|
|
2632
|
+
label: "新建对话",
|
|
2633
|
+
title: "新建对话",
|
|
2634
|
+
icon: () => c(Kn, {}),
|
|
2635
|
+
onClick: () => {
|
|
2636
|
+
r.newTopic && r.newTopic();
|
|
2637
|
+
}
|
|
2638
|
+
}]
|
|
2639
|
+
}], h = [{
|
|
2557
2640
|
label: "刷新",
|
|
2558
2641
|
title: "刷新",
|
|
2559
2642
|
icon: () => c(wt, {}),
|
|
@@ -2575,7 +2658,7 @@ const ee = new M("chat-toolbar"), Je = (n) => {
|
|
|
2575
2658
|
e.copyMessage(i);
|
|
2576
2659
|
}
|
|
2577
2660
|
}];
|
|
2578
|
-
|
|
2661
|
+
r.enableBackFill && h.unshift({
|
|
2579
2662
|
label: "回填",
|
|
2580
2663
|
title: "回填",
|
|
2581
2664
|
icon: () => c(Vn, {}),
|
|
@@ -2583,7 +2666,7 @@ const ee = new M("chat-toolbar"), Je = (n) => {
|
|
|
2583
2666
|
e.backfill(i);
|
|
2584
2667
|
}
|
|
2585
2668
|
});
|
|
2586
|
-
const
|
|
2669
|
+
const p = [{
|
|
2587
2670
|
label: "刷新",
|
|
2588
2671
|
title: "刷新",
|
|
2589
2672
|
icon: () => c(wt, {}),
|
|
@@ -2592,62 +2675,41 @@ const ee = new M("chat-toolbar"), Je = (n) => {
|
|
|
2592
2675
|
}
|
|
2593
2676
|
}];
|
|
2594
2677
|
if (s === "content")
|
|
2595
|
-
switch (
|
|
2678
|
+
switch (i.type) {
|
|
2596
2679
|
case "DEFAULT":
|
|
2597
|
-
i.role === "ASSISTANT" ?
|
|
2680
|
+
i.role === "ASSISTANT" ? a = [...h, ...t] : a = [...p];
|
|
2598
2681
|
break;
|
|
2599
2682
|
case "ERROR":
|
|
2600
|
-
|
|
2683
|
+
a = [...h, ...t];
|
|
2601
2684
|
break;
|
|
2602
2685
|
}
|
|
2603
2686
|
else
|
|
2604
|
-
|
|
2605
|
-
const
|
|
2606
|
-
|
|
2607
|
-
return;
|
|
2608
|
-
const x = {
|
|
2687
|
+
a = [...u, ...t];
|
|
2688
|
+
const l = (_, d) => {
|
|
2689
|
+
const f = {
|
|
2609
2690
|
...i
|
|
2610
2691
|
};
|
|
2611
|
-
if (i instanceof
|
|
2692
|
+
if (i instanceof V && (Object.assign(f, {
|
|
2612
2693
|
topic: e.topic
|
|
2613
|
-
}),
|
|
2614
|
-
|
|
2694
|
+
}), f.msg.realcontent = i.realcontent), d.onClick && typeof d.onClick == "function")
|
|
2695
|
+
d.onClick(_, d, e.context, e.params, f);
|
|
2615
2696
|
else {
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2697
|
+
const m = n.controller.opts.extendToolbarClick;
|
|
2698
|
+
m && typeof m == "function" && m(_, d, e.context, e.params, f);
|
|
2618
2699
|
}
|
|
2619
|
-
},
|
|
2700
|
+
}, v = X(() => s === "content" && (i == null ? void 0 : i.state) === 20 && (i == null ? void 0 : i.completed) !== !0, [i == null ? void 0 : i.state, i == null ? void 0 : i.completed]);
|
|
2620
2701
|
return c("div", {
|
|
2621
|
-
className: "".concat(
|
|
2622
|
-
children:
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
children: [c("div", {
|
|
2630
|
-
className: "".concat(ee.em("item", "icon")),
|
|
2631
|
-
children: typeof m.icon == "function" ? m.icon() : ((x = m.icon) == null ? void 0 : x.showIcon) && c(j, {
|
|
2632
|
-
children: (C = m.icon) != null && C.cssClass ? c("i", {
|
|
2633
|
-
className: m.icon.cssClass
|
|
2634
|
-
}) : (S = m.icon) != null && S.imagePath ? tt(m.icon.imagePath) ? c("div", {
|
|
2635
|
-
dangerouslySetInnerHTML: {
|
|
2636
|
-
__html: m.icon.imagePath
|
|
2637
|
-
}
|
|
2638
|
-
}) : c("img", {
|
|
2639
|
-
src: m.icon.imagePath
|
|
2640
|
-
}) : null
|
|
2641
|
-
})
|
|
2642
|
-
}), c("div", {
|
|
2643
|
-
className: "".concat(ee.em("item", "label")),
|
|
2644
|
-
children: m.label
|
|
2645
|
-
})]
|
|
2646
|
-
}, b);
|
|
2647
|
-
})
|
|
2702
|
+
className: "".concat(Si.b(), " ").concat(o || ""),
|
|
2703
|
+
children: a.map((_, d) => c(xi, {
|
|
2704
|
+
data: i,
|
|
2705
|
+
model: _,
|
|
2706
|
+
disabled: v,
|
|
2707
|
+
buttonType: s === "content" ? "circle" : "default",
|
|
2708
|
+
onClick: l.bind(void 0)
|
|
2709
|
+
}, d))
|
|
2648
2710
|
});
|
|
2649
2711
|
};
|
|
2650
|
-
function
|
|
2712
|
+
function ki(n, e) {
|
|
2651
2713
|
let t = null;
|
|
2652
2714
|
return function(...i) {
|
|
2653
2715
|
t || (t = setTimeout(() => {
|
|
@@ -2655,20 +2717,20 @@ function xi(n, e) {
|
|
|
2655
2717
|
}, e));
|
|
2656
2718
|
};
|
|
2657
2719
|
}
|
|
2658
|
-
const
|
|
2659
|
-
const e = z(!1), t = z({}), i = new
|
|
2720
|
+
const Ei = (n) => {
|
|
2721
|
+
const e = z(!1), t = z({}), i = new N("chat-back-bottom"), s = z(null), o = () => {
|
|
2660
2722
|
if (s.value) {
|
|
2661
2723
|
const u = n.visibilityHeight || 200, h = s.value.scrollHeight - s.value.scrollTop - s.value.offsetHeight;
|
|
2662
2724
|
e.value = h >= u;
|
|
2663
2725
|
}
|
|
2664
|
-
},
|
|
2726
|
+
}, r = () => {
|
|
2665
2727
|
var u;
|
|
2666
2728
|
s.value && (s.value.scrollTo({
|
|
2667
2729
|
top: s.value.scrollHeight,
|
|
2668
2730
|
behavior: "smooth"
|
|
2669
2731
|
}), (u = n.onClick) == null || u.call(n));
|
|
2670
|
-
},
|
|
2671
|
-
return
|
|
2732
|
+
}, a = ki(o, 300);
|
|
2733
|
+
return X(() => {
|
|
2672
2734
|
t.value = {
|
|
2673
2735
|
right: "".concat(n.right, "px"),
|
|
2674
2736
|
bottom: "".concat(n.bottom, "px")
|
|
@@ -2677,19 +2739,19 @@ const Si = (n) => {
|
|
|
2677
2739
|
var u;
|
|
2678
2740
|
if (n.target) {
|
|
2679
2741
|
const h = (u = document.querySelector(n.target)) != null ? u : void 0;
|
|
2680
|
-
h && (s.value = h, h.addEventListener("scroll",
|
|
2742
|
+
h && (s.value = h, h.addEventListener("scroll", a), o());
|
|
2681
2743
|
}
|
|
2682
2744
|
}, []), c("div", {
|
|
2683
2745
|
className: "".concat(i.b(), " ").concat(i.is("visible", e.value)),
|
|
2684
2746
|
style: t.value,
|
|
2685
|
-
onClick:
|
|
2747
|
+
onClick: r,
|
|
2686
2748
|
children: c(li, {
|
|
2687
2749
|
className: i.e("icon")
|
|
2688
2750
|
})
|
|
2689
2751
|
});
|
|
2690
2752
|
};
|
|
2691
|
-
const
|
|
2692
|
-
const e =
|
|
2753
|
+
const yt = new N("chat-messages"), Ct = (n) => {
|
|
2754
|
+
const e = P(null), [t, i] = ne(!0), s = P(!1), o = n.controller.messages, r = () => {
|
|
2693
2755
|
const h = e.current;
|
|
2694
2756
|
h && (s.current = !0, h.scrollTo({
|
|
2695
2757
|
top: h.scrollHeight,
|
|
@@ -2699,9 +2761,9 @@ const bt = new M("chat-messages"), Ct = (n) => {
|
|
|
2699
2761
|
}, 500));
|
|
2700
2762
|
};
|
|
2701
2763
|
H(() => {
|
|
2702
|
-
t &&
|
|
2764
|
+
t && r();
|
|
2703
2765
|
}, [o.value]);
|
|
2704
|
-
const
|
|
2766
|
+
const a = () => {
|
|
2705
2767
|
if (!s.current && e.current) {
|
|
2706
2768
|
const {
|
|
2707
2769
|
scrollTop: h,
|
|
@@ -2715,8 +2777,8 @@ const bt = new M("chat-messages"), Ct = (n) => {
|
|
|
2715
2777
|
};
|
|
2716
2778
|
return c("div", {
|
|
2717
2779
|
ref: e,
|
|
2718
|
-
className:
|
|
2719
|
-
onScroll:
|
|
2780
|
+
className: yt.b(),
|
|
2781
|
+
onScroll: a,
|
|
2720
2782
|
children: [o.value.map((h) => {
|
|
2721
2783
|
var l;
|
|
2722
2784
|
const p = ((l = h.content) == null ? void 0 : l.length) || 0;
|
|
@@ -2731,15 +2793,15 @@ const bt = new M("chat-messages"), Ct = (n) => {
|
|
|
2731
2793
|
controller: n.controller
|
|
2732
2794
|
})
|
|
2733
2795
|
}, h.messageid) : null;
|
|
2734
|
-
}), c(
|
|
2796
|
+
}), c(Ei, {
|
|
2735
2797
|
right: 20,
|
|
2736
2798
|
bottom: 14,
|
|
2737
|
-
target: ".".concat(
|
|
2799
|
+
target: ".".concat(yt.b()),
|
|
2738
2800
|
onClick: u
|
|
2739
2801
|
})]
|
|
2740
2802
|
});
|
|
2741
2803
|
};
|
|
2742
|
-
function
|
|
2804
|
+
function Ni(n, e) {
|
|
2743
2805
|
for (var t in e)
|
|
2744
2806
|
n[t] = e[t];
|
|
2745
2807
|
return n;
|
|
@@ -2756,27 +2818,27 @@ function Tt(n, e) {
|
|
|
2756
2818
|
function xt(n) {
|
|
2757
2819
|
this.props = n;
|
|
2758
2820
|
}
|
|
2759
|
-
(xt.prototype = new
|
|
2821
|
+
(xt.prototype = new F()).isPureReactComponent = !0, xt.prototype.shouldComponentUpdate = function(n, e) {
|
|
2760
2822
|
return Tt(this.props, n) || Tt(this.state, e);
|
|
2761
2823
|
};
|
|
2762
2824
|
var St = w.__b;
|
|
2763
2825
|
w.__b = function(n) {
|
|
2764
2826
|
n.type && n.type.__f && n.ref && (n.props.ref = n.ref, n.ref = null), St && St(n);
|
|
2765
2827
|
};
|
|
2766
|
-
var
|
|
2828
|
+
var Mi = w.__e;
|
|
2767
2829
|
w.__e = function(n, e, t, i) {
|
|
2768
2830
|
if (n.then) {
|
|
2769
2831
|
for (var s, o = e; o = o.__; )
|
|
2770
2832
|
if ((s = o.__c) && s.__c)
|
|
2771
2833
|
return e.__e == null && (e.__e = t.__e, e.__k = t.__k), s.__c(n, e);
|
|
2772
2834
|
}
|
|
2773
|
-
|
|
2835
|
+
Mi(n, e, t, i);
|
|
2774
2836
|
};
|
|
2775
2837
|
var kt = w.unmount;
|
|
2776
2838
|
function _n(n, e, t) {
|
|
2777
2839
|
return n && (n.__c && n.__c.__H && (n.__c.__H.__.forEach(function(i) {
|
|
2778
2840
|
typeof i.__c == "function" && i.__c();
|
|
2779
|
-
}), n.__c.__H = null), (n =
|
|
2841
|
+
}), n.__c.__H = null), (n = Ni({}, n)).__c != null && (n.__c.__P === t && (n.__c.__P = e), n.__c = null), n.__k = n.__k && n.__k.map(function(i) {
|
|
2780
2842
|
return _n(i, e, t);
|
|
2781
2843
|
})), n;
|
|
2782
2844
|
}
|
|
@@ -2798,14 +2860,14 @@ function Ce() {
|
|
|
2798
2860
|
w.unmount = function(n) {
|
|
2799
2861
|
var e = n.__c;
|
|
2800
2862
|
e && e.__R && e.__R(), e && n.__h === !0 && (n.type = null), kt && kt(n);
|
|
2801
|
-
}, (Ve.prototype = new
|
|
2863
|
+
}, (Ve.prototype = new F()).__c = function(n, e) {
|
|
2802
2864
|
var t = e.__c, i = this;
|
|
2803
2865
|
i.t == null && (i.t = []), i.t.push(t);
|
|
2804
|
-
var s = wn(i.__v), o = !1,
|
|
2805
|
-
o || (o = !0, t.__R = null, s ? s(
|
|
2866
|
+
var s = wn(i.__v), o = !1, r = function() {
|
|
2867
|
+
o || (o = !0, t.__R = null, s ? s(a) : a());
|
|
2806
2868
|
};
|
|
2807
|
-
t.__R =
|
|
2808
|
-
var
|
|
2869
|
+
t.__R = r;
|
|
2870
|
+
var a = function() {
|
|
2809
2871
|
if (!--i.__u) {
|
|
2810
2872
|
if (i.state.__a) {
|
|
2811
2873
|
var h = i.state.__a;
|
|
@@ -2816,7 +2878,7 @@ w.unmount = function(n) {
|
|
|
2816
2878
|
p.forceUpdate();
|
|
2817
2879
|
}
|
|
2818
2880
|
}, u = e.__h === !0;
|
|
2819
|
-
i.__u++ || u || i.setState({ __a: i.__b = i.__v.__k[0] }), n.then(
|
|
2881
|
+
i.__u++ || u || i.setState({ __a: i.__b = i.__v.__k[0] }), n.then(r, r);
|
|
2820
2882
|
}, Ve.prototype.componentWillUnmount = function() {
|
|
2821
2883
|
this.t = [];
|
|
2822
2884
|
}, Ve.prototype.render = function(n, e) {
|
|
@@ -2827,8 +2889,8 @@ w.unmount = function(n) {
|
|
|
2827
2889
|
}
|
|
2828
2890
|
this.__b = null;
|
|
2829
2891
|
}
|
|
2830
|
-
var s = e.__a &&
|
|
2831
|
-
return s && (s.__h = null), [
|
|
2892
|
+
var s = e.__a && j(Y, null, n.fallback);
|
|
2893
|
+
return s && (s.__h = null), [j(Y, null, e.__a ? null : n.children), s];
|
|
2832
2894
|
};
|
|
2833
2895
|
var Et = function(n, e, t) {
|
|
2834
2896
|
if (++t[1] === t[0] && n.o.delete(e), n.props.revealOrder && (n.props.revealOrder[0] !== "t" || !n.o.size))
|
|
@@ -2840,28 +2902,28 @@ var Et = function(n, e, t) {
|
|
|
2840
2902
|
n.u = t = t[2];
|
|
2841
2903
|
}
|
|
2842
2904
|
};
|
|
2843
|
-
function
|
|
2905
|
+
function $i(n) {
|
|
2844
2906
|
return this.getChildContext = function() {
|
|
2845
2907
|
return n.context;
|
|
2846
2908
|
}, n.children;
|
|
2847
2909
|
}
|
|
2848
|
-
function
|
|
2910
|
+
function Ai(n) {
|
|
2849
2911
|
var e = this, t = n.i;
|
|
2850
2912
|
e.componentWillUnmount = function() {
|
|
2851
|
-
|
|
2913
|
+
oe(null, e.l), e.l = null, e.i = null;
|
|
2852
2914
|
}, e.i && e.i !== t && e.componentWillUnmount(), e.l || (e.i = t, e.l = { nodeType: 1, parentNode: t, childNodes: [], appendChild: function(i) {
|
|
2853
2915
|
this.childNodes.push(i), e.i.appendChild(i);
|
|
2854
2916
|
}, insertBefore: function(i, s) {
|
|
2855
2917
|
this.childNodes.push(i), e.i.appendChild(i);
|
|
2856
2918
|
}, removeChild: function(i) {
|
|
2857
2919
|
this.childNodes.splice(this.childNodes.indexOf(i) >>> 1, 1), e.i.removeChild(i);
|
|
2858
|
-
} }),
|
|
2920
|
+
} }), oe(j($i, { context: e.context }, n.__v), e.l);
|
|
2859
2921
|
}
|
|
2860
|
-
function
|
|
2861
|
-
var t =
|
|
2922
|
+
function Ii(n, e) {
|
|
2923
|
+
var t = j(Ai, { __v: n, i: e });
|
|
2862
2924
|
return t.containerInfo = e, t;
|
|
2863
2925
|
}
|
|
2864
|
-
(Ce.prototype = new
|
|
2926
|
+
(Ce.prototype = new F()).__a = function(n) {
|
|
2865
2927
|
var e = this, t = wn(e.__v), i = e.o.get(n);
|
|
2866
2928
|
return i[0]++, function(s) {
|
|
2867
2929
|
var o = function() {
|
|
@@ -2882,47 +2944,47 @@ function $i(n, e) {
|
|
|
2882
2944
|
Et(n, t, e);
|
|
2883
2945
|
});
|
|
2884
2946
|
};
|
|
2885
|
-
var
|
|
2947
|
+
var Di = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Li = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, zi = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Hi = /[A-Z0-9]/g, Oi = typeof document < "u", Bi = function(n) {
|
|
2886
2948
|
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(n);
|
|
2887
2949
|
};
|
|
2888
|
-
|
|
2889
|
-
Object.defineProperty(
|
|
2950
|
+
F.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(n) {
|
|
2951
|
+
Object.defineProperty(F.prototype, n, { configurable: !0, get: function() {
|
|
2890
2952
|
return this["UNSAFE_" + n];
|
|
2891
2953
|
}, set: function(e) {
|
|
2892
2954
|
Object.defineProperty(this, n, { configurable: !0, writable: !0, value: e });
|
|
2893
2955
|
} });
|
|
2894
2956
|
});
|
|
2895
2957
|
var Nt = w.event;
|
|
2896
|
-
function
|
|
2958
|
+
function Pi() {
|
|
2897
2959
|
}
|
|
2898
|
-
function
|
|
2960
|
+
function Ri() {
|
|
2899
2961
|
return this.cancelBubble;
|
|
2900
2962
|
}
|
|
2901
|
-
function
|
|
2963
|
+
function Fi() {
|
|
2902
2964
|
return this.defaultPrevented;
|
|
2903
2965
|
}
|
|
2904
2966
|
w.event = function(n) {
|
|
2905
|
-
return Nt && (n = Nt(n)), n.persist =
|
|
2967
|
+
return Nt && (n = Nt(n)), n.persist = Pi, n.isPropagationStopped = Ri, n.isDefaultPrevented = Fi, n.nativeEvent = n;
|
|
2906
2968
|
};
|
|
2907
|
-
var
|
|
2969
|
+
var Ui = { enumerable: !1, configurable: !0, get: function() {
|
|
2908
2970
|
return this.class;
|
|
2909
2971
|
} }, Mt = w.vnode;
|
|
2910
2972
|
w.vnode = function(n) {
|
|
2911
2973
|
typeof n.type == "string" && function(e) {
|
|
2912
2974
|
var t = e.props, i = e.type, s = {};
|
|
2913
2975
|
for (var o in t) {
|
|
2914
|
-
var
|
|
2915
|
-
if (!(o === "value" && "defaultValue" in t &&
|
|
2916
|
-
var
|
|
2917
|
-
o === "defaultValue" && "value" in t && t.value == null ? o = "value" : o === "download" &&
|
|
2976
|
+
var r = t[o];
|
|
2977
|
+
if (!(o === "value" && "defaultValue" in t && r == null || Oi && o === "children" && i === "noscript" || o === "class" || o === "className")) {
|
|
2978
|
+
var a = o.toLowerCase();
|
|
2979
|
+
o === "defaultValue" && "value" in t && t.value == null ? o = "value" : o === "download" && r === !0 ? r = "" : a === "ondoubleclick" ? o = "ondblclick" : a !== "onchange" || i !== "input" && i !== "textarea" || Bi(t.type) ? a === "onfocus" ? o = "onfocusin" : a === "onblur" ? o = "onfocusout" : zi.test(o) ? o = a : i.indexOf("-") === -1 && Li.test(o) ? o = o.replace(Hi, "-$&").toLowerCase() : r === null && (r = void 0) : a = o = "oninput", a === "oninput" && s[o = a] && (o = "oninputCapture"), s[o] = r;
|
|
2918
2980
|
}
|
|
2919
2981
|
}
|
|
2920
2982
|
i == "select" && s.multiple && Array.isArray(s.value) && (s.value = Ee(t.children).forEach(function(u) {
|
|
2921
2983
|
u.props.selected = s.value.indexOf(u.props.value) != -1;
|
|
2922
2984
|
})), i == "select" && s.defaultValue != null && (s.value = Ee(t.children).forEach(function(u) {
|
|
2923
2985
|
u.props.selected = s.multiple ? s.defaultValue.indexOf(u.props.value) != -1 : s.defaultValue == u.props.value;
|
|
2924
|
-
})), t.class && !t.className ? (s.class = t.class, Object.defineProperty(s, "className",
|
|
2925
|
-
}(n), n.$$typeof =
|
|
2986
|
+
})), t.class && !t.className ? (s.class = t.class, Object.defineProperty(s, "className", Ui)) : (t.className && !t.class || t.class && t.className) && (s.class = s.className = t.className), e.props = s;
|
|
2987
|
+
}(n), n.$$typeof = Di, Mt && Mt(n);
|
|
2926
2988
|
};
|
|
2927
2989
|
var $t = w.__r;
|
|
2928
2990
|
w.__r = function(n) {
|
|
@@ -2935,11 +2997,11 @@ w.diffed = function(n) {
|
|
|
2935
2997
|
t != null && n.type === "textarea" && "value" in e && e.value !== t.value && (t.value = e.value == null ? "" : e.value);
|
|
2936
2998
|
};
|
|
2937
2999
|
var me = /* @__PURE__ */ new Map();
|
|
2938
|
-
function
|
|
3000
|
+
function Wi(n) {
|
|
2939
3001
|
var e = me.get(n);
|
|
2940
3002
|
e && e.destroy();
|
|
2941
3003
|
}
|
|
2942
|
-
function
|
|
3004
|
+
function Vi(n) {
|
|
2943
3005
|
var e = me.get(n);
|
|
2944
3006
|
e && e.update();
|
|
2945
3007
|
}
|
|
@@ -2954,29 +3016,29 @@ typeof window > "u" ? ((pe = function(n) {
|
|
|
2954
3016
|
return n && Array.prototype.forEach.call(n.length ? n : [n], function(t) {
|
|
2955
3017
|
return function(i) {
|
|
2956
3018
|
if (i && i.nodeName && i.nodeName === "TEXTAREA" && !me.has(i)) {
|
|
2957
|
-
var s, o = null,
|
|
3019
|
+
var s, o = null, r = window.getComputedStyle(i), a = (s = i.value, function() {
|
|
2958
3020
|
h({ testForHeightReduction: s === "" || !i.value.startsWith(s), restoreTextAlign: null }), s = i.value;
|
|
2959
3021
|
}), u = (function(l) {
|
|
2960
|
-
i.removeEventListener("autosize:destroy", u), i.removeEventListener("autosize:update", p), i.removeEventListener("input",
|
|
3022
|
+
i.removeEventListener("autosize:destroy", u), i.removeEventListener("autosize:update", p), i.removeEventListener("input", a), window.removeEventListener("resize", p), Object.keys(l).forEach(function(v) {
|
|
2961
3023
|
return i.style[v] = l[v];
|
|
2962
3024
|
}), me.delete(i);
|
|
2963
3025
|
}).bind(i, { height: i.style.height, resize: i.style.resize, textAlign: i.style.textAlign, overflowY: i.style.overflowY, overflowX: i.style.overflowX, wordWrap: i.style.wordWrap });
|
|
2964
|
-
i.addEventListener("autosize:destroy", u), i.addEventListener("autosize:update", p), i.addEventListener("input",
|
|
3026
|
+
i.addEventListener("autosize:destroy", u), i.addEventListener("autosize:update", p), i.addEventListener("input", a), window.addEventListener("resize", p), i.style.overflowX = "hidden", i.style.wordWrap = "break-word", me.set(i, { destroy: u, update: p }), p();
|
|
2965
3027
|
}
|
|
2966
3028
|
function h(l) {
|
|
2967
|
-
var v,
|
|
2968
|
-
if (i.scrollHeight !== 0 && (
|
|
3029
|
+
var v, _, d = l.restoreTextAlign, f = d === void 0 ? null : d, m = l.testForHeightReduction, b = m === void 0 || m, g = r.overflowY;
|
|
3030
|
+
if (i.scrollHeight !== 0 && (r.resize === "vertical" ? i.style.resize = "none" : r.resize === "both" && (i.style.resize = "horizontal"), b && (v = function(C) {
|
|
2969
3031
|
for (var S = []; C && C.parentNode && C.parentNode instanceof Element; )
|
|
2970
3032
|
C.parentNode.scrollTop && S.push([C.parentNode, C.parentNode.scrollTop]), C = C.parentNode;
|
|
2971
3033
|
return function() {
|
|
2972
3034
|
return S.forEach(function(O) {
|
|
2973
|
-
var I = O[0],
|
|
2974
|
-
I.style.scrollBehavior = "auto", I.scrollTop =
|
|
3035
|
+
var I = O[0], U = O[1];
|
|
3036
|
+
I.style.scrollBehavior = "auto", I.scrollTop = U, I.style.scrollBehavior = null;
|
|
2975
3037
|
});
|
|
2976
3038
|
};
|
|
2977
|
-
}(i), i.style.height = ""),
|
|
2978
|
-
var
|
|
2979
|
-
|
|
3039
|
+
}(i), i.style.height = ""), _ = r.boxSizing === "content-box" ? i.scrollHeight - (parseFloat(r.paddingTop) + parseFloat(r.paddingBottom)) : i.scrollHeight + parseFloat(r.borderTopWidth) + parseFloat(r.borderBottomWidth), r.maxHeight !== "none" && _ > parseFloat(r.maxHeight) ? (r.overflowY === "hidden" && (i.style.overflow = "scroll"), _ = parseFloat(r.maxHeight)) : r.overflowY !== "hidden" && (i.style.overflow = "hidden"), i.style.height = _ + "px", f && (i.style.textAlign = f), v && v(), o !== _ && (i.dispatchEvent(new Event("autosize:resized", { bubbles: !0 })), o = _), g !== r.overflow && !f)) {
|
|
3040
|
+
var T = r.textAlign;
|
|
3041
|
+
r.overflow === "hidden" && (i.style.textAlign = T === "start" ? "end" : "start"), h({ restoreTextAlign: T, testForHeightReduction: !0 });
|
|
2980
3042
|
}
|
|
2981
3043
|
}
|
|
2982
3044
|
function p() {
|
|
@@ -2985,11 +3047,11 @@ typeof window > "u" ? ((pe = function(n) {
|
|
|
2985
3047
|
}(t);
|
|
2986
3048
|
}), n;
|
|
2987
3049
|
}).destroy = function(n) {
|
|
2988
|
-
return n && Array.prototype.forEach.call(n.length ? n : [n],
|
|
3050
|
+
return n && Array.prototype.forEach.call(n.length ? n : [n], Wi), n;
|
|
2989
3051
|
}, pe.update = function(n) {
|
|
2990
|
-
return n && Array.prototype.forEach.call(n.length ? n : [n],
|
|
3052
|
+
return n && Array.prototype.forEach.call(n.length ? n : [n], Vi), n;
|
|
2991
3053
|
});
|
|
2992
|
-
var It = pe,
|
|
3054
|
+
var It = pe, M = /* @__PURE__ */ ((n) => (n.STYLE_CACHE = "ai-chat-style-cache", n.MINIMIZE_STYLY_CHCHE = "ai-chat-minimize-style-cache", n.DATA_BASE_NAME = "ibiz-chat", n.DATA_TABLE_NAME = "history-message", n.DATA_TABLE_KEY_NAME = "id", n))(M || {});
|
|
2993
3055
|
class Dt {
|
|
2994
3056
|
/**
|
|
2995
3057
|
* 聊天窗触发提问回调
|
|
@@ -3016,7 +3078,7 @@ class Dt {
|
|
|
3016
3078
|
* @date 2023-10-16 16:10:29
|
|
3017
3079
|
* @type {Signal<ChatMessage[]>}
|
|
3018
3080
|
*/
|
|
3019
|
-
|
|
3081
|
+
x(this, "messages", J([]));
|
|
3020
3082
|
/**
|
|
3021
3083
|
* 素材列表
|
|
3022
3084
|
*
|
|
@@ -3024,7 +3086,7 @@ class Dt {
|
|
|
3024
3086
|
* @date 2025-02-27 18:02:46
|
|
3025
3087
|
* @type {Signal<IMaterial[]>}
|
|
3026
3088
|
*/
|
|
3027
|
-
|
|
3089
|
+
x(this, "materials", J([]));
|
|
3028
3090
|
/**
|
|
3029
3091
|
* 聊天框输入值
|
|
3030
3092
|
*
|
|
@@ -3032,7 +3094,7 @@ class Dt {
|
|
|
3032
3094
|
* @date 2023-10-16 15:10:43
|
|
3033
3095
|
* @type {Signal<string>}
|
|
3034
3096
|
*/
|
|
3035
|
-
|
|
3097
|
+
x(this, "input", J(""));
|
|
3036
3098
|
/**
|
|
3037
3099
|
* 是否加载中
|
|
3038
3100
|
*
|
|
@@ -3040,7 +3102,7 @@ class Dt {
|
|
|
3040
3102
|
* @date 2025-03-10 18:03:42
|
|
3041
3103
|
* @type {Signal<boolean>}
|
|
3042
3104
|
*/
|
|
3043
|
-
|
|
3105
|
+
x(this, "isLoading", J(!1));
|
|
3044
3106
|
/**
|
|
3045
3107
|
* 视图参数
|
|
3046
3108
|
*
|
|
@@ -3048,7 +3110,7 @@ class Dt {
|
|
|
3048
3110
|
* @date 2025-02-24 14:02:23
|
|
3049
3111
|
* @type {object}
|
|
3050
3112
|
*/
|
|
3051
|
-
|
|
3113
|
+
x(this, "context");
|
|
3052
3114
|
/**
|
|
3053
3115
|
* 视图参数
|
|
3054
3116
|
*
|
|
@@ -3056,7 +3118,7 @@ class Dt {
|
|
|
3056
3118
|
* @date 2025-02-24 14:02:32
|
|
3057
3119
|
* @type {object}
|
|
3058
3120
|
*/
|
|
3059
|
-
|
|
3121
|
+
x(this, "params");
|
|
3060
3122
|
/**
|
|
3061
3123
|
* 应用实体标记
|
|
3062
3124
|
*
|
|
@@ -3064,7 +3126,7 @@ class Dt {
|
|
|
3064
3126
|
* @date 2025-02-24 14:02:10
|
|
3065
3127
|
* @type {string}
|
|
3066
3128
|
*/
|
|
3067
|
-
|
|
3129
|
+
x(this, "appDataEntityId");
|
|
3068
3130
|
/**
|
|
3069
3131
|
* 话题标识
|
|
3070
3132
|
*
|
|
@@ -3072,7 +3134,7 @@ class Dt {
|
|
|
3072
3134
|
* @date 2025-02-24 18:02:02
|
|
3073
3135
|
* @type {(string | undefined)}
|
|
3074
3136
|
*/
|
|
3075
|
-
|
|
3137
|
+
x(this, "topicId");
|
|
3076
3138
|
/**
|
|
3077
3139
|
* 话题数据
|
|
3078
3140
|
*
|
|
@@ -3080,7 +3142,7 @@ class Dt {
|
|
|
3080
3142
|
* @date 2025-03-10 16:03:26
|
|
3081
3143
|
* @type {(ITopic | undefined)}
|
|
3082
3144
|
*/
|
|
3083
|
-
|
|
3145
|
+
x(this, "topic");
|
|
3084
3146
|
this.opts = e, this.context = e.context, this.params = e.params, this.appDataEntityId = e.appDataEntityId, this.topicId = e.topicId, this.topic = e.topic, this.fecthHistory();
|
|
3085
3147
|
}
|
|
3086
3148
|
/**
|
|
@@ -3092,7 +3154,7 @@ class Dt {
|
|
|
3092
3154
|
*/
|
|
3093
3155
|
async fecthHistory() {
|
|
3094
3156
|
if (this.topicId) {
|
|
3095
|
-
const e = await
|
|
3157
|
+
const e = await q.getData(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, this.topicId);
|
|
3096
3158
|
if (e && e.data && e.data.length > 0)
|
|
3097
3159
|
return e.data.forEach((t) => {
|
|
3098
3160
|
const i = {
|
|
@@ -3126,7 +3188,7 @@ class Dt {
|
|
|
3126
3188
|
data: this.messages.value.map((t) => t._origin),
|
|
3127
3189
|
timestamp: (/* @__PURE__ */ new Date()).getTime()
|
|
3128
3190
|
};
|
|
3129
|
-
await
|
|
3191
|
+
await q.updateData(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, e);
|
|
3130
3192
|
}
|
|
3131
3193
|
/**
|
|
3132
3194
|
* 设置聊天框值
|
|
@@ -3147,7 +3209,7 @@ class Dt {
|
|
|
3147
3209
|
*/
|
|
3148
3210
|
addMessage(e) {
|
|
3149
3211
|
const t = this.messages.value.find((i) => i.messageid === e.messageid);
|
|
3150
|
-
t ? (t.update(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new
|
|
3212
|
+
t ? (t.update(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new V(e)], this.asyncToIndexDB();
|
|
3151
3213
|
}
|
|
3152
3214
|
/**
|
|
3153
3215
|
* 更新消息完成状态
|
|
@@ -3170,8 +3232,11 @@ class Dt {
|
|
|
3170
3232
|
*/
|
|
3171
3233
|
replaceMessage(e) {
|
|
3172
3234
|
const t = this.messages.value.findIndex((i) => i.messageid === e.messageid);
|
|
3173
|
-
t !== -1 ? (this.messages.value[t] = new
|
|
3174
|
-
appDataEntityId: this.appDataEntityId
|
|
3235
|
+
t !== -1 ? (this.messages.value[t] = new V(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new V(e)], this.asyncToIndexDB(), e.type === "DEFAULT" && this.opts.recommendPrompt && this.opts.recommendPrompt(this.context, this.params, {
|
|
3236
|
+
appDataEntityId: this.appDataEntityId,
|
|
3237
|
+
message: {
|
|
3238
|
+
messages: [e]
|
|
3239
|
+
}
|
|
3175
3240
|
}).then((i) => {
|
|
3176
3241
|
i && i.content && this.updateRecommendPrompt(e, i.content);
|
|
3177
3242
|
});
|
|
@@ -3187,9 +3252,9 @@ class Dt {
|
|
|
3187
3252
|
const t = this.messages.value.findIndex((i) => i.messageid === e.messageid);
|
|
3188
3253
|
if (t !== -1) {
|
|
3189
3254
|
const i = this.messages.value[t];
|
|
3190
|
-
e.content = i.content, this.messages.value[t] = new
|
|
3255
|
+
e.content = i.content, this.messages.value[t] = new V(e), this.messages.value = [...this.messages.value];
|
|
3191
3256
|
} else
|
|
3192
|
-
this.messages.value = [...this.messages.value, new
|
|
3257
|
+
this.messages.value = [...this.messages.value, new V(e)];
|
|
3193
3258
|
this.asyncToIndexDB();
|
|
3194
3259
|
}
|
|
3195
3260
|
/**
|
|
@@ -3221,7 +3286,7 @@ class Dt {
|
|
|
3221
3286
|
try {
|
|
3222
3287
|
this.isLoading.value = !0, this.messages.value.forEach((i, s) => {
|
|
3223
3288
|
const o = i._origin;
|
|
3224
|
-
o.suggestions && (o.suggestions = void 0, this.messages.value[s] = new
|
|
3289
|
+
o.suggestions && (o.suggestions = void 0, this.messages.value[s] = new V(o));
|
|
3225
3290
|
}), this.messages.value = [...this.messages.value], this.asyncToIndexDB();
|
|
3226
3291
|
let t = this.stringlyMaterialResource();
|
|
3227
3292
|
t ? t += "\n".concat(e) : t = e, this.addMessage({
|
|
@@ -3313,7 +3378,7 @@ class Dt {
|
|
|
3313
3378
|
* @memberof AiChatController
|
|
3314
3379
|
*/
|
|
3315
3380
|
async resetTopic() {
|
|
3316
|
-
this.topicId && await
|
|
3381
|
+
this.topicId && await q.deleteData(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, this.topicId), this.messages.value = [], this.opts.history(this.context, this.params, {
|
|
3317
3382
|
appDataEntityId: this.appDataEntityId
|
|
3318
3383
|
});
|
|
3319
3384
|
}
|
|
@@ -3324,7 +3389,7 @@ class Dt {
|
|
|
3324
3389
|
* @date 2025-03-18 17:03:57
|
|
3325
3390
|
*/
|
|
3326
3391
|
async clearTopic() {
|
|
3327
|
-
this.topicId && await
|
|
3392
|
+
this.topicId && await q.deleteData(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, this.topicId), this.messages.value = [];
|
|
3328
3393
|
}
|
|
3329
3394
|
/**
|
|
3330
3395
|
* 新增素材资源
|
|
@@ -3372,8 +3437,8 @@ class Dt {
|
|
|
3372
3437
|
return;
|
|
3373
3438
|
const i = this.messages.value.findIndex((o) => o.messageid === e.messageid), {
|
|
3374
3439
|
suggestions: s
|
|
3375
|
-
} =
|
|
3376
|
-
s && s.length > 0 && (e.suggestions = s, i !== -1 ? (this.messages.value[i] = new
|
|
3440
|
+
} = zn.parseMixedContent(t);
|
|
3441
|
+
s && s.length > 0 && (e.suggestions = s, i !== -1 ? (this.messages.value[i] = new V(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new V(e)], this.asyncToIndexDB());
|
|
3377
3442
|
}
|
|
3378
3443
|
/**
|
|
3379
3444
|
* 处理建议点击
|
|
@@ -3386,10 +3451,10 @@ class Dt {
|
|
|
3386
3451
|
* @return {*} {Promise<void>}
|
|
3387
3452
|
*/
|
|
3388
3453
|
async handleSuggestionClick(e, t, i) {
|
|
3389
|
-
const s = this.messages.value.findIndex((
|
|
3454
|
+
const s = this.messages.value.findIndex((r) => r.messageid === e.messageid);
|
|
3390
3455
|
if (s !== -1) {
|
|
3391
|
-
const
|
|
3392
|
-
|
|
3456
|
+
const r = this.messages.value[s]._origin;
|
|
3457
|
+
r.suggestions = void 0, this.messages.value[s] = new V(r), this.messages.value = [...this.messages.value];
|
|
3393
3458
|
}
|
|
3394
3459
|
this.asyncToIndexDB();
|
|
3395
3460
|
const {
|
|
@@ -3398,16 +3463,16 @@ class Dt {
|
|
|
3398
3463
|
switch (o) {
|
|
3399
3464
|
case "action":
|
|
3400
3465
|
if (this.opts.extendToolbarClick) {
|
|
3401
|
-
const
|
|
3402
|
-
if (!
|
|
3466
|
+
const r = t.data.actionid;
|
|
3467
|
+
if (!r)
|
|
3403
3468
|
throw new Error("actionid不能为空");
|
|
3404
3469
|
if (this.opts.otherToolbarItems && this.opts.otherToolbarItems.length > 0) {
|
|
3405
|
-
const
|
|
3406
|
-
if (!
|
|
3407
|
-
throw new Error("未找到".concat(
|
|
3408
|
-
await this.opts.extendToolbarClick(i,
|
|
3470
|
+
const a = this.opts.otherToolbarItems.find((u) => u.id === r);
|
|
3471
|
+
if (!a)
|
|
3472
|
+
throw new Error("未找到".concat(r, "标识界面行为"));
|
|
3473
|
+
await this.opts.extendToolbarClick(i, a, this.context, this.params, e);
|
|
3409
3474
|
} else
|
|
3410
|
-
throw new Error("未找到".concat(
|
|
3475
|
+
throw new Error("未找到".concat(r, "标识界面行为"));
|
|
3411
3476
|
}
|
|
3412
3477
|
break;
|
|
3413
3478
|
case "raw":
|
|
@@ -3418,7 +3483,7 @@ class Dt {
|
|
|
3418
3483
|
}
|
|
3419
3484
|
}
|
|
3420
3485
|
}
|
|
3421
|
-
class
|
|
3486
|
+
class qi {
|
|
3422
3487
|
/**
|
|
3423
3488
|
* Creates an instance of AiTopicController.
|
|
3424
3489
|
* @author tony001
|
|
@@ -3433,7 +3498,7 @@ class Wi {
|
|
|
3433
3498
|
* @date 2025-02-20 16:02:38
|
|
3434
3499
|
* @type {Signal<ChatTopic[]>}
|
|
3435
3500
|
*/
|
|
3436
|
-
|
|
3501
|
+
x(this, "topics", J([]));
|
|
3437
3502
|
/**
|
|
3438
3503
|
* 激活话题
|
|
3439
3504
|
*
|
|
@@ -3441,7 +3506,7 @@ class Wi {
|
|
|
3441
3506
|
* @date 2025-02-24 16:02:44
|
|
3442
3507
|
* @type {(Signal<ITopic | null>)}
|
|
3443
3508
|
*/
|
|
3444
|
-
|
|
3509
|
+
x(this, "activedTopic", J(null));
|
|
3445
3510
|
/**
|
|
3446
3511
|
* 当前话题配置备份
|
|
3447
3512
|
*
|
|
@@ -3450,7 +3515,7 @@ class Wi {
|
|
|
3450
3515
|
* @public
|
|
3451
3516
|
* @type {(ITopicOptions | undefined)}
|
|
3452
3517
|
*/
|
|
3453
|
-
|
|
3518
|
+
x(this, "currentTopicOptions");
|
|
3454
3519
|
this.chat = e;
|
|
3455
3520
|
}
|
|
3456
3521
|
/**
|
|
@@ -3476,16 +3541,16 @@ class Wi {
|
|
|
3476
3541
|
*/
|
|
3477
3542
|
async updateCurrentTopic(e) {
|
|
3478
3543
|
this.currentTopicOptions = e;
|
|
3479
|
-
const t = this.topics.value.findIndex((
|
|
3544
|
+
const t = this.topics.value.findIndex((r) => r.id === e.id), i = new he(e);
|
|
3480
3545
|
t !== -1 ? this.topics.value.splice(t, 1, new he(e)) : this.topics.value = [...this.topics.value, new he(e)];
|
|
3481
|
-
const s = this.topics.value.map((
|
|
3482
|
-
appid:
|
|
3483
|
-
id:
|
|
3484
|
-
type:
|
|
3485
|
-
caption:
|
|
3486
|
-
sourceCaption:
|
|
3487
|
-
url:
|
|
3488
|
-
aiChat:
|
|
3546
|
+
const s = this.topics.value.map((r) => ({
|
|
3547
|
+
appid: r.appid,
|
|
3548
|
+
id: r.id,
|
|
3549
|
+
type: r.type,
|
|
3550
|
+
caption: r.caption,
|
|
3551
|
+
sourceCaption: r.sourceCaption,
|
|
3552
|
+
url: r.url,
|
|
3553
|
+
aiChat: r.aiChat
|
|
3489
3554
|
})), o = e.configService(e.appid, "aitopics", e.type);
|
|
3490
3555
|
await (o == null ? void 0 : o.save(s)), this.activedTopic.value = i;
|
|
3491
3556
|
}
|
|
@@ -3503,11 +3568,11 @@ class Wi {
|
|
|
3503
3568
|
*/
|
|
3504
3569
|
async removeTopic(e, t, i, s, o) {
|
|
3505
3570
|
var p;
|
|
3506
|
-
let
|
|
3507
|
-
if (e.beforeDelete && (
|
|
3571
|
+
let r = !0;
|
|
3572
|
+
if (e.beforeDelete && (r = await e.beforeDelete(t, i, s, o)), !r)
|
|
3508
3573
|
return;
|
|
3509
|
-
const
|
|
3510
|
-
|
|
3574
|
+
const a = this.topics.value.findIndex((l) => l.id === s.id);
|
|
3575
|
+
a !== -1 && (this.topics.value.splice(a, 1), this.topics.value = [...this.topics.value]);
|
|
3511
3576
|
const u = this.topics.value.map((l) => ({
|
|
3512
3577
|
appid: l.appid,
|
|
3513
3578
|
id: l.id,
|
|
@@ -3517,7 +3582,7 @@ class Wi {
|
|
|
3517
3582
|
url: l.url,
|
|
3518
3583
|
aiChat: l.aiChat
|
|
3519
3584
|
})), h = e.configService(e.appid, "aitopics", e.type);
|
|
3520
|
-
await (h == null ? void 0 : h.save(u)), await
|
|
3585
|
+
await (h == null ? void 0 : h.save(u)), await q.deleteData(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, s.id), this.topics.value.length > 0 && s.id === ((p = this.activedTopic.value) == null ? void 0 : p.id) && this.handleTopicChange(this.topics.value[0]);
|
|
3521
3586
|
}
|
|
3522
3587
|
/**
|
|
3523
3588
|
* 更新话题数据
|
|
@@ -3561,14 +3626,14 @@ class Wi {
|
|
|
3561
3626
|
* @return {*} {Promise<void>}
|
|
3562
3627
|
*/
|
|
3563
3628
|
async handleTopicAction(e, t, i) {
|
|
3564
|
-
var o,
|
|
3565
|
-
const s = this.topics.value.find((
|
|
3629
|
+
var o, r;
|
|
3630
|
+
const s = this.topics.value.find((a) => a.id === t.id);
|
|
3566
3631
|
if (this.currentTopicOptions && s && s.aiChat) {
|
|
3567
3632
|
const {
|
|
3568
|
-
context:
|
|
3633
|
+
context: a,
|
|
3569
3634
|
params: u
|
|
3570
3635
|
} = s.aiChat;
|
|
3571
|
-
e === "DELETE" ? await this.removeTopic(this.currentTopicOptions,
|
|
3636
|
+
e === "DELETE" ? await this.removeTopic(this.currentTopicOptions, a, u, s, i) : e === "RENAME" && await this.updateTopic(this.currentTopicOptions, t), (r = (o = this.currentTopicOptions).action) == null || r.call(o, e, a, u, t, i);
|
|
3572
3637
|
}
|
|
3573
3638
|
}
|
|
3574
3639
|
/**
|
|
@@ -3595,7 +3660,7 @@ class Wi {
|
|
|
3595
3660
|
aiChat: e.aiChat
|
|
3596
3661
|
}, o = new he(s);
|
|
3597
3662
|
this.topics.value = [...this.topics.value, o];
|
|
3598
|
-
const
|
|
3663
|
+
const r = this.topics.value.map((p) => ({
|
|
3599
3664
|
appid: p.appid,
|
|
3600
3665
|
id: p.id,
|
|
3601
3666
|
type: p.type,
|
|
@@ -3603,16 +3668,16 @@ class Wi {
|
|
|
3603
3668
|
sourceCaption: p.sourceCaption,
|
|
3604
3669
|
url: p.url,
|
|
3605
3670
|
aiChat: p.aiChat
|
|
3606
|
-
})),
|
|
3607
|
-
await (
|
|
3671
|
+
})), a = (h = this.currentTopicOptions) == null ? void 0 : h.configService(s.appid, "aitopics", s.type);
|
|
3672
|
+
await (a == null ? void 0 : a.save(r)), this.handleTopicChange(o);
|
|
3608
3673
|
}
|
|
3609
3674
|
}
|
|
3610
|
-
class
|
|
3675
|
+
class bn {
|
|
3611
3676
|
constructor(e) {
|
|
3612
3677
|
this.aiChat = e;
|
|
3613
3678
|
}
|
|
3614
3679
|
}
|
|
3615
|
-
class
|
|
3680
|
+
class ji extends bn {
|
|
3616
3681
|
/**
|
|
3617
3682
|
* 执行操作
|
|
3618
3683
|
*
|
|
@@ -3641,7 +3706,7 @@ class Vi extends yn {
|
|
|
3641
3706
|
}
|
|
3642
3707
|
}
|
|
3643
3708
|
}
|
|
3644
|
-
class
|
|
3709
|
+
class Yi extends bn {
|
|
3645
3710
|
/**
|
|
3646
3711
|
* 执行操作
|
|
3647
3712
|
*
|
|
@@ -3653,8 +3718,8 @@ class qi extends yn {
|
|
|
3653
3718
|
const i = this.aiChat.opts.uploader, {
|
|
3654
3719
|
multiple: s,
|
|
3655
3720
|
accept: o,
|
|
3656
|
-
maxSize:
|
|
3657
|
-
onSelect:
|
|
3721
|
+
maxSize: r,
|
|
3722
|
+
onSelect: a,
|
|
3658
3723
|
onUpload: u,
|
|
3659
3724
|
onSuccess: h,
|
|
3660
3725
|
onError: p,
|
|
@@ -3662,13 +3727,13 @@ class qi extends yn {
|
|
|
3662
3727
|
} = i, v = {
|
|
3663
3728
|
multiple: s || !0,
|
|
3664
3729
|
accept: o || "*/*",
|
|
3665
|
-
maxSize:
|
|
3730
|
+
maxSize: r || 5 * 1024 * 1024,
|
|
3666
3731
|
onSelect: (d) => {
|
|
3667
|
-
|
|
3668
|
-
const
|
|
3669
|
-
Object.assign(
|
|
3732
|
+
a == null || a(d), d.length > 0 && d.forEach((f) => {
|
|
3733
|
+
const m = this.buildMaterialObject(f);
|
|
3734
|
+
Object.assign(m.metadata, {
|
|
3670
3735
|
state: "uploading"
|
|
3671
|
-
}), this.aiChat.addMaterial(
|
|
3736
|
+
}), this.aiChat.addMaterial(m);
|
|
3672
3737
|
});
|
|
3673
3738
|
},
|
|
3674
3739
|
onUpload: async (d, f) => u(d, f, {
|
|
@@ -3677,7 +3742,7 @@ class qi extends yn {
|
|
|
3677
3742
|
}),
|
|
3678
3743
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3679
3744
|
onSuccess: (d, f) => {
|
|
3680
|
-
const
|
|
3745
|
+
const m = {
|
|
3681
3746
|
id: d.id,
|
|
3682
3747
|
type: "ossfile",
|
|
3683
3748
|
data: {
|
|
@@ -3694,19 +3759,19 @@ class qi extends yn {
|
|
|
3694
3759
|
state: "successed"
|
|
3695
3760
|
}
|
|
3696
3761
|
};
|
|
3697
|
-
this.aiChat.replaceMaterial(f.name,
|
|
3762
|
+
this.aiChat.replaceMaterial(f.name, m), h == null || h(d, f);
|
|
3698
3763
|
},
|
|
3699
3764
|
onError: (d, f) => {
|
|
3700
|
-
const
|
|
3701
|
-
Object.assign(
|
|
3765
|
+
const m = this.buildMaterialObject(f);
|
|
3766
|
+
Object.assign(m.metadata, {
|
|
3702
3767
|
state: "failed"
|
|
3703
|
-
}), this.aiChat.replaceMaterial(f.name,
|
|
3768
|
+
}), this.aiChat.replaceMaterial(f.name, m), p == null || p(d, f);
|
|
3704
3769
|
},
|
|
3705
3770
|
onProgress: (d, f) => {
|
|
3706
3771
|
l == null || l(d, f);
|
|
3707
3772
|
}
|
|
3708
3773
|
};
|
|
3709
|
-
new
|
|
3774
|
+
new Ln(v).openFilePicker();
|
|
3710
3775
|
}
|
|
3711
3776
|
/**
|
|
3712
3777
|
* 构建素材对象
|
|
@@ -3732,17 +3797,17 @@ class qi extends yn {
|
|
|
3732
3797
|
};
|
|
3733
3798
|
}
|
|
3734
3799
|
}
|
|
3735
|
-
class
|
|
3800
|
+
class Lt {
|
|
3736
3801
|
static getMaterialHelper(e, t) {
|
|
3737
3802
|
switch (e) {
|
|
3738
3803
|
case "ossfile":
|
|
3739
|
-
return new
|
|
3804
|
+
return new Yi(t);
|
|
3740
3805
|
default:
|
|
3741
|
-
return new
|
|
3806
|
+
return new ji(t);
|
|
3742
3807
|
}
|
|
3743
3808
|
}
|
|
3744
3809
|
}
|
|
3745
|
-
class
|
|
3810
|
+
class Xi {
|
|
3746
3811
|
/**
|
|
3747
3812
|
* Creates an instance of ChatController.
|
|
3748
3813
|
* @author tony001
|
|
@@ -3757,7 +3822,7 @@ class ji {
|
|
|
3757
3822
|
* @protected
|
|
3758
3823
|
* @type {HTMLDivElement}
|
|
3759
3824
|
*/
|
|
3760
|
-
|
|
3825
|
+
x(this, "container");
|
|
3761
3826
|
/**
|
|
3762
3827
|
* 默认模式(聊天框)和话题模式(支持多话题切换),聊天框为默认模式
|
|
3763
3828
|
*
|
|
@@ -3766,7 +3831,7 @@ class ji {
|
|
|
3766
3831
|
* @protected
|
|
3767
3832
|
* @type {('DEFAULT' | 'TOPIC')}
|
|
3768
3833
|
*/
|
|
3769
|
-
|
|
3834
|
+
x(this, "mode", "DEFAULT");
|
|
3770
3835
|
/**
|
|
3771
3836
|
* 是否挂载ai话题
|
|
3772
3837
|
*
|
|
@@ -3775,7 +3840,7 @@ class ji {
|
|
|
3775
3840
|
* @protected
|
|
3776
3841
|
* @type {boolean}
|
|
3777
3842
|
*/
|
|
3778
|
-
|
|
3843
|
+
x(this, "isMountedAiTopic", !1);
|
|
3779
3844
|
/**
|
|
3780
3845
|
* 容器配置备份
|
|
3781
3846
|
*
|
|
@@ -3784,7 +3849,7 @@ class ji {
|
|
|
3784
3849
|
* @protected
|
|
3785
3850
|
* @type {(IContainerOptions | undefined)}
|
|
3786
3851
|
*/
|
|
3787
|
-
|
|
3852
|
+
x(this, "backupChatOptions");
|
|
3788
3853
|
/**
|
|
3789
3854
|
* 话题控制器
|
|
3790
3855
|
*
|
|
@@ -3793,7 +3858,7 @@ class ji {
|
|
|
3793
3858
|
* @public
|
|
3794
3859
|
* @type {AiTopicController}
|
|
3795
3860
|
*/
|
|
3796
|
-
|
|
3861
|
+
x(this, "aiTopic");
|
|
3797
3862
|
/**
|
|
3798
3863
|
* 话题map
|
|
3799
3864
|
*
|
|
@@ -3801,8 +3866,8 @@ class ji {
|
|
|
3801
3866
|
* @type {Map<string, AiChatController>}
|
|
3802
3867
|
* @memberof ChatController
|
|
3803
3868
|
*/
|
|
3804
|
-
|
|
3805
|
-
this.aiTopic = new
|
|
3869
|
+
x(this, "aiTopicMap", /* @__PURE__ */ new Map());
|
|
3870
|
+
this.aiTopic = new qi(this);
|
|
3806
3871
|
}
|
|
3807
3872
|
/**
|
|
3808
3873
|
* 聊天控制器
|
|
@@ -3823,7 +3888,7 @@ class ji {
|
|
|
3823
3888
|
* @return {*} {Promise<void>}
|
|
3824
3889
|
*/
|
|
3825
3890
|
async initIndexDB() {
|
|
3826
|
-
await
|
|
3891
|
+
await q.checkTableExists(M.DATA_BASE_NAME, M.DATA_TABLE_NAME) || await q.createTable(M.DATA_BASE_NAME, M.DATA_TABLE_NAME, M.DATA_TABLE_KEY_NAME, !1);
|
|
3827
3892
|
}
|
|
3828
3893
|
/**
|
|
3829
3894
|
* 创建聊天窗口(会同时显示出来)
|
|
@@ -3854,7 +3919,7 @@ class ji {
|
|
|
3854
3919
|
topic: i
|
|
3855
3920
|
});
|
|
3856
3921
|
const s = new Dt(t);
|
|
3857
|
-
return this.aiTopicMap.set("".concat(i == null ? void 0 : i.id), s),
|
|
3922
|
+
return this.aiTopicMap.set("".concat(i == null ? void 0 : i.id), s), oe(j(Ot, {
|
|
3858
3923
|
aiChat: s,
|
|
3859
3924
|
aiTopic: this.aiTopic,
|
|
3860
3925
|
mode: e.mode ? e.mode : "DEFAULT",
|
|
@@ -3867,11 +3932,11 @@ class ji {
|
|
|
3867
3932
|
close: () => {
|
|
3868
3933
|
this.close(), t.closed && t.closed(t.context, t.params);
|
|
3869
3934
|
},
|
|
3870
|
-
fullscreen: (
|
|
3871
|
-
t.fullscreen && t.fullscreen(
|
|
3935
|
+
fullscreen: (r) => {
|
|
3936
|
+
t.fullscreen && t.fullscreen(r, t.context, t.params);
|
|
3872
3937
|
},
|
|
3873
|
-
minimize: (
|
|
3874
|
-
t.minimize && t.minimize(
|
|
3938
|
+
minimize: (r) => {
|
|
3939
|
+
t.minimize && t.minimize(r, t.context, t.params);
|
|
3875
3940
|
}
|
|
3876
3941
|
}), this.container), s;
|
|
3877
3942
|
}
|
|
@@ -3883,7 +3948,7 @@ class ji {
|
|
|
3883
3948
|
* @param {ChatTopic} topic
|
|
3884
3949
|
*/
|
|
3885
3950
|
switchAiChatController(e) {
|
|
3886
|
-
var s, o,
|
|
3951
|
+
var s, o, r, a, u;
|
|
3887
3952
|
const t = {
|
|
3888
3953
|
...this.backupChatOptions.chatOptions
|
|
3889
3954
|
};
|
|
@@ -3902,13 +3967,13 @@ class ji {
|
|
|
3902
3967
|
recommendPrompt: this.backupChatOptions.chatOptions.recommendPrompt
|
|
3903
3968
|
});
|
|
3904
3969
|
let i;
|
|
3905
|
-
this.aiTopicMap.has("".concat(e.id)) ? i = this.aiTopicMap.get("".concat(e.id)) : (i = new Dt(t), this.aiTopicMap.set("".concat(e.id), i)), this.container && (
|
|
3970
|
+
this.aiTopicMap.has("".concat(e.id)) ? i = this.aiTopicMap.get("".concat(e.id)) : (i = new Dt(t), this.aiTopicMap.set("".concat(e.id), i)), this.container && (oe(null, this.container), oe(j(Ot, {
|
|
3906
3971
|
aiChat: i,
|
|
3907
3972
|
aiTopic: this.aiTopic,
|
|
3908
3973
|
mode: (s = this.backupChatOptions) != null && s.mode ? this.backupChatOptions.mode : "DEFAULT",
|
|
3909
3974
|
containerOptions: (o = this.backupChatOptions) == null ? void 0 : o.containerOptions,
|
|
3910
|
-
caption: (
|
|
3911
|
-
enableBackFill: (u = (
|
|
3975
|
+
caption: (r = this.backupChatOptions) != null && r.mode && this.backupChatOptions.mode === "TOPIC" ? "AI助手" : t.caption,
|
|
3976
|
+
enableBackFill: (u = (a = this.backupChatOptions) == null ? void 0 : a.containerOptions) == null ? void 0 : u.enableBackFill,
|
|
3912
3977
|
contentToolbarItems: t.contentToolbarItems,
|
|
3913
3978
|
footerToolbarItems: t.footerToolbarItems,
|
|
3914
3979
|
questionToolbarItems: t.questionToolbarItems,
|
|
@@ -3948,14 +4013,14 @@ class ji {
|
|
|
3948
4013
|
* @date 2023-10-13 17:10:10
|
|
3949
4014
|
*/
|
|
3950
4015
|
close() {
|
|
3951
|
-
this.container && (
|
|
4016
|
+
this.container && (oe(null, this.container), this.container.remove(), this.container = void 0);
|
|
3952
4017
|
}
|
|
3953
4018
|
}
|
|
3954
|
-
const
|
|
3955
|
-
const
|
|
4019
|
+
const ss = new Xi();
|
|
4020
|
+
const Zi = new N("chat-input-material"), Gi = (n) => {
|
|
3956
4021
|
const e = n.controller.materials;
|
|
3957
4022
|
return c("div", {
|
|
3958
|
-
className:
|
|
4023
|
+
className: Zi.b(),
|
|
3959
4024
|
children: e.value.map((t) => c(mn, {
|
|
3960
4025
|
material: t,
|
|
3961
4026
|
disabled: !1,
|
|
@@ -3963,7 +4028,7 @@ const Yi = new M("chat-input-material"), Xi = (n) => {
|
|
|
3963
4028
|
}, t.id))
|
|
3964
4029
|
});
|
|
3965
4030
|
};
|
|
3966
|
-
const
|
|
4031
|
+
const yn = ({
|
|
3967
4032
|
children: n,
|
|
3968
4033
|
actions: e,
|
|
3969
4034
|
// 接收行为数据
|
|
@@ -3971,29 +4036,29 @@ const bn = ({
|
|
|
3971
4036
|
position: i = "bottom",
|
|
3972
4037
|
isOpen: s,
|
|
3973
4038
|
onToggleOpen: o,
|
|
3974
|
-
onAction:
|
|
4039
|
+
onAction: r
|
|
3975
4040
|
// 接收行为事件回调
|
|
3976
4041
|
}) => {
|
|
3977
|
-
const
|
|
4042
|
+
const a = new N("pop"), u = on(ot), [h, p] = ne(s || !1), l = P(null), v = P(null);
|
|
3978
4043
|
H(() => {
|
|
3979
4044
|
s !== void 0 && p(s);
|
|
3980
|
-
}, [s]), H(() => (v.current || (v.current = document.createElement("div"), v.current.className =
|
|
4045
|
+
}, [s]), H(() => (v.current || (v.current = document.createElement("div"), v.current.className = a.b("content-container"), document.body.appendChild(v.current)), () => {
|
|
3981
4046
|
v.current && document.body.removeChild(v.current);
|
|
3982
4047
|
}), []), H(() => {
|
|
3983
4048
|
const d = (f) => {
|
|
3984
|
-
l.current && !l.current.contains(f.target) && !f.target.closest(".".concat(
|
|
4049
|
+
l.current && !l.current.contains(f.target) && !f.target.closest(".".concat(a.b())) && !f.target.closest(".ibiz-quick-edit") && !f.target.closest(".ibiz-picker__transfer") && (p(!1), o == null || o(!1));
|
|
3985
4050
|
};
|
|
3986
4051
|
return h && document.addEventListener("mousedown", d), () => {
|
|
3987
4052
|
document.removeEventListener("mousedown", d);
|
|
3988
4053
|
};
|
|
3989
4054
|
}, [h, o]);
|
|
3990
|
-
const
|
|
4055
|
+
const _ = () => {
|
|
3991
4056
|
if (!l.current)
|
|
3992
4057
|
return {};
|
|
3993
4058
|
const d = l.current.getBoundingClientRect(), f = {
|
|
3994
4059
|
position: "absolute",
|
|
3995
4060
|
zIndex: u.zIndex + 1
|
|
3996
|
-
},
|
|
4061
|
+
}, m = {
|
|
3997
4062
|
bottom: {
|
|
3998
4063
|
top: d.bottom + window.scrollY,
|
|
3999
4064
|
left: d.left + window.scrollX
|
|
@@ -4017,13 +4082,13 @@ const bn = ({
|
|
|
4017
4082
|
};
|
|
4018
4083
|
return {
|
|
4019
4084
|
...f,
|
|
4020
|
-
...
|
|
4085
|
+
...m[i]
|
|
4021
4086
|
};
|
|
4022
4087
|
};
|
|
4023
4088
|
return c("span", {
|
|
4024
|
-
className: "".concat(
|
|
4089
|
+
className: "".concat(a.b("trigger-container")),
|
|
4025
4090
|
children: [c("span", {
|
|
4026
|
-
className: "".concat(
|
|
4091
|
+
className: "".concat(a.b("trigger-element")),
|
|
4027
4092
|
ref: l,
|
|
4028
4093
|
onClick: (d) => {
|
|
4029
4094
|
d.stopPropagation();
|
|
@@ -4031,67 +4096,67 @@ const bn = ({
|
|
|
4031
4096
|
p(f), o == null || o(f);
|
|
4032
4097
|
},
|
|
4033
4098
|
children: n
|
|
4034
|
-
}), h && v.current &&
|
|
4035
|
-
className: "".concat(
|
|
4036
|
-
style:
|
|
4099
|
+
}), h && v.current && Ii(c("div", {
|
|
4100
|
+
className: "".concat(a.b(), " pop-").concat(i),
|
|
4101
|
+
style: _(),
|
|
4037
4102
|
children: t || (e == null ? void 0 : e.map((d) => c("div", {
|
|
4038
4103
|
title: d.caption,
|
|
4039
|
-
className:
|
|
4104
|
+
className: a.e("item"),
|
|
4040
4105
|
onMouseDown: (f) => {
|
|
4041
|
-
f.stopPropagation(),
|
|
4106
|
+
f.stopPropagation(), r == null || r(d.id, f);
|
|
4042
4107
|
},
|
|
4043
4108
|
children: [d.icon, c("div", {
|
|
4044
|
-
className:
|
|
4109
|
+
className: a.em("item", "caption"),
|
|
4045
4110
|
children: d.caption
|
|
4046
4111
|
})]
|
|
4047
4112
|
}, d.id)))
|
|
4048
4113
|
}), v.current)]
|
|
4049
4114
|
});
|
|
4050
|
-
}, $ = new
|
|
4115
|
+
}, $ = new N("chat-input"), zt = window.SpeechRecognition || window.webkitSpeechRecognition, Ht = (n) => {
|
|
4051
4116
|
var f;
|
|
4052
|
-
const [e, t] =
|
|
4053
|
-
|
|
4117
|
+
const [e, t] = ne(!1), i = P(null), s = n.controller.input, o = z(!1), r = P();
|
|
4118
|
+
zt && !r.current && (r.current = new zt(), r.current.onstart = () => {
|
|
4054
4119
|
o.value = !0;
|
|
4055
|
-
},
|
|
4120
|
+
}, r.current.onend = () => {
|
|
4056
4121
|
o.value = !1;
|
|
4057
|
-
},
|
|
4058
|
-
var
|
|
4059
|
-
const
|
|
4060
|
-
|
|
4122
|
+
}, r.current.onresult = (m) => {
|
|
4123
|
+
var g, T, C;
|
|
4124
|
+
const b = (C = (T = (g = m.results) == null ? void 0 : g[0]) == null ? void 0 : T[0]) == null ? void 0 : C.transcript;
|
|
4125
|
+
b && (s.value = "".concat(s.value).concat(b));
|
|
4061
4126
|
});
|
|
4062
|
-
const
|
|
4063
|
-
|
|
4064
|
-
}, u = Be((
|
|
4065
|
-
s.value =
|
|
4066
|
-
}, [s]), h =
|
|
4127
|
+
const a = () => {
|
|
4128
|
+
r.current && !o.value && r.current.start();
|
|
4129
|
+
}, u = Be((m) => {
|
|
4130
|
+
s.value = m.target.value;
|
|
4131
|
+
}, [s]), h = B(() => s.value.length <= 0);
|
|
4067
4132
|
H(() => (i.current && It(i.current), () => {
|
|
4068
4133
|
i.current && It.destroy(i.current);
|
|
4069
4134
|
}), [i]);
|
|
4070
4135
|
const p = Be(async () => {
|
|
4071
4136
|
try {
|
|
4072
|
-
const
|
|
4073
|
-
s.value = "", await n.controller.question(
|
|
4074
|
-
} catch (
|
|
4075
|
-
console.error(
|
|
4137
|
+
const m = s.value;
|
|
4138
|
+
s.value = "", await n.controller.question(m);
|
|
4139
|
+
} catch (m) {
|
|
4140
|
+
console.error(m);
|
|
4076
4141
|
}
|
|
4077
4142
|
}, [s]), l = Be(async () => {
|
|
4078
4143
|
try {
|
|
4079
4144
|
n.controller.abortQuestion();
|
|
4080
|
-
} catch (
|
|
4081
|
-
console.error(
|
|
4145
|
+
} catch (m) {
|
|
4146
|
+
console.error(m);
|
|
4082
4147
|
}
|
|
4083
|
-
}, [s]), v = (
|
|
4084
|
-
|
|
4085
|
-
},
|
|
4086
|
-
await
|
|
4087
|
-
}, d = async (
|
|
4088
|
-
await
|
|
4148
|
+
}, [s]), v = (m) => {
|
|
4149
|
+
m.code === "Enter" && !m.isComposing && (m.stopPropagation(), m.shiftKey === !1 && p());
|
|
4150
|
+
}, _ = async (m) => {
|
|
4151
|
+
await Lt.getMaterialHelper("ossfile", n.controller).excuteAction(m), t(!1);
|
|
4152
|
+
}, d = async (m, b) => {
|
|
4153
|
+
await Lt.getMaterialHelper("common", n.controller).excuteAction(m, b), t(!1);
|
|
4089
4154
|
};
|
|
4090
4155
|
return c("div", {
|
|
4091
4156
|
className: $.b("wrapper"),
|
|
4092
4157
|
children: [c("div", {
|
|
4093
4158
|
className: $.b("material-wrapper"),
|
|
4094
|
-
children: c(
|
|
4159
|
+
children: c(Gi, {
|
|
4095
4160
|
controller: n.controller
|
|
4096
4161
|
})
|
|
4097
4162
|
}), c("div", {
|
|
@@ -4113,13 +4178,13 @@ const bn = ({
|
|
|
4113
4178
|
children: [c("div", {
|
|
4114
4179
|
className: "".concat($.be("action-wrapper", "action-item"), " ").concat($.is("disabled", n.controller.isLoading.value)),
|
|
4115
4180
|
title: "上传资料",
|
|
4116
|
-
children: c(
|
|
4181
|
+
children: c(yn, {
|
|
4117
4182
|
content: c("div", {
|
|
4118
4183
|
className: $.b("pop-actions"),
|
|
4119
4184
|
children: [c("div", {
|
|
4120
4185
|
className: $.b("pop-action-item"),
|
|
4121
|
-
onClick: (
|
|
4122
|
-
|
|
4186
|
+
onClick: (m) => {
|
|
4187
|
+
_(m);
|
|
4123
4188
|
},
|
|
4124
4189
|
children: [c("span", {
|
|
4125
4190
|
className: $.b("pop-action-item-icon"),
|
|
@@ -4128,31 +4193,31 @@ const bn = ({
|
|
|
4128
4193
|
className: $.b("pop-action-item-title"),
|
|
4129
4194
|
children: "文件资料"
|
|
4130
4195
|
})]
|
|
4131
|
-
}), (f = n.questionToolbarItems) == null ? void 0 : f.map((
|
|
4132
|
-
var
|
|
4196
|
+
}), (f = n.questionToolbarItems) == null ? void 0 : f.map((m) => {
|
|
4197
|
+
var b, g, T;
|
|
4133
4198
|
return c("div", {
|
|
4134
4199
|
className: $.b("pop-action-item"),
|
|
4135
4200
|
onClick: (C) => {
|
|
4136
|
-
d(C,
|
|
4201
|
+
d(C, m);
|
|
4137
4202
|
},
|
|
4138
4203
|
children: [c("span", {
|
|
4139
4204
|
className: $.b("pop-action-item-icon"),
|
|
4140
|
-
children: typeof
|
|
4141
|
-
children: (
|
|
4142
|
-
className:
|
|
4143
|
-
}) : (
|
|
4205
|
+
children: typeof m.icon == "function" ? m.icon() : ((b = m.icon) == null ? void 0 : b.showIcon) && c(Y, {
|
|
4206
|
+
children: (g = m.icon) != null && g.cssClass ? c("i", {
|
|
4207
|
+
className: m.icon.cssClass
|
|
4208
|
+
}) : (T = m.icon) != null && T.imagePath ? tt(m.icon.imagePath) ? c("div", {
|
|
4144
4209
|
dangerouslySetInnerHTML: {
|
|
4145
|
-
__html:
|
|
4210
|
+
__html: m.icon.imagePath
|
|
4146
4211
|
}
|
|
4147
4212
|
}) : c("img", {
|
|
4148
|
-
src:
|
|
4213
|
+
src: m.icon.imagePath
|
|
4149
4214
|
}) : null
|
|
4150
4215
|
})
|
|
4151
4216
|
}), c("span", {
|
|
4152
4217
|
className: $.b("pop-action-item-title"),
|
|
4153
|
-
children:
|
|
4218
|
+
children: m.label
|
|
4154
4219
|
})]
|
|
4155
|
-
},
|
|
4220
|
+
}, m.id);
|
|
4156
4221
|
})]
|
|
4157
4222
|
}),
|
|
4158
4223
|
position: "top-left",
|
|
@@ -4163,7 +4228,7 @@ const bn = ({
|
|
|
4163
4228
|
}), c("div", {
|
|
4164
4229
|
title: o.value ? "语音输入中..." : "语音输入",
|
|
4165
4230
|
className: "".concat($.be("action-wrapper", "action-item"), " ").concat($.is("disabled", n.controller.isLoading.value)),
|
|
4166
|
-
onClick:
|
|
4231
|
+
onClick: a,
|
|
4167
4232
|
children: o.value ? c(ei, {}) : c(Qn, {})
|
|
4168
4233
|
}), n.controller.isLoading.value ? c("div", {
|
|
4169
4234
|
title: "停止生成",
|
|
@@ -4180,58 +4245,58 @@ const bn = ({
|
|
|
4180
4245
|
})]
|
|
4181
4246
|
});
|
|
4182
4247
|
};
|
|
4183
|
-
const
|
|
4248
|
+
const R = new N("chat-topic-item"), Ji = (n) => {
|
|
4184
4249
|
const {
|
|
4185
4250
|
controller: e,
|
|
4186
4251
|
topic: t,
|
|
4187
4252
|
onClick: i,
|
|
4188
4253
|
onAction: s
|
|
4189
|
-
} = n, o =
|
|
4190
|
-
var
|
|
4191
|
-
return ((
|
|
4192
|
-
}), [
|
|
4254
|
+
} = n, o = P(null), r = B(() => {
|
|
4255
|
+
var m;
|
|
4256
|
+
return ((m = e.activedTopic.value) == null ? void 0 : m.id) === t.id;
|
|
4257
|
+
}), [a, u] = ne(!1), h = z(!1), p = (f) => {
|
|
4193
4258
|
f.stopPropagation(), s("LINK", f);
|
|
4194
|
-
}, l = (f,
|
|
4195
|
-
f === "DELETE" ? s("DELETE",
|
|
4196
|
-
var
|
|
4197
|
-
(
|
|
4259
|
+
}, l = (f, m) => {
|
|
4260
|
+
f === "DELETE" ? s("DELETE", m) : f === "RENAME" && (h.value = !0, setTimeout(() => {
|
|
4261
|
+
var b;
|
|
4262
|
+
(b = o.current) == null || b.focus();
|
|
4198
4263
|
}, 100)), u(!1);
|
|
4199
4264
|
}, v = (f) => {
|
|
4200
|
-
var
|
|
4201
|
-
f.stopPropagation(), t.data.caption = (
|
|
4202
|
-
},
|
|
4265
|
+
var m;
|
|
4266
|
+
f.stopPropagation(), t.data.caption = (m = f.target) == null ? void 0 : m.value;
|
|
4267
|
+
}, _ = (f) => {
|
|
4203
4268
|
f.stopPropagation(), h.value = !1, s("RENAME", f);
|
|
4204
4269
|
}, d = (f) => {
|
|
4205
4270
|
f.stopPropagation(), f.key === "Enter" && (h.value = !1);
|
|
4206
4271
|
};
|
|
4207
4272
|
return c("div", {
|
|
4208
|
-
className: "".concat(
|
|
4273
|
+
className: "".concat(R.b(), " ").concat(R.is("active", r.value), " ").concat(R.is("edit", h.value)),
|
|
4209
4274
|
onClick: i.bind(void 0),
|
|
4210
4275
|
children: [c("div", {
|
|
4211
|
-
className:
|
|
4276
|
+
className: R.e("caption"),
|
|
4212
4277
|
title: t.caption,
|
|
4213
4278
|
children: h.value ? c("input", {
|
|
4214
4279
|
ref: o,
|
|
4215
4280
|
value: t.caption,
|
|
4216
|
-
onBlur:
|
|
4281
|
+
onBlur: _,
|
|
4217
4282
|
onKeyDown: d,
|
|
4218
4283
|
onClick: (f) => f.stopPropagation(),
|
|
4219
4284
|
onChange: (f) => v(f),
|
|
4220
|
-
className:
|
|
4285
|
+
className: R.em("caption", "editor")
|
|
4221
4286
|
}) : c("span", {
|
|
4222
|
-
className:
|
|
4287
|
+
className: R.em("caption", "text"),
|
|
4223
4288
|
children: t.caption
|
|
4224
4289
|
})
|
|
4225
4290
|
}), !h.value && c("div", {
|
|
4226
|
-
className:
|
|
4291
|
+
className: R.e("icon"),
|
|
4227
4292
|
children: [c("span", {
|
|
4228
4293
|
title: "跳转主视图",
|
|
4229
|
-
className:
|
|
4294
|
+
className: R.em("icon", "item"),
|
|
4230
4295
|
onClick: p.bind(void 0),
|
|
4231
4296
|
children: c(ni, {
|
|
4232
|
-
className:
|
|
4297
|
+
className: R.b("link-icon")
|
|
4233
4298
|
})
|
|
4234
|
-
}),
|
|
4299
|
+
}), r.value ? null : c(yn, {
|
|
4235
4300
|
actions: [{
|
|
4236
4301
|
id: "RENAME",
|
|
4237
4302
|
caption: "重命名",
|
|
@@ -4242,107 +4307,107 @@ const B = new M("chat-topic-item"), Zi = (n) => {
|
|
|
4242
4307
|
icon: c(ii, {})
|
|
4243
4308
|
}],
|
|
4244
4309
|
position: "bottom",
|
|
4245
|
-
isOpen:
|
|
4310
|
+
isOpen: a,
|
|
4246
4311
|
onToggleOpen: u,
|
|
4247
4312
|
onAction: l.bind(void 0),
|
|
4248
4313
|
children: c("span", {
|
|
4249
|
-
className:
|
|
4314
|
+
className: R.em("icon", "item"),
|
|
4250
4315
|
title: "更多",
|
|
4251
4316
|
children: c(ti, {
|
|
4252
|
-
className:
|
|
4317
|
+
className: R.e("more-icon")
|
|
4253
4318
|
})
|
|
4254
4319
|
})
|
|
4255
4320
|
})]
|
|
4256
4321
|
})]
|
|
4257
4322
|
});
|
|
4258
4323
|
};
|
|
4259
|
-
const
|
|
4260
|
-
const e = n.controller.topics, t =
|
|
4324
|
+
const Ki = new N("chat-topics"), Qi = (n) => {
|
|
4325
|
+
const e = n.controller.topics, t = P(null), i = (o) => {
|
|
4261
4326
|
n.controller.handleTopicChange(o);
|
|
4262
|
-
}, s = (o,
|
|
4263
|
-
n.controller.handleTopicAction(o,
|
|
4327
|
+
}, s = (o, r, a) => {
|
|
4328
|
+
n.controller.handleTopicAction(o, r, a);
|
|
4264
4329
|
};
|
|
4265
4330
|
return H(() => {
|
|
4266
4331
|
const o = t.current;
|
|
4267
4332
|
if (!o)
|
|
4268
4333
|
return;
|
|
4269
|
-
const
|
|
4270
|
-
|
|
4334
|
+
const r = o.querySelector(".ibiz-chat-topic-item.is-active");
|
|
4335
|
+
r == null || r.scrollIntoView({
|
|
4271
4336
|
behavior: "smooth",
|
|
4272
4337
|
block: "nearest"
|
|
4273
4338
|
});
|
|
4274
4339
|
}, [n.controller.activedTopic.value]), c("div", {
|
|
4275
4340
|
ref: t,
|
|
4276
|
-
className:
|
|
4277
|
-
children: e.value.map((o) => c(
|
|
4341
|
+
className: Ki.b(),
|
|
4342
|
+
children: e.value.map((o) => c(Ji, {
|
|
4278
4343
|
topic: o,
|
|
4279
4344
|
controller: n.controller,
|
|
4280
4345
|
onClick: () => i(o),
|
|
4281
|
-
onAction: (
|
|
4346
|
+
onAction: (r, a) => s(r, o, a)
|
|
4282
4347
|
}, o.id))
|
|
4283
4348
|
});
|
|
4284
4349
|
};
|
|
4285
|
-
const
|
|
4286
|
-
const e =
|
|
4350
|
+
const se = new N("chat-minimize"), es = (n) => {
|
|
4351
|
+
const e = P(null), [t, i] = ne(""), [s, o] = ne(0), r = P(!1), a = {
|
|
4287
4352
|
x: (window.innerWidth - 86) / window.innerWidth,
|
|
4288
4353
|
y: (window.innerHeight - 86) / window.innerHeight
|
|
4289
|
-
}, u =
|
|
4354
|
+
}, u = B(() => {
|
|
4290
4355
|
const d = n.controller.messages.value[n.controller.messages.value.length - 1];
|
|
4291
4356
|
return d ? d.role === "ASSISTANT" && d.state === 20 && d.completed !== !0 : !1;
|
|
4292
4357
|
}), h = (d) => {
|
|
4293
|
-
const f = d.indexOf("<think>"),
|
|
4294
|
-
let
|
|
4295
|
-
return
|
|
4296
|
-
thoughtContent:
|
|
4297
|
-
answerContent:
|
|
4358
|
+
const f = d.indexOf("<think>"), m = d.indexOf("</think>");
|
|
4359
|
+
let b = "", g = "";
|
|
4360
|
+
return m === -1 ? (b = d.slice(f + 7), g = "") : (b = d.slice(f + 7, m), g = d.slice(m + 8)), {
|
|
4361
|
+
thoughtContent: b,
|
|
4362
|
+
answerContent: g
|
|
4298
4363
|
};
|
|
4299
|
-
}, p =
|
|
4364
|
+
}, p = B(() => {
|
|
4300
4365
|
let d = "";
|
|
4301
4366
|
if (!u.value)
|
|
4302
4367
|
return i(""), o(0), d;
|
|
4303
4368
|
const f = n.controller.messages.value[n.controller.messages.value.length - 1];
|
|
4304
4369
|
if (d = f.content, f.content.indexOf("<think>") !== -1) {
|
|
4305
4370
|
const {
|
|
4306
|
-
thoughtContent:
|
|
4307
|
-
answerContent:
|
|
4371
|
+
thoughtContent: m,
|
|
4372
|
+
answerContent: b
|
|
4308
4373
|
} = h(f.content);
|
|
4309
|
-
d =
|
|
4374
|
+
d = m + b;
|
|
4310
4375
|
}
|
|
4311
4376
|
return d;
|
|
4312
4377
|
}), l = () => {
|
|
4313
4378
|
Object.assign(e.current.style, {
|
|
4314
|
-
left: "".concat(
|
|
4315
|
-
top: "".concat(
|
|
4316
|
-
}), localStorage.setItem(
|
|
4379
|
+
left: "".concat(a.x * 100, "%"),
|
|
4380
|
+
top: "".concat(a.y * 100, "%")
|
|
4381
|
+
}), localStorage.setItem(M.MINIMIZE_STYLY_CHCHE, JSON.stringify(a));
|
|
4317
4382
|
}, v = () => {
|
|
4318
4383
|
const d = e.current;
|
|
4319
4384
|
d && (d.onmousedown = (f) => {
|
|
4320
4385
|
document.body.style.userSelect = "none";
|
|
4321
|
-
const
|
|
4386
|
+
const m = f.clientX - d.offsetLeft, b = f.clientY - d.offsetTop, g = Date.now(), T = (S) => {
|
|
4322
4387
|
const O = 56 / window.innerWidth, I = 56 / window.innerHeight, {
|
|
4323
|
-
x:
|
|
4388
|
+
x: U,
|
|
4324
4389
|
y: D
|
|
4325
|
-
} = nn(S.clientX -
|
|
4326
|
-
Object.assign(
|
|
4327
|
-
x:
|
|
4390
|
+
} = nn(S.clientX - m, S.clientY - b, O, I);
|
|
4391
|
+
Object.assign(a, {
|
|
4392
|
+
x: U,
|
|
4328
4393
|
y: D
|
|
4329
4394
|
}), requestAnimationFrame(() => {
|
|
4330
4395
|
l();
|
|
4331
4396
|
});
|
|
4332
4397
|
}, C = () => {
|
|
4333
4398
|
const S = Date.now();
|
|
4334
|
-
|
|
4399
|
+
r.current = S - g > 300, document.body.style.userSelect = "", document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", C);
|
|
4335
4400
|
};
|
|
4336
|
-
document.addEventListener("mousemove",
|
|
4401
|
+
document.addEventListener("mousemove", T), document.addEventListener("mouseup", C);
|
|
4337
4402
|
});
|
|
4338
|
-
},
|
|
4339
|
-
|
|
4403
|
+
}, _ = () => {
|
|
4404
|
+
r.current || n.onClick();
|
|
4340
4405
|
};
|
|
4341
4406
|
return H(() => {
|
|
4342
|
-
const d = localStorage.getItem(
|
|
4407
|
+
const d = localStorage.getItem(M.MINIMIZE_STYLY_CHCHE);
|
|
4343
4408
|
if (d) {
|
|
4344
4409
|
const f = JSON.parse(d);
|
|
4345
|
-
Xe(f) && Object.assign(
|
|
4410
|
+
Xe(f) && Object.assign(a, f);
|
|
4346
4411
|
}
|
|
4347
4412
|
l(), v();
|
|
4348
4413
|
}, []), H(() => {
|
|
@@ -4355,12 +4420,12 @@ const ie = new M("chart-minimize"), Ki = (n) => {
|
|
|
4355
4420
|
}, [s, p.value]), c("div", {
|
|
4356
4421
|
ref: e,
|
|
4357
4422
|
title: n.title,
|
|
4358
|
-
className: "".concat(
|
|
4359
|
-
onClick:
|
|
4423
|
+
className: "".concat(se.b(), " ").concat(se.is("hidden", !n.isMinimize), " ").concat(se.is("show-halo", u.value)),
|
|
4424
|
+
onClick: _,
|
|
4360
4425
|
children: c("div", {
|
|
4361
|
-
className: "".concat(
|
|
4426
|
+
className: "".concat(se.e("content"), " ").concat(se.is("show-border", !u.value)),
|
|
4362
4427
|
children: [t && c("div", {
|
|
4363
|
-
className: "".concat(
|
|
4428
|
+
className: "".concat(se.em("content", "popover")),
|
|
4364
4429
|
children: c("div", {
|
|
4365
4430
|
className: "typewriter",
|
|
4366
4431
|
children: t
|
|
@@ -4376,18 +4441,18 @@ const ot = Mn({
|
|
|
4376
4441
|
}
|
|
4377
4442
|
});
|
|
4378
4443
|
var Bt, Pt, Rt, Ft;
|
|
4379
|
-
class Ot extends
|
|
4444
|
+
class Ot extends F {
|
|
4380
4445
|
constructor(t) {
|
|
4381
4446
|
super(t);
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4447
|
+
x(this, "ns", new N("chat-container"));
|
|
4448
|
+
x(this, "containerRef", at());
|
|
4449
|
+
x(this, "dragHandle", at());
|
|
4385
4450
|
/**
|
|
4386
4451
|
* 窗口样式数据
|
|
4387
4452
|
*
|
|
4388
4453
|
* @memberof ChatContainer
|
|
4389
4454
|
*/
|
|
4390
|
-
|
|
4455
|
+
x(this, "data", {
|
|
4391
4456
|
side: {
|
|
4392
4457
|
y: 0,
|
|
4393
4458
|
height: 1,
|
|
@@ -4410,14 +4475,14 @@ class Ot extends P {
|
|
|
4410
4475
|
* @type {boolean}
|
|
4411
4476
|
* @memberof ChatContainer
|
|
4412
4477
|
*/
|
|
4413
|
-
|
|
4478
|
+
x(this, "disabled", !1);
|
|
4414
4479
|
/**
|
|
4415
4480
|
* 最小化是否在拖拽中
|
|
4416
4481
|
* - 在拖拽时不应触发点击事件
|
|
4417
4482
|
* @type {boolean}
|
|
4418
4483
|
* @memberof ChatContainer
|
|
4419
4484
|
*/
|
|
4420
|
-
|
|
4485
|
+
x(this, "isDragging", !1);
|
|
4421
4486
|
/**
|
|
4422
4487
|
* 容器上下文
|
|
4423
4488
|
*
|
|
@@ -4425,7 +4490,7 @@ class Ot extends P {
|
|
|
4425
4490
|
* @date 2025-03-03 16:03:44
|
|
4426
4491
|
* @type {ContainerContext}
|
|
4427
4492
|
*/
|
|
4428
|
-
|
|
4493
|
+
x(this, "containerContext", {
|
|
4429
4494
|
zIndex: ((Bt = this.props.containerOptions) == null ? void 0 : Bt.zIndex) || 10,
|
|
4430
4495
|
enableBackFill: ((Pt = this.props) == null ? void 0 : Pt.enableBackFill) !== void 0 && ((Rt = this.props) == null ? void 0 : Rt.enableBackFill) !== null ? (Ft = this.props) == null ? void 0 : Ft.enableBackFill : !0,
|
|
4431
4496
|
newTopic: () => {
|
|
@@ -4479,7 +4544,7 @@ class Ot extends P {
|
|
|
4479
4544
|
* @memberof ChatContainer
|
|
4480
4545
|
*/
|
|
4481
4546
|
setStyle() {
|
|
4482
|
-
Object.assign(this.containerRef.current.style, this.calcWindowStyle()), localStorage.setItem(
|
|
4547
|
+
Object.assign(this.containerRef.current.style, this.calcWindowStyle()), localStorage.setItem(M.STYLE_CACHE, JSON.stringify(this.data));
|
|
4483
4548
|
}
|
|
4484
4549
|
/**
|
|
4485
4550
|
* 吸附边缘(窗口模式)
|
|
@@ -4491,10 +4556,10 @@ class Ot extends P {
|
|
|
4491
4556
|
const t = 20 / window.innerWidth, i = 20 / window.innerHeight, {
|
|
4492
4557
|
x: s,
|
|
4493
4558
|
y: o,
|
|
4494
|
-
width:
|
|
4495
|
-
height:
|
|
4559
|
+
width: r,
|
|
4560
|
+
height: a
|
|
4496
4561
|
} = this.data.window;
|
|
4497
|
-
s < t || s +
|
|
4562
|
+
s < t || s + r > 1 - t ? this.calcSideModeStyle(s < t ? "left" : "right") : (o < i && (this.data.window.y = 0), o + a > 1 - i && (this.data.window.y = 1 - a)), this.setStyle();
|
|
4498
4563
|
}
|
|
4499
4564
|
/**
|
|
4500
4565
|
* 注册对话框拖拽
|
|
@@ -4506,22 +4571,22 @@ class Ot extends P {
|
|
|
4506
4571
|
if (this.state.isFullScreen)
|
|
4507
4572
|
return;
|
|
4508
4573
|
document.body.style.userSelect = "none";
|
|
4509
|
-
const i = t.clientX - this.containerRef.current.offsetLeft, s = t.clientY - this.containerRef.current.offsetTop, o = (
|
|
4574
|
+
const i = t.clientX - this.containerRef.current.offsetLeft, s = t.clientY - this.containerRef.current.offsetTop, o = (a) => {
|
|
4510
4575
|
if (this.disabled)
|
|
4511
4576
|
return;
|
|
4512
4577
|
this.data.showMode = "window";
|
|
4513
4578
|
const {
|
|
4514
4579
|
x: u,
|
|
4515
4580
|
y: h
|
|
4516
|
-
} = nn(
|
|
4581
|
+
} = nn(a.clientX - i, a.clientY - s, this.data.window.width, this.data.window.height);
|
|
4517
4582
|
Object.assign(this.data.window, {
|
|
4518
4583
|
x: u,
|
|
4519
4584
|
y: h
|
|
4520
4585
|
}), this.setStyle();
|
|
4521
|
-
},
|
|
4522
|
-
document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup",
|
|
4586
|
+
}, r = () => {
|
|
4587
|
+
document.body.style.userSelect = "", document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), !this.disabled && this.snapToEdge();
|
|
4523
4588
|
};
|
|
4524
|
-
document.addEventListener("mousemove", o), document.addEventListener("mouseup",
|
|
4589
|
+
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
4525
4590
|
};
|
|
4526
4591
|
}
|
|
4527
4592
|
/**
|
|
@@ -4581,7 +4646,7 @@ class Ot extends P {
|
|
|
4581
4646
|
}
|
|
4582
4647
|
componentDidMount() {
|
|
4583
4648
|
this.handleFullScreenChange = this.handleFullScreenChange.bind(this);
|
|
4584
|
-
const t = localStorage.getItem(
|
|
4649
|
+
const t = localStorage.getItem(M.STYLE_CACHE);
|
|
4585
4650
|
if (t) {
|
|
4586
4651
|
const i = JSON.parse(t);
|
|
4587
4652
|
i.side && Xe(i.side) && i.window && Xe(i.window) && Object.assign(this.data, i);
|
|
@@ -4694,7 +4759,7 @@ class Ot extends P {
|
|
|
4694
4759
|
className: "".concat(this.ns.b("main")),
|
|
4695
4760
|
children: [c("div", {
|
|
4696
4761
|
className: "".concat(this.ns.be("main", "left")),
|
|
4697
|
-
children: c(
|
|
4762
|
+
children: c(Qi, {
|
|
4698
4763
|
controller: this.props.aiTopic
|
|
4699
4764
|
})
|
|
4700
4765
|
}), c("div", {
|
|
@@ -4708,7 +4773,7 @@ class Ot extends P {
|
|
|
4708
4773
|
}), c(Je, {
|
|
4709
4774
|
data: this.props.aiTopic.activedTopic.value,
|
|
4710
4775
|
type: "footer",
|
|
4711
|
-
className: this.ns.e("toolbar"),
|
|
4776
|
+
className: "".concat(this.ns.e("toolbar"), " ").concat(this.ns.is("has-materials", this.props.aiChat.materials.value.length > 0)),
|
|
4712
4777
|
controller: this.props.aiChat,
|
|
4713
4778
|
items: this.props.footerToolbarItems
|
|
4714
4779
|
}), c("div", {
|
|
@@ -4730,7 +4795,7 @@ class Ot extends P {
|
|
|
4730
4795
|
}), c(Je, {
|
|
4731
4796
|
type: "footer",
|
|
4732
4797
|
data: this.props.aiTopic.activedTopic.value,
|
|
4733
|
-
className: this.ns.e("toolbar"),
|
|
4798
|
+
className: "".concat(this.ns.e("toolbar"), " ").concat(this.ns.is("has-materials", this.props.aiChat.materials.value.length > 0)),
|
|
4734
4799
|
controller: this.props.aiChat,
|
|
4735
4800
|
items: this.props.footerToolbarItems
|
|
4736
4801
|
}), c("div", {
|
|
@@ -4741,7 +4806,7 @@ class Ot extends P {
|
|
|
4741
4806
|
})
|
|
4742
4807
|
})]
|
|
4743
4808
|
})]
|
|
4744
|
-
}), c(
|
|
4809
|
+
}), c(es, {
|
|
4745
4810
|
title: this.props.caption || "AI助手",
|
|
4746
4811
|
controller: this.props.aiChat,
|
|
4747
4812
|
isMinimize: this.state.isMinimize,
|
|
@@ -4753,5 +4818,5 @@ class Ot extends P {
|
|
|
4753
4818
|
}
|
|
4754
4819
|
export {
|
|
4755
4820
|
Ot as ChatContainer,
|
|
4756
|
-
|
|
4821
|
+
ss as chat
|
|
4757
4822
|
};
|