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