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