@pagelines/sdk 1.0.527 → 1.0.529
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js +507 -499
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +4 -4
- package/dist/agent.js +9 -9
- package/dist/agent.js.map +1 -1
- package/dist/demo/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/widget/composables/useWidgetState.d.ts +6 -6
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var Ln = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var Ms = (a, t, e) => t in a ? Ln(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var h = (a, t) => Ln(a, "name", { value: t, configurable: !0 });
|
|
4
|
-
var D = (a, t, e) =>
|
|
5
|
-
import { defineComponent as ke, openBlock as T, createElementBlock as
|
|
6
|
-
import { SettingsObject as
|
|
7
|
-
import { P as
|
|
8
|
-
const
|
|
4
|
+
var D = (a, t, e) => Ms(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as ke, openBlock as T, createElementBlock as A, createElementVNode as S, normalizeClass as _, ref as Z, watch as Ze, computed as U, createCommentVNode as j, renderSlot as en, onMounted as At, Fragment as Ce, renderList as vt, withDirectives as rs, vModelText as as, unref as Xt, toDisplayString as pe, shallowRef as ls, onBeforeUnmount as os, nextTick as Ls, createVNode as Fe, withCtx as Os, createBlock as On, withModifiers as gt, createTextVNode as zn } from "vue";
|
|
6
|
+
import { SettingsObject as zs, Agent as wt, getDefaultAvatarUrl as cs, createLogger as Ps } from "@pagelines/core";
|
|
7
|
+
import { P as Ns } from "./sdkClient.js";
|
|
8
|
+
const $s = { class: "spinner max-w-sm" }, Bs = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
},
|
|
11
|
+
}, Pn = /* @__PURE__ */ ke({
|
|
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(a) {
|
|
18
|
-
return (t, e) => (T(),
|
|
19
|
-
(T(),
|
|
20
|
-
|
|
18
|
+
return (t, e) => (T(), A("div", $s, [
|
|
19
|
+
(T(), A("svg", Bs, [
|
|
20
|
+
S("circle", {
|
|
21
21
|
class: _([a.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
@@ -33,7 +33,7 @@ const Ns = { class: "spinner max-w-sm" }, $s = {
|
|
|
33
33
|
}), Us = [
|
|
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
|
-
],
|
|
36
|
+
], Fs = 9e4, us = /* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP"]), Hs = /* @__PURE__ */ new Set([...us, "EMPTY_STREAM", "RATE_LIMIT"]), hn = class hn extends zs {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
39
|
D(this, "isTextMode", !1);
|
|
@@ -53,10 +53,14 @@ const Ns = { class: "spinner max-w-sm" }, $s = {
|
|
|
53
53
|
this._agent = e.agent instanceof wt ? e.agent : new wt({ config: e.agent }), this.setupModeWatcher(), this.setupAvailabilityWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
|
-
|
|
56
|
+
const e = this._agent.state.value.lifecycle;
|
|
57
|
+
return this._agent.lifecycle.value !== void 0 ? e === "running" : this._agent.desiredStatus.value === "active";
|
|
57
58
|
}
|
|
58
59
|
get chatUnavailableReason() {
|
|
59
|
-
|
|
60
|
+
if (this.chatEnabled)
|
|
61
|
+
return;
|
|
62
|
+
const e = this._agent.displayName.value, n = this._agent.state.value.lifecycle;
|
|
63
|
+
return n === "starting" ? `${e} is waking up` : n === "stopping" ? `${e} is going to sleep` : n === "stopped" ? `${e} is asleep` : this._agent.desiredStatus.value !== "active" ? `${e} is offline` : `${e} is unavailable`;
|
|
60
64
|
}
|
|
61
65
|
mapChatError(e) {
|
|
62
66
|
return e.includes("429") || e.includes("Too many") ? "Too many messages. Please wait a moment." : e.includes("503") || e.includes("not available") ? "Agent is currently offline." : e.includes("timed out") ? "This request timed out. Try again in a few minutes." : e.includes("starting up") ? "Agent is starting up. Please try again." : e.includes("404") ? "Agent not found." : e.includes("[no-reply]") ? "The reply didn't make it back. Refresh to see if it landed." : e.includes("[stream-open]") || e.includes("[stream-read]") ? "Lost connection mid-reply. Try again." : e.includes("[api]") ? "Couldn't send. Try again." : "Something went wrong. Try again.";
|
|
@@ -127,7 +131,7 @@ Current User:
|
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
setupAvailabilityWatcher() {
|
|
130
|
-
Ze(() => this.
|
|
134
|
+
Ze(() => this.chatEnabled, (e) => {
|
|
131
135
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
132
136
|
if (e) {
|
|
133
137
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -218,7 +222,7 @@ Current User:
|
|
|
218
222
|
]);
|
|
219
223
|
const I = this.sharedMessages.value, z = I[I.length - 1];
|
|
220
224
|
z?.id === l && (z.text += f, this.sharedMessages.value = [...I]);
|
|
221
|
-
}, "onDelta"),
|
|
225
|
+
}, "onDelta"), v = /* @__PURE__ */ h((f) => {
|
|
222
226
|
p = !0, o = !0;
|
|
223
227
|
const E = this.sharedMessages.value, I = E.findIndex((z) => z.id === f.id);
|
|
224
228
|
if (I >= 0)
|
|
@@ -249,15 +253,15 @@ Current User:
|
|
|
249
253
|
const E = this.sharedMessages.value, I = E[E.length - 1];
|
|
250
254
|
if (I?.id === l && !I.text && (this.sharedMessages.value = E.slice(0, -1)), typeof f == "object" && f.code && f.error) {
|
|
251
255
|
const { bucket: W, actionUrl: N, actionLabel: ie, help: se } = f;
|
|
252
|
-
if (W !== void 0 ||
|
|
253
|
-
const
|
|
256
|
+
if (W !== void 0 || Hs.has(f.code)) {
|
|
257
|
+
const Oe = W ?? (us.has(f.code) ? "account" : "error"), ze = {
|
|
254
258
|
code: f.code,
|
|
255
|
-
bucket:
|
|
259
|
+
bucket: Oe,
|
|
256
260
|
...ie ? { actionLabel: ie } : {},
|
|
257
261
|
...N ? { actionUrl: N } : {},
|
|
258
262
|
...se ? { help: se } : {}
|
|
259
263
|
};
|
|
260
|
-
this.addMessage(f.error, "system", void 0,
|
|
264
|
+
this.addMessage(f.error, "system", void 0, ze), Oe === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
261
265
|
} else
|
|
262
266
|
this.handleError(new Error(f.error));
|
|
263
267
|
return;
|
|
@@ -274,7 +278,7 @@ Current User:
|
|
|
274
278
|
conversationId: this.conversationId,
|
|
275
279
|
history: this.buildHistory(),
|
|
276
280
|
onDelta: c,
|
|
277
|
-
onMessage:
|
|
281
|
+
onMessage: v,
|
|
278
282
|
onDone: d,
|
|
279
283
|
onError: x,
|
|
280
284
|
onStatus: m
|
|
@@ -285,14 +289,14 @@ Current User:
|
|
|
285
289
|
anonymousId: s.user.generateAnonId(),
|
|
286
290
|
context: this.getDynamicSettings().context || void 0,
|
|
287
291
|
onDelta: c,
|
|
288
|
-
onMessage:
|
|
292
|
+
onMessage: v,
|
|
289
293
|
onDone: d,
|
|
290
294
|
onError: x,
|
|
291
295
|
onStatus: m
|
|
292
296
|
});
|
|
293
297
|
await Promise.race([
|
|
294
298
|
f,
|
|
295
|
-
new Promise((E, I) => setTimeout(() => I(new Error("timed out")),
|
|
299
|
+
new Promise((E, I) => setTimeout(() => I(new Error("timed out")), Fs))
|
|
296
300
|
]);
|
|
297
301
|
} catch (f) {
|
|
298
302
|
x(f.message || "Something went wrong");
|
|
@@ -316,29 +320,29 @@ Current User:
|
|
|
316
320
|
}
|
|
317
321
|
};
|
|
318
322
|
h(hn, "AgentChatController");
|
|
319
|
-
let
|
|
320
|
-
function
|
|
323
|
+
let Nn = hn;
|
|
324
|
+
function $n(a) {
|
|
321
325
|
return a ? typeof a == "string" ? a : a.src || "" : "";
|
|
322
326
|
}
|
|
323
|
-
h(
|
|
324
|
-
function
|
|
325
|
-
return
|
|
327
|
+
h($n, "getImageSrc");
|
|
328
|
+
function Zr(a) {
|
|
329
|
+
return $n(a.cover) || $n(a.avatar) || cs(a.name);
|
|
326
330
|
}
|
|
327
|
-
h(
|
|
328
|
-
function
|
|
331
|
+
h(Zr, "getAgentAvatarUrl");
|
|
332
|
+
function Bn(a) {
|
|
329
333
|
const t = a.target;
|
|
330
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
334
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = cs());
|
|
331
335
|
}
|
|
332
|
-
h(
|
|
333
|
-
function
|
|
336
|
+
h(Bn, "handleImageError");
|
|
337
|
+
function Xr(a) {
|
|
334
338
|
const { template: t, agent: e } = a;
|
|
335
339
|
return t.replace(/{name}/g, e.name || "Assistant").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
336
340
|
}
|
|
337
|
-
h(
|
|
338
|
-
const
|
|
341
|
+
h(Xr, "parseButtonTemplate");
|
|
342
|
+
const Gs = {
|
|
339
343
|
key: 0,
|
|
340
344
|
class: "absolute inset-0 flex items-center justify-center"
|
|
341
|
-
},
|
|
345
|
+
}, Kr = /* @__PURE__ */ ke({
|
|
342
346
|
__name: "ElAgentButton",
|
|
343
347
|
props: {
|
|
344
348
|
theme: { default: "primary" },
|
|
@@ -348,42 +352,42 @@ const Hs = {
|
|
|
348
352
|
iconAfter: {}
|
|
349
353
|
},
|
|
350
354
|
setup(a) {
|
|
351
|
-
const t =
|
|
355
|
+
const t = U(() => ({
|
|
352
356
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
353
357
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
354
358
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
355
359
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
356
|
-
})[a.theme]), e =
|
|
360
|
+
})[a.theme]), e = U(() => ({
|
|
357
361
|
sm: "px-4 py-2 text-sm",
|
|
358
362
|
md: "px-6 py-3 text-base",
|
|
359
363
|
lg: "px-8 py-4 text-base"
|
|
360
|
-
})[a.size]), n =
|
|
364
|
+
})[a.size]), n = U(() => ({
|
|
361
365
|
sm: "size-4",
|
|
362
366
|
md: "size-4",
|
|
363
367
|
lg: "size-5"
|
|
364
368
|
})[a.size]);
|
|
365
|
-
return (i, s) => (T(),
|
|
369
|
+
return (i, s) => (T(), A("button", {
|
|
366
370
|
class: _(["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]])
|
|
367
371
|
}, [
|
|
368
|
-
a.loading ? (T(),
|
|
369
|
-
|
|
372
|
+
a.loading ? (T(), A("div", Gs, [...s[0] || (s[0] = [
|
|
373
|
+
S("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
370
374
|
])])) : j("", !0),
|
|
371
|
-
|
|
375
|
+
S("span", {
|
|
372
376
|
class: _(["flex items-center gap-2 transition-opacity duration-200", a.loading ? "opacity-0" : "opacity-100"])
|
|
373
377
|
}, [
|
|
374
|
-
a.icon ? (T(),
|
|
378
|
+
a.icon ? (T(), A("i", {
|
|
375
379
|
key: 0,
|
|
376
380
|
class: _([a.icon, n.value])
|
|
377
381
|
}, null, 2)) : j("", !0),
|
|
378
382
|
en(i.$slots, "default"),
|
|
379
|
-
a.iconAfter ? (T(),
|
|
383
|
+
a.iconAfter ? (T(), A("i", {
|
|
380
384
|
key: 1,
|
|
381
385
|
class: _([a.iconAfter, n.value])
|
|
382
386
|
}, null, 2)) : j("", !0)
|
|
383
387
|
], 2)
|
|
384
388
|
], 2));
|
|
385
389
|
}
|
|
386
|
-
}),
|
|
390
|
+
}), js = ["value"], Qr = /* @__PURE__ */ ke({
|
|
387
391
|
__name: "AgentInputEmail",
|
|
388
392
|
props: {
|
|
389
393
|
modelValue: { default: "" }
|
|
@@ -391,7 +395,7 @@ const Hs = {
|
|
|
391
395
|
emits: ["update:modelValue"],
|
|
392
396
|
setup(a, { emit: t }) {
|
|
393
397
|
const e = t;
|
|
394
|
-
return (n, i) => (T(),
|
|
398
|
+
return (n, i) => (T(), A("input", {
|
|
395
399
|
type: "email",
|
|
396
400
|
autocomplete: "email",
|
|
397
401
|
placeholder: "Enter your email",
|
|
@@ -399,9 +403,9 @@ const Hs = {
|
|
|
399
403
|
class: "w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-all",
|
|
400
404
|
style: { "font-size": "16px" },
|
|
401
405
|
onInput: i[0] || (i[0] = (s) => e("update:modelValue", s.target.value))
|
|
402
|
-
}, null, 40,
|
|
406
|
+
}, null, 40, js));
|
|
403
407
|
}
|
|
404
|
-
}),
|
|
408
|
+
}), Ws = { class: "flex gap-1.5 justify-center" }, qs = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Jr = /* @__PURE__ */ ke({
|
|
405
409
|
__name: "AgentInputOneTimeCode",
|
|
406
410
|
props: {
|
|
407
411
|
modelValue: {},
|
|
@@ -411,7 +415,7 @@ const Hs = {
|
|
|
411
415
|
emits: ["update:modelValue", "autoSubmit"],
|
|
412
416
|
setup(a, { emit: t }) {
|
|
413
417
|
const e = a, n = t, i = Z([]), s = Z(Array.from({ length: e.length }).fill("")), l = Z(!1);
|
|
414
|
-
|
|
418
|
+
At(() => {
|
|
415
419
|
e.modelValue && (s.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && i.value[0]?.focus();
|
|
416
420
|
}), Ze(() => e.modelValue, (d) => {
|
|
417
421
|
s.value = d ? d.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
@@ -447,13 +451,13 @@ const Hs = {
|
|
|
447
451
|
x.key === "Backspace" ? (x.preventDefault(), s.value[d] = "", d > 0 && i.value[d - 1]?.focus()) : x.key === "ArrowLeft" && d > 0 ? i.value[d - 1]?.focus() : x.key === "ArrowRight" && d < e.length - 1 && i.value[d + 1]?.focus();
|
|
448
452
|
}
|
|
449
453
|
h(c, "onKeydown");
|
|
450
|
-
function
|
|
454
|
+
function v(d) {
|
|
451
455
|
if (i.value[d]?.select(), !l.value && s.value[d])
|
|
452
456
|
for (let x = d; x < e.length; x++)
|
|
453
457
|
s.value[x] = "";
|
|
454
458
|
}
|
|
455
|
-
return h(
|
|
456
|
-
(T(!0),
|
|
459
|
+
return h(v, "onFocus"), (d, x) => (T(), A("div", Ws, [
|
|
460
|
+
(T(!0), A(Ce, null, vt(a.length, (m) => rs((T(), A("input", {
|
|
457
461
|
key: m,
|
|
458
462
|
ref_for: !0,
|
|
459
463
|
ref: /* @__PURE__ */ h((f) => i.value[m - 1] = f, "ref"),
|
|
@@ -467,16 +471,16 @@ const Hs = {
|
|
|
467
471
|
onInput: /* @__PURE__ */ h((f) => p(m - 1, f), "onInput"),
|
|
468
472
|
onKeydown: /* @__PURE__ */ h((f) => c(m - 1, f), "onKeydown"),
|
|
469
473
|
onPaste: /* @__PURE__ */ h((f) => o(m - 1, f), "onPaste"),
|
|
470
|
-
onFocus: /* @__PURE__ */ h((f) =>
|
|
471
|
-
}, null, 40,
|
|
472
|
-
[
|
|
474
|
+
onFocus: /* @__PURE__ */ h((f) => v(m - 1), "onFocus")
|
|
475
|
+
}, null, 40, qs)), [
|
|
476
|
+
[as, s.value[m - 1]]
|
|
473
477
|
])), 128))
|
|
474
478
|
]));
|
|
475
479
|
}
|
|
476
|
-
}),
|
|
480
|
+
}), Vs = { class: "relative flex-shrink-0" }, Ys = ["src", "alt"], Zs = { class: "absolute top-1 right-1" }, Xs = {
|
|
477
481
|
key: 1,
|
|
478
482
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
479
|
-
},
|
|
483
|
+
}, Ks = { class: "min-w-0" }, Qs = /* @__PURE__ */ ke({
|
|
480
484
|
__name: "ElModeHeader",
|
|
481
485
|
props: {
|
|
482
486
|
agent: {},
|
|
@@ -485,60 +489,60 @@ const Hs = {
|
|
|
485
489
|
layout: { default: "centered" }
|
|
486
490
|
},
|
|
487
491
|
setup(a) {
|
|
488
|
-
return (t, e) => (T(),
|
|
492
|
+
return (t, e) => (T(), A("div", {
|
|
489
493
|
class: _(["flex gap-4", [
|
|
490
494
|
a.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
491
495
|
]])
|
|
492
496
|
}, [
|
|
493
|
-
|
|
494
|
-
|
|
497
|
+
S("div", Vs, [
|
|
498
|
+
S("div", {
|
|
495
499
|
class: _(["rounded-full overflow-hidden border-white", a.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"])
|
|
496
500
|
}, [
|
|
497
|
-
|
|
501
|
+
S("img", {
|
|
498
502
|
src: a.agent.avatarUrl.value,
|
|
499
503
|
alt: a.agent.displayName.value,
|
|
500
504
|
class: "w-full h-full object-cover",
|
|
501
505
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
502
|
-
(...n) => Xt(
|
|
503
|
-
}, null, 40,
|
|
506
|
+
(...n) => Xt(Bn) && Xt(Bn)(...n))
|
|
507
|
+
}, null, 40, Ys)
|
|
504
508
|
], 2),
|
|
505
|
-
|
|
506
|
-
a.isOnline ? (T(),
|
|
507
|
-
e[1] || (e[1] =
|
|
509
|
+
S("div", Zs, [
|
|
510
|
+
a.isOnline ? (T(), A(Ce, { key: 0 }, [
|
|
511
|
+
e[1] || (e[1] = S("div", {
|
|
508
512
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
509
513
|
style: { "animation-duration": "3s" }
|
|
510
514
|
}, null, -1)),
|
|
511
|
-
e[2] || (e[2] =
|
|
512
|
-
], 64)) : (T(),
|
|
515
|
+
e[2] || (e[2] = S("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
516
|
+
], 64)) : (T(), A("div", Xs))
|
|
513
517
|
])
|
|
514
518
|
]),
|
|
515
|
-
|
|
516
|
-
|
|
519
|
+
S("div", Ks, [
|
|
520
|
+
S("h1", {
|
|
517
521
|
class: _(["font-light text-white mb-1 truncate", [
|
|
518
522
|
a.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
519
523
|
a.layout === "horizontal" ? "text-white/95" : ""
|
|
520
524
|
]])
|
|
521
|
-
},
|
|
522
|
-
|
|
525
|
+
}, pe(a.agent.displayName.value), 3),
|
|
526
|
+
S("p", {
|
|
523
527
|
class: _(["font-light line-clamp-1", [
|
|
524
528
|
a.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
525
529
|
a.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
526
530
|
]])
|
|
527
|
-
},
|
|
531
|
+
}, pe(a.layout === "horizontal" ? a.agent.title.value || "Assistant" : a.agent.title.value), 3)
|
|
528
532
|
])
|
|
529
533
|
], 2));
|
|
530
534
|
}
|
|
531
535
|
});
|
|
532
536
|
const {
|
|
533
|
-
entries:
|
|
537
|
+
entries: hs,
|
|
534
538
|
setPrototypeOf: Un,
|
|
535
|
-
isFrozen:
|
|
536
|
-
getPrototypeOf:
|
|
537
|
-
getOwnPropertyDescriptor:
|
|
539
|
+
isFrozen: Js,
|
|
540
|
+
getPrototypeOf: ei,
|
|
541
|
+
getOwnPropertyDescriptor: ti
|
|
538
542
|
} = Object;
|
|
539
543
|
let {
|
|
540
544
|
freeze: ee,
|
|
541
|
-
seal:
|
|
545
|
+
seal: ce,
|
|
542
546
|
create: Ge
|
|
543
547
|
} = Object, {
|
|
544
548
|
apply: Kt,
|
|
@@ -547,7 +551,7 @@ let {
|
|
|
547
551
|
ee || (ee = /* @__PURE__ */ h(function(t) {
|
|
548
552
|
return t;
|
|
549
553
|
}, "freeze"));
|
|
550
|
-
|
|
554
|
+
ce || (ce = /* @__PURE__ */ h(function(t) {
|
|
551
555
|
return t;
|
|
552
556
|
}, "seal"));
|
|
553
557
|
Kt || (Kt = /* @__PURE__ */ h(function(t, e) {
|
|
@@ -560,7 +564,7 @@ Qt || (Qt = /* @__PURE__ */ h(function(t) {
|
|
|
560
564
|
n[i - 1] = arguments[i];
|
|
561
565
|
return new t(...n);
|
|
562
566
|
}, "construct"));
|
|
563
|
-
const tt = H(Array.prototype.forEach),
|
|
567
|
+
const tt = H(Array.prototype.forEach), ni = H(Array.prototype.lastIndexOf), Fn = H(Array.prototype.pop), nt = H(Array.prototype.push), si = H(Array.prototype.splice), J = Array.isArray, at = H(String.prototype.toLowerCase), Wt = H(String.prototype.toString), Hn = H(String.prototype.match), He = H(String.prototype.replace), Gn = H(String.prototype.indexOf), ii = H(String.prototype.trim), ri = H(Number.prototype.toString), ai = H(Boolean.prototype.toString), jn = typeof BigInt > "u" ? null : H(BigInt.prototype.toString), Wn = typeof Symbol > "u" ? null : H(Symbol.prototype.toString), B = H(Object.prototype.hasOwnProperty), st = H(Object.prototype.toString), Y = H(RegExp.prototype.test), mt = li(TypeError);
|
|
564
568
|
function H(a) {
|
|
565
569
|
return function(t) {
|
|
566
570
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
@@ -570,14 +574,14 @@ function H(a) {
|
|
|
570
574
|
};
|
|
571
575
|
}
|
|
572
576
|
h(H, "unapply");
|
|
573
|
-
function
|
|
577
|
+
function li(a) {
|
|
574
578
|
return function() {
|
|
575
579
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
576
580
|
e[n] = arguments[n];
|
|
577
581
|
return Qt(a, e);
|
|
578
582
|
};
|
|
579
583
|
}
|
|
580
|
-
h(
|
|
584
|
+
h(li, "unconstruct");
|
|
581
585
|
function R(a, t) {
|
|
582
586
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : at;
|
|
583
587
|
if (Un && Un(a, null), !J(t))
|
|
@@ -587,38 +591,38 @@ function R(a, t) {
|
|
|
587
591
|
let i = t[n];
|
|
588
592
|
if (typeof i == "string") {
|
|
589
593
|
const s = e(i);
|
|
590
|
-
s !== i && (
|
|
594
|
+
s !== i && (Js(t) || (t[n] = s), i = s);
|
|
591
595
|
}
|
|
592
596
|
a[i] = !0;
|
|
593
597
|
}
|
|
594
598
|
return a;
|
|
595
599
|
}
|
|
596
600
|
h(R, "addToSet");
|
|
597
|
-
function
|
|
601
|
+
function oi(a) {
|
|
598
602
|
for (let t = 0; t < a.length; t++)
|
|
599
|
-
|
|
603
|
+
B(a, t) || (a[t] = null);
|
|
600
604
|
return a;
|
|
601
605
|
}
|
|
602
|
-
h(
|
|
606
|
+
h(oi, "cleanArray");
|
|
603
607
|
function ne(a) {
|
|
604
608
|
const t = Ge(null);
|
|
605
|
-
for (const [e, n] of
|
|
606
|
-
|
|
609
|
+
for (const [e, n] of hs(a))
|
|
610
|
+
B(a, e) && (J(n) ? t[e] = oi(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = ne(n) : t[e] = n);
|
|
607
611
|
return t;
|
|
608
612
|
}
|
|
609
613
|
h(ne, "clone");
|
|
610
|
-
function
|
|
614
|
+
function ci(a) {
|
|
611
615
|
switch (typeof a) {
|
|
612
616
|
case "string":
|
|
613
617
|
return a;
|
|
614
618
|
case "number":
|
|
615
|
-
return ii(a);
|
|
616
|
-
case "boolean":
|
|
617
619
|
return ri(a);
|
|
620
|
+
case "boolean":
|
|
621
|
+
return ai(a);
|
|
618
622
|
case "bigint":
|
|
619
|
-
return
|
|
623
|
+
return jn ? jn(a) : "0";
|
|
620
624
|
case "symbol":
|
|
621
|
-
return
|
|
625
|
+
return Wn ? Wn(a) : "Symbol()";
|
|
622
626
|
case "undefined":
|
|
623
627
|
return st(a);
|
|
624
628
|
case "function":
|
|
@@ -636,17 +640,17 @@ function oi(a) {
|
|
|
636
640
|
return st(a);
|
|
637
641
|
}
|
|
638
642
|
}
|
|
639
|
-
h(
|
|
643
|
+
h(ci, "stringifyValue");
|
|
640
644
|
function je(a, t) {
|
|
641
645
|
for (; a !== null; ) {
|
|
642
|
-
const n =
|
|
646
|
+
const n = ti(a, t);
|
|
643
647
|
if (n) {
|
|
644
648
|
if (n.get)
|
|
645
649
|
return H(n.get);
|
|
646
650
|
if (typeof n.value == "function")
|
|
647
651
|
return H(n.value);
|
|
648
652
|
}
|
|
649
|
-
a =
|
|
653
|
+
a = ei(a);
|
|
650
654
|
}
|
|
651
655
|
function e() {
|
|
652
656
|
return null;
|
|
@@ -654,33 +658,33 @@ function je(a, t) {
|
|
|
654
658
|
return h(e, "fallbackValue"), e;
|
|
655
659
|
}
|
|
656
660
|
h(je, "lookupGetter");
|
|
657
|
-
function
|
|
661
|
+
function ui(a) {
|
|
658
662
|
try {
|
|
659
663
|
return Y(a, ""), !0;
|
|
660
664
|
} catch {
|
|
661
665
|
return !1;
|
|
662
666
|
}
|
|
663
667
|
}
|
|
664
|
-
h(
|
|
665
|
-
const
|
|
668
|
+
h(ui, "isRegex");
|
|
669
|
+
const qn = ee(["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"]), qt = ee(["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"]), Vt = ee(["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"]), hi = ee(["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"]), Yt = ee(["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"]), pi = ee(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Vn = ee(["#text"]), Yn = ee(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "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"]), Zt = ee(["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"]), Zn = ee(["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"]), xt = ee(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), di = ce(/\{\{[\w\W]*|[\w\W]*\}\}/gm), fi = ce(/<%[\w\W]*|[\w\W]*%>/gm), gi = ce(/\$\{[\w\W]*/gm), mi = ce(/^data-[\-\w.\u00B7-\uFFFF]+$/), xi = ce(/^aria-[\-\w]+$/), ps = ce(
|
|
666
670
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
667
671
|
// eslint-disable-line no-useless-escape
|
|
668
|
-
),
|
|
672
|
+
), bi = ce(/^(?:\w+script|data):/i), ki = ce(
|
|
669
673
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
670
674
|
// eslint-disable-line no-control-regex
|
|
671
|
-
),
|
|
672
|
-
var
|
|
675
|
+
), ds = ce(/^html$/i), vi = ce(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
676
|
+
var Xn = /* @__PURE__ */ Object.freeze({
|
|
673
677
|
__proto__: null,
|
|
674
|
-
ARIA_ATTR:
|
|
675
|
-
ATTR_WHITESPACE:
|
|
676
|
-
CUSTOM_ELEMENT:
|
|
677
|
-
DATA_ATTR:
|
|
678
|
-
DOCTYPE_NAME:
|
|
679
|
-
ERB_EXPR:
|
|
680
|
-
IS_ALLOWED_URI:
|
|
681
|
-
IS_SCRIPT_OR_DATA:
|
|
682
|
-
MUSTACHE_EXPR:
|
|
683
|
-
TMPLIT_EXPR:
|
|
678
|
+
ARIA_ATTR: xi,
|
|
679
|
+
ATTR_WHITESPACE: ki,
|
|
680
|
+
CUSTOM_ELEMENT: vi,
|
|
681
|
+
DATA_ATTR: mi,
|
|
682
|
+
DOCTYPE_NAME: ds,
|
|
683
|
+
ERB_EXPR: fi,
|
|
684
|
+
IS_ALLOWED_URI: ps,
|
|
685
|
+
IS_SCRIPT_OR_DATA: bi,
|
|
686
|
+
MUSTACHE_EXPR: di,
|
|
687
|
+
TMPLIT_EXPR: gi
|
|
684
688
|
});
|
|
685
689
|
const it = {
|
|
686
690
|
element: 1,
|
|
@@ -691,7 +695,7 @@ const it = {
|
|
|
691
695
|
document: 9
|
|
692
696
|
}, wi = /* @__PURE__ */ h(function() {
|
|
693
697
|
return typeof window > "u" ? null : window;
|
|
694
|
-
}, "getGlobal"),
|
|
698
|
+
}, "getGlobal"), yi = /* @__PURE__ */ h(function(t, e) {
|
|
695
699
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
696
700
|
return null;
|
|
697
701
|
let n = null;
|
|
@@ -710,7 +714,7 @@ const it = {
|
|
|
710
714
|
} catch {
|
|
711
715
|
return console.warn("TrustedTypes policy " + s + " could not be created."), null;
|
|
712
716
|
}
|
|
713
|
-
}, "_createTrustedTypesPolicy"),
|
|
717
|
+
}, "_createTrustedTypesPolicy"), Kn = /* @__PURE__ */ h(function() {
|
|
714
718
|
return {
|
|
715
719
|
afterSanitizeAttributes: [],
|
|
716
720
|
afterSanitizeElements: [],
|
|
@@ -723,9 +727,9 @@ const it = {
|
|
|
723
727
|
uponSanitizeShadowNode: []
|
|
724
728
|
};
|
|
725
729
|
}, "_createHooksMap");
|
|
726
|
-
function
|
|
730
|
+
function fs() {
|
|
727
731
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : wi();
|
|
728
|
-
const t = /* @__PURE__ */ h((y) =>
|
|
732
|
+
const t = /* @__PURE__ */ h((y) => fs(y), "DOMPurify");
|
|
729
733
|
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !== it.document || !a.Element)
|
|
730
734
|
return t.isSupported = !1, t;
|
|
731
735
|
let {
|
|
@@ -737,7 +741,7 @@ function ds() {
|
|
|
737
741
|
Node: o,
|
|
738
742
|
Element: p,
|
|
739
743
|
NodeFilter: c,
|
|
740
|
-
NamedNodeMap:
|
|
744
|
+
NamedNodeMap: v = a.NamedNodeMap || a.MozNamedAttrMap,
|
|
741
745
|
HTMLFormElement: d,
|
|
742
746
|
DOMParser: x,
|
|
743
747
|
trustedTypes: m
|
|
@@ -750,29 +754,29 @@ function ds() {
|
|
|
750
754
|
const {
|
|
751
755
|
implementation: se,
|
|
752
756
|
createNodeIterator: re,
|
|
753
|
-
createDocumentFragment:
|
|
754
|
-
getElementsByTagName:
|
|
757
|
+
createDocumentFragment: Oe,
|
|
758
|
+
getElementsByTagName: ze
|
|
755
759
|
} = e, {
|
|
756
760
|
importNode: L
|
|
757
761
|
} = n;
|
|
758
|
-
let q =
|
|
759
|
-
t.isSupported = typeof
|
|
762
|
+
let q = Kn();
|
|
763
|
+
t.isSupported = typeof hs == "function" && typeof W == "function" && se && se.createHTMLDocument !== void 0;
|
|
760
764
|
const {
|
|
761
|
-
MUSTACHE_EXPR:
|
|
765
|
+
MUSTACHE_EXPR: ve,
|
|
762
766
|
ERB_EXPR: Ae,
|
|
763
|
-
TMPLIT_EXPR:
|
|
764
|
-
DATA_ATTR:
|
|
765
|
-
ARIA_ATTR:
|
|
766
|
-
IS_SCRIPT_OR_DATA:
|
|
767
|
+
TMPLIT_EXPR: Pe,
|
|
768
|
+
DATA_ATTR: Rt,
|
|
769
|
+
ARIA_ATTR: It,
|
|
770
|
+
IS_SCRIPT_OR_DATA: Ct,
|
|
767
771
|
ATTR_WHITESPACE: ct,
|
|
768
772
|
CUSTOM_ELEMENT: ut
|
|
769
|
-
} =
|
|
773
|
+
} = Xn;
|
|
770
774
|
let {
|
|
771
775
|
IS_ALLOWED_URI: Ke
|
|
772
|
-
} =
|
|
773
|
-
const k = R({}, [...
|
|
776
|
+
} = Xn, w = null;
|
|
777
|
+
const k = R({}, [...qn, ...qt, ...Vt, ...Yt, ...Vn]);
|
|
774
778
|
let g = null;
|
|
775
|
-
const P = R({}, [...
|
|
779
|
+
const P = R({}, [...Yn, ...Zt, ...Zn, ...xt]);
|
|
776
780
|
let C = Object.seal(Ge(null, {
|
|
777
781
|
tagNameCheck: {
|
|
778
782
|
writable: !0,
|
|
@@ -807,48 +811,48 @@ function ds() {
|
|
|
807
811
|
value: null
|
|
808
812
|
}
|
|
809
813
|
}));
|
|
810
|
-
let pn = !0,
|
|
814
|
+
let pn = !0, Dt = !0, dn = !1, fn = !0, _e = !1, Qe = !0, Re = !1, Mt = !1, Lt = !1, Ne = !1, ht = !1, pt = !1, gn = !0, mn = !1;
|
|
811
815
|
const xn = "user-content-";
|
|
812
|
-
let
|
|
813
|
-
const
|
|
816
|
+
let Ot = !0, Je = !1, $e = {}, ge = null;
|
|
817
|
+
const zt = R({}, ["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"]);
|
|
814
818
|
let bn = null;
|
|
815
819
|
const kn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
816
|
-
let
|
|
817
|
-
const
|
|
818
|
-
let Be = me,
|
|
819
|
-
const
|
|
820
|
-
let
|
|
821
|
-
const
|
|
820
|
+
let Pt = null;
|
|
821
|
+
const vn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), dt = "http://www.w3.org/1998/Math/MathML", ft = "http://www.w3.org/2000/svg", me = "http://www.w3.org/1999/xhtml";
|
|
822
|
+
let Be = me, Nt = !1, $t = null;
|
|
823
|
+
const As = R({}, [dt, ft, me], Wt);
|
|
824
|
+
let Bt = R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ut = R({}, ["annotation-xml"]);
|
|
825
|
+
const Es = R({}, ["title", "style", "font", "a", "script"]);
|
|
822
826
|
let et = null;
|
|
823
|
-
const
|
|
824
|
-
let G = null,
|
|
825
|
-
const
|
|
827
|
+
const _s = ["application/xhtml+xml", "text/html"], Rs = "text/html";
|
|
828
|
+
let G = null, Ue = null;
|
|
829
|
+
const Is = e.createElement("form"), wn = /* @__PURE__ */ h(function(r) {
|
|
826
830
|
return r instanceof RegExp || r instanceof Function;
|
|
827
|
-
}, "isRegexOrFunction"),
|
|
831
|
+
}, "isRegexOrFunction"), Ft = /* @__PURE__ */ h(function() {
|
|
828
832
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
829
|
-
if (
|
|
833
|
+
if (Ue && Ue === r)
|
|
830
834
|
return;
|
|
831
835
|
(!r || typeof r != "object") && (r = {}), r = ne(r), et = // eslint-disable-next-line unicorn/prefer-includes
|
|
832
|
-
|
|
833
|
-
const u =
|
|
834
|
-
if (C = Ge(null),
|
|
836
|
+
_s.indexOf(r.PARSER_MEDIA_TYPE) === -1 ? Rs : r.PARSER_MEDIA_TYPE, G = et === "application/xhtml+xml" ? Wt : at, w = B(r, "ALLOWED_TAGS") && J(r.ALLOWED_TAGS) ? R({}, r.ALLOWED_TAGS, G) : k, g = B(r, "ALLOWED_ATTR") && J(r.ALLOWED_ATTR) ? R({}, r.ALLOWED_ATTR, G) : P, $t = B(r, "ALLOWED_NAMESPACES") && J(r.ALLOWED_NAMESPACES) ? R({}, r.ALLOWED_NAMESPACES, Wt) : As, Pt = B(r, "ADD_URI_SAFE_ATTR") && J(r.ADD_URI_SAFE_ATTR) ? R(ne(vn), r.ADD_URI_SAFE_ATTR, G) : vn, bn = B(r, "ADD_DATA_URI_TAGS") && J(r.ADD_DATA_URI_TAGS) ? R(ne(kn), r.ADD_DATA_URI_TAGS, G) : kn, ge = B(r, "FORBID_CONTENTS") && J(r.FORBID_CONTENTS) ? R({}, r.FORBID_CONTENTS, G) : zt, ae = B(r, "FORBID_TAGS") && J(r.FORBID_TAGS) ? R({}, r.FORBID_TAGS, G) : ne({}), Ee = B(r, "FORBID_ATTR") && J(r.FORBID_ATTR) ? R({}, r.FORBID_ATTR, G) : ne({}), $e = B(r, "USE_PROFILES") ? r.USE_PROFILES && typeof r.USE_PROFILES == "object" ? ne(r.USE_PROFILES) : r.USE_PROFILES : !1, pn = r.ALLOW_ARIA_ATTR !== !1, Dt = r.ALLOW_DATA_ATTR !== !1, dn = r.ALLOW_UNKNOWN_PROTOCOLS || !1, fn = r.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _e = r.SAFE_FOR_TEMPLATES || !1, Qe = r.SAFE_FOR_XML !== !1, Re = r.WHOLE_DOCUMENT || !1, Ne = r.RETURN_DOM || !1, ht = r.RETURN_DOM_FRAGMENT || !1, pt = r.RETURN_TRUSTED_TYPE || !1, Lt = r.FORCE_BODY || !1, gn = r.SANITIZE_DOM !== !1, mn = r.SANITIZE_NAMED_PROPS || !1, Ot = r.KEEP_CONTENT !== !1, Je = r.IN_PLACE || !1, Ke = ui(r.ALLOWED_URI_REGEXP) ? r.ALLOWED_URI_REGEXP : ps, Be = typeof r.NAMESPACE == "string" ? r.NAMESPACE : me, Bt = B(r, "MATHML_TEXT_INTEGRATION_POINTS") && r.MATHML_TEXT_INTEGRATION_POINTS && typeof r.MATHML_TEXT_INTEGRATION_POINTS == "object" ? ne(r.MATHML_TEXT_INTEGRATION_POINTS) : R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ut = B(r, "HTML_INTEGRATION_POINTS") && r.HTML_INTEGRATION_POINTS && typeof r.HTML_INTEGRATION_POINTS == "object" ? ne(r.HTML_INTEGRATION_POINTS) : R({}, ["annotation-xml"]);
|
|
837
|
+
const u = B(r, "CUSTOM_ELEMENT_HANDLING") && r.CUSTOM_ELEMENT_HANDLING && typeof r.CUSTOM_ELEMENT_HANDLING == "object" ? ne(r.CUSTOM_ELEMENT_HANDLING) : Ge(null);
|
|
838
|
+
if (C = Ge(null), B(u, "tagNameCheck") && wn(u.tagNameCheck) && (C.tagNameCheck = u.tagNameCheck), B(u, "attributeNameCheck") && wn(u.attributeNameCheck) && (C.attributeNameCheck = u.attributeNameCheck), B(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (C.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), _e && (Dt = !1), ht && (Ne = !0), $e && (w = R({}, Vn), g = Ge(null), $e.html === !0 && (R(w, qn), R(g, Yn)), $e.svg === !0 && (R(w, qt), R(g, Zt), R(g, xt)), $e.svgFilters === !0 && (R(w, Vt), R(g, Zt), R(g, xt)), $e.mathMl === !0 && (R(w, Yt), R(g, Zn), R(g, xt))), le.tagCheck = null, le.attributeCheck = null, B(r, "ADD_TAGS") && (typeof r.ADD_TAGS == "function" ? le.tagCheck = r.ADD_TAGS : J(r.ADD_TAGS) && (w === k && (w = ne(w)), R(w, r.ADD_TAGS, G))), B(r, "ADD_ATTR") && (typeof r.ADD_ATTR == "function" ? le.attributeCheck = r.ADD_ATTR : J(r.ADD_ATTR) && (g === P && (g = ne(g)), R(g, r.ADD_ATTR, G))), B(r, "ADD_URI_SAFE_ATTR") && J(r.ADD_URI_SAFE_ATTR) && R(Pt, r.ADD_URI_SAFE_ATTR, G), B(r, "FORBID_CONTENTS") && J(r.FORBID_CONTENTS) && (ge === zt && (ge = ne(ge)), R(ge, r.FORBID_CONTENTS, G)), B(r, "ADD_FORBID_CONTENTS") && J(r.ADD_FORBID_CONTENTS) && (ge === zt && (ge = ne(ge)), R(ge, r.ADD_FORBID_CONTENTS, G)), Ot && (w["#text"] = !0), Re && R(w, ["html", "head", "body"]), w.table && (R(w, ["tbody"]), delete ae.tbody), r.TRUSTED_TYPES_POLICY) {
|
|
835
839
|
if (typeof r.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
836
840
|
throw mt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
837
841
|
if (typeof r.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
838
842
|
throw mt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
839
843
|
N = r.TRUSTED_TYPES_POLICY, ie = N.createHTML("");
|
|
840
844
|
} else
|
|
841
|
-
N === void 0 && (N =
|
|
842
|
-
ee && ee(r),
|
|
843
|
-
}, "_parseConfig"), yn = R({}, [...
|
|
845
|
+
N === void 0 && (N = yi(m, i)), N !== null && typeof ie == "string" && (ie = N.createHTML(""));
|
|
846
|
+
ee && ee(r), Ue = r;
|
|
847
|
+
}, "_parseConfig"), yn = R({}, [...qt, ...Vt, ...hi]), Tn = R({}, [...Yt, ...pi]), Cs = /* @__PURE__ */ h(function(r) {
|
|
844
848
|
let u = W(r);
|
|
845
849
|
(!u || !u.tagName) && (u = {
|
|
846
850
|
namespaceURI: Be,
|
|
847
851
|
tagName: "template"
|
|
848
852
|
});
|
|
849
853
|
const b = at(r.tagName), $ = at(u.tagName);
|
|
850
|
-
return
|
|
851
|
-
}, "_checkValidNamespace"),
|
|
854
|
+
return $t[r.namespaceURI] ? r.namespaceURI === ft ? u.namespaceURI === me ? b === "svg" : u.namespaceURI === dt ? b === "svg" && ($ === "annotation-xml" || Bt[$]) : !!yn[b] : r.namespaceURI === dt ? u.namespaceURI === me ? b === "math" : u.namespaceURI === ft ? b === "math" && Ut[$] : !!Tn[b] : r.namespaceURI === me ? u.namespaceURI === ft && !Ut[$] || u.namespaceURI === dt && !Bt[$] ? !1 : !Tn[b] && (Es[b] || !yn[b]) : !!(et === "application/xhtml+xml" && $t[r.namespaceURI]) : !1;
|
|
855
|
+
}, "_checkValidNamespace"), ue = /* @__PURE__ */ h(function(r) {
|
|
852
856
|
nt(t.removed, {
|
|
853
857
|
element: r
|
|
854
858
|
});
|
|
@@ -870,9 +874,9 @@ function ds() {
|
|
|
870
874
|
});
|
|
871
875
|
}
|
|
872
876
|
if (u.removeAttribute(r), r === "is")
|
|
873
|
-
if (
|
|
877
|
+
if (Ne || ht)
|
|
874
878
|
try {
|
|
875
|
-
|
|
879
|
+
ue(u);
|
|
876
880
|
} catch {
|
|
877
881
|
}
|
|
878
882
|
else
|
|
@@ -882,10 +886,10 @@ function ds() {
|
|
|
882
886
|
}
|
|
883
887
|
}, "_removeAttribute"), Sn = /* @__PURE__ */ h(function(r) {
|
|
884
888
|
let u = null, b = null;
|
|
885
|
-
if (
|
|
889
|
+
if (Lt)
|
|
886
890
|
r = "<remove></remove>" + r;
|
|
887
891
|
else {
|
|
888
|
-
const F =
|
|
892
|
+
const F = Hn(r, /^[\r\n\t ]+/);
|
|
889
893
|
b = F && F[0];
|
|
890
894
|
}
|
|
891
895
|
et === "application/xhtml+xml" && Be === me && (r = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + r + "</body></html>");
|
|
@@ -898,12 +902,12 @@ function ds() {
|
|
|
898
902
|
if (!u || !u.documentElement) {
|
|
899
903
|
u = se.createDocument(Be, "template", null);
|
|
900
904
|
try {
|
|
901
|
-
u.documentElement.innerHTML =
|
|
905
|
+
u.documentElement.innerHTML = Nt ? ie : $;
|
|
902
906
|
} catch {
|
|
903
907
|
}
|
|
904
908
|
}
|
|
905
909
|
const X = u.body || u.documentElement;
|
|
906
|
-
return r && b && X.insertBefore(e.createTextNode(b), X.childNodes[0] || null), Be === me ?
|
|
910
|
+
return r && b && X.insertBefore(e.createTextNode(b), X.childNodes[0] || null), Be === me ? ze.call(u, Re ? "html" : "body")[0] : Re ? u.documentElement : X;
|
|
907
911
|
}, "_initDocument"), An = /* @__PURE__ */ h(function(r) {
|
|
908
912
|
return re.call(
|
|
909
913
|
r.ownerDocument || r,
|
|
@@ -912,31 +916,31 @@ function ds() {
|
|
|
912
916
|
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
913
917
|
null
|
|
914
918
|
);
|
|
915
|
-
}, "_createNodeIterator"),
|
|
916
|
-
return r instanceof d && (typeof r.nodeName != "string" || typeof r.textContent != "string" || typeof r.removeChild != "function" || !(r.attributes instanceof
|
|
917
|
-
}, "_isClobbered"),
|
|
919
|
+
}, "_createNodeIterator"), Ht = /* @__PURE__ */ h(function(r) {
|
|
920
|
+
return r instanceof d && (typeof r.nodeName != "string" || typeof r.textContent != "string" || typeof r.removeChild != "function" || !(r.attributes instanceof v) || typeof r.removeAttribute != "function" || typeof r.setAttribute != "function" || typeof r.namespaceURI != "string" || typeof r.insertBefore != "function" || typeof r.hasChildNodes != "function");
|
|
921
|
+
}, "_isClobbered"), Gt = /* @__PURE__ */ h(function(r) {
|
|
918
922
|
return typeof o == "function" && r instanceof o;
|
|
919
923
|
}, "_isNode");
|
|
920
924
|
function be(y, r, u) {
|
|
921
925
|
tt(y, (b) => {
|
|
922
|
-
b.call(t, r, u,
|
|
926
|
+
b.call(t, r, u, Ue);
|
|
923
927
|
});
|
|
924
928
|
}
|
|
925
929
|
h(be, "_executeHooks");
|
|
926
930
|
const En = /* @__PURE__ */ h(function(r) {
|
|
927
931
|
let u = null;
|
|
928
|
-
if (be(q.beforeSanitizeElements, r, null),
|
|
929
|
-
return
|
|
932
|
+
if (be(q.beforeSanitizeElements, r, null), Ht(r))
|
|
933
|
+
return ue(r), !0;
|
|
930
934
|
const b = G(r.nodeName);
|
|
931
935
|
if (be(q.uponSanitizeElement, r, {
|
|
932
936
|
tagName: b,
|
|
933
|
-
allowedTags:
|
|
934
|
-
}), Qe && r.hasChildNodes() && !
|
|
935
|
-
return
|
|
936
|
-
if (ae[b] || !(le.tagCheck instanceof Function && le.tagCheck(b)) && !
|
|
937
|
+
allowedTags: w
|
|
938
|
+
}), Qe && r.hasChildNodes() && !Gt(r.firstElementChild) && Y(/<[/\w!]/g, r.innerHTML) && Y(/<[/\w!]/g, r.textContent) || Qe && r.namespaceURI === me && b === "style" && Gt(r.firstElementChild) || r.nodeType === it.progressingInstruction || Qe && r.nodeType === it.comment && Y(/<[/\w]/g, r.data))
|
|
939
|
+
return ue(r), !0;
|
|
940
|
+
if (ae[b] || !(le.tagCheck instanceof Function && le.tagCheck(b)) && !w[b]) {
|
|
937
941
|
if (!ae[b] && Rn(b) && (C.tagNameCheck instanceof RegExp && Y(C.tagNameCheck, b) || C.tagNameCheck instanceof Function && C.tagNameCheck(b)))
|
|
938
942
|
return !1;
|
|
939
|
-
if (
|
|
943
|
+
if (Ot && !ge[b]) {
|
|
940
944
|
const $ = W(r) || r.parentNode, X = Q(r) || r.childNodes;
|
|
941
945
|
if (X && $) {
|
|
942
946
|
const F = X.length;
|
|
@@ -946,18 +950,18 @@ function ds() {
|
|
|
946
950
|
}
|
|
947
951
|
}
|
|
948
952
|
}
|
|
949
|
-
return
|
|
953
|
+
return ue(r), !0;
|
|
950
954
|
}
|
|
951
|
-
return r instanceof p && !
|
|
955
|
+
return r instanceof p && !Cs(r) || (b === "noscript" || b === "noembed" || b === "noframes") && Y(/<\/no(script|embed|frames)/i, r.innerHTML) ? (ue(r), !0) : (_e && r.nodeType === it.text && (u = r.textContent, tt([ve, Ae, Pe], ($) => {
|
|
952
956
|
u = He(u, $, " ");
|
|
953
957
|
}), r.textContent !== u && (nt(t.removed, {
|
|
954
958
|
element: r.cloneNode()
|
|
955
959
|
}), r.textContent = u)), be(q.afterSanitizeElements, r, null), !1);
|
|
956
960
|
}, "_sanitizeElements"), _n = /* @__PURE__ */ h(function(r, u, b) {
|
|
957
|
-
if (Ee[u] || gn && (u === "id" || u === "name") && (b in e || b in
|
|
961
|
+
if (Ee[u] || gn && (u === "id" || u === "name") && (b in e || b in Is))
|
|
958
962
|
return !1;
|
|
959
|
-
if (!(
|
|
960
|
-
if (!(pn && Y(
|
|
963
|
+
if (!(Dt && !Ee[u] && Y(Rt, u))) {
|
|
964
|
+
if (!(pn && Y(It, u))) {
|
|
961
965
|
if (!(le.attributeCheck instanceof Function && le.attributeCheck(u, r))) {
|
|
962
966
|
if (!g[u] || Ee[u]) {
|
|
963
967
|
if (
|
|
@@ -968,10 +972,10 @@ function ds() {
|
|
|
968
972
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
969
973
|
u === "is" && C.allowCustomizedBuiltInElements && (C.tagNameCheck instanceof RegExp && Y(C.tagNameCheck, b) || C.tagNameCheck instanceof Function && C.tagNameCheck(b)))
|
|
970
974
|
) return !1;
|
|
971
|
-
} else if (!
|
|
975
|
+
} else if (!Pt[u]) {
|
|
972
976
|
if (!Y(Ke, He(b, ct, ""))) {
|
|
973
|
-
if (!((u === "src" || u === "xlink:href" || u === "href") && r !== "script" &&
|
|
974
|
-
if (!(dn && !Y(
|
|
977
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && r !== "script" && Gn(b, "data:") === 0 && bn[r])) {
|
|
978
|
+
if (!(dn && !Y(Ct, He(b, ct, "")))) {
|
|
975
979
|
if (b)
|
|
976
980
|
return !1;
|
|
977
981
|
}
|
|
@@ -982,14 +986,14 @@ function ds() {
|
|
|
982
986
|
}
|
|
983
987
|
}
|
|
984
988
|
return !0;
|
|
985
|
-
}, "_isValidAttribute"),
|
|
986
|
-
return !
|
|
989
|
+
}, "_isValidAttribute"), Ds = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), Rn = /* @__PURE__ */ h(function(r) {
|
|
990
|
+
return !Ds[at(r)] && Y(ut, r);
|
|
987
991
|
}, "_isBasicCustomElement"), In = /* @__PURE__ */ h(function(r) {
|
|
988
992
|
be(q.beforeSanitizeAttributes, r, null);
|
|
989
993
|
const {
|
|
990
994
|
attributes: u
|
|
991
995
|
} = r;
|
|
992
|
-
if (!u ||
|
|
996
|
+
if (!u || Ht(r))
|
|
993
997
|
return;
|
|
994
998
|
const b = {
|
|
995
999
|
attrName: "",
|
|
@@ -1004,13 +1008,13 @@ function ds() {
|
|
|
1004
1008
|
name: F,
|
|
1005
1009
|
namespaceURI: te,
|
|
1006
1010
|
value: oe
|
|
1007
|
-
} = X,
|
|
1008
|
-
let V = F === "value" ?
|
|
1009
|
-
if (b.attrName =
|
|
1011
|
+
} = X, he = G(F), jt = oe;
|
|
1012
|
+
let V = F === "value" ? jt : ii(jt);
|
|
1013
|
+
if (b.attrName = he, b.attrValue = V, b.keepAttr = !0, b.forceKeepAttr = void 0, be(q.uponSanitizeAttribute, r, b), V = b.attrValue, mn && (he === "id" || he === "name") && Gn(V, xn) !== 0 && (Ie(F, r), V = xn + V), Qe && Y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, V)) {
|
|
1010
1014
|
Ie(F, r);
|
|
1011
1015
|
continue;
|
|
1012
1016
|
}
|
|
1013
|
-
if (
|
|
1017
|
+
if (he === "attributename" && Hn(V, "href")) {
|
|
1014
1018
|
Ie(F, r);
|
|
1015
1019
|
continue;
|
|
1016
1020
|
}
|
|
@@ -1024,16 +1028,16 @@ function ds() {
|
|
|
1024
1028
|
Ie(F, r);
|
|
1025
1029
|
continue;
|
|
1026
1030
|
}
|
|
1027
|
-
_e && tt([
|
|
1031
|
+
_e && tt([ve, Ae, Pe], (Mn) => {
|
|
1028
1032
|
V = He(V, Mn, " ");
|
|
1029
1033
|
});
|
|
1030
1034
|
const Dn = G(r.nodeName);
|
|
1031
|
-
if (!_n(Dn,
|
|
1035
|
+
if (!_n(Dn, he, V)) {
|
|
1032
1036
|
Ie(F, r);
|
|
1033
1037
|
continue;
|
|
1034
1038
|
}
|
|
1035
1039
|
if (N && typeof m == "object" && typeof m.getAttributeType == "function" && !te)
|
|
1036
|
-
switch (m.getAttributeType(Dn,
|
|
1040
|
+
switch (m.getAttributeType(Dn, he)) {
|
|
1037
1041
|
case "TrustedHTML": {
|
|
1038
1042
|
V = N.createHTML(V);
|
|
1039
1043
|
break;
|
|
@@ -1043,9 +1047,9 @@ function ds() {
|
|
|
1043
1047
|
break;
|
|
1044
1048
|
}
|
|
1045
1049
|
}
|
|
1046
|
-
if (V !==
|
|
1050
|
+
if (V !== jt)
|
|
1047
1051
|
try {
|
|
1048
|
-
te ? r.setAttributeNS(te, F, V) : r.setAttribute(F, V),
|
|
1052
|
+
te ? r.setAttributeNS(te, F, V) : r.setAttribute(F, V), Ht(r) ? ue(r) : Fn(t.removed);
|
|
1049
1053
|
} catch {
|
|
1050
1054
|
Ie(F, r);
|
|
1051
1055
|
}
|
|
@@ -1060,87 +1064,87 @@ function ds() {
|
|
|
1060
1064
|
}, "_sanitizeShadowDOM");
|
|
1061
1065
|
return t.sanitize = function(y) {
|
|
1062
1066
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, b = null, $ = null, X = null;
|
|
1063
|
-
if (
|
|
1067
|
+
if (Nt = !y, Nt && (y = "<!-->"), typeof y != "string" && !Gt(y) && (y = ci(y), typeof y != "string"))
|
|
1064
1068
|
throw mt("dirty is not a string, aborting");
|
|
1065
1069
|
if (!t.isSupported)
|
|
1066
1070
|
return y;
|
|
1067
|
-
if (
|
|
1071
|
+
if (Mt || Ft(r), t.removed = [], typeof y == "string" && (Je = !1), Je) {
|
|
1068
1072
|
const oe = y.nodeName;
|
|
1069
1073
|
if (typeof oe == "string") {
|
|
1070
|
-
const
|
|
1071
|
-
if (!
|
|
1074
|
+
const he = G(oe);
|
|
1075
|
+
if (!w[he] || ae[he])
|
|
1072
1076
|
throw mt("root node is forbidden and cannot be sanitized in-place");
|
|
1073
1077
|
}
|
|
1074
1078
|
} else if (y instanceof o)
|
|
1075
1079
|
u = Sn("<!---->"), b = u.ownerDocument.importNode(y, !0), b.nodeType === it.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? u = b : u.appendChild(b);
|
|
1076
1080
|
else {
|
|
1077
|
-
if (
|
|
1081
|
+
if (!Ne && !_e && !Re && // eslint-disable-next-line unicorn/prefer-includes
|
|
1078
1082
|
y.indexOf("<") === -1)
|
|
1079
1083
|
return N && pt ? N.createHTML(y) : y;
|
|
1080
1084
|
if (u = Sn(y), !u)
|
|
1081
|
-
return
|
|
1085
|
+
return Ne ? null : pt ? ie : "";
|
|
1082
1086
|
}
|
|
1083
|
-
u &&
|
|
1087
|
+
u && Lt && ue(u.firstChild);
|
|
1084
1088
|
const F = An(Je ? y : u);
|
|
1085
1089
|
for (; $ = F.nextNode(); )
|
|
1086
1090
|
En($), In($), $.content instanceof s && Cn($.content);
|
|
1087
1091
|
if (Je)
|
|
1088
1092
|
return y;
|
|
1089
|
-
if (
|
|
1093
|
+
if (Ne) {
|
|
1090
1094
|
if (_e) {
|
|
1091
1095
|
u.normalize();
|
|
1092
1096
|
let oe = u.innerHTML;
|
|
1093
|
-
tt([
|
|
1094
|
-
oe = He(oe,
|
|
1097
|
+
tt([ve, Ae, Pe], (he) => {
|
|
1098
|
+
oe = He(oe, he, " ");
|
|
1095
1099
|
}), u.innerHTML = oe;
|
|
1096
1100
|
}
|
|
1097
1101
|
if (ht)
|
|
1098
|
-
for (X =
|
|
1102
|
+
for (X = Oe.call(u.ownerDocument); u.firstChild; )
|
|
1099
1103
|
X.appendChild(u.firstChild);
|
|
1100
1104
|
else
|
|
1101
1105
|
X = u;
|
|
1102
1106
|
return (g.shadowroot || g.shadowrootmode) && (X = L.call(n, X, !0)), X;
|
|
1103
1107
|
}
|
|
1104
1108
|
let te = Re ? u.outerHTML : u.innerHTML;
|
|
1105
|
-
return Re &&
|
|
1106
|
-
` + te), _e && tt([
|
|
1109
|
+
return Re && w["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && Y(ds, u.ownerDocument.doctype.name) && (te = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
1110
|
+
` + te), _e && tt([ve, Ae, Pe], (oe) => {
|
|
1107
1111
|
te = He(te, oe, " ");
|
|
1108
1112
|
}), N && pt ? N.createHTML(te) : te;
|
|
1109
1113
|
}, t.setConfig = function() {
|
|
1110
1114
|
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1111
|
-
|
|
1115
|
+
Ft(y), Mt = !0;
|
|
1112
1116
|
}, t.clearConfig = function() {
|
|
1113
|
-
|
|
1117
|
+
Ue = null, Mt = !1;
|
|
1114
1118
|
}, t.isValidAttribute = function(y, r, u) {
|
|
1115
|
-
|
|
1119
|
+
Ue || Ft({});
|
|
1116
1120
|
const b = G(y), $ = G(r);
|
|
1117
1121
|
return _n(b, $, u);
|
|
1118
1122
|
}, t.addHook = function(y, r) {
|
|
1119
1123
|
typeof r == "function" && nt(q[y], r);
|
|
1120
1124
|
}, t.removeHook = function(y, r) {
|
|
1121
1125
|
if (r !== void 0) {
|
|
1122
|
-
const u =
|
|
1123
|
-
return u === -1 ? void 0 :
|
|
1126
|
+
const u = ni(q[y], r);
|
|
1127
|
+
return u === -1 ? void 0 : si(q[y], u, 1)[0];
|
|
1124
1128
|
}
|
|
1125
|
-
return
|
|
1129
|
+
return Fn(q[y]);
|
|
1126
1130
|
}, t.removeHooks = function(y) {
|
|
1127
1131
|
q[y] = [];
|
|
1128
1132
|
}, t.removeAllHooks = function() {
|
|
1129
|
-
q =
|
|
1133
|
+
q = Kn();
|
|
1130
1134
|
}, t;
|
|
1131
1135
|
}
|
|
1132
|
-
h(
|
|
1133
|
-
var
|
|
1136
|
+
h(fs, "createDOMPurify");
|
|
1137
|
+
var Ti = fs();
|
|
1134
1138
|
function tn() {
|
|
1135
1139
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1136
1140
|
}
|
|
1137
1141
|
h(tn, "z");
|
|
1138
|
-
var
|
|
1139
|
-
function
|
|
1140
|
-
|
|
1142
|
+
var Le = tn();
|
|
1143
|
+
function gs(a) {
|
|
1144
|
+
Le = a;
|
|
1141
1145
|
}
|
|
1142
|
-
h(
|
|
1143
|
-
var
|
|
1146
|
+
h(gs, "G");
|
|
1147
|
+
var De = { exec: /* @__PURE__ */ h(() => null, "exec") };
|
|
1144
1148
|
function M(a, t = "") {
|
|
1145
1149
|
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */ h((i, s) => {
|
|
1146
1150
|
let l = typeof s == "string" ? s : s.source;
|
|
@@ -1149,22 +1153,22 @@ function M(a, t = "") {
|
|
|
1149
1153
|
return n;
|
|
1150
1154
|
}
|
|
1151
1155
|
h(M, "d");
|
|
1152
|
-
var
|
|
1156
|
+
var Si = ((a = "") => {
|
|
1153
1157
|
try {
|
|
1154
1158
|
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
1155
1159
|
} catch {
|
|
1156
1160
|
return !1;
|
|
1157
1161
|
}
|
|
1158
|
-
})(), K = { 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__ */ h((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") },
|
|
1159
|
-
]`).replace("lheading",
|
|
1162
|
+
})(), K = { 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__ */ h((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") }, Ai = /^(?:[ \t]*(?:\n|$))+/, Ei = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, _i = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ot = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ri = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, nn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ms = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, xs = M(ms).replace(/bull/g, nn).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(), Ii = M(ms).replace(/bull/g, nn).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(), sn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ci = /^[^\n]+/, rn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Di = M(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", rn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Mi = M(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, nn).getRegex(), Et = "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", an = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Li = M("^ {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", an).replace("tag", Et).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), bs = M(sn).replace("hr", ot).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]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Et).getRegex(), Oi = M(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", bs).getRegex(), ln = { blockquote: Oi, code: Ei, def: Di, fences: _i, heading: Ri, hr: ot, html: Li, lheading: xs, list: Mi, newline: Ai, paragraph: bs, table: De, text: Ci }, Qn = M("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ot).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", Et).getRegex(), zi = { ...ln, lheading: Ii, table: Qn, paragraph: M(sn).replace("hr", ot).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Qn).replace("blockquote", " {0,3}>").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", Et).getRegex() }, Pi = { ...ln, html: M(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", an).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: De, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: M(sn).replace("hr", ot).replace("heading", ` *#{1,6} *[^
|
|
1163
|
+
]`).replace("lheading", xs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ni = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, $i = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ks = /^( {2,}|\\)\n(?!\s*$)/, Bi = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Xe = /[\p{P}\p{S}]/u, _t = /[\s\p{P}\p{S}]/u, on = /[^\s\p{P}\p{S}]/u, Ui = M(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _t).getRegex(), vs = /(?!~)[\p{P}\p{S}]/u, Fi = /(?!~)[\s\p{P}\p{S}]/u, Hi = /(?:[^\s\p{P}\p{S}]|~)/u, Gi = M(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Si ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ws = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ji = M(ws, "u").replace(/punct/g, Xe).getRegex(), Wi = M(ws, "u").replace(/punct/g, vs).getRegex(), ys = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", qi = M(ys, "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, _t).replace(/punct/g, Xe).getRegex(), Vi = M(ys, "gu").replace(/notPunctSpace/g, Hi).replace(/punctSpace/g, Fi).replace(/punct/g, vs).getRegex(), Yi = M("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, _t).replace(/punct/g, Xe).getRegex(), Zi = M(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Xe).getRegex(), Xi = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ki = M(Xi, "gu").replace(/notPunctSpace/g, on).replace(/punctSpace/g, _t).replace(/punct/g, Xe).getRegex(), Qi = M(/\\(punct)/, "gu").replace(/punct/g, Xe).getRegex(), Ji = M(/^<(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(), er = M(an).replace("(?:-->|$)", "-->").getRegex(), tr = M("^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", er).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), yt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, nr = M(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", yt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ts = M(/^!?\[(label)\]\[(ref)\]/).replace("label", yt).replace("ref", rn).getRegex(), Ss = M(/^!?\[(ref)\](?:\[\])?/).replace("ref", rn).getRegex(), sr = M("reflink|nolink(?!\\()", "g").replace("reflink", Ts).replace("nolink", Ss).getRegex(), Jn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, cn = { _backpedal: De, anyPunctuation: Qi, autolink: Ji, blockSkip: Gi, br: ks, code: $i, del: De, delLDelim: De, delRDelim: De, emStrongLDelim: ji, emStrongRDelimAst: qi, emStrongRDelimUnd: Yi, escape: Ni, link: nr, nolink: Ss, punctuation: Ui, reflink: Ts, reflinkSearch: sr, tag: tr, text: Bi, url: De }, ir = { ...cn, link: M(/^!?\[(label)\]\((.*?)\)/).replace("label", yt).getRegex(), reflink: M(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", yt).getRegex() }, Jt = { ...cn, emStrongRDelimAst: Vi, emStrongLDelim: Wi, delLDelim: Zi, delRDelim: Ki, url: M(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Jn).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: M(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Jn).getRegex() }, rr = { ...Jt, br: M(ks).replace("{2,}", "*").getRegex(), text: M(Jt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, bt = { normal: ln, gfm: zi, pedantic: Pi }, rt = { normal: cn, gfm: Jt, breaks: rr, pedantic: ir }, ar = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, es = /* @__PURE__ */ h((a) => ar[a], "de");
|
|
1160
1164
|
function xe(a, t) {
|
|
1161
1165
|
if (t) {
|
|
1162
|
-
if (K.escapeTest.test(a)) return a.replace(K.escapeReplace,
|
|
1163
|
-
} else if (K.escapeTestNoEncode.test(a)) return a.replace(K.escapeReplaceNoEncode,
|
|
1166
|
+
if (K.escapeTest.test(a)) return a.replace(K.escapeReplace, es);
|
|
1167
|
+
} else if (K.escapeTestNoEncode.test(a)) return a.replace(K.escapeReplaceNoEncode, es);
|
|
1164
1168
|
return a;
|
|
1165
1169
|
}
|
|
1166
1170
|
h(xe, "O");
|
|
1167
|
-
function
|
|
1171
|
+
function ts(a) {
|
|
1168
1172
|
try {
|
|
1169
1173
|
a = encodeURI(a).replace(K.percentDecode, "%");
|
|
1170
1174
|
} catch {
|
|
@@ -1172,8 +1176,8 @@ function es(a) {
|
|
|
1172
1176
|
}
|
|
1173
1177
|
return a;
|
|
1174
1178
|
}
|
|
1175
|
-
h(
|
|
1176
|
-
function
|
|
1179
|
+
h(ts, "J");
|
|
1180
|
+
function ns(a, t) {
|
|
1177
1181
|
let e = a.replace(K.findPipe, (s, l, o) => {
|
|
1178
1182
|
let p = !1, c = l;
|
|
1179
1183
|
for (; --c >= 0 && o[c] === "\\"; ) p = !p;
|
|
@@ -1184,8 +1188,8 @@ function ts(a, t) {
|
|
|
1184
1188
|
for (; i < n.length; i++) n[i] = n[i].trim().replace(K.slashPipe, "|");
|
|
1185
1189
|
return n;
|
|
1186
1190
|
}
|
|
1187
|
-
h(
|
|
1188
|
-
function
|
|
1191
|
+
h(ns, "V");
|
|
1192
|
+
function we(a, t, e) {
|
|
1189
1193
|
let n = a.length;
|
|
1190
1194
|
if (n === 0) return "";
|
|
1191
1195
|
let i = 0;
|
|
@@ -1193,16 +1197,16 @@ function ve(a, t, e) {
|
|
|
1193
1197
|
i++;
|
|
1194
1198
|
return a.slice(0, n - i);
|
|
1195
1199
|
}
|
|
1196
|
-
h(
|
|
1197
|
-
function
|
|
1200
|
+
h(we, "$");
|
|
1201
|
+
function ss(a) {
|
|
1198
1202
|
let t = a.split(`
|
|
1199
1203
|
`), e = t.length - 1;
|
|
1200
1204
|
for (; e >= 0 && K.blankLine.test(t[e]); ) e--;
|
|
1201
1205
|
return t.length - e <= 2 ? a : t.slice(0, e + 1).join(`
|
|
1202
1206
|
`);
|
|
1203
1207
|
}
|
|
1204
|
-
h(
|
|
1205
|
-
function
|
|
1208
|
+
h(ss, "Y");
|
|
1209
|
+
function lr(a, t) {
|
|
1206
1210
|
if (a.indexOf(t[1]) === -1) return -1;
|
|
1207
1211
|
let e = 0;
|
|
1208
1212
|
for (let n = 0; n < a.length; n++) if (a[n] === "\\") n++;
|
|
@@ -1210,8 +1214,8 @@ function ar(a, t) {
|
|
|
1210
1214
|
else if (a[n] === t[1] && (e--, e < 0)) return n;
|
|
1211
1215
|
return e > 0 ? -2 : -1;
|
|
1212
1216
|
}
|
|
1213
|
-
h(
|
|
1214
|
-
function
|
|
1217
|
+
h(lr, "ge");
|
|
1218
|
+
function or(a, t = 0) {
|
|
1215
1219
|
let e = t, n = "";
|
|
1216
1220
|
for (let i of a) if (i === " ") {
|
|
1217
1221
|
let s = 4 - e % 4;
|
|
@@ -1219,15 +1223,15 @@ function lr(a, t = 0) {
|
|
|
1219
1223
|
} else n += i, e++;
|
|
1220
1224
|
return n;
|
|
1221
1225
|
}
|
|
1222
|
-
h(
|
|
1223
|
-
function
|
|
1226
|
+
h(or, "fe");
|
|
1227
|
+
function is(a, t, e, n, i) {
|
|
1224
1228
|
let s = t.href, l = t.title || null, o = a[1].replace(i.other.outputLinkReplace, "$1");
|
|
1225
1229
|
n.state.inLink = !0;
|
|
1226
1230
|
let p = { type: a[0].charAt(0) === "!" ? "image" : "link", raw: e, href: s, title: l, text: o, tokens: n.inlineTokens(o) };
|
|
1227
1231
|
return n.state.inLink = !1, p;
|
|
1228
1232
|
}
|
|
1229
|
-
h(
|
|
1230
|
-
function
|
|
1233
|
+
h(is, "me");
|
|
1234
|
+
function cr(a, t, e) {
|
|
1231
1235
|
let n = a.match(e.other.indentCodeCompensation);
|
|
1232
1236
|
if (n === null) return t;
|
|
1233
1237
|
let i = n[1];
|
|
@@ -1240,13 +1244,13 @@ function or(a, t, e) {
|
|
|
1240
1244
|
}).join(`
|
|
1241
1245
|
`);
|
|
1242
1246
|
}
|
|
1243
|
-
h(
|
|
1244
|
-
var We,
|
|
1247
|
+
h(cr, "rt");
|
|
1248
|
+
var We, Tt = (We = class {
|
|
1245
1249
|
constructor(t) {
|
|
1246
1250
|
D(this, "options");
|
|
1247
1251
|
D(this, "rules");
|
|
1248
1252
|
D(this, "lexer");
|
|
1249
|
-
this.options = t ||
|
|
1253
|
+
this.options = t || Le;
|
|
1250
1254
|
}
|
|
1251
1255
|
space(t) {
|
|
1252
1256
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1255,14 +1259,14 @@ var We, yt = (We = class {
|
|
|
1255
1259
|
code(t) {
|
|
1256
1260
|
let e = this.rules.block.code.exec(t);
|
|
1257
1261
|
if (e) {
|
|
1258
|
-
let n = this.options.pedantic ? e[0] :
|
|
1262
|
+
let n = this.options.pedantic ? e[0] : ss(e[0]), i = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
1259
1263
|
return { type: "code", raw: n, codeBlockStyle: "indented", text: i };
|
|
1260
1264
|
}
|
|
1261
1265
|
}
|
|
1262
1266
|
fences(t) {
|
|
1263
1267
|
let e = this.rules.block.fences.exec(t);
|
|
1264
1268
|
if (e) {
|
|
1265
|
-
let n = e[0], i =
|
|
1269
|
+
let n = e[0], i = cr(n, e[3] || "", this.rules);
|
|
1266
1270
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: i };
|
|
1267
1271
|
}
|
|
1268
1272
|
}
|
|
@@ -1271,22 +1275,22 @@ var We, yt = (We = class {
|
|
|
1271
1275
|
if (e) {
|
|
1272
1276
|
let n = e[2].trim();
|
|
1273
1277
|
if (this.rules.other.endingHash.test(n)) {
|
|
1274
|
-
let i =
|
|
1278
|
+
let i = we(n, "#");
|
|
1275
1279
|
(this.options.pedantic || !i || this.rules.other.endingSpaceChar.test(i)) && (n = i.trim());
|
|
1276
1280
|
}
|
|
1277
|
-
return { type: "heading", raw:
|
|
1281
|
+
return { type: "heading", raw: we(e[0], `
|
|
1278
1282
|
`), depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
1279
1283
|
}
|
|
1280
1284
|
}
|
|
1281
1285
|
hr(t) {
|
|
1282
1286
|
let e = this.rules.block.hr.exec(t);
|
|
1283
|
-
if (e) return { type: "hr", raw:
|
|
1287
|
+
if (e) return { type: "hr", raw: we(e[0], `
|
|
1284
1288
|
`) };
|
|
1285
1289
|
}
|
|
1286
1290
|
blockquote(t) {
|
|
1287
1291
|
let e = this.rules.block.blockquote.exec(t);
|
|
1288
1292
|
if (e) {
|
|
1289
|
-
let n =
|
|
1293
|
+
let n = we(e[0], `
|
|
1290
1294
|
`).split(`
|
|
1291
1295
|
`), i = "", s = "", l = [];
|
|
1292
1296
|
for (; n.length > 0; ) {
|
|
@@ -1295,11 +1299,11 @@ var We, yt = (We = class {
|
|
|
1295
1299
|
else if (!o) p.push(n[c]);
|
|
1296
1300
|
else break;
|
|
1297
1301
|
n = n.slice(c);
|
|
1298
|
-
let
|
|
1299
|
-
`), d =
|
|
1302
|
+
let v = p.join(`
|
|
1303
|
+
`), d = v.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1300
1304
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1301
1305
|
i = i ? `${i}
|
|
1302
|
-
${
|
|
1306
|
+
${v}` : v, s = s ? `${s}
|
|
1303
1307
|
${d}` : d;
|
|
1304
1308
|
let x = this.lexer.state.top;
|
|
1305
1309
|
if (this.lexer.state.top = !0, this.lexer.blockTokens(d, l, !0), this.lexer.state.top = x, n.length === 0) break;
|
|
@@ -1330,13 +1334,13 @@ ${d}` : d;
|
|
|
1330
1334
|
n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
|
|
1331
1335
|
let l = this.rules.other.listItemRegex(n), o = !1;
|
|
1332
1336
|
for (; t; ) {
|
|
1333
|
-
let c = !1,
|
|
1337
|
+
let c = !1, v = "", d = "";
|
|
1334
1338
|
if (!(e = l.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1335
|
-
|
|
1336
|
-
let x =
|
|
1339
|
+
v = e[0], t = t.substring(v.length);
|
|
1340
|
+
let x = or(e[2].split(`
|
|
1337
1341
|
`, 1)[0], e[1].length), m = t.split(`
|
|
1338
1342
|
`, 1)[0], f = !x.trim(), E = 0;
|
|
1339
|
-
if (this.options.pedantic ? (E = 2, d = x.trimStart()) : f ? E = e[1].length + 1 : (E = x.search(this.rules.other.nonSpaceChar), E = E > 4 ? 1 : E, d = x.slice(E), E += e[1].length), f && this.rules.other.blankLine.test(m) && (
|
|
1343
|
+
if (this.options.pedantic ? (E = 2, d = x.trimStart()) : f ? E = e[1].length + 1 : (E = x.search(this.rules.other.nonSpaceChar), E = E > 4 ? 1 : E, d = x.slice(E), E += e[1].length), f && this.rules.other.blankLine.test(m) && (v += m + `
|
|
1340
1344
|
`, t = t.substring(m.length + 1), c = !0), !c) {
|
|
1341
1345
|
let I = this.rules.other.nextBulletRegex(E), z = this.rules.other.hrRegex(E), Q = this.rules.other.fencesBeginRegex(E), W = this.rules.other.headingBeginRegex(E), N = this.rules.other.htmlBeginRegex(E), ie = this.rules.other.blockquoteBeginRegex(E);
|
|
1342
1346
|
for (; t; ) {
|
|
@@ -1350,11 +1354,11 @@ ${d}` : d;
|
|
|
1350
1354
|
d += `
|
|
1351
1355
|
` + m;
|
|
1352
1356
|
}
|
|
1353
|
-
f = !m.trim(),
|
|
1357
|
+
f = !m.trim(), v += se + `
|
|
1354
1358
|
`, t = t.substring(se.length + 1), x = re.slice(E);
|
|
1355
1359
|
}
|
|
1356
1360
|
}
|
|
1357
|
-
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1361
|
+
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(v) && (o = !0)), s.items.push({ type: "list_item", raw: v, task: !!this.options.gfm && this.rules.other.listIsTask.test(d), loose: !1, text: d, tokens: [] }), s.raw += v;
|
|
1358
1362
|
}
|
|
1359
1363
|
let p = s.items.at(-1);
|
|
1360
1364
|
if (p) p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
|
|
@@ -1362,9 +1366,9 @@ ${d}` : d;
|
|
|
1362
1366
|
s.raw = s.raw.trimEnd();
|
|
1363
1367
|
for (let c of s.items) {
|
|
1364
1368
|
this.lexer.state.top = !1, c.tokens = this.lexer.blockTokens(c.text, []);
|
|
1365
|
-
let
|
|
1366
|
-
if (c.task && (
|
|
1367
|
-
c.text = c.text.replace(this.rules.other.listReplaceTask, ""),
|
|
1369
|
+
let v = c.tokens[0];
|
|
1370
|
+
if (c.task && (v?.type === "text" || v?.type === "paragraph")) {
|
|
1371
|
+
c.text = c.text.replace(this.rules.other.listReplaceTask, ""), v.raw = v.raw.replace(this.rules.other.listReplaceTask, ""), v.text = v.text.replace(this.rules.other.listReplaceTask, "");
|
|
1368
1372
|
for (let x = this.lexer.inlineQueue.length - 1; x >= 0; x--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)) {
|
|
1369
1373
|
this.lexer.inlineQueue[x].src = this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask, "");
|
|
1370
1374
|
break;
|
|
@@ -1382,7 +1386,7 @@ ${d}` : d;
|
|
|
1382
1386
|
}
|
|
1383
1387
|
if (s.loose) for (let c of s.items) {
|
|
1384
1388
|
c.loose = !0;
|
|
1385
|
-
for (let
|
|
1389
|
+
for (let v of c.tokens) v.type === "text" && (v.type = "paragraph");
|
|
1386
1390
|
}
|
|
1387
1391
|
return s;
|
|
1388
1392
|
}
|
|
@@ -1390,7 +1394,7 @@ ${d}` : d;
|
|
|
1390
1394
|
html(t) {
|
|
1391
1395
|
let e = this.rules.block.html.exec(t);
|
|
1392
1396
|
if (e) {
|
|
1393
|
-
let n =
|
|
1397
|
+
let n = ss(e[0]);
|
|
1394
1398
|
return { type: "html", block: !0, raw: n, pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: n };
|
|
1395
1399
|
}
|
|
1396
1400
|
}
|
|
@@ -1398,20 +1402,20 @@ ${d}` : d;
|
|
|
1398
1402
|
let e = this.rules.block.def.exec(t);
|
|
1399
1403
|
if (e) {
|
|
1400
1404
|
let n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), i = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
1401
|
-
return { type: "def", tag: n, raw:
|
|
1405
|
+
return { type: "def", tag: n, raw: we(e[0], `
|
|
1402
1406
|
`), href: i, title: s };
|
|
1403
1407
|
}
|
|
1404
1408
|
}
|
|
1405
1409
|
table(t) {
|
|
1406
1410
|
let e = this.rules.block.table.exec(t);
|
|
1407
1411
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1408
|
-
let n =
|
|
1409
|
-
`) : [], l = { type: "table", raw:
|
|
1412
|
+
let n = ns(e[1]), i = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1413
|
+
`) : [], l = { type: "table", raw: we(e[0], `
|
|
1410
1414
|
`), header: [], align: [], rows: [] };
|
|
1411
1415
|
if (n.length === i.length) {
|
|
1412
1416
|
for (let o of i) this.rules.other.tableAlignRight.test(o) ? l.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? l.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? l.align.push("left") : l.align.push(null);
|
|
1413
1417
|
for (let o = 0; o < n.length; o++) l.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: l.align[o] });
|
|
1414
|
-
for (let o of s) l.rows.push(
|
|
1418
|
+
for (let o of s) l.rows.push(ns(o, l.header.length).map((p, c) => ({ text: p, tokens: this.lexer.inline(p), header: !1, align: l.align[c] })));
|
|
1415
1419
|
return l;
|
|
1416
1420
|
}
|
|
1417
1421
|
}
|
|
@@ -1419,7 +1423,7 @@ ${d}` : d;
|
|
|
1419
1423
|
let e = this.rules.block.lheading.exec(t);
|
|
1420
1424
|
if (e) {
|
|
1421
1425
|
let n = e[1].trim();
|
|
1422
|
-
return { type: "heading", raw:
|
|
1426
|
+
return { type: "heading", raw: we(e[0], `
|
|
1423
1427
|
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
1424
1428
|
}
|
|
1425
1429
|
}
|
|
@@ -1449,10 +1453,10 @@ ${d}` : d;
|
|
|
1449
1453
|
let n = e[2].trim();
|
|
1450
1454
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1451
1455
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1452
|
-
let l =
|
|
1456
|
+
let l = we(n.slice(0, -1), "\\");
|
|
1453
1457
|
if ((n.length - l.length) % 2 === 0) return;
|
|
1454
1458
|
} else {
|
|
1455
|
-
let l =
|
|
1459
|
+
let l = lr(e[2], "()");
|
|
1456
1460
|
if (l === -2) return;
|
|
1457
1461
|
if (l > -1) {
|
|
1458
1462
|
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
@@ -1464,7 +1468,7 @@ ${d}` : d;
|
|
|
1464
1468
|
let l = this.rules.other.pedanticHrefTitle.exec(i);
|
|
1465
1469
|
l && (i = l[1], s = l[3]);
|
|
1466
1470
|
} else s = e[3] ? e[3].slice(1, -1) : "";
|
|
1467
|
-
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? i = i.slice(1) : i = i.slice(1, -1)),
|
|
1471
|
+
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), is(e, { href: i && i.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
1468
1472
|
}
|
|
1469
1473
|
}
|
|
1470
1474
|
reflink(t, e) {
|
|
@@ -1475,14 +1479,14 @@ ${d}` : d;
|
|
|
1475
1479
|
let l = n[0].charAt(0);
|
|
1476
1480
|
return { type: "text", raw: l, text: l };
|
|
1477
1481
|
}
|
|
1478
|
-
return
|
|
1482
|
+
return is(n, s, n[0], this.lexer, this.rules);
|
|
1479
1483
|
}
|
|
1480
1484
|
}
|
|
1481
1485
|
emStrong(t, e, n = "") {
|
|
1482
1486
|
let i = this.rules.inline.emStrongLDelim.exec(t);
|
|
1483
1487
|
if (!(!i || !i[1] && !i[2] && !i[3] && !i[4] || i[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(i[1] || i[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1484
|
-
let s = [...i[0]].length - 1, l, o, p = s, c = 0,
|
|
1485
|
-
for (
|
|
1488
|
+
let s = [...i[0]].length - 1, l, o, p = s, c = 0, v = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1489
|
+
for (v.lastIndex = 0, e = e.slice(-1 * t.length + s); (i = v.exec(e)) !== null; ) {
|
|
1486
1490
|
if (l = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !l) continue;
|
|
1487
1491
|
if (o = [...l].length, i[3] || i[4]) {
|
|
1488
1492
|
p += o;
|
|
@@ -1526,7 +1530,7 @@ ${d}` : d;
|
|
|
1526
1530
|
}
|
|
1527
1531
|
if (p -= o, p > 0) continue;
|
|
1528
1532
|
o = Math.min(o, o + p);
|
|
1529
|
-
let
|
|
1533
|
+
let v = [...i[0]][0].length, d = t.slice(0, s + i.index + v + o), x = d.slice(s, -s);
|
|
1530
1534
|
return { type: "del", raw: d, text: x, tokens: this.lexer.inlineTokens(x) };
|
|
1531
1535
|
}
|
|
1532
1536
|
}
|
|
@@ -1567,7 +1571,7 @@ ${d}` : d;
|
|
|
1567
1571
|
D(this, "state");
|
|
1568
1572
|
D(this, "inlineQueue");
|
|
1569
1573
|
D(this, "tokenizer");
|
|
1570
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1574
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new Tt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1571
1575
|
let e = { other: K, block: bt.normal, inline: rt.normal };
|
|
1572
1576
|
this.options.pedantic ? (e.block = bt.pedantic, e.inline = rt.pedantic) : this.options.gfm && (e.block = bt.gfm, this.options.breaks ? e.inline = rt.breaks : e.inline = rt.gfm), this.tokenizer.rules = e;
|
|
1573
1577
|
}
|
|
@@ -1660,8 +1664,8 @@ ${d}` : d;
|
|
|
1660
1664
|
let l = t;
|
|
1661
1665
|
if (this.options.extensions?.startBlock) {
|
|
1662
1666
|
let o = 1 / 0, p = t.slice(1), c;
|
|
1663
|
-
this.options.extensions.startBlock.forEach((
|
|
1664
|
-
c =
|
|
1667
|
+
this.options.extensions.startBlock.forEach((v) => {
|
|
1668
|
+
c = v.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (o = Math.min(o, c));
|
|
1665
1669
|
}), o < 1 / 0 && o >= 0 && (l = t.substring(0, o + 1));
|
|
1666
1670
|
}
|
|
1667
1671
|
if (this.state.top && (s = this.tokenizer.paragraph(l))) {
|
|
@@ -1754,14 +1758,14 @@ ${d}` : d;
|
|
|
1754
1758
|
t = t.substring(c.raw.length), e.push(c);
|
|
1755
1759
|
continue;
|
|
1756
1760
|
}
|
|
1757
|
-
let
|
|
1761
|
+
let v = t;
|
|
1758
1762
|
if (this.options.extensions?.startInline) {
|
|
1759
1763
|
let d = 1 / 0, x = t.slice(1), m;
|
|
1760
1764
|
this.options.extensions.startInline.forEach((f) => {
|
|
1761
1765
|
m = f.call({ lexer: this }, x), typeof m == "number" && m >= 0 && (d = Math.min(d, m));
|
|
1762
|
-
}), d < 1 / 0 && d >= 0 && (
|
|
1766
|
+
}), d < 1 / 0 && d >= 0 && (v = t.substring(0, d + 1));
|
|
1763
1767
|
}
|
|
1764
|
-
if (c = this.tokenizer.inlineText(
|
|
1768
|
+
if (c = this.tokenizer.inlineText(v)) {
|
|
1765
1769
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), l = !0;
|
|
1766
1770
|
let d = e.at(-1);
|
|
1767
1771
|
d?.type === "text" ? (d.raw += c.raw, d.text += c.text) : e.push(c);
|
|
@@ -1779,11 +1783,11 @@ ${d}` : d;
|
|
|
1779
1783
|
if (this.options.silent) console.error(e);
|
|
1780
1784
|
else throw new Error(e);
|
|
1781
1785
|
}
|
|
1782
|
-
}, h(Te, "l"), Te), qe,
|
|
1786
|
+
}, h(Te, "l"), Te), qe, St = (qe = class {
|
|
1783
1787
|
constructor(t) {
|
|
1784
1788
|
D(this, "options");
|
|
1785
1789
|
D(this, "parser");
|
|
1786
|
-
this.options = t ||
|
|
1790
|
+
this.options = t || Le;
|
|
1787
1791
|
}
|
|
1788
1792
|
space(t) {
|
|
1789
1793
|
return "";
|
|
@@ -1879,7 +1883,7 @@ ${t}</tr>
|
|
|
1879
1883
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
1880
1884
|
}
|
|
1881
1885
|
link({ href: t, title: e, tokens: n }) {
|
|
1882
|
-
let i = this.parser.parseInline(n), s =
|
|
1886
|
+
let i = this.parser.parseInline(n), s = ts(t);
|
|
1883
1887
|
if (s === null) return i;
|
|
1884
1888
|
t = s;
|
|
1885
1889
|
let l = '<a href="' + t + '"';
|
|
@@ -1887,7 +1891,7 @@ ${t}</tr>
|
|
|
1887
1891
|
}
|
|
1888
1892
|
image({ href: t, title: e, text: n, tokens: i }) {
|
|
1889
1893
|
i && (n = this.parser.parseInline(i, this.parser.textRenderer));
|
|
1890
|
-
let s =
|
|
1894
|
+
let s = ts(t);
|
|
1891
1895
|
if (s === null) return xe(n);
|
|
1892
1896
|
t = s;
|
|
1893
1897
|
let l = `<img src="${t}" alt="${xe(n)}"`;
|
|
@@ -1932,7 +1936,7 @@ ${t}</tr>
|
|
|
1932
1936
|
D(this, "options");
|
|
1933
1937
|
D(this, "renderer");
|
|
1934
1938
|
D(this, "textRenderer");
|
|
1935
|
-
this.options = t ||
|
|
1939
|
+
this.options = t || Le, this.options.renderer = this.options.renderer || new St(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new un();
|
|
1936
1940
|
}
|
|
1937
1941
|
static parse(t, e) {
|
|
1938
1942
|
return new Se(e).parse(t);
|
|
@@ -2082,7 +2086,7 @@ ${t}</tr>
|
|
|
2082
2086
|
constructor(t) {
|
|
2083
2087
|
D(this, "options");
|
|
2084
2088
|
D(this, "block");
|
|
2085
|
-
this.options = t ||
|
|
2089
|
+
this.options = t || Le;
|
|
2086
2090
|
}
|
|
2087
2091
|
preprocess(t) {
|
|
2088
2092
|
return t;
|
|
@@ -2102,17 +2106,17 @@ ${t}</tr>
|
|
|
2102
2106
|
provideParser(t = this.block) {
|
|
2103
2107
|
return t ? fe.parse : fe.parseInline;
|
|
2104
2108
|
}
|
|
2105
|
-
}, h(ye, "P"), D(ye, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), D(ye, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), ye), Ye,
|
|
2109
|
+
}, h(ye, "P"), D(ye, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), D(ye, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), ye), Ye, ur = (Ye = class {
|
|
2106
2110
|
constructor(...t) {
|
|
2107
2111
|
D(this, "defaults", tn());
|
|
2108
2112
|
D(this, "options", this.setOptions);
|
|
2109
2113
|
D(this, "parse", this.parseMarkdown(!0));
|
|
2110
2114
|
D(this, "parseInline", this.parseMarkdown(!1));
|
|
2111
2115
|
D(this, "Parser", fe);
|
|
2112
|
-
D(this, "Renderer",
|
|
2116
|
+
D(this, "Renderer", St);
|
|
2113
2117
|
D(this, "TextRenderer", un);
|
|
2114
2118
|
D(this, "Lexer", de);
|
|
2115
|
-
D(this, "Tokenizer",
|
|
2119
|
+
D(this, "Tokenizer", Tt);
|
|
2116
2120
|
D(this, "Hooks", lt);
|
|
2117
2121
|
this.use(...t);
|
|
2118
2122
|
}
|
|
@@ -2160,27 +2164,27 @@ ${t}</tr>
|
|
|
2160
2164
|
}
|
|
2161
2165
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
2162
2166
|
}), i.extensions = e), n.renderer) {
|
|
2163
|
-
let s = this.defaults.renderer || new
|
|
2167
|
+
let s = this.defaults.renderer || new St(this.defaults);
|
|
2164
2168
|
for (let l in n.renderer) {
|
|
2165
2169
|
if (!(l in s)) throw new Error(`renderer '${l}' does not exist`);
|
|
2166
2170
|
if (["options", "parser"].includes(l)) continue;
|
|
2167
2171
|
let o = l, p = n.renderer[o], c = s[o];
|
|
2168
|
-
s[o] = (...
|
|
2169
|
-
let d = p.apply(s,
|
|
2170
|
-
return d === !1 && (d = c.apply(s,
|
|
2172
|
+
s[o] = (...v) => {
|
|
2173
|
+
let d = p.apply(s, v);
|
|
2174
|
+
return d === !1 && (d = c.apply(s, v)), d || "";
|
|
2171
2175
|
};
|
|
2172
2176
|
}
|
|
2173
2177
|
i.renderer = s;
|
|
2174
2178
|
}
|
|
2175
2179
|
if (n.tokenizer) {
|
|
2176
|
-
let s = this.defaults.tokenizer || new
|
|
2180
|
+
let s = this.defaults.tokenizer || new Tt(this.defaults);
|
|
2177
2181
|
for (let l in n.tokenizer) {
|
|
2178
2182
|
if (!(l in s)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
2179
2183
|
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
2180
2184
|
let o = l, p = n.tokenizer[o], c = s[o];
|
|
2181
|
-
s[o] = (...
|
|
2182
|
-
let d = p.apply(s,
|
|
2183
|
-
return d === !1 && (d = c.apply(s,
|
|
2185
|
+
s[o] = (...v) => {
|
|
2186
|
+
let d = p.apply(s, v);
|
|
2187
|
+
return d === !1 && (d = c.apply(s, v)), d;
|
|
2184
2188
|
};
|
|
2185
2189
|
}
|
|
2186
2190
|
i.tokenizer = s;
|
|
@@ -2191,20 +2195,20 @@ ${t}</tr>
|
|
|
2191
2195
|
if (!(l in s)) throw new Error(`hook '${l}' does not exist`);
|
|
2192
2196
|
if (["options", "block"].includes(l)) continue;
|
|
2193
2197
|
let o = l, p = n.hooks[o], c = s[o];
|
|
2194
|
-
lt.passThroughHooks.has(l) ? s[o] = (
|
|
2198
|
+
lt.passThroughHooks.has(l) ? s[o] = (v) => {
|
|
2195
2199
|
if (this.defaults.async && lt.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
2196
|
-
let x = await p.call(s,
|
|
2200
|
+
let x = await p.call(s, v);
|
|
2197
2201
|
return c.call(s, x);
|
|
2198
2202
|
})();
|
|
2199
|
-
let d = p.call(s,
|
|
2203
|
+
let d = p.call(s, v);
|
|
2200
2204
|
return c.call(s, d);
|
|
2201
|
-
} : s[o] = (...
|
|
2205
|
+
} : s[o] = (...v) => {
|
|
2202
2206
|
if (this.defaults.async) return (async () => {
|
|
2203
|
-
let x = await p.apply(s,
|
|
2204
|
-
return x === !1 && (x = await c.apply(s,
|
|
2207
|
+
let x = await p.apply(s, v);
|
|
2208
|
+
return x === !1 && (x = await c.apply(s, v)), x;
|
|
2205
2209
|
})();
|
|
2206
|
-
let d = p.apply(s,
|
|
2207
|
-
return d === !1 && (d = c.apply(s,
|
|
2210
|
+
let d = p.apply(s, v);
|
|
2211
|
+
return d === !1 && (d = c.apply(s, v)), d;
|
|
2208
2212
|
};
|
|
2209
2213
|
}
|
|
2210
2214
|
i.hooks = s;
|
|
@@ -2237,8 +2241,8 @@ ${t}</tr>
|
|
|
2237
2241
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = t), s.async) return (async () => {
|
|
2238
2242
|
let o = s.hooks ? await s.hooks.preprocess(e) : e, p = await (s.hooks ? await s.hooks.provideLexer(t) : t ? de.lex : de.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
2239
2243
|
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
2240
|
-
let
|
|
2241
|
-
return s.hooks ? await s.hooks.postprocess(
|
|
2244
|
+
let v = await (s.hooks ? await s.hooks.provideParser(t) : t ? fe.parse : fe.parseInline)(c, s);
|
|
2245
|
+
return s.hooks ? await s.hooks.postprocess(v) : v;
|
|
2242
2246
|
})().catch(l);
|
|
2243
2247
|
try {
|
|
2244
2248
|
s.hooks && (e = s.hooks.preprocess(e));
|
|
@@ -2262,30 +2266,30 @@ Please report this to https://github.com/markedjs/marked.`, t) {
|
|
|
2262
2266
|
throw n;
|
|
2263
2267
|
};
|
|
2264
2268
|
}
|
|
2265
|
-
}, h(Ye, "D"), Ye),
|
|
2269
|
+
}, h(Ye, "D"), Ye), Me = new ur();
|
|
2266
2270
|
function O(a, t) {
|
|
2267
|
-
return
|
|
2271
|
+
return Me.parse(a, t);
|
|
2268
2272
|
}
|
|
2269
2273
|
h(O, "g");
|
|
2270
2274
|
O.options = O.setOptions = function(a) {
|
|
2271
|
-
return
|
|
2275
|
+
return Me.setOptions(a), O.defaults = Me.defaults, gs(O.defaults), O;
|
|
2272
2276
|
};
|
|
2273
2277
|
O.getDefaults = tn;
|
|
2274
|
-
O.defaults =
|
|
2278
|
+
O.defaults = Le;
|
|
2275
2279
|
O.use = function(...a) {
|
|
2276
|
-
return
|
|
2280
|
+
return Me.use(...a), O.defaults = Me.defaults, gs(O.defaults), O;
|
|
2277
2281
|
};
|
|
2278
2282
|
O.walkTokens = function(a, t) {
|
|
2279
|
-
return
|
|
2283
|
+
return Me.walkTokens(a, t);
|
|
2280
2284
|
};
|
|
2281
|
-
O.parseInline =
|
|
2285
|
+
O.parseInline = Me.parseInline;
|
|
2282
2286
|
O.Parser = fe;
|
|
2283
2287
|
O.parser = fe.parse;
|
|
2284
|
-
O.Renderer =
|
|
2288
|
+
O.Renderer = St;
|
|
2285
2289
|
O.TextRenderer = un;
|
|
2286
2290
|
O.Lexer = de;
|
|
2287
2291
|
O.lexer = de.lex;
|
|
2288
|
-
O.Tokenizer =
|
|
2292
|
+
O.Tokenizer = Tt;
|
|
2289
2293
|
O.Hooks = lt;
|
|
2290
2294
|
O.parse = O;
|
|
2291
2295
|
O.options;
|
|
@@ -2295,7 +2299,7 @@ O.walkTokens;
|
|
|
2295
2299
|
O.parseInline;
|
|
2296
2300
|
fe.parse;
|
|
2297
2301
|
de.lex;
|
|
2298
|
-
const
|
|
2302
|
+
const hr = ["innerHTML"], kt = /* @__PURE__ */ ke({
|
|
2299
2303
|
__name: "ChatRichText",
|
|
2300
2304
|
props: {
|
|
2301
2305
|
text: {},
|
|
@@ -2303,7 +2307,7 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2303
2307
|
streaming: { type: Boolean }
|
|
2304
2308
|
},
|
|
2305
2309
|
setup(a) {
|
|
2306
|
-
const t = a, e =
|
|
2310
|
+
const t = a, e = ls(t.text);
|
|
2307
2311
|
let n;
|
|
2308
2312
|
Ze(
|
|
2309
2313
|
[() => t.text, () => t.streaming],
|
|
@@ -2316,32 +2320,35 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2316
2320
|
n = void 0, e.value = t.text;
|
|
2317
2321
|
}));
|
|
2318
2322
|
}
|
|
2319
|
-
),
|
|
2323
|
+
), os(() => {
|
|
2320
2324
|
n !== void 0 && cancelAnimationFrame(n);
|
|
2321
2325
|
});
|
|
2322
2326
|
const i = new O.Renderer();
|
|
2323
2327
|
i.link = ({ href: l, text: o }) => {
|
|
2324
|
-
|
|
2328
|
+
const p = l.trim();
|
|
2329
|
+
if (!p || p === "#")
|
|
2330
|
+
return o;
|
|
2331
|
+
let c = !1;
|
|
2325
2332
|
if (typeof window < "u")
|
|
2326
2333
|
try {
|
|
2327
|
-
|
|
2334
|
+
c = new URL(l, window.location.href).origin === window.location.origin;
|
|
2328
2335
|
} catch {
|
|
2329
|
-
|
|
2336
|
+
c = !1;
|
|
2330
2337
|
}
|
|
2331
|
-
return
|
|
2338
|
+
return c ? `<a href="${l}">${o}</a>` : `<a href="${l}" target="_blank" rel="noopener noreferrer">${o}</a>`;
|
|
2332
2339
|
}, O.setOptions({ breaks: !0, gfm: !0, renderer: i });
|
|
2333
|
-
const s =
|
|
2340
|
+
const s = U(() => {
|
|
2334
2341
|
const l = e.value;
|
|
2335
2342
|
if (!l) return "";
|
|
2336
2343
|
const o = O.parse(l, { async: !1 });
|
|
2337
|
-
return
|
|
2344
|
+
return Ti.sanitize(o, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2338
2345
|
});
|
|
2339
|
-
return (l, o) => (T(),
|
|
2346
|
+
return (l, o) => (T(), A("div", {
|
|
2340
2347
|
class: _(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", a.inverted ? "chat-msg-prose-invert" : ""]),
|
|
2341
2348
|
innerHTML: s.value
|
|
2342
|
-
}, null, 10,
|
|
2349
|
+
}, null, 10, hr));
|
|
2343
2350
|
}
|
|
2344
|
-
}),
|
|
2351
|
+
}), pr = 80, dr = /* @__PURE__ */ ke({
|
|
2345
2352
|
__name: "ChatScroller",
|
|
2346
2353
|
setup(a, { expose: t }) {
|
|
2347
2354
|
const e = Z(), n = Z();
|
|
@@ -2353,27 +2360,27 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2353
2360
|
h(l, "scrollToBottom");
|
|
2354
2361
|
function o() {
|
|
2355
2362
|
const c = e.value;
|
|
2356
|
-
c && (i = c.scrollHeight - c.scrollTop - c.clientHeight <=
|
|
2363
|
+
c && (i = c.scrollHeight - c.scrollTop - c.clientHeight <= pr);
|
|
2357
2364
|
}
|
|
2358
2365
|
h(o, "onScroll");
|
|
2359
2366
|
function p() {
|
|
2360
2367
|
i = !0, l();
|
|
2361
2368
|
}
|
|
2362
|
-
return h(p, "pin"), t({ pin: p }),
|
|
2369
|
+
return h(p, "pin"), t({ pin: p }), At(() => {
|
|
2363
2370
|
requestAnimationFrame(() => {
|
|
2364
2371
|
l(), requestAnimationFrame(l);
|
|
2365
2372
|
}), n.value && (s = new ResizeObserver(() => {
|
|
2366
2373
|
i && l();
|
|
2367
2374
|
}), s.observe(n.value));
|
|
2368
|
-
}),
|
|
2375
|
+
}), os(() => {
|
|
2369
2376
|
s?.disconnect();
|
|
2370
|
-
}), (c,
|
|
2377
|
+
}), (c, v) => (T(), A("div", {
|
|
2371
2378
|
ref_key: "viewport",
|
|
2372
2379
|
ref: e,
|
|
2373
2380
|
class: "overflow-y-auto overflow-x-hidden min-h-0 [overflow-anchor:none] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
2374
2381
|
onScrollPassive: o
|
|
2375
2382
|
}, [
|
|
2376
|
-
|
|
2383
|
+
S("div", {
|
|
2377
2384
|
ref_key: "content",
|
|
2378
2385
|
ref: n
|
|
2379
2386
|
}, [
|
|
@@ -2381,35 +2388,35 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2381
2388
|
], 512)
|
|
2382
2389
|
], 544));
|
|
2383
2390
|
}
|
|
2384
|
-
}),
|
|
2391
|
+
}), fr = { class: "@container/chat flex flex-col h-full relative" }, gr = {
|
|
2385
2392
|
key: 0,
|
|
2386
2393
|
class: "pb-4"
|
|
2387
|
-
},
|
|
2394
|
+
}, mr = { class: "pt-4 pb-[120px] px-3 space-y-1" }, xr = {
|
|
2388
2395
|
key: 0,
|
|
2389
2396
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2390
|
-
},
|
|
2397
|
+
}, br = { class: "relative mb-4 size-20 @sm/chat:size-24" }, kr = ["src", "alt"], vr = ["title"], wr = {
|
|
2391
2398
|
key: 0,
|
|
2392
2399
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2393
|
-
},
|
|
2400
|
+
}, yr = ["data-issue-code", "data-issue-bucket"], Tr = { class: "max-w-[85%] min-w-0" }, Sr = ["href"], Ar = ["data-test"], Er = {
|
|
2394
2401
|
key: 0,
|
|
2395
2402
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2396
|
-
},
|
|
2403
|
+
}, _r = ["src", "alt"], Rr = ["src", "alt"], Ir = ["src"], Cr = ["href"], Dr = {
|
|
2397
2404
|
key: 1,
|
|
2398
2405
|
"data-test": "messaging-thinking-indicator",
|
|
2399
2406
|
class: "flex gap-2 justify-start items-center mb-4"
|
|
2400
|
-
},
|
|
2407
|
+
}, Mr = ["src", "alt"], Lr = {
|
|
2401
2408
|
key: 0,
|
|
2402
2409
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
2403
|
-
},
|
|
2410
|
+
}, Or = ["src", "alt"], zr = { class: "max-w-20 truncate" }, Pr = ["onClick"], Nr = {
|
|
2404
2411
|
key: 0,
|
|
2405
2412
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
2406
|
-
},
|
|
2413
|
+
}, $r = ["disabled"], Br = {
|
|
2407
2414
|
key: 0,
|
|
2408
2415
|
class: "i-svg-spinners-ring-resize size-4"
|
|
2409
2416
|
}, Ur = {
|
|
2410
2417
|
key: 1,
|
|
2411
2418
|
class: "i-tabler-paperclip size-5"
|
|
2412
|
-
},
|
|
2419
|
+
}, Fr = ["placeholder", "disabled"], Hr = ["disabled"], ea = /* @__PURE__ */ ke({
|
|
2413
2420
|
__name: "ElAgentChat",
|
|
2414
2421
|
props: {
|
|
2415
2422
|
chatController: {},
|
|
@@ -2426,55 +2433,55 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2426
2433
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
2427
2434
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
2428
2435
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
2429
|
-
}, e =
|
|
2430
|
-
const
|
|
2431
|
-
return a.scope === "org" && a.scopeName && (
|
|
2436
|
+
}, e = U(() => {
|
|
2437
|
+
const w = { ...t[a.scope] };
|
|
2438
|
+
return a.scope === "org" && a.scopeName && (w.label = a.scopeName, w.tooltip = `Visible to ${a.scopeName} members`), w;
|
|
2432
2439
|
}), n = Z(""), i = Z(!1), s = Z(), l = Z(), o = Z(), p = Z([]), c = Z(!1);
|
|
2433
|
-
function w
|
|
2434
|
-
return
|
|
2440
|
+
function v(w) {
|
|
2441
|
+
return w ? /\[[^\]]+\]\([^)]+\)/.test(w) : !1;
|
|
2435
2442
|
}
|
|
2436
|
-
h(
|
|
2437
|
-
function d(
|
|
2438
|
-
return
|
|
2443
|
+
h(v, "containsMarkdownLink");
|
|
2444
|
+
function d(w) {
|
|
2445
|
+
return w.sender === "system" && (!!w.issue || w.id === N.value);
|
|
2439
2446
|
}
|
|
2440
2447
|
h(d, "isSystemExplainerMessage");
|
|
2441
|
-
function x(
|
|
2442
|
-
const g =
|
|
2448
|
+
function x(w, k) {
|
|
2449
|
+
const g = w[k], P = w[k + 1];
|
|
2443
2450
|
return !P || P.sender !== g.sender;
|
|
2444
2451
|
}
|
|
2445
2452
|
h(x, "shouldShowAvatar");
|
|
2446
|
-
const m =
|
|
2453
|
+
const m = U(() => a.chatController?.textState.value), f = U(() => m.value?.isConnected ?? !1), E = U(() => m.value?.isThinking ?? !1), I = U(() => m.value?.connectionStatus === "disconnected" && !!m.value?.error), z = U(() => m.value?.connectionStatus !== "connected" && !m.value?.error), Q = U(() => m.value?.error), W = U(() => a.chatController?.sharedMessages.value ?? []), N = U(() => {
|
|
2447
2454
|
if (!E.value) return;
|
|
2448
|
-
const
|
|
2455
|
+
const w = W.value, k = w[w.length - 1];
|
|
2449
2456
|
return k?.sender === "agent" || k?.sender === "system" ? k.id : void 0;
|
|
2450
|
-
}), ie =
|
|
2457
|
+
}), ie = U(() => E.value ? N.value === void 0 : !1), se = U(() => m.value?.accountGated ?? !1), re = U(() => !f.value || se.value), Oe = U(() => I.value ? "Agent is offline" : z.value ? "Connecting..." : se.value ? "Resolve the billing issue above to continue" : "Message"), ze = U(() => (n.value.trim() || p.value.length > 0) && !re.value && !c.value), L = U(() => a.variant === "light"), q = U(
|
|
2451
2458
|
() => L.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2452
|
-
),
|
|
2453
|
-
|
|
2459
|
+
), ve = U(() => L.value ? "text-theme-300" : "text-white/30");
|
|
2460
|
+
At(async () => {
|
|
2454
2461
|
a.chatController && !f.value && await a.chatController.startTextConversation();
|
|
2455
2462
|
});
|
|
2456
2463
|
async function Ae() {
|
|
2457
|
-
const
|
|
2458
|
-
if (!
|
|
2464
|
+
const w = n.value.trim(), k = p.value.length > 0;
|
|
2465
|
+
if (!w && !k || !a.chatController || !f.value || c.value)
|
|
2459
2466
|
return;
|
|
2460
2467
|
const g = n.value, P = k ? [...p.value] : void 0;
|
|
2461
2468
|
n.value = "", p.value = [], l.value && (l.value.style.height = "auto", l.value.focus()), s.value?.pin(), await a.chatController.sendChatMessage(g, P);
|
|
2462
2469
|
}
|
|
2463
2470
|
h(Ae, "sendMessage");
|
|
2464
|
-
async function
|
|
2465
|
-
|
|
2471
|
+
async function Pe(w) {
|
|
2472
|
+
w.key === "Enter" && !w.shiftKey && (w.preventDefault(), await Ae());
|
|
2466
2473
|
}
|
|
2467
|
-
h(
|
|
2468
|
-
function
|
|
2474
|
+
h(Pe, "handleKeydown");
|
|
2475
|
+
function Rt() {
|
|
2469
2476
|
l.value && (l.value.style.height = "auto", l.value.style.height = `${Math.min(l.value.scrollHeight, 150)}px`);
|
|
2470
2477
|
}
|
|
2471
|
-
h(
|
|
2472
|
-
function
|
|
2478
|
+
h(Rt, "adjustTextareaHeight"), Ze(n, () => Ls(() => Rt()));
|
|
2479
|
+
function It() {
|
|
2473
2480
|
o.value?.click();
|
|
2474
2481
|
}
|
|
2475
|
-
h(
|
|
2476
|
-
async function
|
|
2477
|
-
const k =
|
|
2482
|
+
h(It, "triggerFileInput");
|
|
2483
|
+
async function Ct(w) {
|
|
2484
|
+
const k = w.target, g = k.files?.[0];
|
|
2478
2485
|
if (!(!g || !a.uploadFn)) {
|
|
2479
2486
|
c.value = !0;
|
|
2480
2487
|
try {
|
|
@@ -2488,165 +2495,166 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2488
2495
|
}
|
|
2489
2496
|
}
|
|
2490
2497
|
}
|
|
2491
|
-
h(
|
|
2492
|
-
function ct(
|
|
2493
|
-
p.value = p.value.filter((k, g) => g !==
|
|
2498
|
+
h(Ct, "handleFileSelect");
|
|
2499
|
+
function ct(w) {
|
|
2500
|
+
p.value = p.value.filter((k, g) => g !== w);
|
|
2494
2501
|
}
|
|
2495
2502
|
h(ct, "removeAttachment");
|
|
2496
|
-
function ut(
|
|
2503
|
+
function ut(w, k) {
|
|
2497
2504
|
if (k === 0) {
|
|
2498
|
-
const le =
|
|
2505
|
+
const le = w[k];
|
|
2499
2506
|
return le?.timestamp ? Ke(new Date(le.timestamp)) : null;
|
|
2500
2507
|
}
|
|
2501
|
-
const g =
|
|
2508
|
+
const g = w[k - 1], P = w[k];
|
|
2502
2509
|
if (!g?.timestamp || !P?.timestamp) return null;
|
|
2503
2510
|
const C = new Date(g.timestamp).getTime();
|
|
2504
2511
|
return new Date(P.timestamp).getTime() - C > 36e5 ? Ke(new Date(P.timestamp)) : null;
|
|
2505
2512
|
}
|
|
2506
2513
|
h(ut, "shouldShowTimeDivider");
|
|
2507
|
-
function Ke(
|
|
2508
|
-
const k = /* @__PURE__ */ new Date(), g =
|
|
2514
|
+
function Ke(w) {
|
|
2515
|
+
const k = /* @__PURE__ */ new Date(), g = w.toDateString() === k.toDateString(), P = new Date(k);
|
|
2509
2516
|
P.setDate(P.getDate() - 1);
|
|
2510
|
-
const C =
|
|
2517
|
+
const C = w.toDateString() === P.toDateString(), ae = w.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2511
2518
|
if (g) return ae;
|
|
2512
2519
|
if (C) return `Yesterday, ${ae}`;
|
|
2513
|
-
const Ee =
|
|
2514
|
-
return `${
|
|
2520
|
+
const Ee = w.getFullYear() === k.getFullYear();
|
|
2521
|
+
return `${w.toLocaleDateString("en-US", {
|
|
2515
2522
|
weekday: "long",
|
|
2516
2523
|
month: "short",
|
|
2517
2524
|
day: "numeric",
|
|
2518
2525
|
...Ee ? {} : { year: "numeric" }
|
|
2519
2526
|
})}, ${ae}`;
|
|
2520
2527
|
}
|
|
2521
|
-
return h(Ke, "formatTimeDivider"), (
|
|
2522
|
-
L.value ? j("", !0) : (T(),
|
|
2523
|
-
|
|
2528
|
+
return h(Ke, "formatTimeDivider"), (w, k) => (T(), A("div", fr, [
|
|
2529
|
+
L.value ? j("", !0) : (T(), A("div", gr, [
|
|
2530
|
+
Fe(Qs, {
|
|
2524
2531
|
agent: a.agent,
|
|
2525
2532
|
"is-online": f.value
|
|
2526
2533
|
}, null, 8, ["agent", "is-online"])
|
|
2527
2534
|
])),
|
|
2528
|
-
I.value ? (T(),
|
|
2535
|
+
I.value ? (T(), A("div", {
|
|
2529
2536
|
key: 1,
|
|
2530
2537
|
class: _(["py-16 flex flex-col items-center justify-center gap-3 text-sm", L.value ? "text-theme-400" : "text-white/60"])
|
|
2531
2538
|
}, [
|
|
2532
|
-
|
|
2539
|
+
S("i", {
|
|
2533
2540
|
class: _(["i-heroicons-cloud-arrow-down size-8", L.value ? "text-theme-300" : "text-white/40"])
|
|
2534
2541
|
}, null, 2),
|
|
2535
|
-
|
|
2536
|
-
], 2)) : z.value ? (T(),
|
|
2542
|
+
S("span", null, pe(Q.value), 1)
|
|
2543
|
+
], 2)) : z.value ? (T(), A("div", {
|
|
2537
2544
|
key: 2,
|
|
2538
2545
|
class: _(["py-16 flex flex-col items-center justify-center gap-2 text-sm", L.value ? "text-theme-400" : "text-theme-600"])
|
|
2539
2546
|
}, [
|
|
2540
|
-
|
|
2541
|
-
], 2)) : a.setupHint ? (T(),
|
|
2547
|
+
Fe(Pn, { class: "size-4" })
|
|
2548
|
+
], 2)) : a.setupHint ? (T(), A("div", {
|
|
2542
2549
|
key: 3,
|
|
2543
|
-
class: _(["flex items-center justify-center gap-1.5 py-2 text-[11px]",
|
|
2550
|
+
class: _(["flex items-center justify-center gap-1.5 py-2 text-[11px]", ve.value])
|
|
2544
2551
|
}, [
|
|
2545
|
-
k[9] || (k[9] =
|
|
2546
|
-
|
|
2552
|
+
k[9] || (k[9] = S("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2553
|
+
S("span", null, pe(a.setupHint), 1)
|
|
2547
2554
|
], 2)) : j("", !0),
|
|
2548
|
-
|
|
2555
|
+
Fe(dr, {
|
|
2549
2556
|
ref_key: "chatScroller",
|
|
2550
2557
|
ref: s,
|
|
2551
2558
|
class: "flex-1"
|
|
2552
2559
|
}, {
|
|
2553
|
-
default:
|
|
2554
|
-
|
|
2555
|
-
W.value.length === 0 && !z.value && !I.value ? (T(),
|
|
2556
|
-
|
|
2557
|
-
|
|
2560
|
+
default: Os(() => [
|
|
2561
|
+
S("div", mr, [
|
|
2562
|
+
W.value.length === 0 && !z.value && !I.value ? (T(), A("div", xr, [
|
|
2563
|
+
S("div", br, [
|
|
2564
|
+
S("img", {
|
|
2558
2565
|
src: a.agent.avatarUrl.value,
|
|
2559
2566
|
alt: a.agent.displayName.value,
|
|
2560
2567
|
class: _(["size-full rounded-full object-cover ring-1", L.value ? "ring-black/5" : "ring-white/10"])
|
|
2561
|
-
}, null, 10,
|
|
2562
|
-
f.value ? (T(),
|
|
2568
|
+
}, null, 10, kr),
|
|
2569
|
+
f.value ? (T(), A("span", {
|
|
2563
2570
|
key: 0,
|
|
2564
2571
|
class: _(["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", L.value ? "bg-white" : "bg-theme-900"])
|
|
2565
2572
|
}, [...k[10] || (k[10] = [
|
|
2566
|
-
|
|
2573
|
+
S("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2567
2574
|
])], 2)) : j("", !0)
|
|
2568
2575
|
]),
|
|
2569
|
-
|
|
2576
|
+
S("div", {
|
|
2570
2577
|
class: _(["text-base @sm/chat:text-lg font-semibold", L.value ? "text-theme-900" : "text-white"])
|
|
2571
|
-
},
|
|
2572
|
-
|
|
2573
|
-
class: _(["mt-1 text-center text-xs @sm/chat:text-sm",
|
|
2574
|
-
},
|
|
2575
|
-
|
|
2578
|
+
}, pe(a.agent.displayName.value), 3),
|
|
2579
|
+
S("p", {
|
|
2580
|
+
class: _(["mt-1 text-center text-xs @sm/chat:text-sm", ve.value])
|
|
2581
|
+
}, pe(a.emptyStateMessage || "Type your message to get started."), 3),
|
|
2582
|
+
S("div", {
|
|
2576
2583
|
class: _(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", L.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2577
2584
|
title: e.value.tooltip
|
|
2578
2585
|
}, [
|
|
2579
|
-
|
|
2586
|
+
S("i", {
|
|
2580
2587
|
class: _([e.value.icon, "size-3"])
|
|
2581
2588
|
}, null, 2),
|
|
2582
|
-
|
|
2583
|
-
], 10,
|
|
2589
|
+
S("span", null, pe(e.value.label), 1)
|
|
2590
|
+
], 10, vr)
|
|
2584
2591
|
])) : j("", !0),
|
|
2585
|
-
(T(!0),
|
|
2592
|
+
(T(!0), A(Ce, null, vt(W.value, (g, P) => (T(), A(Ce, {
|
|
2586
2593
|
key: g.id
|
|
2587
2594
|
}, [
|
|
2588
|
-
ut(W.value, P) ? (T(),
|
|
2589
|
-
|
|
2595
|
+
ut(W.value, P) ? (T(), A("div", wr, [
|
|
2596
|
+
S("div", {
|
|
2590
2597
|
class: _(["flex-1 h-px", q.value])
|
|
2591
2598
|
}, null, 2),
|
|
2592
|
-
|
|
2593
|
-
class: _(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase",
|
|
2594
|
-
},
|
|
2595
|
-
|
|
2599
|
+
S("span", {
|
|
2600
|
+
class: _(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", ve.value])
|
|
2601
|
+
}, pe(ut(W.value, P)), 3),
|
|
2602
|
+
S("div", {
|
|
2596
2603
|
class: _(["flex-1 h-px", q.value])
|
|
2597
2604
|
}, null, 2)
|
|
2598
2605
|
])) : j("", !0),
|
|
2599
|
-
d(g) ? (T(),
|
|
2606
|
+
d(g) ? (T(), A("div", {
|
|
2600
2607
|
key: 1,
|
|
2601
2608
|
"data-test": "messaging-system-msg",
|
|
2602
2609
|
"data-issue-code": g.issue?.code,
|
|
2603
2610
|
"data-issue-bucket": g.issue?.bucket,
|
|
2604
2611
|
class: "flex gap-2 items-end justify-start mb-4"
|
|
2605
2612
|
}, [
|
|
2606
|
-
|
|
2607
|
-
|
|
2613
|
+
S("div", Tr, [
|
|
2614
|
+
S("div", {
|
|
2608
2615
|
class: _(["mb-1 pl-1 text-[11px] font-medium", L.value ? "text-theme-500" : "text-white/45"])
|
|
2609
2616
|
}, " System Message ", 2),
|
|
2610
|
-
|
|
2617
|
+
S("div", {
|
|
2611
2618
|
class: _(["rounded-2xl rounded-bl-[4px] px-3.5 py-2 border system-msg-content", L.value ? "bg-theme-100 border-theme-200 text-theme-800" : "bg-white/[0.18] border-white/15 text-white/90"])
|
|
2612
2619
|
}, [
|
|
2613
|
-
|
|
2620
|
+
g.text ? (T(), On(kt, {
|
|
2621
|
+
key: 0,
|
|
2614
2622
|
text: g.text,
|
|
2615
2623
|
inverted: !L.value,
|
|
2616
2624
|
streaming: g.id === N.value,
|
|
2617
2625
|
onClick: k[0] || (k[0] = gt(() => {
|
|
2618
2626
|
}, ["stop"]))
|
|
2619
|
-
}, null, 8, ["text", "inverted", "streaming"]),
|
|
2620
|
-
g.issue?.help ? (T(), S("span", {
|
|
2621
|
-
key: 0,
|
|
2622
|
-
class: _(["mt-1.5 block text-[12px]", L.value ? "text-theme-500" : "text-white/55"])
|
|
2623
|
-
}, ce(g.issue.help), 3)) : j("", !0),
|
|
2624
|
-
g.issue?.actionUrl && !w(g.text) ? (T(), S("a", {
|
|
2627
|
+
}, null, 8, ["text", "inverted", "streaming"])) : g.issue?.help ? (T(), On(kt, {
|
|
2625
2628
|
key: 1,
|
|
2629
|
+
text: g.issue.help,
|
|
2630
|
+
inverted: !L.value
|
|
2631
|
+
}, null, 8, ["text", "inverted"])) : j("", !0),
|
|
2632
|
+
g.issue?.actionUrl && !v(g.text) ? (T(), A("a", {
|
|
2633
|
+
key: 2,
|
|
2626
2634
|
href: g.issue.actionUrl,
|
|
2627
2635
|
"data-test": "messaging-system-msg-action",
|
|
2628
2636
|
class: _(["mt-2 text-[12px] font-medium inline-flex items-center gap-1", L.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"]),
|
|
2629
2637
|
onClick: k[1] || (k[1] = gt(() => {
|
|
2630
2638
|
}, ["stop"]))
|
|
2631
2639
|
}, [
|
|
2632
|
-
|
|
2633
|
-
k[11] || (k[11] =
|
|
2634
|
-
], 10,
|
|
2640
|
+
zn(pe(g.issue.actionLabel) + " ", 1),
|
|
2641
|
+
k[11] || (k[11] = S("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2642
|
+
], 10, Sr)) : j("", !0)
|
|
2635
2643
|
], 2)
|
|
2636
2644
|
])
|
|
2637
|
-
], 8,
|
|
2645
|
+
], 8, yr)) : g.sender === "system" ? (T(), A("div", {
|
|
2638
2646
|
key: 2,
|
|
2639
2647
|
"data-test": "messaging-system-status-msg",
|
|
2640
2648
|
class: _(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", L.value ? "text-theme-500" : "text-white/60"])
|
|
2641
2649
|
}, [
|
|
2642
|
-
k[12] || (k[12] =
|
|
2643
|
-
|
|
2650
|
+
k[12] || (k[12] = S("i", { class: "i-tabler-info-circle size-4 mt-0.5 shrink-0" }, null, -1)),
|
|
2651
|
+
Fe(kt, {
|
|
2644
2652
|
text: g.text,
|
|
2645
2653
|
inverted: !L.value,
|
|
2646
2654
|
onClick: k[2] || (k[2] = gt(() => {
|
|
2647
2655
|
}, ["stop"]))
|
|
2648
2656
|
}, null, 8, ["text", "inverted"])
|
|
2649
|
-
], 2)) : (T(),
|
|
2657
|
+
], 2)) : (T(), A("div", {
|
|
2650
2658
|
key: 3,
|
|
2651
2659
|
"data-test": g.sender === "agent" ? "messaging-assistant-msg" : g.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2652
2660
|
class: _(["flex gap-2 items-end", {
|
|
@@ -2655,51 +2663,51 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2655
2663
|
"mb-4": x(W.value, P)
|
|
2656
2664
|
}])
|
|
2657
2665
|
}, [
|
|
2658
|
-
g.sender === "agent" ? (T(),
|
|
2659
|
-
x(W.value, P) ? (T(),
|
|
2666
|
+
g.sender === "agent" ? (T(), A("div", Er, [
|
|
2667
|
+
x(W.value, P) ? (T(), A("img", {
|
|
2660
2668
|
key: 0,
|
|
2661
2669
|
src: a.agent.avatarUrl.value,
|
|
2662
2670
|
alt: a.agent.displayName.value,
|
|
2663
2671
|
class: _(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", L.value ? "ring-1 ring-black/5" : ""])
|
|
2664
|
-
}, null, 10,
|
|
2672
|
+
}, null, 10, _r)) : j("", !0)
|
|
2665
2673
|
])) : j("", !0),
|
|
2666
|
-
|
|
2674
|
+
S("div", {
|
|
2667
2675
|
class: _(g.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2668
2676
|
}, [
|
|
2669
|
-
g.attachments?.length ? (T(),
|
|
2677
|
+
g.attachments?.length ? (T(), A("div", {
|
|
2670
2678
|
key: 0,
|
|
2671
2679
|
class: _(["mb-1 space-y-1", g.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2672
2680
|
}, [
|
|
2673
|
-
(T(!0),
|
|
2674
|
-
C.type === "image" ? (T(),
|
|
2681
|
+
(T(!0), A(Ce, null, vt(g.attachments, (C, ae) => (T(), A(Ce, { key: ae }, [
|
|
2682
|
+
C.type === "image" ? (T(), A("img", {
|
|
2675
2683
|
key: 0,
|
|
2676
2684
|
src: C.src,
|
|
2677
2685
|
alt: C.filename,
|
|
2678
2686
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2679
|
-
}, null, 8,
|
|
2687
|
+
}, null, 8, Rr)) : C.type === "audio" ? (T(), A("audio", {
|
|
2680
2688
|
key: 1,
|
|
2681
2689
|
src: C.src,
|
|
2682
2690
|
controls: "",
|
|
2683
2691
|
class: "max-w-full"
|
|
2684
|
-
}, null, 8,
|
|
2692
|
+
}, null, 8, Ir)) : (T(), A("a", {
|
|
2685
2693
|
key: 2,
|
|
2686
2694
|
href: C.src,
|
|
2687
2695
|
target: "_blank",
|
|
2688
2696
|
rel: "noopener",
|
|
2689
2697
|
class: _(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", L.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2690
2698
|
}, [
|
|
2691
|
-
k[13] || (k[13] =
|
|
2692
|
-
|
|
2693
|
-
], 10,
|
|
2699
|
+
k[13] || (k[13] = S("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2700
|
+
zn(" " + pe(C.filename), 1)
|
|
2701
|
+
], 10, Cr))
|
|
2694
2702
|
], 64))), 128))
|
|
2695
2703
|
], 2)) : j("", !0),
|
|
2696
|
-
g.text ? (T(),
|
|
2704
|
+
g.text ? (T(), A("div", {
|
|
2697
2705
|
key: 1,
|
|
2698
2706
|
class: _(["rounded-2xl px-3.5 py-2", [
|
|
2699
2707
|
g.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : L.value ? "bg-theme-50 text-theme-800 border border-black/[0.02] rounded-bl-[4px]" : "bg-white/15 backdrop-blur-sm text-white/95 rounded-bl-[4px]"
|
|
2700
2708
|
]])
|
|
2701
2709
|
}, [
|
|
2702
|
-
|
|
2710
|
+
Fe(kt, {
|
|
2703
2711
|
text: g.text,
|
|
2704
2712
|
inverted: g.sender === "user" || !L.value,
|
|
2705
2713
|
streaming: g.id === N.value,
|
|
@@ -2708,18 +2716,18 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2708
2716
|
}, null, 8, ["text", "inverted", "streaming"])
|
|
2709
2717
|
], 2)) : j("", !0)
|
|
2710
2718
|
], 2)
|
|
2711
|
-
], 10,
|
|
2719
|
+
], 10, Ar))
|
|
2712
2720
|
], 64))), 128)),
|
|
2713
|
-
ie.value ? (T(),
|
|
2714
|
-
|
|
2721
|
+
ie.value ? (T(), A("div", Dr, [
|
|
2722
|
+
S("img", {
|
|
2715
2723
|
src: a.agent.avatarUrl.value,
|
|
2716
2724
|
alt: a.agent.displayName.value,
|
|
2717
2725
|
class: _(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", L.value ? "ring-1 ring-black/5" : ""])
|
|
2718
|
-
}, null, 10,
|
|
2719
|
-
|
|
2726
|
+
}, null, 10, Mr),
|
|
2727
|
+
S("div", {
|
|
2720
2728
|
class: _(["rounded-2xl px-3.5 py-2.5 flex items-center", L.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2721
2729
|
}, [
|
|
2722
|
-
|
|
2730
|
+
S("i", {
|
|
2723
2731
|
class: _(["i-svg-spinners-3-dots-bounce size-7", L.value ? "text-theme-400" : "text-white/50"])
|
|
2724
2732
|
}, null, 2)
|
|
2725
2733
|
], 2)
|
|
@@ -2728,93 +2736,93 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2728
2736
|
]),
|
|
2729
2737
|
_: 1
|
|
2730
2738
|
}, 512),
|
|
2731
|
-
|
|
2739
|
+
S("div", {
|
|
2732
2740
|
class: _(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", L.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"])
|
|
2733
2741
|
}, [
|
|
2734
|
-
p.value.length > 0 ? (T(),
|
|
2735
|
-
(T(!0),
|
|
2742
|
+
p.value.length > 0 ? (T(), A("div", Lr, [
|
|
2743
|
+
(T(!0), A(Ce, null, vt(p.value, (g, P) => (T(), A("div", {
|
|
2736
2744
|
key: P,
|
|
2737
2745
|
class: "relative shrink-0 group"
|
|
2738
2746
|
}, [
|
|
2739
|
-
g.type === "image" ? (T(),
|
|
2747
|
+
g.type === "image" ? (T(), A("img", {
|
|
2740
2748
|
key: 0,
|
|
2741
2749
|
src: g.src,
|
|
2742
2750
|
alt: g.filename,
|
|
2743
2751
|
class: _(["size-14 rounded-xl object-cover border", L.value ? "border-black/10" : "border-white/20"])
|
|
2744
|
-
}, null, 10,
|
|
2752
|
+
}, null, 10, Or)) : (T(), A("div", {
|
|
2745
2753
|
key: 1,
|
|
2746
2754
|
class: _(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", L.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2747
2755
|
}, [
|
|
2748
|
-
k[14] || (k[14] =
|
|
2749
|
-
|
|
2756
|
+
k[14] || (k[14] = S("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2757
|
+
S("span", zr, pe(g.filename), 1)
|
|
2750
2758
|
], 2)),
|
|
2751
|
-
|
|
2759
|
+
S("button", {
|
|
2752
2760
|
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",
|
|
2753
2761
|
onClick: /* @__PURE__ */ h((C) => ct(P), "onClick")
|
|
2754
2762
|
}, [...k[15] || (k[15] = [
|
|
2755
|
-
|
|
2756
|
-
])], 8,
|
|
2763
|
+
S("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2764
|
+
])], 8, Pr)
|
|
2757
2765
|
]))), 128)),
|
|
2758
|
-
c.value ? (T(),
|
|
2759
|
-
|
|
2766
|
+
c.value ? (T(), A("div", Nr, [
|
|
2767
|
+
Fe(Pn, { class: "size-5" })
|
|
2760
2768
|
])) : j("", !0)
|
|
2761
2769
|
])) : j("", !0),
|
|
2762
|
-
a.uploadFn ? (T(),
|
|
2770
|
+
a.uploadFn ? (T(), A("input", {
|
|
2763
2771
|
key: 1,
|
|
2764
2772
|
ref_key: "fileInput",
|
|
2765
2773
|
ref: o,
|
|
2766
2774
|
type: "file",
|
|
2767
2775
|
accept: "image/*,audio/*,video/*",
|
|
2768
2776
|
class: "hidden",
|
|
2769
|
-
onChange:
|
|
2777
|
+
onChange: Ct
|
|
2770
2778
|
}, null, 544)) : j("", !0),
|
|
2771
|
-
|
|
2779
|
+
S("div", {
|
|
2772
2780
|
class: _(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-colors duration-200", L.value ? i.value ? "bg-theme-50 ring-1 ring-theme-300" : "bg-theme-25 ring-1 ring-theme-200 hover:ring-theme-300" : i.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2773
2781
|
}, [
|
|
2774
|
-
|
|
2782
|
+
S("button", {
|
|
2775
2783
|
class: _(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2776
2784
|
a.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2777
2785
|
L.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2778
2786
|
c.value ? "opacity-50 pointer-events-none" : ""
|
|
2779
2787
|
]]),
|
|
2780
2788
|
disabled: re.value || c.value || !a.uploadFn,
|
|
2781
|
-
onClick: k[4] || (k[4] = (g) => a.uploadFn &&
|
|
2789
|
+
onClick: k[4] || (k[4] = (g) => a.uploadFn && It())
|
|
2782
2790
|
}, [
|
|
2783
|
-
c.value ? (T(),
|
|
2784
|
-
], 10,
|
|
2785
|
-
|
|
2791
|
+
c.value ? (T(), A("i", Br)) : (T(), A("i", Ur))
|
|
2792
|
+
], 10, $r),
|
|
2793
|
+
rs(S("textarea", {
|
|
2786
2794
|
ref_key: "textarea",
|
|
2787
2795
|
ref: l,
|
|
2788
2796
|
"onUpdate:modelValue": k[5] || (k[5] = (g) => n.value = g),
|
|
2789
2797
|
"data-test": "messaging-input",
|
|
2790
2798
|
rows: "1",
|
|
2791
2799
|
enterkeyhint: "send",
|
|
2792
|
-
placeholder:
|
|
2800
|
+
placeholder: Oe.value,
|
|
2793
2801
|
disabled: re.value,
|
|
2794
2802
|
style: { fontSize: "16px", resize: "none" },
|
|
2795
2803
|
class: _(["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", L.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2796
|
-
onKeydown:
|
|
2804
|
+
onKeydown: Pe,
|
|
2797
2805
|
onFocus: k[6] || (k[6] = (g) => i.value = !0),
|
|
2798
2806
|
onBlur: k[7] || (k[7] = (g) => i.value = !1)
|
|
2799
|
-
}, null, 42,
|
|
2800
|
-
[
|
|
2807
|
+
}, null, 42, Fr), [
|
|
2808
|
+
[as, n.value]
|
|
2801
2809
|
]),
|
|
2802
|
-
|
|
2810
|
+
S("button", {
|
|
2803
2811
|
"data-test": "messaging-send-btn",
|
|
2804
|
-
class: _(["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",
|
|
2805
|
-
disabled: !
|
|
2812
|
+
class: _(["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", ze.value ? "bg-primary-500 text-white hover:scale-105 active:scale-95 cursor-pointer" : L.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2813
|
+
disabled: !ze.value,
|
|
2806
2814
|
onClick: k[8] || (k[8] = (g) => Ae())
|
|
2807
2815
|
}, [...k[16] || (k[16] = [
|
|
2808
|
-
|
|
2809
|
-
])], 10,
|
|
2816
|
+
S("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2817
|
+
])], 10, Hr)
|
|
2810
2818
|
], 2)
|
|
2811
2819
|
], 2)
|
|
2812
2820
|
]));
|
|
2813
2821
|
}
|
|
2814
|
-
}),
|
|
2822
|
+
}), Gr = { class: "agent-wrap" }, jr = {
|
|
2815
2823
|
key: 0,
|
|
2816
2824
|
class: "flex items-center justify-center h-full"
|
|
2817
|
-
},
|
|
2825
|
+
}, ta = /* @__PURE__ */ ke({
|
|
2818
2826
|
__name: "AgentWrap",
|
|
2819
2827
|
props: {
|
|
2820
2828
|
sdk: {},
|
|
@@ -2828,11 +2836,11 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2828
2836
|
apiBase: {}
|
|
2829
2837
|
},
|
|
2830
2838
|
setup(a) {
|
|
2831
|
-
const t =
|
|
2839
|
+
const t = Ps("AgentWrap"), e = a, n = e.sdk || Ns.getInstance({
|
|
2832
2840
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2833
2841
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2834
|
-
}), i = Z(!e.agent), s =
|
|
2835
|
-
return
|
|
2842
|
+
}), i = Z(!e.agent), s = ls(e.agent ? new wt({ config: e.agent }) : void 0), l = Z();
|
|
2843
|
+
return At(async () => {
|
|
2836
2844
|
if (e.agent) {
|
|
2837
2845
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2838
2846
|
agentId: e.agent.agentId,
|
|
@@ -2908,9 +2916,9 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2908
2916
|
}
|
|
2909
2917
|
});
|
|
2910
2918
|
}
|
|
2911
|
-
}), (o, p) => (T(),
|
|
2912
|
-
i.value ? (T(),
|
|
2913
|
-
|
|
2919
|
+
}), (o, p) => (T(), A("div", Gr, [
|
|
2920
|
+
i.value ? (T(), A("div", jr, [...p[0] || (p[0] = [
|
|
2921
|
+
S("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2914
2922
|
])])) : s.value ? en(o.$slots, "default", {
|
|
2915
2923
|
key: 1,
|
|
2916
2924
|
sdk: Xt(n),
|
|
@@ -2925,16 +2933,16 @@ const ur = ["innerHTML"], Zt = /* @__PURE__ */ ke({
|
|
|
2925
2933
|
}
|
|
2926
2934
|
});
|
|
2927
2935
|
export {
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2936
|
+
Nn as A,
|
|
2937
|
+
ta as _,
|
|
2938
|
+
ea as a,
|
|
2939
|
+
Qr as b,
|
|
2940
|
+
Kr as c,
|
|
2941
|
+
Jr as d,
|
|
2942
|
+
Pn as e,
|
|
2943
|
+
Qs as f,
|
|
2944
|
+
Zr as g,
|
|
2945
|
+
Bn as h,
|
|
2946
|
+
Xr as p
|
|
2939
2947
|
};
|
|
2940
2948
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|