lee-ai-widget 1.0.8 → 1.0.9
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/lee-ai-widget.js +382 -374
- package/dist/lee-ai-widget.umd.js +31 -25
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/lee-ai-widget.js
CHANGED
|
@@ -6,8 +6,8 @@ var Fn = (l, e, t) => e in l ? Un(l, e, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var b = (l, e, t) => Fn(l, typeof e != "symbol" ? e + "" : e, t), Hn = (l, e, t) => e.has(l) || Zt("Cannot " + t);
|
|
7
7
|
var Yt = (l, e, t) => e.has(l) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(l) : e.set(l, t);
|
|
8
8
|
var Ce = (l, e, t) => (Hn(l, e, "access private method"), t);
|
|
9
|
-
async function Bn(l, e, t, n,
|
|
10
|
-
const
|
|
9
|
+
async function Bn(l, e, t, n, i, o) {
|
|
10
|
+
const s = `${l.baseUrl}/ai/chat`, a = {
|
|
11
11
|
provider: l.provider || "google",
|
|
12
12
|
// 默认 google
|
|
13
13
|
apiKey: l.apiKey,
|
|
@@ -25,7 +25,7 @@ async function Bn(l, e, t, n, r, o) {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
try {
|
|
28
|
-
const c = await fetch(
|
|
28
|
+
const c = await fetch(s, {
|
|
29
29
|
method: "POST",
|
|
30
30
|
headers: { "Content-Type": "application/json" },
|
|
31
31
|
body: JSON.stringify(a)
|
|
@@ -39,7 +39,7 @@ async function Bn(l, e, t, n, r, o) {
|
|
|
39
39
|
const T = h.decode(g, { stream: !0 });
|
|
40
40
|
n(T);
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
i();
|
|
43
43
|
} catch (c) {
|
|
44
44
|
console.error("Chat API Error:", c), o(c.message || "网络连接失败");
|
|
45
45
|
}
|
|
@@ -86,9 +86,9 @@ function w(l, e) {
|
|
|
86
86
|
let t = typeof l == "string" ? l : l.source;
|
|
87
87
|
e = e || "";
|
|
88
88
|
const n = {
|
|
89
|
-
replace: (
|
|
90
|
-
let
|
|
91
|
-
return
|
|
89
|
+
replace: (i, o) => {
|
|
90
|
+
let s = typeof o == "string" ? o : o.source;
|
|
91
|
+
return s = s.replace(jn, "$1"), t = t.replace(i, s), n;
|
|
92
92
|
},
|
|
93
93
|
getRegex: () => new RegExp(t, e)
|
|
94
94
|
};
|
|
@@ -104,31 +104,31 @@ function Xt(l) {
|
|
|
104
104
|
}
|
|
105
105
|
const xe = { exec: () => null };
|
|
106
106
|
function Qt(l, e) {
|
|
107
|
-
const t = l.replace(/\|/g, (o,
|
|
108
|
-
let c = !1, d =
|
|
107
|
+
const t = l.replace(/\|/g, (o, s, a) => {
|
|
108
|
+
let c = !1, d = s;
|
|
109
109
|
for (; --d >= 0 && a[d] === "\\"; )
|
|
110
110
|
c = !c;
|
|
111
111
|
return c ? "|" : " |";
|
|
112
112
|
}), n = t.split(/ \|/);
|
|
113
|
-
let
|
|
113
|
+
let i = 0;
|
|
114
114
|
if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), e)
|
|
115
115
|
if (n.length > e)
|
|
116
116
|
n.splice(e);
|
|
117
117
|
else
|
|
118
118
|
for (; n.length < e; )
|
|
119
119
|
n.push("");
|
|
120
|
-
for (;
|
|
121
|
-
n[
|
|
120
|
+
for (; i < n.length; i++)
|
|
121
|
+
n[i] = n[i].trim().replace(/\\\|/g, "|");
|
|
122
122
|
return n;
|
|
123
123
|
}
|
|
124
124
|
function Me(l, e, t) {
|
|
125
125
|
const n = l.length;
|
|
126
126
|
if (n === 0)
|
|
127
127
|
return "";
|
|
128
|
-
let
|
|
129
|
-
for (;
|
|
130
|
-
|
|
131
|
-
return l.slice(0, n -
|
|
128
|
+
let i = 0;
|
|
129
|
+
for (; i < n && l.charAt(n - i - 1) === e; )
|
|
130
|
+
i++;
|
|
131
|
+
return l.slice(0, n - i);
|
|
132
132
|
}
|
|
133
133
|
function Xn(l, e) {
|
|
134
134
|
if (l.indexOf(e[1]) === -1)
|
|
@@ -144,25 +144,25 @@ function Xn(l, e) {
|
|
|
144
144
|
return -1;
|
|
145
145
|
}
|
|
146
146
|
function Vt(l, e, t, n) {
|
|
147
|
-
const
|
|
147
|
+
const i = e.href, o = e.title ? $(e.title) : null, s = l[1].replace(/\\([\[\]])/g, "$1");
|
|
148
148
|
if (l[0].charAt(0) !== "!") {
|
|
149
149
|
n.state.inLink = !0;
|
|
150
150
|
const a = {
|
|
151
151
|
type: "link",
|
|
152
152
|
raw: t,
|
|
153
|
-
href:
|
|
153
|
+
href: i,
|
|
154
154
|
title: o,
|
|
155
|
-
text:
|
|
156
|
-
tokens: n.inlineTokens(
|
|
155
|
+
text: s,
|
|
156
|
+
tokens: n.inlineTokens(s)
|
|
157
157
|
};
|
|
158
158
|
return n.state.inLink = !1, a;
|
|
159
159
|
}
|
|
160
160
|
return {
|
|
161
161
|
type: "image",
|
|
162
162
|
raw: t,
|
|
163
|
-
href:
|
|
163
|
+
href: i,
|
|
164
164
|
title: o,
|
|
165
|
-
text: $(
|
|
165
|
+
text: $(s)
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
function Qn(l, e) {
|
|
@@ -171,12 +171,12 @@ function Qn(l, e) {
|
|
|
171
171
|
return e;
|
|
172
172
|
const n = t[1];
|
|
173
173
|
return e.split(`
|
|
174
|
-
`).map((
|
|
175
|
-
const o =
|
|
174
|
+
`).map((i) => {
|
|
175
|
+
const o = i.match(/^\s+/);
|
|
176
176
|
if (o === null)
|
|
177
|
-
return
|
|
178
|
-
const [
|
|
179
|
-
return
|
|
177
|
+
return i;
|
|
178
|
+
const [s] = o;
|
|
179
|
+
return s.length >= n.length ? i.slice(n.length) : i;
|
|
180
180
|
}).join(`
|
|
181
181
|
`);
|
|
182
182
|
}
|
|
@@ -213,12 +213,12 @@ class $e {
|
|
|
213
213
|
fences(e) {
|
|
214
214
|
const t = this.rules.block.fences.exec(e);
|
|
215
215
|
if (t) {
|
|
216
|
-
const n = t[0],
|
|
216
|
+
const n = t[0], i = Qn(n, t[3] || "");
|
|
217
217
|
return {
|
|
218
218
|
type: "code",
|
|
219
219
|
raw: n,
|
|
220
220
|
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
221
|
-
text:
|
|
221
|
+
text: i
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -227,8 +227,8 @@ class $e {
|
|
|
227
227
|
if (t) {
|
|
228
228
|
let n = t[2].trim();
|
|
229
229
|
if (/#$/.test(n)) {
|
|
230
|
-
const
|
|
231
|
-
(this.options.pedantic || !
|
|
230
|
+
const i = Me(n, "#");
|
|
231
|
+
(this.options.pedantic || !i || / $/.test(i)) && (n = i.trim());
|
|
232
232
|
}
|
|
233
233
|
return {
|
|
234
234
|
type: "heading",
|
|
@@ -251,10 +251,10 @@ class $e {
|
|
|
251
251
|
const t = this.rules.block.blockquote.exec(e);
|
|
252
252
|
if (t) {
|
|
253
253
|
const n = Me(t[0].replace(/^ *>[ \t]?/gm, ""), `
|
|
254
|
-
`),
|
|
254
|
+
`), i = this.lexer.state.top;
|
|
255
255
|
this.lexer.state.top = !0;
|
|
256
256
|
const o = this.lexer.blockTokens(n);
|
|
257
|
-
return this.lexer.state.top =
|
|
257
|
+
return this.lexer.state.top = i, {
|
|
258
258
|
type: "blockquote",
|
|
259
259
|
raw: t[0],
|
|
260
260
|
tokens: o,
|
|
@@ -266,20 +266,20 @@ class $e {
|
|
|
266
266
|
let t = this.rules.block.list.exec(e);
|
|
267
267
|
if (t) {
|
|
268
268
|
let n = t[1].trim();
|
|
269
|
-
const
|
|
269
|
+
const i = n.length > 1, o = {
|
|
270
270
|
type: "list",
|
|
271
271
|
raw: "",
|
|
272
|
-
ordered:
|
|
273
|
-
start:
|
|
272
|
+
ordered: i,
|
|
273
|
+
start: i ? +n.slice(0, -1) : "",
|
|
274
274
|
loose: !1,
|
|
275
275
|
items: []
|
|
276
276
|
};
|
|
277
|
-
n =
|
|
278
|
-
const
|
|
277
|
+
n = i ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = i ? n : "[*+-]");
|
|
278
|
+
const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
|
|
279
279
|
let a = "", c = "", d = !1;
|
|
280
280
|
for (; e; ) {
|
|
281
281
|
let h = !1;
|
|
282
|
-
if (!(t =
|
|
282
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
|
|
283
283
|
break;
|
|
284
284
|
a = t[0], e = e.substring(a.length);
|
|
285
285
|
let m = t[2].split(`
|
|
@@ -289,17 +289,17 @@ class $e {
|
|
|
289
289
|
let v = !1;
|
|
290
290
|
if (!m && /^ *$/.test(g) && (a += g + `
|
|
291
291
|
`, e = e.substring(g.length + 1), h = !0), !h) {
|
|
292
|
-
const ue = new RegExp(`^ {0,${Math.min(3, T - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
292
|
+
const ue = new RegExp(`^ {0,${Math.min(3, T - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), ye = new RegExp(`^ {0,${Math.min(3, T - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), V = new RegExp(`^ {0,${Math.min(3, T - 1)}}(?:\`\`\`|~~~)`), S = new RegExp(`^ {0,${Math.min(3, T - 1)}}#`);
|
|
293
293
|
for (; e; ) {
|
|
294
294
|
const Y = e.split(`
|
|
295
295
|
`, 1)[0];
|
|
296
|
-
if (g = Y, this.options.pedantic && (g = g.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), V.test(g) || S.test(g) || ue.test(g) ||
|
|
296
|
+
if (g = Y, this.options.pedantic && (g = g.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), V.test(g) || S.test(g) || ue.test(g) || ye.test(e))
|
|
297
297
|
break;
|
|
298
298
|
if (g.search(/[^ ]/) >= T || !g.trim())
|
|
299
299
|
c += `
|
|
300
300
|
` + g.slice(T);
|
|
301
301
|
else {
|
|
302
|
-
if (v || m.search(/[^ ]/) >= 4 || V.test(m) || S.test(m) ||
|
|
302
|
+
if (v || m.search(/[^ ]/) >= 4 || V.test(m) || S.test(m) || ye.test(m))
|
|
303
303
|
break;
|
|
304
304
|
c += `
|
|
305
305
|
` + g;
|
|
@@ -346,12 +346,12 @@ class $e {
|
|
|
346
346
|
def(e) {
|
|
347
347
|
const t = this.rules.block.def.exec(e);
|
|
348
348
|
if (t) {
|
|
349
|
-
const n = t[1].toLowerCase().replace(/\s+/g, " "),
|
|
349
|
+
const n = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", o = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
350
350
|
return {
|
|
351
351
|
type: "def",
|
|
352
352
|
tag: n,
|
|
353
353
|
raw: t[0],
|
|
354
|
-
href:
|
|
354
|
+
href: i,
|
|
355
355
|
title: o
|
|
356
356
|
};
|
|
357
357
|
}
|
|
@@ -360,28 +360,28 @@ class $e {
|
|
|
360
360
|
const t = this.rules.block.table.exec(e);
|
|
361
361
|
if (!t || !/[:|]/.test(t[2]))
|
|
362
362
|
return;
|
|
363
|
-
const n = Qt(t[1]),
|
|
364
|
-
`) : [],
|
|
363
|
+
const n = Qt(t[1]), i = t[2].replace(/^\||\| *$/g, "").split("|"), o = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
|
|
364
|
+
`) : [], s = {
|
|
365
365
|
type: "table",
|
|
366
366
|
raw: t[0],
|
|
367
367
|
header: [],
|
|
368
368
|
align: [],
|
|
369
369
|
rows: []
|
|
370
370
|
};
|
|
371
|
-
if (n.length ===
|
|
372
|
-
for (const a of
|
|
373
|
-
/^ *-+: *$/.test(a) ?
|
|
371
|
+
if (n.length === i.length) {
|
|
372
|
+
for (const a of i)
|
|
373
|
+
/^ *-+: *$/.test(a) ? s.align.push("right") : /^ *:-+: *$/.test(a) ? s.align.push("center") : /^ *:-+ *$/.test(a) ? s.align.push("left") : s.align.push(null);
|
|
374
374
|
for (const a of n)
|
|
375
|
-
|
|
375
|
+
s.header.push({
|
|
376
376
|
text: a,
|
|
377
377
|
tokens: this.lexer.inline(a)
|
|
378
378
|
});
|
|
379
379
|
for (const a of o)
|
|
380
|
-
|
|
380
|
+
s.rows.push(Qt(a, s.header.length).map((c) => ({
|
|
381
381
|
text: c,
|
|
382
382
|
tokens: this.lexer.inline(c)
|
|
383
383
|
})));
|
|
384
|
-
return
|
|
384
|
+
return s;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
lheading(e) {
|
|
@@ -446,24 +446,24 @@ class $e {
|
|
|
446
446
|
if (!this.options.pedantic && /^</.test(n)) {
|
|
447
447
|
if (!/>$/.test(n))
|
|
448
448
|
return;
|
|
449
|
-
const
|
|
450
|
-
if ((n.length -
|
|
449
|
+
const s = Me(n.slice(0, -1), "\\");
|
|
450
|
+
if ((n.length - s.length) % 2 === 0)
|
|
451
451
|
return;
|
|
452
452
|
} else {
|
|
453
|
-
const
|
|
454
|
-
if (
|
|
455
|
-
const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length +
|
|
456
|
-
t[2] = t[2].substring(0,
|
|
453
|
+
const s = Xn(t[2], "()");
|
|
454
|
+
if (s > -1) {
|
|
455
|
+
const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
456
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, c).trim(), t[3] = "";
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
-
let
|
|
459
|
+
let i = t[2], o = "";
|
|
460
460
|
if (this.options.pedantic) {
|
|
461
|
-
const
|
|
462
|
-
|
|
461
|
+
const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
|
|
462
|
+
s && (i = s[1], o = s[3]);
|
|
463
463
|
} else
|
|
464
464
|
o = t[3] ? t[3].slice(1, -1) : "";
|
|
465
|
-
return
|
|
466
|
-
href:
|
|
465
|
+
return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(n) ? i = i.slice(1) : i = i.slice(1, -1)), Vt(t, {
|
|
466
|
+
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
467
467
|
title: o && o.replace(this.rules.inline.anyPunctuation, "$1")
|
|
468
468
|
}, t[0], this.lexer);
|
|
469
469
|
}
|
|
@@ -471,41 +471,41 @@ class $e {
|
|
|
471
471
|
reflink(e, t) {
|
|
472
472
|
let n;
|
|
473
473
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
474
|
-
const
|
|
474
|
+
const i = (n[2] || n[1]).replace(/\s+/g, " "), o = t[i.toLowerCase()];
|
|
475
475
|
if (!o) {
|
|
476
|
-
const
|
|
476
|
+
const s = n[0].charAt(0);
|
|
477
477
|
return {
|
|
478
478
|
type: "text",
|
|
479
|
-
raw:
|
|
480
|
-
text:
|
|
479
|
+
raw: s,
|
|
480
|
+
text: s
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
483
|
return Vt(n, o, n[0], this.lexer);
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
emStrong(e, t, n = "") {
|
|
487
|
-
let
|
|
488
|
-
if (!
|
|
487
|
+
let i = this.rules.inline.emStrongLDelim.exec(e);
|
|
488
|
+
if (!i || i[3] && n.match(/[\p{L}\p{N}]/u))
|
|
489
489
|
return;
|
|
490
|
-
if (!(
|
|
491
|
-
const
|
|
492
|
-
let a, c, d =
|
|
493
|
-
const m =
|
|
494
|
-
for (m.lastIndex = 0, t = t.slice(-1 * e.length +
|
|
495
|
-
if (a =
|
|
490
|
+
if (!(i[1] || i[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
491
|
+
const s = [...i[0]].length - 1;
|
|
492
|
+
let a, c, d = s, h = 0;
|
|
493
|
+
const m = i[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
494
|
+
for (m.lastIndex = 0, t = t.slice(-1 * e.length + s); (i = m.exec(t)) != null; ) {
|
|
495
|
+
if (a = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !a)
|
|
496
496
|
continue;
|
|
497
|
-
if (c = [...a].length,
|
|
497
|
+
if (c = [...a].length, i[3] || i[4]) {
|
|
498
498
|
d += c;
|
|
499
499
|
continue;
|
|
500
|
-
} else if ((
|
|
500
|
+
} else if ((i[5] || i[6]) && s % 3 && !((s + c) % 3)) {
|
|
501
501
|
h += c;
|
|
502
502
|
continue;
|
|
503
503
|
}
|
|
504
504
|
if (d -= c, d > 0)
|
|
505
505
|
continue;
|
|
506
506
|
c = Math.min(c, c + d + h);
|
|
507
|
-
const g = [...
|
|
508
|
-
if (Math.min(
|
|
507
|
+
const g = [...i[0]][0].length, T = e.slice(0, s + i.index + g + c);
|
|
508
|
+
if (Math.min(s, c) % 2) {
|
|
509
509
|
const P = T.slice(1, -1);
|
|
510
510
|
return {
|
|
511
511
|
type: "em",
|
|
@@ -528,8 +528,8 @@ class $e {
|
|
|
528
528
|
const t = this.rules.inline.code.exec(e);
|
|
529
529
|
if (t) {
|
|
530
530
|
let n = t[2].replace(/\n/g, " ");
|
|
531
|
-
const
|
|
532
|
-
return
|
|
531
|
+
const i = /[^ ]/.test(n), o = /^ /.test(n) && / $/.test(n);
|
|
532
|
+
return i && o && (n = n.substring(1, n.length - 1)), n = $(n, !0), {
|
|
533
533
|
type: "codespan",
|
|
534
534
|
raw: t[0],
|
|
535
535
|
text: n
|
|
@@ -557,12 +557,12 @@ class $e {
|
|
|
557
557
|
autolink(e) {
|
|
558
558
|
const t = this.rules.inline.autolink.exec(e);
|
|
559
559
|
if (t) {
|
|
560
|
-
let n,
|
|
561
|
-
return t[2] === "@" ? (n = $(t[1]),
|
|
560
|
+
let n, i;
|
|
561
|
+
return t[2] === "@" ? (n = $(t[1]), i = "mailto:" + n) : (n = $(t[1]), i = n), {
|
|
562
562
|
type: "link",
|
|
563
563
|
raw: t[0],
|
|
564
564
|
text: n,
|
|
565
|
-
href:
|
|
565
|
+
href: i,
|
|
566
566
|
tokens: [
|
|
567
567
|
{
|
|
568
568
|
type: "text",
|
|
@@ -577,26 +577,26 @@ class $e {
|
|
|
577
577
|
var n;
|
|
578
578
|
let t;
|
|
579
579
|
if (t = this.rules.inline.url.exec(e)) {
|
|
580
|
-
let
|
|
580
|
+
let i, o;
|
|
581
581
|
if (t[2] === "@")
|
|
582
|
-
|
|
582
|
+
i = $(t[0]), o = "mailto:" + i;
|
|
583
583
|
else {
|
|
584
|
-
let
|
|
584
|
+
let s;
|
|
585
585
|
do
|
|
586
|
-
|
|
587
|
-
while (
|
|
588
|
-
|
|
586
|
+
s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
|
|
587
|
+
while (s !== t[0]);
|
|
588
|
+
i = $(t[0]), t[1] === "www." ? o = "http://" + t[0] : o = t[0];
|
|
589
589
|
}
|
|
590
590
|
return {
|
|
591
591
|
type: "link",
|
|
592
592
|
raw: t[0],
|
|
593
|
-
text:
|
|
593
|
+
text: i,
|
|
594
594
|
href: o,
|
|
595
595
|
tokens: [
|
|
596
596
|
{
|
|
597
597
|
type: "text",
|
|
598
|
-
raw:
|
|
599
|
-
text:
|
|
598
|
+
raw: i,
|
|
599
|
+
text: i
|
|
600
600
|
}
|
|
601
601
|
]
|
|
602
602
|
};
|
|
@@ -741,7 +741,7 @@ class W {
|
|
|
741
741
|
}
|
|
742
742
|
blockTokens(e, t = []) {
|
|
743
743
|
this.options.pedantic ? e = e.replace(/\t/g, " ").replace(/^ +$/gm, "") : e = e.replace(/^( *)(\t+)/gm, (a, c, d) => c + " ".repeat(d.length));
|
|
744
|
-
let n,
|
|
744
|
+
let n, i, o, s;
|
|
745
745
|
for (; e; )
|
|
746
746
|
if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((a) => (n = a.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
|
|
747
747
|
if (n = this.tokenizer.space(e)) {
|
|
@@ -750,9 +750,9 @@ class W {
|
|
|
750
750
|
continue;
|
|
751
751
|
}
|
|
752
752
|
if (n = this.tokenizer.code(e)) {
|
|
753
|
-
e = e.substring(n.raw.length),
|
|
754
|
-
` + n.raw,
|
|
755
|
-
` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
753
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
|
|
754
|
+
` + n.raw, i.text += `
|
|
755
|
+
` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
|
|
756
756
|
continue;
|
|
757
757
|
}
|
|
758
758
|
if (n = this.tokenizer.fences(e)) {
|
|
@@ -780,9 +780,9 @@ class W {
|
|
|
780
780
|
continue;
|
|
781
781
|
}
|
|
782
782
|
if (n = this.tokenizer.def(e)) {
|
|
783
|
-
e = e.substring(n.raw.length),
|
|
784
|
-
` + n.raw,
|
|
785
|
-
` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
783
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
|
|
784
|
+
` + n.raw, i.text += `
|
|
785
|
+
` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
|
|
786
786
|
href: n.href,
|
|
787
787
|
title: n.title
|
|
788
788
|
});
|
|
@@ -805,15 +805,15 @@ class W {
|
|
|
805
805
|
}), a < 1 / 0 && a >= 0 && (o = e.substring(0, a + 1));
|
|
806
806
|
}
|
|
807
807
|
if (this.state.top && (n = this.tokenizer.paragraph(o))) {
|
|
808
|
-
|
|
809
|
-
` + n.raw,
|
|
810
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
808
|
+
i = t[t.length - 1], s && i.type === "paragraph" ? (i.raw += `
|
|
809
|
+
` + n.raw, i.text += `
|
|
810
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n), s = o.length !== e.length, e = e.substring(n.raw.length);
|
|
811
811
|
continue;
|
|
812
812
|
}
|
|
813
813
|
if (n = this.tokenizer.text(e)) {
|
|
814
|
-
e = e.substring(n.raw.length),
|
|
815
|
-
` + n.raw,
|
|
816
|
-
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src =
|
|
814
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
|
|
815
|
+
` + n.raw, i.text += `
|
|
816
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(n);
|
|
817
817
|
continue;
|
|
818
818
|
}
|
|
819
819
|
if (e) {
|
|
@@ -834,17 +834,17 @@ class W {
|
|
|
834
834
|
* Lexing/Compiling
|
|
835
835
|
*/
|
|
836
836
|
inlineTokens(e, t = []) {
|
|
837
|
-
let n,
|
|
837
|
+
let n, i, o, s = e, a, c, d;
|
|
838
838
|
if (this.tokens.links) {
|
|
839
839
|
const h = Object.keys(this.tokens.links);
|
|
840
840
|
if (h.length > 0)
|
|
841
|
-
for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(
|
|
842
|
-
h.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (
|
|
841
|
+
for (; (a = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
|
|
842
|
+
h.includes(a[0].slice(a[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
843
843
|
}
|
|
844
|
-
for (; (a = this.tokenizer.rules.inline.blockSkip.exec(
|
|
845
|
-
|
|
846
|
-
for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(
|
|
847
|
-
|
|
844
|
+
for (; (a = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
|
|
845
|
+
s = s.slice(0, a.index) + "[" + "a".repeat(a[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
846
|
+
for (; (a = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
|
|
847
|
+
s = s.slice(0, a.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
848
848
|
for (; e; )
|
|
849
849
|
if (c || (d = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((h) => (n = h.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1))) {
|
|
850
850
|
if (n = this.tokenizer.escape(e)) {
|
|
@@ -852,7 +852,7 @@ class W {
|
|
|
852
852
|
continue;
|
|
853
853
|
}
|
|
854
854
|
if (n = this.tokenizer.tag(e)) {
|
|
855
|
-
e = e.substring(n.raw.length),
|
|
855
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
856
856
|
continue;
|
|
857
857
|
}
|
|
858
858
|
if (n = this.tokenizer.link(e)) {
|
|
@@ -860,10 +860,10 @@ class W {
|
|
|
860
860
|
continue;
|
|
861
861
|
}
|
|
862
862
|
if (n = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
863
|
-
e = e.substring(n.raw.length),
|
|
863
|
+
e = e.substring(n.raw.length), i = t[t.length - 1], i && n.type === "text" && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
864
864
|
continue;
|
|
865
865
|
}
|
|
866
|
-
if (n = this.tokenizer.emStrong(e,
|
|
866
|
+
if (n = this.tokenizer.emStrong(e, s, d)) {
|
|
867
867
|
e = e.substring(n.raw.length), t.push(n);
|
|
868
868
|
continue;
|
|
869
869
|
}
|
|
@@ -896,7 +896,7 @@ class W {
|
|
|
896
896
|
}), h < 1 / 0 && h >= 0 && (o = e.substring(0, h + 1));
|
|
897
897
|
}
|
|
898
898
|
if (n = this.tokenizer.inlineText(o)) {
|
|
899
|
-
e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (d = n.raw.slice(-1)), c = !0,
|
|
899
|
+
e = e.substring(n.raw.length), n.raw.slice(-1) !== "_" && (d = n.raw.slice(-1)), c = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += n.raw, i.text += n.text) : t.push(n);
|
|
900
900
|
continue;
|
|
901
901
|
}
|
|
902
902
|
if (e) {
|
|
@@ -918,9 +918,9 @@ class Fe {
|
|
|
918
918
|
}
|
|
919
919
|
code(e, t, n) {
|
|
920
920
|
var o;
|
|
921
|
-
const
|
|
921
|
+
const i = (o = (t || "").match(/^\S*/)) == null ? void 0 : o[0];
|
|
922
922
|
return e = e.replace(/\n$/, "") + `
|
|
923
|
-
`,
|
|
923
|
+
`, i ? '<pre><code class="language-' + $(i) + '">' + (n ? e : $(e, !0)) + `</code></pre>
|
|
924
924
|
` : "<pre><code>" + (n ? e : $(e, !0)) + `</code></pre>
|
|
925
925
|
`;
|
|
926
926
|
}
|
|
@@ -941,9 +941,9 @@ ${e}</blockquote>
|
|
|
941
941
|
`;
|
|
942
942
|
}
|
|
943
943
|
list(e, t, n) {
|
|
944
|
-
const
|
|
945
|
-
return "<" +
|
|
946
|
-
` + e + "</" +
|
|
944
|
+
const i = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
945
|
+
return "<" + i + o + `>
|
|
946
|
+
` + e + "</" + i + `>
|
|
947
947
|
`;
|
|
948
948
|
}
|
|
949
949
|
listitem(e, t, n) {
|
|
@@ -993,18 +993,18 @@ ${e}</tr>
|
|
|
993
993
|
return `<del>${e}</del>`;
|
|
994
994
|
}
|
|
995
995
|
link(e, t, n) {
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
996
|
+
const i = Xt(e);
|
|
997
|
+
if (i === null)
|
|
998
998
|
return n;
|
|
999
|
-
e =
|
|
999
|
+
e = i;
|
|
1000
1000
|
let o = '<a href="' + e + '"';
|
|
1001
1001
|
return t && (o += ' title="' + t + '"'), o += ">" + n + "</a>", o;
|
|
1002
1002
|
}
|
|
1003
1003
|
image(e, t, n) {
|
|
1004
|
-
const
|
|
1005
|
-
if (
|
|
1004
|
+
const i = Xt(e);
|
|
1005
|
+
if (i === null)
|
|
1006
1006
|
return n;
|
|
1007
|
-
e =
|
|
1007
|
+
e = i;
|
|
1008
1008
|
let o = `<img src="${e}" alt="${n}"`;
|
|
1009
1009
|
return t && (o += ` title="${t}"`), o += ">", o;
|
|
1010
1010
|
}
|
|
@@ -1066,11 +1066,11 @@ class q {
|
|
|
1066
1066
|
*/
|
|
1067
1067
|
parse(e, t = !0) {
|
|
1068
1068
|
let n = "";
|
|
1069
|
-
for (let
|
|
1070
|
-
const o = e[
|
|
1069
|
+
for (let i = 0; i < e.length; i++) {
|
|
1070
|
+
const o = e[i];
|
|
1071
1071
|
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[o.type]) {
|
|
1072
|
-
const
|
|
1073
|
-
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(
|
|
1072
|
+
const s = o, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
1073
|
+
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
|
|
1074
1074
|
n += a || "";
|
|
1075
1075
|
continue;
|
|
1076
1076
|
}
|
|
@@ -1083,42 +1083,42 @@ class q {
|
|
|
1083
1083
|
continue;
|
|
1084
1084
|
}
|
|
1085
1085
|
case "heading": {
|
|
1086
|
-
const
|
|
1087
|
-
n += this.renderer.heading(this.parseInline(
|
|
1086
|
+
const s = o;
|
|
1087
|
+
n += this.renderer.heading(this.parseInline(s.tokens), s.depth, Yn(this.parseInline(s.tokens, this.textRenderer)));
|
|
1088
1088
|
continue;
|
|
1089
1089
|
}
|
|
1090
1090
|
case "code": {
|
|
1091
|
-
const
|
|
1092
|
-
n += this.renderer.code(
|
|
1091
|
+
const s = o;
|
|
1092
|
+
n += this.renderer.code(s.text, s.lang, !!s.escaped);
|
|
1093
1093
|
continue;
|
|
1094
1094
|
}
|
|
1095
1095
|
case "table": {
|
|
1096
|
-
const
|
|
1096
|
+
const s = o;
|
|
1097
1097
|
let a = "", c = "";
|
|
1098
|
-
for (let h = 0; h <
|
|
1099
|
-
c += this.renderer.tablecell(this.parseInline(
|
|
1098
|
+
for (let h = 0; h < s.header.length; h++)
|
|
1099
|
+
c += this.renderer.tablecell(this.parseInline(s.header[h].tokens), { header: !0, align: s.align[h] });
|
|
1100
1100
|
a += this.renderer.tablerow(c);
|
|
1101
1101
|
let d = "";
|
|
1102
|
-
for (let h = 0; h <
|
|
1103
|
-
const m =
|
|
1102
|
+
for (let h = 0; h < s.rows.length; h++) {
|
|
1103
|
+
const m = s.rows[h];
|
|
1104
1104
|
c = "";
|
|
1105
1105
|
for (let g = 0; g < m.length; g++)
|
|
1106
|
-
c += this.renderer.tablecell(this.parseInline(m[g].tokens), { header: !1, align:
|
|
1106
|
+
c += this.renderer.tablecell(this.parseInline(m[g].tokens), { header: !1, align: s.align[g] });
|
|
1107
1107
|
d += this.renderer.tablerow(c);
|
|
1108
1108
|
}
|
|
1109
1109
|
n += this.renderer.table(a, d);
|
|
1110
1110
|
continue;
|
|
1111
1111
|
}
|
|
1112
1112
|
case "blockquote": {
|
|
1113
|
-
const
|
|
1113
|
+
const s = o, a = this.parse(s.tokens);
|
|
1114
1114
|
n += this.renderer.blockquote(a);
|
|
1115
1115
|
continue;
|
|
1116
1116
|
}
|
|
1117
1117
|
case "list": {
|
|
1118
|
-
const
|
|
1118
|
+
const s = o, a = s.ordered, c = s.start, d = s.loose;
|
|
1119
1119
|
let h = "";
|
|
1120
|
-
for (let m = 0; m <
|
|
1121
|
-
const g =
|
|
1120
|
+
for (let m = 0; m < s.items.length; m++) {
|
|
1121
|
+
const g = s.items[m], T = g.checked, v = g.task;
|
|
1122
1122
|
let P = "";
|
|
1123
1123
|
if (g.task) {
|
|
1124
1124
|
const Z = this.renderer.checkbox(!!T);
|
|
@@ -1133,28 +1133,28 @@ class q {
|
|
|
1133
1133
|
continue;
|
|
1134
1134
|
}
|
|
1135
1135
|
case "html": {
|
|
1136
|
-
const
|
|
1137
|
-
n += this.renderer.html(
|
|
1136
|
+
const s = o;
|
|
1137
|
+
n += this.renderer.html(s.text, s.block);
|
|
1138
1138
|
continue;
|
|
1139
1139
|
}
|
|
1140
1140
|
case "paragraph": {
|
|
1141
|
-
const
|
|
1142
|
-
n += this.renderer.paragraph(this.parseInline(
|
|
1141
|
+
const s = o;
|
|
1142
|
+
n += this.renderer.paragraph(this.parseInline(s.tokens));
|
|
1143
1143
|
continue;
|
|
1144
1144
|
}
|
|
1145
1145
|
case "text": {
|
|
1146
|
-
let
|
|
1147
|
-
for (;
|
|
1148
|
-
|
|
1149
|
-
` + (
|
|
1146
|
+
let s = o, a = s.tokens ? this.parseInline(s.tokens) : s.text;
|
|
1147
|
+
for (; i + 1 < e.length && e[i + 1].type === "text"; )
|
|
1148
|
+
s = e[++i], a += `
|
|
1149
|
+
` + (s.tokens ? this.parseInline(s.tokens) : s.text);
|
|
1150
1150
|
n += t ? this.renderer.paragraph(a) : a;
|
|
1151
1151
|
continue;
|
|
1152
1152
|
}
|
|
1153
1153
|
default: {
|
|
1154
|
-
const
|
|
1154
|
+
const s = 'Token with "' + o.type + '" type was not found.';
|
|
1155
1155
|
if (this.options.silent)
|
|
1156
|
-
return console.error(
|
|
1157
|
-
throw new Error(
|
|
1156
|
+
return console.error(s), "";
|
|
1157
|
+
throw new Error(s);
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
@@ -1166,49 +1166,49 @@ class q {
|
|
|
1166
1166
|
parseInline(e, t) {
|
|
1167
1167
|
t = t || this.renderer;
|
|
1168
1168
|
let n = "";
|
|
1169
|
-
for (let
|
|
1170
|
-
const o = e[
|
|
1169
|
+
for (let i = 0; i < e.length; i++) {
|
|
1170
|
+
const o = e[i];
|
|
1171
1171
|
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[o.type]) {
|
|
1172
|
-
const
|
|
1173
|
-
if (
|
|
1174
|
-
n +=
|
|
1172
|
+
const s = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
1173
|
+
if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(o.type)) {
|
|
1174
|
+
n += s || "";
|
|
1175
1175
|
continue;
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
switch (o.type) {
|
|
1179
1179
|
case "escape": {
|
|
1180
|
-
const
|
|
1181
|
-
n += t.text(
|
|
1180
|
+
const s = o;
|
|
1181
|
+
n += t.text(s.text);
|
|
1182
1182
|
break;
|
|
1183
1183
|
}
|
|
1184
1184
|
case "html": {
|
|
1185
|
-
const
|
|
1186
|
-
n += t.html(
|
|
1185
|
+
const s = o;
|
|
1186
|
+
n += t.html(s.text);
|
|
1187
1187
|
break;
|
|
1188
1188
|
}
|
|
1189
1189
|
case "link": {
|
|
1190
|
-
const
|
|
1191
|
-
n += t.link(
|
|
1190
|
+
const s = o;
|
|
1191
|
+
n += t.link(s.href, s.title, this.parseInline(s.tokens, t));
|
|
1192
1192
|
break;
|
|
1193
1193
|
}
|
|
1194
1194
|
case "image": {
|
|
1195
|
-
const
|
|
1196
|
-
n += t.image(
|
|
1195
|
+
const s = o;
|
|
1196
|
+
n += t.image(s.href, s.title, s.text);
|
|
1197
1197
|
break;
|
|
1198
1198
|
}
|
|
1199
1199
|
case "strong": {
|
|
1200
|
-
const
|
|
1201
|
-
n += t.strong(this.parseInline(
|
|
1200
|
+
const s = o;
|
|
1201
|
+
n += t.strong(this.parseInline(s.tokens, t));
|
|
1202
1202
|
break;
|
|
1203
1203
|
}
|
|
1204
1204
|
case "em": {
|
|
1205
|
-
const
|
|
1206
|
-
n += t.em(this.parseInline(
|
|
1205
|
+
const s = o;
|
|
1206
|
+
n += t.em(this.parseInline(s.tokens, t));
|
|
1207
1207
|
break;
|
|
1208
1208
|
}
|
|
1209
1209
|
case "codespan": {
|
|
1210
|
-
const
|
|
1211
|
-
n += t.codespan(
|
|
1210
|
+
const s = o;
|
|
1211
|
+
n += t.codespan(s.text);
|
|
1212
1212
|
break;
|
|
1213
1213
|
}
|
|
1214
1214
|
case "br": {
|
|
@@ -1216,20 +1216,20 @@ class q {
|
|
|
1216
1216
|
break;
|
|
1217
1217
|
}
|
|
1218
1218
|
case "del": {
|
|
1219
|
-
const
|
|
1220
|
-
n += t.del(this.parseInline(
|
|
1219
|
+
const s = o;
|
|
1220
|
+
n += t.del(this.parseInline(s.tokens, t));
|
|
1221
1221
|
break;
|
|
1222
1222
|
}
|
|
1223
1223
|
case "text": {
|
|
1224
|
-
const
|
|
1225
|
-
n += t.text(
|
|
1224
|
+
const s = o;
|
|
1225
|
+
n += t.text(s.text);
|
|
1226
1226
|
break;
|
|
1227
1227
|
}
|
|
1228
1228
|
default: {
|
|
1229
|
-
const
|
|
1229
|
+
const s = 'Token with "' + o.type + '" type was not found.';
|
|
1230
1230
|
if (this.options.silent)
|
|
1231
|
-
return console.error(
|
|
1232
|
-
throw new Error(
|
|
1231
|
+
return console.error(s), "";
|
|
1232
|
+
throw new Error(s);
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
@@ -1285,12 +1285,12 @@ class Ei {
|
|
|
1285
1285
|
* Run callback for every token
|
|
1286
1286
|
*/
|
|
1287
1287
|
walkTokens(e, t) {
|
|
1288
|
-
var
|
|
1288
|
+
var i, o;
|
|
1289
1289
|
let n = [];
|
|
1290
|
-
for (const
|
|
1291
|
-
switch (n = n.concat(t.call(this,
|
|
1290
|
+
for (const s of e)
|
|
1291
|
+
switch (n = n.concat(t.call(this, s)), s.type) {
|
|
1292
1292
|
case "table": {
|
|
1293
|
-
const a =
|
|
1293
|
+
const a = s;
|
|
1294
1294
|
for (const c of a.header)
|
|
1295
1295
|
n = n.concat(this.walkTokens(c.tokens, t));
|
|
1296
1296
|
for (const c of a.rows)
|
|
@@ -1299,13 +1299,13 @@ class Ei {
|
|
|
1299
1299
|
break;
|
|
1300
1300
|
}
|
|
1301
1301
|
case "list": {
|
|
1302
|
-
const a =
|
|
1302
|
+
const a = s;
|
|
1303
1303
|
n = n.concat(this.walkTokens(a.items, t));
|
|
1304
1304
|
break;
|
|
1305
1305
|
}
|
|
1306
1306
|
default: {
|
|
1307
|
-
const a =
|
|
1308
|
-
(o = (
|
|
1307
|
+
const a = s;
|
|
1308
|
+
(o = (i = this.defaults.extensions) == null ? void 0 : i.childTokens) != null && o[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((c) => {
|
|
1309
1309
|
const d = a[c].flat(1 / 0);
|
|
1310
1310
|
n = n.concat(this.walkTokens(d, t));
|
|
1311
1311
|
}) : a.tokens && (n = n.concat(this.walkTokens(a.tokens, t)));
|
|
@@ -1316,63 +1316,63 @@ class Ei {
|
|
|
1316
1316
|
use(...e) {
|
|
1317
1317
|
const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1318
1318
|
return e.forEach((n) => {
|
|
1319
|
-
const
|
|
1320
|
-
if (
|
|
1319
|
+
const i = { ...n };
|
|
1320
|
+
if (i.async = this.defaults.async || i.async || !1, n.extensions && (n.extensions.forEach((o) => {
|
|
1321
1321
|
if (!o.name)
|
|
1322
1322
|
throw new Error("extension name required");
|
|
1323
1323
|
if ("renderer" in o) {
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1324
|
+
const s = t.renderers[o.name];
|
|
1325
|
+
s ? t.renderers[o.name] = function(...a) {
|
|
1326
1326
|
let c = o.renderer.apply(this, a);
|
|
1327
|
-
return c === !1 && (c =
|
|
1327
|
+
return c === !1 && (c = s.apply(this, a)), c;
|
|
1328
1328
|
} : t.renderers[o.name] = o.renderer;
|
|
1329
1329
|
}
|
|
1330
1330
|
if ("tokenizer" in o) {
|
|
1331
1331
|
if (!o.level || o.level !== "block" && o.level !== "inline")
|
|
1332
1332
|
throw new Error("extension level must be 'block' or 'inline'");
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1333
|
+
const s = t[o.level];
|
|
1334
|
+
s ? s.unshift(o.tokenizer) : t[o.level] = [o.tokenizer], o.start && (o.level === "block" ? t.startBlock ? t.startBlock.push(o.start) : t.startBlock = [o.start] : o.level === "inline" && (t.startInline ? t.startInline.push(o.start) : t.startInline = [o.start]));
|
|
1335
1335
|
}
|
|
1336
1336
|
"childTokens" in o && o.childTokens && (t.childTokens[o.name] = o.childTokens);
|
|
1337
|
-
}),
|
|
1337
|
+
}), i.extensions = t), n.renderer) {
|
|
1338
1338
|
const o = this.defaults.renderer || new Fe(this.defaults);
|
|
1339
|
-
for (const
|
|
1340
|
-
if (!(
|
|
1341
|
-
throw new Error(`renderer '${
|
|
1342
|
-
if (
|
|
1339
|
+
for (const s in n.renderer) {
|
|
1340
|
+
if (!(s in o))
|
|
1341
|
+
throw new Error(`renderer '${s}' does not exist`);
|
|
1342
|
+
if (s === "options")
|
|
1343
1343
|
continue;
|
|
1344
|
-
const a =
|
|
1344
|
+
const a = s, c = n.renderer[a], d = o[a];
|
|
1345
1345
|
o[a] = (...h) => {
|
|
1346
1346
|
let m = c.apply(o, h);
|
|
1347
1347
|
return m === !1 && (m = d.apply(o, h)), m || "";
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
|
-
|
|
1350
|
+
i.renderer = o;
|
|
1351
1351
|
}
|
|
1352
1352
|
if (n.tokenizer) {
|
|
1353
1353
|
const o = this.defaults.tokenizer || new $e(this.defaults);
|
|
1354
|
-
for (const
|
|
1355
|
-
if (!(
|
|
1356
|
-
throw new Error(`tokenizer '${
|
|
1357
|
-
if (["options", "rules", "lexer"].includes(
|
|
1354
|
+
for (const s in n.tokenizer) {
|
|
1355
|
+
if (!(s in o))
|
|
1356
|
+
throw new Error(`tokenizer '${s}' does not exist`);
|
|
1357
|
+
if (["options", "rules", "lexer"].includes(s))
|
|
1358
1358
|
continue;
|
|
1359
|
-
const a =
|
|
1359
|
+
const a = s, c = n.tokenizer[a], d = o[a];
|
|
1360
1360
|
o[a] = (...h) => {
|
|
1361
1361
|
let m = c.apply(o, h);
|
|
1362
1362
|
return m === !1 && (m = d.apply(o, h)), m;
|
|
1363
1363
|
};
|
|
1364
1364
|
}
|
|
1365
|
-
|
|
1365
|
+
i.tokenizer = o;
|
|
1366
1366
|
}
|
|
1367
1367
|
if (n.hooks) {
|
|
1368
1368
|
const o = this.defaults.hooks || new we();
|
|
1369
|
-
for (const
|
|
1370
|
-
if (!(
|
|
1371
|
-
throw new Error(`hook '${
|
|
1372
|
-
if (
|
|
1369
|
+
for (const s in n.hooks) {
|
|
1370
|
+
if (!(s in o))
|
|
1371
|
+
throw new Error(`hook '${s}' does not exist`);
|
|
1372
|
+
if (s === "options")
|
|
1373
1373
|
continue;
|
|
1374
|
-
const a =
|
|
1375
|
-
we.passThroughHooks.has(
|
|
1374
|
+
const a = s, c = n.hooks[a], d = o[a];
|
|
1375
|
+
we.passThroughHooks.has(s) ? o[a] = (h) => {
|
|
1376
1376
|
if (this.defaults.async)
|
|
1377
1377
|
return Promise.resolve(c.call(o, h)).then((g) => d.call(o, g));
|
|
1378
1378
|
const m = c.call(o, h);
|
|
@@ -1382,16 +1382,16 @@ class Ei {
|
|
|
1382
1382
|
return m === !1 && (m = d.apply(o, h)), m;
|
|
1383
1383
|
};
|
|
1384
1384
|
}
|
|
1385
|
-
|
|
1385
|
+
i.hooks = o;
|
|
1386
1386
|
}
|
|
1387
1387
|
if (n.walkTokens) {
|
|
1388
|
-
const o = this.defaults.walkTokens,
|
|
1389
|
-
|
|
1388
|
+
const o = this.defaults.walkTokens, s = n.walkTokens;
|
|
1389
|
+
i.walkTokens = function(a) {
|
|
1390
1390
|
let c = [];
|
|
1391
|
-
return c.push(
|
|
1391
|
+
return c.push(s.call(this, a)), o && (c = c.concat(o.call(this, a))), c;
|
|
1392
1392
|
};
|
|
1393
1393
|
}
|
|
1394
|
-
this.defaults = { ...this.defaults, ...
|
|
1394
|
+
this.defaults = { ...this.defaults, ...i };
|
|
1395
1395
|
}), this;
|
|
1396
1396
|
}
|
|
1397
1397
|
setOptions(e) {
|
|
@@ -1405,22 +1405,22 @@ class Ei {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
1407
|
te = new WeakSet(), pt = function(e, t) {
|
|
1408
|
-
return (n,
|
|
1409
|
-
const o = { ...
|
|
1410
|
-
this.defaults.async === !0 && o.async === !1 && (
|
|
1411
|
-
const a = Ce(this, te, Tn).call(this, !!
|
|
1408
|
+
return (n, i) => {
|
|
1409
|
+
const o = { ...i }, s = { ...this.defaults, ...o };
|
|
1410
|
+
this.defaults.async === !0 && o.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
|
|
1411
|
+
const a = Ce(this, te, Tn).call(this, !!s.silent, !!s.async);
|
|
1412
1412
|
if (typeof n > "u" || n === null)
|
|
1413
1413
|
return a(new Error("marked(): input parameter is undefined or null"));
|
|
1414
1414
|
if (typeof n != "string")
|
|
1415
1415
|
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1416
|
-
if (
|
|
1417
|
-
return Promise.resolve(
|
|
1416
|
+
if (s.hooks && (s.hooks.options = s), s.async)
|
|
1417
|
+
return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((c) => e(c, s)).then((c) => s.hooks ? s.hooks.processAllTokens(c) : c).then((c) => s.walkTokens ? Promise.all(this.walkTokens(c, s.walkTokens)).then(() => c) : c).then((c) => t(c, s)).then((c) => s.hooks ? s.hooks.postprocess(c) : c).catch(a);
|
|
1418
1418
|
try {
|
|
1419
|
-
|
|
1420
|
-
let c = e(n,
|
|
1421
|
-
|
|
1422
|
-
let d = t(c,
|
|
1423
|
-
return
|
|
1419
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
1420
|
+
let c = e(n, s);
|
|
1421
|
+
s.hooks && (c = s.hooks.processAllTokens(c)), s.walkTokens && this.walkTokens(c, s.walkTokens);
|
|
1422
|
+
let d = t(c, s);
|
|
1423
|
+
return s.hooks && (d = s.hooks.postprocess(d)), d;
|
|
1424
1424
|
} catch (c) {
|
|
1425
1425
|
return a(c);
|
|
1426
1426
|
}
|
|
@@ -1429,8 +1429,8 @@ te = new WeakSet(), pt = function(e, t) {
|
|
|
1429
1429
|
return (n) => {
|
|
1430
1430
|
if (n.message += `
|
|
1431
1431
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1432
|
-
const
|
|
1433
|
-
return t ? Promise.resolve(
|
|
1432
|
+
const i = "<p>An error occurred:</p><pre>" + $(n.message + "", !0) + "</pre>";
|
|
1433
|
+
return t ? Promise.resolve(i) : i;
|
|
1434
1434
|
}
|
|
1435
1435
|
if (t)
|
|
1436
1436
|
return Promise.reject(n);
|
|
@@ -1473,8 +1473,8 @@ W.lex;
|
|
|
1473
1473
|
const {
|
|
1474
1474
|
entries: bn,
|
|
1475
1475
|
setPrototypeOf: Jt,
|
|
1476
|
-
isFrozen:
|
|
1477
|
-
getPrototypeOf:
|
|
1476
|
+
isFrozen: yi,
|
|
1477
|
+
getPrototypeOf: Ai,
|
|
1478
1478
|
getOwnPropertyDescriptor: Si
|
|
1479
1479
|
} = Object;
|
|
1480
1480
|
let {
|
|
@@ -1492,21 +1492,21 @@ U || (U = function(e) {
|
|
|
1492
1492
|
return e;
|
|
1493
1493
|
});
|
|
1494
1494
|
ft || (ft = function(e, t) {
|
|
1495
|
-
for (var n = arguments.length,
|
|
1496
|
-
|
|
1497
|
-
return e.apply(t,
|
|
1495
|
+
for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), o = 2; o < n; o++)
|
|
1496
|
+
i[o - 2] = arguments[o];
|
|
1497
|
+
return e.apply(t, i);
|
|
1498
1498
|
});
|
|
1499
1499
|
dt || (dt = function(e) {
|
|
1500
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
1501
|
-
n[
|
|
1500
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
1501
|
+
n[i - 1] = arguments[i];
|
|
1502
1502
|
return new e(...n);
|
|
1503
1503
|
});
|
|
1504
1504
|
const ve = N(Array.prototype.forEach), Ri = N(Array.prototype.lastIndexOf), en = N(Array.prototype.pop), ge = N(Array.prototype.push), Li = N(Array.prototype.splice), Pe = N(String.prototype.toLowerCase), st = N(String.prototype.toString), rt = N(String.prototype.match), me = N(String.prototype.replace), Ii = N(String.prototype.indexOf), Oi = N(String.prototype.trim), F = N(Object.prototype.hasOwnProperty), C = N(RegExp.prototype.test), ke = Di(TypeError);
|
|
1505
1505
|
function N(l) {
|
|
1506
1506
|
return function(e) {
|
|
1507
1507
|
e instanceof RegExp && (e.lastIndex = 0);
|
|
1508
|
-
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0),
|
|
1509
|
-
n[
|
|
1508
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
|
|
1509
|
+
n[i - 1] = arguments[i];
|
|
1510
1510
|
return ft(l, e, n);
|
|
1511
1511
|
};
|
|
1512
1512
|
}
|
|
@@ -1522,12 +1522,12 @@ function k(l, e) {
|
|
|
1522
1522
|
Jt && Jt(l, null);
|
|
1523
1523
|
let n = e.length;
|
|
1524
1524
|
for (; n--; ) {
|
|
1525
|
-
let
|
|
1526
|
-
if (typeof
|
|
1527
|
-
const o = t(
|
|
1528
|
-
o !==
|
|
1525
|
+
let i = e[n];
|
|
1526
|
+
if (typeof i == "string") {
|
|
1527
|
+
const o = t(i);
|
|
1528
|
+
o !== i && (yi(e) || (e[n] = o), i = o);
|
|
1529
1529
|
}
|
|
1530
|
-
l[
|
|
1530
|
+
l[i] = !0;
|
|
1531
1531
|
}
|
|
1532
1532
|
return l;
|
|
1533
1533
|
}
|
|
@@ -1551,7 +1551,7 @@ function Te(l, e) {
|
|
|
1551
1551
|
if (typeof n.value == "function")
|
|
1552
1552
|
return N(n.value);
|
|
1553
1553
|
}
|
|
1554
|
-
l =
|
|
1554
|
+
l = Ai(l);
|
|
1555
1555
|
}
|
|
1556
1556
|
function t() {
|
|
1557
1557
|
return null;
|
|
@@ -1591,16 +1591,16 @@ const be = {
|
|
|
1591
1591
|
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
1592
1592
|
return null;
|
|
1593
1593
|
let n = null;
|
|
1594
|
-
const
|
|
1595
|
-
t && t.hasAttribute(
|
|
1594
|
+
const i = "data-tt-policy-suffix";
|
|
1595
|
+
t && t.hasAttribute(i) && (n = t.getAttribute(i));
|
|
1596
1596
|
const o = "dompurify" + (n ? "#" + n : "");
|
|
1597
1597
|
try {
|
|
1598
1598
|
return e.createPolicy(o, {
|
|
1599
|
-
createHTML(
|
|
1600
|
-
return
|
|
1599
|
+
createHTML(s) {
|
|
1600
|
+
return s;
|
|
1601
1601
|
},
|
|
1602
|
-
createScriptURL(
|
|
1603
|
-
return
|
|
1602
|
+
createScriptURL(s) {
|
|
1603
|
+
return s;
|
|
1604
1604
|
}
|
|
1605
1605
|
});
|
|
1606
1606
|
} catch {
|
|
@@ -1627,9 +1627,9 @@ function _n() {
|
|
|
1627
1627
|
let {
|
|
1628
1628
|
document: t
|
|
1629
1629
|
} = l;
|
|
1630
|
-
const n = t,
|
|
1630
|
+
const n = t, i = n.currentScript, {
|
|
1631
1631
|
DocumentFragment: o,
|
|
1632
|
-
HTMLTemplateElement:
|
|
1632
|
+
HTMLTemplateElement: s,
|
|
1633
1633
|
Node: a,
|
|
1634
1634
|
Element: c,
|
|
1635
1635
|
NodeFilter: d,
|
|
@@ -1637,8 +1637,8 @@ function _n() {
|
|
|
1637
1637
|
HTMLFormElement: m,
|
|
1638
1638
|
DOMParser: g,
|
|
1639
1639
|
trustedTypes: T
|
|
1640
|
-
} = l, v = c.prototype, P = Te(v, "cloneNode"), Z = Te(v, "remove"), ue = Te(v, "nextSibling"),
|
|
1641
|
-
if (typeof
|
|
1640
|
+
} = l, v = c.prototype, P = Te(v, "cloneNode"), Z = Te(v, "remove"), ue = Te(v, "nextSibling"), ye = Te(v, "childNodes"), V = Te(v, "parentNode");
|
|
1641
|
+
if (typeof s == "function") {
|
|
1642
1642
|
const f = t.createElement("template");
|
|
1643
1643
|
f.content && f.content.ownerDocument && (t = f.content.ownerDocument);
|
|
1644
1644
|
}
|
|
@@ -1646,8 +1646,8 @@ function _n() {
|
|
|
1646
1646
|
const {
|
|
1647
1647
|
implementation: Be,
|
|
1648
1648
|
createNodeIterator: En,
|
|
1649
|
-
createDocumentFragment:
|
|
1650
|
-
getElementsByTagName:
|
|
1649
|
+
createDocumentFragment: yn,
|
|
1650
|
+
getElementsByTagName: An
|
|
1651
1651
|
} = t, {
|
|
1652
1652
|
importNode: Sn
|
|
1653
1653
|
} = n;
|
|
@@ -1666,9 +1666,9 @@ function _n() {
|
|
|
1666
1666
|
let {
|
|
1667
1667
|
IS_ALLOWED_URI: Et
|
|
1668
1668
|
} = on, R = null;
|
|
1669
|
-
const
|
|
1669
|
+
const yt = k({}, [...tn, ...ot, ...lt, ...at, ...nn]);
|
|
1670
1670
|
let L = null;
|
|
1671
|
-
const
|
|
1671
|
+
const At = k({}, [...sn, ...ct, ...rn, ...ze]);
|
|
1672
1672
|
let E = Object.seal(ht(null, {
|
|
1673
1673
|
tagNameCheck: {
|
|
1674
1674
|
writable: !0,
|
|
@@ -1703,7 +1703,7 @@ function _n() {
|
|
|
1703
1703
|
value: null
|
|
1704
1704
|
}
|
|
1705
1705
|
}));
|
|
1706
|
-
let St = !0, Ye = !0, Rt = !1, Lt = !0, se = !1,
|
|
1706
|
+
let St = !0, Ye = !0, Rt = !1, Lt = !0, se = !1, Ae = !0, K = !1, je = !1, Xe = !1, re = !1, Se = !1, Re = !1, It = !0, Ot = !1;
|
|
1707
1707
|
const Dn = "user-content-";
|
|
1708
1708
|
let Qe = !0, he = !1, oe = {}, H = null;
|
|
1709
1709
|
const Ve = k({}, ["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"]);
|
|
@@ -1717,44 +1717,44 @@ function _n() {
|
|
|
1717
1717
|
const Mn = k({}, ["title", "style", "font", "a", "script"]);
|
|
1718
1718
|
let fe = null;
|
|
1719
1719
|
const Nn = ["application/xhtml+xml", "text/html"], vn = "text/html";
|
|
1720
|
-
let
|
|
1721
|
-
const zn = t.createElement("form"), Nt = function(
|
|
1722
|
-
return
|
|
1720
|
+
let A = null, ae = null;
|
|
1721
|
+
const zn = t.createElement("form"), Nt = function(r) {
|
|
1722
|
+
return r instanceof RegExp || r instanceof Function;
|
|
1723
1723
|
}, tt = function() {
|
|
1724
|
-
let
|
|
1725
|
-
if (!(ae && ae ===
|
|
1726
|
-
if ((!
|
|
1727
|
-
Nn.indexOf(
|
|
1728
|
-
if (typeof
|
|
1724
|
+
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1725
|
+
if (!(ae && ae === r)) {
|
|
1726
|
+
if ((!r || typeof r != "object") && (r = {}), r = G(r), fe = // eslint-disable-next-line unicorn/prefer-includes
|
|
1727
|
+
Nn.indexOf(r.PARSER_MEDIA_TYPE) === -1 ? vn : r.PARSER_MEDIA_TYPE, A = fe === "application/xhtml+xml" ? st : Pe, R = F(r, "ALLOWED_TAGS") ? k({}, r.ALLOWED_TAGS, A) : yt, L = F(r, "ALLOWED_ATTR") ? k({}, r.ALLOWED_ATTR, A) : At, et = F(r, "ALLOWED_NAMESPACES") ? k({}, r.ALLOWED_NAMESPACES, st) : Cn, Ke = F(r, "ADD_URI_SAFE_ATTR") ? k(G(Mt), r.ADD_URI_SAFE_ATTR, A) : Mt, Dt = F(r, "ADD_DATA_URI_TAGS") ? k(G(Ct), r.ADD_DATA_URI_TAGS, A) : Ct, H = F(r, "FORBID_CONTENTS") ? k({}, r.FORBID_CONTENTS, A) : Ve, pe = F(r, "FORBID_TAGS") ? k({}, r.FORBID_TAGS, A) : G({}), Ze = F(r, "FORBID_ATTR") ? k({}, r.FORBID_ATTR, A) : G({}), oe = F(r, "USE_PROFILES") ? r.USE_PROFILES : !1, St = r.ALLOW_ARIA_ATTR !== !1, Ye = r.ALLOW_DATA_ATTR !== !1, Rt = r.ALLOW_UNKNOWN_PROTOCOLS || !1, Lt = r.ALLOW_SELF_CLOSE_IN_ATTR !== !1, se = r.SAFE_FOR_TEMPLATES || !1, Ae = r.SAFE_FOR_XML !== !1, K = r.WHOLE_DOCUMENT || !1, re = r.RETURN_DOM || !1, Se = r.RETURN_DOM_FRAGMENT || !1, Re = r.RETURN_TRUSTED_TYPE || !1, Xe = r.FORCE_BODY || !1, It = r.SANITIZE_DOM !== !1, Ot = r.SANITIZE_NAMED_PROPS || !1, Qe = r.KEEP_CONTENT !== !1, he = r.IN_PLACE || !1, Et = r.ALLOWED_URI_REGEXP || xn, le = r.NAMESPACE || j, Oe = r.MATHML_TEXT_INTEGRATION_POINTS || Oe, De = r.HTML_INTEGRATION_POINTS || De, E = r.CUSTOM_ELEMENT_HANDLING || {}, r.CUSTOM_ELEMENT_HANDLING && Nt(r.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = r.CUSTOM_ELEMENT_HANDLING.tagNameCheck), r.CUSTOM_ELEMENT_HANDLING && Nt(r.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (E.attributeNameCheck = r.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), r.CUSTOM_ELEMENT_HANDLING && typeof r.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = r.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), se && (Ye = !1), Se && (re = !0), oe && (R = k({}, nn), L = [], oe.html === !0 && (k(R, tn), k(L, sn)), oe.svg === !0 && (k(R, ot), k(L, ct), k(L, ze)), oe.svgFilters === !0 && (k(R, lt), k(L, ct), k(L, ze)), oe.mathMl === !0 && (k(R, at), k(L, rn), k(L, ze))), r.ADD_TAGS && (typeof r.ADD_TAGS == "function" ? ie.tagCheck = r.ADD_TAGS : (R === yt && (R = G(R)), k(R, r.ADD_TAGS, A))), r.ADD_ATTR && (typeof r.ADD_ATTR == "function" ? ie.attributeCheck = r.ADD_ATTR : (L === At && (L = G(L)), k(L, r.ADD_ATTR, A))), r.ADD_URI_SAFE_ATTR && k(Ke, r.ADD_URI_SAFE_ATTR, A), r.FORBID_CONTENTS && (H === Ve && (H = G(H)), k(H, r.FORBID_CONTENTS, A)), r.ADD_FORBID_CONTENTS && (H === Ve && (H = G(H)), k(H, r.ADD_FORBID_CONTENTS, A)), Qe && (R["#text"] = !0), K && k(R, ["html", "head", "body"]), R.table && (k(R, ["tbody"]), delete pe.tbody), r.TRUSTED_TYPES_POLICY) {
|
|
1728
|
+
if (typeof r.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
1729
1729
|
throw ke('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
1730
|
-
if (typeof
|
|
1730
|
+
if (typeof r.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
1731
1731
|
throw ke('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
1732
|
-
S =
|
|
1732
|
+
S = r.TRUSTED_TYPES_POLICY, Y = S.createHTML("");
|
|
1733
1733
|
} else
|
|
1734
|
-
S === void 0 && (S = Wi(T,
|
|
1735
|
-
M && M(
|
|
1734
|
+
S === void 0 && (S = Wi(T, i)), S !== null && typeof Y == "string" && (Y = S.createHTML(""));
|
|
1735
|
+
M && M(r), ae = r;
|
|
1736
1736
|
}
|
|
1737
|
-
}, vt = k({}, [...ot, ...lt, ...Mi]), zt = k({}, [...at, ...Ni]), Pn = function(
|
|
1738
|
-
let u = V(
|
|
1737
|
+
}, vt = k({}, [...ot, ...lt, ...Mi]), zt = k({}, [...at, ...Ni]), Pn = function(r) {
|
|
1738
|
+
let u = V(r);
|
|
1739
1739
|
(!u || !u.tagName) && (u = {
|
|
1740
1740
|
namespaceURI: le,
|
|
1741
1741
|
tagName: "template"
|
|
1742
1742
|
});
|
|
1743
|
-
const p = Pe(
|
|
1744
|
-
return et[
|
|
1745
|
-
}, B = function(
|
|
1743
|
+
const p = Pe(r.tagName), _ = Pe(u.tagName);
|
|
1744
|
+
return et[r.namespaceURI] ? r.namespaceURI === Ie ? u.namespaceURI === j ? p === "svg" : u.namespaceURI === Le ? p === "svg" && (_ === "annotation-xml" || Oe[_]) : !!vt[p] : r.namespaceURI === Le ? u.namespaceURI === j ? p === "math" : u.namespaceURI === Ie ? p === "math" && De[_] : !!zt[p] : r.namespaceURI === j ? u.namespaceURI === Ie && !De[_] || u.namespaceURI === Le && !Oe[_] ? !1 : !zt[p] && (Mn[p] || !vt[p]) : !!(fe === "application/xhtml+xml" && et[r.namespaceURI]) : !1;
|
|
1745
|
+
}, B = function(r) {
|
|
1746
1746
|
ge(e.removed, {
|
|
1747
|
-
element:
|
|
1747
|
+
element: r
|
|
1748
1748
|
});
|
|
1749
1749
|
try {
|
|
1750
|
-
V(
|
|
1750
|
+
V(r).removeChild(r);
|
|
1751
1751
|
} catch {
|
|
1752
|
-
Z(
|
|
1752
|
+
Z(r);
|
|
1753
1753
|
}
|
|
1754
|
-
}, J = function(
|
|
1754
|
+
}, J = function(r, u) {
|
|
1755
1755
|
try {
|
|
1756
1756
|
ge(e.removed, {
|
|
1757
|
-
attribute: u.getAttributeNode(
|
|
1757
|
+
attribute: u.getAttributeNode(r),
|
|
1758
1758
|
from: u
|
|
1759
1759
|
});
|
|
1760
1760
|
} catch {
|
|
@@ -1763,7 +1763,7 @@ function _n() {
|
|
|
1763
1763
|
from: u
|
|
1764
1764
|
});
|
|
1765
1765
|
}
|
|
1766
|
-
if (u.removeAttribute(
|
|
1766
|
+
if (u.removeAttribute(r), r === "is")
|
|
1767
1767
|
if (re || Se)
|
|
1768
1768
|
try {
|
|
1769
1769
|
B(u);
|
|
@@ -1771,19 +1771,19 @@ function _n() {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
else
|
|
1773
1773
|
try {
|
|
1774
|
-
u.setAttribute(
|
|
1774
|
+
u.setAttribute(r, "");
|
|
1775
1775
|
} catch {
|
|
1776
1776
|
}
|
|
1777
|
-
}, Pt = function(
|
|
1777
|
+
}, Pt = function(r) {
|
|
1778
1778
|
let u = null, p = null;
|
|
1779
1779
|
if (Xe)
|
|
1780
|
-
|
|
1780
|
+
r = "<remove></remove>" + r;
|
|
1781
1781
|
else {
|
|
1782
|
-
const
|
|
1783
|
-
p =
|
|
1782
|
+
const y = rt(r, /^[\r\n\t ]+/);
|
|
1783
|
+
p = y && y[0];
|
|
1784
1784
|
}
|
|
1785
|
-
fe === "application/xhtml+xml" && le === j && (
|
|
1786
|
-
const _ = S ? S.createHTML(
|
|
1785
|
+
fe === "application/xhtml+xml" && le === j && (r = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + r + "</body></html>");
|
|
1786
|
+
const _ = S ? S.createHTML(r) : r;
|
|
1787
1787
|
if (le === j)
|
|
1788
1788
|
try {
|
|
1789
1789
|
u = new g().parseFromString(_, fe);
|
|
@@ -1797,73 +1797,73 @@ function _n() {
|
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
1799
|
const O = u.body || u.documentElement;
|
|
1800
|
-
return
|
|
1801
|
-
}, $t = function(
|
|
1800
|
+
return r && p && O.insertBefore(t.createTextNode(p), O.childNodes[0] || null), le === j ? An.call(u, K ? "html" : "body")[0] : K ? u.documentElement : O;
|
|
1801
|
+
}, $t = function(r) {
|
|
1802
1802
|
return En.call(
|
|
1803
|
-
|
|
1804
|
-
|
|
1803
|
+
r.ownerDocument || r,
|
|
1804
|
+
r,
|
|
1805
1805
|
// eslint-disable-next-line no-bitwise
|
|
1806
1806
|
d.SHOW_ELEMENT | d.SHOW_COMMENT | d.SHOW_TEXT | d.SHOW_PROCESSING_INSTRUCTION | d.SHOW_CDATA_SECTION,
|
|
1807
1807
|
null
|
|
1808
1808
|
);
|
|
1809
|
-
}, nt = function(
|
|
1810
|
-
return
|
|
1811
|
-
}, Ut = function(
|
|
1812
|
-
return typeof a == "function" &&
|
|
1809
|
+
}, nt = function(r) {
|
|
1810
|
+
return r instanceof m && (typeof r.nodeName != "string" || typeof r.textContent != "string" || typeof r.removeChild != "function" || !(r.attributes instanceof h) || typeof r.removeAttribute != "function" || typeof r.setAttribute != "function" || typeof r.namespaceURI != "string" || typeof r.insertBefore != "function" || typeof r.hasChildNodes != "function");
|
|
1811
|
+
}, Ut = function(r) {
|
|
1812
|
+
return typeof a == "function" && r instanceof a;
|
|
1813
1813
|
};
|
|
1814
|
-
function X(f,
|
|
1814
|
+
function X(f, r, u) {
|
|
1815
1815
|
ve(f, (p) => {
|
|
1816
|
-
p.call(e,
|
|
1816
|
+
p.call(e, r, u, ae);
|
|
1817
1817
|
});
|
|
1818
1818
|
}
|
|
1819
|
-
const Ft = function(
|
|
1819
|
+
const Ft = function(r) {
|
|
1820
1820
|
let u = null;
|
|
1821
|
-
if (X(D.beforeSanitizeElements,
|
|
1822
|
-
return B(
|
|
1823
|
-
const p =
|
|
1824
|
-
if (X(D.uponSanitizeElement,
|
|
1821
|
+
if (X(D.beforeSanitizeElements, r, null), nt(r))
|
|
1822
|
+
return B(r), !0;
|
|
1823
|
+
const p = A(r.nodeName);
|
|
1824
|
+
if (X(D.uponSanitizeElement, r, {
|
|
1825
1825
|
tagName: p,
|
|
1826
1826
|
allowedTags: R
|
|
1827
|
-
}),
|
|
1828
|
-
return B(
|
|
1827
|
+
}), Ae && r.hasChildNodes() && !Ut(r.firstElementChild) && C(/<[/\w!]/g, r.innerHTML) && C(/<[/\w!]/g, r.textContent) || r.nodeType === be.progressingInstruction || Ae && r.nodeType === be.comment && C(/<[/\w]/g, r.data))
|
|
1828
|
+
return B(r), !0;
|
|
1829
1829
|
if (!(ie.tagCheck instanceof Function && ie.tagCheck(p)) && (!R[p] || pe[p])) {
|
|
1830
1830
|
if (!pe[p] && Bt(p) && (E.tagNameCheck instanceof RegExp && C(E.tagNameCheck, p) || E.tagNameCheck instanceof Function && E.tagNameCheck(p)))
|
|
1831
1831
|
return !1;
|
|
1832
1832
|
if (Qe && !H[p]) {
|
|
1833
|
-
const _ = V(
|
|
1833
|
+
const _ = V(r) || r.parentNode, O = ye(r) || r.childNodes;
|
|
1834
1834
|
if (O && _) {
|
|
1835
|
-
const
|
|
1836
|
-
for (let z =
|
|
1835
|
+
const y = O.length;
|
|
1836
|
+
for (let z = y - 1; z >= 0; --z) {
|
|
1837
1837
|
const Q = P(O[z], !0);
|
|
1838
|
-
Q.__removalCount = (
|
|
1838
|
+
Q.__removalCount = (r.__removalCount || 0) + 1, _.insertBefore(Q, ue(r));
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
|
-
return B(
|
|
1842
|
+
return B(r), !0;
|
|
1843
1843
|
}
|
|
1844
|
-
return
|
|
1844
|
+
return r instanceof c && !Pn(r) || (p === "noscript" || p === "noembed" || p === "noframes") && C(/<\/no(script|embed|frames)/i, r.innerHTML) ? (B(r), !0) : (se && r.nodeType === be.text && (u = r.textContent, ve([Ge, We, qe], (_) => {
|
|
1845
1845
|
u = me(u, _, " ");
|
|
1846
|
-
}),
|
|
1847
|
-
element:
|
|
1848
|
-
}),
|
|
1849
|
-
}, Ht = function(
|
|
1846
|
+
}), r.textContent !== u && (ge(e.removed, {
|
|
1847
|
+
element: r.cloneNode()
|
|
1848
|
+
}), r.textContent = u)), X(D.afterSanitizeElements, r, null), !1);
|
|
1849
|
+
}, Ht = function(r, u, p) {
|
|
1850
1850
|
if (It && (u === "id" || u === "name") && (p in t || p in zn))
|
|
1851
1851
|
return !1;
|
|
1852
1852
|
if (!(Ye && !Ze[u] && C(Rn, u))) {
|
|
1853
1853
|
if (!(St && C(Ln, u))) {
|
|
1854
|
-
if (!(ie.attributeCheck instanceof Function && ie.attributeCheck(u,
|
|
1854
|
+
if (!(ie.attributeCheck instanceof Function && ie.attributeCheck(u, r))) {
|
|
1855
1855
|
if (!L[u] || Ze[u]) {
|
|
1856
1856
|
if (
|
|
1857
1857
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1858
1858
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1859
1859
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1860
|
-
!(Bt(
|
|
1860
|
+
!(Bt(r) && (E.tagNameCheck instanceof RegExp && C(E.tagNameCheck, r) || E.tagNameCheck instanceof Function && E.tagNameCheck(r)) && (E.attributeNameCheck instanceof RegExp && C(E.attributeNameCheck, u) || E.attributeNameCheck instanceof Function && E.attributeNameCheck(u, r)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1861
1861
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1862
1862
|
u === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && C(E.tagNameCheck, p) || E.tagNameCheck instanceof Function && E.tagNameCheck(p)))
|
|
1863
1863
|
) return !1;
|
|
1864
1864
|
} else if (!Ke[u]) {
|
|
1865
1865
|
if (!C(Et, me(p, _t, ""))) {
|
|
1866
|
-
if (!((u === "src" || u === "xlink:href" || u === "href") &&
|
|
1866
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && r !== "script" && Ii(p, "data:") === 0 && Dt[r])) {
|
|
1867
1867
|
if (!(Rt && !C(In, me(p, _t, "")))) {
|
|
1868
1868
|
if (p)
|
|
1869
1869
|
return !1;
|
|
@@ -1875,14 +1875,14 @@ function _n() {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
return !0;
|
|
1878
|
-
}, Bt = function(
|
|
1879
|
-
return
|
|
1880
|
-
}, Gt = function(
|
|
1881
|
-
X(D.beforeSanitizeAttributes,
|
|
1878
|
+
}, Bt = function(r) {
|
|
1879
|
+
return r !== "annotation-xml" && rt(r, On);
|
|
1880
|
+
}, Gt = function(r) {
|
|
1881
|
+
X(D.beforeSanitizeAttributes, r, null);
|
|
1882
1882
|
const {
|
|
1883
1883
|
attributes: u
|
|
1884
|
-
} =
|
|
1885
|
-
if (!u || nt(
|
|
1884
|
+
} = r;
|
|
1885
|
+
if (!u || nt(r))
|
|
1886
1886
|
return;
|
|
1887
1887
|
const p = {
|
|
1888
1888
|
attrName: "",
|
|
@@ -1894,35 +1894,35 @@ function _n() {
|
|
|
1894
1894
|
let _ = u.length;
|
|
1895
1895
|
for (; _--; ) {
|
|
1896
1896
|
const O = u[_], {
|
|
1897
|
-
name:
|
|
1897
|
+
name: y,
|
|
1898
1898
|
namespaceURI: z,
|
|
1899
1899
|
value: Q
|
|
1900
|
-
} = O, ce = y
|
|
1901
|
-
let I =
|
|
1902
|
-
if (p.attrName = ce, p.attrValue = I, p.keepAttr = !0, p.forceKeepAttr = void 0, X(D.uponSanitizeAttribute,
|
|
1903
|
-
J(
|
|
1900
|
+
} = O, ce = A(y), it = Q;
|
|
1901
|
+
let I = y === "value" ? it : Oi(it);
|
|
1902
|
+
if (p.attrName = ce, p.attrValue = I, p.keepAttr = !0, p.forceKeepAttr = void 0, X(D.uponSanitizeAttribute, r, p), I = p.attrValue, Ot && (ce === "id" || ce === "name") && (J(y, r), I = Dn + I), Ae && C(/((--!?|])>)|<\/(style|title|textarea)/i, I)) {
|
|
1903
|
+
J(y, r);
|
|
1904
1904
|
continue;
|
|
1905
1905
|
}
|
|
1906
1906
|
if (ce === "attributename" && rt(I, "href")) {
|
|
1907
|
-
J(
|
|
1907
|
+
J(y, r);
|
|
1908
1908
|
continue;
|
|
1909
1909
|
}
|
|
1910
1910
|
if (p.forceKeepAttr)
|
|
1911
1911
|
continue;
|
|
1912
1912
|
if (!p.keepAttr) {
|
|
1913
|
-
J(
|
|
1913
|
+
J(y, r);
|
|
1914
1914
|
continue;
|
|
1915
1915
|
}
|
|
1916
1916
|
if (!Lt && C(/\/>/i, I)) {
|
|
1917
|
-
J(
|
|
1917
|
+
J(y, r);
|
|
1918
1918
|
continue;
|
|
1919
1919
|
}
|
|
1920
1920
|
se && ve([Ge, We, qe], (qt) => {
|
|
1921
1921
|
I = me(I, qt, " ");
|
|
1922
1922
|
});
|
|
1923
|
-
const Wt =
|
|
1923
|
+
const Wt = A(r.nodeName);
|
|
1924
1924
|
if (!Ht(Wt, ce, I)) {
|
|
1925
|
-
J(
|
|
1925
|
+
J(y, r);
|
|
1926
1926
|
continue;
|
|
1927
1927
|
}
|
|
1928
1928
|
if (S && typeof T == "object" && typeof T.getAttributeType == "function" && !z)
|
|
@@ -1938,21 +1938,21 @@ function _n() {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
if (I !== it)
|
|
1940
1940
|
try {
|
|
1941
|
-
z ?
|
|
1941
|
+
z ? r.setAttributeNS(z, y, I) : r.setAttribute(y, I), nt(r) ? B(r) : en(e.removed);
|
|
1942
1942
|
} catch {
|
|
1943
|
-
J(
|
|
1943
|
+
J(y, r);
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
|
-
X(D.afterSanitizeAttributes,
|
|
1947
|
-
}, $n = function f(
|
|
1946
|
+
X(D.afterSanitizeAttributes, r, null);
|
|
1947
|
+
}, $n = function f(r) {
|
|
1948
1948
|
let u = null;
|
|
1949
|
-
const p = $t(
|
|
1950
|
-
for (X(D.beforeSanitizeShadowDOM,
|
|
1949
|
+
const p = $t(r);
|
|
1950
|
+
for (X(D.beforeSanitizeShadowDOM, r, null); u = p.nextNode(); )
|
|
1951
1951
|
X(D.uponSanitizeShadowNode, u, null), Ft(u), Gt(u), u.content instanceof o && f(u.content);
|
|
1952
|
-
X(D.afterSanitizeShadowDOM,
|
|
1952
|
+
X(D.afterSanitizeShadowDOM, r, null);
|
|
1953
1953
|
};
|
|
1954
1954
|
return e.sanitize = function(f) {
|
|
1955
|
-
let
|
|
1955
|
+
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, p = null, _ = null, O = null;
|
|
1956
1956
|
if (Je = !f, Je && (f = "<!-->"), typeof f != "string" && !Ut(f))
|
|
1957
1957
|
if (typeof f.toString == "function") {
|
|
1958
1958
|
if (f = f.toString(), typeof f != "string")
|
|
@@ -1961,9 +1961,9 @@ function _n() {
|
|
|
1961
1961
|
throw ke("toString is not a function");
|
|
1962
1962
|
if (!e.isSupported)
|
|
1963
1963
|
return f;
|
|
1964
|
-
if (je || tt(
|
|
1964
|
+
if (je || tt(r), e.removed = [], typeof f == "string" && (he = !1), he) {
|
|
1965
1965
|
if (f.nodeName) {
|
|
1966
|
-
const Q =
|
|
1966
|
+
const Q = A(f.nodeName);
|
|
1967
1967
|
if (!R[Q] || pe[Q])
|
|
1968
1968
|
throw ke("root node is forbidden and cannot be sanitized in-place");
|
|
1969
1969
|
}
|
|
@@ -1977,14 +1977,14 @@ function _n() {
|
|
|
1977
1977
|
return re ? null : Re ? Y : "";
|
|
1978
1978
|
}
|
|
1979
1979
|
u && Xe && B(u.firstChild);
|
|
1980
|
-
const
|
|
1981
|
-
for (; _ =
|
|
1980
|
+
const y = $t(he ? f : u);
|
|
1981
|
+
for (; _ = y.nextNode(); )
|
|
1982
1982
|
Ft(_), Gt(_), _.content instanceof o && $n(_.content);
|
|
1983
1983
|
if (he)
|
|
1984
1984
|
return f;
|
|
1985
1985
|
if (re) {
|
|
1986
1986
|
if (Se)
|
|
1987
|
-
for (O =
|
|
1987
|
+
for (O = yn.call(u.ownerDocument); u.firstChild; )
|
|
1988
1988
|
O.appendChild(u.firstChild);
|
|
1989
1989
|
else
|
|
1990
1990
|
O = u;
|
|
@@ -2000,15 +2000,15 @@ function _n() {
|
|
|
2000
2000
|
tt(f), je = !0;
|
|
2001
2001
|
}, e.clearConfig = function() {
|
|
2002
2002
|
ae = null, je = !1;
|
|
2003
|
-
}, e.isValidAttribute = function(f,
|
|
2003
|
+
}, e.isValidAttribute = function(f, r, u) {
|
|
2004
2004
|
ae || tt({});
|
|
2005
|
-
const p =
|
|
2005
|
+
const p = A(f), _ = A(r);
|
|
2006
2006
|
return Ht(p, _, u);
|
|
2007
|
-
}, e.addHook = function(f,
|
|
2008
|
-
typeof
|
|
2009
|
-
}, e.removeHook = function(f,
|
|
2010
|
-
if (
|
|
2011
|
-
const u = Ri(D[f],
|
|
2007
|
+
}, e.addHook = function(f, r) {
|
|
2008
|
+
typeof r == "function" && ge(D[f], r);
|
|
2009
|
+
}, e.removeHook = function(f, r) {
|
|
2010
|
+
if (r !== void 0) {
|
|
2011
|
+
const u = Ri(D[f], r);
|
|
2012
2012
|
return u === -1 ? void 0 : Li(D[f], u, 1)[0];
|
|
2013
2013
|
}
|
|
2014
2014
|
return en(D[f]);
|
|
@@ -2028,13 +2028,11 @@ class Zi {
|
|
|
2028
2028
|
b(this, "sendBtn");
|
|
2029
2029
|
b(this, "isOpen", !1);
|
|
2030
2030
|
b(this, "history", []);
|
|
2031
|
-
// 维护前端历史记录
|
|
2032
2031
|
b(this, "config");
|
|
2033
2032
|
this.config = {
|
|
2034
2033
|
title: "企业智能助手",
|
|
2035
2034
|
welcomeMessage: "您好,有什么可以帮您?",
|
|
2036
2035
|
provider: "google",
|
|
2037
|
-
// 默认值
|
|
2038
2036
|
...e
|
|
2039
2037
|
}, this.initDOM();
|
|
2040
2038
|
}
|
|
@@ -2066,32 +2064,42 @@ class Zi {
|
|
|
2066
2064
|
const e = this.input.value.trim();
|
|
2067
2065
|
if (!e) return;
|
|
2068
2066
|
this.input.value = "", this.appendMessage(e, "user"), this.setLoading(!0);
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2067
|
+
const n = this.appendMessage(`
|
|
2068
|
+
<div class="lee-ai-typing">
|
|
2069
|
+
<div class="lee-ai-dot"></div>
|
|
2070
|
+
<div class="lee-ai-dot"></div>
|
|
2071
|
+
<div class="lee-ai-dot"></div>
|
|
2072
|
+
</div>
|
|
2073
|
+
`, "model", !0);
|
|
2074
|
+
let i = "", o = !0;
|
|
2071
2075
|
await Bn(
|
|
2072
2076
|
this.config,
|
|
2073
2077
|
this.history,
|
|
2074
2078
|
e,
|
|
2075
|
-
(
|
|
2076
|
-
n +=
|
|
2079
|
+
(s) => {
|
|
2080
|
+
o && (n.innerHTML = "", o = !1), i += s, n.innerHTML = qi.sanitize(x.parse(i)), this.scrollToBottom();
|
|
2077
2081
|
},
|
|
2078
2082
|
() => {
|
|
2079
|
-
this.setLoading(!1), this.history.push({ role: "user", parts: [{ text: e }] }), this.history.push({ role: "model", parts: [{ text:
|
|
2083
|
+
this.setLoading(!1), this.history.push({ role: "user", parts: [{ text: e }] }), this.history.push({ role: "model", parts: [{ text: i }] }), i === "" && (n.innerHTML = "(无内容)");
|
|
2080
2084
|
},
|
|
2081
|
-
(
|
|
2082
|
-
|
|
2085
|
+
(s) => {
|
|
2086
|
+
n.innerHTML = `<span style="color:#ff6b6b">系统错误: ${s}</span>`, this.setLoading(!1);
|
|
2083
2087
|
}
|
|
2084
2088
|
);
|
|
2085
2089
|
}
|
|
2086
|
-
appendMessage
|
|
2087
|
-
|
|
2088
|
-
|
|
2090
|
+
// 修改 appendMessage 方法,支持直接插入 HTML
|
|
2091
|
+
appendMessage(e, t, n = !1) {
|
|
2092
|
+
const i = document.createElement("div");
|
|
2093
|
+
return i.className = `lee-ai-msg ${t}`, t === "user" ? i.innerText = e : n ? i.innerHTML = e : i.innerText = e, this.messagesDiv.appendChild(i), this.scrollToBottom(), i;
|
|
2089
2094
|
}
|
|
2090
2095
|
scrollToBottom() {
|
|
2091
|
-
this.messagesDiv.
|
|
2096
|
+
this.messagesDiv.scrollTo({
|
|
2097
|
+
top: this.messagesDiv.scrollHeight,
|
|
2098
|
+
behavior: "smooth"
|
|
2099
|
+
});
|
|
2092
2100
|
}
|
|
2093
2101
|
setLoading(e) {
|
|
2094
|
-
this.sendBtn.disabled = e, this.sendBtn.
|
|
2102
|
+
this.sendBtn.disabled = e, this.sendBtn.style.opacity = e ? "0.6" : "1", this.sendBtn.style.cursor = e ? "not-allowed" : "pointer", this.input.disabled = e, e || setTimeout(() => this.input.focus(), 100);
|
|
2095
2103
|
}
|
|
2096
2104
|
}
|
|
2097
2105
|
window.LeeAI = {
|