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