@pagelines/sdk 1.0.473 → 1.0.474
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,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var D = (
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as
|
|
7
|
-
import { P as
|
|
8
|
-
const
|
|
1
|
+
var Mn = Object.defineProperty;
|
|
2
|
+
var Es = (a, t, e) => t in a ? Mn(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
|
+
var h = (a, t) => Mn(a, "name", { value: t, configurable: !0 });
|
|
4
|
+
var D = (a, t, e) => Es(a, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as Le, openBlock as T, createElementBlock as S, createElementVNode as y, normalizeClass as A, ref as ee, watch as ct, computed as G, createCommentVNode as B, renderSlot as ts, onMounted as nn, Fragment as Te, renderList as at, withDirectives as ns, vModelText as ss, unref as Qt, toDisplayString as ie, nextTick as Wt, createVNode as qt, createTextVNode as Je, withModifiers as _s, shallowRef as Rs } from "vue";
|
|
6
|
+
import { SettingsObject as Is, Agent as Tt, getDefaultAvatarUrl as rs, createLogger as Ds } from "@pagelines/core";
|
|
7
|
+
import { P as Cs } from "./sdkClient.js";
|
|
8
|
+
const Ms = { class: "spinner max-w-sm" }, Ls = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
},
|
|
11
|
+
}, Ln = /* @__PURE__ */ Le({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
|
-
setup(
|
|
18
|
-
return (t, e) => (T(), S("div",
|
|
19
|
-
(T(), S("svg",
|
|
20
|
-
|
|
21
|
-
class: A([
|
|
17
|
+
setup(a) {
|
|
18
|
+
return (t, e) => (T(), S("div", Ms, [
|
|
19
|
+
(T(), S("svg", Ls, [
|
|
20
|
+
y("circle", {
|
|
21
|
+
class: A([a.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -30,10 +30,10 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
30
30
|
]))
|
|
31
31
|
]));
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), Os = [
|
|
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
|
+
], zs = 9e4, dn = class dn extends Is {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
39
|
D(this, "isTextMode", !1);
|
|
@@ -41,14 +41,14 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
41
41
|
D(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
43
|
D(this, "conversationId");
|
|
44
|
-
D(this, "textState",
|
|
44
|
+
D(this, "textState", ee({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
D(this, "agentMode",
|
|
51
|
-
D(this, "sharedMessages",
|
|
50
|
+
D(this, "agentMode", ee("self"));
|
|
51
|
+
D(this, "sharedMessages", ee([]));
|
|
52
52
|
D(this, "_agent");
|
|
53
53
|
this._agent = e.agent instanceof Tt ? e.agent : new Tt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
@@ -72,8 +72,8 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
72
72
|
return e.includes("timed out") || e.includes("starting up") || e.includes("503") || e.includes("429") || e.includes("[no-reply]") || e.includes("[stream-open]") || e.includes("[stream-read]") || e.includes("[api]");
|
|
73
73
|
}
|
|
74
74
|
isDuplicateMessage(e, n) {
|
|
75
|
-
const s = `${n}:${e.toLowerCase().trim()}`, r = Date.now(),
|
|
76
|
-
return
|
|
75
|
+
const s = `${n}:${e.toLowerCase().trim()}`, r = Date.now(), l = s === this.lastMessage.hash && r - this.lastMessage.time < 500;
|
|
76
|
+
return l || (this.lastMessage = { hash: s, time: r }), l;
|
|
77
77
|
}
|
|
78
78
|
addMessage(e, n, s, r) {
|
|
79
79
|
this.isDuplicateMessage(e, n) || (this.sharedMessages.value = [
|
|
@@ -84,7 +84,7 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
84
84
|
getDynamicSettings() {
|
|
85
85
|
const { sdk: e } = this.settings;
|
|
86
86
|
if (!e) return { context: this.settings.context || "", firstMessage: this.settings.firstMessage || "" };
|
|
87
|
-
const n = e.activeUser.value, s = n?.agents?.find((
|
|
87
|
+
const n = e.activeUser.value, s = n?.agents?.find((l) => l.agentId === n.primaryAgentId), r = n ? `
|
|
88
88
|
|
|
89
89
|
Current User:
|
|
90
90
|
- Name: ${s?.name || "Anonymous"}
|
|
@@ -110,7 +110,7 @@ Current User:
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
setupModeWatcher() {
|
|
113
|
-
|
|
113
|
+
ct(this.agentMode, async (e, n) => {
|
|
114
114
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
115
115
|
});
|
|
116
116
|
}
|
|
@@ -194,42 +194,42 @@ Current User:
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
197
|
-
const
|
|
197
|
+
const l = `stream-${Date.now()}`;
|
|
198
198
|
let o = !1;
|
|
199
|
-
const c = /* @__PURE__ */
|
|
199
|
+
const c = /* @__PURE__ */ h((f) => {
|
|
200
200
|
o || (o = !0, this.sharedMessages.value = [
|
|
201
201
|
...this.sharedMessages.value,
|
|
202
|
-
{ id:
|
|
202
|
+
{ id: l, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
203
203
|
]);
|
|
204
204
|
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
205
|
-
w?.id ===
|
|
206
|
-
}, "onDelta"), p = /* @__PURE__ */
|
|
205
|
+
w?.id === l && (w.text += f, this.sharedMessages.value = [...m]);
|
|
206
|
+
}, "onDelta"), p = /* @__PURE__ */ h((f) => {
|
|
207
207
|
if (!o) {
|
|
208
208
|
g("empty_stream — assistant returned no content");
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
212
|
-
if (w?.id ===
|
|
212
|
+
if (w?.id === l && w.text) {
|
|
213
213
|
let E = w.text;
|
|
214
|
-
for (const
|
|
215
|
-
|
|
214
|
+
for (const O of Os)
|
|
215
|
+
O.pattern.test(E) && (console.debug(`[chat] filtered directive: ${O.label}`), E = E.replace(O.pattern, "").trim(), O.pattern.lastIndex = 0);
|
|
216
216
|
E ? E !== w.text && (w.text = E, this.sharedMessages.value = [...m]) : this.sharedMessages.value = m.slice(0, -1);
|
|
217
217
|
}
|
|
218
218
|
f && (this.conversationId = f), this.updateState(this.textState, { isThinking: !1 });
|
|
219
|
-
}, "onDone"), g = /* @__PURE__ */
|
|
219
|
+
}, "onDone"), g = /* @__PURE__ */ h((f) => {
|
|
220
220
|
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
221
|
-
if (w?.id ===
|
|
222
|
-
const { bucket: U, actionUrl:
|
|
221
|
+
if (w?.id === l && !w.text && (this.sharedMessages.value = m.slice(0, -1)), typeof f == "object" && f.code && f.error) {
|
|
222
|
+
const { bucket: U, actionUrl: ae, actionLabel: le, help: z } = f;
|
|
223
223
|
if (U !== void 0 || (/* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP", "EMPTY_STREAM", "RATE_LIMIT"])).has(f.code)) {
|
|
224
|
-
const
|
|
225
|
-
this.addMessage(f.error, "system", void 0,
|
|
224
|
+
const V = U && ae && le ? { code: f.code, bucket: U, actionLabel: le, actionUrl: ae, ...z ? { help: z } : {} } : void 0;
|
|
225
|
+
this.addMessage(f.error, "system", void 0, V), U === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
226
226
|
} else
|
|
227
227
|
this.handleError(new Error(f.error));
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
const E = typeof f == "string" ? f : f.error,
|
|
231
|
-
this.isTransientError(E) ? (this.logger.warn("Chat turn failed (transient):", { raw: E, friendly:
|
|
232
|
-
}, "onError"), d = /* @__PURE__ */
|
|
230
|
+
const E = typeof f == "string" ? f : f.error, O = this.mapChatError(E);
|
|
231
|
+
this.isTransientError(E) ? (this.logger.warn("Chat turn failed (transient):", { raw: E, friendly: O }), this.addMessage(O, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(O), E);
|
|
232
|
+
}, "onError"), d = /* @__PURE__ */ h((f) => {
|
|
233
233
|
this.addMessage(f, "system");
|
|
234
234
|
}, "onStatus");
|
|
235
235
|
try {
|
|
@@ -257,7 +257,7 @@ Current User:
|
|
|
257
257
|
});
|
|
258
258
|
await Promise.race([
|
|
259
259
|
f,
|
|
260
|
-
new Promise((m, w) => setTimeout(() => w(new Error("timed out")),
|
|
260
|
+
new Promise((m, w) => setTimeout(() => w(new Error("timed out")), zs))
|
|
261
261
|
]);
|
|
262
262
|
} catch (f) {
|
|
263
263
|
g(f.message || "Something went wrong");
|
|
@@ -284,30 +284,30 @@ Current User:
|
|
|
284
284
|
await this.endConversation();
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
|
-
|
|
288
|
-
let
|
|
289
|
-
function
|
|
290
|
-
return
|
|
287
|
+
h(dn, "AgentChatController");
|
|
288
|
+
let On = dn;
|
|
289
|
+
function zn(a) {
|
|
290
|
+
return a ? typeof a == "string" ? a : a.src || "" : "";
|
|
291
291
|
}
|
|
292
|
-
|
|
293
|
-
function
|
|
294
|
-
return
|
|
292
|
+
h(zn, "getImageSrc");
|
|
293
|
+
function Hi(a) {
|
|
294
|
+
return zn(a.cover) || zn(a.avatar) || rs(a.name);
|
|
295
295
|
}
|
|
296
|
-
|
|
297
|
-
function
|
|
298
|
-
const t =
|
|
299
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
296
|
+
h(Hi, "getAgentAvatarUrl");
|
|
297
|
+
function Pn(a) {
|
|
298
|
+
const t = a.target;
|
|
299
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = rs());
|
|
300
300
|
}
|
|
301
|
-
|
|
302
|
-
function
|
|
303
|
-
const { template: t, agent: e } =
|
|
301
|
+
h(Pn, "handleImageError");
|
|
302
|
+
function Gi(a) {
|
|
303
|
+
const { template: t, agent: e } = a;
|
|
304
304
|
return t.replace(/{name}/g, e.name || "Digital Agent").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
const
|
|
306
|
+
h(Gi, "parseButtonTemplate");
|
|
307
|
+
const Ps = {
|
|
308
308
|
key: 0,
|
|
309
309
|
class: "absolute inset-0 flex items-center justify-center"
|
|
310
|
-
},
|
|
310
|
+
}, ji = /* @__PURE__ */ Le({
|
|
311
311
|
__name: "ElAgentButton",
|
|
312
312
|
props: {
|
|
313
313
|
theme: { default: "primary" },
|
|
@@ -316,61 +316,61 @@ const Ds = {
|
|
|
316
316
|
icon: {},
|
|
317
317
|
iconAfter: {}
|
|
318
318
|
},
|
|
319
|
-
setup(
|
|
320
|
-
const t =
|
|
319
|
+
setup(a) {
|
|
320
|
+
const t = G(() => ({
|
|
321
321
|
primary: "bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",
|
|
322
322
|
green: "bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",
|
|
323
323
|
red: "bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",
|
|
324
324
|
default: "bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"
|
|
325
|
-
})[
|
|
325
|
+
})[a.theme]), e = G(() => ({
|
|
326
326
|
sm: "px-4 py-2 text-sm",
|
|
327
327
|
md: "px-6 py-3 text-base",
|
|
328
328
|
lg: "px-8 py-4 text-base"
|
|
329
|
-
})[
|
|
329
|
+
})[a.size]), n = G(() => ({
|
|
330
330
|
sm: "size-4",
|
|
331
331
|
md: "size-4",
|
|
332
332
|
lg: "size-5"
|
|
333
|
-
})[
|
|
333
|
+
})[a.size]);
|
|
334
334
|
return (s, r) => (T(), S("button", {
|
|
335
335
|
class: A(["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]])
|
|
336
336
|
}, [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
])])) :
|
|
340
|
-
|
|
341
|
-
class: A(["flex items-center gap-2 transition-opacity duration-200",
|
|
337
|
+
a.loading ? (T(), S("div", Ps, [...r[0] || (r[0] = [
|
|
338
|
+
y("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
339
|
+
])])) : B("", !0),
|
|
340
|
+
y("span", {
|
|
341
|
+
class: A(["flex items-center gap-2 transition-opacity duration-200", a.loading ? "opacity-0" : "opacity-100"])
|
|
342
342
|
}, [
|
|
343
|
-
|
|
343
|
+
a.icon ? (T(), S("i", {
|
|
344
344
|
key: 0,
|
|
345
|
-
class: A([
|
|
346
|
-
}, null, 2)) :
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
class: A([a.icon, n.value])
|
|
346
|
+
}, null, 2)) : B("", !0),
|
|
347
|
+
ts(s.$slots, "default"),
|
|
348
|
+
a.iconAfter ? (T(), S("i", {
|
|
349
349
|
key: 1,
|
|
350
|
-
class: A([
|
|
351
|
-
}, null, 2)) :
|
|
350
|
+
class: A([a.iconAfter, n.value])
|
|
351
|
+
}, null, 2)) : B("", !0)
|
|
352
352
|
], 2)
|
|
353
353
|
], 2));
|
|
354
354
|
}
|
|
355
|
-
}),
|
|
355
|
+
}), Ns = ["value"], Wi = /* @__PURE__ */ Le({
|
|
356
356
|
__name: "AgentInputEmail",
|
|
357
357
|
props: {
|
|
358
358
|
modelValue: { default: "" }
|
|
359
359
|
},
|
|
360
360
|
emits: ["update:modelValue"],
|
|
361
|
-
setup(
|
|
361
|
+
setup(a, { emit: t }) {
|
|
362
362
|
const e = t;
|
|
363
363
|
return (n, s) => (T(), S("input", {
|
|
364
364
|
type: "email",
|
|
365
365
|
autocomplete: "email",
|
|
366
366
|
placeholder: "Enter Your Email",
|
|
367
|
-
value:
|
|
367
|
+
value: a.modelValue,
|
|
368
368
|
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",
|
|
369
369
|
style: { "font-size": "16px" },
|
|
370
370
|
onInput: s[0] || (s[0] = (r) => e("update:modelValue", r.target.value))
|
|
371
|
-
}, null, 40,
|
|
371
|
+
}, null, 40, Ns));
|
|
372
372
|
}
|
|
373
|
-
}),
|
|
373
|
+
}), $s = { class: "flex gap-1.5 justify-center" }, Bs = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], qi = /* @__PURE__ */ Le({
|
|
374
374
|
__name: "AgentInputOneTimeCode",
|
|
375
375
|
props: {
|
|
376
376
|
modelValue: {},
|
|
@@ -378,74 +378,74 @@ const Ds = {
|
|
|
378
378
|
focusFirst: { type: Boolean }
|
|
379
379
|
},
|
|
380
380
|
emits: ["update:modelValue", "autoSubmit"],
|
|
381
|
-
setup(
|
|
382
|
-
const e =
|
|
383
|
-
|
|
381
|
+
setup(a, { emit: t }) {
|
|
382
|
+
const e = a, n = t, s = ee([]), r = ee(Array.from({ length: e.length }).fill("")), l = ee(!1);
|
|
383
|
+
nn(() => {
|
|
384
384
|
e.modelValue && (r.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && s.value[0]?.focus();
|
|
385
|
-
}),
|
|
385
|
+
}), ct(() => e.modelValue, (d) => {
|
|
386
386
|
r.value = d ? d.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
387
|
-
}),
|
|
387
|
+
}), ct(r, () => {
|
|
388
388
|
const d = r.value.filter(Boolean).join("");
|
|
389
389
|
n("update:modelValue", d), d.length === e.length && n("autoSubmit", d);
|
|
390
390
|
}, { deep: !0 });
|
|
391
391
|
function o(d, f) {
|
|
392
|
-
f.preventDefault(),
|
|
392
|
+
f.preventDefault(), l.value = !0;
|
|
393
393
|
const m = (f.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
394
394
|
if (m.length === e.length)
|
|
395
395
|
r.value = m.split(""), setTimeout(() => {
|
|
396
|
-
s.value[e.length - 1]?.focus(),
|
|
396
|
+
s.value[e.length - 1]?.focus(), l.value = !1;
|
|
397
397
|
}, 10);
|
|
398
398
|
else {
|
|
399
399
|
const w = [...r.value];
|
|
400
|
-
m.split("").slice(0, e.length - d).forEach((
|
|
401
|
-
w[d + U] =
|
|
400
|
+
m.split("").slice(0, e.length - d).forEach((O, U) => {
|
|
401
|
+
w[d + U] = O;
|
|
402
402
|
}), r.value = w;
|
|
403
403
|
const E = Math.min(d + m.length, e.length - 1);
|
|
404
404
|
setTimeout(() => {
|
|
405
|
-
s.value[E]?.focus(),
|
|
405
|
+
s.value[E]?.focus(), l.value = !1;
|
|
406
406
|
}, 10);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
|
|
409
|
+
h(o, "onPaste");
|
|
410
410
|
function c(d, f) {
|
|
411
411
|
const m = f.target.value.slice(-1).replace(/\D/g, "");
|
|
412
412
|
r.value[d] = m, m && d < e.length - 1 && s.value[d + 1]?.focus();
|
|
413
413
|
}
|
|
414
|
-
|
|
414
|
+
h(c, "onInput");
|
|
415
415
|
function p(d, f) {
|
|
416
416
|
f.key === "Backspace" ? (f.preventDefault(), r.value[d] = "", d > 0 && s.value[d - 1]?.focus()) : f.key === "ArrowLeft" && d > 0 ? s.value[d - 1]?.focus() : f.key === "ArrowRight" && d < e.length - 1 && s.value[d + 1]?.focus();
|
|
417
417
|
}
|
|
418
|
-
|
|
418
|
+
h(p, "onKeydown");
|
|
419
419
|
function g(d) {
|
|
420
|
-
if (s.value[d]?.select(), !
|
|
420
|
+
if (s.value[d]?.select(), !l.value && r.value[d])
|
|
421
421
|
for (let f = d; f < e.length; f++)
|
|
422
422
|
r.value[f] = "";
|
|
423
423
|
}
|
|
424
|
-
return
|
|
425
|
-
(T(!0), S(
|
|
424
|
+
return h(g, "onFocus"), (d, f) => (T(), S("div", $s, [
|
|
425
|
+
(T(!0), S(Te, null, at(a.length, (m) => ns((T(), S("input", {
|
|
426
426
|
key: m,
|
|
427
427
|
ref_for: !0,
|
|
428
|
-
ref: /* @__PURE__ */
|
|
429
|
-
"onUpdate:modelValue": /* @__PURE__ */
|
|
428
|
+
ref: /* @__PURE__ */ h((w) => s.value[m - 1] = w, "ref"),
|
|
429
|
+
"onUpdate:modelValue": /* @__PURE__ */ h((w) => r.value[m - 1] = w, "onUpdate:modelValue"),
|
|
430
430
|
type: "text",
|
|
431
431
|
inputmode: "numeric",
|
|
432
432
|
autocomplete: "one-time-code",
|
|
433
433
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
434
434
|
style: { "font-size": "16px" },
|
|
435
435
|
maxlength: "1",
|
|
436
|
-
onInput: /* @__PURE__ */
|
|
437
|
-
onKeydown: /* @__PURE__ */
|
|
438
|
-
onPaste: /* @__PURE__ */
|
|
439
|
-
onFocus: /* @__PURE__ */
|
|
440
|
-
}, null, 40,
|
|
441
|
-
[
|
|
436
|
+
onInput: /* @__PURE__ */ h((w) => c(m - 1, w), "onInput"),
|
|
437
|
+
onKeydown: /* @__PURE__ */ h((w) => p(m - 1, w), "onKeydown"),
|
|
438
|
+
onPaste: /* @__PURE__ */ h((w) => o(m - 1, w), "onPaste"),
|
|
439
|
+
onFocus: /* @__PURE__ */ h((w) => g(m - 1), "onFocus")
|
|
440
|
+
}, null, 40, Bs)), [
|
|
441
|
+
[ss, r.value[m - 1]]
|
|
442
442
|
])), 128))
|
|
443
443
|
]));
|
|
444
444
|
}
|
|
445
|
-
}),
|
|
445
|
+
}), Us = { class: "relative flex-shrink-0" }, Fs = ["src", "alt"], Hs = { class: "absolute top-1 right-1" }, Gs = {
|
|
446
446
|
key: 1,
|
|
447
447
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
448
|
-
},
|
|
448
|
+
}, js = { class: "min-w-0" }, Ws = /* @__PURE__ */ Le({
|
|
449
449
|
__name: "ElModeHeader",
|
|
450
450
|
props: {
|
|
451
451
|
agent: {},
|
|
@@ -453,175 +453,214 @@ const Ds = {
|
|
|
453
453
|
isOnline: { type: Boolean, default: !1 },
|
|
454
454
|
layout: { default: "centered" }
|
|
455
455
|
},
|
|
456
|
-
setup(
|
|
456
|
+
setup(a) {
|
|
457
457
|
return (t, e) => (T(), S("div", {
|
|
458
458
|
class: A(["flex gap-4", [
|
|
459
|
-
|
|
459
|
+
a.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
460
460
|
]])
|
|
461
461
|
}, [
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
class: A(["rounded-full overflow-hidden border-white",
|
|
462
|
+
y("div", Us, [
|
|
463
|
+
y("div", {
|
|
464
|
+
class: A(["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"])
|
|
465
465
|
}, [
|
|
466
|
-
|
|
467
|
-
src:
|
|
468
|
-
alt:
|
|
466
|
+
y("img", {
|
|
467
|
+
src: a.agent.avatarUrl.value,
|
|
468
|
+
alt: a.agent.displayName.value,
|
|
469
469
|
class: "w-full h-full object-cover",
|
|
470
470
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
471
|
-
(...n) =>
|
|
472
|
-
}, null, 40,
|
|
471
|
+
(...n) => Qt(Pn) && Qt(Pn)(...n))
|
|
472
|
+
}, null, 40, Fs)
|
|
473
473
|
], 2),
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
e[1] || (e[1] =
|
|
474
|
+
y("div", Hs, [
|
|
475
|
+
a.isOnline ? (T(), S(Te, { key: 0 }, [
|
|
476
|
+
e[1] || (e[1] = y("div", {
|
|
477
477
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
478
478
|
style: { "animation-duration": "3s" }
|
|
479
479
|
}, null, -1)),
|
|
480
|
-
e[2] || (e[2] =
|
|
481
|
-
], 64)) : (T(), S("div",
|
|
480
|
+
e[2] || (e[2] = y("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
481
|
+
], 64)) : (T(), S("div", Gs))
|
|
482
482
|
])
|
|
483
483
|
]),
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
y("div", js, [
|
|
485
|
+
y("h1", {
|
|
486
486
|
class: A(["font-light text-white mb-1 truncate", [
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
a.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
488
|
+
a.layout === "horizontal" ? "text-white/95" : ""
|
|
489
489
|
]])
|
|
490
|
-
},
|
|
491
|
-
|
|
490
|
+
}, ie(a.agent.displayName.value), 3),
|
|
491
|
+
y("p", {
|
|
492
492
|
class: A(["font-light line-clamp-1", [
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
a.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
494
|
+
a.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
495
495
|
]])
|
|
496
|
-
},
|
|
496
|
+
}, ie(a.layout === "horizontal" ? a.agent.title.value || "Digital Agent" : a.agent.title.value), 3)
|
|
497
497
|
])
|
|
498
498
|
], 2));
|
|
499
499
|
}
|
|
500
500
|
});
|
|
501
501
|
const {
|
|
502
|
-
entries:
|
|
503
|
-
setPrototypeOf:
|
|
504
|
-
isFrozen:
|
|
505
|
-
getPrototypeOf:
|
|
506
|
-
getOwnPropertyDescriptor:
|
|
502
|
+
entries: is,
|
|
503
|
+
setPrototypeOf: Nn,
|
|
504
|
+
isFrozen: qs,
|
|
505
|
+
getPrototypeOf: Vs,
|
|
506
|
+
getOwnPropertyDescriptor: Ys
|
|
507
507
|
} = Object;
|
|
508
508
|
let {
|
|
509
|
-
freeze:
|
|
510
|
-
seal:
|
|
511
|
-
create:
|
|
509
|
+
freeze: ne,
|
|
510
|
+
seal: ue,
|
|
511
|
+
create: Ue
|
|
512
512
|
} = Object, {
|
|
513
|
-
apply:
|
|
514
|
-
construct:
|
|
513
|
+
apply: Jt,
|
|
514
|
+
construct: en
|
|
515
515
|
} = typeof Reflect < "u" && Reflect;
|
|
516
|
-
|
|
516
|
+
ne || (ne = /* @__PURE__ */ h(function(t) {
|
|
517
517
|
return t;
|
|
518
518
|
}, "freeze"));
|
|
519
|
-
|
|
519
|
+
ue || (ue = /* @__PURE__ */ h(function(t) {
|
|
520
520
|
return t;
|
|
521
521
|
}, "seal"));
|
|
522
|
-
|
|
522
|
+
Jt || (Jt = /* @__PURE__ */ h(function(t, e) {
|
|
523
523
|
for (var n = arguments.length, s = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
524
524
|
s[r - 2] = arguments[r];
|
|
525
525
|
return t.apply(e, s);
|
|
526
526
|
}, "apply"));
|
|
527
|
-
|
|
527
|
+
en || (en = /* @__PURE__ */ h(function(t) {
|
|
528
528
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
529
529
|
n[s - 1] = arguments[s];
|
|
530
530
|
return new t(...n);
|
|
531
531
|
}, "construct"));
|
|
532
|
-
const
|
|
533
|
-
function
|
|
532
|
+
const et = j(Array.prototype.forEach), Zs = j(Array.prototype.lastIndexOf), $n = j(Array.prototype.pop), tt = j(Array.prototype.push), Xs = j(Array.prototype.splice), J = Array.isArray, lt = j(String.prototype.toLowerCase), Vt = j(String.prototype.toString), Bn = j(String.prototype.match), Be = j(String.prototype.replace), Un = j(String.prototype.indexOf), Ks = j(String.prototype.trim), Qs = j(Number.prototype.toString), Js = 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), nt = j(Object.prototype.toString), K = j(RegExp.prototype.test), wt = er(TypeError);
|
|
533
|
+
function j(a) {
|
|
534
534
|
return function(t) {
|
|
535
535
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
536
536
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
537
537
|
n[s - 1] = arguments[s];
|
|
538
|
-
return
|
|
538
|
+
return Jt(a, t, n);
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
|
|
542
|
-
function
|
|
541
|
+
h(j, "unapply");
|
|
542
|
+
function er(a) {
|
|
543
543
|
return function() {
|
|
544
544
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
545
545
|
e[n] = arguments[n];
|
|
546
|
-
return
|
|
546
|
+
return en(a, e);
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
|
-
|
|
550
|
-
function
|
|
551
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
552
|
-
|
|
549
|
+
h(er, "unconstruct");
|
|
550
|
+
function R(a, t) {
|
|
551
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : lt;
|
|
552
|
+
if (Nn && Nn(a, null), !J(t))
|
|
553
|
+
return a;
|
|
553
554
|
let n = t.length;
|
|
554
555
|
for (; n--; ) {
|
|
555
556
|
let s = t[n];
|
|
556
557
|
if (typeof s == "string") {
|
|
557
558
|
const r = e(s);
|
|
558
|
-
r !== s && (
|
|
559
|
+
r !== s && (qs(t) || (t[n] = r), s = r);
|
|
559
560
|
}
|
|
560
|
-
|
|
561
|
+
a[s] = !0;
|
|
561
562
|
}
|
|
562
|
-
return
|
|
563
|
+
return a;
|
|
563
564
|
}
|
|
564
|
-
|
|
565
|
-
function
|
|
566
|
-
for (let t = 0; t <
|
|
567
|
-
|
|
568
|
-
return
|
|
565
|
+
h(R, "addToSet");
|
|
566
|
+
function tr(a) {
|
|
567
|
+
for (let t = 0; t < a.length; t++)
|
|
568
|
+
$(a, t) || (a[t] = null);
|
|
569
|
+
return a;
|
|
569
570
|
}
|
|
570
|
-
|
|
571
|
-
function
|
|
572
|
-
const t =
|
|
573
|
-
for (const [e, n] of
|
|
574
|
-
|
|
571
|
+
h(tr, "cleanArray");
|
|
572
|
+
function re(a) {
|
|
573
|
+
const t = Ue(null);
|
|
574
|
+
for (const [e, n] of is(a))
|
|
575
|
+
$(a, e) && (J(n) ? t[e] = tr(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = re(n) : t[e] = n);
|
|
575
576
|
return t;
|
|
576
577
|
}
|
|
577
|
-
|
|
578
|
-
function
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
h(re, "clone");
|
|
579
|
+
function nr(a) {
|
|
580
|
+
switch (typeof a) {
|
|
581
|
+
case "string":
|
|
582
|
+
return a;
|
|
583
|
+
case "number":
|
|
584
|
+
return Qs(a);
|
|
585
|
+
case "boolean":
|
|
586
|
+
return Js(a);
|
|
587
|
+
case "bigint":
|
|
588
|
+
return Fn ? Fn(a) : "0";
|
|
589
|
+
case "symbol":
|
|
590
|
+
return Hn ? Hn(a) : "Symbol()";
|
|
591
|
+
case "undefined":
|
|
592
|
+
return nt(a);
|
|
593
|
+
case "function":
|
|
594
|
+
case "object": {
|
|
595
|
+
if (a === null)
|
|
596
|
+
return nt(a);
|
|
597
|
+
const t = a, e = Fe(t, "toString");
|
|
598
|
+
if (typeof e == "function") {
|
|
599
|
+
const n = e(t);
|
|
600
|
+
return typeof n == "string" ? n : nt(n);
|
|
601
|
+
}
|
|
602
|
+
return nt(a);
|
|
603
|
+
}
|
|
604
|
+
default:
|
|
605
|
+
return nt(a);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
h(nr, "stringifyValue");
|
|
609
|
+
function Fe(a, t) {
|
|
610
|
+
for (; a !== null; ) {
|
|
611
|
+
const n = Ys(a, t);
|
|
581
612
|
if (n) {
|
|
582
613
|
if (n.get)
|
|
583
|
-
return
|
|
614
|
+
return j(n.get);
|
|
584
615
|
if (typeof n.value == "function")
|
|
585
|
-
return
|
|
616
|
+
return j(n.value);
|
|
586
617
|
}
|
|
587
|
-
|
|
618
|
+
a = Vs(a);
|
|
588
619
|
}
|
|
589
620
|
function e() {
|
|
590
621
|
return null;
|
|
591
622
|
}
|
|
592
|
-
return
|
|
623
|
+
return h(e, "fallbackValue"), e;
|
|
624
|
+
}
|
|
625
|
+
h(Fe, "lookupGetter");
|
|
626
|
+
function sr(a) {
|
|
627
|
+
try {
|
|
628
|
+
return K(a, ""), !0;
|
|
629
|
+
} catch {
|
|
630
|
+
return !1;
|
|
631
|
+
}
|
|
593
632
|
}
|
|
594
|
-
|
|
595
|
-
const
|
|
633
|
+
h(sr, "isRegex");
|
|
634
|
+
const Gn = ne(["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"]), Yt = ne(["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"]), Zt = ne(["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"]), rr = ne(["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"]), Xt = ne(["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"]), ir = ne(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), jn = ne(["#text"]), Wn = ne(["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"]), Kt = ne(["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 = ne(["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"]), yt = ne(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), ar = ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm), lr = ue(/<%[\w\W]*|[\w\W]*%>/gm), or = ue(/\$\{[\w\W]*/gm), cr = ue(/^data-[\-\w.\u00B7-\uFFFF]+$/), ur = ue(/^aria-[\-\w]+$/), as = ue(
|
|
596
635
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
597
636
|
// eslint-disable-line no-useless-escape
|
|
598
|
-
),
|
|
637
|
+
), hr = ue(/^(?:\w+script|data):/i), pr = ue(
|
|
599
638
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
600
639
|
// eslint-disable-line no-control-regex
|
|
601
|
-
),
|
|
602
|
-
var
|
|
640
|
+
), ls = ue(/^html$/i), dr = ue(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
641
|
+
var Vn = /* @__PURE__ */ Object.freeze({
|
|
603
642
|
__proto__: null,
|
|
604
|
-
ARIA_ATTR:
|
|
605
|
-
ATTR_WHITESPACE:
|
|
606
|
-
CUSTOM_ELEMENT:
|
|
607
|
-
DATA_ATTR:
|
|
608
|
-
DOCTYPE_NAME:
|
|
609
|
-
ERB_EXPR:
|
|
610
|
-
IS_ALLOWED_URI:
|
|
611
|
-
IS_SCRIPT_OR_DATA:
|
|
612
|
-
MUSTACHE_EXPR:
|
|
613
|
-
TMPLIT_EXPR:
|
|
643
|
+
ARIA_ATTR: ur,
|
|
644
|
+
ATTR_WHITESPACE: pr,
|
|
645
|
+
CUSTOM_ELEMENT: dr,
|
|
646
|
+
DATA_ATTR: cr,
|
|
647
|
+
DOCTYPE_NAME: ls,
|
|
648
|
+
ERB_EXPR: lr,
|
|
649
|
+
IS_ALLOWED_URI: as,
|
|
650
|
+
IS_SCRIPT_OR_DATA: hr,
|
|
651
|
+
MUSTACHE_EXPR: ar,
|
|
652
|
+
TMPLIT_EXPR: or
|
|
614
653
|
});
|
|
615
|
-
const
|
|
654
|
+
const st = {
|
|
616
655
|
element: 1,
|
|
617
656
|
text: 3,
|
|
618
657
|
// Deprecated
|
|
619
658
|
progressingInstruction: 7,
|
|
620
659
|
comment: 8,
|
|
621
660
|
document: 9
|
|
622
|
-
},
|
|
661
|
+
}, fr = /* @__PURE__ */ h(function() {
|
|
623
662
|
return typeof window > "u" ? null : window;
|
|
624
|
-
}, "getGlobal"),
|
|
663
|
+
}, "getGlobal"), gr = /* @__PURE__ */ h(function(t, e) {
|
|
625
664
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
626
665
|
return null;
|
|
627
666
|
let n = null;
|
|
@@ -630,17 +669,17 @@ const tt = {
|
|
|
630
669
|
const r = "dompurify" + (n ? "#" + n : "");
|
|
631
670
|
try {
|
|
632
671
|
return t.createPolicy(r, {
|
|
633
|
-
createHTML(
|
|
634
|
-
return
|
|
672
|
+
createHTML(l) {
|
|
673
|
+
return l;
|
|
635
674
|
},
|
|
636
|
-
createScriptURL(
|
|
637
|
-
return
|
|
675
|
+
createScriptURL(l) {
|
|
676
|
+
return l;
|
|
638
677
|
}
|
|
639
678
|
});
|
|
640
679
|
} catch {
|
|
641
680
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
642
681
|
}
|
|
643
|
-
}, "_createTrustedTypesPolicy"),
|
|
682
|
+
}, "_createTrustedTypesPolicy"), Yn = /* @__PURE__ */ h(function() {
|
|
644
683
|
return {
|
|
645
684
|
afterSanitizeAttributes: [],
|
|
646
685
|
afterSanitizeElements: [],
|
|
@@ -653,57 +692,57 @@ const tt = {
|
|
|
653
692
|
uponSanitizeShadowNode: []
|
|
654
693
|
};
|
|
655
694
|
}, "_createHooksMap");
|
|
656
|
-
function
|
|
657
|
-
let
|
|
658
|
-
const t = /* @__PURE__ */
|
|
659
|
-
if (t.version = "3.4.
|
|
695
|
+
function os() {
|
|
696
|
+
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : fr();
|
|
697
|
+
const t = /* @__PURE__ */ h((v) => os(v), "DOMPurify");
|
|
698
|
+
if (t.version = "3.4.1", t.removed = [], !a || !a.document || a.document.nodeType !== st.document || !a.Element)
|
|
660
699
|
return t.isSupported = !1, t;
|
|
661
700
|
let {
|
|
662
701
|
document: e
|
|
663
|
-
} =
|
|
702
|
+
} = a;
|
|
664
703
|
const n = e, s = n.currentScript, {
|
|
665
704
|
DocumentFragment: r,
|
|
666
|
-
HTMLTemplateElement:
|
|
705
|
+
HTMLTemplateElement: l,
|
|
667
706
|
Node: o,
|
|
668
707
|
Element: c,
|
|
669
708
|
NodeFilter: p,
|
|
670
|
-
NamedNodeMap: g =
|
|
709
|
+
NamedNodeMap: g = a.NamedNodeMap || a.MozNamedAttrMap,
|
|
671
710
|
HTMLFormElement: d,
|
|
672
711
|
DOMParser: f,
|
|
673
712
|
trustedTypes: m
|
|
674
|
-
} =
|
|
675
|
-
if (typeof
|
|
676
|
-
const
|
|
677
|
-
|
|
713
|
+
} = a, w = c.prototype, E = Fe(w, "cloneNode"), O = Fe(w, "remove"), U = Fe(w, "nextSibling"), ae = Fe(w, "childNodes"), le = Fe(w, "parentNode");
|
|
714
|
+
if (typeof l == "function") {
|
|
715
|
+
const v = e.createElement("template");
|
|
716
|
+
v.content && v.content.ownerDocument && (e = v.content.ownerDocument);
|
|
678
717
|
}
|
|
679
|
-
let
|
|
718
|
+
let z, oe = "";
|
|
680
719
|
const {
|
|
681
|
-
implementation:
|
|
682
|
-
createNodeIterator:
|
|
683
|
-
createDocumentFragment:
|
|
684
|
-
getElementsByTagName:
|
|
720
|
+
implementation: me,
|
|
721
|
+
createNodeIterator: V,
|
|
722
|
+
createDocumentFragment: ht,
|
|
723
|
+
getElementsByTagName: _e
|
|
685
724
|
} = e, {
|
|
686
|
-
importNode:
|
|
725
|
+
importNode: It
|
|
687
726
|
} = n;
|
|
688
|
-
let
|
|
689
|
-
t.isSupported = typeof
|
|
727
|
+
let Y = Yn();
|
|
728
|
+
t.isSupported = typeof is == "function" && typeof le == "function" && me && me.createHTMLDocument !== void 0;
|
|
690
729
|
const {
|
|
691
|
-
MUSTACHE_EXPR:
|
|
692
|
-
ERB_EXPR:
|
|
693
|
-
TMPLIT_EXPR:
|
|
730
|
+
MUSTACHE_EXPR: I,
|
|
731
|
+
ERB_EXPR: Re,
|
|
732
|
+
TMPLIT_EXPR: ve,
|
|
694
733
|
DATA_ATTR: Dt,
|
|
695
|
-
ARIA_ATTR:
|
|
696
|
-
IS_SCRIPT_OR_DATA:
|
|
697
|
-
ATTR_WHITESPACE:
|
|
698
|
-
CUSTOM_ELEMENT:
|
|
699
|
-
} =
|
|
734
|
+
ARIA_ATTR: Ve,
|
|
735
|
+
IS_SCRIPT_OR_DATA: Ct,
|
|
736
|
+
ATTR_WHITESPACE: pt,
|
|
737
|
+
CUSTOM_ELEMENT: dt
|
|
738
|
+
} = Vn;
|
|
700
739
|
let {
|
|
701
|
-
IS_ALLOWED_URI:
|
|
702
|
-
} =
|
|
703
|
-
const
|
|
704
|
-
let
|
|
705
|
-
const
|
|
706
|
-
let P = Object.seal(
|
|
740
|
+
IS_ALLOWED_URI: ft
|
|
741
|
+
} = Vn, F = null;
|
|
742
|
+
const gt = R({}, [...Gn, ...Yt, ...Zt, ...Xt, ...jn]);
|
|
743
|
+
let W = null;
|
|
744
|
+
const Ye = R({}, [...Wn, ...Kt, ...qn, ...yt]);
|
|
745
|
+
let P = Object.seal(Ue(null, {
|
|
707
746
|
tagNameCheck: {
|
|
708
747
|
writable: !0,
|
|
709
748
|
configurable: !1,
|
|
@@ -722,8 +761,8 @@ function ns() {
|
|
|
722
761
|
enumerable: !0,
|
|
723
762
|
value: !1
|
|
724
763
|
}
|
|
725
|
-
})), _ = null,
|
|
726
|
-
const
|
|
764
|
+
})), _ = null, x = null;
|
|
765
|
+
const b = Object.seal(Ue(null, {
|
|
727
766
|
tagCheck: {
|
|
728
767
|
writable: !0,
|
|
729
768
|
configurable: !1,
|
|
@@ -737,169 +776,171 @@ function ns() {
|
|
|
737
776
|
value: null
|
|
738
777
|
}
|
|
739
778
|
}));
|
|
740
|
-
let L = !0,
|
|
741
|
-
const
|
|
742
|
-
let
|
|
743
|
-
const
|
|
744
|
-
let
|
|
745
|
-
const
|
|
779
|
+
let L = !0, Z = !0, we = !1, Ze = !0, he = !1, Xe = !0, Ie = !1, Mt = !1, Lt = !1, ze = !1, mt = !1, bt = !1, fn = !0, gn = !1;
|
|
780
|
+
const mn = "user-content-";
|
|
781
|
+
let Ot = !0, Ke = !1, Pe = {}, be = null;
|
|
782
|
+
const zt = R({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
783
|
+
let bn = null;
|
|
784
|
+
const xn = R({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
746
785
|
let Pt = null;
|
|
747
|
-
const
|
|
748
|
-
let
|
|
749
|
-
const
|
|
750
|
-
let
|
|
751
|
-
const
|
|
752
|
-
let
|
|
753
|
-
const
|
|
754
|
-
let
|
|
755
|
-
const
|
|
786
|
+
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", kt = "http://www.w3.org/2000/svg", xe = "http://www.w3.org/1999/xhtml";
|
|
787
|
+
let Ne = xe, Nt = !1, $t = null;
|
|
788
|
+
const ks = R({}, [xt, kt, xe], Vt);
|
|
789
|
+
let Bt = R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ut = R({}, ["annotation-xml"]);
|
|
790
|
+
const ws = R({}, ["title", "style", "font", "a", "script"]);
|
|
791
|
+
let Qe = null;
|
|
792
|
+
const ys = ["application/xhtml+xml", "text/html"], vs = "text/html";
|
|
793
|
+
let q = null, $e = null;
|
|
794
|
+
const Ts = e.createElement("form"), wn = /* @__PURE__ */ h(function(i) {
|
|
756
795
|
return i instanceof RegExp || i instanceof Function;
|
|
757
|
-
}, "isRegexOrFunction"),
|
|
796
|
+
}, "isRegexOrFunction"), Ft = /* @__PURE__ */ h(function() {
|
|
758
797
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
759
|
-
if (
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
798
|
+
if ($e && $e === i)
|
|
799
|
+
return;
|
|
800
|
+
(!i || typeof i != "object") && (i = {}), i = re(i), Qe = // eslint-disable-next-line unicorn/prefer-includes
|
|
801
|
+
ys.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? vs : i.PARSER_MEDIA_TYPE, q = Qe === "application/xhtml+xml" ? Vt : lt, F = $(i, "ALLOWED_TAGS") && J(i.ALLOWED_TAGS) ? R({}, i.ALLOWED_TAGS, q) : gt, W = $(i, "ALLOWED_ATTR") && J(i.ALLOWED_ATTR) ? R({}, i.ALLOWED_ATTR, q) : Ye, $t = $(i, "ALLOWED_NAMESPACES") && J(i.ALLOWED_NAMESPACES) ? R({}, i.ALLOWED_NAMESPACES, Vt) : ks, Pt = $(i, "ADD_URI_SAFE_ATTR") && J(i.ADD_URI_SAFE_ATTR) ? R(re(kn), i.ADD_URI_SAFE_ATTR, q) : kn, bn = $(i, "ADD_DATA_URI_TAGS") && J(i.ADD_DATA_URI_TAGS) ? R(re(xn), i.ADD_DATA_URI_TAGS, q) : xn, be = $(i, "FORBID_CONTENTS") && J(i.FORBID_CONTENTS) ? R({}, i.FORBID_CONTENTS, q) : zt, _ = $(i, "FORBID_TAGS") && J(i.FORBID_TAGS) ? R({}, i.FORBID_TAGS, q) : re({}), x = $(i, "FORBID_ATTR") && J(i.FORBID_ATTR) ? R({}, i.FORBID_ATTR, q) : re({}), Pe = $(i, "USE_PROFILES") ? i.USE_PROFILES && typeof i.USE_PROFILES == "object" ? re(i.USE_PROFILES) : i.USE_PROFILES : !1, L = i.ALLOW_ARIA_ATTR !== !1, Z = i.ALLOW_DATA_ATTR !== !1, we = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Ze = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, he = i.SAFE_FOR_TEMPLATES || !1, Xe = i.SAFE_FOR_XML !== !1, Ie = i.WHOLE_DOCUMENT || !1, ze = i.RETURN_DOM || !1, mt = i.RETURN_DOM_FRAGMENT || !1, bt = i.RETURN_TRUSTED_TYPE || !1, Lt = i.FORCE_BODY || !1, fn = i.SANITIZE_DOM !== !1, gn = i.SANITIZE_NAMED_PROPS || !1, Ot = i.KEEP_CONTENT !== !1, Ke = i.IN_PLACE || !1, ft = sr(i.ALLOWED_URI_REGEXP) ? i.ALLOWED_URI_REGEXP : as, Ne = typeof i.NAMESPACE == "string" ? i.NAMESPACE : xe, Bt = $(i, "MATHML_TEXT_INTEGRATION_POINTS") && i.MATHML_TEXT_INTEGRATION_POINTS && typeof i.MATHML_TEXT_INTEGRATION_POINTS == "object" ? re(i.MATHML_TEXT_INTEGRATION_POINTS) : R({}, ["mi", "mo", "mn", "ms", "mtext"]), Ut = $(i, "HTML_INTEGRATION_POINTS") && i.HTML_INTEGRATION_POINTS && typeof i.HTML_INTEGRATION_POINTS == "object" ? re(i.HTML_INTEGRATION_POINTS) : R({}, ["annotation-xml"]);
|
|
802
|
+
const u = $(i, "CUSTOM_ELEMENT_HANDLING") && i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING == "object" ? re(i.CUSTOM_ELEMENT_HANDLING) : Ue(null);
|
|
803
|
+
if (P = Ue(null), $(u, "tagNameCheck") && wn(u.tagNameCheck) && (P.tagNameCheck = u.tagNameCheck), $(u, "attributeNameCheck") && wn(u.attributeNameCheck) && (P.attributeNameCheck = u.attributeNameCheck), $(u, "allowCustomizedBuiltInElements") && typeof u.allowCustomizedBuiltInElements == "boolean" && (P.allowCustomizedBuiltInElements = u.allowCustomizedBuiltInElements), he && (Z = !1), mt && (ze = !0), Pe && (F = R({}, jn), W = Ue(null), Pe.html === !0 && (R(F, Gn), R(W, Wn)), Pe.svg === !0 && (R(F, Yt), R(W, Kt), R(W, yt)), Pe.svgFilters === !0 && (R(F, Zt), R(W, Kt), R(W, yt)), Pe.mathMl === !0 && (R(F, Xt), R(W, qn), R(W, yt))), b.tagCheck = null, b.attributeCheck = null, $(i, "ADD_TAGS") && (typeof i.ADD_TAGS == "function" ? b.tagCheck = i.ADD_TAGS : J(i.ADD_TAGS) && (F === gt && (F = re(F)), R(F, i.ADD_TAGS, q))), $(i, "ADD_ATTR") && (typeof i.ADD_ATTR == "function" ? b.attributeCheck = i.ADD_ATTR : J(i.ADD_ATTR) && (W === Ye && (W = re(W)), R(W, i.ADD_ATTR, q))), $(i, "ADD_URI_SAFE_ATTR") && J(i.ADD_URI_SAFE_ATTR) && R(Pt, i.ADD_URI_SAFE_ATTR, q), $(i, "FORBID_CONTENTS") && J(i.FORBID_CONTENTS) && (be === zt && (be = re(be)), R(be, i.FORBID_CONTENTS, q)), $(i, "ADD_FORBID_CONTENTS") && J(i.ADD_FORBID_CONTENTS) && (be === zt && (be = re(be)), R(be, i.ADD_FORBID_CONTENTS, q)), Ot && (F["#text"] = !0), Ie && R(F, ["html", "head", "body"]), F.table && (R(F, ["tbody"]), delete _.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
804
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
805
|
+
throw wt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
806
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
807
|
+
throw wt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
808
|
+
z = i.TRUSTED_TYPES_POLICY, oe = z.createHTML("");
|
|
809
|
+
} else
|
|
810
|
+
z === void 0 && (z = gr(m, s)), z !== null && typeof oe == "string" && (oe = z.createHTML(""));
|
|
811
|
+
ne && ne(i), $e = i;
|
|
812
|
+
}, "_parseConfig"), yn = R({}, [...Yt, ...Zt, ...rr]), vn = R({}, [...Xt, ...ir]), Ss = /* @__PURE__ */ h(function(i) {
|
|
813
|
+
let u = le(i);
|
|
814
|
+
(!u || !u.tagName) && (u = {
|
|
815
|
+
namespaceURI: Ne,
|
|
775
816
|
tagName: "template"
|
|
776
817
|
});
|
|
777
|
-
const k =
|
|
778
|
-
return $t[i.namespaceURI] ? i.namespaceURI ===
|
|
779
|
-
}, "_checkValidNamespace"),
|
|
780
|
-
|
|
818
|
+
const k = lt(i.tagName), N = lt(u.tagName);
|
|
819
|
+
return $t[i.namespaceURI] ? i.namespaceURI === kt ? u.namespaceURI === xe ? k === "svg" : u.namespaceURI === xt ? k === "svg" && (N === "annotation-xml" || Bt[N]) : !!yn[k] : i.namespaceURI === xt ? u.namespaceURI === xe ? k === "math" : u.namespaceURI === kt ? k === "math" && Ut[N] : !!vn[k] : i.namespaceURI === xe ? u.namespaceURI === kt && !Ut[N] || u.namespaceURI === xt && !Bt[N] ? !1 : !vn[k] && (ws[k] || !yn[k]) : !!(Qe === "application/xhtml+xml" && $t[i.namespaceURI]) : !1;
|
|
820
|
+
}, "_checkValidNamespace"), pe = /* @__PURE__ */ h(function(i) {
|
|
821
|
+
tt(t.removed, {
|
|
781
822
|
element: i
|
|
782
823
|
});
|
|
783
824
|
try {
|
|
784
|
-
|
|
825
|
+
le(i).removeChild(i);
|
|
785
826
|
} catch {
|
|
786
|
-
|
|
827
|
+
O(i);
|
|
787
828
|
}
|
|
788
|
-
}, "_forceRemove"),
|
|
829
|
+
}, "_forceRemove"), De = /* @__PURE__ */ h(function(i, u) {
|
|
789
830
|
try {
|
|
790
|
-
|
|
791
|
-
attribute:
|
|
792
|
-
from:
|
|
831
|
+
tt(t.removed, {
|
|
832
|
+
attribute: u.getAttributeNode(i),
|
|
833
|
+
from: u
|
|
793
834
|
});
|
|
794
835
|
} catch {
|
|
795
|
-
|
|
836
|
+
tt(t.removed, {
|
|
796
837
|
attribute: null,
|
|
797
|
-
from:
|
|
838
|
+
from: u
|
|
798
839
|
});
|
|
799
840
|
}
|
|
800
|
-
if (
|
|
801
|
-
if (ze ||
|
|
841
|
+
if (u.removeAttribute(i), i === "is")
|
|
842
|
+
if (ze || mt)
|
|
802
843
|
try {
|
|
803
|
-
|
|
844
|
+
pe(u);
|
|
804
845
|
} catch {
|
|
805
846
|
}
|
|
806
847
|
else
|
|
807
848
|
try {
|
|
808
|
-
|
|
849
|
+
u.setAttribute(i, "");
|
|
809
850
|
} catch {
|
|
810
851
|
}
|
|
811
|
-
}, "_removeAttribute"),
|
|
812
|
-
let
|
|
852
|
+
}, "_removeAttribute"), Tn = /* @__PURE__ */ h(function(i) {
|
|
853
|
+
let u = null, k = null;
|
|
813
854
|
if (Lt)
|
|
814
855
|
i = "<remove></remove>" + i;
|
|
815
856
|
else {
|
|
816
|
-
const
|
|
817
|
-
k =
|
|
857
|
+
const H = Bn(i, /^[\r\n\t ]+/);
|
|
858
|
+
k = H && H[0];
|
|
818
859
|
}
|
|
819
|
-
|
|
820
|
-
const N =
|
|
821
|
-
if (
|
|
860
|
+
Qe === "application/xhtml+xml" && Ne === xe && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
861
|
+
const N = z ? z.createHTML(i) : i;
|
|
862
|
+
if (Ne === xe)
|
|
822
863
|
try {
|
|
823
|
-
|
|
864
|
+
u = new f().parseFromString(N, Qe);
|
|
824
865
|
} catch {
|
|
825
866
|
}
|
|
826
|
-
if (!
|
|
827
|
-
|
|
867
|
+
if (!u || !u.documentElement) {
|
|
868
|
+
u = me.createDocument(Ne, "template", null);
|
|
828
869
|
try {
|
|
829
|
-
|
|
870
|
+
u.documentElement.innerHTML = Nt ? oe : N;
|
|
830
871
|
} catch {
|
|
831
872
|
}
|
|
832
873
|
}
|
|
833
|
-
const
|
|
834
|
-
return i && k &&
|
|
835
|
-
}, "_initDocument"),
|
|
836
|
-
return
|
|
874
|
+
const Q = u.body || u.documentElement;
|
|
875
|
+
return i && k && Q.insertBefore(e.createTextNode(k), Q.childNodes[0] || null), Ne === xe ? _e.call(u, Ie ? "html" : "body")[0] : Ie ? u.documentElement : Q;
|
|
876
|
+
}, "_initDocument"), Sn = /* @__PURE__ */ h(function(i) {
|
|
877
|
+
return V.call(
|
|
837
878
|
i.ownerDocument || i,
|
|
838
879
|
i,
|
|
839
880
|
// eslint-disable-next-line no-bitwise
|
|
840
881
|
p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION,
|
|
841
882
|
null
|
|
842
883
|
);
|
|
843
|
-
}, "_createNodeIterator"),
|
|
884
|
+
}, "_createNodeIterator"), Ht = /* @__PURE__ */ h(function(i) {
|
|
844
885
|
return i instanceof d && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof g) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
845
|
-
}, "_isClobbered"),
|
|
886
|
+
}, "_isClobbered"), Gt = /* @__PURE__ */ h(function(i) {
|
|
846
887
|
return typeof o == "function" && i instanceof o;
|
|
847
888
|
}, "_isNode");
|
|
848
|
-
function
|
|
849
|
-
|
|
850
|
-
k.call(t, i,
|
|
889
|
+
function ye(v, i, u) {
|
|
890
|
+
et(v, (k) => {
|
|
891
|
+
k.call(t, i, u, $e);
|
|
851
892
|
});
|
|
852
893
|
}
|
|
853
|
-
|
|
854
|
-
const
|
|
855
|
-
let
|
|
856
|
-
if (
|
|
857
|
-
return
|
|
858
|
-
const k =
|
|
859
|
-
if (
|
|
894
|
+
h(ye, "_executeHooks");
|
|
895
|
+
const An = /* @__PURE__ */ h(function(i) {
|
|
896
|
+
let u = null;
|
|
897
|
+
if (ye(Y.beforeSanitizeElements, i, null), Ht(i))
|
|
898
|
+
return pe(i), !0;
|
|
899
|
+
const k = q(i.nodeName);
|
|
900
|
+
if (ye(Y.uponSanitizeElement, i, {
|
|
860
901
|
tagName: k,
|
|
861
|
-
allowedTags:
|
|
862
|
-
}),
|
|
863
|
-
return
|
|
864
|
-
if (_[k] || !(
|
|
865
|
-
if (!_[k] &&
|
|
902
|
+
allowedTags: F
|
|
903
|
+
}), Xe && i.hasChildNodes() && !Gt(i.firstElementChild) && K(/<[/\w!]/g, i.innerHTML) && K(/<[/\w!]/g, i.textContent) || Xe && i.namespaceURI === xe && k === "style" && Gt(i.firstElementChild) || i.nodeType === st.progressingInstruction || Xe && i.nodeType === st.comment && K(/<[/\w]/g, i.data))
|
|
904
|
+
return pe(i), !0;
|
|
905
|
+
if (_[k] || !(b.tagCheck instanceof Function && b.tagCheck(k)) && !F[k]) {
|
|
906
|
+
if (!_[k] && _n(k) && (P.tagNameCheck instanceof RegExp && K(P.tagNameCheck, k) || P.tagNameCheck instanceof Function && P.tagNameCheck(k)))
|
|
866
907
|
return !1;
|
|
867
|
-
if (
|
|
868
|
-
const N =
|
|
869
|
-
if (
|
|
870
|
-
const
|
|
871
|
-
for (let
|
|
872
|
-
const
|
|
873
|
-
|
|
908
|
+
if (Ot && !be[k]) {
|
|
909
|
+
const N = le(i) || i.parentNode, Q = ae(i) || i.childNodes;
|
|
910
|
+
if (Q && N) {
|
|
911
|
+
const H = Q.length;
|
|
912
|
+
for (let se = H - 1; se >= 0; --se) {
|
|
913
|
+
const ce = E(Q[se], !0);
|
|
914
|
+
N.insertBefore(ce, U(i));
|
|
874
915
|
}
|
|
875
916
|
}
|
|
876
917
|
}
|
|
877
|
-
return
|
|
918
|
+
return pe(i), !0;
|
|
878
919
|
}
|
|
879
|
-
return i instanceof c && !
|
|
880
|
-
|
|
881
|
-
}), i.textContent !==
|
|
920
|
+
return i instanceof c && !Ss(i) || (k === "noscript" || k === "noembed" || k === "noframes") && K(/<\/no(script|embed|frames)/i, i.innerHTML) ? (pe(i), !0) : (he && i.nodeType === st.text && (u = i.textContent, et([I, Re, ve], (N) => {
|
|
921
|
+
u = Be(u, N, " ");
|
|
922
|
+
}), i.textContent !== u && (tt(t.removed, {
|
|
882
923
|
element: i.cloneNode()
|
|
883
|
-
}), i.textContent =
|
|
884
|
-
}, "_sanitizeElements"),
|
|
885
|
-
if (
|
|
924
|
+
}), i.textContent = u)), ye(Y.afterSanitizeElements, i, null), !1);
|
|
925
|
+
}, "_sanitizeElements"), En = /* @__PURE__ */ h(function(i, u, k) {
|
|
926
|
+
if (x[u] || fn && (u === "id" || u === "name") && (k in e || k in Ts))
|
|
886
927
|
return !1;
|
|
887
|
-
if (!(
|
|
888
|
-
if (!(L &&
|
|
889
|
-
if (!(
|
|
890
|
-
if (!
|
|
928
|
+
if (!(Z && !x[u] && K(Dt, u))) {
|
|
929
|
+
if (!(L && K(Ve, u))) {
|
|
930
|
+
if (!(b.attributeCheck instanceof Function && b.attributeCheck(u, i))) {
|
|
931
|
+
if (!W[u] || x[u]) {
|
|
891
932
|
if (
|
|
892
933
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
893
934
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
894
935
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
895
|
-
!(
|
|
936
|
+
!(_n(i) && (P.tagNameCheck instanceof RegExp && K(P.tagNameCheck, i) || P.tagNameCheck instanceof Function && P.tagNameCheck(i)) && (P.attributeNameCheck instanceof RegExp && K(P.attributeNameCheck, u) || P.attributeNameCheck instanceof Function && P.attributeNameCheck(u, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
896
937
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
897
|
-
|
|
938
|
+
u === "is" && P.allowCustomizedBuiltInElements && (P.tagNameCheck instanceof RegExp && K(P.tagNameCheck, k) || P.tagNameCheck instanceof Function && P.tagNameCheck(k)))
|
|
898
939
|
) return !1;
|
|
899
|
-
} else if (!Pt[
|
|
900
|
-
if (!
|
|
901
|
-
if (!((
|
|
902
|
-
if (!(
|
|
940
|
+
} else if (!Pt[u]) {
|
|
941
|
+
if (!K(ft, Be(k, pt, ""))) {
|
|
942
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && i !== "script" && Un(k, "data:") === 0 && bn[i])) {
|
|
943
|
+
if (!(we && !K(Ct, Be(k, pt, "")))) {
|
|
903
944
|
if (k)
|
|
904
945
|
return !1;
|
|
905
946
|
}
|
|
@@ -910,266 +951,263 @@ function ns() {
|
|
|
910
951
|
}
|
|
911
952
|
}
|
|
912
953
|
return !0;
|
|
913
|
-
}, "_isValidAttribute"),
|
|
914
|
-
return i
|
|
915
|
-
}, "_isBasicCustomElement"),
|
|
916
|
-
|
|
954
|
+
}, "_isValidAttribute"), As = R({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), _n = /* @__PURE__ */ h(function(i) {
|
|
955
|
+
return !As[lt(i)] && K(dt, i);
|
|
956
|
+
}, "_isBasicCustomElement"), Rn = /* @__PURE__ */ h(function(i) {
|
|
957
|
+
ye(Y.beforeSanitizeAttributes, i, null);
|
|
917
958
|
const {
|
|
918
|
-
attributes:
|
|
959
|
+
attributes: u
|
|
919
960
|
} = i;
|
|
920
|
-
if (!
|
|
961
|
+
if (!u || Ht(i))
|
|
921
962
|
return;
|
|
922
963
|
const k = {
|
|
923
964
|
attrName: "",
|
|
924
965
|
attrValue: "",
|
|
925
966
|
keepAttr: !0,
|
|
926
|
-
allowedAttributes:
|
|
967
|
+
allowedAttributes: W,
|
|
927
968
|
forceKeepAttr: void 0
|
|
928
969
|
};
|
|
929
|
-
let N =
|
|
970
|
+
let N = u.length;
|
|
930
971
|
for (; N--; ) {
|
|
931
|
-
const
|
|
932
|
-
name:
|
|
933
|
-
namespaceURI:
|
|
934
|
-
value:
|
|
935
|
-
} =
|
|
936
|
-
let
|
|
937
|
-
if (k.attrName =
|
|
938
|
-
|
|
972
|
+
const Q = u[N], {
|
|
973
|
+
name: H,
|
|
974
|
+
namespaceURI: se,
|
|
975
|
+
value: ce
|
|
976
|
+
} = Q, de = q(H), jt = ce;
|
|
977
|
+
let X = H === "value" ? jt : Ks(jt);
|
|
978
|
+
if (k.attrName = de, k.attrValue = X, k.keepAttr = !0, k.forceKeepAttr = void 0, ye(Y.uponSanitizeAttribute, i, k), X = k.attrValue, gn && (de === "id" || de === "name") && Un(X, mn) !== 0 && (De(H, i), X = mn + X), Xe && K(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, X)) {
|
|
979
|
+
De(H, i);
|
|
939
980
|
continue;
|
|
940
981
|
}
|
|
941
|
-
if (
|
|
942
|
-
|
|
982
|
+
if (de === "attributename" && Bn(X, "href")) {
|
|
983
|
+
De(H, i);
|
|
943
984
|
continue;
|
|
944
985
|
}
|
|
945
986
|
if (k.forceKeepAttr)
|
|
946
987
|
continue;
|
|
947
988
|
if (!k.keepAttr) {
|
|
948
|
-
|
|
989
|
+
De(H, i);
|
|
949
990
|
continue;
|
|
950
991
|
}
|
|
951
|
-
if (!
|
|
952
|
-
|
|
992
|
+
if (!Ze && K(/\/>/i, X)) {
|
|
993
|
+
De(H, i);
|
|
953
994
|
continue;
|
|
954
995
|
}
|
|
955
|
-
|
|
956
|
-
|
|
996
|
+
he && et([I, Re, ve], (Cn) => {
|
|
997
|
+
X = Be(X, Cn, " ");
|
|
957
998
|
});
|
|
958
|
-
const
|
|
959
|
-
if (!
|
|
960
|
-
|
|
999
|
+
const Dn = q(i.nodeName);
|
|
1000
|
+
if (!En(Dn, de, X)) {
|
|
1001
|
+
De(H, i);
|
|
961
1002
|
continue;
|
|
962
1003
|
}
|
|
963
|
-
if (
|
|
964
|
-
switch (m.getAttributeType(
|
|
1004
|
+
if (z && typeof m == "object" && typeof m.getAttributeType == "function" && !se)
|
|
1005
|
+
switch (m.getAttributeType(Dn, de)) {
|
|
965
1006
|
case "TrustedHTML": {
|
|
966
|
-
|
|
1007
|
+
X = z.createHTML(X);
|
|
967
1008
|
break;
|
|
968
1009
|
}
|
|
969
1010
|
case "TrustedScriptURL": {
|
|
970
|
-
|
|
1011
|
+
X = z.createScriptURL(X);
|
|
971
1012
|
break;
|
|
972
1013
|
}
|
|
973
1014
|
}
|
|
974
|
-
if (
|
|
1015
|
+
if (X !== jt)
|
|
975
1016
|
try {
|
|
976
|
-
|
|
1017
|
+
se ? i.setAttributeNS(se, H, X) : i.setAttribute(H, X), Ht(i) ? pe(i) : $n(t.removed);
|
|
977
1018
|
} catch {
|
|
978
|
-
|
|
1019
|
+
De(H, i);
|
|
979
1020
|
}
|
|
980
1021
|
}
|
|
981
|
-
|
|
982
|
-
}, "_sanitizeAttributes"),
|
|
983
|
-
let
|
|
984
|
-
const k =
|
|
985
|
-
for (
|
|
986
|
-
|
|
987
|
-
|
|
1022
|
+
ye(Y.afterSanitizeAttributes, i, null);
|
|
1023
|
+
}, "_sanitizeAttributes"), In = /* @__PURE__ */ h(function(i) {
|
|
1024
|
+
let u = null;
|
|
1025
|
+
const k = Sn(i);
|
|
1026
|
+
for (ye(Y.beforeSanitizeShadowDOM, i, null); u = k.nextNode(); )
|
|
1027
|
+
ye(Y.uponSanitizeShadowNode, u, null), An(u), Rn(u), u.content instanceof r && In(u.content);
|
|
1028
|
+
ye(Y.afterSanitizeShadowDOM, i, null);
|
|
988
1029
|
}, "_sanitizeShadowDOM");
|
|
989
|
-
return t.sanitize = function(
|
|
990
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
991
|
-
if (Nt = !
|
|
992
|
-
|
|
993
|
-
if (y = y.toString(), typeof y != "string")
|
|
994
|
-
throw Je("dirty is not a string, aborting");
|
|
995
|
-
} else
|
|
996
|
-
throw Je("toString is not a function");
|
|
1030
|
+
return t.sanitize = function(v) {
|
|
1031
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, k = null, N = null, Q = null;
|
|
1032
|
+
if (Nt = !v, Nt && (v = "<!-->"), typeof v != "string" && !Gt(v) && (v = nr(v), typeof v != "string"))
|
|
1033
|
+
throw wt("dirty is not a string, aborting");
|
|
997
1034
|
if (!t.isSupported)
|
|
998
|
-
return
|
|
999
|
-
if (Mt ||
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1035
|
+
return v;
|
|
1036
|
+
if (Mt || Ft(i), t.removed = [], typeof v == "string" && (Ke = !1), Ke) {
|
|
1037
|
+
const ce = v.nodeName;
|
|
1038
|
+
if (typeof ce == "string") {
|
|
1039
|
+
const de = q(ce);
|
|
1040
|
+
if (!F[de] || _[de])
|
|
1041
|
+
throw wt("root node is forbidden and cannot be sanitized in-place");
|
|
1042
|
+
}
|
|
1043
|
+
} else if (v instanceof o)
|
|
1044
|
+
u = Tn("<!---->"), k = u.ownerDocument.importNode(v, !0), k.nodeType === st.element && k.nodeName === "BODY" || k.nodeName === "HTML" ? u = k : u.appendChild(k);
|
|
1007
1045
|
else {
|
|
1008
|
-
if (!ze && !
|
|
1009
|
-
|
|
1010
|
-
return
|
|
1011
|
-
if (
|
|
1012
|
-
return ze ? null :
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
const
|
|
1016
|
-
for (; N =
|
|
1017
|
-
|
|
1018
|
-
if (
|
|
1019
|
-
return
|
|
1046
|
+
if (!ze && !he && !Ie && // eslint-disable-next-line unicorn/prefer-includes
|
|
1047
|
+
v.indexOf("<") === -1)
|
|
1048
|
+
return z && bt ? z.createHTML(v) : v;
|
|
1049
|
+
if (u = Tn(v), !u)
|
|
1050
|
+
return ze ? null : bt ? oe : "";
|
|
1051
|
+
}
|
|
1052
|
+
u && Lt && pe(u.firstChild);
|
|
1053
|
+
const H = Sn(Ke ? v : u);
|
|
1054
|
+
for (; N = H.nextNode(); )
|
|
1055
|
+
An(N), Rn(N), N.content instanceof r && In(N.content);
|
|
1056
|
+
if (Ke)
|
|
1057
|
+
return v;
|
|
1020
1058
|
if (ze) {
|
|
1021
|
-
if (
|
|
1022
|
-
|
|
1023
|
-
let
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}),
|
|
1027
|
-
}
|
|
1028
|
-
if (
|
|
1029
|
-
for (
|
|
1030
|
-
|
|
1059
|
+
if (he) {
|
|
1060
|
+
u.normalize();
|
|
1061
|
+
let ce = u.innerHTML;
|
|
1062
|
+
et([I, Re, ve], (de) => {
|
|
1063
|
+
ce = Be(ce, de, " ");
|
|
1064
|
+
}), u.innerHTML = ce;
|
|
1065
|
+
}
|
|
1066
|
+
if (mt)
|
|
1067
|
+
for (Q = ht.call(u.ownerDocument); u.firstChild; )
|
|
1068
|
+
Q.appendChild(u.firstChild);
|
|
1031
1069
|
else
|
|
1032
|
-
|
|
1033
|
-
return (
|
|
1034
|
-
}
|
|
1035
|
-
let
|
|
1036
|
-
return
|
|
1037
|
-
` +
|
|
1038
|
-
|
|
1039
|
-
}),
|
|
1070
|
+
Q = u;
|
|
1071
|
+
return (W.shadowroot || W.shadowrootmode) && (Q = It.call(n, Q, !0)), Q;
|
|
1072
|
+
}
|
|
1073
|
+
let se = Ie ? u.outerHTML : u.innerHTML;
|
|
1074
|
+
return Ie && F["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && K(ls, u.ownerDocument.doctype.name) && (se = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
1075
|
+
` + se), he && et([I, Re, ve], (ce) => {
|
|
1076
|
+
se = Be(se, ce, " ");
|
|
1077
|
+
}), z && bt ? z.createHTML(se) : se;
|
|
1040
1078
|
}, t.setConfig = function() {
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1079
|
+
let v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1080
|
+
Ft(v), Mt = !0;
|
|
1043
1081
|
}, t.clearConfig = function() {
|
|
1044
|
-
|
|
1045
|
-
}, t.isValidAttribute = function(
|
|
1046
|
-
|
|
1047
|
-
const k =
|
|
1048
|
-
return
|
|
1049
|
-
}, t.addHook = function(
|
|
1050
|
-
typeof i == "function" &&
|
|
1051
|
-
}, t.removeHook = function(
|
|
1082
|
+
$e = null, Mt = !1;
|
|
1083
|
+
}, t.isValidAttribute = function(v, i, u) {
|
|
1084
|
+
$e || Ft({});
|
|
1085
|
+
const k = q(v), N = q(i);
|
|
1086
|
+
return En(k, N, u);
|
|
1087
|
+
}, t.addHook = function(v, i) {
|
|
1088
|
+
typeof i == "function" && tt(Y[v], i);
|
|
1089
|
+
}, t.removeHook = function(v, i) {
|
|
1052
1090
|
if (i !== void 0) {
|
|
1053
|
-
const
|
|
1054
|
-
return
|
|
1091
|
+
const u = Zs(Y[v], i);
|
|
1092
|
+
return u === -1 ? void 0 : Xs(Y[v], u, 1)[0];
|
|
1055
1093
|
}
|
|
1056
|
-
return
|
|
1057
|
-
}, t.removeHooks = function(
|
|
1058
|
-
|
|
1094
|
+
return $n(Y[v]);
|
|
1095
|
+
}, t.removeHooks = function(v) {
|
|
1096
|
+
Y[v] = [];
|
|
1059
1097
|
}, t.removeAllHooks = function() {
|
|
1060
|
-
|
|
1098
|
+
Y = Yn();
|
|
1061
1099
|
}, t;
|
|
1062
1100
|
}
|
|
1063
|
-
|
|
1064
|
-
var
|
|
1065
|
-
function
|
|
1101
|
+
h(os, "createDOMPurify");
|
|
1102
|
+
var mr = os();
|
|
1103
|
+
function sn() {
|
|
1066
1104
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1067
1105
|
}
|
|
1068
|
-
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1071
|
-
|
|
1106
|
+
h(sn, "M");
|
|
1107
|
+
var Oe = sn();
|
|
1108
|
+
function cs(a) {
|
|
1109
|
+
Oe = a;
|
|
1072
1110
|
}
|
|
1073
|
-
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1076
|
-
let e = typeof
|
|
1077
|
-
let
|
|
1078
|
-
return
|
|
1079
|
-
}, "replace"), getRegex: /* @__PURE__ */
|
|
1111
|
+
h(cs, "G");
|
|
1112
|
+
var Ce = { exec: /* @__PURE__ */ h(() => null, "exec") };
|
|
1113
|
+
function C(a, t = "") {
|
|
1114
|
+
let e = typeof a == "string" ? a : a.source, n = { replace: /* @__PURE__ */ h((s, r) => {
|
|
1115
|
+
let l = typeof r == "string" ? r : r.source;
|
|
1116
|
+
return l = l.replace(te.caret, "$1"), e = e.replace(s, l), n;
|
|
1117
|
+
}, "replace"), getRegex: /* @__PURE__ */ h(() => new RegExp(e, t), "getRegex") };
|
|
1080
1118
|
return n;
|
|
1081
1119
|
}
|
|
1082
|
-
|
|
1083
|
-
var
|
|
1120
|
+
h(C, "k");
|
|
1121
|
+
var br = (() => {
|
|
1084
1122
|
try {
|
|
1085
1123
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
1086
1124
|
} catch {
|
|
1087
1125
|
return !1;
|
|
1088
1126
|
}
|
|
1089
|
-
})(),
|
|
1090
|
-
]`).replace("lheading",
|
|
1091
|
-
function
|
|
1127
|
+
})(), te = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ h((a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ h((a) => new RegExp(`^ {0,${Math.min(3, a - 1)}}>`), "blockquoteBeginRegex") }, xr = /^(?:[ \t]*(?:\n|$))+/, kr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, wr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ut = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, yr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, rn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, us = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, hs = C(us).replace(/bull/g, rn).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(), vr = C(us).replace(/bull/g, rn).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(), an = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Tr = /^[^\n]+/, ln = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Sr = C(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ln).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ar = C(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, rn).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", on = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Er = C("^ {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", on).replace("tag", _t).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ps = C(an).replace("hr", ut).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(), _r = C(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ps).getRegex(), cn = { blockquote: _r, code: kr, def: Sr, fences: wr, heading: yr, hr: ut, html: Er, lheading: hs, list: Ar, newline: xr, paragraph: ps, table: Ce, text: Tr }, Zn = C("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ut).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(), Rr = { ...cn, lheading: vr, table: Zn, paragraph: C(an).replace("hr", ut).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() }, Ir = { ...cn, html: C(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", on).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: Ce, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: C(an).replace("hr", ut).replace("heading", ` *#{1,6} *[^
|
|
1128
|
+
]`).replace("lheading", hs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Dr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Cr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ds = /^( {2,}|\\)\n(?!\s*$)/, Mr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, qe = /[\p{P}\p{S}]/u, Rt = /[\s\p{P}\p{S}]/u, un = /[^\s\p{P}\p{S}]/u, Lr = C(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Rt).getRegex(), fs = /(?!~)[\p{P}\p{S}]/u, Or = /(?!~)[\s\p{P}\p{S}]/u, zr = /(?:[^\s\p{P}\p{S}]|~)/u, Pr = C(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", br ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), gs = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Nr = C(gs, "u").replace(/punct/g, qe).getRegex(), $r = C(gs, "u").replace(/punct/g, fs).getRegex(), ms = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Br = C(ms, "gu").replace(/notPunctSpace/g, un).replace(/punctSpace/g, Rt).replace(/punct/g, qe).getRegex(), Ur = C(ms, "gu").replace(/notPunctSpace/g, zr).replace(/punctSpace/g, Or).replace(/punct/g, fs).getRegex(), Fr = C("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, un).replace(/punctSpace/g, Rt).replace(/punct/g, qe).getRegex(), Hr = C(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, qe).getRegex(), Gr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", jr = C(Gr, "gu").replace(/notPunctSpace/g, un).replace(/punctSpace/g, Rt).replace(/punct/g, qe).getRegex(), Wr = C(/\\(punct)/, "gu").replace(/punct/g, qe).getRegex(), qr = C(/^<(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(), Vr = C(on).replace("(?:-->|$)", "-->").getRegex(), Yr = C("^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", Vr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), St = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Zr = C(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", St).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), bs = C(/^!?\[(label)\]\[(ref)\]/).replace("label", St).replace("ref", ln).getRegex(), xs = C(/^!?\[(ref)\](?:\[\])?/).replace("ref", ln).getRegex(), Xr = C("reflink|nolink(?!\\()", "g").replace("reflink", bs).replace("nolink", xs).getRegex(), Xn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, hn = { _backpedal: Ce, anyPunctuation: Wr, autolink: qr, blockSkip: Pr, br: ds, code: Cr, del: Ce, delLDelim: Ce, delRDelim: Ce, emStrongLDelim: Nr, emStrongRDelimAst: Br, emStrongRDelimUnd: Fr, escape: Dr, link: Zr, nolink: xs, punctuation: Lr, reflink: bs, reflinkSearch: Xr, tag: Yr, text: Mr, url: Ce }, Kr = { ...hn, link: C(/^!?\[(label)\]\((.*?)\)/).replace("label", St).getRegex(), reflink: C(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", St).getRegex() }, tn = { ...hn, emStrongRDelimAst: Ur, emStrongLDelim: $r, delLDelim: Hr, delRDelim: jr, url: C(/^((?: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: C(/^([`~]+|[^`~])(?:(?= {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() }, Qr = { ...tn, br: C(ds).replace("{2,}", "*").getRegex(), text: C(tn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, vt = { normal: cn, gfm: Rr, pedantic: Ir }, rt = { normal: hn, gfm: tn, breaks: Qr, pedantic: Kr }, Jr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Kn = /* @__PURE__ */ h((a) => Jr[a], "ke");
|
|
1129
|
+
function ke(a, t) {
|
|
1092
1130
|
if (t) {
|
|
1093
|
-
if (
|
|
1094
|
-
} else if (
|
|
1095
|
-
return
|
|
1131
|
+
if (te.escapeTest.test(a)) return a.replace(te.escapeReplace, Kn);
|
|
1132
|
+
} else if (te.escapeTestNoEncode.test(a)) return a.replace(te.escapeReplaceNoEncode, Kn);
|
|
1133
|
+
return a;
|
|
1096
1134
|
}
|
|
1097
|
-
|
|
1098
|
-
function
|
|
1135
|
+
h(ke, "T");
|
|
1136
|
+
function Qn(a) {
|
|
1099
1137
|
try {
|
|
1100
|
-
|
|
1138
|
+
a = encodeURI(a).replace(te.percentDecode, "%");
|
|
1101
1139
|
} catch {
|
|
1102
1140
|
return null;
|
|
1103
1141
|
}
|
|
1104
|
-
return
|
|
1142
|
+
return a;
|
|
1105
1143
|
}
|
|
1106
|
-
|
|
1107
|
-
function
|
|
1108
|
-
let e =
|
|
1109
|
-
let c = !1, p =
|
|
1144
|
+
h(Qn, "J");
|
|
1145
|
+
function Jn(a, t) {
|
|
1146
|
+
let e = a.replace(te.findPipe, (r, l, o) => {
|
|
1147
|
+
let c = !1, p = l;
|
|
1110
1148
|
for (; --p >= 0 && o[p] === "\\"; ) c = !c;
|
|
1111
1149
|
return c ? "|" : " |";
|
|
1112
|
-
}), n = e.split(
|
|
1150
|
+
}), n = e.split(te.splitPipe), s = 0;
|
|
1113
1151
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1114
1152
|
else for (; n.length < t; ) n.push("");
|
|
1115
|
-
for (; s < n.length; s++) n[s] = n[s].trim().replace(
|
|
1153
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(te.slashPipe, "|");
|
|
1116
1154
|
return n;
|
|
1117
1155
|
}
|
|
1118
|
-
|
|
1119
|
-
function
|
|
1120
|
-
let n =
|
|
1156
|
+
h(Jn, "V");
|
|
1157
|
+
function it(a, t, e) {
|
|
1158
|
+
let n = a.length;
|
|
1121
1159
|
if (n === 0) return "";
|
|
1122
1160
|
let s = 0;
|
|
1123
|
-
for (; s < n &&
|
|
1161
|
+
for (; s < n && a.charAt(n - s - 1) === t; )
|
|
1124
1162
|
s++;
|
|
1125
|
-
return
|
|
1163
|
+
return a.slice(0, n - s);
|
|
1126
1164
|
}
|
|
1127
|
-
|
|
1128
|
-
function
|
|
1129
|
-
if (
|
|
1165
|
+
h(it, "I");
|
|
1166
|
+
function ei(a, t) {
|
|
1167
|
+
if (a.indexOf(t[1]) === -1) return -1;
|
|
1130
1168
|
let e = 0;
|
|
1131
|
-
for (let n = 0; n <
|
|
1132
|
-
else if (
|
|
1133
|
-
else if (
|
|
1169
|
+
for (let n = 0; n < a.length; n++) if (a[n] === "\\") n++;
|
|
1170
|
+
else if (a[n] === t[0]) e++;
|
|
1171
|
+
else if (a[n] === t[1] && (e--, e < 0)) return n;
|
|
1134
1172
|
return e > 0 ? -2 : -1;
|
|
1135
1173
|
}
|
|
1136
|
-
|
|
1137
|
-
function
|
|
1174
|
+
h(ei, "de");
|
|
1175
|
+
function ti(a, t = 0) {
|
|
1138
1176
|
let e = t, n = "";
|
|
1139
|
-
for (let s of
|
|
1177
|
+
for (let s of a) if (s === " ") {
|
|
1140
1178
|
let r = 4 - e % 4;
|
|
1141
1179
|
n += " ".repeat(r), e += r;
|
|
1142
1180
|
} else n += s, e++;
|
|
1143
1181
|
return n;
|
|
1144
1182
|
}
|
|
1145
|
-
|
|
1146
|
-
function
|
|
1147
|
-
let r = t.href,
|
|
1183
|
+
h(ti, "ge");
|
|
1184
|
+
function es(a, t, e, n, s) {
|
|
1185
|
+
let r = t.href, l = t.title || null, o = a[1].replace(s.other.outputLinkReplace, "$1");
|
|
1148
1186
|
n.state.inLink = !0;
|
|
1149
|
-
let c = { type:
|
|
1187
|
+
let c = { type: a[0].charAt(0) === "!" ? "image" : "link", raw: e, href: r, title: l, text: o, tokens: n.inlineTokens(o) };
|
|
1150
1188
|
return n.state.inLink = !1, c;
|
|
1151
1189
|
}
|
|
1152
|
-
|
|
1153
|
-
function
|
|
1154
|
-
let n =
|
|
1190
|
+
h(es, "fe");
|
|
1191
|
+
function ni(a, t, e) {
|
|
1192
|
+
let n = a.match(e.other.indentCodeCompensation);
|
|
1155
1193
|
if (n === null) return t;
|
|
1156
1194
|
let s = n[1];
|
|
1157
1195
|
return t.split(`
|
|
1158
1196
|
`).map((r) => {
|
|
1159
|
-
let
|
|
1160
|
-
if (
|
|
1161
|
-
let [o] =
|
|
1197
|
+
let l = r.match(e.other.beginningSpace);
|
|
1198
|
+
if (l === null) return r;
|
|
1199
|
+
let [o] = l;
|
|
1162
1200
|
return o.length >= s.length ? r.slice(s.length) : r;
|
|
1163
1201
|
}).join(`
|
|
1164
1202
|
`);
|
|
1165
1203
|
}
|
|
1166
|
-
|
|
1167
|
-
var
|
|
1204
|
+
h(ni, "nt");
|
|
1205
|
+
var He, At = (He = class {
|
|
1168
1206
|
constructor(t) {
|
|
1169
1207
|
D(this, "options");
|
|
1170
1208
|
D(this, "rules");
|
|
1171
1209
|
D(this, "lexer");
|
|
1172
|
-
this.options = t ||
|
|
1210
|
+
this.options = t || Oe;
|
|
1173
1211
|
}
|
|
1174
1212
|
space(t) {
|
|
1175
1213
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1179,14 +1217,14 @@ var Ue, At = (Ue = class {
|
|
|
1179
1217
|
let e = this.rules.block.code.exec(t);
|
|
1180
1218
|
if (e) {
|
|
1181
1219
|
let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1182
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n :
|
|
1220
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : it(n, `
|
|
1183
1221
|
`) };
|
|
1184
1222
|
}
|
|
1185
1223
|
}
|
|
1186
1224
|
fences(t) {
|
|
1187
1225
|
let e = this.rules.block.fences.exec(t);
|
|
1188
1226
|
if (e) {
|
|
1189
|
-
let n = e[0], s =
|
|
1227
|
+
let n = e[0], s = ni(n, e[3] || "", this.rules);
|
|
1190
1228
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
1191
1229
|
}
|
|
1192
1230
|
}
|
|
@@ -1195,7 +1233,7 @@ var Ue, At = (Ue = class {
|
|
|
1195
1233
|
if (e) {
|
|
1196
1234
|
let n = e[2].trim();
|
|
1197
1235
|
if (this.rules.other.endingHash.test(n)) {
|
|
1198
|
-
let s =
|
|
1236
|
+
let s = it(n, "#");
|
|
1199
1237
|
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
1200
1238
|
}
|
|
1201
1239
|
return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
@@ -1203,15 +1241,15 @@ var Ue, At = (Ue = class {
|
|
|
1203
1241
|
}
|
|
1204
1242
|
hr(t) {
|
|
1205
1243
|
let e = this.rules.block.hr.exec(t);
|
|
1206
|
-
if (e) return { type: "hr", raw:
|
|
1244
|
+
if (e) return { type: "hr", raw: it(e[0], `
|
|
1207
1245
|
`) };
|
|
1208
1246
|
}
|
|
1209
1247
|
blockquote(t) {
|
|
1210
1248
|
let e = this.rules.block.blockquote.exec(t);
|
|
1211
1249
|
if (e) {
|
|
1212
|
-
let n =
|
|
1250
|
+
let n = it(e[0], `
|
|
1213
1251
|
`).split(`
|
|
1214
|
-
`), s = "", r = "",
|
|
1252
|
+
`), s = "", r = "", l = [];
|
|
1215
1253
|
for (; n.length > 0; ) {
|
|
1216
1254
|
let o = !1, c = [], p;
|
|
1217
1255
|
for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) c.push(n[p]), o = !0;
|
|
@@ -1225,25 +1263,25 @@ var Ue, At = (Ue = class {
|
|
|
1225
1263
|
${g}` : g, r = r ? `${r}
|
|
1226
1264
|
${d}` : d;
|
|
1227
1265
|
let f = this.lexer.state.top;
|
|
1228
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(d,
|
|
1229
|
-
let m =
|
|
1266
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(d, l, !0), this.lexer.state.top = f, n.length === 0) break;
|
|
1267
|
+
let m = l.at(-1);
|
|
1230
1268
|
if (m?.type === "code") break;
|
|
1231
1269
|
if (m?.type === "blockquote") {
|
|
1232
1270
|
let w = m, E = w.raw + `
|
|
1233
1271
|
` + n.join(`
|
|
1234
|
-
`),
|
|
1235
|
-
|
|
1272
|
+
`), O = this.blockquote(E);
|
|
1273
|
+
l[l.length - 1] = O, s = s.substring(0, s.length - w.raw.length) + O.raw, r = r.substring(0, r.length - w.text.length) + O.text;
|
|
1236
1274
|
break;
|
|
1237
1275
|
} else if (m?.type === "list") {
|
|
1238
1276
|
let w = m, E = w.raw + `
|
|
1239
1277
|
` + n.join(`
|
|
1240
|
-
`),
|
|
1241
|
-
|
|
1278
|
+
`), O = this.list(E);
|
|
1279
|
+
l[l.length - 1] = O, s = s.substring(0, s.length - m.raw.length) + O.raw, r = r.substring(0, r.length - w.raw.length) + O.raw, n = E.substring(l.at(-1).raw.length).split(`
|
|
1242
1280
|
`);
|
|
1243
1281
|
continue;
|
|
1244
1282
|
}
|
|
1245
1283
|
}
|
|
1246
|
-
return { type: "blockquote", raw: s, tokens:
|
|
1284
|
+
return { type: "blockquote", raw: s, tokens: l, text: r };
|
|
1247
1285
|
}
|
|
1248
1286
|
}
|
|
1249
1287
|
list(t) {
|
|
@@ -1251,30 +1289,30 @@ ${d}` : d;
|
|
|
1251
1289
|
if (e) {
|
|
1252
1290
|
let n = e[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: !1, items: [] };
|
|
1253
1291
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1254
|
-
let
|
|
1292
|
+
let l = this.rules.other.listItemRegex(n), o = !1;
|
|
1255
1293
|
for (; t; ) {
|
|
1256
1294
|
let p = !1, g = "", d = "";
|
|
1257
|
-
if (!(e =
|
|
1295
|
+
if (!(e = l.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1258
1296
|
g = e[0], t = t.substring(g.length);
|
|
1259
|
-
let f =
|
|
1297
|
+
let f = ti(e[2].split(`
|
|
1260
1298
|
`, 1)[0], e[1].length), m = t.split(`
|
|
1261
1299
|
`, 1)[0], w = !f.trim(), E = 0;
|
|
1262
1300
|
if (this.options.pedantic ? (E = 2, d = f.trimStart()) : w ? E = e[1].length + 1 : (E = f.search(this.rules.other.nonSpaceChar), E = E > 4 ? 1 : E, d = f.slice(E), E += e[1].length), w && this.rules.other.blankLine.test(m) && (g += m + `
|
|
1263
1301
|
`, t = t.substring(m.length + 1), p = !0), !p) {
|
|
1264
|
-
let
|
|
1302
|
+
let O = this.rules.other.nextBulletRegex(E), U = this.rules.other.hrRegex(E), ae = this.rules.other.fencesBeginRegex(E), le = this.rules.other.headingBeginRegex(E), z = this.rules.other.htmlBeginRegex(E), oe = this.rules.other.blockquoteBeginRegex(E);
|
|
1265
1303
|
for (; t; ) {
|
|
1266
|
-
let
|
|
1267
|
-
`, 1)[0],
|
|
1268
|
-
if (m =
|
|
1269
|
-
if (
|
|
1270
|
-
` +
|
|
1304
|
+
let me = t.split(`
|
|
1305
|
+
`, 1)[0], V;
|
|
1306
|
+
if (m = me, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), V = m) : V = m.replace(this.rules.other.tabCharGlobal, " "), ae.test(m) || le.test(m) || z.test(m) || oe.test(m) || O.test(m) || U.test(m)) break;
|
|
1307
|
+
if (V.search(this.rules.other.nonSpaceChar) >= E || !m.trim()) d += `
|
|
1308
|
+
` + V.slice(E);
|
|
1271
1309
|
else {
|
|
1272
|
-
if (w || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 ||
|
|
1310
|
+
if (w || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ae.test(f) || le.test(f) || U.test(f)) break;
|
|
1273
1311
|
d += `
|
|
1274
1312
|
` + m;
|
|
1275
1313
|
}
|
|
1276
|
-
w = !m.trim(), g +=
|
|
1277
|
-
`, t = t.substring(
|
|
1314
|
+
w = !m.trim(), g += me + `
|
|
1315
|
+
`, t = t.substring(me.length + 1), f = V.slice(E);
|
|
1278
1316
|
}
|
|
1279
1317
|
}
|
|
1280
1318
|
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (o = !0)), r.items.push({ type: "list_item", raw: g, task: !!this.options.gfm && this.rules.other.listIsTask.test(d), loose: !1, text: d, tokens: [] }), r.raw += g;
|
|
@@ -1324,13 +1362,13 @@ ${d}` : d;
|
|
|
1324
1362
|
table(t) {
|
|
1325
1363
|
let e = this.rules.block.table.exec(t);
|
|
1326
1364
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1327
|
-
let n =
|
|
1328
|
-
`) : [],
|
|
1365
|
+
let n = Jn(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1366
|
+
`) : [], l = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
1329
1367
|
if (n.length === s.length) {
|
|
1330
|
-
for (let o of s) this.rules.other.tableAlignRight.test(o) ?
|
|
1331
|
-
for (let o = 0; o < n.length; o++)
|
|
1332
|
-
for (let o of r)
|
|
1333
|
-
return
|
|
1368
|
+
for (let o of s) 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);
|
|
1369
|
+
for (let o = 0; o < n.length; o++) l.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: l.align[o] });
|
|
1370
|
+
for (let o of r) l.rows.push(Jn(o, l.header.length).map((c, p) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: l.align[p] })));
|
|
1371
|
+
return l;
|
|
1334
1372
|
}
|
|
1335
1373
|
}
|
|
1336
1374
|
lheading(t) {
|
|
@@ -1366,22 +1404,22 @@ ${d}` : d;
|
|
|
1366
1404
|
let n = e[2].trim();
|
|
1367
1405
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1368
1406
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1369
|
-
let
|
|
1370
|
-
if ((n.length -
|
|
1407
|
+
let l = it(n.slice(0, -1), "\\");
|
|
1408
|
+
if ((n.length - l.length) % 2 === 0) return;
|
|
1371
1409
|
} else {
|
|
1372
|
-
let
|
|
1373
|
-
if (
|
|
1374
|
-
if (
|
|
1375
|
-
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length +
|
|
1376
|
-
e[2] = e[2].substring(0,
|
|
1410
|
+
let l = ei(e[2], "()");
|
|
1411
|
+
if (l === -2) return;
|
|
1412
|
+
if (l > -1) {
|
|
1413
|
+
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
1414
|
+
e[2] = e[2].substring(0, l), e[0] = e[0].substring(0, o).trim(), e[3] = "";
|
|
1377
1415
|
}
|
|
1378
1416
|
}
|
|
1379
1417
|
let s = e[2], r = "";
|
|
1380
1418
|
if (this.options.pedantic) {
|
|
1381
|
-
let
|
|
1382
|
-
|
|
1419
|
+
let l = this.rules.other.pedanticHrefTitle.exec(s);
|
|
1420
|
+
l && (s = l[1], r = l[3]);
|
|
1383
1421
|
} else r = e[3] ? e[3].slice(1, -1) : "";
|
|
1384
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)),
|
|
1422
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), es(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
1385
1423
|
}
|
|
1386
1424
|
}
|
|
1387
1425
|
reflink(t, e) {
|
|
@@ -1389,19 +1427,19 @@ ${d}` : d;
|
|
|
1389
1427
|
if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
|
|
1390
1428
|
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = e[s.toLowerCase()];
|
|
1391
1429
|
if (!r) {
|
|
1392
|
-
let
|
|
1393
|
-
return { type: "text", raw:
|
|
1430
|
+
let l = n[0].charAt(0);
|
|
1431
|
+
return { type: "text", raw: l, text: l };
|
|
1394
1432
|
}
|
|
1395
|
-
return
|
|
1433
|
+
return es(n, r, n[0], this.lexer, this.rules);
|
|
1396
1434
|
}
|
|
1397
1435
|
}
|
|
1398
1436
|
emStrong(t, e, n = "") {
|
|
1399
1437
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
1400
1438
|
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1401
|
-
let r = [...s[0]].length - 1,
|
|
1439
|
+
let r = [...s[0]].length - 1, l, o, c = r, p = 0, g = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1402
1440
|
for (g.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = g.exec(e)) !== null; ) {
|
|
1403
|
-
if (
|
|
1404
|
-
if (o = [...
|
|
1441
|
+
if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l) continue;
|
|
1442
|
+
if (o = [...l].length, s[3] || s[4]) {
|
|
1405
1443
|
c += o;
|
|
1406
1444
|
continue;
|
|
1407
1445
|
} else if ((s[5] || s[6]) && r % 3 && !((r + o) % 3)) {
|
|
@@ -1434,9 +1472,9 @@ ${d}` : d;
|
|
|
1434
1472
|
del(t, e, n = "") {
|
|
1435
1473
|
let s = this.rules.inline.delLDelim.exec(t);
|
|
1436
1474
|
if (s && (!s[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1437
|
-
let r = [...s[0]].length - 1,
|
|
1475
|
+
let r = [...s[0]].length - 1, l, o, c = r, p = this.rules.inline.delRDelim;
|
|
1438
1476
|
for (p.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = p.exec(e)) !== null; ) {
|
|
1439
|
-
if (
|
|
1477
|
+
if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l || (o = [...l].length, o !== r)) continue;
|
|
1440
1478
|
if (s[3] || s[4]) {
|
|
1441
1479
|
c += o;
|
|
1442
1480
|
continue;
|
|
@@ -1477,28 +1515,28 @@ ${d}` : d;
|
|
|
1477
1515
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1478
1516
|
}
|
|
1479
1517
|
}
|
|
1480
|
-
},
|
|
1518
|
+
}, h(He, "w"), He), Ae, fe = (Ae = class {
|
|
1481
1519
|
constructor(t) {
|
|
1482
1520
|
D(this, "tokens");
|
|
1483
1521
|
D(this, "options");
|
|
1484
1522
|
D(this, "state");
|
|
1485
1523
|
D(this, "inlineQueue");
|
|
1486
1524
|
D(this, "tokenizer");
|
|
1487
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1488
|
-
let e = { other:
|
|
1489
|
-
this.options.pedantic ? (e.block = vt.pedantic, e.inline =
|
|
1525
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Oe, this.options.tokenizer = this.options.tokenizer || new At(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1526
|
+
let e = { other: te, block: vt.normal, inline: rt.normal };
|
|
1527
|
+
this.options.pedantic ? (e.block = vt.pedantic, e.inline = rt.pedantic) : this.options.gfm && (e.block = vt.gfm, this.options.breaks ? e.inline = rt.breaks : e.inline = rt.gfm), this.tokenizer.rules = e;
|
|
1490
1528
|
}
|
|
1491
1529
|
static get rules() {
|
|
1492
|
-
return { block: vt, inline:
|
|
1530
|
+
return { block: vt, inline: rt };
|
|
1493
1531
|
}
|
|
1494
1532
|
static lex(t, e) {
|
|
1495
|
-
return new
|
|
1533
|
+
return new Ae(e).lex(t);
|
|
1496
1534
|
}
|
|
1497
1535
|
static lexInline(t, e) {
|
|
1498
|
-
return new
|
|
1536
|
+
return new Ae(e).inlineTokens(t);
|
|
1499
1537
|
}
|
|
1500
1538
|
lex(t) {
|
|
1501
|
-
t = t.replace(
|
|
1539
|
+
t = t.replace(te.carriageReturn, `
|
|
1502
1540
|
`), this.blockTokens(t, this.tokens);
|
|
1503
1541
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1504
1542
|
let n = this.inlineQueue[e];
|
|
@@ -1507,23 +1545,23 @@ ${d}` : d;
|
|
|
1507
1545
|
return this.inlineQueue = [], this.tokens;
|
|
1508
1546
|
}
|
|
1509
1547
|
blockTokens(t, e = [], n = !1) {
|
|
1510
|
-
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1548
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(te.tabCharGlobal, " ").replace(te.spaceLine, "")); t; ) {
|
|
1511
1549
|
let s;
|
|
1512
|
-
if (this.options.extensions?.block?.some((
|
|
1550
|
+
if (this.options.extensions?.block?.some((l) => (s = l.call({ lexer: this }, t, e)) ? (t = t.substring(s.raw.length), e.push(s), !0) : !1)) continue;
|
|
1513
1551
|
if (s = this.tokenizer.space(t)) {
|
|
1514
1552
|
t = t.substring(s.raw.length);
|
|
1515
|
-
let
|
|
1516
|
-
s.raw.length === 1 &&
|
|
1553
|
+
let l = e.at(-1);
|
|
1554
|
+
s.raw.length === 1 && l !== void 0 ? l.raw += `
|
|
1517
1555
|
` : e.push(s);
|
|
1518
1556
|
continue;
|
|
1519
1557
|
}
|
|
1520
1558
|
if (s = this.tokenizer.code(t)) {
|
|
1521
1559
|
t = t.substring(s.raw.length);
|
|
1522
|
-
let
|
|
1523
|
-
|
|
1560
|
+
let l = e.at(-1);
|
|
1561
|
+
l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1524
1562
|
`) ? "" : `
|
|
1525
|
-
`) + s.raw,
|
|
1526
|
-
` + s.text, this.inlineQueue.at(-1).src =
|
|
1563
|
+
`) + s.raw, l.text += `
|
|
1564
|
+
` + s.text, this.inlineQueue.at(-1).src = l.text) : e.push(s);
|
|
1527
1565
|
continue;
|
|
1528
1566
|
}
|
|
1529
1567
|
if (s = this.tokenizer.fences(t)) {
|
|
@@ -1552,11 +1590,11 @@ ${d}` : d;
|
|
|
1552
1590
|
}
|
|
1553
1591
|
if (s = this.tokenizer.def(t)) {
|
|
1554
1592
|
t = t.substring(s.raw.length);
|
|
1555
|
-
let
|
|
1556
|
-
|
|
1593
|
+
let l = e.at(-1);
|
|
1594
|
+
l?.type === "paragraph" || l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1557
1595
|
`) ? "" : `
|
|
1558
|
-
`) + s.raw,
|
|
1559
|
-
` + s.raw, this.inlineQueue.at(-1).src =
|
|
1596
|
+
`) + s.raw, l.text += `
|
|
1597
|
+
` + s.raw, this.inlineQueue.at(-1).src = l.text) : this.tokens.links[s.tag] || (this.tokens.links[s.tag] = { href: s.href, title: s.title }, e.push(s));
|
|
1560
1598
|
continue;
|
|
1561
1599
|
}
|
|
1562
1600
|
if (s = this.tokenizer.table(t)) {
|
|
@@ -1569,34 +1607,34 @@ ${d}` : d;
|
|
|
1569
1607
|
}
|
|
1570
1608
|
let r = t;
|
|
1571
1609
|
if (this.options.extensions?.startBlock) {
|
|
1572
|
-
let
|
|
1610
|
+
let l = 1 / 0, o = t.slice(1), c;
|
|
1573
1611
|
this.options.extensions.startBlock.forEach((p) => {
|
|
1574
|
-
c = p.call({ lexer: this }, o), typeof c == "number" && c >= 0 && (
|
|
1575
|
-
}),
|
|
1612
|
+
c = p.call({ lexer: this }, o), typeof c == "number" && c >= 0 && (l = Math.min(l, c));
|
|
1613
|
+
}), l < 1 / 0 && l >= 0 && (r = t.substring(0, l + 1));
|
|
1576
1614
|
}
|
|
1577
1615
|
if (this.state.top && (s = this.tokenizer.paragraph(r))) {
|
|
1578
|
-
let
|
|
1579
|
-
n &&
|
|
1616
|
+
let l = e.at(-1);
|
|
1617
|
+
n && l?.type === "paragraph" ? (l.raw += (l.raw.endsWith(`
|
|
1580
1618
|
`) ? "" : `
|
|
1581
|
-
`) + s.raw,
|
|
1582
|
-
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
1619
|
+
`) + s.raw, l.text += `
|
|
1620
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : e.push(s), n = r.length !== t.length, t = t.substring(s.raw.length);
|
|
1583
1621
|
continue;
|
|
1584
1622
|
}
|
|
1585
1623
|
if (s = this.tokenizer.text(t)) {
|
|
1586
1624
|
t = t.substring(s.raw.length);
|
|
1587
|
-
let
|
|
1588
|
-
|
|
1625
|
+
let l = e.at(-1);
|
|
1626
|
+
l?.type === "text" ? (l.raw += (l.raw.endsWith(`
|
|
1589
1627
|
`) ? "" : `
|
|
1590
|
-
`) + s.raw,
|
|
1591
|
-
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
1628
|
+
`) + s.raw, l.text += `
|
|
1629
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : e.push(s);
|
|
1592
1630
|
continue;
|
|
1593
1631
|
}
|
|
1594
1632
|
if (t) {
|
|
1595
|
-
let
|
|
1633
|
+
let l = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1596
1634
|
if (this.options.silent) {
|
|
1597
|
-
console.error(
|
|
1635
|
+
console.error(l);
|
|
1598
1636
|
break;
|
|
1599
|
-
} else throw new Error(
|
|
1637
|
+
} else throw new Error(l);
|
|
1600
1638
|
}
|
|
1601
1639
|
}
|
|
1602
1640
|
return this.state.top = !0, e;
|
|
@@ -1615,9 +1653,9 @@ ${d}` : d;
|
|
|
1615
1653
|
let r;
|
|
1616
1654
|
for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1617
1655
|
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
1618
|
-
let
|
|
1656
|
+
let l = !1, o = "";
|
|
1619
1657
|
for (; t; ) {
|
|
1620
|
-
|
|
1658
|
+
l || (o = ""), l = !1;
|
|
1621
1659
|
let c;
|
|
1622
1660
|
if (this.options.extensions?.inline?.some((g) => (c = g.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1623
1661
|
if (c = this.tokenizer.escape(t)) {
|
|
@@ -1670,7 +1708,7 @@ ${d}` : d;
|
|
|
1670
1708
|
}), g < 1 / 0 && g >= 0 && (p = t.substring(0, g + 1));
|
|
1671
1709
|
}
|
|
1672
1710
|
if (c = this.tokenizer.inlineText(p)) {
|
|
1673
|
-
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)),
|
|
1711
|
+
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), l = !0;
|
|
1674
1712
|
let g = e.at(-1);
|
|
1675
1713
|
g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
1676
1714
|
continue;
|
|
@@ -1685,20 +1723,20 @@ ${d}` : d;
|
|
|
1685
1723
|
}
|
|
1686
1724
|
return e;
|
|
1687
1725
|
}
|
|
1688
|
-
},
|
|
1726
|
+
}, h(Ae, "u"), Ae), Ge, Et = (Ge = class {
|
|
1689
1727
|
constructor(t) {
|
|
1690
1728
|
D(this, "options");
|
|
1691
1729
|
D(this, "parser");
|
|
1692
|
-
this.options = t ||
|
|
1730
|
+
this.options = t || Oe;
|
|
1693
1731
|
}
|
|
1694
1732
|
space(t) {
|
|
1695
1733
|
return "";
|
|
1696
1734
|
}
|
|
1697
1735
|
code({ text: t, lang: e, escaped: n }) {
|
|
1698
|
-
let s = (e || "").match(
|
|
1736
|
+
let s = (e || "").match(te.notSpaceStart)?.[0], r = t.replace(te.endingNewline, "") + `
|
|
1699
1737
|
`;
|
|
1700
|
-
return s ? '<pre><code class="language-' +
|
|
1701
|
-
` : "<pre><code>" + (n ? r :
|
|
1738
|
+
return s ? '<pre><code class="language-' + ke(s) + '">' + (n ? r : ke(r, !0)) + `</code></pre>
|
|
1739
|
+
` : "<pre><code>" + (n ? r : ke(r, !0)) + `</code></pre>
|
|
1702
1740
|
`;
|
|
1703
1741
|
}
|
|
1704
1742
|
blockquote({ tokens: t }) {
|
|
@@ -1726,8 +1764,8 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1726
1764
|
let c = t.items[o];
|
|
1727
1765
|
s += this.listitem(c);
|
|
1728
1766
|
}
|
|
1729
|
-
let r = e ? "ol" : "ul",
|
|
1730
|
-
return "<" + r +
|
|
1767
|
+
let r = e ? "ol" : "ul", l = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
1768
|
+
return "<" + r + l + `>
|
|
1731
1769
|
` + s + "</" + r + `>
|
|
1732
1770
|
`;
|
|
1733
1771
|
}
|
|
@@ -1748,9 +1786,9 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1748
1786
|
e += this.tablerow({ text: n });
|
|
1749
1787
|
let s = "";
|
|
1750
1788
|
for (let r = 0; r < t.rows.length; r++) {
|
|
1751
|
-
let
|
|
1789
|
+
let l = t.rows[r];
|
|
1752
1790
|
n = "";
|
|
1753
|
-
for (let o = 0; o <
|
|
1791
|
+
for (let o = 0; o < l.length; o++) n += this.tablecell(l[o]);
|
|
1754
1792
|
s += this.tablerow({ text: n });
|
|
1755
1793
|
}
|
|
1756
1794
|
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
@@ -1776,7 +1814,7 @@ ${t}</tr>
|
|
|
1776
1814
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1777
1815
|
}
|
|
1778
1816
|
codespan({ text: t }) {
|
|
1779
|
-
return `<code>${
|
|
1817
|
+
return `<code>${ke(t, !0)}</code>`;
|
|
1780
1818
|
}
|
|
1781
1819
|
br(t) {
|
|
1782
1820
|
return "<br>";
|
|
@@ -1785,24 +1823,24 @@ ${t}</tr>
|
|
|
1785
1823
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
1786
1824
|
}
|
|
1787
1825
|
link({ href: t, title: e, tokens: n }) {
|
|
1788
|
-
let s = this.parser.parseInline(n), r =
|
|
1826
|
+
let s = this.parser.parseInline(n), r = Qn(t);
|
|
1789
1827
|
if (r === null) return s;
|
|
1790
1828
|
t = r;
|
|
1791
|
-
let
|
|
1792
|
-
return e && (
|
|
1829
|
+
let l = '<a href="' + t + '"';
|
|
1830
|
+
return e && (l += ' title="' + ke(e) + '"'), l += ">" + s + "</a>", l;
|
|
1793
1831
|
}
|
|
1794
1832
|
image({ href: t, title: e, text: n, tokens: s }) {
|
|
1795
1833
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1796
|
-
let r =
|
|
1797
|
-
if (r === null) return
|
|
1834
|
+
let r = Qn(t);
|
|
1835
|
+
if (r === null) return ke(n);
|
|
1798
1836
|
t = r;
|
|
1799
|
-
let
|
|
1800
|
-
return e && (
|
|
1837
|
+
let l = `<img src="${t}" alt="${ke(n)}"`;
|
|
1838
|
+
return e && (l += ` title="${ke(e)}"`), l += ">", l;
|
|
1801
1839
|
}
|
|
1802
1840
|
text(t) {
|
|
1803
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1841
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : ke(t.text);
|
|
1804
1842
|
}
|
|
1805
|
-
},
|
|
1843
|
+
}, h(Ge, "y"), Ge), je, pn = (je = class {
|
|
1806
1844
|
strong({ text: t }) {
|
|
1807
1845
|
return t;
|
|
1808
1846
|
}
|
|
@@ -1833,18 +1871,18 @@ ${t}</tr>
|
|
|
1833
1871
|
checkbox({ raw: t }) {
|
|
1834
1872
|
return t;
|
|
1835
1873
|
}
|
|
1836
|
-
},
|
|
1874
|
+
}, h(je, "$"), je), Ee, ge = (Ee = class {
|
|
1837
1875
|
constructor(t) {
|
|
1838
1876
|
D(this, "options");
|
|
1839
1877
|
D(this, "renderer");
|
|
1840
1878
|
D(this, "textRenderer");
|
|
1841
|
-
this.options = t ||
|
|
1879
|
+
this.options = t || Oe, this.options.renderer = this.options.renderer || new Et(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new pn();
|
|
1842
1880
|
}
|
|
1843
1881
|
static parse(t, e) {
|
|
1844
|
-
return new
|
|
1882
|
+
return new Ee(e).parse(t);
|
|
1845
1883
|
}
|
|
1846
1884
|
static parseInline(t, e) {
|
|
1847
|
-
return new
|
|
1885
|
+
return new Ee(e).parseInline(t);
|
|
1848
1886
|
}
|
|
1849
1887
|
parse(t) {
|
|
1850
1888
|
this.renderer.parser = this;
|
|
@@ -1852,8 +1890,8 @@ ${t}</tr>
|
|
|
1852
1890
|
for (let n = 0; n < t.length; n++) {
|
|
1853
1891
|
let s = t[n];
|
|
1854
1892
|
if (this.options.extensions?.renderers?.[s.type]) {
|
|
1855
|
-
let
|
|
1856
|
-
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(
|
|
1893
|
+
let l = s, o = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1894
|
+
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
1857
1895
|
e += o || "";
|
|
1858
1896
|
continue;
|
|
1859
1897
|
}
|
|
@@ -1909,9 +1947,9 @@ ${t}</tr>
|
|
|
1909
1947
|
break;
|
|
1910
1948
|
}
|
|
1911
1949
|
default: {
|
|
1912
|
-
let
|
|
1913
|
-
if (this.options.silent) return console.error(
|
|
1914
|
-
throw new Error(
|
|
1950
|
+
let l = 'Token with "' + r.type + '" type was not found.';
|
|
1951
|
+
if (this.options.silent) return console.error(l), "";
|
|
1952
|
+
throw new Error(l);
|
|
1915
1953
|
}
|
|
1916
1954
|
}
|
|
1917
1955
|
}
|
|
@@ -1929,54 +1967,54 @@ ${t}</tr>
|
|
|
1929
1967
|
continue;
|
|
1930
1968
|
}
|
|
1931
1969
|
}
|
|
1932
|
-
let
|
|
1933
|
-
switch (
|
|
1970
|
+
let l = r;
|
|
1971
|
+
switch (l.type) {
|
|
1934
1972
|
case "escape": {
|
|
1935
|
-
n += e.text(
|
|
1973
|
+
n += e.text(l);
|
|
1936
1974
|
break;
|
|
1937
1975
|
}
|
|
1938
1976
|
case "html": {
|
|
1939
|
-
n += e.html(
|
|
1977
|
+
n += e.html(l);
|
|
1940
1978
|
break;
|
|
1941
1979
|
}
|
|
1942
1980
|
case "link": {
|
|
1943
|
-
n += e.link(
|
|
1981
|
+
n += e.link(l);
|
|
1944
1982
|
break;
|
|
1945
1983
|
}
|
|
1946
1984
|
case "image": {
|
|
1947
|
-
n += e.image(
|
|
1985
|
+
n += e.image(l);
|
|
1948
1986
|
break;
|
|
1949
1987
|
}
|
|
1950
1988
|
case "checkbox": {
|
|
1951
|
-
n += e.checkbox(
|
|
1989
|
+
n += e.checkbox(l);
|
|
1952
1990
|
break;
|
|
1953
1991
|
}
|
|
1954
1992
|
case "strong": {
|
|
1955
|
-
n += e.strong(
|
|
1993
|
+
n += e.strong(l);
|
|
1956
1994
|
break;
|
|
1957
1995
|
}
|
|
1958
1996
|
case "em": {
|
|
1959
|
-
n += e.em(
|
|
1997
|
+
n += e.em(l);
|
|
1960
1998
|
break;
|
|
1961
1999
|
}
|
|
1962
2000
|
case "codespan": {
|
|
1963
|
-
n += e.codespan(
|
|
2001
|
+
n += e.codespan(l);
|
|
1964
2002
|
break;
|
|
1965
2003
|
}
|
|
1966
2004
|
case "br": {
|
|
1967
|
-
n += e.br(
|
|
2005
|
+
n += e.br(l);
|
|
1968
2006
|
break;
|
|
1969
2007
|
}
|
|
1970
2008
|
case "del": {
|
|
1971
|
-
n += e.del(
|
|
2009
|
+
n += e.del(l);
|
|
1972
2010
|
break;
|
|
1973
2011
|
}
|
|
1974
2012
|
case "text": {
|
|
1975
|
-
n += e.text(
|
|
2013
|
+
n += e.text(l);
|
|
1976
2014
|
break;
|
|
1977
2015
|
}
|
|
1978
2016
|
default: {
|
|
1979
|
-
let o = 'Token with "' +
|
|
2017
|
+
let o = 'Token with "' + l.type + '" type was not found.';
|
|
1980
2018
|
if (this.options.silent) return console.error(o), "";
|
|
1981
2019
|
throw new Error(o);
|
|
1982
2020
|
}
|
|
@@ -1984,11 +2022,11 @@ ${t}</tr>
|
|
|
1984
2022
|
}
|
|
1985
2023
|
return n;
|
|
1986
2024
|
}
|
|
1987
|
-
},
|
|
2025
|
+
}, h(Ee, "u"), Ee), Se, ot = (Se = class {
|
|
1988
2026
|
constructor(t) {
|
|
1989
2027
|
D(this, "options");
|
|
1990
2028
|
D(this, "block");
|
|
1991
|
-
this.options = t ||
|
|
2029
|
+
this.options = t || Oe;
|
|
1992
2030
|
}
|
|
1993
2031
|
preprocess(t) {
|
|
1994
2032
|
return t;
|
|
@@ -2003,23 +2041,23 @@ ${t}</tr>
|
|
|
2003
2041
|
return t;
|
|
2004
2042
|
}
|
|
2005
2043
|
provideLexer(t = this.block) {
|
|
2006
|
-
return t ?
|
|
2044
|
+
return t ? fe.lex : fe.lexInline;
|
|
2007
2045
|
}
|
|
2008
2046
|
provideParser(t = this.block) {
|
|
2009
|
-
return t ?
|
|
2047
|
+
return t ? ge.parse : ge.parseInline;
|
|
2010
2048
|
}
|
|
2011
|
-
},
|
|
2049
|
+
}, h(Se, "P"), D(Se, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), D(Se, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Se), We, si = (We = class {
|
|
2012
2050
|
constructor(...t) {
|
|
2013
|
-
D(this, "defaults",
|
|
2051
|
+
D(this, "defaults", sn());
|
|
2014
2052
|
D(this, "options", this.setOptions);
|
|
2015
2053
|
D(this, "parse", this.parseMarkdown(!0));
|
|
2016
2054
|
D(this, "parseInline", this.parseMarkdown(!1));
|
|
2017
|
-
D(this, "Parser",
|
|
2055
|
+
D(this, "Parser", ge);
|
|
2018
2056
|
D(this, "Renderer", Et);
|
|
2019
|
-
D(this, "TextRenderer",
|
|
2020
|
-
D(this, "Lexer",
|
|
2057
|
+
D(this, "TextRenderer", pn);
|
|
2058
|
+
D(this, "Lexer", fe);
|
|
2021
2059
|
D(this, "Tokenizer", At);
|
|
2022
|
-
D(this, "Hooks",
|
|
2060
|
+
D(this, "Hooks", ot);
|
|
2023
2061
|
this.use(...t);
|
|
2024
2062
|
}
|
|
2025
2063
|
walkTokens(t, e) {
|
|
@@ -2027,8 +2065,8 @@ ${t}</tr>
|
|
|
2027
2065
|
for (let s of t) switch (n = n.concat(e.call(this, s)), s.type) {
|
|
2028
2066
|
case "table": {
|
|
2029
2067
|
let r = s;
|
|
2030
|
-
for (let
|
|
2031
|
-
for (let
|
|
2068
|
+
for (let l of r.header) n = n.concat(this.walkTokens(l.tokens, e));
|
|
2069
|
+
for (let l of r.rows) for (let o of l) n = n.concat(this.walkTokens(o.tokens, e));
|
|
2032
2070
|
break;
|
|
2033
2071
|
}
|
|
2034
2072
|
case "list": {
|
|
@@ -2038,8 +2076,8 @@ ${t}</tr>
|
|
|
2038
2076
|
}
|
|
2039
2077
|
default: {
|
|
2040
2078
|
let r = s;
|
|
2041
|
-
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((
|
|
2042
|
-
let o = r[
|
|
2079
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((l) => {
|
|
2080
|
+
let o = r[l].flat(1 / 0);
|
|
2043
2081
|
n = n.concat(this.walkTokens(o, e));
|
|
2044
2082
|
}) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, e)));
|
|
2045
2083
|
}
|
|
@@ -2053,24 +2091,24 @@ ${t}</tr>
|
|
|
2053
2091
|
if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
|
|
2054
2092
|
if (!r.name) throw new Error("extension name required");
|
|
2055
2093
|
if ("renderer" in r) {
|
|
2056
|
-
let
|
|
2057
|
-
|
|
2094
|
+
let l = e.renderers[r.name];
|
|
2095
|
+
l ? e.renderers[r.name] = function(...o) {
|
|
2058
2096
|
let c = r.renderer.apply(this, o);
|
|
2059
|
-
return c === !1 && (c =
|
|
2097
|
+
return c === !1 && (c = l.apply(this, o)), c;
|
|
2060
2098
|
} : e.renderers[r.name] = r.renderer;
|
|
2061
2099
|
}
|
|
2062
2100
|
if ("tokenizer" in r) {
|
|
2063
2101
|
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
2064
|
-
let
|
|
2065
|
-
|
|
2102
|
+
let l = e[r.level];
|
|
2103
|
+
l ? l.unshift(r.tokenizer) : e[r.level] = [r.tokenizer], r.start && (r.level === "block" ? e.startBlock ? e.startBlock.push(r.start) : e.startBlock = [r.start] : r.level === "inline" && (e.startInline ? e.startInline.push(r.start) : e.startInline = [r.start]));
|
|
2066
2104
|
}
|
|
2067
2105
|
"childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
|
|
2068
2106
|
}), s.extensions = e), n.renderer) {
|
|
2069
2107
|
let r = this.defaults.renderer || new Et(this.defaults);
|
|
2070
|
-
for (let
|
|
2071
|
-
if (!(
|
|
2072
|
-
if (["options", "parser"].includes(
|
|
2073
|
-
let o =
|
|
2108
|
+
for (let l in n.renderer) {
|
|
2109
|
+
if (!(l in r)) throw new Error(`renderer '${l}' does not exist`);
|
|
2110
|
+
if (["options", "parser"].includes(l)) continue;
|
|
2111
|
+
let o = l, c = n.renderer[o], p = r[o];
|
|
2074
2112
|
r[o] = (...g) => {
|
|
2075
2113
|
let d = c.apply(r, g);
|
|
2076
2114
|
return d === !1 && (d = p.apply(r, g)), d || "";
|
|
@@ -2080,10 +2118,10 @@ ${t}</tr>
|
|
|
2080
2118
|
}
|
|
2081
2119
|
if (n.tokenizer) {
|
|
2082
2120
|
let r = this.defaults.tokenizer || new At(this.defaults);
|
|
2083
|
-
for (let
|
|
2084
|
-
if (!(
|
|
2085
|
-
if (["options", "rules", "lexer"].includes(
|
|
2086
|
-
let o =
|
|
2121
|
+
for (let l in n.tokenizer) {
|
|
2122
|
+
if (!(l in r)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
2123
|
+
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
2124
|
+
let o = l, c = n.tokenizer[o], p = r[o];
|
|
2087
2125
|
r[o] = (...g) => {
|
|
2088
2126
|
let d = c.apply(r, g);
|
|
2089
2127
|
return d === !1 && (d = p.apply(r, g)), d;
|
|
@@ -2092,13 +2130,13 @@ ${t}</tr>
|
|
|
2092
2130
|
s.tokenizer = r;
|
|
2093
2131
|
}
|
|
2094
2132
|
if (n.hooks) {
|
|
2095
|
-
let r = this.defaults.hooks || new
|
|
2096
|
-
for (let
|
|
2097
|
-
if (!(
|
|
2098
|
-
if (["options", "block"].includes(
|
|
2099
|
-
let o =
|
|
2100
|
-
|
|
2101
|
-
if (this.defaults.async &&
|
|
2133
|
+
let r = this.defaults.hooks || new ot();
|
|
2134
|
+
for (let l in n.hooks) {
|
|
2135
|
+
if (!(l in r)) throw new Error(`hook '${l}' does not exist`);
|
|
2136
|
+
if (["options", "block"].includes(l)) continue;
|
|
2137
|
+
let o = l, c = n.hooks[o], p = r[o];
|
|
2138
|
+
ot.passThroughHooks.has(l) ? r[o] = (g) => {
|
|
2139
|
+
if (this.defaults.async && ot.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
2102
2140
|
let f = await c.call(r, g);
|
|
2103
2141
|
return p.call(r, f);
|
|
2104
2142
|
})();
|
|
@@ -2116,10 +2154,10 @@ ${t}</tr>
|
|
|
2116
2154
|
s.hooks = r;
|
|
2117
2155
|
}
|
|
2118
2156
|
if (n.walkTokens) {
|
|
2119
|
-
let r = this.defaults.walkTokens,
|
|
2157
|
+
let r = this.defaults.walkTokens, l = n.walkTokens;
|
|
2120
2158
|
s.walkTokens = function(o) {
|
|
2121
2159
|
let c = [];
|
|
2122
|
-
return c.push(
|
|
2160
|
+
return c.push(l.call(this, o)), r && (c = c.concat(r.call(this, o))), c;
|
|
2123
2161
|
};
|
|
2124
2162
|
}
|
|
2125
2163
|
this.defaults = { ...this.defaults, ...s };
|
|
@@ -2129,31 +2167,31 @@ ${t}</tr>
|
|
|
2129
2167
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2130
2168
|
}
|
|
2131
2169
|
lexer(t, e) {
|
|
2132
|
-
return
|
|
2170
|
+
return fe.lex(t, e ?? this.defaults);
|
|
2133
2171
|
}
|
|
2134
2172
|
parser(t, e) {
|
|
2135
|
-
return
|
|
2173
|
+
return ge.parse(t, e ?? this.defaults);
|
|
2136
2174
|
}
|
|
2137
2175
|
parseMarkdown(t) {
|
|
2138
2176
|
return (e, n) => {
|
|
2139
|
-
let s = { ...n }, r = { ...this.defaults, ...s },
|
|
2140
|
-
if (this.defaults.async === !0 && s.async === !1) return
|
|
2141
|
-
if (typeof e > "u" || e === null) return
|
|
2142
|
-
if (typeof e != "string") return
|
|
2177
|
+
let s = { ...n }, r = { ...this.defaults, ...s }, l = this.onError(!!r.silent, !!r.async);
|
|
2178
|
+
if (this.defaults.async === !0 && s.async === !1) return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
2179
|
+
if (typeof e > "u" || e === null) return l(new Error("marked(): input parameter is undefined or null"));
|
|
2180
|
+
if (typeof e != "string") return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2143
2181
|
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
2144
|
-
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ?
|
|
2182
|
+
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ? fe.lex : fe.lexInline)(o, r), p = r.hooks ? await r.hooks.processAllTokens(c) : c;
|
|
2145
2183
|
r.walkTokens && await Promise.all(this.walkTokens(p, r.walkTokens));
|
|
2146
|
-
let g = await (r.hooks ? await r.hooks.provideParser(t) : t ?
|
|
2184
|
+
let g = await (r.hooks ? await r.hooks.provideParser(t) : t ? ge.parse : ge.parseInline)(p, r);
|
|
2147
2185
|
return r.hooks ? await r.hooks.postprocess(g) : g;
|
|
2148
|
-
})().catch(
|
|
2186
|
+
})().catch(l);
|
|
2149
2187
|
try {
|
|
2150
2188
|
r.hooks && (e = r.hooks.preprocess(e));
|
|
2151
|
-
let o = (r.hooks ? r.hooks.provideLexer(t) : t ?
|
|
2189
|
+
let o = (r.hooks ? r.hooks.provideLexer(t) : t ? fe.lex : fe.lexInline)(e, r);
|
|
2152
2190
|
r.hooks && (o = r.hooks.processAllTokens(o)), r.walkTokens && this.walkTokens(o, r.walkTokens);
|
|
2153
|
-
let c = (r.hooks ? r.hooks.provideParser(t) : t ?
|
|
2191
|
+
let c = (r.hooks ? r.hooks.provideParser(t) : t ? ge.parse : ge.parseInline)(o, r);
|
|
2154
2192
|
return r.hooks && (c = r.hooks.postprocess(c)), c;
|
|
2155
2193
|
} catch (o) {
|
|
2156
|
-
return
|
|
2194
|
+
return l(o);
|
|
2157
2195
|
}
|
|
2158
2196
|
};
|
|
2159
2197
|
}
|
|
@@ -2161,80 +2199,80 @@ ${t}</tr>
|
|
|
2161
2199
|
return (n) => {
|
|
2162
2200
|
if (n.message += `
|
|
2163
2201
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2164
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
2202
|
+
let s = "<p>An error occurred:</p><pre>" + ke(n.message + "", !0) + "</pre>";
|
|
2165
2203
|
return e ? Promise.resolve(s) : s;
|
|
2166
2204
|
}
|
|
2167
2205
|
if (e) return Promise.reject(n);
|
|
2168
2206
|
throw n;
|
|
2169
2207
|
};
|
|
2170
2208
|
}
|
|
2171
|
-
},
|
|
2172
|
-
function M(
|
|
2173
|
-
return
|
|
2209
|
+
}, h(We, "D"), We), Me = new si();
|
|
2210
|
+
function M(a, t) {
|
|
2211
|
+
return Me.parse(a, t);
|
|
2174
2212
|
}
|
|
2175
|
-
|
|
2176
|
-
M.options = M.setOptions = function(
|
|
2177
|
-
return
|
|
2213
|
+
h(M, "g");
|
|
2214
|
+
M.options = M.setOptions = function(a) {
|
|
2215
|
+
return Me.setOptions(a), M.defaults = Me.defaults, cs(M.defaults), M;
|
|
2178
2216
|
};
|
|
2179
|
-
M.getDefaults =
|
|
2180
|
-
M.defaults =
|
|
2181
|
-
M.use = function(...
|
|
2182
|
-
return
|
|
2217
|
+
M.getDefaults = sn;
|
|
2218
|
+
M.defaults = Oe;
|
|
2219
|
+
M.use = function(...a) {
|
|
2220
|
+
return Me.use(...a), M.defaults = Me.defaults, cs(M.defaults), M;
|
|
2183
2221
|
};
|
|
2184
|
-
M.walkTokens = function(
|
|
2185
|
-
return
|
|
2222
|
+
M.walkTokens = function(a, t) {
|
|
2223
|
+
return Me.walkTokens(a, t);
|
|
2186
2224
|
};
|
|
2187
|
-
M.parseInline =
|
|
2188
|
-
M.Parser =
|
|
2189
|
-
M.parser =
|
|
2225
|
+
M.parseInline = Me.parseInline;
|
|
2226
|
+
M.Parser = ge;
|
|
2227
|
+
M.parser = ge.parse;
|
|
2190
2228
|
M.Renderer = Et;
|
|
2191
|
-
M.TextRenderer =
|
|
2192
|
-
M.Lexer =
|
|
2193
|
-
M.lexer =
|
|
2229
|
+
M.TextRenderer = pn;
|
|
2230
|
+
M.Lexer = fe;
|
|
2231
|
+
M.lexer = fe.lex;
|
|
2194
2232
|
M.Tokenizer = At;
|
|
2195
|
-
M.Hooks =
|
|
2233
|
+
M.Hooks = ot;
|
|
2196
2234
|
M.parse = M;
|
|
2197
2235
|
M.options;
|
|
2198
2236
|
M.setOptions;
|
|
2199
2237
|
M.use;
|
|
2200
2238
|
M.walkTokens;
|
|
2201
2239
|
M.parseInline;
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
const
|
|
2240
|
+
ge.parse;
|
|
2241
|
+
fe.lex;
|
|
2242
|
+
const ri = { class: "@container/chat flex flex-col h-full relative" }, ii = {
|
|
2205
2243
|
key: 0,
|
|
2206
2244
|
class: "pb-4"
|
|
2207
|
-
},
|
|
2245
|
+
}, ai = {
|
|
2208
2246
|
key: 0,
|
|
2209
2247
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2210
|
-
},
|
|
2248
|
+
}, li = { class: "relative mb-4 size-20 @sm/chat:size-24" }, oi = ["src", "alt"], ci = {
|
|
2211
2249
|
key: 0,
|
|
2212
2250
|
class: "mt-5 flex flex-col items-stretch gap-2 w-full max-w-xs"
|
|
2213
|
-
},
|
|
2251
|
+
}, ui = ["onClick"], hi = ["title"], pi = {
|
|
2214
2252
|
key: 1,
|
|
2215
2253
|
class: "flex justify-end px-2 pb-2"
|
|
2216
|
-
},
|
|
2254
|
+
}, di = {
|
|
2217
2255
|
key: 0,
|
|
2218
2256
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2219
|
-
},
|
|
2257
|
+
}, fi = ["data-issue-code", "data-issue-bucket"], gi = { class: "flex flex-col gap-1 min-w-0" }, mi = ["href"], bi = ["data-test"], xi = {
|
|
2220
2258
|
key: 0,
|
|
2221
2259
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2222
|
-
},
|
|
2260
|
+
}, ki = ["src", "alt"], wi = ["src", "alt"], yi = ["src"], vi = ["href"], Ti = ["innerHTML"], Si = {
|
|
2223
2261
|
key: 2,
|
|
2224
2262
|
class: "flex gap-2 justify-start items-center mb-4"
|
|
2225
|
-
},
|
|
2263
|
+
}, Ai = ["src", "alt"], Ei = {
|
|
2226
2264
|
key: 0,
|
|
2227
2265
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
2228
|
-
},
|
|
2266
|
+
}, _i = ["src", "alt"], Ri = { class: "max-w-20 truncate" }, Ii = ["onClick"], Di = {
|
|
2229
2267
|
key: 0,
|
|
2230
2268
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
2231
|
-
},
|
|
2269
|
+
}, Ci = ["disabled"], Mi = {
|
|
2232
2270
|
key: 0,
|
|
2233
2271
|
class: "i-svg-spinners-ring-resize size-4"
|
|
2234
|
-
},
|
|
2272
|
+
}, Li = {
|
|
2235
2273
|
key: 1,
|
|
2236
2274
|
class: "i-tabler-paperclip size-5"
|
|
2237
|
-
},
|
|
2275
|
+
}, Oi = ["placeholder", "disabled"], zi = ["disabled"], Vi = /* @__PURE__ */ Le({
|
|
2238
2276
|
__name: "ElAgentChat",
|
|
2239
2277
|
props: {
|
|
2240
2278
|
chatController: {},
|
|
@@ -2247,25 +2285,25 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2247
2285
|
emptyStateMessage: {},
|
|
2248
2286
|
starterPrompts: {}
|
|
2249
2287
|
},
|
|
2250
|
-
setup(
|
|
2288
|
+
setup(a) {
|
|
2251
2289
|
const t = new M.Renderer();
|
|
2252
|
-
t.link = ({ href: _, text:
|
|
2253
|
-
let
|
|
2290
|
+
t.link = ({ href: _, text: x }) => {
|
|
2291
|
+
let b = !1;
|
|
2254
2292
|
if (typeof window < "u")
|
|
2255
2293
|
try {
|
|
2256
|
-
|
|
2294
|
+
b = new URL(_, window.location.href).origin === window.location.origin;
|
|
2257
2295
|
} catch {
|
|
2258
|
-
|
|
2296
|
+
b = !1;
|
|
2259
2297
|
}
|
|
2260
|
-
return
|
|
2298
|
+
return b ? `<a href="${_}">${x}</a>` : `<a href="${_}" target="_blank" rel="noopener noreferrer">${x}</a>`;
|
|
2261
2299
|
}, M.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2262
2300
|
function e(_) {
|
|
2263
2301
|
if (!_)
|
|
2264
2302
|
return "";
|
|
2265
|
-
const
|
|
2266
|
-
return
|
|
2303
|
+
const x = M.parse(_, { async: !1 });
|
|
2304
|
+
return mr.sanitize(x, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2267
2305
|
}
|
|
2268
|
-
|
|
2306
|
+
h(e, "renderMarkdown");
|
|
2269
2307
|
const n = {
|
|
2270
2308
|
private: "",
|
|
2271
2309
|
org: "",
|
|
@@ -2278,413 +2316,413 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2278
2316
|
"Brief me on tomorrow",
|
|
2279
2317
|
"Triage my inbox",
|
|
2280
2318
|
"What's on my plate this week"
|
|
2281
|
-
],
|
|
2282
|
-
() =>
|
|
2283
|
-
), o =
|
|
2284
|
-
const _ = { ...s[
|
|
2285
|
-
return
|
|
2286
|
-
}), p =
|
|
2287
|
-
function
|
|
2288
|
-
const
|
|
2289
|
-
return !L || L.sender !==
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
const U =
|
|
2293
|
-
() =>
|
|
2294
|
-
),
|
|
2295
|
-
|
|
2296
|
-
if (
|
|
2319
|
+
], l = G(
|
|
2320
|
+
() => a.starterPrompts ?? r
|
|
2321
|
+
), o = G(() => a.setupHint ?? n[a.scope]), c = G(() => {
|
|
2322
|
+
const _ = { ...s[a.scope] };
|
|
2323
|
+
return a.scope === "org" && a.scopeName && (_.label = a.scopeName, _.tooltip = `Visible to ${a.scopeName} members`), _;
|
|
2324
|
+
}), p = ee(""), g = ee(!1), d = ee(), f = ee(), m = ee(), w = ee([]), E = ee(!1);
|
|
2325
|
+
function O(_, x) {
|
|
2326
|
+
const b = _[x], L = _[x + 1];
|
|
2327
|
+
return !L || L.sender !== b.sender;
|
|
2328
|
+
}
|
|
2329
|
+
h(O, "shouldShowAvatar");
|
|
2330
|
+
const U = G(() => a.chatController?.textState.value), ae = G(() => U.value?.isConnected ?? !1), le = G(() => U.value?.isThinking ?? !1), z = G(() => U.value?.connectionStatus === "disconnected" && !!U.value?.error), oe = G(() => U.value?.connectionStatus !== "connected" && !U.value?.error), me = G(() => U.value?.error), V = G(() => a.chatController?.sharedMessages.value ?? []), ht = G(() => U.value?.accountGated ?? !1), _e = G(() => !ae.value || ht.value), It = G(() => z.value ? "Agent is offline" : oe.value ? "Connecting..." : ht.value ? "Resolve the billing issue above to continue" : "Message"), Y = G(() => (p.value.trim() || w.value.length > 0) && !_e.value && !E.value), I = G(() => a.variant === "light"), Re = G(
|
|
2331
|
+
() => I.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2332
|
+
), ve = G(() => I.value ? "text-theme-300" : "text-white/30");
|
|
2333
|
+
nn(async () => {
|
|
2334
|
+
if (a.chatController && !ae.value)
|
|
2297
2335
|
try {
|
|
2298
|
-
await
|
|
2336
|
+
await a.chatController.startTextConversation();
|
|
2299
2337
|
} catch (_) {
|
|
2300
2338
|
console.error("Failed to start text conversation:", _);
|
|
2301
2339
|
}
|
|
2302
2340
|
});
|
|
2303
2341
|
function Dt() {
|
|
2304
|
-
|
|
2342
|
+
a.chatController?.newConversation();
|
|
2305
2343
|
}
|
|
2306
|
-
|
|
2307
|
-
async function
|
|
2308
|
-
const _ = p.value.trim(),
|
|
2309
|
-
if (!_ && !
|
|
2344
|
+
h(Dt, "startNewConversation");
|
|
2345
|
+
async function Ve() {
|
|
2346
|
+
const _ = p.value.trim(), x = w.value.length > 0;
|
|
2347
|
+
if (!_ && !x || !a.chatController || !ae.value || E.value)
|
|
2310
2348
|
return;
|
|
2311
|
-
const
|
|
2349
|
+
const b = p.value, L = x ? [...w.value] : void 0;
|
|
2312
2350
|
p.value = "", w.value = [], f.value && (f.value.style.height = "auto", f.value.focus());
|
|
2313
2351
|
try {
|
|
2314
|
-
await
|
|
2315
|
-
} catch (
|
|
2316
|
-
console.error("Error sending message:",
|
|
2352
|
+
await a.chatController.sendChatMessage(b, L), dt();
|
|
2353
|
+
} catch (Z) {
|
|
2354
|
+
console.error("Error sending message:", Z);
|
|
2317
2355
|
}
|
|
2318
2356
|
}
|
|
2319
|
-
|
|
2320
|
-
function
|
|
2321
|
-
|
|
2357
|
+
h(Ve, "sendMessage");
|
|
2358
|
+
function Ct(_) {
|
|
2359
|
+
_e.value || (p.value = _, Ve());
|
|
2322
2360
|
}
|
|
2323
|
-
|
|
2324
|
-
function
|
|
2325
|
-
_.key === "Enter" && !_.shiftKey && (_.preventDefault(),
|
|
2361
|
+
h(Ct, "sendStarterPrompt");
|
|
2362
|
+
function pt(_) {
|
|
2363
|
+
_.key === "Enter" && !_.shiftKey && (_.preventDefault(), Ve());
|
|
2326
2364
|
}
|
|
2327
|
-
|
|
2328
|
-
function
|
|
2329
|
-
d.value &&
|
|
2365
|
+
h(pt, "handleKeydown");
|
|
2366
|
+
function dt() {
|
|
2367
|
+
d.value && Wt(() => {
|
|
2330
2368
|
d.value.scrollTop = d.value.scrollHeight;
|
|
2331
2369
|
});
|
|
2332
2370
|
}
|
|
2333
|
-
|
|
2334
|
-
function
|
|
2371
|
+
h(dt, "scrollToBottom");
|
|
2372
|
+
function ft() {
|
|
2335
2373
|
f.value && (f.value.style.height = "auto", f.value.style.height = `${Math.min(f.value.scrollHeight, 150)}px`);
|
|
2336
2374
|
}
|
|
2337
|
-
|
|
2338
|
-
function
|
|
2375
|
+
h(ft, "adjustTextareaHeight"), ct(p, () => Wt(() => ft()));
|
|
2376
|
+
function F() {
|
|
2339
2377
|
m.value?.click();
|
|
2340
2378
|
}
|
|
2341
|
-
|
|
2342
|
-
async function
|
|
2343
|
-
const
|
|
2344
|
-
if (!(!
|
|
2379
|
+
h(F, "triggerFileInput");
|
|
2380
|
+
async function gt(_) {
|
|
2381
|
+
const x = _.target, b = x.files?.[0];
|
|
2382
|
+
if (!(!b || !a.uploadFn)) {
|
|
2345
2383
|
E.value = !0;
|
|
2346
2384
|
try {
|
|
2347
|
-
const L = await
|
|
2385
|
+
const L = await a.uploadFn(b);
|
|
2348
2386
|
w.value = [...w.value, L];
|
|
2349
2387
|
} catch (L) {
|
|
2350
2388
|
console.error("Upload failed:", L);
|
|
2351
2389
|
} finally {
|
|
2352
|
-
E.value = !1,
|
|
2390
|
+
E.value = !1, x.value = "";
|
|
2353
2391
|
}
|
|
2354
2392
|
}
|
|
2355
2393
|
}
|
|
2356
|
-
|
|
2357
|
-
function
|
|
2358
|
-
w.value = w.value.filter((
|
|
2394
|
+
h(gt, "handleFileSelect");
|
|
2395
|
+
function W(_) {
|
|
2396
|
+
w.value = w.value.filter((x, b) => b !== _);
|
|
2359
2397
|
}
|
|
2360
|
-
|
|
2361
|
-
function
|
|
2362
|
-
if (
|
|
2363
|
-
const
|
|
2364
|
-
return
|
|
2398
|
+
h(W, "removeAttachment");
|
|
2399
|
+
function Ye(_, x) {
|
|
2400
|
+
if (x === 0) {
|
|
2401
|
+
const he = _[x];
|
|
2402
|
+
return he?.timestamp ? P(new Date(he.timestamp)) : null;
|
|
2365
2403
|
}
|
|
2366
|
-
const
|
|
2367
|
-
if (!
|
|
2368
|
-
const
|
|
2369
|
-
return new Date(L.timestamp).getTime() -
|
|
2404
|
+
const b = _[x - 1], L = _[x];
|
|
2405
|
+
if (!b?.timestamp || !L?.timestamp) return null;
|
|
2406
|
+
const Z = new Date(b.timestamp).getTime();
|
|
2407
|
+
return new Date(L.timestamp).getTime() - Z > 36e5 ? P(new Date(L.timestamp)) : null;
|
|
2370
2408
|
}
|
|
2371
|
-
|
|
2409
|
+
h(Ye, "shouldShowTimeDivider");
|
|
2372
2410
|
function P(_) {
|
|
2373
|
-
const
|
|
2411
|
+
const x = /* @__PURE__ */ new Date(), b = _.toDateString() === x.toDateString(), L = new Date(x);
|
|
2374
2412
|
L.setDate(L.getDate() - 1);
|
|
2375
|
-
const
|
|
2376
|
-
if (
|
|
2377
|
-
if (
|
|
2378
|
-
const
|
|
2413
|
+
const Z = _.toDateString() === L.toDateString(), we = _.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2414
|
+
if (b) return we;
|
|
2415
|
+
if (Z) return `Yesterday, ${we}`;
|
|
2416
|
+
const Ze = _.getFullYear() === x.getFullYear();
|
|
2379
2417
|
return `${_.toLocaleDateString("en-US", {
|
|
2380
2418
|
weekday: "long",
|
|
2381
2419
|
month: "short",
|
|
2382
2420
|
day: "numeric",
|
|
2383
|
-
...
|
|
2384
|
-
})}, ${
|
|
2385
|
-
}
|
|
2386
|
-
return
|
|
2387
|
-
_.length > 0 &&
|
|
2388
|
-
}, { immediate: !0, deep: !0 }), (_,
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
agent:
|
|
2392
|
-
"is-online":
|
|
2421
|
+
...Ze ? {} : { year: "numeric" }
|
|
2422
|
+
})}, ${we}`;
|
|
2423
|
+
}
|
|
2424
|
+
return h(P, "formatTimeDivider"), ct(V, (_) => {
|
|
2425
|
+
_.length > 0 && Wt(() => dt());
|
|
2426
|
+
}, { immediate: !0, deep: !0 }), (_, x) => (T(), S("div", ri, [
|
|
2427
|
+
I.value ? B("", !0) : (T(), S("div", ii, [
|
|
2428
|
+
qt(Ws, {
|
|
2429
|
+
agent: a.agent,
|
|
2430
|
+
"is-online": ae.value
|
|
2393
2431
|
}, null, 8, ["agent", "is-online"])
|
|
2394
2432
|
])),
|
|
2395
|
-
|
|
2433
|
+
z.value ? (T(), S("div", {
|
|
2396
2434
|
key: 1,
|
|
2397
|
-
class: A(["py-16 flex flex-col items-center justify-center gap-3 text-sm",
|
|
2435
|
+
class: A(["py-16 flex flex-col items-center justify-center gap-3 text-sm", I.value ? "text-theme-400" : "text-white/60"])
|
|
2398
2436
|
}, [
|
|
2399
|
-
|
|
2400
|
-
class: A(["i-heroicons-cloud-arrow-down size-8",
|
|
2437
|
+
y("i", {
|
|
2438
|
+
class: A(["i-heroicons-cloud-arrow-down size-8", I.value ? "text-theme-300" : "text-white/40"])
|
|
2401
2439
|
}, null, 2),
|
|
2402
|
-
|
|
2403
|
-
], 2)) :
|
|
2440
|
+
y("span", null, ie(me.value), 1)
|
|
2441
|
+
], 2)) : oe.value ? (T(), S("div", {
|
|
2404
2442
|
key: 2,
|
|
2405
|
-
class: A(["py-16 flex flex-col items-center justify-center gap-2 text-sm",
|
|
2443
|
+
class: A(["py-16 flex flex-col items-center justify-center gap-2 text-sm", I.value ? "text-theme-400" : "text-theme-600"])
|
|
2406
2444
|
}, [
|
|
2407
|
-
|
|
2445
|
+
qt(Ln, { class: "size-4" })
|
|
2408
2446
|
], 2)) : o.value ? (T(), S("div", {
|
|
2409
2447
|
key: 3,
|
|
2410
|
-
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]",
|
|
2448
|
+
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]", ve.value])
|
|
2411
2449
|
}, [
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
], 2)) :
|
|
2415
|
-
|
|
2450
|
+
x[6] || (x[6] = y("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2451
|
+
y("span", null, ie(o.value), 1)
|
|
2452
|
+
], 2)) : B("", !0),
|
|
2453
|
+
y("div", {
|
|
2416
2454
|
ref_key: "messagesContainer",
|
|
2417
2455
|
ref: d,
|
|
2418
2456
|
class: "flex-1 overflow-y-auto overflow-x-hidden pt-4 pb-[120px] px-3 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
|
|
2419
2457
|
}, [
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
src:
|
|
2424
|
-
alt:
|
|
2425
|
-
class: A(["size-full rounded-full object-cover ring-1",
|
|
2426
|
-
}, null, 10,
|
|
2427
|
-
|
|
2458
|
+
V.value.length === 0 && !oe.value && !z.value ? (T(), S("div", ai, [
|
|
2459
|
+
y("div", li, [
|
|
2460
|
+
y("img", {
|
|
2461
|
+
src: a.agent.avatarUrl.value,
|
|
2462
|
+
alt: a.agent.displayName.value,
|
|
2463
|
+
class: A(["size-full rounded-full object-cover ring-1", I.value ? "ring-black/5" : "ring-white/10"])
|
|
2464
|
+
}, null, 10, oi),
|
|
2465
|
+
ae.value ? (T(), S("span", {
|
|
2428
2466
|
key: 0,
|
|
2429
|
-
class: A(["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",
|
|
2430
|
-
}, [...
|
|
2431
|
-
|
|
2432
|
-
])], 2)) :
|
|
2467
|
+
class: A(["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", I.value ? "bg-white" : "bg-theme-900"])
|
|
2468
|
+
}, [...x[7] || (x[7] = [
|
|
2469
|
+
y("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2470
|
+
])], 2)) : B("", !0)
|
|
2433
2471
|
]),
|
|
2434
|
-
|
|
2435
|
-
class: A(["text-base @sm/chat:text-lg font-semibold",
|
|
2436
|
-
},
|
|
2437
|
-
|
|
2438
|
-
class: A(["mt-1 text-center text-xs @sm/chat:text-sm",
|
|
2439
|
-
},
|
|
2440
|
-
|
|
2441
|
-
(T(!0), S(
|
|
2442
|
-
key:
|
|
2472
|
+
y("div", {
|
|
2473
|
+
class: A(["text-base @sm/chat:text-lg font-semibold", I.value ? "text-theme-900" : "text-white"])
|
|
2474
|
+
}, ie(a.agent.displayName.value), 3),
|
|
2475
|
+
y("p", {
|
|
2476
|
+
class: A(["mt-1 text-center text-xs @sm/chat:text-sm", ve.value])
|
|
2477
|
+
}, ie(a.emptyStateMessage || "Tap a prompt to get started, or type your own."), 3),
|
|
2478
|
+
l.value.length > 0 && !_e.value ? (T(), S("div", ci, [
|
|
2479
|
+
(T(!0), S(Te, null, at(l.value, (b) => (T(), S("button", {
|
|
2480
|
+
key: b,
|
|
2443
2481
|
type: "button",
|
|
2444
2482
|
"data-test": "chat-starter-prompt",
|
|
2445
|
-
class: A(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer",
|
|
2446
|
-
onClick: /* @__PURE__ */
|
|
2447
|
-
},
|
|
2448
|
-
])) :
|
|
2449
|
-
|
|
2450
|
-
class: A(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]",
|
|
2483
|
+
class: A(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer", I.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"]),
|
|
2484
|
+
onClick: /* @__PURE__ */ h((L) => Ct(b), "onClick")
|
|
2485
|
+
}, ie(b), 11, ui))), 128))
|
|
2486
|
+
])) : B("", !0),
|
|
2487
|
+
y("div", {
|
|
2488
|
+
class: A(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", I.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2451
2489
|
title: c.value.tooltip
|
|
2452
2490
|
}, [
|
|
2453
|
-
|
|
2491
|
+
y("i", {
|
|
2454
2492
|
class: A([c.value.icon, "size-3"])
|
|
2455
2493
|
}, null, 2),
|
|
2456
|
-
|
|
2457
|
-
], 10,
|
|
2458
|
-
])) :
|
|
2459
|
-
|
|
2460
|
-
|
|
2494
|
+
y("span", null, ie(c.value.label), 1)
|
|
2495
|
+
], 10, hi)
|
|
2496
|
+
])) : B("", !0),
|
|
2497
|
+
V.value.length > 0 ? (T(), S("div", pi, [
|
|
2498
|
+
y("button", {
|
|
2461
2499
|
type: "button",
|
|
2462
2500
|
"data-test": "chat-new-session",
|
|
2463
|
-
class: A(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors",
|
|
2501
|
+
class: A(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", I.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2464
2502
|
onClick: Dt
|
|
2465
|
-
}, [...
|
|
2466
|
-
|
|
2467
|
-
|
|
2503
|
+
}, [...x[8] || (x[8] = [
|
|
2504
|
+
y("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2505
|
+
y("span", null, "New chat", -1)
|
|
2468
2506
|
])], 2)
|
|
2469
|
-
])) :
|
|
2470
|
-
(T(!0), S(
|
|
2471
|
-
key:
|
|
2507
|
+
])) : B("", !0),
|
|
2508
|
+
(T(!0), S(Te, null, at(V.value, (b, L) => (T(), S(Te, {
|
|
2509
|
+
key: b.id
|
|
2472
2510
|
}, [
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
class: A(["flex-1 h-px",
|
|
2511
|
+
Ye(V.value, L) ? (T(), S("div", di, [
|
|
2512
|
+
y("div", {
|
|
2513
|
+
class: A(["flex-1 h-px", Re.value])
|
|
2476
2514
|
}, null, 2),
|
|
2477
|
-
|
|
2478
|
-
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase",
|
|
2479
|
-
},
|
|
2480
|
-
|
|
2481
|
-
class: A(["flex-1 h-px",
|
|
2515
|
+
y("span", {
|
|
2516
|
+
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", ve.value])
|
|
2517
|
+
}, ie(Ye(V.value, L)), 3),
|
|
2518
|
+
y("div", {
|
|
2519
|
+
class: A(["flex-1 h-px", Re.value])
|
|
2482
2520
|
}, null, 2)
|
|
2483
|
-
])) :
|
|
2484
|
-
|
|
2521
|
+
])) : B("", !0),
|
|
2522
|
+
b.sender === "system" ? (T(), S("div", {
|
|
2485
2523
|
key: 1,
|
|
2486
2524
|
"data-test": "messaging-system-msg",
|
|
2487
|
-
"data-issue-code":
|
|
2488
|
-
"data-issue-bucket":
|
|
2489
|
-
class: A(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed",
|
|
2525
|
+
"data-issue-code": b.issue?.code,
|
|
2526
|
+
"data-issue-bucket": b.issue?.bucket,
|
|
2527
|
+
class: A(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", I.value ? "text-theme-500" : "text-white/70"])
|
|
2490
2528
|
}, [
|
|
2491
|
-
|
|
2492
|
-
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0",
|
|
2529
|
+
y("i", {
|
|
2530
|
+
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", b.issue?.bucket === "account" ? I.value ? "text-amber-500" : "text-amber-300" : I.value ? "text-red-500" : "text-red-300"])
|
|
2493
2531
|
}, null, 2),
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2532
|
+
y("div", gi, [
|
|
2533
|
+
y("span", null, ie(b.text), 1),
|
|
2534
|
+
b.issue?.help ? (T(), S("span", {
|
|
2497
2535
|
key: 0,
|
|
2498
|
-
class: A(["text-[12px]",
|
|
2499
|
-
},
|
|
2500
|
-
|
|
2536
|
+
class: A(["text-[12px]", I.value ? "text-theme-400" : "text-white/55"])
|
|
2537
|
+
}, ie(b.issue.help), 3)) : B("", !0),
|
|
2538
|
+
b.issue?.actionUrl ? (T(), S("a", {
|
|
2501
2539
|
key: 1,
|
|
2502
|
-
href:
|
|
2540
|
+
href: b.issue.actionUrl,
|
|
2503
2541
|
"data-test": "messaging-system-msg-action",
|
|
2504
|
-
class: A(["text-[12px] font-medium inline-flex items-center gap-1",
|
|
2542
|
+
class: A(["text-[12px] font-medium inline-flex items-center gap-1", I.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2505
2543
|
}, [
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
], 10,
|
|
2544
|
+
Je(ie(b.issue.actionLabel) + " ", 1),
|
|
2545
|
+
x[9] || (x[9] = y("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2546
|
+
], 10, mi)) : B("", !0)
|
|
2509
2547
|
])
|
|
2510
|
-
], 10,
|
|
2548
|
+
], 10, fi)) : (T(), S("div", {
|
|
2511
2549
|
key: 2,
|
|
2512
|
-
"data-test":
|
|
2550
|
+
"data-test": b.sender === "agent" ? "messaging-assistant-msg" : b.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2513
2551
|
class: A(["flex gap-2 items-end", {
|
|
2514
|
-
"justify-end":
|
|
2515
|
-
"justify-start":
|
|
2516
|
-
"mb-4":
|
|
2552
|
+
"justify-end": b.sender === "user",
|
|
2553
|
+
"justify-start": b.sender === "agent",
|
|
2554
|
+
"mb-4": O(V.value, L)
|
|
2517
2555
|
}])
|
|
2518
2556
|
}, [
|
|
2519
|
-
|
|
2520
|
-
|
|
2557
|
+
b.sender === "agent" ? (T(), S("div", xi, [
|
|
2558
|
+
O(V.value, L) ? (T(), S("img", {
|
|
2521
2559
|
key: 0,
|
|
2522
|
-
src:
|
|
2523
|
-
alt:
|
|
2524
|
-
class: A(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm",
|
|
2525
|
-
}, null, 10,
|
|
2526
|
-
])) :
|
|
2527
|
-
|
|
2528
|
-
class: A(
|
|
2560
|
+
src: a.agent.avatarUrl.value,
|
|
2561
|
+
alt: a.agent.displayName.value,
|
|
2562
|
+
class: A(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", I.value ? "ring-1 ring-black/5" : ""])
|
|
2563
|
+
}, null, 10, ki)) : B("", !0)
|
|
2564
|
+
])) : B("", !0),
|
|
2565
|
+
y("div", {
|
|
2566
|
+
class: A(b.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2529
2567
|
}, [
|
|
2530
|
-
|
|
2568
|
+
b.attachments?.length ? (T(), S("div", {
|
|
2531
2569
|
key: 0,
|
|
2532
|
-
class: A(["mb-1 space-y-1",
|
|
2570
|
+
class: A(["mb-1 space-y-1", b.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2533
2571
|
}, [
|
|
2534
|
-
(T(!0), S(
|
|
2535
|
-
|
|
2572
|
+
(T(!0), S(Te, null, at(b.attachments, (Z, we) => (T(), S(Te, { key: we }, [
|
|
2573
|
+
Z.type === "image" ? (T(), S("img", {
|
|
2536
2574
|
key: 0,
|
|
2537
|
-
src:
|
|
2538
|
-
alt:
|
|
2575
|
+
src: Z.url,
|
|
2576
|
+
alt: Z.name,
|
|
2539
2577
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2540
|
-
}, null, 8,
|
|
2578
|
+
}, null, 8, wi)) : Z.type === "audio" ? (T(), S("audio", {
|
|
2541
2579
|
key: 1,
|
|
2542
|
-
src:
|
|
2580
|
+
src: Z.url,
|
|
2543
2581
|
controls: "",
|
|
2544
2582
|
class: "max-w-full"
|
|
2545
|
-
}, null, 8,
|
|
2583
|
+
}, null, 8, yi)) : (T(), S("a", {
|
|
2546
2584
|
key: 2,
|
|
2547
|
-
href:
|
|
2585
|
+
href: Z.url,
|
|
2548
2586
|
target: "_blank",
|
|
2549
2587
|
rel: "noopener",
|
|
2550
|
-
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs",
|
|
2588
|
+
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", I.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2551
2589
|
}, [
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
], 10,
|
|
2590
|
+
x[10] || (x[10] = y("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2591
|
+
Je(" " + ie(Z.name), 1)
|
|
2592
|
+
], 10, vi))
|
|
2555
2593
|
], 64))), 128))
|
|
2556
|
-
], 2)) :
|
|
2557
|
-
|
|
2594
|
+
], 2)) : B("", !0),
|
|
2595
|
+
b.text ? (T(), S("div", {
|
|
2558
2596
|
key: 1,
|
|
2559
2597
|
class: A(["rounded-2xl px-3.5 py-2", [
|
|
2560
|
-
|
|
2598
|
+
b.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : I.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]"
|
|
2561
2599
|
]])
|
|
2562
2600
|
}, [
|
|
2563
|
-
|
|
2564
|
-
class: A(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed",
|
|
2565
|
-
innerHTML: e(
|
|
2566
|
-
onClick:
|
|
2601
|
+
y("div", {
|
|
2602
|
+
class: A(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", b.sender === "user" || !I.value ? "chat-msg-prose-invert" : ""]),
|
|
2603
|
+
innerHTML: e(b.text),
|
|
2604
|
+
onClick: x[0] || (x[0] = _s(() => {
|
|
2567
2605
|
}, ["stop"]))
|
|
2568
|
-
}, null, 10,
|
|
2569
|
-
], 2)) :
|
|
2606
|
+
}, null, 10, Ti)
|
|
2607
|
+
], 2)) : B("", !0)
|
|
2570
2608
|
], 2)
|
|
2571
|
-
], 10,
|
|
2609
|
+
], 10, bi))
|
|
2572
2610
|
], 64))), 128)),
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
src:
|
|
2576
|
-
alt:
|
|
2577
|
-
class: A(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm",
|
|
2578
|
-
}, null, 10,
|
|
2579
|
-
|
|
2580
|
-
class: A(["rounded-2xl px-3.5 py-2.5 flex items-center",
|
|
2611
|
+
le.value ? (T(), S("div", Si, [
|
|
2612
|
+
y("img", {
|
|
2613
|
+
src: a.agent.avatarUrl.value,
|
|
2614
|
+
alt: a.agent.displayName.value,
|
|
2615
|
+
class: A(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", I.value ? "ring-1 ring-black/5" : ""])
|
|
2616
|
+
}, null, 10, Ai),
|
|
2617
|
+
y("div", {
|
|
2618
|
+
class: A(["rounded-2xl px-3.5 py-2.5 flex items-center", I.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2581
2619
|
}, [
|
|
2582
|
-
|
|
2583
|
-
class: A(["i-svg-spinners-3-dots-bounce size-7",
|
|
2620
|
+
y("i", {
|
|
2621
|
+
class: A(["i-svg-spinners-3-dots-bounce size-7", I.value ? "text-theme-400" : "text-white/50"])
|
|
2584
2622
|
}, null, 2)
|
|
2585
2623
|
], 2)
|
|
2586
|
-
])) :
|
|
2624
|
+
])) : B("", !0)
|
|
2587
2625
|
], 512),
|
|
2588
|
-
|
|
2589
|
-
class: A(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3",
|
|
2626
|
+
y("div", {
|
|
2627
|
+
class: A(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", I.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"])
|
|
2590
2628
|
}, [
|
|
2591
|
-
w.value.length > 0 ? (T(), S("div",
|
|
2592
|
-
(T(!0), S(
|
|
2629
|
+
w.value.length > 0 ? (T(), S("div", Ei, [
|
|
2630
|
+
(T(!0), S(Te, null, at(w.value, (b, L) => (T(), S("div", {
|
|
2593
2631
|
key: L,
|
|
2594
2632
|
class: "relative shrink-0 group"
|
|
2595
2633
|
}, [
|
|
2596
|
-
|
|
2634
|
+
b.type === "image" ? (T(), S("img", {
|
|
2597
2635
|
key: 0,
|
|
2598
|
-
src:
|
|
2599
|
-
alt:
|
|
2600
|
-
class: A(["size-14 rounded-xl object-cover border",
|
|
2601
|
-
}, null, 10,
|
|
2636
|
+
src: b.url,
|
|
2637
|
+
alt: b.name,
|
|
2638
|
+
class: A(["size-14 rounded-xl object-cover border", I.value ? "border-black/10" : "border-white/20"])
|
|
2639
|
+
}, null, 10, _i)) : (T(), S("div", {
|
|
2602
2640
|
key: 1,
|
|
2603
|
-
class: A(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border",
|
|
2641
|
+
class: A(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", I.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2604
2642
|
}, [
|
|
2605
|
-
|
|
2606
|
-
|
|
2643
|
+
x[11] || (x[11] = y("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2644
|
+
y("span", Ri, ie(b.name), 1)
|
|
2607
2645
|
], 2)),
|
|
2608
|
-
|
|
2646
|
+
y("button", {
|
|
2609
2647
|
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",
|
|
2610
|
-
onClick: /* @__PURE__ */
|
|
2611
|
-
}, [...
|
|
2612
|
-
|
|
2613
|
-
])], 8,
|
|
2648
|
+
onClick: /* @__PURE__ */ h((Z) => W(L), "onClick")
|
|
2649
|
+
}, [...x[12] || (x[12] = [
|
|
2650
|
+
y("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2651
|
+
])], 8, Ii)
|
|
2614
2652
|
]))), 128)),
|
|
2615
|
-
E.value ? (T(), S("div",
|
|
2616
|
-
|
|
2617
|
-
])) :
|
|
2618
|
-
])) :
|
|
2619
|
-
|
|
2653
|
+
E.value ? (T(), S("div", Di, [
|
|
2654
|
+
qt(Ln, { class: "size-5" })
|
|
2655
|
+
])) : B("", !0)
|
|
2656
|
+
])) : B("", !0),
|
|
2657
|
+
a.uploadFn ? (T(), S("input", {
|
|
2620
2658
|
key: 1,
|
|
2621
2659
|
ref_key: "fileInput",
|
|
2622
2660
|
ref: m,
|
|
2623
2661
|
type: "file",
|
|
2624
2662
|
accept: "image/*,audio/*,video/*",
|
|
2625
2663
|
class: "hidden",
|
|
2626
|
-
onChange:
|
|
2627
|
-
}, null, 544)) :
|
|
2628
|
-
|
|
2629
|
-
class: A(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300",
|
|
2664
|
+
onChange: gt
|
|
2665
|
+
}, null, 544)) : B("", !0),
|
|
2666
|
+
y("div", {
|
|
2667
|
+
class: A(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", I.value ? g.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" : g.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2630
2668
|
}, [
|
|
2631
|
-
|
|
2669
|
+
y("button", {
|
|
2632
2670
|
class: A(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2633
|
-
|
|
2634
|
-
|
|
2671
|
+
a.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2672
|
+
I.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2635
2673
|
E.value ? "opacity-50 pointer-events-none" : ""
|
|
2636
2674
|
]]),
|
|
2637
|
-
disabled:
|
|
2638
|
-
onClick:
|
|
2675
|
+
disabled: _e.value || E.value || !a.uploadFn,
|
|
2676
|
+
onClick: x[1] || (x[1] = (b) => a.uploadFn && F())
|
|
2639
2677
|
}, [
|
|
2640
|
-
E.value ? (T(), S("i",
|
|
2641
|
-
], 10,
|
|
2642
|
-
|
|
2678
|
+
E.value ? (T(), S("i", Mi)) : (T(), S("i", Li))
|
|
2679
|
+
], 10, Ci),
|
|
2680
|
+
ns(y("textarea", {
|
|
2643
2681
|
ref_key: "textarea",
|
|
2644
2682
|
ref: f,
|
|
2645
|
-
"onUpdate:modelValue":
|
|
2683
|
+
"onUpdate:modelValue": x[2] || (x[2] = (b) => p.value = b),
|
|
2646
2684
|
"data-test": "messaging-input",
|
|
2647
2685
|
rows: "1",
|
|
2648
2686
|
enterkeyhint: "send",
|
|
2649
|
-
placeholder:
|
|
2650
|
-
disabled:
|
|
2687
|
+
placeholder: It.value,
|
|
2688
|
+
disabled: _e.value,
|
|
2651
2689
|
style: { fontSize: "16px", resize: "none" },
|
|
2652
|
-
class: A(["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",
|
|
2653
|
-
onKeydown:
|
|
2654
|
-
onFocus:
|
|
2655
|
-
onBlur:
|
|
2656
|
-
}, null, 42,
|
|
2657
|
-
[
|
|
2690
|
+
class: A(["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", I.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2691
|
+
onKeydown: pt,
|
|
2692
|
+
onFocus: x[3] || (x[3] = (b) => g.value = !0),
|
|
2693
|
+
onBlur: x[4] || (x[4] = (b) => g.value = !1)
|
|
2694
|
+
}, null, 42, Oi), [
|
|
2695
|
+
[ss, p.value]
|
|
2658
2696
|
]),
|
|
2659
|
-
|
|
2697
|
+
y("button", {
|
|
2660
2698
|
"data-test": "messaging-send-btn",
|
|
2661
|
-
class: A(["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",
|
|
2662
|
-
disabled: !
|
|
2663
|
-
onClick:
|
|
2664
|
-
}, [...
|
|
2665
|
-
|
|
2666
|
-
])], 10,
|
|
2699
|
+
class: A(["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", Y.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : I.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2700
|
+
disabled: !Y.value,
|
|
2701
|
+
onClick: x[5] || (x[5] = (b) => Ve())
|
|
2702
|
+
}, [...x[13] || (x[13] = [
|
|
2703
|
+
y("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2704
|
+
])], 10, zi)
|
|
2667
2705
|
], 2),
|
|
2668
|
-
|
|
2669
|
-
class: A(["text-[10px] text-center mt-2.5 select-none opacity-70",
|
|
2706
|
+
y("div", {
|
|
2707
|
+
class: A(["text-[10px] text-center mt-2.5 select-none opacity-70", I.value ? "text-theme-400" : "text-white/50"])
|
|
2670
2708
|
}, [
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]",
|
|
2709
|
+
x[14] || (x[14] = Je(" Press ", -1)),
|
|
2710
|
+
y("kbd", {
|
|
2711
|
+
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", I.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2674
2712
|
}, "Enter", 2),
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]",
|
|
2713
|
+
x[15] || (x[15] = Je(" to send, ", -1)),
|
|
2714
|
+
y("kbd", {
|
|
2715
|
+
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", I.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2678
2716
|
}, "Shift+Enter", 2),
|
|
2679
|
-
|
|
2717
|
+
x[16] || (x[16] = Je(" for new line ", -1))
|
|
2680
2718
|
], 2)
|
|
2681
2719
|
], 2)
|
|
2682
2720
|
]));
|
|
2683
2721
|
}
|
|
2684
|
-
}),
|
|
2722
|
+
}), Pi = { class: "agent-wrap" }, Ni = {
|
|
2685
2723
|
key: 0,
|
|
2686
2724
|
class: "flex items-center justify-center h-full"
|
|
2687
|
-
},
|
|
2725
|
+
}, Yi = /* @__PURE__ */ Le({
|
|
2688
2726
|
__name: "AgentWrap",
|
|
2689
2727
|
props: {
|
|
2690
2728
|
sdk: {},
|
|
@@ -2697,12 +2735,12 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2697
2735
|
hasClose: { type: Boolean },
|
|
2698
2736
|
apiBase: {}
|
|
2699
2737
|
},
|
|
2700
|
-
setup(
|
|
2701
|
-
const t =
|
|
2738
|
+
setup(a) {
|
|
2739
|
+
const t = Ds("AgentWrap"), e = a, n = e.sdk || Cs.getInstance({
|
|
2702
2740
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2703
2741
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2704
|
-
}), s =
|
|
2705
|
-
return
|
|
2742
|
+
}), s = ee(!e.agent), r = Rs(e.agent ? new Tt({ config: e.agent }) : void 0), l = ee();
|
|
2743
|
+
return nn(async () => {
|
|
2706
2744
|
if (e.agent) {
|
|
2707
2745
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2708
2746
|
agentId: e.agent.agentId,
|
|
@@ -2711,7 +2749,7 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2711
2749
|
return;
|
|
2712
2750
|
}
|
|
2713
2751
|
if (!e.handle) {
|
|
2714
|
-
|
|
2752
|
+
l.value = "No handle or agent provided", t.warn("AgentWrap mounted without handle or agent", {
|
|
2715
2753
|
propsReceived: {
|
|
2716
2754
|
handle: e.handle,
|
|
2717
2755
|
agent: e.agent,
|
|
@@ -2737,7 +2775,7 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2737
2775
|
properties: {
|
|
2738
2776
|
viewSource: "widget"
|
|
2739
2777
|
}
|
|
2740
|
-
})) : (
|
|
2778
|
+
})) : (l.value = n.error.value || "Agent not found", t.error("Failed to fetch public agent - no data returned", {
|
|
2741
2779
|
handle: e.handle,
|
|
2742
2780
|
sdkError: n.error.value,
|
|
2743
2781
|
sdkState: {
|
|
@@ -2747,7 +2785,7 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2747
2785
|
}
|
|
2748
2786
|
}));
|
|
2749
2787
|
} catch (o) {
|
|
2750
|
-
|
|
2788
|
+
l.value = o instanceof Error ? o.message : "Failed to fetch agent", t.error("Exception while fetching public agent", {
|
|
2751
2789
|
handle: e.handle,
|
|
2752
2790
|
error: o instanceof Error ? {
|
|
2753
2791
|
message: o.message,
|
|
@@ -2764,7 +2802,7 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2764
2802
|
state: {
|
|
2765
2803
|
loading: s.value,
|
|
2766
2804
|
hasAgent: !!r.value,
|
|
2767
|
-
error:
|
|
2805
|
+
error: l.value
|
|
2768
2806
|
},
|
|
2769
2807
|
props: {
|
|
2770
2808
|
handle: e.handle,
|
|
@@ -2778,33 +2816,33 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2778
2816
|
}
|
|
2779
2817
|
});
|
|
2780
2818
|
}
|
|
2781
|
-
}), (o, c) => (T(), S("div",
|
|
2782
|
-
s.value ? (T(), S("div",
|
|
2783
|
-
|
|
2784
|
-
])])) : r.value ?
|
|
2819
|
+
}), (o, c) => (T(), S("div", Pi, [
|
|
2820
|
+
s.value ? (T(), S("div", Ni, [...c[0] || (c[0] = [
|
|
2821
|
+
y("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2822
|
+
])])) : r.value ? ts(o.$slots, "default", {
|
|
2785
2823
|
key: 1,
|
|
2786
|
-
sdk:
|
|
2824
|
+
sdk: Qt(n),
|
|
2787
2825
|
agent: r.value,
|
|
2788
|
-
context:
|
|
2789
|
-
firstMessage:
|
|
2790
|
-
buttonText:
|
|
2791
|
-
buttonIcon:
|
|
2826
|
+
context: a.context,
|
|
2827
|
+
firstMessage: a.firstMessage,
|
|
2828
|
+
buttonText: a.buttonText,
|
|
2829
|
+
buttonIcon: a.buttonIcon,
|
|
2792
2830
|
loading: s.value
|
|
2793
|
-
}) :
|
|
2831
|
+
}) : B("", !0)
|
|
2794
2832
|
]));
|
|
2795
2833
|
}
|
|
2796
2834
|
});
|
|
2797
2835
|
export {
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2836
|
+
On as A,
|
|
2837
|
+
Yi as _,
|
|
2838
|
+
Vi as a,
|
|
2839
|
+
Wi as b,
|
|
2840
|
+
ji as c,
|
|
2841
|
+
qi as d,
|
|
2842
|
+
Ln as e,
|
|
2843
|
+
Ws as f,
|
|
2844
|
+
Hi as g,
|
|
2845
|
+
Pn as h,
|
|
2846
|
+
Gi as p
|
|
2809
2847
|
};
|
|
2810
2848
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|