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