@pagelines/sdk 1.0.397 → 1.0.398
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 +868 -854
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +6 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/index.js +195 -195
- package/dist/index.js.map +1 -1
- package/dist/sdkClient.d.ts +9 -0
- package/dist/widget/composables/useWidgetState.d.ts +9 -0
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (l, t) =>
|
|
4
|
-
var
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as
|
|
7
|
-
import { P as
|
|
8
|
-
const
|
|
1
|
+
var Dn = Object.defineProperty;
|
|
2
|
+
var ws = (l, t, e) => t in l ? Dn(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
|
|
3
|
+
var u = (l, t) => Dn(l, "name", { value: t, configurable: !0 });
|
|
4
|
+
var C = (l, t, e) => ws(l, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as Ee, openBlock as T, createElementBlock as S, createElementVNode as v, normalizeClass as y, ref as Y, watch as Je, computed as W, createCommentVNode as B, renderSlot as Yn, onMounted as Kt, Fragment as Te, renderList as gt, withDirectives as Zn, vModelText as Xn, unref as Vt, toDisplayString as ue, nextTick as Ut, createVNode as Bt, createTextVNode as ht, shallowRef as vs } from "vue";
|
|
6
|
+
import { SettingsObject as ys, Agent as bt, getDefaultAvatarUrl as Kn, createLogger as Ts } from "@pagelines/core";
|
|
7
|
+
import { P as Ss } from "./sdkClient.js";
|
|
8
|
+
const As = { class: "spinner max-w-sm" }, Es = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
},
|
|
11
|
+
}, Cn = /* @__PURE__ */ Ee({
|
|
12
12
|
__name: "FSpinner",
|
|
13
13
|
props: {
|
|
14
14
|
width: { type: String, default: "" },
|
|
15
15
|
colorMode: { type: String, default: "primary" }
|
|
16
16
|
},
|
|
17
17
|
setup(l) {
|
|
18
|
-
return (t, e) => (
|
|
19
|
-
(
|
|
18
|
+
return (t, e) => (T(), S("div", As, [
|
|
19
|
+
(T(), S("svg", Es, [
|
|
20
20
|
v("circle", {
|
|
21
|
-
class:
|
|
21
|
+
class: y([l.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -30,27 +30,27 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
30
30
|
]))
|
|
31
31
|
]));
|
|
32
32
|
}
|
|
33
|
-
}),
|
|
33
|
+
}), _s = [
|
|
34
34
|
{ pattern: /\bNO_REP\w*\b/g, label: "NO_REPLY — bot chose not to respond" },
|
|
35
35
|
{ pattern: /\bHEARTBEAT_OK\b/g, label: "HEARTBEAT_OK — scheduled check, nothing to do" }
|
|
36
|
-
],
|
|
36
|
+
], Rs = 9e4, on = class on extends ys {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
C(this, "isTextMode", !1);
|
|
40
|
+
C(this, "lastMessage", { hash: "", time: 0 });
|
|
41
|
+
C(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
C(this, "conversationId");
|
|
44
|
+
C(this, "textState", Y({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this._agent = e.agent instanceof
|
|
50
|
+
C(this, "agentMode", Y("self"));
|
|
51
|
+
C(this, "sharedMessages", Y([]));
|
|
52
|
+
C(this, "_agent");
|
|
53
|
+
this._agent = e.agent instanceof bt ? e.agent : new bt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -165,39 +165,39 @@ Current User:
|
|
|
165
165
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
166
166
|
const a = `stream-${Date.now()}`;
|
|
167
167
|
let o = !1;
|
|
168
|
-
const c = /* @__PURE__ */ u((
|
|
168
|
+
const c = /* @__PURE__ */ u((m) => {
|
|
169
169
|
o || (o = !0, this.sharedMessages.value = [
|
|
170
170
|
...this.sharedMessages.value,
|
|
171
171
|
{ id: a, text: "", sender: "agent", timestamp: /* @__PURE__ */ new Date() }
|
|
172
172
|
]);
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
}, "onDelta"),
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
let
|
|
179
|
-
for (const O of
|
|
180
|
-
O.pattern.test(
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
}, "onDone"),
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
this.isTransientError(
|
|
189
|
-
}, "onError"), p = /* @__PURE__ */ u((
|
|
190
|
-
this.addMessage(
|
|
173
|
+
const f = this.sharedMessages.value, k = f[f.length - 1];
|
|
174
|
+
k?.id === a && (k.text += m, this.sharedMessages.value = [...f]);
|
|
175
|
+
}, "onDelta"), d = /* @__PURE__ */ u((m) => {
|
|
176
|
+
const f = this.sharedMessages.value, k = f[f.length - 1];
|
|
177
|
+
if (k?.id === a && k.text) {
|
|
178
|
+
let _ = k.text;
|
|
179
|
+
for (const O of _s)
|
|
180
|
+
O.pattern.test(_) && (console.debug(`[chat] filtered directive: ${O.label}`), _ = _.replace(O.pattern, "").trim(), O.pattern.lastIndex = 0);
|
|
181
|
+
_ ? _ !== k.text && (k.text = _, this.sharedMessages.value = [...f]) : this.sharedMessages.value = f.slice(0, -1);
|
|
182
|
+
}
|
|
183
|
+
m && (this.conversationId = m), this.updateState(this.textState, { isThinking: !1 });
|
|
184
|
+
}, "onDone"), g = /* @__PURE__ */ u((m) => {
|
|
185
|
+
const f = this.sharedMessages.value, k = f[f.length - 1];
|
|
186
|
+
k?.id === a && !k.text && (this.sharedMessages.value = f.slice(0, -1));
|
|
187
|
+
const _ = this.mapChatError(m);
|
|
188
|
+
this.isTransientError(m) ? (this.addMessage(_, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(_));
|
|
189
|
+
}, "onError"), p = /* @__PURE__ */ u((m) => {
|
|
190
|
+
this.addMessage(m, "system");
|
|
191
191
|
}, "onStatus");
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const m = s ? s({
|
|
194
194
|
message: e,
|
|
195
195
|
attachments: n,
|
|
196
196
|
conversationId: this.conversationId,
|
|
197
197
|
history: this.buildHistory(),
|
|
198
198
|
onDelta: c,
|
|
199
|
-
onDone:
|
|
200
|
-
onError:
|
|
199
|
+
onDone: d,
|
|
200
|
+
onError: g,
|
|
201
201
|
onStatus: p
|
|
202
202
|
}) : r.chatStream({
|
|
203
203
|
handle: this._agent.handle.value,
|
|
@@ -208,16 +208,16 @@ Current User:
|
|
|
208
208
|
visitorId: r.generateAnonId(),
|
|
209
209
|
context: this.getDynamicSettings().context || void 0,
|
|
210
210
|
onDelta: c,
|
|
211
|
-
onDone:
|
|
212
|
-
onError:
|
|
211
|
+
onDone: d,
|
|
212
|
+
onError: g,
|
|
213
213
|
onStatus: p
|
|
214
214
|
});
|
|
215
215
|
await Promise.race([
|
|
216
|
-
|
|
217
|
-
new Promise((
|
|
216
|
+
m,
|
|
217
|
+
new Promise((f, k) => setTimeout(() => k(new Error("timed out")), Rs))
|
|
218
218
|
]);
|
|
219
|
-
} catch (
|
|
220
|
-
|
|
219
|
+
} catch (m) {
|
|
220
|
+
g(m.message || "Something went wrong");
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
buildHistory() {
|
|
@@ -237,30 +237,30 @@ Current User:
|
|
|
237
237
|
await this.endConversation();
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
-
u(
|
|
241
|
-
let
|
|
242
|
-
function
|
|
240
|
+
u(on, "AgentChatController");
|
|
241
|
+
let In = on;
|
|
242
|
+
function Mn(l) {
|
|
243
243
|
return l ? typeof l == "string" ? l : l.src || "" : "";
|
|
244
244
|
}
|
|
245
|
-
u(
|
|
246
|
-
function
|
|
247
|
-
return
|
|
245
|
+
u(Mn, "getImageSrc");
|
|
246
|
+
function Ai(l) {
|
|
247
|
+
return Mn(l.cover) || Mn(l.avatar) || Kn(l.name);
|
|
248
248
|
}
|
|
249
|
-
u(
|
|
250
|
-
function
|
|
249
|
+
u(Ai, "getAgentAvatarUrl");
|
|
250
|
+
function Ln(l) {
|
|
251
251
|
const t = l.target;
|
|
252
|
-
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src =
|
|
252
|
+
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = Kn());
|
|
253
253
|
}
|
|
254
|
-
u(
|
|
255
|
-
function
|
|
254
|
+
u(Ln, "handleImageError");
|
|
255
|
+
function Ei(l) {
|
|
256
256
|
const { template: t, agent: e } = l;
|
|
257
257
|
return t.replace(/{name}/g, e.name || "Digital Agent").replace(/{title}/g, e.title || "").replace(/{handle}/g, e.handle || "").replace(/{orgName}/g, e.org?.name || "");
|
|
258
258
|
}
|
|
259
|
-
u(
|
|
260
|
-
const
|
|
259
|
+
u(Ei, "parseButtonTemplate");
|
|
260
|
+
const Ds = {
|
|
261
261
|
key: 0,
|
|
262
262
|
class: "absolute inset-0 flex items-center justify-center"
|
|
263
|
-
},
|
|
263
|
+
}, _i = /* @__PURE__ */ Ee({
|
|
264
264
|
__name: "ElAgentButton",
|
|
265
265
|
props: {
|
|
266
266
|
theme: { default: "primary" },
|
|
@@ -284,28 +284,28 @@ const Cs = {
|
|
|
284
284
|
md: "size-4",
|
|
285
285
|
lg: "size-5"
|
|
286
286
|
})[l.size]);
|
|
287
|
-
return (s, r) => (
|
|
288
|
-
class:
|
|
287
|
+
return (s, r) => (T(), S("button", {
|
|
288
|
+
class: y(["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]])
|
|
289
289
|
}, [
|
|
290
|
-
l.loading ? (
|
|
290
|
+
l.loading ? (T(), S("div", Ds, [...r[0] || (r[0] = [
|
|
291
291
|
v("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
292
|
-
])])) :
|
|
292
|
+
])])) : B("", !0),
|
|
293
293
|
v("span", {
|
|
294
|
-
class:
|
|
294
|
+
class: y(["flex items-center gap-2 transition-opacity duration-200", l.loading ? "opacity-0" : "opacity-100"])
|
|
295
295
|
}, [
|
|
296
|
-
l.icon ? (
|
|
296
|
+
l.icon ? (T(), S("i", {
|
|
297
297
|
key: 0,
|
|
298
|
-
class:
|
|
299
|
-
}, null, 2)) :
|
|
300
|
-
|
|
301
|
-
l.iconAfter ? (
|
|
298
|
+
class: y([l.icon, n.value])
|
|
299
|
+
}, null, 2)) : B("", !0),
|
|
300
|
+
Yn(s.$slots, "default"),
|
|
301
|
+
l.iconAfter ? (T(), S("i", {
|
|
302
302
|
key: 1,
|
|
303
|
-
class:
|
|
304
|
-
}, null, 2)) :
|
|
303
|
+
class: y([l.iconAfter, n.value])
|
|
304
|
+
}, null, 2)) : B("", !0)
|
|
305
305
|
], 2)
|
|
306
306
|
], 2));
|
|
307
307
|
}
|
|
308
|
-
}),
|
|
308
|
+
}), Cs = ["value"], Ri = /* @__PURE__ */ Ee({
|
|
309
309
|
__name: "AgentInputEmail",
|
|
310
310
|
props: {
|
|
311
311
|
modelValue: { default: "" }
|
|
@@ -313,7 +313,7 @@ const Cs = {
|
|
|
313
313
|
emits: ["update:modelValue"],
|
|
314
314
|
setup(l, { emit: t }) {
|
|
315
315
|
const e = t;
|
|
316
|
-
return (n, s) => (
|
|
316
|
+
return (n, s) => (T(), S("input", {
|
|
317
317
|
type: "email",
|
|
318
318
|
autocomplete: "email",
|
|
319
319
|
placeholder: "Enter Your Email",
|
|
@@ -321,9 +321,9 @@ const Cs = {
|
|
|
321
321
|
class: "w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-all",
|
|
322
322
|
style: { "font-size": "16px" },
|
|
323
323
|
onInput: s[0] || (s[0] = (r) => e("update:modelValue", r.target.value))
|
|
324
|
-
}, null, 40,
|
|
324
|
+
}, null, 40, Cs));
|
|
325
325
|
}
|
|
326
|
-
}),
|
|
326
|
+
}), Is = { class: "flex gap-1.5 justify-center" }, Ms = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Di = /* @__PURE__ */ Ee({
|
|
327
327
|
__name: "AgentInputOneTimeCode",
|
|
328
328
|
props: {
|
|
329
329
|
modelValue: {},
|
|
@@ -332,8 +332,8 @@ const Cs = {
|
|
|
332
332
|
},
|
|
333
333
|
emits: ["update:modelValue", "autoSubmit"],
|
|
334
334
|
setup(l, { emit: t }) {
|
|
335
|
-
const e = l, n = t, s =
|
|
336
|
-
|
|
335
|
+
const e = l, n = t, s = Y([]), r = Y(Array.from({ length: e.length }).fill("")), a = Y(!1);
|
|
336
|
+
Kt(() => {
|
|
337
337
|
e.modelValue && (r.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && s.value[0]?.focus();
|
|
338
338
|
}), Je(() => e.modelValue, (p) => {
|
|
339
339
|
r.value = p ? p.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
@@ -341,64 +341,64 @@ const Cs = {
|
|
|
341
341
|
const p = r.value.filter(Boolean).join("");
|
|
342
342
|
n("update:modelValue", p), p.length === e.length && n("autoSubmit", p);
|
|
343
343
|
}, { deep: !0 });
|
|
344
|
-
function o(p,
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
r.value =
|
|
344
|
+
function o(p, m) {
|
|
345
|
+
m.preventDefault(), a.value = !0;
|
|
346
|
+
const f = (m.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
347
|
+
if (f.length === e.length)
|
|
348
|
+
r.value = f.split(""), setTimeout(() => {
|
|
349
349
|
s.value[e.length - 1]?.focus(), a.value = !1;
|
|
350
350
|
}, 10);
|
|
351
351
|
else {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}), r.value =
|
|
356
|
-
const
|
|
352
|
+
const k = [...r.value];
|
|
353
|
+
f.split("").slice(0, e.length - p).forEach((O, ee) => {
|
|
354
|
+
k[p + ee] = O;
|
|
355
|
+
}), r.value = k;
|
|
356
|
+
const _ = Math.min(p + f.length, e.length - 1);
|
|
357
357
|
setTimeout(() => {
|
|
358
|
-
s.value[
|
|
358
|
+
s.value[_]?.focus(), a.value = !1;
|
|
359
359
|
}, 10);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
u(o, "onPaste");
|
|
363
|
-
function c(p,
|
|
364
|
-
const
|
|
365
|
-
r.value[p] =
|
|
363
|
+
function c(p, m) {
|
|
364
|
+
const f = m.target.value.slice(-1).replace(/\D/g, "");
|
|
365
|
+
r.value[p] = f, f && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
366
366
|
}
|
|
367
367
|
u(c, "onInput");
|
|
368
|
-
function
|
|
369
|
-
|
|
368
|
+
function d(p, m) {
|
|
369
|
+
m.key === "Backspace" ? (m.preventDefault(), r.value[p] = "", p > 0 && s.value[p - 1]?.focus()) : m.key === "ArrowLeft" && p > 0 ? s.value[p - 1]?.focus() : m.key === "ArrowRight" && p < e.length - 1 && s.value[p + 1]?.focus();
|
|
370
370
|
}
|
|
371
|
-
u(
|
|
372
|
-
function
|
|
371
|
+
u(d, "onKeydown");
|
|
372
|
+
function g(p) {
|
|
373
373
|
if (s.value[p]?.select(), !a.value && r.value[p])
|
|
374
|
-
for (let
|
|
375
|
-
r.value[
|
|
374
|
+
for (let m = p; m < e.length; m++)
|
|
375
|
+
r.value[m] = "";
|
|
376
376
|
}
|
|
377
|
-
return u(
|
|
378
|
-
(
|
|
379
|
-
key:
|
|
377
|
+
return u(g, "onFocus"), (p, m) => (T(), S("div", Is, [
|
|
378
|
+
(T(!0), S(Te, null, gt(l.length, (f) => Zn((T(), S("input", {
|
|
379
|
+
key: f,
|
|
380
380
|
ref_for: !0,
|
|
381
|
-
ref: /* @__PURE__ */ u((
|
|
382
|
-
"onUpdate:modelValue": /* @__PURE__ */ u((
|
|
381
|
+
ref: /* @__PURE__ */ u((k) => s.value[f - 1] = k, "ref"),
|
|
382
|
+
"onUpdate:modelValue": /* @__PURE__ */ u((k) => r.value[f - 1] = k, "onUpdate:modelValue"),
|
|
383
383
|
type: "text",
|
|
384
384
|
inputmode: "numeric",
|
|
385
385
|
autocomplete: "one-time-code",
|
|
386
386
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
387
387
|
style: { "font-size": "16px" },
|
|
388
388
|
maxlength: "1",
|
|
389
|
-
onInput: /* @__PURE__ */ u((
|
|
390
|
-
onKeydown: /* @__PURE__ */ u((
|
|
391
|
-
onPaste: /* @__PURE__ */ u((
|
|
392
|
-
onFocus: /* @__PURE__ */ u((
|
|
393
|
-
}, null, 40,
|
|
394
|
-
[
|
|
389
|
+
onInput: /* @__PURE__ */ u((k) => c(f - 1, k), "onInput"),
|
|
390
|
+
onKeydown: /* @__PURE__ */ u((k) => d(f - 1, k), "onKeydown"),
|
|
391
|
+
onPaste: /* @__PURE__ */ u((k) => o(f - 1, k), "onPaste"),
|
|
392
|
+
onFocus: /* @__PURE__ */ u((k) => g(f - 1), "onFocus")
|
|
393
|
+
}, null, 40, Ms)), [
|
|
394
|
+
[Xn, r.value[f - 1]]
|
|
395
395
|
])), 128))
|
|
396
396
|
]));
|
|
397
397
|
}
|
|
398
|
-
}),
|
|
398
|
+
}), Ls = { class: "relative flex-shrink-0" }, zs = ["src", "alt"], Os = { class: "absolute top-1 right-1" }, Ns = {
|
|
399
399
|
key: 1,
|
|
400
400
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
401
|
-
},
|
|
401
|
+
}, Ps = { class: "min-w-0" }, $s = /* @__PURE__ */ Ee({
|
|
402
402
|
__name: "ElModeHeader",
|
|
403
403
|
props: {
|
|
404
404
|
agent: {},
|
|
@@ -407,137 +407,137 @@ const Cs = {
|
|
|
407
407
|
layout: { default: "centered" }
|
|
408
408
|
},
|
|
409
409
|
setup(l) {
|
|
410
|
-
return (t, e) => (
|
|
411
|
-
class:
|
|
410
|
+
return (t, e) => (T(), S("div", {
|
|
411
|
+
class: y(["flex gap-4", [
|
|
412
412
|
l.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
413
413
|
]])
|
|
414
414
|
}, [
|
|
415
|
-
v("div",
|
|
415
|
+
v("div", Ls, [
|
|
416
416
|
v("div", {
|
|
417
|
-
class:
|
|
417
|
+
class: y(["rounded-full overflow-hidden border-white", l.size === "lg" ? "w-20 h-20 sm:w-24 sm:h-24 border-4" : "w-16 sm:size-16 border-2"])
|
|
418
418
|
}, [
|
|
419
419
|
v("img", {
|
|
420
420
|
src: l.agent.avatarUrl.value,
|
|
421
421
|
alt: l.agent.displayName.value,
|
|
422
422
|
class: "w-full h-full object-cover",
|
|
423
423
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
424
|
-
(...n) =>
|
|
425
|
-
}, null, 40,
|
|
424
|
+
(...n) => Vt(Ln) && Vt(Ln)(...n))
|
|
425
|
+
}, null, 40, zs)
|
|
426
426
|
], 2),
|
|
427
|
-
v("div",
|
|
428
|
-
l.isOnline ? (
|
|
427
|
+
v("div", Os, [
|
|
428
|
+
l.isOnline ? (T(), S(Te, { key: 0 }, [
|
|
429
429
|
e[1] || (e[1] = v("div", {
|
|
430
430
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
431
431
|
style: { "animation-duration": "3s" }
|
|
432
432
|
}, null, -1)),
|
|
433
433
|
e[2] || (e[2] = v("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
434
|
-
], 64)) : (
|
|
434
|
+
], 64)) : (T(), S("div", Ns))
|
|
435
435
|
])
|
|
436
436
|
]),
|
|
437
|
-
v("div",
|
|
437
|
+
v("div", Ps, [
|
|
438
438
|
v("h1", {
|
|
439
|
-
class:
|
|
439
|
+
class: y(["font-light text-white mb-1 truncate", [
|
|
440
440
|
l.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
441
441
|
l.layout === "horizontal" ? "text-white/95" : ""
|
|
442
442
|
]])
|
|
443
|
-
},
|
|
443
|
+
}, ue(l.agent.displayName.value), 3),
|
|
444
444
|
v("p", {
|
|
445
|
-
class:
|
|
445
|
+
class: y(["font-light line-clamp-1", [
|
|
446
446
|
l.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
447
447
|
l.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
448
448
|
]])
|
|
449
|
-
},
|
|
449
|
+
}, ue(l.layout === "horizontal" ? l.agent.title.value || "Digital Agent" : l.agent.title.value), 3)
|
|
450
450
|
])
|
|
451
451
|
], 2));
|
|
452
452
|
}
|
|
453
453
|
});
|
|
454
454
|
const {
|
|
455
|
-
entries:
|
|
456
|
-
setPrototypeOf:
|
|
457
|
-
isFrozen:
|
|
458
|
-
getPrototypeOf:
|
|
459
|
-
getOwnPropertyDescriptor:
|
|
455
|
+
entries: Qn,
|
|
456
|
+
setPrototypeOf: zn,
|
|
457
|
+
isFrozen: Us,
|
|
458
|
+
getPrototypeOf: Bs,
|
|
459
|
+
getOwnPropertyDescriptor: Fs
|
|
460
460
|
} = Object;
|
|
461
461
|
let {
|
|
462
|
-
freeze:
|
|
463
|
-
seal:
|
|
462
|
+
freeze: X,
|
|
463
|
+
seal: te,
|
|
464
464
|
create: mt
|
|
465
465
|
} = Object, {
|
|
466
|
-
apply:
|
|
467
|
-
construct:
|
|
466
|
+
apply: Yt,
|
|
467
|
+
construct: Zt
|
|
468
468
|
} = typeof Reflect < "u" && Reflect;
|
|
469
|
-
|
|
469
|
+
X || (X = /* @__PURE__ */ u(function(t) {
|
|
470
470
|
return t;
|
|
471
471
|
}, "freeze"));
|
|
472
|
-
|
|
472
|
+
te || (te = /* @__PURE__ */ u(function(t) {
|
|
473
473
|
return t;
|
|
474
474
|
}, "seal"));
|
|
475
|
-
|
|
475
|
+
Yt || (Yt = /* @__PURE__ */ u(function(t, e) {
|
|
476
476
|
for (var n = arguments.length, s = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
477
477
|
s[r - 2] = arguments[r];
|
|
478
478
|
return t.apply(e, s);
|
|
479
479
|
}, "apply"));
|
|
480
|
-
|
|
480
|
+
Zt || (Zt = /* @__PURE__ */ u(function(t) {
|
|
481
481
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
482
482
|
n[s - 1] = arguments[s];
|
|
483
483
|
return new t(...n);
|
|
484
484
|
}, "construct"));
|
|
485
|
-
const pt =
|
|
486
|
-
function
|
|
485
|
+
const pt = K(Array.prototype.forEach), Hs = K(Array.prototype.lastIndexOf), On = K(Array.prototype.pop), je = K(Array.prototype.push), Gs = K(Array.prototype.splice), xt = K(String.prototype.toLowerCase), Ft = K(String.prototype.toString), Ht = K(String.prototype.match), qe = K(String.prototype.replace), Ws = K(String.prototype.indexOf), js = K(String.prototype.trim), J = K(Object.prototype.hasOwnProperty), V = K(RegExp.prototype.test), Ve = qs(TypeError);
|
|
486
|
+
function K(l) {
|
|
487
487
|
return function(t) {
|
|
488
488
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
489
489
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
490
490
|
n[s - 1] = arguments[s];
|
|
491
|
-
return
|
|
491
|
+
return Yt(l, t, n);
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
|
-
u(
|
|
495
|
-
function
|
|
494
|
+
u(K, "unapply");
|
|
495
|
+
function qs(l) {
|
|
496
496
|
return function() {
|
|
497
497
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
498
498
|
e[n] = arguments[n];
|
|
499
|
-
return
|
|
499
|
+
return Zt(l, e);
|
|
500
500
|
};
|
|
501
501
|
}
|
|
502
|
-
u(
|
|
503
|
-
function
|
|
502
|
+
u(qs, "unconstruct");
|
|
503
|
+
function D(l, t) {
|
|
504
504
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : xt;
|
|
505
|
-
|
|
505
|
+
zn && zn(l, null);
|
|
506
506
|
let n = t.length;
|
|
507
507
|
for (; n--; ) {
|
|
508
508
|
let s = t[n];
|
|
509
509
|
if (typeof s == "string") {
|
|
510
510
|
const r = e(s);
|
|
511
|
-
r !== s && (
|
|
511
|
+
r !== s && (Us(t) || (t[n] = r), s = r);
|
|
512
512
|
}
|
|
513
513
|
l[s] = !0;
|
|
514
514
|
}
|
|
515
515
|
return l;
|
|
516
516
|
}
|
|
517
|
-
u(
|
|
518
|
-
function
|
|
517
|
+
u(D, "addToSet");
|
|
518
|
+
function Vs(l) {
|
|
519
519
|
for (let t = 0; t < l.length; t++)
|
|
520
520
|
J(l, t) || (l[t] = null);
|
|
521
521
|
return l;
|
|
522
522
|
}
|
|
523
|
-
u(
|
|
524
|
-
function
|
|
523
|
+
u(Vs, "cleanArray");
|
|
524
|
+
function oe(l) {
|
|
525
525
|
const t = mt(null);
|
|
526
|
-
for (const [e, n] of
|
|
527
|
-
J(l, e) && (Array.isArray(n) ? t[e] =
|
|
526
|
+
for (const [e, n] of Qn(l))
|
|
527
|
+
J(l, e) && (Array.isArray(n) ? t[e] = Vs(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = oe(n) : t[e] = n);
|
|
528
528
|
return t;
|
|
529
529
|
}
|
|
530
|
-
u(
|
|
530
|
+
u(oe, "clone");
|
|
531
531
|
function Ye(l, t) {
|
|
532
532
|
for (; l !== null; ) {
|
|
533
|
-
const n =
|
|
533
|
+
const n = Fs(l, t);
|
|
534
534
|
if (n) {
|
|
535
535
|
if (n.get)
|
|
536
|
-
return
|
|
536
|
+
return K(n.get);
|
|
537
537
|
if (typeof n.value == "function")
|
|
538
|
-
return
|
|
538
|
+
return K(n.value);
|
|
539
539
|
}
|
|
540
|
-
l =
|
|
540
|
+
l = Bs(l);
|
|
541
541
|
}
|
|
542
542
|
function e() {
|
|
543
543
|
return null;
|
|
@@ -545,25 +545,25 @@ function Ye(l, t) {
|
|
|
545
545
|
return u(e, "fallbackValue"), e;
|
|
546
546
|
}
|
|
547
547
|
u(Ye, "lookupGetter");
|
|
548
|
-
const
|
|
548
|
+
const Nn = X(["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"]), Gt = X(["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"]), Wt = X(["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"]), Ys = X(["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"]), jt = X(["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"]), Zs = X(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Pn = X(["#text"]), $n = X(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), qt = X(["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"]), Un = X(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "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"]), dt = X(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Xs = te(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Ks = te(/<%[\w\W]*|[\w\W]*%>/gm), Qs = te(/\$\{[\w\W]*/gm), Js = te(/^data-[\-\w.\u00B7-\uFFFF]+$/), er = te(/^aria-[\-\w]+$/), Jn = te(
|
|
549
549
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
550
550
|
// eslint-disable-line no-useless-escape
|
|
551
|
-
),
|
|
551
|
+
), tr = te(/^(?:\w+script|data):/i), nr = te(
|
|
552
552
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
553
553
|
// eslint-disable-line no-control-regex
|
|
554
|
-
),
|
|
555
|
-
var
|
|
554
|
+
), es = te(/^html$/i), sr = te(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
555
|
+
var Bn = /* @__PURE__ */ Object.freeze({
|
|
556
556
|
__proto__: null,
|
|
557
|
-
ARIA_ATTR:
|
|
558
|
-
ATTR_WHITESPACE:
|
|
559
|
-
CUSTOM_ELEMENT:
|
|
560
|
-
DATA_ATTR:
|
|
561
|
-
DOCTYPE_NAME:
|
|
562
|
-
ERB_EXPR:
|
|
563
|
-
IS_ALLOWED_URI:
|
|
564
|
-
IS_SCRIPT_OR_DATA:
|
|
565
|
-
MUSTACHE_EXPR:
|
|
566
|
-
TMPLIT_EXPR:
|
|
557
|
+
ARIA_ATTR: er,
|
|
558
|
+
ATTR_WHITESPACE: nr,
|
|
559
|
+
CUSTOM_ELEMENT: sr,
|
|
560
|
+
DATA_ATTR: Js,
|
|
561
|
+
DOCTYPE_NAME: es,
|
|
562
|
+
ERB_EXPR: Ks,
|
|
563
|
+
IS_ALLOWED_URI: Jn,
|
|
564
|
+
IS_SCRIPT_OR_DATA: tr,
|
|
565
|
+
MUSTACHE_EXPR: Xs,
|
|
566
|
+
TMPLIT_EXPR: Qs
|
|
567
567
|
});
|
|
568
568
|
const Ze = {
|
|
569
569
|
element: 1,
|
|
@@ -572,9 +572,9 @@ const Ze = {
|
|
|
572
572
|
progressingInstruction: 7,
|
|
573
573
|
comment: 8,
|
|
574
574
|
document: 9
|
|
575
|
-
},
|
|
575
|
+
}, rr = /* @__PURE__ */ u(function() {
|
|
576
576
|
return typeof window > "u" ? null : window;
|
|
577
|
-
}, "getGlobal"),
|
|
577
|
+
}, "getGlobal"), ir = /* @__PURE__ */ u(function(t, e) {
|
|
578
578
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
579
579
|
return null;
|
|
580
580
|
let n = null;
|
|
@@ -593,7 +593,7 @@ const Ze = {
|
|
|
593
593
|
} catch {
|
|
594
594
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
595
595
|
}
|
|
596
|
-
}, "_createTrustedTypesPolicy"),
|
|
596
|
+
}, "_createTrustedTypesPolicy"), Fn = /* @__PURE__ */ u(function() {
|
|
597
597
|
return {
|
|
598
598
|
afterSanitizeAttributes: [],
|
|
599
599
|
afterSanitizeElements: [],
|
|
@@ -606,9 +606,9 @@ const Ze = {
|
|
|
606
606
|
uponSanitizeShadowNode: []
|
|
607
607
|
};
|
|
608
608
|
}, "_createHooksMap");
|
|
609
|
-
function
|
|
610
|
-
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
611
|
-
const t = /* @__PURE__ */ u((
|
|
609
|
+
function ts() {
|
|
610
|
+
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : rr();
|
|
611
|
+
const t = /* @__PURE__ */ u((w) => ts(w), "DOMPurify");
|
|
612
612
|
if (t.version = "3.3.3", t.removed = [], !l || !l.document || l.document.nodeType !== Ze.document || !l.Element)
|
|
613
613
|
return t.isSupported = !1, t;
|
|
614
614
|
let {
|
|
@@ -619,44 +619,44 @@ function es() {
|
|
|
619
619
|
HTMLTemplateElement: a,
|
|
620
620
|
Node: o,
|
|
621
621
|
Element: c,
|
|
622
|
-
NodeFilter:
|
|
623
|
-
NamedNodeMap:
|
|
622
|
+
NodeFilter: d,
|
|
623
|
+
NamedNodeMap: g = l.NamedNodeMap || l.MozNamedAttrMap,
|
|
624
624
|
HTMLFormElement: p,
|
|
625
|
-
DOMParser:
|
|
626
|
-
trustedTypes:
|
|
627
|
-
} = l,
|
|
625
|
+
DOMParser: m,
|
|
626
|
+
trustedTypes: f
|
|
627
|
+
} = l, k = c.prototype, _ = Ye(k, "cloneNode"), O = Ye(k, "remove"), ee = Ye(k, "nextSibling"), Re = Ye(k, "childNodes"), ne = Ye(k, "parentNode");
|
|
628
628
|
if (typeof a == "function") {
|
|
629
|
-
const
|
|
630
|
-
|
|
629
|
+
const w = e.createElement("template");
|
|
630
|
+
w.content && w.content.ownerDocument && (e = w.content.ownerDocument);
|
|
631
631
|
}
|
|
632
|
-
let
|
|
632
|
+
let P, he = "";
|
|
633
633
|
const {
|
|
634
|
-
implementation:
|
|
635
|
-
createNodeIterator:
|
|
636
|
-
createDocumentFragment:
|
|
637
|
-
getElementsByTagName:
|
|
634
|
+
implementation: q,
|
|
635
|
+
createNodeIterator: se,
|
|
636
|
+
createDocumentFragment: St,
|
|
637
|
+
getElementsByTagName: tt
|
|
638
638
|
} = e, {
|
|
639
|
-
importNode:
|
|
639
|
+
importNode: nt
|
|
640
640
|
} = n;
|
|
641
|
-
let F =
|
|
642
|
-
t.isSupported = typeof
|
|
641
|
+
let F = Fn();
|
|
642
|
+
t.isSupported = typeof Qn == "function" && typeof ne == "function" && q && q.createHTMLDocument !== void 0;
|
|
643
643
|
const {
|
|
644
|
-
MUSTACHE_EXPR:
|
|
645
|
-
ERB_EXPR:
|
|
646
|
-
TMPLIT_EXPR:
|
|
644
|
+
MUSTACHE_EXPR: De,
|
|
645
|
+
ERB_EXPR: Fe,
|
|
646
|
+
TMPLIT_EXPR: M,
|
|
647
647
|
DATA_ATTR: At,
|
|
648
648
|
ARIA_ATTR: Et,
|
|
649
|
-
IS_SCRIPT_OR_DATA:
|
|
649
|
+
IS_SCRIPT_OR_DATA: _t,
|
|
650
650
|
ATTR_WHITESPACE: He,
|
|
651
|
-
CUSTOM_ELEMENT:
|
|
652
|
-
} =
|
|
651
|
+
CUSTOM_ELEMENT: st
|
|
652
|
+
} = Bn;
|
|
653
653
|
let {
|
|
654
|
-
IS_ALLOWED_URI:
|
|
655
|
-
} =
|
|
656
|
-
const
|
|
657
|
-
let
|
|
658
|
-
const
|
|
659
|
-
let
|
|
654
|
+
IS_ALLOWED_URI: E
|
|
655
|
+
} = Bn, x = null;
|
|
656
|
+
const R = D({}, [...Nn, ...Gt, ...Wt, ...jt, ...Pn]);
|
|
657
|
+
let A = null;
|
|
658
|
+
const H = D({}, [...$n, ...qt, ...Un, ...dt]);
|
|
659
|
+
let z = Object.seal(mt(null, {
|
|
660
660
|
tagNameCheck: {
|
|
661
661
|
writable: !0,
|
|
662
662
|
configurable: !1,
|
|
@@ -675,8 +675,8 @@ function es() {
|
|
|
675
675
|
enumerable: !0,
|
|
676
676
|
value: !1
|
|
677
677
|
}
|
|
678
|
-
})),
|
|
679
|
-
const
|
|
678
|
+
})), ge = null, me = null;
|
|
679
|
+
const xe = Object.seal(mt(null, {
|
|
680
680
|
tagCheck: {
|
|
681
681
|
writable: !0,
|
|
682
682
|
configurable: !1,
|
|
@@ -690,55 +690,55 @@ function es() {
|
|
|
690
690
|
value: null
|
|
691
691
|
}
|
|
692
692
|
}));
|
|
693
|
-
let
|
|
694
|
-
const
|
|
695
|
-
let
|
|
696
|
-
const
|
|
693
|
+
let cn = !0, Rt = !0, un = !1, hn = !0, Ce = !1, rt = !0, ve = !1, Dt = !1, Ct = !1, Ie = !1, it = !1, at = !1, pn = !0, dn = !1;
|
|
694
|
+
const ps = "user-content-";
|
|
695
|
+
let It = !0, Ge = !1, Me = {}, ae = null;
|
|
696
|
+
const Mt = D({}, ["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"]);
|
|
697
697
|
let fn = null;
|
|
698
|
-
const
|
|
699
|
-
let
|
|
700
|
-
const
|
|
701
|
-
let
|
|
702
|
-
const
|
|
703
|
-
let
|
|
704
|
-
const fs =
|
|
698
|
+
const gn = D({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
699
|
+
let Lt = null;
|
|
700
|
+
const mn = D({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), lt = "http://www.w3.org/1998/Math/MathML", ot = "http://www.w3.org/2000/svg", pe = "http://www.w3.org/1999/xhtml";
|
|
701
|
+
let Le = pe, zt = !1, Ot = null;
|
|
702
|
+
const ds = D({}, [lt, ot, pe], Ft);
|
|
703
|
+
let ct = D({}, ["mi", "mo", "mn", "ms", "mtext"]), ut = D({}, ["annotation-xml"]);
|
|
704
|
+
const fs = D({}, ["title", "style", "font", "a", "script"]);
|
|
705
705
|
let We = null;
|
|
706
|
-
const
|
|
707
|
-
let
|
|
708
|
-
const
|
|
706
|
+
const gs = ["application/xhtml+xml", "text/html"], ms = "text/html";
|
|
707
|
+
let U = null, ze = null;
|
|
708
|
+
const xs = e.createElement("form"), xn = /* @__PURE__ */ u(function(i) {
|
|
709
709
|
return i instanceof RegExp || i instanceof Function;
|
|
710
|
-
}, "isRegexOrFunction"),
|
|
710
|
+
}, "isRegexOrFunction"), Nt = /* @__PURE__ */ u(function() {
|
|
711
711
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
712
|
-
if (!(
|
|
713
|
-
if ((!i || typeof i != "object") && (i = {}), i =
|
|
714
|
-
|
|
712
|
+
if (!(ze && ze === i)) {
|
|
713
|
+
if ((!i || typeof i != "object") && (i = {}), i = oe(i), We = // eslint-disable-next-line unicorn/prefer-includes
|
|
714
|
+
gs.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? ms : i.PARSER_MEDIA_TYPE, U = We === "application/xhtml+xml" ? Ft : xt, x = J(i, "ALLOWED_TAGS") ? D({}, i.ALLOWED_TAGS, U) : R, A = J(i, "ALLOWED_ATTR") ? D({}, i.ALLOWED_ATTR, U) : H, Ot = J(i, "ALLOWED_NAMESPACES") ? D({}, i.ALLOWED_NAMESPACES, Ft) : ds, Lt = J(i, "ADD_URI_SAFE_ATTR") ? D(oe(mn), i.ADD_URI_SAFE_ATTR, U) : mn, fn = J(i, "ADD_DATA_URI_TAGS") ? D(oe(gn), i.ADD_DATA_URI_TAGS, U) : gn, ae = J(i, "FORBID_CONTENTS") ? D({}, i.FORBID_CONTENTS, U) : Mt, ge = J(i, "FORBID_TAGS") ? D({}, i.FORBID_TAGS, U) : oe({}), me = J(i, "FORBID_ATTR") ? D({}, i.FORBID_ATTR, U) : oe({}), Me = J(i, "USE_PROFILES") ? i.USE_PROFILES : !1, cn = i.ALLOW_ARIA_ATTR !== !1, Rt = i.ALLOW_DATA_ATTR !== !1, un = i.ALLOW_UNKNOWN_PROTOCOLS || !1, hn = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ce = i.SAFE_FOR_TEMPLATES || !1, rt = i.SAFE_FOR_XML !== !1, ve = i.WHOLE_DOCUMENT || !1, Ie = i.RETURN_DOM || !1, it = i.RETURN_DOM_FRAGMENT || !1, at = i.RETURN_TRUSTED_TYPE || !1, Ct = i.FORCE_BODY || !1, pn = i.SANITIZE_DOM !== !1, dn = i.SANITIZE_NAMED_PROPS || !1, It = i.KEEP_CONTENT !== !1, Ge = i.IN_PLACE || !1, E = i.ALLOWED_URI_REGEXP || Jn, Le = i.NAMESPACE || pe, ct = i.MATHML_TEXT_INTEGRATION_POINTS || ct, ut = i.HTML_INTEGRATION_POINTS || ut, z = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && xn(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (z.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && xn(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (z.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (z.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Ce && (Rt = !1), it && (Ie = !0), Me && (x = D({}, Pn), A = mt(null), Me.html === !0 && (D(x, Nn), D(A, $n)), Me.svg === !0 && (D(x, Gt), D(A, qt), D(A, dt)), Me.svgFilters === !0 && (D(x, Wt), D(A, qt), D(A, dt)), Me.mathMl === !0 && (D(x, jt), D(A, Un), D(A, dt))), J(i, "ADD_TAGS") || (xe.tagCheck = null), J(i, "ADD_ATTR") || (xe.attributeCheck = null), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? xe.tagCheck = i.ADD_TAGS : (x === R && (x = oe(x)), D(x, i.ADD_TAGS, U))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? xe.attributeCheck = i.ADD_ATTR : (A === H && (A = oe(A)), D(A, i.ADD_ATTR, U))), i.ADD_URI_SAFE_ATTR && D(Lt, i.ADD_URI_SAFE_ATTR, U), i.FORBID_CONTENTS && (ae === Mt && (ae = oe(ae)), D(ae, i.FORBID_CONTENTS, U)), i.ADD_FORBID_CONTENTS && (ae === Mt && (ae = oe(ae)), D(ae, i.ADD_FORBID_CONTENTS, U)), It && (x["#text"] = !0), ve && D(x, ["html", "head", "body"]), x.table && (D(x, ["tbody"]), delete ge.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
715
715
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
716
716
|
throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
717
717
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
718
718
|
throw Ve('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
719
|
-
|
|
719
|
+
P = i.TRUSTED_TYPES_POLICY, he = P.createHTML("");
|
|
720
720
|
} else
|
|
721
|
-
|
|
722
|
-
|
|
721
|
+
P === void 0 && (P = ir(f, s)), P !== null && typeof he == "string" && (he = P.createHTML(""));
|
|
722
|
+
X && X(i), ze = i;
|
|
723
723
|
}
|
|
724
|
-
}, "_parseConfig"),
|
|
725
|
-
let h =
|
|
724
|
+
}, "_parseConfig"), bn = D({}, [...Gt, ...Wt, ...Ys]), kn = D({}, [...jt, ...Zs]), bs = /* @__PURE__ */ u(function(i) {
|
|
725
|
+
let h = ne(i);
|
|
726
726
|
(!h || !h.tagName) && (h = {
|
|
727
|
-
namespaceURI:
|
|
727
|
+
namespaceURI: Le,
|
|
728
728
|
tagName: "template"
|
|
729
729
|
});
|
|
730
|
-
const
|
|
731
|
-
return
|
|
732
|
-
}, "_checkValidNamespace"),
|
|
730
|
+
const b = xt(i.tagName), N = xt(h.tagName);
|
|
731
|
+
return Ot[i.namespaceURI] ? i.namespaceURI === ot ? h.namespaceURI === pe ? b === "svg" : h.namespaceURI === lt ? b === "svg" && (N === "annotation-xml" || ct[N]) : !!bn[b] : i.namespaceURI === lt ? h.namespaceURI === pe ? b === "math" : h.namespaceURI === ot ? b === "math" && ut[N] : !!kn[b] : i.namespaceURI === pe ? h.namespaceURI === ot && !ut[N] || h.namespaceURI === lt && !ct[N] ? !1 : !kn[b] && (fs[b] || !bn[b]) : !!(We === "application/xhtml+xml" && Ot[i.namespaceURI]) : !1;
|
|
732
|
+
}, "_checkValidNamespace"), le = /* @__PURE__ */ u(function(i) {
|
|
733
733
|
je(t.removed, {
|
|
734
734
|
element: i
|
|
735
735
|
});
|
|
736
736
|
try {
|
|
737
|
-
|
|
737
|
+
ne(i).removeChild(i);
|
|
738
738
|
} catch {
|
|
739
739
|
O(i);
|
|
740
740
|
}
|
|
741
|
-
}, "_forceRemove"),
|
|
741
|
+
}, "_forceRemove"), ye = /* @__PURE__ */ u(function(i, h) {
|
|
742
742
|
try {
|
|
743
743
|
je(t.removed, {
|
|
744
744
|
attribute: h.getAttributeNode(i),
|
|
@@ -751,9 +751,9 @@ function es() {
|
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
753
|
if (h.removeAttribute(i), i === "is")
|
|
754
|
-
if (
|
|
754
|
+
if (Ie || it)
|
|
755
755
|
try {
|
|
756
|
-
|
|
756
|
+
le(h);
|
|
757
757
|
} catch {
|
|
758
758
|
}
|
|
759
759
|
else
|
|
@@ -761,99 +761,99 @@ function es() {
|
|
|
761
761
|
h.setAttribute(i, "");
|
|
762
762
|
} catch {
|
|
763
763
|
}
|
|
764
|
-
}, "_removeAttribute"),
|
|
765
|
-
let h = null,
|
|
766
|
-
if (
|
|
764
|
+
}, "_removeAttribute"), wn = /* @__PURE__ */ u(function(i) {
|
|
765
|
+
let h = null, b = null;
|
|
766
|
+
if (Ct)
|
|
767
767
|
i = "<remove></remove>" + i;
|
|
768
768
|
else {
|
|
769
|
-
const $ =
|
|
770
|
-
|
|
769
|
+
const $ = Ht(i, /^[\r\n\t ]+/);
|
|
770
|
+
b = $ && $[0];
|
|
771
771
|
}
|
|
772
|
-
We === "application/xhtml+xml" &&
|
|
773
|
-
const
|
|
774
|
-
if (
|
|
772
|
+
We === "application/xhtml+xml" && Le === pe && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
773
|
+
const N = P ? P.createHTML(i) : i;
|
|
774
|
+
if (Le === pe)
|
|
775
775
|
try {
|
|
776
|
-
h = new
|
|
776
|
+
h = new m().parseFromString(N, We);
|
|
777
777
|
} catch {
|
|
778
778
|
}
|
|
779
779
|
if (!h || !h.documentElement) {
|
|
780
|
-
h =
|
|
780
|
+
h = q.createDocument(Le, "template", null);
|
|
781
781
|
try {
|
|
782
|
-
h.documentElement.innerHTML =
|
|
782
|
+
h.documentElement.innerHTML = zt ? he : N;
|
|
783
783
|
} catch {
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
const j = h.body || h.documentElement;
|
|
787
|
-
return i &&
|
|
788
|
-
}, "_initDocument"),
|
|
789
|
-
return
|
|
787
|
+
return i && b && j.insertBefore(e.createTextNode(b), j.childNodes[0] || null), Le === pe ? tt.call(h, ve ? "html" : "body")[0] : ve ? h.documentElement : j;
|
|
788
|
+
}, "_initDocument"), vn = /* @__PURE__ */ u(function(i) {
|
|
789
|
+
return se.call(
|
|
790
790
|
i.ownerDocument || i,
|
|
791
791
|
i,
|
|
792
792
|
// eslint-disable-next-line no-bitwise
|
|
793
|
-
|
|
793
|
+
d.SHOW_ELEMENT | d.SHOW_COMMENT | d.SHOW_TEXT | d.SHOW_PROCESSING_INSTRUCTION | d.SHOW_CDATA_SECTION,
|
|
794
794
|
null
|
|
795
795
|
);
|
|
796
|
-
}, "_createNodeIterator"),
|
|
797
|
-
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof
|
|
798
|
-
}, "_isClobbered"),
|
|
796
|
+
}, "_createNodeIterator"), Pt = /* @__PURE__ */ u(function(i) {
|
|
797
|
+
return i instanceof p && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof g) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
798
|
+
}, "_isClobbered"), yn = /* @__PURE__ */ u(function(i) {
|
|
799
799
|
return typeof o == "function" && i instanceof o;
|
|
800
800
|
}, "_isNode");
|
|
801
|
-
function de(
|
|
802
|
-
pt(
|
|
803
|
-
|
|
801
|
+
function de(w, i, h) {
|
|
802
|
+
pt(w, (b) => {
|
|
803
|
+
b.call(t, i, h, ze);
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
806
|
u(de, "_executeHooks");
|
|
807
|
-
const
|
|
807
|
+
const Tn = /* @__PURE__ */ u(function(i) {
|
|
808
808
|
let h = null;
|
|
809
|
-
if (de(F.beforeSanitizeElements, i, null),
|
|
810
|
-
return
|
|
811
|
-
const
|
|
809
|
+
if (de(F.beforeSanitizeElements, i, null), Pt(i))
|
|
810
|
+
return le(i), !0;
|
|
811
|
+
const b = U(i.nodeName);
|
|
812
812
|
if (de(F.uponSanitizeElement, i, {
|
|
813
|
-
tagName:
|
|
814
|
-
allowedTags:
|
|
815
|
-
}),
|
|
816
|
-
return
|
|
817
|
-
if (!(
|
|
818
|
-
if (!
|
|
813
|
+
tagName: b,
|
|
814
|
+
allowedTags: x
|
|
815
|
+
}), rt && i.hasChildNodes() && !yn(i.firstElementChild) && V(/<[/\w!]/g, i.innerHTML) && V(/<[/\w!]/g, i.textContent) || i.nodeType === Ze.progressingInstruction || rt && i.nodeType === Ze.comment && V(/<[/\w]/g, i.data))
|
|
816
|
+
return le(i), !0;
|
|
817
|
+
if (!(xe.tagCheck instanceof Function && xe.tagCheck(b)) && (!x[b] || ge[b])) {
|
|
818
|
+
if (!ge[b] && An(b) && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, b) || z.tagNameCheck instanceof Function && z.tagNameCheck(b)))
|
|
819
819
|
return !1;
|
|
820
|
-
if (
|
|
821
|
-
const
|
|
822
|
-
if (j &&
|
|
820
|
+
if (It && !ae[b]) {
|
|
821
|
+
const N = ne(i) || i.parentNode, j = Re(i) || i.childNodes;
|
|
822
|
+
if (j && N) {
|
|
823
823
|
const $ = j.length;
|
|
824
|
-
for (let
|
|
825
|
-
const
|
|
826
|
-
|
|
824
|
+
for (let Q = $ - 1; Q >= 0; --Q) {
|
|
825
|
+
const fe = _(j[Q], !0);
|
|
826
|
+
fe.__removalCount = (i.__removalCount || 0) + 1, N.insertBefore(fe, ee(i));
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
|
-
return
|
|
830
|
+
return le(i), !0;
|
|
831
831
|
}
|
|
832
|
-
return i instanceof c && !
|
|
833
|
-
h = qe(h,
|
|
832
|
+
return i instanceof c && !bs(i) || (b === "noscript" || b === "noembed" || b === "noframes") && V(/<\/no(script|embed|frames)/i, i.innerHTML) ? (le(i), !0) : (Ce && i.nodeType === Ze.text && (h = i.textContent, pt([De, Fe, M], (N) => {
|
|
833
|
+
h = qe(h, N, " ");
|
|
834
834
|
}), i.textContent !== h && (je(t.removed, {
|
|
835
835
|
element: i.cloneNode()
|
|
836
836
|
}), i.textContent = h)), de(F.afterSanitizeElements, i, null), !1);
|
|
837
|
-
}, "_sanitizeElements"),
|
|
838
|
-
if (
|
|
837
|
+
}, "_sanitizeElements"), Sn = /* @__PURE__ */ u(function(i, h, b) {
|
|
838
|
+
if (me[h] || pn && (h === "id" || h === "name") && (b in e || b in xs))
|
|
839
839
|
return !1;
|
|
840
|
-
if (!(
|
|
841
|
-
if (!(
|
|
842
|
-
if (!(
|
|
843
|
-
if (!
|
|
840
|
+
if (!(Rt && !me[h] && V(At, h))) {
|
|
841
|
+
if (!(cn && V(Et, h))) {
|
|
842
|
+
if (!(xe.attributeCheck instanceof Function && xe.attributeCheck(h, i))) {
|
|
843
|
+
if (!A[h] || me[h]) {
|
|
844
844
|
if (
|
|
845
845
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
846
846
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
847
847
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
848
|
-
!(
|
|
848
|
+
!(An(i) && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, i) || z.tagNameCheck instanceof Function && z.tagNameCheck(i)) && (z.attributeNameCheck instanceof RegExp && V(z.attributeNameCheck, h) || z.attributeNameCheck instanceof Function && z.attributeNameCheck(h, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
849
849
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
850
|
-
h === "is" &&
|
|
850
|
+
h === "is" && z.allowCustomizedBuiltInElements && (z.tagNameCheck instanceof RegExp && V(z.tagNameCheck, b) || z.tagNameCheck instanceof Function && z.tagNameCheck(b)))
|
|
851
851
|
) return !1;
|
|
852
|
-
} else if (!
|
|
853
|
-
if (!V(
|
|
854
|
-
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" &&
|
|
855
|
-
if (!(
|
|
856
|
-
if (
|
|
852
|
+
} else if (!Lt[h]) {
|
|
853
|
+
if (!V(E, qe(b, He, ""))) {
|
|
854
|
+
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && Ws(b, "data:") === 0 && fn[i])) {
|
|
855
|
+
if (!(un && !V(_t, qe(b, He, "")))) {
|
|
856
|
+
if (b)
|
|
857
857
|
return !1;
|
|
858
858
|
}
|
|
859
859
|
}
|
|
@@ -863,205 +863,205 @@ function es() {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
return !0;
|
|
866
|
-
}, "_isValidAttribute"),
|
|
867
|
-
return i !== "annotation-xml" &&
|
|
868
|
-
}, "_isBasicCustomElement"),
|
|
866
|
+
}, "_isValidAttribute"), An = /* @__PURE__ */ u(function(i) {
|
|
867
|
+
return i !== "annotation-xml" && Ht(i, st);
|
|
868
|
+
}, "_isBasicCustomElement"), En = /* @__PURE__ */ u(function(i) {
|
|
869
869
|
de(F.beforeSanitizeAttributes, i, null);
|
|
870
870
|
const {
|
|
871
871
|
attributes: h
|
|
872
872
|
} = i;
|
|
873
|
-
if (!h ||
|
|
873
|
+
if (!h || Pt(i))
|
|
874
874
|
return;
|
|
875
|
-
const
|
|
875
|
+
const b = {
|
|
876
876
|
attrName: "",
|
|
877
877
|
attrValue: "",
|
|
878
878
|
keepAttr: !0,
|
|
879
|
-
allowedAttributes:
|
|
879
|
+
allowedAttributes: A,
|
|
880
880
|
forceKeepAttr: void 0
|
|
881
881
|
};
|
|
882
|
-
let
|
|
883
|
-
for (;
|
|
884
|
-
const j = h[
|
|
882
|
+
let N = h.length;
|
|
883
|
+
for (; N--; ) {
|
|
884
|
+
const j = h[N], {
|
|
885
885
|
name: $,
|
|
886
|
-
namespaceURI:
|
|
887
|
-
value:
|
|
888
|
-
} = j,
|
|
889
|
-
let G = $ === "value" ?
|
|
890
|
-
if (
|
|
891
|
-
|
|
886
|
+
namespaceURI: Q,
|
|
887
|
+
value: fe
|
|
888
|
+
} = j, Oe = U($), $t = fe;
|
|
889
|
+
let G = $ === "value" ? $t : js($t);
|
|
890
|
+
if (b.attrName = Oe, b.attrValue = G, b.keepAttr = !0, b.forceKeepAttr = void 0, de(F.uponSanitizeAttribute, i, b), G = b.attrValue, dn && (Oe === "id" || Oe === "name") && (ye($, i), G = ps + G), rt && V(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, G)) {
|
|
891
|
+
ye($, i);
|
|
892
892
|
continue;
|
|
893
893
|
}
|
|
894
|
-
if (
|
|
895
|
-
|
|
894
|
+
if (Oe === "attributename" && Ht(G, "href")) {
|
|
895
|
+
ye($, i);
|
|
896
896
|
continue;
|
|
897
897
|
}
|
|
898
|
-
if (
|
|
898
|
+
if (b.forceKeepAttr)
|
|
899
899
|
continue;
|
|
900
|
-
if (!
|
|
901
|
-
|
|
900
|
+
if (!b.keepAttr) {
|
|
901
|
+
ye($, i);
|
|
902
902
|
continue;
|
|
903
903
|
}
|
|
904
|
-
if (!
|
|
905
|
-
|
|
904
|
+
if (!hn && V(/\/>/i, G)) {
|
|
905
|
+
ye($, i);
|
|
906
906
|
continue;
|
|
907
907
|
}
|
|
908
|
-
|
|
909
|
-
G = qe(G,
|
|
908
|
+
Ce && pt([De, Fe, M], (Rn) => {
|
|
909
|
+
G = qe(G, Rn, " ");
|
|
910
910
|
});
|
|
911
|
-
const
|
|
912
|
-
if (!
|
|
913
|
-
|
|
911
|
+
const _n = U(i.nodeName);
|
|
912
|
+
if (!Sn(_n, Oe, G)) {
|
|
913
|
+
ye($, i);
|
|
914
914
|
continue;
|
|
915
915
|
}
|
|
916
|
-
if (
|
|
917
|
-
switch (
|
|
916
|
+
if (P && typeof f == "object" && typeof f.getAttributeType == "function" && !Q)
|
|
917
|
+
switch (f.getAttributeType(_n, Oe)) {
|
|
918
918
|
case "TrustedHTML": {
|
|
919
|
-
G =
|
|
919
|
+
G = P.createHTML(G);
|
|
920
920
|
break;
|
|
921
921
|
}
|
|
922
922
|
case "TrustedScriptURL": {
|
|
923
|
-
G =
|
|
923
|
+
G = P.createScriptURL(G);
|
|
924
924
|
break;
|
|
925
925
|
}
|
|
926
926
|
}
|
|
927
|
-
if (G !==
|
|
927
|
+
if (G !== $t)
|
|
928
928
|
try {
|
|
929
|
-
|
|
929
|
+
Q ? i.setAttributeNS(Q, $, G) : i.setAttribute($, G), Pt(i) ? le(i) : On(t.removed);
|
|
930
930
|
} catch {
|
|
931
|
-
|
|
931
|
+
ye($, i);
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
de(F.afterSanitizeAttributes, i, null);
|
|
935
|
-
}, "_sanitizeAttributes"), ks = /* @__PURE__ */ u(function
|
|
935
|
+
}, "_sanitizeAttributes"), ks = /* @__PURE__ */ u(function w(i) {
|
|
936
936
|
let h = null;
|
|
937
|
-
const
|
|
938
|
-
for (de(F.beforeSanitizeShadowDOM, i, null); h =
|
|
939
|
-
de(F.uponSanitizeShadowNode, h, null),
|
|
937
|
+
const b = vn(i);
|
|
938
|
+
for (de(F.beforeSanitizeShadowDOM, i, null); h = b.nextNode(); )
|
|
939
|
+
de(F.uponSanitizeShadowNode, h, null), Tn(h), En(h), h.content instanceof r && w(h.content);
|
|
940
940
|
de(F.afterSanitizeShadowDOM, i, null);
|
|
941
941
|
}, "_sanitizeShadowDOM");
|
|
942
|
-
return t.sanitize = function(
|
|
943
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null,
|
|
944
|
-
if (
|
|
945
|
-
if (typeof
|
|
946
|
-
if (
|
|
942
|
+
return t.sanitize = function(w) {
|
|
943
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, b = null, N = null, j = null;
|
|
944
|
+
if (zt = !w, zt && (w = "<!-->"), typeof w != "string" && !yn(w))
|
|
945
|
+
if (typeof w.toString == "function") {
|
|
946
|
+
if (w = w.toString(), typeof w != "string")
|
|
947
947
|
throw Ve("dirty is not a string, aborting");
|
|
948
948
|
} else
|
|
949
949
|
throw Ve("toString is not a function");
|
|
950
950
|
if (!t.isSupported)
|
|
951
|
-
return
|
|
952
|
-
if (
|
|
953
|
-
if (
|
|
954
|
-
const
|
|
955
|
-
if (!
|
|
951
|
+
return w;
|
|
952
|
+
if (Dt || Nt(i), t.removed = [], typeof w == "string" && (Ge = !1), Ge) {
|
|
953
|
+
if (w.nodeName) {
|
|
954
|
+
const fe = U(w.nodeName);
|
|
955
|
+
if (!x[fe] || ge[fe])
|
|
956
956
|
throw Ve("root node is forbidden and cannot be sanitized in-place");
|
|
957
957
|
}
|
|
958
|
-
} else if (
|
|
959
|
-
h =
|
|
958
|
+
} else if (w instanceof o)
|
|
959
|
+
h = wn("<!---->"), b = h.ownerDocument.importNode(w, !0), b.nodeType === Ze.element && b.nodeName === "BODY" || b.nodeName === "HTML" ? h = b : h.appendChild(b);
|
|
960
960
|
else {
|
|
961
|
-
if (!
|
|
962
|
-
|
|
963
|
-
return
|
|
964
|
-
if (h =
|
|
965
|
-
return
|
|
961
|
+
if (!Ie && !Ce && !ve && // eslint-disable-next-line unicorn/prefer-includes
|
|
962
|
+
w.indexOf("<") === -1)
|
|
963
|
+
return P && at ? P.createHTML(w) : w;
|
|
964
|
+
if (h = wn(w), !h)
|
|
965
|
+
return Ie ? null : at ? he : "";
|
|
966
966
|
}
|
|
967
|
-
h &&
|
|
968
|
-
const $ =
|
|
969
|
-
for (;
|
|
970
|
-
|
|
967
|
+
h && Ct && le(h.firstChild);
|
|
968
|
+
const $ = vn(Ge ? w : h);
|
|
969
|
+
for (; N = $.nextNode(); )
|
|
970
|
+
Tn(N), En(N), N.content instanceof r && ks(N.content);
|
|
971
971
|
if (Ge)
|
|
972
|
-
return
|
|
973
|
-
if (
|
|
974
|
-
if (
|
|
975
|
-
for (j =
|
|
972
|
+
return w;
|
|
973
|
+
if (Ie) {
|
|
974
|
+
if (it)
|
|
975
|
+
for (j = St.call(h.ownerDocument); h.firstChild; )
|
|
976
976
|
j.appendChild(h.firstChild);
|
|
977
977
|
else
|
|
978
978
|
j = h;
|
|
979
|
-
return (
|
|
979
|
+
return (A.shadowroot || A.shadowrootmode) && (j = nt.call(n, j, !0)), j;
|
|
980
980
|
}
|
|
981
|
-
let
|
|
982
|
-
return
|
|
983
|
-
` +
|
|
984
|
-
|
|
985
|
-
}),
|
|
981
|
+
let Q = ve ? h.outerHTML : h.innerHTML;
|
|
982
|
+
return ve && x["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && V(es, h.ownerDocument.doctype.name) && (Q = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
983
|
+
` + Q), Ce && pt([De, Fe, M], (fe) => {
|
|
984
|
+
Q = qe(Q, fe, " ");
|
|
985
|
+
}), P && at ? P.createHTML(Q) : Q;
|
|
986
986
|
}, t.setConfig = function() {
|
|
987
|
-
let
|
|
988
|
-
|
|
987
|
+
let w = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
988
|
+
Nt(w), Dt = !0;
|
|
989
989
|
}, t.clearConfig = function() {
|
|
990
|
-
|
|
991
|
-
}, t.isValidAttribute = function(
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
return
|
|
995
|
-
}, t.addHook = function(
|
|
996
|
-
typeof i == "function" && je(F[
|
|
997
|
-
}, t.removeHook = function(
|
|
990
|
+
ze = null, Dt = !1;
|
|
991
|
+
}, t.isValidAttribute = function(w, i, h) {
|
|
992
|
+
ze || Nt({});
|
|
993
|
+
const b = U(w), N = U(i);
|
|
994
|
+
return Sn(b, N, h);
|
|
995
|
+
}, t.addHook = function(w, i) {
|
|
996
|
+
typeof i == "function" && je(F[w], i);
|
|
997
|
+
}, t.removeHook = function(w, i) {
|
|
998
998
|
if (i !== void 0) {
|
|
999
|
-
const h =
|
|
1000
|
-
return h === -1 ? void 0 :
|
|
999
|
+
const h = Hs(F[w], i);
|
|
1000
|
+
return h === -1 ? void 0 : Gs(F[w], h, 1)[0];
|
|
1001
1001
|
}
|
|
1002
|
-
return
|
|
1003
|
-
}, t.removeHooks = function(
|
|
1004
|
-
F[
|
|
1002
|
+
return On(F[w]);
|
|
1003
|
+
}, t.removeHooks = function(w) {
|
|
1004
|
+
F[w] = [];
|
|
1005
1005
|
}, t.removeAllHooks = function() {
|
|
1006
|
-
F =
|
|
1006
|
+
F = Fn();
|
|
1007
1007
|
}, t;
|
|
1008
1008
|
}
|
|
1009
|
-
u(
|
|
1010
|
-
var
|
|
1011
|
-
function
|
|
1009
|
+
u(ts, "createDOMPurify");
|
|
1010
|
+
var ar = ts();
|
|
1011
|
+
function Qt() {
|
|
1012
1012
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1013
1013
|
}
|
|
1014
|
-
u(
|
|
1015
|
-
var
|
|
1016
|
-
function
|
|
1017
|
-
|
|
1014
|
+
u(Qt, "M");
|
|
1015
|
+
var _e = Qt();
|
|
1016
|
+
function ns(l) {
|
|
1017
|
+
_e = l;
|
|
1018
1018
|
}
|
|
1019
|
-
u(
|
|
1020
|
-
var
|
|
1021
|
-
function
|
|
1019
|
+
u(ns, "G");
|
|
1020
|
+
var Se = { exec: /* @__PURE__ */ u(() => null, "exec") };
|
|
1021
|
+
function I(l, t = "") {
|
|
1022
1022
|
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */ u((s, r) => {
|
|
1023
1023
|
let a = typeof r == "string" ? r : r.source;
|
|
1024
|
-
return a = a.replace(
|
|
1024
|
+
return a = a.replace(Z.caret, "$1"), e = e.replace(s, a), n;
|
|
1025
1025
|
}, "replace"), getRegex: /* @__PURE__ */ u(() => new RegExp(e, t), "getRegex") };
|
|
1026
1026
|
return n;
|
|
1027
1027
|
}
|
|
1028
|
-
u(
|
|
1029
|
-
var
|
|
1028
|
+
u(I, "k");
|
|
1029
|
+
var lr = (() => {
|
|
1030
1030
|
try {
|
|
1031
1031
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
1032
1032
|
} catch {
|
|
1033
1033
|
return !1;
|
|
1034
1034
|
}
|
|
1035
|
-
})(),
|
|
1036
|
-
]`).replace("lheading",
|
|
1037
|
-
function
|
|
1035
|
+
})(), Z = { 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__ */ u((l) => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex"), blockquoteBeginRegex: /* @__PURE__ */ u((l) => new RegExp(`^ {0,${Math.min(3, l - 1)}}>`), "blockquoteBeginRegex") }, or = /^(?:[ \t]*(?:\n|$))+/, cr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ur = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, et = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, hr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Jt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ss = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, rs = I(ss).replace(/bull/g, Jt).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(), pr = I(ss).replace(/bull/g, Jt).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(), en = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, dr = /^[^\n]+/, tn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, fr = I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", tn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), gr = I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Jt).getRegex(), yt = "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", nn = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, mr = I("^ {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", nn).replace("tag", yt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), is = I(en).replace("hr", et).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", yt).getRegex(), xr = I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", is).getRegex(), sn = { blockquote: xr, code: cr, def: fr, fences: ur, heading: hr, hr: et, html: mr, lheading: rs, list: gr, newline: or, paragraph: is, table: Se, text: dr }, Hn = I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", et).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", yt).getRegex(), br = { ...sn, lheading: pr, table: Hn, paragraph: I(en).replace("hr", et).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Hn).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", yt).getRegex() }, kr = { ...sn, html: I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", nn).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: Se, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: I(en).replace("hr", et).replace("heading", ` *#{1,6} *[^
|
|
1036
|
+
]`).replace("lheading", rs).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, wr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, vr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, as = /^( {2,}|\\)\n(?!\s*$)/, yr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Be = /[\p{P}\p{S}]/u, Tt = /[\s\p{P}\p{S}]/u, rn = /[^\s\p{P}\p{S}]/u, Tr = I(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Tt).getRegex(), ls = /(?!~)[\p{P}\p{S}]/u, Sr = /(?!~)[\s\p{P}\p{S}]/u, Ar = /(?:[^\s\p{P}\p{S}]|~)/u, Er = I(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", lr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), os = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, _r = I(os, "u").replace(/punct/g, Be).getRegex(), Rr = I(os, "u").replace(/punct/g, ls).getRegex(), cs = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Dr = I(cs, "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, Tt).replace(/punct/g, Be).getRegex(), Cr = I(cs, "gu").replace(/notPunctSpace/g, Ar).replace(/punctSpace/g, Sr).replace(/punct/g, ls).getRegex(), Ir = I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, Tt).replace(/punct/g, Be).getRegex(), Mr = I(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Be).getRegex(), Lr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", zr = I(Lr, "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, Tt).replace(/punct/g, Be).getRegex(), Or = I(/\\(punct)/, "gu").replace(/punct/g, Be).getRegex(), Nr = I(/^<(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(), Pr = I(nn).replace("(?:-->|$)", "-->").getRegex(), $r = I("^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", Pr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), kt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ur = I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", kt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), us = I(/^!?\[(label)\]\[(ref)\]/).replace("label", kt).replace("ref", tn).getRegex(), hs = I(/^!?\[(ref)\](?:\[\])?/).replace("ref", tn).getRegex(), Br = I("reflink|nolink(?!\\()", "g").replace("reflink", us).replace("nolink", hs).getRegex(), Gn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, an = { _backpedal: Se, anyPunctuation: Or, autolink: Nr, blockSkip: Er, br: as, code: vr, del: Se, delLDelim: Se, delRDelim: Se, emStrongLDelim: _r, emStrongRDelimAst: Dr, emStrongRDelimUnd: Ir, escape: wr, link: Ur, nolink: hs, punctuation: Tr, reflink: us, reflinkSearch: Br, tag: $r, text: yr, url: Se }, Fr = { ...an, link: I(/^!?\[(label)\]\((.*?)\)/).replace("label", kt).getRegex(), reflink: I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", kt).getRegex() }, Xt = { ...an, emStrongRDelimAst: Cr, emStrongLDelim: Rr, delLDelim: Mr, delRDelim: zr, url: I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Gn).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: I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Gn).getRegex() }, Hr = { ...Xt, br: I(as).replace("{2,}", "*").getRegex(), text: I(Xt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ft = { normal: sn, gfm: br, pedantic: kr }, Xe = { normal: an, gfm: Xt, breaks: Hr, pedantic: Fr }, Gr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, Wn = /* @__PURE__ */ u((l) => Gr[l], "ke");
|
|
1037
|
+
function ce(l, t) {
|
|
1038
1038
|
if (t) {
|
|
1039
|
-
if (
|
|
1040
|
-
} else if (
|
|
1039
|
+
if (Z.escapeTest.test(l)) return l.replace(Z.escapeReplace, Wn);
|
|
1040
|
+
} else if (Z.escapeTestNoEncode.test(l)) return l.replace(Z.escapeReplaceNoEncode, Wn);
|
|
1041
1041
|
return l;
|
|
1042
1042
|
}
|
|
1043
|
-
u(
|
|
1044
|
-
function
|
|
1043
|
+
u(ce, "O");
|
|
1044
|
+
function jn(l) {
|
|
1045
1045
|
try {
|
|
1046
|
-
l = encodeURI(l).replace(
|
|
1046
|
+
l = encodeURI(l).replace(Z.percentDecode, "%");
|
|
1047
1047
|
} catch {
|
|
1048
1048
|
return null;
|
|
1049
1049
|
}
|
|
1050
1050
|
return l;
|
|
1051
1051
|
}
|
|
1052
|
-
u(
|
|
1053
|
-
function
|
|
1054
|
-
let e = l.replace(
|
|
1055
|
-
let c = !1,
|
|
1056
|
-
for (; --
|
|
1052
|
+
u(jn, "J");
|
|
1053
|
+
function qn(l, t) {
|
|
1054
|
+
let e = l.replace(Z.findPipe, (r, a, o) => {
|
|
1055
|
+
let c = !1, d = a;
|
|
1056
|
+
for (; --d >= 0 && o[d] === "\\"; ) c = !c;
|
|
1057
1057
|
return c ? "|" : " |";
|
|
1058
|
-
}), n = e.split(
|
|
1058
|
+
}), n = e.split(Z.splitPipe), s = 0;
|
|
1059
1059
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1060
1060
|
else for (; n.length < t; ) n.push("");
|
|
1061
|
-
for (; s < n.length; s++) n[s] = n[s].trim().replace(
|
|
1061
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(Z.slashPipe, "|");
|
|
1062
1062
|
return n;
|
|
1063
1063
|
}
|
|
1064
|
-
u(
|
|
1064
|
+
u(qn, "V");
|
|
1065
1065
|
function Ke(l, t, e) {
|
|
1066
1066
|
let n = l.length;
|
|
1067
1067
|
if (n === 0) return "";
|
|
@@ -1071,7 +1071,7 @@ function Ke(l, t, e) {
|
|
|
1071
1071
|
return l.slice(0, n - s);
|
|
1072
1072
|
}
|
|
1073
1073
|
u(Ke, "I");
|
|
1074
|
-
function
|
|
1074
|
+
function Wr(l, t) {
|
|
1075
1075
|
if (l.indexOf(t[1]) === -1) return -1;
|
|
1076
1076
|
let e = 0;
|
|
1077
1077
|
for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++;
|
|
@@ -1079,8 +1079,8 @@ function jr(l, t) {
|
|
|
1079
1079
|
else if (l[n] === t[1] && (e--, e < 0)) return n;
|
|
1080
1080
|
return e > 0 ? -2 : -1;
|
|
1081
1081
|
}
|
|
1082
|
-
u(
|
|
1083
|
-
function
|
|
1082
|
+
u(Wr, "de");
|
|
1083
|
+
function jr(l, t = 0) {
|
|
1084
1084
|
let e = t, n = "";
|
|
1085
1085
|
for (let s of l) if (s === " ") {
|
|
1086
1086
|
let r = 4 - e % 4;
|
|
@@ -1088,15 +1088,15 @@ function qr(l, t = 0) {
|
|
|
1088
1088
|
} else n += s, e++;
|
|
1089
1089
|
return n;
|
|
1090
1090
|
}
|
|
1091
|
-
u(
|
|
1092
|
-
function
|
|
1091
|
+
u(jr, "ge");
|
|
1092
|
+
function Vn(l, t, e, n, s) {
|
|
1093
1093
|
let r = t.href, a = t.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
1094
1094
|
n.state.inLink = !0;
|
|
1095
1095
|
let c = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: e, href: r, title: a, text: o, tokens: n.inlineTokens(o) };
|
|
1096
1096
|
return n.state.inLink = !1, c;
|
|
1097
1097
|
}
|
|
1098
|
-
u(
|
|
1099
|
-
function
|
|
1098
|
+
u(Vn, "fe");
|
|
1099
|
+
function qr(l, t, e) {
|
|
1100
1100
|
let n = l.match(e.other.indentCodeCompensation);
|
|
1101
1101
|
if (n === null) return t;
|
|
1102
1102
|
let s = n[1];
|
|
@@ -1109,13 +1109,13 @@ function Vr(l, t, e) {
|
|
|
1109
1109
|
}).join(`
|
|
1110
1110
|
`);
|
|
1111
1111
|
}
|
|
1112
|
-
u(
|
|
1113
|
-
var
|
|
1112
|
+
u(qr, "nt");
|
|
1113
|
+
var Ne, wt = (Ne = class {
|
|
1114
1114
|
constructor(t) {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
this.options = t ||
|
|
1115
|
+
C(this, "options");
|
|
1116
|
+
C(this, "rules");
|
|
1117
|
+
C(this, "lexer");
|
|
1118
|
+
this.options = t || _e;
|
|
1119
1119
|
}
|
|
1120
1120
|
space(t) {
|
|
1121
1121
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1132,7 +1132,7 @@ var Oe, wt = (Oe = class {
|
|
|
1132
1132
|
fences(t) {
|
|
1133
1133
|
let e = this.rules.block.fences.exec(t);
|
|
1134
1134
|
if (e) {
|
|
1135
|
-
let n = e[0], s =
|
|
1135
|
+
let n = e[0], s = qr(n, e[3] || "", this.rules);
|
|
1136
1136
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
@@ -1159,32 +1159,32 @@ var Oe, wt = (Oe = class {
|
|
|
1159
1159
|
`).split(`
|
|
1160
1160
|
`), s = "", r = "", a = [];
|
|
1161
1161
|
for (; n.length > 0; ) {
|
|
1162
|
-
let o = !1, c = [],
|
|
1163
|
-
for (
|
|
1164
|
-
else if (!o) c.push(n[
|
|
1162
|
+
let o = !1, c = [], d;
|
|
1163
|
+
for (d = 0; d < n.length; d++) if (this.rules.other.blockquoteStart.test(n[d])) c.push(n[d]), o = !0;
|
|
1164
|
+
else if (!o) c.push(n[d]);
|
|
1165
1165
|
else break;
|
|
1166
|
-
n = n.slice(
|
|
1167
|
-
let
|
|
1168
|
-
`), p =
|
|
1166
|
+
n = n.slice(d);
|
|
1167
|
+
let g = c.join(`
|
|
1168
|
+
`), p = g.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1169
1169
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1170
1170
|
s = s ? `${s}
|
|
1171
|
-
${
|
|
1171
|
+
${g}` : g, r = r ? `${r}
|
|
1172
1172
|
${p}` : p;
|
|
1173
|
-
let
|
|
1174
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top =
|
|
1175
|
-
let
|
|
1176
|
-
if (
|
|
1177
|
-
if (
|
|
1178
|
-
let
|
|
1173
|
+
let m = this.lexer.state.top;
|
|
1174
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(p, a, !0), this.lexer.state.top = m, n.length === 0) break;
|
|
1175
|
+
let f = a.at(-1);
|
|
1176
|
+
if (f?.type === "code") break;
|
|
1177
|
+
if (f?.type === "blockquote") {
|
|
1178
|
+
let k = f, _ = k.raw + `
|
|
1179
1179
|
` + n.join(`
|
|
1180
|
-
`), O = this.blockquote(
|
|
1181
|
-
a[a.length - 1] = O, s = s.substring(0, s.length -
|
|
1180
|
+
`), O = this.blockquote(_);
|
|
1181
|
+
a[a.length - 1] = O, s = s.substring(0, s.length - k.raw.length) + O.raw, r = r.substring(0, r.length - k.text.length) + O.text;
|
|
1182
1182
|
break;
|
|
1183
|
-
} else if (
|
|
1184
|
-
let
|
|
1183
|
+
} else if (f?.type === "list") {
|
|
1184
|
+
let k = f, _ = k.raw + `
|
|
1185
1185
|
` + n.join(`
|
|
1186
|
-
`), O = this.list(
|
|
1187
|
-
a[a.length - 1] = O, s = s.substring(0, s.length -
|
|
1186
|
+
`), O = this.list(_);
|
|
1187
|
+
a[a.length - 1] = O, s = s.substring(0, s.length - f.raw.length) + O.raw, r = r.substring(0, r.length - k.raw.length) + O.raw, n = _.substring(a.at(-1).raw.length).split(`
|
|
1188
1188
|
`);
|
|
1189
1189
|
continue;
|
|
1190
1190
|
}
|
|
@@ -1199,59 +1199,59 @@ ${p}` : p;
|
|
|
1199
1199
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1200
1200
|
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
1201
1201
|
for (; t; ) {
|
|
1202
|
-
let
|
|
1202
|
+
let d = !1, g = "", p = "";
|
|
1203
1203
|
if (!(e = a.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1204
|
-
|
|
1205
|
-
let
|
|
1206
|
-
`, 1)[0], e[1].length),
|
|
1207
|
-
`, 1)[0],
|
|
1208
|
-
if (this.options.pedantic ? (
|
|
1209
|
-
`, t = t.substring(
|
|
1210
|
-
let O = this.rules.other.nextBulletRegex(
|
|
1204
|
+
g = e[0], t = t.substring(g.length);
|
|
1205
|
+
let m = jr(e[2].split(`
|
|
1206
|
+
`, 1)[0], e[1].length), f = t.split(`
|
|
1207
|
+
`, 1)[0], k = !m.trim(), _ = 0;
|
|
1208
|
+
if (this.options.pedantic ? (_ = 2, p = m.trimStart()) : k ? _ = e[1].length + 1 : (_ = m.search(this.rules.other.nonSpaceChar), _ = _ > 4 ? 1 : _, p = m.slice(_), _ += e[1].length), k && this.rules.other.blankLine.test(f) && (g += f + `
|
|
1209
|
+
`, t = t.substring(f.length + 1), d = !0), !d) {
|
|
1210
|
+
let O = this.rules.other.nextBulletRegex(_), ee = this.rules.other.hrRegex(_), Re = this.rules.other.fencesBeginRegex(_), ne = this.rules.other.headingBeginRegex(_), P = this.rules.other.htmlBeginRegex(_), he = this.rules.other.blockquoteBeginRegex(_);
|
|
1211
1211
|
for (; t; ) {
|
|
1212
|
-
let
|
|
1213
|
-
`, 1)[0],
|
|
1214
|
-
if (
|
|
1215
|
-
if (
|
|
1216
|
-
` +
|
|
1212
|
+
let q = t.split(`
|
|
1213
|
+
`, 1)[0], se;
|
|
1214
|
+
if (f = q, this.options.pedantic ? (f = f.replace(this.rules.other.listReplaceNesting, " "), se = f) : se = f.replace(this.rules.other.tabCharGlobal, " "), Re.test(f) || ne.test(f) || P.test(f) || he.test(f) || O.test(f) || ee.test(f)) break;
|
|
1215
|
+
if (se.search(this.rules.other.nonSpaceChar) >= _ || !f.trim()) p += `
|
|
1216
|
+
` + se.slice(_);
|
|
1217
1217
|
else {
|
|
1218
|
-
if (
|
|
1218
|
+
if (k || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Re.test(m) || ne.test(m) || ee.test(m)) break;
|
|
1219
1219
|
p += `
|
|
1220
|
-
` +
|
|
1220
|
+
` + f;
|
|
1221
1221
|
}
|
|
1222
|
-
|
|
1223
|
-
`, t = t.substring(
|
|
1222
|
+
k = !f.trim(), g += q + `
|
|
1223
|
+
`, t = t.substring(q.length + 1), m = se.slice(_);
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
1226
|
+
r.loose || (o ? r.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (o = !0)), r.items.push({ type: "list_item", raw: g, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: !1, text: p, tokens: [] }), r.raw += g;
|
|
1227
1227
|
}
|
|
1228
1228
|
let c = r.items.at(-1);
|
|
1229
1229
|
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
1230
1230
|
else return;
|
|
1231
1231
|
r.raw = r.raw.trimEnd();
|
|
1232
|
-
for (let
|
|
1233
|
-
if (this.lexer.state.top = !1,
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1232
|
+
for (let d of r.items) {
|
|
1233
|
+
if (this.lexer.state.top = !1, d.tokens = this.lexer.blockTokens(d.text, []), d.task) {
|
|
1234
|
+
if (d.text = d.text.replace(this.rules.other.listReplaceTask, ""), d.tokens[0]?.type === "text" || d.tokens[0]?.type === "paragraph") {
|
|
1235
|
+
d.tokens[0].raw = d.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), d.tokens[0].text = d.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
1236
1236
|
for (let p = this.lexer.inlineQueue.length - 1; p >= 0; p--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)) {
|
|
1237
1237
|
this.lexer.inlineQueue[p].src = this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask, "");
|
|
1238
1238
|
break;
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
1241
|
-
let
|
|
1242
|
-
if (
|
|
1243
|
-
let p = { type: "checkbox", raw:
|
|
1244
|
-
|
|
1241
|
+
let g = this.rules.other.listTaskCheckbox.exec(d.raw);
|
|
1242
|
+
if (g) {
|
|
1243
|
+
let p = { type: "checkbox", raw: g[0] + " ", checked: g[0] !== "[ ]" };
|
|
1244
|
+
d.checked = p.checked, r.loose ? d.tokens[0] && ["paragraph", "text"].includes(d.tokens[0].type) && "tokens" in d.tokens[0] && d.tokens[0].tokens ? (d.tokens[0].raw = p.raw + d.tokens[0].raw, d.tokens[0].text = p.raw + d.tokens[0].text, d.tokens[0].tokens.unshift(p)) : d.tokens.unshift({ type: "paragraph", raw: p.raw, text: p.raw, tokens: [p] }) : d.tokens.unshift(p);
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
if (!r.loose) {
|
|
1248
|
-
let
|
|
1248
|
+
let g = d.tokens.filter((m) => m.type === "space"), p = g.length > 0 && g.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
1249
1249
|
r.loose = p;
|
|
1250
1250
|
}
|
|
1251
1251
|
}
|
|
1252
|
-
if (r.loose) for (let
|
|
1253
|
-
|
|
1254
|
-
for (let
|
|
1252
|
+
if (r.loose) for (let d of r.items) {
|
|
1253
|
+
d.loose = !0;
|
|
1254
|
+
for (let g of d.tokens) g.type === "text" && (g.type = "paragraph");
|
|
1255
1255
|
}
|
|
1256
1256
|
return r;
|
|
1257
1257
|
}
|
|
@@ -1270,12 +1270,12 @@ ${p}` : p;
|
|
|
1270
1270
|
table(t) {
|
|
1271
1271
|
let e = this.rules.block.table.exec(t);
|
|
1272
1272
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
1273
|
-
let n =
|
|
1273
|
+
let n = qn(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
1274
1274
|
`) : [], a = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
1275
1275
|
if (n.length === s.length) {
|
|
1276
1276
|
for (let o of s) this.rules.other.tableAlignRight.test(o) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? a.align.push("left") : a.align.push(null);
|
|
1277
1277
|
for (let o = 0; o < n.length; o++) a.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: !0, align: a.align[o] });
|
|
1278
|
-
for (let o of r) a.rows.push(
|
|
1278
|
+
for (let o of r) a.rows.push(qn(o, a.header.length).map((c, d) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: a.align[d] })));
|
|
1279
1279
|
return a;
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
@@ -1315,7 +1315,7 @@ ${p}` : p;
|
|
|
1315
1315
|
let a = Ke(n.slice(0, -1), "\\");
|
|
1316
1316
|
if ((n.length - a.length) % 2 === 0) return;
|
|
1317
1317
|
} else {
|
|
1318
|
-
let a =
|
|
1318
|
+
let a = Wr(e[2], "()");
|
|
1319
1319
|
if (a === -2) return;
|
|
1320
1320
|
if (a > -1) {
|
|
1321
1321
|
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + a;
|
|
@@ -1327,7 +1327,7 @@ ${p}` : p;
|
|
|
1327
1327
|
let a = this.rules.other.pedanticHrefTitle.exec(s);
|
|
1328
1328
|
a && (s = a[1], r = a[3]);
|
|
1329
1329
|
} else r = e[3] ? e[3].slice(1, -1) : "";
|
|
1330
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)),
|
|
1330
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), Vn(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
1333
|
reflink(t, e) {
|
|
@@ -1338,31 +1338,31 @@ ${p}` : p;
|
|
|
1338
1338
|
let a = n[0].charAt(0);
|
|
1339
1339
|
return { type: "text", raw: a, text: a };
|
|
1340
1340
|
}
|
|
1341
|
-
return
|
|
1341
|
+
return Vn(n, r, n[0], this.lexer, this.rules);
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
emStrong(t, e, n = "") {
|
|
1345
1345
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
1346
1346
|
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1347
|
-
let r = [...s[0]].length - 1, a, o, c = r,
|
|
1348
|
-
for (
|
|
1347
|
+
let r = [...s[0]].length - 1, a, o, c = r, d = 0, g = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1348
|
+
for (g.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = g.exec(e)) != null; ) {
|
|
1349
1349
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a) continue;
|
|
1350
1350
|
if (o = [...a].length, s[3] || s[4]) {
|
|
1351
1351
|
c += o;
|
|
1352
1352
|
continue;
|
|
1353
1353
|
} else if ((s[5] || s[6]) && r % 3 && !((r + o) % 3)) {
|
|
1354
|
-
|
|
1354
|
+
d += o;
|
|
1355
1355
|
continue;
|
|
1356
1356
|
}
|
|
1357
1357
|
if (c -= o, c > 0) continue;
|
|
1358
|
-
o = Math.min(o, o + c +
|
|
1359
|
-
let p = [...s[0]][0].length,
|
|
1358
|
+
o = Math.min(o, o + c + d);
|
|
1359
|
+
let p = [...s[0]][0].length, m = t.slice(0, r + s.index + p + o);
|
|
1360
1360
|
if (Math.min(r, o) % 2) {
|
|
1361
|
-
let
|
|
1362
|
-
return { type: "em", raw:
|
|
1361
|
+
let k = m.slice(1, -1);
|
|
1362
|
+
return { type: "em", raw: m, text: k, tokens: this.lexer.inlineTokens(k) };
|
|
1363
1363
|
}
|
|
1364
|
-
let
|
|
1365
|
-
return { type: "strong", raw:
|
|
1364
|
+
let f = m.slice(2, -2);
|
|
1365
|
+
return { type: "strong", raw: m, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
@@ -1380,8 +1380,8 @@ ${p}` : p;
|
|
|
1380
1380
|
del(t, e, n = "") {
|
|
1381
1381
|
let s = this.rules.inline.delLDelim.exec(t);
|
|
1382
1382
|
if (s && (!s[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1383
|
-
let r = [...s[0]].length - 1, a, o, c = r,
|
|
1384
|
-
for (
|
|
1383
|
+
let r = [...s[0]].length - 1, a, o, c = r, d = this.rules.inline.delRDelim;
|
|
1384
|
+
for (d.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = d.exec(e)) != null; ) {
|
|
1385
1385
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a || (o = [...a].length, o !== r)) continue;
|
|
1386
1386
|
if (s[3] || s[4]) {
|
|
1387
1387
|
c += o;
|
|
@@ -1389,8 +1389,8 @@ ${p}` : p;
|
|
|
1389
1389
|
}
|
|
1390
1390
|
if (c -= o, c > 0) continue;
|
|
1391
1391
|
o = Math.min(o, o + c);
|
|
1392
|
-
let
|
|
1393
|
-
return { type: "del", raw: p, text:
|
|
1392
|
+
let g = [...s[0]][0].length, p = t.slice(0, r + s.index + g + o), m = p.slice(r, -r);
|
|
1393
|
+
return { type: "del", raw: p, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
@@ -1423,28 +1423,28 @@ ${p}` : p;
|
|
|
1423
1423
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
}, u(
|
|
1426
|
+
}, u(Ne, "w"), Ne), ke, re = (ke = class {
|
|
1427
1427
|
constructor(t) {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1434
|
-
let e = { other:
|
|
1435
|
-
this.options.pedantic ? (e.block =
|
|
1428
|
+
C(this, "tokens");
|
|
1429
|
+
C(this, "options");
|
|
1430
|
+
C(this, "state");
|
|
1431
|
+
C(this, "inlineQueue");
|
|
1432
|
+
C(this, "tokenizer");
|
|
1433
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || _e, this.options.tokenizer = this.options.tokenizer || new wt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1434
|
+
let e = { other: Z, block: ft.normal, inline: Xe.normal };
|
|
1435
|
+
this.options.pedantic ? (e.block = ft.pedantic, e.inline = Xe.pedantic) : this.options.gfm && (e.block = ft.gfm, this.options.breaks ? e.inline = Xe.breaks : e.inline = Xe.gfm), this.tokenizer.rules = e;
|
|
1436
1436
|
}
|
|
1437
1437
|
static get rules() {
|
|
1438
|
-
return { block:
|
|
1438
|
+
return { block: ft, inline: Xe };
|
|
1439
1439
|
}
|
|
1440
1440
|
static lex(t, e) {
|
|
1441
|
-
return new
|
|
1441
|
+
return new ke(e).lex(t);
|
|
1442
1442
|
}
|
|
1443
1443
|
static lexInline(t, e) {
|
|
1444
|
-
return new
|
|
1444
|
+
return new ke(e).inlineTokens(t);
|
|
1445
1445
|
}
|
|
1446
1446
|
lex(t) {
|
|
1447
|
-
t = t.replace(
|
|
1447
|
+
t = t.replace(Z.carriageReturn, `
|
|
1448
1448
|
`), this.blockTokens(t, this.tokens);
|
|
1449
1449
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1450
1450
|
let n = this.inlineQueue[e];
|
|
@@ -1453,7 +1453,7 @@ ${p}` : p;
|
|
|
1453
1453
|
return this.inlineQueue = [], this.tokens;
|
|
1454
1454
|
}
|
|
1455
1455
|
blockTokens(t, e = [], n = !1) {
|
|
1456
|
-
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1456
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(Z.tabCharGlobal, " ").replace(Z.spaceLine, "")); t; ) {
|
|
1457
1457
|
let s;
|
|
1458
1458
|
if (this.options.extensions?.block?.some((a) => (s = a.call({ lexer: this }, t, e)) ? (t = t.substring(s.raw.length), e.push(s), !0) : !1)) continue;
|
|
1459
1459
|
if (s = this.tokenizer.space(t)) {
|
|
@@ -1516,8 +1516,8 @@ ${p}` : p;
|
|
|
1516
1516
|
let r = t;
|
|
1517
1517
|
if (this.options.extensions?.startBlock) {
|
|
1518
1518
|
let a = 1 / 0, o = t.slice(1), c;
|
|
1519
|
-
this.options.extensions.startBlock.forEach((
|
|
1520
|
-
c =
|
|
1519
|
+
this.options.extensions.startBlock.forEach((d) => {
|
|
1520
|
+
c = d.call({ lexer: this }, o), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
1521
1521
|
}), a < 1 / 0 && a >= 0 && (r = t.substring(0, a + 1));
|
|
1522
1522
|
}
|
|
1523
1523
|
if (this.state.top && (s = this.tokenizer.paragraph(r))) {
|
|
@@ -1565,7 +1565,7 @@ ${p}` : p;
|
|
|
1565
1565
|
for (; t; ) {
|
|
1566
1566
|
a || (o = ""), a = !1;
|
|
1567
1567
|
let c;
|
|
1568
|
-
if (this.options.extensions?.inline?.some((
|
|
1568
|
+
if (this.options.extensions?.inline?.some((g) => (c = g.call({ lexer: this }, t, e)) ? (t = t.substring(c.raw.length), e.push(c), !0) : !1)) continue;
|
|
1569
1569
|
if (c = this.tokenizer.escape(t)) {
|
|
1570
1570
|
t = t.substring(c.raw.length), e.push(c);
|
|
1571
1571
|
continue;
|
|
@@ -1580,8 +1580,8 @@ ${p}` : p;
|
|
|
1580
1580
|
}
|
|
1581
1581
|
if (c = this.tokenizer.reflink(t, this.tokens.links)) {
|
|
1582
1582
|
t = t.substring(c.raw.length);
|
|
1583
|
-
let
|
|
1584
|
-
c.type === "text" &&
|
|
1583
|
+
let g = e.at(-1);
|
|
1584
|
+
c.type === "text" && g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
1585
1585
|
continue;
|
|
1586
1586
|
}
|
|
1587
1587
|
if (c = this.tokenizer.emStrong(t, n, o)) {
|
|
@@ -1608,43 +1608,43 @@ ${p}` : p;
|
|
|
1608
1608
|
t = t.substring(c.raw.length), e.push(c);
|
|
1609
1609
|
continue;
|
|
1610
1610
|
}
|
|
1611
|
-
let
|
|
1611
|
+
let d = t;
|
|
1612
1612
|
if (this.options.extensions?.startInline) {
|
|
1613
|
-
let
|
|
1614
|
-
this.options.extensions.startInline.forEach((
|
|
1615
|
-
|
|
1616
|
-
}),
|
|
1613
|
+
let g = 1 / 0, p = t.slice(1), m;
|
|
1614
|
+
this.options.extensions.startInline.forEach((f) => {
|
|
1615
|
+
m = f.call({ lexer: this }, p), typeof m == "number" && m >= 0 && (g = Math.min(g, m));
|
|
1616
|
+
}), g < 1 / 0 && g >= 0 && (d = t.substring(0, g + 1));
|
|
1617
1617
|
}
|
|
1618
|
-
if (c = this.tokenizer.inlineText(
|
|
1618
|
+
if (c = this.tokenizer.inlineText(d)) {
|
|
1619
1619
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), a = !0;
|
|
1620
|
-
let
|
|
1621
|
-
|
|
1620
|
+
let g = e.at(-1);
|
|
1621
|
+
g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
1622
1622
|
continue;
|
|
1623
1623
|
}
|
|
1624
1624
|
if (t) {
|
|
1625
|
-
let
|
|
1625
|
+
let g = "Infinite loop on byte: " + t.charCodeAt(0);
|
|
1626
1626
|
if (this.options.silent) {
|
|
1627
|
-
console.error(
|
|
1627
|
+
console.error(g);
|
|
1628
1628
|
break;
|
|
1629
|
-
} else throw new Error(
|
|
1629
|
+
} else throw new Error(g);
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
return e;
|
|
1633
1633
|
}
|
|
1634
|
-
}, u(
|
|
1634
|
+
}, u(ke, "u"), ke), Pe, vt = (Pe = class {
|
|
1635
1635
|
constructor(t) {
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
this.options = t ||
|
|
1636
|
+
C(this, "options");
|
|
1637
|
+
C(this, "parser");
|
|
1638
|
+
this.options = t || _e;
|
|
1639
1639
|
}
|
|
1640
1640
|
space(t) {
|
|
1641
1641
|
return "";
|
|
1642
1642
|
}
|
|
1643
1643
|
code({ text: t, lang: e, escaped: n }) {
|
|
1644
|
-
let s = (e || "").match(
|
|
1644
|
+
let s = (e || "").match(Z.notSpaceStart)?.[0], r = t.replace(Z.endingNewline, "") + `
|
|
1645
1645
|
`;
|
|
1646
|
-
return s ? '<pre><code class="language-' +
|
|
1647
|
-
` : "<pre><code>" + (n ? r :
|
|
1646
|
+
return s ? '<pre><code class="language-' + ce(s) + '">' + (n ? r : ce(r, !0)) + `</code></pre>
|
|
1647
|
+
` : "<pre><code>" + (n ? r : ce(r, !0)) + `</code></pre>
|
|
1648
1648
|
`;
|
|
1649
1649
|
}
|
|
1650
1650
|
blockquote({ tokens: t }) {
|
|
@@ -1722,7 +1722,7 @@ ${t}</tr>
|
|
|
1722
1722
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1723
1723
|
}
|
|
1724
1724
|
codespan({ text: t }) {
|
|
1725
|
-
return `<code>${
|
|
1725
|
+
return `<code>${ce(t, !0)}</code>`;
|
|
1726
1726
|
}
|
|
1727
1727
|
br(t) {
|
|
1728
1728
|
return "<br>";
|
|
@@ -1731,24 +1731,24 @@ ${t}</tr>
|
|
|
1731
1731
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
1732
1732
|
}
|
|
1733
1733
|
link({ href: t, title: e, tokens: n }) {
|
|
1734
|
-
let s = this.parser.parseInline(n), r =
|
|
1734
|
+
let s = this.parser.parseInline(n), r = jn(t);
|
|
1735
1735
|
if (r === null) return s;
|
|
1736
1736
|
t = r;
|
|
1737
1737
|
let a = '<a href="' + t + '"';
|
|
1738
|
-
return e && (a += ' title="' +
|
|
1738
|
+
return e && (a += ' title="' + ce(e) + '"'), a += ">" + s + "</a>", a;
|
|
1739
1739
|
}
|
|
1740
1740
|
image({ href: t, title: e, text: n, tokens: s }) {
|
|
1741
1741
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1742
|
-
let r =
|
|
1743
|
-
if (r === null) return
|
|
1742
|
+
let r = jn(t);
|
|
1743
|
+
if (r === null) return ce(n);
|
|
1744
1744
|
t = r;
|
|
1745
|
-
let a = `<img src="${t}" alt="${
|
|
1746
|
-
return e && (a += ` title="${
|
|
1745
|
+
let a = `<img src="${t}" alt="${ce(n)}"`;
|
|
1746
|
+
return e && (a += ` title="${ce(e)}"`), a += ">", a;
|
|
1747
1747
|
}
|
|
1748
1748
|
text(t) {
|
|
1749
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1749
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : ce(t.text);
|
|
1750
1750
|
}
|
|
1751
|
-
}, u(
|
|
1751
|
+
}, u(Pe, "y"), Pe), $e, ln = ($e = class {
|
|
1752
1752
|
strong({ text: t }) {
|
|
1753
1753
|
return t;
|
|
1754
1754
|
}
|
|
@@ -1779,18 +1779,18 @@ ${t}</tr>
|
|
|
1779
1779
|
checkbox({ raw: t }) {
|
|
1780
1780
|
return t;
|
|
1781
1781
|
}
|
|
1782
|
-
}, u(
|
|
1782
|
+
}, u($e, "$"), $e), we, ie = (we = class {
|
|
1783
1783
|
constructor(t) {
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
this.options = t ||
|
|
1784
|
+
C(this, "options");
|
|
1785
|
+
C(this, "renderer");
|
|
1786
|
+
C(this, "textRenderer");
|
|
1787
|
+
this.options = t || _e, this.options.renderer = this.options.renderer || new vt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ln();
|
|
1788
1788
|
}
|
|
1789
1789
|
static parse(t, e) {
|
|
1790
|
-
return new
|
|
1790
|
+
return new we(e).parse(t);
|
|
1791
1791
|
}
|
|
1792
1792
|
static parseInline(t, e) {
|
|
1793
|
-
return new
|
|
1793
|
+
return new we(e).parseInline(t);
|
|
1794
1794
|
}
|
|
1795
1795
|
parse(t) {
|
|
1796
1796
|
this.renderer.parser = this;
|
|
@@ -1930,11 +1930,11 @@ ${t}</tr>
|
|
|
1930
1930
|
}
|
|
1931
1931
|
return n;
|
|
1932
1932
|
}
|
|
1933
|
-
}, u(
|
|
1933
|
+
}, u(we, "u"), we), be, Qe = (be = class {
|
|
1934
1934
|
constructor(t) {
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
this.options = t ||
|
|
1935
|
+
C(this, "options");
|
|
1936
|
+
C(this, "block");
|
|
1937
|
+
this.options = t || _e;
|
|
1938
1938
|
}
|
|
1939
1939
|
preprocess(t) {
|
|
1940
1940
|
return t;
|
|
@@ -1949,23 +1949,23 @@ ${t}</tr>
|
|
|
1949
1949
|
return t;
|
|
1950
1950
|
}
|
|
1951
1951
|
provideLexer() {
|
|
1952
|
-
return this.block ?
|
|
1952
|
+
return this.block ? re.lex : re.lexInline;
|
|
1953
1953
|
}
|
|
1954
1954
|
provideParser() {
|
|
1955
|
-
return this.block ?
|
|
1955
|
+
return this.block ? ie.parse : ie.parseInline;
|
|
1956
1956
|
}
|
|
1957
|
-
}, u(be, "P"),
|
|
1957
|
+
}, u(be, "P"), C(be, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), C(be, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), be), Ue, Vr = (Ue = class {
|
|
1958
1958
|
constructor(...t) {
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1959
|
+
C(this, "defaults", Qt());
|
|
1960
|
+
C(this, "options", this.setOptions);
|
|
1961
|
+
C(this, "parse", this.parseMarkdown(!0));
|
|
1962
|
+
C(this, "parseInline", this.parseMarkdown(!1));
|
|
1963
|
+
C(this, "Parser", ie);
|
|
1964
|
+
C(this, "Renderer", vt);
|
|
1965
|
+
C(this, "TextRenderer", ln);
|
|
1966
|
+
C(this, "Lexer", re);
|
|
1967
|
+
C(this, "Tokenizer", wt);
|
|
1968
|
+
C(this, "Hooks", Qe);
|
|
1969
1969
|
this.use(...t);
|
|
1970
1970
|
}
|
|
1971
1971
|
walkTokens(t, e) {
|
|
@@ -2016,10 +2016,10 @@ ${t}</tr>
|
|
|
2016
2016
|
for (let a in n.renderer) {
|
|
2017
2017
|
if (!(a in r)) throw new Error(`renderer '${a}' does not exist`);
|
|
2018
2018
|
if (["options", "parser"].includes(a)) continue;
|
|
2019
|
-
let o = a, c = n.renderer[o],
|
|
2020
|
-
r[o] = (...
|
|
2021
|
-
let p = c.apply(r,
|
|
2022
|
-
return p === !1 && (p =
|
|
2019
|
+
let o = a, c = n.renderer[o], d = r[o];
|
|
2020
|
+
r[o] = (...g) => {
|
|
2021
|
+
let p = c.apply(r, g);
|
|
2022
|
+
return p === !1 && (p = d.apply(r, g)), p || "";
|
|
2023
2023
|
};
|
|
2024
2024
|
}
|
|
2025
2025
|
s.renderer = r;
|
|
@@ -2029,10 +2029,10 @@ ${t}</tr>
|
|
|
2029
2029
|
for (let a in n.tokenizer) {
|
|
2030
2030
|
if (!(a in r)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
2031
2031
|
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
2032
|
-
let o = a, c = n.tokenizer[o],
|
|
2033
|
-
r[o] = (...
|
|
2034
|
-
let p = c.apply(r,
|
|
2035
|
-
return p === !1 && (p =
|
|
2032
|
+
let o = a, c = n.tokenizer[o], d = r[o];
|
|
2033
|
+
r[o] = (...g) => {
|
|
2034
|
+
let p = c.apply(r, g);
|
|
2035
|
+
return p === !1 && (p = d.apply(r, g)), p;
|
|
2036
2036
|
};
|
|
2037
2037
|
}
|
|
2038
2038
|
s.tokenizer = r;
|
|
@@ -2042,21 +2042,21 @@ ${t}</tr>
|
|
|
2042
2042
|
for (let a in n.hooks) {
|
|
2043
2043
|
if (!(a in r)) throw new Error(`hook '${a}' does not exist`);
|
|
2044
2044
|
if (["options", "block"].includes(a)) continue;
|
|
2045
|
-
let o = a, c = n.hooks[o],
|
|
2046
|
-
Qe.passThroughHooks.has(a) ? r[o] = (
|
|
2045
|
+
let o = a, c = n.hooks[o], d = r[o];
|
|
2046
|
+
Qe.passThroughHooks.has(a) ? r[o] = (g) => {
|
|
2047
2047
|
if (this.defaults.async && Qe.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
2048
|
-
let
|
|
2049
|
-
return
|
|
2048
|
+
let m = await c.call(r, g);
|
|
2049
|
+
return d.call(r, m);
|
|
2050
2050
|
})();
|
|
2051
|
-
let p = c.call(r,
|
|
2052
|
-
return
|
|
2053
|
-
} : r[o] = (...
|
|
2051
|
+
let p = c.call(r, g);
|
|
2052
|
+
return d.call(r, p);
|
|
2053
|
+
} : r[o] = (...g) => {
|
|
2054
2054
|
if (this.defaults.async) return (async () => {
|
|
2055
|
-
let
|
|
2056
|
-
return
|
|
2055
|
+
let m = await c.apply(r, g);
|
|
2056
|
+
return m === !1 && (m = await d.apply(r, g)), m;
|
|
2057
2057
|
})();
|
|
2058
|
-
let p = c.apply(r,
|
|
2059
|
-
return p === !1 && (p =
|
|
2058
|
+
let p = c.apply(r, g);
|
|
2059
|
+
return p === !1 && (p = d.apply(r, g)), p;
|
|
2060
2060
|
};
|
|
2061
2061
|
}
|
|
2062
2062
|
s.hooks = r;
|
|
@@ -2075,10 +2075,10 @@ ${t}</tr>
|
|
|
2075
2075
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2076
2076
|
}
|
|
2077
2077
|
lexer(t, e) {
|
|
2078
|
-
return
|
|
2078
|
+
return re.lex(t, e ?? this.defaults);
|
|
2079
2079
|
}
|
|
2080
2080
|
parser(t, e) {
|
|
2081
|
-
return
|
|
2081
|
+
return ie.parse(t, e ?? this.defaults);
|
|
2082
2082
|
}
|
|
2083
2083
|
parseMarkdown(t) {
|
|
2084
2084
|
return (e, n) => {
|
|
@@ -2087,16 +2087,16 @@ ${t}</tr>
|
|
|
2087
2087
|
if (typeof e > "u" || e === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
2088
2088
|
if (typeof e != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2089
2089
|
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
2090
|
-
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer() : t ?
|
|
2091
|
-
r.walkTokens && await Promise.all(this.walkTokens(
|
|
2092
|
-
let
|
|
2093
|
-
return r.hooks ? await r.hooks.postprocess(
|
|
2090
|
+
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer() : t ? re.lex : re.lexInline)(o, r), d = r.hooks ? await r.hooks.processAllTokens(c) : c;
|
|
2091
|
+
r.walkTokens && await Promise.all(this.walkTokens(d, r.walkTokens));
|
|
2092
|
+
let g = await (r.hooks ? await r.hooks.provideParser() : t ? ie.parse : ie.parseInline)(d, r);
|
|
2093
|
+
return r.hooks ? await r.hooks.postprocess(g) : g;
|
|
2094
2094
|
})().catch(a);
|
|
2095
2095
|
try {
|
|
2096
2096
|
r.hooks && (e = r.hooks.preprocess(e));
|
|
2097
|
-
let o = (r.hooks ? r.hooks.provideLexer() : t ?
|
|
2097
|
+
let o = (r.hooks ? r.hooks.provideLexer() : t ? re.lex : re.lexInline)(e, r);
|
|
2098
2098
|
r.hooks && (o = r.hooks.processAllTokens(o)), r.walkTokens && this.walkTokens(o, r.walkTokens);
|
|
2099
|
-
let c = (r.hooks ? r.hooks.provideParser() : t ?
|
|
2099
|
+
let c = (r.hooks ? r.hooks.provideParser() : t ? ie.parse : ie.parseInline)(o, r);
|
|
2100
2100
|
return r.hooks && (c = r.hooks.postprocess(c)), c;
|
|
2101
2101
|
} catch (o) {
|
|
2102
2102
|
return a(o);
|
|
@@ -2107,71 +2107,71 @@ ${t}</tr>
|
|
|
2107
2107
|
return (n) => {
|
|
2108
2108
|
if (n.message += `
|
|
2109
2109
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2110
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
2110
|
+
let s = "<p>An error occurred:</p><pre>" + ce(n.message + "", !0) + "</pre>";
|
|
2111
2111
|
return e ? Promise.resolve(s) : s;
|
|
2112
2112
|
}
|
|
2113
2113
|
if (e) return Promise.reject(n);
|
|
2114
2114
|
throw n;
|
|
2115
2115
|
};
|
|
2116
2116
|
}
|
|
2117
|
-
}, u(
|
|
2118
|
-
function
|
|
2119
|
-
return
|
|
2117
|
+
}, u(Ue, "D"), Ue), Ae = new Vr();
|
|
2118
|
+
function L(l, t) {
|
|
2119
|
+
return Ae.parse(l, t);
|
|
2120
2120
|
}
|
|
2121
|
-
u(
|
|
2122
|
-
|
|
2123
|
-
return
|
|
2121
|
+
u(L, "g");
|
|
2122
|
+
L.options = L.setOptions = function(l) {
|
|
2123
|
+
return Ae.setOptions(l), L.defaults = Ae.defaults, ns(L.defaults), L;
|
|
2124
2124
|
};
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
return
|
|
2125
|
+
L.getDefaults = Qt;
|
|
2126
|
+
L.defaults = _e;
|
|
2127
|
+
L.use = function(...l) {
|
|
2128
|
+
return Ae.use(...l), L.defaults = Ae.defaults, ns(L.defaults), L;
|
|
2129
2129
|
};
|
|
2130
|
-
|
|
2131
|
-
return
|
|
2130
|
+
L.walkTokens = function(l, t) {
|
|
2131
|
+
return Ae.walkTokens(l, t);
|
|
2132
2132
|
};
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
const
|
|
2133
|
+
L.parseInline = Ae.parseInline;
|
|
2134
|
+
L.Parser = ie;
|
|
2135
|
+
L.parser = ie.parse;
|
|
2136
|
+
L.Renderer = vt;
|
|
2137
|
+
L.TextRenderer = ln;
|
|
2138
|
+
L.Lexer = re;
|
|
2139
|
+
L.lexer = re.lex;
|
|
2140
|
+
L.Tokenizer = wt;
|
|
2141
|
+
L.Hooks = Qe;
|
|
2142
|
+
L.parse = L;
|
|
2143
|
+
L.options;
|
|
2144
|
+
L.setOptions;
|
|
2145
|
+
L.use;
|
|
2146
|
+
L.walkTokens;
|
|
2147
|
+
L.parseInline;
|
|
2148
|
+
ie.parse;
|
|
2149
|
+
re.lex;
|
|
2150
|
+
const Yr = { class: "flex flex-col h-full relative" }, Zr = {
|
|
2151
2151
|
key: 0,
|
|
2152
2152
|
class: "pb-4"
|
|
2153
|
-
},
|
|
2153
|
+
}, Xr = {
|
|
2154
2154
|
key: 0,
|
|
2155
2155
|
class: "flex flex-col items-center justify-center pt-12 pb-6 px-4"
|
|
2156
|
-
},
|
|
2156
|
+
}, Kr = { class: "relative mb-3" }, Qr = ["src", "alt"], Jr = ["title"], ei = {
|
|
2157
2157
|
key: 0,
|
|
2158
2158
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2159
|
-
},
|
|
2159
|
+
}, ti = ["src", "alt"], ni = ["src", "alt"], si = ["src"], ri = ["href"], ii = ["innerHTML"], ai = {
|
|
2160
2160
|
key: 1,
|
|
2161
2161
|
class: "flex gap-2 justify-start items-end mb-4"
|
|
2162
|
-
},
|
|
2162
|
+
}, li = { class: "flex-shrink-0" }, oi = ["src", "alt"], ci = {
|
|
2163
2163
|
key: 0,
|
|
2164
|
-
class: "flex items-center gap-2 px-
|
|
2165
|
-
},
|
|
2164
|
+
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto"
|
|
2165
|
+
}, ui = ["src", "alt"], hi = { class: "max-w-20 truncate" }, pi = ["onClick"], di = {
|
|
2166
2166
|
key: 0,
|
|
2167
2167
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
2168
|
-
},
|
|
2168
|
+
}, fi = ["disabled"], gi = {
|
|
2169
2169
|
key: 0,
|
|
2170
2170
|
class: "i-svg-spinners-ring-resize size-4"
|
|
2171
|
-
},
|
|
2171
|
+
}, mi = {
|
|
2172
2172
|
key: 1,
|
|
2173
2173
|
class: "i-tabler-paperclip size-5"
|
|
2174
|
-
},
|
|
2174
|
+
}, xi = ["placeholder", "disabled"], bi = ["disabled"], Ci = /* @__PURE__ */ Ee({
|
|
2175
2175
|
__name: "ElAgentChat",
|
|
2176
2176
|
props: {
|
|
2177
2177
|
chatController: {},
|
|
@@ -2185,13 +2185,13 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2185
2185
|
emptyStateMessage: {}
|
|
2186
2186
|
},
|
|
2187
2187
|
setup(l) {
|
|
2188
|
-
const t = new
|
|
2189
|
-
t.link = ({ href: E, text:
|
|
2188
|
+
const t = new L.Renderer();
|
|
2189
|
+
t.link = ({ href: E, text: x }) => `<a href="${E}" target="_blank" rel="noopener noreferrer">${x}</a>`, L.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2190
2190
|
function e(E) {
|
|
2191
2191
|
if (!E)
|
|
2192
2192
|
return "";
|
|
2193
|
-
const
|
|
2194
|
-
return
|
|
2193
|
+
const x = L.parse(E, { async: !1 });
|
|
2194
|
+
return ar.sanitize(x, { ADD_ATTR: ["target"] });
|
|
2195
2195
|
}
|
|
2196
2196
|
u(e, "renderMarkdown");
|
|
2197
2197
|
const n = {
|
|
@@ -2205,15 +2205,15 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2205
2205
|
}, r = W(() => l.setupHint ?? n[l.scope]), a = W(() => {
|
|
2206
2206
|
const E = { ...s[l.scope] };
|
|
2207
2207
|
return l.scope === "org" && l.scopeName && (E.label = l.scopeName, E.tooltip = `Visible to ${l.scopeName} members`), E;
|
|
2208
|
-
}), o = W(() => l.scale === "lg"), c =
|
|
2209
|
-
function
|
|
2210
|
-
const
|
|
2211
|
-
return !
|
|
2208
|
+
}), o = W(() => l.scale === "lg"), c = Y(""), d = Y(!1), g = Y(), p = Y(), m = Y(), f = Y([]), k = Y(!1);
|
|
2209
|
+
function _(E, x) {
|
|
2210
|
+
const R = E[x], A = E[x + 1];
|
|
2211
|
+
return !A || A.sender !== R.sender;
|
|
2212
2212
|
}
|
|
2213
|
-
u(
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2216
|
-
if (l.chatController && !
|
|
2213
|
+
u(_, "shouldShowAvatar");
|
|
2214
|
+
const O = W(() => l.chatController?.textState.value), ee = W(() => O.value?.isConnected ?? !1), Re = W(() => O.value?.isThinking ?? !1), ne = W(() => O.value?.connectionStatus === "disconnected" && !!O.value?.error), P = W(() => O.value?.connectionStatus !== "connected" && !O.value?.error), he = W(() => O.value?.error), q = W(() => l.chatController?.sharedMessages.value?.filter((E) => E.sender !== "system") ?? []), se = W(() => !ee.value), St = W(() => ne.value ? "Agent is offline" : P.value ? "Connecting..." : "Message"), tt = W(() => (c.value.trim() || f.value.length > 0) && !se.value && !k.value);
|
|
2215
|
+
Kt(async () => {
|
|
2216
|
+
if (l.chatController && !ee.value)
|
|
2217
2217
|
try {
|
|
2218
2218
|
await l.chatController.startTextConversation();
|
|
2219
2219
|
} catch (E) {
|
|
@@ -2221,336 +2221,350 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2221
2221
|
}
|
|
2222
2222
|
});
|
|
2223
2223
|
async function nt() {
|
|
2224
|
-
const E = c.value.trim(),
|
|
2225
|
-
if (!E && !
|
|
2224
|
+
const E = c.value.trim(), x = f.value.length > 0;
|
|
2225
|
+
if (!E && !x || !l.chatController || !ee.value || k.value)
|
|
2226
2226
|
return;
|
|
2227
|
-
const
|
|
2228
|
-
c.value = "",
|
|
2227
|
+
const R = c.value, A = x ? [...f.value] : void 0;
|
|
2228
|
+
c.value = "", f.value = [], p.value && (p.value.style.height = "auto", p.value.focus());
|
|
2229
2229
|
try {
|
|
2230
|
-
await l.chatController.sendChatMessage(
|
|
2231
|
-
} catch (
|
|
2232
|
-
console.error("Error sending message:",
|
|
2230
|
+
await l.chatController.sendChatMessage(R, A), De();
|
|
2231
|
+
} catch (H) {
|
|
2232
|
+
console.error("Error sending message:", H);
|
|
2233
2233
|
}
|
|
2234
2234
|
}
|
|
2235
2235
|
u(nt, "sendMessage");
|
|
2236
|
-
function
|
|
2236
|
+
function F(E) {
|
|
2237
2237
|
E.key === "Enter" && !E.shiftKey && (E.preventDefault(), nt());
|
|
2238
2238
|
}
|
|
2239
|
-
u(
|
|
2240
|
-
function
|
|
2241
|
-
|
|
2242
|
-
|
|
2239
|
+
u(F, "handleKeydown");
|
|
2240
|
+
function De() {
|
|
2241
|
+
g.value && Ut(() => {
|
|
2242
|
+
g.value.scrollTop = g.value.scrollHeight;
|
|
2243
2243
|
});
|
|
2244
2244
|
}
|
|
2245
|
-
u(
|
|
2246
|
-
function Be() {
|
|
2247
|
-
d.value && (d.value.style.height = "auto", d.value.style.height = `${Math.min(d.value.scrollHeight, 150)}px`);
|
|
2248
|
-
}
|
|
2249
|
-
u(Be, "adjustTextareaHeight"), Je(c, () => $t(() => Be()));
|
|
2250
|
-
const L = W(() => l.variant === "light");
|
|
2245
|
+
u(De, "scrollToBottom");
|
|
2251
2246
|
function Fe() {
|
|
2252
|
-
p.value
|
|
2247
|
+
p.value && (p.value.style.height = "auto", p.value.style.height = `${Math.min(p.value.scrollHeight, 150)}px`);
|
|
2253
2248
|
}
|
|
2254
|
-
u(Fe, "
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2249
|
+
u(Fe, "adjustTextareaHeight"), Je(c, () => Ut(() => Fe()));
|
|
2250
|
+
const M = W(() => l.variant === "light");
|
|
2251
|
+
function At() {
|
|
2252
|
+
m.value?.click();
|
|
2253
|
+
}
|
|
2254
|
+
u(At, "triggerFileInput");
|
|
2255
|
+
async function Et(E) {
|
|
2256
|
+
const x = E.target, R = x.files?.[0];
|
|
2257
|
+
if (!(!R || !l.uploadFn)) {
|
|
2258
|
+
k.value = !0;
|
|
2259
2259
|
try {
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
} catch (
|
|
2263
|
-
console.error("Upload failed:",
|
|
2260
|
+
const A = await l.uploadFn(R);
|
|
2261
|
+
f.value = [...f.value, A];
|
|
2262
|
+
} catch (A) {
|
|
2263
|
+
console.error("Upload failed:", A);
|
|
2264
2264
|
} finally {
|
|
2265
|
-
|
|
2265
|
+
k.value = !1, x.value = "";
|
|
2266
2266
|
}
|
|
2267
2267
|
}
|
|
2268
2268
|
}
|
|
2269
|
-
u(
|
|
2270
|
-
function
|
|
2271
|
-
|
|
2269
|
+
u(Et, "handleFileSelect");
|
|
2270
|
+
function _t(E) {
|
|
2271
|
+
f.value = f.value.filter((x, R) => R !== E);
|
|
2272
2272
|
}
|
|
2273
|
-
u(
|
|
2274
|
-
function
|
|
2275
|
-
if (
|
|
2276
|
-
const
|
|
2277
|
-
return
|
|
2278
|
-
}
|
|
2279
|
-
const
|
|
2280
|
-
if (!
|
|
2281
|
-
const
|
|
2282
|
-
return new Date(
|
|
2273
|
+
u(_t, "removeAttachment");
|
|
2274
|
+
function He(E, x) {
|
|
2275
|
+
if (x === 0) {
|
|
2276
|
+
const me = E[x];
|
|
2277
|
+
return me?.timestamp ? st(new Date(me.timestamp)) : null;
|
|
2278
|
+
}
|
|
2279
|
+
const R = E[x - 1], A = E[x];
|
|
2280
|
+
if (!R?.timestamp || !A?.timestamp) return null;
|
|
2281
|
+
const H = new Date(R.timestamp).getTime();
|
|
2282
|
+
return new Date(A.timestamp).getTime() - H > 36e5 ? st(new Date(A.timestamp)) : null;
|
|
2283
2283
|
}
|
|
2284
|
-
u(
|
|
2285
|
-
function
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
const
|
|
2289
|
-
if (
|
|
2290
|
-
if (
|
|
2291
|
-
const
|
|
2284
|
+
u(He, "shouldShowTimeDivider");
|
|
2285
|
+
function st(E) {
|
|
2286
|
+
const x = /* @__PURE__ */ new Date(), R = E.toDateString() === x.toDateString(), A = new Date(x);
|
|
2287
|
+
A.setDate(A.getDate() - 1);
|
|
2288
|
+
const H = E.toDateString() === A.toDateString(), z = E.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2289
|
+
if (R) return z;
|
|
2290
|
+
if (H) return `Yesterday, ${z}`;
|
|
2291
|
+
const ge = E.getFullYear() === x.getFullYear();
|
|
2292
2292
|
return `${E.toLocaleDateString("en-US", {
|
|
2293
2293
|
weekday: "long",
|
|
2294
2294
|
month: "short",
|
|
2295
2295
|
day: "numeric",
|
|
2296
|
-
...
|
|
2297
|
-
})}, ${
|
|
2296
|
+
...ge ? {} : { year: "numeric" }
|
|
2297
|
+
})}, ${z}`;
|
|
2298
2298
|
}
|
|
2299
|
-
return u(
|
|
2300
|
-
E.length > 0 &&
|
|
2301
|
-
}, { immediate: !0, deep: !0 }), (E,
|
|
2302
|
-
|
|
2303
|
-
|
|
2299
|
+
return u(st, "formatTimeDivider"), Je(q, (E) => {
|
|
2300
|
+
E.length > 0 && Ut(() => De());
|
|
2301
|
+
}, { immediate: !0, deep: !0 }), (E, x) => (T(), S("div", Yr, [
|
|
2302
|
+
M.value ? B("", !0) : (T(), S("div", Zr, [
|
|
2303
|
+
Bt($s, {
|
|
2304
2304
|
agent: l.agent,
|
|
2305
|
-
"is-online":
|
|
2305
|
+
"is-online": ee.value
|
|
2306
2306
|
}, null, 8, ["agent", "is-online"])
|
|
2307
2307
|
])),
|
|
2308
|
-
|
|
2308
|
+
ne.value ? (T(), S("div", {
|
|
2309
2309
|
key: 1,
|
|
2310
|
-
class:
|
|
2310
|
+
class: y(["py-16 flex flex-col items-center justify-center gap-3 text-sm", M.value ? "text-theme-400" : "text-white/60"])
|
|
2311
2311
|
}, [
|
|
2312
2312
|
v("i", {
|
|
2313
|
-
class:
|
|
2313
|
+
class: y(["i-heroicons-cloud-arrow-down size-8", M.value ? "text-theme-300" : "text-white/40"])
|
|
2314
2314
|
}, null, 2),
|
|
2315
|
-
v("span", null,
|
|
2316
|
-
], 2)) :
|
|
2315
|
+
v("span", null, ue(he.value), 1)
|
|
2316
|
+
], 2)) : P.value ? (T(), S("div", {
|
|
2317
2317
|
key: 2,
|
|
2318
|
-
class:
|
|
2318
|
+
class: y(["py-16 flex flex-col items-center justify-center gap-2 text-sm", M.value ? "text-theme-400" : "text-theme-600"])
|
|
2319
2319
|
}, [
|
|
2320
|
-
|
|
2321
|
-
], 2)) : r.value ? (
|
|
2320
|
+
Bt(Cn, { class: "size-4" })
|
|
2321
|
+
], 2)) : r.value ? (T(), S("div", {
|
|
2322
2322
|
key: 3,
|
|
2323
|
-
class:
|
|
2323
|
+
class: y(["flex items-center justify-center gap-1.5 py-2 text-[11px]", M.value ? "text-theme-300" : "text-white/30"])
|
|
2324
2324
|
}, [
|
|
2325
|
-
|
|
2326
|
-
v("span", null,
|
|
2327
|
-
], 2)) :
|
|
2325
|
+
x[4] || (x[4] = v("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2326
|
+
v("span", null, ue(r.value), 1)
|
|
2327
|
+
], 2)) : B("", !0),
|
|
2328
2328
|
v("div", {
|
|
2329
2329
|
ref_key: "messagesContainer",
|
|
2330
|
-
ref:
|
|
2331
|
-
class: "flex-1 overflow-y-auto overflow-x-hidden
|
|
2330
|
+
ref: g,
|
|
2331
|
+
class: "flex-1 overflow-y-auto overflow-x-hidden pt-4 pb-[120px] px-3 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
|
|
2332
2332
|
}, [
|
|
2333
|
-
q.value.length === 0 && !
|
|
2334
|
-
v("div",
|
|
2333
|
+
q.value.length === 0 && !P.value && !ne.value ? (T(), S("div", Xr, [
|
|
2334
|
+
v("div", Kr, [
|
|
2335
2335
|
v("img", {
|
|
2336
2336
|
src: l.agent.avatarUrl.value,
|
|
2337
2337
|
alt: l.agent.displayName.value,
|
|
2338
|
-
class:
|
|
2339
|
-
}, null, 10,
|
|
2340
|
-
|
|
2338
|
+
class: y(["rounded-full object-cover", o.value ? "size-28" : "size-20"])
|
|
2339
|
+
}, null, 10, Qr),
|
|
2340
|
+
ee.value ? (T(), S("span", {
|
|
2341
2341
|
key: 0,
|
|
2342
|
-
class:
|
|
2342
|
+
class: y(["absolute bottom-0.5 right-0.5 flex items-center justify-center", o.value ? "size-6" : "size-5"])
|
|
2343
2343
|
}, [
|
|
2344
2344
|
v("span", {
|
|
2345
|
-
class:
|
|
2345
|
+
class: y(["absolute inline-flex rounded-full bg-emerald-400/40 animate-ping", o.value ? "size-4" : "size-3"]),
|
|
2346
2346
|
style: { "animation-duration": "2.5s" }
|
|
2347
2347
|
}, null, 2),
|
|
2348
2348
|
v("span", {
|
|
2349
|
-
class:
|
|
2349
|
+
class: y(["relative inline-flex rounded-full bg-emerald-500 ring-2", [
|
|
2350
2350
|
o.value ? "size-3" : "size-2.5",
|
|
2351
|
-
|
|
2351
|
+
M.value ? "ring-white" : "ring-theme-900"
|
|
2352
2352
|
]])
|
|
2353
2353
|
}, null, 2)
|
|
2354
|
-
], 2)) :
|
|
2354
|
+
], 2)) : B("", !0)
|
|
2355
2355
|
]),
|
|
2356
2356
|
v("div", {
|
|
2357
|
-
class:
|
|
2358
|
-
},
|
|
2357
|
+
class: y(["font-semibold", [M.value ? "text-theme-900" : "text-white", o.value ? "text-lg" : "text-base"]])
|
|
2358
|
+
}, ue(l.agent.displayName.value), 3),
|
|
2359
2359
|
v("p", {
|
|
2360
|
-
class:
|
|
2361
|
-
},
|
|
2360
|
+
class: y(["mt-1 text-center", [M.value ? "text-theme-300" : "text-white/30", o.value ? "text-sm" : "text-xs"]])
|
|
2361
|
+
}, ue(l.emptyStateMessage || "Send a message to get started"), 3),
|
|
2362
2362
|
v("div", {
|
|
2363
|
-
class:
|
|
2363
|
+
class: y(["inline-flex items-center gap-1.5 mt-6 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"]),
|
|
2364
2364
|
title: a.value.tooltip
|
|
2365
2365
|
}, [
|
|
2366
2366
|
v("i", {
|
|
2367
|
-
class:
|
|
2367
|
+
class: y([a.value.icon, "size-3"])
|
|
2368
2368
|
}, null, 2),
|
|
2369
|
-
v("span", null,
|
|
2370
|
-
], 10,
|
|
2371
|
-
])) :
|
|
2372
|
-
(
|
|
2373
|
-
key:
|
|
2369
|
+
v("span", null, ue(a.value.label), 1)
|
|
2370
|
+
], 10, Jr)
|
|
2371
|
+
])) : B("", !0),
|
|
2372
|
+
(T(!0), S(Te, null, gt(q.value, (R, A) => (T(), S(Te, {
|
|
2373
|
+
key: R.id
|
|
2374
2374
|
}, [
|
|
2375
|
-
|
|
2375
|
+
He(q.value, A) ? (T(), S("div", ei, [
|
|
2376
2376
|
v("div", {
|
|
2377
|
-
class:
|
|
2377
|
+
class: y(["flex-1 h-px", M.value ? "bg-theme-200" : "bg-white/10"])
|
|
2378
2378
|
}, null, 2),
|
|
2379
2379
|
v("span", {
|
|
2380
|
-
class:
|
|
2381
|
-
},
|
|
2380
|
+
class: y(["font-medium shrink-0", [M.value ? "text-theme-400" : "text-white/40", o.value ? "text-xs" : "text-[11px]"]])
|
|
2381
|
+
}, ue(He(q.value, A)), 3),
|
|
2382
2382
|
v("div", {
|
|
2383
|
-
class:
|
|
2383
|
+
class: y(["flex-1 h-px", M.value ? "bg-theme-200" : "bg-white/10"])
|
|
2384
2384
|
}, null, 2)
|
|
2385
|
-
])) :
|
|
2385
|
+
])) : B("", !0),
|
|
2386
2386
|
v("div", {
|
|
2387
|
-
class:
|
|
2388
|
-
"justify-end":
|
|
2389
|
-
"justify-start":
|
|
2390
|
-
"mb-4":
|
|
2387
|
+
class: y(["flex gap-2 items-end", {
|
|
2388
|
+
"justify-end": R.sender === "user",
|
|
2389
|
+
"justify-start": R.sender === "agent",
|
|
2390
|
+
"mb-4": _(q.value, A)
|
|
2391
2391
|
}])
|
|
2392
2392
|
}, [
|
|
2393
|
-
|
|
2393
|
+
R.sender === "agent" ? (T(), S("div", {
|
|
2394
2394
|
key: 0,
|
|
2395
|
-
class:
|
|
2395
|
+
class: y(["flex-shrink-0", o.value ? "size-10" : "size-8"])
|
|
2396
2396
|
}, [
|
|
2397
|
-
|
|
2397
|
+
_(q.value, A) ? (T(), S("img", {
|
|
2398
2398
|
key: 0,
|
|
2399
2399
|
src: l.agent.avatarUrl.value,
|
|
2400
2400
|
alt: l.agent.displayName.value,
|
|
2401
|
-
class:
|
|
2402
|
-
}, null, 10,
|
|
2403
|
-
], 2)) :
|
|
2401
|
+
class: y(["rounded-full object-cover", o.value ? "size-10" : "size-7"])
|
|
2402
|
+
}, null, 10, ti)) : B("", !0)
|
|
2403
|
+
], 2)) : B("", !0),
|
|
2404
2404
|
v("div", {
|
|
2405
|
-
class:
|
|
2405
|
+
class: y(R.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2406
2406
|
}, [
|
|
2407
|
-
|
|
2407
|
+
R.attachments?.length ? (T(), S("div", {
|
|
2408
2408
|
key: 0,
|
|
2409
|
-
class:
|
|
2409
|
+
class: y(["mb-1 space-y-1", R.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2410
2410
|
}, [
|
|
2411
|
-
(
|
|
2412
|
-
|
|
2411
|
+
(T(!0), S(Te, null, gt(R.attachments, (H, z) => (T(), S(Te, { key: z }, [
|
|
2412
|
+
H.type === "image" ? (T(), S("img", {
|
|
2413
2413
|
key: 0,
|
|
2414
|
-
src:
|
|
2415
|
-
alt:
|
|
2416
|
-
class:
|
|
2417
|
-
}, null, 10,
|
|
2414
|
+
src: H.url,
|
|
2415
|
+
alt: H.name,
|
|
2416
|
+
class: y(["rounded-xl object-cover max-h-48", o.value ? "max-w-[320px]" : "max-w-[240px]"])
|
|
2417
|
+
}, null, 10, ni)) : H.type === "audio" ? (T(), S("audio", {
|
|
2418
2418
|
key: 1,
|
|
2419
|
-
src:
|
|
2419
|
+
src: H.url,
|
|
2420
2420
|
controls: "",
|
|
2421
2421
|
class: "max-w-full"
|
|
2422
|
-
}, null, 8,
|
|
2422
|
+
}, null, 8, si)) : (T(), S("a", {
|
|
2423
2423
|
key: 2,
|
|
2424
|
-
href:
|
|
2424
|
+
href: H.url,
|
|
2425
2425
|
target: "_blank",
|
|
2426
2426
|
rel: "noopener",
|
|
2427
|
-
class:
|
|
2427
|
+
class: y(["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"])
|
|
2428
2428
|
}, [
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
], 10,
|
|
2429
|
+
x[5] || (x[5] = v("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2430
|
+
ht(" " + ue(H.name), 1)
|
|
2431
|
+
], 10, ri))
|
|
2432
2432
|
], 64))), 128))
|
|
2433
|
-
], 2)) :
|
|
2434
|
-
|
|
2433
|
+
], 2)) : B("", !0),
|
|
2434
|
+
R.text ? (T(), S("div", {
|
|
2435
2435
|
key: 1,
|
|
2436
|
-
class:
|
|
2436
|
+
class: y(["rounded-2xl px-3.5 py-2", R.sender === "user" ? "bg-primary-500 text-white" : M.value ? "bg-theme-100 text-theme-800" : "bg-white/15 backdrop-blur-sm text-white/95"])
|
|
2437
2437
|
}, [
|
|
2438
2438
|
v("div", {
|
|
2439
|
-
class:
|
|
2439
|
+
class: y(["chat-msg-prose break-words", [
|
|
2440
2440
|
o.value ? "text-[15px] leading-[1.6]" : "text-[13px] leading-[1.55]",
|
|
2441
|
-
|
|
2441
|
+
R.sender === "user" || !M.value ? "chat-msg-prose-invert" : ""
|
|
2442
2442
|
]]),
|
|
2443
|
-
innerHTML: e(
|
|
2444
|
-
}, null, 10,
|
|
2445
|
-
], 2)) :
|
|
2443
|
+
innerHTML: e(R.text)
|
|
2444
|
+
}, null, 10, ii)
|
|
2445
|
+
], 2)) : B("", !0)
|
|
2446
2446
|
], 2)
|
|
2447
2447
|
], 2)
|
|
2448
2448
|
], 64))), 128)),
|
|
2449
|
-
|
|
2450
|
-
v("div",
|
|
2449
|
+
Re.value ? (T(), S("div", ai, [
|
|
2450
|
+
v("div", li, [
|
|
2451
2451
|
v("img", {
|
|
2452
2452
|
src: l.agent.avatarUrl.value,
|
|
2453
2453
|
alt: l.agent.displayName.value,
|
|
2454
|
-
class:
|
|
2455
|
-
}, null, 10,
|
|
2454
|
+
class: y(["rounded-full object-cover", o.value ? "size-10" : "size-8"])
|
|
2455
|
+
}, null, 10, oi)
|
|
2456
2456
|
]),
|
|
2457
2457
|
v("div", {
|
|
2458
|
-
class:
|
|
2458
|
+
class: y(["rounded-2xl px-4 py-2.5 flex items-center", M.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2459
2459
|
}, [
|
|
2460
2460
|
v("i", {
|
|
2461
|
-
class:
|
|
2461
|
+
class: y(["i-svg-spinners-3-dots-fade size-6", M.value ? "text-theme-400" : "text-white/70"])
|
|
2462
2462
|
}, null, 2)
|
|
2463
2463
|
], 2)
|
|
2464
|
-
])) :
|
|
2464
|
+
])) : B("", !0)
|
|
2465
2465
|
], 512),
|
|
2466
|
-
v("div",
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2466
|
+
v("div", {
|
|
2467
|
+
class: y(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", M.value ? "bg-gradient-to-t from-white via-white/95 to-white/70" : "bg-gradient-to-t from-black/80 via-black/70 to-black/40"])
|
|
2468
|
+
}, [
|
|
2469
|
+
f.value.length > 0 ? (T(), S("div", ci, [
|
|
2470
|
+
(T(!0), S(Te, null, gt(f.value, (R, A) => (T(), S("div", {
|
|
2471
|
+
key: A,
|
|
2470
2472
|
class: "relative shrink-0 group"
|
|
2471
2473
|
}, [
|
|
2472
|
-
|
|
2474
|
+
R.type === "image" ? (T(), S("img", {
|
|
2473
2475
|
key: 0,
|
|
2474
|
-
src:
|
|
2475
|
-
alt:
|
|
2476
|
-
class:
|
|
2477
|
-
}, null, 10,
|
|
2476
|
+
src: R.url,
|
|
2477
|
+
alt: R.name,
|
|
2478
|
+
class: y(["size-14 rounded-xl object-cover border", M.value ? "border-black/10" : "border-white/20"])
|
|
2479
|
+
}, null, 10, ui)) : (T(), S("div", {
|
|
2478
2480
|
key: 1,
|
|
2479
|
-
class:
|
|
2481
|
+
class: y(["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"])
|
|
2480
2482
|
}, [
|
|
2481
|
-
|
|
2482
|
-
v("span",
|
|
2483
|
+
x[6] || (x[6] = v("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2484
|
+
v("span", hi, ue(R.name), 1)
|
|
2483
2485
|
], 2)),
|
|
2484
2486
|
v("button", {
|
|
2485
|
-
class: "absolute -top-1.5 -right-1.5 size-5 flex items-center justify-center rounded-full bg-theme-
|
|
2486
|
-
onClick: /* @__PURE__ */ u((
|
|
2487
|
-
}, [...
|
|
2487
|
+
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",
|
|
2488
|
+
onClick: /* @__PURE__ */ u((H) => _t(A), "onClick")
|
|
2489
|
+
}, [...x[7] || (x[7] = [
|
|
2488
2490
|
v("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2489
|
-
])], 8,
|
|
2491
|
+
])], 8, pi)
|
|
2490
2492
|
]))), 128)),
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
])) :
|
|
2494
|
-
])) :
|
|
2495
|
-
l.uploadFn ? (
|
|
2493
|
+
k.value ? (T(), S("div", di, [
|
|
2494
|
+
Bt(Cn, { class: "size-5" })
|
|
2495
|
+
])) : B("", !0)
|
|
2496
|
+
])) : B("", !0),
|
|
2497
|
+
l.uploadFn ? (T(), S("input", {
|
|
2496
2498
|
key: 1,
|
|
2497
2499
|
ref_key: "fileInput",
|
|
2498
|
-
ref:
|
|
2500
|
+
ref: m,
|
|
2499
2501
|
type: "file",
|
|
2500
2502
|
accept: "image/*,audio/*,video/*",
|
|
2501
2503
|
class: "hidden",
|
|
2502
|
-
onChange:
|
|
2503
|
-
}, null, 544)) :
|
|
2504
|
+
onChange: Et
|
|
2505
|
+
}, null, 544)) : B("", !0),
|
|
2504
2506
|
v("div", {
|
|
2505
|
-
class:
|
|
2507
|
+
class: y(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", M.value ? d.value ? "bg-white ring-1 ring-black/10 shadow-[0_4px_16px_rgba(0,0,0,0.06)]" : "bg-theme-50 ring-1 ring-transparent hover:ring-black/5" : d.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2506
2508
|
}, [
|
|
2507
|
-
l.uploadFn ? (
|
|
2509
|
+
l.uploadFn ? (T(), S("button", {
|
|
2508
2510
|
key: 0,
|
|
2509
|
-
class:
|
|
2511
|
+
class: y(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 cursor-pointer", [
|
|
2510
2512
|
o.value ? "size-10" : "size-9",
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
+
M.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2514
|
+
k.value ? "opacity-50 pointer-events-none" : ""
|
|
2513
2515
|
]]),
|
|
2514
|
-
disabled:
|
|
2515
|
-
onClick:
|
|
2516
|
+
disabled: se.value || k.value,
|
|
2517
|
+
onClick: At
|
|
2516
2518
|
}, [
|
|
2517
|
-
|
|
2518
|
-
], 10,
|
|
2519
|
-
|
|
2519
|
+
k.value ? (T(), S("i", gi)) : (T(), S("i", mi))
|
|
2520
|
+
], 10, fi)) : B("", !0),
|
|
2521
|
+
Zn(v("textarea", {
|
|
2520
2522
|
ref_key: "textarea",
|
|
2521
|
-
ref:
|
|
2522
|
-
"onUpdate:modelValue":
|
|
2523
|
+
ref: p,
|
|
2524
|
+
"onUpdate:modelValue": x[0] || (x[0] = (R) => c.value = R),
|
|
2523
2525
|
rows: "1",
|
|
2524
2526
|
enterkeyhint: "send",
|
|
2525
|
-
placeholder:
|
|
2526
|
-
disabled:
|
|
2527
|
-
style:
|
|
2528
|
-
class:
|
|
2529
|
-
onKeydown:
|
|
2530
|
-
|
|
2531
|
-
[
|
|
2527
|
+
placeholder: St.value,
|
|
2528
|
+
disabled: se.value,
|
|
2529
|
+
style: { fontSize: "16px", resize: "none" },
|
|
2530
|
+
class: y(["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"]),
|
|
2531
|
+
onKeydown: F,
|
|
2532
|
+
onFocus: x[1] || (x[1] = (R) => d.value = !0),
|
|
2533
|
+
onBlur: x[2] || (x[2] = (R) => d.value = !1)
|
|
2534
|
+
}, null, 42, xi), [
|
|
2535
|
+
[Xn, c.value]
|
|
2532
2536
|
]),
|
|
2533
2537
|
v("button", {
|
|
2534
|
-
class:
|
|
2538
|
+
class: y(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5", [
|
|
2535
2539
|
o.value ? "size-10" : "size-9",
|
|
2536
|
-
tt.value ? "bg-primary-500 text-white hover:
|
|
2540
|
+
tt.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : M.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"
|
|
2537
2541
|
]]),
|
|
2538
2542
|
disabled: !tt.value,
|
|
2539
|
-
onClick:
|
|
2540
|
-
}, [...
|
|
2543
|
+
onClick: x[3] || (x[3] = (R) => nt())
|
|
2544
|
+
}, [...x[8] || (x[8] = [
|
|
2541
2545
|
v("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2542
|
-
])], 10,
|
|
2546
|
+
])], 10, bi)
|
|
2543
2547
|
], 2),
|
|
2544
2548
|
v("div", {
|
|
2545
|
-
class:
|
|
2546
|
-
},
|
|
2547
|
-
|
|
2549
|
+
class: y(["text-[10px] text-center mt-2.5 select-none opacity-70", M.value ? "text-theme-400" : "text-white/50"])
|
|
2550
|
+
}, [
|
|
2551
|
+
x[9] || (x[9] = ht(" Press ", -1)),
|
|
2552
|
+
v("kbd", {
|
|
2553
|
+
class: y(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", M.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2554
|
+
}, "Enter", 2),
|
|
2555
|
+
x[10] || (x[10] = ht(" to send, ", -1)),
|
|
2556
|
+
v("kbd", {
|
|
2557
|
+
class: y(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", M.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2558
|
+
}, "Shift+Enter", 2),
|
|
2559
|
+
x[11] || (x[11] = ht(" for new line ", -1))
|
|
2560
|
+
], 2)
|
|
2561
|
+
], 2)
|
|
2548
2562
|
]));
|
|
2549
2563
|
}
|
|
2550
|
-
}),
|
|
2564
|
+
}), ki = { class: "agent-wrap" }, wi = {
|
|
2551
2565
|
key: 0,
|
|
2552
2566
|
class: "flex items-center justify-center h-full"
|
|
2553
|
-
},
|
|
2567
|
+
}, Ii = /* @__PURE__ */ Ee({
|
|
2554
2568
|
__name: "AgentWrap",
|
|
2555
2569
|
props: {
|
|
2556
2570
|
sdk: {},
|
|
@@ -2564,11 +2578,11 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2564
2578
|
apiBase: {}
|
|
2565
2579
|
},
|
|
2566
2580
|
setup(l) {
|
|
2567
|
-
const t =
|
|
2581
|
+
const t = Ts("AgentWrap"), e = l, n = e.sdk || Ss.getInstance({
|
|
2568
2582
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2569
2583
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2570
|
-
}), s =
|
|
2571
|
-
return
|
|
2584
|
+
}), s = Y(!e.agent), r = vs(e.agent ? new bt({ config: e.agent }) : void 0), a = Y();
|
|
2585
|
+
return Kt(async () => {
|
|
2572
2586
|
if (e.agent) {
|
|
2573
2587
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2574
2588
|
agentId: e.agent.agentId,
|
|
@@ -2594,7 +2608,7 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2594
2608
|
try {
|
|
2595
2609
|
s.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2596
2610
|
const o = await n.getPublicAgent({ handle: e.handle });
|
|
2597
|
-
o ? (r.value = new
|
|
2611
|
+
o ? (r.value = new bt({ config: o }), t.debug("Successfully fetched public agent", {
|
|
2598
2612
|
agentId: o.agentId,
|
|
2599
2613
|
handle: o.handle
|
|
2600
2614
|
}), o.agentId && n.track({
|
|
@@ -2644,33 +2658,33 @@ const Zr = { class: "flex flex-col h-full relative" }, Xr = {
|
|
|
2644
2658
|
}
|
|
2645
2659
|
});
|
|
2646
2660
|
}
|
|
2647
|
-
}), (o, c) => (
|
|
2648
|
-
s.value ? (
|
|
2661
|
+
}), (o, c) => (T(), S("div", ki, [
|
|
2662
|
+
s.value ? (T(), S("div", wi, [...c[0] || (c[0] = [
|
|
2649
2663
|
v("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2650
|
-
])])) : r.value ?
|
|
2664
|
+
])])) : r.value ? Yn(o.$slots, "default", {
|
|
2651
2665
|
key: 1,
|
|
2652
|
-
sdk:
|
|
2666
|
+
sdk: Vt(n),
|
|
2653
2667
|
agent: r.value,
|
|
2654
2668
|
context: l.context,
|
|
2655
2669
|
firstMessage: l.firstMessage,
|
|
2656
2670
|
buttonText: l.buttonText,
|
|
2657
2671
|
buttonIcon: l.buttonIcon,
|
|
2658
2672
|
loading: s.value
|
|
2659
|
-
}) :
|
|
2673
|
+
}) : B("", !0)
|
|
2660
2674
|
]));
|
|
2661
2675
|
}
|
|
2662
2676
|
});
|
|
2663
2677
|
export {
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2678
|
+
In as A,
|
|
2679
|
+
Ii as _,
|
|
2680
|
+
Ci as a,
|
|
2681
|
+
Ri as b,
|
|
2682
|
+
_i as c,
|
|
2683
|
+
Di as d,
|
|
2684
|
+
Cn as e,
|
|
2685
|
+
$s as f,
|
|
2686
|
+
Ai as g,
|
|
2687
|
+
Ln as h,
|
|
2688
|
+
Ei as p
|
|
2675
2689
|
};
|
|
2676
2690
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|