hanbiro-react16-sdk 1.0.0

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.
@@ -0,0 +1,2131 @@
1
+ var Re = Object.defineProperty;
2
+ var $e = (n, e, t) => e in n ? Re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var g = (n, e, t) => $e(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import * as u from "react";
5
+ import { v4 as Ee } from "uuid";
6
+ import { Copy as pe, Settings as Te, Send as Ce } from "react-feather";
7
+ const W = [
8
+ { label: "Korean", value: "KR", extra: "ko" },
9
+ { label: "English", value: "US", extra: "en" },
10
+ { label: "Japanese", value: "JP" },
11
+ { label: "Simplified Chinese", value: "zh-CN", extra: "zh-chs" },
12
+ { label: "Traditional Chinese (Taiwan)", value: "zh-TW" },
13
+ { label: "Traditional Chinese (Hong Kong)", value: "zh-HK", extra: "zh-cht" },
14
+ { label: "Vietnamese", value: "VN", extra: "vi" },
15
+ { label: "Indonesian", value: "ID", extra: "id" }
16
+ ], ze = ({ isGradient: n = !1, stroke: e = 1.5, size: t = 40 }) => {
17
+ const r = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
18
+ return /* @__PURE__ */ u.createElement(
19
+ "svg",
20
+ {
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: t,
23
+ height: t,
24
+ viewBox: "0 0 24 24",
25
+ style: { flexShrink: 0 }
26
+ },
27
+ n && /* @__PURE__ */ u.createElement("defs", null, /* @__PURE__ */ u.createElement("linearGradient", { id: r, x1: "0%", y1: "0%", x2: "0%", y2: "100%" }, /* @__PURE__ */ u.createElement("stop", { offset: "0%", stopColor: "#9D50BB" }, /* @__PURE__ */ u.createElement(
28
+ "animate",
29
+ {
30
+ attributeName: "offset",
31
+ values: "0%;0.4;0%",
32
+ dur: "1s",
33
+ repeatCount: "indefinite"
34
+ }
35
+ )), /* @__PURE__ */ u.createElement("stop", { offset: "30%", stopColor: "#6E48AA" }, /* @__PURE__ */ u.createElement(
36
+ "animate",
37
+ {
38
+ attributeName: "offset",
39
+ values: "0.4;0.7;0.4",
40
+ dur: "1s",
41
+ repeatCount: "indefinite"
42
+ }
43
+ )), /* @__PURE__ */ u.createElement("stop", { offset: "50%", stopColor: "#4776E6" }, /* @__PURE__ */ u.createElement(
44
+ "animate",
45
+ {
46
+ attributeName: "offset",
47
+ values: "0.5;0.7;0.5",
48
+ dur: "1s",
49
+ repeatCount: "indefinite"
50
+ }
51
+ )), /* @__PURE__ */ u.createElement(
52
+ "animateTransform",
53
+ {
54
+ attributeName: "gradientTransform",
55
+ type: "translate",
56
+ from: "0,0",
57
+ to: "100,0",
58
+ dur: "1s",
59
+ repeatCount: "indefinite"
60
+ }
61
+ ))),
62
+ /* @__PURE__ */ u.createElement(
63
+ "path",
64
+ {
65
+ fill: "none",
66
+ stroke: n ? `url(#${r})` : "currentColor",
67
+ strokeLinecap: "round",
68
+ strokeLinejoin: "round",
69
+ strokeWidth: e,
70
+ d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"
71
+ }
72
+ )
73
+ );
74
+ };
75
+ async function Ae(n, { setContent: e, setIsLoading: t, setConversationId: r, signer: i, baseUrl: s }) {
76
+ let c = "";
77
+ try {
78
+ t(!0);
79
+ const l = {
80
+ method: "POST",
81
+ baseURL: s,
82
+ url: "/nmail/chatdraft",
83
+ params: n
84
+ };
85
+ let h = {};
86
+ i && typeof i.generateHeaders == "function" && (h = await i.generateHeaders(l));
87
+ const a = await fetch(`${s}/nmail/chatdraft`, {
88
+ method: "POST",
89
+ body: JSON.stringify(n),
90
+ headers: {
91
+ "Content-Type": "application/json",
92
+ "Access-Control-Allow-Origin": "*",
93
+ ...h
94
+ }
95
+ });
96
+ if (t(!1), !a.body)
97
+ throw new Error("Response body is not available for streaming.");
98
+ const o = a.body.getReader();
99
+ let d = "", p = 0;
100
+ for (; ; ) {
101
+ const { done: x, value: f } = await o.read();
102
+ if (x)
103
+ break;
104
+ let b = "", y = "";
105
+ try {
106
+ const S = new TextDecoder().decode(f);
107
+ d += S;
108
+ const A = /"answer":".*?"/g, v = /"conversation_id"\s*:\s*"([^"]+)"/, I = [...d.matchAll(A)], L = d.match(v);
109
+ for (L && L[1] && r(L[1]); p < I.length; ) {
110
+ const _ = I[p];
111
+ try {
112
+ b = _[0];
113
+ const R = b.slice(10, b.length - 1);
114
+ y = `"${R}"`, R.endsWith("\\") && (y = `"${R}\\"`);
115
+ const Se = JSON.parse(y);
116
+ c += Se, e(c);
117
+ } catch (R) {
118
+ console.error("Parse error: ", R, b, y);
119
+ }
120
+ p++;
121
+ }
122
+ } catch (S) {
123
+ console.error("TextDecoder error: ", S, b);
124
+ }
125
+ }
126
+ return c;
127
+ } catch (l) {
128
+ console.error("Summary error:", l), e("");
129
+ } finally {
130
+ t(!1);
131
+ }
132
+ return "";
133
+ }
134
+ function J() {
135
+ return {
136
+ async: !1,
137
+ breaks: !1,
138
+ extensions: null,
139
+ gfm: !0,
140
+ hooks: null,
141
+ pedantic: !1,
142
+ renderer: null,
143
+ silent: !1,
144
+ tokenizer: null,
145
+ walkTokens: null
146
+ };
147
+ }
148
+ var z = J();
149
+ function ue(n) {
150
+ z = n;
151
+ }
152
+ var D = { exec: () => null };
153
+ function k(n, e = "") {
154
+ let t = typeof n == "string" ? n : n.source;
155
+ const r = {
156
+ replace: (i, s) => {
157
+ let c = typeof s == "string" ? s : s.source;
158
+ return c = c.replace(w.caret, "$1"), t = t.replace(i, c), r;
159
+ },
160
+ getRegex: () => new RegExp(t, e)
161
+ };
162
+ return r;
163
+ }
164
+ var w = {
165
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
166
+ outputLinkReplace: /\\([\[\]])/g,
167
+ indentCodeCompensation: /^(\s+)(?:```)/,
168
+ beginningSpace: /^\s+/,
169
+ endingHash: /#$/,
170
+ startingSpaceChar: /^ /,
171
+ endingSpaceChar: / $/,
172
+ nonSpaceChar: /[^ ]/,
173
+ newLineCharGlobal: /\n/g,
174
+ tabCharGlobal: /\t/g,
175
+ multipleSpaceGlobal: /\s+/g,
176
+ blankLine: /^[ \t]*$/,
177
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
178
+ blockquoteStart: /^ {0,3}>/,
179
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
180
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
181
+ listReplaceTabs: /^\t+/,
182
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
183
+ listIsTask: /^\[[ xX]\] /,
184
+ listReplaceTask: /^\[[ xX]\] +/,
185
+ anyLine: /\n.*\n/,
186
+ hrefBrackets: /^<(.*)>$/,
187
+ tableDelimiter: /[:|]/,
188
+ tableAlignChars: /^\||\| *$/g,
189
+ tableRowBlankLine: /\n[ \t]*$/,
190
+ tableAlignRight: /^ *-+: *$/,
191
+ tableAlignCenter: /^ *:-+: *$/,
192
+ tableAlignLeft: /^ *:-+ *$/,
193
+ startATag: /^<a /i,
194
+ endATag: /^<\/a>/i,
195
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
196
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
197
+ startAngleBracket: /^</,
198
+ endAngleBracket: />$/,
199
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
200
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
201
+ escapeTest: /[&<>"']/,
202
+ escapeReplace: /[&<>"']/g,
203
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
204
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
205
+ unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
206
+ caret: /(^|[^\[])\^/g,
207
+ percentDecode: /%25/g,
208
+ findPipe: /\|/g,
209
+ splitPipe: / \|/,
210
+ slashPipe: /\\\|/g,
211
+ carriageReturn: /\r\n|\r/g,
212
+ spaceLine: /^ +$/gm,
213
+ notSpaceStart: /^\S*/,
214
+ endingNewline: /\n$/,
215
+ listItemRegex: (n) => new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),
216
+ nextBulletRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
217
+ hrRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
218
+ fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`),
219
+ headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`),
220
+ htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i")
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
+ "^ {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
+ "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(), je = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", fe).getRegex(), te = {
225
+ blockquote: je,
226
+ code: Le,
227
+ def: qe,
228
+ fences: _e,
229
+ heading: Pe,
230
+ hr: q,
231
+ html: Oe,
232
+ lheading: de,
233
+ list: Me,
234
+ newline: Ie,
235
+ paragraph: fe,
236
+ table: D,
237
+ text: De
238
+ }, se = k(
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(), Ne = {
241
+ ...te,
242
+ lheading: Be,
243
+ table: se,
244
+ paragraph: k(X).replace("hr", q).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).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()
245
+ }, Ze = {
246
+ ...te,
247
+ html: k(
248
+ `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
249
+ ).replace("comment", ee).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
250
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
251
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
252
+ fences: D,
253
+ // fences not supported
254
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
255
+ paragraph: k(X).replace("hr", q).replace("heading", ` *#{1,6} *[^
256
+ ]`).replace("lheading", de).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
257
+ }, He = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ge = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, me = /^( {2,}|\\)\n(?!\s*$)/, Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, G = /[\p{P}\p{S}]/u, ne = /[\s\p{P}\p{S}]/u, ke = /[^\s\p{P}\p{S}]/u, We = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ne).getRegex(), be = /(?!~)[\p{P}\p{S}]/u, Fe = /(?!~)[\s\p{P}\p{S}]/u, Ke = /(?:[^\s\p{P}\p{S}]|~)/u, Ue = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, xe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Je = k(xe, "u").replace(/punct/g, G).getRegex(), Ve = k(xe, "u").replace(/punct/g, be).getRegex(), we = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Xe = k(we, "gu").replace(/notPunctSpace/g, ke).replace(/punctSpace/g, ne).replace(/punct/g, G).getRegex(), Ye = k(we, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Fe).replace(/punct/g, be).getRegex(), et = k(
258
+ "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
259
+ "gu"
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
+ "^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(), j = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, st = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", j).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ye = k(/^!?\[(label)\]\[(ref)\]/).replace("label", j).replace("ref", Y).getRegex(), ve = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex(), lt = k("reflink|nolink(?!\\()", "g").replace("reflink", ye).replace("nolink", ve).getRegex(), re = {
263
+ _backpedal: D,
264
+ // only used for GFM url
265
+ anyPunctuation: tt,
266
+ autolink: nt,
267
+ blockSkip: Ue,
268
+ br: me,
269
+ code: Ge,
270
+ del: D,
271
+ emStrongLDelim: Je,
272
+ emStrongRDelimAst: Xe,
273
+ emStrongRDelimUnd: et,
274
+ escape: He,
275
+ link: st,
276
+ nolink: ve,
277
+ punctuation: We,
278
+ reflink: ye,
279
+ reflinkSearch: lt,
280
+ tag: it,
281
+ text: Qe,
282
+ url: D
283
+ }, at = {
284
+ ...re,
285
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", j).getRegex(),
286
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", j).getRegex()
287
+ }, F = {
288
+ ...re,
289
+ emStrongRDelimAst: Ye,
290
+ emStrongLDelim: Ve,
291
+ url: k(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
292
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
293
+ del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
294
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
295
+ }, ot = {
296
+ ...F,
297
+ br: k(me).replace("{2,}", "*").getRegex(),
298
+ text: k(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
299
+ }, M = {
300
+ normal: te,
301
+ gfm: Ne,
302
+ pedantic: Ze
303
+ }, P = {
304
+ normal: re,
305
+ gfm: F,
306
+ breaks: ot,
307
+ pedantic: at
308
+ }, ct = {
309
+ "&": "&amp;",
310
+ "<": "&lt;",
311
+ ">": "&gt;",
312
+ '"': "&quot;",
313
+ "'": "&#39;"
314
+ }, le = (n) => ct[n];
315
+ function $(n, e) {
316
+ if (e) {
317
+ if (w.escapeTest.test(n))
318
+ return n.replace(w.escapeReplace, le);
319
+ } else if (w.escapeTestNoEncode.test(n))
320
+ return n.replace(w.escapeReplaceNoEncode, le);
321
+ return n;
322
+ }
323
+ function ae(n) {
324
+ try {
325
+ n = encodeURI(n).replace(w.percentDecode, "%");
326
+ } catch {
327
+ return null;
328
+ }
329
+ return n;
330
+ }
331
+ function oe(n, e) {
332
+ var s;
333
+ const t = n.replace(w.findPipe, (c, l, h) => {
334
+ let a = !1, o = l;
335
+ for (; --o >= 0 && h[o] === "\\"; ) a = !a;
336
+ return a ? "|" : " |";
337
+ }), r = t.split(w.splitPipe);
338
+ let i = 0;
339
+ if (r[0].trim() || r.shift(), r.length > 0 && !((s = r.at(-1)) != null && s.trim()) && r.pop(), e)
340
+ if (r.length > e)
341
+ r.splice(e);
342
+ else
343
+ for (; r.length < e; ) r.push("");
344
+ for (; i < r.length; i++)
345
+ r[i] = r[i].trim().replace(w.slashPipe, "|");
346
+ return r;
347
+ }
348
+ function B(n, e, t) {
349
+ const r = n.length;
350
+ if (r === 0)
351
+ return "";
352
+ let i = 0;
353
+ for (; i < r && n.charAt(r - i - 1) === e; )
354
+ i++;
355
+ return n.slice(0, r - i);
356
+ }
357
+ function ht(n, e) {
358
+ if (n.indexOf(e[1]) === -1)
359
+ return -1;
360
+ let t = 0;
361
+ for (let r = 0; r < n.length; r++)
362
+ if (n[r] === "\\")
363
+ r++;
364
+ else if (n[r] === e[0])
365
+ t++;
366
+ else if (n[r] === e[1] && (t--, t < 0))
367
+ return r;
368
+ return t > 0 ? -2 : -1;
369
+ }
370
+ function ce(n, e, t, r, i) {
371
+ const s = e.href, c = e.title || null, l = n[1].replace(i.other.outputLinkReplace, "$1");
372
+ r.state.inLink = !0;
373
+ const h = {
374
+ type: n[0].charAt(0) === "!" ? "image" : "link",
375
+ raw: t,
376
+ href: s,
377
+ title: c,
378
+ text: l,
379
+ tokens: r.inlineTokens(l)
380
+ };
381
+ return r.state.inLink = !1, h;
382
+ }
383
+ function pt(n, e, t) {
384
+ const r = n.match(t.other.indentCodeCompensation);
385
+ if (r === null)
386
+ return e;
387
+ const i = r[1];
388
+ return e.split(`
389
+ `).map((s) => {
390
+ const c = s.match(t.other.beginningSpace);
391
+ if (c === null)
392
+ return s;
393
+ const [l] = c;
394
+ return l.length >= i.length ? s.slice(i.length) : s;
395
+ }).join(`
396
+ `);
397
+ }
398
+ var N = class {
399
+ // set by the lexer
400
+ constructor(n) {
401
+ g(this, "options");
402
+ g(this, "rules");
403
+ // set by the lexer
404
+ g(this, "lexer");
405
+ this.options = n || z;
406
+ }
407
+ space(n) {
408
+ const e = this.rules.block.newline.exec(n);
409
+ if (e && e[0].length > 0)
410
+ return {
411
+ type: "space",
412
+ raw: e[0]
413
+ };
414
+ }
415
+ code(n) {
416
+ const e = this.rules.block.code.exec(n);
417
+ if (e) {
418
+ const t = e[0].replace(this.rules.other.codeRemoveIndent, "");
419
+ return {
420
+ type: "code",
421
+ raw: e[0],
422
+ codeBlockStyle: "indented",
423
+ text: this.options.pedantic ? t : B(t, `
424
+ `)
425
+ };
426
+ }
427
+ }
428
+ fences(n) {
429
+ const e = this.rules.block.fences.exec(n);
430
+ if (e) {
431
+ const t = e[0], r = pt(t, e[3] || "", this.rules);
432
+ return {
433
+ type: "code",
434
+ raw: t,
435
+ lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2],
436
+ text: r
437
+ };
438
+ }
439
+ }
440
+ heading(n) {
441
+ const e = this.rules.block.heading.exec(n);
442
+ if (e) {
443
+ let t = e[2].trim();
444
+ if (this.rules.other.endingHash.test(t)) {
445
+ const r = B(t, "#");
446
+ (this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (t = r.trim());
447
+ }
448
+ return {
449
+ type: "heading",
450
+ raw: e[0],
451
+ depth: e[1].length,
452
+ text: t,
453
+ tokens: this.lexer.inline(t)
454
+ };
455
+ }
456
+ }
457
+ hr(n) {
458
+ const e = this.rules.block.hr.exec(n);
459
+ if (e)
460
+ return {
461
+ type: "hr",
462
+ raw: B(e[0], `
463
+ `)
464
+ };
465
+ }
466
+ blockquote(n) {
467
+ const e = this.rules.block.blockquote.exec(n);
468
+ if (e) {
469
+ let t = B(e[0], `
470
+ `).split(`
471
+ `), r = "", i = "";
472
+ const s = [];
473
+ for (; t.length > 0; ) {
474
+ let c = !1;
475
+ const l = [];
476
+ let h;
477
+ for (h = 0; h < t.length; h++)
478
+ if (this.rules.other.blockquoteStart.test(t[h]))
479
+ l.push(t[h]), c = !0;
480
+ else if (!c)
481
+ l.push(t[h]);
482
+ else
483
+ break;
484
+ t = t.slice(h);
485
+ const a = l.join(`
486
+ `), o = a.replace(this.rules.other.blockquoteSetextReplace, `
487
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
488
+ r = r ? `${r}
489
+ ${a}` : a, i = i ? `${i}
490
+ ${o}` : o;
491
+ const d = this.lexer.state.top;
492
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(o, s, !0), this.lexer.state.top = d, t.length === 0)
493
+ break;
494
+ const p = s.at(-1);
495
+ if ((p == null ? void 0 : p.type) === "code")
496
+ break;
497
+ if ((p == null ? void 0 : p.type) === "blockquote") {
498
+ const x = p, f = x.raw + `
499
+ ` + t.join(`
500
+ `), b = this.blockquote(f);
501
+ s[s.length - 1] = b, r = r.substring(0, r.length - x.raw.length) + b.raw, i = i.substring(0, i.length - x.text.length) + b.text;
502
+ break;
503
+ } else if ((p == null ? void 0 : p.type) === "list") {
504
+ const x = p, f = x.raw + `
505
+ ` + t.join(`
506
+ `), b = this.list(f);
507
+ s[s.length - 1] = b, r = r.substring(0, r.length - p.raw.length) + b.raw, i = i.substring(0, i.length - x.raw.length) + b.raw, t = f.substring(s.at(-1).raw.length).split(`
508
+ `);
509
+ continue;
510
+ }
511
+ }
512
+ return {
513
+ type: "blockquote",
514
+ raw: r,
515
+ tokens: s,
516
+ text: i
517
+ };
518
+ }
519
+ }
520
+ list(n) {
521
+ let e = this.rules.block.list.exec(n);
522
+ if (e) {
523
+ let t = e[1].trim();
524
+ const r = t.length > 1, i = {
525
+ type: "list",
526
+ raw: "",
527
+ ordered: r,
528
+ start: r ? +t.slice(0, -1) : "",
529
+ loose: !1,
530
+ items: []
531
+ };
532
+ t = r ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = r ? t : "[*+-]");
533
+ const s = this.rules.other.listItemRegex(t);
534
+ let c = !1;
535
+ for (; n; ) {
536
+ let h = !1, a = "", o = "";
537
+ if (!(e = s.exec(n)) || this.rules.block.hr.test(n))
538
+ break;
539
+ a = e[0], n = n.substring(a.length);
540
+ let d = e[2].split(`
541
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (S) => " ".repeat(3 * S.length)), p = n.split(`
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) && (a += p + `
544
+ `, n = n.substring(p.length + 1), h = !0), !h) {
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
+ for (; n; ) {
547
+ const _ = n.split(`
548
+ `, 1)[0];
549
+ let R;
550
+ if (p = _, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), R = p) : R = p.replace(this.rules.other.tabCharGlobal, " "), v.test(p) || I.test(p) || L.test(p) || S.test(p) || A.test(p))
551
+ break;
552
+ if (R.search(this.rules.other.nonSpaceChar) >= f || !p.trim())
553
+ o += `
554
+ ` + R.slice(f);
555
+ else {
556
+ if (x || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(d) || I.test(d) || A.test(d))
557
+ break;
558
+ o += `
559
+ ` + p;
560
+ }
561
+ !x && !p.trim() && (x = !0), a += _ + `
562
+ `, n = n.substring(_.length + 1), d = R.slice(f);
563
+ }
564
+ }
565
+ i.loose || (c ? i.loose = !0 : this.rules.other.doubleBlankLine.test(a) && (c = !0));
566
+ let b = null, y;
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
+ type: "list_item",
569
+ raw: a,
570
+ task: !!b,
571
+ checked: y,
572
+ loose: !1,
573
+ text: o,
574
+ tokens: []
575
+ }), i.raw += a;
576
+ }
577
+ const l = i.items.at(-1);
578
+ if (l)
579
+ l.raw = l.raw.trimEnd(), l.text = l.text.trimEnd();
580
+ else
581
+ return;
582
+ i.raw = i.raw.trimEnd();
583
+ for (let h = 0; h < i.items.length; h++)
584
+ if (this.lexer.state.top = !1, i.items[h].tokens = this.lexer.blockTokens(i.items[h].text, []), !i.loose) {
585
+ const a = i.items[h].tokens.filter((d) => d.type === "space"), o = a.length > 0 && a.some((d) => this.rules.other.anyLine.test(d.raw));
586
+ i.loose = o;
587
+ }
588
+ if (i.loose)
589
+ for (let h = 0; h < i.items.length; h++)
590
+ i.items[h].loose = !0;
591
+ return i;
592
+ }
593
+ }
594
+ html(n) {
595
+ const e = this.rules.block.html.exec(n);
596
+ if (e)
597
+ return {
598
+ type: "html",
599
+ block: !0,
600
+ raw: e[0],
601
+ pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
602
+ text: e[0]
603
+ };
604
+ }
605
+ def(n) {
606
+ const e = this.rules.block.def.exec(n);
607
+ if (e) {
608
+ const t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
609
+ return {
610
+ type: "def",
611
+ tag: t,
612
+ raw: e[0],
613
+ href: r,
614
+ title: i
615
+ };
616
+ }
617
+ }
618
+ table(n) {
619
+ var c;
620
+ const e = this.rules.block.table.exec(n);
621
+ if (!e || !this.rules.other.tableDelimiter.test(e[2]))
622
+ return;
623
+ const t = oe(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = (c = e[3]) != null && c.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
624
+ `) : [], s = {
625
+ type: "table",
626
+ raw: e[0],
627
+ header: [],
628
+ align: [],
629
+ rows: []
630
+ };
631
+ if (t.length === r.length) {
632
+ for (const l of r)
633
+ this.rules.other.tableAlignRight.test(l) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? s.align.push("left") : s.align.push(null);
634
+ for (let l = 0; l < t.length; l++)
635
+ s.header.push({
636
+ text: t[l],
637
+ tokens: this.lexer.inline(t[l]),
638
+ header: !0,
639
+ align: s.align[l]
640
+ });
641
+ for (const l of i)
642
+ s.rows.push(oe(l, s.header.length).map((h, a) => ({
643
+ text: h,
644
+ tokens: this.lexer.inline(h),
645
+ header: !1,
646
+ align: s.align[a]
647
+ })));
648
+ return s;
649
+ }
650
+ }
651
+ lheading(n) {
652
+ const e = this.rules.block.lheading.exec(n);
653
+ if (e)
654
+ return {
655
+ type: "heading",
656
+ raw: e[0],
657
+ depth: e[2].charAt(0) === "=" ? 1 : 2,
658
+ text: e[1],
659
+ tokens: this.lexer.inline(e[1])
660
+ };
661
+ }
662
+ paragraph(n) {
663
+ const e = this.rules.block.paragraph.exec(n);
664
+ if (e) {
665
+ const t = e[1].charAt(e[1].length - 1) === `
666
+ ` ? e[1].slice(0, -1) : e[1];
667
+ return {
668
+ type: "paragraph",
669
+ raw: e[0],
670
+ text: t,
671
+ tokens: this.lexer.inline(t)
672
+ };
673
+ }
674
+ }
675
+ text(n) {
676
+ const e = this.rules.block.text.exec(n);
677
+ if (e)
678
+ return {
679
+ type: "text",
680
+ raw: e[0],
681
+ text: e[0],
682
+ tokens: this.lexer.inline(e[0])
683
+ };
684
+ }
685
+ escape(n) {
686
+ const e = this.rules.inline.escape.exec(n);
687
+ if (e)
688
+ return {
689
+ type: "escape",
690
+ raw: e[0],
691
+ text: e[1]
692
+ };
693
+ }
694
+ tag(n) {
695
+ const e = this.rules.inline.tag.exec(n);
696
+ if (e)
697
+ return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), {
698
+ type: "html",
699
+ raw: e[0],
700
+ inLink: this.lexer.state.inLink,
701
+ inRawBlock: this.lexer.state.inRawBlock,
702
+ block: !1,
703
+ text: e[0]
704
+ };
705
+ }
706
+ link(n) {
707
+ const e = this.rules.inline.link.exec(n);
708
+ if (e) {
709
+ const t = e[2].trim();
710
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
711
+ if (!this.rules.other.endAngleBracket.test(t))
712
+ return;
713
+ const s = B(t.slice(0, -1), "\\");
714
+ if ((t.length - s.length) % 2 === 0)
715
+ return;
716
+ } else {
717
+ const s = ht(e[2], "()");
718
+ if (s === -2)
719
+ return;
720
+ if (s > -1) {
721
+ const l = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + s;
722
+ e[2] = e[2].substring(0, s), e[0] = e[0].substring(0, l).trim(), e[3] = "";
723
+ }
724
+ }
725
+ let r = e[2], i = "";
726
+ if (this.options.pedantic) {
727
+ const s = this.rules.other.pedanticHrefTitle.exec(r);
728
+ s && (r = s[1], i = s[3]);
729
+ } else
730
+ i = e[3] ? e[3].slice(1, -1) : "";
731
+ return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? r = r.slice(1) : r = r.slice(1, -1)), ce(e, {
732
+ href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
733
+ title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
734
+ }, e[0], this.lexer, this.rules);
735
+ }
736
+ }
737
+ reflink(n, e) {
738
+ let t;
739
+ if ((t = this.rules.inline.reflink.exec(n)) || (t = this.rules.inline.nolink.exec(n))) {
740
+ const r = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = e[r.toLowerCase()];
741
+ if (!i) {
742
+ const s = t[0].charAt(0);
743
+ return {
744
+ type: "text",
745
+ raw: s,
746
+ text: s
747
+ };
748
+ }
749
+ return ce(t, i, t[0], this.lexer, this.rules);
750
+ }
751
+ }
752
+ emStrong(n, e, t = "") {
753
+ let r = this.rules.inline.emStrongLDelim.exec(n);
754
+ if (!r || r[3] && t.match(this.rules.other.unicodeAlphaNumeric)) return;
755
+ if (!(r[1] || r[2] || "") || !t || this.rules.inline.punctuation.exec(t)) {
756
+ const s = [...r[0]].length - 1;
757
+ let c, l, h = s, a = 0;
758
+ const o = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
759
+ for (o.lastIndex = 0, e = e.slice(-1 * n.length + s); (r = o.exec(e)) != null; ) {
760
+ if (c = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !c) continue;
761
+ if (l = [...c].length, r[3] || r[4]) {
762
+ h += l;
763
+ continue;
764
+ } else if ((r[5] || r[6]) && s % 3 && !((s + l) % 3)) {
765
+ a += l;
766
+ continue;
767
+ }
768
+ if (h -= l, h > 0) continue;
769
+ l = Math.min(l, l + h + a);
770
+ const d = [...r[0]][0].length, p = n.slice(0, s + r.index + d + l);
771
+ if (Math.min(s, l) % 2) {
772
+ const f = p.slice(1, -1);
773
+ return {
774
+ type: "em",
775
+ raw: p,
776
+ text: f,
777
+ tokens: this.lexer.inlineTokens(f)
778
+ };
779
+ }
780
+ const x = p.slice(2, -2);
781
+ return {
782
+ type: "strong",
783
+ raw: p,
784
+ text: x,
785
+ tokens: this.lexer.inlineTokens(x)
786
+ };
787
+ }
788
+ }
789
+ }
790
+ codespan(n) {
791
+ const e = this.rules.inline.code.exec(n);
792
+ if (e) {
793
+ let t = e[2].replace(this.rules.other.newLineCharGlobal, " ");
794
+ const r = this.rules.other.nonSpaceChar.test(t), i = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
795
+ return r && i && (t = t.substring(1, t.length - 1)), {
796
+ type: "codespan",
797
+ raw: e[0],
798
+ text: t
799
+ };
800
+ }
801
+ }
802
+ br(n) {
803
+ const e = this.rules.inline.br.exec(n);
804
+ if (e)
805
+ return {
806
+ type: "br",
807
+ raw: e[0]
808
+ };
809
+ }
810
+ del(n) {
811
+ const e = this.rules.inline.del.exec(n);
812
+ if (e)
813
+ return {
814
+ type: "del",
815
+ raw: e[0],
816
+ text: e[2],
817
+ tokens: this.lexer.inlineTokens(e[2])
818
+ };
819
+ }
820
+ autolink(n) {
821
+ const e = this.rules.inline.autolink.exec(n);
822
+ if (e) {
823
+ let t, r;
824
+ return e[2] === "@" ? (t = e[1], r = "mailto:" + t) : (t = e[1], r = t), {
825
+ type: "link",
826
+ raw: e[0],
827
+ text: t,
828
+ href: r,
829
+ tokens: [
830
+ {
831
+ type: "text",
832
+ raw: t,
833
+ text: t
834
+ }
835
+ ]
836
+ };
837
+ }
838
+ }
839
+ url(n) {
840
+ var t;
841
+ let e;
842
+ if (e = this.rules.inline.url.exec(n)) {
843
+ let r, i;
844
+ if (e[2] === "@")
845
+ r = e[0], i = "mailto:" + r;
846
+ else {
847
+ let s;
848
+ do
849
+ s = e[0], e[0] = ((t = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : t[0]) ?? "";
850
+ while (s !== e[0]);
851
+ r = e[0], e[1] === "www." ? i = "http://" + e[0] : i = e[0];
852
+ }
853
+ return {
854
+ type: "link",
855
+ raw: e[0],
856
+ text: r,
857
+ href: i,
858
+ tokens: [
859
+ {
860
+ type: "text",
861
+ raw: r,
862
+ text: r
863
+ }
864
+ ]
865
+ };
866
+ }
867
+ }
868
+ inlineText(n) {
869
+ const e = this.rules.inline.text.exec(n);
870
+ if (e) {
871
+ const t = this.lexer.state.inRawBlock;
872
+ return {
873
+ type: "text",
874
+ raw: e[0],
875
+ text: e[0],
876
+ escaped: t
877
+ };
878
+ }
879
+ }
880
+ }, E = class K {
881
+ constructor(e) {
882
+ g(this, "tokens");
883
+ g(this, "options");
884
+ g(this, "state");
885
+ g(this, "tokenizer");
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 N(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
888
+ inLink: !1,
889
+ inRawBlock: !1,
890
+ top: !0
891
+ };
892
+ const t = {
893
+ other: w,
894
+ block: M.normal,
895
+ inline: P.normal
896
+ };
897
+ this.options.pedantic ? (t.block = M.pedantic, t.inline = P.pedantic) : this.options.gfm && (t.block = M.gfm, this.options.breaks ? t.inline = P.breaks : t.inline = P.gfm), this.tokenizer.rules = t;
898
+ }
899
+ /**
900
+ * Expose Rules
901
+ */
902
+ static get rules() {
903
+ return {
904
+ block: M,
905
+ inline: P
906
+ };
907
+ }
908
+ /**
909
+ * Static Lex Method
910
+ */
911
+ static lex(e, t) {
912
+ return new K(t).lex(e);
913
+ }
914
+ /**
915
+ * Static Lex Inline Method
916
+ */
917
+ static lexInline(e, t) {
918
+ return new K(t).inlineTokens(e);
919
+ }
920
+ /**
921
+ * Preprocessing
922
+ */
923
+ lex(e) {
924
+ e = e.replace(w.carriageReturn, `
925
+ `), this.blockTokens(e, this.tokens);
926
+ for (let t = 0; t < this.inlineQueue.length; t++) {
927
+ const r = this.inlineQueue[t];
928
+ this.inlineTokens(r.src, r.tokens);
929
+ }
930
+ return this.inlineQueue = [], this.tokens;
931
+ }
932
+ blockTokens(e, t = [], r = !1) {
933
+ var i, s, c;
934
+ for (this.options.pedantic && (e = e.replace(w.tabCharGlobal, " ").replace(w.spaceLine, "")); e; ) {
935
+ let l;
936
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.block) != null && s.some((a) => (l = a.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1))
937
+ continue;
938
+ if (l = this.tokenizer.space(e)) {
939
+ e = e.substring(l.raw.length);
940
+ const a = t.at(-1);
941
+ l.raw.length === 1 && a !== void 0 ? a.raw += `
942
+ ` : t.push(l);
943
+ continue;
944
+ }
945
+ if (l = this.tokenizer.code(e)) {
946
+ e = e.substring(l.raw.length);
947
+ const a = t.at(-1);
948
+ (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
949
+ ` + l.raw, a.text += `
950
+ ` + l.text, this.inlineQueue.at(-1).src = a.text) : t.push(l);
951
+ continue;
952
+ }
953
+ if (l = this.tokenizer.fences(e)) {
954
+ e = e.substring(l.raw.length), t.push(l);
955
+ continue;
956
+ }
957
+ if (l = this.tokenizer.heading(e)) {
958
+ e = e.substring(l.raw.length), t.push(l);
959
+ continue;
960
+ }
961
+ if (l = this.tokenizer.hr(e)) {
962
+ e = e.substring(l.raw.length), t.push(l);
963
+ continue;
964
+ }
965
+ if (l = this.tokenizer.blockquote(e)) {
966
+ e = e.substring(l.raw.length), t.push(l);
967
+ continue;
968
+ }
969
+ if (l = this.tokenizer.list(e)) {
970
+ e = e.substring(l.raw.length), t.push(l);
971
+ continue;
972
+ }
973
+ if (l = this.tokenizer.html(e)) {
974
+ e = e.substring(l.raw.length), t.push(l);
975
+ continue;
976
+ }
977
+ if (l = this.tokenizer.def(e)) {
978
+ e = e.substring(l.raw.length);
979
+ const a = t.at(-1);
980
+ (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
981
+ ` + l.raw, a.text += `
982
+ ` + l.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = {
983
+ href: l.href,
984
+ title: l.title
985
+ });
986
+ continue;
987
+ }
988
+ if (l = this.tokenizer.table(e)) {
989
+ e = e.substring(l.raw.length), t.push(l);
990
+ continue;
991
+ }
992
+ if (l = this.tokenizer.lheading(e)) {
993
+ e = e.substring(l.raw.length), t.push(l);
994
+ continue;
995
+ }
996
+ let h = e;
997
+ if ((c = this.options.extensions) != null && c.startBlock) {
998
+ let a = 1 / 0;
999
+ const o = e.slice(1);
1000
+ let d;
1001
+ this.options.extensions.startBlock.forEach((p) => {
1002
+ d = p.call({ lexer: this }, o), typeof d == "number" && d >= 0 && (a = Math.min(a, d));
1003
+ }), a < 1 / 0 && a >= 0 && (h = e.substring(0, a + 1));
1004
+ }
1005
+ if (this.state.top && (l = this.tokenizer.paragraph(h))) {
1006
+ const a = t.at(-1);
1007
+ r && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += `
1008
+ ` + l.raw, a.text += `
1009
+ ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l), r = h.length !== e.length, e = e.substring(l.raw.length);
1010
+ continue;
1011
+ }
1012
+ if (l = this.tokenizer.text(e)) {
1013
+ e = e.substring(l.raw.length);
1014
+ const a = t.at(-1);
1015
+ (a == null ? void 0 : a.type) === "text" ? (a.raw += `
1016
+ ` + l.raw, a.text += `
1017
+ ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l);
1018
+ continue;
1019
+ }
1020
+ if (e) {
1021
+ const a = "Infinite loop on byte: " + e.charCodeAt(0);
1022
+ if (this.options.silent) {
1023
+ console.error(a);
1024
+ break;
1025
+ } else
1026
+ throw new Error(a);
1027
+ }
1028
+ }
1029
+ return this.state.top = !0, t;
1030
+ }
1031
+ inline(e, t = []) {
1032
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
1033
+ }
1034
+ /**
1035
+ * Lexing/Compiling
1036
+ */
1037
+ inlineTokens(e, t = []) {
1038
+ var l, h, a;
1039
+ let r = e, i = null;
1040
+ if (this.tokens.links) {
1041
+ const o = Object.keys(this.tokens.links);
1042
+ if (o.length > 0)
1043
+ for (; (i = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
1044
+ o.includes(i[0].slice(i[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1045
+ }
1046
+ for (; (i = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
1047
+ r = r.slice(0, i.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1048
+ for (; (i = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
1049
+ r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1050
+ let s = !1, c = "";
1051
+ for (; e; ) {
1052
+ s || (c = ""), s = !1;
1053
+ let o;
1054
+ if ((h = (l = this.options.extensions) == null ? void 0 : l.inline) != null && h.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1))
1055
+ continue;
1056
+ if (o = this.tokenizer.escape(e)) {
1057
+ e = e.substring(o.raw.length), t.push(o);
1058
+ continue;
1059
+ }
1060
+ if (o = this.tokenizer.tag(e)) {
1061
+ e = e.substring(o.raw.length), t.push(o);
1062
+ continue;
1063
+ }
1064
+ if (o = this.tokenizer.link(e)) {
1065
+ e = e.substring(o.raw.length), t.push(o);
1066
+ continue;
1067
+ }
1068
+ if (o = this.tokenizer.reflink(e, this.tokens.links)) {
1069
+ e = e.substring(o.raw.length);
1070
+ const p = t.at(-1);
1071
+ o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1072
+ continue;
1073
+ }
1074
+ if (o = this.tokenizer.emStrong(e, r, c)) {
1075
+ e = e.substring(o.raw.length), t.push(o);
1076
+ continue;
1077
+ }
1078
+ if (o = this.tokenizer.codespan(e)) {
1079
+ e = e.substring(o.raw.length), t.push(o);
1080
+ continue;
1081
+ }
1082
+ if (o = this.tokenizer.br(e)) {
1083
+ e = e.substring(o.raw.length), t.push(o);
1084
+ continue;
1085
+ }
1086
+ if (o = this.tokenizer.del(e)) {
1087
+ e = e.substring(o.raw.length), t.push(o);
1088
+ continue;
1089
+ }
1090
+ if (o = this.tokenizer.autolink(e)) {
1091
+ e = e.substring(o.raw.length), t.push(o);
1092
+ continue;
1093
+ }
1094
+ if (!this.state.inLink && (o = this.tokenizer.url(e))) {
1095
+ e = e.substring(o.raw.length), t.push(o);
1096
+ continue;
1097
+ }
1098
+ let d = e;
1099
+ if ((a = this.options.extensions) != null && a.startInline) {
1100
+ let p = 1 / 0;
1101
+ const x = e.slice(1);
1102
+ let f;
1103
+ this.options.extensions.startInline.forEach((b) => {
1104
+ f = b.call({ lexer: this }, x), typeof f == "number" && f >= 0 && (p = Math.min(p, f));
1105
+ }), p < 1 / 0 && p >= 0 && (d = e.substring(0, p + 1));
1106
+ }
1107
+ if (o = this.tokenizer.inlineText(d)) {
1108
+ e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (c = o.raw.slice(-1)), s = !0;
1109
+ const p = t.at(-1);
1110
+ (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
1111
+ continue;
1112
+ }
1113
+ if (e) {
1114
+ const p = "Infinite loop on byte: " + e.charCodeAt(0);
1115
+ if (this.options.silent) {
1116
+ console.error(p);
1117
+ break;
1118
+ } else
1119
+ throw new Error(p);
1120
+ }
1121
+ }
1122
+ return t;
1123
+ }
1124
+ }, Z = class {
1125
+ // set by the parser
1126
+ constructor(n) {
1127
+ g(this, "options");
1128
+ g(this, "parser");
1129
+ this.options = n || z;
1130
+ }
1131
+ space(n) {
1132
+ return "";
1133
+ }
1134
+ code({ text: n, lang: e, escaped: t }) {
1135
+ var s;
1136
+ const r = (s = (e || "").match(w.notSpaceStart)) == null ? void 0 : s[0], i = n.replace(w.endingNewline, "") + `
1137
+ `;
1138
+ return r ? '<pre><code class="language-' + $(r) + '">' + (t ? i : $(i, !0)) + `</code></pre>
1139
+ ` : "<pre><code>" + (t ? i : $(i, !0)) + `</code></pre>
1140
+ `;
1141
+ }
1142
+ blockquote({ tokens: n }) {
1143
+ return `<blockquote>
1144
+ ${this.parser.parse(n)}</blockquote>
1145
+ `;
1146
+ }
1147
+ html({ text: n }) {
1148
+ return n;
1149
+ }
1150
+ heading({ tokens: n, depth: e }) {
1151
+ return `<h${e}>${this.parser.parseInline(n)}</h${e}>
1152
+ `;
1153
+ }
1154
+ hr(n) {
1155
+ return `<hr>
1156
+ `;
1157
+ }
1158
+ list(n) {
1159
+ const e = n.ordered, t = n.start;
1160
+ let r = "";
1161
+ for (let c = 0; c < n.items.length; c++) {
1162
+ const l = n.items[c];
1163
+ r += this.listitem(l);
1164
+ }
1165
+ const i = e ? "ol" : "ul", s = e && t !== 1 ? ' start="' + t + '"' : "";
1166
+ return "<" + i + s + `>
1167
+ ` + r + "</" + i + `>
1168
+ `;
1169
+ }
1170
+ listitem(n) {
1171
+ var t;
1172
+ let e = "";
1173
+ if (n.task) {
1174
+ const r = this.checkbox({ checked: !!n.checked });
1175
+ n.loose ? ((t = n.tokens[0]) == null ? void 0 : t.type) === "paragraph" ? (n.tokens[0].text = r + " " + n.tokens[0].text, n.tokens[0].tokens && n.tokens[0].tokens.length > 0 && n.tokens[0].tokens[0].type === "text" && (n.tokens[0].tokens[0].text = r + " " + $(n.tokens[0].tokens[0].text), n.tokens[0].tokens[0].escaped = !0)) : n.tokens.unshift({
1176
+ type: "text",
1177
+ raw: r + " ",
1178
+ text: r + " ",
1179
+ escaped: !0
1180
+ }) : e += r + " ";
1181
+ }
1182
+ return e += this.parser.parse(n.tokens, !!n.loose), `<li>${e}</li>
1183
+ `;
1184
+ }
1185
+ checkbox({ checked: n }) {
1186
+ return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1187
+ }
1188
+ paragraph({ tokens: n }) {
1189
+ return `<p>${this.parser.parseInline(n)}</p>
1190
+ `;
1191
+ }
1192
+ table(n) {
1193
+ let e = "", t = "";
1194
+ for (let i = 0; i < n.header.length; i++)
1195
+ t += this.tablecell(n.header[i]);
1196
+ e += this.tablerow({ text: t });
1197
+ let r = "";
1198
+ for (let i = 0; i < n.rows.length; i++) {
1199
+ const s = n.rows[i];
1200
+ t = "";
1201
+ for (let c = 0; c < s.length; c++)
1202
+ t += this.tablecell(s[c]);
1203
+ r += this.tablerow({ text: t });
1204
+ }
1205
+ return r && (r = `<tbody>${r}</tbody>`), `<table>
1206
+ <thead>
1207
+ ` + e + `</thead>
1208
+ ` + r + `</table>
1209
+ `;
1210
+ }
1211
+ tablerow({ text: n }) {
1212
+ return `<tr>
1213
+ ${n}</tr>
1214
+ `;
1215
+ }
1216
+ tablecell(n) {
1217
+ const e = this.parser.parseInline(n.tokens), t = n.header ? "th" : "td";
1218
+ return (n.align ? `<${t} align="${n.align}">` : `<${t}>`) + e + `</${t}>
1219
+ `;
1220
+ }
1221
+ /**
1222
+ * span level renderer
1223
+ */
1224
+ strong({ tokens: n }) {
1225
+ return `<strong>${this.parser.parseInline(n)}</strong>`;
1226
+ }
1227
+ em({ tokens: n }) {
1228
+ return `<em>${this.parser.parseInline(n)}</em>`;
1229
+ }
1230
+ codespan({ text: n }) {
1231
+ return `<code>${$(n, !0)}</code>`;
1232
+ }
1233
+ br(n) {
1234
+ return "<br>";
1235
+ }
1236
+ del({ tokens: n }) {
1237
+ return `<del>${this.parser.parseInline(n)}</del>`;
1238
+ }
1239
+ link({ href: n, title: e, tokens: t }) {
1240
+ const r = this.parser.parseInline(t), i = ae(n);
1241
+ if (i === null)
1242
+ return r;
1243
+ n = i;
1244
+ let s = '<a href="' + n + '"';
1245
+ return e && (s += ' title="' + $(e) + '"'), s += ">" + r + "</a>", s;
1246
+ }
1247
+ image({ href: n, title: e, text: t, tokens: r }) {
1248
+ r && (t = this.parser.parseInline(r, this.parser.textRenderer));
1249
+ const i = ae(n);
1250
+ if (i === null)
1251
+ return $(t);
1252
+ n = i;
1253
+ let s = `<img src="${n}" alt="${t}"`;
1254
+ return e && (s += ` title="${$(e)}"`), s += ">", s;
1255
+ }
1256
+ text(n) {
1257
+ return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : $(n.text);
1258
+ }
1259
+ }, ie = class {
1260
+ // no need for block level renderers
1261
+ strong({ text: n }) {
1262
+ return n;
1263
+ }
1264
+ em({ text: n }) {
1265
+ return n;
1266
+ }
1267
+ codespan({ text: n }) {
1268
+ return n;
1269
+ }
1270
+ del({ text: n }) {
1271
+ return n;
1272
+ }
1273
+ html({ text: n }) {
1274
+ return n;
1275
+ }
1276
+ text({ text: n }) {
1277
+ return n;
1278
+ }
1279
+ link({ text: n }) {
1280
+ return "" + n;
1281
+ }
1282
+ image({ text: n }) {
1283
+ return "" + n;
1284
+ }
1285
+ br() {
1286
+ return "";
1287
+ }
1288
+ }, T = class U {
1289
+ constructor(e) {
1290
+ g(this, "options");
1291
+ g(this, "renderer");
1292
+ g(this, "textRenderer");
1293
+ this.options = e || z, this.options.renderer = this.options.renderer || new Z(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ie();
1294
+ }
1295
+ /**
1296
+ * Static Parse Method
1297
+ */
1298
+ static parse(e, t) {
1299
+ return new U(t).parse(e);
1300
+ }
1301
+ /**
1302
+ * Static Parse Inline Method
1303
+ */
1304
+ static parseInline(e, t) {
1305
+ return new U(t).parseInline(e);
1306
+ }
1307
+ /**
1308
+ * Parse Loop
1309
+ */
1310
+ parse(e, t = !0) {
1311
+ var i, s;
1312
+ let r = "";
1313
+ for (let c = 0; c < e.length; c++) {
1314
+ const l = e[c];
1315
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[l.type]) {
1316
+ const a = l, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
1317
+ if (o !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
1318
+ r += o || "";
1319
+ continue;
1320
+ }
1321
+ }
1322
+ const h = l;
1323
+ switch (h.type) {
1324
+ case "space": {
1325
+ r += this.renderer.space(h);
1326
+ continue;
1327
+ }
1328
+ case "hr": {
1329
+ r += this.renderer.hr(h);
1330
+ continue;
1331
+ }
1332
+ case "heading": {
1333
+ r += this.renderer.heading(h);
1334
+ continue;
1335
+ }
1336
+ case "code": {
1337
+ r += this.renderer.code(h);
1338
+ continue;
1339
+ }
1340
+ case "table": {
1341
+ r += this.renderer.table(h);
1342
+ continue;
1343
+ }
1344
+ case "blockquote": {
1345
+ r += this.renderer.blockquote(h);
1346
+ continue;
1347
+ }
1348
+ case "list": {
1349
+ r += this.renderer.list(h);
1350
+ continue;
1351
+ }
1352
+ case "html": {
1353
+ r += this.renderer.html(h);
1354
+ continue;
1355
+ }
1356
+ case "paragraph": {
1357
+ r += this.renderer.paragraph(h);
1358
+ continue;
1359
+ }
1360
+ case "text": {
1361
+ let a = h, o = this.renderer.text(a);
1362
+ for (; c + 1 < e.length && e[c + 1].type === "text"; )
1363
+ a = e[++c], o += `
1364
+ ` + this.renderer.text(a);
1365
+ t ? r += this.renderer.paragraph({
1366
+ type: "paragraph",
1367
+ raw: o,
1368
+ text: o,
1369
+ tokens: [{ type: "text", raw: o, text: o, escaped: !0 }]
1370
+ }) : r += o;
1371
+ continue;
1372
+ }
1373
+ default: {
1374
+ const a = 'Token with "' + h.type + '" type was not found.';
1375
+ if (this.options.silent)
1376
+ return console.error(a), "";
1377
+ throw new Error(a);
1378
+ }
1379
+ }
1380
+ }
1381
+ return r;
1382
+ }
1383
+ /**
1384
+ * Parse Inline Tokens
1385
+ */
1386
+ parseInline(e, t = this.renderer) {
1387
+ var i, s;
1388
+ let r = "";
1389
+ for (let c = 0; c < e.length; c++) {
1390
+ const l = e[c];
1391
+ if ((s = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && s[l.type]) {
1392
+ const a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1393
+ if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1394
+ r += a || "";
1395
+ continue;
1396
+ }
1397
+ }
1398
+ const h = l;
1399
+ switch (h.type) {
1400
+ case "escape": {
1401
+ r += t.text(h);
1402
+ break;
1403
+ }
1404
+ case "html": {
1405
+ r += t.html(h);
1406
+ break;
1407
+ }
1408
+ case "link": {
1409
+ r += t.link(h);
1410
+ break;
1411
+ }
1412
+ case "image": {
1413
+ r += t.image(h);
1414
+ break;
1415
+ }
1416
+ case "strong": {
1417
+ r += t.strong(h);
1418
+ break;
1419
+ }
1420
+ case "em": {
1421
+ r += t.em(h);
1422
+ break;
1423
+ }
1424
+ case "codespan": {
1425
+ r += t.codespan(h);
1426
+ break;
1427
+ }
1428
+ case "br": {
1429
+ r += t.br(h);
1430
+ break;
1431
+ }
1432
+ case "del": {
1433
+ r += t.del(h);
1434
+ break;
1435
+ }
1436
+ case "text": {
1437
+ r += t.text(h);
1438
+ break;
1439
+ }
1440
+ default: {
1441
+ const a = 'Token with "' + h.type + '" type was not found.';
1442
+ if (this.options.silent)
1443
+ return console.error(a), "";
1444
+ throw new Error(a);
1445
+ }
1446
+ }
1447
+ }
1448
+ return r;
1449
+ }
1450
+ }, Q, O = (Q = class {
1451
+ constructor(n) {
1452
+ g(this, "options");
1453
+ g(this, "block");
1454
+ this.options = n || z;
1455
+ }
1456
+ /**
1457
+ * Process markdown before marked
1458
+ */
1459
+ preprocess(n) {
1460
+ return n;
1461
+ }
1462
+ /**
1463
+ * Process HTML after marked is finished
1464
+ */
1465
+ postprocess(n) {
1466
+ return n;
1467
+ }
1468
+ /**
1469
+ * Process all tokens before walk tokens
1470
+ */
1471
+ processAllTokens(n) {
1472
+ return n;
1473
+ }
1474
+ /**
1475
+ * Provide function to tokenize markdown
1476
+ */
1477
+ provideLexer() {
1478
+ return this.block ? E.lex : E.lexInline;
1479
+ }
1480
+ /**
1481
+ * Provide function to parse tokens
1482
+ */
1483
+ provideParser() {
1484
+ return this.block ? T.parse : T.parseInline;
1485
+ }
1486
+ }, g(Q, "passThroughHooks", /* @__PURE__ */ new Set([
1487
+ "preprocess",
1488
+ "postprocess",
1489
+ "processAllTokens"
1490
+ ])), Q), ut = class {
1491
+ constructor(...n) {
1492
+ g(this, "defaults", J());
1493
+ g(this, "options", this.setOptions);
1494
+ g(this, "parse", this.parseMarkdown(!0));
1495
+ g(this, "parseInline", this.parseMarkdown(!1));
1496
+ g(this, "Parser", T);
1497
+ g(this, "Renderer", Z);
1498
+ g(this, "TextRenderer", ie);
1499
+ g(this, "Lexer", E);
1500
+ g(this, "Tokenizer", N);
1501
+ g(this, "Hooks", O);
1502
+ this.use(...n);
1503
+ }
1504
+ /**
1505
+ * Run callback for every token
1506
+ */
1507
+ walkTokens(n, e) {
1508
+ var r, i;
1509
+ let t = [];
1510
+ for (const s of n)
1511
+ switch (t = t.concat(e.call(this, s)), s.type) {
1512
+ case "table": {
1513
+ const c = s;
1514
+ for (const l of c.header)
1515
+ t = t.concat(this.walkTokens(l.tokens, e));
1516
+ for (const l of c.rows)
1517
+ for (const h of l)
1518
+ t = t.concat(this.walkTokens(h.tokens, e));
1519
+ break;
1520
+ }
1521
+ case "list": {
1522
+ const c = s;
1523
+ t = t.concat(this.walkTokens(c.items, e));
1524
+ break;
1525
+ }
1526
+ default: {
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((l) => {
1529
+ const h = c[l].flat(1 / 0);
1530
+ t = t.concat(this.walkTokens(h, e));
1531
+ }) : c.tokens && (t = t.concat(this.walkTokens(c.tokens, e)));
1532
+ }
1533
+ }
1534
+ return t;
1535
+ }
1536
+ use(...n) {
1537
+ const e = this.defaults.extensions || { renderers: {}, childTokens: {} };
1538
+ return n.forEach((t) => {
1539
+ const r = { ...t };
1540
+ if (r.async = this.defaults.async || r.async || !1, t.extensions && (t.extensions.forEach((i) => {
1541
+ if (!i.name)
1542
+ throw new Error("extension name required");
1543
+ if ("renderer" in i) {
1544
+ const s = e.renderers[i.name];
1545
+ s ? e.renderers[i.name] = function(...c) {
1546
+ let l = i.renderer.apply(this, c);
1547
+ return l === !1 && (l = s.apply(this, c)), l;
1548
+ } : e.renderers[i.name] = i.renderer;
1549
+ }
1550
+ if ("tokenizer" in i) {
1551
+ if (!i.level || i.level !== "block" && i.level !== "inline")
1552
+ throw new Error("extension level must be 'block' or 'inline'");
1553
+ const s = e[i.level];
1554
+ s ? s.unshift(i.tokenizer) : e[i.level] = [i.tokenizer], i.start && (i.level === "block" ? e.startBlock ? e.startBlock.push(i.start) : e.startBlock = [i.start] : i.level === "inline" && (e.startInline ? e.startInline.push(i.start) : e.startInline = [i.start]));
1555
+ }
1556
+ "childTokens" in i && i.childTokens && (e.childTokens[i.name] = i.childTokens);
1557
+ }), r.extensions = e), t.renderer) {
1558
+ const i = this.defaults.renderer || new Z(this.defaults);
1559
+ for (const s in t.renderer) {
1560
+ if (!(s in i))
1561
+ throw new Error(`renderer '${s}' does not exist`);
1562
+ if (["options", "parser"].includes(s))
1563
+ continue;
1564
+ const c = s, l = t.renderer[c], h = i[c];
1565
+ i[c] = (...a) => {
1566
+ let o = l.apply(i, a);
1567
+ return o === !1 && (o = h.apply(i, a)), o || "";
1568
+ };
1569
+ }
1570
+ r.renderer = i;
1571
+ }
1572
+ if (t.tokenizer) {
1573
+ const i = this.defaults.tokenizer || new N(this.defaults);
1574
+ for (const s in t.tokenizer) {
1575
+ if (!(s in i))
1576
+ throw new Error(`tokenizer '${s}' does not exist`);
1577
+ if (["options", "rules", "lexer"].includes(s))
1578
+ continue;
1579
+ const c = s, l = t.tokenizer[c], h = i[c];
1580
+ i[c] = (...a) => {
1581
+ let o = l.apply(i, a);
1582
+ return o === !1 && (o = h.apply(i, a)), o;
1583
+ };
1584
+ }
1585
+ r.tokenizer = i;
1586
+ }
1587
+ if (t.hooks) {
1588
+ const i = this.defaults.hooks || new O();
1589
+ for (const s in t.hooks) {
1590
+ if (!(s in i))
1591
+ throw new Error(`hook '${s}' does not exist`);
1592
+ if (["options", "block"].includes(s))
1593
+ continue;
1594
+ const c = s, l = t.hooks[c], h = i[c];
1595
+ O.passThroughHooks.has(s) ? i[c] = (a) => {
1596
+ if (this.defaults.async)
1597
+ return Promise.resolve(l.call(i, a)).then((d) => h.call(i, d));
1598
+ const o = l.call(i, a);
1599
+ return h.call(i, o);
1600
+ } : i[c] = (...a) => {
1601
+ let o = l.apply(i, a);
1602
+ return o === !1 && (o = h.apply(i, a)), o;
1603
+ };
1604
+ }
1605
+ r.hooks = i;
1606
+ }
1607
+ if (t.walkTokens) {
1608
+ const i = this.defaults.walkTokens, s = t.walkTokens;
1609
+ r.walkTokens = function(c) {
1610
+ let l = [];
1611
+ return l.push(s.call(this, c)), i && (l = l.concat(i.call(this, c))), l;
1612
+ };
1613
+ }
1614
+ this.defaults = { ...this.defaults, ...r };
1615
+ }), this;
1616
+ }
1617
+ setOptions(n) {
1618
+ return this.defaults = { ...this.defaults, ...n }, this;
1619
+ }
1620
+ lexer(n, e) {
1621
+ return E.lex(n, e ?? this.defaults);
1622
+ }
1623
+ parser(n, e) {
1624
+ return T.parse(n, e ?? this.defaults);
1625
+ }
1626
+ parseMarkdown(n) {
1627
+ return (t, r) => {
1628
+ const i = { ...r }, s = { ...this.defaults, ...i }, c = this.onError(!!s.silent, !!s.async);
1629
+ if (this.defaults.async === !0 && i.async === !1)
1630
+ return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1631
+ if (typeof t > "u" || t === null)
1632
+ return c(new Error("marked(): input parameter is undefined or null"));
1633
+ if (typeof t != "string")
1634
+ return c(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1635
+ s.hooks && (s.hooks.options = s, s.hooks.block = n);
1636
+ const l = s.hooks ? s.hooks.provideLexer() : n ? E.lex : E.lexInline, h = s.hooks ? s.hooks.provideParser() : n ? T.parse : T.parseInline;
1637
+ if (s.async)
1638
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(t) : t).then((a) => l(a, s)).then((a) => s.hooks ? s.hooks.processAllTokens(a) : a).then((a) => s.walkTokens ? Promise.all(this.walkTokens(a, s.walkTokens)).then(() => a) : a).then((a) => h(a, s)).then((a) => s.hooks ? s.hooks.postprocess(a) : a).catch(c);
1639
+ try {
1640
+ s.hooks && (t = s.hooks.preprocess(t));
1641
+ let a = l(t, s);
1642
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1643
+ let o = h(a, s);
1644
+ return s.hooks && (o = s.hooks.postprocess(o)), o;
1645
+ } catch (a) {
1646
+ return c(a);
1647
+ }
1648
+ };
1649
+ }
1650
+ onError(n, e) {
1651
+ return (t) => {
1652
+ if (t.message += `
1653
+ Please report this to https://github.com/markedjs/marked.`, n) {
1654
+ const r = "<p>An error occurred:</p><pre>" + $(t.message + "", !0) + "</pre>";
1655
+ return e ? Promise.resolve(r) : r;
1656
+ }
1657
+ if (e)
1658
+ return Promise.reject(t);
1659
+ throw t;
1660
+ };
1661
+ }
1662
+ }, C = new ut();
1663
+ function m(n, e) {
1664
+ return C.parse(n, e);
1665
+ }
1666
+ m.options = m.setOptions = function(n) {
1667
+ return C.setOptions(n), m.defaults = C.defaults, ue(m.defaults), m;
1668
+ };
1669
+ m.getDefaults = J;
1670
+ m.defaults = z;
1671
+ m.use = function(...n) {
1672
+ return C.use(...n), m.defaults = C.defaults, ue(m.defaults), m;
1673
+ };
1674
+ m.walkTokens = function(n, e) {
1675
+ return C.walkTokens(n, e);
1676
+ };
1677
+ m.parseInline = C.parseInline;
1678
+ m.Parser = T;
1679
+ m.parser = T.parse;
1680
+ m.Renderer = Z;
1681
+ m.TextRenderer = ie;
1682
+ m.Lexer = E;
1683
+ m.lexer = E.lex;
1684
+ m.Tokenizer = N;
1685
+ m.Hooks = O;
1686
+ m.parse = m;
1687
+ m.options;
1688
+ m.setOptions;
1689
+ m.use;
1690
+ m.walkTokens;
1691
+ m.parseInline;
1692
+ T.parse;
1693
+ E.lex;
1694
+ const he = ({ data: n, style: e }) => /* @__PURE__ */ u.createElement(
1695
+ "div",
1696
+ {
1697
+ style: {
1698
+ maxWidth: "80%",
1699
+ ...e
1700
+ }
1701
+ },
1702
+ n && n.subject ? /* @__PURE__ */ u.createElement(
1703
+ "div",
1704
+ {
1705
+ dangerouslySetInnerHTML: {
1706
+ __html: m.parse(n.body, { async: !1 })
1707
+ }
1708
+ }
1709
+ ) : /* @__PURE__ */ u.createElement("p", { style: { margin: 0, whiteSpace: "pre-wrap" } }, n ? n.question : "")
1710
+ ), gt = ({ items: n, onApply: e, getEditorContent: t }) => {
1711
+ const r = async (i) => {
1712
+ const s = /제목:[^\n]*/g;
1713
+ ((s.exec(i) || [])[0] || "").replace("제목: ", "").replace(`
1714
+ `, "");
1715
+ const l = i.replace(s, "").replace("본문: ", "");
1716
+ let h = await m.parse(l);
1717
+ const a = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g, o = t ? t() : "", d = a.exec(o) || [];
1718
+ d[0] && (h = h + "<br>" + d[0]), e({ html: h });
1719
+ };
1720
+ return /* @__PURE__ */ u.createElement(
1721
+ "div",
1722
+ {
1723
+ style: {
1724
+ flex: 1,
1725
+ minHeight: 0,
1726
+ position: "relative",
1727
+ overflowY: "auto",
1728
+ paddingRight: 16,
1729
+ marginRight: -16,
1730
+ marginBottom: 8,
1731
+ display: "flex",
1732
+ flexDirection: "column"
1733
+ }
1734
+ },
1735
+ n && n.map((i) => /* @__PURE__ */ u.createElement("div", { key: i.id, style: { display: "flex", flexDirection: "column", marginBottom: 16 } }, /* @__PURE__ */ u.createElement(
1736
+ "div",
1737
+ {
1738
+ style: {
1739
+ width: "100%",
1740
+ display: "flex",
1741
+ alignItems: "flex-end",
1742
+ flexDirection: "column",
1743
+ position: "relative",
1744
+ marginTop: 8
1745
+ }
1746
+ },
1747
+ /* @__PURE__ */ u.createElement(
1748
+ he,
1749
+ {
1750
+ data: { question: i.question },
1751
+ style: {
1752
+ border: "1px solid #e0e0e0",
1753
+ borderRadius: 8,
1754
+ borderTopRightRadius: 0,
1755
+ padding: "8px 12px",
1756
+ background: "#f9f9f9"
1757
+ }
1758
+ }
1759
+ )
1760
+ ), /* @__PURE__ */ u.createElement(
1761
+ "div",
1762
+ {
1763
+ style: {
1764
+ width: "100%",
1765
+ display: "flex",
1766
+ alignItems: "flex-start",
1767
+ flexDirection: "column",
1768
+ position: "relative",
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
1782
+ }
1783
+ }
1784
+ ), /* @__PURE__ */ u.createElement(
1785
+ "button",
1786
+ {
1787
+ type: "button",
1788
+ title: "Apply content",
1789
+ onClick: () => r(i.body),
1790
+ style: {
1791
+ marginLeft: 4,
1792
+ background: "none",
1793
+ border: "none",
1794
+ cursor: "pointer",
1795
+ display: "flex",
1796
+ alignItems: "center",
1797
+ justifyContent: "center",
1798
+ padding: 8,
1799
+ borderRadius: 4
1800
+ }
1801
+ },
1802
+ /* @__PURE__ */ u.createElement(pe, { size: 16, color: "#666" })
1803
+ ))
1804
+ )))
1805
+ );
1806
+ };
1807
+ class dt extends u.Component {
1808
+ constructor(t) {
1809
+ super(t);
1810
+ g(this, "containerRef");
1811
+ g(this, "handleClickOutside", (t) => {
1812
+ this.containerRef.current && !this.containerRef.current.contains(t.target) && this.setState({ open: !1 });
1813
+ });
1814
+ g(this, "togglePopper", () => {
1815
+ this.setState((t) => ({ open: !t.open }));
1816
+ });
1817
+ g(this, "handleLangChange", (t) => {
1818
+ const r = W.find((i) => i.value === t.target.value);
1819
+ this.props.setLang(r || null);
1820
+ });
1821
+ this.state = { open: !1 }, this.containerRef = u.createRef();
1822
+ }
1823
+ componentDidMount() {
1824
+ document.addEventListener("mousedown", this.handleClickOutside);
1825
+ }
1826
+ componentWillUnmount() {
1827
+ document.removeEventListener("mousedown", this.handleClickOutside);
1828
+ }
1829
+ render() {
1830
+ const { lang: t, originalEmail: r, setOriginalEmail: i, getEditorContent: s } = this.props, { open: c } = this.state;
1831
+ return /* @__PURE__ */ u.createElement("div", { ref: this.containerRef, style: { position: "relative", display: "inline-block" } }, /* @__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(
1851
+ "div",
1852
+ {
1853
+ style: {
1854
+ position: "absolute",
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
+ }
1866
+ },
1867
+ /* @__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("span", { style: { fontSize: 12, fontWeight: 500, color: "#666" } }, "Language"), /* @__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(
1882
+ "button",
1883
+ {
1884
+ type: "button",
1885
+ title: "Copy from origin email",
1886
+ onClick: () => {
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
+ }
1898
+ },
1899
+ /* @__PURE__ */ u.createElement(pe, { size: 14, color: "#1976d2" })
1900
+ )), /* @__PURE__ */ u.createElement(
1901
+ "textarea",
1902
+ {
1903
+ value: r,
1904
+ onChange: (l) => i(l.target.value),
1905
+ style: {
1906
+ width: "100%",
1907
+ height: 120,
1908
+ resize: "vertical",
1909
+ padding: 8,
1910
+ border: "1px solid #ccc",
1911
+ borderRadius: 4,
1912
+ fontSize: 13,
1913
+ fontFamily: "inherit",
1914
+ boxSizing: "border-box"
1915
+ }
1916
+ }
1917
+ )))
1918
+ ));
1919
+ }
1920
+ }
1921
+ class bt extends u.Component {
1922
+ constructor(t) {
1923
+ super(t);
1924
+ // Equivalent to useImperativeHandle
1925
+ g(this, "setAiContext", (t) => {
1926
+ this.setState({ originalEmail: t });
1927
+ });
1928
+ g(this, "handleMessageChange", (t) => {
1929
+ this.setState({ message: t.target.value });
1930
+ });
1931
+ g(this, "handleSubmit", async () => {
1932
+ const { message: t, messages: r, lang: i, originalEmail: s, conversationId: c } = this.state, { signer: l, baseUrl: h = "" } = this.props;
1933
+ if (!t.trim()) return;
1934
+ const a = Ee();
1935
+ let o = {
1936
+ id: a,
1937
+ question: t,
1938
+ subject: "",
1939
+ body: "",
1940
+ created_at: (/* @__PURE__ */ new Date()).getTime(),
1941
+ isLoading: !0
1942
+ };
1943
+ const d = [...r, o];
1944
+ this.setState({
1945
+ messages: d,
1946
+ message: "",
1947
+ isSending: !0
1948
+ });
1949
+ const p = {
1950
+ query: t,
1951
+ default_language: i ? i.value : "KR",
1952
+ original_email: s,
1953
+ debug_grpc: !0
1954
+ };
1955
+ c && (p.conversation_id = c), await Ae(p, {
1956
+ setContent: (y) => {
1957
+ this.setState((S) => ({ messages: S.messages.map(
1958
+ (v) => v.id === a ? {
1959
+ ...v,
1960
+ body: y,
1961
+ isLoading: !1,
1962
+ created_at: (/* @__PURE__ */ new Date()).getTime()
1963
+ } : v
1964
+ ) }));
1965
+ },
1966
+ setIsLoading: (y) => {
1967
+ this.setState((S) => ({ messages: S.messages.map(
1968
+ (v) => v.id === a ? { ...v, isLoading: y } : v
1969
+ ) }));
1970
+ },
1971
+ setConversationId: (y) => {
1972
+ this.setState({ conversationId: y });
1973
+ },
1974
+ signer: l,
1975
+ baseUrl: h
1976
+ }), this.setState({ isSending: !1 });
1977
+ });
1978
+ g(this, "handleKeyDown", (t) => {
1979
+ !t.shiftKey && t.key === "Enter" && !this.state.isSending && (t.preventDefault(), this.handleSubmit());
1980
+ });
1981
+ g(this, "setLang", (t) => {
1982
+ this.setState({ lang: t });
1983
+ });
1984
+ g(this, "setOriginalEmail", (t) => {
1985
+ this.setState({ originalEmail: t });
1986
+ });
1987
+ this.state = {
1988
+ message: "",
1989
+ messages: [],
1990
+ isSending: !1,
1991
+ lang: W[0],
1992
+ conversationId: "",
1993
+ originalEmail: ""
1994
+ };
1995
+ }
1996
+ render() {
1997
+ const { onApply: t, getEditorContent: r } = this.props, { message: i, messages: s, isSending: c, lang: l, originalEmail: h } = this.state;
1998
+ return /* @__PURE__ */ u.createElement(
1999
+ "div",
2000
+ {
2001
+ style: {
2002
+ display: "flex",
2003
+ height: "100%",
2004
+ padding: 16,
2005
+ flexDirection: "column",
2006
+ background: "#fff",
2007
+ fontFamily: "inherit",
2008
+ boxSizing: "border-box"
2009
+ }
2010
+ },
2011
+ s.length > 0 ? /* @__PURE__ */ u.createElement(
2012
+ gt,
2013
+ {
2014
+ items: s,
2015
+ onApply: t,
2016
+ getEditorContent: r
2017
+ }
2018
+ ) : /* @__PURE__ */ u.createElement(
2019
+ "div",
2020
+ {
2021
+ style: {
2022
+ flex: 1,
2023
+ minHeight: 0,
2024
+ display: "flex",
2025
+ flexDirection: "column",
2026
+ alignItems: "center",
2027
+ justifyContent: "center",
2028
+ color: "#ccc"
2029
+ }
2030
+ },
2031
+ /* @__PURE__ */ u.createElement(ze, { size: 46 }),
2032
+ /* @__PURE__ */ u.createElement(
2033
+ "h2",
2034
+ {
2035
+ style: {
2036
+ marginTop: 16,
2037
+ fontWeight: 600,
2038
+ color: "#999",
2039
+ fontSize: 18
2040
+ }
2041
+ },
2042
+ "Build with Agent"
2043
+ )
2044
+ ),
2045
+ /* @__PURE__ */ u.createElement(
2046
+ "div",
2047
+ {
2048
+ style: {
2049
+ width: "100%",
2050
+ border: "1px solid #ddd",
2051
+ borderRadius: 8,
2052
+ // overflow: "hidden",
2053
+ background: c ? "#f9f9f9" : "#fff",
2054
+ display: "flex",
2055
+ flexDirection: "column"
2056
+ }
2057
+ },
2058
+ /* @__PURE__ */ u.createElement(
2059
+ "textarea",
2060
+ {
2061
+ value: i,
2062
+ onChange: this.handleMessageChange,
2063
+ placeholder: "Describe your email",
2064
+ onKeyDown: this.handleKeyDown,
2065
+ disabled: c,
2066
+ style: {
2067
+ flex: 1,
2068
+ minWidth: 0,
2069
+ borderRadius: 8,
2070
+ padding: 12,
2071
+ fontSize: 13,
2072
+ border: "none",
2073
+ resize: "none",
2074
+ outline: "none",
2075
+ minHeight: 60,
2076
+ fontFamily: "inherit"
2077
+ }
2078
+ }
2079
+ ),
2080
+ /* @__PURE__ */ u.createElement(
2081
+ "div",
2082
+ {
2083
+ style: {
2084
+ display: "flex",
2085
+ flexDirection: "row",
2086
+ alignItems: "center",
2087
+ justifyContent: "space-between",
2088
+ width: "100%",
2089
+ padding: "8px",
2090
+ boxSizing: "border-box"
2091
+ }
2092
+ },
2093
+ /* @__PURE__ */ u.createElement(
2094
+ dt,
2095
+ {
2096
+ lang: l,
2097
+ setLang: this.setLang,
2098
+ originalEmail: h,
2099
+ setOriginalEmail: this.setOriginalEmail,
2100
+ getEditorContent: r
2101
+ }
2102
+ ),
2103
+ /* @__PURE__ */ u.createElement(
2104
+ "button",
2105
+ {
2106
+ disabled: !i.trim() || c,
2107
+ onClick: this.handleSubmit,
2108
+ style: {
2109
+ flexShrink: 0,
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
+ }
2121
+ },
2122
+ /* @__PURE__ */ u.createElement(Ce, { size: 16 })
2123
+ )
2124
+ )
2125
+ )
2126
+ );
2127
+ }
2128
+ }
2129
+ export {
2130
+ bt as C
2131
+ };