@pagelines/sdk 1.0.508 → 1.0.509
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var Mn = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var Is = (a, t, e) => t in a ? Mn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var p = (a, t) => Mn(a, "name", { value: t, configurable: !0 });
|
|
4
|
-
var I = (a, t, e) =>
|
|
5
|
-
import { defineComponent as ke, openBlock as y, createElementBlock as T, createElementVNode as v, normalizeClass as E, ref as
|
|
6
|
-
import { SettingsObject as
|
|
7
|
-
import { P as
|
|
8
|
-
const
|
|
4
|
+
var I = (a, t, e) => Is(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as ke, openBlock as y, createElementBlock as T, createElementVNode as v, normalizeClass as E, ref as Y, watch as Ze, computed as U, createCommentVNode as B, renderSlot as tn, onMounted as Et, Fragment as ye, renderList as ot, withDirectives as ss, vModelText as rs, unref as Kt, toDisplayString as ne, shallowRef as is, onBeforeUnmount as as, nextTick as Ds, createVNode as Fe, withCtx as Ms, createTextVNode as nt, withModifiers as Ls } from "vue";
|
|
6
|
+
import { SettingsObject as Os, Agent as yt, getDefaultAvatarUrl as ls, createLogger as zs } from "@pagelines/core";
|
|
7
|
+
import { P as Ps } from "./sdkClient.js";
|
|
8
|
+
const Ns = { class: "spinner max-w-sm" }, $s = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
11
|
}, Ln = /* @__PURE__ */ ke({
|
|
@@ -15,8 +15,8 @@ const Ps = { class: "spinner max-w-sm" }, Ns = {
|
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
17
|
setup(a) {
|
|
18
|
-
return (t, e) => (y(), T("div",
|
|
19
|
-
(y(), T("svg",
|
|
18
|
+
return (t, e) => (y(), T("div", Ns, [
|
|
19
|
+
(y(), T("svg", $s, [
|
|
20
20
|
v("circle", {
|
|
21
21
|
class: E([a.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
@@ -30,10 +30,10 @@ const Ps = { class: "spinner max-w-sm" }, Ns = {
|
|
|
30
30
|
]))
|
|
31
31
|
]));
|
|
32
32
|
}
|
|
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
|
+
], Bs = 9e4, os = /* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP"]), Fs = /* @__PURE__ */ new Set([...os, "EMPTY_STREAM", "RATE_LIMIT"]), pn = class pn extends Os {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
39
|
I(this, "isTextMode", !1);
|
|
@@ -41,16 +41,16 @@ const Ps = { class: "spinner max-w-sm" }, Ns = {
|
|
|
41
41
|
I(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
43
|
I(this, "conversationId");
|
|
44
|
-
I(this, "textState",
|
|
44
|
+
I(this, "textState", Y({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
I(this, "agentMode",
|
|
51
|
-
I(this, "sharedMessages",
|
|
50
|
+
I(this, "agentMode", Y("self"));
|
|
51
|
+
I(this, "sharedMessages", Y([]));
|
|
52
52
|
I(this, "_agent");
|
|
53
|
-
this._agent = e.agent instanceof
|
|
53
|
+
this._agent = e.agent instanceof yt ? e.agent : new yt({ config: e.agent }), this.setupModeWatcher(), this.setupAvailabilityWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -122,12 +122,12 @@ Current User:
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
setupModeWatcher() {
|
|
125
|
-
|
|
125
|
+
Ze(this.agentMode, async (e, n) => {
|
|
126
126
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
setupAvailabilityWatcher() {
|
|
130
|
-
|
|
130
|
+
Ze(() => this._agent.chatAvailable.value, (e) => {
|
|
131
131
|
if (!(!this.isTextMode || this.isConnecting)) {
|
|
132
132
|
if (e) {
|
|
133
133
|
this.textState.value.isConnected || this.updateState(this.textState, {
|
|
@@ -227,57 +227,57 @@ Current User:
|
|
|
227
227
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
228
228
|
const l = `stream-${Date.now()}`;
|
|
229
229
|
let o = !1;
|
|
230
|
-
const d = /* @__PURE__ */ p((
|
|
230
|
+
const d = /* @__PURE__ */ p((g) => {
|
|
231
231
|
o || (o = !0, this.sharedMessages.value = [
|
|
232
232
|
...this.sharedMessages.value,
|
|
233
233
|
{ id: l, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
234
234
|
]);
|
|
235
|
-
const
|
|
236
|
-
w?.id === l && (w.text +=
|
|
237
|
-
}, "onDelta"), c = /* @__PURE__ */ p((
|
|
235
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
236
|
+
w?.id === l && (w.text += g, this.sharedMessages.value = [...m]);
|
|
237
|
+
}, "onDelta"), c = /* @__PURE__ */ p((g) => {
|
|
238
238
|
if (!o) {
|
|
239
|
-
|
|
239
|
+
x("empty_stream — assistant returned no content");
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
243
243
|
if (w?.id === l && w.text) {
|
|
244
244
|
let _ = w.text;
|
|
245
|
-
for (const
|
|
246
|
-
|
|
247
|
-
_ ? _ !== w.text && (w.text = _, this.sharedMessages.value = [...
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
}, "onDone"),
|
|
251
|
-
const
|
|
252
|
-
if (w?.id === l && !w.text && (this.sharedMessages.value =
|
|
253
|
-
const { bucket:
|
|
254
|
-
if (
|
|
255
|
-
const
|
|
256
|
-
code:
|
|
257
|
-
bucket:
|
|
258
|
-
...
|
|
259
|
-
...
|
|
260
|
-
...
|
|
245
|
+
for (const z of Us)
|
|
246
|
+
z.pattern.test(_) && (console.debug(`[chat] filtered directive: ${z.label}`), _ = _.replace(z.pattern, "").trim(), z.pattern.lastIndex = 0);
|
|
247
|
+
_ ? _ !== w.text && (w.text = _, this.sharedMessages.value = [...m]) : this.sharedMessages.value = m.slice(0, -1);
|
|
248
|
+
}
|
|
249
|
+
g && (this.conversationId = g), this.updateState(this.textState, { isThinking: !1 });
|
|
250
|
+
}, "onDone"), x = /* @__PURE__ */ p((g) => {
|
|
251
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
252
|
+
if (w?.id === l && !w.text && (this.sharedMessages.value = m.slice(0, -1)), typeof g == "object" && g.code && g.error) {
|
|
253
|
+
const { bucket: te, actionUrl: oe, actionLabel: se, help: O } = g;
|
|
254
|
+
if (te !== void 0 || Fs.has(g.code)) {
|
|
255
|
+
const re = te ?? (os.has(g.code) ? "account" : "error"), ie = {
|
|
256
|
+
code: g.code,
|
|
257
|
+
bucket: re,
|
|
258
|
+
...se ? { actionLabel: se } : {},
|
|
259
|
+
...oe ? { actionUrl: oe } : {},
|
|
260
|
+
...O ? { help: O } : {}
|
|
261
261
|
};
|
|
262
|
-
this.addMessage(
|
|
262
|
+
this.addMessage(g.error, "system", void 0, ie), re === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
263
263
|
} else
|
|
264
|
-
this.handleError(new Error(
|
|
264
|
+
this.handleError(new Error(g.error));
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
const _ = typeof
|
|
268
|
-
this.isTransientError(_) ? (this.logger.warn("Chat turn failed (transient):", { raw: _, friendly:
|
|
269
|
-
}, "onError"), u = /* @__PURE__ */ p((
|
|
270
|
-
this.addMessage(
|
|
267
|
+
const _ = typeof g == "string" ? g : g.error, z = this.mapChatError(_);
|
|
268
|
+
this.isTransientError(_) ? (this.logger.warn("Chat turn failed (transient):", { raw: _, friendly: z }), this.addMessage(z, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(z), _);
|
|
269
|
+
}, "onError"), u = /* @__PURE__ */ p((g) => {
|
|
270
|
+
this.addMessage(g, "system");
|
|
271
271
|
}, "onStatus");
|
|
272
272
|
try {
|
|
273
|
-
const
|
|
273
|
+
const g = r ? r({
|
|
274
274
|
message: e,
|
|
275
275
|
attachments: n,
|
|
276
276
|
conversationId: this.conversationId,
|
|
277
277
|
history: this.buildHistory(),
|
|
278
278
|
onDelta: d,
|
|
279
279
|
onDone: c,
|
|
280
|
-
onError:
|
|
280
|
+
onError: x,
|
|
281
281
|
onStatus: u
|
|
282
282
|
}) : s.chat.chatStreamPublic({
|
|
283
283
|
handle: this._agent.handle.value,
|
|
@@ -287,15 +287,15 @@ Current User:
|
|
|
287
287
|
context: this.getDynamicSettings().context || void 0,
|
|
288
288
|
onDelta: d,
|
|
289
289
|
onDone: c,
|
|
290
|
-
onError:
|
|
290
|
+
onError: x,
|
|
291
291
|
onStatus: u
|
|
292
292
|
});
|
|
293
293
|
await Promise.race([
|
|
294
|
-
|
|
295
|
-
new Promise((
|
|
294
|
+
g,
|
|
295
|
+
new Promise((m, w) => setTimeout(() => w(new Error("timed out")), Bs))
|
|
296
296
|
]);
|
|
297
|
-
} catch (
|
|
298
|
-
|
|
297
|
+
} catch (g) {
|
|
298
|
+
x(g.message || "Something went wrong");
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
buildHistory() {
|
|
@@ -319,19 +319,19 @@ Current User:
|
|
|
319
319
|
await this.endConversation();
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
p(
|
|
323
|
-
let On =
|
|
322
|
+
p(pn, "AgentChatController");
|
|
323
|
+
let On = pn;
|
|
324
324
|
function zn(a) {
|
|
325
325
|
return a ? typeof a == "string" ? a : a.src || "" : "";
|
|
326
326
|
}
|
|
327
327
|
p(zn, "getImageSrc");
|
|
328
328
|
function Ki(a) {
|
|
329
|
-
return zn(a.cover) || zn(a.avatar) ||
|
|
329
|
+
return zn(a.cover) || zn(a.avatar) || ls(a.name);
|
|
330
330
|
}
|
|
331
331
|
p(Ki, "getAgentAvatarUrl");
|
|
332
332
|
function Pn(a) {
|
|
333
333
|
const t = a.target;
|
|
334
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
334
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = ls());
|
|
335
335
|
}
|
|
336
336
|
p(Pn, "handleImageError");
|
|
337
337
|
function Qi(a) {
|
|
@@ -339,7 +339,7 @@ function Qi(a) {
|
|
|
339
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 || "");
|
|
340
340
|
}
|
|
341
341
|
p(Qi, "parseButtonTemplate");
|
|
342
|
-
const
|
|
342
|
+
const Hs = {
|
|
343
343
|
key: 0,
|
|
344
344
|
class: "absolute inset-0 flex items-center justify-center"
|
|
345
345
|
}, Ji = /* @__PURE__ */ ke({
|
|
@@ -352,16 +352,16 @@ const Fs = {
|
|
|
352
352
|
iconAfter: {}
|
|
353
353
|
},
|
|
354
354
|
setup(a) {
|
|
355
|
-
const t =
|
|
355
|
+
const t = U(() => ({
|
|
356
356
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
357
357
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
358
358
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
359
359
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
360
|
-
})[a.theme]), e =
|
|
360
|
+
})[a.theme]), e = U(() => ({
|
|
361
361
|
sm: "px-4 py-2 text-sm",
|
|
362
362
|
md: "px-6 py-3 text-base",
|
|
363
363
|
lg: "px-8 py-4 text-base"
|
|
364
|
-
})[a.size]), n =
|
|
364
|
+
})[a.size]), n = U(() => ({
|
|
365
365
|
sm: "size-4",
|
|
366
366
|
md: "size-4",
|
|
367
367
|
lg: "size-5"
|
|
@@ -369,7 +369,7 @@ const Fs = {
|
|
|
369
369
|
return (r, s) => (y(), T("button", {
|
|
370
370
|
class: E(["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]])
|
|
371
371
|
}, [
|
|
372
|
-
a.loading ? (y(), T("div",
|
|
372
|
+
a.loading ? (y(), T("div", Hs, [...s[0] || (s[0] = [
|
|
373
373
|
v("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
374
374
|
])])) : B("", !0),
|
|
375
375
|
v("span", {
|
|
@@ -379,7 +379,7 @@ const Fs = {
|
|
|
379
379
|
key: 0,
|
|
380
380
|
class: E([a.icon, n.value])
|
|
381
381
|
}, null, 2)) : B("", !0),
|
|
382
|
-
|
|
382
|
+
tn(r.$slots, "default"),
|
|
383
383
|
a.iconAfter ? (y(), T("i", {
|
|
384
384
|
key: 1,
|
|
385
385
|
class: E([a.iconAfter, n.value])
|
|
@@ -387,7 +387,7 @@ const Fs = {
|
|
|
387
387
|
], 2)
|
|
388
388
|
], 2));
|
|
389
389
|
}
|
|
390
|
-
}),
|
|
390
|
+
}), Gs = ["value"], ea = /* @__PURE__ */ ke({
|
|
391
391
|
__name: "AgentInputEmail",
|
|
392
392
|
props: {
|
|
393
393
|
modelValue: { default: "" }
|
|
@@ -403,9 +403,9 @@ const Fs = {
|
|
|
403
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",
|
|
404
404
|
style: { "font-size": "16px" },
|
|
405
405
|
onInput: r[0] || (r[0] = (s) => e("update:modelValue", s.target.value))
|
|
406
|
-
}, null, 40,
|
|
406
|
+
}, null, 40, Gs));
|
|
407
407
|
}
|
|
408
|
-
}),
|
|
408
|
+
}), js = { class: "flex gap-1.5 justify-center" }, Ws = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], ta = /* @__PURE__ */ ke({
|
|
409
409
|
__name: "AgentInputOneTimeCode",
|
|
410
410
|
props: {
|
|
411
411
|
modelValue: {},
|
|
@@ -414,73 +414,73 @@ const Fs = {
|
|
|
414
414
|
},
|
|
415
415
|
emits: ["update:modelValue", "autoSubmit"],
|
|
416
416
|
setup(a, { emit: t }) {
|
|
417
|
-
const e = a, n = t, r =
|
|
418
|
-
|
|
417
|
+
const e = a, n = t, r = Y([]), s = Y(Array.from({ length: e.length }).fill("")), l = Y(!1);
|
|
418
|
+
Et(() => {
|
|
419
419
|
e.modelValue && (s.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && r.value[0]?.focus();
|
|
420
|
-
}),
|
|
420
|
+
}), Ze(() => e.modelValue, (u) => {
|
|
421
421
|
s.value = u ? u.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
422
|
-
}),
|
|
422
|
+
}), Ze(s, () => {
|
|
423
423
|
const u = s.value.filter(Boolean).join("");
|
|
424
424
|
n("update:modelValue", u), u.length === e.length && n("autoSubmit", u);
|
|
425
425
|
}, { deep: !0 });
|
|
426
|
-
function o(u,
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
430
|
-
s.value =
|
|
426
|
+
function o(u, g) {
|
|
427
|
+
g.preventDefault(), l.value = !0;
|
|
428
|
+
const m = (g.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
429
|
+
if (m.length === e.length)
|
|
430
|
+
s.value = m.split(""), setTimeout(() => {
|
|
431
431
|
r.value[e.length - 1]?.focus(), l.value = !1;
|
|
432
432
|
}, 10);
|
|
433
433
|
else {
|
|
434
434
|
const w = [...s.value];
|
|
435
|
-
|
|
436
|
-
w[u +
|
|
435
|
+
m.split("").slice(0, e.length - u).forEach((z, te) => {
|
|
436
|
+
w[u + te] = z;
|
|
437
437
|
}), s.value = w;
|
|
438
|
-
const _ = Math.min(u +
|
|
438
|
+
const _ = Math.min(u + m.length, e.length - 1);
|
|
439
439
|
setTimeout(() => {
|
|
440
440
|
r.value[_]?.focus(), l.value = !1;
|
|
441
441
|
}, 10);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
p(o, "onPaste");
|
|
445
|
-
function d(u,
|
|
446
|
-
const
|
|
447
|
-
s.value[u] =
|
|
445
|
+
function d(u, g) {
|
|
446
|
+
const m = g.target.value.slice(-1).replace(/\D/g, "");
|
|
447
|
+
s.value[u] = m, m && u < e.length - 1 && r.value[u + 1]?.focus();
|
|
448
448
|
}
|
|
449
449
|
p(d, "onInput");
|
|
450
|
-
function c(u,
|
|
451
|
-
|
|
450
|
+
function c(u, g) {
|
|
451
|
+
g.key === "Backspace" ? (g.preventDefault(), s.value[u] = "", u > 0 && r.value[u - 1]?.focus()) : g.key === "ArrowLeft" && u > 0 ? r.value[u - 1]?.focus() : g.key === "ArrowRight" && u < e.length - 1 && r.value[u + 1]?.focus();
|
|
452
452
|
}
|
|
453
453
|
p(c, "onKeydown");
|
|
454
|
-
function
|
|
454
|
+
function x(u) {
|
|
455
455
|
if (r.value[u]?.select(), !l.value && s.value[u])
|
|
456
|
-
for (let
|
|
457
|
-
s.value[
|
|
456
|
+
for (let g = u; g < e.length; g++)
|
|
457
|
+
s.value[g] = "";
|
|
458
458
|
}
|
|
459
|
-
return p(
|
|
460
|
-
(y(!0), T(
|
|
461
|
-
key:
|
|
459
|
+
return p(x, "onFocus"), (u, g) => (y(), T("div", js, [
|
|
460
|
+
(y(!0), T(ye, null, ot(a.length, (m) => ss((y(), T("input", {
|
|
461
|
+
key: m,
|
|
462
462
|
ref_for: !0,
|
|
463
|
-
ref: /* @__PURE__ */ p((w) => r.value[
|
|
464
|
-
"onUpdate:modelValue": /* @__PURE__ */ p((w) => s.value[
|
|
463
|
+
ref: /* @__PURE__ */ p((w) => r.value[m - 1] = w, "ref"),
|
|
464
|
+
"onUpdate:modelValue": /* @__PURE__ */ p((w) => s.value[m - 1] = w, "onUpdate:modelValue"),
|
|
465
465
|
type: "text",
|
|
466
466
|
inputmode: "numeric",
|
|
467
467
|
autocomplete: "one-time-code",
|
|
468
468
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
469
469
|
style: { "font-size": "16px" },
|
|
470
470
|
maxlength: "1",
|
|
471
|
-
onInput: /* @__PURE__ */ p((w) => d(
|
|
472
|
-
onKeydown: /* @__PURE__ */ p((w) => c(
|
|
473
|
-
onPaste: /* @__PURE__ */ p((w) => o(
|
|
474
|
-
onFocus: /* @__PURE__ */ p((w) =>
|
|
475
|
-
}, null, 40,
|
|
476
|
-
[
|
|
471
|
+
onInput: /* @__PURE__ */ p((w) => d(m - 1, w), "onInput"),
|
|
472
|
+
onKeydown: /* @__PURE__ */ p((w) => c(m - 1, w), "onKeydown"),
|
|
473
|
+
onPaste: /* @__PURE__ */ p((w) => o(m - 1, w), "onPaste"),
|
|
474
|
+
onFocus: /* @__PURE__ */ p((w) => x(m - 1), "onFocus")
|
|
475
|
+
}, null, 40, Ws)), [
|
|
476
|
+
[rs, s.value[m - 1]]
|
|
477
477
|
])), 128))
|
|
478
478
|
]));
|
|
479
479
|
}
|
|
480
|
-
}),
|
|
480
|
+
}), qs = { class: "relative flex-shrink-0" }, Vs = ["src", "alt"], Ys = { class: "absolute top-1 right-1" }, Zs = {
|
|
481
481
|
key: 1,
|
|
482
482
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
483
|
-
},
|
|
483
|
+
}, Xs = { class: "min-w-0" }, Ks = /* @__PURE__ */ ke({
|
|
484
484
|
__name: "ElModeHeader",
|
|
485
485
|
props: {
|
|
486
486
|
agent: {},
|
|
@@ -494,7 +494,7 @@ const Fs = {
|
|
|
494
494
|
a.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
495
495
|
]])
|
|
496
496
|
}, [
|
|
497
|
-
v("div",
|
|
497
|
+
v("div", qs, [
|
|
498
498
|
v("div", {
|
|
499
499
|
class: E(["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"])
|
|
500
500
|
}, [
|
|
@@ -503,199 +503,199 @@ const Fs = {
|
|
|
503
503
|
alt: a.agent.displayName.value,
|
|
504
504
|
class: "w-full h-full object-cover",
|
|
505
505
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
506
|
-
(...n) =>
|
|
507
|
-
}, null, 40,
|
|
506
|
+
(...n) => Kt(Pn) && Kt(Pn)(...n))
|
|
507
|
+
}, null, 40, Vs)
|
|
508
508
|
], 2),
|
|
509
|
-
v("div",
|
|
510
|
-
a.isOnline ? (y(), T(
|
|
509
|
+
v("div", Ys, [
|
|
510
|
+
a.isOnline ? (y(), T(ye, { key: 0 }, [
|
|
511
511
|
e[1] || (e[1] = v("div", {
|
|
512
512
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
513
513
|
style: { "animation-duration": "3s" }
|
|
514
514
|
}, null, -1)),
|
|
515
515
|
e[2] || (e[2] = v("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
516
|
-
], 64)) : (y(), T("div",
|
|
516
|
+
], 64)) : (y(), T("div", Zs))
|
|
517
517
|
])
|
|
518
518
|
]),
|
|
519
|
-
v("div",
|
|
519
|
+
v("div", Xs, [
|
|
520
520
|
v("h1", {
|
|
521
521
|
class: E(["font-light text-white mb-1 truncate", [
|
|
522
522
|
a.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
523
523
|
a.layout === "horizontal" ? "text-white/95" : ""
|
|
524
524
|
]])
|
|
525
|
-
},
|
|
525
|
+
}, ne(a.agent.displayName.value), 3),
|
|
526
526
|
v("p", {
|
|
527
527
|
class: E(["font-light line-clamp-1", [
|
|
528
528
|
a.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
529
529
|
a.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
530
530
|
]])
|
|
531
|
-
},
|
|
531
|
+
}, ne(a.layout === "horizontal" ? a.agent.title.value || "Assistant" : a.agent.title.value), 3)
|
|
532
532
|
])
|
|
533
533
|
], 2));
|
|
534
534
|
}
|
|
535
535
|
});
|
|
536
536
|
const {
|
|
537
|
-
entries:
|
|
537
|
+
entries: cs,
|
|
538
538
|
setPrototypeOf: Nn,
|
|
539
|
-
isFrozen:
|
|
540
|
-
getPrototypeOf:
|
|
541
|
-
getOwnPropertyDescriptor:
|
|
539
|
+
isFrozen: Qs,
|
|
540
|
+
getPrototypeOf: Js,
|
|
541
|
+
getOwnPropertyDescriptor: er
|
|
542
542
|
} = Object;
|
|
543
543
|
let {
|
|
544
|
-
freeze:
|
|
545
|
-
seal:
|
|
546
|
-
create:
|
|
544
|
+
freeze: Q,
|
|
545
|
+
seal: le,
|
|
546
|
+
create: Ge
|
|
547
547
|
} = Object, {
|
|
548
|
-
apply:
|
|
549
|
-
construct:
|
|
548
|
+
apply: Qt,
|
|
549
|
+
construct: Jt
|
|
550
550
|
} = typeof Reflect < "u" && Reflect;
|
|
551
|
-
|
|
551
|
+
Q || (Q = /* @__PURE__ */ p(function(t) {
|
|
552
552
|
return t;
|
|
553
553
|
}, "freeze"));
|
|
554
|
-
|
|
554
|
+
le || (le = /* @__PURE__ */ p(function(t) {
|
|
555
555
|
return t;
|
|
556
556
|
}, "seal"));
|
|
557
|
-
|
|
557
|
+
Qt || (Qt = /* @__PURE__ */ p(function(t, e) {
|
|
558
558
|
for (var n = arguments.length, r = new Array(n > 2 ? n - 2 : 0), s = 2; s < n; s++)
|
|
559
559
|
r[s - 2] = arguments[s];
|
|
560
560
|
return t.apply(e, r);
|
|
561
561
|
}, "apply"));
|
|
562
|
-
|
|
562
|
+
Jt || (Jt = /* @__PURE__ */ p(function(t) {
|
|
563
563
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
564
564
|
n[r - 1] = arguments[r];
|
|
565
565
|
return new t(...n);
|
|
566
566
|
}, "construct"));
|
|
567
|
-
const
|
|
568
|
-
function
|
|
567
|
+
const st = j(Array.prototype.forEach), tr = j(Array.prototype.lastIndexOf), $n = j(Array.prototype.pop), rt = j(Array.prototype.push), nr = j(Array.prototype.splice), K = Array.isArray, ct = j(String.prototype.toLowerCase), qt = j(String.prototype.toString), Un = j(String.prototype.match), He = j(String.prototype.replace), Bn = j(String.prototype.indexOf), sr = j(String.prototype.trim), rr = j(Number.prototype.toString), ir = j(Boolean.prototype.toString), Fn = typeof BigInt > "u" ? null : j(BigInt.prototype.toString), Hn = typeof Symbol > "u" ? null : j(Symbol.prototype.toString), $ = j(Object.prototype.hasOwnProperty), it = j(Object.prototype.toString), V = j(RegExp.prototype.test), kt = ar(TypeError);
|
|
568
|
+
function j(a) {
|
|
569
569
|
return function(t) {
|
|
570
570
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
571
571
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), r = 1; r < e; r++)
|
|
572
572
|
n[r - 1] = arguments[r];
|
|
573
|
-
return
|
|
573
|
+
return Qt(a, t, n);
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
|
-
p(
|
|
577
|
-
function
|
|
576
|
+
p(j, "unapply");
|
|
577
|
+
function ar(a) {
|
|
578
578
|
return function() {
|
|
579
579
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
580
580
|
e[n] = arguments[n];
|
|
581
|
-
return
|
|
581
|
+
return Jt(a, e);
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
|
-
p(
|
|
584
|
+
p(ar, "unconstruct");
|
|
585
585
|
function R(a, t) {
|
|
586
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
587
|
-
if (Nn && Nn(a, null), !
|
|
586
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ct;
|
|
587
|
+
if (Nn && Nn(a, null), !K(t))
|
|
588
588
|
return a;
|
|
589
589
|
let n = t.length;
|
|
590
590
|
for (; n--; ) {
|
|
591
591
|
let r = t[n];
|
|
592
592
|
if (typeof r == "string") {
|
|
593
593
|
const s = e(r);
|
|
594
|
-
s !== r && (
|
|
594
|
+
s !== r && (Qs(t) || (t[n] = s), r = s);
|
|
595
595
|
}
|
|
596
596
|
a[r] = !0;
|
|
597
597
|
}
|
|
598
598
|
return a;
|
|
599
599
|
}
|
|
600
600
|
p(R, "addToSet");
|
|
601
|
-
function
|
|
601
|
+
function lr(a) {
|
|
602
602
|
for (let t = 0; t < a.length; t++)
|
|
603
|
-
|
|
603
|
+
$(a, t) || (a[t] = null);
|
|
604
604
|
return a;
|
|
605
605
|
}
|
|
606
|
-
p(
|
|
607
|
-
function
|
|
608
|
-
const t =
|
|
609
|
-
for (const [e, n] of
|
|
610
|
-
|
|
606
|
+
p(lr, "cleanArray");
|
|
607
|
+
function ee(a) {
|
|
608
|
+
const t = Ge(null);
|
|
609
|
+
for (const [e, n] of cs(a))
|
|
610
|
+
$(a, e) && (K(n) ? t[e] = lr(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = ee(n) : t[e] = n);
|
|
611
611
|
return t;
|
|
612
612
|
}
|
|
613
|
-
p(
|
|
614
|
-
function
|
|
613
|
+
p(ee, "clone");
|
|
614
|
+
function or(a) {
|
|
615
615
|
switch (typeof a) {
|
|
616
616
|
case "string":
|
|
617
617
|
return a;
|
|
618
618
|
case "number":
|
|
619
|
-
return sr(a);
|
|
620
|
-
case "boolean":
|
|
621
619
|
return rr(a);
|
|
620
|
+
case "boolean":
|
|
621
|
+
return ir(a);
|
|
622
622
|
case "bigint":
|
|
623
623
|
return Fn ? Fn(a) : "0";
|
|
624
624
|
case "symbol":
|
|
625
625
|
return Hn ? Hn(a) : "Symbol()";
|
|
626
626
|
case "undefined":
|
|
627
|
-
return
|
|
627
|
+
return it(a);
|
|
628
628
|
case "function":
|
|
629
629
|
case "object": {
|
|
630
630
|
if (a === null)
|
|
631
|
-
return
|
|
632
|
-
const t = a, e =
|
|
631
|
+
return it(a);
|
|
632
|
+
const t = a, e = je(t, "toString");
|
|
633
633
|
if (typeof e == "function") {
|
|
634
634
|
const n = e(t);
|
|
635
|
-
return typeof n == "string" ? n :
|
|
635
|
+
return typeof n == "string" ? n : it(n);
|
|
636
636
|
}
|
|
637
|
-
return
|
|
637
|
+
return it(a);
|
|
638
638
|
}
|
|
639
639
|
default:
|
|
640
|
-
return
|
|
640
|
+
return it(a);
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
p(
|
|
644
|
-
function
|
|
643
|
+
p(or, "stringifyValue");
|
|
644
|
+
function je(a, t) {
|
|
645
645
|
for (; a !== null; ) {
|
|
646
|
-
const n =
|
|
646
|
+
const n = er(a, t);
|
|
647
647
|
if (n) {
|
|
648
648
|
if (n.get)
|
|
649
|
-
return
|
|
649
|
+
return j(n.get);
|
|
650
650
|
if (typeof n.value == "function")
|
|
651
|
-
return
|
|
651
|
+
return j(n.value);
|
|
652
652
|
}
|
|
653
|
-
a =
|
|
653
|
+
a = Js(a);
|
|
654
654
|
}
|
|
655
655
|
function e() {
|
|
656
656
|
return null;
|
|
657
657
|
}
|
|
658
658
|
return p(e, "fallbackValue"), e;
|
|
659
659
|
}
|
|
660
|
-
p(
|
|
661
|
-
function
|
|
660
|
+
p(je, "lookupGetter");
|
|
661
|
+
function cr(a) {
|
|
662
662
|
try {
|
|
663
|
-
return
|
|
663
|
+
return V(a, ""), !0;
|
|
664
664
|
} catch {
|
|
665
665
|
return !1;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
p(
|
|
669
|
-
const Gn =
|
|
668
|
+
p(cr, "isRegex");
|
|
669
|
+
const Gn = Q(["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"]), Vt = Q(["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"]), Yt = Q(["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"]), ur = Q(["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"]), Zt = Q(["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"]), hr = Q(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), jn = Q(["#text"]), Wn = Q(["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"]), Xt = Q(["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"]), qn = Q(["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"]), wt = Q(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), pr = le(/\{\{[\w\W]*|[\w\W]*\}\}/gm), dr = le(/<%[\w\W]*|[\w\W]*%>/gm), fr = le(/\$\{[\w\W]*/gm), gr = le(/^data-[\-\w.\u00B7-\uFFFF]+$/), mr = le(/^aria-[\-\w]+$/), us = le(
|
|
670
670
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
671
671
|
// eslint-disable-line no-useless-escape
|
|
672
|
-
),
|
|
672
|
+
), xr = le(/^(?:\w+script|data):/i), br = le(
|
|
673
673
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
674
674
|
// eslint-disable-line no-control-regex
|
|
675
|
-
),
|
|
675
|
+
), hs = le(/^html$/i), kr = le(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
676
676
|
var Vn = /* @__PURE__ */ Object.freeze({
|
|
677
677
|
__proto__: null,
|
|
678
|
-
ARIA_ATTR:
|
|
678
|
+
ARIA_ATTR: mr,
|
|
679
679
|
ATTR_WHITESPACE: br,
|
|
680
|
-
CUSTOM_ELEMENT:
|
|
681
|
-
DATA_ATTR:
|
|
682
|
-
DOCTYPE_NAME:
|
|
683
|
-
ERB_EXPR:
|
|
684
|
-
IS_ALLOWED_URI:
|
|
685
|
-
IS_SCRIPT_OR_DATA:
|
|
686
|
-
MUSTACHE_EXPR:
|
|
687
|
-
TMPLIT_EXPR:
|
|
680
|
+
CUSTOM_ELEMENT: kr,
|
|
681
|
+
DATA_ATTR: gr,
|
|
682
|
+
DOCTYPE_NAME: hs,
|
|
683
|
+
ERB_EXPR: dr,
|
|
684
|
+
IS_ALLOWED_URI: us,
|
|
685
|
+
IS_SCRIPT_OR_DATA: xr,
|
|
686
|
+
MUSTACHE_EXPR: pr,
|
|
687
|
+
TMPLIT_EXPR: fr
|
|
688
688
|
});
|
|
689
|
-
const
|
|
689
|
+
const at = {
|
|
690
690
|
element: 1,
|
|
691
691
|
text: 3,
|
|
692
692
|
// Deprecated
|
|
693
693
|
progressingInstruction: 7,
|
|
694
694
|
comment: 8,
|
|
695
695
|
document: 9
|
|
696
|
-
},
|
|
696
|
+
}, wr = /* @__PURE__ */ p(function() {
|
|
697
697
|
return typeof window > "u" ? null : window;
|
|
698
|
-
}, "getGlobal"),
|
|
698
|
+
}, "getGlobal"), vr = /* @__PURE__ */ p(function(t, e) {
|
|
699
699
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
700
700
|
return null;
|
|
701
701
|
let n = null;
|
|
@@ -727,10 +727,10 @@ const rt = {
|
|
|
727
727
|
uponSanitizeShadowNode: []
|
|
728
728
|
};
|
|
729
729
|
}, "_createHooksMap");
|
|
730
|
-
function
|
|
731
|
-
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
732
|
-
const t = /* @__PURE__ */ p((S) =>
|
|
733
|
-
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !==
|
|
730
|
+
function ps() {
|
|
731
|
+
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : wr();
|
|
732
|
+
const t = /* @__PURE__ */ p((S) => ps(S), "DOMPurify");
|
|
733
|
+
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !== at.document || !a.Element)
|
|
734
734
|
return t.isSupported = !1, t;
|
|
735
735
|
let {
|
|
736
736
|
document: e
|
|
@@ -741,43 +741,43 @@ function hs() {
|
|
|
741
741
|
Node: o,
|
|
742
742
|
Element: d,
|
|
743
743
|
NodeFilter: c,
|
|
744
|
-
NamedNodeMap:
|
|
744
|
+
NamedNodeMap: x = a.NamedNodeMap || a.MozNamedAttrMap,
|
|
745
745
|
HTMLFormElement: u,
|
|
746
|
-
DOMParser:
|
|
747
|
-
trustedTypes:
|
|
748
|
-
} = a, w = d.prototype, _ =
|
|
746
|
+
DOMParser: g,
|
|
747
|
+
trustedTypes: m
|
|
748
|
+
} = a, w = d.prototype, _ = je(w, "cloneNode"), z = je(w, "remove"), te = je(w, "nextSibling"), oe = je(w, "childNodes"), se = je(w, "parentNode");
|
|
749
749
|
if (typeof l == "function") {
|
|
750
750
|
const S = e.createElement("template");
|
|
751
751
|
S.content && S.content.ownerDocument && (e = S.content.ownerDocument);
|
|
752
752
|
}
|
|
753
|
-
let
|
|
753
|
+
let O, ce = "";
|
|
754
754
|
const {
|
|
755
|
-
implementation:
|
|
756
|
-
createNodeIterator:
|
|
757
|
-
createDocumentFragment:
|
|
758
|
-
getElementsByTagName:
|
|
755
|
+
implementation: re,
|
|
756
|
+
createNodeIterator: ie,
|
|
757
|
+
createDocumentFragment: Ee,
|
|
758
|
+
getElementsByTagName: Ct
|
|
759
759
|
} = e, {
|
|
760
|
-
importNode:
|
|
760
|
+
importNode: pt
|
|
761
761
|
} = n;
|
|
762
|
-
let
|
|
763
|
-
t.isSupported = typeof
|
|
762
|
+
let A = Yn();
|
|
763
|
+
t.isSupported = typeof cs == "function" && typeof se == "function" && re && re.createHTMLDocument !== void 0;
|
|
764
764
|
const {
|
|
765
|
-
MUSTACHE_EXPR:
|
|
766
|
-
ERB_EXPR:
|
|
767
|
-
TMPLIT_EXPR:
|
|
768
|
-
DATA_ATTR:
|
|
769
|
-
ARIA_ATTR:
|
|
770
|
-
IS_SCRIPT_OR_DATA:
|
|
771
|
-
ATTR_WHITESPACE:
|
|
772
|
-
CUSTOM_ELEMENT:
|
|
765
|
+
MUSTACHE_EXPR: _e,
|
|
766
|
+
ERB_EXPR: we,
|
|
767
|
+
TMPLIT_EXPR: Oe,
|
|
768
|
+
DATA_ATTR: Ke,
|
|
769
|
+
ARIA_ATTR: It,
|
|
770
|
+
IS_SCRIPT_OR_DATA: Dt,
|
|
771
|
+
ATTR_WHITESPACE: dt,
|
|
772
|
+
CUSTOM_ELEMENT: Mt
|
|
773
773
|
} = Vn;
|
|
774
774
|
let {
|
|
775
|
-
IS_ALLOWED_URI:
|
|
776
|
-
} = Vn,
|
|
777
|
-
const
|
|
778
|
-
let
|
|
779
|
-
const
|
|
780
|
-
let
|
|
775
|
+
IS_ALLOWED_URI: ft
|
|
776
|
+
} = Vn, F = null;
|
|
777
|
+
const Qe = R({}, [...Gn, ...Vt, ...Yt, ...Zt, ...jn]);
|
|
778
|
+
let H = null;
|
|
779
|
+
const C = R({}, [...Wn, ...Xt, ...qn, ...wt]);
|
|
780
|
+
let f = Object.seal(Ge(null, {
|
|
781
781
|
tagNameCheck: {
|
|
782
782
|
writable: !0,
|
|
783
783
|
configurable: !1,
|
|
@@ -796,8 +796,8 @@ function hs() {
|
|
|
796
796
|
enumerable: !0,
|
|
797
797
|
value: !1
|
|
798
798
|
}
|
|
799
|
-
})),
|
|
800
|
-
const
|
|
799
|
+
})), k = null, M = null;
|
|
800
|
+
const N = Object.seal(Ge(null, {
|
|
801
801
|
tagCheck: {
|
|
802
802
|
writable: !0,
|
|
803
803
|
configurable: !1,
|
|
@@ -811,72 +811,72 @@ function hs() {
|
|
|
811
811
|
value: null
|
|
812
812
|
}
|
|
813
813
|
}));
|
|
814
|
-
let
|
|
814
|
+
let xe = !0, ze = !0, Pe = !1, dn = !0, Re = !1, Je = !0, Ce = !1, Lt = !1, Ot = !1, Ne = !1, gt = !1, mt = !1, fn = !0, gn = !1;
|
|
815
815
|
const mn = "user-content-";
|
|
816
|
-
let
|
|
817
|
-
const
|
|
818
|
-
let
|
|
819
|
-
const
|
|
820
|
-
let
|
|
821
|
-
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
822
|
-
let
|
|
823
|
-
const
|
|
824
|
-
let
|
|
825
|
-
const
|
|
826
|
-
let
|
|
827
|
-
const
|
|
828
|
-
let W = null,
|
|
829
|
-
const
|
|
816
|
+
let zt = !0, et = !1, $e = {}, fe = null;
|
|
817
|
+
const Pt = 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"]);
|
|
818
|
+
let xn = null;
|
|
819
|
+
const bn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
820
|
+
let Nt = null;
|
|
821
|
+
const kn = R({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), xt = "http://www.w3.org/1998/Math/MathML", bt = "http://www.w3.org/2000/svg", ge = "http://www.w3.org/1999/xhtml";
|
|
822
|
+
let Ue = ge, $t = !1, Ut = null;
|
|
823
|
+
const Ts = R({}, [xt, bt, ge], qt);
|
|
824
|
+
let Bt = R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ft = R({}, ["annotation-xml"]);
|
|
825
|
+
const Ss = R({}, ["title", "style", "font", "a", "script"]);
|
|
826
|
+
let tt = null;
|
|
827
|
+
const As = ["application/xhtml+xml", "text/html"], Es = "text/html";
|
|
828
|
+
let W = null, Be = null;
|
|
829
|
+
const _s = e.createElement("form"), wn = /* @__PURE__ */ p(function(i) {
|
|
830
830
|
return i instanceof RegExp || i instanceof Function;
|
|
831
|
-
}, "isRegexOrFunction"),
|
|
831
|
+
}, "isRegexOrFunction"), Ht = /* @__PURE__ */ p(function() {
|
|
832
832
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
833
|
-
if (
|
|
833
|
+
if (Be && Be === i)
|
|
834
834
|
return;
|
|
835
|
-
(!i || typeof i != "object") && (i = {}), i =
|
|
836
|
-
|
|
837
|
-
const h =
|
|
838
|
-
if (
|
|
835
|
+
(!i || typeof i != "object") && (i = {}), i = ee(i), tt = // eslint-disable-next-line unicorn/prefer-includes
|
|
836
|
+
As.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Es : i.PARSER_MEDIA_TYPE, W = tt === "application/xhtml+xml" ? qt : ct, F = $(i, "ALLOWED_TAGS") && K(i.ALLOWED_TAGS) ? R({}, i.ALLOWED_TAGS, W) : Qe, H = $(i, "ALLOWED_ATTR") && K(i.ALLOWED_ATTR) ? R({}, i.ALLOWED_ATTR, W) : C, Ut = $(i, "ALLOWED_NAMESPACES") && K(i.ALLOWED_NAMESPACES) ? R({}, i.ALLOWED_NAMESPACES, qt) : Ts, Nt = $(i, "ADD_URI_SAFE_ATTR") && K(i.ADD_URI_SAFE_ATTR) ? R(ee(kn), i.ADD_URI_SAFE_ATTR, W) : kn, xn = $(i, "ADD_DATA_URI_TAGS") && K(i.ADD_DATA_URI_TAGS) ? R(ee(bn), i.ADD_DATA_URI_TAGS, W) : bn, fe = $(i, "FORBID_CONTENTS") && K(i.FORBID_CONTENTS) ? R({}, i.FORBID_CONTENTS, W) : Pt, k = $(i, "FORBID_TAGS") && K(i.FORBID_TAGS) ? R({}, i.FORBID_TAGS, W) : ee({}), M = $(i, "FORBID_ATTR") && K(i.FORBID_ATTR) ? R({}, i.FORBID_ATTR, W) : ee({}), $e = $(i, "USE_PROFILES") ? i.USE_PROFILES && typeof i.USE_PROFILES == "object" ? ee(i.USE_PROFILES) : i.USE_PROFILES : !1, xe = i.ALLOW_ARIA_ATTR !== !1, ze = i.ALLOW_DATA_ATTR !== !1, Pe = i.ALLOW_UNKNOWN_PROTOCOLS || !1, dn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Re = i.SAFE_FOR_TEMPLATES || !1, Je = i.SAFE_FOR_XML !== !1, Ce = i.WHOLE_DOCUMENT || !1, Ne = i.RETURN_DOM || !1, gt = i.RETURN_DOM_FRAGMENT || !1, mt = i.RETURN_TRUSTED_TYPE || !1, Ot = i.FORCE_BODY || !1, fn = i.SANITIZE_DOM !== !1, gn = i.SANITIZE_NAMED_PROPS || !1, zt = i.KEEP_CONTENT !== !1, et = i.IN_PLACE || !1, ft = cr(i.ALLOWED_URI_REGEXP) ? i.ALLOWED_URI_REGEXP : us, Ue = typeof i.NAMESPACE == "string" ? i.NAMESPACE : ge, Bt = $(i, "MATHML_TEXT_INTEGRATION_POINTS") && i.MATHML_TEXT_INTEGRATION_POINTS && typeof i.MATHML_TEXT_INTEGRATION_POINTS == "object" ? ee(i.MATHML_TEXT_INTEGRATION_POINTS) : R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ft = $(i, "HTML_INTEGRATION_POINTS") && i.HTML_INTEGRATION_POINTS && typeof i.HTML_INTEGRATION_POINTS == "object" ? ee(i.HTML_INTEGRATION_POINTS) : R({}, ["annotation-xml"]);
|
|
837
|
+
const h = $(i, "CUSTOM_ELEMENT_HANDLING") && i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING == "object" ? ee(i.CUSTOM_ELEMENT_HANDLING) : Ge(null);
|
|
838
|
+
if (f = Ge(null), $(h, "tagNameCheck") && wn(h.tagNameCheck) && (f.tagNameCheck = h.tagNameCheck), $(h, "attributeNameCheck") && wn(h.attributeNameCheck) && (f.attributeNameCheck = h.attributeNameCheck), $(h, "allowCustomizedBuiltInElements") && typeof h.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = h.allowCustomizedBuiltInElements), Re && (ze = !1), gt && (Ne = !0), $e && (F = R({}, jn), H = Ge(null), $e.html === !0 && (R(F, Gn), R(H, Wn)), $e.svg === !0 && (R(F, Vt), R(H, Xt), R(H, wt)), $e.svgFilters === !0 && (R(F, Yt), R(H, Xt), R(H, wt)), $e.mathMl === !0 && (R(F, Zt), R(H, qn), R(H, wt))), N.tagCheck = null, N.attributeCheck = null, $(i, "ADD_TAGS") && (typeof i.ADD_TAGS == "function" ? N.tagCheck = i.ADD_TAGS : K(i.ADD_TAGS) && (F === Qe && (F = ee(F)), R(F, i.ADD_TAGS, W))), $(i, "ADD_ATTR") && (typeof i.ADD_ATTR == "function" ? N.attributeCheck = i.ADD_ATTR : K(i.ADD_ATTR) && (H === C && (H = ee(H)), R(H, i.ADD_ATTR, W))), $(i, "ADD_URI_SAFE_ATTR") && K(i.ADD_URI_SAFE_ATTR) && R(Nt, i.ADD_URI_SAFE_ATTR, W), $(i, "FORBID_CONTENTS") && K(i.FORBID_CONTENTS) && (fe === Pt && (fe = ee(fe)), R(fe, i.FORBID_CONTENTS, W)), $(i, "ADD_FORBID_CONTENTS") && K(i.ADD_FORBID_CONTENTS) && (fe === Pt && (fe = ee(fe)), R(fe, i.ADD_FORBID_CONTENTS, W)), zt && (F["#text"] = !0), Ce && R(F, ["html", "head", "body"]), F.table && (R(F, ["tbody"]), delete k.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
839
839
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
840
|
-
throw
|
|
840
|
+
throw kt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
841
841
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
842
|
-
throw
|
|
843
|
-
|
|
842
|
+
throw kt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
843
|
+
O = i.TRUSTED_TYPES_POLICY, ce = O.createHTML("");
|
|
844
844
|
} else
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}, "_parseConfig"), vn = R({}, [...
|
|
848
|
-
let h =
|
|
845
|
+
O === void 0 && (O = vr(m, r)), O !== null && typeof ce == "string" && (ce = O.createHTML(""));
|
|
846
|
+
Q && Q(i), Be = i;
|
|
847
|
+
}, "_parseConfig"), vn = R({}, [...Vt, ...Yt, ...ur]), yn = R({}, [...Zt, ...hr]), Rs = /* @__PURE__ */ p(function(i) {
|
|
848
|
+
let h = se(i);
|
|
849
849
|
(!h || !h.tagName) && (h = {
|
|
850
|
-
namespaceURI:
|
|
850
|
+
namespaceURI: Ue,
|
|
851
851
|
tagName: "template"
|
|
852
852
|
});
|
|
853
|
-
const
|
|
854
|
-
return
|
|
855
|
-
}, "_checkValidNamespace"),
|
|
856
|
-
|
|
853
|
+
const b = ct(i.tagName), P = ct(h.tagName);
|
|
854
|
+
return Ut[i.namespaceURI] ? i.namespaceURI === bt ? h.namespaceURI === ge ? b === "svg" : h.namespaceURI === xt ? b === "svg" && (P === "annotation-xml" || Bt[P]) : !!vn[b] : i.namespaceURI === xt ? h.namespaceURI === ge ? b === "math" : h.namespaceURI === bt ? b === "math" && Ft[P] : !!yn[b] : i.namespaceURI === ge ? h.namespaceURI === bt && !Ft[P] || h.namespaceURI === xt && !Bt[P] ? !1 : !yn[b] && (Ss[b] || !vn[b]) : !!(tt === "application/xhtml+xml" && Ut[i.namespaceURI]) : !1;
|
|
855
|
+
}, "_checkValidNamespace"), ue = /* @__PURE__ */ p(function(i) {
|
|
856
|
+
rt(t.removed, {
|
|
857
857
|
element: i
|
|
858
858
|
});
|
|
859
859
|
try {
|
|
860
|
-
|
|
860
|
+
se(i).removeChild(i);
|
|
861
861
|
} catch {
|
|
862
|
-
|
|
862
|
+
z(i);
|
|
863
863
|
}
|
|
864
864
|
}, "_forceRemove"), Ie = /* @__PURE__ */ p(function(i, h) {
|
|
865
865
|
try {
|
|
866
|
-
|
|
866
|
+
rt(t.removed, {
|
|
867
867
|
attribute: h.getAttributeNode(i),
|
|
868
868
|
from: h
|
|
869
869
|
});
|
|
870
870
|
} catch {
|
|
871
|
-
|
|
871
|
+
rt(t.removed, {
|
|
872
872
|
attribute: null,
|
|
873
873
|
from: h
|
|
874
874
|
});
|
|
875
875
|
}
|
|
876
876
|
if (h.removeAttribute(i), i === "is")
|
|
877
|
-
if (
|
|
877
|
+
if (Ne || gt)
|
|
878
878
|
try {
|
|
879
|
-
|
|
879
|
+
ue(h);
|
|
880
880
|
} catch {
|
|
881
881
|
}
|
|
882
882
|
else
|
|
@@ -885,98 +885,98 @@ function hs() {
|
|
|
885
885
|
} catch {
|
|
886
886
|
}
|
|
887
887
|
}, "_removeAttribute"), Tn = /* @__PURE__ */ p(function(i) {
|
|
888
|
-
let h = null,
|
|
889
|
-
if (
|
|
888
|
+
let h = null, b = null;
|
|
889
|
+
if (Ot)
|
|
890
890
|
i = "<remove></remove>" + i;
|
|
891
891
|
else {
|
|
892
|
-
const
|
|
893
|
-
|
|
892
|
+
const G = Un(i, /^[\r\n\t ]+/);
|
|
893
|
+
b = G && G[0];
|
|
894
894
|
}
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
895
|
+
tt === "application/xhtml+xml" && Ue === ge && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
896
|
+
const P = O ? O.createHTML(i) : i;
|
|
897
|
+
if (Ue === ge)
|
|
898
898
|
try {
|
|
899
|
-
h = new
|
|
899
|
+
h = new g().parseFromString(P, tt);
|
|
900
900
|
} catch {
|
|
901
901
|
}
|
|
902
902
|
if (!h || !h.documentElement) {
|
|
903
|
-
h =
|
|
903
|
+
h = re.createDocument(Ue, "template", null);
|
|
904
904
|
try {
|
|
905
|
-
h.documentElement.innerHTML =
|
|
905
|
+
h.documentElement.innerHTML = $t ? ce : P;
|
|
906
906
|
} catch {
|
|
907
907
|
}
|
|
908
908
|
}
|
|
909
|
-
const
|
|
910
|
-
return i &&
|
|
909
|
+
const Z = h.body || h.documentElement;
|
|
910
|
+
return i && b && Z.insertBefore(e.createTextNode(b), Z.childNodes[0] || null), Ue === ge ? Ct.call(h, Ce ? "html" : "body")[0] : Ce ? h.documentElement : Z;
|
|
911
911
|
}, "_initDocument"), Sn = /* @__PURE__ */ p(function(i) {
|
|
912
|
-
return
|
|
912
|
+
return ie.call(
|
|
913
913
|
i.ownerDocument || i,
|
|
914
914
|
i,
|
|
915
915
|
// eslint-disable-next-line no-bitwise
|
|
916
916
|
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
917
917
|
null
|
|
918
918
|
);
|
|
919
|
-
}, "_createNodeIterator"),
|
|
920
|
-
return i instanceof u && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof
|
|
921
|
-
}, "_isClobbered"),
|
|
919
|
+
}, "_createNodeIterator"), Gt = /* @__PURE__ */ p(function(i) {
|
|
920
|
+
return i instanceof u && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof x) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
921
|
+
}, "_isClobbered"), jt = /* @__PURE__ */ p(function(i) {
|
|
922
922
|
return typeof o == "function" && i instanceof o;
|
|
923
923
|
}, "_isNode");
|
|
924
|
-
function
|
|
925
|
-
|
|
926
|
-
|
|
924
|
+
function be(S, i, h) {
|
|
925
|
+
st(S, (b) => {
|
|
926
|
+
b.call(t, i, h, Be);
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
|
-
p(
|
|
929
|
+
p(be, "_executeHooks");
|
|
930
930
|
const An = /* @__PURE__ */ p(function(i) {
|
|
931
931
|
let h = null;
|
|
932
|
-
if (
|
|
933
|
-
return
|
|
934
|
-
const
|
|
935
|
-
if (
|
|
936
|
-
tagName:
|
|
937
|
-
allowedTags:
|
|
938
|
-
}),
|
|
939
|
-
return
|
|
940
|
-
if (
|
|
941
|
-
if (!
|
|
932
|
+
if (be(A.beforeSanitizeElements, i, null), Gt(i))
|
|
933
|
+
return ue(i), !0;
|
|
934
|
+
const b = W(i.nodeName);
|
|
935
|
+
if (be(A.uponSanitizeElement, i, {
|
|
936
|
+
tagName: b,
|
|
937
|
+
allowedTags: F
|
|
938
|
+
}), Je && i.hasChildNodes() && !jt(i.firstElementChild) && V(/<[/\w!]/g, i.innerHTML) && V(/<[/\w!]/g, i.textContent) || Je && i.namespaceURI === ge && b === "style" && jt(i.firstElementChild) || i.nodeType === at.progressingInstruction || Je && i.nodeType === at.comment && V(/<[/\w]/g, i.data))
|
|
939
|
+
return ue(i), !0;
|
|
940
|
+
if (k[b] || !(N.tagCheck instanceof Function && N.tagCheck(b)) && !F[b]) {
|
|
941
|
+
if (!k[b] && _n(b) && (f.tagNameCheck instanceof RegExp && V(f.tagNameCheck, b) || f.tagNameCheck instanceof Function && f.tagNameCheck(b)))
|
|
942
942
|
return !1;
|
|
943
|
-
if (
|
|
944
|
-
const
|
|
945
|
-
if (
|
|
946
|
-
const
|
|
947
|
-
for (let
|
|
948
|
-
const
|
|
949
|
-
|
|
943
|
+
if (zt && !fe[b]) {
|
|
944
|
+
const P = se(i) || i.parentNode, Z = oe(i) || i.childNodes;
|
|
945
|
+
if (Z && P) {
|
|
946
|
+
const G = Z.length;
|
|
947
|
+
for (let J = G - 1; J >= 0; --J) {
|
|
948
|
+
const ae = _(Z[J], !0);
|
|
949
|
+
P.insertBefore(ae, te(i));
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
return
|
|
953
|
+
return ue(i), !0;
|
|
954
954
|
}
|
|
955
|
-
return i instanceof d && !
|
|
956
|
-
h =
|
|
957
|
-
}), i.textContent !== h && (
|
|
955
|
+
return i instanceof d && !Rs(i) || (b === "noscript" || b === "noembed" || b === "noframes") && V(/<\/no(script|embed|frames)/i, i.innerHTML) ? (ue(i), !0) : (Re && i.nodeType === at.text && (h = i.textContent, st([_e, we, Oe], (P) => {
|
|
956
|
+
h = He(h, P, " ");
|
|
957
|
+
}), i.textContent !== h && (rt(t.removed, {
|
|
958
958
|
element: i.cloneNode()
|
|
959
|
-
}), i.textContent = h)),
|
|
960
|
-
}, "_sanitizeElements"), En = /* @__PURE__ */ p(function(i, h,
|
|
961
|
-
if (
|
|
959
|
+
}), i.textContent = h)), be(A.afterSanitizeElements, i, null), !1);
|
|
960
|
+
}, "_sanitizeElements"), En = /* @__PURE__ */ p(function(i, h, b) {
|
|
961
|
+
if (M[h] || fn && (h === "id" || h === "name") && (b in e || b in _s))
|
|
962
962
|
return !1;
|
|
963
|
-
if (!(
|
|
964
|
-
if (!(
|
|
965
|
-
if (!(
|
|
966
|
-
if (!
|
|
963
|
+
if (!(ze && !M[h] && V(Ke, h))) {
|
|
964
|
+
if (!(xe && V(It, h))) {
|
|
965
|
+
if (!(N.attributeCheck instanceof Function && N.attributeCheck(h, i))) {
|
|
966
|
+
if (!H[h] || M[h]) {
|
|
967
967
|
if (
|
|
968
968
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
969
969
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
970
970
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
971
|
-
!(_n(i) && (
|
|
971
|
+
!(_n(i) && (f.tagNameCheck instanceof RegExp && V(f.tagNameCheck, i) || f.tagNameCheck instanceof Function && f.tagNameCheck(i)) && (f.attributeNameCheck instanceof RegExp && V(f.attributeNameCheck, h) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(h, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
972
972
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
973
|
-
h === "is" &&
|
|
973
|
+
h === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && V(f.tagNameCheck, b) || f.tagNameCheck instanceof Function && f.tagNameCheck(b)))
|
|
974
974
|
) return !1;
|
|
975
|
-
} else if (!
|
|
976
|
-
if (!
|
|
977
|
-
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Bn(
|
|
978
|
-
if (!(
|
|
979
|
-
if (
|
|
975
|
+
} else if (!Nt[h]) {
|
|
976
|
+
if (!V(ft, He(b, dt, ""))) {
|
|
977
|
+
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Bn(b, "data:") === 0 && xn[i])) {
|
|
978
|
+
if (!(Pe && !V(Dt, He(b, dt, "")))) {
|
|
979
|
+
if (b)
|
|
980
980
|
return !1;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
@@ -986,191 +986,191 @@ function hs() {
|
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
return !0;
|
|
989
|
-
}, "_isValidAttribute"),
|
|
990
|
-
return !
|
|
989
|
+
}, "_isValidAttribute"), Cs = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), _n = /* @__PURE__ */ p(function(i) {
|
|
990
|
+
return !Cs[ct(i)] && V(Mt, i);
|
|
991
991
|
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */ p(function(i) {
|
|
992
|
-
|
|
992
|
+
be(A.beforeSanitizeAttributes, i, null);
|
|
993
993
|
const {
|
|
994
994
|
attributes: h
|
|
995
995
|
} = i;
|
|
996
|
-
if (!h ||
|
|
996
|
+
if (!h || Gt(i))
|
|
997
997
|
return;
|
|
998
|
-
const
|
|
998
|
+
const b = {
|
|
999
999
|
attrName: "",
|
|
1000
1000
|
attrValue: "",
|
|
1001
1001
|
keepAttr: !0,
|
|
1002
|
-
allowedAttributes:
|
|
1002
|
+
allowedAttributes: H,
|
|
1003
1003
|
forceKeepAttr: void 0
|
|
1004
1004
|
};
|
|
1005
|
-
let
|
|
1006
|
-
for (;
|
|
1007
|
-
const
|
|
1008
|
-
name:
|
|
1009
|
-
namespaceURI:
|
|
1010
|
-
value:
|
|
1011
|
-
} =
|
|
1012
|
-
let
|
|
1013
|
-
if (
|
|
1014
|
-
Ie(
|
|
1005
|
+
let P = h.length;
|
|
1006
|
+
for (; P--; ) {
|
|
1007
|
+
const Z = h[P], {
|
|
1008
|
+
name: G,
|
|
1009
|
+
namespaceURI: J,
|
|
1010
|
+
value: ae
|
|
1011
|
+
} = Z, he = W(G), Wt = ae;
|
|
1012
|
+
let q = G === "value" ? Wt : sr(Wt);
|
|
1013
|
+
if (b.attrName = he, b.attrValue = q, b.keepAttr = !0, b.forceKeepAttr = void 0, be(A.uponSanitizeAttribute, i, b), q = b.attrValue, gn && (he === "id" || he === "name") && Bn(q, mn) !== 0 && (Ie(G, i), q = mn + q), Je && V(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, q)) {
|
|
1014
|
+
Ie(G, i);
|
|
1015
1015
|
continue;
|
|
1016
1016
|
}
|
|
1017
|
-
if (
|
|
1018
|
-
Ie(
|
|
1017
|
+
if (he === "attributename" && Un(q, "href")) {
|
|
1018
|
+
Ie(G, i);
|
|
1019
1019
|
continue;
|
|
1020
1020
|
}
|
|
1021
|
-
if (
|
|
1021
|
+
if (b.forceKeepAttr)
|
|
1022
1022
|
continue;
|
|
1023
|
-
if (!
|
|
1024
|
-
Ie(
|
|
1023
|
+
if (!b.keepAttr) {
|
|
1024
|
+
Ie(G, i);
|
|
1025
1025
|
continue;
|
|
1026
1026
|
}
|
|
1027
|
-
if (!dn &&
|
|
1028
|
-
Ie(
|
|
1027
|
+
if (!dn && V(/\/>/i, q)) {
|
|
1028
|
+
Ie(G, i);
|
|
1029
1029
|
continue;
|
|
1030
1030
|
}
|
|
1031
|
-
Re &&
|
|
1032
|
-
|
|
1031
|
+
Re && st([_e, we, Oe], (Dn) => {
|
|
1032
|
+
q = He(q, Dn, " ");
|
|
1033
1033
|
});
|
|
1034
1034
|
const In = W(i.nodeName);
|
|
1035
|
-
if (!En(In,
|
|
1036
|
-
Ie(
|
|
1035
|
+
if (!En(In, he, q)) {
|
|
1036
|
+
Ie(G, i);
|
|
1037
1037
|
continue;
|
|
1038
1038
|
}
|
|
1039
|
-
if (
|
|
1040
|
-
switch (
|
|
1039
|
+
if (O && typeof m == "object" && typeof m.getAttributeType == "function" && !J)
|
|
1040
|
+
switch (m.getAttributeType(In, he)) {
|
|
1041
1041
|
case "TrustedHTML": {
|
|
1042
|
-
|
|
1042
|
+
q = O.createHTML(q);
|
|
1043
1043
|
break;
|
|
1044
1044
|
}
|
|
1045
1045
|
case "TrustedScriptURL": {
|
|
1046
|
-
|
|
1046
|
+
q = O.createScriptURL(q);
|
|
1047
1047
|
break;
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
|
-
if (
|
|
1050
|
+
if (q !== Wt)
|
|
1051
1051
|
try {
|
|
1052
|
-
|
|
1052
|
+
J ? i.setAttributeNS(J, G, q) : i.setAttribute(G, q), Gt(i) ? ue(i) : $n(t.removed);
|
|
1053
1053
|
} catch {
|
|
1054
|
-
Ie(
|
|
1054
|
+
Ie(G, i);
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
-
|
|
1057
|
+
be(A.afterSanitizeAttributes, i, null);
|
|
1058
1058
|
}, "_sanitizeAttributes"), Cn = /* @__PURE__ */ p(function(i) {
|
|
1059
1059
|
let h = null;
|
|
1060
|
-
const
|
|
1061
|
-
for (
|
|
1062
|
-
|
|
1063
|
-
|
|
1060
|
+
const b = Sn(i);
|
|
1061
|
+
for (be(A.beforeSanitizeShadowDOM, i, null); h = b.nextNode(); )
|
|
1062
|
+
be(A.uponSanitizeShadowNode, h, null), An(h), Rn(h), h.content instanceof s && Cn(h.content);
|
|
1063
|
+
be(A.afterSanitizeShadowDOM, i, null);
|
|
1064
1064
|
}, "_sanitizeShadowDOM");
|
|
1065
1065
|
return t.sanitize = function(S) {
|
|
1066
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null,
|
|
1067
|
-
if (
|
|
1068
|
-
throw
|
|
1066
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, b = null, P = null, Z = null;
|
|
1067
|
+
if ($t = !S, $t && (S = "<!-->"), typeof S != "string" && !jt(S) && (S = or(S), typeof S != "string"))
|
|
1068
|
+
throw kt("dirty is not a string, aborting");
|
|
1069
1069
|
if (!t.isSupported)
|
|
1070
1070
|
return S;
|
|
1071
|
-
if (
|
|
1072
|
-
const
|
|
1073
|
-
if (typeof
|
|
1074
|
-
const
|
|
1075
|
-
if (!
|
|
1076
|
-
throw
|
|
1071
|
+
if (Lt || Ht(i), t.removed = [], typeof S == "string" && (et = !1), et) {
|
|
1072
|
+
const ae = S.nodeName;
|
|
1073
|
+
if (typeof ae == "string") {
|
|
1074
|
+
const he = W(ae);
|
|
1075
|
+
if (!F[he] || k[he])
|
|
1076
|
+
throw kt("root node is forbidden and cannot be sanitized in-place");
|
|
1077
1077
|
}
|
|
1078
1078
|
} else if (S instanceof o)
|
|
1079
|
-
h = Tn("<!---->"),
|
|
1079
|
+
h = Tn("<!---->"), b = h.ownerDocument.importNode(S, !0), b.nodeType === at.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? h = b : h.appendChild(b);
|
|
1080
1080
|
else {
|
|
1081
|
-
if (!
|
|
1081
|
+
if (!Ne && !Re && !Ce && // eslint-disable-next-line unicorn/prefer-includes
|
|
1082
1082
|
S.indexOf("<") === -1)
|
|
1083
|
-
return
|
|
1083
|
+
return O && mt ? O.createHTML(S) : S;
|
|
1084
1084
|
if (h = Tn(S), !h)
|
|
1085
|
-
return
|
|
1085
|
+
return Ne ? null : mt ? ce : "";
|
|
1086
1086
|
}
|
|
1087
|
-
h &&
|
|
1088
|
-
const
|
|
1089
|
-
for (;
|
|
1090
|
-
An(
|
|
1091
|
-
if (
|
|
1087
|
+
h && Ot && ue(h.firstChild);
|
|
1088
|
+
const G = Sn(et ? S : h);
|
|
1089
|
+
for (; P = G.nextNode(); )
|
|
1090
|
+
An(P), Rn(P), P.content instanceof s && Cn(P.content);
|
|
1091
|
+
if (et)
|
|
1092
1092
|
return S;
|
|
1093
|
-
if (
|
|
1093
|
+
if (Ne) {
|
|
1094
1094
|
if (Re) {
|
|
1095
1095
|
h.normalize();
|
|
1096
|
-
let
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
}), h.innerHTML =
|
|
1100
|
-
}
|
|
1101
|
-
if (
|
|
1102
|
-
for (
|
|
1103
|
-
|
|
1096
|
+
let ae = h.innerHTML;
|
|
1097
|
+
st([_e, we, Oe], (he) => {
|
|
1098
|
+
ae = He(ae, he, " ");
|
|
1099
|
+
}), h.innerHTML = ae;
|
|
1100
|
+
}
|
|
1101
|
+
if (gt)
|
|
1102
|
+
for (Z = Ee.call(h.ownerDocument); h.firstChild; )
|
|
1103
|
+
Z.appendChild(h.firstChild);
|
|
1104
1104
|
else
|
|
1105
|
-
|
|
1106
|
-
return (
|
|
1107
|
-
}
|
|
1108
|
-
let
|
|
1109
|
-
return Ce &&
|
|
1110
|
-
` +
|
|
1111
|
-
|
|
1112
|
-
}),
|
|
1105
|
+
Z = h;
|
|
1106
|
+
return (H.shadowroot || H.shadowrootmode) && (Z = pt.call(n, Z, !0)), Z;
|
|
1107
|
+
}
|
|
1108
|
+
let J = Ce ? h.outerHTML : h.innerHTML;
|
|
1109
|
+
return Ce && F["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && V(hs, h.ownerDocument.doctype.name) && (J = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
1110
|
+
` + J), Re && st([_e, we, Oe], (ae) => {
|
|
1111
|
+
J = He(J, ae, " ");
|
|
1112
|
+
}), O && mt ? O.createHTML(J) : J;
|
|
1113
1113
|
}, t.setConfig = function() {
|
|
1114
1114
|
let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1115
|
-
|
|
1115
|
+
Ht(S), Lt = !0;
|
|
1116
1116
|
}, t.clearConfig = function() {
|
|
1117
|
-
|
|
1117
|
+
Be = null, Lt = !1;
|
|
1118
1118
|
}, t.isValidAttribute = function(S, i, h) {
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
return En(
|
|
1119
|
+
Be || Ht({});
|
|
1120
|
+
const b = W(S), P = W(i);
|
|
1121
|
+
return En(b, P, h);
|
|
1122
1122
|
}, t.addHook = function(S, i) {
|
|
1123
|
-
typeof i == "function" &&
|
|
1123
|
+
typeof i == "function" && rt(A[S], i);
|
|
1124
1124
|
}, t.removeHook = function(S, i) {
|
|
1125
1125
|
if (i !== void 0) {
|
|
1126
|
-
const h =
|
|
1127
|
-
return h === -1 ? void 0 :
|
|
1126
|
+
const h = tr(A[S], i);
|
|
1127
|
+
return h === -1 ? void 0 : nr(A[S], h, 1)[0];
|
|
1128
1128
|
}
|
|
1129
|
-
return $n(
|
|
1129
|
+
return $n(A[S]);
|
|
1130
1130
|
}, t.removeHooks = function(S) {
|
|
1131
|
-
|
|
1131
|
+
A[S] = [];
|
|
1132
1132
|
}, t.removeAllHooks = function() {
|
|
1133
|
-
|
|
1133
|
+
A = Yn();
|
|
1134
1134
|
}, t;
|
|
1135
1135
|
}
|
|
1136
|
-
p(
|
|
1137
|
-
var
|
|
1138
|
-
function
|
|
1136
|
+
p(ps, "createDOMPurify");
|
|
1137
|
+
var yr = ps();
|
|
1138
|
+
function nn() {
|
|
1139
1139
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1140
1140
|
}
|
|
1141
|
-
p(
|
|
1142
|
-
var Le =
|
|
1143
|
-
function
|
|
1141
|
+
p(nn, "z");
|
|
1142
|
+
var Le = nn();
|
|
1143
|
+
function ds(a) {
|
|
1144
1144
|
Le = a;
|
|
1145
1145
|
}
|
|
1146
|
-
p(
|
|
1146
|
+
p(ds, "G");
|
|
1147
1147
|
var De = { exec: /* @__PURE__ */ p(() => null, "exec") };
|
|
1148
1148
|
function D(a, t = "") {
|
|
1149
1149
|
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */ p((r, s) => {
|
|
1150
1150
|
let l = typeof s == "string" ? s : s.source;
|
|
1151
|
-
return l = l.replace(
|
|
1151
|
+
return l = l.replace(X.caret, "$1"), e = e.replace(r, l), n;
|
|
1152
1152
|
}, "replace"), getRegex: /* @__PURE__ */ p(() => new RegExp(e, t), "getRegex") };
|
|
1153
1153
|
return n;
|
|
1154
1154
|
}
|
|
1155
1155
|
p(D, "k");
|
|
1156
|
-
var
|
|
1156
|
+
var Tr = ((a = "") => {
|
|
1157
1157
|
try {
|
|
1158
1158
|
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
1159
1159
|
} catch {
|
|
1160
1160
|
return !1;
|
|
1161
1161
|
}
|
|
1162
|
-
})(),
|
|
1163
|
-
]`).replace("lheading",
|
|
1162
|
+
})(), X = { 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__ */ p((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ p((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") }, Sr = /^(?:[ \t]*(?:\n|$))+/, Ar = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Er = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ht = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, _r = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, sn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, fs = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, gs = D(fs).replace(/bull/g, sn).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(), Rr = D(fs).replace(/bull/g, sn).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(), rn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Cr = /^[^\n]+/, an = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ir = D(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", an).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Dr = D(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, sn).getRegex(), _t = "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", ln = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Mr = D("^ {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", ln).replace("tag", _t).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ms = D(rn).replace("hr", ht).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", _t).getRegex(), Lr = D(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ms).getRegex(), on = { blockquote: Lr, code: Ar, def: Ir, fences: Er, heading: _r, hr: ht, html: Mr, lheading: gs, list: Dr, newline: Sr, paragraph: ms, table: De, text: Cr }, Zn = D("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ht).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", _t).getRegex(), Or = { ...on, lheading: Rr, table: Zn, paragraph: D(rn).replace("hr", ht).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Zn).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", _t).getRegex() }, zr = { ...on, html: D(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ln).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: D(rn).replace("hr", ht).replace("heading", ` *#{1,6} *[^
|
|
1163
|
+
]`).replace("lheading", gs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Pr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Nr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, xs = /^( {2,}|\\)\n(?!\s*$)/, $r = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Xe = /[\p{P}\p{S}]/u, Rt = /[\s\p{P}\p{S}]/u, cn = /[^\s\p{P}\p{S}]/u, Ur = D(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Rt).getRegex(), bs = /(?!~)[\p{P}\p{S}]/u, Br = /(?!~)[\s\p{P}\p{S}]/u, Fr = /(?:[^\s\p{P}\p{S}]|~)/u, Hr = D(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Tr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ks = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Gr = D(ks, "u").replace(/punct/g, Xe).getRegex(), jr = D(ks, "u").replace(/punct/g, bs).getRegex(), ws = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Wr = D(ws, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Xe).getRegex(), qr = D(ws, "gu").replace(/notPunctSpace/g, Fr).replace(/punctSpace/g, Br).replace(/punct/g, bs).getRegex(), Vr = D("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Xe).getRegex(), Yr = D(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Xe).getRegex(), Zr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Xr = D(Zr, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Xe).getRegex(), Kr = D(/\\(punct)/, "gu").replace(/punct/g, Xe).getRegex(), Qr = D(/^<(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(), Jr = D(ln).replace("(?:-->|$)", "-->").getRegex(), ei = D("^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", Jr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Tt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, ti = D(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Tt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), vs = D(/^!?\[(label)\]\[(ref)\]/).replace("label", Tt).replace("ref", an).getRegex(), ys = D(/^!?\[(ref)\](?:\[\])?/).replace("ref", an).getRegex(), ni = D("reflink|nolink(?!\\()", "g").replace("reflink", vs).replace("nolink", ys).getRegex(), Xn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, un = { _backpedal: De, anyPunctuation: Kr, autolink: Qr, blockSkip: Hr, br: xs, code: Nr, del: De, delLDelim: De, delRDelim: De, emStrongLDelim: Gr, emStrongRDelimAst: Wr, emStrongRDelimUnd: Vr, escape: Pr, link: ti, nolink: ys, punctuation: Ur, reflink: vs, reflinkSearch: ni, tag: ei, text: $r, url: De }, si = { ...un, link: D(/^!?\[(label)\]\((.*?)\)/).replace("label", Tt).getRegex(), reflink: D(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Tt).getRegex() }, en = { ...un, emStrongRDelimAst: qr, emStrongLDelim: jr, delLDelim: Yr, delRDelim: Xr, url: D(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Xn).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: D(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Xn).getRegex() }, ri = { ...en, br: D(xs).replace("{2,}", "*").getRegex(), text: D(en.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, vt = { normal: on, gfm: Or, pedantic: zr }, lt = { normal: un, gfm: en, breaks: ri, pedantic: si }, ii = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Kn = /* @__PURE__ */ p((a) => ii[a], "de");
|
|
1164
1164
|
function me(a, t) {
|
|
1165
1165
|
if (t) {
|
|
1166
|
-
if (
|
|
1167
|
-
} else if (
|
|
1166
|
+
if (X.escapeTest.test(a)) return a.replace(X.escapeReplace, Kn);
|
|
1167
|
+
} else if (X.escapeTestNoEncode.test(a)) return a.replace(X.escapeReplaceNoEncode, Kn);
|
|
1168
1168
|
return a;
|
|
1169
1169
|
}
|
|
1170
1170
|
p(me, "O");
|
|
1171
1171
|
function Qn(a) {
|
|
1172
1172
|
try {
|
|
1173
|
-
a = encodeURI(a).replace(
|
|
1173
|
+
a = encodeURI(a).replace(X.percentDecode, "%");
|
|
1174
1174
|
} catch {
|
|
1175
1175
|
return null;
|
|
1176
1176
|
}
|
|
@@ -1178,18 +1178,18 @@ function Qn(a) {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
p(Qn, "J");
|
|
1180
1180
|
function Jn(a, t) {
|
|
1181
|
-
let e = a.replace(
|
|
1181
|
+
let e = a.replace(X.findPipe, (s, l, o) => {
|
|
1182
1182
|
let d = !1, c = l;
|
|
1183
1183
|
for (; --c >= 0 && o[c] === "\\"; ) d = !d;
|
|
1184
1184
|
return d ? "|" : " |";
|
|
1185
|
-
}), n = e.split(
|
|
1185
|
+
}), n = e.split(X.splitPipe), r = 0;
|
|
1186
1186
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1187
1187
|
else for (; n.length < t; ) n.push("");
|
|
1188
|
-
for (; r < n.length; r++) n[r] = n[r].trim().replace(
|
|
1188
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(X.slashPipe, "|");
|
|
1189
1189
|
return n;
|
|
1190
1190
|
}
|
|
1191
1191
|
p(Jn, "V");
|
|
1192
|
-
function
|
|
1192
|
+
function ve(a, t, e) {
|
|
1193
1193
|
let n = a.length;
|
|
1194
1194
|
if (n === 0) return "";
|
|
1195
1195
|
let r = 0;
|
|
@@ -1197,16 +1197,16 @@ function ye(a, t, e) {
|
|
|
1197
1197
|
r++;
|
|
1198
1198
|
return a.slice(0, n - r);
|
|
1199
1199
|
}
|
|
1200
|
-
p(
|
|
1200
|
+
p(ve, "$");
|
|
1201
1201
|
function es(a) {
|
|
1202
1202
|
let t = a.split(`
|
|
1203
1203
|
`), e = t.length - 1;
|
|
1204
|
-
for (; e >= 0 &&
|
|
1204
|
+
for (; e >= 0 && X.blankLine.test(t[e]); ) e--;
|
|
1205
1205
|
return t.length - e <= 2 ? a : t.slice(0, e + 1).join(`
|
|
1206
1206
|
`);
|
|
1207
1207
|
}
|
|
1208
1208
|
p(es, "Y");
|
|
1209
|
-
function
|
|
1209
|
+
function ai(a, t) {
|
|
1210
1210
|
if (a.indexOf(t[1]) === -1) return -1;
|
|
1211
1211
|
let e = 0;
|
|
1212
1212
|
for (let n = 0; n < a.length; n++) if (a[n] === "\\") n++;
|
|
@@ -1214,8 +1214,8 @@ function ii(a, t) {
|
|
|
1214
1214
|
else if (a[n] === t[1] && (e--, e < 0)) return n;
|
|
1215
1215
|
return e > 0 ? -2 : -1;
|
|
1216
1216
|
}
|
|
1217
|
-
p(
|
|
1218
|
-
function
|
|
1217
|
+
p(ai, "ge");
|
|
1218
|
+
function li(a, t = 0) {
|
|
1219
1219
|
let e = t, n = "";
|
|
1220
1220
|
for (let r of a) if (r === " ") {
|
|
1221
1221
|
let s = 4 - e % 4;
|
|
@@ -1223,7 +1223,7 @@ function ai(a, t = 0) {
|
|
|
1223
1223
|
} else n += r, e++;
|
|
1224
1224
|
return n;
|
|
1225
1225
|
}
|
|
1226
|
-
p(
|
|
1226
|
+
p(li, "fe");
|
|
1227
1227
|
function ts(a, t, e, n, r) {
|
|
1228
1228
|
let s = t.href, l = t.title || null, o = a[1].replace(r.other.outputLinkReplace, "$1");
|
|
1229
1229
|
n.state.inLink = !0;
|
|
@@ -1231,7 +1231,7 @@ function ts(a, t, e, n, r) {
|
|
|
1231
1231
|
return n.state.inLink = !1, d;
|
|
1232
1232
|
}
|
|
1233
1233
|
p(ts, "me");
|
|
1234
|
-
function
|
|
1234
|
+
function oi(a, t, e) {
|
|
1235
1235
|
let n = a.match(e.other.indentCodeCompensation);
|
|
1236
1236
|
if (n === null) return t;
|
|
1237
1237
|
let r = n[1];
|
|
@@ -1244,8 +1244,8 @@ function li(a, t, e) {
|
|
|
1244
1244
|
}).join(`
|
|
1245
1245
|
`);
|
|
1246
1246
|
}
|
|
1247
|
-
p(
|
|
1248
|
-
var
|
|
1247
|
+
p(oi, "rt");
|
|
1248
|
+
var We, St = (We = class {
|
|
1249
1249
|
constructor(t) {
|
|
1250
1250
|
I(this, "options");
|
|
1251
1251
|
I(this, "rules");
|
|
@@ -1266,7 +1266,7 @@ var He, yt = (He = class {
|
|
|
1266
1266
|
fences(t) {
|
|
1267
1267
|
let e = this.rules.block.fences.exec(t);
|
|
1268
1268
|
if (e) {
|
|
1269
|
-
let n = e[0], r =
|
|
1269
|
+
let n = e[0], r = oi(n, e[3] || "", this.rules);
|
|
1270
1270
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: r };
|
|
1271
1271
|
}
|
|
1272
1272
|
}
|
|
@@ -1275,22 +1275,22 @@ var He, yt = (He = class {
|
|
|
1275
1275
|
if (e) {
|
|
1276
1276
|
let n = e[2].trim();
|
|
1277
1277
|
if (this.rules.other.endingHash.test(n)) {
|
|
1278
|
-
let r =
|
|
1278
|
+
let r = ve(n, "#");
|
|
1279
1279
|
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
1280
1280
|
}
|
|
1281
|
-
return { type: "heading", raw:
|
|
1281
|
+
return { type: "heading", raw: ve(e[0], `
|
|
1282
1282
|
`), depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
1285
|
hr(t) {
|
|
1286
1286
|
let e = this.rules.block.hr.exec(t);
|
|
1287
|
-
if (e) return { type: "hr", raw:
|
|
1287
|
+
if (e) return { type: "hr", raw: ve(e[0], `
|
|
1288
1288
|
`) };
|
|
1289
1289
|
}
|
|
1290
1290
|
blockquote(t) {
|
|
1291
1291
|
let e = this.rules.block.blockquote.exec(t);
|
|
1292
1292
|
if (e) {
|
|
1293
|
-
let n =
|
|
1293
|
+
let n = ve(e[0], `
|
|
1294
1294
|
`).split(`
|
|
1295
1295
|
`), r = "", s = "", l = [];
|
|
1296
1296
|
for (; n.length > 0; ) {
|
|
@@ -1299,27 +1299,27 @@ var He, yt = (He = class {
|
|
|
1299
1299
|
else if (!o) d.push(n[c]);
|
|
1300
1300
|
else break;
|
|
1301
1301
|
n = n.slice(c);
|
|
1302
|
-
let
|
|
1303
|
-
`), u =
|
|
1302
|
+
let x = d.join(`
|
|
1303
|
+
`), u = x.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1304
1304
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1305
1305
|
r = r ? `${r}
|
|
1306
|
-
${
|
|
1306
|
+
${x}` : x, s = s ? `${s}
|
|
1307
1307
|
${u}` : u;
|
|
1308
|
-
let
|
|
1309
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, l, !0), this.lexer.state.top =
|
|
1310
|
-
let
|
|
1311
|
-
if (
|
|
1312
|
-
if (
|
|
1313
|
-
let w =
|
|
1308
|
+
let g = this.lexer.state.top;
|
|
1309
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, l, !0), this.lexer.state.top = g, n.length === 0) break;
|
|
1310
|
+
let m = l.at(-1);
|
|
1311
|
+
if (m?.type === "code") break;
|
|
1312
|
+
if (m?.type === "blockquote") {
|
|
1313
|
+
let w = m, _ = w.raw + `
|
|
1314
1314
|
` + n.join(`
|
|
1315
|
-
`),
|
|
1316
|
-
l[l.length - 1] =
|
|
1315
|
+
`), z = this.blockquote(_);
|
|
1316
|
+
l[l.length - 1] = z, r = r.substring(0, r.length - w.raw.length) + z.raw, s = s.substring(0, s.length - w.text.length) + z.text;
|
|
1317
1317
|
break;
|
|
1318
|
-
} else if (
|
|
1319
|
-
let w =
|
|
1318
|
+
} else if (m?.type === "list") {
|
|
1319
|
+
let w = m, _ = w.raw + `
|
|
1320
1320
|
` + n.join(`
|
|
1321
|
-
`),
|
|
1322
|
-
l[l.length - 1] =
|
|
1321
|
+
`), z = this.list(_);
|
|
1322
|
+
l[l.length - 1] = z, r = r.substring(0, r.length - m.raw.length) + z.raw, s = s.substring(0, s.length - w.raw.length) + z.raw, n = _.substring(l.at(-1).raw.length).split(`
|
|
1323
1323
|
`);
|
|
1324
1324
|
continue;
|
|
1325
1325
|
}
|
|
@@ -1334,31 +1334,31 @@ ${u}` : u;
|
|
|
1334
1334
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
1335
1335
|
let l = this.rules.other.listItemRegex(n), o = !1;
|
|
1336
1336
|
for (; t; ) {
|
|
1337
|
-
let c = !1,
|
|
1337
|
+
let c = !1, x = "", u = "";
|
|
1338
1338
|
if (!(e = l.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1339
|
-
|
|
1340
|
-
let
|
|
1341
|
-
`, 1)[0], e[1].length),
|
|
1342
|
-
`, 1)[0], w = !
|
|
1343
|
-
if (this.options.pedantic ? (_ = 2, u =
|
|
1344
|
-
`, t = t.substring(
|
|
1345
|
-
let
|
|
1339
|
+
x = e[0], t = t.substring(x.length);
|
|
1340
|
+
let g = li(e[2].split(`
|
|
1341
|
+
`, 1)[0], e[1].length), m = t.split(`
|
|
1342
|
+
`, 1)[0], w = !g.trim(), _ = 0;
|
|
1343
|
+
if (this.options.pedantic ? (_ = 2, u = g.trimStart()) : w ? _ = e[1].length + 1 : (_ = g.search(this.rules.other.nonSpaceChar), _ = _ > 4 ? 1 : _, u = g.slice(_), _ += e[1].length), w && this.rules.other.blankLine.test(m) && (x += m + `
|
|
1344
|
+
`, t = t.substring(m.length + 1), c = !0), !c) {
|
|
1345
|
+
let z = this.rules.other.nextBulletRegex(_), te = this.rules.other.hrRegex(_), oe = this.rules.other.fencesBeginRegex(_), se = this.rules.other.headingBeginRegex(_), O = this.rules.other.htmlBeginRegex(_), ce = this.rules.other.blockquoteBeginRegex(_);
|
|
1346
1346
|
for (; t; ) {
|
|
1347
|
-
let
|
|
1348
|
-
`, 1)[0],
|
|
1349
|
-
if (
|
|
1350
|
-
if (
|
|
1351
|
-
` +
|
|
1347
|
+
let re = t.split(`
|
|
1348
|
+
`, 1)[0], ie;
|
|
1349
|
+
if (m = re, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), ie = m) : ie = m.replace(this.rules.other.tabCharGlobal, " "), oe.test(m) || se.test(m) || O.test(m) || ce.test(m) || z.test(m) || te.test(m)) break;
|
|
1350
|
+
if (ie.search(this.rules.other.nonSpaceChar) >= _ || !m.trim()) u += `
|
|
1351
|
+
` + ie.slice(_);
|
|
1352
1352
|
else {
|
|
1353
|
-
if (w ||
|
|
1353
|
+
if (w || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || oe.test(g) || se.test(g) || te.test(g)) break;
|
|
1354
1354
|
u += `
|
|
1355
|
-
` +
|
|
1355
|
+
` + m;
|
|
1356
1356
|
}
|
|
1357
|
-
w = !
|
|
1358
|
-
`, t = t.substring(
|
|
1357
|
+
w = !m.trim(), x += re + `
|
|
1358
|
+
`, t = t.substring(re.length + 1), g = ie.slice(_);
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
1361
|
-
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1361
|
+
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(x) && (o = !0)), s.items.push({ type: "list_item", raw: x, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), s.raw += x;
|
|
1362
1362
|
}
|
|
1363
1363
|
let d = s.items.at(-1);
|
|
1364
1364
|
if (d) d.raw = d.raw.trimEnd(), d.text = d.text.trimEnd();
|
|
@@ -1373,20 +1373,20 @@ ${u}` : u;
|
|
|
1373
1373
|
break;
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
|
-
let
|
|
1377
|
-
if (
|
|
1378
|
-
let u = { type: "checkbox", raw:
|
|
1376
|
+
let x = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
1377
|
+
if (x) {
|
|
1378
|
+
let u = { type: "checkbox", raw: x[0] + " ", checked: x[0] !== "[ ]" };
|
|
1379
1379
|
c.checked = u.checked, s.loose ? c.tokens[0] && ["paragraph", "text"].includes(c.tokens[0].type) && "tokens" in c.tokens[0] && c.tokens[0].tokens ? (c.tokens[0].raw = u.raw + c.tokens[0].raw, c.tokens[0].text = u.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(u)) : c.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : c.tokens.unshift(u);
|
|
1380
1380
|
}
|
|
1381
1381
|
}
|
|
1382
1382
|
if (!s.loose) {
|
|
1383
|
-
let
|
|
1383
|
+
let x = c.tokens.filter((g) => g.type === "space"), u = x.length > 0 && x.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
1384
1384
|
s.loose = u;
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
1387
|
if (s.loose) for (let c of s.items) {
|
|
1388
1388
|
c.loose = !0;
|
|
1389
|
-
for (let
|
|
1389
|
+
for (let x of c.tokens) x.type === "text" && (x.type = "paragraph");
|
|
1390
1390
|
}
|
|
1391
1391
|
return s;
|
|
1392
1392
|
}
|
|
@@ -1402,7 +1402,7 @@ ${u}` : u;
|
|
|
1402
1402
|
let e = this.rules.block.def.exec(t);
|
|
1403
1403
|
if (e) {
|
|
1404
1404
|
let n = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = 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];
|
|
1405
|
-
return { type: "def", tag: n, raw:
|
|
1405
|
+
return { type: "def", tag: n, raw: ve(e[0], `
|
|
1406
1406
|
`), href: r, title: s };
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
@@ -1410,7 +1410,7 @@ ${u}` : u;
|
|
|
1410
1410
|
let e = this.rules.block.table.exec(t);
|
|
1411
1411
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1412
1412
|
let n = Jn(e[1]), r = 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:
|
|
1413
|
+
`) : [], l = { type: "table", raw: ve(e[0], `
|
|
1414
1414
|
`), header: [], align: [], rows: [] };
|
|
1415
1415
|
if (n.length === r.length) {
|
|
1416
1416
|
for (let o of r) 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);
|
|
@@ -1423,7 +1423,7 @@ ${u}` : u;
|
|
|
1423
1423
|
let e = this.rules.block.lheading.exec(t);
|
|
1424
1424
|
if (e) {
|
|
1425
1425
|
let n = e[1].trim();
|
|
1426
|
-
return { type: "heading", raw:
|
|
1426
|
+
return { type: "heading", raw: ve(e[0], `
|
|
1427
1427
|
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
@@ -1453,10 +1453,10 @@ ${u}` : u;
|
|
|
1453
1453
|
let n = e[2].trim();
|
|
1454
1454
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1455
1455
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1456
|
-
let l =
|
|
1456
|
+
let l = ve(n.slice(0, -1), "\\");
|
|
1457
1457
|
if ((n.length - l.length) % 2 === 0) return;
|
|
1458
1458
|
} else {
|
|
1459
|
-
let l =
|
|
1459
|
+
let l = ai(e[2], "()");
|
|
1460
1460
|
if (l === -2) return;
|
|
1461
1461
|
if (l > -1) {
|
|
1462
1462
|
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
@@ -1485,8 +1485,8 @@ ${u}` : u;
|
|
|
1485
1485
|
emStrong(t, e, n = "") {
|
|
1486
1486
|
let r = this.rules.inline.emStrongLDelim.exec(t);
|
|
1487
1487
|
if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1488
|
-
let s = [...r[0]].length - 1, l, o, d = s, c = 0,
|
|
1489
|
-
for (
|
|
1488
|
+
let s = [...r[0]].length - 1, l, o, d = s, c = 0, x = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1489
|
+
for (x.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = x.exec(e)) !== null; ) {
|
|
1490
1490
|
if (l = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !l) continue;
|
|
1491
1491
|
if (o = [...l].length, r[3] || r[4]) {
|
|
1492
1492
|
d += o;
|
|
@@ -1497,13 +1497,13 @@ ${u}` : u;
|
|
|
1497
1497
|
}
|
|
1498
1498
|
if (d -= o, d > 0) continue;
|
|
1499
1499
|
o = Math.min(o, o + d + c);
|
|
1500
|
-
let u = [...r[0]][0].length,
|
|
1500
|
+
let u = [...r[0]][0].length, g = t.slice(0, s + r.index + u + o);
|
|
1501
1501
|
if (Math.min(s, o) % 2) {
|
|
1502
|
-
let w =
|
|
1503
|
-
return { type: "em", raw:
|
|
1502
|
+
let w = g.slice(1, -1);
|
|
1503
|
+
return { type: "em", raw: g, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
1504
1504
|
}
|
|
1505
|
-
let
|
|
1506
|
-
return { type: "strong", raw:
|
|
1505
|
+
let m = g.slice(2, -2);
|
|
1506
|
+
return { type: "strong", raw: g, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1507
1507
|
}
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
@@ -1530,8 +1530,8 @@ ${u}` : u;
|
|
|
1530
1530
|
}
|
|
1531
1531
|
if (d -= o, d > 0) continue;
|
|
1532
1532
|
o = Math.min(o, o + d);
|
|
1533
|
-
let
|
|
1534
|
-
return { type: "del", raw: u, text:
|
|
1533
|
+
let x = [...r[0]][0].length, u = t.slice(0, s + r.index + x + o), g = u.slice(s, -s);
|
|
1534
|
+
return { type: "del", raw: u, text: g, tokens: this.lexer.inlineTokens(g) };
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
1537
|
}
|
|
@@ -1564,28 +1564,28 @@ ${u}` : u;
|
|
|
1564
1564
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
|
-
}, p(
|
|
1567
|
+
}, p(We, "w"), We), Se, pe = (Se = class {
|
|
1568
1568
|
constructor(t) {
|
|
1569
1569
|
I(this, "tokens");
|
|
1570
1570
|
I(this, "options");
|
|
1571
1571
|
I(this, "state");
|
|
1572
1572
|
I(this, "inlineQueue");
|
|
1573
1573
|
I(this, "tokenizer");
|
|
1574
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new
|
|
1575
|
-
let e = { other:
|
|
1576
|
-
this.options.pedantic ? (e.block =
|
|
1574
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new St(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1575
|
+
let e = { other: X, block: vt.normal, inline: lt.normal };
|
|
1576
|
+
this.options.pedantic ? (e.block = vt.pedantic, e.inline = lt.pedantic) : this.options.gfm && (e.block = vt.gfm, this.options.breaks ? e.inline = lt.breaks : e.inline = lt.gfm), this.tokenizer.rules = e;
|
|
1577
1577
|
}
|
|
1578
1578
|
static get rules() {
|
|
1579
|
-
return { block:
|
|
1579
|
+
return { block: vt, inline: lt };
|
|
1580
1580
|
}
|
|
1581
1581
|
static lex(t, e) {
|
|
1582
|
-
return new
|
|
1582
|
+
return new Se(e).lex(t);
|
|
1583
1583
|
}
|
|
1584
1584
|
static lexInline(t, e) {
|
|
1585
|
-
return new
|
|
1585
|
+
return new Se(e).inlineTokens(t);
|
|
1586
1586
|
}
|
|
1587
1587
|
lex(t) {
|
|
1588
|
-
t = t.replace(
|
|
1588
|
+
t = t.replace(X.carriageReturn, `
|
|
1589
1589
|
`), this.blockTokens(t, this.tokens);
|
|
1590
1590
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1591
1591
|
let n = this.inlineQueue[e];
|
|
@@ -1594,7 +1594,7 @@ ${u}` : u;
|
|
|
1594
1594
|
return this.inlineQueue = [], this.tokens;
|
|
1595
1595
|
}
|
|
1596
1596
|
blockTokens(t, e = [], n = !1) {
|
|
1597
|
-
this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1597
|
+
this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(X.tabCharGlobal, " ").replace(X.spaceLine, ""));
|
|
1598
1598
|
let r = 1 / 0;
|
|
1599
1599
|
for (; t; ) {
|
|
1600
1600
|
if (t.length < r) r = t.length;
|
|
@@ -1664,8 +1664,8 @@ ${u}` : u;
|
|
|
1664
1664
|
let l = t;
|
|
1665
1665
|
if (this.options.extensions?.startBlock) {
|
|
1666
1666
|
let o = 1 / 0, d = t.slice(1), c;
|
|
1667
|
-
this.options.extensions.startBlock.forEach((
|
|
1668
|
-
c =
|
|
1667
|
+
this.options.extensions.startBlock.forEach((x) => {
|
|
1668
|
+
c = x.call({ lexer: this }, d), typeof c == "number" && c >= 0 && (o = Math.min(o, c));
|
|
1669
1669
|
}), o < 1 / 0 && o >= 0 && (l = t.substring(0, o + 1));
|
|
1670
1670
|
}
|
|
1671
1671
|
if (this.state.top && (s = this.tokenizer.paragraph(l))) {
|
|
@@ -1758,14 +1758,14 @@ ${u}` : u;
|
|
|
1758
1758
|
t = t.substring(c.raw.length), e.push(c);
|
|
1759
1759
|
continue;
|
|
1760
1760
|
}
|
|
1761
|
-
let
|
|
1761
|
+
let x = t;
|
|
1762
1762
|
if (this.options.extensions?.startInline) {
|
|
1763
|
-
let u = 1 / 0,
|
|
1763
|
+
let u = 1 / 0, g = t.slice(1), m;
|
|
1764
1764
|
this.options.extensions.startInline.forEach((w) => {
|
|
1765
|
-
|
|
1766
|
-
}), u < 1 / 0 && u >= 0 && (
|
|
1765
|
+
m = w.call({ lexer: this }, g), typeof m == "number" && m >= 0 && (u = Math.min(u, m));
|
|
1766
|
+
}), u < 1 / 0 && u >= 0 && (x = t.substring(0, u + 1));
|
|
1767
1767
|
}
|
|
1768
|
-
if (c = this.tokenizer.inlineText(
|
|
1768
|
+
if (c = this.tokenizer.inlineText(x)) {
|
|
1769
1769
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), l = !0;
|
|
1770
1770
|
let u = e.at(-1);
|
|
1771
1771
|
u?.type === "text" ? (u.raw += c.raw, u.text += c.text) : e.push(c);
|
|
@@ -1783,7 +1783,7 @@ ${u}` : u;
|
|
|
1783
1783
|
if (this.options.silent) console.error(e);
|
|
1784
1784
|
else throw new Error(e);
|
|
1785
1785
|
}
|
|
1786
|
-
}, p(
|
|
1786
|
+
}, p(Se, "l"), Se), qe, At = (qe = class {
|
|
1787
1787
|
constructor(t) {
|
|
1788
1788
|
I(this, "options");
|
|
1789
1789
|
I(this, "parser");
|
|
@@ -1793,7 +1793,7 @@ ${u}` : u;
|
|
|
1793
1793
|
return "";
|
|
1794
1794
|
}
|
|
1795
1795
|
code({ text: t, lang: e, escaped: n }) {
|
|
1796
|
-
let r = (e || "").match(
|
|
1796
|
+
let r = (e || "").match(X.notSpaceStart)?.[0], s = t.replace(X.endingNewline, "") + `
|
|
1797
1797
|
`;
|
|
1798
1798
|
return r ? '<pre><code class="language-' + me(r) + '">' + (n ? s : me(s, !0)) + `</code></pre>
|
|
1799
1799
|
` : "<pre><code>" + (n ? s : me(s, !0)) + `</code></pre>
|
|
@@ -1900,7 +1900,7 @@ ${t}</tr>
|
|
|
1900
1900
|
text(t) {
|
|
1901
1901
|
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : me(t.text);
|
|
1902
1902
|
}
|
|
1903
|
-
}, p(
|
|
1903
|
+
}, p(qe, "y"), qe), Ve, hn = (Ve = class {
|
|
1904
1904
|
strong({ text: t }) {
|
|
1905
1905
|
return t;
|
|
1906
1906
|
}
|
|
@@ -1931,18 +1931,18 @@ ${t}</tr>
|
|
|
1931
1931
|
checkbox({ raw: t }) {
|
|
1932
1932
|
return t;
|
|
1933
1933
|
}
|
|
1934
|
-
}, p(
|
|
1934
|
+
}, p(Ve, "L"), Ve), Ae, de = (Ae = class {
|
|
1935
1935
|
constructor(t) {
|
|
1936
1936
|
I(this, "options");
|
|
1937
1937
|
I(this, "renderer");
|
|
1938
1938
|
I(this, "textRenderer");
|
|
1939
|
-
this.options = t || Le, this.options.renderer = this.options.renderer || new
|
|
1939
|
+
this.options = t || Le, this.options.renderer = this.options.renderer || new At(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new hn();
|
|
1940
1940
|
}
|
|
1941
1941
|
static parse(t, e) {
|
|
1942
|
-
return new
|
|
1942
|
+
return new Ae(e).parse(t);
|
|
1943
1943
|
}
|
|
1944
1944
|
static parseInline(t, e) {
|
|
1945
|
-
return new
|
|
1945
|
+
return new Ae(e).parseInline(t);
|
|
1946
1946
|
}
|
|
1947
1947
|
parse(t) {
|
|
1948
1948
|
this.renderer.parser = this;
|
|
@@ -2082,7 +2082,7 @@ ${t}</tr>
|
|
|
2082
2082
|
}
|
|
2083
2083
|
return n;
|
|
2084
2084
|
}
|
|
2085
|
-
}, p(
|
|
2085
|
+
}, p(Ae, "l"), Ae), Te, ut = (Te = class {
|
|
2086
2086
|
constructor(t) {
|
|
2087
2087
|
I(this, "options");
|
|
2088
2088
|
I(this, "block");
|
|
@@ -2101,23 +2101,23 @@ ${t}</tr>
|
|
|
2101
2101
|
return t;
|
|
2102
2102
|
}
|
|
2103
2103
|
provideLexer(t = this.block) {
|
|
2104
|
-
return t ?
|
|
2104
|
+
return t ? pe.lex : pe.lexInline;
|
|
2105
2105
|
}
|
|
2106
2106
|
provideParser(t = this.block) {
|
|
2107
|
-
return t ?
|
|
2107
|
+
return t ? de.parse : de.parseInline;
|
|
2108
2108
|
}
|
|
2109
|
-
}, p(
|
|
2109
|
+
}, p(Te, "P"), I(Te, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), I(Te, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Te), Ye, ci = (Ye = class {
|
|
2110
2110
|
constructor(...t) {
|
|
2111
|
-
I(this, "defaults",
|
|
2111
|
+
I(this, "defaults", nn());
|
|
2112
2112
|
I(this, "options", this.setOptions);
|
|
2113
2113
|
I(this, "parse", this.parseMarkdown(!0));
|
|
2114
2114
|
I(this, "parseInline", this.parseMarkdown(!1));
|
|
2115
|
-
I(this, "Parser",
|
|
2116
|
-
I(this, "Renderer",
|
|
2117
|
-
I(this, "TextRenderer",
|
|
2118
|
-
I(this, "Lexer",
|
|
2119
|
-
I(this, "Tokenizer",
|
|
2120
|
-
I(this, "Hooks",
|
|
2115
|
+
I(this, "Parser", de);
|
|
2116
|
+
I(this, "Renderer", At);
|
|
2117
|
+
I(this, "TextRenderer", hn);
|
|
2118
|
+
I(this, "Lexer", pe);
|
|
2119
|
+
I(this, "Tokenizer", St);
|
|
2120
|
+
I(this, "Hooks", ut);
|
|
2121
2121
|
this.use(...t);
|
|
2122
2122
|
}
|
|
2123
2123
|
walkTokens(t, e) {
|
|
@@ -2164,51 +2164,51 @@ ${t}</tr>
|
|
|
2164
2164
|
}
|
|
2165
2165
|
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
2166
2166
|
}), r.extensions = e), n.renderer) {
|
|
2167
|
-
let s = this.defaults.renderer || new
|
|
2167
|
+
let s = this.defaults.renderer || new At(this.defaults);
|
|
2168
2168
|
for (let l in n.renderer) {
|
|
2169
2169
|
if (!(l in s)) throw new Error(`renderer '${l}' does not exist`);
|
|
2170
2170
|
if (["options", "parser"].includes(l)) continue;
|
|
2171
2171
|
let o = l, d = n.renderer[o], c = s[o];
|
|
2172
|
-
s[o] = (...
|
|
2173
|
-
let u = d.apply(s,
|
|
2174
|
-
return u === !1 && (u = c.apply(s,
|
|
2172
|
+
s[o] = (...x) => {
|
|
2173
|
+
let u = d.apply(s, x);
|
|
2174
|
+
return u === !1 && (u = c.apply(s, x)), u || "";
|
|
2175
2175
|
};
|
|
2176
2176
|
}
|
|
2177
2177
|
r.renderer = s;
|
|
2178
2178
|
}
|
|
2179
2179
|
if (n.tokenizer) {
|
|
2180
|
-
let s = this.defaults.tokenizer || new
|
|
2180
|
+
let s = this.defaults.tokenizer || new St(this.defaults);
|
|
2181
2181
|
for (let l in n.tokenizer) {
|
|
2182
2182
|
if (!(l in s)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
2183
2183
|
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
2184
2184
|
let o = l, d = n.tokenizer[o], c = s[o];
|
|
2185
|
-
s[o] = (...
|
|
2186
|
-
let u = d.apply(s,
|
|
2187
|
-
return u === !1 && (u = c.apply(s,
|
|
2185
|
+
s[o] = (...x) => {
|
|
2186
|
+
let u = d.apply(s, x);
|
|
2187
|
+
return u === !1 && (u = c.apply(s, x)), u;
|
|
2188
2188
|
};
|
|
2189
2189
|
}
|
|
2190
2190
|
r.tokenizer = s;
|
|
2191
2191
|
}
|
|
2192
2192
|
if (n.hooks) {
|
|
2193
|
-
let s = this.defaults.hooks || new
|
|
2193
|
+
let s = this.defaults.hooks || new ut();
|
|
2194
2194
|
for (let l in n.hooks) {
|
|
2195
2195
|
if (!(l in s)) throw new Error(`hook '${l}' does not exist`);
|
|
2196
2196
|
if (["options", "block"].includes(l)) continue;
|
|
2197
2197
|
let o = l, d = n.hooks[o], c = s[o];
|
|
2198
|
-
|
|
2199
|
-
if (this.defaults.async &&
|
|
2200
|
-
let
|
|
2201
|
-
return c.call(s,
|
|
2198
|
+
ut.passThroughHooks.has(l) ? s[o] = (x) => {
|
|
2199
|
+
if (this.defaults.async && ut.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
2200
|
+
let g = await d.call(s, x);
|
|
2201
|
+
return c.call(s, g);
|
|
2202
2202
|
})();
|
|
2203
|
-
let u = d.call(s,
|
|
2203
|
+
let u = d.call(s, x);
|
|
2204
2204
|
return c.call(s, u);
|
|
2205
|
-
} : s[o] = (...
|
|
2205
|
+
} : s[o] = (...x) => {
|
|
2206
2206
|
if (this.defaults.async) return (async () => {
|
|
2207
|
-
let
|
|
2208
|
-
return
|
|
2207
|
+
let g = await d.apply(s, x);
|
|
2208
|
+
return g === !1 && (g = await c.apply(s, x)), g;
|
|
2209
2209
|
})();
|
|
2210
|
-
let u = d.apply(s,
|
|
2211
|
-
return u === !1 && (u = c.apply(s,
|
|
2210
|
+
let u = d.apply(s, x);
|
|
2211
|
+
return u === !1 && (u = c.apply(s, x)), u;
|
|
2212
2212
|
};
|
|
2213
2213
|
}
|
|
2214
2214
|
r.hooks = s;
|
|
@@ -2227,10 +2227,10 @@ ${t}</tr>
|
|
|
2227
2227
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2228
2228
|
}
|
|
2229
2229
|
lexer(t, e) {
|
|
2230
|
-
return
|
|
2230
|
+
return pe.lex(t, e ?? this.defaults);
|
|
2231
2231
|
}
|
|
2232
2232
|
parser(t, e) {
|
|
2233
|
-
return
|
|
2233
|
+
return de.parse(t, e ?? this.defaults);
|
|
2234
2234
|
}
|
|
2235
2235
|
parseMarkdown(t) {
|
|
2236
2236
|
return (e, n) => {
|
|
@@ -2239,16 +2239,16 @@ ${t}</tr>
|
|
|
2239
2239
|
if (typeof e > "u" || e === null) return l(new Error("marked(): input parameter is undefined or null"));
|
|
2240
2240
|
if (typeof e != "string") return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2241
2241
|
if (s.hooks && (s.hooks.options = s, s.hooks.block = t), s.async) return (async () => {
|
|
2242
|
-
let o = s.hooks ? await s.hooks.preprocess(e) : e, d = await (s.hooks ? await s.hooks.provideLexer(t) : t ?
|
|
2242
|
+
let o = s.hooks ? await s.hooks.preprocess(e) : e, d = await (s.hooks ? await s.hooks.provideLexer(t) : t ? pe.lex : pe.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(d) : d;
|
|
2243
2243
|
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
2244
|
-
let
|
|
2245
|
-
return s.hooks ? await s.hooks.postprocess(
|
|
2244
|
+
let x = await (s.hooks ? await s.hooks.provideParser(t) : t ? de.parse : de.parseInline)(c, s);
|
|
2245
|
+
return s.hooks ? await s.hooks.postprocess(x) : x;
|
|
2246
2246
|
})().catch(l);
|
|
2247
2247
|
try {
|
|
2248
2248
|
s.hooks && (e = s.hooks.preprocess(e));
|
|
2249
|
-
let o = (s.hooks ? s.hooks.provideLexer(t) : t ?
|
|
2249
|
+
let o = (s.hooks ? s.hooks.provideLexer(t) : t ? pe.lex : pe.lexInline)(e, s);
|
|
2250
2250
|
s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
|
|
2251
|
-
let d = (s.hooks ? s.hooks.provideParser(t) : t ?
|
|
2251
|
+
let d = (s.hooks ? s.hooks.provideParser(t) : t ? de.parse : de.parseInline)(o, s);
|
|
2252
2252
|
return s.hooks && (d = s.hooks.postprocess(d)), d;
|
|
2253
2253
|
} catch (o) {
|
|
2254
2254
|
return l(o);
|
|
@@ -2266,40 +2266,40 @@ Please report this to https://github.com/markedjs/marked.`, t) {
|
|
|
2266
2266
|
throw n;
|
|
2267
2267
|
};
|
|
2268
2268
|
}
|
|
2269
|
-
}, p(
|
|
2269
|
+
}, p(Ye, "D"), Ye), Me = new ci();
|
|
2270
2270
|
function L(a, t) {
|
|
2271
2271
|
return Me.parse(a, t);
|
|
2272
2272
|
}
|
|
2273
2273
|
p(L, "g");
|
|
2274
2274
|
L.options = L.setOptions = function(a) {
|
|
2275
|
-
return Me.setOptions(a), L.defaults = Me.defaults,
|
|
2275
|
+
return Me.setOptions(a), L.defaults = Me.defaults, ds(L.defaults), L;
|
|
2276
2276
|
};
|
|
2277
|
-
L.getDefaults =
|
|
2277
|
+
L.getDefaults = nn;
|
|
2278
2278
|
L.defaults = Le;
|
|
2279
2279
|
L.use = function(...a) {
|
|
2280
|
-
return Me.use(...a), L.defaults = Me.defaults,
|
|
2280
|
+
return Me.use(...a), L.defaults = Me.defaults, ds(L.defaults), L;
|
|
2281
2281
|
};
|
|
2282
2282
|
L.walkTokens = function(a, t) {
|
|
2283
2283
|
return Me.walkTokens(a, t);
|
|
2284
2284
|
};
|
|
2285
2285
|
L.parseInline = Me.parseInline;
|
|
2286
|
-
L.Parser =
|
|
2287
|
-
L.parser =
|
|
2288
|
-
L.Renderer =
|
|
2289
|
-
L.TextRenderer =
|
|
2290
|
-
L.Lexer =
|
|
2291
|
-
L.lexer =
|
|
2292
|
-
L.Tokenizer =
|
|
2293
|
-
L.Hooks =
|
|
2286
|
+
L.Parser = de;
|
|
2287
|
+
L.parser = de.parse;
|
|
2288
|
+
L.Renderer = At;
|
|
2289
|
+
L.TextRenderer = hn;
|
|
2290
|
+
L.Lexer = pe;
|
|
2291
|
+
L.lexer = pe.lex;
|
|
2292
|
+
L.Tokenizer = St;
|
|
2293
|
+
L.Hooks = ut;
|
|
2294
2294
|
L.parse = L;
|
|
2295
2295
|
L.options;
|
|
2296
2296
|
L.setOptions;
|
|
2297
2297
|
L.use;
|
|
2298
2298
|
L.walkTokens;
|
|
2299
2299
|
L.parseInline;
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
const
|
|
2300
|
+
de.parse;
|
|
2301
|
+
pe.lex;
|
|
2302
|
+
const ui = ["innerHTML"], ns = /* @__PURE__ */ ke({
|
|
2303
2303
|
__name: "ChatRichText",
|
|
2304
2304
|
props: {
|
|
2305
2305
|
text: {},
|
|
@@ -2307,9 +2307,9 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2307
2307
|
streaming: { type: Boolean }
|
|
2308
2308
|
},
|
|
2309
2309
|
setup(a) {
|
|
2310
|
-
const t = a, e =
|
|
2310
|
+
const t = a, e = is(t.text);
|
|
2311
2311
|
let n;
|
|
2312
|
-
|
|
2312
|
+
Ze(
|
|
2313
2313
|
[() => t.text, () => t.streaming],
|
|
2314
2314
|
([l, o]) => {
|
|
2315
2315
|
if (!o) {
|
|
@@ -2320,7 +2320,7 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2320
2320
|
n = void 0, e.value = t.text;
|
|
2321
2321
|
}));
|
|
2322
2322
|
}
|
|
2323
|
-
),
|
|
2323
|
+
), as(() => {
|
|
2324
2324
|
n !== void 0 && cancelAnimationFrame(n);
|
|
2325
2325
|
});
|
|
2326
2326
|
const r = new L.Renderer();
|
|
@@ -2334,21 +2334,21 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2334
2334
|
}
|
|
2335
2335
|
return d ? `<a href="${l}">${o}</a>` : `<a href="${l}" target="_blank" rel="noopener noreferrer">${o}</a>`;
|
|
2336
2336
|
}, L.setOptions({ breaks: !0, gfm: !0, renderer: r });
|
|
2337
|
-
const s =
|
|
2337
|
+
const s = U(() => {
|
|
2338
2338
|
const l = e.value;
|
|
2339
2339
|
if (!l) return "";
|
|
2340
2340
|
const o = L.parse(l, { async: !1 });
|
|
2341
|
-
return
|
|
2341
|
+
return yr.sanitize(o, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2342
2342
|
});
|
|
2343
2343
|
return (l, o) => (y(), T("div", {
|
|
2344
2344
|
class: E(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", a.inverted ? "chat-msg-prose-invert" : ""]),
|
|
2345
2345
|
innerHTML: s.value
|
|
2346
|
-
}, null, 10,
|
|
2346
|
+
}, null, 10, ui));
|
|
2347
2347
|
}
|
|
2348
2348
|
}), hi = 80, pi = /* @__PURE__ */ ke({
|
|
2349
2349
|
__name: "ChatScroller",
|
|
2350
2350
|
setup(a, { expose: t }) {
|
|
2351
|
-
const e =
|
|
2351
|
+
const e = Y(), n = Y();
|
|
2352
2352
|
let r = !0, s;
|
|
2353
2353
|
function l() {
|
|
2354
2354
|
const c = e.value;
|
|
@@ -2363,15 +2363,15 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2363
2363
|
function d() {
|
|
2364
2364
|
r = !0, l();
|
|
2365
2365
|
}
|
|
2366
|
-
return p(d, "pin"), t({ pin: d }),
|
|
2366
|
+
return p(d, "pin"), t({ pin: d }), Et(() => {
|
|
2367
2367
|
requestAnimationFrame(() => {
|
|
2368
2368
|
l(), requestAnimationFrame(l);
|
|
2369
2369
|
}), n.value && (s = new ResizeObserver(() => {
|
|
2370
2370
|
r && l();
|
|
2371
2371
|
}), s.observe(n.value));
|
|
2372
|
-
}),
|
|
2372
|
+
}), as(() => {
|
|
2373
2373
|
s?.disconnect();
|
|
2374
|
-
}), (c,
|
|
2374
|
+
}), (c, x) => (y(), T("div", {
|
|
2375
2375
|
ref_key: "viewport",
|
|
2376
2376
|
ref: e,
|
|
2377
2377
|
class: "overflow-y-auto overflow-x-hidden min-h-0 [overflow-anchor:none] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
@@ -2381,7 +2381,7 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2381
2381
|
ref_key: "content",
|
|
2382
2382
|
ref: n
|
|
2383
2383
|
}, [
|
|
2384
|
-
|
|
2384
|
+
tn(c.$slots, "default")
|
|
2385
2385
|
], 512)
|
|
2386
2386
|
], 544));
|
|
2387
2387
|
}
|
|
@@ -2391,7 +2391,7 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2391
2391
|
}, gi = { class: "pt-4 pb-[120px] px-3 space-y-1" }, mi = {
|
|
2392
2392
|
key: 0,
|
|
2393
2393
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2394
|
-
},
|
|
2394
|
+
}, xi = { class: "relative mb-4 size-20 @sm/chat:size-24" }, bi = ["src", "alt"], ki = {
|
|
2395
2395
|
key: 0,
|
|
2396
2396
|
class: "mt-5 flex flex-col items-stretch gap-2 w-full max-w-xs"
|
|
2397
2397
|
}, wi = ["onClick"], vi = ["title"], yi = {
|
|
@@ -2400,7 +2400,7 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2400
2400
|
}, Ti = {
|
|
2401
2401
|
key: 0,
|
|
2402
2402
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2403
|
-
}, Si = ["data-issue-code", "data-issue-bucket"], Ai = { class: "flex flex-col gap-1 min-w-0" }, Ei = ["href"], _i = ["data-test"], Ri = {
|
|
2403
|
+
}, Si = ["data-issue-code", "data-issue-bucket"], Ai = { class: "flex flex-col gap-1 min-w-0 system-msg-content" }, Ei = ["href"], _i = ["data-test"], Ri = {
|
|
2404
2404
|
key: 0,
|
|
2405
2405
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2406
2406
|
}, Ci = ["src", "alt"], Ii = ["src", "alt"], Di = ["src"], Mi = ["href"], Li = {
|
|
@@ -2441,299 +2441,306 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2441
2441
|
"Brief me on tomorrow",
|
|
2442
2442
|
"Triage my inbox",
|
|
2443
2443
|
"What's on my plate this week"
|
|
2444
|
-
], n =
|
|
2444
|
+
], n = U(
|
|
2445
2445
|
() => a.starterPrompts ?? e
|
|
2446
|
-
), r =
|
|
2447
|
-
const
|
|
2448
|
-
return a.scope === "org" && a.scopeName && (
|
|
2449
|
-
}), s =
|
|
2450
|
-
function
|
|
2451
|
-
|
|
2452
|
-
|
|
2446
|
+
), r = U(() => {
|
|
2447
|
+
const C = { ...t[a.scope] };
|
|
2448
|
+
return a.scope === "org" && a.scopeName && (C.label = a.scopeName, C.tooltip = `Visible to ${a.scopeName} members`), C;
|
|
2449
|
+
}), s = Y(""), l = Y(!1), o = Y(), d = Y(), c = Y(), x = Y([]), u = Y(!1);
|
|
2450
|
+
function g(C) {
|
|
2451
|
+
return C ? /\[[^\]]+\]\([^)]+\)/.test(C) : !1;
|
|
2452
|
+
}
|
|
2453
|
+
p(g, "containsMarkdownLink");
|
|
2454
|
+
function m(C, f) {
|
|
2455
|
+
const k = C[f], M = C[f + 1];
|
|
2456
|
+
return !M || M.sender !== k.sender;
|
|
2453
2457
|
}
|
|
2454
2458
|
p(m, "shouldShowAvatar");
|
|
2455
|
-
const
|
|
2456
|
-
if (!
|
|
2457
|
-
const
|
|
2458
|
-
return
|
|
2459
|
-
}),
|
|
2460
|
-
() =>
|
|
2461
|
-
), we =
|
|
2462
|
-
|
|
2463
|
-
a.chatController && !
|
|
2459
|
+
const w = U(() => a.chatController?.textState.value), _ = U(() => w.value?.isConnected ?? !1), z = U(() => w.value?.isThinking ?? !1), te = U(() => w.value?.connectionStatus === "disconnected" && !!w.value?.error), oe = U(() => w.value?.connectionStatus !== "connected" && !w.value?.error), se = U(() => w.value?.error), O = U(() => a.chatController?.sharedMessages.value ?? []), ce = U(() => {
|
|
2460
|
+
if (!z.value) return;
|
|
2461
|
+
const C = O.value, f = C[C.length - 1];
|
|
2462
|
+
return f?.sender === "agent" ? f.id : void 0;
|
|
2463
|
+
}), re = U(() => z.value ? ce.value === void 0 : !1), ie = U(() => w.value?.accountGated ?? !1), Ee = U(() => !_.value || ie.value), Ct = U(() => te.value ? "Agent is offline" : oe.value ? "Connecting..." : ie.value ? "Resolve the billing issue above to continue" : "Message"), pt = U(() => (s.value.trim() || x.value.length > 0) && !Ee.value && !u.value), A = U(() => a.variant === "light"), _e = U(
|
|
2464
|
+
() => A.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2465
|
+
), we = U(() => A.value ? "text-theme-300" : "text-white/30");
|
|
2466
|
+
Et(async () => {
|
|
2467
|
+
a.chatController && !_.value && await a.chatController.startTextConversation();
|
|
2464
2468
|
});
|
|
2465
2469
|
function Oe() {
|
|
2466
2470
|
a.chatController?.newConversation();
|
|
2467
2471
|
}
|
|
2468
2472
|
p(Oe, "startNewConversation");
|
|
2469
|
-
async function
|
|
2470
|
-
const
|
|
2471
|
-
if (!
|
|
2473
|
+
async function Ke() {
|
|
2474
|
+
const C = s.value.trim(), f = x.value.length > 0;
|
|
2475
|
+
if (!C && !f || !a.chatController || !_.value || u.value)
|
|
2472
2476
|
return;
|
|
2473
|
-
const
|
|
2474
|
-
s.value = "",
|
|
2477
|
+
const k = s.value, M = f ? [...x.value] : void 0;
|
|
2478
|
+
s.value = "", x.value = [], d.value && (d.value.style.height = "auto", d.value.focus()), o.value?.pin(), await a.chatController.sendChatMessage(k, M);
|
|
2475
2479
|
}
|
|
2476
|
-
p(
|
|
2477
|
-
async function
|
|
2478
|
-
|
|
2480
|
+
p(Ke, "sendMessage");
|
|
2481
|
+
async function It(C) {
|
|
2482
|
+
Ee.value || (s.value = C, await Ke());
|
|
2479
2483
|
}
|
|
2480
|
-
p(
|
|
2481
|
-
async function
|
|
2482
|
-
|
|
2484
|
+
p(It, "sendStarterPrompt");
|
|
2485
|
+
async function Dt(C) {
|
|
2486
|
+
C.key === "Enter" && !C.shiftKey && (C.preventDefault(), await Ke());
|
|
2483
2487
|
}
|
|
2484
|
-
p(
|
|
2485
|
-
function
|
|
2488
|
+
p(Dt, "handleKeydown");
|
|
2489
|
+
function dt() {
|
|
2486
2490
|
d.value && (d.value.style.height = "auto", d.value.style.height = `${Math.min(d.value.scrollHeight, 150)}px`);
|
|
2487
2491
|
}
|
|
2488
|
-
p(
|
|
2489
|
-
function
|
|
2492
|
+
p(dt, "adjustTextareaHeight"), Ze(s, () => Ds(() => dt()));
|
|
2493
|
+
function Mt() {
|
|
2490
2494
|
c.value?.click();
|
|
2491
2495
|
}
|
|
2492
|
-
p(
|
|
2493
|
-
async function
|
|
2494
|
-
const
|
|
2495
|
-
if (!(!
|
|
2496
|
+
p(Mt, "triggerFileInput");
|
|
2497
|
+
async function ft(C) {
|
|
2498
|
+
const f = C.target, k = f.files?.[0];
|
|
2499
|
+
if (!(!k || !a.uploadFn)) {
|
|
2496
2500
|
u.value = !0;
|
|
2497
2501
|
try {
|
|
2498
|
-
const M = await a.uploadFn(
|
|
2499
|
-
|
|
2502
|
+
const M = await a.uploadFn(k);
|
|
2503
|
+
x.value = [...x.value, M];
|
|
2500
2504
|
} catch (M) {
|
|
2501
|
-
const
|
|
2502
|
-
a.chatController?.notify(`Upload failed — ${
|
|
2505
|
+
const N = M instanceof Error ? M.message : "Couldn't attach that file.";
|
|
2506
|
+
a.chatController?.notify(`Upload failed — ${N}`);
|
|
2503
2507
|
} finally {
|
|
2504
|
-
u.value = !1,
|
|
2508
|
+
u.value = !1, f.value = "";
|
|
2505
2509
|
}
|
|
2506
2510
|
}
|
|
2507
2511
|
}
|
|
2508
|
-
p(
|
|
2509
|
-
function
|
|
2510
|
-
|
|
2512
|
+
p(ft, "handleFileSelect");
|
|
2513
|
+
function F(C) {
|
|
2514
|
+
x.value = x.value.filter((f, k) => k !== C);
|
|
2511
2515
|
}
|
|
2512
|
-
p(
|
|
2513
|
-
function
|
|
2514
|
-
if (
|
|
2515
|
-
const
|
|
2516
|
-
return
|
|
2516
|
+
p(F, "removeAttachment");
|
|
2517
|
+
function Qe(C, f) {
|
|
2518
|
+
if (f === 0) {
|
|
2519
|
+
const Pe = C[f];
|
|
2520
|
+
return Pe?.timestamp ? H(new Date(Pe.timestamp)) : null;
|
|
2517
2521
|
}
|
|
2518
|
-
const
|
|
2519
|
-
if (!
|
|
2520
|
-
const
|
|
2521
|
-
return new Date(M.timestamp).getTime() -
|
|
2522
|
+
const k = C[f - 1], M = C[f];
|
|
2523
|
+
if (!k?.timestamp || !M?.timestamp) return null;
|
|
2524
|
+
const N = new Date(k.timestamp).getTime();
|
|
2525
|
+
return new Date(M.timestamp).getTime() - N > 36e5 ? H(new Date(M.timestamp)) : null;
|
|
2522
2526
|
}
|
|
2523
|
-
p(
|
|
2524
|
-
function
|
|
2525
|
-
const
|
|
2527
|
+
p(Qe, "shouldShowTimeDivider");
|
|
2528
|
+
function H(C) {
|
|
2529
|
+
const f = /* @__PURE__ */ new Date(), k = C.toDateString() === f.toDateString(), M = new Date(f);
|
|
2526
2530
|
M.setDate(M.getDate() - 1);
|
|
2527
|
-
const
|
|
2528
|
-
if (
|
|
2529
|
-
if (
|
|
2530
|
-
const
|
|
2531
|
-
return `${
|
|
2531
|
+
const N = C.toDateString() === M.toDateString(), xe = C.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2532
|
+
if (k) return xe;
|
|
2533
|
+
if (N) return `Yesterday, ${xe}`;
|
|
2534
|
+
const ze = C.getFullYear() === f.getFullYear();
|
|
2535
|
+
return `${C.toLocaleDateString("en-US", {
|
|
2532
2536
|
weekday: "long",
|
|
2533
2537
|
month: "short",
|
|
2534
2538
|
day: "numeric",
|
|
2535
|
-
...
|
|
2536
|
-
})}, ${
|
|
2539
|
+
...ze ? {} : { year: "numeric" }
|
|
2540
|
+
})}, ${xe}`;
|
|
2537
2541
|
}
|
|
2538
|
-
return p(
|
|
2539
|
-
|
|
2540
|
-
|
|
2542
|
+
return p(H, "formatTimeDivider"), (C, f) => (y(), T("div", di, [
|
|
2543
|
+
A.value ? B("", !0) : (y(), T("div", fi, [
|
|
2544
|
+
Fe(Ks, {
|
|
2541
2545
|
agent: a.agent,
|
|
2542
|
-
"is-online":
|
|
2546
|
+
"is-online": _.value
|
|
2543
2547
|
}, null, 8, ["agent", "is-online"])
|
|
2544
2548
|
])),
|
|
2545
|
-
|
|
2549
|
+
te.value ? (y(), T("div", {
|
|
2546
2550
|
key: 1,
|
|
2547
|
-
class: E(["py-16 flex flex-col items-center justify-center gap-3 text-sm",
|
|
2551
|
+
class: E(["py-16 flex flex-col items-center justify-center gap-3 text-sm", A.value ? "text-theme-400" : "text-white/60"])
|
|
2548
2552
|
}, [
|
|
2549
2553
|
v("i", {
|
|
2550
|
-
class: E(["i-heroicons-cloud-arrow-down size-8",
|
|
2554
|
+
class: E(["i-heroicons-cloud-arrow-down size-8", A.value ? "text-theme-300" : "text-white/40"])
|
|
2551
2555
|
}, null, 2),
|
|
2552
|
-
v("span", null,
|
|
2553
|
-
], 2)) :
|
|
2556
|
+
v("span", null, ne(se.value), 1)
|
|
2557
|
+
], 2)) : oe.value ? (y(), T("div", {
|
|
2554
2558
|
key: 2,
|
|
2555
|
-
class: E(["py-16 flex flex-col items-center justify-center gap-2 text-sm",
|
|
2559
|
+
class: E(["py-16 flex flex-col items-center justify-center gap-2 text-sm", A.value ? "text-theme-400" : "text-theme-600"])
|
|
2556
2560
|
}, [
|
|
2557
|
-
|
|
2561
|
+
Fe(Ln, { class: "size-4" })
|
|
2558
2562
|
], 2)) : a.setupHint ? (y(), T("div", {
|
|
2559
2563
|
key: 3,
|
|
2560
2564
|
class: E(["flex items-center justify-center gap-1.5 py-2 text-[11px]", we.value])
|
|
2561
2565
|
}, [
|
|
2562
|
-
|
|
2563
|
-
v("span", null,
|
|
2566
|
+
f[6] || (f[6] = v("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2567
|
+
v("span", null, ne(a.setupHint), 1)
|
|
2564
2568
|
], 2)) : B("", !0),
|
|
2565
|
-
|
|
2569
|
+
Fe(pi, {
|
|
2566
2570
|
ref_key: "chatScroller",
|
|
2567
2571
|
ref: o,
|
|
2568
2572
|
class: "flex-1"
|
|
2569
2573
|
}, {
|
|
2570
|
-
default:
|
|
2574
|
+
default: Ms(() => [
|
|
2571
2575
|
v("div", gi, [
|
|
2572
|
-
|
|
2573
|
-
v("div",
|
|
2576
|
+
O.value.length === 0 && !oe.value && !te.value ? (y(), T("div", mi, [
|
|
2577
|
+
v("div", xi, [
|
|
2574
2578
|
v("img", {
|
|
2575
2579
|
src: a.agent.avatarUrl.value,
|
|
2576
2580
|
alt: a.agent.displayName.value,
|
|
2577
|
-
class: E(["size-full rounded-full object-cover ring-1",
|
|
2578
|
-
}, null, 10,
|
|
2579
|
-
|
|
2581
|
+
class: E(["size-full rounded-full object-cover ring-1", A.value ? "ring-black/5" : "ring-white/10"])
|
|
2582
|
+
}, null, 10, bi),
|
|
2583
|
+
_.value ? (y(), T("span", {
|
|
2580
2584
|
key: 0,
|
|
2581
|
-
class: E(["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",
|
|
2582
|
-
}, [...
|
|
2585
|
+
class: E(["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", A.value ? "bg-white" : "bg-theme-900"])
|
|
2586
|
+
}, [...f[7] || (f[7] = [
|
|
2583
2587
|
v("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2584
2588
|
])], 2)) : B("", !0)
|
|
2585
2589
|
]),
|
|
2586
2590
|
v("div", {
|
|
2587
|
-
class: E(["text-base @sm/chat:text-lg font-semibold",
|
|
2588
|
-
},
|
|
2591
|
+
class: E(["text-base @sm/chat:text-lg font-semibold", A.value ? "text-theme-900" : "text-white"])
|
|
2592
|
+
}, ne(a.agent.displayName.value), 3),
|
|
2589
2593
|
v("p", {
|
|
2590
2594
|
class: E(["mt-1 text-center text-xs @sm/chat:text-sm", we.value])
|
|
2591
|
-
},
|
|
2592
|
-
n.value.length > 0 && !
|
|
2593
|
-
(y(!0), T(
|
|
2594
|
-
key:
|
|
2595
|
+
}, ne(a.emptyStateMessage || "Tap a prompt to get started, or type your own."), 3),
|
|
2596
|
+
n.value.length > 0 && !Ee.value ? (y(), T("div", ki, [
|
|
2597
|
+
(y(!0), T(ye, null, ot(n.value, (k) => (y(), T("button", {
|
|
2598
|
+
key: k,
|
|
2595
2599
|
type: "button",
|
|
2596
2600
|
"data-test": "chat-starter-prompt",
|
|
2597
|
-
class: E(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer",
|
|
2598
|
-
onClick: /* @__PURE__ */ p((M) =>
|
|
2599
|
-
},
|
|
2601
|
+
class: E(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer", A.value ? "bg-theme-25 border border-theme-200 text-theme-700 hover:bg-theme-50 hover:border-theme-300" : "bg-white/5 border border-white/10 text-white/80 hover:bg-white/10 hover:border-white/20"]),
|
|
2602
|
+
onClick: /* @__PURE__ */ p((M) => It(k), "onClick")
|
|
2603
|
+
}, ne(k), 11, wi))), 128))
|
|
2600
2604
|
])) : B("", !0),
|
|
2601
2605
|
v("div", {
|
|
2602
|
-
class: E(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]",
|
|
2606
|
+
class: E(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", A.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2603
2607
|
title: r.value.tooltip
|
|
2604
2608
|
}, [
|
|
2605
2609
|
v("i", {
|
|
2606
2610
|
class: E([r.value.icon, "size-3"])
|
|
2607
2611
|
}, null, 2),
|
|
2608
|
-
v("span", null,
|
|
2612
|
+
v("span", null, ne(r.value.label), 1)
|
|
2609
2613
|
], 10, vi)
|
|
2610
2614
|
])) : B("", !0),
|
|
2611
|
-
|
|
2615
|
+
O.value.length > 0 ? (y(), T("div", yi, [
|
|
2612
2616
|
v("button", {
|
|
2613
2617
|
type: "button",
|
|
2614
2618
|
"data-test": "chat-new-session",
|
|
2615
|
-
class: E(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors",
|
|
2619
|
+
class: E(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", A.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2616
2620
|
onClick: Oe
|
|
2617
|
-
}, [...
|
|
2621
|
+
}, [...f[8] || (f[8] = [
|
|
2618
2622
|
v("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2619
2623
|
v("span", null, "New chat", -1)
|
|
2620
2624
|
])], 2)
|
|
2621
2625
|
])) : B("", !0),
|
|
2622
|
-
(y(!0), T(
|
|
2623
|
-
key:
|
|
2626
|
+
(y(!0), T(ye, null, ot(O.value, (k, M) => (y(), T(ye, {
|
|
2627
|
+
key: k.id
|
|
2624
2628
|
}, [
|
|
2625
|
-
|
|
2629
|
+
Qe(O.value, M) ? (y(), T("div", Ti, [
|
|
2626
2630
|
v("div", {
|
|
2627
|
-
class: E(["flex-1 h-px",
|
|
2631
|
+
class: E(["flex-1 h-px", _e.value])
|
|
2628
2632
|
}, null, 2),
|
|
2629
2633
|
v("span", {
|
|
2630
2634
|
class: E(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", we.value])
|
|
2631
|
-
},
|
|
2635
|
+
}, ne(Qe(O.value, M)), 3),
|
|
2632
2636
|
v("div", {
|
|
2633
|
-
class: E(["flex-1 h-px",
|
|
2637
|
+
class: E(["flex-1 h-px", _e.value])
|
|
2634
2638
|
}, null, 2)
|
|
2635
2639
|
])) : B("", !0),
|
|
2636
|
-
|
|
2640
|
+
k.sender === "system" ? (y(), T("div", {
|
|
2637
2641
|
key: 1,
|
|
2638
2642
|
"data-test": "messaging-system-msg",
|
|
2639
|
-
"data-issue-code":
|
|
2640
|
-
"data-issue-bucket":
|
|
2641
|
-
class: E(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed",
|
|
2643
|
+
"data-issue-code": k.issue?.code,
|
|
2644
|
+
"data-issue-bucket": k.issue?.bucket,
|
|
2645
|
+
class: E(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", A.value ? "text-theme-500" : "text-white/70"])
|
|
2642
2646
|
}, [
|
|
2643
2647
|
v("i", {
|
|
2644
|
-
class: E(["i-tabler-alert-circle size-4 mt-0.5 shrink-0",
|
|
2648
|
+
class: E(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", k.issue?.bucket === "account" ? A.value ? "text-amber-500" : "text-amber-300" : A.value ? "text-red-500" : "text-red-300"])
|
|
2645
2649
|
}, null, 2),
|
|
2646
2650
|
v("div", Ai, [
|
|
2647
|
-
|
|
2648
|
-
|
|
2651
|
+
Fe(ns, {
|
|
2652
|
+
text: k.text,
|
|
2653
|
+
inverted: !A.value
|
|
2654
|
+
}, null, 8, ["text", "inverted"]),
|
|
2655
|
+
k.issue?.help ? (y(), T("span", {
|
|
2649
2656
|
key: 0,
|
|
2650
|
-
class: E(["text-[12px]",
|
|
2651
|
-
},
|
|
2652
|
-
|
|
2657
|
+
class: E(["text-[12px]", A.value ? "text-theme-400" : "text-white/55"])
|
|
2658
|
+
}, ne(k.issue.help), 3)) : B("", !0),
|
|
2659
|
+
k.issue?.actionUrl && !g(k.text) ? (y(), T("a", {
|
|
2653
2660
|
key: 1,
|
|
2654
|
-
href:
|
|
2661
|
+
href: k.issue.actionUrl,
|
|
2655
2662
|
"data-test": "messaging-system-msg-action",
|
|
2656
|
-
class: E(["text-[12px] font-medium inline-flex items-center gap-1",
|
|
2663
|
+
class: E(["text-[12px] font-medium inline-flex items-center gap-1", A.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2657
2664
|
}, [
|
|
2658
|
-
|
|
2659
|
-
|
|
2665
|
+
nt(ne(k.issue.actionLabel) + " ", 1),
|
|
2666
|
+
f[9] || (f[9] = v("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2660
2667
|
], 10, Ei)) : B("", !0)
|
|
2661
2668
|
])
|
|
2662
2669
|
], 10, Si)) : (y(), T("div", {
|
|
2663
2670
|
key: 2,
|
|
2664
|
-
"data-test":
|
|
2671
|
+
"data-test": k.sender === "agent" ? "messaging-assistant-msg" : k.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2665
2672
|
class: E(["flex gap-2 items-end", {
|
|
2666
|
-
"justify-end":
|
|
2667
|
-
"justify-start":
|
|
2668
|
-
"mb-4": m(
|
|
2673
|
+
"justify-end": k.sender === "user",
|
|
2674
|
+
"justify-start": k.sender === "agent",
|
|
2675
|
+
"mb-4": m(O.value, M)
|
|
2669
2676
|
}])
|
|
2670
2677
|
}, [
|
|
2671
|
-
|
|
2672
|
-
m(
|
|
2678
|
+
k.sender === "agent" ? (y(), T("div", Ri, [
|
|
2679
|
+
m(O.value, M) ? (y(), T("img", {
|
|
2673
2680
|
key: 0,
|
|
2674
2681
|
src: a.agent.avatarUrl.value,
|
|
2675
2682
|
alt: a.agent.displayName.value,
|
|
2676
|
-
class: E(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm",
|
|
2683
|
+
class: E(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", A.value ? "ring-1 ring-black/5" : ""])
|
|
2677
2684
|
}, null, 10, Ci)) : B("", !0)
|
|
2678
2685
|
])) : B("", !0),
|
|
2679
2686
|
v("div", {
|
|
2680
|
-
class: E(
|
|
2687
|
+
class: E(k.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2681
2688
|
}, [
|
|
2682
|
-
|
|
2689
|
+
k.attachments?.length ? (y(), T("div", {
|
|
2683
2690
|
key: 0,
|
|
2684
|
-
class: E(["mb-1 space-y-1",
|
|
2691
|
+
class: E(["mb-1 space-y-1", k.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2685
2692
|
}, [
|
|
2686
|
-
(y(!0), T(
|
|
2687
|
-
|
|
2693
|
+
(y(!0), T(ye, null, ot(k.attachments, (N, xe) => (y(), T(ye, { key: xe }, [
|
|
2694
|
+
N.type === "image" ? (y(), T("img", {
|
|
2688
2695
|
key: 0,
|
|
2689
|
-
src:
|
|
2690
|
-
alt:
|
|
2696
|
+
src: N.url,
|
|
2697
|
+
alt: N.name,
|
|
2691
2698
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2692
|
-
}, null, 8, Ii)) :
|
|
2699
|
+
}, null, 8, Ii)) : N.type === "audio" ? (y(), T("audio", {
|
|
2693
2700
|
key: 1,
|
|
2694
|
-
src:
|
|
2701
|
+
src: N.url,
|
|
2695
2702
|
controls: "",
|
|
2696
2703
|
class: "max-w-full"
|
|
2697
2704
|
}, null, 8, Di)) : (y(), T("a", {
|
|
2698
2705
|
key: 2,
|
|
2699
|
-
href:
|
|
2706
|
+
href: N.url,
|
|
2700
2707
|
target: "_blank",
|
|
2701
2708
|
rel: "noopener",
|
|
2702
|
-
class: E(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs",
|
|
2709
|
+
class: E(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", A.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2703
2710
|
}, [
|
|
2704
|
-
|
|
2705
|
-
|
|
2711
|
+
f[10] || (f[10] = v("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2712
|
+
nt(" " + ne(N.name), 1)
|
|
2706
2713
|
], 10, Mi))
|
|
2707
2714
|
], 64))), 128))
|
|
2708
2715
|
], 2)) : B("", !0),
|
|
2709
|
-
|
|
2716
|
+
k.text ? (y(), T("div", {
|
|
2710
2717
|
key: 1,
|
|
2711
2718
|
class: E(["rounded-2xl px-3.5 py-2", [
|
|
2712
|
-
|
|
2719
|
+
k.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : A.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]"
|
|
2713
2720
|
]])
|
|
2714
2721
|
}, [
|
|
2715
|
-
|
|
2716
|
-
text:
|
|
2717
|
-
inverted:
|
|
2718
|
-
streaming:
|
|
2719
|
-
onClick:
|
|
2722
|
+
Fe(ns, {
|
|
2723
|
+
text: k.text,
|
|
2724
|
+
inverted: k.sender === "user" || !A.value,
|
|
2725
|
+
streaming: k.id === ce.value,
|
|
2726
|
+
onClick: f[0] || (f[0] = Ls(() => {
|
|
2720
2727
|
}, ["stop"]))
|
|
2721
2728
|
}, null, 8, ["text", "inverted", "streaming"])
|
|
2722
2729
|
], 2)) : B("", !0)
|
|
2723
2730
|
], 2)
|
|
2724
2731
|
], 10, _i))
|
|
2725
2732
|
], 64))), 128)),
|
|
2726
|
-
|
|
2733
|
+
re.value ? (y(), T("div", Li, [
|
|
2727
2734
|
v("img", {
|
|
2728
2735
|
src: a.agent.avatarUrl.value,
|
|
2729
2736
|
alt: a.agent.displayName.value,
|
|
2730
|
-
class: E(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm",
|
|
2737
|
+
class: E(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", A.value ? "ring-1 ring-black/5" : ""])
|
|
2731
2738
|
}, null, 10, Oi),
|
|
2732
2739
|
v("div", {
|
|
2733
|
-
class: E(["rounded-2xl px-3.5 py-2.5 flex items-center",
|
|
2740
|
+
class: E(["rounded-2xl px-3.5 py-2.5 flex items-center", A.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2734
2741
|
}, [
|
|
2735
2742
|
v("i", {
|
|
2736
|
-
class: E(["i-svg-spinners-3-dots-bounce size-7",
|
|
2743
|
+
class: E(["i-svg-spinners-3-dots-bounce size-7", A.value ? "text-theme-400" : "text-white/50"])
|
|
2737
2744
|
}, null, 2)
|
|
2738
2745
|
], 2)
|
|
2739
2746
|
])) : B("", !0)
|
|
@@ -2742,34 +2749,34 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2742
2749
|
_: 1
|
|
2743
2750
|
}, 512),
|
|
2744
2751
|
v("div", {
|
|
2745
|
-
class: E(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3",
|
|
2752
|
+
class: E(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", A.value ? "bg-gradient-to-t from-white via-white/95 to-white/70" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
2746
2753
|
}, [
|
|
2747
|
-
|
|
2748
|
-
(y(!0), T(
|
|
2754
|
+
x.value.length > 0 ? (y(), T("div", zi, [
|
|
2755
|
+
(y(!0), T(ye, null, ot(x.value, (k, M) => (y(), T("div", {
|
|
2749
2756
|
key: M,
|
|
2750
2757
|
class: "relative shrink-0 group"
|
|
2751
2758
|
}, [
|
|
2752
|
-
|
|
2759
|
+
k.type === "image" ? (y(), T("img", {
|
|
2753
2760
|
key: 0,
|
|
2754
|
-
src:
|
|
2755
|
-
alt:
|
|
2756
|
-
class: E(["size-14 rounded-xl object-cover border",
|
|
2761
|
+
src: k.url,
|
|
2762
|
+
alt: k.name,
|
|
2763
|
+
class: E(["size-14 rounded-xl object-cover border", A.value ? "border-black/10" : "border-white/20"])
|
|
2757
2764
|
}, null, 10, Pi)) : (y(), T("div", {
|
|
2758
2765
|
key: 1,
|
|
2759
|
-
class: E(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border",
|
|
2766
|
+
class: E(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", A.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2760
2767
|
}, [
|
|
2761
|
-
|
|
2762
|
-
v("span", Ni,
|
|
2768
|
+
f[11] || (f[11] = v("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2769
|
+
v("span", Ni, ne(k.name), 1)
|
|
2763
2770
|
], 2)),
|
|
2764
2771
|
v("button", {
|
|
2765
2772
|
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",
|
|
2766
|
-
onClick: /* @__PURE__ */ p((
|
|
2767
|
-
}, [...
|
|
2773
|
+
onClick: /* @__PURE__ */ p((N) => F(M), "onClick")
|
|
2774
|
+
}, [...f[12] || (f[12] = [
|
|
2768
2775
|
v("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2769
2776
|
])], 8, $i)
|
|
2770
2777
|
]))), 128)),
|
|
2771
2778
|
u.value ? (y(), T("div", Ui, [
|
|
2772
|
-
|
|
2779
|
+
Fe(Ln, { class: "size-5" })
|
|
2773
2780
|
])) : B("", !0)
|
|
2774
2781
|
])) : B("", !0),
|
|
2775
2782
|
a.uploadFn ? (y(), T("input", {
|
|
@@ -2779,60 +2786,60 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2779
2786
|
type: "file",
|
|
2780
2787
|
accept: "image/*,audio/*,video/*",
|
|
2781
2788
|
class: "hidden",
|
|
2782
|
-
onChange:
|
|
2789
|
+
onChange: ft
|
|
2783
2790
|
}, null, 544)) : B("", !0),
|
|
2784
2791
|
v("div", {
|
|
2785
|
-
class: E(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300",
|
|
2792
|
+
class: E(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", A.value ? l.value ? "bg-white ring-1 ring-black/10 shadow-[0_4px_16px_rgba(0,0,0,0.06)]" : "bg-theme-50 ring-1 ring-transparent hover:ring-black/5" : l.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2786
2793
|
}, [
|
|
2787
2794
|
v("button", {
|
|
2788
2795
|
class: E(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2789
2796
|
a.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2790
|
-
|
|
2797
|
+
A.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2791
2798
|
u.value ? "opacity-50 pointer-events-none" : ""
|
|
2792
2799
|
]]),
|
|
2793
|
-
disabled:
|
|
2794
|
-
onClick:
|
|
2800
|
+
disabled: Ee.value || u.value || !a.uploadFn,
|
|
2801
|
+
onClick: f[1] || (f[1] = (k) => a.uploadFn && Mt())
|
|
2795
2802
|
}, [
|
|
2796
2803
|
u.value ? (y(), T("i", Fi)) : (y(), T("i", Hi))
|
|
2797
2804
|
], 10, Bi),
|
|
2798
|
-
|
|
2805
|
+
ss(v("textarea", {
|
|
2799
2806
|
ref_key: "textarea",
|
|
2800
2807
|
ref: d,
|
|
2801
|
-
"onUpdate:modelValue":
|
|
2808
|
+
"onUpdate:modelValue": f[2] || (f[2] = (k) => s.value = k),
|
|
2802
2809
|
"data-test": "messaging-input",
|
|
2803
2810
|
rows: "1",
|
|
2804
2811
|
enterkeyhint: "send",
|
|
2805
|
-
placeholder:
|
|
2806
|
-
disabled:
|
|
2812
|
+
placeholder: Ct.value,
|
|
2813
|
+
disabled: Ee.value,
|
|
2807
2814
|
style: { fontSize: "16px", resize: "none" },
|
|
2808
|
-
class: E(["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",
|
|
2809
|
-
onKeydown:
|
|
2810
|
-
onFocus:
|
|
2811
|
-
onBlur:
|
|
2815
|
+
class: E(["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", A.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2816
|
+
onKeydown: Dt,
|
|
2817
|
+
onFocus: f[3] || (f[3] = (k) => l.value = !0),
|
|
2818
|
+
onBlur: f[4] || (f[4] = (k) => l.value = !1)
|
|
2812
2819
|
}, null, 42, Gi), [
|
|
2813
|
-
[
|
|
2820
|
+
[rs, s.value]
|
|
2814
2821
|
]),
|
|
2815
2822
|
v("button", {
|
|
2816
2823
|
"data-test": "messaging-send-btn",
|
|
2817
|
-
class: E(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10",
|
|
2818
|
-
disabled: !
|
|
2819
|
-
onClick:
|
|
2820
|
-
}, [...
|
|
2824
|
+
class: E(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", pt.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : A.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2825
|
+
disabled: !pt.value,
|
|
2826
|
+
onClick: f[5] || (f[5] = (k) => Ke())
|
|
2827
|
+
}, [...f[13] || (f[13] = [
|
|
2821
2828
|
v("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2822
2829
|
])], 10, ji)
|
|
2823
2830
|
], 2),
|
|
2824
2831
|
v("div", {
|
|
2825
|
-
class: E(["text-[10px] text-center mt-2.5 select-none opacity-70",
|
|
2832
|
+
class: E(["text-[10px] text-center mt-2.5 select-none opacity-70", A.value ? "text-theme-400" : "text-white/50"])
|
|
2826
2833
|
}, [
|
|
2827
|
-
|
|
2834
|
+
f[14] || (f[14] = nt(" Press ", -1)),
|
|
2828
2835
|
v("kbd", {
|
|
2829
|
-
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]",
|
|
2836
|
+
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", A.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2830
2837
|
}, "Enter", 2),
|
|
2831
|
-
|
|
2838
|
+
f[15] || (f[15] = nt(" to send, ", -1)),
|
|
2832
2839
|
v("kbd", {
|
|
2833
|
-
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]",
|
|
2840
|
+
class: E(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", A.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2834
2841
|
}, "Shift+Enter", 2),
|
|
2835
|
-
|
|
2842
|
+
f[16] || (f[16] = nt(" for new line ", -1))
|
|
2836
2843
|
], 2)
|
|
2837
2844
|
], 2)
|
|
2838
2845
|
]));
|
|
@@ -2854,11 +2861,11 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2854
2861
|
apiBase: {}
|
|
2855
2862
|
},
|
|
2856
2863
|
setup(a) {
|
|
2857
|
-
const t =
|
|
2864
|
+
const t = zs("AgentWrap"), e = a, n = e.sdk || Ps.getInstance({
|
|
2858
2865
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2859
2866
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2860
|
-
}), r =
|
|
2861
|
-
return
|
|
2867
|
+
}), r = Y(!e.agent), s = is(e.agent ? new yt({ config: e.agent }) : void 0), l = Y();
|
|
2868
|
+
return Et(async () => {
|
|
2862
2869
|
if (e.agent) {
|
|
2863
2870
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2864
2871
|
agentId: e.agent.agentId,
|
|
@@ -2884,7 +2891,7 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2884
2891
|
try {
|
|
2885
2892
|
r.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2886
2893
|
const o = await n.user.getPublicAgent({ handle: e.handle });
|
|
2887
|
-
o ? (s.value = new
|
|
2894
|
+
o ? (s.value = new yt({ config: o }), t.debug("Successfully fetched public agent", {
|
|
2888
2895
|
agentId: o.agentId,
|
|
2889
2896
|
handle: o.handle
|
|
2890
2897
|
}), o.agentId && n.user.track({
|
|
@@ -2937,9 +2944,9 @@ const ci = ["innerHTML"], ui = /* @__PURE__ */ ke({
|
|
|
2937
2944
|
}), (o, d) => (y(), T("div", Wi, [
|
|
2938
2945
|
r.value ? (y(), T("div", qi, [...d[0] || (d[0] = [
|
|
2939
2946
|
v("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2940
|
-
])])) : s.value ?
|
|
2947
|
+
])])) : s.value ? tn(o.$slots, "default", {
|
|
2941
2948
|
key: 1,
|
|
2942
|
-
sdk:
|
|
2949
|
+
sdk: Kt(n),
|
|
2943
2950
|
agent: s.value,
|
|
2944
2951
|
context: a.context,
|
|
2945
2952
|
firstMessage: a.firstMessage,
|
|
@@ -2958,7 +2965,7 @@ export {
|
|
|
2958
2965
|
Ji as c,
|
|
2959
2966
|
ta as d,
|
|
2960
2967
|
Ln as e,
|
|
2961
|
-
|
|
2968
|
+
Ks as f,
|
|
2962
2969
|
Ki as g,
|
|
2963
2970
|
Pn as h,
|
|
2964
2971
|
Qi as p
|