@ibiz-template-plugin/ai-chat 0.0.39 → 0.0.41
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 +185 -184
- package/dist/index.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -151,29 +151,29 @@ function vs(n) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function zr(n, e, t, i, r, s, o, l, a, c) {
|
|
154
|
-
var d, u, h, f, p, m, y, v, b, w,
|
|
154
|
+
var d, u, h, f, p, m, y, v, b, w, S, k, _, M, O, I, ue, me = e.type;
|
|
155
155
|
if (e.constructor != null)
|
|
156
156
|
return null;
|
|
157
157
|
128 & t.__u && (a = !!(32 & t.__u), s = [l = e.__e = t.__e]), (d = D.__b) && d(e);
|
|
158
158
|
e:
|
|
159
159
|
if (typeof me == "function")
|
|
160
160
|
try {
|
|
161
|
-
if (v = e.props, b = "prototype" in me && me.prototype.render, w = (d = me.contextType) && i[d.__c],
|
|
161
|
+
if (v = e.props, b = "prototype" in me && me.prototype.render, w = (d = me.contextType) && i[d.__c], S = d ? w ? w.props.value : d.__ : i, t.__c ? y = (u = e.__c = t.__c).__ = u.__E : (b ? e.__c = u = new me(v, S) : (e.__c = u = new De(v, S), u.constructor = me, u.render = id), w && w.sub(u), u.props = v, u.state || (u.state = {}), u.context = S, u.__n = i, h = u.__d = !0, u.__h = [], u._sb = []), b && u.__s == null && (u.__s = u.state), b && me.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = je({}, u.__s)), je(u.__s, me.getDerivedStateFromProps(v, u.__s))), f = u.props, p = u.state, u.__v = e, h)
|
|
162
162
|
b && me.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), b && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
163
163
|
else {
|
|
164
|
-
if (b && me.getDerivedStateFromProps == null && v !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v,
|
|
164
|
+
if (b && me.getDerivedStateFromProps == null && v !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v, S), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(v, u.__s, S) === !1 || e.__v == t.__v) {
|
|
165
165
|
for (e.__v != t.__v && (u.props = v, u.state = u.__s, u.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.some(function(Ne) {
|
|
166
166
|
Ne && (Ne.__ = e);
|
|
167
|
-
}),
|
|
168
|
-
u.__h.push(u._sb[
|
|
167
|
+
}), k = 0; k < u._sb.length; k++)
|
|
168
|
+
u.__h.push(u._sb[k]);
|
|
169
169
|
u._sb = [], u.__h.length && o.push(u);
|
|
170
170
|
break e;
|
|
171
171
|
}
|
|
172
|
-
u.componentWillUpdate != null && u.componentWillUpdate(v, u.__s,
|
|
172
|
+
u.componentWillUpdate != null && u.componentWillUpdate(v, u.__s, S), b && u.componentDidUpdate != null && u.__h.push(function() {
|
|
173
173
|
u.componentDidUpdate(f, p, m);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
if (u.context =
|
|
176
|
+
if (u.context = S, u.props = v, u.__P = n, u.__e = !1, _ = D.__r, M = 0, b) {
|
|
177
177
|
for (u.state = u.__s, u.__d = !1, _ && _(e), d = u.render(u.props, u.state, u.context), O = 0; O < u._sb.length; O++)
|
|
178
178
|
u.__h.push(u._sb[O]);
|
|
179
179
|
u._sb = [];
|
|
@@ -1889,7 +1889,7 @@ function F(n) {
|
|
|
1889
1889
|
return We(n);
|
|
1890
1890
|
}, []);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1892
|
+
function Ce(n) {
|
|
1893
1893
|
var e = se(n);
|
|
1894
1894
|
return e.current = n, mi.__$f |= 4, Ee(function() {
|
|
1895
1895
|
return Pl(function() {
|
|
@@ -2402,8 +2402,8 @@ const nu = (n) => {
|
|
|
2402
2402
|
c(f, p).forEach((v, b) => {
|
|
2403
2403
|
const w = document.createElement("div");
|
|
2404
2404
|
w.className = "code-line";
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2405
|
+
const S = document.createElement("span");
|
|
2406
|
+
S && (S.className = "line-number", S.textContent = (b + 1).toString(), w.appendChild(S), w.innerHTML += v, m.appendChild(w));
|
|
2407
2407
|
});
|
|
2408
2408
|
}, c = (h, f = 0) => {
|
|
2409
2409
|
const p = " ".repeat(f), m = [];
|
|
@@ -2419,13 +2419,13 @@ const nu = (n) => {
|
|
|
2419
2419
|
if (y.length === 0)
|
|
2420
2420
|
return ["".concat(p, '<span class="property">{}</span>')];
|
|
2421
2421
|
m.push("".concat(p, '<span class="property">{</span>')), y.forEach((v, b) => {
|
|
2422
|
-
const w = h[v],
|
|
2422
|
+
const w = h[v], S = b < y.length - 1 ? "," : "", k = '<span class="json-key">"'.concat(v, '":</span>');
|
|
2423
2423
|
if (typeof w == "object" && w !== null) {
|
|
2424
2424
|
const _ = c(w, f + 1);
|
|
2425
|
-
m.push("".concat(p, " ").concat(
|
|
2425
|
+
m.push("".concat(p, " ").concat(k, " ").concat(_[0].trim())), _.length > 1 && (m.push(..._.slice(1, -1)), m.push("".concat(_[_.length - 1]).concat(S)));
|
|
2426
2426
|
} else {
|
|
2427
2427
|
const _ = d(w);
|
|
2428
|
-
m.push("".concat(p, " ").concat(
|
|
2428
|
+
m.push("".concat(p, " ").concat(k, " ").concat(_).concat(S));
|
|
2429
2429
|
}
|
|
2430
2430
|
}), m.push("".concat(p, '<span class="property">}</span>'));
|
|
2431
2431
|
} else
|
|
@@ -2530,7 +2530,7 @@ const iu = (n) => {
|
|
|
2530
2530
|
K(() => {
|
|
2531
2531
|
i.value = e.filter((a) => a), s.value = e.length > 4;
|
|
2532
2532
|
}, [e]);
|
|
2533
|
-
const o =
|
|
2533
|
+
const o = Ce(() => s.value && !r.value ? i.value.slice(0, 4) : i.value), l = () => {
|
|
2534
2534
|
r.value = !r.value;
|
|
2535
2535
|
};
|
|
2536
2536
|
return /* @__PURE__ */ g("div", { className: "".concat(t.b()), children: [
|
|
@@ -2538,8 +2538,8 @@ const iu = (n) => {
|
|
|
2538
2538
|
s.value && /* @__PURE__ */ g("div", { className: t.e("toggle"), onClick: l, children: r.value ? "收起工具调用" : "展开全部 ".concat(i.value.length, " 个工具调用") })
|
|
2539
2539
|
] });
|
|
2540
2540
|
};
|
|
2541
|
-
const
|
|
2542
|
-
var
|
|
2541
|
+
const ve = new L("chat-select"), ru = (n) => {
|
|
2542
|
+
var v;
|
|
2543
2543
|
const {
|
|
2544
2544
|
options: e,
|
|
2545
2545
|
value: t,
|
|
@@ -2554,45 +2554,45 @@ const Ce = new L("chat-select"), ru = (n) => {
|
|
|
2554
2554
|
K(() => {
|
|
2555
2555
|
t !== void 0 && u(t);
|
|
2556
2556
|
}, [t]);
|
|
2557
|
-
const p = (
|
|
2558
|
-
u(
|
|
2557
|
+
const p = (b) => {
|
|
2558
|
+
u(b.value), o == null || o(b.value), f(!1);
|
|
2559
2559
|
};
|
|
2560
2560
|
K(() => {
|
|
2561
|
-
const
|
|
2562
|
-
var
|
|
2563
|
-
l || (
|
|
2561
|
+
const b = (w) => {
|
|
2562
|
+
var S, k;
|
|
2563
|
+
l || (S = c.current) != null && S.contains(w.target) || ((k = a.current) != null && k.contains(w.target) ? f((_) => !_) : f(!1));
|
|
2564
2564
|
};
|
|
2565
|
-
return document.addEventListener("mousedown",
|
|
2566
|
-
document.removeEventListener("mousedown",
|
|
2565
|
+
return document.addEventListener("mousedown", b), () => {
|
|
2566
|
+
document.removeEventListener("mousedown", b);
|
|
2567
2567
|
};
|
|
2568
2568
|
}, []);
|
|
2569
|
-
const m = ((
|
|
2569
|
+
const m = ((v = e == null ? void 0 : e.find((b) => b.value === d)) == null ? void 0 : v.label) || s, y = !!(e != null && e.length);
|
|
2570
2570
|
return /* @__PURE__ */ g(
|
|
2571
2571
|
"div",
|
|
2572
2572
|
{
|
|
2573
|
-
className: "".concat(
|
|
2573
|
+
className: "".concat(ve.b(), " ").concat(r || "", " ").concat(ve.is("visble", h), " ").concat(ve.is("disabled", l), " ").concat(ve.is("no-options", !y)),
|
|
2574
2574
|
children: [
|
|
2575
|
-
/* @__PURE__ */ g("div", { className:
|
|
2576
|
-
/* @__PURE__ */ g("span", { className:
|
|
2577
|
-
/* @__PURE__ */ g("span", { className:
|
|
2578
|
-
/* @__PURE__ */ g(
|
|
2575
|
+
/* @__PURE__ */ g("div", { className: ve.e("header"), ref: a, children: [
|
|
2576
|
+
/* @__PURE__ */ g("span", { className: ve.em("header", "prefix"), title: "智能体", children: Yd() }),
|
|
2577
|
+
/* @__PURE__ */ g("span", { className: ve.em("header", "display-value"), title: m, children: m }),
|
|
2578
|
+
y ? /* @__PURE__ */ g(
|
|
2579
2579
|
"span",
|
|
2580
2580
|
{
|
|
2581
|
-
className: "".concat(
|
|
2581
|
+
className: "".concat(ve.em("header", "suffix"), " ").concat(ve.is("disabled", l)),
|
|
2582
2582
|
children: Xd()
|
|
2583
2583
|
}
|
|
2584
|
-
)
|
|
2584
|
+
) : null
|
|
2585
2585
|
] }),
|
|
2586
|
-
/* @__PURE__ */ g("div", { className:
|
|
2586
|
+
y ? /* @__PURE__ */ g("div", { className: ve.e("dropdown"), ref: c, children: /* @__PURE__ */ g("ul", { className: ve.em("dropdown", "list"), children: e == null ? void 0 : e.map((b) => /* @__PURE__ */ g(
|
|
2587
2587
|
"li",
|
|
2588
2588
|
{
|
|
2589
|
-
className: "".concat(
|
|
2590
|
-
title:
|
|
2591
|
-
onClick: () => p(
|
|
2592
|
-
children:
|
|
2589
|
+
className: "".concat(ve.em("dropdown", "item"), " ").concat(ve.is("active", b.value === d)),
|
|
2590
|
+
title: b.label,
|
|
2591
|
+
onClick: () => p(b),
|
|
2592
|
+
children: b.label
|
|
2593
2593
|
},
|
|
2594
|
-
|
|
2595
|
-
)) }) })
|
|
2594
|
+
b.value
|
|
2595
|
+
)) }) }) : null
|
|
2596
2596
|
]
|
|
2597
2597
|
}
|
|
2598
2598
|
);
|
|
@@ -2750,10 +2750,10 @@ const ht = new L("markdown-message"), ou = (n) => {
|
|
|
2750
2750
|
] });
|
|
2751
2751
|
};
|
|
2752
2752
|
const en = new L("ossfile-material"), lu = (n) => {
|
|
2753
|
-
const e =
|
|
2753
|
+
const e = Ce(() => n.material.data.name), t = Ce(() => n.material.metadata.size), i = Ce(() => {
|
|
2754
2754
|
const s = n.material.metadata.state;
|
|
2755
2755
|
return s === "successed" ? "上传成功" : s === "uploading" ? "上传中" : s === "failed" ? "上传失败" : "未知状态";
|
|
2756
|
-
}), r =
|
|
2756
|
+
}), r = Ce(() => {
|
|
2757
2757
|
switch (n.material.metadata.state) {
|
|
2758
2758
|
case "successed":
|
|
2759
2759
|
return "#1890ff";
|
|
@@ -2783,7 +2783,7 @@ const tn = new L("common-material"), au = (n) => {
|
|
|
2783
2783
|
var i, r, s, o;
|
|
2784
2784
|
const e = (i = n.controller.opts.questionToolbarItems) == null ? void 0 : i.find(
|
|
2785
2785
|
(l) => l.id === n.material.metadata.actionId
|
|
2786
|
-
), t =
|
|
2786
|
+
), t = Ce(() => n.material.metadata.name);
|
|
2787
2787
|
return /* @__PURE__ */ g("div", { className: tn.b(), children: [
|
|
2788
2788
|
/* @__PURE__ */ g("div", { className: tn.b("left"), children: e && e.icon ? typeof e.icon == "function" ? e.icon() : ((r = e.icon) == null ? void 0 : r.showIcon) && /* @__PURE__ */ g(ze, { children: (s = e.icon) != null && s.cssClass ? /* @__PURE__ */ g("i", { className: e.icon.cssClass }) : (o = e.icon) != null && o.imagePath ? fi(e.icon.imagePath) ? /* @__PURE__ */ g(
|
|
2789
2789
|
"div",
|
|
@@ -2821,7 +2821,7 @@ const $i = new L("chat-input-material-item"), Fl = (n) => {
|
|
|
2821
2821
|
] });
|
|
2822
2822
|
};
|
|
2823
2823
|
const Re = new L("user-message-question"), cu = (n) => {
|
|
2824
|
-
const e = F(He()), t = F(null), i = F(135), r = F(!0), s = F(!1), o = se(null), l =
|
|
2824
|
+
const e = F(He()), t = F(null), i = F(135), r = F(!0), s = F(!1), o = se(null), l = Ce(() => n.message.content), a = Ce(() => dr.parseMixedContent(l.value));
|
|
2825
2825
|
return K(() => {
|
|
2826
2826
|
t.value = new dl({
|
|
2827
2827
|
id: e,
|
|
@@ -2913,7 +2913,7 @@ const Re = new L("user-message-question"), cu = (n) => {
|
|
|
2913
2913
|
] });
|
|
2914
2914
|
};
|
|
2915
2915
|
const On = new L("error-message"), du = (n) => {
|
|
2916
|
-
const e =
|
|
2916
|
+
const e = Ce(() => n.message.content);
|
|
2917
2917
|
return /* @__PURE__ */ g("div", { className: On.b(), children: [
|
|
2918
2918
|
/* @__PURE__ */ g("div", { className: On.b("header"), children: [
|
|
2919
2919
|
/* @__PURE__ */ g("div", { className: On.be("header", "caption"), children: "AI " }),
|
|
@@ -3135,12 +3135,12 @@ const ge = new L("chat-toolbar-item"), mu = (n) => {
|
|
|
3135
3135
|
if (d(e))
|
|
3136
3136
|
return /* @__PURE__ */ g(ze, {});
|
|
3137
3137
|
const u = (b) => r ? !0 : typeof b.disabled == "function" ? b.disabled(t) : b.disabled === !0, h = (b) => {
|
|
3138
|
-
var w,
|
|
3138
|
+
var w, S, k, _;
|
|
3139
3139
|
if (typeof b.icon == "function")
|
|
3140
3140
|
return b.icon();
|
|
3141
|
-
if ((w = b.icon) != null && w.showIcon && ((
|
|
3141
|
+
if ((w = b.icon) != null && w.showIcon && ((S = b.icon) != null && S.cssClass))
|
|
3142
3142
|
return /* @__PURE__ */ g("i", { className: b.icon.cssClass });
|
|
3143
|
-
if ((
|
|
3143
|
+
if ((k = b.icon) != null && k.showIcon && ((_ = b.icon) != null && _.imagePath))
|
|
3144
3144
|
return fi(b.icon.imagePath) ? /* @__PURE__ */ g(
|
|
3145
3145
|
"div",
|
|
3146
3146
|
{
|
|
@@ -3194,7 +3194,7 @@ const ge = new L("chat-toolbar-item"), mu = (n) => {
|
|
|
3194
3194
|
"div",
|
|
3195
3195
|
{
|
|
3196
3196
|
title: b.title,
|
|
3197
|
-
onClick: (
|
|
3197
|
+
onClick: (S) => p(S, b),
|
|
3198
3198
|
className: "".concat(ge.be("dropdown", "item"), " ").concat(b.customClass || "", " ").concat(ge.is("disabled", u(b))),
|
|
3199
3199
|
children: [
|
|
3200
3200
|
/* @__PURE__ */ g("div", { className: ge.bem("dropdown", "item", "icon"), children: h(b) }),
|
|
@@ -3400,19 +3400,19 @@ const Ds = new L("chat-messages"), Is = (n) => {
|
|
|
3400
3400
|
return;
|
|
3401
3401
|
const { scrollTop: v, scrollHeight: b, clientHeight: w } = y;
|
|
3402
3402
|
v < 100 && !s && h && (o(!0), setTimeout(() => {
|
|
3403
|
-
const
|
|
3403
|
+
const k = Math.min(
|
|
3404
3404
|
i + t,
|
|
3405
3405
|
d.value.length
|
|
3406
3406
|
);
|
|
3407
|
-
r(
|
|
3407
|
+
r(k);
|
|
3408
3408
|
const _ = y.scrollHeight;
|
|
3409
3409
|
setTimeout(() => {
|
|
3410
3410
|
const M = y.scrollHeight;
|
|
3411
3411
|
y.scrollTop = M - _ + y.scrollTop, o(!1);
|
|
3412
3412
|
}, 0);
|
|
3413
3413
|
}, 300));
|
|
3414
|
-
const
|
|
3415
|
-
a(
|
|
3414
|
+
const S = b - (v + w) < 50;
|
|
3415
|
+
a(S);
|
|
3416
3416
|
}, m = () => {
|
|
3417
3417
|
c.current = !0, a(!0);
|
|
3418
3418
|
};
|
|
@@ -4333,20 +4333,21 @@ class Ws {
|
|
|
4333
4333
|
* @return {*} {Promise<void>}
|
|
4334
4334
|
*/
|
|
4335
4335
|
async handleSuggestionClick(e, t, i) {
|
|
4336
|
+
var l;
|
|
4336
4337
|
const r = this.messages.value.findIndex(
|
|
4337
|
-
(
|
|
4338
|
+
(a) => a.messageid === e.messageid
|
|
4338
4339
|
);
|
|
4339
4340
|
if (r !== -1) {
|
|
4340
|
-
const
|
|
4341
|
-
|
|
4341
|
+
const a = this.messages.value[r]._origin;
|
|
4342
|
+
a.suggestions = void 0, this.messages.value[r].replace(a), this.messages.value = [...this.messages.value];
|
|
4342
4343
|
}
|
|
4343
4344
|
this.asyncToIndexDB();
|
|
4344
4345
|
const { type: s, metadata: o } = t;
|
|
4345
4346
|
switch (s) {
|
|
4346
4347
|
case "action":
|
|
4347
4348
|
if (this.opts.extendToolbarClick) {
|
|
4348
|
-
const
|
|
4349
|
-
if (!
|
|
4349
|
+
const a = t.data.actionid;
|
|
4350
|
+
if (!a)
|
|
4350
4351
|
throw new Error("actionid不能为空");
|
|
4351
4352
|
this.addMessage({
|
|
4352
4353
|
messageid: He(),
|
|
@@ -4355,25 +4356,22 @@ class Ws {
|
|
|
4355
4356
|
role: "USER",
|
|
4356
4357
|
content: o.content_name
|
|
4357
4358
|
});
|
|
4358
|
-
const
|
|
4359
|
-
Object.assign(
|
|
4360
|
-
const
|
|
4359
|
+
const c = { ...e };
|
|
4360
|
+
Object.assign(c, { topic: this.topic }), c.msg.realcontent = e.realcontent;
|
|
4361
|
+
const d = await this.opts.extendToolbarClick(
|
|
4361
4362
|
i,
|
|
4362
|
-
{ id:
|
|
4363
|
+
{ id: a, appId: this.context.srfappid },
|
|
4363
4364
|
this.context,
|
|
4364
4365
|
this.params,
|
|
4365
|
-
|
|
4366
|
-
);
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
...d
|
|
4375
|
-
});
|
|
4376
|
-
}
|
|
4366
|
+
c
|
|
4367
|
+
), u = (l = d == null ? void 0 : d.data) == null ? void 0 : l[0];
|
|
4368
|
+
u.content && this.addMessage({
|
|
4369
|
+
messageid: He(),
|
|
4370
|
+
state: 30,
|
|
4371
|
+
type: u.type || "DEFAULT",
|
|
4372
|
+
role: u.role || "ASSISTANT",
|
|
4373
|
+
content: u.content
|
|
4374
|
+
});
|
|
4377
4375
|
}
|
|
4378
4376
|
break;
|
|
4379
4377
|
case "raw":
|
|
@@ -5190,7 +5188,7 @@ class Vu {
|
|
|
5190
5188
|
const r = this.aiTopic.getCurrentTopicByID(
|
|
5191
5189
|
e.id
|
|
5192
5190
|
);
|
|
5193
|
-
if (r && r.aiChat && r.aiChat.activeAIAgentID)
|
|
5191
|
+
if (r && (e.sequence = r.sequence, e.isTop = r.isTop), r && r.aiChat && r.aiChat.activeAIAgentID)
|
|
5194
5192
|
t.activeAIAgentID = r.aiChat.activeAIAgentID, e.aiChat.activeAIAgentID = r.aiChat.activeAIAgentID;
|
|
5195
5193
|
else if (t.aiAgentlist && t.aiAgentlist.length > 0 && !t.activeAIAgentID) {
|
|
5196
5194
|
const o = t.aiAgentlist.find(
|
|
@@ -5237,8 +5235,11 @@ class Vu {
|
|
|
5237
5235
|
extendToolbarClick: this.backupChatOptions.chatOptions.extendToolbarClick,
|
|
5238
5236
|
recommendPrompt: this.backupChatOptions.chatOptions.recommendPrompt
|
|
5239
5237
|
});
|
|
5240
|
-
|
|
5241
|
-
|
|
5238
|
+
const i = new Ws(
|
|
5239
|
+
t,
|
|
5240
|
+
this.resourceOptions
|
|
5241
|
+
);
|
|
5242
|
+
this.aiTopicMap.set("".concat(e.id), i), this.container && (Lt(null, this.container), Lt(
|
|
5242
5243
|
Ke(sl, {
|
|
5243
5244
|
aiChat: i,
|
|
5244
5245
|
aiTopic: this.aiTopic,
|
|
@@ -8272,15 +8273,15 @@ class wr {
|
|
|
8272
8273
|
return (this.delInfo & qn) > 0;
|
|
8273
8274
|
}
|
|
8274
8275
|
}
|
|
8275
|
-
class
|
|
8276
|
+
class we {
|
|
8276
8277
|
/**
|
|
8277
8278
|
Create a position map. The modifications to the document are
|
|
8278
8279
|
represented as an array of numbers, in which each group of three
|
|
8279
8280
|
represents a modified chunk as `[start, oldSize, newSize]`.
|
|
8280
8281
|
*/
|
|
8281
8282
|
constructor(e, t = !1) {
|
|
8282
|
-
if (this.ranges = e, this.inverted = t, !e.length &&
|
|
8283
|
-
return
|
|
8283
|
+
if (this.ranges = e, this.inverted = t, !e.length && we.empty)
|
|
8284
|
+
return we.empty;
|
|
8284
8285
|
}
|
|
8285
8286
|
/**
|
|
8286
8287
|
@internal
|
|
@@ -8351,7 +8352,7 @@ class be {
|
|
|
8351
8352
|
map positions in the post-step document to the pre-step document.
|
|
8352
8353
|
*/
|
|
8353
8354
|
invert() {
|
|
8354
|
-
return new
|
|
8355
|
+
return new we(this.ranges, !this.inverted);
|
|
8355
8356
|
}
|
|
8356
8357
|
/**
|
|
8357
8358
|
@internal
|
|
@@ -8365,10 +8366,10 @@ class be {
|
|
|
8365
8366
|
sub-document to a larger document, or vice-versa.
|
|
8366
8367
|
*/
|
|
8367
8368
|
static offset(e) {
|
|
8368
|
-
return e == 0 ?
|
|
8369
|
+
return e == 0 ? we.empty : new we(e < 0 ? [0, -e, 0] : [0, 0, e]);
|
|
8369
8370
|
}
|
|
8370
8371
|
}
|
|
8371
|
-
|
|
8372
|
+
we.empty = new we([]);
|
|
8372
8373
|
class bn {
|
|
8373
8374
|
/**
|
|
8374
8375
|
Create a new mapping with the given position maps.
|
|
@@ -8484,7 +8485,7 @@ class de {
|
|
|
8484
8485
|
and the new document.
|
|
8485
8486
|
*/
|
|
8486
8487
|
getMap() {
|
|
8487
|
-
return
|
|
8488
|
+
return we.empty;
|
|
8488
8489
|
}
|
|
8489
8490
|
/**
|
|
8490
8491
|
Try to merge this step with another one, to be applied directly
|
|
@@ -8734,7 +8735,7 @@ class G extends de {
|
|
|
8734
8735
|
return this.structure && Cr(e, this.from, this.to) ? J.fail("Structure replace would overwrite content") : J.fromReplace(e, this.from, this.to, this.slice);
|
|
8735
8736
|
}
|
|
8736
8737
|
getMap() {
|
|
8737
|
-
return new
|
|
8738
|
+
return new we([this.from, this.to - this.from, this.slice.size]);
|
|
8738
8739
|
}
|
|
8739
8740
|
invert(e) {
|
|
8740
8741
|
return new G(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
|
|
@@ -8789,7 +8790,7 @@ class Q extends de {
|
|
|
8789
8790
|
return i ? J.fromReplace(e, this.from, this.to, i) : J.fail("Content does not fit in gap");
|
|
8790
8791
|
}
|
|
8791
8792
|
getMap() {
|
|
8792
|
-
return new
|
|
8793
|
+
return new we([
|
|
8793
8794
|
this.from,
|
|
8794
8795
|
this.gapFrom - this.from,
|
|
8795
8796
|
this.insert,
|
|
@@ -9433,7 +9434,7 @@ class Ht extends de {
|
|
|
9433
9434
|
return J.fromReplace(e, this.pos, this.pos + 1, new x(C.from(r), 0, t.isLeaf ? 0 : 1));
|
|
9434
9435
|
}
|
|
9435
9436
|
getMap() {
|
|
9436
|
-
return
|
|
9437
|
+
return we.empty;
|
|
9437
9438
|
}
|
|
9438
9439
|
invert(e) {
|
|
9439
9440
|
return new Ht(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -9468,7 +9469,7 @@ class wn extends de {
|
|
|
9468
9469
|
return J.ok(i);
|
|
9469
9470
|
}
|
|
9470
9471
|
getMap() {
|
|
9471
|
-
return
|
|
9472
|
+
return we.empty;
|
|
9472
9473
|
}
|
|
9473
9474
|
invert(e) {
|
|
9474
9475
|
return new wn(this.attr, e.attrs[this.attr]);
|
|
@@ -14215,32 +14216,32 @@ function Vp(n, e, t, i, r) {
|
|
|
14215
14216
|
return M(n, mt(13, "Enter"));
|
|
14216
14217
|
});
|
|
14217
14218
|
}, 20));
|
|
14218
|
-
let w = p.start,
|
|
14219
|
-
let O = M || n.state.tr.replace(w,
|
|
14219
|
+
let w = p.start, S = p.endA, k = (M) => {
|
|
14220
|
+
let O = M || n.state.tr.replace(w, S, c.doc.slice(p.start - c.from, p.endB - c.from));
|
|
14220
14221
|
if (c.sel) {
|
|
14221
14222
|
let I = Lo(n, O.doc, c.sel);
|
|
14222
|
-
I && !(Z && n.composing && I.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (I.head == w || I.head == O.mapping.map(
|
|
14223
|
+
I && !(Z && n.composing && I.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (I.head == w || I.head == O.mapping.map(S) - 1) || ye && I.empty && I.head == w) && O.setSelection(I);
|
|
14223
14224
|
}
|
|
14224
14225
|
return s && O.setMeta("composition", s), O.scrollIntoView();
|
|
14225
14226
|
}, _;
|
|
14226
14227
|
if (b)
|
|
14227
14228
|
if (m.pos == y.pos) {
|
|
14228
14229
|
ye && ot <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => Je(n), 20));
|
|
14229
|
-
let M =
|
|
14230
|
+
let M = k(n.state.tr.delete(w, S)), O = d.resolve(p.start).marksAcross(d.resolve(p.endA));
|
|
14230
14231
|
O && M.ensureMarks(O), n.dispatch(M);
|
|
14231
14232
|
} else if (
|
|
14232
14233
|
// Adding or removing a mark
|
|
14233
14234
|
p.endA == p.endB && (_ = Hp(m.parent.content.cut(m.parentOffset, y.parentOffset), v.parent.content.cut(v.parentOffset, p.endA - v.start())))
|
|
14234
14235
|
) {
|
|
14235
|
-
let M =
|
|
14236
|
-
_.type == "add" ? M.addMark(w,
|
|
14236
|
+
let M = k(n.state.tr);
|
|
14237
|
+
_.type == "add" ? M.addMark(w, S, _.mark) : M.removeMark(w, S, _.mark), n.dispatch(M);
|
|
14237
14238
|
} else if (m.parent.child(m.index()).isText && m.index() == y.index() - (y.textOffset ? 0 : 1)) {
|
|
14238
|
-
let M = m.parent.textBetween(m.parentOffset, y.parentOffset), O = () =>
|
|
14239
|
-
n.someProp("handleTextInput", (I) => I(n, w,
|
|
14239
|
+
let M = m.parent.textBetween(m.parentOffset, y.parentOffset), O = () => k(n.state.tr.insertText(M, w, S));
|
|
14240
|
+
n.someProp("handleTextInput", (I) => I(n, w, S, M, O)) || n.dispatch(O());
|
|
14240
14241
|
} else
|
|
14241
|
-
n.dispatch(
|
|
14242
|
+
n.dispatch(k());
|
|
14242
14243
|
else
|
|
14243
|
-
n.dispatch(
|
|
14244
|
+
n.dispatch(k());
|
|
14244
14245
|
}
|
|
14245
14246
|
function Lo(n, e, t) {
|
|
14246
14247
|
return Math.max(t.anchor, t.head) > e.content.size ? null : Yr(n, e.resolve(t.anchor), e.resolve(t.head));
|
|
@@ -15304,8 +15305,8 @@ var Cm = (n) => !("type" in n), km = (n, e, t) => ({ tr: i, dispatch: r, editor:
|
|
|
15304
15305
|
i.insertText(m, d, u);
|
|
15305
15306
|
} else {
|
|
15306
15307
|
m = l;
|
|
15307
|
-
const y = i.doc.resolve(d), v = y.node(), b = y.parentOffset === 0, w = v.isText || v.isTextblock,
|
|
15308
|
-
b && w &&
|
|
15308
|
+
const y = i.doc.resolve(d), v = y.node(), b = y.parentOffset === 0, w = v.isText || v.isTextblock, S = v.content.size > 0;
|
|
15309
|
+
b && w && S && (d = Math.max(0, d - 1)), i.replaceWith(d, u, m);
|
|
15309
15310
|
}
|
|
15310
15311
|
t.updateSelection && wm(i, i.steps.length - 1, -1), t.applyInputRules && i.setMeta("applyInputRules", { from: d, text: m }), t.applyPasteRules && i.setMeta("applyPasteRules", { from: d, text: m });
|
|
15311
15312
|
}
|
|
@@ -15862,8 +15863,8 @@ function Ir(n, e, t = {}) {
|
|
|
15862
15863
|
return;
|
|
15863
15864
|
const v = Math.max(f, y), b = Math.min(p, y + m.nodeSize), w = b - v;
|
|
15864
15865
|
o += w, l.push(
|
|
15865
|
-
...m.marks.map((
|
|
15866
|
-
mark:
|
|
15866
|
+
...m.marks.map((S) => ({
|
|
15867
|
+
mark: S,
|
|
15867
15868
|
from: v,
|
|
15868
15869
|
to: b
|
|
15869
15870
|
}))
|
|
@@ -16084,11 +16085,11 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16084
16085
|
const w = (
|
|
16085
16086
|
// eslint-disable-next-line no-nested-ternary
|
|
16086
16087
|
a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3
|
|
16087
|
-
),
|
|
16088
|
+
), S = {
|
|
16088
16089
|
...Un(h, a.node().type.name, a.node().attrs),
|
|
16089
16090
|
...e
|
|
16090
|
-
},
|
|
16091
|
-
v = v.append(C.from(l.createAndFill(null,
|
|
16091
|
+
}, k = ((o = l.contentMatch.defaultType) == null ? void 0 : o.createAndFill(S)) || void 0;
|
|
16092
|
+
v = v.append(C.from(l.createAndFill(null, k) || void 0));
|
|
16092
16093
|
const _ = a.before(a.depth - (b - 1));
|
|
16093
16094
|
t.replace(_, a.after(-w), new x(v, 4 - b, 0));
|
|
16094
16095
|
let M = -1;
|
|
@@ -16115,11 +16116,11 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16115
16116
|
if (!Vt(t.doc, a.pos, 2))
|
|
16116
16117
|
return !1;
|
|
16117
16118
|
if (r) {
|
|
16118
|
-
const { selection: v, storedMarks: b } = i, { splittableMarks: w } = s.extensionManager,
|
|
16119
|
-
if (t.split(a.pos, 2, y).scrollIntoView(), !
|
|
16119
|
+
const { selection: v, storedMarks: b } = i, { splittableMarks: w } = s.extensionManager, S = b || v.$to.parentOffset && v.$from.marks();
|
|
16120
|
+
if (t.split(a.pos, 2, y).scrollIntoView(), !S || !r)
|
|
16120
16121
|
return !0;
|
|
16121
|
-
const
|
|
16122
|
-
t.ensureMarks(
|
|
16122
|
+
const k = S.filter((_) => w.includes(_.type.name));
|
|
16123
|
+
t.ensureMarks(k);
|
|
16123
16124
|
}
|
|
16124
16125
|
return !0;
|
|
16125
16126
|
}, nr = (n, e) => {
|
|
@@ -16141,18 +16142,18 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16141
16142
|
const r = n.doc.nodeAt(i);
|
|
16142
16143
|
return t.node.type === (r == null ? void 0 : r.type) && At(n.doc, i) && n.join(i), !0;
|
|
16143
16144
|
}, w0 = (n, e, t, i = {}) => ({ editor: r, tr: s, state: o, dispatch: l, chain: a, commands: c, can: d }) => {
|
|
16144
|
-
const { extensions: u, splittableMarks: h } = r.extensionManager, f = te(n, o.schema), p = te(e, o.schema), { selection: m, storedMarks: y } = o, { $from: v, $to: b } = m, w = v.blockRange(b),
|
|
16145
|
+
const { extensions: u, splittableMarks: h } = r.extensionManager, f = te(n, o.schema), p = te(e, o.schema), { selection: m, storedMarks: y } = o, { $from: v, $to: b } = m, w = v.blockRange(b), S = y || m.$to.parentOffset && m.$from.marks();
|
|
16145
16146
|
if (!w)
|
|
16146
16147
|
return !1;
|
|
16147
|
-
const
|
|
16148
|
-
if (w.depth >= 1 &&
|
|
16149
|
-
if (
|
|
16148
|
+
const k = ss((_) => Go(_.type.name, u))(m);
|
|
16149
|
+
if (w.depth >= 1 && k && w.depth - k.depth <= 1) {
|
|
16150
|
+
if (k.node.type === f)
|
|
16150
16151
|
return c.liftListItem(p);
|
|
16151
|
-
if (Go(
|
|
16152
|
-
return a().command(() => (s.setNodeMarkup(
|
|
16152
|
+
if (Go(k.node.type.name, u) && f.validContent(k.node.content) && l)
|
|
16153
|
+
return a().command(() => (s.setNodeMarkup(k.pos, f), !0)).command(() => nr(s, f)).command(() => ir(s, f)).run();
|
|
16153
16154
|
}
|
|
16154
|
-
return !t || !
|
|
16155
|
-
const _ = d().wrapInList(f, i), M =
|
|
16155
|
+
return !t || !S || !l ? a().command(() => d().wrapInList(f, i) ? !0 : c.clearNodes()).wrapInList(f, i).command(() => nr(s, f)).command(() => ir(s, f)).run() : a().command(() => {
|
|
16156
|
+
const _ = d().wrapInList(f, i), M = S.filter((O) => h.includes(O.type.name));
|
|
16156
16157
|
return s.ensureMarks(M), _ ? !0 : c.clearNodes();
|
|
16157
16158
|
}).wrapInList(f, i).command(() => nr(s, f)).command(() => ir(s, f)).run();
|
|
16158
16159
|
}, C0 = (n, e = {}, t = {}) => ({ state: i, commands: r }) => {
|
|
@@ -16234,10 +16235,10 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16234
16235
|
...e
|
|
16235
16236
|
})), o && y.marks.length && y.marks.forEach((b) => {
|
|
16236
16237
|
if (o === b.type && (a = !0, r)) {
|
|
16237
|
-
const w = Math.max(v, d),
|
|
16238
|
+
const w = Math.max(v, d), S = Math.min(v + y.nodeSize, u);
|
|
16238
16239
|
t.addMark(
|
|
16239
16240
|
w,
|
|
16240
|
-
|
|
16241
|
+
S,
|
|
16241
16242
|
o.create({
|
|
16242
16243
|
...b.attrs,
|
|
16243
16244
|
...e
|
|
@@ -16521,14 +16522,14 @@ function B0(n) {
|
|
|
16521
16522
|
var m, y, v, b, w;
|
|
16522
16523
|
if ((y = (m = f.type) == null ? void 0 : m.spec) != null && y.code || !(f.isText || f.isTextblock || f.isInline))
|
|
16523
16524
|
return;
|
|
16524
|
-
const
|
|
16525
|
-
if (
|
|
16525
|
+
const S = (w = (b = (v = f.content) == null ? void 0 : v.size) != null ? b : f.nodeSize) != null ? w : 0, k = Math.max(i, p), _ = Math.min(r, p + S);
|
|
16526
|
+
if (k >= _)
|
|
16526
16527
|
return;
|
|
16527
|
-
const M = f.isText ? f.text || "" : f.textBetween(
|
|
16528
|
+
const M = f.isText ? f.text || "" : f.textBetween(k - p, _ - p, void 0, "");
|
|
16528
16529
|
L0(M, s.find, o).forEach((I) => {
|
|
16529
16530
|
if (I.index === void 0)
|
|
16530
16531
|
return;
|
|
16531
|
-
const ue =
|
|
16532
|
+
const ue = k + I.index + 1, me = ue + I[0].length, Ne = {
|
|
16532
16533
|
from: t.tr.mapping.map(ue),
|
|
16533
16534
|
to: t.tr.mapping.map(me)
|
|
16534
16535
|
}, Ai = s.handler({
|
|
@@ -16627,9 +16628,9 @@ function V0(n) {
|
|
|
16627
16628
|
if (!m && !y && !b)
|
|
16628
16629
|
return;
|
|
16629
16630
|
if (b) {
|
|
16630
|
-
let { text:
|
|
16631
|
-
typeof
|
|
16632
|
-
const { from: _ } = v, M = _ +
|
|
16631
|
+
let { text: k } = v;
|
|
16632
|
+
typeof k == "string" ? k = k : k = as(C.from(k), f.schema);
|
|
16633
|
+
const { from: _ } = v, M = _ + k.length, O = F0(k);
|
|
16633
16634
|
return a({
|
|
16634
16635
|
rule: d,
|
|
16635
16636
|
state: f,
|
|
@@ -16638,13 +16639,13 @@ function V0(n) {
|
|
|
16638
16639
|
pasteEvt: O
|
|
16639
16640
|
});
|
|
16640
16641
|
}
|
|
16641
|
-
const w = h.doc.content.findDiffStart(f.doc.content),
|
|
16642
|
-
if (!(!$0(w) || !
|
|
16642
|
+
const w = h.doc.content.findDiffStart(f.doc.content), S = h.doc.content.findDiffEnd(f.doc.content);
|
|
16643
|
+
if (!(!$0(w) || !S || w === S.b))
|
|
16643
16644
|
return a({
|
|
16644
16645
|
rule: d,
|
|
16645
16646
|
state: f,
|
|
16646
16647
|
from: w,
|
|
16647
|
-
to:
|
|
16648
|
+
to: S,
|
|
16648
16649
|
pasteEvt: o
|
|
16649
16650
|
});
|
|
16650
16651
|
}
|
|
@@ -16935,7 +16936,7 @@ var X = class Dc extends us {
|
|
|
16935
16936
|
d.steps.forEach((f, p) => {
|
|
16936
16937
|
var m, y;
|
|
16937
16938
|
if (f instanceof Oe) {
|
|
16938
|
-
const v = h.slice(p).map(f.from, -1), b = h.slice(p).map(f.to), w = h.invert().map(v, -1),
|
|
16939
|
+
const v = h.slice(p).map(f.from, -1), b = h.slice(p).map(f.to), w = h.invert().map(v, -1), S = h.invert().map(b), k = (m = d.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((M) => M.eq(f.mark)), _ = (y = d.doc.nodeAt(b)) == null ? void 0 : y.marks.some((M) => M.eq(f.mark));
|
|
16939
16940
|
this.editor.emit("delete", {
|
|
16940
16941
|
type: "mark",
|
|
16941
16942
|
mark: f.mark,
|
|
@@ -16943,13 +16944,13 @@ var X = class Dc extends us {
|
|
|
16943
16944
|
to: f.to,
|
|
16944
16945
|
deletedRange: {
|
|
16945
16946
|
from: w,
|
|
16946
|
-
to:
|
|
16947
|
+
to: S
|
|
16947
16948
|
},
|
|
16948
16949
|
newRange: {
|
|
16949
16950
|
from: v,
|
|
16950
16951
|
to: b
|
|
16951
16952
|
},
|
|
16952
|
-
partial: !!(_ ||
|
|
16953
|
+
partial: !!(_ || k),
|
|
16953
16954
|
editor: this.editor,
|
|
16954
16955
|
transaction: n,
|
|
16955
16956
|
combinedTransform: d
|
|
@@ -18129,10 +18130,10 @@ function Z0(n) {
|
|
|
18129
18130
|
if (!y)
|
|
18130
18131
|
return;
|
|
18131
18132
|
const [v, b = ""] = y, w = r(b);
|
|
18132
|
-
let
|
|
18133
|
-
const
|
|
18133
|
+
let S = 1;
|
|
18134
|
+
const k = v.length;
|
|
18134
18135
|
let _ = "";
|
|
18135
|
-
const M = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(
|
|
18136
|
+
const M = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(k);
|
|
18136
18137
|
for (M.lastIndex = 0; ; ) {
|
|
18137
18138
|
const I = M.exec(O);
|
|
18138
18139
|
if (I === null)
|
|
@@ -18140,11 +18141,11 @@ function Z0(n) {
|
|
|
18140
18141
|
const ue = I.index, me = I[1];
|
|
18141
18142
|
if (!((p = I[2]) != null && p.endsWith(":::"))) {
|
|
18142
18143
|
if (me)
|
|
18143
|
-
|
|
18144
|
-
else if (
|
|
18144
|
+
S += 1;
|
|
18145
|
+
else if (S -= 1, S === 0) {
|
|
18145
18146
|
const Ne = O.slice(0, ue);
|
|
18146
18147
|
_ = Ne.trim();
|
|
18147
|
-
const Ai = u.slice(0,
|
|
18148
|
+
const Ai = u.slice(0, k + ue + I[0].length);
|
|
18148
18149
|
let Xe = [];
|
|
18149
18150
|
if (_)
|
|
18150
18151
|
if (l === "block")
|
|
@@ -18230,11 +18231,11 @@ function t1(n) {
|
|
|
18230
18231
|
return;
|
|
18231
18232
|
let v = "", b = "";
|
|
18232
18233
|
if (l) {
|
|
18233
|
-
const [,
|
|
18234
|
-
b =
|
|
18234
|
+
const [, S] = y;
|
|
18235
|
+
b = S;
|
|
18235
18236
|
} else {
|
|
18236
|
-
const [,
|
|
18237
|
-
b =
|
|
18237
|
+
const [, S, k] = y;
|
|
18238
|
+
b = S, v = k || "";
|
|
18238
18239
|
}
|
|
18239
18240
|
const w = r(b.trim());
|
|
18240
18241
|
return {
|
|
@@ -18273,30 +18274,30 @@ function n1(n, e, t) {
|
|
|
18273
18274
|
c = "".concat(c).concat(h, "\n");
|
|
18274
18275
|
const v = [y];
|
|
18275
18276
|
for (d += 1; d < l.length; ) {
|
|
18276
|
-
const
|
|
18277
|
-
if (
|
|
18277
|
+
const k = l[d];
|
|
18278
|
+
if (k.trim() === "") {
|
|
18278
18279
|
const M = l.slice(d + 1).findIndex((ue) => ue.trim() !== "");
|
|
18279
18280
|
if (M === -1)
|
|
18280
18281
|
break;
|
|
18281
18282
|
if ((((r = (i = l[d + 1 + M].match(/^(\s*)/)) == null ? void 0 : i[1]) == null ? void 0 : r.length) || 0) > m) {
|
|
18282
|
-
v.push(
|
|
18283
|
+
v.push(k), c = "".concat(c).concat(k, "\n"), d += 1;
|
|
18283
18284
|
continue;
|
|
18284
18285
|
} else
|
|
18285
18286
|
break;
|
|
18286
18287
|
}
|
|
18287
|
-
if ((((o = (s =
|
|
18288
|
-
v.push(
|
|
18288
|
+
if ((((o = (s = k.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : o.length) || 0) > m)
|
|
18289
|
+
v.push(k), c = "".concat(c).concat(k, "\n"), d += 1;
|
|
18289
18290
|
else
|
|
18290
18291
|
break;
|
|
18291
18292
|
}
|
|
18292
18293
|
let b;
|
|
18293
18294
|
const w = v.slice(1);
|
|
18294
18295
|
if (w.length > 0) {
|
|
18295
|
-
const
|
|
18296
|
-
|
|
18296
|
+
const k = w.map((_) => _.slice(m + u)).join("\n");
|
|
18297
|
+
k.trim() && (e.customNestedParser ? b = e.customNestedParser(k) : b = t.blockTokens(k));
|
|
18297
18298
|
}
|
|
18298
|
-
const
|
|
18299
|
-
a.push(
|
|
18299
|
+
const S = e.createToken(p, b);
|
|
18300
|
+
a.push(S);
|
|
18300
18301
|
}
|
|
18301
18302
|
if (a.length !== 0)
|
|
18302
18303
|
return {
|
|
@@ -19591,20 +19592,20 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19591
19592
|
}, s.current.onend = () => {
|
|
19592
19593
|
r.value = !1;
|
|
19593
19594
|
}, s.current.onresult = (v) => {
|
|
19594
|
-
var w,
|
|
19595
|
-
const b = (
|
|
19595
|
+
var w, S, k, _;
|
|
19596
|
+
const b = (k = (S = (w = v.results) == null ? void 0 : w[0]) == null ? void 0 : S[0]) == null ? void 0 : k.transcript;
|
|
19596
19597
|
b && ((_ = o.current) == null || _.commands.insertContent(b));
|
|
19597
19598
|
});
|
|
19598
19599
|
const l = () => {
|
|
19599
19600
|
s.current && !r.value && s.current.start();
|
|
19600
19601
|
}, a = (v) => {
|
|
19601
19602
|
const b = new DOMParser().parseFromString(v, "text/html");
|
|
19602
|
-
function w(
|
|
19603
|
-
if (
|
|
19604
|
-
return
|
|
19605
|
-
if (
|
|
19603
|
+
function w(k) {
|
|
19604
|
+
if (k.nodeType === Node.TEXT_NODE)
|
|
19605
|
+
return k.textContent || "";
|
|
19606
|
+
if (k.nodeType !== Node.ELEMENT_NODE)
|
|
19606
19607
|
return "";
|
|
19607
|
-
const _ =
|
|
19608
|
+
const _ = k, M = _.tagName.toLowerCase(), O = Array.from(_.childNodes).map((I) => w(I)).join("");
|
|
19608
19609
|
switch (M) {
|
|
19609
19610
|
case "p":
|
|
19610
19611
|
return "".concat(O, "\n");
|
|
@@ -19613,11 +19614,11 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19613
19614
|
return I ? "\n.concat(I, ")\n") : "";
|
|
19614
19615
|
}
|
|
19615
19616
|
default:
|
|
19616
|
-
return
|
|
19617
|
+
return k.textContent || "";
|
|
19617
19618
|
}
|
|
19618
19619
|
}
|
|
19619
19620
|
return Array.from(b.body.childNodes).map(w).join("").replace(/\n+/g, "\n").replace(/^\n|\n$/g, "");
|
|
19620
|
-
}, c =
|
|
19621
|
+
}, c = Ce(() => a(i.value).length <= 0), d = Ts(async () => {
|
|
19621
19622
|
var v;
|
|
19622
19623
|
try {
|
|
19623
19624
|
const b = a(i.value);
|
|
@@ -19707,16 +19708,16 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19707
19708
|
}
|
|
19708
19709
|
),
|
|
19709
19710
|
(y = n.questionToolbarItems) == null ? void 0 : y.map((v) => {
|
|
19710
|
-
var b, w,
|
|
19711
|
+
var b, w, S;
|
|
19711
19712
|
return /* @__PURE__ */ g(
|
|
19712
19713
|
"div",
|
|
19713
19714
|
{
|
|
19714
19715
|
className: j.b("pop-action-item"),
|
|
19715
|
-
onClick: (
|
|
19716
|
-
p(
|
|
19716
|
+
onClick: (k) => {
|
|
19717
|
+
p(k, v);
|
|
19717
19718
|
},
|
|
19718
19719
|
children: [
|
|
19719
|
-
/* @__PURE__ */ g("span", { className: j.b("pop-action-item-icon"), children: typeof v.icon == "function" ? v.icon() : ((b = v.icon) == null ? void 0 : b.showIcon) && /* @__PURE__ */ g(ze, { children: (w = v.icon) != null && w.cssClass ? /* @__PURE__ */ g("i", { className: v.icon.cssClass }) : (
|
|
19720
|
+
/* @__PURE__ */ g("span", { className: j.b("pop-action-item-icon"), children: typeof v.icon == "function" ? v.icon() : ((b = v.icon) == null ? void 0 : b.showIcon) && /* @__PURE__ */ g(ze, { children: (w = v.icon) != null && w.cssClass ? /* @__PURE__ */ g("i", { className: v.icon.cssClass }) : (S = v.icon) != null && S.imagePath ? fi(v.icon.imagePath) ? /* @__PURE__ */ g(
|
|
19720
19721
|
"div",
|
|
19721
19722
|
{
|
|
19722
19723
|
dangerouslySetInnerHTML: {
|
|
@@ -19776,8 +19777,8 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19776
19777
|
] })
|
|
19777
19778
|
] });
|
|
19778
19779
|
};
|
|
19779
|
-
const
|
|
19780
|
-
const { controller: e, topic: t, onClick: i, onAction: r } = n, s = se(null), o =
|
|
19780
|
+
const be = new L("chat-topic-item"), $1 = (n) => {
|
|
19781
|
+
const { controller: e, topic: t, onClick: i, onAction: r } = n, s = se(null), o = Ce(() => {
|
|
19781
19782
|
var y;
|
|
19782
19783
|
return ((y = e.activedTopic.value) == null ? void 0 : y.id) === t.id;
|
|
19783
19784
|
}), [l, a] = xe(!1), c = F(!1), d = (m) => {
|
|
@@ -19798,13 +19799,13 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19798
19799
|
return /* @__PURE__ */ g(
|
|
19799
19800
|
"div",
|
|
19800
19801
|
{
|
|
19801
|
-
className: "".concat(
|
|
19802
|
+
className: "".concat(be.b(), " ").concat(be.is("active", o.value), " ").concat(be.is(
|
|
19802
19803
|
"edit",
|
|
19803
19804
|
c.value
|
|
19804
19805
|
)),
|
|
19805
19806
|
onClick: i.bind(void 0),
|
|
19806
19807
|
children: [
|
|
19807
|
-
/* @__PURE__ */ g("div", { className:
|
|
19808
|
+
/* @__PURE__ */ g("div", { className: be.e("caption"), title: t.caption, children: c.value ? /* @__PURE__ */ g(
|
|
19808
19809
|
"input",
|
|
19809
19810
|
{
|
|
19810
19811
|
ref: s,
|
|
@@ -19813,20 +19814,20 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19813
19814
|
onKeyDown: p,
|
|
19814
19815
|
onClick: (m) => m.stopPropagation(),
|
|
19815
19816
|
onChange: (m) => h(m),
|
|
19816
|
-
className:
|
|
19817
|
+
className: be.em("caption", "editor")
|
|
19817
19818
|
}
|
|
19818
|
-
) : /* @__PURE__ */ g("div", { className:
|
|
19819
|
-
/* @__PURE__ */ g("span", { className:
|
|
19820
|
-
t.isTop ? /* @__PURE__ */ g("span", { className:
|
|
19819
|
+
) : /* @__PURE__ */ g("div", { className: be.em("caption", "readonly"), children: [
|
|
19820
|
+
/* @__PURE__ */ g("span", { className: be.em("caption", "text"), children: t.caption }),
|
|
19821
|
+
t.isTop ? /* @__PURE__ */ g("span", { className: be.em("caption", "icon"), children: /* @__PURE__ */ g(As, {}) }) : null
|
|
19821
19822
|
] }) }),
|
|
19822
|
-
!c.value && /* @__PURE__ */ g("div", { className:
|
|
19823
|
+
!c.value && /* @__PURE__ */ g("div", { className: be.e("icon"), children: [
|
|
19823
19824
|
/* @__PURE__ */ g(
|
|
19824
19825
|
"span",
|
|
19825
19826
|
{
|
|
19826
19827
|
title: "跳转主视图",
|
|
19827
|
-
className:
|
|
19828
|
+
className: be.em("icon", "item"),
|
|
19828
19829
|
onClick: d.bind(void 0),
|
|
19829
|
-
children: /* @__PURE__ */ g($d, { className:
|
|
19830
|
+
children: /* @__PURE__ */ g($d, { className: be.b("link-icon") })
|
|
19830
19831
|
}
|
|
19831
19832
|
),
|
|
19832
19833
|
o.value ? null : /* @__PURE__ */ g(
|
|
@@ -19845,7 +19846,7 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19845
19846
|
isOpen: l,
|
|
19846
19847
|
onToggleOpen: a,
|
|
19847
19848
|
onAction: u.bind(void 0),
|
|
19848
|
-
children: /* @__PURE__ */ g("span", { className:
|
|
19849
|
+
children: /* @__PURE__ */ g("span", { className: be.em("icon", "item"), title: "更多", children: /* @__PURE__ */ g(zd, { className: be.e("more-icon") }) })
|
|
19849
19850
|
}
|
|
19850
19851
|
)
|
|
19851
19852
|
] })
|
|
@@ -19882,7 +19883,7 @@ const Vn = new L("chat-search"), L1 = (n) => {
|
|
|
19882
19883
|
const It = new L("chat-topics"), B1 = (n) => {
|
|
19883
19884
|
const e = se(null), t = F(void 0), i = F([]);
|
|
19884
19885
|
K(() => {
|
|
19885
|
-
const l = n.controller.topics.value.sort((a, c) => a.isTop !== c.isTop ? c.isTop ? 1 : -1 : a.sequence - c.sequence);
|
|
19886
|
+
const l = [...n.controller.topics.value].sort((a, c) => a.isTop !== c.isTop ? c.isTop ? 1 : -1 : a.sequence - c.sequence);
|
|
19886
19887
|
i.value = l.filter(
|
|
19887
19888
|
(a) => {
|
|
19888
19889
|
var c, d;
|
|
@@ -19947,14 +19948,14 @@ const Rt = new L("chat-minimize"), F1 = (n) => {
|
|
|
19947
19948
|
const e = se(null), [t, i] = xe(""), [r, s] = xe(0), o = se(!1), l = {
|
|
19948
19949
|
x: (window.innerWidth - 86) / window.innerWidth,
|
|
19949
19950
|
y: (window.innerHeight - 86) / window.innerHeight
|
|
19950
|
-
}, a =
|
|
19951
|
+
}, a = Ce(() => {
|
|
19951
19952
|
const p = n.controller.messages.value[n.controller.messages.value.length - 1];
|
|
19952
19953
|
return p ? p.role === "ASSISTANT" && p.state === 20 && p.completed !== !0 : !1;
|
|
19953
19954
|
}), c = (p) => {
|
|
19954
19955
|
const m = p.indexOf("<think>"), y = p.indexOf("</think>");
|
|
19955
19956
|
let v = "", b = "";
|
|
19956
19957
|
return y === -1 ? (v = p.slice(m + 7), b = "") : (v = p.slice(m + 7, y), b = p.slice(y + 8)), { thoughtContent: v, answerContent: b };
|
|
19957
|
-
}, d =
|
|
19958
|
+
}, d = Ce(() => {
|
|
19958
19959
|
let p = "";
|
|
19959
19960
|
if (!a.value)
|
|
19960
19961
|
return i(""), s(0), p;
|
|
@@ -19978,21 +19979,21 @@ const Rt = new L("chat-minimize"), F1 = (n) => {
|
|
|
19978
19979
|
const p = e.current;
|
|
19979
19980
|
p && (p.onmousedown = (m) => {
|
|
19980
19981
|
document.body.style.userSelect = "none";
|
|
19981
|
-
const y = m.clientX - p.offsetLeft, v = m.clientY - p.offsetTop, b = Date.now(), w = (
|
|
19982
|
+
const y = m.clientX - p.offsetLeft, v = m.clientY - p.offsetTop, b = Date.now(), w = (k) => {
|
|
19982
19983
|
const _ = 56 / window.innerWidth, M = 56 / window.innerHeight, { x: O, y: I } = _l(
|
|
19983
|
-
|
|
19984
|
-
|
|
19984
|
+
k.clientX - y,
|
|
19985
|
+
k.clientY - v,
|
|
19985
19986
|
_,
|
|
19986
19987
|
M
|
|
19987
19988
|
);
|
|
19988
19989
|
Object.assign(l, { x: O, y: I }), requestAnimationFrame(() => {
|
|
19989
19990
|
u();
|
|
19990
19991
|
});
|
|
19991
|
-
},
|
|
19992
|
-
const
|
|
19993
|
-
o.current =
|
|
19992
|
+
}, S = () => {
|
|
19993
|
+
const k = Date.now();
|
|
19994
|
+
o.current = k - b > 300, document.body.style.userSelect = "", document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", S);
|
|
19994
19995
|
};
|
|
19995
|
-
document.addEventListener("mousemove", w), document.addEventListener("mouseup",
|
|
19996
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", S);
|
|
19996
19997
|
});
|
|
19997
19998
|
}, f = () => {
|
|
19998
19999
|
o.current || n.onClick();
|