@pagelines/sdk 1.0.471 → 1.0.473
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 +898 -854
- package/dist/AgentWrap.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/agent/AgentController.d.ts +15 -0
- package/dist/agent/ui/ElAgentChat.vue.d.ts +2 -0
- package/dist/clients/ChatClient.d.ts +13 -2
- package/dist/index.js +54 -54
- package/dist/index.js.map +1 -1
- package/dist/sdkClient.d.ts +0 -4
- package/dist/sdkClient.js +295 -231
- package/dist/sdkClient.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var ws = (l, t, e) => t in l ?
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { SettingsObject as Ts, Agent as
|
|
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 D = (l, t, e) => ws(l, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { defineComponent as Me, openBlock as T, createElementBlock as S, createElementVNode as v, normalizeClass as A, ref as K, watch as lt, computed as H, createCommentVNode as $, renderSlot as Zn, onMounted as tn, Fragment as ye, renderList as rt, withDirectives as Xn, vModelText as Kn, unref as Kt, toDisplayString as ne, nextTick as Gt, createVNode as Wt, createTextVNode as Xe, withModifiers as vs, shallowRef as ys } from "vue";
|
|
6
|
+
import { SettingsObject as Ts, Agent as Tt, getDefaultAvatarUrl as Qn, createLogger as Ss } from "@pagelines/core";
|
|
7
7
|
import { P as As } from "./sdkClient.js";
|
|
8
8
|
const Es = { class: "spinner max-w-sm" }, _s = {
|
|
9
9
|
class: "ring-circular h-full w-full origin-center",
|
|
10
10
|
viewBox: "25 25 50 50"
|
|
11
|
-
},
|
|
11
|
+
}, In = /* @__PURE__ */ Me({
|
|
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", Es, [
|
|
19
|
+
(T(), S("svg", _s, [
|
|
20
20
|
v("circle", {
|
|
21
|
-
class:
|
|
21
|
+
class: A([l.colorMode, "ring-path"]),
|
|
22
22
|
cx: "50",
|
|
23
23
|
cy: "50",
|
|
24
24
|
r: "20",
|
|
@@ -33,24 +33,24 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
33
33
|
}), Rs = [
|
|
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
|
-
], Cs = 9e4,
|
|
36
|
+
], Cs = 9e4, pn = class pn extends Ts {
|
|
37
37
|
constructor(e) {
|
|
38
38
|
super("AgentChatController", e);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
D(this, "isTextMode", !1);
|
|
40
|
+
D(this, "lastMessage", { hash: "", time: 0 });
|
|
41
|
+
D(this, "isConnecting", !1);
|
|
42
42
|
// Chat conversation tracking (server-managed persistence)
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
D(this, "conversationId");
|
|
44
|
+
D(this, "textState", K({
|
|
45
45
|
isActive: !1,
|
|
46
46
|
isConnected: !1,
|
|
47
47
|
isThinking: !1,
|
|
48
48
|
connectionStatus: "disconnected"
|
|
49
49
|
}));
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this._agent = e.agent instanceof
|
|
50
|
+
D(this, "agentMode", K("self"));
|
|
51
|
+
D(this, "sharedMessages", K([]));
|
|
52
|
+
D(this, "_agent");
|
|
53
|
+
this._agent = e.agent instanceof Tt ? e.agent : new Tt({ config: e.agent }), this.setupModeWatcher();
|
|
54
54
|
}
|
|
55
55
|
get chatEnabled() {
|
|
56
56
|
return this._agent.chatAvailable.value;
|
|
@@ -59,10 +59,17 @@ const Es = { class: "spinner max-w-sm" }, _s = {
|
|
|
59
59
|
return this._agent.chatUnavailable.value;
|
|
60
60
|
}
|
|
61
61
|
mapChatError(e) {
|
|
62
|
-
return e.includes("429") || e.includes("Too many") ? "Too many messages. Please wait a moment." : e.includes("503") || e.includes("not available") ? "Agent is currently offline." : e.includes("timed out") ? "This request timed out. Try again in a few minutes." : e.includes("starting up") ? "Agent is starting up. Please try again." : e.includes("404") ? "Agent not found." : "Something went wrong.
|
|
62
|
+
return e.includes("429") || e.includes("Too many") ? "Too many messages. Please wait a moment." : e.includes("503") || e.includes("not available") ? "Agent is currently offline." : e.includes("timed out") ? "This request timed out. Try again in a few minutes." : e.includes("starting up") ? "Agent is starting up. Please try again." : e.includes("404") ? "Agent not found." : e.includes("[no-reply]") ? "The reply didn't make it back. Refresh to see if it landed." : e.includes("[stream-open]") || e.includes("[stream-read]") ? "Lost connection mid-reply. Try again." : e.includes("[api]") ? "Couldn't send. Try again." : "Something went wrong. Try again.";
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Errors we treat as recoverable mid-conversation: rate limits, timeouts,
|
|
66
|
+
* transient infra blips, dropped streams. We render an inline system bubble
|
|
67
|
+
* and keep the input enabled so the next attempt can succeed without
|
|
68
|
+
* forcing a manual reload. Hard errors (auth lost, agent missing) still
|
|
69
|
+
* fall through to handleError which marks the conversation dead.
|
|
70
|
+
*/
|
|
64
71
|
isTransientError(e) {
|
|
65
|
-
return e.includes("timed out") || e.includes("starting up") || e.includes("503");
|
|
72
|
+
return e.includes("timed out") || e.includes("starting up") || e.includes("503") || e.includes("429") || e.includes("[no-reply]") || e.includes("[stream-open]") || e.includes("[stream-read]") || e.includes("[api]");
|
|
66
73
|
}
|
|
67
74
|
isDuplicateMessage(e, n) {
|
|
68
75
|
const s = `${n}:${e.toLowerCase().trim()}`, r = Date.now(), a = s === this.lastMessage.hash && r - this.lastMessage.time < 500;
|
|
@@ -103,14 +110,22 @@ Current User:
|
|
|
103
110
|
});
|
|
104
111
|
}
|
|
105
112
|
setupModeWatcher() {
|
|
106
|
-
|
|
113
|
+
lt(this.agentMode, async (e, n) => {
|
|
107
114
|
this.logger.info(`Mode changed from ${n} to ${e}`), this.isTextMode && (n === "talk" || n === "chat") && await this.endConversation();
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Hard error path. Resets the connection and surfaces an inline bubble so
|
|
119
|
+
* the user actually sees what happened — `connectionStatus: 'error'`
|
|
120
|
+
* alone doesn't render anywhere. The raw error is kept on console.error
|
|
121
|
+
* so devs can tell which pipeline stage failed (the `[api]` /
|
|
122
|
+
* `[stream-open]` / `[stream-read]` / `[no-reply]` tags from
|
|
123
|
+
* agent/client.ts survive into the console line).
|
|
124
|
+
*/
|
|
125
|
+
handleError(e, n) {
|
|
126
|
+
const s = e.message;
|
|
127
|
+
this.logger.error("Conversation error:", { message: s, raw: n, error: e }), this.addMessage(s, "system"), this.resetState(), this.updateState(this.textState, {
|
|
128
|
+
error: s,
|
|
114
129
|
connectionStatus: "error"
|
|
115
130
|
});
|
|
116
131
|
}
|
|
@@ -157,7 +172,13 @@ Current User:
|
|
|
157
172
|
* conversation and the user wants a clean slate after resolving it.
|
|
158
173
|
*/
|
|
159
174
|
newConversation() {
|
|
160
|
-
this.conversationId = void 0, this.sharedMessages.value = [], this.lastMessage = { hash: "", time: 0 }, this.updateState(this.textState, {
|
|
175
|
+
this.conversationId = void 0, this.sharedMessages.value = [], this.lastMessage = { hash: "", time: 0 }, this.updateState(this.textState, {
|
|
176
|
+
isThinking: !1,
|
|
177
|
+
accountGated: !1,
|
|
178
|
+
isConnected: this.chatEnabled,
|
|
179
|
+
connectionStatus: this.chatEnabled ? "connected" : "disconnected",
|
|
180
|
+
error: void 0
|
|
181
|
+
});
|
|
161
182
|
}
|
|
162
183
|
async sendChatMessage(e, n) {
|
|
163
184
|
if (!this.isTextMode)
|
|
@@ -175,50 +196,50 @@ Current User:
|
|
|
175
196
|
this.addMessage(e, "user", n), this.updateState(this.textState, { isThinking: !0 });
|
|
176
197
|
const a = `stream-${Date.now()}`;
|
|
177
198
|
let o = !1;
|
|
178
|
-
const c = /* @__PURE__ */
|
|
199
|
+
const c = /* @__PURE__ */ u((f) => {
|
|
179
200
|
o || (o = !0, this.sharedMessages.value = [
|
|
180
201
|
...this.sharedMessages.value,
|
|
181
202
|
{ id: a, text: "", sender: "agent", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
182
203
|
]);
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
}, "onDelta"),
|
|
204
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
205
|
+
w?.id === a && (w.text += f, this.sharedMessages.value = [...m]);
|
|
206
|
+
}, "onDelta"), p = /* @__PURE__ */ u((f) => {
|
|
186
207
|
if (!o) {
|
|
187
208
|
g("empty_stream — assistant returned no content");
|
|
188
209
|
return;
|
|
189
210
|
}
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
let
|
|
211
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
212
|
+
if (w?.id === a && w.text) {
|
|
213
|
+
let E = w.text;
|
|
193
214
|
for (const z of Rs)
|
|
194
|
-
z.pattern.test(
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
}, "onDone"), g = /* @__PURE__ */
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
const { bucket:
|
|
202
|
-
if (
|
|
203
|
-
const
|
|
204
|
-
this.addMessage(
|
|
215
|
+
z.pattern.test(E) && (console.debug(`[chat] filtered directive: ${z.label}`), E = E.replace(z.pattern, "").trim(), z.pattern.lastIndex = 0);
|
|
216
|
+
E ? E !== w.text && (w.text = E, this.sharedMessages.value = [...m]) : this.sharedMessages.value = m.slice(0, -1);
|
|
217
|
+
}
|
|
218
|
+
f && (this.conversationId = f), this.updateState(this.textState, { isThinking: !1 });
|
|
219
|
+
}, "onDone"), g = /* @__PURE__ */ u((f) => {
|
|
220
|
+
const m = this.sharedMessages.value, w = m[m.length - 1];
|
|
221
|
+
if (w?.id === a && !w.text && (this.sharedMessages.value = m.slice(0, -1)), typeof f == "object" && f.code && f.error) {
|
|
222
|
+
const { bucket: U, actionUrl: se, actionLabel: ie, help: O } = f;
|
|
223
|
+
if (U !== void 0 || (/* @__PURE__ */ new Set(["CREDIT_LIMIT", "OVERAGE_CAP", "EMPTY_STREAM", "RATE_LIMIT"])).has(f.code)) {
|
|
224
|
+
const j = U && se && ie ? { code: f.code, bucket: U, actionLabel: ie, actionUrl: se, ...O ? { help: O } : {} } : void 0;
|
|
225
|
+
this.addMessage(f.error, "system", void 0, j), U === "account" ? this.updateState(this.textState, { isThinking: !1, accountGated: !0 }) : this.updateState(this.textState, { isThinking: !1 });
|
|
205
226
|
} else
|
|
206
|
-
this.handleError(new Error(
|
|
227
|
+
this.handleError(new Error(f.error));
|
|
207
228
|
return;
|
|
208
229
|
}
|
|
209
|
-
const
|
|
210
|
-
this.isTransientError(
|
|
211
|
-
}, "onError"), d = /* @__PURE__ */
|
|
212
|
-
this.addMessage(
|
|
230
|
+
const E = typeof f == "string" ? f : f.error, z = this.mapChatError(E);
|
|
231
|
+
this.isTransientError(E) ? (this.logger.warn("Chat turn failed (transient):", { raw: E, friendly: z }), this.addMessage(z, "system"), this.updateState(this.textState, { isThinking: !1 })) : this.handleError(new Error(z), E);
|
|
232
|
+
}, "onError"), d = /* @__PURE__ */ u((f) => {
|
|
233
|
+
this.addMessage(f, "system");
|
|
213
234
|
}, "onStatus");
|
|
214
235
|
try {
|
|
215
|
-
const
|
|
236
|
+
const f = s ? s({
|
|
216
237
|
message: e,
|
|
217
238
|
attachments: n,
|
|
218
239
|
conversationId: this.conversationId,
|
|
219
240
|
history: this.buildHistory(),
|
|
220
241
|
onDelta: c,
|
|
221
|
-
onDone:
|
|
242
|
+
onDone: p,
|
|
222
243
|
onError: g,
|
|
223
244
|
onStatus: d
|
|
224
245
|
}) : r.chatStream({
|
|
@@ -230,16 +251,16 @@ Current User:
|
|
|
230
251
|
visitorId: r.generateAnonId(),
|
|
231
252
|
context: this.getDynamicSettings().context || void 0,
|
|
232
253
|
onDelta: c,
|
|
233
|
-
onDone:
|
|
254
|
+
onDone: p,
|
|
234
255
|
onError: g,
|
|
235
256
|
onStatus: d
|
|
236
257
|
});
|
|
237
258
|
await Promise.race([
|
|
238
|
-
|
|
239
|
-
new Promise((
|
|
259
|
+
f,
|
|
260
|
+
new Promise((m, w) => setTimeout(() => w(new Error("timed out")), Cs))
|
|
240
261
|
]);
|
|
241
|
-
} catch (
|
|
242
|
-
g(
|
|
262
|
+
} catch (f) {
|
|
263
|
+
g(f.message || "Something went wrong");
|
|
243
264
|
}
|
|
244
265
|
}
|
|
245
266
|
buildHistory() {
|
|
@@ -263,30 +284,30 @@ Current User:
|
|
|
263
284
|
await this.endConversation();
|
|
264
285
|
}
|
|
265
286
|
};
|
|
266
|
-
|
|
267
|
-
let Mn =
|
|
287
|
+
u(pn, "AgentChatController");
|
|
288
|
+
let Mn = pn;
|
|
268
289
|
function Ln(l) {
|
|
269
290
|
return l ? typeof l == "string" ? l : l.src || "" : "";
|
|
270
291
|
}
|
|
271
|
-
|
|
272
|
-
function
|
|
292
|
+
u(Ln, "getImageSrc");
|
|
293
|
+
function Li(l) {
|
|
273
294
|
return Ln(l.cover) || Ln(l.avatar) || Qn(l.name);
|
|
274
295
|
}
|
|
275
|
-
|
|
296
|
+
u(Li, "getAgentAvatarUrl");
|
|
276
297
|
function zn(l) {
|
|
277
298
|
const t = l.target;
|
|
278
299
|
t.dataset.fallbackUsed || (t.dataset.fallbackUsed = "true", t.src = Qn());
|
|
279
300
|
}
|
|
280
|
-
|
|
281
|
-
function
|
|
301
|
+
u(zn, "handleImageError");
|
|
302
|
+
function zi(l) {
|
|
282
303
|
const { template: t, agent: e } = l;
|
|
283
304
|
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 || "");
|
|
284
305
|
}
|
|
285
|
-
|
|
286
|
-
const
|
|
306
|
+
u(zi, "parseButtonTemplate");
|
|
307
|
+
const Ds = {
|
|
287
308
|
key: 0,
|
|
288
309
|
class: "absolute inset-0 flex items-center justify-center"
|
|
289
|
-
},
|
|
310
|
+
}, Oi = /* @__PURE__ */ Me({
|
|
290
311
|
__name: "ElAgentButton",
|
|
291
312
|
props: {
|
|
292
313
|
theme: { default: "primary" },
|
|
@@ -310,28 +331,28 @@ const Is = {
|
|
|
310
331
|
md: "size-4",
|
|
311
332
|
lg: "size-5"
|
|
312
333
|
})[l.size]);
|
|
313
|
-
return (s, r) => (
|
|
314
|
-
class:
|
|
334
|
+
return (s, r) => (T(), S("button", {
|
|
335
|
+
class: A(["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]])
|
|
315
336
|
}, [
|
|
316
|
-
l.loading ? (
|
|
337
|
+
l.loading ? (T(), S("div", Ds, [...r[0] || (r[0] = [
|
|
317
338
|
v("i", { class: "i-svg-spinners-90-ring-with-bg size-5" }, null, -1)
|
|
318
|
-
])])) :
|
|
339
|
+
])])) : $("", !0),
|
|
319
340
|
v("span", {
|
|
320
|
-
class:
|
|
341
|
+
class: A(["flex items-center gap-2 transition-opacity duration-200", l.loading ? "opacity-0" : "opacity-100"])
|
|
321
342
|
}, [
|
|
322
|
-
l.icon ? (
|
|
343
|
+
l.icon ? (T(), S("i", {
|
|
323
344
|
key: 0,
|
|
324
|
-
class:
|
|
325
|
-
}, null, 2)) :
|
|
345
|
+
class: A([l.icon, n.value])
|
|
346
|
+
}, null, 2)) : $("", !0),
|
|
326
347
|
Zn(s.$slots, "default"),
|
|
327
|
-
l.iconAfter ? (
|
|
348
|
+
l.iconAfter ? (T(), S("i", {
|
|
328
349
|
key: 1,
|
|
329
|
-
class:
|
|
330
|
-
}, null, 2)) :
|
|
350
|
+
class: A([l.iconAfter, n.value])
|
|
351
|
+
}, null, 2)) : $("", !0)
|
|
331
352
|
], 2)
|
|
332
353
|
], 2));
|
|
333
354
|
}
|
|
334
|
-
}),
|
|
355
|
+
}), Is = ["value"], Pi = /* @__PURE__ */ Me({
|
|
335
356
|
__name: "AgentInputEmail",
|
|
336
357
|
props: {
|
|
337
358
|
modelValue: { default: "" }
|
|
@@ -339,7 +360,7 @@ const Is = {
|
|
|
339
360
|
emits: ["update:modelValue"],
|
|
340
361
|
setup(l, { emit: t }) {
|
|
341
362
|
const e = t;
|
|
342
|
-
return (n, s) => (
|
|
363
|
+
return (n, s) => (T(), S("input", {
|
|
343
364
|
type: "email",
|
|
344
365
|
autocomplete: "email",
|
|
345
366
|
placeholder: "Enter Your Email",
|
|
@@ -347,9 +368,9 @@ const Is = {
|
|
|
347
368
|
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",
|
|
348
369
|
style: { "font-size": "16px" },
|
|
349
370
|
onInput: s[0] || (s[0] = (r) => e("update:modelValue", r.target.value))
|
|
350
|
-
}, null, 40,
|
|
371
|
+
}, null, 40, Is));
|
|
351
372
|
}
|
|
352
|
-
}), Ms = { class: "flex gap-1.5 justify-center" }, Ls = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"],
|
|
373
|
+
}), Ms = { class: "flex gap-1.5 justify-center" }, Ls = ["onUpdate:modelValue", "onInput", "onKeydown", "onPaste", "onFocus"], Ni = /* @__PURE__ */ Me({
|
|
353
374
|
__name: "AgentInputOneTimeCode",
|
|
354
375
|
props: {
|
|
355
376
|
modelValue: {},
|
|
@@ -358,73 +379,73 @@ const Is = {
|
|
|
358
379
|
},
|
|
359
380
|
emits: ["update:modelValue", "autoSubmit"],
|
|
360
381
|
setup(l, { emit: t }) {
|
|
361
|
-
const e = l, n = t, s =
|
|
362
|
-
|
|
382
|
+
const e = l, n = t, s = K([]), r = K(Array.from({ length: e.length }).fill("")), a = K(!1);
|
|
383
|
+
tn(() => {
|
|
363
384
|
e.modelValue && (r.value = e.modelValue.split("").slice(0, e.length)), e.focusFirst && !("ontouchstart" in window) && s.value[0]?.focus();
|
|
364
|
-
}),
|
|
385
|
+
}), lt(() => e.modelValue, (d) => {
|
|
365
386
|
r.value = d ? d.split("").slice(0, e.length) : Array.from({ length: e.length }).fill("");
|
|
366
|
-
}),
|
|
387
|
+
}), lt(r, () => {
|
|
367
388
|
const d = r.value.filter(Boolean).join("");
|
|
368
389
|
n("update:modelValue", d), d.length === e.length && n("autoSubmit", d);
|
|
369
390
|
}, { deep: !0 });
|
|
370
|
-
function o(d,
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
r.value =
|
|
391
|
+
function o(d, f) {
|
|
392
|
+
f.preventDefault(), a.value = !0;
|
|
393
|
+
const m = (f.clipboardData?.getData("text") || "").replace(/\D/g, "");
|
|
394
|
+
if (m.length === e.length)
|
|
395
|
+
r.value = m.split(""), setTimeout(() => {
|
|
375
396
|
s.value[e.length - 1]?.focus(), a.value = !1;
|
|
376
397
|
}, 10);
|
|
377
398
|
else {
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}), r.value =
|
|
382
|
-
const
|
|
399
|
+
const w = [...r.value];
|
|
400
|
+
m.split("").slice(0, e.length - d).forEach((z, U) => {
|
|
401
|
+
w[d + U] = z;
|
|
402
|
+
}), r.value = w;
|
|
403
|
+
const E = Math.min(d + m.length, e.length - 1);
|
|
383
404
|
setTimeout(() => {
|
|
384
|
-
s.value[
|
|
405
|
+
s.value[E]?.focus(), a.value = !1;
|
|
385
406
|
}, 10);
|
|
386
407
|
}
|
|
387
408
|
}
|
|
388
|
-
|
|
389
|
-
function c(d,
|
|
390
|
-
const
|
|
391
|
-
r.value[d] =
|
|
409
|
+
u(o, "onPaste");
|
|
410
|
+
function c(d, f) {
|
|
411
|
+
const m = f.target.value.slice(-1).replace(/\D/g, "");
|
|
412
|
+
r.value[d] = m, m && d < e.length - 1 && s.value[d + 1]?.focus();
|
|
392
413
|
}
|
|
393
|
-
|
|
394
|
-
function
|
|
395
|
-
|
|
414
|
+
u(c, "onInput");
|
|
415
|
+
function p(d, f) {
|
|
416
|
+
f.key === "Backspace" ? (f.preventDefault(), r.value[d] = "", d > 0 && s.value[d - 1]?.focus()) : f.key === "ArrowLeft" && d > 0 ? s.value[d - 1]?.focus() : f.key === "ArrowRight" && d < e.length - 1 && s.value[d + 1]?.focus();
|
|
396
417
|
}
|
|
397
|
-
|
|
418
|
+
u(p, "onKeydown");
|
|
398
419
|
function g(d) {
|
|
399
420
|
if (s.value[d]?.select(), !a.value && r.value[d])
|
|
400
|
-
for (let
|
|
401
|
-
r.value[
|
|
421
|
+
for (let f = d; f < e.length; f++)
|
|
422
|
+
r.value[f] = "";
|
|
402
423
|
}
|
|
403
|
-
return
|
|
404
|
-
(
|
|
405
|
-
key:
|
|
424
|
+
return u(g, "onFocus"), (d, f) => (T(), S("div", Ms, [
|
|
425
|
+
(T(!0), S(ye, null, rt(l.length, (m) => Xn((T(), S("input", {
|
|
426
|
+
key: m,
|
|
406
427
|
ref_for: !0,
|
|
407
|
-
ref: /* @__PURE__ */
|
|
408
|
-
"onUpdate:modelValue": /* @__PURE__ */
|
|
428
|
+
ref: /* @__PURE__ */ u((w) => s.value[m - 1] = w, "ref"),
|
|
429
|
+
"onUpdate:modelValue": /* @__PURE__ */ u((w) => r.value[m - 1] = w, "onUpdate:modelValue"),
|
|
409
430
|
type: "text",
|
|
410
431
|
inputmode: "numeric",
|
|
411
432
|
autocomplete: "one-time-code",
|
|
412
433
|
class: "size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",
|
|
413
434
|
style: { "font-size": "16px" },
|
|
414
435
|
maxlength: "1",
|
|
415
|
-
onInput: /* @__PURE__ */
|
|
416
|
-
onKeydown: /* @__PURE__ */
|
|
417
|
-
onPaste: /* @__PURE__ */
|
|
418
|
-
onFocus: /* @__PURE__ */
|
|
436
|
+
onInput: /* @__PURE__ */ u((w) => c(m - 1, w), "onInput"),
|
|
437
|
+
onKeydown: /* @__PURE__ */ u((w) => p(m - 1, w), "onKeydown"),
|
|
438
|
+
onPaste: /* @__PURE__ */ u((w) => o(m - 1, w), "onPaste"),
|
|
439
|
+
onFocus: /* @__PURE__ */ u((w) => g(m - 1), "onFocus")
|
|
419
440
|
}, null, 40, Ls)), [
|
|
420
|
-
[Kn, r.value[
|
|
441
|
+
[Kn, r.value[m - 1]]
|
|
421
442
|
])), 128))
|
|
422
443
|
]));
|
|
423
444
|
}
|
|
424
445
|
}), zs = { class: "relative flex-shrink-0" }, Os = ["src", "alt"], Ps = { class: "absolute top-1 right-1" }, Ns = {
|
|
425
446
|
key: 1,
|
|
426
447
|
class: "size-3 bg-theme-400 rounded-full ring-2 ring-white"
|
|
427
|
-
}, $s = { class: "min-w-0" }, Us = /* @__PURE__ */
|
|
448
|
+
}, $s = { class: "min-w-0" }, Us = /* @__PURE__ */ Me({
|
|
428
449
|
__name: "ElModeHeader",
|
|
429
450
|
props: {
|
|
430
451
|
agent: {},
|
|
@@ -433,46 +454,46 @@ const Is = {
|
|
|
433
454
|
layout: { default: "centered" }
|
|
434
455
|
},
|
|
435
456
|
setup(l) {
|
|
436
|
-
return (t, e) => (
|
|
437
|
-
class:
|
|
457
|
+
return (t, e) => (T(), S("div", {
|
|
458
|
+
class: A(["flex gap-4", [
|
|
438
459
|
l.layout === "centered" ? "flex-col items-center text-center" : "flex-row items-center justify-center"
|
|
439
460
|
]])
|
|
440
461
|
}, [
|
|
441
462
|
v("div", zs, [
|
|
442
463
|
v("div", {
|
|
443
|
-
class:
|
|
464
|
+
class: A(["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"])
|
|
444
465
|
}, [
|
|
445
466
|
v("img", {
|
|
446
467
|
src: l.agent.avatarUrl.value,
|
|
447
468
|
alt: l.agent.displayName.value,
|
|
448
469
|
class: "w-full h-full object-cover",
|
|
449
470
|
onError: e[0] || (e[0] = //@ts-ignore
|
|
450
|
-
(...n) =>
|
|
471
|
+
(...n) => Kt(zn) && Kt(zn)(...n))
|
|
451
472
|
}, null, 40, Os)
|
|
452
473
|
], 2),
|
|
453
474
|
v("div", Ps, [
|
|
454
|
-
l.isOnline ? (
|
|
475
|
+
l.isOnline ? (T(), S(ye, { key: 0 }, [
|
|
455
476
|
e[1] || (e[1] = v("div", {
|
|
456
477
|
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
457
478
|
style: { "animation-duration": "3s" }
|
|
458
479
|
}, null, -1)),
|
|
459
480
|
e[2] || (e[2] = v("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" }, null, -1))
|
|
460
|
-
], 64)) : (
|
|
481
|
+
], 64)) : (T(), S("div", Ns))
|
|
461
482
|
])
|
|
462
483
|
]),
|
|
463
484
|
v("div", $s, [
|
|
464
485
|
v("h1", {
|
|
465
|
-
class:
|
|
486
|
+
class: A(["font-light text-white mb-1 truncate", [
|
|
466
487
|
l.size === "lg" ? "text-3xl mb-2" : "text-xl sm:text-2xl tracking-wide leading-tight",
|
|
467
488
|
l.layout === "horizontal" ? "text-white/95" : ""
|
|
468
489
|
]])
|
|
469
|
-
},
|
|
490
|
+
}, ne(l.agent.displayName.value), 3),
|
|
470
491
|
v("p", {
|
|
471
|
-
class:
|
|
492
|
+
class: A(["font-light line-clamp-1", [
|
|
472
493
|
l.size === "lg" ? "text-base text-white/60" : "text-sm sm:text-base",
|
|
473
494
|
l.layout === "horizontal" ? "text-white/70 truncate" : "text-white/60"
|
|
474
495
|
]])
|
|
475
|
-
},
|
|
496
|
+
}, ne(l.layout === "horizontal" ? l.agent.title.value || "Digital Agent" : l.agent.title.value), 3)
|
|
476
497
|
])
|
|
477
498
|
], 2));
|
|
478
499
|
}
|
|
@@ -485,49 +506,49 @@ const {
|
|
|
485
506
|
getOwnPropertyDescriptor: Hs
|
|
486
507
|
} = Object;
|
|
487
508
|
let {
|
|
488
|
-
freeze:
|
|
489
|
-
seal:
|
|
490
|
-
create:
|
|
509
|
+
freeze: J,
|
|
510
|
+
seal: le,
|
|
511
|
+
create: it
|
|
491
512
|
} = Object, {
|
|
492
|
-
apply:
|
|
493
|
-
construct:
|
|
513
|
+
apply: Qt,
|
|
514
|
+
construct: Jt
|
|
494
515
|
} = typeof Reflect < "u" && Reflect;
|
|
495
|
-
|
|
516
|
+
J || (J = /* @__PURE__ */ u(function(t) {
|
|
496
517
|
return t;
|
|
497
518
|
}, "freeze"));
|
|
498
|
-
|
|
519
|
+
le || (le = /* @__PURE__ */ u(function(t) {
|
|
499
520
|
return t;
|
|
500
521
|
}, "seal"));
|
|
501
|
-
|
|
522
|
+
Qt || (Qt = /* @__PURE__ */ u(function(t, e) {
|
|
502
523
|
for (var n = arguments.length, s = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
503
524
|
s[r - 2] = arguments[r];
|
|
504
525
|
return t.apply(e, s);
|
|
505
526
|
}, "apply"));
|
|
506
|
-
|
|
527
|
+
Jt || (Jt = /* @__PURE__ */ u(function(t) {
|
|
507
528
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
508
529
|
n[s - 1] = arguments[s];
|
|
509
530
|
return new t(...n);
|
|
510
531
|
}, "construct"));
|
|
511
|
-
const
|
|
512
|
-
function
|
|
532
|
+
const Ke = ee(Array.prototype.forEach), Gs = ee(Array.prototype.lastIndexOf), Pn = ee(Array.prototype.pop), Qe = ee(Array.prototype.push), Ws = ee(Array.prototype.splice), yt = ee(String.prototype.toLowerCase), jt = ee(String.prototype.toString), qt = ee(String.prototype.match), $e = ee(String.prototype.replace), js = ee(String.prototype.indexOf), qs = ee(String.prototype.trim), ue = ee(Object.prototype.hasOwnProperty), X = ee(RegExp.prototype.test), Je = Vs(TypeError);
|
|
533
|
+
function ee(l) {
|
|
513
534
|
return function(t) {
|
|
514
535
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
515
536
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
516
537
|
n[s - 1] = arguments[s];
|
|
517
|
-
return
|
|
538
|
+
return Qt(l, t, n);
|
|
518
539
|
};
|
|
519
540
|
}
|
|
520
|
-
|
|
541
|
+
u(ee, "unapply");
|
|
521
542
|
function Vs(l) {
|
|
522
543
|
return function() {
|
|
523
544
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
524
545
|
e[n] = arguments[n];
|
|
525
|
-
return
|
|
546
|
+
return Jt(l, e);
|
|
526
547
|
};
|
|
527
548
|
}
|
|
528
|
-
|
|
529
|
-
function
|
|
530
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
549
|
+
u(Vs, "unconstruct");
|
|
550
|
+
function C(l, t) {
|
|
551
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : yt;
|
|
531
552
|
On && On(l, null);
|
|
532
553
|
let n = t.length;
|
|
533
554
|
for (; n--; ) {
|
|
@@ -540,44 +561,44 @@ function R(l, t) {
|
|
|
540
561
|
}
|
|
541
562
|
return l;
|
|
542
563
|
}
|
|
543
|
-
|
|
564
|
+
u(C, "addToSet");
|
|
544
565
|
function Ys(l) {
|
|
545
566
|
for (let t = 0; t < l.length; t++)
|
|
546
|
-
|
|
567
|
+
ue(l, t) || (l[t] = null);
|
|
547
568
|
return l;
|
|
548
569
|
}
|
|
549
|
-
|
|
550
|
-
function
|
|
551
|
-
const t =
|
|
570
|
+
u(Ys, "cleanArray");
|
|
571
|
+
function me(l) {
|
|
572
|
+
const t = it(null);
|
|
552
573
|
for (const [e, n] of Jn(l))
|
|
553
|
-
|
|
574
|
+
ue(l, e) && (Array.isArray(n) ? t[e] = Ys(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = me(n) : t[e] = n);
|
|
554
575
|
return t;
|
|
555
576
|
}
|
|
556
|
-
|
|
557
|
-
function
|
|
577
|
+
u(me, "clone");
|
|
578
|
+
function et(l, t) {
|
|
558
579
|
for (; l !== null; ) {
|
|
559
580
|
const n = Hs(l, t);
|
|
560
581
|
if (n) {
|
|
561
582
|
if (n.get)
|
|
562
|
-
return
|
|
583
|
+
return ee(n.get);
|
|
563
584
|
if (typeof n.value == "function")
|
|
564
|
-
return
|
|
585
|
+
return ee(n.value);
|
|
565
586
|
}
|
|
566
587
|
l = Fs(l);
|
|
567
588
|
}
|
|
568
589
|
function e() {
|
|
569
590
|
return null;
|
|
570
591
|
}
|
|
571
|
-
return
|
|
592
|
+
return u(e, "fallbackValue"), e;
|
|
572
593
|
}
|
|
573
|
-
|
|
574
|
-
const Nn =
|
|
594
|
+
u(et, "lookupGetter");
|
|
595
|
+
const Nn = J(["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"]), Vt = J(["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"]), Yt = J(["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"]), Zs = J(["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"]), Zt = J(["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"]), Xs = J(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), $n = J(["#text"]), Un = J(["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"]), Xt = J(["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"]), Bn = J(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), wt = J(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ks = le(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Qs = le(/<%[\w\W]*|[\w\W]*%>/gm), Js = le(/\$\{[\w\W]*/gm), er = le(/^data-[\-\w.\u00B7-\uFFFF]+$/), tr = le(/^aria-[\-\w]+$/), es = le(
|
|
575
596
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
576
597
|
// eslint-disable-line no-useless-escape
|
|
577
|
-
), nr =
|
|
598
|
+
), nr = le(/^(?:\w+script|data):/i), sr = le(
|
|
578
599
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
579
600
|
// eslint-disable-line no-control-regex
|
|
580
|
-
), ts =
|
|
601
|
+
), ts = le(/^html$/i), rr = le(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
581
602
|
var Fn = /* @__PURE__ */ Object.freeze({
|
|
582
603
|
__proto__: null,
|
|
583
604
|
ARIA_ATTR: tr,
|
|
@@ -591,16 +612,16 @@ var Fn = /* @__PURE__ */ Object.freeze({
|
|
|
591
612
|
MUSTACHE_EXPR: Ks,
|
|
592
613
|
TMPLIT_EXPR: Js
|
|
593
614
|
});
|
|
594
|
-
const
|
|
615
|
+
const tt = {
|
|
595
616
|
element: 1,
|
|
596
617
|
text: 3,
|
|
597
618
|
// Deprecated
|
|
598
619
|
progressingInstruction: 7,
|
|
599
620
|
comment: 8,
|
|
600
621
|
document: 9
|
|
601
|
-
}, ir = /* @__PURE__ */
|
|
622
|
+
}, ir = /* @__PURE__ */ u(function() {
|
|
602
623
|
return typeof window > "u" ? null : window;
|
|
603
|
-
}, "getGlobal"), ar = /* @__PURE__ */
|
|
624
|
+
}, "getGlobal"), ar = /* @__PURE__ */ u(function(t, e) {
|
|
604
625
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
605
626
|
return null;
|
|
606
627
|
let n = null;
|
|
@@ -619,7 +640,7 @@ const Je = {
|
|
|
619
640
|
} catch {
|
|
620
641
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
621
642
|
}
|
|
622
|
-
}, "_createTrustedTypesPolicy"), Hn = /* @__PURE__ */
|
|
643
|
+
}, "_createTrustedTypesPolicy"), Hn = /* @__PURE__ */ u(function() {
|
|
623
644
|
return {
|
|
624
645
|
afterSanitizeAttributes: [],
|
|
625
646
|
afterSanitizeElements: [],
|
|
@@ -634,8 +655,8 @@ const Je = {
|
|
|
634
655
|
}, "_createHooksMap");
|
|
635
656
|
function ns() {
|
|
636
657
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ir();
|
|
637
|
-
const t = /* @__PURE__ */
|
|
638
|
-
if (t.version = "3.4.0", t.removed = [], !l || !l.document || l.document.nodeType !==
|
|
658
|
+
const t = /* @__PURE__ */ u((y) => ns(y), "DOMPurify");
|
|
659
|
+
if (t.version = "3.4.0", t.removed = [], !l || !l.document || l.document.nodeType !== tt.document || !l.Element)
|
|
639
660
|
return t.isSupported = !1, t;
|
|
640
661
|
let {
|
|
641
662
|
document: e
|
|
@@ -645,44 +666,44 @@ function ns() {
|
|
|
645
666
|
HTMLTemplateElement: a,
|
|
646
667
|
Node: o,
|
|
647
668
|
Element: c,
|
|
648
|
-
NodeFilter:
|
|
669
|
+
NodeFilter: p,
|
|
649
670
|
NamedNodeMap: g = l.NamedNodeMap || l.MozNamedAttrMap,
|
|
650
671
|
HTMLFormElement: d,
|
|
651
|
-
DOMParser:
|
|
652
|
-
trustedTypes:
|
|
653
|
-
} = l,
|
|
672
|
+
DOMParser: f,
|
|
673
|
+
trustedTypes: m
|
|
674
|
+
} = l, w = c.prototype, E = et(w, "cloneNode"), z = et(w, "remove"), U = et(w, "nextSibling"), se = et(w, "childNodes"), ie = et(w, "parentNode");
|
|
654
675
|
if (typeof a == "function") {
|
|
655
676
|
const y = e.createElement("template");
|
|
656
677
|
y.content && y.content.ownerDocument && (e = y.content.ownerDocument);
|
|
657
678
|
}
|
|
658
|
-
let
|
|
679
|
+
let O, ae = "";
|
|
659
680
|
const {
|
|
660
|
-
implementation:
|
|
661
|
-
createNodeIterator:
|
|
662
|
-
createDocumentFragment:
|
|
663
|
-
getElementsByTagName:
|
|
681
|
+
implementation: de,
|
|
682
|
+
createNodeIterator: j,
|
|
683
|
+
createDocumentFragment: ct,
|
|
684
|
+
getElementsByTagName: Ee
|
|
664
685
|
} = e, {
|
|
665
|
-
importNode:
|
|
686
|
+
importNode: Ct
|
|
666
687
|
} = n;
|
|
667
|
-
let
|
|
668
|
-
t.isSupported = typeof Jn == "function" && typeof
|
|
688
|
+
let q = Hn();
|
|
689
|
+
t.isSupported = typeof Jn == "function" && typeof ie == "function" && de && de.createHTMLDocument !== void 0;
|
|
669
690
|
const {
|
|
670
|
-
MUSTACHE_EXPR:
|
|
671
|
-
ERB_EXPR:
|
|
672
|
-
TMPLIT_EXPR:
|
|
673
|
-
DATA_ATTR:
|
|
674
|
-
ARIA_ATTR:
|
|
675
|
-
IS_SCRIPT_OR_DATA:
|
|
676
|
-
ATTR_WHITESPACE:
|
|
677
|
-
CUSTOM_ELEMENT:
|
|
691
|
+
MUSTACHE_EXPR: R,
|
|
692
|
+
ERB_EXPR: _e,
|
|
693
|
+
TMPLIT_EXPR: we,
|
|
694
|
+
DATA_ATTR: Dt,
|
|
695
|
+
ARIA_ATTR: We,
|
|
696
|
+
IS_SCRIPT_OR_DATA: It,
|
|
697
|
+
ATTR_WHITESPACE: ut,
|
|
698
|
+
CUSTOM_ELEMENT: ht
|
|
678
699
|
} = Fn;
|
|
679
700
|
let {
|
|
680
|
-
IS_ALLOWED_URI:
|
|
681
|
-
} = Fn,
|
|
682
|
-
const
|
|
683
|
-
let
|
|
684
|
-
const
|
|
685
|
-
let
|
|
701
|
+
IS_ALLOWED_URI: pt
|
|
702
|
+
} = Fn, B = null;
|
|
703
|
+
const dt = C({}, [...Nn, ...Vt, ...Yt, ...Zt, ...$n]);
|
|
704
|
+
let G = null;
|
|
705
|
+
const je = C({}, [...Un, ...Xt, ...Bn, ...wt]);
|
|
706
|
+
let P = Object.seal(it(null, {
|
|
686
707
|
tagNameCheck: {
|
|
687
708
|
writable: !0,
|
|
688
709
|
configurable: !1,
|
|
@@ -701,8 +722,8 @@ function ns() {
|
|
|
701
722
|
enumerable: !0,
|
|
702
723
|
value: !1
|
|
703
724
|
}
|
|
704
|
-
})),
|
|
705
|
-
const
|
|
725
|
+
})), _ = null, b = null;
|
|
726
|
+
const x = Object.seal(it(null, {
|
|
706
727
|
tagCheck: {
|
|
707
728
|
writable: !0,
|
|
708
729
|
configurable: !1,
|
|
@@ -716,170 +737,170 @@ function ns() {
|
|
|
716
737
|
value: null
|
|
717
738
|
}
|
|
718
739
|
}));
|
|
719
|
-
let
|
|
740
|
+
let L = !0, V = !0, be = !1, qe = !0, oe = !1, Ve = !0, Re = !1, Mt = !1, Lt = !1, ze = !1, ft = !1, gt = !1, dn = !0, fn = !1;
|
|
720
741
|
const ds = "user-content-";
|
|
721
|
-
let
|
|
722
|
-
const
|
|
742
|
+
let zt = !0, Ye = !1, Oe = {}, fe = null;
|
|
743
|
+
const Ot = C({}, ["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"]);
|
|
723
744
|
let gn = null;
|
|
724
|
-
const mn =
|
|
725
|
-
let
|
|
726
|
-
const xn =
|
|
727
|
-
let
|
|
728
|
-
const fs =
|
|
729
|
-
let
|
|
730
|
-
const gs =
|
|
731
|
-
let
|
|
745
|
+
const mn = C({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
746
|
+
let Pt = null;
|
|
747
|
+
const xn = C({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), mt = "http://www.w3.org/1998/Math/MathML", xt = "http://www.w3.org/2000/svg", ge = "http://www.w3.org/1999/xhtml";
|
|
748
|
+
let Pe = ge, Nt = !1, $t = null;
|
|
749
|
+
const fs = C({}, [mt, xt, ge], jt);
|
|
750
|
+
let bt = C({}, ["mi", "mo", "mn", "ms", "mtext"]), kt = C({}, ["annotation-xml"]);
|
|
751
|
+
const gs = C({}, ["title", "style", "font", "a", "script"]);
|
|
752
|
+
let Ze = null;
|
|
732
753
|
const ms = ["application/xhtml+xml", "text/html"], xs = "text/html";
|
|
733
|
-
let
|
|
734
|
-
const bs = e.createElement("form"), bn = /* @__PURE__ */
|
|
754
|
+
let W = null, Ne = null;
|
|
755
|
+
const bs = e.createElement("form"), bn = /* @__PURE__ */ u(function(i) {
|
|
735
756
|
return i instanceof RegExp || i instanceof Function;
|
|
736
|
-
}, "isRegexOrFunction"),
|
|
757
|
+
}, "isRegexOrFunction"), Ut = /* @__PURE__ */ u(function() {
|
|
737
758
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
738
|
-
if (!(
|
|
739
|
-
if ((!i || typeof i != "object") && (i = {}), i =
|
|
740
|
-
ms.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? xs : i.PARSER_MEDIA_TYPE,
|
|
759
|
+
if (!(Ne && Ne === i)) {
|
|
760
|
+
if ((!i || typeof i != "object") && (i = {}), i = me(i), Ze = // eslint-disable-next-line unicorn/prefer-includes
|
|
761
|
+
ms.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? xs : i.PARSER_MEDIA_TYPE, W = Ze === "application/xhtml+xml" ? jt : yt, B = ue(i, "ALLOWED_TAGS") ? C({}, i.ALLOWED_TAGS, W) : dt, G = ue(i, "ALLOWED_ATTR") ? C({}, i.ALLOWED_ATTR, W) : je, $t = ue(i, "ALLOWED_NAMESPACES") ? C({}, i.ALLOWED_NAMESPACES, jt) : fs, Pt = ue(i, "ADD_URI_SAFE_ATTR") ? C(me(xn), i.ADD_URI_SAFE_ATTR, W) : xn, gn = ue(i, "ADD_DATA_URI_TAGS") ? C(me(mn), i.ADD_DATA_URI_TAGS, W) : mn, fe = ue(i, "FORBID_CONTENTS") ? C({}, i.FORBID_CONTENTS, W) : Ot, _ = ue(i, "FORBID_TAGS") ? C({}, i.FORBID_TAGS, W) : me({}), b = ue(i, "FORBID_ATTR") ? C({}, i.FORBID_ATTR, W) : me({}), Oe = ue(i, "USE_PROFILES") ? i.USE_PROFILES : !1, L = i.ALLOW_ARIA_ATTR !== !1, V = i.ALLOW_DATA_ATTR !== !1, be = i.ALLOW_UNKNOWN_PROTOCOLS || !1, qe = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, oe = i.SAFE_FOR_TEMPLATES || !1, Ve = i.SAFE_FOR_XML !== !1, Re = i.WHOLE_DOCUMENT || !1, ze = i.RETURN_DOM || !1, ft = i.RETURN_DOM_FRAGMENT || !1, gt = i.RETURN_TRUSTED_TYPE || !1, Lt = i.FORCE_BODY || !1, dn = i.SANITIZE_DOM !== !1, fn = i.SANITIZE_NAMED_PROPS || !1, zt = i.KEEP_CONTENT !== !1, Ye = i.IN_PLACE || !1, pt = i.ALLOWED_URI_REGEXP || es, Pe = i.NAMESPACE || ge, bt = i.MATHML_TEXT_INTEGRATION_POINTS || bt, kt = i.HTML_INTEGRATION_POINTS || kt, P = i.CUSTOM_ELEMENT_HANDLING || it(null), i.CUSTOM_ELEMENT_HANDLING && bn(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (P.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && bn(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (P.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (P.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), oe && (V = !1), ft && (ze = !0), Oe && (B = C({}, $n), G = it(null), Oe.html === !0 && (C(B, Nn), C(G, Un)), Oe.svg === !0 && (C(B, Vt), C(G, Xt), C(G, wt)), Oe.svgFilters === !0 && (C(B, Yt), C(G, Xt), C(G, wt)), Oe.mathMl === !0 && (C(B, Zt), C(G, Bn), C(G, wt))), x.tagCheck = null, x.attributeCheck = null, i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? x.tagCheck = i.ADD_TAGS : (B === dt && (B = me(B)), C(B, i.ADD_TAGS, W))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? x.attributeCheck = i.ADD_ATTR : (G === je && (G = me(G)), C(G, i.ADD_ATTR, W))), i.ADD_URI_SAFE_ATTR && C(Pt, i.ADD_URI_SAFE_ATTR, W), i.FORBID_CONTENTS && (fe === Ot && (fe = me(fe)), C(fe, i.FORBID_CONTENTS, W)), i.ADD_FORBID_CONTENTS && (fe === Ot && (fe = me(fe)), C(fe, i.ADD_FORBID_CONTENTS, W)), zt && (B["#text"] = !0), Re && C(B, ["html", "head", "body"]), B.table && (C(B, ["tbody"]), delete _.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
741
762
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
742
|
-
throw
|
|
763
|
+
throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
743
764
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
744
|
-
throw
|
|
745
|
-
|
|
765
|
+
throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
766
|
+
O = i.TRUSTED_TYPES_POLICY, ae = O.createHTML("");
|
|
746
767
|
} else
|
|
747
|
-
|
|
748
|
-
|
|
768
|
+
O === void 0 && (O = ar(m, s)), O !== null && typeof ae == "string" && (ae = O.createHTML(""));
|
|
769
|
+
J && J(i), Ne = i;
|
|
749
770
|
}
|
|
750
|
-
}, "_parseConfig"), kn =
|
|
751
|
-
let
|
|
752
|
-
(!
|
|
753
|
-
namespaceURI:
|
|
771
|
+
}, "_parseConfig"), kn = C({}, [...Vt, ...Yt, ...Zs]), wn = C({}, [...Zt, ...Xs]), ks = /* @__PURE__ */ u(function(i) {
|
|
772
|
+
let h = ie(i);
|
|
773
|
+
(!h || !h.tagName) && (h = {
|
|
774
|
+
namespaceURI: Pe,
|
|
754
775
|
tagName: "template"
|
|
755
776
|
});
|
|
756
|
-
const
|
|
757
|
-
return
|
|
758
|
-
}, "_checkValidNamespace"),
|
|
759
|
-
|
|
777
|
+
const k = yt(i.tagName), N = yt(h.tagName);
|
|
778
|
+
return $t[i.namespaceURI] ? i.namespaceURI === xt ? h.namespaceURI === ge ? k === "svg" : h.namespaceURI === mt ? k === "svg" && (N === "annotation-xml" || bt[N]) : !!kn[k] : i.namespaceURI === mt ? h.namespaceURI === ge ? k === "math" : h.namespaceURI === xt ? k === "math" && kt[N] : !!wn[k] : i.namespaceURI === ge ? h.namespaceURI === xt && !kt[N] || h.namespaceURI === mt && !bt[N] ? !1 : !wn[k] && (gs[k] || !kn[k]) : !!(Ze === "application/xhtml+xml" && $t[i.namespaceURI]) : !1;
|
|
779
|
+
}, "_checkValidNamespace"), ce = /* @__PURE__ */ u(function(i) {
|
|
780
|
+
Qe(t.removed, {
|
|
760
781
|
element: i
|
|
761
782
|
});
|
|
762
783
|
try {
|
|
763
|
-
|
|
784
|
+
ie(i).removeChild(i);
|
|
764
785
|
} catch {
|
|
765
786
|
z(i);
|
|
766
787
|
}
|
|
767
|
-
}, "_forceRemove"),
|
|
788
|
+
}, "_forceRemove"), Ce = /* @__PURE__ */ u(function(i, h) {
|
|
768
789
|
try {
|
|
769
|
-
|
|
770
|
-
attribute:
|
|
771
|
-
from:
|
|
790
|
+
Qe(t.removed, {
|
|
791
|
+
attribute: h.getAttributeNode(i),
|
|
792
|
+
from: h
|
|
772
793
|
});
|
|
773
794
|
} catch {
|
|
774
|
-
|
|
795
|
+
Qe(t.removed, {
|
|
775
796
|
attribute: null,
|
|
776
|
-
from:
|
|
797
|
+
from: h
|
|
777
798
|
});
|
|
778
799
|
}
|
|
779
|
-
if (
|
|
780
|
-
if (
|
|
800
|
+
if (h.removeAttribute(i), i === "is")
|
|
801
|
+
if (ze || ft)
|
|
781
802
|
try {
|
|
782
|
-
|
|
803
|
+
ce(h);
|
|
783
804
|
} catch {
|
|
784
805
|
}
|
|
785
806
|
else
|
|
786
807
|
try {
|
|
787
|
-
|
|
808
|
+
h.setAttribute(i, "");
|
|
788
809
|
} catch {
|
|
789
810
|
}
|
|
790
|
-
}, "_removeAttribute"), vn = /* @__PURE__ */
|
|
791
|
-
let
|
|
792
|
-
if (
|
|
811
|
+
}, "_removeAttribute"), vn = /* @__PURE__ */ u(function(i) {
|
|
812
|
+
let h = null, k = null;
|
|
813
|
+
if (Lt)
|
|
793
814
|
i = "<remove></remove>" + i;
|
|
794
815
|
else {
|
|
795
|
-
const
|
|
796
|
-
|
|
816
|
+
const F = qt(i, /^[\r\n\t ]+/);
|
|
817
|
+
k = F && F[0];
|
|
797
818
|
}
|
|
798
|
-
|
|
799
|
-
const
|
|
800
|
-
if (
|
|
819
|
+
Ze === "application/xhtml+xml" && Pe === ge && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
820
|
+
const N = O ? O.createHTML(i) : i;
|
|
821
|
+
if (Pe === ge)
|
|
801
822
|
try {
|
|
802
|
-
|
|
823
|
+
h = new f().parseFromString(N, Ze);
|
|
803
824
|
} catch {
|
|
804
825
|
}
|
|
805
|
-
if (!
|
|
806
|
-
|
|
826
|
+
if (!h || !h.documentElement) {
|
|
827
|
+
h = de.createDocument(Pe, "template", null);
|
|
807
828
|
try {
|
|
808
|
-
|
|
829
|
+
h.documentElement.innerHTML = Nt ? ae : N;
|
|
809
830
|
} catch {
|
|
810
831
|
}
|
|
811
832
|
}
|
|
812
|
-
const
|
|
813
|
-
return i &&
|
|
814
|
-
}, "_initDocument"), yn = /* @__PURE__ */
|
|
815
|
-
return
|
|
833
|
+
const Z = h.body || h.documentElement;
|
|
834
|
+
return i && k && Z.insertBefore(e.createTextNode(k), Z.childNodes[0] || null), Pe === ge ? Ee.call(h, Re ? "html" : "body")[0] : Re ? h.documentElement : Z;
|
|
835
|
+
}, "_initDocument"), yn = /* @__PURE__ */ u(function(i) {
|
|
836
|
+
return j.call(
|
|
816
837
|
i.ownerDocument || i,
|
|
817
838
|
i,
|
|
818
839
|
// eslint-disable-next-line no-bitwise
|
|
819
|
-
|
|
840
|
+
p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION,
|
|
820
841
|
null
|
|
821
842
|
);
|
|
822
|
-
}, "_createNodeIterator"),
|
|
843
|
+
}, "_createNodeIterator"), Bt = /* @__PURE__ */ u(function(i) {
|
|
823
844
|
return i instanceof d && (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");
|
|
824
|
-
}, "_isClobbered"),
|
|
845
|
+
}, "_isClobbered"), Ft = /* @__PURE__ */ u(function(i) {
|
|
825
846
|
return typeof o == "function" && i instanceof o;
|
|
826
847
|
}, "_isNode");
|
|
827
|
-
function
|
|
828
|
-
|
|
829
|
-
|
|
848
|
+
function ke(y, i, h) {
|
|
849
|
+
Ke(y, (k) => {
|
|
850
|
+
k.call(t, i, h, Ne);
|
|
830
851
|
});
|
|
831
852
|
}
|
|
832
|
-
|
|
833
|
-
const Tn = /* @__PURE__ */
|
|
834
|
-
let
|
|
835
|
-
if (
|
|
836
|
-
return
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
839
|
-
tagName:
|
|
840
|
-
allowedTags:
|
|
841
|
-
}),
|
|
842
|
-
return
|
|
843
|
-
if (
|
|
844
|
-
if (!
|
|
853
|
+
u(ke, "_executeHooks");
|
|
854
|
+
const Tn = /* @__PURE__ */ u(function(i) {
|
|
855
|
+
let h = null;
|
|
856
|
+
if (ke(q.beforeSanitizeElements, i, null), Bt(i))
|
|
857
|
+
return ce(i), !0;
|
|
858
|
+
const k = W(i.nodeName);
|
|
859
|
+
if (ke(q.uponSanitizeElement, i, {
|
|
860
|
+
tagName: k,
|
|
861
|
+
allowedTags: B
|
|
862
|
+
}), Ve && i.hasChildNodes() && !Ft(i.firstElementChild) && X(/<[/\w!]/g, i.innerHTML) && X(/<[/\w!]/g, i.textContent) || Ve && i.namespaceURI === ge && k === "style" && Ft(i.firstElementChild) || i.nodeType === tt.progressingInstruction || Ve && i.nodeType === tt.comment && X(/<[/\w]/g, i.data))
|
|
863
|
+
return ce(i), !0;
|
|
864
|
+
if (_[k] || !(x.tagCheck instanceof Function && x.tagCheck(k)) && !B[k]) {
|
|
865
|
+
if (!_[k] && An(k) && (P.tagNameCheck instanceof RegExp && X(P.tagNameCheck, k) || P.tagNameCheck instanceof Function && P.tagNameCheck(k)))
|
|
845
866
|
return !1;
|
|
846
|
-
if (
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
849
|
-
const
|
|
850
|
-
for (let
|
|
851
|
-
const
|
|
852
|
-
|
|
867
|
+
if (zt && !fe[k]) {
|
|
868
|
+
const N = ie(i) || i.parentNode, Z = se(i) || i.childNodes;
|
|
869
|
+
if (Z && N) {
|
|
870
|
+
const F = Z.length;
|
|
871
|
+
for (let te = F - 1; te >= 0; --te) {
|
|
872
|
+
const re = E(Z[te], !0);
|
|
873
|
+
re.__removalCount = (i.__removalCount || 0) + 1, N.insertBefore(re, U(i));
|
|
853
874
|
}
|
|
854
875
|
}
|
|
855
876
|
}
|
|
856
|
-
return
|
|
877
|
+
return ce(i), !0;
|
|
857
878
|
}
|
|
858
|
-
return i instanceof c && !ks(i) || (
|
|
859
|
-
|
|
860
|
-
}), i.textContent !==
|
|
879
|
+
return i instanceof c && !ks(i) || (k === "noscript" || k === "noembed" || k === "noframes") && X(/<\/no(script|embed|frames)/i, i.innerHTML) ? (ce(i), !0) : (oe && i.nodeType === tt.text && (h = i.textContent, Ke([R, _e, we], (N) => {
|
|
880
|
+
h = $e(h, N, " ");
|
|
881
|
+
}), i.textContent !== h && (Qe(t.removed, {
|
|
861
882
|
element: i.cloneNode()
|
|
862
|
-
}), i.textContent =
|
|
863
|
-
}, "_sanitizeElements"), Sn = /* @__PURE__ */
|
|
864
|
-
if (
|
|
883
|
+
}), i.textContent = h)), ke(q.afterSanitizeElements, i, null), !1);
|
|
884
|
+
}, "_sanitizeElements"), Sn = /* @__PURE__ */ u(function(i, h, k) {
|
|
885
|
+
if (b[h] || dn && (h === "id" || h === "name") && (k in e || k in bs))
|
|
865
886
|
return !1;
|
|
866
|
-
if (!(
|
|
867
|
-
if (!(
|
|
868
|
-
if (!(
|
|
869
|
-
if (!
|
|
887
|
+
if (!(V && !b[h] && X(Dt, h))) {
|
|
888
|
+
if (!(L && X(We, h))) {
|
|
889
|
+
if (!(x.attributeCheck instanceof Function && x.attributeCheck(h, i))) {
|
|
890
|
+
if (!G[h] || b[h]) {
|
|
870
891
|
if (
|
|
871
892
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
872
893
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
873
894
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
874
|
-
!(An(i) && (
|
|
895
|
+
!(An(i) && (P.tagNameCheck instanceof RegExp && X(P.tagNameCheck, i) || P.tagNameCheck instanceof Function && P.tagNameCheck(i)) && (P.attributeNameCheck instanceof RegExp && X(P.attributeNameCheck, h) || P.attributeNameCheck instanceof Function && P.attributeNameCheck(h, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
875
896
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
876
|
-
|
|
897
|
+
h === "is" && P.allowCustomizedBuiltInElements && (P.tagNameCheck instanceof RegExp && X(P.tagNameCheck, k) || P.tagNameCheck instanceof Function && P.tagNameCheck(k)))
|
|
877
898
|
) return !1;
|
|
878
|
-
} else if (!
|
|
879
|
-
if (!
|
|
880
|
-
if (!((
|
|
881
|
-
if (!(
|
|
882
|
-
if (
|
|
899
|
+
} else if (!Pt[h]) {
|
|
900
|
+
if (!X(pt, $e(k, ut, ""))) {
|
|
901
|
+
if (!((h === "src" || h === "xlink:href" || h === "href") && i !== "script" && js(k, "data:") === 0 && gn[i])) {
|
|
902
|
+
if (!(be && !X(It, $e(k, ut, "")))) {
|
|
903
|
+
if (k)
|
|
883
904
|
return !1;
|
|
884
905
|
}
|
|
885
906
|
}
|
|
@@ -889,213 +910,213 @@ function ns() {
|
|
|
889
910
|
}
|
|
890
911
|
}
|
|
891
912
|
return !0;
|
|
892
|
-
}, "_isValidAttribute"), An = /* @__PURE__ */
|
|
893
|
-
return i !== "annotation-xml" &&
|
|
894
|
-
}, "_isBasicCustomElement"), En = /* @__PURE__ */
|
|
895
|
-
|
|
913
|
+
}, "_isValidAttribute"), An = /* @__PURE__ */ u(function(i) {
|
|
914
|
+
return i !== "annotation-xml" && qt(i, ht);
|
|
915
|
+
}, "_isBasicCustomElement"), En = /* @__PURE__ */ u(function(i) {
|
|
916
|
+
ke(q.beforeSanitizeAttributes, i, null);
|
|
896
917
|
const {
|
|
897
|
-
attributes:
|
|
918
|
+
attributes: h
|
|
898
919
|
} = i;
|
|
899
|
-
if (!
|
|
920
|
+
if (!h || Bt(i))
|
|
900
921
|
return;
|
|
901
|
-
const
|
|
922
|
+
const k = {
|
|
902
923
|
attrName: "",
|
|
903
924
|
attrValue: "",
|
|
904
925
|
keepAttr: !0,
|
|
905
|
-
allowedAttributes:
|
|
926
|
+
allowedAttributes: G,
|
|
906
927
|
forceKeepAttr: void 0
|
|
907
928
|
};
|
|
908
|
-
let
|
|
909
|
-
for (;
|
|
910
|
-
const
|
|
911
|
-
name:
|
|
912
|
-
namespaceURI:
|
|
913
|
-
value:
|
|
914
|
-
} =
|
|
915
|
-
let
|
|
916
|
-
if (
|
|
917
|
-
|
|
929
|
+
let N = h.length;
|
|
930
|
+
for (; N--; ) {
|
|
931
|
+
const Z = h[N], {
|
|
932
|
+
name: F,
|
|
933
|
+
namespaceURI: te,
|
|
934
|
+
value: re
|
|
935
|
+
} = Z, ve = W(F), Ht = re;
|
|
936
|
+
let Y = F === "value" ? Ht : qs(Ht);
|
|
937
|
+
if (k.attrName = ve, k.attrValue = Y, k.keepAttr = !0, k.forceKeepAttr = void 0, ke(q.uponSanitizeAttribute, i, k), Y = k.attrValue, fn && (ve === "id" || ve === "name") && (Ce(F, i), Y = ds + Y), Ve && X(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, Y)) {
|
|
938
|
+
Ce(F, i);
|
|
918
939
|
continue;
|
|
919
940
|
}
|
|
920
|
-
if (
|
|
921
|
-
|
|
941
|
+
if (ve === "attributename" && qt(Y, "href")) {
|
|
942
|
+
Ce(F, i);
|
|
922
943
|
continue;
|
|
923
944
|
}
|
|
924
|
-
if (
|
|
945
|
+
if (k.forceKeepAttr)
|
|
925
946
|
continue;
|
|
926
|
-
if (!
|
|
927
|
-
|
|
947
|
+
if (!k.keepAttr) {
|
|
948
|
+
Ce(F, i);
|
|
928
949
|
continue;
|
|
929
950
|
}
|
|
930
|
-
if (!
|
|
931
|
-
|
|
951
|
+
if (!qe && X(/\/>/i, Y)) {
|
|
952
|
+
Ce(F, i);
|
|
932
953
|
continue;
|
|
933
954
|
}
|
|
934
|
-
|
|
935
|
-
|
|
955
|
+
oe && Ke([R, _e, we], (Cn) => {
|
|
956
|
+
Y = $e(Y, Cn, " ");
|
|
936
957
|
});
|
|
937
|
-
const Rn =
|
|
938
|
-
if (!Sn(Rn,
|
|
939
|
-
|
|
958
|
+
const Rn = W(i.nodeName);
|
|
959
|
+
if (!Sn(Rn, ve, Y)) {
|
|
960
|
+
Ce(F, i);
|
|
940
961
|
continue;
|
|
941
962
|
}
|
|
942
|
-
if (
|
|
943
|
-
switch (
|
|
963
|
+
if (O && typeof m == "object" && typeof m.getAttributeType == "function" && !te)
|
|
964
|
+
switch (m.getAttributeType(Rn, ve)) {
|
|
944
965
|
case "TrustedHTML": {
|
|
945
|
-
|
|
966
|
+
Y = O.createHTML(Y);
|
|
946
967
|
break;
|
|
947
968
|
}
|
|
948
969
|
case "TrustedScriptURL": {
|
|
949
|
-
|
|
970
|
+
Y = O.createScriptURL(Y);
|
|
950
971
|
break;
|
|
951
972
|
}
|
|
952
973
|
}
|
|
953
|
-
if (
|
|
974
|
+
if (Y !== Ht)
|
|
954
975
|
try {
|
|
955
|
-
|
|
976
|
+
te ? i.setAttributeNS(te, F, Y) : i.setAttribute(F, Y), Bt(i) ? ce(i) : Pn(t.removed);
|
|
956
977
|
} catch {
|
|
957
|
-
|
|
978
|
+
Ce(F, i);
|
|
958
979
|
}
|
|
959
980
|
}
|
|
960
|
-
|
|
961
|
-
}, "_sanitizeAttributes"), _n = /* @__PURE__ */
|
|
962
|
-
let
|
|
963
|
-
const
|
|
964
|
-
for (
|
|
965
|
-
|
|
966
|
-
|
|
981
|
+
ke(q.afterSanitizeAttributes, i, null);
|
|
982
|
+
}, "_sanitizeAttributes"), _n = /* @__PURE__ */ u(function(i) {
|
|
983
|
+
let h = null;
|
|
984
|
+
const k = yn(i);
|
|
985
|
+
for (ke(q.beforeSanitizeShadowDOM, i, null); h = k.nextNode(); )
|
|
986
|
+
ke(q.uponSanitizeShadowNode, h, null), Tn(h), En(h), h.content instanceof r && _n(h.content);
|
|
987
|
+
ke(q.afterSanitizeShadowDOM, i, null);
|
|
967
988
|
}, "_sanitizeShadowDOM");
|
|
968
989
|
return t.sanitize = function(y) {
|
|
969
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
970
|
-
if (
|
|
990
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, k = null, N = null, Z = null;
|
|
991
|
+
if (Nt = !y, Nt && (y = "<!-->"), typeof y != "string" && !Ft(y))
|
|
971
992
|
if (typeof y.toString == "function") {
|
|
972
993
|
if (y = y.toString(), typeof y != "string")
|
|
973
|
-
throw
|
|
994
|
+
throw Je("dirty is not a string, aborting");
|
|
974
995
|
} else
|
|
975
|
-
throw
|
|
996
|
+
throw Je("toString is not a function");
|
|
976
997
|
if (!t.isSupported)
|
|
977
998
|
return y;
|
|
978
|
-
if (
|
|
999
|
+
if (Mt || Ut(i), t.removed = [], typeof y == "string" && (Ye = !1), Ye) {
|
|
979
1000
|
if (y.nodeName) {
|
|
980
|
-
const
|
|
981
|
-
if (!
|
|
982
|
-
throw
|
|
1001
|
+
const re = W(y.nodeName);
|
|
1002
|
+
if (!B[re] || _[re])
|
|
1003
|
+
throw Je("root node is forbidden and cannot be sanitized in-place");
|
|
983
1004
|
}
|
|
984
1005
|
} else if (y instanceof o)
|
|
985
|
-
|
|
1006
|
+
h = vn("<!---->"), k = h.ownerDocument.importNode(y, !0), k.nodeType === tt.element && k.nodeName === "BODY" || k.nodeName === "HTML" ? h = k : h.appendChild(k);
|
|
986
1007
|
else {
|
|
987
|
-
if (!
|
|
1008
|
+
if (!ze && !oe && !Re && // eslint-disable-next-line unicorn/prefer-includes
|
|
988
1009
|
y.indexOf("<") === -1)
|
|
989
|
-
return
|
|
990
|
-
if (
|
|
991
|
-
return
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
const
|
|
995
|
-
for (;
|
|
996
|
-
Tn(
|
|
997
|
-
if (
|
|
1010
|
+
return O && gt ? O.createHTML(y) : y;
|
|
1011
|
+
if (h = vn(y), !h)
|
|
1012
|
+
return ze ? null : gt ? ae : "";
|
|
1013
|
+
}
|
|
1014
|
+
h && Lt && ce(h.firstChild);
|
|
1015
|
+
const F = yn(Ye ? y : h);
|
|
1016
|
+
for (; N = F.nextNode(); )
|
|
1017
|
+
Tn(N), En(N), N.content instanceof r && _n(N.content);
|
|
1018
|
+
if (Ye)
|
|
998
1019
|
return y;
|
|
999
|
-
if (
|
|
1000
|
-
if (
|
|
1001
|
-
|
|
1002
|
-
let
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
}),
|
|
1006
|
-
}
|
|
1007
|
-
if (
|
|
1008
|
-
for (
|
|
1009
|
-
|
|
1020
|
+
if (ze) {
|
|
1021
|
+
if (oe) {
|
|
1022
|
+
h.normalize();
|
|
1023
|
+
let re = h.innerHTML;
|
|
1024
|
+
Ke([R, _e, we], (ve) => {
|
|
1025
|
+
re = $e(re, ve, " ");
|
|
1026
|
+
}), h.innerHTML = re;
|
|
1027
|
+
}
|
|
1028
|
+
if (ft)
|
|
1029
|
+
for (Z = ct.call(h.ownerDocument); h.firstChild; )
|
|
1030
|
+
Z.appendChild(h.firstChild);
|
|
1010
1031
|
else
|
|
1011
|
-
|
|
1012
|
-
return (
|
|
1013
|
-
}
|
|
1014
|
-
let
|
|
1015
|
-
return
|
|
1016
|
-
` +
|
|
1017
|
-
|
|
1018
|
-
}),
|
|
1032
|
+
Z = h;
|
|
1033
|
+
return (G.shadowroot || G.shadowrootmode) && (Z = Ct.call(n, Z, !0)), Z;
|
|
1034
|
+
}
|
|
1035
|
+
let te = Re ? h.outerHTML : h.innerHTML;
|
|
1036
|
+
return Re && B["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && X(ts, h.ownerDocument.doctype.name) && (te = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
|
|
1037
|
+
` + te), oe && Ke([R, _e, we], (re) => {
|
|
1038
|
+
te = $e(te, re, " ");
|
|
1039
|
+
}), O && gt ? O.createHTML(te) : te;
|
|
1019
1040
|
}, t.setConfig = function() {
|
|
1020
1041
|
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1021
|
-
|
|
1042
|
+
Ut(y), Mt = !0;
|
|
1022
1043
|
}, t.clearConfig = function() {
|
|
1023
|
-
|
|
1024
|
-
}, t.isValidAttribute = function(y, i,
|
|
1025
|
-
|
|
1026
|
-
const
|
|
1027
|
-
return Sn(
|
|
1044
|
+
Ne = null, Mt = !1;
|
|
1045
|
+
}, t.isValidAttribute = function(y, i, h) {
|
|
1046
|
+
Ne || Ut({});
|
|
1047
|
+
const k = W(y), N = W(i);
|
|
1048
|
+
return Sn(k, N, h);
|
|
1028
1049
|
}, t.addHook = function(y, i) {
|
|
1029
|
-
typeof i == "function" &&
|
|
1050
|
+
typeof i == "function" && Qe(q[y], i);
|
|
1030
1051
|
}, t.removeHook = function(y, i) {
|
|
1031
1052
|
if (i !== void 0) {
|
|
1032
|
-
const
|
|
1033
|
-
return
|
|
1053
|
+
const h = Gs(q[y], i);
|
|
1054
|
+
return h === -1 ? void 0 : Ws(q[y], h, 1)[0];
|
|
1034
1055
|
}
|
|
1035
|
-
return Pn(
|
|
1056
|
+
return Pn(q[y]);
|
|
1036
1057
|
}, t.removeHooks = function(y) {
|
|
1037
|
-
|
|
1058
|
+
q[y] = [];
|
|
1038
1059
|
}, t.removeAllHooks = function() {
|
|
1039
|
-
|
|
1060
|
+
q = Hn();
|
|
1040
1061
|
}, t;
|
|
1041
1062
|
}
|
|
1042
|
-
|
|
1063
|
+
u(ns, "createDOMPurify");
|
|
1043
1064
|
var lr = ns();
|
|
1044
|
-
function
|
|
1065
|
+
function nn() {
|
|
1045
1066
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
1046
1067
|
}
|
|
1047
|
-
|
|
1048
|
-
var
|
|
1068
|
+
u(nn, "M");
|
|
1069
|
+
var Le = nn();
|
|
1049
1070
|
function ss(l) {
|
|
1050
|
-
|
|
1071
|
+
Le = l;
|
|
1051
1072
|
}
|
|
1052
|
-
|
|
1053
|
-
var
|
|
1054
|
-
function
|
|
1055
|
-
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */
|
|
1073
|
+
u(ss, "G");
|
|
1074
|
+
var De = { exec: /* @__PURE__ */ u(() => null, "exec") };
|
|
1075
|
+
function I(l, t = "") {
|
|
1076
|
+
let e = typeof l == "string" ? l : l.source, n = { replace: /* @__PURE__ */ u((s, r) => {
|
|
1056
1077
|
let a = typeof r == "string" ? r : r.source;
|
|
1057
|
-
return a = a.replace(
|
|
1058
|
-
}, "replace"), getRegex: /* @__PURE__ */
|
|
1078
|
+
return a = a.replace(Q.caret, "$1"), e = e.replace(s, a), n;
|
|
1079
|
+
}, "replace"), getRegex: /* @__PURE__ */ u(() => new RegExp(e, t), "getRegex") };
|
|
1059
1080
|
return n;
|
|
1060
1081
|
}
|
|
1061
|
-
|
|
1082
|
+
u(I, "k");
|
|
1062
1083
|
var or = (() => {
|
|
1063
1084
|
try {
|
|
1064
1085
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
1065
1086
|
} catch {
|
|
1066
1087
|
return !1;
|
|
1067
1088
|
}
|
|
1068
|
-
})(),
|
|
1069
|
-
]`).replace("lheading", is).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, vr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, yr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ls = /^( {2,}|\\)\n(?!\s*$)/, Tr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1070
|
-
function
|
|
1089
|
+
})(), Q = { 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") }, cr = /^(?:[ \t]*(?:\n|$))+/, ur = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, hr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ot = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, pr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, sn = / {0,3}(?:[*+-]|\d{1,9}[.)])/, rs = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, is = I(rs).replace(/bull/g, sn).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(), dr = I(rs).replace(/bull/g, sn).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(), rn = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, fr = /^[^\n]+/, an = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, gr = I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", an).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), mr = I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, sn).getRegex(), _t = "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", ln = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, xr = 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", ln).replace("tag", _t).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), as = I(rn).replace("hr", ot).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", _t).getRegex(), br = I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", as).getRegex(), on = { blockquote: br, code: ur, def: gr, fences: hr, heading: pr, hr: ot, html: xr, lheading: is, list: mr, newline: cr, paragraph: as, table: De, text: fr }, Gn = I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ot).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", _t).getRegex(), kr = { ...on, lheading: dr, table: Gn, paragraph: I(rn).replace("hr", ot).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Gn).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", _t).getRegex() }, wr = { ...on, html: I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ln).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: De, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: I(rn).replace("hr", ot).replace("heading", ` *#{1,6} *[^
|
|
1090
|
+
]`).replace("lheading", is).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, vr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, yr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ls = /^( {2,}|\\)\n(?!\s*$)/, Tr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Ge = /[\p{P}\p{S}]/u, Rt = /[\s\p{P}\p{S}]/u, cn = /[^\s\p{P}\p{S}]/u, Sr = I(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Rt).getRegex(), os = /(?!~)[\p{P}\p{S}]/u, Ar = /(?!~)[\s\p{P}\p{S}]/u, Er = /(?:[^\s\p{P}\p{S}]|~)/u, _r = I(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", or ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), cs = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Rr = I(cs, "u").replace(/punct/g, Ge).getRegex(), Cr = I(cs, "u").replace(/punct/g, os).getRegex(), us = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Dr = I(us, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Ge).getRegex(), Ir = I(us, "gu").replace(/notPunctSpace/g, Er).replace(/punctSpace/g, Ar).replace(/punct/g, os).getRegex(), Mr = I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Ge).getRegex(), Lr = I(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, Ge).getRegex(), zr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Or = I(zr, "gu").replace(/notPunctSpace/g, cn).replace(/punctSpace/g, Rt).replace(/punct/g, Ge).getRegex(), Pr = I(/\\(punct)/, "gu").replace(/punct/g, Ge).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(), $r = I(ln).replace("(?:-->|$)", "-->").getRegex(), Ur = 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", $r).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), St = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Br = I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", St).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), hs = I(/^!?\[(label)\]\[(ref)\]/).replace("label", St).replace("ref", an).getRegex(), ps = I(/^!?\[(ref)\](?:\[\])?/).replace("ref", an).getRegex(), Fr = I("reflink|nolink(?!\\()", "g").replace("reflink", hs).replace("nolink", ps).getRegex(), Wn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, un = { _backpedal: De, anyPunctuation: Pr, autolink: Nr, blockSkip: _r, br: ls, code: yr, del: De, delLDelim: De, delRDelim: De, emStrongLDelim: Rr, emStrongRDelimAst: Dr, emStrongRDelimUnd: Mr, escape: vr, link: Br, nolink: ps, punctuation: Sr, reflink: hs, reflinkSearch: Fr, tag: Ur, text: Tr, url: De }, Hr = { ...un, link: I(/^!?\[(label)\]\((.*?)\)/).replace("label", St).getRegex(), reflink: I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", St).getRegex() }, en = { ...un, emStrongRDelimAst: Ir, emStrongLDelim: Cr, delLDelim: Lr, delRDelim: Or, url: I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Wn).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", Wn).getRegex() }, Gr = { ...en, br: I(ls).replace("{2,}", "*").getRegex(), text: I(en.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, vt = { normal: on, gfm: kr, pedantic: wr }, nt = { normal: un, gfm: en, breaks: Gr, pedantic: Hr }, Wr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, jn = /* @__PURE__ */ u((l) => Wr[l], "ke");
|
|
1091
|
+
function xe(l, t) {
|
|
1071
1092
|
if (t) {
|
|
1072
|
-
if (
|
|
1073
|
-
} else if (
|
|
1093
|
+
if (Q.escapeTest.test(l)) return l.replace(Q.escapeReplace, jn);
|
|
1094
|
+
} else if (Q.escapeTestNoEncode.test(l)) return l.replace(Q.escapeReplaceNoEncode, jn);
|
|
1074
1095
|
return l;
|
|
1075
1096
|
}
|
|
1076
|
-
|
|
1097
|
+
u(xe, "T");
|
|
1077
1098
|
function qn(l) {
|
|
1078
1099
|
try {
|
|
1079
|
-
l = encodeURI(l).replace(
|
|
1100
|
+
l = encodeURI(l).replace(Q.percentDecode, "%");
|
|
1080
1101
|
} catch {
|
|
1081
1102
|
return null;
|
|
1082
1103
|
}
|
|
1083
1104
|
return l;
|
|
1084
1105
|
}
|
|
1085
|
-
|
|
1106
|
+
u(qn, "J");
|
|
1086
1107
|
function Vn(l, t) {
|
|
1087
|
-
let e = l.replace(
|
|
1088
|
-
let c = !1,
|
|
1089
|
-
for (; --
|
|
1108
|
+
let e = l.replace(Q.findPipe, (r, a, o) => {
|
|
1109
|
+
let c = !1, p = a;
|
|
1110
|
+
for (; --p >= 0 && o[p] === "\\"; ) c = !c;
|
|
1090
1111
|
return c ? "|" : " |";
|
|
1091
|
-
}), n = e.split(
|
|
1112
|
+
}), n = e.split(Q.splitPipe), s = 0;
|
|
1092
1113
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
1093
1114
|
else for (; n.length < t; ) n.push("");
|
|
1094
|
-
for (; s < n.length; s++) n[s] = n[s].trim().replace(
|
|
1115
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(Q.slashPipe, "|");
|
|
1095
1116
|
return n;
|
|
1096
1117
|
}
|
|
1097
|
-
|
|
1098
|
-
function
|
|
1118
|
+
u(Vn, "V");
|
|
1119
|
+
function st(l, t, e) {
|
|
1099
1120
|
let n = l.length;
|
|
1100
1121
|
if (n === 0) return "";
|
|
1101
1122
|
let s = 0;
|
|
@@ -1103,7 +1124,7 @@ function tt(l, t, e) {
|
|
|
1103
1124
|
s++;
|
|
1104
1125
|
return l.slice(0, n - s);
|
|
1105
1126
|
}
|
|
1106
|
-
|
|
1127
|
+
u(st, "I");
|
|
1107
1128
|
function jr(l, t) {
|
|
1108
1129
|
if (l.indexOf(t[1]) === -1) return -1;
|
|
1109
1130
|
let e = 0;
|
|
@@ -1112,7 +1133,7 @@ function jr(l, t) {
|
|
|
1112
1133
|
else if (l[n] === t[1] && (e--, e < 0)) return n;
|
|
1113
1134
|
return e > 0 ? -2 : -1;
|
|
1114
1135
|
}
|
|
1115
|
-
|
|
1136
|
+
u(jr, "de");
|
|
1116
1137
|
function qr(l, t = 0) {
|
|
1117
1138
|
let e = t, n = "";
|
|
1118
1139
|
for (let s of l) if (s === " ") {
|
|
@@ -1121,14 +1142,14 @@ function qr(l, t = 0) {
|
|
|
1121
1142
|
} else n += s, e++;
|
|
1122
1143
|
return n;
|
|
1123
1144
|
}
|
|
1124
|
-
|
|
1145
|
+
u(qr, "ge");
|
|
1125
1146
|
function Yn(l, t, e, n, s) {
|
|
1126
1147
|
let r = t.href, a = t.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1");
|
|
1127
1148
|
n.state.inLink = !0;
|
|
1128
1149
|
let c = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: e, href: r, title: a, text: o, tokens: n.inlineTokens(o) };
|
|
1129
1150
|
return n.state.inLink = !1, c;
|
|
1130
1151
|
}
|
|
1131
|
-
|
|
1152
|
+
u(Yn, "fe");
|
|
1132
1153
|
function Vr(l, t, e) {
|
|
1133
1154
|
let n = l.match(e.other.indentCodeCompensation);
|
|
1134
1155
|
if (n === null) return t;
|
|
@@ -1142,13 +1163,13 @@ function Vr(l, t, e) {
|
|
|
1142
1163
|
}).join(`
|
|
1143
1164
|
`);
|
|
1144
1165
|
}
|
|
1145
|
-
|
|
1146
|
-
var
|
|
1166
|
+
u(Vr, "nt");
|
|
1167
|
+
var Ue, At = (Ue = class {
|
|
1147
1168
|
constructor(t) {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
this.options = t ||
|
|
1169
|
+
D(this, "options");
|
|
1170
|
+
D(this, "rules");
|
|
1171
|
+
D(this, "lexer");
|
|
1172
|
+
this.options = t || Le;
|
|
1152
1173
|
}
|
|
1153
1174
|
space(t) {
|
|
1154
1175
|
let e = this.rules.block.newline.exec(t);
|
|
@@ -1158,7 +1179,7 @@ var $e, yt = ($e = class {
|
|
|
1158
1179
|
let e = this.rules.block.code.exec(t);
|
|
1159
1180
|
if (e) {
|
|
1160
1181
|
let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
1161
|
-
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n :
|
|
1182
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : st(n, `
|
|
1162
1183
|
`) };
|
|
1163
1184
|
}
|
|
1164
1185
|
}
|
|
@@ -1174,7 +1195,7 @@ var $e, yt = ($e = class {
|
|
|
1174
1195
|
if (e) {
|
|
1175
1196
|
let n = e[2].trim();
|
|
1176
1197
|
if (this.rules.other.endingHash.test(n)) {
|
|
1177
|
-
let s =
|
|
1198
|
+
let s = st(n, "#");
|
|
1178
1199
|
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
1179
1200
|
}
|
|
1180
1201
|
return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
@@ -1182,42 +1203,42 @@ var $e, yt = ($e = class {
|
|
|
1182
1203
|
}
|
|
1183
1204
|
hr(t) {
|
|
1184
1205
|
let e = this.rules.block.hr.exec(t);
|
|
1185
|
-
if (e) return { type: "hr", raw:
|
|
1206
|
+
if (e) return { type: "hr", raw: st(e[0], `
|
|
1186
1207
|
`) };
|
|
1187
1208
|
}
|
|
1188
1209
|
blockquote(t) {
|
|
1189
1210
|
let e = this.rules.block.blockquote.exec(t);
|
|
1190
1211
|
if (e) {
|
|
1191
|
-
let n =
|
|
1212
|
+
let n = st(e[0], `
|
|
1192
1213
|
`).split(`
|
|
1193
1214
|
`), s = "", r = "", a = [];
|
|
1194
1215
|
for (; n.length > 0; ) {
|
|
1195
|
-
let o = !1, c = [],
|
|
1196
|
-
for (
|
|
1197
|
-
else if (!o) c.push(n[
|
|
1216
|
+
let o = !1, c = [], p;
|
|
1217
|
+
for (p = 0; p < n.length; p++) if (this.rules.other.blockquoteStart.test(n[p])) c.push(n[p]), o = !0;
|
|
1218
|
+
else if (!o) c.push(n[p]);
|
|
1198
1219
|
else break;
|
|
1199
|
-
n = n.slice(
|
|
1220
|
+
n = n.slice(p);
|
|
1200
1221
|
let g = c.join(`
|
|
1201
1222
|
`), d = g.replace(this.rules.other.blockquoteSetextReplace, `
|
|
1202
1223
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1203
1224
|
s = s ? `${s}
|
|
1204
1225
|
${g}` : g, r = r ? `${r}
|
|
1205
1226
|
${d}` : d;
|
|
1206
|
-
let
|
|
1207
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(d, a, !0), this.lexer.state.top =
|
|
1208
|
-
let
|
|
1209
|
-
if (
|
|
1210
|
-
if (
|
|
1211
|
-
let
|
|
1227
|
+
let f = this.lexer.state.top;
|
|
1228
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(d, a, !0), this.lexer.state.top = f, n.length === 0) break;
|
|
1229
|
+
let m = a.at(-1);
|
|
1230
|
+
if (m?.type === "code") break;
|
|
1231
|
+
if (m?.type === "blockquote") {
|
|
1232
|
+
let w = m, E = w.raw + `
|
|
1212
1233
|
` + n.join(`
|
|
1213
|
-
`), z = this.blockquote(
|
|
1214
|
-
a[a.length - 1] = z, s = s.substring(0, s.length -
|
|
1234
|
+
`), z = this.blockquote(E);
|
|
1235
|
+
a[a.length - 1] = z, s = s.substring(0, s.length - w.raw.length) + z.raw, r = r.substring(0, r.length - w.text.length) + z.text;
|
|
1215
1236
|
break;
|
|
1216
|
-
} else if (
|
|
1217
|
-
let
|
|
1237
|
+
} else if (m?.type === "list") {
|
|
1238
|
+
let w = m, E = w.raw + `
|
|
1218
1239
|
` + n.join(`
|
|
1219
|
-
`), z = this.list(
|
|
1220
|
-
a[a.length - 1] = z, s = s.substring(0, s.length -
|
|
1240
|
+
`), z = this.list(E);
|
|
1241
|
+
a[a.length - 1] = z, s = s.substring(0, s.length - m.raw.length) + z.raw, r = r.substring(0, r.length - w.raw.length) + z.raw, n = E.substring(a.at(-1).raw.length).split(`
|
|
1221
1242
|
`);
|
|
1222
1243
|
continue;
|
|
1223
1244
|
}
|
|
@@ -1232,28 +1253,28 @@ ${d}` : d;
|
|
|
1232
1253
|
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
1233
1254
|
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
1234
1255
|
for (; t; ) {
|
|
1235
|
-
let
|
|
1256
|
+
let p = !1, g = "", d = "";
|
|
1236
1257
|
if (!(e = a.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
1237
1258
|
g = e[0], t = t.substring(g.length);
|
|
1238
|
-
let
|
|
1239
|
-
`, 1)[0], e[1].length),
|
|
1240
|
-
`, 1)[0],
|
|
1241
|
-
if (this.options.pedantic ? (
|
|
1242
|
-
`, t = t.substring(
|
|
1243
|
-
let z = this.rules.other.nextBulletRegex(
|
|
1259
|
+
let f = qr(e[2].split(`
|
|
1260
|
+
`, 1)[0], e[1].length), m = t.split(`
|
|
1261
|
+
`, 1)[0], w = !f.trim(), E = 0;
|
|
1262
|
+
if (this.options.pedantic ? (E = 2, d = f.trimStart()) : w ? E = e[1].length + 1 : (E = f.search(this.rules.other.nonSpaceChar), E = E > 4 ? 1 : E, d = f.slice(E), E += e[1].length), w && this.rules.other.blankLine.test(m) && (g += m + `
|
|
1263
|
+
`, t = t.substring(m.length + 1), p = !0), !p) {
|
|
1264
|
+
let z = this.rules.other.nextBulletRegex(E), U = this.rules.other.hrRegex(E), se = this.rules.other.fencesBeginRegex(E), ie = this.rules.other.headingBeginRegex(E), O = this.rules.other.htmlBeginRegex(E), ae = this.rules.other.blockquoteBeginRegex(E);
|
|
1244
1265
|
for (; t; ) {
|
|
1245
|
-
let
|
|
1246
|
-
`, 1)[0],
|
|
1247
|
-
if (
|
|
1248
|
-
if (
|
|
1249
|
-
` +
|
|
1266
|
+
let de = t.split(`
|
|
1267
|
+
`, 1)[0], j;
|
|
1268
|
+
if (m = de, this.options.pedantic ? (m = m.replace(this.rules.other.listReplaceNesting, " "), j = m) : j = m.replace(this.rules.other.tabCharGlobal, " "), se.test(m) || ie.test(m) || O.test(m) || ae.test(m) || z.test(m) || U.test(m)) break;
|
|
1269
|
+
if (j.search(this.rules.other.nonSpaceChar) >= E || !m.trim()) d += `
|
|
1270
|
+
` + j.slice(E);
|
|
1250
1271
|
else {
|
|
1251
|
-
if (
|
|
1272
|
+
if (w || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || se.test(f) || ie.test(f) || U.test(f)) break;
|
|
1252
1273
|
d += `
|
|
1253
|
-
` +
|
|
1274
|
+
` + m;
|
|
1254
1275
|
}
|
|
1255
|
-
|
|
1256
|
-
`, t = t.substring(
|
|
1276
|
+
w = !m.trim(), g += de + `
|
|
1277
|
+
`, t = t.substring(de.length + 1), f = j.slice(E);
|
|
1257
1278
|
}
|
|
1258
1279
|
}
|
|
1259
1280
|
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(d), loose: !1, text: d, tokens: [] }), r.raw += g;
|
|
@@ -1262,29 +1283,29 @@ ${d}` : d;
|
|
|
1262
1283
|
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
1263
1284
|
else return;
|
|
1264
1285
|
r.raw = r.raw.trimEnd();
|
|
1265
|
-
for (let
|
|
1266
|
-
if (this.lexer.state.top = !1,
|
|
1267
|
-
if (
|
|
1268
|
-
|
|
1286
|
+
for (let p of r.items) {
|
|
1287
|
+
if (this.lexer.state.top = !1, p.tokens = this.lexer.blockTokens(p.text, []), p.task) {
|
|
1288
|
+
if (p.text = p.text.replace(this.rules.other.listReplaceTask, ""), p.tokens[0]?.type === "text" || p.tokens[0]?.type === "paragraph") {
|
|
1289
|
+
p.tokens[0].raw = p.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), p.tokens[0].text = p.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
1269
1290
|
for (let d = this.lexer.inlineQueue.length - 1; d >= 0; d--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)) {
|
|
1270
1291
|
this.lexer.inlineQueue[d].src = this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask, "");
|
|
1271
1292
|
break;
|
|
1272
1293
|
}
|
|
1273
1294
|
}
|
|
1274
|
-
let g = this.rules.other.listTaskCheckbox.exec(
|
|
1295
|
+
let g = this.rules.other.listTaskCheckbox.exec(p.raw);
|
|
1275
1296
|
if (g) {
|
|
1276
1297
|
let d = { type: "checkbox", raw: g[0] + " ", checked: g[0] !== "[ ]" };
|
|
1277
|
-
|
|
1298
|
+
p.checked = d.checked, r.loose ? p.tokens[0] && ["paragraph", "text"].includes(p.tokens[0].type) && "tokens" in p.tokens[0] && p.tokens[0].tokens ? (p.tokens[0].raw = d.raw + p.tokens[0].raw, p.tokens[0].text = d.raw + p.tokens[0].text, p.tokens[0].tokens.unshift(d)) : p.tokens.unshift({ type: "paragraph", raw: d.raw, text: d.raw, tokens: [d] }) : p.tokens.unshift(d);
|
|
1278
1299
|
}
|
|
1279
1300
|
}
|
|
1280
1301
|
if (!r.loose) {
|
|
1281
|
-
let g =
|
|
1302
|
+
let g = p.tokens.filter((f) => f.type === "space"), d = g.length > 0 && g.some((f) => this.rules.other.anyLine.test(f.raw));
|
|
1282
1303
|
r.loose = d;
|
|
1283
1304
|
}
|
|
1284
1305
|
}
|
|
1285
|
-
if (r.loose) for (let
|
|
1286
|
-
|
|
1287
|
-
for (let g of
|
|
1306
|
+
if (r.loose) for (let p of r.items) {
|
|
1307
|
+
p.loose = !0;
|
|
1308
|
+
for (let g of p.tokens) g.type === "text" && (g.type = "paragraph");
|
|
1288
1309
|
}
|
|
1289
1310
|
return r;
|
|
1290
1311
|
}
|
|
@@ -1308,7 +1329,7 @@ ${d}` : d;
|
|
|
1308
1329
|
if (n.length === s.length) {
|
|
1309
1330
|
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);
|
|
1310
1331
|
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] });
|
|
1311
|
-
for (let o of r) a.rows.push(Vn(o, a.header.length).map((c,
|
|
1332
|
+
for (let o of r) a.rows.push(Vn(o, a.header.length).map((c, p) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: a.align[p] })));
|
|
1312
1333
|
return a;
|
|
1313
1334
|
}
|
|
1314
1335
|
}
|
|
@@ -1345,7 +1366,7 @@ ${d}` : d;
|
|
|
1345
1366
|
let n = e[2].trim();
|
|
1346
1367
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1347
1368
|
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1348
|
-
let a =
|
|
1369
|
+
let a = st(n.slice(0, -1), "\\");
|
|
1349
1370
|
if ((n.length - a.length) % 2 === 0) return;
|
|
1350
1371
|
} else {
|
|
1351
1372
|
let a = jr(e[2], "()");
|
|
@@ -1377,25 +1398,25 @@ ${d}` : d;
|
|
|
1377
1398
|
emStrong(t, e, n = "") {
|
|
1378
1399
|
let s = this.rules.inline.emStrongLDelim.exec(t);
|
|
1379
1400
|
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))) {
|
|
1380
|
-
let r = [...s[0]].length - 1, a, o, c = r,
|
|
1401
|
+
let r = [...s[0]].length - 1, a, o, c = r, p = 0, g = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1381
1402
|
for (g.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = g.exec(e)) !== null; ) {
|
|
1382
1403
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a) continue;
|
|
1383
1404
|
if (o = [...a].length, s[3] || s[4]) {
|
|
1384
1405
|
c += o;
|
|
1385
1406
|
continue;
|
|
1386
1407
|
} else if ((s[5] || s[6]) && r % 3 && !((r + o) % 3)) {
|
|
1387
|
-
|
|
1408
|
+
p += o;
|
|
1388
1409
|
continue;
|
|
1389
1410
|
}
|
|
1390
1411
|
if (c -= o, c > 0) continue;
|
|
1391
|
-
o = Math.min(o, o + c +
|
|
1392
|
-
let d = [...s[0]][0].length,
|
|
1412
|
+
o = Math.min(o, o + c + p);
|
|
1413
|
+
let d = [...s[0]][0].length, f = t.slice(0, r + s.index + d + o);
|
|
1393
1414
|
if (Math.min(r, o) % 2) {
|
|
1394
|
-
let
|
|
1395
|
-
return { type: "em", raw:
|
|
1415
|
+
let w = f.slice(1, -1);
|
|
1416
|
+
return { type: "em", raw: f, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
1396
1417
|
}
|
|
1397
|
-
let
|
|
1398
|
-
return { type: "strong", raw:
|
|
1418
|
+
let m = f.slice(2, -2);
|
|
1419
|
+
return { type: "strong", raw: f, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1399
1420
|
}
|
|
1400
1421
|
}
|
|
1401
1422
|
}
|
|
@@ -1413,8 +1434,8 @@ ${d}` : d;
|
|
|
1413
1434
|
del(t, e, n = "") {
|
|
1414
1435
|
let s = this.rules.inline.delLDelim.exec(t);
|
|
1415
1436
|
if (s && (!s[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
1416
|
-
let r = [...s[0]].length - 1, a, o, c = r,
|
|
1417
|
-
for (
|
|
1437
|
+
let r = [...s[0]].length - 1, a, o, c = r, p = this.rules.inline.delRDelim;
|
|
1438
|
+
for (p.lastIndex = 0, e = e.slice(-1 * t.length + r); (s = p.exec(e)) !== null; ) {
|
|
1418
1439
|
if (a = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !a || (o = [...a].length, o !== r)) continue;
|
|
1419
1440
|
if (s[3] || s[4]) {
|
|
1420
1441
|
c += o;
|
|
@@ -1422,8 +1443,8 @@ ${d}` : d;
|
|
|
1422
1443
|
}
|
|
1423
1444
|
if (c -= o, c > 0) continue;
|
|
1424
1445
|
o = Math.min(o, o + c);
|
|
1425
|
-
let g = [...s[0]][0].length, d = t.slice(0, r + s.index + g + o),
|
|
1426
|
-
return { type: "del", raw: d, text:
|
|
1446
|
+
let g = [...s[0]][0].length, d = t.slice(0, r + s.index + g + o), f = d.slice(r, -r);
|
|
1447
|
+
return { type: "del", raw: d, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1427
1448
|
}
|
|
1428
1449
|
}
|
|
1429
1450
|
}
|
|
@@ -1456,28 +1477,28 @@ ${d}` : d;
|
|
|
1456
1477
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
1457
1478
|
}
|
|
1458
1479
|
}
|
|
1459
|
-
},
|
|
1480
|
+
}, u(Ue, "w"), Ue), Se, he = (Se = class {
|
|
1460
1481
|
constructor(t) {
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t ||
|
|
1467
|
-
let e = { other:
|
|
1468
|
-
this.options.pedantic ? (e.block =
|
|
1482
|
+
D(this, "tokens");
|
|
1483
|
+
D(this, "options");
|
|
1484
|
+
D(this, "state");
|
|
1485
|
+
D(this, "inlineQueue");
|
|
1486
|
+
D(this, "tokenizer");
|
|
1487
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || Le, this.options.tokenizer = this.options.tokenizer || new At(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1488
|
+
let e = { other: Q, block: vt.normal, inline: nt.normal };
|
|
1489
|
+
this.options.pedantic ? (e.block = vt.pedantic, e.inline = nt.pedantic) : this.options.gfm && (e.block = vt.gfm, this.options.breaks ? e.inline = nt.breaks : e.inline = nt.gfm), this.tokenizer.rules = e;
|
|
1469
1490
|
}
|
|
1470
1491
|
static get rules() {
|
|
1471
|
-
return { block:
|
|
1492
|
+
return { block: vt, inline: nt };
|
|
1472
1493
|
}
|
|
1473
1494
|
static lex(t, e) {
|
|
1474
|
-
return new
|
|
1495
|
+
return new Se(e).lex(t);
|
|
1475
1496
|
}
|
|
1476
1497
|
static lexInline(t, e) {
|
|
1477
|
-
return new
|
|
1498
|
+
return new Se(e).inlineTokens(t);
|
|
1478
1499
|
}
|
|
1479
1500
|
lex(t) {
|
|
1480
|
-
t = t.replace(
|
|
1501
|
+
t = t.replace(Q.carriageReturn, `
|
|
1481
1502
|
`), this.blockTokens(t, this.tokens);
|
|
1482
1503
|
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
1483
1504
|
let n = this.inlineQueue[e];
|
|
@@ -1486,7 +1507,7 @@ ${d}` : d;
|
|
|
1486
1507
|
return this.inlineQueue = [], this.tokens;
|
|
1487
1508
|
}
|
|
1488
1509
|
blockTokens(t, e = [], n = !1) {
|
|
1489
|
-
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(
|
|
1510
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (t = t.replace(Q.tabCharGlobal, " ").replace(Q.spaceLine, "")); t; ) {
|
|
1490
1511
|
let s;
|
|
1491
1512
|
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;
|
|
1492
1513
|
if (s = this.tokenizer.space(t)) {
|
|
@@ -1549,8 +1570,8 @@ ${d}` : d;
|
|
|
1549
1570
|
let r = t;
|
|
1550
1571
|
if (this.options.extensions?.startBlock) {
|
|
1551
1572
|
let a = 1 / 0, o = t.slice(1), c;
|
|
1552
|
-
this.options.extensions.startBlock.forEach((
|
|
1553
|
-
c =
|
|
1573
|
+
this.options.extensions.startBlock.forEach((p) => {
|
|
1574
|
+
c = p.call({ lexer: this }, o), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
1554
1575
|
}), a < 1 / 0 && a >= 0 && (r = t.substring(0, a + 1));
|
|
1555
1576
|
}
|
|
1556
1577
|
if (this.state.top && (s = this.tokenizer.paragraph(r))) {
|
|
@@ -1641,14 +1662,14 @@ ${d}` : d;
|
|
|
1641
1662
|
t = t.substring(c.raw.length), e.push(c);
|
|
1642
1663
|
continue;
|
|
1643
1664
|
}
|
|
1644
|
-
let
|
|
1665
|
+
let p = t;
|
|
1645
1666
|
if (this.options.extensions?.startInline) {
|
|
1646
|
-
let g = 1 / 0, d = t.slice(1),
|
|
1647
|
-
this.options.extensions.startInline.forEach((
|
|
1648
|
-
|
|
1649
|
-
}), g < 1 / 0 && g >= 0 && (
|
|
1667
|
+
let g = 1 / 0, d = t.slice(1), f;
|
|
1668
|
+
this.options.extensions.startInline.forEach((m) => {
|
|
1669
|
+
f = m.call({ lexer: this }, d), typeof f == "number" && f >= 0 && (g = Math.min(g, f));
|
|
1670
|
+
}), g < 1 / 0 && g >= 0 && (p = t.substring(0, g + 1));
|
|
1650
1671
|
}
|
|
1651
|
-
if (c = this.tokenizer.inlineText(
|
|
1672
|
+
if (c = this.tokenizer.inlineText(p)) {
|
|
1652
1673
|
t = t.substring(c.raw.length), c.raw.slice(-1) !== "_" && (o = c.raw.slice(-1)), a = !0;
|
|
1653
1674
|
let g = e.at(-1);
|
|
1654
1675
|
g?.type === "text" ? (g.raw += c.raw, g.text += c.text) : e.push(c);
|
|
@@ -1664,20 +1685,20 @@ ${d}` : d;
|
|
|
1664
1685
|
}
|
|
1665
1686
|
return e;
|
|
1666
1687
|
}
|
|
1667
|
-
},
|
|
1688
|
+
}, u(Se, "u"), Se), Be, Et = (Be = class {
|
|
1668
1689
|
constructor(t) {
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
this.options = t ||
|
|
1690
|
+
D(this, "options");
|
|
1691
|
+
D(this, "parser");
|
|
1692
|
+
this.options = t || Le;
|
|
1672
1693
|
}
|
|
1673
1694
|
space(t) {
|
|
1674
1695
|
return "";
|
|
1675
1696
|
}
|
|
1676
1697
|
code({ text: t, lang: e, escaped: n }) {
|
|
1677
|
-
let s = (e || "").match(
|
|
1698
|
+
let s = (e || "").match(Q.notSpaceStart)?.[0], r = t.replace(Q.endingNewline, "") + `
|
|
1678
1699
|
`;
|
|
1679
|
-
return s ? '<pre><code class="language-' +
|
|
1680
|
-
` : "<pre><code>" + (n ? r :
|
|
1700
|
+
return s ? '<pre><code class="language-' + xe(s) + '">' + (n ? r : xe(r, !0)) + `</code></pre>
|
|
1701
|
+
` : "<pre><code>" + (n ? r : xe(r, !0)) + `</code></pre>
|
|
1681
1702
|
`;
|
|
1682
1703
|
}
|
|
1683
1704
|
blockquote({ tokens: t }) {
|
|
@@ -1755,7 +1776,7 @@ ${t}</tr>
|
|
|
1755
1776
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1756
1777
|
}
|
|
1757
1778
|
codespan({ text: t }) {
|
|
1758
|
-
return `<code>${
|
|
1779
|
+
return `<code>${xe(t, !0)}</code>`;
|
|
1759
1780
|
}
|
|
1760
1781
|
br(t) {
|
|
1761
1782
|
return "<br>";
|
|
@@ -1768,20 +1789,20 @@ ${t}</tr>
|
|
|
1768
1789
|
if (r === null) return s;
|
|
1769
1790
|
t = r;
|
|
1770
1791
|
let a = '<a href="' + t + '"';
|
|
1771
|
-
return e && (a += ' title="' +
|
|
1792
|
+
return e && (a += ' title="' + xe(e) + '"'), a += ">" + s + "</a>", a;
|
|
1772
1793
|
}
|
|
1773
1794
|
image({ href: t, title: e, text: n, tokens: s }) {
|
|
1774
1795
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1775
1796
|
let r = qn(t);
|
|
1776
|
-
if (r === null) return
|
|
1797
|
+
if (r === null) return xe(n);
|
|
1777
1798
|
t = r;
|
|
1778
|
-
let a = `<img src="${t}" alt="${
|
|
1779
|
-
return e && (a += ` title="${
|
|
1799
|
+
let a = `<img src="${t}" alt="${xe(n)}"`;
|
|
1800
|
+
return e && (a += ` title="${xe(e)}"`), a += ">", a;
|
|
1780
1801
|
}
|
|
1781
1802
|
text(t) {
|
|
1782
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1803
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : xe(t.text);
|
|
1783
1804
|
}
|
|
1784
|
-
},
|
|
1805
|
+
}, u(Be, "y"), Be), Fe, hn = (Fe = class {
|
|
1785
1806
|
strong({ text: t }) {
|
|
1786
1807
|
return t;
|
|
1787
1808
|
}
|
|
@@ -1812,18 +1833,18 @@ ${t}</tr>
|
|
|
1812
1833
|
checkbox({ raw: t }) {
|
|
1813
1834
|
return t;
|
|
1814
1835
|
}
|
|
1815
|
-
},
|
|
1836
|
+
}, u(Fe, "$"), Fe), Ae, pe = (Ae = class {
|
|
1816
1837
|
constructor(t) {
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
this.options = t ||
|
|
1838
|
+
D(this, "options");
|
|
1839
|
+
D(this, "renderer");
|
|
1840
|
+
D(this, "textRenderer");
|
|
1841
|
+
this.options = t || Le, this.options.renderer = this.options.renderer || new Et(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new hn();
|
|
1821
1842
|
}
|
|
1822
1843
|
static parse(t, e) {
|
|
1823
|
-
return new
|
|
1844
|
+
return new Ae(e).parse(t);
|
|
1824
1845
|
}
|
|
1825
1846
|
static parseInline(t, e) {
|
|
1826
|
-
return new
|
|
1847
|
+
return new Ae(e).parseInline(t);
|
|
1827
1848
|
}
|
|
1828
1849
|
parse(t) {
|
|
1829
1850
|
this.renderer.parser = this;
|
|
@@ -1963,11 +1984,11 @@ ${t}</tr>
|
|
|
1963
1984
|
}
|
|
1964
1985
|
return n;
|
|
1965
1986
|
}
|
|
1966
|
-
},
|
|
1987
|
+
}, u(Ae, "u"), Ae), Te, at = (Te = class {
|
|
1967
1988
|
constructor(t) {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
this.options = t ||
|
|
1989
|
+
D(this, "options");
|
|
1990
|
+
D(this, "block");
|
|
1991
|
+
this.options = t || Le;
|
|
1971
1992
|
}
|
|
1972
1993
|
preprocess(t) {
|
|
1973
1994
|
return t;
|
|
@@ -1982,23 +2003,23 @@ ${t}</tr>
|
|
|
1982
2003
|
return t;
|
|
1983
2004
|
}
|
|
1984
2005
|
provideLexer(t = this.block) {
|
|
1985
|
-
return t ?
|
|
2006
|
+
return t ? he.lex : he.lexInline;
|
|
1986
2007
|
}
|
|
1987
2008
|
provideParser(t = this.block) {
|
|
1988
|
-
return t ?
|
|
2009
|
+
return t ? pe.parse : pe.parseInline;
|
|
1989
2010
|
}
|
|
1990
|
-
},
|
|
2011
|
+
}, u(Te, "P"), D(Te, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), D(Te, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Te), He, Yr = (He = class {
|
|
1991
2012
|
constructor(...t) {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2013
|
+
D(this, "defaults", nn());
|
|
2014
|
+
D(this, "options", this.setOptions);
|
|
2015
|
+
D(this, "parse", this.parseMarkdown(!0));
|
|
2016
|
+
D(this, "parseInline", this.parseMarkdown(!1));
|
|
2017
|
+
D(this, "Parser", pe);
|
|
2018
|
+
D(this, "Renderer", Et);
|
|
2019
|
+
D(this, "TextRenderer", hn);
|
|
2020
|
+
D(this, "Lexer", he);
|
|
2021
|
+
D(this, "Tokenizer", At);
|
|
2022
|
+
D(this, "Hooks", at);
|
|
2002
2023
|
this.use(...t);
|
|
2003
2024
|
}
|
|
2004
2025
|
walkTokens(t, e) {
|
|
@@ -2045,51 +2066,51 @@ ${t}</tr>
|
|
|
2045
2066
|
}
|
|
2046
2067
|
"childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
|
|
2047
2068
|
}), s.extensions = e), n.renderer) {
|
|
2048
|
-
let r = this.defaults.renderer || new
|
|
2069
|
+
let r = this.defaults.renderer || new Et(this.defaults);
|
|
2049
2070
|
for (let a in n.renderer) {
|
|
2050
2071
|
if (!(a in r)) throw new Error(`renderer '${a}' does not exist`);
|
|
2051
2072
|
if (["options", "parser"].includes(a)) continue;
|
|
2052
|
-
let o = a, c = n.renderer[o],
|
|
2073
|
+
let o = a, c = n.renderer[o], p = r[o];
|
|
2053
2074
|
r[o] = (...g) => {
|
|
2054
2075
|
let d = c.apply(r, g);
|
|
2055
|
-
return d === !1 && (d =
|
|
2076
|
+
return d === !1 && (d = p.apply(r, g)), d || "";
|
|
2056
2077
|
};
|
|
2057
2078
|
}
|
|
2058
2079
|
s.renderer = r;
|
|
2059
2080
|
}
|
|
2060
2081
|
if (n.tokenizer) {
|
|
2061
|
-
let r = this.defaults.tokenizer || new
|
|
2082
|
+
let r = this.defaults.tokenizer || new At(this.defaults);
|
|
2062
2083
|
for (let a in n.tokenizer) {
|
|
2063
2084
|
if (!(a in r)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
2064
2085
|
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
2065
|
-
let o = a, c = n.tokenizer[o],
|
|
2086
|
+
let o = a, c = n.tokenizer[o], p = r[o];
|
|
2066
2087
|
r[o] = (...g) => {
|
|
2067
2088
|
let d = c.apply(r, g);
|
|
2068
|
-
return d === !1 && (d =
|
|
2089
|
+
return d === !1 && (d = p.apply(r, g)), d;
|
|
2069
2090
|
};
|
|
2070
2091
|
}
|
|
2071
2092
|
s.tokenizer = r;
|
|
2072
2093
|
}
|
|
2073
2094
|
if (n.hooks) {
|
|
2074
|
-
let r = this.defaults.hooks || new
|
|
2095
|
+
let r = this.defaults.hooks || new at();
|
|
2075
2096
|
for (let a in n.hooks) {
|
|
2076
2097
|
if (!(a in r)) throw new Error(`hook '${a}' does not exist`);
|
|
2077
2098
|
if (["options", "block"].includes(a)) continue;
|
|
2078
|
-
let o = a, c = n.hooks[o],
|
|
2079
|
-
|
|
2080
|
-
if (this.defaults.async &&
|
|
2081
|
-
let
|
|
2082
|
-
return
|
|
2099
|
+
let o = a, c = n.hooks[o], p = r[o];
|
|
2100
|
+
at.passThroughHooks.has(a) ? r[o] = (g) => {
|
|
2101
|
+
if (this.defaults.async && at.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
2102
|
+
let f = await c.call(r, g);
|
|
2103
|
+
return p.call(r, f);
|
|
2083
2104
|
})();
|
|
2084
2105
|
let d = c.call(r, g);
|
|
2085
|
-
return
|
|
2106
|
+
return p.call(r, d);
|
|
2086
2107
|
} : r[o] = (...g) => {
|
|
2087
2108
|
if (this.defaults.async) return (async () => {
|
|
2088
|
-
let
|
|
2089
|
-
return
|
|
2109
|
+
let f = await c.apply(r, g);
|
|
2110
|
+
return f === !1 && (f = await p.apply(r, g)), f;
|
|
2090
2111
|
})();
|
|
2091
2112
|
let d = c.apply(r, g);
|
|
2092
|
-
return d === !1 && (d =
|
|
2113
|
+
return d === !1 && (d = p.apply(r, g)), d;
|
|
2093
2114
|
};
|
|
2094
2115
|
}
|
|
2095
2116
|
s.hooks = r;
|
|
@@ -2108,10 +2129,10 @@ ${t}</tr>
|
|
|
2108
2129
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
2109
2130
|
}
|
|
2110
2131
|
lexer(t, e) {
|
|
2111
|
-
return
|
|
2132
|
+
return he.lex(t, e ?? this.defaults);
|
|
2112
2133
|
}
|
|
2113
2134
|
parser(t, e) {
|
|
2114
|
-
return
|
|
2135
|
+
return pe.parse(t, e ?? this.defaults);
|
|
2115
2136
|
}
|
|
2116
2137
|
parseMarkdown(t) {
|
|
2117
2138
|
return (e, n) => {
|
|
@@ -2120,16 +2141,16 @@ ${t}</tr>
|
|
|
2120
2141
|
if (typeof e > "u" || e === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
2121
2142
|
if (typeof e != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
2122
2143
|
if (r.hooks && (r.hooks.options = r, r.hooks.block = t), r.async) return (async () => {
|
|
2123
|
-
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ?
|
|
2124
|
-
r.walkTokens && await Promise.all(this.walkTokens(
|
|
2125
|
-
let g = await (r.hooks ? await r.hooks.provideParser(t) : t ?
|
|
2144
|
+
let o = r.hooks ? await r.hooks.preprocess(e) : e, c = await (r.hooks ? await r.hooks.provideLexer(t) : t ? he.lex : he.lexInline)(o, r), p = r.hooks ? await r.hooks.processAllTokens(c) : c;
|
|
2145
|
+
r.walkTokens && await Promise.all(this.walkTokens(p, r.walkTokens));
|
|
2146
|
+
let g = await (r.hooks ? await r.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(p, r);
|
|
2126
2147
|
return r.hooks ? await r.hooks.postprocess(g) : g;
|
|
2127
2148
|
})().catch(a);
|
|
2128
2149
|
try {
|
|
2129
2150
|
r.hooks && (e = r.hooks.preprocess(e));
|
|
2130
|
-
let o = (r.hooks ? r.hooks.provideLexer(t) : t ?
|
|
2151
|
+
let o = (r.hooks ? r.hooks.provideLexer(t) : t ? he.lex : he.lexInline)(e, r);
|
|
2131
2152
|
r.hooks && (o = r.hooks.processAllTokens(o)), r.walkTokens && this.walkTokens(o, r.walkTokens);
|
|
2132
|
-
let c = (r.hooks ? r.hooks.provideParser(t) : t ?
|
|
2153
|
+
let c = (r.hooks ? r.hooks.provideParser(t) : t ? pe.parse : pe.parseInline)(o, r);
|
|
2133
2154
|
return r.hooks && (c = r.hooks.postprocess(c)), c;
|
|
2134
2155
|
} catch (o) {
|
|
2135
2156
|
return a(o);
|
|
@@ -2140,77 +2161,80 @@ ${t}</tr>
|
|
|
2140
2161
|
return (n) => {
|
|
2141
2162
|
if (n.message += `
|
|
2142
2163
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
2143
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
2164
|
+
let s = "<p>An error occurred:</p><pre>" + xe(n.message + "", !0) + "</pre>";
|
|
2144
2165
|
return e ? Promise.resolve(s) : s;
|
|
2145
2166
|
}
|
|
2146
2167
|
if (e) return Promise.reject(n);
|
|
2147
2168
|
throw n;
|
|
2148
2169
|
};
|
|
2149
2170
|
}
|
|
2150
|
-
},
|
|
2171
|
+
}, u(He, "D"), He), Ie = new Yr();
|
|
2151
2172
|
function M(l, t) {
|
|
2152
|
-
return
|
|
2173
|
+
return Ie.parse(l, t);
|
|
2153
2174
|
}
|
|
2154
|
-
|
|
2175
|
+
u(M, "g");
|
|
2155
2176
|
M.options = M.setOptions = function(l) {
|
|
2156
|
-
return
|
|
2177
|
+
return Ie.setOptions(l), M.defaults = Ie.defaults, ss(M.defaults), M;
|
|
2157
2178
|
};
|
|
2158
|
-
M.getDefaults =
|
|
2159
|
-
M.defaults =
|
|
2179
|
+
M.getDefaults = nn;
|
|
2180
|
+
M.defaults = Le;
|
|
2160
2181
|
M.use = function(...l) {
|
|
2161
|
-
return
|
|
2182
|
+
return Ie.use(...l), M.defaults = Ie.defaults, ss(M.defaults), M;
|
|
2162
2183
|
};
|
|
2163
2184
|
M.walkTokens = function(l, t) {
|
|
2164
|
-
return
|
|
2185
|
+
return Ie.walkTokens(l, t);
|
|
2165
2186
|
};
|
|
2166
|
-
M.parseInline =
|
|
2167
|
-
M.Parser =
|
|
2168
|
-
M.parser =
|
|
2169
|
-
M.Renderer =
|
|
2170
|
-
M.TextRenderer =
|
|
2171
|
-
M.Lexer =
|
|
2172
|
-
M.lexer =
|
|
2173
|
-
M.Tokenizer =
|
|
2174
|
-
M.Hooks =
|
|
2187
|
+
M.parseInline = Ie.parseInline;
|
|
2188
|
+
M.Parser = pe;
|
|
2189
|
+
M.parser = pe.parse;
|
|
2190
|
+
M.Renderer = Et;
|
|
2191
|
+
M.TextRenderer = hn;
|
|
2192
|
+
M.Lexer = he;
|
|
2193
|
+
M.lexer = he.lex;
|
|
2194
|
+
M.Tokenizer = At;
|
|
2195
|
+
M.Hooks = at;
|
|
2175
2196
|
M.parse = M;
|
|
2176
2197
|
M.options;
|
|
2177
2198
|
M.setOptions;
|
|
2178
2199
|
M.use;
|
|
2179
2200
|
M.walkTokens;
|
|
2180
2201
|
M.parseInline;
|
|
2181
|
-
|
|
2182
|
-
|
|
2202
|
+
pe.parse;
|
|
2203
|
+
he.lex;
|
|
2183
2204
|
const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
2184
2205
|
key: 0,
|
|
2185
2206
|
class: "pb-4"
|
|
2186
2207
|
}, Kr = {
|
|
2187
2208
|
key: 0,
|
|
2188
2209
|
class: "flex flex-col items-center justify-center px-4 min-h-full"
|
|
2189
|
-
}, Qr = { class: "relative mb-4 size-20 @sm/chat:size-24" }, Jr = ["src", "alt"], ei =
|
|
2210
|
+
}, Qr = { class: "relative mb-4 size-20 @sm/chat:size-24" }, Jr = ["src", "alt"], ei = {
|
|
2211
|
+
key: 0,
|
|
2212
|
+
class: "mt-5 flex flex-col items-stretch gap-2 w-full max-w-xs"
|
|
2213
|
+
}, ti = ["onClick"], ni = ["title"], si = {
|
|
2190
2214
|
key: 1,
|
|
2191
2215
|
class: "flex justify-end px-2 pb-2"
|
|
2192
|
-
},
|
|
2216
|
+
}, ri = {
|
|
2193
2217
|
key: 0,
|
|
2194
2218
|
class: "flex items-center gap-3 py-3 px-2"
|
|
2195
|
-
},
|
|
2219
|
+
}, ii = ["data-issue-code", "data-issue-bucket"], ai = { class: "flex flex-col gap-1 min-w-0" }, li = ["href"], oi = ["data-test"], ci = {
|
|
2196
2220
|
key: 0,
|
|
2197
2221
|
class: "flex-shrink-0 size-7 @sm/chat:size-8"
|
|
2198
|
-
},
|
|
2222
|
+
}, ui = ["src", "alt"], hi = ["src", "alt"], pi = ["src"], di = ["href"], fi = ["innerHTML"], gi = {
|
|
2199
2223
|
key: 2,
|
|
2200
2224
|
class: "flex gap-2 justify-start items-center mb-4"
|
|
2201
|
-
},
|
|
2225
|
+
}, mi = ["src", "alt"], xi = {
|
|
2202
2226
|
key: 0,
|
|
2203
2227
|
class: "flex items-center gap-2 px-2 pb-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
2204
|
-
},
|
|
2228
|
+
}, bi = ["src", "alt"], ki = { class: "max-w-20 truncate" }, wi = ["onClick"], vi = {
|
|
2205
2229
|
key: 0,
|
|
2206
2230
|
class: "shrink-0 flex items-center justify-center size-14"
|
|
2207
|
-
},
|
|
2231
|
+
}, yi = ["disabled"], Ti = {
|
|
2208
2232
|
key: 0,
|
|
2209
2233
|
class: "i-svg-spinners-ring-resize size-4"
|
|
2210
|
-
},
|
|
2234
|
+
}, Si = {
|
|
2211
2235
|
key: 1,
|
|
2212
2236
|
class: "i-tabler-paperclip size-5"
|
|
2213
|
-
},
|
|
2237
|
+
}, Ai = ["placeholder", "disabled"], Ei = ["disabled"], $i = /* @__PURE__ */ Me({
|
|
2214
2238
|
__name: "ElAgentChat",
|
|
2215
2239
|
props: {
|
|
2216
2240
|
chatController: {},
|
|
@@ -2220,27 +2244,28 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2220
2244
|
scope: { default: "private" },
|
|
2221
2245
|
scopeName: {},
|
|
2222
2246
|
setupHint: {},
|
|
2223
|
-
emptyStateMessage: {}
|
|
2247
|
+
emptyStateMessage: {},
|
|
2248
|
+
starterPrompts: {}
|
|
2224
2249
|
},
|
|
2225
2250
|
setup(l) {
|
|
2226
2251
|
const t = new M.Renderer();
|
|
2227
|
-
t.link = ({ href:
|
|
2228
|
-
let
|
|
2252
|
+
t.link = ({ href: _, text: b }) => {
|
|
2253
|
+
let x = !1;
|
|
2229
2254
|
if (typeof window < "u")
|
|
2230
2255
|
try {
|
|
2231
|
-
|
|
2256
|
+
x = new URL(_, window.location.href).origin === window.location.origin;
|
|
2232
2257
|
} catch {
|
|
2233
|
-
|
|
2258
|
+
x = !1;
|
|
2234
2259
|
}
|
|
2235
|
-
return
|
|
2260
|
+
return x ? `<a href="${_}">${b}</a>` : `<a href="${_}" target="_blank" rel="noopener noreferrer">${b}</a>`;
|
|
2236
2261
|
}, M.setOptions({ breaks: !0, gfm: !0, renderer: t });
|
|
2237
|
-
function e(
|
|
2238
|
-
if (!
|
|
2262
|
+
function e(_) {
|
|
2263
|
+
if (!_)
|
|
2239
2264
|
return "";
|
|
2240
|
-
const
|
|
2241
|
-
return lr.sanitize(
|
|
2265
|
+
const b = M.parse(_, { async: !1 });
|
|
2266
|
+
return lr.sanitize(b, { ADD_ATTR: ["target"], ADD_DATA_URI_TAGS: ["img"] });
|
|
2242
2267
|
}
|
|
2243
|
-
|
|
2268
|
+
u(e, "renderMarkdown");
|
|
2244
2269
|
const n = {
|
|
2245
2270
|
private: "",
|
|
2246
2271
|
org: "",
|
|
@@ -2249,398 +2274,417 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2249
2274
|
private: { icon: "i-tabler-lock", label: "Private", tooltip: "Only you can see this conversation" },
|
|
2250
2275
|
org: { icon: "i-tabler-users", label: "Workspace", tooltip: "Visible to workspace members" },
|
|
2251
2276
|
public: { icon: "i-tabler-globe", label: "Public", tooltip: "Anyone with the link can see this" }
|
|
2252
|
-
}, r =
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2277
|
+
}, r = [
|
|
2278
|
+
"Brief me on tomorrow",
|
|
2279
|
+
"Triage my inbox",
|
|
2280
|
+
"What's on my plate this week"
|
|
2281
|
+
], a = H(
|
|
2282
|
+
() => l.starterPrompts ?? r
|
|
2283
|
+
), o = H(() => l.setupHint ?? n[l.scope]), c = H(() => {
|
|
2284
|
+
const _ = { ...s[l.scope] };
|
|
2285
|
+
return l.scope === "org" && l.scopeName && (_.label = l.scopeName, _.tooltip = `Visible to ${l.scopeName} members`), _;
|
|
2286
|
+
}), p = K(""), g = K(!1), d = K(), f = K(), m = K(), w = K([]), E = K(!1);
|
|
2287
|
+
function z(_, b) {
|
|
2288
|
+
const x = _[b], L = _[b + 1];
|
|
2289
|
+
return !L || L.sender !== x.sender;
|
|
2290
|
+
}
|
|
2291
|
+
u(z, "shouldShowAvatar");
|
|
2292
|
+
const U = H(() => l.chatController?.textState.value), se = H(() => U.value?.isConnected ?? !1), ie = H(() => U.value?.isThinking ?? !1), O = H(() => U.value?.connectionStatus === "disconnected" && !!U.value?.error), ae = H(() => U.value?.connectionStatus !== "connected" && !U.value?.error), de = H(() => U.value?.error), j = H(() => l.chatController?.sharedMessages.value ?? []), ct = H(() => U.value?.accountGated ?? !1), Ee = H(() => !se.value || ct.value), Ct = H(() => O.value ? "Agent is offline" : ae.value ? "Connecting..." : ct.value ? "Resolve the billing issue above to continue" : "Message"), q = H(() => (p.value.trim() || w.value.length > 0) && !Ee.value && !E.value), R = H(() => l.variant === "light"), _e = H(
|
|
2293
|
+
() => R.value ? "bg-gradient-to-r from-transparent via-black/5 to-transparent" : "bg-gradient-to-r from-transparent via-white/5 to-transparent"
|
|
2294
|
+
), we = H(() => R.value ? "text-theme-300" : "text-white/30");
|
|
2295
|
+
tn(async () => {
|
|
2296
|
+
if (l.chatController && !se.value)
|
|
2266
2297
|
try {
|
|
2267
2298
|
await l.chatController.startTextConversation();
|
|
2268
|
-
} catch (
|
|
2269
|
-
console.error("Failed to start text conversation:",
|
|
2299
|
+
} catch (_) {
|
|
2300
|
+
console.error("Failed to start text conversation:", _);
|
|
2270
2301
|
}
|
|
2271
2302
|
});
|
|
2272
|
-
function
|
|
2303
|
+
function Dt() {
|
|
2273
2304
|
l.chatController?.newConversation();
|
|
2274
2305
|
}
|
|
2275
|
-
|
|
2276
|
-
async function
|
|
2277
|
-
const
|
|
2278
|
-
if (!
|
|
2306
|
+
u(Dt, "startNewConversation");
|
|
2307
|
+
async function We() {
|
|
2308
|
+
const _ = p.value.trim(), b = w.value.length > 0;
|
|
2309
|
+
if (!_ && !b || !l.chatController || !se.value || E.value)
|
|
2279
2310
|
return;
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2311
|
+
const x = p.value, L = b ? [...w.value] : void 0;
|
|
2312
|
+
p.value = "", w.value = [], f.value && (f.value.style.height = "auto", f.value.focus());
|
|
2282
2313
|
try {
|
|
2283
|
-
await l.chatController.sendChatMessage(
|
|
2284
|
-
} catch (
|
|
2285
|
-
console.error("Error sending message:",
|
|
2314
|
+
await l.chatController.sendChatMessage(x, L), ht();
|
|
2315
|
+
} catch (V) {
|
|
2316
|
+
console.error("Error sending message:", V);
|
|
2286
2317
|
}
|
|
2287
2318
|
}
|
|
2288
|
-
|
|
2289
|
-
function
|
|
2290
|
-
|
|
2319
|
+
u(We, "sendMessage");
|
|
2320
|
+
function It(_) {
|
|
2321
|
+
Ee.value || (p.value = _, We());
|
|
2322
|
+
}
|
|
2323
|
+
u(It, "sendStarterPrompt");
|
|
2324
|
+
function ut(_) {
|
|
2325
|
+
_.key === "Enter" && !_.shiftKey && (_.preventDefault(), We());
|
|
2291
2326
|
}
|
|
2292
|
-
|
|
2293
|
-
function
|
|
2294
|
-
|
|
2295
|
-
|
|
2327
|
+
u(ut, "handleKeydown");
|
|
2328
|
+
function ht() {
|
|
2329
|
+
d.value && Gt(() => {
|
|
2330
|
+
d.value.scrollTop = d.value.scrollHeight;
|
|
2296
2331
|
});
|
|
2297
2332
|
}
|
|
2298
|
-
|
|
2299
|
-
function
|
|
2300
|
-
|
|
2333
|
+
u(ht, "scrollToBottom");
|
|
2334
|
+
function pt() {
|
|
2335
|
+
f.value && (f.value.style.height = "auto", f.value.style.height = `${Math.min(f.value.scrollHeight, 150)}px`);
|
|
2301
2336
|
}
|
|
2302
|
-
|
|
2303
|
-
function
|
|
2304
|
-
|
|
2337
|
+
u(pt, "adjustTextareaHeight"), lt(p, () => Gt(() => pt()));
|
|
2338
|
+
function B() {
|
|
2339
|
+
m.value?.click();
|
|
2305
2340
|
}
|
|
2306
|
-
|
|
2307
|
-
async function
|
|
2308
|
-
const
|
|
2309
|
-
if (!(!
|
|
2310
|
-
|
|
2341
|
+
u(B, "triggerFileInput");
|
|
2342
|
+
async function dt(_) {
|
|
2343
|
+
const b = _.target, x = b.files?.[0];
|
|
2344
|
+
if (!(!x || !l.uploadFn)) {
|
|
2345
|
+
E.value = !0;
|
|
2311
2346
|
try {
|
|
2312
|
-
const L = await l.uploadFn(
|
|
2313
|
-
|
|
2347
|
+
const L = await l.uploadFn(x);
|
|
2348
|
+
w.value = [...w.value, L];
|
|
2314
2349
|
} catch (L) {
|
|
2315
2350
|
console.error("Upload failed:", L);
|
|
2316
2351
|
} finally {
|
|
2317
|
-
|
|
2352
|
+
E.value = !1, b.value = "";
|
|
2318
2353
|
}
|
|
2319
2354
|
}
|
|
2320
2355
|
}
|
|
2321
|
-
|
|
2322
|
-
function
|
|
2323
|
-
|
|
2356
|
+
u(dt, "handleFileSelect");
|
|
2357
|
+
function G(_) {
|
|
2358
|
+
w.value = w.value.filter((b, x) => x !== _);
|
|
2324
2359
|
}
|
|
2325
|
-
|
|
2326
|
-
function
|
|
2327
|
-
if (
|
|
2328
|
-
const
|
|
2329
|
-
return
|
|
2360
|
+
u(G, "removeAttachment");
|
|
2361
|
+
function je(_, b) {
|
|
2362
|
+
if (b === 0) {
|
|
2363
|
+
const oe = _[b];
|
|
2364
|
+
return oe?.timestamp ? P(new Date(oe.timestamp)) : null;
|
|
2330
2365
|
}
|
|
2331
|
-
const
|
|
2332
|
-
if (!
|
|
2333
|
-
const
|
|
2334
|
-
return new Date(L.timestamp).getTime() -
|
|
2366
|
+
const x = _[b - 1], L = _[b];
|
|
2367
|
+
if (!x?.timestamp || !L?.timestamp) return null;
|
|
2368
|
+
const V = new Date(x.timestamp).getTime();
|
|
2369
|
+
return new Date(L.timestamp).getTime() - V > 36e5 ? P(new Date(L.timestamp)) : null;
|
|
2335
2370
|
}
|
|
2336
|
-
|
|
2337
|
-
function
|
|
2338
|
-
const
|
|
2371
|
+
u(je, "shouldShowTimeDivider");
|
|
2372
|
+
function P(_) {
|
|
2373
|
+
const b = /* @__PURE__ */ new Date(), x = _.toDateString() === b.toDateString(), L = new Date(b);
|
|
2339
2374
|
L.setDate(L.getDate() - 1);
|
|
2340
|
-
const
|
|
2341
|
-
if (
|
|
2342
|
-
if (
|
|
2343
|
-
const
|
|
2344
|
-
return `${
|
|
2375
|
+
const V = _.toDateString() === L.toDateString(), be = _.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
|
|
2376
|
+
if (x) return be;
|
|
2377
|
+
if (V) return `Yesterday, ${be}`;
|
|
2378
|
+
const qe = _.getFullYear() === b.getFullYear();
|
|
2379
|
+
return `${_.toLocaleDateString("en-US", {
|
|
2345
2380
|
weekday: "long",
|
|
2346
2381
|
month: "short",
|
|
2347
2382
|
day: "numeric",
|
|
2348
|
-
...
|
|
2349
|
-
})}, ${
|
|
2350
|
-
}
|
|
2351
|
-
return
|
|
2352
|
-
|
|
2353
|
-
}, { immediate: !0, deep: !0 }), (
|
|
2354
|
-
|
|
2355
|
-
|
|
2383
|
+
...qe ? {} : { year: "numeric" }
|
|
2384
|
+
})}, ${be}`;
|
|
2385
|
+
}
|
|
2386
|
+
return u(P, "formatTimeDivider"), lt(j, (_) => {
|
|
2387
|
+
_.length > 0 && Gt(() => ht());
|
|
2388
|
+
}, { immediate: !0, deep: !0 }), (_, b) => (T(), S("div", Zr, [
|
|
2389
|
+
R.value ? $("", !0) : (T(), S("div", Xr, [
|
|
2390
|
+
Wt(Us, {
|
|
2356
2391
|
agent: l.agent,
|
|
2357
|
-
"is-online":
|
|
2392
|
+
"is-online": se.value
|
|
2358
2393
|
}, null, 8, ["agent", "is-online"])
|
|
2359
2394
|
])),
|
|
2360
|
-
|
|
2395
|
+
O.value ? (T(), S("div", {
|
|
2361
2396
|
key: 1,
|
|
2362
|
-
class:
|
|
2397
|
+
class: A(["py-16 flex flex-col items-center justify-center gap-3 text-sm", R.value ? "text-theme-400" : "text-white/60"])
|
|
2363
2398
|
}, [
|
|
2364
2399
|
v("i", {
|
|
2365
|
-
class:
|
|
2400
|
+
class: A(["i-heroicons-cloud-arrow-down size-8", R.value ? "text-theme-300" : "text-white/40"])
|
|
2366
2401
|
}, null, 2),
|
|
2367
|
-
v("span", null,
|
|
2368
|
-
], 2)) :
|
|
2402
|
+
v("span", null, ne(de.value), 1)
|
|
2403
|
+
], 2)) : ae.value ? (T(), S("div", {
|
|
2369
2404
|
key: 2,
|
|
2370
|
-
class:
|
|
2405
|
+
class: A(["py-16 flex flex-col items-center justify-center gap-2 text-sm", R.value ? "text-theme-400" : "text-theme-600"])
|
|
2371
2406
|
}, [
|
|
2372
|
-
|
|
2373
|
-
], 2)) :
|
|
2407
|
+
Wt(In, { class: "size-4" })
|
|
2408
|
+
], 2)) : o.value ? (T(), S("div", {
|
|
2374
2409
|
key: 3,
|
|
2375
|
-
class:
|
|
2410
|
+
class: A(["flex items-center justify-center gap-1.5 py-2 text-[11px]", we.value])
|
|
2376
2411
|
}, [
|
|
2377
|
-
|
|
2378
|
-
v("span", null,
|
|
2379
|
-
], 2)) :
|
|
2412
|
+
b[6] || (b[6] = v("i", { class: "i-tabler-tool size-3" }, null, -1)),
|
|
2413
|
+
v("span", null, ne(o.value), 1)
|
|
2414
|
+
], 2)) : $("", !0),
|
|
2380
2415
|
v("div", {
|
|
2381
2416
|
ref_key: "messagesContainer",
|
|
2382
|
-
ref:
|
|
2417
|
+
ref: d,
|
|
2383
2418
|
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"
|
|
2384
2419
|
}, [
|
|
2385
|
-
|
|
2420
|
+
j.value.length === 0 && !ae.value && !O.value ? (T(), S("div", Kr, [
|
|
2386
2421
|
v("div", Qr, [
|
|
2387
2422
|
v("img", {
|
|
2388
2423
|
src: l.agent.avatarUrl.value,
|
|
2389
2424
|
alt: l.agent.displayName.value,
|
|
2390
|
-
class:
|
|
2425
|
+
class: A(["size-full rounded-full object-cover ring-1", R.value ? "ring-black/5" : "ring-white/10"])
|
|
2391
2426
|
}, null, 10, Jr),
|
|
2392
|
-
|
|
2427
|
+
se.value ? (T(), S("span", {
|
|
2393
2428
|
key: 0,
|
|
2394
|
-
class:
|
|
2395
|
-
}, [...
|
|
2429
|
+
class: A(["absolute top-[85%] left-[85%] -translate-x-1/2 -translate-y-1/2 size-[18%] min-w-2.5 min-h-2.5 flex items-center justify-center rounded-full", R.value ? "bg-white" : "bg-theme-900"])
|
|
2430
|
+
}, [...b[7] || (b[7] = [
|
|
2396
2431
|
v("span", { class: "size-[70%] inline-flex rounded-full bg-emerald-500" }, null, -1)
|
|
2397
|
-
])], 2)) :
|
|
2432
|
+
])], 2)) : $("", !0)
|
|
2398
2433
|
]),
|
|
2399
2434
|
v("div", {
|
|
2400
|
-
class:
|
|
2401
|
-
},
|
|
2435
|
+
class: A(["text-base @sm/chat:text-lg font-semibold", R.value ? "text-theme-900" : "text-white"])
|
|
2436
|
+
}, ne(l.agent.displayName.value), 3),
|
|
2402
2437
|
v("p", {
|
|
2403
|
-
class:
|
|
2404
|
-
},
|
|
2438
|
+
class: A(["mt-1 text-center text-xs @sm/chat:text-sm", we.value])
|
|
2439
|
+
}, ne(l.emptyStateMessage || "Tap a prompt to get started, or type your own."), 3),
|
|
2440
|
+
a.value.length > 0 && !Ee.value ? (T(), S("div", ei, [
|
|
2441
|
+
(T(!0), S(ye, null, rt(a.value, (x) => (T(), S("button", {
|
|
2442
|
+
key: x,
|
|
2443
|
+
type: "button",
|
|
2444
|
+
"data-test": "chat-starter-prompt",
|
|
2445
|
+
class: A(["text-left text-sm rounded-2xl px-4 py-2.5 transition-colors cursor-pointer", R.value ? "bg-theme-25 border border-theme-200 text-theme-700 hover:bg-theme-50 hover:border-theme-300" : "bg-white/5 border border-white/10 text-white/80 hover:bg-white/10 hover:border-white/20"]),
|
|
2446
|
+
onClick: /* @__PURE__ */ u((L) => It(x), "onClick")
|
|
2447
|
+
}, ne(x), 11, ti))), 128))
|
|
2448
|
+
])) : $("", !0),
|
|
2405
2449
|
v("div", {
|
|
2406
|
-
class:
|
|
2407
|
-
title:
|
|
2450
|
+
class: A(["inline-flex items-center gap-1.5 mt-5 px-2.5 py-1 rounded-full text-[11px]", R.value ? "bg-theme-50 border border-theme-100 text-theme-400" : "bg-white/10 border border-white/20 text-white/40"]),
|
|
2451
|
+
title: c.value.tooltip
|
|
2408
2452
|
}, [
|
|
2409
2453
|
v("i", {
|
|
2410
|
-
class:
|
|
2454
|
+
class: A([c.value.icon, "size-3"])
|
|
2411
2455
|
}, null, 2),
|
|
2412
|
-
v("span", null,
|
|
2413
|
-
], 10,
|
|
2414
|
-
])) :
|
|
2415
|
-
|
|
2456
|
+
v("span", null, ne(c.value.label), 1)
|
|
2457
|
+
], 10, ni)
|
|
2458
|
+
])) : $("", !0),
|
|
2459
|
+
j.value.length > 0 ? (T(), S("div", si, [
|
|
2416
2460
|
v("button", {
|
|
2417
2461
|
type: "button",
|
|
2418
2462
|
"data-test": "chat-new-session",
|
|
2419
|
-
class:
|
|
2420
|
-
onClick:
|
|
2421
|
-
}, [...
|
|
2463
|
+
class: A(["inline-flex items-center gap-1 text-[11px] rounded-full px-2 py-1 transition-colors", R.value ? "text-theme-400 hover:text-theme-700 hover:bg-theme-50" : "text-white/40 hover:text-white hover:bg-white/5"]),
|
|
2464
|
+
onClick: Dt
|
|
2465
|
+
}, [...b[8] || (b[8] = [
|
|
2422
2466
|
v("i", { class: "i-tabler-refresh size-3" }, null, -1),
|
|
2423
2467
|
v("span", null, "New chat", -1)
|
|
2424
2468
|
])], 2)
|
|
2425
|
-
])) :
|
|
2426
|
-
(
|
|
2427
|
-
key:
|
|
2469
|
+
])) : $("", !0),
|
|
2470
|
+
(T(!0), S(ye, null, rt(j.value, (x, L) => (T(), S(ye, {
|
|
2471
|
+
key: x.id
|
|
2428
2472
|
}, [
|
|
2429
|
-
|
|
2473
|
+
je(j.value, L) ? (T(), S("div", ri, [
|
|
2430
2474
|
v("div", {
|
|
2431
|
-
class:
|
|
2475
|
+
class: A(["flex-1 h-px", _e.value])
|
|
2432
2476
|
}, null, 2),
|
|
2433
2477
|
v("span", {
|
|
2434
|
-
class:
|
|
2435
|
-
},
|
|
2478
|
+
class: A(["text-[10px] @sm/chat:text-[11px] font-medium shrink-0 tracking-widest uppercase", we.value])
|
|
2479
|
+
}, ne(je(j.value, L)), 3),
|
|
2436
2480
|
v("div", {
|
|
2437
|
-
class:
|
|
2481
|
+
class: A(["flex-1 h-px", _e.value])
|
|
2438
2482
|
}, null, 2)
|
|
2439
|
-
])) :
|
|
2440
|
-
|
|
2483
|
+
])) : $("", !0),
|
|
2484
|
+
x.sender === "system" ? (T(), S("div", {
|
|
2441
2485
|
key: 1,
|
|
2442
2486
|
"data-test": "messaging-system-msg",
|
|
2443
|
-
"data-issue-code":
|
|
2444
|
-
"data-issue-bucket":
|
|
2445
|
-
class:
|
|
2487
|
+
"data-issue-code": x.issue?.code,
|
|
2488
|
+
"data-issue-bucket": x.issue?.bucket,
|
|
2489
|
+
class: A(["flex items-start gap-2 px-3 py-2 text-[13px] leading-relaxed", R.value ? "text-theme-500" : "text-white/70"])
|
|
2446
2490
|
}, [
|
|
2447
2491
|
v("i", {
|
|
2448
|
-
class:
|
|
2492
|
+
class: A(["i-tabler-alert-circle size-4 mt-0.5 shrink-0", x.issue?.bucket === "account" ? R.value ? "text-amber-500" : "text-amber-300" : R.value ? "text-red-500" : "text-red-300"])
|
|
2449
2493
|
}, null, 2),
|
|
2450
|
-
v("div",
|
|
2451
|
-
v("span", null,
|
|
2452
|
-
|
|
2494
|
+
v("div", ai, [
|
|
2495
|
+
v("span", null, ne(x.text), 1),
|
|
2496
|
+
x.issue?.help ? (T(), S("span", {
|
|
2453
2497
|
key: 0,
|
|
2454
|
-
class:
|
|
2455
|
-
},
|
|
2456
|
-
|
|
2498
|
+
class: A(["text-[12px]", R.value ? "text-theme-400" : "text-white/55"])
|
|
2499
|
+
}, ne(x.issue.help), 3)) : $("", !0),
|
|
2500
|
+
x.issue?.actionUrl ? (T(), S("a", {
|
|
2457
2501
|
key: 1,
|
|
2458
|
-
href:
|
|
2502
|
+
href: x.issue.actionUrl,
|
|
2459
2503
|
"data-test": "messaging-system-msg-action",
|
|
2460
|
-
class:
|
|
2504
|
+
class: A(["text-[12px] font-medium inline-flex items-center gap-1", R.value ? "text-theme-900 hover:text-theme-700" : "text-white hover:text-white/80"])
|
|
2461
2505
|
}, [
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
], 10,
|
|
2506
|
+
Xe(ne(x.issue.actionLabel) + " ", 1),
|
|
2507
|
+
b[9] || (b[9] = v("i", { class: "i-tabler-arrow-right size-3" }, null, -1))
|
|
2508
|
+
], 10, li)) : $("", !0)
|
|
2465
2509
|
])
|
|
2466
|
-
], 10,
|
|
2510
|
+
], 10, ii)) : (T(), S("div", {
|
|
2467
2511
|
key: 2,
|
|
2468
|
-
"data-test":
|
|
2469
|
-
class:
|
|
2470
|
-
"justify-end":
|
|
2471
|
-
"justify-start":
|
|
2472
|
-
"mb-4":
|
|
2512
|
+
"data-test": x.sender === "agent" ? "messaging-assistant-msg" : x.sender === "user" ? "messaging-user-msg" : void 0,
|
|
2513
|
+
class: A(["flex gap-2 items-end", {
|
|
2514
|
+
"justify-end": x.sender === "user",
|
|
2515
|
+
"justify-start": x.sender === "agent",
|
|
2516
|
+
"mb-4": z(j.value, L)
|
|
2473
2517
|
}])
|
|
2474
2518
|
}, [
|
|
2475
|
-
|
|
2476
|
-
|
|
2519
|
+
x.sender === "agent" ? (T(), S("div", ci, [
|
|
2520
|
+
z(j.value, L) ? (T(), S("img", {
|
|
2477
2521
|
key: 0,
|
|
2478
2522
|
src: l.agent.avatarUrl.value,
|
|
2479
2523
|
alt: l.agent.displayName.value,
|
|
2480
|
-
class:
|
|
2481
|
-
}, null, 10,
|
|
2482
|
-
])) :
|
|
2524
|
+
class: A(["size-6 @sm/chat:size-7 rounded-full object-cover shadow-sm", R.value ? "ring-1 ring-black/5" : ""])
|
|
2525
|
+
}, null, 10, ui)) : $("", !0)
|
|
2526
|
+
])) : $("", !0),
|
|
2483
2527
|
v("div", {
|
|
2484
|
-
class:
|
|
2528
|
+
class: A(x.sender === "user" ? "max-w-[75%]" : "max-w-[85%]")
|
|
2485
2529
|
}, [
|
|
2486
|
-
|
|
2530
|
+
x.attachments?.length ? (T(), S("div", {
|
|
2487
2531
|
key: 0,
|
|
2488
|
-
class:
|
|
2532
|
+
class: A(["mb-1 space-y-1", x.sender === "user" ? "flex flex-col items-end" : ""])
|
|
2489
2533
|
}, [
|
|
2490
|
-
(
|
|
2491
|
-
|
|
2534
|
+
(T(!0), S(ye, null, rt(x.attachments, (V, be) => (T(), S(ye, { key: be }, [
|
|
2535
|
+
V.type === "image" ? (T(), S("img", {
|
|
2492
2536
|
key: 0,
|
|
2493
|
-
src:
|
|
2494
|
-
alt:
|
|
2537
|
+
src: V.url,
|
|
2538
|
+
alt: V.name,
|
|
2495
2539
|
class: "rounded-xl object-cover max-h-48 max-w-[240px] @sm/chat:max-w-[320px]"
|
|
2496
|
-
}, null, 8,
|
|
2540
|
+
}, null, 8, hi)) : V.type === "audio" ? (T(), S("audio", {
|
|
2497
2541
|
key: 1,
|
|
2498
|
-
src:
|
|
2542
|
+
src: V.url,
|
|
2499
2543
|
controls: "",
|
|
2500
2544
|
class: "max-w-full"
|
|
2501
|
-
}, null, 8,
|
|
2545
|
+
}, null, 8, pi)) : (T(), S("a", {
|
|
2502
2546
|
key: 2,
|
|
2503
|
-
href:
|
|
2547
|
+
href: V.url,
|
|
2504
2548
|
target: "_blank",
|
|
2505
2549
|
rel: "noopener",
|
|
2506
|
-
class:
|
|
2550
|
+
class: A(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs", R.value ? "bg-theme-100 text-theme-600 hover:bg-theme-200" : "bg-white/10 text-white/80 hover:bg-white/20"])
|
|
2507
2551
|
}, [
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
], 10,
|
|
2552
|
+
b[10] || (b[10] = v("i", { class: "i-tabler-file size-3.5" }, null, -1)),
|
|
2553
|
+
Xe(" " + ne(V.name), 1)
|
|
2554
|
+
], 10, di))
|
|
2511
2555
|
], 64))), 128))
|
|
2512
|
-
], 2)) :
|
|
2513
|
-
|
|
2556
|
+
], 2)) : $("", !0),
|
|
2557
|
+
x.text ? (T(), S("div", {
|
|
2514
2558
|
key: 1,
|
|
2515
|
-
class:
|
|
2516
|
-
|
|
2559
|
+
class: A(["rounded-2xl px-3.5 py-2", [
|
|
2560
|
+
x.sender === "user" ? "bg-primary-500 text-white rounded-br-[4px]" : R.value ? "bg-theme-50 text-theme-800 border border-black/[0.02] rounded-bl-[4px]" : "bg-white/15 backdrop-blur-sm text-white/95 rounded-bl-[4px]"
|
|
2517
2561
|
]])
|
|
2518
2562
|
}, [
|
|
2519
2563
|
v("div", {
|
|
2520
|
-
class:
|
|
2521
|
-
innerHTML: e(
|
|
2522
|
-
onClick:
|
|
2564
|
+
class: A(["chat-msg-prose break-words text-[14px] leading-relaxed @sm/chat:text-[15px] @sm/chat:leading-relaxed", x.sender === "user" || !R.value ? "chat-msg-prose-invert" : ""]),
|
|
2565
|
+
innerHTML: e(x.text),
|
|
2566
|
+
onClick: b[0] || (b[0] = vs(() => {
|
|
2523
2567
|
}, ["stop"]))
|
|
2524
|
-
}, null, 10,
|
|
2525
|
-
], 2)) :
|
|
2568
|
+
}, null, 10, fi)
|
|
2569
|
+
], 2)) : $("", !0)
|
|
2526
2570
|
], 2)
|
|
2527
|
-
], 10,
|
|
2571
|
+
], 10, oi))
|
|
2528
2572
|
], 64))), 128)),
|
|
2529
|
-
|
|
2573
|
+
ie.value ? (T(), S("div", gi, [
|
|
2530
2574
|
v("img", {
|
|
2531
2575
|
src: l.agent.avatarUrl.value,
|
|
2532
2576
|
alt: l.agent.displayName.value,
|
|
2533
|
-
class:
|
|
2534
|
-
}, null, 10,
|
|
2577
|
+
class: A(["size-7 @sm/chat:size-8 flex-shrink-0 rounded-full object-cover shadow-sm", R.value ? "ring-1 ring-black/5" : ""])
|
|
2578
|
+
}, null, 10, mi),
|
|
2535
2579
|
v("div", {
|
|
2536
|
-
class:
|
|
2580
|
+
class: A(["rounded-2xl px-3.5 py-2.5 flex items-center", R.value ? "bg-theme-100" : "bg-white/15 backdrop-blur-sm"])
|
|
2537
2581
|
}, [
|
|
2538
2582
|
v("i", {
|
|
2539
|
-
class:
|
|
2583
|
+
class: A(["i-svg-spinners-3-dots-bounce size-7", R.value ? "text-theme-400" : "text-white/50"])
|
|
2540
2584
|
}, null, 2)
|
|
2541
2585
|
], 2)
|
|
2542
|
-
])) :
|
|
2586
|
+
])) : $("", !0)
|
|
2543
2587
|
], 512),
|
|
2544
2588
|
v("div", {
|
|
2545
|
-
class:
|
|
2589
|
+
class: A(["absolute bottom-0 left-0 right-0 z-30 px-5 pb-4 pt-3", R.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"])
|
|
2546
2590
|
}, [
|
|
2547
|
-
|
|
2548
|
-
(
|
|
2591
|
+
w.value.length > 0 ? (T(), S("div", xi, [
|
|
2592
|
+
(T(!0), S(ye, null, rt(w.value, (x, L) => (T(), S("div", {
|
|
2549
2593
|
key: L,
|
|
2550
2594
|
class: "relative shrink-0 group"
|
|
2551
2595
|
}, [
|
|
2552
|
-
|
|
2596
|
+
x.type === "image" ? (T(), S("img", {
|
|
2553
2597
|
key: 0,
|
|
2554
|
-
src:
|
|
2555
|
-
alt:
|
|
2556
|
-
class:
|
|
2557
|
-
}, null, 10,
|
|
2598
|
+
src: x.url,
|
|
2599
|
+
alt: x.name,
|
|
2600
|
+
class: A(["size-14 rounded-xl object-cover border", R.value ? "border-black/10" : "border-white/20"])
|
|
2601
|
+
}, null, 10, bi)) : (T(), S("div", {
|
|
2558
2602
|
key: 1,
|
|
2559
|
-
class:
|
|
2603
|
+
class: A(["h-14 px-3 rounded-xl flex items-center gap-1.5 text-xs border", R.value ? "border-black/10 bg-theme-50 text-theme-600" : "border-white/20 bg-white/10 text-white/70"])
|
|
2560
2604
|
}, [
|
|
2561
|
-
|
|
2562
|
-
v("span",
|
|
2605
|
+
b[11] || (b[11] = v("i", { class: "i-tabler-file size-4" }, null, -1)),
|
|
2606
|
+
v("span", ki, ne(x.name), 1)
|
|
2563
2607
|
], 2)),
|
|
2564
2608
|
v("button", {
|
|
2565
2609
|
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",
|
|
2566
|
-
onClick: /* @__PURE__ */
|
|
2567
|
-
}, [...
|
|
2610
|
+
onClick: /* @__PURE__ */ u((V) => G(L), "onClick")
|
|
2611
|
+
}, [...b[12] || (b[12] = [
|
|
2568
2612
|
v("i", { class: "i-tabler-x size-3" }, null, -1)
|
|
2569
|
-
])], 8,
|
|
2613
|
+
])], 8, wi)
|
|
2570
2614
|
]))), 128)),
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
])) :
|
|
2574
|
-
])) :
|
|
2575
|
-
l.uploadFn ? (
|
|
2615
|
+
E.value ? (T(), S("div", vi, [
|
|
2616
|
+
Wt(In, { class: "size-5" })
|
|
2617
|
+
])) : $("", !0)
|
|
2618
|
+
])) : $("", !0),
|
|
2619
|
+
l.uploadFn ? (T(), S("input", {
|
|
2576
2620
|
key: 1,
|
|
2577
2621
|
ref_key: "fileInput",
|
|
2578
|
-
ref:
|
|
2622
|
+
ref: m,
|
|
2579
2623
|
type: "file",
|
|
2580
2624
|
accept: "image/*,audio/*,video/*",
|
|
2581
2625
|
class: "hidden",
|
|
2582
|
-
onChange:
|
|
2583
|
-
}, null, 544)) :
|
|
2626
|
+
onChange: dt
|
|
2627
|
+
}, null, 544)) : $("", !0),
|
|
2584
2628
|
v("div", {
|
|
2585
|
-
class:
|
|
2629
|
+
class: A(["flex items-end gap-1 w-full rounded-[24px] p-1.5 transition-all duration-300", R.value ? g.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" : g.value ? "bg-white/15 ring-1 ring-white/25" : "bg-white/10 ring-1 ring-transparent hover:ring-white/15"])
|
|
2586
2630
|
}, [
|
|
2587
2631
|
v("button", {
|
|
2588
|
-
class:
|
|
2632
|
+
class: A(["shrink-0 flex items-center justify-center rounded-full transition-colors mb-0.5 ml-0.5 size-9 @sm/chat:size-10", [
|
|
2589
2633
|
l.uploadFn ? "cursor-pointer" : "cursor-default",
|
|
2590
|
-
|
|
2591
|
-
|
|
2634
|
+
R.value ? "text-theme-400 hover:text-theme-600 hover:bg-black/5" : "text-white/50 hover:text-white/80 hover:bg-white/10",
|
|
2635
|
+
E.value ? "opacity-50 pointer-events-none" : ""
|
|
2592
2636
|
]]),
|
|
2593
|
-
disabled:
|
|
2594
|
-
onClick:
|
|
2637
|
+
disabled: Ee.value || E.value || !l.uploadFn,
|
|
2638
|
+
onClick: b[1] || (b[1] = (x) => l.uploadFn && B())
|
|
2595
2639
|
}, [
|
|
2596
|
-
|
|
2597
|
-
], 10,
|
|
2640
|
+
E.value ? (T(), S("i", Ti)) : (T(), S("i", Si))
|
|
2641
|
+
], 10, yi),
|
|
2598
2642
|
Xn(v("textarea", {
|
|
2599
2643
|
ref_key: "textarea",
|
|
2600
|
-
ref:
|
|
2601
|
-
"onUpdate:modelValue":
|
|
2644
|
+
ref: f,
|
|
2645
|
+
"onUpdate:modelValue": b[2] || (b[2] = (x) => p.value = x),
|
|
2602
2646
|
"data-test": "messaging-input",
|
|
2603
2647
|
rows: "1",
|
|
2604
2648
|
enterkeyhint: "send",
|
|
2605
|
-
placeholder:
|
|
2606
|
-
disabled:
|
|
2649
|
+
placeholder: Ct.value,
|
|
2650
|
+
disabled: Ee.value,
|
|
2607
2651
|
style: { fontSize: "16px", resize: "none" },
|
|
2608
|
-
class:
|
|
2609
|
-
onKeydown:
|
|
2610
|
-
onFocus:
|
|
2611
|
-
onBlur:
|
|
2612
|
-
}, null, 42,
|
|
2613
|
-
[Kn,
|
|
2652
|
+
class: A(["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", R.value ? "text-theme-800 placeholder-theme-400" : "text-white placeholder-white/50"]),
|
|
2653
|
+
onKeydown: ut,
|
|
2654
|
+
onFocus: b[3] || (b[3] = (x) => g.value = !0),
|
|
2655
|
+
onBlur: b[4] || (b[4] = (x) => g.value = !1)
|
|
2656
|
+
}, null, 42, Ai), [
|
|
2657
|
+
[Kn, p.value]
|
|
2614
2658
|
]),
|
|
2615
2659
|
v("button", {
|
|
2616
2660
|
"data-test": "messaging-send-btn",
|
|
2617
|
-
class:
|
|
2618
|
-
disabled: !
|
|
2619
|
-
onClick:
|
|
2620
|
-
}, [...
|
|
2661
|
+
class: A(["shrink-0 flex items-center justify-center rounded-full transition-all duration-300 mb-0.5 mr-0.5 size-9 @sm/chat:size-10", q.value ? "bg-primary-500 text-white shadow-md hover:scale-105 active:scale-95 cursor-pointer" : R.value ? "bg-black/5 text-black/20" : "bg-white/10 text-white/30"]),
|
|
2662
|
+
disabled: !q.value,
|
|
2663
|
+
onClick: b[5] || (b[5] = (x) => We())
|
|
2664
|
+
}, [...b[13] || (b[13] = [
|
|
2621
2665
|
v("i", { class: "i-tabler-arrow-up size-5" }, null, -1)
|
|
2622
|
-
])], 10,
|
|
2666
|
+
])], 10, Ei)
|
|
2623
2667
|
], 2),
|
|
2624
2668
|
v("div", {
|
|
2625
|
-
class:
|
|
2669
|
+
class: A(["text-[10px] text-center mt-2.5 select-none opacity-70", R.value ? "text-theme-400" : "text-white/50"])
|
|
2626
2670
|
}, [
|
|
2627
|
-
|
|
2671
|
+
b[14] || (b[14] = Xe(" Press ", -1)),
|
|
2628
2672
|
v("kbd", {
|
|
2629
|
-
class:
|
|
2673
|
+
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", R.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2630
2674
|
}, "Enter", 2),
|
|
2631
|
-
|
|
2675
|
+
b[15] || (b[15] = Xe(" to send, ", -1)),
|
|
2632
2676
|
v("kbd", {
|
|
2633
|
-
class:
|
|
2677
|
+
class: A(["font-sans px-1.5 py-0.5 rounded-md text-[10px]", R.value ? "bg-black/[0.04] border border-black/[0.05]" : "bg-white/10 border border-white/15"])
|
|
2634
2678
|
}, "Shift+Enter", 2),
|
|
2635
|
-
|
|
2679
|
+
b[16] || (b[16] = Xe(" for new line ", -1))
|
|
2636
2680
|
], 2)
|
|
2637
2681
|
], 2)
|
|
2638
2682
|
]));
|
|
2639
2683
|
}
|
|
2640
|
-
}),
|
|
2684
|
+
}), _i = { class: "agent-wrap" }, Ri = {
|
|
2641
2685
|
key: 0,
|
|
2642
2686
|
class: "flex items-center justify-center h-full"
|
|
2643
|
-
},
|
|
2687
|
+
}, Ui = /* @__PURE__ */ Me({
|
|
2644
2688
|
__name: "AgentWrap",
|
|
2645
2689
|
props: {
|
|
2646
2690
|
sdk: {},
|
|
@@ -2657,8 +2701,8 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2657
2701
|
const t = Ss("AgentWrap"), e = l, n = e.sdk || As.getInstance({
|
|
2658
2702
|
isDev: typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1,
|
|
2659
2703
|
...e.apiBase && { apiBase: e.apiBase }
|
|
2660
|
-
}), s =
|
|
2661
|
-
return
|
|
2704
|
+
}), s = K(!e.agent), r = ys(e.agent ? new Tt({ config: e.agent }) : void 0), a = K();
|
|
2705
|
+
return tn(async () => {
|
|
2662
2706
|
if (e.agent) {
|
|
2663
2707
|
t.debug("Agent provided via props, skipping fetch", {
|
|
2664
2708
|
agentId: e.agent.agentId,
|
|
@@ -2684,7 +2728,7 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2684
2728
|
try {
|
|
2685
2729
|
s.value = !0, t.debug("Fetching public agent", { handle: e.handle });
|
|
2686
2730
|
const o = await n.getPublicAgent({ handle: e.handle });
|
|
2687
|
-
o ? (r.value = new
|
|
2731
|
+
o ? (r.value = new Tt({ config: o }), t.debug("Successfully fetched public agent", {
|
|
2688
2732
|
agentId: o.agentId,
|
|
2689
2733
|
handle: o.handle
|
|
2690
2734
|
}), o.agentId && n.track({
|
|
@@ -2734,33 +2778,33 @@ const Zr = { class: "@container/chat flex flex-col h-full relative" }, Xr = {
|
|
|
2734
2778
|
}
|
|
2735
2779
|
});
|
|
2736
2780
|
}
|
|
2737
|
-
}), (o, c) => (
|
|
2738
|
-
s.value ? (
|
|
2781
|
+
}), (o, c) => (T(), S("div", _i, [
|
|
2782
|
+
s.value ? (T(), S("div", Ri, [...c[0] || (c[0] = [
|
|
2739
2783
|
v("div", { class: "animate-spin rounded-full size-6 border-b-2 border-white" }, null, -1)
|
|
2740
2784
|
])])) : r.value ? Zn(o.$slots, "default", {
|
|
2741
2785
|
key: 1,
|
|
2742
|
-
sdk:
|
|
2786
|
+
sdk: Kt(n),
|
|
2743
2787
|
agent: r.value,
|
|
2744
2788
|
context: l.context,
|
|
2745
2789
|
firstMessage: l.firstMessage,
|
|
2746
2790
|
buttonText: l.buttonText,
|
|
2747
2791
|
buttonIcon: l.buttonIcon,
|
|
2748
2792
|
loading: s.value
|
|
2749
|
-
}) :
|
|
2793
|
+
}) : $("", !0)
|
|
2750
2794
|
]));
|
|
2751
2795
|
}
|
|
2752
2796
|
});
|
|
2753
2797
|
export {
|
|
2754
2798
|
Mn as A,
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2799
|
+
Ui as _,
|
|
2800
|
+
$i as a,
|
|
2801
|
+
Pi as b,
|
|
2802
|
+
Oi as c,
|
|
2803
|
+
Ni as d,
|
|
2804
|
+
In as e,
|
|
2761
2805
|
Us as f,
|
|
2762
|
-
|
|
2806
|
+
Li as g,
|
|
2763
2807
|
zn as h,
|
|
2764
|
-
|
|
2808
|
+
zi as p
|
|
2765
2809
|
};
|
|
2766
2810
|
//# sourceMappingURL=AgentWrap.vue_vue_type_script_setup_true_lang.js.map
|