@pagelines/sdk 1.0.631 → 1.0.633
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.
|
@@ -2,23 +2,23 @@ var jn = Object.defineProperty;
|
|
|
2
2
|
var Fs = (i, t, e) => t in i ? jn(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
3
|
var u = (i, t) => jn(i, "name", { value: t, configurable: !0 });
|
|
4
4
|
var j = (i, t, e) => Fs(i, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as Gs, Agent as
|
|
7
|
-
import { P as
|
|
8
|
-
const Ks = { class: "spinner max-w-sm" },
|
|
5
|
+
import { defineComponent as Be, openBlock as g, createElementBlock as m, createElementVNode as w, normalizeClass as L, ref as ve, watch as Ut, computed as M, createCommentVNode as q, renderSlot as gn, onMounted as qt, unref as un, Fragment as re, toDisplayString as Y, normalizeStyle as ie, renderList as me, shallowRef as fs, onBeforeUnmount as gs, createBlock as hn, nextTick as Bs, createVNode as ht, withCtx as Us, withModifiers as At, createTextVNode as _t, withDirectives as Hs, vModelText as js } from "vue";
|
|
6
|
+
import { SettingsObject as Gs, Agent as Ht, CHAT_ISSUE_COPY as Ws, getDefaultAvatarUrl as ms, parseChatVisualFencePayload as qs, createLogger as Vs } from "@pagelines/core";
|
|
7
|
+
import { P as Ys } from "./sdkClient.js";
|
|
8
|
+
const Ks = { class: "spinner max-w-sm" }, Zs = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
}, Gn = /* @__PURE__ */
|
|
11
|
+
}, Gn = /* @__PURE__ */ Be({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
17
|
setup(i) {
|
|
18
|
-
return (t, e) => (g(),
|
|
19
|
-
(g(),
|
|
20
|
-
|
|
21
|
-
class:
|
|
18
|
+
return (t, e) => (g(), m("div", Ks, [
|
|
19
|
+
(g(), m("svg", Zs, [
|
|
20
|
+
w("circle", {
|
|
21
|
+
class: L([i.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -30,12 +30,15 @@ const Ks = { class: "spinner max-w-sm" }, Ys = {
|
|
|
30
30
|
]))
|
|
31
31
|
]));
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), Xs = [
|
|
34
34
|
{ pattern: /\bNO_REP\w*\b/g, label: "NO_REPLY — bot chose not to respond" },
|
|
35
35
|
{ pattern: /\bHEARTBEAT_OK\b/g, label: "HEARTBEAT_OK — scheduled check, nothing to do" }
|
|
36
|
-
],
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
], Qs = 9e4, xs = /* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP"]), Js = /* @__PURE__ */ new Set([...xs, "EMPTY_STREAM", "RATE_LIMIT"]), ks = /* @__PURE__ */ new Set(["agent_deleted", "AGENT_DELETED"]), ea = {
|
|
37
|
+
CREDIT_LIMIT: "billing_budget_reached",
|
|
38
|
+
OVERAGE_CAP: "billing_runaway_cap"
|
|
39
|
+
};
|
|
40
|
+
function ta(i) {
|
|
41
|
+
if (!(i.bucket !== void 0 || Js.has(i.code)))
|
|
39
42
|
return { surface: "hard" };
|
|
40
43
|
const e = i.bucket ?? (xs.has(i.code) ? "account" : "error"), n = {
|
|
41
44
|
...i.actionLabel ? { actionLabel: i.actionLabel } : {},
|
|
@@ -44,8 +47,13 @@ function Js(i) {
|
|
|
44
47
|
};
|
|
45
48
|
return e === "account" ? { surface: "transcript", issue: { code: i.code, bucket: e, ...n }, sendBlockedReason: "account" } : ks.has(i.code) ? { surface: "transcript", issue: { code: i.code, bucket: e, ...n }, sendBlockedReason: "agent_deleted" } : { surface: "transient", issue: { code: i.code, message: i.error, ...n } };
|
|
46
49
|
}
|
|
47
|
-
u(
|
|
48
|
-
|
|
50
|
+
u(ta, "presentChatStreamError");
|
|
51
|
+
function na(i) {
|
|
52
|
+
const t = ea[i.code];
|
|
53
|
+
return t ? Ws[t].oneLine : i.error;
|
|
54
|
+
}
|
|
55
|
+
u(na, "transcriptMessageForChatStreamError");
|
|
56
|
+
const An = class An extends Gs {
|
|
49
57
|
constructor(e) {
|
|
50
58
|
super("AgentChatController", e);
|
|
51
59
|
j(this, "isTextMode", !1);
|
|
@@ -63,7 +71,7 @@ const Sn = class Sn extends Gs {
|
|
|
63
71
|
j(this, "agentMode", ve("self"));
|
|
64
72
|
j(this, "sharedMessages", ve([]));
|
|
65
73
|
j(this, "_agent");
|
|
66
|
-
this._agent = e.agent instanceof
|
|
74
|
+
this._agent = e.agent instanceof Ht ? e.agent : new Ht({ config: e.agent }), this.setupModeWatcher(), this.setupAvailabilityWatcher();
|
|
67
75
|
}
|
|
68
76
|
get chatEnabled() {
|
|
69
77
|
const e = this._agent.state.value.lifecycle;
|
|
@@ -152,12 +160,12 @@ Current User:
|
|
|
152
160
|
});
|
|
153
161
|
}
|
|
154
162
|
setupModeWatcher() {
|
|
155
|
-
|
|
163
|
+
Ut(this.agentMode, async (e, n) => {
|
|
156
164
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
157
165
|
});
|
|
158
166
|
}
|
|
159
167
|
setupAvailabilityWatcher() {
|
|
160
|
-
|
|
168
|
+
Ut(() => this.chatEnabled, (e) => {
|
|
161
169
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
162
170
|
if (e) {
|
|
163
171
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -243,105 +251,105 @@ Current User:
|
|
|
243
251
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0, workingDescription: void 0, toolActivities: [], transientIssue: void 0 });
|
|
244
252
|
const l = ++this.activeTurnGeneration, o = `stream-${Date.now()}`;
|
|
245
253
|
let p = !1, c = !1;
|
|
246
|
-
const _ = /* @__PURE__ */ u(() => l === this.activeTurnGeneration, "isCurrentTurn"),
|
|
254
|
+
const _ = /* @__PURE__ */ u(() => l === this.activeTurnGeneration, "isCurrentTurn"), T = /* @__PURE__ */ u((N, H = "assistant") => {
|
|
247
255
|
if (!_())
|
|
248
256
|
return;
|
|
249
257
|
this.updateState(this.textState, { workingDescription: void 0 }), p || (p = !0, this.sharedMessages.value = [
|
|
250
258
|
...this.sharedMessages.value,
|
|
251
259
|
{ id: o, text: "", sender: H === "system" ? "system" : "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
252
260
|
]);
|
|
253
|
-
const
|
|
254
|
-
W?.id === o && (W.text +=
|
|
255
|
-
}, "onDelta"), b = /* @__PURE__ */ u((
|
|
261
|
+
const F = this.sharedMessages.value, W = F[F.length - 1];
|
|
262
|
+
W?.id === o && (W.text += N, this.sharedMessages.value = [...F]);
|
|
263
|
+
}, "onDelta"), b = /* @__PURE__ */ u((N) => {
|
|
256
264
|
if (!_())
|
|
257
265
|
return;
|
|
258
266
|
c = !0, p = !0, this.updateState(this.textState, { workingDescription: void 0 }), this.finishToolActivities("completed");
|
|
259
|
-
const H = this.sharedMessages.value,
|
|
260
|
-
if (
|
|
267
|
+
const H = this.sharedMessages.value, F = H.findIndex((W) => W.id === N.id);
|
|
268
|
+
if (F >= 0)
|
|
261
269
|
this.sharedMessages.value = [
|
|
262
|
-
...H.slice(0,
|
|
263
|
-
|
|
264
|
-
...H.slice(
|
|
270
|
+
...H.slice(0, F),
|
|
271
|
+
N,
|
|
272
|
+
...H.slice(F + 1)
|
|
265
273
|
];
|
|
266
274
|
else {
|
|
267
275
|
const W = H[H.length - 1];
|
|
268
|
-
this.sharedMessages.value = W?.id === o ? [...H.slice(0, -1),
|
|
276
|
+
this.sharedMessages.value = W?.id === o ? [...H.slice(0, -1), N] : [...H, N];
|
|
269
277
|
}
|
|
270
|
-
|
|
271
|
-
}, "onMessage"),
|
|
278
|
+
N.sender === "system" && N.issue?.bucket === "account" ? this.updateState(this.textState, { sendBlockedReason: "account" }) : N.sender === "system" && N.issue?.code && ks.has(N.issue.code) && this.updateState(this.textState, { sendBlockedReason: "agent_deleted" });
|
|
279
|
+
}, "onMessage"), y = /* @__PURE__ */ u((N) => {
|
|
272
280
|
if (!_())
|
|
273
281
|
return;
|
|
274
282
|
if (!p && !c) {
|
|
275
|
-
|
|
283
|
+
O("empty_stream — assistant returned no content");
|
|
276
284
|
return;
|
|
277
285
|
}
|
|
278
286
|
this.finishToolActivities("completed");
|
|
279
|
-
const H = this.sharedMessages.value,
|
|
280
|
-
if (
|
|
281
|
-
let W =
|
|
282
|
-
for (const z of
|
|
287
|
+
const H = this.sharedMessages.value, F = H[H.length - 1];
|
|
288
|
+
if (F?.id === o && F.sender === "agent" && F.text) {
|
|
289
|
+
let W = F.text;
|
|
290
|
+
for (const z of Xs)
|
|
283
291
|
z.pattern.test(W) && (console.debug(`[chat] filtered directive: ${z.label}`), W = W.replace(z.pattern, "").trim(), z.pattern.lastIndex = 0);
|
|
284
|
-
W ? W !==
|
|
292
|
+
W ? W !== F.text && (F.text = W, this.sharedMessages.value = [...H]) : this.sharedMessages.value = H.slice(0, -1);
|
|
285
293
|
}
|
|
286
|
-
|
|
287
|
-
}, "onDone"),
|
|
294
|
+
N && (this.conversationId = N), this.updateState(this.textState, { isThinking: !1, workingDescription: void 0, transientIssue: void 0 });
|
|
295
|
+
}, "onDone"), O = /* @__PURE__ */ u((N) => {
|
|
288
296
|
if (!_())
|
|
289
297
|
return;
|
|
290
298
|
this.updateState(this.textState, { workingDescription: void 0 }), this.finishToolActivities("failed");
|
|
291
|
-
const H = this.sharedMessages.value,
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
|
|
299
|
+
const H = this.sharedMessages.value, F = H[H.length - 1];
|
|
300
|
+
if (F?.id === o && !F.text && (this.sharedMessages.value = H.slice(0, -1)), typeof N == "object" && N.code && N.error) {
|
|
301
|
+
const ee = ta(N);
|
|
302
|
+
ee.surface === "transient" ? this.updateState(this.textState, { isThinking: !1, transientIssue: ee.issue }) : ee.surface === "transcript" ? (this.addMessage(na(N), "system", void 0, ee.issue), this.updateState(this.textState, {
|
|
295
303
|
isThinking: !1,
|
|
296
|
-
...
|
|
297
|
-
})) : this.handleError(new Error(
|
|
304
|
+
...ee.sendBlockedReason ? { sendBlockedReason: ee.sendBlockedReason } : {}
|
|
305
|
+
})) : this.handleError(new Error(N.error));
|
|
298
306
|
return;
|
|
299
307
|
}
|
|
300
|
-
const W = typeof
|
|
308
|
+
const W = typeof N == "string" ? N : N.error, z = this.mapChatError(W);
|
|
301
309
|
this.isTransientError(W) ? (this.logger.warn("Chat turn failed (transient):", { raw: W, friendly: z }), this.addMessage(z, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(z), W);
|
|
302
|
-
}, "onError"), R = /* @__PURE__ */ u((
|
|
310
|
+
}, "onError"), R = /* @__PURE__ */ u((N) => {
|
|
303
311
|
if (!_())
|
|
304
312
|
return;
|
|
305
|
-
const H =
|
|
313
|
+
const H = N.trim();
|
|
306
314
|
this.updateState(this.textState, { workingDescription: H || void 0 });
|
|
307
|
-
}, "onStatus"), K = /* @__PURE__ */ u((
|
|
308
|
-
_() && this.updateToolActivity(
|
|
309
|
-
}, "onToolActivity"),
|
|
315
|
+
}, "onStatus"), K = /* @__PURE__ */ u((N) => {
|
|
316
|
+
_() && this.updateToolActivity(N);
|
|
317
|
+
}, "onToolActivity"), Z = /* @__PURE__ */ u(() => {
|
|
310
318
|
_() && this.updateState(this.textState, { workingDescription: void 0 });
|
|
311
319
|
}, "onWorkingEnd");
|
|
312
320
|
try {
|
|
313
|
-
const
|
|
321
|
+
const N = a ? a({
|
|
314
322
|
message: e,
|
|
315
323
|
attachments: n,
|
|
316
324
|
conversationId: this.conversationId,
|
|
317
325
|
history: this.buildHistory(),
|
|
318
|
-
onDelta:
|
|
326
|
+
onDelta: T,
|
|
319
327
|
onMessage: b,
|
|
320
|
-
onDone:
|
|
321
|
-
onError:
|
|
328
|
+
onDone: y,
|
|
329
|
+
onError: O,
|
|
322
330
|
onStatus: R,
|
|
323
331
|
onToolActivity: K,
|
|
324
|
-
onWorkingEnd:
|
|
332
|
+
onWorkingEnd: Z
|
|
325
333
|
}) : s.chat.chatStreamPublic({
|
|
326
334
|
handle: this._agent.handle.value,
|
|
327
335
|
message: e,
|
|
328
336
|
attachments: n,
|
|
329
337
|
anonymousId: s.user.generateAnonId(),
|
|
330
338
|
context: this.getDynamicSettings().context || void 0,
|
|
331
|
-
onDelta:
|
|
339
|
+
onDelta: T,
|
|
332
340
|
onMessage: b,
|
|
333
|
-
onDone:
|
|
334
|
-
onError:
|
|
341
|
+
onDone: y,
|
|
342
|
+
onError: O,
|
|
335
343
|
onStatus: R,
|
|
336
344
|
onToolActivity: K,
|
|
337
|
-
onWorkingEnd:
|
|
345
|
+
onWorkingEnd: Z
|
|
338
346
|
});
|
|
339
347
|
await Promise.race([
|
|
340
|
-
|
|
341
|
-
new Promise((H,
|
|
348
|
+
N,
|
|
349
|
+
new Promise((H, F) => setTimeout(() => F(new Error("timed out")), Qs))
|
|
342
350
|
]);
|
|
343
|
-
} catch (
|
|
344
|
-
|
|
351
|
+
} catch (N) {
|
|
352
|
+
O(N.message || "Something went wrong");
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
355
|
async stopChatTurn() {
|
|
@@ -378,30 +386,30 @@ Current User:
|
|
|
378
386
|
await this.endConversation();
|
|
379
387
|
}
|
|
380
388
|
};
|
|
381
|
-
u(
|
|
382
|
-
let Wn =
|
|
389
|
+
u(An, "AgentChatController");
|
|
390
|
+
let Wn = An;
|
|
383
391
|
function qn(i) {
|
|
384
392
|
return i ? typeof i == "string" ? i : i.src || "" : "";
|
|
385
393
|
}
|
|
386
394
|
u(qn, "getImageSrc");
|
|
387
|
-
function
|
|
395
|
+
function Yr(i) {
|
|
388
396
|
return qn(i.cover) || qn(i.avatar) || ms(i.name);
|
|
389
397
|
}
|
|
390
|
-
u(
|
|
398
|
+
u(Yr, "getAgentAvatarUrl");
|
|
391
399
|
function Vn(i) {
|
|
392
400
|
const t = i.target;
|
|
393
401
|
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = ms());
|
|
394
402
|
}
|
|
395
403
|
u(Vn, "handleImageError");
|
|
396
|
-
function
|
|
404
|
+
function Kr(i) {
|
|
397
405
|
const { template: t, agent: e } = i;
|
|
398
406
|
return t.replace(/{name}/g, e.name || "Assistant").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
399
407
|
}
|
|
400
|
-
u(
|
|
401
|
-
const
|
|
408
|
+
u(Kr, "parseButtonTemplate");
|
|
409
|
+
const sa = {
|
|
402
410
|
key: 0,
|
|
403
411
|
class: "absolute inset-0 flex items-center justify-center"
|
|
404
|
-
},
|
|
412
|
+
}, Zr = /* @__PURE__ */ Be({
|
|
405
413
|
__name: "ElAgentButton",
|
|
406
414
|
props: {
|
|
407
415
|
theme: { default: "primary" },
|
|
@@ -411,42 +419,42 @@ const ea = {
|
|
|
411
419
|
iconAfter: {}
|
|
412
420
|
},
|
|
413
421
|
setup(i) {
|
|
414
|
-
const t =
|
|
422
|
+
const t = M(() => ({
|
|
415
423
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
416
424
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
417
425
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
418
426
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
419
|
-
})[i.theme]), e =
|
|
427
|
+
})[i.theme]), e = M(() => ({
|
|
420
428
|
sm: "px-4 py-2 text-sm",
|
|
421
429
|
md: "px-6 py-3 text-base",
|
|
422
430
|
lg: "px-8 py-4 text-base"
|
|
423
|
-
})[i.size]), n =
|
|
431
|
+
})[i.size]), n = M(() => ({
|
|
424
432
|
sm: "size-4",
|
|
425
433
|
md: "size-4",
|
|
426
434
|
lg: "size-5"
|
|
427
435
|
})[i.size]);
|
|
428
|
-
return (a, s) => (g(),
|
|
429
|
-
class:
|
|
436
|
+
return (a, s) => (g(), m("button", {
|
|
437
|
+
class: L(["relative inline-flex items-center justify-center gap-2 font-medium rounded-full backdrop-blur-sm border-2 text-white transition-all duration-200 focus:outline-none active:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer", [t.value, e.value]])
|
|
430
438
|
}, [
|
|
431
|
-
i.loading ? (g(),
|
|
432
|
-
|
|
439
|
+
i.loading ? (g(), m("div", sa, [...s[0] || (s[0] = [
|
|
440
|
+
w("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
433
441
|
])])) : q("", !0),
|
|
434
|
-
|
|
435
|
-
class:
|
|
442
|
+
w("span", {
|
|
443
|
+
class: L(["flex items-center gap-2 transition-opacity duration-200", i.loading ? "opacity-0" : "opacity-100"])
|
|
436
444
|
}, [
|
|
437
|
-
i.icon ? (g(),
|
|
445
|
+
i.icon ? (g(), m("i", {
|
|
438
446
|
key: 0,
|
|
439
|
-
class:
|
|
447
|
+
class: L([i.icon, n.value])
|
|
440
448
|
}, null, 2)) : q("", !0),
|
|
441
|
-
|
|
442
|
-
i.iconAfter ? (g(),
|
|
449
|
+
gn(a.$slots, "default"),
|
|
450
|
+
i.iconAfter ? (g(), m("i", {
|
|
443
451
|
key: 1,
|
|
444
|
-
class:
|
|
452
|
+
class: L([i.iconAfter, n.value])
|
|
445
453
|
}, null, 2)) : q("", !0)
|
|
446
454
|
], 2)
|
|
447
455
|
], 2));
|
|
448
456
|
}
|
|
449
|
-
}),
|
|
457
|
+
}), aa = ["value"], Xr = /* @__PURE__ */ Be({
|
|
450
458
|
__name: "AgentInputEmail",
|
|
451
459
|
props: {
|
|
452
460
|
modelValue: { default: "" }
|
|
@@ -454,7 +462,7 @@ const ea = {
|
|
|
454
462
|
emits: ["update:modelValue"],
|
|
455
463
|
setup(i, { emit: t }) {
|
|
456
464
|
const e = t;
|
|
457
|
-
return (n, a) => (g(),
|
|
465
|
+
return (n, a) => (g(), m("input", {
|
|
458
466
|
name: "username",
|
|
459
467
|
type: "email",
|
|
460
468
|
inputmode: "email",
|
|
@@ -467,9 +475,9 @@ const ea = {
|
|
|
467
475
|
class: "w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-colors",
|
|
468
476
|
style: { "font-size": "16px" },
|
|
469
477
|
onInput: a[0] || (a[0] = (s) => e("update:modelValue", s.target.value))
|
|
470
|
-
}, null, 40,
|
|
478
|
+
}, null, 40, aa));
|
|
471
479
|
}
|
|
472
|
-
}),
|
|
480
|
+
}), ia = ["placeholder", "value"], Qr = /* @__PURE__ */ Be({
|
|
473
481
|
__name: "AgentInputOneTimeCode",
|
|
474
482
|
props: {
|
|
475
483
|
modelValue: {},
|
|
@@ -478,15 +486,15 @@ const ea = {
|
|
|
478
486
|
},
|
|
479
487
|
emits: ["update:modelValue", "autoSubmit"],
|
|
480
488
|
setup(i, { emit: t }) {
|
|
481
|
-
const e = i, n = t, a = ve(null), s =
|
|
482
|
-
|
|
489
|
+
const e = i, n = t, a = ve(null), s = M(() => "0".repeat(e.length));
|
|
490
|
+
qt(() => {
|
|
483
491
|
e.focusFirst && !("ontouchstart" in window) && a.value?.focus();
|
|
484
492
|
});
|
|
485
493
|
function l(o) {
|
|
486
494
|
const p = o.target.value.replace(/\D/g, "").slice(0, e.length);
|
|
487
495
|
n("update:modelValue", p), p.length === e.length && n("autoSubmit", p);
|
|
488
496
|
}
|
|
489
|
-
return u(l, "onInput"), (o, p) => (g(),
|
|
497
|
+
return u(l, "onInput"), (o, p) => (g(), m("input", {
|
|
490
498
|
ref_key: "input",
|
|
491
499
|
ref: a,
|
|
492
500
|
name: "one-time-code",
|
|
@@ -502,12 +510,12 @@ const ea = {
|
|
|
502
510
|
class: "w-full px-6 py-3 text-center font-mono tracking-[0.35em] text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-colors",
|
|
503
511
|
style: { "font-size": "16px" },
|
|
504
512
|
onInput: l
|
|
505
|
-
}, null, 40,
|
|
513
|
+
}, null, 40, ia));
|
|
506
514
|
}
|
|
507
|
-
}),
|
|
515
|
+
}), ra = { class: "relative flex-shrink-0" }, la = ["src", "alt"], oa = { class: "absolute top-1 right-1" }, ca = {
|
|
508
516
|
key: 1,
|
|
509
517
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
510
|
-
},
|
|
518
|
+
}, ua = { class: "min-w-0" }, ha = /* @__PURE__ */ Be({
|
|
511
519
|
__name: "ElModeHeader",
|
|
512
520
|
props: {
|
|
513
521
|
agent: {},
|
|
@@ -516,61 +524,61 @@ const ea = {
|
|
|
516
524
|
layout: { default: "centered" }
|
|
517
525
|
},
|
|
518
526
|
setup(i) {
|
|
519
|
-
return (t, e) => (g(),
|
|
520
|
-
class:
|
|
527
|
+
return (t, e) => (g(), m("div", {
|
|
528
|
+
class: L(["flex gap-4", [
|
|
521
529
|
i.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
522
530
|
]])
|
|
523
531
|
}, [
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
class:
|
|
532
|
+
w("div", ra, [
|
|
533
|
+
w("div", {
|
|
534
|
+
class: L(["rounded-full overflow-hidden border-white", i.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"])
|
|
527
535
|
}, [
|
|
528
|
-
|
|
536
|
+
w("img", {
|
|
529
537
|
src: i.agent.avatarUrl.value,
|
|
530
538
|
alt: i.agent.displayName.value,
|
|
531
539
|
class: "w-full h-full object-cover",
|
|
532
540
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
533
|
-
(...n) =>
|
|
534
|
-
}, null, 40,
|
|
541
|
+
(...n) => un(Vn) && un(Vn)(...n))
|
|
542
|
+
}, null, 40, la)
|
|
535
543
|
], 2),
|
|
536
|
-
|
|
537
|
-
i.isOnline ? (g(),
|
|
538
|
-
e[1] || (e[1] =
|
|
544
|
+
w("div", oa, [
|
|
545
|
+
i.isOnline ? (g(), m(re, { key: 0 }, [
|
|
546
|
+
e[1] || (e[1] = w("div", {
|
|
539
547
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
540
548
|
style: { "animation-duration": "3s" }
|
|
541
549
|
}, null, -1)),
|
|
542
|
-
e[2] || (e[2] =
|
|
543
|
-
], 64)) : (g(),
|
|
550
|
+
e[2] || (e[2] = w("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
551
|
+
], 64)) : (g(), m("div", ca))
|
|
544
552
|
])
|
|
545
553
|
]),
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
class:
|
|
554
|
+
w("div", ua, [
|
|
555
|
+
w("h1", {
|
|
556
|
+
class: L(["font-light text-white mb-1 truncate", [
|
|
549
557
|
i.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
550
558
|
i.layout === "horizontal" ? "text-white/95" : ""
|
|
551
559
|
]])
|
|
552
|
-
},
|
|
553
|
-
|
|
554
|
-
class:
|
|
560
|
+
}, Y(i.agent.displayName.value), 3),
|
|
561
|
+
w("p", {
|
|
562
|
+
class: L(["font-light line-clamp-1", [
|
|
555
563
|
i.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
556
564
|
i.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
557
565
|
]])
|
|
558
|
-
},
|
|
566
|
+
}, Y(i.layout === "horizontal" ? i.agent.title.value || "Assistant" : i.agent.title.value), 3)
|
|
559
567
|
])
|
|
560
568
|
], 2));
|
|
561
569
|
}
|
|
562
570
|
});
|
|
563
|
-
function
|
|
571
|
+
function Yn(i, t) {
|
|
564
572
|
(t == null || t > i.length) && (t = i.length);
|
|
565
573
|
for (var e = 0, n = Array(t); e < t; e++) n[e] = i[e];
|
|
566
574
|
return n;
|
|
567
575
|
}
|
|
568
|
-
u(
|
|
569
|
-
function
|
|
576
|
+
u(Yn, "_arrayLikeToArray");
|
|
577
|
+
function da(i) {
|
|
570
578
|
if (Array.isArray(i)) return i;
|
|
571
579
|
}
|
|
572
|
-
u(
|
|
573
|
-
function
|
|
580
|
+
u(da, "_arrayWithHoles");
|
|
581
|
+
function pa(i, t) {
|
|
574
582
|
var e = i == null ? null : typeof Symbol < "u" && i[Symbol.iterator] || i["@@iterator"];
|
|
575
583
|
if (e != null) {
|
|
576
584
|
var n, a, s, l, o = [], p = !0, c = !1;
|
|
@@ -588,154 +596,154 @@ function ua(i, t) {
|
|
|
588
596
|
return o;
|
|
589
597
|
}
|
|
590
598
|
}
|
|
591
|
-
u(
|
|
592
|
-
function
|
|
599
|
+
u(pa, "_iterableToArrayLimit");
|
|
600
|
+
function fa() {
|
|
593
601
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
594
602
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
595
603
|
}
|
|
596
|
-
u(
|
|
597
|
-
function
|
|
598
|
-
return
|
|
604
|
+
u(fa, "_nonIterableRest");
|
|
605
|
+
function ga(i, t) {
|
|
606
|
+
return da(i) || pa(i, t) || ma(i, t) || fa();
|
|
599
607
|
}
|
|
600
|
-
u(
|
|
601
|
-
function
|
|
608
|
+
u(ga, "_slicedToArray");
|
|
609
|
+
function ma(i, t) {
|
|
602
610
|
if (i) {
|
|
603
|
-
if (typeof i == "string") return
|
|
611
|
+
if (typeof i == "string") return Yn(i, t);
|
|
604
612
|
var e = {}.toString.call(i).slice(8, -1);
|
|
605
|
-
return e === "Object" && i.constructor && (e = i.constructor.name), e === "Map" || e === "Set" ? Array.from(i) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ?
|
|
613
|
+
return e === "Object" && i.constructor && (e = i.constructor.name), e === "Map" || e === "Set" ? Array.from(i) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? Yn(i, t) : void 0;
|
|
606
614
|
}
|
|
607
615
|
}
|
|
608
|
-
u(
|
|
609
|
-
const bs = Object.entries,
|
|
610
|
-
let we = Object.freeze, _e = Object.seal,
|
|
616
|
+
u(ma, "_unsupportedIterableToArray");
|
|
617
|
+
const bs = Object.entries, Kn = Object.setPrototypeOf, xa = Object.isFrozen, ka = Object.getPrototypeOf, ba = Object.getOwnPropertyDescriptor;
|
|
618
|
+
let we = Object.freeze, _e = Object.seal, mt = Object.create, ys = typeof Reflect < "u" && Reflect, dn = ys.apply, pn = ys.construct;
|
|
611
619
|
we || (we = /* @__PURE__ */ u(function(t) {
|
|
612
620
|
return t;
|
|
613
621
|
}, "freeze"));
|
|
614
622
|
_e || (_e = /* @__PURE__ */ u(function(t) {
|
|
615
623
|
return t;
|
|
616
624
|
}, "seal"));
|
|
617
|
-
|
|
625
|
+
dn || (dn = /* @__PURE__ */ u(function(t, e) {
|
|
618
626
|
for (var n = arguments.length, a = new Array(n > 2 ? n - 2 : 0), s = 2; s < n; s++)
|
|
619
627
|
a[s - 2] = arguments[s];
|
|
620
628
|
return t.apply(e, a);
|
|
621
629
|
}, "apply"));
|
|
622
|
-
|
|
630
|
+
pn || (pn = /* @__PURE__ */ u(function(t) {
|
|
623
631
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), a = 1; a < e; a++)
|
|
624
632
|
n[a - 1] = arguments[a];
|
|
625
633
|
return new t(...n);
|
|
626
634
|
}, "construct"));
|
|
627
|
-
const
|
|
628
|
-
function
|
|
635
|
+
const dt = ce(Array.prototype.forEach), ya = ce(Array.prototype.lastIndexOf), Zn = ce(Array.prototype.pop), pt = ce(Array.prototype.push), va = ce(Array.prototype.splice), ye = Array.isArray, It = ce(String.prototype.toLowerCase), an = ce(String.prototype.toString), Xn = ce(String.prototype.match), ft = ce(String.prototype.replace), Qn = ce(String.prototype.indexOf), wa = ce(String.prototype.trim), Ta = ce(Number.prototype.toString), Sa = ce(Boolean.prototype.toString), Jn = typeof BigInt > "u" ? null : ce(BigInt.prototype.toString), es = typeof Symbol > "u" ? null : ce(Symbol.prototype.toString), le = ce(Object.prototype.hasOwnProperty), Et = ce(Object.prototype.toString), fe = ce(RegExp.prototype.test), Rt = Aa(TypeError);
|
|
636
|
+
function ce(i) {
|
|
629
637
|
return function(t) {
|
|
630
638
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
631
639
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), a = 1; a < e; a++)
|
|
632
640
|
n[a - 1] = arguments[a];
|
|
633
|
-
return
|
|
641
|
+
return dn(i, t, n);
|
|
634
642
|
};
|
|
635
643
|
}
|
|
636
|
-
u(
|
|
637
|
-
function
|
|
644
|
+
u(ce, "unapply");
|
|
645
|
+
function Aa(i) {
|
|
638
646
|
return function() {
|
|
639
647
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
640
648
|
e[n] = arguments[n];
|
|
641
|
-
return
|
|
649
|
+
return pn(i, e);
|
|
642
650
|
};
|
|
643
651
|
}
|
|
644
|
-
u(
|
|
652
|
+
u(Aa, "unconstruct");
|
|
645
653
|
function U(i, t) {
|
|
646
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
647
|
-
if (
|
|
654
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : It;
|
|
655
|
+
if (Kn && Kn(i, null), !ye(t))
|
|
648
656
|
return i;
|
|
649
657
|
let n = t.length;
|
|
650
658
|
for (; n--; ) {
|
|
651
659
|
let a = t[n];
|
|
652
660
|
if (typeof a == "string") {
|
|
653
661
|
const s = e(a);
|
|
654
|
-
s !== a && (
|
|
662
|
+
s !== a && (xa(t) || (t[n] = s), a = s);
|
|
655
663
|
}
|
|
656
664
|
i[a] = !0;
|
|
657
665
|
}
|
|
658
666
|
return i;
|
|
659
667
|
}
|
|
660
668
|
u(U, "addToSet");
|
|
661
|
-
function
|
|
669
|
+
function _a(i) {
|
|
662
670
|
for (let t = 0; t < i.length; t++)
|
|
663
|
-
|
|
671
|
+
le(i, t) || (i[t] = null);
|
|
664
672
|
return i;
|
|
665
673
|
}
|
|
666
|
-
u(
|
|
674
|
+
u(_a, "cleanArray");
|
|
667
675
|
function ge(i) {
|
|
668
|
-
const t =
|
|
676
|
+
const t = mt(null);
|
|
669
677
|
for (const n of bs(i)) {
|
|
670
|
-
var e =
|
|
678
|
+
var e = ga(n, 2);
|
|
671
679
|
const a = e[0], s = e[1];
|
|
672
|
-
|
|
680
|
+
le(i, a) && (ye(s) ? t[a] = _a(s) : s && typeof s == "object" && s.constructor === Object ? t[a] = ge(s) : t[a] = s);
|
|
673
681
|
}
|
|
674
682
|
return t;
|
|
675
683
|
}
|
|
676
684
|
u(ge, "clone");
|
|
677
|
-
function
|
|
685
|
+
function Ea(i) {
|
|
678
686
|
switch (typeof i) {
|
|
679
687
|
case "string":
|
|
680
688
|
return i;
|
|
681
689
|
case "number":
|
|
682
|
-
return
|
|
690
|
+
return Ta(i);
|
|
683
691
|
case "boolean":
|
|
684
|
-
return
|
|
692
|
+
return Sa(i);
|
|
685
693
|
case "bigint":
|
|
686
694
|
return Jn ? Jn(i) : "0";
|
|
687
695
|
case "symbol":
|
|
688
696
|
return es ? es(i) : "Symbol()";
|
|
689
697
|
case "undefined":
|
|
690
|
-
return
|
|
698
|
+
return Et(i);
|
|
691
699
|
case "function":
|
|
692
700
|
case "object": {
|
|
693
701
|
if (i === null)
|
|
694
|
-
return
|
|
695
|
-
const t = i, e =
|
|
702
|
+
return Et(i);
|
|
703
|
+
const t = i, e = Pe(t, "toString");
|
|
696
704
|
if (typeof e == "function") {
|
|
697
705
|
const n = e(t);
|
|
698
|
-
return typeof n == "string" ? n :
|
|
706
|
+
return typeof n == "string" ? n : Et(n);
|
|
699
707
|
}
|
|
700
|
-
return
|
|
708
|
+
return Et(i);
|
|
701
709
|
}
|
|
702
710
|
default:
|
|
703
|
-
return
|
|
711
|
+
return Et(i);
|
|
704
712
|
}
|
|
705
713
|
}
|
|
706
|
-
u(
|
|
707
|
-
function
|
|
714
|
+
u(Ea, "stringifyValue");
|
|
715
|
+
function Pe(i, t) {
|
|
708
716
|
for (; i !== null; ) {
|
|
709
|
-
const n =
|
|
717
|
+
const n = ba(i, t);
|
|
710
718
|
if (n) {
|
|
711
719
|
if (n.get)
|
|
712
|
-
return
|
|
720
|
+
return ce(n.get);
|
|
713
721
|
if (typeof n.value == "function")
|
|
714
|
-
return
|
|
722
|
+
return ce(n.value);
|
|
715
723
|
}
|
|
716
|
-
i =
|
|
724
|
+
i = ka(i);
|
|
717
725
|
}
|
|
718
726
|
function e() {
|
|
719
727
|
return null;
|
|
720
728
|
}
|
|
721
729
|
return u(e, "fallbackValue"), e;
|
|
722
730
|
}
|
|
723
|
-
u(
|
|
724
|
-
function
|
|
731
|
+
u(Pe, "lookupGetter");
|
|
732
|
+
function Ra(i) {
|
|
725
733
|
try {
|
|
726
734
|
return fe(i, ""), !0;
|
|
727
735
|
} catch {
|
|
728
736
|
return !1;
|
|
729
737
|
}
|
|
730
738
|
}
|
|
731
|
-
u(
|
|
732
|
-
const ts = we(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]),
|
|
739
|
+
u(Ra, "isRegex");
|
|
740
|
+
const ts = we(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), rn = we(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), ln = we(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Ca = we(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), on = we(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Ia = we(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), ns = we(["#text"]), ss = we(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), cn = we(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), as = we(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Pt = we(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ma = _e(/{{[\w\W]*|^[\w\W]*}}/g), Da = _e(/<%[\w\W]*|^[\w\W]*%>/g), $a = _e(/\${[\w\W]*/g), La = _e(/^data-[\-\w.\u00B7-\uFFFF]+$/), Oa = _e(/^aria-[\-\w]+$/), is = _e(
|
|
733
741
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
734
742
|
// eslint-disable-line no-useless-escape
|
|
735
|
-
),
|
|
743
|
+
), Na = _e(/^(?:\w+script|data):/i), za = _e(
|
|
736
744
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
737
745
|
// eslint-disable-line no-control-regex
|
|
738
|
-
),
|
|
746
|
+
), Pa = _e(/^html$/i), Fa = _e(/^[a-z][.\w]*(-[.\w]+)+$/i), ze = {
|
|
739
747
|
element: 1,
|
|
740
748
|
attribute: 2,
|
|
741
749
|
text: 3,
|
|
@@ -751,9 +759,9 @@ const ts = we(["a", "abbr", "acronym", "address", "area", "article", "aside", "a
|
|
|
751
759
|
documentFragment: 11,
|
|
752
760
|
notation: 12
|
|
753
761
|
// Deprecated
|
|
754
|
-
},
|
|
762
|
+
}, Ba = /* @__PURE__ */ u(function() {
|
|
755
763
|
return typeof window > "u" ? null : window;
|
|
756
|
-
}, "getGlobal"),
|
|
764
|
+
}, "getGlobal"), Ua = /* @__PURE__ */ u(function(t, e) {
|
|
757
765
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
758
766
|
return null;
|
|
759
767
|
let n = null;
|
|
@@ -786,30 +794,30 @@ const ts = we(["a", "abbr", "acronym", "address", "area", "article", "aside", "a
|
|
|
786
794
|
};
|
|
787
795
|
}, "_createHooksMap");
|
|
788
796
|
function vs() {
|
|
789
|
-
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
790
|
-
const t = /* @__PURE__ */ u((
|
|
791
|
-
if (t.version = "3.4.7", t.removed = [], !i || !i.document || i.document.nodeType !==
|
|
797
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ba();
|
|
798
|
+
const t = /* @__PURE__ */ u((I) => vs(I), "DOMPurify");
|
|
799
|
+
if (t.version = "3.4.7", t.removed = [], !i || !i.document || i.document.nodeType !== ze.document || !i.Element)
|
|
792
800
|
return t.isSupported = !1, t;
|
|
793
801
|
let e = i.document;
|
|
794
802
|
const n = e, a = n.currentScript;
|
|
795
803
|
i.DocumentFragment;
|
|
796
804
|
const s = i.HTMLTemplateElement, l = i.Node, o = i.Element, p = i.NodeFilter, c = i.NamedNodeMap;
|
|
797
805
|
c === void 0 && (i.NamedNodeMap || i.MozNamedAttrMap), i.HTMLFormElement;
|
|
798
|
-
const _ = i.DOMParser,
|
|
806
|
+
const _ = i.DOMParser, T = i.trustedTypes, b = o.prototype, y = Pe(b, "cloneNode"), O = Pe(b, "remove"), R = Pe(b, "nextSibling"), K = Pe(b, "childNodes"), Z = Pe(b, "parentNode"), N = Pe(b, "shadowRoot"), H = Pe(b, "attributes"), F = l && l.prototype ? Pe(l.prototype, "nodeType") : null, W = l && l.prototype ? Pe(l.prototype, "nodeName") : null;
|
|
799
807
|
if (typeof s == "function") {
|
|
800
|
-
const
|
|
801
|
-
|
|
808
|
+
const I = e.createElement("template");
|
|
809
|
+
I.content && I.content.ownerDocument && (e = I.content.ownerDocument);
|
|
802
810
|
}
|
|
803
|
-
let z,
|
|
811
|
+
let z, ee = "";
|
|
804
812
|
const De = e, je = De.implementation, Xe = De.createNodeIterator, st = De.createDocumentFragment, Ge = De.getElementsByTagName, Te = n.importNode;
|
|
805
813
|
let ne = rs();
|
|
806
|
-
t.isSupported = typeof bs == "function" && typeof
|
|
807
|
-
const We =
|
|
808
|
-
let
|
|
809
|
-
const
|
|
814
|
+
t.isSupported = typeof bs == "function" && typeof Z == "function" && je && je.createHTMLDocument !== void 0;
|
|
815
|
+
const We = Ma, ke = Da, be = $a, Ue = La, Qe = Oa, at = Na, Ee = za, it = Fa;
|
|
816
|
+
let $e = is, C = null;
|
|
817
|
+
const qe = U({}, [...ts, ...rn, ...ln, ...on, ...ns]);
|
|
810
818
|
let f = null;
|
|
811
|
-
const E = U({}, [...ss, ...
|
|
812
|
-
let d = Object.seal(
|
|
819
|
+
const E = U({}, [...ss, ...cn, ...as, ...Pt]);
|
|
820
|
+
let d = Object.seal(mt(null, {
|
|
813
821
|
tagNameCheck: {
|
|
814
822
|
writable: !0,
|
|
815
823
|
configurable: !1,
|
|
@@ -828,8 +836,8 @@ function vs() {
|
|
|
828
836
|
enumerable: !0,
|
|
829
837
|
value: !1
|
|
830
838
|
}
|
|
831
|
-
})), A = null,
|
|
832
|
-
const B = Object.seal(
|
|
839
|
+
})), A = null, D = null;
|
|
840
|
+
const B = Object.seal(mt(null, {
|
|
833
841
|
tagCheck: {
|
|
834
842
|
writable: !0,
|
|
835
843
|
configurable: !1,
|
|
@@ -843,70 +851,70 @@ function vs() {
|
|
|
843
851
|
value: null
|
|
844
852
|
}
|
|
845
853
|
}));
|
|
846
|
-
let Q = !0,
|
|
854
|
+
let Q = !0, he = !0, te = !1, ue = !0, pe = !1, v = !0, k = !1, x = !1, P = !1, $ = !1, se = !1, Se = !1, rt = !0, _n = !1;
|
|
847
855
|
const En = "user-content-";
|
|
848
|
-
let Kt = !0,
|
|
849
|
-
const
|
|
856
|
+
let Kt = !0, wt = !1, lt = {}, Le = null;
|
|
857
|
+
const Zt = U({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
850
858
|
let Rn = null;
|
|
851
859
|
const Cn = U({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
852
|
-
let
|
|
853
|
-
const In = U({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
854
|
-
let
|
|
855
|
-
const Ds = U({}, [
|
|
856
|
-
let
|
|
860
|
+
let Xt = null;
|
|
861
|
+
const In = U({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), $t = "http://www.w3.org/1998/Math/MathML", Lt = "http://www.w3.org/2000/svg", Oe = "http://www.w3.org/1999/xhtml";
|
|
862
|
+
let ot = Oe, Qt = !1, Jt = null;
|
|
863
|
+
const Ds = U({}, [$t, Lt, Oe], an);
|
|
864
|
+
let en = U({}, ["mi", "mo", "mn", "ms", "mtext"]), tn = U({}, ["annotation-xml"]);
|
|
857
865
|
const $s = U({}, ["title", "style", "font", "a", "script"]);
|
|
858
|
-
let
|
|
866
|
+
let Tt = null;
|
|
859
867
|
const Ls = ["application/xhtml+xml", "text/html"], Os = "text/html";
|
|
860
|
-
let
|
|
868
|
+
let oe = null, ct = null;
|
|
861
869
|
const Ns = e.createElement("form"), Mn = /* @__PURE__ */ u(function(r) {
|
|
862
870
|
return r instanceof RegExp || r instanceof Function;
|
|
863
|
-
}, "isRegexOrFunction"),
|
|
871
|
+
}, "isRegexOrFunction"), nn = /* @__PURE__ */ u(function() {
|
|
864
872
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
865
|
-
if (
|
|
873
|
+
if (ct && ct === r)
|
|
866
874
|
return;
|
|
867
|
-
(!r || typeof r != "object") && (r = {}), r = ge(r),
|
|
868
|
-
Ls.indexOf(r.PARSER_MEDIA_TYPE) === -1 ? Os : r.PARSER_MEDIA_TYPE,
|
|
869
|
-
const h =
|
|
870
|
-
if (d =
|
|
875
|
+
(!r || typeof r != "object") && (r = {}), r = ge(r), Tt = // eslint-disable-next-line unicorn/prefer-includes
|
|
876
|
+
Ls.indexOf(r.PARSER_MEDIA_TYPE) === -1 ? Os : r.PARSER_MEDIA_TYPE, oe = Tt === "application/xhtml+xml" ? an : It, C = le(r, "ALLOWED_TAGS") && ye(r.ALLOWED_TAGS) ? U({}, r.ALLOWED_TAGS, oe) : qe, f = le(r, "ALLOWED_ATTR") && ye(r.ALLOWED_ATTR) ? U({}, r.ALLOWED_ATTR, oe) : E, Jt = le(r, "ALLOWED_NAMESPACES") && ye(r.ALLOWED_NAMESPACES) ? U({}, r.ALLOWED_NAMESPACES, an) : Ds, Xt = le(r, "ADD_URI_SAFE_ATTR") && ye(r.ADD_URI_SAFE_ATTR) ? U(ge(In), r.ADD_URI_SAFE_ATTR, oe) : In, Rn = le(r, "ADD_DATA_URI_TAGS") && ye(r.ADD_DATA_URI_TAGS) ? U(ge(Cn), r.ADD_DATA_URI_TAGS, oe) : Cn, Le = le(r, "FORBID_CONTENTS") && ye(r.FORBID_CONTENTS) ? U({}, r.FORBID_CONTENTS, oe) : Zt, A = le(r, "FORBID_TAGS") && ye(r.FORBID_TAGS) ? U({}, r.FORBID_TAGS, oe) : ge({}), D = le(r, "FORBID_ATTR") && ye(r.FORBID_ATTR) ? U({}, r.FORBID_ATTR, oe) : ge({}), lt = le(r, "USE_PROFILES") ? r.USE_PROFILES && typeof r.USE_PROFILES == "object" ? ge(r.USE_PROFILES) : r.USE_PROFILES : !1, Q = r.ALLOW_ARIA_ATTR !== !1, he = r.ALLOW_DATA_ATTR !== !1, te = r.ALLOW_UNKNOWN_PROTOCOLS || !1, ue = r.ALLOW_SELF_CLOSE_IN_ATTR !== !1, pe = r.SAFE_FOR_TEMPLATES || !1, v = r.SAFE_FOR_XML !== !1, k = r.WHOLE_DOCUMENT || !1, $ = r.RETURN_DOM || !1, se = r.RETURN_DOM_FRAGMENT || !1, Se = r.RETURN_TRUSTED_TYPE || !1, P = r.FORCE_BODY || !1, rt = r.SANITIZE_DOM !== !1, _n = r.SANITIZE_NAMED_PROPS || !1, Kt = r.KEEP_CONTENT !== !1, wt = r.IN_PLACE || !1, $e = Ra(r.ALLOWED_URI_REGEXP) ? r.ALLOWED_URI_REGEXP : is, ot = typeof r.NAMESPACE == "string" ? r.NAMESPACE : Oe, en = le(r, "MATHML_TEXT_INTEGRATION_POINTS") && r.MATHML_TEXT_INTEGRATION_POINTS && typeof r.MATHML_TEXT_INTEGRATION_POINTS == "object" ? ge(r.MATHML_TEXT_INTEGRATION_POINTS) : U({}, ["mi", "mo", "mn", "ms", "mtext"]), tn = le(r, "HTML_INTEGRATION_POINTS") && r.HTML_INTEGRATION_POINTS && typeof r.HTML_INTEGRATION_POINTS == "object" ? ge(r.HTML_INTEGRATION_POINTS) : U({}, ["annotation-xml"]);
|
|
877
|
+
const h = le(r, "CUSTOM_ELEMENT_HANDLING") && r.CUSTOM_ELEMENT_HANDLING && typeof r.CUSTOM_ELEMENT_HANDLING == "object" ? ge(r.CUSTOM_ELEMENT_HANDLING) : mt(null);
|
|
878
|
+
if (d = mt(null), le(h, "tagNameCheck") && Mn(h.tagNameCheck) && (d.tagNameCheck = h.tagNameCheck), le(h, "attributeNameCheck") && Mn(h.attributeNameCheck) && (d.attributeNameCheck = h.attributeNameCheck), le(h, "allowCustomizedBuiltInElements") && typeof h.allowCustomizedBuiltInElements == "boolean" && (d.allowCustomizedBuiltInElements = h.allowCustomizedBuiltInElements), pe && (he = !1), se && ($ = !0), lt && (C = U({}, ns), f = mt(null), lt.html === !0 && (U(C, ts), U(f, ss)), lt.svg === !0 && (U(C, rn), U(f, cn), U(f, Pt)), lt.svgFilters === !0 && (U(C, ln), U(f, cn), U(f, Pt)), lt.mathMl === !0 && (U(C, on), U(f, as), U(f, Pt))), B.tagCheck = null, B.attributeCheck = null, le(r, "ADD_TAGS") && (typeof r.ADD_TAGS == "function" ? B.tagCheck = r.ADD_TAGS : ye(r.ADD_TAGS) && (C === qe && (C = ge(C)), U(C, r.ADD_TAGS, oe))), le(r, "ADD_ATTR") && (typeof r.ADD_ATTR == "function" ? B.attributeCheck = r.ADD_ATTR : ye(r.ADD_ATTR) && (f === E && (f = ge(f)), U(f, r.ADD_ATTR, oe))), le(r, "ADD_URI_SAFE_ATTR") && ye(r.ADD_URI_SAFE_ATTR) && U(Xt, r.ADD_URI_SAFE_ATTR, oe), le(r, "FORBID_CONTENTS") && ye(r.FORBID_CONTENTS) && (Le === Zt && (Le = ge(Le)), U(Le, r.FORBID_CONTENTS, oe)), le(r, "ADD_FORBID_CONTENTS") && ye(r.ADD_FORBID_CONTENTS) && (Le === Zt && (Le = ge(Le)), U(Le, r.ADD_FORBID_CONTENTS, oe)), Kt && (C["#text"] = !0), k && U(C, ["html", "head", "body"]), C.table && (U(C, ["tbody"]), delete A.tbody), r.TRUSTED_TYPES_POLICY) {
|
|
871
879
|
if (typeof r.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
872
|
-
throw
|
|
880
|
+
throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
873
881
|
if (typeof r.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
874
|
-
throw
|
|
875
|
-
z = r.TRUSTED_TYPES_POLICY,
|
|
882
|
+
throw Rt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
883
|
+
z = r.TRUSTED_TYPES_POLICY, ee = z.createHTML("");
|
|
876
884
|
} else
|
|
877
|
-
z === void 0 && (z =
|
|
878
|
-
(ne.uponSanitizeElement.length > 0 || ne.uponSanitizeAttribute.length > 0) &&
|
|
879
|
-
}, "_parseConfig"), Dn = U({}, [...
|
|
880
|
-
let h =
|
|
885
|
+
z === void 0 && (z = Ua(T, a)), z !== null && typeof ee == "string" && (ee = z.createHTML(""));
|
|
886
|
+
(ne.uponSanitizeElement.length > 0 || ne.uponSanitizeAttribute.length > 0) && C === qe && (C = ge(C)), ne.uponSanitizeAttribute.length > 0 && f === E && (f = ge(f)), we && we(r), ct = r;
|
|
887
|
+
}, "_parseConfig"), Dn = U({}, [...rn, ...ln, ...Ca]), $n = U({}, [...on, ...Ia]), zs = /* @__PURE__ */ u(function(r) {
|
|
888
|
+
let h = Z(r);
|
|
881
889
|
(!h || !h.tagName) && (h = {
|
|
882
|
-
namespaceURI:
|
|
890
|
+
namespaceURI: ot,
|
|
883
891
|
tagName: "template"
|
|
884
892
|
});
|
|
885
|
-
const S =
|
|
886
|
-
return
|
|
893
|
+
const S = It(r.tagName), J = It(h.tagName);
|
|
894
|
+
return Jt[r.namespaceURI] ? r.namespaceURI === Lt ? h.namespaceURI === Oe ? S === "svg" : h.namespaceURI === $t ? S === "svg" && (J === "annotation-xml" || en[J]) : !!Dn[S] : r.namespaceURI === $t ? h.namespaceURI === Oe ? S === "math" : h.namespaceURI === Lt ? S === "math" && tn[J] : !!$n[S] : r.namespaceURI === Oe ? h.namespaceURI === Lt && !tn[J] || h.namespaceURI === $t && !en[J] ? !1 : !$n[S] && ($s[S] || !Dn[S]) : !!(Tt === "application/xhtml+xml" && Jt[r.namespaceURI]) : !1;
|
|
887
895
|
}, "_checkValidNamespace"), Re = /* @__PURE__ */ u(function(r) {
|
|
888
|
-
|
|
896
|
+
pt(t.removed, {
|
|
889
897
|
element: r
|
|
890
898
|
});
|
|
891
899
|
try {
|
|
892
|
-
|
|
900
|
+
Z(r).removeChild(r);
|
|
893
901
|
} catch {
|
|
894
|
-
|
|
902
|
+
O(r);
|
|
895
903
|
}
|
|
896
904
|
}, "_forceRemove"), Je = /* @__PURE__ */ u(function(r, h) {
|
|
897
905
|
try {
|
|
898
|
-
|
|
906
|
+
pt(t.removed, {
|
|
899
907
|
attribute: h.getAttributeNode(r),
|
|
900
908
|
from: h
|
|
901
909
|
});
|
|
902
910
|
} catch {
|
|
903
|
-
|
|
911
|
+
pt(t.removed, {
|
|
904
912
|
attribute: null,
|
|
905
913
|
from: h
|
|
906
914
|
});
|
|
907
915
|
}
|
|
908
916
|
if (h.removeAttribute(r), r === "is")
|
|
909
|
-
if (
|
|
917
|
+
if ($ || se)
|
|
910
918
|
try {
|
|
911
919
|
Re(h);
|
|
912
920
|
} catch {
|
|
@@ -918,28 +926,28 @@ function vs() {
|
|
|
918
926
|
}
|
|
919
927
|
}, "_removeAttribute"), Ln = /* @__PURE__ */ u(function(r) {
|
|
920
928
|
let h = null, S = null;
|
|
921
|
-
if (
|
|
929
|
+
if (P)
|
|
922
930
|
r = "<remove></remove>" + r;
|
|
923
931
|
else {
|
|
924
|
-
const
|
|
925
|
-
S =
|
|
932
|
+
const ae = Xn(r, /^[\r\n\t ]+/);
|
|
933
|
+
S = ae && ae[0];
|
|
926
934
|
}
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
935
|
+
Tt === "application/xhtml+xml" && ot === Oe && (r = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + r + "</body></html>");
|
|
936
|
+
const J = z ? z.createHTML(r) : r;
|
|
937
|
+
if (ot === Oe)
|
|
930
938
|
try {
|
|
931
|
-
h = new _().parseFromString(
|
|
939
|
+
h = new _().parseFromString(J, Tt);
|
|
932
940
|
} catch {
|
|
933
941
|
}
|
|
934
942
|
if (!h || !h.documentElement) {
|
|
935
|
-
h = je.createDocument(
|
|
943
|
+
h = je.createDocument(ot, "template", null);
|
|
936
944
|
try {
|
|
937
|
-
h.documentElement.innerHTML =
|
|
945
|
+
h.documentElement.innerHTML = Qt ? ee : J;
|
|
938
946
|
} catch {
|
|
939
947
|
}
|
|
940
948
|
}
|
|
941
949
|
const G = h.body || h.documentElement;
|
|
942
|
-
return r && S && G.insertBefore(e.createTextNode(S), G.childNodes[0] || null),
|
|
950
|
+
return r && S && G.insertBefore(e.createTextNode(S), G.childNodes[0] || null), ot === Oe ? Ge.call(h, k ? "html" : "body")[0] : k ? h.documentElement : G;
|
|
943
951
|
}, "_initDocument"), On = /* @__PURE__ */ u(function(r) {
|
|
944
952
|
return Xe.call(
|
|
945
953
|
r.ownerDocument || r,
|
|
@@ -959,14 +967,14 @@ function vs() {
|
|
|
959
967
|
);
|
|
960
968
|
let S = h.nextNode();
|
|
961
969
|
for (; S; ) {
|
|
962
|
-
let
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
}), S.data =
|
|
970
|
+
let J = S.data;
|
|
971
|
+
dt([We, ke, be], (G) => {
|
|
972
|
+
J = ft(J, G, " ");
|
|
973
|
+
}), S.data = J, S = h.nextNode();
|
|
966
974
|
}
|
|
967
|
-
}, "_scrubTemplateExpressions"),
|
|
975
|
+
}, "_scrubTemplateExpressions"), Ot = /* @__PURE__ */ u(function(r) {
|
|
968
976
|
const h = W ? W(r) : null;
|
|
969
|
-
return typeof h != "string" ||
|
|
977
|
+
return typeof h != "string" || oe(h) !== "form" ? !1 : typeof r.nodeName != "string" || typeof r.textContent != "string" || typeof r.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
|
|
970
978
|
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
971
979
|
// makes the direct read diverge from the cached read; a clean form
|
|
972
980
|
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
@@ -978,7 +986,7 @@ function vs() {
|
|
|
978
986
|
// an internal slot, no serialization cost — and removes a residual
|
|
979
987
|
// clobbering surface used by several mXSS / PI / comment branches
|
|
980
988
|
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
981
|
-
r.nodeType !==
|
|
989
|
+
r.nodeType !== F(r) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
982
990
|
// "childNodes" shadows the prototype getter. Direct reads of
|
|
983
991
|
// form.childNodes from a clobbered form return the named child
|
|
984
992
|
// instead of the real NodeList, so any walk that reads it directly
|
|
@@ -990,66 +998,66 @@ function vs() {
|
|
|
990
998
|
// carry a numeric .length, which a typeof-based probe would miss
|
|
991
999
|
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
992
1000
|
r.childNodes !== K(r);
|
|
993
|
-
}, "_isClobbered"),
|
|
994
|
-
if (!
|
|
1001
|
+
}, "_isClobbered"), St = /* @__PURE__ */ u(function(r) {
|
|
1002
|
+
if (!F || typeof r != "object" || r === null)
|
|
995
1003
|
return !1;
|
|
996
1004
|
try {
|
|
997
|
-
return
|
|
1005
|
+
return F(r) === ze.documentFragment;
|
|
998
1006
|
} catch {
|
|
999
1007
|
return !1;
|
|
1000
1008
|
}
|
|
1001
|
-
}, "_isDocumentFragment"),
|
|
1002
|
-
if (!
|
|
1009
|
+
}, "_isDocumentFragment"), Nt = /* @__PURE__ */ u(function(r) {
|
|
1010
|
+
if (!F || typeof r != "object" || r === null)
|
|
1003
1011
|
return !1;
|
|
1004
1012
|
try {
|
|
1005
|
-
return typeof
|
|
1013
|
+
return typeof F(r) == "number";
|
|
1006
1014
|
} catch {
|
|
1007
1015
|
return !1;
|
|
1008
1016
|
}
|
|
1009
1017
|
}, "_isNode");
|
|
1010
|
-
function He(
|
|
1011
|
-
|
|
1012
|
-
S.call(t, r, h,
|
|
1018
|
+
function He(I, r, h) {
|
|
1019
|
+
dt(I, (S) => {
|
|
1020
|
+
S.call(t, r, h, ct);
|
|
1013
1021
|
});
|
|
1014
1022
|
}
|
|
1015
1023
|
u(He, "_executeHooks");
|
|
1016
1024
|
const zn = /* @__PURE__ */ u(function(r) {
|
|
1017
1025
|
let h = null;
|
|
1018
|
-
if (He(ne.beforeSanitizeElements, r, null),
|
|
1026
|
+
if (He(ne.beforeSanitizeElements, r, null), Ot(r))
|
|
1019
1027
|
return Re(r), !0;
|
|
1020
|
-
const S =
|
|
1028
|
+
const S = oe(r.nodeName);
|
|
1021
1029
|
if (He(ne.uponSanitizeElement, r, {
|
|
1022
1030
|
tagName: S,
|
|
1023
|
-
allowedTags:
|
|
1024
|
-
}),
|
|
1031
|
+
allowedTags: C
|
|
1032
|
+
}), v && r.hasChildNodes() && !Nt(r.firstElementChild) && fe(/<[/\w!]/g, r.innerHTML) && fe(/<[/\w!]/g, r.textContent) || v && r.namespaceURI === Oe && S === "style" && Nt(r.firstElementChild) || r.nodeType === ze.progressingInstruction || v && r.nodeType === ze.comment && fe(/<[/\w]/g, r.data))
|
|
1025
1033
|
return Re(r), !0;
|
|
1026
|
-
if (A[S] || !(B.tagCheck instanceof Function && B.tagCheck(S)) && !
|
|
1034
|
+
if (A[S] || !(B.tagCheck instanceof Function && B.tagCheck(S)) && !C[S]) {
|
|
1027
1035
|
if (!A[S] && Fn(S) && (d.tagNameCheck instanceof RegExp && fe(d.tagNameCheck, S) || d.tagNameCheck instanceof Function && d.tagNameCheck(S)))
|
|
1028
1036
|
return !1;
|
|
1029
|
-
if (Kt &&
|
|
1030
|
-
const G =
|
|
1031
|
-
if (
|
|
1032
|
-
const Ae =
|
|
1033
|
-
for (let
|
|
1034
|
-
const Ce =
|
|
1037
|
+
if (Kt && !Le[S]) {
|
|
1038
|
+
const G = Z(r), ae = K(r);
|
|
1039
|
+
if (ae && G) {
|
|
1040
|
+
const Ae = ae.length;
|
|
1041
|
+
for (let Ne = Ae - 1; Ne >= 0; --Ne) {
|
|
1042
|
+
const Ce = y(ae[Ne], !0);
|
|
1035
1043
|
G.insertBefore(Ce, R(r));
|
|
1036
1044
|
}
|
|
1037
1045
|
}
|
|
1038
1046
|
}
|
|
1039
1047
|
return Re(r), !0;
|
|
1040
1048
|
}
|
|
1041
|
-
return (
|
|
1042
|
-
h =
|
|
1043
|
-
}), r.textContent !== h && (
|
|
1049
|
+
return (F ? F(r) : r.nodeType) === ze.element && !zs(r) || (S === "noscript" || S === "noembed" || S === "noframes") && fe(/<\/no(script|embed|frames)/i, r.innerHTML) ? (Re(r), !0) : (pe && r.nodeType === ze.text && (h = r.textContent, dt([We, ke, be], (G) => {
|
|
1050
|
+
h = ft(h, G, " ");
|
|
1051
|
+
}), r.textContent !== h && (pt(t.removed, {
|
|
1044
1052
|
element: r.cloneNode()
|
|
1045
1053
|
}), r.textContent = h)), He(ne.afterSanitizeElements, r, null), !1);
|
|
1046
1054
|
}, "_sanitizeElements"), Pn = /* @__PURE__ */ u(function(r, h, S) {
|
|
1047
|
-
if (
|
|
1055
|
+
if (D[h] || rt && (h === "id" || h === "name") && (S in e || S in Ns))
|
|
1048
1056
|
return !1;
|
|
1049
|
-
const
|
|
1050
|
-
if (!(
|
|
1057
|
+
const J = f[h] || B.attributeCheck instanceof Function && B.attributeCheck(h, r);
|
|
1058
|
+
if (!(he && !D[h] && fe(Ue, h))) {
|
|
1051
1059
|
if (!(Q && fe(Qe, h))) {
|
|
1052
|
-
if (!
|
|
1060
|
+
if (!J || D[h]) {
|
|
1053
1061
|
if (
|
|
1054
1062
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1055
1063
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
@@ -1058,10 +1066,10 @@ function vs() {
|
|
|
1058
1066
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1059
1067
|
h === "is" && d.allowCustomizedBuiltInElements && (d.tagNameCheck instanceof RegExp && fe(d.tagNameCheck, S) || d.tagNameCheck instanceof Function && d.tagNameCheck(S)))
|
|
1060
1068
|
) return !1;
|
|
1061
|
-
} else if (!
|
|
1062
|
-
if (!fe(
|
|
1069
|
+
} else if (!Xt[h]) {
|
|
1070
|
+
if (!fe($e, ft(S, Ee, ""))) {
|
|
1063
1071
|
if (!((h === "src" || h === "xlink:href" || h === "href") && r !== "script" && Qn(S, "data:") === 0 && Rn[r])) {
|
|
1064
|
-
if (!(
|
|
1072
|
+
if (!(te && !fe(at, ft(S, Ee, "")))) {
|
|
1065
1073
|
if (S)
|
|
1066
1074
|
return !1;
|
|
1067
1075
|
}
|
|
@@ -1072,11 +1080,11 @@ function vs() {
|
|
|
1072
1080
|
}
|
|
1073
1081
|
return !0;
|
|
1074
1082
|
}, "_isValidAttribute"), Ps = U({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), Fn = /* @__PURE__ */ u(function(r) {
|
|
1075
|
-
return !Ps[
|
|
1083
|
+
return !Ps[It(r)] && fe(it, r);
|
|
1076
1084
|
}, "_isBasicCustomElement"), Bn = /* @__PURE__ */ u(function(r) {
|
|
1077
1085
|
He(ne.beforeSanitizeAttributes, r, null);
|
|
1078
1086
|
const h = r.attributes;
|
|
1079
|
-
if (!h ||
|
|
1087
|
+
if (!h || Ot(r))
|
|
1080
1088
|
return;
|
|
1081
1089
|
const S = {
|
|
1082
1090
|
attrName: "",
|
|
@@ -1085,174 +1093,174 @@ function vs() {
|
|
|
1085
1093
|
allowedAttributes: f,
|
|
1086
1094
|
forceKeepAttr: void 0
|
|
1087
1095
|
};
|
|
1088
|
-
let
|
|
1089
|
-
for (;
|
|
1090
|
-
const G = h[
|
|
1091
|
-
let
|
|
1092
|
-
if (S.attrName = Ce, S.attrValue =
|
|
1093
|
-
Je(
|
|
1096
|
+
let J = h.length;
|
|
1097
|
+
for (; J--; ) {
|
|
1098
|
+
const G = h[J], ae = G.name, Ae = G.namespaceURI, Ne = G.value, Ce = oe(ae), sn = Ne;
|
|
1099
|
+
let de = ae === "value" ? sn : wa(sn);
|
|
1100
|
+
if (S.attrName = Ce, S.attrValue = de, S.keepAttr = !0, S.forceKeepAttr = void 0, He(ne.uponSanitizeAttribute, r, S), de = S.attrValue, _n && (Ce === "id" || Ce === "name") && Qn(de, En) !== 0 && (Je(ae, r), de = En + de), v && fe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, de)) {
|
|
1101
|
+
Je(ae, r);
|
|
1094
1102
|
continue;
|
|
1095
1103
|
}
|
|
1096
|
-
if (Ce === "attributename" && Xn(
|
|
1097
|
-
Je(
|
|
1104
|
+
if (Ce === "attributename" && Xn(de, "href")) {
|
|
1105
|
+
Je(ae, r);
|
|
1098
1106
|
continue;
|
|
1099
1107
|
}
|
|
1100
1108
|
if (S.forceKeepAttr)
|
|
1101
1109
|
continue;
|
|
1102
1110
|
if (!S.keepAttr) {
|
|
1103
|
-
Je(
|
|
1111
|
+
Je(ae, r);
|
|
1104
1112
|
continue;
|
|
1105
1113
|
}
|
|
1106
|
-
if (!
|
|
1107
|
-
Je(
|
|
1114
|
+
if (!ue && fe(/\/>/i, de)) {
|
|
1115
|
+
Je(ae, r);
|
|
1108
1116
|
continue;
|
|
1109
1117
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1118
|
+
pe && dt([We, ke, be], (Hn) => {
|
|
1119
|
+
de = ft(de, Hn, " ");
|
|
1112
1120
|
});
|
|
1113
|
-
const Un =
|
|
1114
|
-
if (!Pn(Un, Ce,
|
|
1115
|
-
Je(
|
|
1121
|
+
const Un = oe(r.nodeName);
|
|
1122
|
+
if (!Pn(Un, Ce, de)) {
|
|
1123
|
+
Je(ae, r);
|
|
1116
1124
|
continue;
|
|
1117
1125
|
}
|
|
1118
|
-
if (z && typeof
|
|
1119
|
-
switch (
|
|
1126
|
+
if (z && typeof T == "object" && typeof T.getAttributeType == "function" && !Ae)
|
|
1127
|
+
switch (T.getAttributeType(Un, Ce)) {
|
|
1120
1128
|
case "TrustedHTML": {
|
|
1121
|
-
|
|
1129
|
+
de = z.createHTML(de);
|
|
1122
1130
|
break;
|
|
1123
1131
|
}
|
|
1124
1132
|
case "TrustedScriptURL": {
|
|
1125
|
-
|
|
1133
|
+
de = z.createScriptURL(de);
|
|
1126
1134
|
break;
|
|
1127
1135
|
}
|
|
1128
1136
|
}
|
|
1129
|
-
if (
|
|
1137
|
+
if (de !== sn)
|
|
1130
1138
|
try {
|
|
1131
|
-
Ae ? r.setAttributeNS(Ae,
|
|
1139
|
+
Ae ? r.setAttributeNS(Ae, ae, de) : r.setAttribute(ae, de), Ot(r) ? Re(r) : Zn(t.removed);
|
|
1132
1140
|
} catch {
|
|
1133
|
-
Je(
|
|
1141
|
+
Je(ae, r);
|
|
1134
1142
|
}
|
|
1135
1143
|
}
|
|
1136
1144
|
He(ne.afterSanitizeAttributes, r, null);
|
|
1137
|
-
}, "_sanitizeAttributes"),
|
|
1145
|
+
}, "_sanitizeAttributes"), zt = /* @__PURE__ */ u(function(r) {
|
|
1138
1146
|
let h = null;
|
|
1139
1147
|
const S = On(r);
|
|
1140
1148
|
for (He(ne.beforeSanitizeShadowDOM, r, null); h = S.nextNode(); )
|
|
1141
|
-
if (He(ne.uponSanitizeShadowNode, h, null), zn(h), Bn(h),
|
|
1142
|
-
const G =
|
|
1143
|
-
|
|
1149
|
+
if (He(ne.uponSanitizeShadowNode, h, null), zn(h), Bn(h), St(h.content) && zt(h.content), (F ? F(h) : h.nodeType) === ze.element) {
|
|
1150
|
+
const G = N ? N(h) : h.shadowRoot;
|
|
1151
|
+
St(G) && (ut(G), zt(G));
|
|
1144
1152
|
}
|
|
1145
1153
|
He(ne.afterSanitizeShadowDOM, r, null);
|
|
1146
|
-
}, "_sanitizeShadowDOM"),
|
|
1147
|
-
const h =
|
|
1148
|
-
if (h ===
|
|
1149
|
-
const G =
|
|
1150
|
-
|
|
1154
|
+
}, "_sanitizeShadowDOM"), ut = /* @__PURE__ */ u(function(r) {
|
|
1155
|
+
const h = F ? F(r) : r.nodeType;
|
|
1156
|
+
if (h === ze.element) {
|
|
1157
|
+
const G = N ? N(r) : r.shadowRoot;
|
|
1158
|
+
St(G) && (ut(G), zt(G));
|
|
1151
1159
|
}
|
|
1152
1160
|
const S = K ? K(r) : r.childNodes;
|
|
1153
1161
|
if (!S)
|
|
1154
1162
|
return;
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1163
|
+
const J = [];
|
|
1164
|
+
dt(S, (G) => {
|
|
1165
|
+
pt(J, G);
|
|
1158
1166
|
});
|
|
1159
|
-
for (const G of
|
|
1160
|
-
|
|
1161
|
-
if (h ===
|
|
1167
|
+
for (const G of J)
|
|
1168
|
+
ut(G);
|
|
1169
|
+
if (h === ze.element) {
|
|
1162
1170
|
const G = W ? W(r) : null;
|
|
1163
|
-
if (typeof G == "string" &&
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1171
|
+
if (typeof G == "string" && oe(G) === "template") {
|
|
1172
|
+
const ae = r.content;
|
|
1173
|
+
St(ae) && ut(ae);
|
|
1166
1174
|
}
|
|
1167
1175
|
}
|
|
1168
1176
|
}, "_sanitizeAttachedShadowRoots");
|
|
1169
|
-
return t.sanitize = function(
|
|
1170
|
-
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, S = null,
|
|
1171
|
-
if (
|
|
1172
|
-
throw
|
|
1177
|
+
return t.sanitize = function(I) {
|
|
1178
|
+
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, S = null, J = null, G = null;
|
|
1179
|
+
if (Qt = !I, Qt && (I = "<!-->"), typeof I != "string" && !Nt(I) && (I = Ea(I), typeof I != "string"))
|
|
1180
|
+
throw Rt("dirty is not a string, aborting");
|
|
1173
1181
|
if (!t.isSupported)
|
|
1174
|
-
return
|
|
1175
|
-
if (
|
|
1176
|
-
const
|
|
1177
|
-
if (typeof
|
|
1178
|
-
const Ce =
|
|
1179
|
-
if (!
|
|
1180
|
-
throw
|
|
1181
|
-
}
|
|
1182
|
-
if (
|
|
1183
|
-
throw
|
|
1184
|
-
|
|
1185
|
-
} else if (
|
|
1186
|
-
h = Ln("<!---->"), S = h.ownerDocument.importNode(
|
|
1182
|
+
return I;
|
|
1183
|
+
if (x || nn(r), t.removed = [], typeof I == "string" && (wt = !1), wt) {
|
|
1184
|
+
const Ne = W ? W(I) : I.nodeName;
|
|
1185
|
+
if (typeof Ne == "string") {
|
|
1186
|
+
const Ce = oe(Ne);
|
|
1187
|
+
if (!C[Ce] || A[Ce])
|
|
1188
|
+
throw Rt("root node is forbidden and cannot be sanitized in-place");
|
|
1189
|
+
}
|
|
1190
|
+
if (Ot(I))
|
|
1191
|
+
throw Rt("root node is clobbered and cannot be sanitized in-place");
|
|
1192
|
+
ut(I);
|
|
1193
|
+
} else if (Nt(I))
|
|
1194
|
+
h = Ln("<!---->"), S = h.ownerDocument.importNode(I, !0), S.nodeType === ze.element && S.nodeName === "BODY" || S.nodeName === "HTML" ? h = S : h.appendChild(S), ut(S);
|
|
1187
1195
|
else {
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1190
|
-
return z &&
|
|
1191
|
-
if (h = Ln(
|
|
1192
|
-
return
|
|
1193
|
-
}
|
|
1194
|
-
h &&
|
|
1195
|
-
const
|
|
1196
|
-
for (;
|
|
1197
|
-
zn(
|
|
1198
|
-
if (
|
|
1199
|
-
return
|
|
1200
|
-
if (
|
|
1201
|
-
if (
|
|
1196
|
+
if (!$ && !pe && !k && // eslint-disable-next-line unicorn/prefer-includes
|
|
1197
|
+
I.indexOf("<") === -1)
|
|
1198
|
+
return z && Se ? z.createHTML(I) : I;
|
|
1199
|
+
if (h = Ln(I), !h)
|
|
1200
|
+
return $ ? null : Se ? ee : "";
|
|
1201
|
+
}
|
|
1202
|
+
h && P && Re(h.firstChild);
|
|
1203
|
+
const ae = On(wt ? I : h);
|
|
1204
|
+
for (; J = ae.nextNode(); )
|
|
1205
|
+
zn(J), Bn(J), St(J.content) && zt(J.content);
|
|
1206
|
+
if (wt)
|
|
1207
|
+
return pe && Nn(I), I;
|
|
1208
|
+
if ($) {
|
|
1209
|
+
if (pe && Nn(h), se)
|
|
1202
1210
|
for (G = st.call(h.ownerDocument); h.firstChild; )
|
|
1203
1211
|
G.appendChild(h.firstChild);
|
|
1204
1212
|
else
|
|
1205
1213
|
G = h;
|
|
1206
1214
|
return (f.shadowroot || f.shadowrootmode) && (G = Te.call(n, G, !0)), G;
|
|
1207
1215
|
}
|
|
1208
|
-
let Ae =
|
|
1209
|
-
return
|
|
1210
|
-
` + Ae),
|
|
1211
|
-
Ae =
|
|
1212
|
-
}), z &&
|
|
1216
|
+
let Ae = k ? h.outerHTML : h.innerHTML;
|
|
1217
|
+
return k && C["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && fe(Pa, h.ownerDocument.doctype.name) && (Ae = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
1218
|
+
` + Ae), pe && dt([We, ke, be], (Ne) => {
|
|
1219
|
+
Ae = ft(Ae, Ne, " ");
|
|
1220
|
+
}), z && Se ? z.createHTML(Ae) : Ae;
|
|
1213
1221
|
}, t.setConfig = function() {
|
|
1214
|
-
let
|
|
1215
|
-
|
|
1222
|
+
let I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1223
|
+
nn(I), x = !0;
|
|
1216
1224
|
}, t.clearConfig = function() {
|
|
1217
|
-
|
|
1218
|
-
}, t.isValidAttribute = function(
|
|
1219
|
-
|
|
1220
|
-
const S =
|
|
1221
|
-
return Pn(S,
|
|
1222
|
-
}, t.addHook = function(
|
|
1223
|
-
typeof r == "function" &&
|
|
1224
|
-
}, t.removeHook = function(
|
|
1225
|
+
ct = null, x = !1;
|
|
1226
|
+
}, t.isValidAttribute = function(I, r, h) {
|
|
1227
|
+
ct || nn({});
|
|
1228
|
+
const S = oe(I), J = oe(r);
|
|
1229
|
+
return Pn(S, J, h);
|
|
1230
|
+
}, t.addHook = function(I, r) {
|
|
1231
|
+
typeof r == "function" && pt(ne[I], r);
|
|
1232
|
+
}, t.removeHook = function(I, r) {
|
|
1225
1233
|
if (r !== void 0) {
|
|
1226
|
-
const h =
|
|
1227
|
-
return h === -1 ? void 0 :
|
|
1234
|
+
const h = ya(ne[I], r);
|
|
1235
|
+
return h === -1 ? void 0 : va(ne[I], h, 1)[0];
|
|
1228
1236
|
}
|
|
1229
|
-
return Zn(ne[
|
|
1230
|
-
}, t.removeHooks = function(
|
|
1231
|
-
ne[
|
|
1237
|
+
return Zn(ne[I]);
|
|
1238
|
+
}, t.removeHooks = function(I) {
|
|
1239
|
+
ne[I] = [];
|
|
1232
1240
|
}, t.removeAllHooks = function() {
|
|
1233
1241
|
ne = rs();
|
|
1234
1242
|
}, t;
|
|
1235
1243
|
}
|
|
1236
1244
|
u(vs, "createDOMPurify");
|
|
1237
|
-
var
|
|
1238
|
-
function
|
|
1245
|
+
var Ha = vs();
|
|
1246
|
+
function mn() {
|
|
1239
1247
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1240
1248
|
}
|
|
1241
|
-
u(
|
|
1242
|
-
var nt =
|
|
1249
|
+
u(mn, "M");
|
|
1250
|
+
var nt = mn();
|
|
1243
1251
|
function ws(i) {
|
|
1244
1252
|
nt = i;
|
|
1245
1253
|
}
|
|
1246
1254
|
u(ws, "N");
|
|
1247
1255
|
var et = { exec: /* @__PURE__ */ u(() => null, "exec") };
|
|
1248
|
-
function
|
|
1256
|
+
function gt(i) {
|
|
1249
1257
|
let t = [];
|
|
1250
1258
|
return (e) => {
|
|
1251
1259
|
let n = Math.max(0, Math.min(3, e - 1)), a = t[n];
|
|
1252
1260
|
return a || (a = i(n), t[n] = a), a;
|
|
1253
1261
|
};
|
|
1254
1262
|
}
|
|
1255
|
-
u(
|
|
1263
|
+
u(gt, "E");
|
|
1256
1264
|
function V(i, t = "") {
|
|
1257
1265
|
let e = typeof i == "string" ? i : i.source, n = { replace: /* @__PURE__ */ u((a, s) => {
|
|
1258
1266
|
let l = typeof s == "string" ? s : s.source;
|
|
@@ -1261,21 +1269,21 @@ function V(i, t = "") {
|
|
|
1261
1269
|
return n;
|
|
1262
1270
|
}
|
|
1263
1271
|
u(V, "d");
|
|
1264
|
-
var
|
|
1272
|
+
var ja = ((i = "") => {
|
|
1265
1273
|
try {
|
|
1266
1274
|
return !!new RegExp("(?<=1)(?<!1)" + i);
|
|
1267
1275
|
} catch {
|
|
1268
1276
|
return !1;
|
|
1269
1277
|
}
|
|
1270
|
-
})(), xe = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ u((i) => new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex:
|
|
1271
|
-
]`).replace("lheading", Ss).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() },
|
|
1272
|
-
function
|
|
1278
|
+
})(), xe = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ u((i) => new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: gt((i) => new RegExp(`^ {0,${i}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: gt((i) => new RegExp(`^ {0,${i}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: gt((i) => new RegExp(`^ {0,${i}}(?:\`\`\`|~~~)`)), headingBeginRegex: gt((i) => new RegExp(`^ {0,${i}}#`)), htmlBeginRegex: gt((i) => new RegExp(`^ {0,${i}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: gt((i) => new RegExp(`^ {0,${i}}>`)) }, Ga = /^(?:[ \t]*(?:\n|$))+/, Wa = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, qa = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Dt = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Va = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Ts = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Ss = V(Ts).replace(/bull/g, xn).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ya = V(Ts).replace(/bull/g, xn).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), kn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ka = /^[^\n]+/, bn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Za = V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", bn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Xa = V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, xn).getRegex(), Vt = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", yn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Qa = V("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", yn).replace("tag", Vt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), As = V(kn).replace("hr", Dt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Vt).getRegex(), Ja = V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", As).getRegex(), vn = { blockquote: Ja, code: Wa, def: Za, fences: qa, heading: Va, hr: Dt, html: Qa, lheading: Ss, list: Xa, newline: Ga, paragraph: As, table: et, text: Ka }, ls = V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Dt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Vt).getRegex(), ei = { ...vn, lheading: Ya, table: ls, paragraph: V(kn).replace("hr", Dt).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ls).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Vt).getRegex() }, ti = { ...vn, html: V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", yn).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: et, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: V(kn).replace("hr", Dt).replace("heading", ` *#{1,6} *[^
|
|
1279
|
+
]`).replace("lheading", Ss).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, ni = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, si = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _s = /^( {2,}|\\)\n(?!\s*$)/, ai = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, vt = /[\p{P}\p{S}]/u, Yt = /[\s\p{P}\p{S}]/u, wn = /[^\s\p{P}\p{S}]/u, ii = V(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Yt).getRegex(), Es = /(?!~)[\p{P}\p{S}]/u, ri = /(?!~)[\s\p{P}\p{S}]/u, li = /(?:[^\s\p{P}\p{S}]|~)/u, oi = V(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ja ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Rs = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ci = V(Rs, "u").replace(/punct/g, vt).getRegex(), ui = V(Rs, "u").replace(/punct/g, Es).getRegex(), Cs = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", hi = V(Cs, "gu").replace(/notPunctSpace/g, wn).replace(/punctSpace/g, Yt).replace(/punct/g, vt).getRegex(), di = V(Cs, "gu").replace(/notPunctSpace/g, li).replace(/punctSpace/g, ri).replace(/punct/g, Es).getRegex(), pi = V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, wn).replace(/punctSpace/g, Yt).replace(/punct/g, vt).getRegex(), fi = V(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, vt).getRegex(), gi = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", mi = V(gi, "gu").replace(/notPunctSpace/g, wn).replace(/punctSpace/g, Yt).replace(/punct/g, vt).getRegex(), xi = V(/\\(punct)/, "gu").replace(/punct/g, vt).getRegex(), ki = V(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), bi = V(yn).replace("(?:-->|$)", "-->").getRegex(), yi = V("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", bi).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), jt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, vi = V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", jt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Is = V(/^!?\[(label)\]\[(ref)\]/).replace("label", jt).replace("ref", bn).getRegex(), Ms = V(/^!?\[(ref)\](?:\[\])?/).replace("ref", bn).getRegex(), wi = V("reflink|nolink(?!\\()", "g").replace("reflink", Is).replace("nolink", Ms).getRegex(), os = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Tn = { _backpedal: et, anyPunctuation: xi, autolink: ki, blockSkip: oi, br: _s, code: si, del: et, delLDelim: et, delRDelim: et, emStrongLDelim: ci, emStrongRDelimAst: hi, emStrongRDelimUnd: pi, escape: ni, link: vi, nolink: Ms, punctuation: ii, reflink: Is, reflinkSearch: wi, tag: yi, text: ai, url: et }, Ti = { ...Tn, link: V(/^!?\[(label)\]\((.*?)\)/).replace("label", jt).getRegex(), reflink: V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", jt).getRegex() }, fn = { ...Tn, emStrongRDelimAst: di, emStrongLDelim: ui, delLDelim: fi, delRDelim: mi, url: V(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", os).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: V(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", os).getRegex() }, Si = { ...fn, br: V(_s).replace("{2,}", "*").getRegex(), text: V(fn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, Ft = { normal: vn, gfm: ei, pedantic: ti }, Ct = { normal: Tn, gfm: fn, breaks: Si, pedantic: Ti }, Ai = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, cs = /* @__PURE__ */ u((i) => Ai[i], "ge");
|
|
1280
|
+
function Fe(i, t) {
|
|
1273
1281
|
if (t) {
|
|
1274
1282
|
if (xe.escapeTest.test(i)) return i.replace(xe.escapeReplace, cs);
|
|
1275
1283
|
} else if (xe.escapeTestNoEncode.test(i)) return i.replace(xe.escapeReplaceNoEncode, cs);
|
|
1276
1284
|
return i;
|
|
1277
1285
|
}
|
|
1278
|
-
u(
|
|
1286
|
+
u(Fe, "O");
|
|
1279
1287
|
function us(i) {
|
|
1280
1288
|
try {
|
|
1281
1289
|
i = encodeURI(i).replace(xe.percentDecode, "%");
|
|
@@ -1314,7 +1322,7 @@ function ds(i) {
|
|
|
1314
1322
|
`);
|
|
1315
1323
|
}
|
|
1316
1324
|
u(ds, "ee");
|
|
1317
|
-
function
|
|
1325
|
+
function _i(i, t) {
|
|
1318
1326
|
if (i.indexOf(t[1]) === -1) return -1;
|
|
1319
1327
|
let e = 0;
|
|
1320
1328
|
for (let n = 0; n < i.length; n++) if (i[n] === "\\") n++;
|
|
@@ -1322,8 +1330,8 @@ function Ti(i, t) {
|
|
|
1322
1330
|
else if (i[n] === t[1] && (e--, e < 0)) return n;
|
|
1323
1331
|
return e > 0 ? -2 : -1;
|
|
1324
1332
|
}
|
|
1325
|
-
u(
|
|
1326
|
-
function
|
|
1333
|
+
u(_i, "fe");
|
|
1334
|
+
function Ei(i, t = 0) {
|
|
1327
1335
|
let e = t, n = "";
|
|
1328
1336
|
for (let a of i) if (a === " ") {
|
|
1329
1337
|
let s = 4 - e % 4;
|
|
@@ -1331,7 +1339,7 @@ function Si(i, t = 0) {
|
|
|
1331
1339
|
} else n += a, e++;
|
|
1332
1340
|
return n;
|
|
1333
1341
|
}
|
|
1334
|
-
u(
|
|
1342
|
+
u(Ei, "me");
|
|
1335
1343
|
function ps(i, t, e, n, a) {
|
|
1336
1344
|
let s = t.href, l = t.title || null, o = i[1].replace(a.other.outputLinkReplace, "$1");
|
|
1337
1345
|
n.state.inLink = !0;
|
|
@@ -1339,7 +1347,7 @@ function ps(i, t, e, n, a) {
|
|
|
1339
1347
|
return n.state.inLink = !1, p;
|
|
1340
1348
|
}
|
|
1341
1349
|
u(ps, "xe");
|
|
1342
|
-
function
|
|
1350
|
+
function Ri(i, t, e) {
|
|
1343
1351
|
let n = i.match(e.other.indentCodeCompensation);
|
|
1344
1352
|
if (n === null) return t;
|
|
1345
1353
|
let a = n[1];
|
|
@@ -1352,8 +1360,8 @@ function Ai(i, t, e) {
|
|
|
1352
1360
|
}).join(`
|
|
1353
1361
|
`);
|
|
1354
1362
|
}
|
|
1355
|
-
u(
|
|
1356
|
-
var
|
|
1363
|
+
u(Ri, "st");
|
|
1364
|
+
var xt, Gt = (xt = class {
|
|
1357
1365
|
constructor(t) {
|
|
1358
1366
|
j(this, "options");
|
|
1359
1367
|
j(this, "rules");
|
|
@@ -1374,7 +1382,7 @@ var mt, jt = (mt = class {
|
|
|
1374
1382
|
fences(t) {
|
|
1375
1383
|
let e = this.rules.block.fences.exec(t);
|
|
1376
1384
|
if (e) {
|
|
1377
|
-
let n = e[0], a =
|
|
1385
|
+
let n = e[0], a = Ri(n, e[3] || "", this.rules);
|
|
1378
1386
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: a };
|
|
1379
1387
|
}
|
|
1380
1388
|
}
|
|
@@ -1408,26 +1416,26 @@ var mt, jt = (mt = class {
|
|
|
1408
1416
|
else break;
|
|
1409
1417
|
n = n.slice(c);
|
|
1410
1418
|
let _ = p.join(`
|
|
1411
|
-
`),
|
|
1419
|
+
`), T = _.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1412
1420
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1413
1421
|
a = a ? `${a}
|
|
1414
1422
|
${_}` : _, s = s ? `${s}
|
|
1415
|
-
${
|
|
1423
|
+
${T}` : T;
|
|
1416
1424
|
let b = this.lexer.state.top;
|
|
1417
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
1418
|
-
let
|
|
1419
|
-
if (
|
|
1420
|
-
if (
|
|
1421
|
-
let
|
|
1425
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(T, l, !0), this.lexer.state.top = b, n.length === 0) break;
|
|
1426
|
+
let y = l.at(-1);
|
|
1427
|
+
if (y?.type === "code") break;
|
|
1428
|
+
if (y?.type === "blockquote") {
|
|
1429
|
+
let O = y, R = O.raw + `
|
|
1422
1430
|
` + n.join(`
|
|
1423
1431
|
`), K = this.blockquote(R);
|
|
1424
|
-
l[l.length - 1] = K, a = a.substring(0, a.length -
|
|
1432
|
+
l[l.length - 1] = K, a = a.substring(0, a.length - O.raw.length) + K.raw, s = s.substring(0, s.length - O.text.length) + K.text;
|
|
1425
1433
|
break;
|
|
1426
|
-
} else if (
|
|
1427
|
-
let
|
|
1434
|
+
} else if (y?.type === "list") {
|
|
1435
|
+
let O = y, R = O.raw + `
|
|
1428
1436
|
` + n.join(`
|
|
1429
1437
|
`), K = this.list(R);
|
|
1430
|
-
l[l.length - 1] = K, a = a.substring(0, a.length -
|
|
1438
|
+
l[l.length - 1] = K, a = a.substring(0, a.length - y.raw.length) + K.raw, s = s.substring(0, s.length - O.raw.length) + K.raw, n = R.substring(l.at(-1).raw.length).split(`
|
|
1431
1439
|
`);
|
|
1432
1440
|
continue;
|
|
1433
1441
|
}
|
|
@@ -1442,31 +1450,31 @@ ${w}` : w;
|
|
|
1442
1450
|
n = a ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = a ? n : "[*+-]");
|
|
1443
1451
|
let l = this.rules.other.listItemRegex(n), o = !1;
|
|
1444
1452
|
for (; t; ) {
|
|
1445
|
-
let c = !1, _ = "",
|
|
1453
|
+
let c = !1, _ = "", T = "";
|
|
1446
1454
|
if (!(e = l.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1447
1455
|
_ = e[0], t = t.substring(_.length);
|
|
1448
|
-
let b =
|
|
1449
|
-
`, 1)[0], e[1].length),
|
|
1450
|
-
`, 1)[0],
|
|
1451
|
-
if (this.options.pedantic ? (R = 2,
|
|
1452
|
-
`, t = t.substring(
|
|
1453
|
-
let K = this.rules.other.nextBulletRegex(R),
|
|
1456
|
+
let b = Ei(e[2].split(`
|
|
1457
|
+
`, 1)[0], e[1].length), y = t.split(`
|
|
1458
|
+
`, 1)[0], O = !b.trim(), R = 0;
|
|
1459
|
+
if (this.options.pedantic ? (R = 2, T = b.trimStart()) : O ? R = e[1].length + 1 : (R = b.search(this.rules.other.nonSpaceChar), R = R > 4 ? 1 : R, T = b.slice(R), R += e[1].length), O && this.rules.other.blankLine.test(y) && (_ += y + `
|
|
1460
|
+
`, t = t.substring(y.length + 1), c = !0), !c) {
|
|
1461
|
+
let K = this.rules.other.nextBulletRegex(R), Z = this.rules.other.hrRegex(R), N = this.rules.other.fencesBeginRegex(R), H = this.rules.other.headingBeginRegex(R), F = this.rules.other.htmlBeginRegex(R), W = this.rules.other.blockquoteBeginRegex(R);
|
|
1454
1462
|
for (; t; ) {
|
|
1455
1463
|
let z = t.split(`
|
|
1456
|
-
`, 1)[0],
|
|
1457
|
-
if (
|
|
1458
|
-
if (
|
|
1459
|
-
` +
|
|
1464
|
+
`, 1)[0], ee;
|
|
1465
|
+
if (y = z, this.options.pedantic ? (y = y.replace(this.rules.other.listReplaceNesting, " "), ee = y) : ee = y.replace(this.rules.other.tabCharGlobal, " "), N.test(y) || H.test(y) || F.test(y) || W.test(y) || K.test(y) || Z.test(y)) break;
|
|
1466
|
+
if (ee.search(this.rules.other.nonSpaceChar) >= R || !y.trim()) T += `
|
|
1467
|
+
` + ee.slice(R);
|
|
1460
1468
|
else {
|
|
1461
|
-
if (
|
|
1462
|
-
|
|
1463
|
-
` +
|
|
1469
|
+
if (O || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || N.test(b) || H.test(b) || Z.test(b)) break;
|
|
1470
|
+
T += `
|
|
1471
|
+
` + y;
|
|
1464
1472
|
}
|
|
1465
|
-
|
|
1466
|
-
`, t = t.substring(z.length + 1), b =
|
|
1473
|
+
O = !y.trim(), _ += z + `
|
|
1474
|
+
`, t = t.substring(z.length + 1), b = ee.slice(R);
|
|
1467
1475
|
}
|
|
1468
1476
|
}
|
|
1469
|
-
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(_) && (o = !0)), s.items.push({ type: "list_item", raw: _, task: !!this.options.gfm && this.rules.other.listIsTask.test(
|
|
1477
|
+
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(_) && (o = !0)), s.items.push({ type: "list_item", raw: _, task: !!this.options.gfm && this.rules.other.listIsTask.test(T), loose: !1, text: T, tokens: [] }), s.raw += _;
|
|
1470
1478
|
}
|
|
1471
1479
|
let p = s.items.at(-1);
|
|
1472
1480
|
if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
|
|
@@ -1481,14 +1489,14 @@ ${w}` : w;
|
|
|
1481
1489
|
this.lexer.inlineQueue[b].src = this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask, "");
|
|
1482
1490
|
break;
|
|
1483
1491
|
}
|
|
1484
|
-
let
|
|
1485
|
-
if (
|
|
1486
|
-
let b = { type: "checkbox", raw:
|
|
1492
|
+
let T = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
1493
|
+
if (T) {
|
|
1494
|
+
let b = { type: "checkbox", raw: T[0] + " ", checked: T[0] !== "[ ]" };
|
|
1487
1495
|
c.checked = b.checked, s.loose ? c.tokens[0] && ["paragraph", "text"].includes(c.tokens[0].type) && "tokens" in c.tokens[0] && c.tokens[0].tokens ? (c.tokens[0].raw = b.raw + c.tokens[0].raw, c.tokens[0].text = b.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(b)) : c.tokens.unshift({ type: "paragraph", raw: b.raw, text: b.raw, tokens: [b] }) : c.tokens.unshift(b);
|
|
1488
1496
|
}
|
|
1489
1497
|
} else c.task && (c.task = !1);
|
|
1490
1498
|
if (!s.loose) {
|
|
1491
|
-
let
|
|
1499
|
+
let T = c.tokens.filter((y) => y.type === "space"), b = T.length > 0 && T.some((y) => this.rules.other.anyLine.test(y.raw));
|
|
1492
1500
|
s.loose = b;
|
|
1493
1501
|
}
|
|
1494
1502
|
}
|
|
@@ -1564,7 +1572,7 @@ ${w}` : w;
|
|
|
1564
1572
|
let l = Ve(n.slice(0, -1), "\\");
|
|
1565
1573
|
if ((n.length - l.length) % 2 === 0) return;
|
|
1566
1574
|
} else {
|
|
1567
|
-
let l =
|
|
1575
|
+
let l = _i(e[2], "()");
|
|
1568
1576
|
if (l === -2) return;
|
|
1569
1577
|
if (l > -1) {
|
|
1570
1578
|
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
@@ -1605,13 +1613,13 @@ ${w}` : w;
|
|
|
1605
1613
|
}
|
|
1606
1614
|
if (p -= o, p > 0) continue;
|
|
1607
1615
|
o = Math.min(o, o + p + c);
|
|
1608
|
-
let
|
|
1616
|
+
let T = [...a[0]][0].length, b = t.slice(0, s + a.index + T + o);
|
|
1609
1617
|
if (Math.min(s, o) % 2) {
|
|
1610
|
-
let
|
|
1611
|
-
return { type: "em", raw: b, text:
|
|
1618
|
+
let O = b.slice(1, -1);
|
|
1619
|
+
return { type: "em", raw: b, text: O, tokens: this.lexer.inlineTokens(O) };
|
|
1612
1620
|
}
|
|
1613
|
-
let
|
|
1614
|
-
return { type: "strong", raw: b, text:
|
|
1621
|
+
let y = b.slice(2, -2);
|
|
1622
|
+
return { type: "strong", raw: b, text: y, tokens: this.lexer.inlineTokens(y) };
|
|
1615
1623
|
}
|
|
1616
1624
|
}
|
|
1617
1625
|
}
|
|
@@ -1638,8 +1646,8 @@ ${w}` : w;
|
|
|
1638
1646
|
}
|
|
1639
1647
|
if (p -= o, p > 0) continue;
|
|
1640
1648
|
o = Math.min(o, o + p);
|
|
1641
|
-
let _ = [...a[0]][0].length,
|
|
1642
|
-
return { type: "del", raw:
|
|
1649
|
+
let _ = [...a[0]][0].length, T = t.slice(0, s + a.index + _ + o), b = T.slice(s, -s);
|
|
1650
|
+
return { type: "del", raw: T, text: b, tokens: this.lexer.inlineTokens(b) };
|
|
1643
1651
|
}
|
|
1644
1652
|
}
|
|
1645
1653
|
}
|
|
@@ -1672,25 +1680,25 @@ ${w}` : w;
|
|
|
1672
1680
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1673
1681
|
}
|
|
1674
1682
|
}
|
|
1675
|
-
}, u(
|
|
1683
|
+
}, u(xt, "w"), xt), Ke, Ie = (Ke = class {
|
|
1676
1684
|
constructor(t) {
|
|
1677
1685
|
j(this, "tokens");
|
|
1678
1686
|
j(this, "options");
|
|
1679
1687
|
j(this, "state");
|
|
1680
1688
|
j(this, "inlineQueue");
|
|
1681
1689
|
j(this, "tokenizer");
|
|
1682
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || nt, this.options.tokenizer = this.options.tokenizer || new
|
|
1683
|
-
let e = { other: xe, block:
|
|
1684
|
-
this.options.pedantic ? (e.block =
|
|
1690
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || nt, this.options.tokenizer = this.options.tokenizer || new Gt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1691
|
+
let e = { other: xe, block: Ft.normal, inline: Ct.normal };
|
|
1692
|
+
this.options.pedantic ? (e.block = Ft.pedantic, e.inline = Ct.pedantic) : this.options.gfm && (e.block = Ft.gfm, this.options.breaks ? e.inline = Ct.breaks : e.inline = Ct.gfm), this.tokenizer.rules = e;
|
|
1685
1693
|
}
|
|
1686
1694
|
static get rules() {
|
|
1687
|
-
return { block:
|
|
1695
|
+
return { block: Ft, inline: Ct };
|
|
1688
1696
|
}
|
|
1689
1697
|
static lex(t, e) {
|
|
1690
|
-
return new
|
|
1698
|
+
return new Ke(e).lex(t);
|
|
1691
1699
|
}
|
|
1692
1700
|
static lexInline(t, e) {
|
|
1693
|
-
return new
|
|
1701
|
+
return new Ke(e).inlineTokens(t);
|
|
1694
1702
|
}
|
|
1695
1703
|
lex(t) {
|
|
1696
1704
|
t = t.replace(xe.carriageReturn, `
|
|
@@ -1823,7 +1831,7 @@ ${w}` : w;
|
|
|
1823
1831
|
}
|
|
1824
1832
|
l || (o = ""), l = !1;
|
|
1825
1833
|
let c;
|
|
1826
|
-
if (this.options.extensions?.inline?.some((
|
|
1834
|
+
if (this.options.extensions?.inline?.some((T) => (c = T.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1827
1835
|
if (c = this.tokenizer.escape(t)) {
|
|
1828
1836
|
t = t.substring(c.raw.length), e.push(c);
|
|
1829
1837
|
continue;
|
|
@@ -1838,8 +1846,8 @@ ${w}` : w;
|
|
|
1838
1846
|
}
|
|
1839
1847
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1840
1848
|
t = t.substring(c.raw.length);
|
|
1841
|
-
let
|
|
1842
|
-
c.type === "text" &&
|
|
1849
|
+
let T = e.at(-1);
|
|
1850
|
+
c.type === "text" && T?.type === "text" ? (T.raw += c.raw, T.text += c.text) : e.push(c);
|
|
1843
1851
|
continue;
|
|
1844
1852
|
}
|
|
1845
1853
|
if (c = this.tokenizer.emStrong(t, n, o)) {
|
|
@@ -1868,15 +1876,15 @@ ${w}` : w;
|
|
|
1868
1876
|
}
|
|
1869
1877
|
let _ = t;
|
|
1870
1878
|
if (this.options.extensions?.startInline) {
|
|
1871
|
-
let
|
|
1872
|
-
this.options.extensions.startInline.forEach((
|
|
1873
|
-
|
|
1874
|
-
}),
|
|
1879
|
+
let T = 1 / 0, b = t.slice(1), y;
|
|
1880
|
+
this.options.extensions.startInline.forEach((O) => {
|
|
1881
|
+
y = O.call({ lexer: this }, b), typeof y == "number" && y >= 0 && (T = Math.min(T, y));
|
|
1882
|
+
}), T < 1 / 0 && T >= 0 && (_ = t.substring(0, T + 1));
|
|
1875
1883
|
}
|
|
1876
1884
|
if (c = this.tokenizer.inlineText(_)) {
|
|
1877
1885
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), l = !0;
|
|
1878
|
-
let
|
|
1879
|
-
|
|
1886
|
+
let T = e.at(-1);
|
|
1887
|
+
T?.type === "text" ? (T.raw += c.raw, T.text += c.text) : e.push(c);
|
|
1880
1888
|
continue;
|
|
1881
1889
|
}
|
|
1882
1890
|
if (t) {
|
|
@@ -1891,7 +1899,7 @@ ${w}` : w;
|
|
|
1891
1899
|
if (this.options.silent) console.error(e);
|
|
1892
1900
|
else throw new Error(e);
|
|
1893
1901
|
}
|
|
1894
|
-
}, u(
|
|
1902
|
+
}, u(Ke, "l"), Ke), kt, Wt = (kt = class {
|
|
1895
1903
|
constructor(t) {
|
|
1896
1904
|
j(this, "options");
|
|
1897
1905
|
j(this, "parser");
|
|
@@ -1903,8 +1911,8 @@ ${w}` : w;
|
|
|
1903
1911
|
code({ text: t, lang: e, escaped: n }) {
|
|
1904
1912
|
let a = (e || "").match(xe.notSpaceStart)?.[0], s = t.replace(xe.endingNewline, "") + `
|
|
1905
1913
|
`;
|
|
1906
|
-
return a ? '<pre><code class="language-' +
|
|
1907
|
-
` : "<pre><code>" + (n ? s :
|
|
1914
|
+
return a ? '<pre><code class="language-' + Fe(a) + '">' + (n ? s : Fe(s, !0)) + `</code></pre>
|
|
1915
|
+
` : "<pre><code>" + (n ? s : Fe(s, !0)) + `</code></pre>
|
|
1908
1916
|
`;
|
|
1909
1917
|
}
|
|
1910
1918
|
blockquote({ tokens: t }) {
|
|
@@ -1982,7 +1990,7 @@ ${t}</tr>
|
|
|
1982
1990
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1983
1991
|
}
|
|
1984
1992
|
codespan({ text: t }) {
|
|
1985
|
-
return `<code>${
|
|
1993
|
+
return `<code>${Fe(t, !0)}</code>`;
|
|
1986
1994
|
}
|
|
1987
1995
|
br(t) {
|
|
1988
1996
|
return "<br>";
|
|
@@ -1995,20 +2003,20 @@ ${t}</tr>
|
|
|
1995
2003
|
if (s === null) return a;
|
|
1996
2004
|
t = s;
|
|
1997
2005
|
let l = '<a href="' + t + '"';
|
|
1998
|
-
return e && (l += ' title="' +
|
|
2006
|
+
return e && (l += ' title="' + Fe(e) + '"'), l += ">" + a + "</a>", l;
|
|
1999
2007
|
}
|
|
2000
2008
|
image({ href: t, title: e, text: n, tokens: a }) {
|
|
2001
2009
|
a && (n = this.parser.parseInline(a, this.parser.textRenderer));
|
|
2002
2010
|
let s = us(t);
|
|
2003
|
-
if (s === null) return
|
|
2011
|
+
if (s === null) return Fe(n);
|
|
2004
2012
|
t = s;
|
|
2005
|
-
let l = `<img src="${t}" alt="${
|
|
2006
|
-
return e && (l += ` title="${
|
|
2013
|
+
let l = `<img src="${t}" alt="${Fe(n)}"`;
|
|
2014
|
+
return e && (l += ` title="${Fe(e)}"`), l += ">", l;
|
|
2007
2015
|
}
|
|
2008
2016
|
text(t) {
|
|
2009
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
2017
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : Fe(t.text);
|
|
2010
2018
|
}
|
|
2011
|
-
}, u(
|
|
2019
|
+
}, u(kt, "y"), kt), bt, Sn = (bt = class {
|
|
2012
2020
|
strong({ text: t }) {
|
|
2013
2021
|
return t;
|
|
2014
2022
|
}
|
|
@@ -2039,12 +2047,12 @@ ${t}</tr>
|
|
|
2039
2047
|
checkbox({ raw: t }) {
|
|
2040
2048
|
return t;
|
|
2041
2049
|
}
|
|
2042
|
-
}, u(
|
|
2050
|
+
}, u(bt, "L"), bt), Ze, Me = (Ze = class {
|
|
2043
2051
|
constructor(t) {
|
|
2044
2052
|
j(this, "options");
|
|
2045
2053
|
j(this, "renderer");
|
|
2046
2054
|
j(this, "textRenderer");
|
|
2047
|
-
this.options = t || nt, this.options.renderer = this.options.renderer || new
|
|
2055
|
+
this.options = t || nt, this.options.renderer = this.options.renderer || new Wt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Sn();
|
|
2048
2056
|
}
|
|
2049
2057
|
static parse(t, e) {
|
|
2050
2058
|
return new Ze(e).parse(t);
|
|
@@ -2190,7 +2198,7 @@ ${t}</tr>
|
|
|
2190
2198
|
}
|
|
2191
2199
|
return n;
|
|
2192
2200
|
}
|
|
2193
|
-
}, u(Ze, "l"), Ze),
|
|
2201
|
+
}, u(Ze, "l"), Ze), Ye, Mt = (Ye = class {
|
|
2194
2202
|
constructor(t) {
|
|
2195
2203
|
j(this, "options");
|
|
2196
2204
|
j(this, "block");
|
|
@@ -2214,18 +2222,18 @@ ${t}</tr>
|
|
|
2214
2222
|
provideParser(t = this.block) {
|
|
2215
2223
|
return t ? Me.parse : Me.parseInline;
|
|
2216
2224
|
}
|
|
2217
|
-
}, u(
|
|
2225
|
+
}, u(Ye, "P"), j(Ye, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), j(Ye, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Ye), yt, Ci = (yt = class {
|
|
2218
2226
|
constructor(...t) {
|
|
2219
|
-
j(this, "defaults",
|
|
2227
|
+
j(this, "defaults", mn());
|
|
2220
2228
|
j(this, "options", this.setOptions);
|
|
2221
2229
|
j(this, "parse", this.parseMarkdown(!0));
|
|
2222
2230
|
j(this, "parseInline", this.parseMarkdown(!1));
|
|
2223
2231
|
j(this, "Parser", Me);
|
|
2224
|
-
j(this, "Renderer",
|
|
2225
|
-
j(this, "TextRenderer",
|
|
2232
|
+
j(this, "Renderer", Wt);
|
|
2233
|
+
j(this, "TextRenderer", Sn);
|
|
2226
2234
|
j(this, "Lexer", Ie);
|
|
2227
|
-
j(this, "Tokenizer",
|
|
2228
|
-
j(this, "Hooks",
|
|
2235
|
+
j(this, "Tokenizer", Gt);
|
|
2236
|
+
j(this, "Hooks", Mt);
|
|
2229
2237
|
this.use(...t);
|
|
2230
2238
|
}
|
|
2231
2239
|
walkTokens(t, e) {
|
|
@@ -2272,51 +2280,51 @@ ${t}</tr>
|
|
|
2272
2280
|
}
|
|
2273
2281
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
2274
2282
|
}), a.extensions = e), n.renderer) {
|
|
2275
|
-
let s = this.defaults.renderer || new
|
|
2283
|
+
let s = this.defaults.renderer || new Wt(this.defaults);
|
|
2276
2284
|
for (let l in n.renderer) {
|
|
2277
2285
|
if (!(l in s)) throw new Error(`renderer '${l}' does not exist`);
|
|
2278
2286
|
if (["options", "parser"].includes(l)) continue;
|
|
2279
2287
|
let o = l, p = n.renderer[o], c = s[o];
|
|
2280
2288
|
s[o] = (..._) => {
|
|
2281
|
-
let
|
|
2282
|
-
return
|
|
2289
|
+
let T = p.apply(s, _);
|
|
2290
|
+
return T === !1 && (T = c.apply(s, _)), T || "";
|
|
2283
2291
|
};
|
|
2284
2292
|
}
|
|
2285
2293
|
a.renderer = s;
|
|
2286
2294
|
}
|
|
2287
2295
|
if (n.tokenizer) {
|
|
2288
|
-
let s = this.defaults.tokenizer || new
|
|
2296
|
+
let s = this.defaults.tokenizer || new Gt(this.defaults);
|
|
2289
2297
|
for (let l in n.tokenizer) {
|
|
2290
2298
|
if (!(l in s)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
2291
2299
|
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
2292
2300
|
let o = l, p = n.tokenizer[o], c = s[o];
|
|
2293
2301
|
s[o] = (..._) => {
|
|
2294
|
-
let
|
|
2295
|
-
return
|
|
2302
|
+
let T = p.apply(s, _);
|
|
2303
|
+
return T === !1 && (T = c.apply(s, _)), T;
|
|
2296
2304
|
};
|
|
2297
2305
|
}
|
|
2298
2306
|
a.tokenizer = s;
|
|
2299
2307
|
}
|
|
2300
2308
|
if (n.hooks) {
|
|
2301
|
-
let s = this.defaults.hooks || new
|
|
2309
|
+
let s = this.defaults.hooks || new Mt();
|
|
2302
2310
|
for (let l in n.hooks) {
|
|
2303
2311
|
if (!(l in s)) throw new Error(`hook '${l}' does not exist`);
|
|
2304
2312
|
if (["options", "block"].includes(l)) continue;
|
|
2305
2313
|
let o = l, p = n.hooks[o], c = s[o];
|
|
2306
|
-
|
|
2307
|
-
if (this.defaults.async &&
|
|
2314
|
+
Mt.passThroughHooks.has(l) ? s[o] = (_) => {
|
|
2315
|
+
if (this.defaults.async && Mt.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
2308
2316
|
let b = await p.call(s, _);
|
|
2309
2317
|
return c.call(s, b);
|
|
2310
2318
|
})();
|
|
2311
|
-
let
|
|
2312
|
-
return c.call(s,
|
|
2319
|
+
let T = p.call(s, _);
|
|
2320
|
+
return c.call(s, T);
|
|
2313
2321
|
} : s[o] = (..._) => {
|
|
2314
2322
|
if (this.defaults.async) return (async () => {
|
|
2315
2323
|
let b = await p.apply(s, _);
|
|
2316
2324
|
return b === !1 && (b = await c.apply(s, _)), b;
|
|
2317
2325
|
})();
|
|
2318
|
-
let
|
|
2319
|
-
return
|
|
2326
|
+
let T = p.apply(s, _);
|
|
2327
|
+
return T === !1 && (T = c.apply(s, _)), T;
|
|
2320
2328
|
};
|
|
2321
2329
|
}
|
|
2322
2330
|
a.hooks = s;
|
|
@@ -2367,14 +2375,14 @@ ${t}</tr>
|
|
|
2367
2375
|
return (n) => {
|
|
2368
2376
|
if (n.message += `
|
|
2369
2377
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2370
|
-
let a = "<p>An error occurred:</p><pre>" +
|
|
2378
|
+
let a = "<p>An error occurred:</p><pre>" + Fe(n.message + "", !0) + "</pre>";
|
|
2371
2379
|
return e ? Promise.resolve(a) : a;
|
|
2372
2380
|
}
|
|
2373
2381
|
if (e) return Promise.reject(n);
|
|
2374
2382
|
throw n;
|
|
2375
2383
|
};
|
|
2376
2384
|
}
|
|
2377
|
-
}, u(
|
|
2385
|
+
}, u(yt, "q"), yt), tt = new Ci();
|
|
2378
2386
|
function X(i, t) {
|
|
2379
2387
|
return tt.parse(i, t);
|
|
2380
2388
|
}
|
|
@@ -2382,7 +2390,7 @@ u(X, "g");
|
|
|
2382
2390
|
X.options = X.setOptions = function(i) {
|
|
2383
2391
|
return tt.setOptions(i), X.defaults = tt.defaults, ws(X.defaults), X;
|
|
2384
2392
|
};
|
|
2385
|
-
X.getDefaults =
|
|
2393
|
+
X.getDefaults = mn;
|
|
2386
2394
|
X.defaults = nt;
|
|
2387
2395
|
X.use = function(...i) {
|
|
2388
2396
|
return tt.use(...i), X.defaults = tt.defaults, ws(X.defaults), X;
|
|
@@ -2393,12 +2401,12 @@ X.walkTokens = function(i, t) {
|
|
|
2393
2401
|
X.parseInline = tt.parseInline;
|
|
2394
2402
|
X.Parser = Me;
|
|
2395
2403
|
X.parser = Me.parse;
|
|
2396
|
-
X.Renderer =
|
|
2397
|
-
X.TextRenderer =
|
|
2404
|
+
X.Renderer = Wt;
|
|
2405
|
+
X.TextRenderer = Sn;
|
|
2398
2406
|
X.Lexer = Ie;
|
|
2399
2407
|
X.lexer = Ie.lex;
|
|
2400
|
-
X.Tokenizer =
|
|
2401
|
-
X.Hooks =
|
|
2408
|
+
X.Tokenizer = Gt;
|
|
2409
|
+
X.Hooks = Mt;
|
|
2402
2410
|
X.parse = X;
|
|
2403
2411
|
X.options;
|
|
2404
2412
|
X.setOptions;
|
|
@@ -2407,20 +2415,20 @@ X.walkTokens;
|
|
|
2407
2415
|
X.parseInline;
|
|
2408
2416
|
Me.parse;
|
|
2409
2417
|
Ie.lex;
|
|
2410
|
-
const
|
|
2418
|
+
const Ii = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-label"], Mi = { class: "mb-2.5" }, Di = ["aria-label"], $i = ["viewBox"], Li = ["x1", "x2", "y1", "y2"], Oi = ["x", "y"], Ni = ["x", "y", "width", "height"], zi = ["d"], Pi = ["cx", "cy"], Fi = ["cx", "cy"], Bi = ["x", "y", "text-anchor"], Ui = {
|
|
2411
2419
|
key: 0,
|
|
2412
2420
|
class: "mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5"
|
|
2413
|
-
},
|
|
2421
|
+
}, Hi = {
|
|
2414
2422
|
key: 1,
|
|
2415
2423
|
class: "grid gap-3"
|
|
2416
|
-
},
|
|
2424
|
+
}, ji = { class: "mb-1 flex items-baseline justify-between gap-3 text-[12px]" }, Gi = { key: 2 }, Wi = { class: "relative flex flex-col items-center" }, qi = { class: "min-w-0 pb-3.5" }, Vi = /* @__PURE__ */ Be({
|
|
2417
2425
|
__name: "ChatVisualBlock",
|
|
2418
2426
|
props: {
|
|
2419
2427
|
result: {},
|
|
2420
2428
|
inverted: { type: Boolean }
|
|
2421
2429
|
},
|
|
2422
2430
|
setup(i) {
|
|
2423
|
-
const t = i, e =
|
|
2431
|
+
const t = i, e = M(() => t.result.ok ? t.result.spec : null), n = M(() => e.value?.visualType === "chart" ? e.value : null), a = M(() => e.value?.visualType === "diagram" ? e.value : null);
|
|
2424
2432
|
function s(f) {
|
|
2425
2433
|
return f?.chartType === "bar" || f?.chartType === "line" || f?.chartType === "scatter";
|
|
2426
2434
|
}
|
|
@@ -2429,78 +2437,78 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2429
2437
|
return f?.chartType === "pie";
|
|
2430
2438
|
}
|
|
2431
2439
|
u(l, "isPieChart");
|
|
2432
|
-
const o =
|
|
2433
|
-
function
|
|
2440
|
+
const o = M(() => n.value?.data ?? []), p = M(() => s(n.value) ? n.value : null), c = M(() => p.value?.series ?? []), _ = M(() => l(n.value) ? n.value : null);
|
|
2441
|
+
function T(f) {
|
|
2434
2442
|
return typeof f == "number" && Number.isFinite(f) ? f : null;
|
|
2435
2443
|
}
|
|
2436
|
-
u(
|
|
2437
|
-
const b =
|
|
2444
|
+
u(T, "numericValue");
|
|
2445
|
+
const b = M(() => {
|
|
2438
2446
|
const f = [], E = p.value;
|
|
2439
2447
|
if (!E) return f;
|
|
2440
2448
|
for (const d of E.data)
|
|
2441
2449
|
for (const A of E.series) {
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2450
|
+
const D = T(d[A.dataKey]);
|
|
2451
|
+
D !== null && f.push(D);
|
|
2444
2452
|
}
|
|
2445
2453
|
return f;
|
|
2446
2454
|
});
|
|
2447
|
-
function
|
|
2448
|
-
const d = f > 0 ? f : 1, A = Math.floor(Math.log10(d)),
|
|
2455
|
+
function y(f, E) {
|
|
2456
|
+
const d = f > 0 ? f : 1, A = Math.floor(Math.log10(d)), D = d / 10 ** A;
|
|
2449
2457
|
let B;
|
|
2450
|
-
return E ? B =
|
|
2458
|
+
return E ? B = D < 1.5 ? 1 : D < 3 ? 2 : D < 7 ? 5 : 10 : B = D <= 1 ? 1 : D <= 2 ? 2 : D <= 5 ? 5 : 10, B * 10 ** A;
|
|
2451
2459
|
}
|
|
2452
|
-
u(
|
|
2453
|
-
const
|
|
2460
|
+
u(y, "niceNum");
|
|
2461
|
+
const O = M(() => {
|
|
2454
2462
|
const f = b.value, E = f.length ? Math.max(...f) : 1, d = f.length ? Math.min(0, ...f) : 0;
|
|
2455
2463
|
if (d === E)
|
|
2456
2464
|
return { min: 0, max: E || 1, ticks: [0, E || 1] };
|
|
2457
|
-
const A = 4,
|
|
2458
|
-
for (let
|
|
2459
|
-
|
|
2460
|
-
return { min: Q, max:
|
|
2465
|
+
const A = 4, D = y(E - d, !1), B = y(D / (A - 1), !0), Q = Math.floor(d / B) * B, he = Math.ceil(E / B) * B, te = [];
|
|
2466
|
+
for (let ue = Q; ue <= he + B * 0.5; ue += B)
|
|
2467
|
+
te.push(Number(ue.toFixed(6)));
|
|
2468
|
+
return { min: Q, max: he, ticks: te };
|
|
2461
2469
|
}), R = { width: 360, height: 168, left: 30, right: 12, top: 10, bottom: 24 };
|
|
2462
2470
|
function K(f, E) {
|
|
2463
2471
|
const d = R.width - R.left - R.right;
|
|
2464
2472
|
return E <= 1 ? R.left + d / 2 : R.left + d * f / (E - 1);
|
|
2465
2473
|
}
|
|
2466
2474
|
u(K, "xForIndex");
|
|
2467
|
-
function
|
|
2468
|
-
const { min: E, max: d } =
|
|
2475
|
+
function Z(f) {
|
|
2476
|
+
const { min: E, max: d } = O.value, A = R.height - R.top - R.bottom;
|
|
2469
2477
|
return R.top + (d - f) / (d - E || 1) * A;
|
|
2470
2478
|
}
|
|
2471
|
-
u(
|
|
2472
|
-
function
|
|
2479
|
+
u(Z, "yForValue");
|
|
2480
|
+
function N(f) {
|
|
2473
2481
|
const E = p.value;
|
|
2474
2482
|
return E ? E.data.map((d, A) => {
|
|
2475
|
-
const
|
|
2476
|
-
return `${A === 0 ? "M" : "L"} ${K(A, E.data.length).toFixed(1)} ${
|
|
2483
|
+
const D = T(d[f]) ?? 0;
|
|
2484
|
+
return `${A === 0 ? "M" : "L"} ${K(A, E.data.length).toFixed(1)} ${Z(D).toFixed(1)}`;
|
|
2477
2485
|
}).join(" ") : "";
|
|
2478
2486
|
}
|
|
2479
|
-
u(
|
|
2480
|
-
const H =
|
|
2487
|
+
u(N, "pathForSeries");
|
|
2488
|
+
const H = M(() => {
|
|
2481
2489
|
const f = p.value;
|
|
2482
2490
|
if (!f || f.chartType !== "bar") return [];
|
|
2483
|
-
const d = (R.width - R.left - R.right) / Math.max(f.data.length, 1), A = Math.max(f.series.length, 1),
|
|
2484
|
-
return f.data.flatMap((
|
|
2485
|
-
const
|
|
2491
|
+
const d = (R.width - R.left - R.right) / Math.max(f.data.length, 1), A = Math.max(f.series.length, 1), D = A > 1 ? 2 : 0, B = Math.max(3, Math.min(20, (d * 0.62 - D * (A - 1)) / A)), Q = B * A + D * (A - 1), he = Z(0);
|
|
2492
|
+
return f.data.flatMap((te, ue) => f.series.map((pe, v) => {
|
|
2493
|
+
const k = T(te[pe.dataKey]) ?? 0, x = Z(k), P = R.left + ue * d + (d - Q) / 2 + v * (B + D);
|
|
2486
2494
|
return {
|
|
2487
|
-
key: `${
|
|
2488
|
-
x:
|
|
2489
|
-
y: Math.min(
|
|
2495
|
+
key: `${ue}-${pe.dataKey}`,
|
|
2496
|
+
x: P,
|
|
2497
|
+
y: Math.min(x, he),
|
|
2490
2498
|
width: B,
|
|
2491
|
-
height: Math.max(1.5, Math.abs(
|
|
2492
|
-
seriesIndex:
|
|
2499
|
+
height: Math.max(1.5, Math.abs(he - x)),
|
|
2500
|
+
seriesIndex: v
|
|
2493
2501
|
};
|
|
2494
2502
|
}));
|
|
2495
|
-
}),
|
|
2503
|
+
}), F = M(() => {
|
|
2496
2504
|
const f = p.value;
|
|
2497
2505
|
if (!f) return [];
|
|
2498
2506
|
const E = f.data;
|
|
2499
2507
|
if (!E.length) return [];
|
|
2500
|
-
const d = f.xKey, A = E.length - 1,
|
|
2501
|
-
for (let Q = 0; Q <= A; Q +=
|
|
2508
|
+
const d = f.xKey, A = E.length - 1, D = A <= 6 ? 1 : Math.ceil(A / 4), B = /* @__PURE__ */ new Set([0, A]);
|
|
2509
|
+
for (let Q = 0; Q <= A; Q += D)
|
|
2502
2510
|
B.add(Q);
|
|
2503
|
-
return [...B].sort((Q,
|
|
2511
|
+
return [...B].sort((Q, he) => Q - he).map((Q) => ({
|
|
2504
2512
|
key: `${Q}`,
|
|
2505
2513
|
label: String(E[Q]?.[d] ?? ""),
|
|
2506
2514
|
x: K(Q, E.length),
|
|
@@ -2520,89 +2528,89 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2520
2528
|
const B = Math.floor(E / 60), Q = E % 60;
|
|
2521
2529
|
return Q ? `${d}${B}m ${Q}s` : `${d}${B}m`;
|
|
2522
2530
|
}
|
|
2523
|
-
const A = Math.floor(E / 3600),
|
|
2524
|
-
return
|
|
2531
|
+
const A = Math.floor(E / 3600), D = Math.floor(E % 3600 / 60);
|
|
2532
|
+
return D ? `${d}${A}h ${D}m` : `${d}${A}h`;
|
|
2525
2533
|
}
|
|
2526
2534
|
u(z, "formatDuration");
|
|
2527
|
-
function
|
|
2535
|
+
function ee(f, E) {
|
|
2528
2536
|
const d = E?.valuePrefix ?? (E?.valueFormat === "currency" ? "$" : ""), A = E?.valueSuffix ?? (E?.valueFormat === "percent" ? "%" : "");
|
|
2529
|
-
let
|
|
2537
|
+
let D;
|
|
2530
2538
|
switch (E?.valueFormat) {
|
|
2531
2539
|
case "integer":
|
|
2532
|
-
|
|
2540
|
+
D = `${Math.round(f)}`;
|
|
2533
2541
|
break;
|
|
2534
2542
|
case "duration":
|
|
2535
|
-
|
|
2543
|
+
D = z(f);
|
|
2536
2544
|
break;
|
|
2537
2545
|
case "raw":
|
|
2538
|
-
|
|
2546
|
+
D = Number.isInteger(f) ? `${f}` : f.toFixed(1);
|
|
2539
2547
|
break;
|
|
2540
2548
|
default:
|
|
2541
|
-
|
|
2549
|
+
D = W(f);
|
|
2542
2550
|
}
|
|
2543
|
-
return `${d}${
|
|
2551
|
+
return `${d}${D}${A}`;
|
|
2544
2552
|
}
|
|
2545
|
-
u(
|
|
2546
|
-
const De =
|
|
2553
|
+
u(ee, "formatSeriesValue");
|
|
2554
|
+
const De = M(() => {
|
|
2547
2555
|
const f = p.value;
|
|
2548
2556
|
if (!f?.data.length) return [];
|
|
2549
2557
|
const E = f.data[f.data.length - 1];
|
|
2550
2558
|
return f.series.map((d, A) => {
|
|
2551
|
-
const
|
|
2559
|
+
const D = T(E?.[d.dataKey]);
|
|
2552
2560
|
return {
|
|
2553
2561
|
key: d.dataKey,
|
|
2554
2562
|
label: d.label || d.dataKey,
|
|
2555
|
-
value:
|
|
2563
|
+
value: D === null ? "—" : ee(D, d),
|
|
2556
2564
|
seriesIndex: A
|
|
2557
2565
|
};
|
|
2558
2566
|
});
|
|
2559
|
-
}), je =
|
|
2567
|
+
}), je = M(() => {
|
|
2560
2568
|
const f = p.value;
|
|
2561
2569
|
if (!f?.data.length || f.chartType !== "line") return [];
|
|
2562
2570
|
const E = f.data.length - 1, d = f.data[E];
|
|
2563
|
-
return f.series.map((A,
|
|
2564
|
-
const B =
|
|
2565
|
-
return B === null ? null : { key: A.dataKey, cx: K(E, f.data.length), cy:
|
|
2571
|
+
return f.series.map((A, D) => {
|
|
2572
|
+
const B = T(d?.[A.dataKey]);
|
|
2573
|
+
return B === null ? null : { key: A.dataKey, cx: K(E, f.data.length), cy: Z(B), seriesIndex: D };
|
|
2566
2574
|
}).filter((A) => A !== null);
|
|
2567
|
-
}), Xe =
|
|
2575
|
+
}), Xe = M(() => {
|
|
2568
2576
|
const f = _.value;
|
|
2569
2577
|
if (!f) return [];
|
|
2570
2578
|
const E = f.data.map((A) => ({
|
|
2571
2579
|
name: String(A[f.nameKey] ?? ""),
|
|
2572
|
-
value:
|
|
2573
|
-
})).filter((A) => A.name && A.value >= 0).sort((A,
|
|
2574
|
-
return E.map((A,
|
|
2580
|
+
value: T(A[f.valueKey]) ?? 0
|
|
2581
|
+
})).filter((A) => A.name && A.value >= 0).sort((A, D) => D.value - A.value), d = E.reduce((A, D) => A + D.value, 0) || 1;
|
|
2582
|
+
return E.map((A, D) => ({
|
|
2575
2583
|
...A,
|
|
2576
|
-
key: `${
|
|
2584
|
+
key: `${D}-${A.name}`,
|
|
2577
2585
|
percent: A.value / d
|
|
2578
2586
|
}));
|
|
2579
|
-
}), st =
|
|
2587
|
+
}), st = M(() => {
|
|
2580
2588
|
const f = /* @__PURE__ */ new Map();
|
|
2581
2589
|
for (const E of a.value?.nodes ?? [])
|
|
2582
2590
|
f.set(E.id, E);
|
|
2583
2591
|
return f;
|
|
2584
|
-
}), Ge =
|
|
2592
|
+
}), Ge = M(() => {
|
|
2585
2593
|
const f = a.value;
|
|
2586
2594
|
if (!f?.edges.length) return [];
|
|
2587
|
-
const E = new Set(f.edges.map((
|
|
2595
|
+
const E = new Set(f.edges.map((te) => te.to)), d = f.edges.find((te) => !E.has(te.from)) ?? f.edges[0];
|
|
2588
2596
|
if (!d) return [];
|
|
2589
|
-
const A = [],
|
|
2590
|
-
const
|
|
2591
|
-
|
|
2597
|
+
const A = [], D = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ u((te) => `${te.from}->${te.to}`, "edgeKey"), Q = /* @__PURE__ */ u((te, ue) => {
|
|
2598
|
+
const pe = st.value.get(te);
|
|
2599
|
+
pe && A.push({ key: `node-${te}-${A.length}`, label: pe.label, note: ue });
|
|
2592
2600
|
}, "pushStep");
|
|
2593
|
-
let
|
|
2594
|
-
for (;
|
|
2595
|
-
const
|
|
2596
|
-
if (Q(
|
|
2601
|
+
let he = d.from;
|
|
2602
|
+
for (; he; ) {
|
|
2603
|
+
const te = f.edges.find((ue) => ue.from === he && !D.has(B(ue)));
|
|
2604
|
+
if (Q(he, te?.label), !te)
|
|
2597
2605
|
break;
|
|
2598
|
-
|
|
2606
|
+
D.add(B(te)), he = te.to;
|
|
2599
2607
|
}
|
|
2600
|
-
for (const
|
|
2601
|
-
const
|
|
2602
|
-
|
|
2608
|
+
for (const te of f.edges) {
|
|
2609
|
+
const ue = B(te);
|
|
2610
|
+
D.has(ue) || (Q(te.from, te.label), Q(te.to, void 0));
|
|
2603
2611
|
}
|
|
2604
2612
|
return A;
|
|
2605
|
-
}), Te =
|
|
2613
|
+
}), Te = M(() => a.value?.nodes ?? []), ne = [
|
|
2606
2614
|
"var(--color-theme-900)",
|
|
2607
2615
|
"var(--color-primary-500)",
|
|
2608
2616
|
"color-mix(in oklch, var(--color-primary-500) 55%, var(--color-theme-500))"
|
|
@@ -2616,194 +2624,194 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2616
2624
|
return E[f % E.length];
|
|
2617
2625
|
}
|
|
2618
2626
|
u(ke, "seriesColor");
|
|
2619
|
-
const be =
|
|
2620
|
-
return (f, E) => e.value ? (g(),
|
|
2627
|
+
const be = M(() => t.inverted ? "rgba(255, 255, 255, 0.95)" : "var(--color-theme-900)"), Ue = M(() => t.inverted ? "rgba(255, 255, 255, 0.6)" : "var(--color-theme-500)"), Qe = M(() => t.inverted ? "rgba(255, 255, 255, 0.45)" : "color-mix(in oklch, var(--color-theme-900) 42%, transparent)"), at = M(() => t.inverted ? "rgba(255, 255, 255, 0.1)" : "color-mix(in oklch, var(--color-theme-900) 8%, transparent)"), Ee = M(() => t.inverted ? "rgba(255, 255, 255, 0.24)" : "color-mix(in oklch, var(--color-theme-900) 18%, transparent)"), it = M(() => t.inverted ? "rgba(255, 255, 255, 0.16)" : "color-mix(in oklch, var(--color-theme-300) 55%, transparent)"), $e = M(() => t.inverted ? "rgba(255, 255, 255, 0.18)" : "color-mix(in oklch, var(--color-theme-900) 16%, transparent)"), C = M(() => t.inverted ? "rgba(255, 255, 255, 0.12)" : "color-mix(in oklch, var(--color-theme-900) 9%, transparent)"), qe = M(() => t.inverted ? "transparent" : "var(--color-theme-0)");
|
|
2628
|
+
return (f, E) => e.value ? (g(), m("section", {
|
|
2621
2629
|
key: 0,
|
|
2622
2630
|
"data-test": "chat-visual",
|
|
2623
2631
|
"data-visual-type": e.value.visualType,
|
|
2624
2632
|
"data-chart-type": n.value?.chartType,
|
|
2625
2633
|
"data-diagram-type": a.value?.diagramType,
|
|
2626
2634
|
class: "my-6 w-full border-y py-5",
|
|
2627
|
-
style:
|
|
2635
|
+
style: ie({ borderColor: it.value }),
|
|
2628
2636
|
"aria-label": e.value.meta.title
|
|
2629
2637
|
}, [
|
|
2630
|
-
|
|
2631
|
-
|
|
2638
|
+
w("header", Mi, [
|
|
2639
|
+
w("h4", {
|
|
2632
2640
|
class: "text-[13px] font-semibold leading-tight",
|
|
2633
|
-
style:
|
|
2634
|
-
},
|
|
2635
|
-
e.value.meta.description ? (g(),
|
|
2641
|
+
style: ie({ color: be.value })
|
|
2642
|
+
}, Y(e.value.meta.title), 5),
|
|
2643
|
+
e.value.meta.description ? (g(), m("p", {
|
|
2636
2644
|
key: 0,
|
|
2637
2645
|
class: "mt-0.5 text-[12px] leading-snug",
|
|
2638
|
-
style:
|
|
2639
|
-
},
|
|
2646
|
+
style: ie({ color: Ue.value })
|
|
2647
|
+
}, Y(e.value.meta.description), 5)) : q("", !0)
|
|
2640
2648
|
]),
|
|
2641
|
-
p.value ? (g(),
|
|
2649
|
+
p.value ? (g(), m("div", {
|
|
2642
2650
|
key: 0,
|
|
2643
2651
|
role: "img",
|
|
2644
2652
|
"aria-label": e.value.meta.title
|
|
2645
2653
|
}, [
|
|
2646
|
-
(g(),
|
|
2654
|
+
(g(), m("svg", {
|
|
2647
2655
|
class: "block h-auto w-full overflow-visible",
|
|
2648
2656
|
viewBox: `0 0 ${R.width} ${R.height}`,
|
|
2649
|
-
style:
|
|
2657
|
+
style: ie({ aspectRatio: `${R.width} / ${R.height}` }),
|
|
2650
2658
|
preserveAspectRatio: "xMidYMid meet",
|
|
2651
2659
|
"aria-hidden": "true"
|
|
2652
2660
|
}, [
|
|
2653
|
-
(g(!0),
|
|
2661
|
+
(g(!0), m(re, null, me(O.value.ticks, (d) => (g(), m("line", {
|
|
2654
2662
|
key: `grid-${d}`,
|
|
2655
2663
|
x1: R.left,
|
|
2656
2664
|
x2: R.width - R.right,
|
|
2657
|
-
y1:
|
|
2658
|
-
y2:
|
|
2665
|
+
y1: Z(d),
|
|
2666
|
+
y2: Z(d),
|
|
2659
2667
|
"stroke-width": "1",
|
|
2660
2668
|
"vector-effect": "non-scaling-stroke",
|
|
2661
|
-
style:
|
|
2662
|
-
}, null, 12,
|
|
2663
|
-
|
|
2664
|
-
(g(!0),
|
|
2669
|
+
style: ie({ stroke: d === 0 ? Ee.value : at.value })
|
|
2670
|
+
}, null, 12, Li))), 128)),
|
|
2671
|
+
w("g", null, [
|
|
2672
|
+
(g(!0), m(re, null, me(O.value.ticks, (d) => (g(), m("text", {
|
|
2665
2673
|
key: `y-${d}`,
|
|
2666
2674
|
x: R.left - 7,
|
|
2667
|
-
y:
|
|
2675
|
+
y: Z(d) + 3,
|
|
2668
2676
|
"text-anchor": "end",
|
|
2669
2677
|
"font-size": "9.5",
|
|
2670
|
-
style:
|
|
2671
|
-
},
|
|
2678
|
+
style: ie({ fill: Qe.value })
|
|
2679
|
+
}, Y(W(d)), 13, Oi))), 128))
|
|
2672
2680
|
]),
|
|
2673
|
-
p.value.chartType === "bar" ? (g(!0),
|
|
2681
|
+
p.value.chartType === "bar" ? (g(!0), m(re, { key: 0 }, me(H.value, (d) => (g(), m("rect", {
|
|
2674
2682
|
key: d.key,
|
|
2675
2683
|
x: d.x,
|
|
2676
2684
|
y: d.y,
|
|
2677
2685
|
width: d.width,
|
|
2678
2686
|
height: d.height,
|
|
2679
2687
|
rx: "2.5",
|
|
2680
|
-
style:
|
|
2681
|
-
}, null, 12,
|
|
2682
|
-
(g(!0),
|
|
2688
|
+
style: ie({ fill: ke(d.seriesIndex) })
|
|
2689
|
+
}, null, 12, Ni))), 128)) : (g(), m(re, { key: 1 }, [
|
|
2690
|
+
(g(!0), m(re, null, me(c.value, (d, A) => (g(), m("g", {
|
|
2683
2691
|
key: d.dataKey
|
|
2684
2692
|
}, [
|
|
2685
|
-
p.value.chartType === "line" ? (g(),
|
|
2693
|
+
p.value.chartType === "line" ? (g(), m("path", {
|
|
2686
2694
|
key: 0,
|
|
2687
|
-
d:
|
|
2695
|
+
d: N(d.dataKey),
|
|
2688
2696
|
fill: "none",
|
|
2689
2697
|
"stroke-width": "2",
|
|
2690
2698
|
"stroke-linecap": "round",
|
|
2691
2699
|
"stroke-linejoin": "round",
|
|
2692
2700
|
"vector-effect": "non-scaling-stroke",
|
|
2693
|
-
style:
|
|
2694
|
-
}, null, 12,
|
|
2695
|
-
(g(!0),
|
|
2701
|
+
style: ie({ stroke: ke(A) })
|
|
2702
|
+
}, null, 12, zi)) : q("", !0),
|
|
2703
|
+
(g(!0), m(re, null, me(o.value, (D, B) => (g(), m(re, {
|
|
2696
2704
|
key: `${d.dataKey}-${B}`
|
|
2697
2705
|
}, [
|
|
2698
|
-
p.value.chartType === "scatter" ? (g(),
|
|
2706
|
+
p.value.chartType === "scatter" ? (g(), m("circle", {
|
|
2699
2707
|
key: 0,
|
|
2700
2708
|
cx: K(B, o.value.length),
|
|
2701
|
-
cy:
|
|
2709
|
+
cy: Z(T(D[d.dataKey]) ?? 0),
|
|
2702
2710
|
r: "2.6",
|
|
2703
|
-
style:
|
|
2704
|
-
}, null, 12,
|
|
2711
|
+
style: ie({ fill: ke(A) })
|
|
2712
|
+
}, null, 12, Pi)) : q("", !0)
|
|
2705
2713
|
], 64))), 128))
|
|
2706
2714
|
]))), 128)),
|
|
2707
|
-
(g(!0),
|
|
2715
|
+
(g(!0), m(re, null, me(je.value, (d) => (g(), m("circle", {
|
|
2708
2716
|
key: `marker-${d.key}`,
|
|
2709
2717
|
cx: d.cx,
|
|
2710
2718
|
cy: d.cy,
|
|
2711
2719
|
r: "3",
|
|
2712
|
-
style:
|
|
2713
|
-
}, null, 12,
|
|
2720
|
+
style: ie({ fill: ke(d.seriesIndex) })
|
|
2721
|
+
}, null, 12, Fi))), 128))
|
|
2714
2722
|
], 64)),
|
|
2715
|
-
(g(!0),
|
|
2723
|
+
(g(!0), m(re, null, me(F.value, (d) => (g(), m("text", {
|
|
2716
2724
|
key: d.key,
|
|
2717
2725
|
x: d.x,
|
|
2718
2726
|
y: R.height - 6,
|
|
2719
2727
|
"text-anchor": d.anchor,
|
|
2720
2728
|
"font-size": "9.5",
|
|
2721
|
-
style:
|
|
2722
|
-
},
|
|
2723
|
-
], 12,
|
|
2724
|
-
De.value.length > 1 || p.value.chartType !== "bar" ? (g(),
|
|
2725
|
-
(g(!0),
|
|
2729
|
+
style: ie({ fill: Qe.value })
|
|
2730
|
+
}, Y(d.label), 13, Bi))), 128))
|
|
2731
|
+
], 12, $i)),
|
|
2732
|
+
De.value.length > 1 || p.value.chartType !== "bar" ? (g(), m("div", Ui, [
|
|
2733
|
+
(g(!0), m(re, null, me(De.value, (d) => (g(), m("div", {
|
|
2726
2734
|
key: d.key,
|
|
2727
2735
|
class: "inline-flex items-center gap-1.5 text-[11.5px] leading-none"
|
|
2728
2736
|
}, [
|
|
2729
|
-
|
|
2737
|
+
w("span", {
|
|
2730
2738
|
class: "size-2.5 shrink-0 rounded-full",
|
|
2731
|
-
style:
|
|
2739
|
+
style: ie({ background: ke(d.seriesIndex) })
|
|
2732
2740
|
}, null, 4),
|
|
2733
|
-
|
|
2734
|
-
style:
|
|
2735
|
-
},
|
|
2736
|
-
|
|
2741
|
+
w("span", {
|
|
2742
|
+
style: ie({ color: Ue.value })
|
|
2743
|
+
}, Y(d.label), 5),
|
|
2744
|
+
w("span", {
|
|
2737
2745
|
class: "font-semibold tabular-nums",
|
|
2738
|
-
style:
|
|
2739
|
-
},
|
|
2746
|
+
style: ie({ color: be.value })
|
|
2747
|
+
}, Y(d.value), 5)
|
|
2740
2748
|
]))), 128))
|
|
2741
2749
|
])) : q("", !0)
|
|
2742
|
-
], 8,
|
|
2743
|
-
(g(!0),
|
|
2750
|
+
], 8, Di)) : _.value ? (g(), m("div", Hi, [
|
|
2751
|
+
(g(!0), m(re, null, me(Xe.value, (d, A) => (g(), m("div", {
|
|
2744
2752
|
key: d.key
|
|
2745
2753
|
}, [
|
|
2746
|
-
|
|
2747
|
-
|
|
2754
|
+
w("div", ji, [
|
|
2755
|
+
w("span", {
|
|
2748
2756
|
class: "truncate font-medium",
|
|
2749
|
-
style:
|
|
2750
|
-
},
|
|
2751
|
-
|
|
2757
|
+
style: ie({ color: be.value })
|
|
2758
|
+
}, Y(d.name), 5),
|
|
2759
|
+
w("span", {
|
|
2752
2760
|
class: "tabular-nums",
|
|
2753
|
-
style:
|
|
2754
|
-
},
|
|
2761
|
+
style: ie({ color: Ue.value })
|
|
2762
|
+
}, Y(Math.round(d.percent * 100)) + "%", 5)
|
|
2755
2763
|
]),
|
|
2756
|
-
|
|
2764
|
+
w("div", {
|
|
2757
2765
|
class: "h-1.5 w-full overflow-hidden rounded-full",
|
|
2758
|
-
style:
|
|
2766
|
+
style: ie({ background: C.value })
|
|
2759
2767
|
}, [
|
|
2760
|
-
|
|
2768
|
+
w("div", {
|
|
2761
2769
|
class: "h-full rounded-full",
|
|
2762
|
-
style:
|
|
2770
|
+
style: ie({ width: `${Math.max(2, d.percent * 100)}%`, background: ke(A) })
|
|
2763
2771
|
}, null, 4)
|
|
2764
2772
|
], 4)
|
|
2765
2773
|
]))), 128))
|
|
2766
|
-
])) : a.value ? (g(),
|
|
2767
|
-
Ge.value.length ? (g(!0),
|
|
2774
|
+
])) : a.value ? (g(), m("div", Gi, [
|
|
2775
|
+
Ge.value.length ? (g(!0), m(re, { key: 0 }, me(Ge.value, (d, A) => (g(), m("div", {
|
|
2768
2776
|
key: d.key,
|
|
2769
2777
|
class: "grid grid-cols-[1.5rem_minmax(0,1fr)] items-start gap-x-2.5"
|
|
2770
2778
|
}, [
|
|
2771
|
-
|
|
2772
|
-
|
|
2779
|
+
w("div", Wi, [
|
|
2780
|
+
w("span", {
|
|
2773
2781
|
class: "grid size-5 place-items-center rounded-full border text-[10px] font-semibold leading-none",
|
|
2774
|
-
style:
|
|
2775
|
-
},
|
|
2776
|
-
A !== Ge.value.length - 1 ? (g(),
|
|
2782
|
+
style: ie({ borderColor: $e.value, color: Ue.value, background: qe.value })
|
|
2783
|
+
}, Y(A + 1), 5),
|
|
2784
|
+
A !== Ge.value.length - 1 ? (g(), m("span", {
|
|
2777
2785
|
key: 0,
|
|
2778
2786
|
class: "w-px flex-1",
|
|
2779
|
-
style:
|
|
2787
|
+
style: ie({ background: $e.value, minHeight: "1.1rem" })
|
|
2780
2788
|
}, null, 4)) : q("", !0)
|
|
2781
2789
|
]),
|
|
2782
|
-
|
|
2783
|
-
|
|
2790
|
+
w("div", qi, [
|
|
2791
|
+
w("div", {
|
|
2784
2792
|
class: "text-[12.5px] font-semibold leading-snug",
|
|
2785
|
-
style:
|
|
2786
|
-
},
|
|
2787
|
-
d.note ? (g(),
|
|
2793
|
+
style: ie({ color: be.value })
|
|
2794
|
+
}, Y(d.label), 5),
|
|
2795
|
+
d.note ? (g(), m("div", {
|
|
2788
2796
|
key: 0,
|
|
2789
2797
|
class: "mt-0.5 text-[11px] leading-snug",
|
|
2790
|
-
style:
|
|
2791
|
-
},
|
|
2798
|
+
style: ie({ color: Ue.value })
|
|
2799
|
+
}, Y(d.note), 5)) : q("", !0)
|
|
2792
2800
|
])
|
|
2793
|
-
]))), 128)) : (g(!0),
|
|
2801
|
+
]))), 128)) : (g(!0), m(re, { key: 1 }, me(Te.value, (d) => (g(), m("div", {
|
|
2794
2802
|
key: d.id,
|
|
2795
2803
|
class: "mb-1.5 rounded-xl border px-2.5 py-2 text-[12px] font-medium leading-tight",
|
|
2796
|
-
style:
|
|
2797
|
-
},
|
|
2804
|
+
style: ie({ borderColor: $e.value, color: be.value })
|
|
2805
|
+
}, Y(d.label), 5))), 128))
|
|
2798
2806
|
])) : q("", !0),
|
|
2799
|
-
e.value.meta.footer ? (g(),
|
|
2807
|
+
e.value.meta.footer ? (g(), m("footer", {
|
|
2800
2808
|
key: 3,
|
|
2801
2809
|
class: "mt-3 text-[11px] leading-snug",
|
|
2802
|
-
style:
|
|
2803
|
-
},
|
|
2804
|
-
], 12,
|
|
2810
|
+
style: ie({ color: Qe.value })
|
|
2811
|
+
}, Y(e.value.meta.footer), 5)) : q("", !0)
|
|
2812
|
+
], 12, Ii)) : q("", !0);
|
|
2805
2813
|
}
|
|
2806
|
-
}),
|
|
2814
|
+
}), Yi = ["innerHTML"], Bt = /* @__PURE__ */ Be({
|
|
2807
2815
|
__name: "ChatRichText",
|
|
2808
2816
|
props: {
|
|
2809
2817
|
text: {},
|
|
@@ -2813,10 +2821,10 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2813
2821
|
setup(i) {
|
|
2814
2822
|
const t = i, e = fs(t.text);
|
|
2815
2823
|
let n;
|
|
2816
|
-
|
|
2824
|
+
Ut(
|
|
2817
2825
|
[() => t.text, () => t.streaming],
|
|
2818
|
-
([b,
|
|
2819
|
-
if (!
|
|
2826
|
+
([b, y]) => {
|
|
2827
|
+
if (!y) {
|
|
2820
2828
|
n !== void 0 && (cancelAnimationFrame(n), n = void 0), e.value = b;
|
|
2821
2829
|
return;
|
|
2822
2830
|
}
|
|
@@ -2828,10 +2836,10 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2828
2836
|
n !== void 0 && cancelAnimationFrame(n);
|
|
2829
2837
|
});
|
|
2830
2838
|
const a = new X.Renderer();
|
|
2831
|
-
a.link = ({ href: b, text:
|
|
2832
|
-
const
|
|
2833
|
-
if (
|
|
2834
|
-
return
|
|
2839
|
+
a.link = ({ href: b, text: y }) => {
|
|
2840
|
+
const O = b.trim();
|
|
2841
|
+
if (!O || O === "#")
|
|
2842
|
+
return y;
|
|
2835
2843
|
let R = !1;
|
|
2836
2844
|
if (typeof window < "u")
|
|
2837
2845
|
try {
|
|
@@ -2839,32 +2847,32 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2839
2847
|
} catch {
|
|
2840
2848
|
R = !1;
|
|
2841
2849
|
}
|
|
2842
|
-
return R ? `<a href="${b}">${
|
|
2850
|
+
return R ? `<a href="${b}">${y}</a>` : `<a href="${b}" target="_blank" rel="noopener noreferrer">${y}</a>`;
|
|
2843
2851
|
}, X.setOptions({ breaks: !0, gfm: !0, renderer: a });
|
|
2844
2852
|
function s(b) {
|
|
2845
2853
|
if (!b) return "";
|
|
2846
|
-
const
|
|
2847
|
-
return
|
|
2854
|
+
const y = X.parse(b, { async: !1 });
|
|
2855
|
+
return Ha.sanitize(y, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2848
2856
|
}
|
|
2849
2857
|
u(s, "renderMarkdown");
|
|
2850
2858
|
function l(b) {
|
|
2851
2859
|
if (typeof b != "string") return null;
|
|
2852
|
-
const
|
|
2853
|
-
return
|
|
2860
|
+
const y = b.trim();
|
|
2861
|
+
return y ? y.slice(0, 80) : null;
|
|
2854
2862
|
}
|
|
2855
2863
|
u(l, "safePayloadString");
|
|
2856
2864
|
function o(b) {
|
|
2857
2865
|
try {
|
|
2858
|
-
const
|
|
2859
|
-
if (!
|
|
2866
|
+
const y = JSON.parse(b);
|
|
2867
|
+
if (!y || typeof y != "object" || Array.isArray(y))
|
|
2860
2868
|
return { topLevelKeys: [], declaredVisualType: null, declaredChartType: null, declaredDiagramType: null, inputType: null };
|
|
2861
|
-
const
|
|
2869
|
+
const O = y;
|
|
2862
2870
|
return {
|
|
2863
|
-
topLevelKeys: Object.keys(
|
|
2864
|
-
declaredVisualType: l(
|
|
2865
|
-
declaredChartType: l(
|
|
2866
|
-
declaredDiagramType: l(
|
|
2867
|
-
inputType: l(
|
|
2871
|
+
topLevelKeys: Object.keys(O).sort().slice(0, 24),
|
|
2872
|
+
declaredVisualType: l(O.visualType),
|
|
2873
|
+
declaredChartType: l(O.chartType),
|
|
2874
|
+
declaredDiagramType: l(O.diagramType),
|
|
2875
|
+
inputType: l(O.type)
|
|
2868
2876
|
};
|
|
2869
2877
|
} catch {
|
|
2870
2878
|
return { topLevelKeys: [], declaredVisualType: null, declaredChartType: null, declaredDiagramType: null, inputType: null };
|
|
@@ -2890,55 +2898,55 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2890
2898
|
}
|
|
2891
2899
|
u(c, "onRichTextAssetError");
|
|
2892
2900
|
function _(b) {
|
|
2893
|
-
const
|
|
2894
|
-
let R = 0, K = 0,
|
|
2895
|
-
for (;
|
|
2896
|
-
const
|
|
2897
|
-
W &&
|
|
2898
|
-
const z =
|
|
2901
|
+
const y = [], O = /```pl-visual[ \t]*\r?\n([\s\S]*?)```/g;
|
|
2902
|
+
let R = 0, K = 0, Z = O.exec(b);
|
|
2903
|
+
for (; Z !== null; ) {
|
|
2904
|
+
const F = b.slice(R, Z.index), W = s(F);
|
|
2905
|
+
W && y.push({ kind: "markdown", key: `md-${K}`, html: W });
|
|
2906
|
+
const z = qs(Z[1].trim());
|
|
2899
2907
|
if (z.ok)
|
|
2900
|
-
|
|
2908
|
+
y.push({ kind: "visual", key: `visual-${K}`, result: z });
|
|
2901
2909
|
else {
|
|
2902
2910
|
typeof console < "u" && console.warn("[pl-visual] parse_failed", {
|
|
2903
2911
|
reason: z.reason,
|
|
2904
2912
|
message: z.message,
|
|
2905
2913
|
hasFallbackMarkdown: !!z.fallbackMarkdown,
|
|
2906
|
-
payloadChars:
|
|
2907
|
-
...o(
|
|
2914
|
+
payloadChars: Z[1].trim().length,
|
|
2915
|
+
...o(Z[1].trim())
|
|
2908
2916
|
});
|
|
2909
|
-
const
|
|
2910
|
-
|
|
2917
|
+
const ee = z.fallbackMarkdown ? s(z.fallbackMarkdown) : "";
|
|
2918
|
+
ee && y.push({ kind: "markdown", key: `visual-${K}`, html: ee });
|
|
2911
2919
|
}
|
|
2912
|
-
R =
|
|
2920
|
+
R = Z.index + Z[0].length, K += 1, Z = O.exec(b);
|
|
2913
2921
|
}
|
|
2914
|
-
const
|
|
2915
|
-
return H &&
|
|
2922
|
+
const N = b.slice(R), H = s(N);
|
|
2923
|
+
return H && y.push({ kind: "markdown", key: `md-${K}`, html: H }), y;
|
|
2916
2924
|
}
|
|
2917
2925
|
u(_, "richTextSegments");
|
|
2918
|
-
const
|
|
2926
|
+
const T = M(() => {
|
|
2919
2927
|
const b = e.value;
|
|
2920
2928
|
return b ? _(b) : [];
|
|
2921
2929
|
});
|
|
2922
|
-
return (b,
|
|
2930
|
+
return (b, y) => (g(), m("div", {
|
|
2923
2931
|
class: "chat-msg-rich break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed",
|
|
2924
2932
|
onErrorCapture: c
|
|
2925
2933
|
}, [
|
|
2926
|
-
(g(!0),
|
|
2927
|
-
key:
|
|
2934
|
+
(g(!0), m(re, null, me(T.value, (O) => (g(), m(re, {
|
|
2935
|
+
key: O.key
|
|
2928
2936
|
}, [
|
|
2929
|
-
|
|
2937
|
+
O.kind === "markdown" ? (g(), m("div", {
|
|
2930
2938
|
key: 0,
|
|
2931
|
-
class:
|
|
2932
|
-
innerHTML:
|
|
2933
|
-
}, null, 10,
|
|
2939
|
+
class: L(["chat-msg-prose", i.inverted ? "chat-msg-prose-invert" : ""]),
|
|
2940
|
+
innerHTML: O.html
|
|
2941
|
+
}, null, 10, Yi)) : (g(), hn(Vi, {
|
|
2934
2942
|
key: 1,
|
|
2935
|
-
result:
|
|
2943
|
+
result: O.result,
|
|
2936
2944
|
inverted: i.inverted
|
|
2937
2945
|
}, null, 8, ["result", "inverted"]))
|
|
2938
2946
|
], 64))), 128))
|
|
2939
2947
|
], 32));
|
|
2940
2948
|
}
|
|
2941
|
-
}),
|
|
2949
|
+
}), Ki = 80, Zi = /* @__PURE__ */ Be({
|
|
2942
2950
|
__name: "ChatScroller",
|
|
2943
2951
|
setup(i, { expose: t }) {
|
|
2944
2952
|
const e = ve(), n = ve();
|
|
@@ -2950,13 +2958,13 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2950
2958
|
u(l, "scrollToBottom");
|
|
2951
2959
|
function o() {
|
|
2952
2960
|
const c = e.value;
|
|
2953
|
-
c && (a = c.scrollHeight - c.scrollTop - c.clientHeight <=
|
|
2961
|
+
c && (a = c.scrollHeight - c.scrollTop - c.clientHeight <= Ki);
|
|
2954
2962
|
}
|
|
2955
2963
|
u(o, "onScroll");
|
|
2956
2964
|
function p() {
|
|
2957
2965
|
a = !0, l();
|
|
2958
2966
|
}
|
|
2959
|
-
return u(p, "pin"), t({ pin: p }),
|
|
2967
|
+
return u(p, "pin"), t({ pin: p }), qt(() => {
|
|
2960
2968
|
requestAnimationFrame(() => {
|
|
2961
2969
|
l(), requestAnimationFrame(l);
|
|
2962
2970
|
}), n.value && (s = new ResizeObserver(() => {
|
|
@@ -2964,59 +2972,59 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
2964
2972
|
}), s.observe(n.value));
|
|
2965
2973
|
}), gs(() => {
|
|
2966
2974
|
s?.disconnect();
|
|
2967
|
-
}), (c, _) => (g(),
|
|
2975
|
+
}), (c, _) => (g(), m("div", {
|
|
2968
2976
|
ref_key: "viewport",
|
|
2969
2977
|
ref: e,
|
|
2970
2978
|
class: "overflow-y-auto overflow-x-hidden min-h-0 flex flex-col [overflow-anchor:none] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
2971
2979
|
onScrollPassive: o
|
|
2972
2980
|
}, [
|
|
2973
|
-
|
|
2981
|
+
w("div", {
|
|
2974
2982
|
ref_key: "content",
|
|
2975
2983
|
ref: n,
|
|
2976
2984
|
class: "flex-1 flex flex-col"
|
|
2977
2985
|
}, [
|
|
2978
|
-
|
|
2986
|
+
gn(c.$slots, "default")
|
|
2979
2987
|
], 512)
|
|
2980
2988
|
], 544));
|
|
2981
2989
|
}
|
|
2982
|
-
}),
|
|
2990
|
+
}), Xi = { class: "@container/chat flex flex-col h-full relative" }, Qi = {
|
|
2983
2991
|
key: 0,
|
|
2984
2992
|
class: "pb-4"
|
|
2985
|
-
},
|
|
2993
|
+
}, Ji = {
|
|
2986
2994
|
key: 0,
|
|
2987
2995
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2988
|
-
},
|
|
2996
|
+
}, er = { class: "relative mb-4 size-20 @sm/chat:size-24" }, tr = ["src", "alt"], nr = ["title"], sr = {
|
|
2989
2997
|
key: 0,
|
|
2990
2998
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2991
|
-
},
|
|
2999
|
+
}, ar = ["data-message-id", "data-message-sender", "data-conversation-id", "data-message-sequence", "data-system-kind", "data-issue-code", "data-issue-bucket", "data-issue-action-label", "data-issue-action-url", "data-streaming"], ir = { class: "max-w-[85%] min-w-0" }, rr = ["href"], lr = ["data-message-id", "data-message-sender", "data-conversation-id", "data-message-sequence", "data-system-kind", "data-issue-code", "data-issue-bucket", "data-streaming"], or = ["data-test", "data-message-id", "data-message-sender", "data-conversation-id", "data-message-sequence", "data-system-kind", "data-streaming"], cr = {
|
|
2992
3000
|
key: 0,
|
|
2993
3001
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2994
|
-
},
|
|
3002
|
+
}, ur = ["src", "alt"], hr = ["src", "alt"], dr = ["src"], pr = ["href"], fr = {
|
|
2995
3003
|
key: 0,
|
|
2996
3004
|
"data-test": "messaging-message-text-part"
|
|
2997
|
-
},
|
|
3005
|
+
}, gr = ["src", "alt", "data-attachment-placement"], mr = ["src", "data-attachment-placement"], xr = ["href", "data-attachment-placement"], kr = ["data-tool-activity-status"], br = { class: "truncate" }, yr = ["data-working-description"], vr = { class: "truncate" }, wr = ["data-tool-activity-status"], Tr = { class: "truncate" }, Sr = ["data-issue-code"], Ar = ["href"], _r = {
|
|
2998
3006
|
key: 4,
|
|
2999
3007
|
"data-test": "messaging-thinking-indicator",
|
|
3000
3008
|
class: "flex gap-2 justify-start items-center mb-4"
|
|
3001
|
-
},
|
|
3009
|
+
}, Er = ["src", "alt"], Rr = {
|
|
3002
3010
|
key: 0,
|
|
3003
3011
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
3004
|
-
},
|
|
3012
|
+
}, Cr = ["src", "alt"], Ir = { class: "max-w-20 truncate" }, Mr = ["onClick"], Dr = {
|
|
3005
3013
|
key: 0,
|
|
3006
3014
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
3007
|
-
},
|
|
3015
|
+
}, $r = ["disabled", "aria-label", "title"], Lr = {
|
|
3008
3016
|
key: 0,
|
|
3009
3017
|
class: "i-svg-spinners-ring-resize size-4"
|
|
3010
|
-
},
|
|
3018
|
+
}, Or = {
|
|
3011
3019
|
key: 1,
|
|
3012
3020
|
class: "i-tabler-paperclip size-5"
|
|
3013
|
-
},
|
|
3021
|
+
}, Nr = { class: "sr-only" }, zr = ["placeholder", "disabled"], Pr = ["data-composer-action", "disabled", "aria-label", "title"], Fr = {
|
|
3014
3022
|
key: 0,
|
|
3015
3023
|
class: "i-tabler-player-stop-filled size-4"
|
|
3016
|
-
},
|
|
3024
|
+
}, Br = {
|
|
3017
3025
|
key: 1,
|
|
3018
3026
|
class: "i-tabler-arrow-up size-5"
|
|
3019
|
-
},
|
|
3027
|
+
}, Ur = { class: "sr-only" }, Jr = /* @__PURE__ */ Be({
|
|
3020
3028
|
__name: "ElAgentChat",
|
|
3021
3029
|
props: {
|
|
3022
3030
|
chatController: {},
|
|
@@ -3033,502 +3041,502 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3033
3041
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
3034
3042
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
3035
3043
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
3036
|
-
}, e =
|
|
3037
|
-
const
|
|
3038
|
-
return i.scope === "org" && i.scopeName && (
|
|
3044
|
+
}, e = M(() => {
|
|
3045
|
+
const v = { ...t[i.scope] };
|
|
3046
|
+
return i.scope === "org" && i.scopeName && (v.label = i.scopeName, v.tooltip = `Visible to ${i.scopeName} members`), v;
|
|
3039
3047
|
}), n = ve(""), a = ve(!1), s = ve(), l = ve(), o = ve(), p = ve([]), c = ve(!1);
|
|
3040
|
-
function _(
|
|
3041
|
-
return
|
|
3048
|
+
function _(v) {
|
|
3049
|
+
return v ? /\[[^\]]+\]\([^)]+\)/.test(v) : !1;
|
|
3042
3050
|
}
|
|
3043
3051
|
u(_, "containsMarkdownLink");
|
|
3044
|
-
function
|
|
3045
|
-
return
|
|
3052
|
+
function T(v) {
|
|
3053
|
+
return v.sender === "system" && (!!v.issue || v.id === ne.value);
|
|
3046
3054
|
}
|
|
3047
|
-
u(
|
|
3048
|
-
function b(
|
|
3049
|
-
const
|
|
3050
|
-
return !
|
|
3055
|
+
u(T, "isSystemExplainerMessage");
|
|
3056
|
+
function b(v, k) {
|
|
3057
|
+
const x = v[k], P = v[k + 1];
|
|
3058
|
+
return !P || P.sender !== x.sender;
|
|
3051
3059
|
}
|
|
3052
3060
|
u(b, "shouldShowAvatar");
|
|
3053
|
-
const
|
|
3054
|
-
function
|
|
3055
|
-
if (!
|
|
3061
|
+
const y = M(() => i.chatController?.textState.value), O = M(() => y.value?.isConnected ?? !1), R = M(() => y.value?.isThinking ?? !1), K = M(() => y.value?.connectionStatus === "disconnected" && !!y.value?.error), Z = M(() => y.value?.connectionStatus !== "connected" && !y.value?.error), N = M(() => y.value?.error), H = M(() => i.chatController?.sharedMessages.value ?? []), F = M(() => y.value?.workingDescription?.trim() || void 0), W = M(() => R.value ? y.value?.toolActivities ?? [] : []), z = M(() => ee(W.value));
|
|
3062
|
+
function ee(v) {
|
|
3063
|
+
if (!v?.length)
|
|
3056
3064
|
return;
|
|
3057
|
-
const k = De(
|
|
3065
|
+
const k = De(v, "started");
|
|
3058
3066
|
if (k)
|
|
3059
3067
|
return { status: "started", icon: "i-tabler-loader-2 animate-spin", label: k.label };
|
|
3060
|
-
const
|
|
3061
|
-
if (
|
|
3062
|
-
return { status: "failed", icon: "i-tabler-alert-circle text-theme-500", label:
|
|
3063
|
-
const
|
|
3064
|
-
if (
|
|
3068
|
+
const x = De(v, "failed");
|
|
3069
|
+
if (x)
|
|
3070
|
+
return { status: "failed", icon: "i-tabler-alert-circle text-theme-500", label: x.label };
|
|
3071
|
+
const P = v.filter(($) => $.status === "completed").length;
|
|
3072
|
+
if (P > 0)
|
|
3065
3073
|
return {
|
|
3066
3074
|
status: "completed",
|
|
3067
3075
|
icon: "i-tabler-circle-check-filled text-primary-500",
|
|
3068
|
-
label:
|
|
3076
|
+
label: P === 1 ? "1 action completed" : `${P} actions completed`
|
|
3069
3077
|
};
|
|
3070
3078
|
}
|
|
3071
|
-
u(
|
|
3072
|
-
function De(
|
|
3073
|
-
for (let
|
|
3074
|
-
const
|
|
3075
|
-
if (
|
|
3076
|
-
return
|
|
3079
|
+
u(ee, "toolActivityLineFor");
|
|
3080
|
+
function De(v, k) {
|
|
3081
|
+
for (let x = v.length - 1; x >= 0; x--) {
|
|
3082
|
+
const P = v[x];
|
|
3083
|
+
if (P?.status === k)
|
|
3084
|
+
return P;
|
|
3077
3085
|
}
|
|
3078
3086
|
}
|
|
3079
3087
|
u(De, "lastToolActivityWithStatus");
|
|
3080
|
-
function je(
|
|
3081
|
-
return
|
|
3088
|
+
function je(v, k) {
|
|
3089
|
+
return v.placement?.kind !== "inline" || !Number.isFinite(v.placement.offset) ? null : Math.max(0, Math.min(k.length, Math.trunc(v.placement.offset)));
|
|
3082
3090
|
}
|
|
3083
3091
|
u(je, "inlineOffset");
|
|
3084
|
-
function Xe(
|
|
3085
|
-
return
|
|
3092
|
+
function Xe(v, k) {
|
|
3093
|
+
return v.mediaId || `${v.src}:${k}`;
|
|
3086
3094
|
}
|
|
3087
3095
|
u(Xe, "attachmentKey");
|
|
3088
|
-
function st(
|
|
3089
|
-
return (
|
|
3096
|
+
function st(v) {
|
|
3097
|
+
return (v.attachments ?? []).map((k, x) => ({ attachment: k, index: x })).filter(({ attachment: k }) => je(k, v.text) === null);
|
|
3090
3098
|
}
|
|
3091
3099
|
u(st, "blockAttachmentsForMessage");
|
|
3092
|
-
function Ge(
|
|
3093
|
-
const k =
|
|
3094
|
-
if (
|
|
3095
|
-
return k ? [{ kind: "text", key: `${
|
|
3096
|
-
const
|
|
3097
|
-
if (
|
|
3098
|
-
return k ? [{ kind: "text", key: `${
|
|
3099
|
-
const
|
|
3100
|
-
let
|
|
3101
|
-
for (const se of
|
|
3102
|
-
se.offset >
|
|
3100
|
+
function Ge(v) {
|
|
3101
|
+
const k = v.text ?? "";
|
|
3102
|
+
if (v.sender !== "agent")
|
|
3103
|
+
return k ? [{ kind: "text", key: `${v.id}:text`, text: k }] : [];
|
|
3104
|
+
const x = (v.attachments ?? []).map((se, Se) => ({ attachment: se, index: Se, offset: je(se, k) })).filter((se) => se.offset !== null).sort((se, Se) => se.offset - Se.offset || se.index - Se.index);
|
|
3105
|
+
if (x.length === 0)
|
|
3106
|
+
return k ? [{ kind: "text", key: `${v.id}:text`, text: k }] : [];
|
|
3107
|
+
const P = [];
|
|
3108
|
+
let $ = 0;
|
|
3109
|
+
for (const se of x)
|
|
3110
|
+
se.offset > $ && P.push({
|
|
3103
3111
|
kind: "text",
|
|
3104
|
-
key: `${
|
|
3105
|
-
text: k.slice(
|
|
3106
|
-
}),
|
|
3112
|
+
key: `${v.id}:text:${$}`,
|
|
3113
|
+
text: k.slice($, se.offset)
|
|
3114
|
+
}), P.push({
|
|
3107
3115
|
kind: "attachment",
|
|
3108
|
-
key: `${
|
|
3116
|
+
key: `${v.id}:attachment:${Xe(se.attachment, se.index)}`,
|
|
3109
3117
|
attachment: se.attachment,
|
|
3110
3118
|
placement: "inline"
|
|
3111
|
-
}),
|
|
3112
|
-
return
|
|
3119
|
+
}), $ = se.offset;
|
|
3120
|
+
return $ < k.length && P.push({
|
|
3113
3121
|
kind: "text",
|
|
3114
|
-
key: `${
|
|
3115
|
-
text: k.slice(
|
|
3116
|
-
}),
|
|
3122
|
+
key: `${v.id}:text:${$}`,
|
|
3123
|
+
text: k.slice($)
|
|
3124
|
+
}), P;
|
|
3117
3125
|
}
|
|
3118
3126
|
u(Ge, "messageRenderParts");
|
|
3119
|
-
const Te =
|
|
3127
|
+
const Te = M(() => y.value?.transientIssue), ne = M(() => {
|
|
3120
3128
|
if (!R.value) return;
|
|
3121
|
-
const
|
|
3129
|
+
const v = H.value, k = v[v.length - 1];
|
|
3122
3130
|
return k?.sender === "agent" || k?.sender === "system" ? k.id : void 0;
|
|
3123
|
-
}), We =
|
|
3124
|
-
() =>
|
|
3125
|
-
),
|
|
3126
|
-
|
|
3127
|
-
i.chatController &&
|
|
3131
|
+
}), We = M(() => !R.value || F.value ? !1 : ne.value === void 0), ke = M(() => y.value?.sendBlockedReason), be = M(() => !O.value || ke.value !== void 0), Ue = M(() => K.value ? "Agent is offline" : Z.value ? "Connecting..." : ke.value === "agent_deleted" ? "This assistant was deleted" : ke.value === "account" ? "Open billing to keep chatting" : "Message"), Qe = M(() => (n.value.trim() || p.value.length > 0) && !be.value && !c.value && !R.value), at = M(() => !!i.chatController && R.value && !c.value), Ee = M(() => at.value ? "stop" : Qe.value ? "send" : "idle"), it = M(() => Ee.value !== "idle"), $e = M(() => Ee.value === "stop" ? "Stop reply" : "Send message"), C = M(() => i.variant === "light"), qe = M(
|
|
3132
|
+
() => C.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
3133
|
+
), f = M(() => C.value ? "text-theme-300" : "text-white/30");
|
|
3134
|
+
qt(async () => {
|
|
3135
|
+
i.chatController && !O.value && await i.chatController.startTextConversation();
|
|
3128
3136
|
});
|
|
3129
|
-
async function
|
|
3130
|
-
const
|
|
3131
|
-
if (!
|
|
3137
|
+
async function E() {
|
|
3138
|
+
const v = n.value.trim(), k = p.value.length > 0;
|
|
3139
|
+
if (!v && !k || !i.chatController || be.value || c.value || R.value)
|
|
3132
3140
|
return;
|
|
3133
|
-
const
|
|
3134
|
-
n.value = "", p.value = [], l.value && (l.value.style.height = "auto", l.value.focus()), s.value?.pin(), await i.chatController.sendChatMessage(
|
|
3141
|
+
const x = n.value, P = k ? [...p.value] : void 0;
|
|
3142
|
+
n.value = "", p.value = [], l.value && (l.value.style.height = "auto", l.value.focus()), s.value?.pin(), await i.chatController.sendChatMessage(x, P);
|
|
3135
3143
|
}
|
|
3136
|
-
u(
|
|
3137
|
-
async function
|
|
3144
|
+
u(E, "sendMessage");
|
|
3145
|
+
async function d() {
|
|
3138
3146
|
!i.chatController || !at.value || await i.chatController.stopChatTurn();
|
|
3139
3147
|
}
|
|
3140
|
-
u(
|
|
3141
|
-
async function
|
|
3148
|
+
u(d, "stopMessage");
|
|
3149
|
+
async function A() {
|
|
3142
3150
|
if (Ee.value === "stop") {
|
|
3143
|
-
await
|
|
3151
|
+
await d();
|
|
3144
3152
|
return;
|
|
3145
3153
|
}
|
|
3146
|
-
Ee.value === "send" && await
|
|
3154
|
+
Ee.value === "send" && await E();
|
|
3147
3155
|
}
|
|
3148
|
-
u(
|
|
3149
|
-
async function
|
|
3150
|
-
|
|
3156
|
+
u(A, "handleComposerAction");
|
|
3157
|
+
async function D(v) {
|
|
3158
|
+
v.key === "Enter" && !v.shiftKey && (v.preventDefault(), await E());
|
|
3151
3159
|
}
|
|
3152
|
-
u(
|
|
3153
|
-
function
|
|
3160
|
+
u(D, "handleKeydown");
|
|
3161
|
+
function B() {
|
|
3154
3162
|
l.value && (l.value.style.height = "auto", l.value.style.height = `${Math.min(l.value.scrollHeight, 150)}px`);
|
|
3155
3163
|
}
|
|
3156
|
-
u(
|
|
3157
|
-
function
|
|
3164
|
+
u(B, "adjustTextareaHeight"), Ut(n, () => Bs(() => B()));
|
|
3165
|
+
function Q() {
|
|
3158
3166
|
o.value?.click();
|
|
3159
3167
|
}
|
|
3160
|
-
u(
|
|
3161
|
-
async function
|
|
3162
|
-
const k =
|
|
3163
|
-
if (!(!
|
|
3168
|
+
u(Q, "triggerFileInput");
|
|
3169
|
+
async function he(v) {
|
|
3170
|
+
const k = v.target, x = k.files?.[0];
|
|
3171
|
+
if (!(!x || !i.uploadFn)) {
|
|
3164
3172
|
c.value = !0;
|
|
3165
3173
|
try {
|
|
3166
|
-
const
|
|
3167
|
-
p.value = [...p.value,
|
|
3168
|
-
} catch (
|
|
3169
|
-
const
|
|
3170
|
-
i.chatController?.notify(`Upload failed — ${
|
|
3174
|
+
const P = await i.uploadFn(x);
|
|
3175
|
+
p.value = [...p.value, P];
|
|
3176
|
+
} catch (P) {
|
|
3177
|
+
const $ = P instanceof Error ? P.message : "Couldn't attach that file.";
|
|
3178
|
+
i.chatController?.notify(`Upload failed — ${$}`);
|
|
3171
3179
|
} finally {
|
|
3172
3180
|
c.value = !1, k.value = "";
|
|
3173
3181
|
}
|
|
3174
3182
|
}
|
|
3175
3183
|
}
|
|
3176
|
-
u(
|
|
3177
|
-
function
|
|
3178
|
-
p.value = p.value.filter((k,
|
|
3184
|
+
u(he, "handleFileSelect");
|
|
3185
|
+
function te(v) {
|
|
3186
|
+
p.value = p.value.filter((k, x) => x !== v);
|
|
3179
3187
|
}
|
|
3180
|
-
u(
|
|
3181
|
-
function
|
|
3188
|
+
u(te, "removeAttachment");
|
|
3189
|
+
function ue(v, k) {
|
|
3182
3190
|
if (k === 0) {
|
|
3183
|
-
const
|
|
3184
|
-
return
|
|
3185
|
-
}
|
|
3186
|
-
const
|
|
3187
|
-
if (!
|
|
3188
|
-
const
|
|
3189
|
-
return new Date(
|
|
3190
|
-
}
|
|
3191
|
-
u(
|
|
3192
|
-
function
|
|
3193
|
-
const k = /* @__PURE__ */ new Date(),
|
|
3194
|
-
|
|
3195
|
-
const
|
|
3196
|
-
if (
|
|
3197
|
-
if (
|
|
3198
|
-
const Se =
|
|
3199
|
-
return `${
|
|
3191
|
+
const rt = v[k];
|
|
3192
|
+
return rt?.timestamp ? pe(new Date(rt.timestamp)) : null;
|
|
3193
|
+
}
|
|
3194
|
+
const x = v[k - 1], P = v[k];
|
|
3195
|
+
if (!x?.timestamp || !P?.timestamp) return null;
|
|
3196
|
+
const $ = new Date(x.timestamp).getTime();
|
|
3197
|
+
return new Date(P.timestamp).getTime() - $ > 36e5 ? pe(new Date(P.timestamp)) : null;
|
|
3198
|
+
}
|
|
3199
|
+
u(ue, "shouldShowTimeDivider");
|
|
3200
|
+
function pe(v) {
|
|
3201
|
+
const k = /* @__PURE__ */ new Date(), x = v.toDateString() === k.toDateString(), P = new Date(k);
|
|
3202
|
+
P.setDate(P.getDate() - 1);
|
|
3203
|
+
const $ = v.toDateString() === P.toDateString(), se = v.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
3204
|
+
if (x) return se;
|
|
3205
|
+
if ($) return `Yesterday, ${se}`;
|
|
3206
|
+
const Se = v.getFullYear() === k.getFullYear();
|
|
3207
|
+
return `${v.toLocaleDateString("en-US", {
|
|
3200
3208
|
weekday: "long",
|
|
3201
3209
|
month: "short",
|
|
3202
3210
|
day: "numeric",
|
|
3203
3211
|
...Se ? {} : { year: "numeric" }
|
|
3204
3212
|
})}, ${se}`;
|
|
3205
3213
|
}
|
|
3206
|
-
return u(
|
|
3207
|
-
|
|
3208
|
-
|
|
3214
|
+
return u(pe, "formatTimeDivider"), (v, k) => (g(), m("div", Xi, [
|
|
3215
|
+
C.value ? q("", !0) : (g(), m("div", Qi, [
|
|
3216
|
+
ht(ha, {
|
|
3209
3217
|
agent: i.agent,
|
|
3210
|
-
"is-online":
|
|
3218
|
+
"is-online": O.value
|
|
3211
3219
|
}, null, 8, ["agent", "is-online"])
|
|
3212
3220
|
])),
|
|
3213
|
-
K.value ? (g(),
|
|
3221
|
+
K.value ? (g(), m("div", {
|
|
3214
3222
|
key: 1,
|
|
3215
|
-
class:
|
|
3223
|
+
class: L(["py-16 flex flex-col items-center justify-center gap-3 text-sm", C.value ? "text-theme-400" : "text-white/60"])
|
|
3216
3224
|
}, [
|
|
3217
|
-
|
|
3218
|
-
class:
|
|
3225
|
+
w("i", {
|
|
3226
|
+
class: L(["i-heroicons-cloud-arrow-down size-8", C.value ? "text-theme-300" : "text-white/40"])
|
|
3219
3227
|
}, null, 2),
|
|
3220
|
-
|
|
3221
|
-
], 2)) :
|
|
3228
|
+
w("span", null, Y(N.value), 1)
|
|
3229
|
+
], 2)) : Z.value ? (g(), m("div", {
|
|
3222
3230
|
key: 2,
|
|
3223
|
-
class:
|
|
3231
|
+
class: L(["py-16 flex flex-col items-center justify-center gap-2 text-sm", C.value ? "text-theme-400" : "text-theme-600"])
|
|
3224
3232
|
}, [
|
|
3225
|
-
|
|
3226
|
-
], 2)) : i.setupHint ? (g(),
|
|
3233
|
+
ht(Gn, { class: "size-4" })
|
|
3234
|
+
], 2)) : i.setupHint ? (g(), m("div", {
|
|
3227
3235
|
key: 3,
|
|
3228
|
-
class:
|
|
3236
|
+
class: L(["flex items-center justify-center gap-1.5 py-2 text-[11px]", f.value])
|
|
3229
3237
|
}, [
|
|
3230
|
-
k[10] || (k[10] =
|
|
3231
|
-
|
|
3238
|
+
k[10] || (k[10] = w("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
3239
|
+
w("span", null, Y(i.setupHint), 1)
|
|
3232
3240
|
], 2)) : q("", !0),
|
|
3233
|
-
|
|
3241
|
+
ht(Zi, {
|
|
3234
3242
|
ref_key: "chatScroller",
|
|
3235
3243
|
ref: s,
|
|
3236
3244
|
class: "flex-1"
|
|
3237
3245
|
}, {
|
|
3238
3246
|
default: Us(() => [
|
|
3239
|
-
|
|
3240
|
-
class:
|
|
3247
|
+
w("div", {
|
|
3248
|
+
class: L(H.value.length === 0 ? "flex-1 flex flex-col items-center justify-center px-3" : "pt-4 pb-[120px] px-3 space-y-2")
|
|
3241
3249
|
}, [
|
|
3242
|
-
H.value.length === 0 && !
|
|
3243
|
-
|
|
3244
|
-
|
|
3250
|
+
H.value.length === 0 && !Z.value && !K.value ? (g(), m("div", Ji, [
|
|
3251
|
+
w("div", er, [
|
|
3252
|
+
w("img", {
|
|
3245
3253
|
src: i.agent.avatarUrl.value,
|
|
3246
3254
|
alt: i.agent.displayName.value,
|
|
3247
|
-
class:
|
|
3248
|
-
}, null, 10,
|
|
3249
|
-
|
|
3255
|
+
class: L(["size-full rounded-full object-cover ring-1", C.value ? "ring-black/5" : "ring-white/10"])
|
|
3256
|
+
}, null, 10, tr),
|
|
3257
|
+
O.value ? (g(), m("span", {
|
|
3250
3258
|
key: 0,
|
|
3251
|
-
class:
|
|
3259
|
+
class: L(["absolute top-[85%] left-[85%] -translate-x-1/2 -translate-y-1/2 size-[18%] min-w-2.5 min-h-2.5 flex items-center justify-center rounded-full", C.value ? "bg-white" : "bg-theme-900"])
|
|
3252
3260
|
}, [...k[11] || (k[11] = [
|
|
3253
|
-
|
|
3261
|
+
w("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
3254
3262
|
])], 2)) : q("", !0)
|
|
3255
3263
|
]),
|
|
3256
|
-
|
|
3257
|
-
class:
|
|
3258
|
-
},
|
|
3259
|
-
|
|
3260
|
-
class:
|
|
3261
|
-
},
|
|
3262
|
-
|
|
3263
|
-
class:
|
|
3264
|
+
w("div", {
|
|
3265
|
+
class: L(["text-base @sm/chat:text-lg font-semibold", C.value ? "text-theme-900" : "text-white"])
|
|
3266
|
+
}, Y(i.agent.displayName.value), 3),
|
|
3267
|
+
w("p", {
|
|
3268
|
+
class: L(["mt-1 text-center text-xs @sm/chat:text-sm", f.value])
|
|
3269
|
+
}, Y(i.emptyStateMessage || "Type your message to get started."), 3),
|
|
3270
|
+
w("div", {
|
|
3271
|
+
class: L(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", C.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
3264
3272
|
title: e.value.tooltip
|
|
3265
3273
|
}, [
|
|
3266
|
-
|
|
3267
|
-
class:
|
|
3274
|
+
w("i", {
|
|
3275
|
+
class: L([e.value.icon, "size-3"])
|
|
3268
3276
|
}, null, 2),
|
|
3269
|
-
|
|
3270
|
-
], 10,
|
|
3277
|
+
w("span", null, Y(e.value.label), 1)
|
|
3278
|
+
], 10, nr)
|
|
3271
3279
|
])) : q("", !0),
|
|
3272
|
-
(g(!0),
|
|
3273
|
-
key:
|
|
3280
|
+
(g(!0), m(re, null, me(H.value, (x, P) => (g(), m(re, {
|
|
3281
|
+
key: x.id
|
|
3274
3282
|
}, [
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
class:
|
|
3283
|
+
ue(H.value, P) ? (g(), m("div", sr, [
|
|
3284
|
+
w("div", {
|
|
3285
|
+
class: L(["flex-1 h-px", qe.value])
|
|
3278
3286
|
}, null, 2),
|
|
3279
|
-
|
|
3280
|
-
class:
|
|
3281
|
-
},
|
|
3282
|
-
|
|
3283
|
-
class:
|
|
3287
|
+
w("span", {
|
|
3288
|
+
class: L(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", f.value])
|
|
3289
|
+
}, Y(ue(H.value, P)), 3),
|
|
3290
|
+
w("div", {
|
|
3291
|
+
class: L(["flex-1 h-px", qe.value])
|
|
3284
3292
|
}, null, 2)
|
|
3285
3293
|
])) : q("", !0),
|
|
3286
|
-
|
|
3294
|
+
T(x) ? (g(), m("div", {
|
|
3287
3295
|
key: 1,
|
|
3288
3296
|
"data-test": "messaging-system-msg",
|
|
3289
|
-
"data-message-id":
|
|
3290
|
-
"data-message-sender":
|
|
3291
|
-
"data-conversation-id":
|
|
3292
|
-
"data-message-sequence":
|
|
3293
|
-
"data-system-kind":
|
|
3294
|
-
"data-issue-code":
|
|
3295
|
-
"data-issue-bucket":
|
|
3296
|
-
"data-issue-action-label":
|
|
3297
|
-
"data-issue-action-url":
|
|
3298
|
-
"data-streaming":
|
|
3297
|
+
"data-message-id": x.id,
|
|
3298
|
+
"data-message-sender": x.sender,
|
|
3299
|
+
"data-conversation-id": x.conversationId,
|
|
3300
|
+
"data-message-sequence": x.sequence,
|
|
3301
|
+
"data-system-kind": x.systemKind,
|
|
3302
|
+
"data-issue-code": x.issue?.code,
|
|
3303
|
+
"data-issue-bucket": x.issue?.bucket,
|
|
3304
|
+
"data-issue-action-label": x.issue?.actionLabel,
|
|
3305
|
+
"data-issue-action-url": x.issue?.actionUrl,
|
|
3306
|
+
"data-streaming": x.id === ne.value ? "true" : void 0,
|
|
3299
3307
|
class: "flex gap-2 items-end justify-start mb-4"
|
|
3300
3308
|
}, [
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
class:
|
|
3309
|
+
w("div", ir, [
|
|
3310
|
+
w("div", {
|
|
3311
|
+
class: L(["mb-1 pl-1 text-[11px] font-medium", C.value ? "text-theme-500" : "text-white/45"])
|
|
3304
3312
|
}, " System Message ", 2),
|
|
3305
|
-
|
|
3306
|
-
class:
|
|
3313
|
+
w("div", {
|
|
3314
|
+
class: L(["rounded-2xl rounded-bl-[4px] px-3.5 py-2 border system-msg-content", C.value ? "bg-theme-100 border-theme-200 text-theme-800" : "bg-white/[0.18] border-white/15 text-white/90"])
|
|
3307
3315
|
}, [
|
|
3308
|
-
|
|
3316
|
+
x.text ? (g(), hn(Bt, {
|
|
3309
3317
|
key: 0,
|
|
3310
|
-
text:
|
|
3311
|
-
inverted: !
|
|
3312
|
-
streaming:
|
|
3313
|
-
onClick: k[0] || (k[0] =
|
|
3318
|
+
text: x.text,
|
|
3319
|
+
inverted: !C.value,
|
|
3320
|
+
streaming: x.id === ne.value,
|
|
3321
|
+
onClick: k[0] || (k[0] = At(() => {
|
|
3314
3322
|
}, ["stop"]))
|
|
3315
|
-
}, null, 8, ["text", "inverted", "streaming"])) :
|
|
3323
|
+
}, null, 8, ["text", "inverted", "streaming"])) : x.issue?.help ? (g(), hn(Bt, {
|
|
3316
3324
|
key: 1,
|
|
3317
|
-
text:
|
|
3318
|
-
inverted: !
|
|
3325
|
+
text: x.issue.help,
|
|
3326
|
+
inverted: !C.value
|
|
3319
3327
|
}, null, 8, ["text", "inverted"])) : q("", !0),
|
|
3320
|
-
|
|
3328
|
+
x.issue?.actionUrl && !_(x.text) ? (g(), m("a", {
|
|
3321
3329
|
key: 2,
|
|
3322
|
-
href:
|
|
3330
|
+
href: x.issue.actionUrl,
|
|
3323
3331
|
"data-test": "messaging-system-msg-action",
|
|
3324
|
-
class:
|
|
3325
|
-
onClick: k[1] || (k[1] =
|
|
3332
|
+
class: L(["mt-2 text-[12px] font-medium inline-flex items-center gap-1", C.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"]),
|
|
3333
|
+
onClick: k[1] || (k[1] = At(() => {
|
|
3326
3334
|
}, ["stop"]))
|
|
3327
3335
|
}, [
|
|
3328
|
-
|
|
3329
|
-
k[12] || (k[12] =
|
|
3330
|
-
], 10,
|
|
3336
|
+
_t(Y(x.issue.actionLabel) + " ", 1),
|
|
3337
|
+
k[12] || (k[12] = w("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
3338
|
+
], 10, rr)) : q("", !0)
|
|
3331
3339
|
], 2)
|
|
3332
3340
|
])
|
|
3333
|
-
], 8,
|
|
3341
|
+
], 8, ar)) : x.sender === "system" ? (g(), m("div", {
|
|
3334
3342
|
key: 2,
|
|
3335
3343
|
"data-test": "messaging-system-status-msg",
|
|
3336
|
-
"data-message-id":
|
|
3337
|
-
"data-message-sender":
|
|
3338
|
-
"data-conversation-id":
|
|
3339
|
-
"data-message-sequence":
|
|
3340
|
-
"data-system-kind":
|
|
3341
|
-
"data-issue-code":
|
|
3342
|
-
"data-issue-bucket":
|
|
3343
|
-
"data-streaming":
|
|
3344
|
-
class:
|
|
3344
|
+
"data-message-id": x.id,
|
|
3345
|
+
"data-message-sender": x.sender,
|
|
3346
|
+
"data-conversation-id": x.conversationId,
|
|
3347
|
+
"data-message-sequence": x.sequence,
|
|
3348
|
+
"data-system-kind": x.systemKind,
|
|
3349
|
+
"data-issue-code": x.issue?.code,
|
|
3350
|
+
"data-issue-bucket": x.issue?.bucket,
|
|
3351
|
+
"data-streaming": x.id === ne.value ? "true" : void 0,
|
|
3352
|
+
class: L(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", C.value ? "text-theme-500" : "text-white/60"])
|
|
3345
3353
|
}, [
|
|
3346
|
-
k[13] || (k[13] =
|
|
3347
|
-
|
|
3348
|
-
text:
|
|
3349
|
-
inverted: !
|
|
3350
|
-
onClick: k[2] || (k[2] =
|
|
3354
|
+
k[13] || (k[13] = w("i", { class: "i-tabler-info-circle size-4 mt-0.5 shrink-0" }, null, -1)),
|
|
3355
|
+
ht(Bt, {
|
|
3356
|
+
text: x.text,
|
|
3357
|
+
inverted: !C.value,
|
|
3358
|
+
onClick: k[2] || (k[2] = At(() => {
|
|
3351
3359
|
}, ["stop"]))
|
|
3352
3360
|
}, null, 8, ["text", "inverted"])
|
|
3353
|
-
], 10,
|
|
3361
|
+
], 10, lr)) : (g(), m("div", {
|
|
3354
3362
|
key: 3,
|
|
3355
|
-
"data-test":
|
|
3356
|
-
"data-message-id":
|
|
3357
|
-
"data-message-sender":
|
|
3358
|
-
"data-conversation-id":
|
|
3359
|
-
"data-message-sequence":
|
|
3360
|
-
"data-system-kind":
|
|
3361
|
-
"data-streaming":
|
|
3362
|
-
class:
|
|
3363
|
-
"justify-end":
|
|
3364
|
-
"justify-start":
|
|
3363
|
+
"data-test": x.sender === "agent" ? "messaging-assistant-msg" : x.sender === "user" ? "messaging-user-msg" : void 0,
|
|
3364
|
+
"data-message-id": x.id,
|
|
3365
|
+
"data-message-sender": x.sender,
|
|
3366
|
+
"data-conversation-id": x.conversationId,
|
|
3367
|
+
"data-message-sequence": x.sequence,
|
|
3368
|
+
"data-system-kind": x.systemKind,
|
|
3369
|
+
"data-streaming": x.id === ne.value ? "true" : void 0,
|
|
3370
|
+
class: L(["flex gap-2 items-end", {
|
|
3371
|
+
"justify-end": x.sender === "user",
|
|
3372
|
+
"justify-start": x.sender === "agent",
|
|
3365
3373
|
// Group-aware rhythm: tight (space-y) within a speaker's turn,
|
|
3366
3374
|
// generous at the boundary between speakers (end of a group).
|
|
3367
|
-
"mb-6": b(H.value,
|
|
3375
|
+
"mb-6": b(H.value, P)
|
|
3368
3376
|
}])
|
|
3369
3377
|
}, [
|
|
3370
|
-
|
|
3371
|
-
b(H.value,
|
|
3378
|
+
x.sender === "agent" ? (g(), m("div", cr, [
|
|
3379
|
+
b(H.value, P) ? (g(), m("img", {
|
|
3372
3380
|
key: 0,
|
|
3373
3381
|
src: i.agent.avatarUrl.value,
|
|
3374
3382
|
alt: i.agent.displayName.value,
|
|
3375
|
-
class:
|
|
3376
|
-
}, null, 10,
|
|
3383
|
+
class: L(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", C.value ? "ring-1 ring-black/5" : ""])
|
|
3384
|
+
}, null, 10, ur)) : q("", !0)
|
|
3377
3385
|
])) : q("", !0),
|
|
3378
|
-
|
|
3379
|
-
class:
|
|
3386
|
+
w("div", {
|
|
3387
|
+
class: L(x.sender === "user" ? "max-w-[75%]" : "max-w-[92%]")
|
|
3380
3388
|
}, [
|
|
3381
|
-
st(
|
|
3389
|
+
st(x).length ? (g(), m("div", {
|
|
3382
3390
|
key: 0,
|
|
3383
|
-
class:
|
|
3391
|
+
class: L(["mb-1 space-y-1", x.sender === "user" ? "flex flex-col items-end" : ""])
|
|
3384
3392
|
}, [
|
|
3385
|
-
(g(!0),
|
|
3386
|
-
key: Xe(
|
|
3393
|
+
(g(!0), m(re, null, me(st(x), ({ attachment: $, index: se }) => (g(), m(re, {
|
|
3394
|
+
key: Xe($, se)
|
|
3387
3395
|
}, [
|
|
3388
|
-
|
|
3396
|
+
$.type === "image" ? (g(), m("img", {
|
|
3389
3397
|
key: 0,
|
|
3390
|
-
src:
|
|
3391
|
-
alt:
|
|
3398
|
+
src: $.src,
|
|
3399
|
+
alt: $.filename,
|
|
3392
3400
|
"data-test": "messaging-attachment",
|
|
3393
3401
|
"data-attachment-placement": "block",
|
|
3394
3402
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
3395
|
-
}, null, 8,
|
|
3403
|
+
}, null, 8, hr)) : $.type === "audio" ? (g(), m("audio", {
|
|
3396
3404
|
key: 1,
|
|
3397
|
-
src:
|
|
3405
|
+
src: $.src,
|
|
3398
3406
|
controls: "",
|
|
3399
3407
|
"data-test": "messaging-attachment",
|
|
3400
3408
|
"data-attachment-placement": "block",
|
|
3401
3409
|
class: "max-w-full"
|
|
3402
|
-
}, null, 8,
|
|
3410
|
+
}, null, 8, dr)) : (g(), m("a", {
|
|
3403
3411
|
key: 2,
|
|
3404
|
-
href:
|
|
3412
|
+
href: $.src,
|
|
3405
3413
|
target: "_blank",
|
|
3406
3414
|
rel: "noopener",
|
|
3407
3415
|
"data-test": "messaging-attachment",
|
|
3408
3416
|
"data-attachment-placement": "block",
|
|
3409
|
-
class:
|
|
3417
|
+
class: L(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", C.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
3410
3418
|
}, [
|
|
3411
|
-
k[14] || (k[14] =
|
|
3412
|
-
|
|
3413
|
-
], 10,
|
|
3419
|
+
k[14] || (k[14] = w("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
3420
|
+
_t(" " + Y($.filename), 1)
|
|
3421
|
+
], 10, pr))
|
|
3414
3422
|
], 64))), 128))
|
|
3415
3423
|
], 2)) : q("", !0),
|
|
3416
|
-
Ge(
|
|
3424
|
+
Ge(x).length ? (g(), m("div", {
|
|
3417
3425
|
key: 1,
|
|
3418
|
-
class:
|
|
3419
|
-
|
|
3426
|
+
class: L(
|
|
3427
|
+
x.sender === "user" ? "rounded-2xl rounded-br-[4px] px-3.5 py-2 bg-primary-500 text-white" : C.value ? "text-theme-800" : "text-white/95"
|
|
3420
3428
|
)
|
|
3421
3429
|
}, [
|
|
3422
|
-
(g(!0),
|
|
3423
|
-
key:
|
|
3430
|
+
(g(!0), m(re, null, me(Ge(x), ($) => (g(), m(re, {
|
|
3431
|
+
key: $.key
|
|
3424
3432
|
}, [
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
text:
|
|
3428
|
-
inverted:
|
|
3429
|
-
streaming:
|
|
3430
|
-
onClick: k[3] || (k[3] =
|
|
3433
|
+
$.kind === "text" && $.text ? (g(), m("div", fr, [
|
|
3434
|
+
ht(Bt, {
|
|
3435
|
+
text: $.text,
|
|
3436
|
+
inverted: x.sender === "user" || !C.value,
|
|
3437
|
+
streaming: x.id === ne.value,
|
|
3438
|
+
onClick: k[3] || (k[3] = At(() => {
|
|
3431
3439
|
}, ["stop"]))
|
|
3432
3440
|
}, null, 8, ["text", "inverted", "streaming"])
|
|
3433
|
-
])) :
|
|
3441
|
+
])) : $.kind === "attachment" && $.attachment.type === "image" ? (g(), m("img", {
|
|
3434
3442
|
key: 1,
|
|
3435
|
-
src:
|
|
3436
|
-
alt:
|
|
3443
|
+
src: $.attachment.src,
|
|
3444
|
+
alt: $.attachment.filename,
|
|
3437
3445
|
"data-test": "messaging-attachment",
|
|
3438
|
-
"data-attachment-placement":
|
|
3446
|
+
"data-attachment-placement": $.placement,
|
|
3439
3447
|
class: "my-2 rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
3440
|
-
}, null, 8,
|
|
3448
|
+
}, null, 8, gr)) : $.kind === "attachment" && $.attachment.type === "audio" ? (g(), m("audio", {
|
|
3441
3449
|
key: 2,
|
|
3442
|
-
src:
|
|
3450
|
+
src: $.attachment.src,
|
|
3443
3451
|
controls: "",
|
|
3444
3452
|
"data-test": "messaging-attachment",
|
|
3445
|
-
"data-attachment-placement":
|
|
3453
|
+
"data-attachment-placement": $.placement,
|
|
3446
3454
|
class: "my-2 max-w-full"
|
|
3447
|
-
}, null, 8,
|
|
3455
|
+
}, null, 8, mr)) : $.kind === "attachment" ? (g(), m("a", {
|
|
3448
3456
|
key: 3,
|
|
3449
|
-
href:
|
|
3457
|
+
href: $.attachment.src,
|
|
3450
3458
|
target: "_blank",
|
|
3451
3459
|
rel: "noopener",
|
|
3452
3460
|
"data-test": "messaging-attachment",
|
|
3453
|
-
"data-attachment-placement":
|
|
3454
|
-
class:
|
|
3461
|
+
"data-attachment-placement": $.placement,
|
|
3462
|
+
class: L(["my-2 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", C.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
3455
3463
|
}, [
|
|
3456
|
-
k[15] || (k[15] =
|
|
3457
|
-
|
|
3458
|
-
], 10,
|
|
3464
|
+
k[15] || (k[15] = w("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
3465
|
+
_t(" " + Y($.attachment.filename), 1)
|
|
3466
|
+
], 10, xr)) : q("", !0)
|
|
3459
3467
|
], 64))), 128))
|
|
3460
3468
|
], 2)) : q("", !0),
|
|
3461
|
-
|
|
3469
|
+
ee(x.toolActivities) ? (g(), m("div", {
|
|
3462
3470
|
key: 2,
|
|
3463
3471
|
"data-test": "messaging-message-tool-activity",
|
|
3464
|
-
"data-tool-activity-status":
|
|
3465
|
-
class:
|
|
3472
|
+
"data-tool-activity-status": ee(x.toolActivities)?.status,
|
|
3473
|
+
class: L(["mt-1 flex items-center gap-1.5 pl-2 pr-3 text-[12px] leading-none", C.value ? "text-theme-500" : "text-white/45"])
|
|
3466
3474
|
}, [
|
|
3467
|
-
|
|
3468
|
-
class:
|
|
3475
|
+
w("i", {
|
|
3476
|
+
class: L(["size-3.5 shrink-0 opacity-80", ee(x.toolActivities)?.icon]),
|
|
3469
3477
|
"aria-hidden": "true"
|
|
3470
3478
|
}, null, 2),
|
|
3471
|
-
|
|
3472
|
-
], 10,
|
|
3479
|
+
w("span", br, Y(ee(x.toolActivities)?.label), 1)
|
|
3480
|
+
], 10, kr)) : q("", !0)
|
|
3473
3481
|
], 2)
|
|
3474
|
-
], 10,
|
|
3482
|
+
], 10, or))
|
|
3475
3483
|
], 64))), 128)),
|
|
3476
|
-
|
|
3484
|
+
F.value ? (g(), m("div", {
|
|
3477
3485
|
key: 1,
|
|
3478
3486
|
"data-test": "messaging-working-state",
|
|
3479
|
-
"data-working-description":
|
|
3480
|
-
class:
|
|
3487
|
+
"data-working-description": F.value,
|
|
3488
|
+
class: L(["flex items-center gap-1.5 pl-2 pr-3 pb-1 mb-3 text-[12px] leading-none", C.value ? "text-theme-500" : "text-white/45"])
|
|
3481
3489
|
}, [
|
|
3482
|
-
k[16] || (k[16] =
|
|
3490
|
+
k[16] || (k[16] = w("i", {
|
|
3483
3491
|
class: "i-tabler-loader-2 size-3.5 shrink-0 animate-spin opacity-70",
|
|
3484
3492
|
"aria-hidden": "true"
|
|
3485
3493
|
}, null, -1)),
|
|
3486
|
-
|
|
3487
|
-
], 10,
|
|
3488
|
-
z.value ? (g(),
|
|
3494
|
+
w("span", vr, Y(F.value), 1)
|
|
3495
|
+
], 10, yr)) : q("", !0),
|
|
3496
|
+
z.value ? (g(), m("div", {
|
|
3489
3497
|
key: 2,
|
|
3490
3498
|
"data-test": "messaging-tool-activity",
|
|
3491
3499
|
"data-tool-activity-status": z.value.status,
|
|
3492
|
-
class:
|
|
3500
|
+
class: L(["flex items-center gap-1.5 pl-2 pr-3 pb-1 mb-3 text-[12px] leading-none", C.value ? "text-theme-500" : "text-white/45"])
|
|
3493
3501
|
}, [
|
|
3494
|
-
|
|
3495
|
-
class:
|
|
3502
|
+
w("i", {
|
|
3503
|
+
class: L(["size-3.5 shrink-0 opacity-80", z.value.icon]),
|
|
3496
3504
|
"aria-hidden": "true"
|
|
3497
3505
|
}, null, 2),
|
|
3498
|
-
|
|
3499
|
-
], 10,
|
|
3500
|
-
Te.value ? (g(),
|
|
3506
|
+
w("span", Tr, Y(z.value.label), 1)
|
|
3507
|
+
], 10, wr)) : q("", !0),
|
|
3508
|
+
Te.value ? (g(), m("div", {
|
|
3501
3509
|
key: 3,
|
|
3502
3510
|
"data-test": "messaging-transient-issue",
|
|
3503
3511
|
"data-issue-code": Te.value.code,
|
|
3504
|
-
class:
|
|
3512
|
+
class: L(["flex items-center gap-1.5 pl-2 pr-3 pb-1 mb-3 text-[12px] leading-snug", C.value ? "text-theme-600" : "text-white/60"])
|
|
3505
3513
|
}, [
|
|
3506
|
-
k[17] || (k[17] =
|
|
3514
|
+
k[17] || (k[17] = w("i", {
|
|
3507
3515
|
class: "i-tabler-alert-circle size-3.5 shrink-0 text-red-500",
|
|
3508
3516
|
"aria-hidden": "true"
|
|
3509
3517
|
}, null, -1)),
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
Te.value.help ? (g(),
|
|
3513
|
-
|
|
3518
|
+
w("span", null, [
|
|
3519
|
+
_t(Y(Te.value.message), 1),
|
|
3520
|
+
Te.value.help ? (g(), m(re, { key: 0 }, [
|
|
3521
|
+
_t(Y(Te.value.help), 1)
|
|
3514
3522
|
], 64)) : q("", !0)
|
|
3515
3523
|
]),
|
|
3516
|
-
Te.value.actionUrl && Te.value.actionLabel ? (g(),
|
|
3524
|
+
Te.value.actionUrl && Te.value.actionLabel ? (g(), m("a", {
|
|
3517
3525
|
key: 0,
|
|
3518
3526
|
href: Te.value.actionUrl,
|
|
3519
3527
|
class: "shrink-0 underline underline-offset-2",
|
|
3520
|
-
onClick: k[4] || (k[4] =
|
|
3528
|
+
onClick: k[4] || (k[4] = At(() => {
|
|
3521
3529
|
}, ["stop"]))
|
|
3522
|
-
},
|
|
3523
|
-
], 10,
|
|
3524
|
-
We.value ? (g(),
|
|
3525
|
-
|
|
3530
|
+
}, Y(Te.value.actionLabel), 9, Ar)) : q("", !0)
|
|
3531
|
+
], 10, Sr)) : q("", !0),
|
|
3532
|
+
We.value ? (g(), m("div", _r, [
|
|
3533
|
+
w("img", {
|
|
3526
3534
|
src: i.agent.avatarUrl.value,
|
|
3527
3535
|
alt: i.agent.displayName.value,
|
|
3528
|
-
class:
|
|
3529
|
-
}, null, 10,
|
|
3530
|
-
|
|
3531
|
-
class:
|
|
3536
|
+
class: L(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", C.value ? "ring-1 ring-black/5" : ""])
|
|
3537
|
+
}, null, 10, Er),
|
|
3538
|
+
w("i", {
|
|
3539
|
+
class: L(["i-svg-spinners-3-dots-bounce size-7", C.value ? "text-theme-400" : "text-white/50"]),
|
|
3532
3540
|
"aria-hidden": "true"
|
|
3533
3541
|
}, null, 2)
|
|
3534
3542
|
])) : q("", !0)
|
|
@@ -3536,95 +3544,100 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3536
3544
|
]),
|
|
3537
3545
|
_: 1
|
|
3538
3546
|
}, 512),
|
|
3539
|
-
|
|
3540
|
-
class:
|
|
3547
|
+
w("div", {
|
|
3548
|
+
class: L(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", C.value ? "bg-gradient-to-t from-theme-50/90 via-theme-50/55 to-transparent" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
3541
3549
|
}, [
|
|
3542
|
-
p.value.length > 0 ? (g(),
|
|
3543
|
-
(g(!0),
|
|
3544
|
-
key:
|
|
3550
|
+
p.value.length > 0 ? (g(), m("div", Rr, [
|
|
3551
|
+
(g(!0), m(re, null, me(p.value, (x, P) => (g(), m("div", {
|
|
3552
|
+
key: P,
|
|
3545
3553
|
class: "relative shrink-0 group"
|
|
3546
3554
|
}, [
|
|
3547
|
-
|
|
3555
|
+
x.type === "image" ? (g(), m("img", {
|
|
3548
3556
|
key: 0,
|
|
3549
|
-
src:
|
|
3550
|
-
alt:
|
|
3551
|
-
class:
|
|
3552
|
-
}, null, 10,
|
|
3557
|
+
src: x.src,
|
|
3558
|
+
alt: x.filename,
|
|
3559
|
+
class: L(["size-14 rounded-xl object-cover border", C.value ? "border-black/10" : "border-white/20"])
|
|
3560
|
+
}, null, 10, Cr)) : (g(), m("div", {
|
|
3553
3561
|
key: 1,
|
|
3554
|
-
class:
|
|
3562
|
+
class: L(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", C.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
3555
3563
|
}, [
|
|
3556
|
-
k[18] || (k[18] =
|
|
3557
|
-
|
|
3564
|
+
k[18] || (k[18] = w("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
3565
|
+
w("span", Ir, Y(x.filename), 1)
|
|
3558
3566
|
], 2)),
|
|
3559
|
-
|
|
3567
|
+
w("button", {
|
|
3560
3568
|
class: "absolute -top-1.5 -right-1.5 size-5 flex items-center justify-center rounded-full bg-theme-800 text-white text-xs scale-0 group-hover:scale-100 transition-transform cursor-pointer",
|
|
3561
|
-
onClick: /* @__PURE__ */ u((
|
|
3569
|
+
onClick: /* @__PURE__ */ u(($) => te(P), "onClick")
|
|
3562
3570
|
}, [...k[19] || (k[19] = [
|
|
3563
|
-
|
|
3564
|
-
])], 8,
|
|
3571
|
+
w("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
3572
|
+
])], 8, Mr)
|
|
3565
3573
|
]))), 128)),
|
|
3566
|
-
c.value ? (g(),
|
|
3567
|
-
|
|
3574
|
+
c.value ? (g(), m("div", Dr, [
|
|
3575
|
+
ht(Gn, { class: "size-5" })
|
|
3568
3576
|
])) : q("", !0)
|
|
3569
3577
|
])) : q("", !0),
|
|
3570
|
-
i.uploadFn ? (g(),
|
|
3578
|
+
i.uploadFn ? (g(), m("input", {
|
|
3571
3579
|
key: 1,
|
|
3572
3580
|
ref_key: "fileInput",
|
|
3573
3581
|
ref: o,
|
|
3574
3582
|
type: "file",
|
|
3575
3583
|
accept: "image/*,audio/*,video/*",
|
|
3576
3584
|
class: "hidden",
|
|
3577
|
-
onChange:
|
|
3585
|
+
onChange: he
|
|
3578
3586
|
}, null, 544)) : q("", !0),
|
|
3579
|
-
|
|
3580
|
-
class:
|
|
3587
|
+
w("div", {
|
|
3588
|
+
class: L(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-colors duration-200", C.value ? a.value ? "bg-theme-50 ring-1 ring-theme-300" : "bg-theme-25 ring-1 ring-theme-200 hover:ring-theme-300" : a.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
3581
3589
|
}, [
|
|
3582
|
-
|
|
3583
|
-
class:
|
|
3590
|
+
w("button", {
|
|
3591
|
+
class: L(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
3584
3592
|
i.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
3585
|
-
|
|
3593
|
+
C.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
3586
3594
|
c.value ? "opacity-50 pointer-events-none" : ""
|
|
3587
3595
|
]]),
|
|
3588
3596
|
disabled: be.value || c.value || !i.uploadFn,
|
|
3589
|
-
|
|
3597
|
+
"aria-label": i.uploadFn ? "Attach file" : "File attachments unavailable",
|
|
3598
|
+
title: i.uploadFn ? "Attach file" : "File attachments unavailable",
|
|
3599
|
+
onClick: k[5] || (k[5] = (x) => i.uploadFn && Q())
|
|
3590
3600
|
}, [
|
|
3591
|
-
c.value ? (g(),
|
|
3592
|
-
|
|
3593
|
-
|
|
3601
|
+
c.value ? (g(), m("i", Lr)) : (g(), m("i", Or)),
|
|
3602
|
+
w("span", Nr, Y(i.uploadFn ? "Attach file" : "File attachments unavailable"), 1)
|
|
3603
|
+
], 10, $r),
|
|
3604
|
+
Hs(w("textarea", {
|
|
3594
3605
|
ref_key: "textarea",
|
|
3595
3606
|
ref: l,
|
|
3596
|
-
"onUpdate:modelValue": k[6] || (k[6] = (
|
|
3607
|
+
"onUpdate:modelValue": k[6] || (k[6] = (x) => n.value = x),
|
|
3597
3608
|
"data-test": "messaging-input",
|
|
3598
3609
|
rows: "1",
|
|
3599
3610
|
enterkeyhint: "send",
|
|
3600
|
-
placeholder:
|
|
3611
|
+
placeholder: Ue.value,
|
|
3601
3612
|
disabled: be.value,
|
|
3602
3613
|
style: { fontSize: "16px", resize: "none" },
|
|
3603
|
-
class:
|
|
3604
|
-
onKeydown:
|
|
3605
|
-
onFocus: k[7] || (k[7] = (
|
|
3606
|
-
onBlur: k[8] || (k[8] = (
|
|
3607
|
-
}, null, 42,
|
|
3614
|
+
class: L(["flex-1 min-w-0 bg-transparent px-1 py-2 focus:outline-none disabled:opacity-50 overflow-y-auto leading-relaxed [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden", C.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
3615
|
+
onKeydown: D,
|
|
3616
|
+
onFocus: k[7] || (k[7] = (x) => a.value = !0),
|
|
3617
|
+
onBlur: k[8] || (k[8] = (x) => a.value = !1)
|
|
3618
|
+
}, null, 42, zr), [
|
|
3608
3619
|
[js, n.value]
|
|
3609
3620
|
]),
|
|
3610
|
-
|
|
3621
|
+
w("button", {
|
|
3611
3622
|
"data-test": "messaging-send-btn",
|
|
3612
3623
|
"data-composer-action": Ee.value,
|
|
3613
|
-
class:
|
|
3624
|
+
class: L(["shrink-0 flex items-center justify-center rounded-full transition-transform duration-200 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", it.value ? "bg-primary-500 text-white hover:scale-105 active:scale-95 cursor-pointer" : C.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
3614
3625
|
disabled: !it.value,
|
|
3615
|
-
"aria-label":
|
|
3616
|
-
|
|
3626
|
+
"aria-label": $e.value,
|
|
3627
|
+
title: $e.value,
|
|
3628
|
+
onClick: k[9] || (k[9] = (x) => A())
|
|
3617
3629
|
}, [
|
|
3618
|
-
Ee.value === "stop" ? (g(),
|
|
3619
|
-
|
|
3630
|
+
Ee.value === "stop" ? (g(), m("i", Fr)) : (g(), m("i", Br)),
|
|
3631
|
+
w("span", Ur, Y($e.value), 1)
|
|
3632
|
+
], 10, Pr)
|
|
3620
3633
|
], 2)
|
|
3621
3634
|
], 2)
|
|
3622
3635
|
]));
|
|
3623
3636
|
}
|
|
3624
|
-
}),
|
|
3637
|
+
}), Hr = { class: "agent-wrap" }, jr = {
|
|
3625
3638
|
key: 0,
|
|
3626
3639
|
class: "flex items-center justify-center h-full"
|
|
3627
|
-
},
|
|
3640
|
+
}, el = /* @__PURE__ */ Be({
|
|
3628
3641
|
__name: "AgentWrap",
|
|
3629
3642
|
props: {
|
|
3630
3643
|
sdk: {},
|
|
@@ -3638,11 +3651,11 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3638
3651
|
apiBase: {}
|
|
3639
3652
|
},
|
|
3640
3653
|
setup(i) {
|
|
3641
|
-
const t =
|
|
3654
|
+
const t = Vs("AgentWrap"), e = i, n = e.sdk || Ys.getInstance({
|
|
3642
3655
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
3643
3656
|
...e.apiBase && { apiBase: e.apiBase }
|
|
3644
|
-
}), a = ve(!e.agent), s = fs(e.agent ? new
|
|
3645
|
-
return
|
|
3657
|
+
}), a = ve(!e.agent), s = fs(e.agent ? new Ht({ config: e.agent }) : void 0), l = ve();
|
|
3658
|
+
return qt(async () => {
|
|
3646
3659
|
if (e.agent) {
|
|
3647
3660
|
t.debug("Agent provided via props, skipping fetch", {
|
|
3648
3661
|
agentId: e.agent.agentId,
|
|
@@ -3668,7 +3681,7 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3668
3681
|
try {
|
|
3669
3682
|
a.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
3670
3683
|
const o = await n.user.getPublicAgent({ handle: e.handle });
|
|
3671
|
-
o ? (s.value = new
|
|
3684
|
+
o ? (s.value = new Ht({ config: o }), t.debug("Successfully fetched public agent", {
|
|
3672
3685
|
agentId: o.agentId,
|
|
3673
3686
|
handle: o.handle
|
|
3674
3687
|
}), o.agentId && n.user.track({
|
|
@@ -3718,12 +3731,12 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3718
3731
|
}
|
|
3719
3732
|
});
|
|
3720
3733
|
}
|
|
3721
|
-
}), (o, p) => (g(),
|
|
3722
|
-
a.value ? (g(),
|
|
3723
|
-
|
|
3724
|
-
])])) : s.value ?
|
|
3734
|
+
}), (o, p) => (g(), m("div", Hr, [
|
|
3735
|
+
a.value ? (g(), m("div", jr, [...p[0] || (p[0] = [
|
|
3736
|
+
w("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
3737
|
+
])])) : s.value ? gn(o.$slots, "default", {
|
|
3725
3738
|
key: 1,
|
|
3726
|
-
sdk:
|
|
3739
|
+
sdk: un(n),
|
|
3727
3740
|
agent: s.value,
|
|
3728
3741
|
context: i.context,
|
|
3729
3742
|
firstMessage: i.firstMessage,
|
|
@@ -3736,15 +3749,15 @@ const Ei = ["data-visual-type", "data-chart-type", "data-diagram-type", "aria-la
|
|
|
3736
3749
|
});
|
|
3737
3750
|
export {
|
|
3738
3751
|
Wn as A,
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3752
|
+
el as _,
|
|
3753
|
+
Jr as a,
|
|
3754
|
+
Xr as b,
|
|
3755
|
+
Zr as c,
|
|
3756
|
+
Qr as d,
|
|
3744
3757
|
Gn as e,
|
|
3745
|
-
|
|
3746
|
-
|
|
3758
|
+
ha as f,
|
|
3759
|
+
Yr as g,
|
|
3747
3760
|
Vn as h,
|
|
3748
|
-
|
|
3761
|
+
Kr as p
|
|
3749
3762
|
};
|
|
3750
3763
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|