hanbiro-react16-sdk 1.0.0 → 1.0.2
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/README.md +88 -0
- package/dist/components/ChatAIDraft/List.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{index-DuSzMCvF.mjs → index-BB9T_tBw.mjs} +396 -347
- package/dist/index.js +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/url.d.ts +10 -0
- package/package.json +5 -5
|
@@ -76,15 +76,15 @@ async function Ae(n, { setContent: e, setIsLoading: t, setConversationId: r, sig
|
|
|
76
76
|
let c = "";
|
|
77
77
|
try {
|
|
78
78
|
t(!0);
|
|
79
|
-
const
|
|
79
|
+
const a = {
|
|
80
80
|
method: "POST",
|
|
81
81
|
baseURL: s,
|
|
82
82
|
url: "/nmail/chatdraft",
|
|
83
83
|
params: n
|
|
84
84
|
};
|
|
85
85
|
let h = {};
|
|
86
|
-
i && typeof i.generateHeaders == "function" && (h = await i.generateHeaders(
|
|
87
|
-
const
|
|
86
|
+
i && typeof i.generateHeaders == "function" && (h = await i.generateHeaders(a));
|
|
87
|
+
const l = await fetch(`${s}/nmail/chatdraft`, {
|
|
88
88
|
method: "POST",
|
|
89
89
|
body: JSON.stringify(n),
|
|
90
90
|
headers: {
|
|
@@ -93,9 +93,9 @@ async function Ae(n, { setContent: e, setIsLoading: t, setConversationId: r, sig
|
|
|
93
93
|
...h
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
-
if (t(!1), !
|
|
96
|
+
if (t(!1), !l.body)
|
|
97
97
|
throw new Error("Response body is not available for streaming.");
|
|
98
|
-
const o =
|
|
98
|
+
const o = l.body.getReader();
|
|
99
99
|
let d = "", p = 0;
|
|
100
100
|
for (; ; ) {
|
|
101
101
|
const { done: x, value: f } = await o.read();
|
|
@@ -124,8 +124,8 @@ async function Ae(n, { setContent: e, setIsLoading: t, setConversationId: r, sig
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
return c;
|
|
127
|
-
} catch (
|
|
128
|
-
console.error("Summary error:",
|
|
127
|
+
} catch (a) {
|
|
128
|
+
console.error("Summary error:", a), e("");
|
|
129
129
|
} finally {
|
|
130
130
|
t(!1);
|
|
131
131
|
}
|
|
@@ -221,8 +221,8 @@ var w = {
|
|
|
221
221
|
}, Ie = /^(?:[ \t]*(?:\n|$))+/, Le = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, _e = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, q = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, V = /(?:[*+-]|\d{1,9}[.)])/, ge = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, de = k(ge).replace(/bull/g, V).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(), Be = k(ge).replace(/bull/g, V).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(), X = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, De = /^[^\n]+/, Y = /(?!\s*\])(?:\\.|[^\[\]\\])+/, qe = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Y).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Me = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, V).getRegex(), H = "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", ee = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Oe = k(
|
|
222
222
|
"^ {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|$))",
|
|
223
223
|
"i"
|
|
224
|
-
).replace("comment", ee).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), fe = k(X).replace("hr", q).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(),
|
|
225
|
-
blockquote:
|
|
224
|
+
).replace("comment", ee).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), fe = k(X).replace("hr", q).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Ne = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", fe).getRegex(), te = {
|
|
225
|
+
blockquote: Ne,
|
|
226
226
|
code: Le,
|
|
227
227
|
def: qe,
|
|
228
228
|
fences: _e,
|
|
@@ -237,7 +237,7 @@ var w = {
|
|
|
237
237
|
text: De
|
|
238
238
|
}, se = k(
|
|
239
239
|
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
240
|
-
).replace("hr", q).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(),
|
|
240
|
+
).replace("hr", q).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), je = {
|
|
241
241
|
...te,
|
|
242
242
|
lheading: Be,
|
|
243
243
|
table: se,
|
|
@@ -259,7 +259,7 @@ var w = {
|
|
|
259
259
|
"gu"
|
|
260
260
|
).replace(/notPunctSpace/g, ke).replace(/punctSpace/g, ne).replace(/punct/g, G).getRegex(), tt = k(/\\(punct)/, "gu").replace(/punct/g, G).getRegex(), nt = k(/^<(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(), rt = k(ee).replace("(?:-->|$)", "-->").getRegex(), it = k(
|
|
261
261
|
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
262
|
-
).replace("comment", rt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),
|
|
262
|
+
).replace("comment", rt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), N = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, st = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", N).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ye = k(/^!?\[(label)\]\[(ref)\]/).replace("label", N).replace("ref", Y).getRegex(), ve = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex(), at = k("reflink|nolink(?!\\()", "g").replace("reflink", ye).replace("nolink", ve).getRegex(), re = {
|
|
263
263
|
_backpedal: D,
|
|
264
264
|
// only used for GFM url
|
|
265
265
|
anyPunctuation: tt,
|
|
@@ -276,14 +276,14 @@ var w = {
|
|
|
276
276
|
nolink: ve,
|
|
277
277
|
punctuation: We,
|
|
278
278
|
reflink: ye,
|
|
279
|
-
reflinkSearch:
|
|
279
|
+
reflinkSearch: at,
|
|
280
280
|
tag: it,
|
|
281
281
|
text: Qe,
|
|
282
282
|
url: D
|
|
283
|
-
},
|
|
283
|
+
}, lt = {
|
|
284
284
|
...re,
|
|
285
|
-
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label",
|
|
286
|
-
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",
|
|
285
|
+
link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", N).getRegex(),
|
|
286
|
+
reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", N).getRegex()
|
|
287
287
|
}, F = {
|
|
288
288
|
...re,
|
|
289
289
|
emStrongRDelimAst: Ye,
|
|
@@ -298,29 +298,29 @@ var w = {
|
|
|
298
298
|
text: k(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
299
299
|
}, M = {
|
|
300
300
|
normal: te,
|
|
301
|
-
gfm:
|
|
301
|
+
gfm: je,
|
|
302
302
|
pedantic: Ze
|
|
303
303
|
}, P = {
|
|
304
304
|
normal: re,
|
|
305
305
|
gfm: F,
|
|
306
306
|
breaks: ot,
|
|
307
|
-
pedantic:
|
|
307
|
+
pedantic: lt
|
|
308
308
|
}, ct = {
|
|
309
309
|
"&": "&",
|
|
310
310
|
"<": "<",
|
|
311
311
|
">": ">",
|
|
312
312
|
'"': """,
|
|
313
313
|
"'": "'"
|
|
314
|
-
},
|
|
314
|
+
}, ae = (n) => ct[n];
|
|
315
315
|
function $(n, e) {
|
|
316
316
|
if (e) {
|
|
317
317
|
if (w.escapeTest.test(n))
|
|
318
|
-
return n.replace(w.escapeReplace,
|
|
318
|
+
return n.replace(w.escapeReplace, ae);
|
|
319
319
|
} else if (w.escapeTestNoEncode.test(n))
|
|
320
|
-
return n.replace(w.escapeReplaceNoEncode,
|
|
320
|
+
return n.replace(w.escapeReplaceNoEncode, ae);
|
|
321
321
|
return n;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function le(n) {
|
|
324
324
|
try {
|
|
325
325
|
n = encodeURI(n).replace(w.percentDecode, "%");
|
|
326
326
|
} catch {
|
|
@@ -330,10 +330,10 @@ function ae(n) {
|
|
|
330
330
|
}
|
|
331
331
|
function oe(n, e) {
|
|
332
332
|
var s;
|
|
333
|
-
const t = n.replace(w.findPipe, (c,
|
|
334
|
-
let
|
|
335
|
-
for (; --o >= 0 && h[o] === "\\"; )
|
|
336
|
-
return
|
|
333
|
+
const t = n.replace(w.findPipe, (c, a, h) => {
|
|
334
|
+
let l = !1, o = a;
|
|
335
|
+
for (; --o >= 0 && h[o] === "\\"; ) l = !l;
|
|
336
|
+
return l ? "|" : " |";
|
|
337
337
|
}), r = t.split(w.splitPipe);
|
|
338
338
|
let i = 0;
|
|
339
339
|
if (r[0].trim() || r.shift(), r.length > 0 && !((s = r.at(-1)) != null && s.trim()) && r.pop(), e)
|
|
@@ -368,15 +368,15 @@ function ht(n, e) {
|
|
|
368
368
|
return t > 0 ? -2 : -1;
|
|
369
369
|
}
|
|
370
370
|
function ce(n, e, t, r, i) {
|
|
371
|
-
const s = e.href, c = e.title || null,
|
|
371
|
+
const s = e.href, c = e.title || null, a = n[1].replace(i.other.outputLinkReplace, "$1");
|
|
372
372
|
r.state.inLink = !0;
|
|
373
373
|
const h = {
|
|
374
374
|
type: n[0].charAt(0) === "!" ? "image" : "link",
|
|
375
375
|
raw: t,
|
|
376
376
|
href: s,
|
|
377
377
|
title: c,
|
|
378
|
-
text:
|
|
379
|
-
tokens: r.inlineTokens(
|
|
378
|
+
text: a,
|
|
379
|
+
tokens: r.inlineTokens(a)
|
|
380
380
|
};
|
|
381
381
|
return r.state.inLink = !1, h;
|
|
382
382
|
}
|
|
@@ -390,12 +390,12 @@ function pt(n, e, t) {
|
|
|
390
390
|
const c = s.match(t.other.beginningSpace);
|
|
391
391
|
if (c === null)
|
|
392
392
|
return s;
|
|
393
|
-
const [
|
|
394
|
-
return
|
|
393
|
+
const [a] = c;
|
|
394
|
+
return a.length >= i.length ? s.slice(i.length) : s;
|
|
395
395
|
}).join(`
|
|
396
396
|
`);
|
|
397
397
|
}
|
|
398
|
-
var
|
|
398
|
+
var j = class {
|
|
399
399
|
// set by the lexer
|
|
400
400
|
constructor(n) {
|
|
401
401
|
g(this, "options");
|
|
@@ -472,21 +472,21 @@ var N = class {
|
|
|
472
472
|
const s = [];
|
|
473
473
|
for (; t.length > 0; ) {
|
|
474
474
|
let c = !1;
|
|
475
|
-
const
|
|
475
|
+
const a = [];
|
|
476
476
|
let h;
|
|
477
477
|
for (h = 0; h < t.length; h++)
|
|
478
478
|
if (this.rules.other.blockquoteStart.test(t[h]))
|
|
479
|
-
|
|
479
|
+
a.push(t[h]), c = !0;
|
|
480
480
|
else if (!c)
|
|
481
|
-
|
|
481
|
+
a.push(t[h]);
|
|
482
482
|
else
|
|
483
483
|
break;
|
|
484
484
|
t = t.slice(h);
|
|
485
|
-
const
|
|
486
|
-
`), o =
|
|
485
|
+
const l = a.join(`
|
|
486
|
+
`), o = l.replace(this.rules.other.blockquoteSetextReplace, `
|
|
487
487
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
488
488
|
r = r ? `${r}
|
|
489
|
-
${
|
|
489
|
+
${l}` : l, i = i ? `${i}
|
|
490
490
|
${o}` : o;
|
|
491
491
|
const d = this.lexer.state.top;
|
|
492
492
|
if (this.lexer.state.top = !0, this.lexer.blockTokens(o, s, !0), this.lexer.state.top = d, t.length === 0)
|
|
@@ -533,14 +533,14 @@ ${o}` : o;
|
|
|
533
533
|
const s = this.rules.other.listItemRegex(t);
|
|
534
534
|
let c = !1;
|
|
535
535
|
for (; n; ) {
|
|
536
|
-
let h = !1,
|
|
536
|
+
let h = !1, l = "", o = "";
|
|
537
537
|
if (!(e = s.exec(n)) || this.rules.block.hr.test(n))
|
|
538
538
|
break;
|
|
539
|
-
|
|
539
|
+
l = e[0], n = n.substring(l.length);
|
|
540
540
|
let d = e[2].split(`
|
|
541
541
|
`, 1)[0].replace(this.rules.other.listReplaceTabs, (S) => " ".repeat(3 * S.length)), p = n.split(`
|
|
542
542
|
`, 1)[0], x = !d.trim(), f = 0;
|
|
543
|
-
if (this.options.pedantic ? (f = 2, o = d.trimStart()) : x ? f = e[1].length + 1 : (f = e[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, o = d.slice(f), f += e[1].length), x && this.rules.other.blankLine.test(p) && (
|
|
543
|
+
if (this.options.pedantic ? (f = 2, o = d.trimStart()) : x ? f = e[1].length + 1 : (f = e[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, o = d.slice(f), f += e[1].length), x && this.rules.other.blankLine.test(p) && (l += p + `
|
|
544
544
|
`, n = n.substring(p.length + 1), h = !0), !h) {
|
|
545
545
|
const S = this.rules.other.nextBulletRegex(f), A = this.rules.other.hrRegex(f), v = this.rules.other.fencesBeginRegex(f), I = this.rules.other.headingBeginRegex(f), L = this.rules.other.htmlBeginRegex(f);
|
|
546
546
|
for (; n; ) {
|
|
@@ -558,31 +558,31 @@ ${o}` : o;
|
|
|
558
558
|
o += `
|
|
559
559
|
` + p;
|
|
560
560
|
}
|
|
561
|
-
!x && !p.trim() && (x = !0),
|
|
561
|
+
!x && !p.trim() && (x = !0), l += _ + `
|
|
562
562
|
`, n = n.substring(_.length + 1), d = R.slice(f);
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
i.loose || (c ? i.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
565
|
+
i.loose || (c ? i.loose = !0 : this.rules.other.doubleBlankLine.test(l) && (c = !0));
|
|
566
566
|
let b = null, y;
|
|
567
567
|
this.options.gfm && (b = this.rules.other.listIsTask.exec(o), b && (y = b[0] !== "[ ] ", o = o.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
568
568
|
type: "list_item",
|
|
569
|
-
raw:
|
|
569
|
+
raw: l,
|
|
570
570
|
task: !!b,
|
|
571
571
|
checked: y,
|
|
572
572
|
loose: !1,
|
|
573
573
|
text: o,
|
|
574
574
|
tokens: []
|
|
575
|
-
}), i.raw +=
|
|
575
|
+
}), i.raw += l;
|
|
576
576
|
}
|
|
577
|
-
const
|
|
578
|
-
if (
|
|
579
|
-
|
|
577
|
+
const a = i.items.at(-1);
|
|
578
|
+
if (a)
|
|
579
|
+
a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
|
|
580
580
|
else
|
|
581
581
|
return;
|
|
582
582
|
i.raw = i.raw.trimEnd();
|
|
583
583
|
for (let h = 0; h < i.items.length; h++)
|
|
584
584
|
if (this.lexer.state.top = !1, i.items[h].tokens = this.lexer.blockTokens(i.items[h].text, []), !i.loose) {
|
|
585
|
-
const
|
|
585
|
+
const l = i.items[h].tokens.filter((d) => d.type === "space"), o = l.length > 0 && l.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
586
586
|
i.loose = o;
|
|
587
587
|
}
|
|
588
588
|
if (i.loose)
|
|
@@ -629,21 +629,21 @@ ${o}` : o;
|
|
|
629
629
|
rows: []
|
|
630
630
|
};
|
|
631
631
|
if (t.length === r.length) {
|
|
632
|
-
for (const
|
|
633
|
-
this.rules.other.tableAlignRight.test(
|
|
634
|
-
for (let
|
|
632
|
+
for (const a of r)
|
|
633
|
+
this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
634
|
+
for (let a = 0; a < t.length; a++)
|
|
635
635
|
s.header.push({
|
|
636
|
-
text: t[
|
|
637
|
-
tokens: this.lexer.inline(t[
|
|
636
|
+
text: t[a],
|
|
637
|
+
tokens: this.lexer.inline(t[a]),
|
|
638
638
|
header: !0,
|
|
639
|
-
align: s.align[
|
|
639
|
+
align: s.align[a]
|
|
640
640
|
});
|
|
641
|
-
for (const
|
|
642
|
-
s.rows.push(oe(
|
|
641
|
+
for (const a of i)
|
|
642
|
+
s.rows.push(oe(a, s.header.length).map((h, l) => ({
|
|
643
643
|
text: h,
|
|
644
644
|
tokens: this.lexer.inline(h),
|
|
645
645
|
header: !1,
|
|
646
|
-
align: s.align[
|
|
646
|
+
align: s.align[l]
|
|
647
647
|
})));
|
|
648
648
|
return s;
|
|
649
649
|
}
|
|
@@ -718,8 +718,8 @@ ${o}` : o;
|
|
|
718
718
|
if (s === -2)
|
|
719
719
|
return;
|
|
720
720
|
if (s > -1) {
|
|
721
|
-
const
|
|
722
|
-
e[2] = e[2].substring(0, s), e[0] = e[0].substring(0,
|
|
721
|
+
const a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + s;
|
|
722
|
+
e[2] = e[2].substring(0, s), e[0] = e[0].substring(0, a).trim(), e[3] = "";
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
let r = e[2], i = "";
|
|
@@ -754,21 +754,21 @@ ${o}` : o;
|
|
|
754
754
|
if (!r || r[3] && t.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
755
755
|
if (!(r[1] || r[2] || "") || !t || this.rules.inline.punctuation.exec(t)) {
|
|
756
756
|
const s = [...r[0]].length - 1;
|
|
757
|
-
let c,
|
|
757
|
+
let c, a, h = s, l = 0;
|
|
758
758
|
const o = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
759
759
|
for (o.lastIndex = 0, e = e.slice(-1 * n.length + s); (r = o.exec(e)) != null; ) {
|
|
760
760
|
if (c = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !c) continue;
|
|
761
|
-
if (
|
|
762
|
-
h +=
|
|
761
|
+
if (a = [...c].length, r[3] || r[4]) {
|
|
762
|
+
h += a;
|
|
763
763
|
continue;
|
|
764
|
-
} else if ((r[5] || r[6]) && s % 3 && !((s +
|
|
765
|
-
|
|
764
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + a) % 3)) {
|
|
765
|
+
l += a;
|
|
766
766
|
continue;
|
|
767
767
|
}
|
|
768
|
-
if (h -=
|
|
769
|
-
|
|
770
|
-
const d = [...r[0]][0].length, p = n.slice(0, s + r.index + d +
|
|
771
|
-
if (Math.min(s,
|
|
768
|
+
if (h -= a, h > 0) continue;
|
|
769
|
+
a = Math.min(a, a + h + l);
|
|
770
|
+
const d = [...r[0]][0].length, p = n.slice(0, s + r.index + d + a);
|
|
771
|
+
if (Math.min(s, a) % 2) {
|
|
772
772
|
const f = p.slice(1, -1);
|
|
773
773
|
return {
|
|
774
774
|
type: "em",
|
|
@@ -884,7 +884,7 @@ ${o}` : o;
|
|
|
884
884
|
g(this, "state");
|
|
885
885
|
g(this, "tokenizer");
|
|
886
886
|
g(this, "inlineQueue");
|
|
887
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || z, this.options.tokenizer = this.options.tokenizer || new
|
|
887
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || z, this.options.tokenizer = this.options.tokenizer || new j(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
888
888
|
inLink: !1,
|
|
889
889
|
inRawBlock: !1,
|
|
890
890
|
top: !0
|
|
@@ -932,98 +932,98 @@ ${o}` : o;
|
|
|
932
932
|
blockTokens(e, t = [], r = !1) {
|
|
933
933
|
var i, s, c;
|
|
934
934
|
for (this.options.pedantic && (e = e.replace(w.tabCharGlobal, " ").replace(w.spaceLine, "")); e; ) {
|
|
935
|
-
let
|
|
936
|
-
if ((s = (i = this.options.extensions) == null ? void 0 : i.block) != null && s.some((
|
|
935
|
+
let a;
|
|
936
|
+
if ((s = (i = this.options.extensions) == null ? void 0 : i.block) != null && s.some((l) => (a = l.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), !0) : !1))
|
|
937
937
|
continue;
|
|
938
|
-
if (
|
|
939
|
-
e = e.substring(
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
` : t.push(
|
|
938
|
+
if (a = this.tokenizer.space(e)) {
|
|
939
|
+
e = e.substring(a.raw.length);
|
|
940
|
+
const l = t.at(-1);
|
|
941
|
+
a.raw.length === 1 && l !== void 0 ? l.raw += `
|
|
942
|
+
` : t.push(a);
|
|
943
943
|
continue;
|
|
944
944
|
}
|
|
945
|
-
if (
|
|
946
|
-
e = e.substring(
|
|
947
|
-
const
|
|
948
|
-
(
|
|
949
|
-
` +
|
|
950
|
-
` +
|
|
945
|
+
if (a = this.tokenizer.code(e)) {
|
|
946
|
+
e = e.substring(a.raw.length);
|
|
947
|
+
const l = t.at(-1);
|
|
948
|
+
(l == null ? void 0 : l.type) === "paragraph" || (l == null ? void 0 : l.type) === "text" ? (l.raw += `
|
|
949
|
+
` + a.raw, l.text += `
|
|
950
|
+
` + a.text, this.inlineQueue.at(-1).src = l.text) : t.push(a);
|
|
951
951
|
continue;
|
|
952
952
|
}
|
|
953
|
-
if (
|
|
954
|
-
e = e.substring(
|
|
953
|
+
if (a = this.tokenizer.fences(e)) {
|
|
954
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
955
955
|
continue;
|
|
956
956
|
}
|
|
957
|
-
if (
|
|
958
|
-
e = e.substring(
|
|
957
|
+
if (a = this.tokenizer.heading(e)) {
|
|
958
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
959
959
|
continue;
|
|
960
960
|
}
|
|
961
|
-
if (
|
|
962
|
-
e = e.substring(
|
|
961
|
+
if (a = this.tokenizer.hr(e)) {
|
|
962
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
963
963
|
continue;
|
|
964
964
|
}
|
|
965
|
-
if (
|
|
966
|
-
e = e.substring(
|
|
965
|
+
if (a = this.tokenizer.blockquote(e)) {
|
|
966
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
967
967
|
continue;
|
|
968
968
|
}
|
|
969
|
-
if (
|
|
970
|
-
e = e.substring(
|
|
969
|
+
if (a = this.tokenizer.list(e)) {
|
|
970
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
971
971
|
continue;
|
|
972
972
|
}
|
|
973
|
-
if (
|
|
974
|
-
e = e.substring(
|
|
973
|
+
if (a = this.tokenizer.html(e)) {
|
|
974
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
975
975
|
continue;
|
|
976
976
|
}
|
|
977
|
-
if (
|
|
978
|
-
e = e.substring(
|
|
979
|
-
const
|
|
980
|
-
(
|
|
981
|
-
` +
|
|
982
|
-
` +
|
|
983
|
-
href:
|
|
984
|
-
title:
|
|
977
|
+
if (a = this.tokenizer.def(e)) {
|
|
978
|
+
e = e.substring(a.raw.length);
|
|
979
|
+
const l = t.at(-1);
|
|
980
|
+
(l == null ? void 0 : l.type) === "paragraph" || (l == null ? void 0 : l.type) === "text" ? (l.raw += `
|
|
981
|
+
` + a.raw, l.text += `
|
|
982
|
+
` + a.raw, this.inlineQueue.at(-1).src = l.text) : this.tokens.links[a.tag] || (this.tokens.links[a.tag] = {
|
|
983
|
+
href: a.href,
|
|
984
|
+
title: a.title
|
|
985
985
|
});
|
|
986
986
|
continue;
|
|
987
987
|
}
|
|
988
|
-
if (
|
|
989
|
-
e = e.substring(
|
|
988
|
+
if (a = this.tokenizer.table(e)) {
|
|
989
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
990
990
|
continue;
|
|
991
991
|
}
|
|
992
|
-
if (
|
|
993
|
-
e = e.substring(
|
|
992
|
+
if (a = this.tokenizer.lheading(e)) {
|
|
993
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
994
994
|
continue;
|
|
995
995
|
}
|
|
996
996
|
let h = e;
|
|
997
997
|
if ((c = this.options.extensions) != null && c.startBlock) {
|
|
998
|
-
let
|
|
998
|
+
let l = 1 / 0;
|
|
999
999
|
const o = e.slice(1);
|
|
1000
1000
|
let d;
|
|
1001
1001
|
this.options.extensions.startBlock.forEach((p) => {
|
|
1002
|
-
d = p.call({ lexer: this }, o), typeof d == "number" && d >= 0 && (
|
|
1003
|
-
}),
|
|
1002
|
+
d = p.call({ lexer: this }, o), typeof d == "number" && d >= 0 && (l = Math.min(l, d));
|
|
1003
|
+
}), l < 1 / 0 && l >= 0 && (h = e.substring(0, l + 1));
|
|
1004
1004
|
}
|
|
1005
|
-
if (this.state.top && (
|
|
1006
|
-
const
|
|
1007
|
-
r && (
|
|
1008
|
-
` +
|
|
1009
|
-
` +
|
|
1005
|
+
if (this.state.top && (a = this.tokenizer.paragraph(h))) {
|
|
1006
|
+
const l = t.at(-1);
|
|
1007
|
+
r && (l == null ? void 0 : l.type) === "paragraph" ? (l.raw += `
|
|
1008
|
+
` + a.raw, l.text += `
|
|
1009
|
+
` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(a), r = h.length !== e.length, e = e.substring(a.raw.length);
|
|
1010
1010
|
continue;
|
|
1011
1011
|
}
|
|
1012
|
-
if (
|
|
1013
|
-
e = e.substring(
|
|
1014
|
-
const
|
|
1015
|
-
(
|
|
1016
|
-
` +
|
|
1017
|
-
` +
|
|
1012
|
+
if (a = this.tokenizer.text(e)) {
|
|
1013
|
+
e = e.substring(a.raw.length);
|
|
1014
|
+
const l = t.at(-1);
|
|
1015
|
+
(l == null ? void 0 : l.type) === "text" ? (l.raw += `
|
|
1016
|
+
` + a.raw, l.text += `
|
|
1017
|
+
` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : t.push(a);
|
|
1018
1018
|
continue;
|
|
1019
1019
|
}
|
|
1020
1020
|
if (e) {
|
|
1021
|
-
const
|
|
1021
|
+
const l = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1022
1022
|
if (this.options.silent) {
|
|
1023
|
-
console.error(
|
|
1023
|
+
console.error(l);
|
|
1024
1024
|
break;
|
|
1025
1025
|
} else
|
|
1026
|
-
throw new Error(
|
|
1026
|
+
throw new Error(l);
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
return this.state.top = !0, t;
|
|
@@ -1035,7 +1035,7 @@ ${o}` : o;
|
|
|
1035
1035
|
* Lexing/Compiling
|
|
1036
1036
|
*/
|
|
1037
1037
|
inlineTokens(e, t = []) {
|
|
1038
|
-
var
|
|
1038
|
+
var a, h, l;
|
|
1039
1039
|
let r = e, i = null;
|
|
1040
1040
|
if (this.tokens.links) {
|
|
1041
1041
|
const o = Object.keys(this.tokens.links);
|
|
@@ -1051,7 +1051,7 @@ ${o}` : o;
|
|
|
1051
1051
|
for (; e; ) {
|
|
1052
1052
|
s || (c = ""), s = !1;
|
|
1053
1053
|
let o;
|
|
1054
|
-
if ((h = (
|
|
1054
|
+
if ((h = (a = this.options.extensions) == null ? void 0 : a.inline) != null && h.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1))
|
|
1055
1055
|
continue;
|
|
1056
1056
|
if (o = this.tokenizer.escape(e)) {
|
|
1057
1057
|
e = e.substring(o.raw.length), t.push(o);
|
|
@@ -1096,7 +1096,7 @@ ${o}` : o;
|
|
|
1096
1096
|
continue;
|
|
1097
1097
|
}
|
|
1098
1098
|
let d = e;
|
|
1099
|
-
if ((
|
|
1099
|
+
if ((l = this.options.extensions) != null && l.startInline) {
|
|
1100
1100
|
let p = 1 / 0;
|
|
1101
1101
|
const x = e.slice(1);
|
|
1102
1102
|
let f;
|
|
@@ -1159,8 +1159,8 @@ ${this.parser.parse(n)}</blockquote>
|
|
|
1159
1159
|
const e = n.ordered, t = n.start;
|
|
1160
1160
|
let r = "";
|
|
1161
1161
|
for (let c = 0; c < n.items.length; c++) {
|
|
1162
|
-
const
|
|
1163
|
-
r += this.listitem(
|
|
1162
|
+
const a = n.items[c];
|
|
1163
|
+
r += this.listitem(a);
|
|
1164
1164
|
}
|
|
1165
1165
|
const i = e ? "ol" : "ul", s = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
1166
1166
|
return "<" + i + s + `>
|
|
@@ -1237,7 +1237,7 @@ ${n}</tr>
|
|
|
1237
1237
|
return `<del>${this.parser.parseInline(n)}</del>`;
|
|
1238
1238
|
}
|
|
1239
1239
|
link({ href: n, title: e, tokens: t }) {
|
|
1240
|
-
const r = this.parser.parseInline(t), i =
|
|
1240
|
+
const r = this.parser.parseInline(t), i = le(n);
|
|
1241
1241
|
if (i === null)
|
|
1242
1242
|
return r;
|
|
1243
1243
|
n = i;
|
|
@@ -1246,7 +1246,7 @@ ${n}</tr>
|
|
|
1246
1246
|
}
|
|
1247
1247
|
image({ href: n, title: e, text: t, tokens: r }) {
|
|
1248
1248
|
r && (t = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1249
|
-
const i =
|
|
1249
|
+
const i = le(n);
|
|
1250
1250
|
if (i === null)
|
|
1251
1251
|
return $(t);
|
|
1252
1252
|
n = i;
|
|
@@ -1311,15 +1311,15 @@ ${n}</tr>
|
|
|
1311
1311
|
var i, s;
|
|
1312
1312
|
let r = "";
|
|
1313
1313
|
for (let c = 0; c < e.length; c++) {
|
|
1314
|
-
const
|
|
1315
|
-
if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[
|
|
1316
|
-
const
|
|
1317
|
-
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(
|
|
1314
|
+
const a = e[c];
|
|
1315
|
+
if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[a.type]) {
|
|
1316
|
+
const l = a, o = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1317
|
+
if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(l.type)) {
|
|
1318
1318
|
r += o || "";
|
|
1319
1319
|
continue;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
const h =
|
|
1322
|
+
const h = a;
|
|
1323
1323
|
switch (h.type) {
|
|
1324
1324
|
case "space": {
|
|
1325
1325
|
r += this.renderer.space(h);
|
|
@@ -1358,10 +1358,10 @@ ${n}</tr>
|
|
|
1358
1358
|
continue;
|
|
1359
1359
|
}
|
|
1360
1360
|
case "text": {
|
|
1361
|
-
let
|
|
1361
|
+
let l = h, o = this.renderer.text(l);
|
|
1362
1362
|
for (; c + 1 < e.length && e[c + 1].type === "text"; )
|
|
1363
|
-
|
|
1364
|
-
` + this.renderer.text(
|
|
1363
|
+
l = e[++c], o += `
|
|
1364
|
+
` + this.renderer.text(l);
|
|
1365
1365
|
t ? r += this.renderer.paragraph({
|
|
1366
1366
|
type: "paragraph",
|
|
1367
1367
|
raw: o,
|
|
@@ -1371,10 +1371,10 @@ ${n}</tr>
|
|
|
1371
1371
|
continue;
|
|
1372
1372
|
}
|
|
1373
1373
|
default: {
|
|
1374
|
-
const
|
|
1374
|
+
const l = 'Token with "' + h.type + '" type was not found.';
|
|
1375
1375
|
if (this.options.silent)
|
|
1376
|
-
return console.error(
|
|
1377
|
-
throw new Error(
|
|
1376
|
+
return console.error(l), "";
|
|
1377
|
+
throw new Error(l);
|
|
1378
1378
|
}
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
@@ -1387,15 +1387,15 @@ ${n}</tr>
|
|
|
1387
1387
|
var i, s;
|
|
1388
1388
|
let r = "";
|
|
1389
1389
|
for (let c = 0; c < e.length; c++) {
|
|
1390
|
-
const
|
|
1391
|
-
if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[
|
|
1392
|
-
const
|
|
1393
|
-
if (
|
|
1394
|
-
r +=
|
|
1390
|
+
const a = e[c];
|
|
1391
|
+
if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[a.type]) {
|
|
1392
|
+
const l = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1393
|
+
if (l !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(a.type)) {
|
|
1394
|
+
r += l || "";
|
|
1395
1395
|
continue;
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
|
-
const h =
|
|
1398
|
+
const h = a;
|
|
1399
1399
|
switch (h.type) {
|
|
1400
1400
|
case "escape": {
|
|
1401
1401
|
r += t.text(h);
|
|
@@ -1438,10 +1438,10 @@ ${n}</tr>
|
|
|
1438
1438
|
break;
|
|
1439
1439
|
}
|
|
1440
1440
|
default: {
|
|
1441
|
-
const
|
|
1441
|
+
const l = 'Token with "' + h.type + '" type was not found.';
|
|
1442
1442
|
if (this.options.silent)
|
|
1443
|
-
return console.error(
|
|
1444
|
-
throw new Error(
|
|
1443
|
+
return console.error(l), "";
|
|
1444
|
+
throw new Error(l);
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
@@ -1497,7 +1497,7 @@ ${n}</tr>
|
|
|
1497
1497
|
g(this, "Renderer", Z);
|
|
1498
1498
|
g(this, "TextRenderer", ie);
|
|
1499
1499
|
g(this, "Lexer", E);
|
|
1500
|
-
g(this, "Tokenizer",
|
|
1500
|
+
g(this, "Tokenizer", j);
|
|
1501
1501
|
g(this, "Hooks", O);
|
|
1502
1502
|
this.use(...n);
|
|
1503
1503
|
}
|
|
@@ -1511,10 +1511,10 @@ ${n}</tr>
|
|
|
1511
1511
|
switch (t = t.concat(e.call(this, s)), s.type) {
|
|
1512
1512
|
case "table": {
|
|
1513
1513
|
const c = s;
|
|
1514
|
-
for (const
|
|
1515
|
-
t = t.concat(this.walkTokens(
|
|
1516
|
-
for (const
|
|
1517
|
-
for (const h of
|
|
1514
|
+
for (const a of c.header)
|
|
1515
|
+
t = t.concat(this.walkTokens(a.tokens, e));
|
|
1516
|
+
for (const a of c.rows)
|
|
1517
|
+
for (const h of a)
|
|
1518
1518
|
t = t.concat(this.walkTokens(h.tokens, e));
|
|
1519
1519
|
break;
|
|
1520
1520
|
}
|
|
@@ -1525,8 +1525,8 @@ ${n}</tr>
|
|
|
1525
1525
|
}
|
|
1526
1526
|
default: {
|
|
1527
1527
|
const c = s;
|
|
1528
|
-
(i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[c.type] ? this.defaults.extensions.childTokens[c.type].forEach((
|
|
1529
|
-
const h = c[
|
|
1528
|
+
(i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[c.type] ? this.defaults.extensions.childTokens[c.type].forEach((a) => {
|
|
1529
|
+
const h = c[a].flat(1 / 0);
|
|
1530
1530
|
t = t.concat(this.walkTokens(h, e));
|
|
1531
1531
|
}) : c.tokens && (t = t.concat(this.walkTokens(c.tokens, e)));
|
|
1532
1532
|
}
|
|
@@ -1543,8 +1543,8 @@ ${n}</tr>
|
|
|
1543
1543
|
if ("renderer" in i) {
|
|
1544
1544
|
const s = e.renderers[i.name];
|
|
1545
1545
|
s ? e.renderers[i.name] = function(...c) {
|
|
1546
|
-
let
|
|
1547
|
-
return
|
|
1546
|
+
let a = i.renderer.apply(this, c);
|
|
1547
|
+
return a === !1 && (a = s.apply(this, c)), a;
|
|
1548
1548
|
} : e.renderers[i.name] = i.renderer;
|
|
1549
1549
|
}
|
|
1550
1550
|
if ("tokenizer" in i) {
|
|
@@ -1561,25 +1561,25 @@ ${n}</tr>
|
|
|
1561
1561
|
throw new Error(`renderer '${s}' does not exist`);
|
|
1562
1562
|
if (["options", "parser"].includes(s))
|
|
1563
1563
|
continue;
|
|
1564
|
-
const c = s,
|
|
1565
|
-
i[c] = (...
|
|
1566
|
-
let o =
|
|
1567
|
-
return o === !1 && (o = h.apply(i,
|
|
1564
|
+
const c = s, a = t.renderer[c], h = i[c];
|
|
1565
|
+
i[c] = (...l) => {
|
|
1566
|
+
let o = a.apply(i, l);
|
|
1567
|
+
return o === !1 && (o = h.apply(i, l)), o || "";
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
1570
|
r.renderer = i;
|
|
1571
1571
|
}
|
|
1572
1572
|
if (t.tokenizer) {
|
|
1573
|
-
const i = this.defaults.tokenizer || new
|
|
1573
|
+
const i = this.defaults.tokenizer || new j(this.defaults);
|
|
1574
1574
|
for (const s in t.tokenizer) {
|
|
1575
1575
|
if (!(s in i))
|
|
1576
1576
|
throw new Error(`tokenizer '${s}' does not exist`);
|
|
1577
1577
|
if (["options", "rules", "lexer"].includes(s))
|
|
1578
1578
|
continue;
|
|
1579
|
-
const c = s,
|
|
1580
|
-
i[c] = (...
|
|
1581
|
-
let o =
|
|
1582
|
-
return o === !1 && (o = h.apply(i,
|
|
1579
|
+
const c = s, a = t.tokenizer[c], h = i[c];
|
|
1580
|
+
i[c] = (...l) => {
|
|
1581
|
+
let o = a.apply(i, l);
|
|
1582
|
+
return o === !1 && (o = h.apply(i, l)), o;
|
|
1583
1583
|
};
|
|
1584
1584
|
}
|
|
1585
1585
|
r.tokenizer = i;
|
|
@@ -1591,15 +1591,15 @@ ${n}</tr>
|
|
|
1591
1591
|
throw new Error(`hook '${s}' does not exist`);
|
|
1592
1592
|
if (["options", "block"].includes(s))
|
|
1593
1593
|
continue;
|
|
1594
|
-
const c = s,
|
|
1595
|
-
O.passThroughHooks.has(s) ? i[c] = (
|
|
1594
|
+
const c = s, a = t.hooks[c], h = i[c];
|
|
1595
|
+
O.passThroughHooks.has(s) ? i[c] = (l) => {
|
|
1596
1596
|
if (this.defaults.async)
|
|
1597
|
-
return Promise.resolve(
|
|
1598
|
-
const o =
|
|
1597
|
+
return Promise.resolve(a.call(i, l)).then((d) => h.call(i, d));
|
|
1598
|
+
const o = a.call(i, l);
|
|
1599
1599
|
return h.call(i, o);
|
|
1600
|
-
} : i[c] = (...
|
|
1601
|
-
let o =
|
|
1602
|
-
return o === !1 && (o = h.apply(i,
|
|
1600
|
+
} : i[c] = (...l) => {
|
|
1601
|
+
let o = a.apply(i, l);
|
|
1602
|
+
return o === !1 && (o = h.apply(i, l)), o;
|
|
1603
1603
|
};
|
|
1604
1604
|
}
|
|
1605
1605
|
r.hooks = i;
|
|
@@ -1607,8 +1607,8 @@ ${n}</tr>
|
|
|
1607
1607
|
if (t.walkTokens) {
|
|
1608
1608
|
const i = this.defaults.walkTokens, s = t.walkTokens;
|
|
1609
1609
|
r.walkTokens = function(c) {
|
|
1610
|
-
let
|
|
1611
|
-
return
|
|
1610
|
+
let a = [];
|
|
1611
|
+
return a.push(s.call(this, c)), i && (a = a.concat(i.call(this, c))), a;
|
|
1612
1612
|
};
|
|
1613
1613
|
}
|
|
1614
1614
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -1633,17 +1633,17 @@ ${n}</tr>
|
|
|
1633
1633
|
if (typeof t != "string")
|
|
1634
1634
|
return c(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1635
1635
|
s.hooks && (s.hooks.options = s, s.hooks.block = n);
|
|
1636
|
-
const
|
|
1636
|
+
const a = s.hooks ? s.hooks.provideLexer() : n ? E.lex : E.lexInline, h = s.hooks ? s.hooks.provideParser() : n ? T.parse : T.parseInline;
|
|
1637
1637
|
if (s.async)
|
|
1638
|
-
return Promise.resolve(s.hooks ? s.hooks.preprocess(t) : t).then((
|
|
1638
|
+
return Promise.resolve(s.hooks ? s.hooks.preprocess(t) : t).then((l) => a(l, s)).then((l) => s.hooks ? s.hooks.processAllTokens(l) : l).then((l) => s.walkTokens ? Promise.all(this.walkTokens(l, s.walkTokens)).then(() => l) : l).then((l) => h(l, s)).then((l) => s.hooks ? s.hooks.postprocess(l) : l).catch(c);
|
|
1639
1639
|
try {
|
|
1640
1640
|
s.hooks && (t = s.hooks.preprocess(t));
|
|
1641
|
-
let
|
|
1642
|
-
s.hooks && (
|
|
1643
|
-
let o = h(
|
|
1641
|
+
let l = a(t, s);
|
|
1642
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
1643
|
+
let o = h(l, s);
|
|
1644
1644
|
return s.hooks && (o = s.hooks.postprocess(o)), o;
|
|
1645
|
-
} catch (
|
|
1646
|
-
return c(
|
|
1645
|
+
} catch (l) {
|
|
1646
|
+
return c(l);
|
|
1647
1647
|
}
|
|
1648
1648
|
};
|
|
1649
1649
|
}
|
|
@@ -1681,7 +1681,7 @@ m.Renderer = Z;
|
|
|
1681
1681
|
m.TextRenderer = ie;
|
|
1682
1682
|
m.Lexer = E;
|
|
1683
1683
|
m.lexer = E.lex;
|
|
1684
|
-
m.Tokenizer =
|
|
1684
|
+
m.Tokenizer = j;
|
|
1685
1685
|
m.Hooks = O;
|
|
1686
1686
|
m.parse = m;
|
|
1687
1687
|
m.options;
|
|
@@ -1707,14 +1707,18 @@ const he = ({ data: n, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
1709
1709
|
) : /* @__PURE__ */ u.createElement("p", { style: { margin: 0, whiteSpace: "pre-wrap" } }, n ? n.question : "")
|
|
1710
|
-
), gt = ({
|
|
1710
|
+
), gt = ({
|
|
1711
|
+
items: n,
|
|
1712
|
+
onApply: e,
|
|
1713
|
+
getEditorContent: t
|
|
1714
|
+
}) => {
|
|
1711
1715
|
const r = async (i) => {
|
|
1712
1716
|
const s = /제목:[^\n]*/g;
|
|
1713
1717
|
((s.exec(i) || [])[0] || "").replace("제목: ", "").replace(`
|
|
1714
1718
|
`, "");
|
|
1715
|
-
const
|
|
1716
|
-
let h = await m.parse(
|
|
1717
|
-
const
|
|
1719
|
+
const a = i.replace(s, "").replace("본문: ", "");
|
|
1720
|
+
let h = await m.parse(a);
|
|
1721
|
+
const l = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g, o = t ? t() : "", d = l.exec(o) || [];
|
|
1718
1722
|
d[0] && (h = h + "<br>" + d[0]), e({ html: h });
|
|
1719
1723
|
};
|
|
1720
1724
|
return /* @__PURE__ */ u.createElement(
|
|
@@ -1732,76 +1736,109 @@ const he = ({ data: n, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1732
1736
|
flexDirection: "column"
|
|
1733
1737
|
}
|
|
1734
1738
|
},
|
|
1735
|
-
n && n.map((i) => /* @__PURE__ */ u.createElement(
|
|
1739
|
+
n && n.map((i) => /* @__PURE__ */ u.createElement(
|
|
1736
1740
|
"div",
|
|
1737
1741
|
{
|
|
1742
|
+
key: i.id,
|
|
1738
1743
|
style: {
|
|
1739
|
-
width: "100%",
|
|
1740
1744
|
display: "flex",
|
|
1741
|
-
alignItems: "flex-end",
|
|
1742
1745
|
flexDirection: "column",
|
|
1743
|
-
|
|
1744
|
-
marginTop: 8
|
|
1746
|
+
marginBottom: 16
|
|
1745
1747
|
}
|
|
1746
1748
|
},
|
|
1747
1749
|
/* @__PURE__ */ u.createElement(
|
|
1748
|
-
|
|
1750
|
+
"div",
|
|
1749
1751
|
{
|
|
1750
|
-
data: { question: i.question },
|
|
1751
1752
|
style: {
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1753
|
+
width: "100%",
|
|
1754
|
+
display: "flex",
|
|
1755
|
+
alignItems: "flex-end",
|
|
1756
|
+
flexDirection: "column",
|
|
1757
|
+
position: "relative",
|
|
1758
|
+
marginTop: 8
|
|
1757
1759
|
}
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
marginTop: 8
|
|
1770
|
-
}
|
|
1771
|
-
},
|
|
1772
|
-
i.isLoading ? /* @__PURE__ */ u.createElement("div", { style: { marginTop: 8, fontStyle: "italic", color: "#888" } }, "Loading...") : /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "row", alignItems: "flex-end", width: "100%" } }, /* @__PURE__ */ u.createElement(
|
|
1773
|
-
he,
|
|
1774
|
-
{
|
|
1775
|
-
data: { subject: i.subject, body: i.body },
|
|
1776
|
-
style: {
|
|
1777
|
-
background: "#f5f5f5",
|
|
1778
|
-
borderRadius: 8,
|
|
1779
|
-
borderTopLeftRadius: 0,
|
|
1780
|
-
padding: "8px 12px",
|
|
1781
|
-
flexShrink: 0
|
|
1760
|
+
},
|
|
1761
|
+
/* @__PURE__ */ u.createElement(
|
|
1762
|
+
he,
|
|
1763
|
+
{
|
|
1764
|
+
data: { question: i.question },
|
|
1765
|
+
style: {
|
|
1766
|
+
borderRadius: 8,
|
|
1767
|
+
borderTopRightRadius: 0,
|
|
1768
|
+
padding: "8px 12px",
|
|
1769
|
+
background: "var(--background-softGrey)"
|
|
1770
|
+
}
|
|
1782
1771
|
}
|
|
1783
|
-
|
|
1784
|
-
),
|
|
1785
|
-
|
|
1772
|
+
)
|
|
1773
|
+
),
|
|
1774
|
+
/* @__PURE__ */ u.createElement(
|
|
1775
|
+
"div",
|
|
1786
1776
|
{
|
|
1787
|
-
type: "button",
|
|
1788
|
-
title: "Apply content",
|
|
1789
|
-
onClick: () => r(i.body),
|
|
1790
1777
|
style: {
|
|
1791
|
-
|
|
1792
|
-
background: "none",
|
|
1793
|
-
border: "none",
|
|
1794
|
-
cursor: "pointer",
|
|
1778
|
+
width: "100%",
|
|
1795
1779
|
display: "flex",
|
|
1796
|
-
alignItems: "
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1780
|
+
alignItems: "flex-start",
|
|
1781
|
+
flexDirection: "column",
|
|
1782
|
+
position: "relative",
|
|
1783
|
+
marginTop: 8
|
|
1800
1784
|
}
|
|
1801
1785
|
},
|
|
1802
|
-
/* @__PURE__ */ u.createElement(
|
|
1803
|
-
|
|
1804
|
-
|
|
1786
|
+
i.isLoading ? /* @__PURE__ */ u.createElement(
|
|
1787
|
+
"div",
|
|
1788
|
+
{
|
|
1789
|
+
style: {
|
|
1790
|
+
marginTop: 8,
|
|
1791
|
+
fontStyle: "italic",
|
|
1792
|
+
color: "var(--text-secondary)"
|
|
1793
|
+
}
|
|
1794
|
+
},
|
|
1795
|
+
"Loading..."
|
|
1796
|
+
) : /* @__PURE__ */ u.createElement(
|
|
1797
|
+
"div",
|
|
1798
|
+
{
|
|
1799
|
+
style: {
|
|
1800
|
+
display: "flex",
|
|
1801
|
+
flexDirection: "row",
|
|
1802
|
+
alignItems: "flex-end",
|
|
1803
|
+
width: "100%"
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
|
+
/* @__PURE__ */ u.createElement(
|
|
1807
|
+
he,
|
|
1808
|
+
{
|
|
1809
|
+
data: { subject: i.subject, body: i.body },
|
|
1810
|
+
style: {
|
|
1811
|
+
background: "var(--background-softGrey)",
|
|
1812
|
+
borderRadius: 8,
|
|
1813
|
+
borderTopLeftRadius: 0,
|
|
1814
|
+
padding: "8px 12px",
|
|
1815
|
+
flexShrink: 0
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
),
|
|
1819
|
+
/* @__PURE__ */ u.createElement(
|
|
1820
|
+
"button",
|
|
1821
|
+
{
|
|
1822
|
+
type: "button",
|
|
1823
|
+
title: "Apply content",
|
|
1824
|
+
onClick: () => r(i.body),
|
|
1825
|
+
style: {
|
|
1826
|
+
marginLeft: 4,
|
|
1827
|
+
background: "none",
|
|
1828
|
+
border: "none",
|
|
1829
|
+
cursor: "pointer",
|
|
1830
|
+
display: "flex",
|
|
1831
|
+
alignItems: "center",
|
|
1832
|
+
justifyContent: "center",
|
|
1833
|
+
padding: 8,
|
|
1834
|
+
borderRadius: 4
|
|
1835
|
+
}
|
|
1836
|
+
},
|
|
1837
|
+
/* @__PURE__ */ u.createElement(pe, { size: 16, color: "#666" })
|
|
1838
|
+
)
|
|
1839
|
+
)
|
|
1840
|
+
)
|
|
1841
|
+
))
|
|
1805
1842
|
);
|
|
1806
1843
|
};
|
|
1807
1844
|
class dt extends u.Component {
|
|
@@ -1828,94 +1865,115 @@ class dt extends u.Component {
|
|
|
1828
1865
|
}
|
|
1829
1866
|
render() {
|
|
1830
1867
|
const { lang: t, originalEmail: r, setOriginalEmail: i, getEditorContent: s } = this.props, { open: c } = this.state;
|
|
1831
|
-
return /* @__PURE__ */ u.createElement(
|
|
1832
|
-
"button",
|
|
1833
|
-
{
|
|
1834
|
-
type: "button",
|
|
1835
|
-
onClick: this.togglePopper,
|
|
1836
|
-
style: {
|
|
1837
|
-
background: "transparent",
|
|
1838
|
-
border: "none",
|
|
1839
|
-
cursor: "pointer",
|
|
1840
|
-
width: 36,
|
|
1841
|
-
height: 36,
|
|
1842
|
-
display: "flex",
|
|
1843
|
-
alignItems: "center",
|
|
1844
|
-
justifyContent: "center",
|
|
1845
|
-
color: c ? "#1976d2" : "#555",
|
|
1846
|
-
borderRadius: 4
|
|
1847
|
-
}
|
|
1848
|
-
},
|
|
1849
|
-
/* @__PURE__ */ u.createElement(Te, { size: 20 })
|
|
1850
|
-
), c && /* @__PURE__ */ u.createElement(
|
|
1868
|
+
return /* @__PURE__ */ u.createElement(
|
|
1851
1869
|
"div",
|
|
1852
1870
|
{
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
bottom: "100%",
|
|
1856
|
-
left: 0,
|
|
1857
|
-
zIndex: 1051,
|
|
1858
|
-
background: "#fff",
|
|
1859
|
-
border: "1px solid #ddd",
|
|
1860
|
-
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
1861
|
-
borderRadius: 8,
|
|
1862
|
-
padding: 16,
|
|
1863
|
-
width: 320,
|
|
1864
|
-
marginBottom: 8
|
|
1865
|
-
}
|
|
1871
|
+
ref: this.containerRef,
|
|
1872
|
+
style: { position: "relative", display: "inline-block" }
|
|
1866
1873
|
},
|
|
1867
|
-
/* @__PURE__ */ u.createElement(
|
|
1868
|
-
"select",
|
|
1869
|
-
{
|
|
1870
|
-
value: t ? t.value : "",
|
|
1871
|
-
onChange: this.handleLangChange,
|
|
1872
|
-
style: {
|
|
1873
|
-
padding: "6px 8px",
|
|
1874
|
-
borderRadius: 4,
|
|
1875
|
-
border: "1px solid #ccc",
|
|
1876
|
-
fontSize: 14
|
|
1877
|
-
}
|
|
1878
|
-
},
|
|
1879
|
-
/* @__PURE__ */ u.createElement("option", { value: "", disabled: !0 }, "Select Language"),
|
|
1880
|
-
W.map((l) => /* @__PURE__ */ u.createElement("option", { key: l.value, value: l.value }, l.label))
|
|
1881
|
-
)), /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ u.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" } }, /* @__PURE__ */ u.createElement("span", { style: { fontSize: 12, fontWeight: 500, color: "#666" } }, "AI Context"), s && /* @__PURE__ */ u.createElement(
|
|
1874
|
+
/* @__PURE__ */ u.createElement(
|
|
1882
1875
|
"button",
|
|
1883
1876
|
{
|
|
1884
1877
|
type: "button",
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
const l = s();
|
|
1888
|
-
i(l);
|
|
1889
|
-
},
|
|
1890
|
-
style: {
|
|
1891
|
-
background: "none",
|
|
1892
|
-
border: "none",
|
|
1893
|
-
cursor: "pointer",
|
|
1894
|
-
display: "flex",
|
|
1895
|
-
alignItems: "center",
|
|
1896
|
-
padding: 2
|
|
1897
|
-
}
|
|
1878
|
+
onClick: this.togglePopper,
|
|
1879
|
+
className: "icon-button small"
|
|
1898
1880
|
},
|
|
1899
|
-
/* @__PURE__ */ u.createElement(
|
|
1900
|
-
)
|
|
1901
|
-
|
|
1881
|
+
/* @__PURE__ */ u.createElement(Te, { size: 16 })
|
|
1882
|
+
),
|
|
1883
|
+
c && /* @__PURE__ */ u.createElement(
|
|
1884
|
+
"div",
|
|
1902
1885
|
{
|
|
1903
|
-
value: r,
|
|
1904
|
-
onChange: (l) => i(l.target.value),
|
|
1905
1886
|
style: {
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1887
|
+
position: "absolute",
|
|
1888
|
+
bottom: "100%",
|
|
1889
|
+
left: 0,
|
|
1890
|
+
zIndex: 1051,
|
|
1891
|
+
background: "#fff",
|
|
1892
|
+
border: "1px solid #ddd",
|
|
1893
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
1894
|
+
borderRadius: 8,
|
|
1895
|
+
padding: 16,
|
|
1896
|
+
width: 320,
|
|
1897
|
+
marginBottom: 8
|
|
1915
1898
|
}
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
|
|
1899
|
+
},
|
|
1900
|
+
/* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ u.createElement(
|
|
1901
|
+
"span",
|
|
1902
|
+
{
|
|
1903
|
+
style: {
|
|
1904
|
+
fontSize: 12,
|
|
1905
|
+
fontWeight: 500,
|
|
1906
|
+
color: "var(--text-secondary)"
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
"Language"
|
|
1910
|
+
), /* @__PURE__ */ u.createElement(
|
|
1911
|
+
"select",
|
|
1912
|
+
{
|
|
1913
|
+
value: t ? t.value : "",
|
|
1914
|
+
onChange: this.handleLangChange,
|
|
1915
|
+
style: {
|
|
1916
|
+
padding: "6px 8px",
|
|
1917
|
+
borderRadius: 4,
|
|
1918
|
+
border: "1px solid #ccc",
|
|
1919
|
+
fontSize: 14
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
/* @__PURE__ */ u.createElement("option", { value: "", disabled: !0 }, "Select Language"),
|
|
1923
|
+
W.map((a) => /* @__PURE__ */ u.createElement("option", { key: a.value, value: a.value }, a.label))
|
|
1924
|
+
)), /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ u.createElement(
|
|
1925
|
+
"div",
|
|
1926
|
+
{
|
|
1927
|
+
style: {
|
|
1928
|
+
display: "flex",
|
|
1929
|
+
alignItems: "center",
|
|
1930
|
+
justifyContent: "space-between"
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
/* @__PURE__ */ u.createElement(
|
|
1934
|
+
"span",
|
|
1935
|
+
{
|
|
1936
|
+
style: {
|
|
1937
|
+
fontSize: 12,
|
|
1938
|
+
fontWeight: 500,
|
|
1939
|
+
color: "var(--text-secondary)"
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
"AI Context"
|
|
1943
|
+
),
|
|
1944
|
+
s && /* @__PURE__ */ u.createElement(
|
|
1945
|
+
"button",
|
|
1946
|
+
{
|
|
1947
|
+
type: "button",
|
|
1948
|
+
title: "Copy from origin email",
|
|
1949
|
+
onClick: () => {
|
|
1950
|
+
const a = s();
|
|
1951
|
+
i(a);
|
|
1952
|
+
},
|
|
1953
|
+
className: "icon-button"
|
|
1954
|
+
},
|
|
1955
|
+
/* @__PURE__ */ u.createElement(pe, null)
|
|
1956
|
+
)
|
|
1957
|
+
), /* @__PURE__ */ u.createElement(
|
|
1958
|
+
"textarea",
|
|
1959
|
+
{
|
|
1960
|
+
value: r,
|
|
1961
|
+
onChange: (a) => i(a.target.value),
|
|
1962
|
+
style: {
|
|
1963
|
+
width: "100%",
|
|
1964
|
+
height: 120,
|
|
1965
|
+
resize: "vertical",
|
|
1966
|
+
padding: 8,
|
|
1967
|
+
border: "1px solid #ccc",
|
|
1968
|
+
borderRadius: 4,
|
|
1969
|
+
fontSize: 13,
|
|
1970
|
+
fontFamily: "inherit",
|
|
1971
|
+
boxSizing: "border-box"
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
)))
|
|
1975
|
+
)
|
|
1976
|
+
);
|
|
1919
1977
|
}
|
|
1920
1978
|
}
|
|
1921
1979
|
class bt extends u.Component {
|
|
@@ -1929,11 +1987,11 @@ class bt extends u.Component {
|
|
|
1929
1987
|
this.setState({ message: t.target.value });
|
|
1930
1988
|
});
|
|
1931
1989
|
g(this, "handleSubmit", async () => {
|
|
1932
|
-
const { message: t, messages: r, lang: i, originalEmail: s, conversationId: c } = this.state, { signer:
|
|
1990
|
+
const { message: t, messages: r, lang: i, originalEmail: s, conversationId: c } = this.state, { signer: a, baseUrl: h = "" } = this.props;
|
|
1933
1991
|
if (!t.trim()) return;
|
|
1934
|
-
const
|
|
1992
|
+
const l = Ee();
|
|
1935
1993
|
let o = {
|
|
1936
|
-
id:
|
|
1994
|
+
id: l,
|
|
1937
1995
|
question: t,
|
|
1938
1996
|
subject: "",
|
|
1939
1997
|
body: "",
|
|
@@ -1955,8 +2013,9 @@ class bt extends u.Component {
|
|
|
1955
2013
|
c && (p.conversation_id = c), await Ae(p, {
|
|
1956
2014
|
setContent: (y) => {
|
|
1957
2015
|
this.setState((S) => ({ messages: S.messages.map(
|
|
1958
|
-
(v) => v.id ===
|
|
2016
|
+
(v) => v.id === l ? {
|
|
1959
2017
|
...v,
|
|
2018
|
+
subject: "Some thing not used",
|
|
1960
2019
|
body: y,
|
|
1961
2020
|
isLoading: !1,
|
|
1962
2021
|
created_at: (/* @__PURE__ */ new Date()).getTime()
|
|
@@ -1965,13 +2024,13 @@ class bt extends u.Component {
|
|
|
1965
2024
|
},
|
|
1966
2025
|
setIsLoading: (y) => {
|
|
1967
2026
|
this.setState((S) => ({ messages: S.messages.map(
|
|
1968
|
-
(v) => v.id ===
|
|
2027
|
+
(v) => v.id === l ? { ...v, isLoading: y } : v
|
|
1969
2028
|
) }));
|
|
1970
2029
|
},
|
|
1971
2030
|
setConversationId: (y) => {
|
|
1972
2031
|
this.setState({ conversationId: y });
|
|
1973
2032
|
},
|
|
1974
|
-
signer:
|
|
2033
|
+
signer: a,
|
|
1975
2034
|
baseUrl: h
|
|
1976
2035
|
}), this.setState({ isSending: !1 });
|
|
1977
2036
|
});
|
|
@@ -1994,7 +2053,7 @@ class bt extends u.Component {
|
|
|
1994
2053
|
};
|
|
1995
2054
|
}
|
|
1996
2055
|
render() {
|
|
1997
|
-
const { onApply: t, getEditorContent: r } = this.props, { message: i, messages: s, isSending: c, lang:
|
|
2056
|
+
const { onApply: t, getEditorContent: r } = this.props, { message: i, messages: s, isSending: c, lang: a, originalEmail: h } = this.state;
|
|
1998
2057
|
return /* @__PURE__ */ u.createElement(
|
|
1999
2058
|
"div",
|
|
2000
2059
|
{
|
|
@@ -2025,7 +2084,7 @@ class bt extends u.Component {
|
|
|
2025
2084
|
flexDirection: "column",
|
|
2026
2085
|
alignItems: "center",
|
|
2027
2086
|
justifyContent: "center",
|
|
2028
|
-
color: "
|
|
2087
|
+
color: "var(--grey-light)"
|
|
2029
2088
|
}
|
|
2030
2089
|
},
|
|
2031
2090
|
/* @__PURE__ */ u.createElement(ze, { size: 46 }),
|
|
@@ -2035,7 +2094,7 @@ class bt extends u.Component {
|
|
|
2035
2094
|
style: {
|
|
2036
2095
|
marginTop: 16,
|
|
2037
2096
|
fontWeight: 600,
|
|
2038
|
-
color: "
|
|
2097
|
+
color: "inherit",
|
|
2039
2098
|
fontSize: 18
|
|
2040
2099
|
}
|
|
2041
2100
|
},
|
|
@@ -2048,9 +2107,9 @@ class bt extends u.Component {
|
|
|
2048
2107
|
style: {
|
|
2049
2108
|
width: "100%",
|
|
2050
2109
|
border: "1px solid #ddd",
|
|
2051
|
-
borderRadius:
|
|
2110
|
+
borderRadius: 4,
|
|
2052
2111
|
// overflow: "hidden",
|
|
2053
|
-
background: c ? "
|
|
2112
|
+
background: c ? "var(--background-lightGrey)" : "#fff",
|
|
2054
2113
|
display: "flex",
|
|
2055
2114
|
flexDirection: "column"
|
|
2056
2115
|
}
|
|
@@ -2061,12 +2120,13 @@ class bt extends u.Component {
|
|
|
2061
2120
|
value: i,
|
|
2062
2121
|
onChange: this.handleMessageChange,
|
|
2063
2122
|
placeholder: "Describe your email",
|
|
2123
|
+
name: "ai-content",
|
|
2064
2124
|
onKeyDown: this.handleKeyDown,
|
|
2065
2125
|
disabled: c,
|
|
2066
2126
|
style: {
|
|
2067
2127
|
flex: 1,
|
|
2068
2128
|
minWidth: 0,
|
|
2069
|
-
borderRadius:
|
|
2129
|
+
borderRadius: 4,
|
|
2070
2130
|
padding: 12,
|
|
2071
2131
|
fontSize: 13,
|
|
2072
2132
|
border: "none",
|
|
@@ -2093,7 +2153,7 @@ class bt extends u.Component {
|
|
|
2093
2153
|
/* @__PURE__ */ u.createElement(
|
|
2094
2154
|
dt,
|
|
2095
2155
|
{
|
|
2096
|
-
lang:
|
|
2156
|
+
lang: a,
|
|
2097
2157
|
setLang: this.setLang,
|
|
2098
2158
|
originalEmail: h,
|
|
2099
2159
|
setOriginalEmail: this.setOriginalEmail,
|
|
@@ -2105,21 +2165,10 @@ class bt extends u.Component {
|
|
|
2105
2165
|
{
|
|
2106
2166
|
disabled: !i.trim() || c,
|
|
2107
2167
|
onClick: this.handleSubmit,
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
background: !i.trim() || c ? "#e0e0e0" : "#1976d2",
|
|
2111
|
-
color: "#fff",
|
|
2112
|
-
border: "none",
|
|
2113
|
-
borderRadius: 4,
|
|
2114
|
-
padding: "6px 12px",
|
|
2115
|
-
cursor: !i.trim() || c ? "not-allowed" : "pointer",
|
|
2116
|
-
display: "flex",
|
|
2117
|
-
alignItems: "center",
|
|
2118
|
-
justifyContent: "center",
|
|
2119
|
-
transition: "background 0.2s"
|
|
2120
|
-
}
|
|
2168
|
+
className: "icon-button",
|
|
2169
|
+
color: "primary"
|
|
2121
2170
|
},
|
|
2122
|
-
/* @__PURE__ */ u.createElement(Ce,
|
|
2171
|
+
/* @__PURE__ */ u.createElement(Ce, null)
|
|
2123
2172
|
)
|
|
2124
2173
|
)
|
|
2125
2174
|
)
|