@liip/liipgpt 0.0.8 → 0.0.11
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/chat/index.html +51 -6
- package/chat/liipgpt-chat.iife.js +58 -58
- package/lib/feedback.d.ts +0 -0
- package/lib/liipgpt-client.d.ts +21 -0
- package/lib/liipgpt-client.js +264 -217
- package/lib/liipgpt-client.umd.cjs +20 -20
- package/lib/sse-types.d.ts +4 -0
- package/package.json +1 -1
package/lib/liipgpt-client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var qt = Object.defineProperty;
|
|
2
|
+
var Ot = (h, e, t) => e in h ? qt(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var S = (h, e, t) => Ot(h, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
const pe = /* @__PURE__ */ new Map();
|
|
5
|
-
class
|
|
5
|
+
class Bt {
|
|
6
6
|
get length() {
|
|
7
7
|
return pe.size;
|
|
8
8
|
}
|
|
@@ -22,8 +22,8 @@ class qt {
|
|
|
22
22
|
pe.set(e, String(t));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
25
|
+
const je = globalThis.localStorage ?? new Bt();
|
|
26
|
+
function Qe() {
|
|
27
27
|
return {
|
|
28
28
|
async: !1,
|
|
29
29
|
breaks: !1,
|
|
@@ -37,23 +37,23 @@ function Ge() {
|
|
|
37
37
|
walkTokens: null
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
let ie =
|
|
40
|
+
let ie = Qe();
|
|
41
41
|
function bt(h) {
|
|
42
42
|
ie = h;
|
|
43
43
|
}
|
|
44
44
|
const Se = { exec: () => null };
|
|
45
|
-
function
|
|
45
|
+
function $(h, e = "") {
|
|
46
46
|
let t = typeof h == "string" ? h : h.source;
|
|
47
47
|
const n = {
|
|
48
48
|
replace: (s, r) => {
|
|
49
49
|
let i = typeof r == "string" ? r : r.source;
|
|
50
|
-
return i = i.replace(
|
|
50
|
+
return i = i.replace(O.caret, "$1"), t = t.replace(s, i), n;
|
|
51
51
|
},
|
|
52
52
|
getRegex: () => new RegExp(t, e)
|
|
53
53
|
};
|
|
54
54
|
return n;
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const O = {
|
|
57
57
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
58
58
|
outputLinkReplace: /\\([\[\]])/g,
|
|
59
59
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -110,35 +110,35 @@ const B = {
|
|
|
110
110
|
fencesBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`),
|
|
111
111
|
headingBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}#`),
|
|
112
112
|
htmlBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
113
|
-
}, Ft = /^(?:[ \t]*(?:\n|$))+/, Ht = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Mt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Te = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, jt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, wt = /(?:[*+-]|\d{1,9}[.)])/, xt =
|
|
113
|
+
}, Ft = /^(?:[ \t]*(?:\n|$))+/, Ht = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Mt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Te = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, jt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, wt = /(?:[*+-]|\d{1,9}[.)])/, xt = $(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, wt).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/).getRegex(), Xe = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ut = /^[^\n]+/, We = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Gt = $(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", We).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Zt = $(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, wt).getRegex(), ze = "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", Ke = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Qt = $("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", Ke).replace("tag", ze).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), yt = $(Xe).replace("hr", Te).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", ze).getRegex(), Xt = $(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", yt).getRegex(), Ve = {
|
|
114
114
|
blockquote: Xt,
|
|
115
115
|
code: Ht,
|
|
116
|
-
def:
|
|
116
|
+
def: Gt,
|
|
117
117
|
fences: Mt,
|
|
118
118
|
heading: jt,
|
|
119
119
|
hr: Te,
|
|
120
120
|
html: Qt,
|
|
121
121
|
lheading: xt,
|
|
122
|
-
list:
|
|
122
|
+
list: Zt,
|
|
123
123
|
newline: Ft,
|
|
124
124
|
paragraph: yt,
|
|
125
125
|
table: Se,
|
|
126
126
|
text: Ut
|
|
127
|
-
}, lt =
|
|
128
|
-
...
|
|
127
|
+
}, lt = $("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Te).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", ze).getRegex(), Wt = {
|
|
128
|
+
...Ve,
|
|
129
129
|
table: lt,
|
|
130
|
-
paragraph:
|
|
130
|
+
paragraph: $(Xe).replace("hr", Te).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", lt).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", ze).getRegex()
|
|
131
131
|
}, Kt = {
|
|
132
|
-
...
|
|
133
|
-
html:
|
|
132
|
+
...Ve,
|
|
133
|
+
html: $(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", Ke).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(),
|
|
134
134
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
135
135
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
136
136
|
fences: Se,
|
|
137
137
|
// fences not supported
|
|
138
138
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
139
|
-
paragraph:
|
|
139
|
+
paragraph: $(Xe).replace("hr", Te).replace("heading", ` *#{1,6} *[^
|
|
140
140
|
]`).replace("lheading", xt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
141
|
-
}, Vt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Jt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, vt = /^( {2,}|\\)\n(?!\s*$)/, Yt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, De = /[\p{P}\p{S}]/u,
|
|
141
|
+
}, Vt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Jt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, vt = /^( {2,}|\\)\n(?!\s*$)/, Yt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, De = /[\p{P}\p{S}]/u, Je = /[\s\p{P}\p{S}]/u, St = /[^\s\p{P}\p{S}]/u, en = $(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Je).getRegex(), tn = /(?!~)[\p{P}\p{S}]/u, nn = /(?!~)[\s\p{P}\p{S}]/u, rn = /(?:[^\s\p{P}\p{S}]|~)/u, sn = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, an = $(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, "u").replace(/punct/g, De).getRegex(), Rt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", on = $(Rt, "gu").replace(/notPunctSpace/g, St).replace(/punctSpace/g, Je).replace(/punct/g, De).getRegex(), ln = $(Rt, "gu").replace(/notPunctSpace/g, rn).replace(/punctSpace/g, nn).replace(/punct/g, tn).getRegex(), cn = $("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, St).replace(/punctSpace/g, Je).replace(/punct/g, De).getRegex(), un = $(/\\(punct)/, "gu").replace(/punct/g, De).getRegex(), hn = $(/^<(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(), pn = $(Ke).replace("(?:-->|$)", "-->").getRegex(), fn = $("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", pn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ce = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, dn = $(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", Ce).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Tt = $(/^!?\[(label)\]\[(ref)\]/).replace("label", Ce).replace("ref", We).getRegex(), Et = $(/^!?\[(ref)\](?:\[\])?/).replace("ref", We).getRegex(), gn = $("reflink|nolink(?!\\()", "g").replace("reflink", Tt).replace("nolink", Et).getRegex(), Ye = {
|
|
142
142
|
_backpedal: Se,
|
|
143
143
|
// only used for GFM url
|
|
144
144
|
anyPunctuation: un,
|
|
@@ -160,27 +160,27 @@ const B = {
|
|
|
160
160
|
text: Yt,
|
|
161
161
|
url: Se
|
|
162
162
|
}, kn = {
|
|
163
|
-
...
|
|
164
|
-
link:
|
|
165
|
-
reflink:
|
|
166
|
-
},
|
|
167
|
-
...
|
|
163
|
+
...Ye,
|
|
164
|
+
link: $(/^!?\[(label)\]\((.*?)\)/).replace("label", Ce).getRegex(),
|
|
165
|
+
reflink: $(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ce).getRegex()
|
|
166
|
+
}, Ge = {
|
|
167
|
+
...Ye,
|
|
168
168
|
emStrongRDelimAst: ln,
|
|
169
|
-
url:
|
|
169
|
+
url: $(/^((?: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(),
|
|
170
170
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
171
171
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
172
172
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
173
173
|
}, mn = {
|
|
174
|
-
...
|
|
175
|
-
br:
|
|
176
|
-
text:
|
|
177
|
-
},
|
|
178
|
-
normal:
|
|
174
|
+
...Ge,
|
|
175
|
+
br: $(vt).replace("{2,}", "*").getRegex(),
|
|
176
|
+
text: $(Ge.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
177
|
+
}, Ie = {
|
|
178
|
+
normal: Ve,
|
|
179
179
|
gfm: Wt,
|
|
180
180
|
pedantic: Kt
|
|
181
181
|
}, ye = {
|
|
182
|
-
normal:
|
|
183
|
-
gfm:
|
|
182
|
+
normal: Ye,
|
|
183
|
+
gfm: Ge,
|
|
184
184
|
breaks: mn,
|
|
185
185
|
pedantic: kn
|
|
186
186
|
}, bn = {
|
|
@@ -192,15 +192,15 @@ const B = {
|
|
|
192
192
|
}, ct = (h) => bn[h];
|
|
193
193
|
function W(h, e) {
|
|
194
194
|
if (e) {
|
|
195
|
-
if (
|
|
196
|
-
return h.replace(
|
|
197
|
-
} else if (
|
|
198
|
-
return h.replace(
|
|
195
|
+
if (O.escapeTest.test(h))
|
|
196
|
+
return h.replace(O.escapeReplace, ct);
|
|
197
|
+
} else if (O.escapeTestNoEncode.test(h))
|
|
198
|
+
return h.replace(O.escapeReplaceNoEncode, ct);
|
|
199
199
|
return h;
|
|
200
200
|
}
|
|
201
201
|
function ut(h) {
|
|
202
202
|
try {
|
|
203
|
-
h = encodeURI(h).replace(
|
|
203
|
+
h = encodeURI(h).replace(O.percentDecode, "%");
|
|
204
204
|
} catch {
|
|
205
205
|
return null;
|
|
206
206
|
}
|
|
@@ -208,12 +208,12 @@ function ut(h) {
|
|
|
208
208
|
}
|
|
209
209
|
function ht(h, e) {
|
|
210
210
|
var r;
|
|
211
|
-
const t = h.replace(
|
|
211
|
+
const t = h.replace(O.findPipe, (i, a, u) => {
|
|
212
212
|
let o = !1, l = a;
|
|
213
213
|
for (; --l >= 0 && u[l] === "\\"; )
|
|
214
214
|
o = !o;
|
|
215
215
|
return o ? "|" : " |";
|
|
216
|
-
}), n = t.split(
|
|
216
|
+
}), n = t.split(O.splitPipe);
|
|
217
217
|
let s = 0;
|
|
218
218
|
if (n[0].trim() || n.shift(), n.length > 0 && !((r = n.at(-1)) != null && r.trim()) && n.pop(), e)
|
|
219
219
|
if (n.length > e)
|
|
@@ -222,7 +222,7 @@ function ht(h, e) {
|
|
|
222
222
|
for (; n.length < e; )
|
|
223
223
|
n.push("");
|
|
224
224
|
for (; s < n.length; s++)
|
|
225
|
-
n[s] = n[s].trim().replace(
|
|
225
|
+
n[s] = n[s].trim().replace(O.slashPipe, "|");
|
|
226
226
|
return n;
|
|
227
227
|
}
|
|
228
228
|
function ve(h, e, t) {
|
|
@@ -284,13 +284,13 @@ function xn(h, e, t) {
|
|
|
284
284
|
}).join(`
|
|
285
285
|
`);
|
|
286
286
|
}
|
|
287
|
-
class
|
|
287
|
+
class Ae {
|
|
288
288
|
// set by the lexer
|
|
289
289
|
constructor(e) {
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
S(this, "options");
|
|
291
|
+
S(this, "rules");
|
|
292
292
|
// set by the lexer
|
|
293
|
-
|
|
293
|
+
S(this, "lexer");
|
|
294
294
|
this.options = e || ie;
|
|
295
295
|
}
|
|
296
296
|
space(e) {
|
|
@@ -384,16 +384,16 @@ ${g}` : g;
|
|
|
384
384
|
if ((x == null ? void 0 : x.type) === "code")
|
|
385
385
|
break;
|
|
386
386
|
if ((x == null ? void 0 : x.type) === "blockquote") {
|
|
387
|
-
const
|
|
387
|
+
const I = x, R = I.raw + `
|
|
388
388
|
` + n.join(`
|
|
389
|
-
`),
|
|
390
|
-
i[i.length - 1] =
|
|
389
|
+
`), B = this.blockquote(R);
|
|
390
|
+
i[i.length - 1] = B, s = s.substring(0, s.length - I.raw.length) + B.raw, r = r.substring(0, r.length - I.text.length) + B.text;
|
|
391
391
|
break;
|
|
392
392
|
} else if ((x == null ? void 0 : x.type) === "list") {
|
|
393
|
-
const
|
|
393
|
+
const I = x, R = I.raw + `
|
|
394
394
|
` + n.join(`
|
|
395
|
-
`),
|
|
396
|
-
i[i.length - 1] =
|
|
395
|
+
`), B = this.list(R);
|
|
396
|
+
i[i.length - 1] = B, s = s.substring(0, s.length - x.raw.length) + B.raw, r = r.substring(0, r.length - I.raw.length) + B.raw, n = R.substring(i.at(-1).raw.length).split(`
|
|
397
397
|
`);
|
|
398
398
|
continue;
|
|
399
399
|
}
|
|
@@ -428,35 +428,35 @@ ${g}` : g;
|
|
|
428
428
|
l = t[0], e = e.substring(l.length);
|
|
429
429
|
let m = t[2].split(`
|
|
430
430
|
`, 1)[0].replace(this.rules.other.listReplaceTabs, (ge) => " ".repeat(3 * ge.length)), x = e.split(`
|
|
431
|
-
`, 1)[0],
|
|
432
|
-
if (this.options.pedantic ? (
|
|
431
|
+
`, 1)[0], I = !m.trim(), R = 0;
|
|
432
|
+
if (this.options.pedantic ? (R = 2, g = m.trimStart()) : I ? R = t[1].length + 1 : (R = t[2].search(this.rules.other.nonSpaceChar), R = R > 4 ? 1 : R, g = m.slice(R), R += t[1].length), I && this.rules.other.blankLine.test(x) && (l += x + `
|
|
433
433
|
`, e = e.substring(x.length + 1), o = !0), !o) {
|
|
434
|
-
const ge = this.rules.other.nextBulletRegex(
|
|
434
|
+
const ge = this.rules.other.nextBulletRegex(R), F = this.rules.other.hrRegex(R), X = this.rules.other.fencesBeginRegex(R), ke = this.rules.other.headingBeginRegex(R), Ee = this.rules.other.htmlBeginRegex(R);
|
|
435
435
|
for (; e; ) {
|
|
436
436
|
const ae = e.split(`
|
|
437
437
|
`, 1)[0];
|
|
438
438
|
let ee;
|
|
439
439
|
if (x = ae, this.options.pedantic ? (x = x.replace(this.rules.other.listReplaceNesting, " "), ee = x) : ee = x.replace(this.rules.other.tabCharGlobal, " "), X.test(x) || ke.test(x) || Ee.test(x) || ge.test(x) || F.test(x))
|
|
440
440
|
break;
|
|
441
|
-
if (ee.search(this.rules.other.nonSpaceChar) >=
|
|
441
|
+
if (ee.search(this.rules.other.nonSpaceChar) >= R || !x.trim())
|
|
442
442
|
g += `
|
|
443
|
-
` + ee.slice(
|
|
443
|
+
` + ee.slice(R);
|
|
444
444
|
else {
|
|
445
|
-
if (
|
|
445
|
+
if (I || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || X.test(m) || ke.test(m) || F.test(m))
|
|
446
446
|
break;
|
|
447
447
|
g += `
|
|
448
448
|
` + x;
|
|
449
449
|
}
|
|
450
|
-
!
|
|
451
|
-
`, e = e.substring(ae.length + 1), m = ee.slice(
|
|
450
|
+
!I && !x.trim() && (I = !0), l += ae + `
|
|
451
|
+
`, e = e.substring(ae.length + 1), m = ee.slice(R);
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
r.loose || (a ? r.loose = !0 : this.rules.other.doubleBlankLine.test(l) && (a = !0));
|
|
455
|
-
let
|
|
456
|
-
this.options.gfm && (
|
|
455
|
+
let B = null, de;
|
|
456
|
+
this.options.gfm && (B = this.rules.other.listIsTask.exec(g), B && (de = B[0] !== "[ ] ", g = g.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
|
|
457
457
|
type: "list_item",
|
|
458
458
|
raw: l,
|
|
459
|
-
task: !!
|
|
459
|
+
task: !!B,
|
|
460
460
|
checked: de,
|
|
461
461
|
loose: !1,
|
|
462
462
|
text: g,
|
|
@@ -659,20 +659,20 @@ ${g}` : g;
|
|
|
659
659
|
u = Math.min(u, u + o + l);
|
|
660
660
|
const m = [...s[0]][0].length, x = e.slice(0, i + s.index + m + u);
|
|
661
661
|
if (Math.min(i, u) % 2) {
|
|
662
|
-
const
|
|
662
|
+
const R = x.slice(1, -1);
|
|
663
663
|
return {
|
|
664
664
|
type: "em",
|
|
665
665
|
raw: x,
|
|
666
|
-
text:
|
|
667
|
-
tokens: this.lexer.inlineTokens(
|
|
666
|
+
text: R,
|
|
667
|
+
tokens: this.lexer.inlineTokens(R)
|
|
668
668
|
};
|
|
669
669
|
}
|
|
670
|
-
const
|
|
670
|
+
const I = x.slice(2, -2);
|
|
671
671
|
return {
|
|
672
672
|
type: "strong",
|
|
673
673
|
raw: x,
|
|
674
|
-
text:
|
|
675
|
-
tokens: this.lexer.inlineTokens(
|
|
674
|
+
text: I,
|
|
675
|
+
tokens: this.lexer.inlineTokens(I)
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
678
|
}
|
|
@@ -770,29 +770,29 @@ ${g}` : g;
|
|
|
770
770
|
}
|
|
771
771
|
class U {
|
|
772
772
|
constructor(e) {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ie, this.options.tokenizer = this.options.tokenizer || new
|
|
773
|
+
S(this, "tokens");
|
|
774
|
+
S(this, "options");
|
|
775
|
+
S(this, "state");
|
|
776
|
+
S(this, "tokenizer");
|
|
777
|
+
S(this, "inlineQueue");
|
|
778
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ie, this.options.tokenizer = this.options.tokenizer || new Ae(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
779
779
|
inLink: !1,
|
|
780
780
|
inRawBlock: !1,
|
|
781
781
|
top: !0
|
|
782
782
|
};
|
|
783
783
|
const t = {
|
|
784
|
-
other:
|
|
785
|
-
block:
|
|
784
|
+
other: O,
|
|
785
|
+
block: Ie.normal,
|
|
786
786
|
inline: ye.normal
|
|
787
787
|
};
|
|
788
|
-
this.options.pedantic ? (t.block =
|
|
788
|
+
this.options.pedantic ? (t.block = Ie.pedantic, t.inline = ye.pedantic) : this.options.gfm && (t.block = Ie.gfm, this.options.breaks ? t.inline = ye.breaks : t.inline = ye.gfm), this.tokenizer.rules = t;
|
|
789
789
|
}
|
|
790
790
|
/**
|
|
791
791
|
* Expose Rules
|
|
792
792
|
*/
|
|
793
793
|
static get rules() {
|
|
794
794
|
return {
|
|
795
|
-
block:
|
|
795
|
+
block: Ie,
|
|
796
796
|
inline: ye
|
|
797
797
|
};
|
|
798
798
|
}
|
|
@@ -812,7 +812,7 @@ class U {
|
|
|
812
812
|
* Preprocessing
|
|
813
813
|
*/
|
|
814
814
|
lex(e) {
|
|
815
|
-
e = e.replace(
|
|
815
|
+
e = e.replace(O.carriageReturn, `
|
|
816
816
|
`), this.blockTokens(e, this.tokens);
|
|
817
817
|
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
818
818
|
const n = this.inlineQueue[t];
|
|
@@ -822,7 +822,7 @@ class U {
|
|
|
822
822
|
}
|
|
823
823
|
blockTokens(e, t = [], n = !1) {
|
|
824
824
|
var s, r, i;
|
|
825
|
-
for (this.options.pedantic && (e = e.replace(
|
|
825
|
+
for (this.options.pedantic && (e = e.replace(O.tabCharGlobal, " ").replace(O.spaceLine, "")); e; ) {
|
|
826
826
|
let a;
|
|
827
827
|
if ((r = (s = this.options.extensions) == null ? void 0 : s.block) != null && r.some((o) => (a = o.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), !0) : !1))
|
|
828
828
|
continue;
|
|
@@ -990,9 +990,9 @@ class U {
|
|
|
990
990
|
if ((o = this.options.extensions) != null && o.startInline) {
|
|
991
991
|
let m = 1 / 0;
|
|
992
992
|
const x = e.slice(1);
|
|
993
|
-
let
|
|
994
|
-
this.options.extensions.startInline.forEach((
|
|
995
|
-
|
|
993
|
+
let I;
|
|
994
|
+
this.options.extensions.startInline.forEach((R) => {
|
|
995
|
+
I = R.call({ lexer: this }, x), typeof I == "number" && I >= 0 && (m = Math.min(m, I));
|
|
996
996
|
}), m < 1 / 0 && m >= 0 && (g = e.substring(0, m + 1));
|
|
997
997
|
}
|
|
998
998
|
if (l = this.tokenizer.inlineText(g)) {
|
|
@@ -1016,8 +1016,8 @@ class U {
|
|
|
1016
1016
|
class Le {
|
|
1017
1017
|
// set by the parser
|
|
1018
1018
|
constructor(e) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1019
|
+
S(this, "options");
|
|
1020
|
+
S(this, "parser");
|
|
1021
1021
|
this.options = e || ie;
|
|
1022
1022
|
}
|
|
1023
1023
|
space(e) {
|
|
@@ -1025,7 +1025,7 @@ class Le {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
code({ text: e, lang: t, escaped: n }) {
|
|
1027
1027
|
var i;
|
|
1028
|
-
const s = (i = (t || "").match(
|
|
1028
|
+
const s = (i = (t || "").match(O.notSpaceStart)) == null ? void 0 : i[0], r = e.replace(O.endingNewline, "") + `
|
|
1029
1029
|
`;
|
|
1030
1030
|
return s ? '<pre><code class="language-' + W(s) + '">' + (n ? r : W(r, !0)) + `</code></pre>
|
|
1031
1031
|
` : "<pre><code>" + (n ? r : W(r, !0)) + `</code></pre>
|
|
@@ -1148,7 +1148,7 @@ ${e}</tr>
|
|
|
1148
1148
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : W(e.text);
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
|
-
class
|
|
1151
|
+
class et {
|
|
1152
1152
|
// no need for block level renderers
|
|
1153
1153
|
strong({ text: e }) {
|
|
1154
1154
|
return e;
|
|
@@ -1178,24 +1178,24 @@ class Ye {
|
|
|
1178
1178
|
return "";
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
-
class
|
|
1181
|
+
class G {
|
|
1182
1182
|
constructor(e) {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
this.options = e || ie, this.options.renderer = this.options.renderer || new Le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new
|
|
1183
|
+
S(this, "options");
|
|
1184
|
+
S(this, "renderer");
|
|
1185
|
+
S(this, "textRenderer");
|
|
1186
|
+
this.options = e || ie, this.options.renderer = this.options.renderer || new Le(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new et();
|
|
1187
1187
|
}
|
|
1188
1188
|
/**
|
|
1189
1189
|
* Static Parse Method
|
|
1190
1190
|
*/
|
|
1191
1191
|
static parse(e, t) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new G(t).parse(e);
|
|
1193
1193
|
}
|
|
1194
1194
|
/**
|
|
1195
1195
|
* Static Parse Inline Method
|
|
1196
1196
|
*/
|
|
1197
1197
|
static parseInline(e, t) {
|
|
1198
|
-
return new
|
|
1198
|
+
return new G(t).parseInline(e);
|
|
1199
1199
|
}
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Parse Loop
|
|
@@ -1343,8 +1343,8 @@ class Z {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
class Re {
|
|
1345
1345
|
constructor(e) {
|
|
1346
|
-
|
|
1347
|
-
|
|
1346
|
+
S(this, "options");
|
|
1347
|
+
S(this, "block");
|
|
1348
1348
|
this.options = e || ie;
|
|
1349
1349
|
}
|
|
1350
1350
|
/**
|
|
@@ -1375,26 +1375,26 @@ class Re {
|
|
|
1375
1375
|
* Provide function to parse tokens
|
|
1376
1376
|
*/
|
|
1377
1377
|
provideParser() {
|
|
1378
|
-
return this.block ?
|
|
1378
|
+
return this.block ? G.parse : G.parseInline;
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
|
-
|
|
1381
|
+
S(Re, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
1382
1382
|
"preprocess",
|
|
1383
1383
|
"postprocess",
|
|
1384
1384
|
"processAllTokens"
|
|
1385
1385
|
]));
|
|
1386
|
-
class
|
|
1386
|
+
class $t {
|
|
1387
1387
|
constructor(...e) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1388
|
+
S(this, "defaults", Qe());
|
|
1389
|
+
S(this, "options", this.setOptions);
|
|
1390
|
+
S(this, "parse", this.parseMarkdown(!0));
|
|
1391
|
+
S(this, "parseInline", this.parseMarkdown(!1));
|
|
1392
|
+
S(this, "Parser", G);
|
|
1393
|
+
S(this, "Renderer", Le);
|
|
1394
|
+
S(this, "TextRenderer", et);
|
|
1395
|
+
S(this, "Lexer", U);
|
|
1396
|
+
S(this, "Tokenizer", Ae);
|
|
1397
|
+
S(this, "Hooks", Re);
|
|
1398
1398
|
this.use(...e);
|
|
1399
1399
|
}
|
|
1400
1400
|
/**
|
|
@@ -1466,7 +1466,7 @@ class _t {
|
|
|
1466
1466
|
s.renderer = r;
|
|
1467
1467
|
}
|
|
1468
1468
|
if (n.tokenizer) {
|
|
1469
|
-
const r = this.defaults.tokenizer || new
|
|
1469
|
+
const r = this.defaults.tokenizer || new Ae(this.defaults);
|
|
1470
1470
|
for (const i in n.tokenizer) {
|
|
1471
1471
|
if (!(i in r))
|
|
1472
1472
|
throw new Error(`tokenizer '${i}' does not exist`);
|
|
@@ -1517,7 +1517,7 @@ class _t {
|
|
|
1517
1517
|
return U.lex(e, t ?? this.defaults);
|
|
1518
1518
|
}
|
|
1519
1519
|
parser(e, t) {
|
|
1520
|
-
return
|
|
1520
|
+
return G.parse(e, t ?? this.defaults);
|
|
1521
1521
|
}
|
|
1522
1522
|
parseMarkdown(e) {
|
|
1523
1523
|
return (n, s) => {
|
|
@@ -1529,7 +1529,7 @@ class _t {
|
|
|
1529
1529
|
if (typeof n != "string")
|
|
1530
1530
|
return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1531
1531
|
i.hooks && (i.hooks.options = i, i.hooks.block = e);
|
|
1532
|
-
const u = i.hooks ? i.hooks.provideLexer() : e ? U.lex : U.lexInline, o = i.hooks ? i.hooks.provideParser() : e ?
|
|
1532
|
+
const u = i.hooks ? i.hooks.provideLexer() : e ? U.lex : U.lexInline, o = i.hooks ? i.hooks.provideParser() : e ? G.parse : G.parseInline;
|
|
1533
1533
|
if (i.async)
|
|
1534
1534
|
return Promise.resolve(i.hooks ? i.hooks.preprocess(n) : n).then((l) => u(l, i)).then((l) => i.hooks ? i.hooks.processAllTokens(l) : l).then((l) => i.walkTokens ? Promise.all(this.walkTokens(l, i.walkTokens)).then(() => l) : l).then((l) => o(l, i)).then((l) => i.hooks ? i.hooks.postprocess(l) : l).catch(a);
|
|
1535
1535
|
try {
|
|
@@ -1556,14 +1556,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1556
1556
|
};
|
|
1557
1557
|
}
|
|
1558
1558
|
}
|
|
1559
|
-
const se = new
|
|
1559
|
+
const se = new $t();
|
|
1560
1560
|
function E(h, e) {
|
|
1561
1561
|
return se.parse(h, e);
|
|
1562
1562
|
}
|
|
1563
1563
|
E.options = E.setOptions = function(h) {
|
|
1564
1564
|
return se.setOptions(h), E.defaults = se.defaults, bt(E.defaults), E;
|
|
1565
1565
|
};
|
|
1566
|
-
E.getDefaults =
|
|
1566
|
+
E.getDefaults = Qe;
|
|
1567
1567
|
E.defaults = ie;
|
|
1568
1568
|
E.use = function(...h) {
|
|
1569
1569
|
return se.use(...h), E.defaults = se.defaults, bt(E.defaults), E;
|
|
@@ -1572,13 +1572,13 @@ E.walkTokens = function(h, e) {
|
|
|
1572
1572
|
return se.walkTokens(h, e);
|
|
1573
1573
|
};
|
|
1574
1574
|
E.parseInline = se.parseInline;
|
|
1575
|
-
E.Parser =
|
|
1576
|
-
E.parser =
|
|
1575
|
+
E.Parser = G;
|
|
1576
|
+
E.parser = G.parse;
|
|
1577
1577
|
E.Renderer = Le;
|
|
1578
|
-
E.TextRenderer =
|
|
1578
|
+
E.TextRenderer = et;
|
|
1579
1579
|
E.Lexer = U;
|
|
1580
1580
|
E.lexer = U.lex;
|
|
1581
|
-
E.Tokenizer =
|
|
1581
|
+
E.Tokenizer = Ae;
|
|
1582
1582
|
E.Hooks = Re;
|
|
1583
1583
|
E.parse = E;
|
|
1584
1584
|
E.options;
|
|
@@ -1586,7 +1586,7 @@ E.setOptions;
|
|
|
1586
1586
|
E.use;
|
|
1587
1587
|
E.walkTokens;
|
|
1588
1588
|
E.parseInline;
|
|
1589
|
-
|
|
1589
|
+
G.parse;
|
|
1590
1590
|
U.lex;
|
|
1591
1591
|
const yn = (h) => ({
|
|
1592
1592
|
extensions: [
|
|
@@ -1621,7 +1621,7 @@ const yn = (h) => ({
|
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
1623
|
]
|
|
1624
|
-
}), ft = (h, e) => new
|
|
1624
|
+
}), ft = (h, e) => new $t().use(yn(e)).parse(h);
|
|
1625
1625
|
var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ze = { exports: {} };
|
|
1626
1626
|
/** @license
|
|
1627
1627
|
* eventsource.js
|
|
@@ -1630,7 +1630,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1630
1630
|
*/
|
|
1631
1631
|
(function(h, e) {
|
|
1632
1632
|
(function(t) {
|
|
1633
|
-
var n = t.setTimeout, s = t.clearTimeout, r = t.XMLHttpRequest, i = t.XDomainRequest, a = t.ActiveXObject, u = t.EventSource, o = t.document, l = t.Promise, g = t.fetch, m = t.Response, x = t.TextDecoder,
|
|
1633
|
+
var n = t.setTimeout, s = t.clearTimeout, r = t.XMLHttpRequest, i = t.XDomainRequest, a = t.ActiveXObject, u = t.EventSource, o = t.document, l = t.Promise, g = t.fetch, m = t.Response, x = t.TextDecoder, I = t.TextEncoder, R = t.AbortController;
|
|
1634
1634
|
if (typeof window < "u" && typeof o < "u" && !("readyState" in o) && o.body == null && (o.readyState = "loading", window.addEventListener("load", function(c) {
|
|
1635
1635
|
o.readyState = "complete";
|
|
1636
1636
|
}, !1)), r == null && a != null && (r = function() {
|
|
@@ -1641,11 +1641,11 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1641
1641
|
return f.prototype = c, new f();
|
|
1642
1642
|
}), Date.now || (Date.now = function() {
|
|
1643
1643
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
1644
|
-
}),
|
|
1645
|
-
var
|
|
1644
|
+
}), R == null) {
|
|
1645
|
+
var B = g;
|
|
1646
1646
|
g = function(c, f) {
|
|
1647
1647
|
var d = f.signal;
|
|
1648
|
-
return
|
|
1648
|
+
return B(c, { headers: f.headers, credentials: f.credentials, cache: f.cache }).then(function(p) {
|
|
1649
1649
|
var b = p.body.getReader();
|
|
1650
1650
|
return d._reader = b, d._aborted && d._reader.cancel(), {
|
|
1651
1651
|
status: p.status,
|
|
@@ -1658,7 +1658,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1658
1658
|
}
|
|
1659
1659
|
};
|
|
1660
1660
|
});
|
|
1661
|
-
},
|
|
1661
|
+
}, R = function() {
|
|
1662
1662
|
this.signal = {
|
|
1663
1663
|
_reader: null,
|
|
1664
1664
|
_aborted: !1
|
|
@@ -1671,20 +1671,20 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1671
1671
|
this.bitsNeeded = 0, this.codePoint = 0;
|
|
1672
1672
|
}
|
|
1673
1673
|
de.prototype.decode = function(c) {
|
|
1674
|
-
function f(T,
|
|
1674
|
+
function f(T, _, w) {
|
|
1675
1675
|
if (w === 1)
|
|
1676
|
-
return T >= 128 >>
|
|
1676
|
+
return T >= 128 >> _ && T << _ <= 2047;
|
|
1677
1677
|
if (w === 2)
|
|
1678
|
-
return T >= 2048 >>
|
|
1678
|
+
return T >= 2048 >> _ && T << _ <= 55295 || T >= 57344 >> _ && T << _ <= 65535;
|
|
1679
1679
|
if (w === 3)
|
|
1680
|
-
return T >= 65536 >>
|
|
1680
|
+
return T >= 65536 >> _ && T << _ <= 1114111;
|
|
1681
1681
|
throw new Error();
|
|
1682
1682
|
}
|
|
1683
|
-
function d(T,
|
|
1683
|
+
function d(T, _) {
|
|
1684
1684
|
if (T === 6 * 1)
|
|
1685
|
-
return
|
|
1685
|
+
return _ >> 6 > 15 ? 3 : _ > 31 ? 2 : 1;
|
|
1686
1686
|
if (T === 6 * 2)
|
|
1687
|
-
return
|
|
1687
|
+
return _ > 15 ? 3 : 2;
|
|
1688
1688
|
if (T === 6 * 3)
|
|
1689
1689
|
return 3;
|
|
1690
1690
|
throw new Error();
|
|
@@ -1697,13 +1697,13 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1697
1697
|
};
|
|
1698
1698
|
var ge = function() {
|
|
1699
1699
|
try {
|
|
1700
|
-
return new x().decode(new
|
|
1700
|
+
return new x().decode(new I().encode("test"), { stream: !0 }) === "test";
|
|
1701
1701
|
} catch (c) {
|
|
1702
1702
|
console.debug("TextDecoder does not support streaming option. Using polyfill instead: " + c);
|
|
1703
1703
|
}
|
|
1704
1704
|
return !1;
|
|
1705
1705
|
};
|
|
1706
|
-
(x == null ||
|
|
1706
|
+
(x == null || I == null || !ge()) && (x = de);
|
|
1707
1707
|
var F = function() {
|
|
1708
1708
|
};
|
|
1709
1709
|
function X(c) {
|
|
@@ -1717,16 +1717,16 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1717
1717
|
};
|
|
1718
1718
|
var y = function() {
|
|
1719
1719
|
if (b === 1) {
|
|
1720
|
-
var w = 0,
|
|
1720
|
+
var w = 0, A = "", K = void 0;
|
|
1721
1721
|
if ("contentType" in p)
|
|
1722
|
-
w = 200,
|
|
1722
|
+
w = 200, A = "OK", K = p.contentType;
|
|
1723
1723
|
else
|
|
1724
1724
|
try {
|
|
1725
|
-
w = p.status,
|
|
1725
|
+
w = p.status, A = p.statusText, K = p.getResponseHeader("Content-Type");
|
|
1726
1726
|
} catch {
|
|
1727
|
-
w = 0,
|
|
1727
|
+
w = 0, A = "", K = void 0;
|
|
1728
1728
|
}
|
|
1729
|
-
w !== 0 && (b = 2, d.readyState = 2, d.status = w, d.statusText =
|
|
1729
|
+
w !== 0 && (b = 2, d.readyState = 2, d.status = w, d.statusText = A, d._contentType = K, d.onreadystatechange());
|
|
1730
1730
|
}
|
|
1731
1731
|
}, C = function() {
|
|
1732
1732
|
if (y(), b === 2 || b === 3) {
|
|
@@ -1738,25 +1738,25 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1738
1738
|
}
|
|
1739
1739
|
d.readyState = 3, d.responseText = w, d.onprogress();
|
|
1740
1740
|
}
|
|
1741
|
-
}, v = function(w,
|
|
1742
|
-
if ((
|
|
1741
|
+
}, v = function(w, A) {
|
|
1742
|
+
if ((A == null || A.preventDefault == null) && (A = {
|
|
1743
1743
|
preventDefault: F
|
|
1744
1744
|
}), C(), b === 1 || b === 2 || b === 3) {
|
|
1745
1745
|
if (b = 4, k !== 0 && (s(k), k = 0), d.readyState = 4, w === "load")
|
|
1746
|
-
d.onload(
|
|
1746
|
+
d.onload(A);
|
|
1747
1747
|
else if (w === "error")
|
|
1748
|
-
d.onerror(
|
|
1748
|
+
d.onerror(A);
|
|
1749
1749
|
else if (w === "abort")
|
|
1750
|
-
d.onabort(
|
|
1750
|
+
d.onabort(A);
|
|
1751
1751
|
else
|
|
1752
1752
|
throw new TypeError();
|
|
1753
1753
|
d.onreadystatechange();
|
|
1754
1754
|
}
|
|
1755
1755
|
}, T = function(w) {
|
|
1756
1756
|
p != null && (p.readyState === 4 ? (!("onload" in p) || !("onerror" in p) || !("onabort" in p)) && v(p.responseText === "" ? "error" : "load", w) : p.readyState === 3 ? "onprogress" in p || C() : p.readyState === 2 && y());
|
|
1757
|
-
},
|
|
1757
|
+
}, _ = function() {
|
|
1758
1758
|
k = n(function() {
|
|
1759
|
-
|
|
1759
|
+
_();
|
|
1760
1760
|
}, 500), p.readyState === 3 && C();
|
|
1761
1761
|
};
|
|
1762
1762
|
"onload" in p && (p.onload = function(w) {
|
|
@@ -1768,7 +1768,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1768
1768
|
}), "onprogress" in p && (p.onprogress = C), "onreadystatechange" in p && (p.onreadystatechange = function(w) {
|
|
1769
1769
|
T(w);
|
|
1770
1770
|
}), ("contentType" in p || !("ontimeout" in r.prototype)) && (f += (f.indexOf("?") === -1 ? "?" : "&") + "padding=true"), p.open(c, f, !0), "readyState" in p && (k = n(function() {
|
|
1771
|
-
|
|
1771
|
+
_();
|
|
1772
1772
|
}, 0));
|
|
1773
1773
|
}, X.prototype.abort = function() {
|
|
1774
1774
|
this._abort(!1);
|
|
@@ -1817,8 +1817,8 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1817
1817
|
c.open("GET", b);
|
|
1818
1818
|
var C = 0;
|
|
1819
1819
|
c.onprogress = function() {
|
|
1820
|
-
var T = c.responseText,
|
|
1821
|
-
C +=
|
|
1820
|
+
var T = c.responseText, _ = T.slice(C);
|
|
1821
|
+
C += _.length, d(_);
|
|
1822
1822
|
}, c.onerror = function(T) {
|
|
1823
1823
|
T.preventDefault(), p(new Error("NetworkError"));
|
|
1824
1824
|
}, c.onload = function() {
|
|
@@ -1827,8 +1827,8 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1827
1827
|
p(null);
|
|
1828
1828
|
}, c.onreadystatechange = function() {
|
|
1829
1829
|
if (c.readyState === r.HEADERS_RECEIVED) {
|
|
1830
|
-
var T = c.status,
|
|
1831
|
-
f(T,
|
|
1830
|
+
var T = c.status, _ = c.statusText, w = c.getResponseHeader("Content-Type"), A = c.getAllResponseHeaders();
|
|
1831
|
+
f(T, _, w, new Ee(A));
|
|
1832
1832
|
}
|
|
1833
1833
|
}, c.withCredentials = k;
|
|
1834
1834
|
for (var v in y)
|
|
@@ -1841,23 +1841,23 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1841
1841
|
ee.prototype.get = function(c) {
|
|
1842
1842
|
return this._headers.get(c);
|
|
1843
1843
|
};
|
|
1844
|
-
function
|
|
1844
|
+
function tt() {
|
|
1845
1845
|
}
|
|
1846
|
-
|
|
1847
|
-
var C = null, v = new
|
|
1846
|
+
tt.prototype.open = function(c, f, d, p, b, k, y) {
|
|
1847
|
+
var C = null, v = new R(), T = v.signal, _ = new x();
|
|
1848
1848
|
return g(b, {
|
|
1849
1849
|
headers: y,
|
|
1850
1850
|
credentials: k ? "include" : "same-origin",
|
|
1851
1851
|
signal: T,
|
|
1852
1852
|
cache: "no-store"
|
|
1853
1853
|
}).then(function(w) {
|
|
1854
|
-
return C = w.body.getReader(), f(w.status, w.statusText, w.headers.get("Content-Type"), new ee(w.headers)), new l(function(
|
|
1854
|
+
return C = w.body.getReader(), f(w.status, w.statusText, w.headers.get("Content-Type"), new ee(w.headers)), new l(function(A, K) {
|
|
1855
1855
|
var we = function() {
|
|
1856
1856
|
C.read().then(function(H) {
|
|
1857
1857
|
if (H.done)
|
|
1858
|
-
|
|
1858
|
+
A(void 0);
|
|
1859
1859
|
else {
|
|
1860
|
-
var P =
|
|
1860
|
+
var P = _.decode(H.value, { stream: !0 });
|
|
1861
1861
|
d(P), we();
|
|
1862
1862
|
}
|
|
1863
1863
|
}).catch(function(H) {
|
|
@@ -1880,7 +1880,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1880
1880
|
function me() {
|
|
1881
1881
|
this._listeners = /* @__PURE__ */ Object.create(null);
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function nt(c) {
|
|
1884
1884
|
n(function() {
|
|
1885
1885
|
throw c;
|
|
1886
1886
|
}, 0);
|
|
@@ -1894,7 +1894,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1894
1894
|
try {
|
|
1895
1895
|
typeof b.handleEvent == "function" ? b.handleEvent(c) : b.call(this, c);
|
|
1896
1896
|
} catch (k) {
|
|
1897
|
-
|
|
1897
|
+
nt(k);
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
1900
|
}, me.prototype.addEventListener = function(c, f) {
|
|
@@ -1916,31 +1916,31 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1916
1916
|
function oe(c) {
|
|
1917
1917
|
this.type = c, this.target = void 0;
|
|
1918
1918
|
}
|
|
1919
|
-
function
|
|
1919
|
+
function rt(c, f) {
|
|
1920
1920
|
oe.call(this, c), this.data = f.data, this.lastEventId = f.lastEventId;
|
|
1921
1921
|
}
|
|
1922
|
-
|
|
1922
|
+
rt.prototype = Object.create(oe.prototype);
|
|
1923
1923
|
function Pe(c, f) {
|
|
1924
1924
|
oe.call(this, c), this.status = f.status, this.statusText = f.statusText, this.headers = f.headers;
|
|
1925
1925
|
}
|
|
1926
1926
|
Pe.prototype = Object.create(oe.prototype);
|
|
1927
|
-
function
|
|
1927
|
+
function st(c, f) {
|
|
1928
1928
|
oe.call(this, c), this.error = f.error;
|
|
1929
1929
|
}
|
|
1930
|
-
|
|
1931
|
-
var Ne = -1, te = 0, le = 1, be = 2,
|
|
1930
|
+
st.prototype = Object.create(oe.prototype);
|
|
1931
|
+
var Ne = -1, te = 0, le = 1, be = 2, qe = -1, ne = 0, Oe = 1, it = 2, _t = 3, It = /^text\/event\-stream(;.*)?$/i, Ct = 1e3, At = 18e6, Be = function(c, f) {
|
|
1932
1932
|
var d = c == null ? f : parseInt(c, 10);
|
|
1933
1933
|
return d !== d && (d = f), Fe(d);
|
|
1934
1934
|
}, Fe = function(c) {
|
|
1935
|
-
return Math.min(Math.max(c, Ct),
|
|
1935
|
+
return Math.min(Math.max(c, Ct), At);
|
|
1936
1936
|
}, ce = function(c, f, d) {
|
|
1937
1937
|
try {
|
|
1938
1938
|
typeof f == "function" && f.call(c, d);
|
|
1939
1939
|
} catch (p) {
|
|
1940
|
-
|
|
1940
|
+
nt(p);
|
|
1941
1941
|
}
|
|
1942
1942
|
};
|
|
1943
|
-
function
|
|
1943
|
+
function Z(c, f) {
|
|
1944
1944
|
me.call(this), f = f || {}, this.onopen = void 0, this.onmessage = void 0, this.onerror = void 0, this.url = void 0, this.readyState = void 0, this.withCredentials = void 0, this.headers = void 0, this._close = void 0, Dt(this, c, f);
|
|
1945
1945
|
}
|
|
1946
1946
|
function Lt() {
|
|
@@ -1949,25 +1949,25 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1949
1949
|
var zt = g != null && m != null && "body" in m.prototype;
|
|
1950
1950
|
function Dt(c, f, d) {
|
|
1951
1951
|
f = String(f);
|
|
1952
|
-
var p = !!d.withCredentials, b = d.lastEventIdQueryParameterName || "lastEventId", k = Fe(1e3), y =
|
|
1952
|
+
var p = !!d.withCredentials, b = d.lastEventIdQueryParameterName || "lastEventId", k = Fe(1e3), y = Be(d.heartbeatTimeout, 45e3), C = "", v = k, T = !1, _ = 0, w = d.headers || {}, A = d.Transport, K = zt && A == null ? void 0 : new X(A != null ? new A() : Lt()), we = A != null && typeof A != "string" ? new A() : K == null ? new tt() : new ae(), H = void 0, P = 0, Q = Ne, ue = "", $e = "", V = "", _e = "", N = ne, He = 0, re = 0, Pt = function(z, L, M, j) {
|
|
1953
1953
|
if (Q === te)
|
|
1954
|
-
if (z === 200 && M != null &&
|
|
1954
|
+
if (z === 200 && M != null && It.test(M)) {
|
|
1955
1955
|
Q = le, T = Date.now(), v = k, c.readyState = le;
|
|
1956
|
-
var
|
|
1956
|
+
var q = new Pe("open", {
|
|
1957
1957
|
status: z,
|
|
1958
1958
|
statusText: L,
|
|
1959
1959
|
headers: j
|
|
1960
1960
|
});
|
|
1961
|
-
c.dispatchEvent(
|
|
1961
|
+
c.dispatchEvent(q), ce(c, c.onopen, q);
|
|
1962
1962
|
} else {
|
|
1963
1963
|
var D = "";
|
|
1964
1964
|
z !== 200 ? (L && (L = L.replace(/\s+/g, " ")), D = "EventSource's response has a status " + z + " " + L + " that is not 200. Aborting the connection.") : D = "EventSource's response has a Content-Type specifying an unsupported type: " + (M == null ? "-" : M.replace(/\s+/g, " ")) + ". Aborting the connection.", Me();
|
|
1965
|
-
var
|
|
1965
|
+
var q = new Pe("error", {
|
|
1966
1966
|
status: z,
|
|
1967
1967
|
statusText: L,
|
|
1968
1968
|
headers: j
|
|
1969
1969
|
});
|
|
1970
|
-
c.dispatchEvent(
|
|
1970
|
+
c.dispatchEvent(q), ce(c, c.onerror, q), console.error(D);
|
|
1971
1971
|
}
|
|
1972
1972
|
}, Nt = function(z) {
|
|
1973
1973
|
if (Q === le) {
|
|
@@ -1975,44 +1975,44 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1975
1975
|
var j = z.charCodeAt(M);
|
|
1976
1976
|
(j === 10 || j === 13) && (L = M);
|
|
1977
1977
|
}
|
|
1978
|
-
var
|
|
1979
|
-
|
|
1980
|
-
for (var D = 0; D <
|
|
1981
|
-
var j =
|
|
1982
|
-
if (N ===
|
|
1978
|
+
var q = (L !== -1 ? _e : "") + z.slice(0, L + 1);
|
|
1979
|
+
_e = (L === -1 ? _e : "") + z.slice(L + 1), z !== "" && (T = Date.now(), _ += z.length);
|
|
1980
|
+
for (var D = 0; D < q.length; D += 1) {
|
|
1981
|
+
var j = q.charCodeAt(D);
|
|
1982
|
+
if (N === qe && j === 10)
|
|
1983
1983
|
N = ne;
|
|
1984
|
-
else if (N ===
|
|
1984
|
+
else if (N === qe && (N = ne), j === 13 || j === 10) {
|
|
1985
1985
|
if (N !== ne) {
|
|
1986
|
-
N ===
|
|
1987
|
-
var J =
|
|
1986
|
+
N === Oe && (re = D + 1);
|
|
1987
|
+
var J = q.slice(He, re - 1), Y = q.slice(re + (re < D && q.charCodeAt(re) === 32 ? 1 : 0), D);
|
|
1988
1988
|
J === "data" ? (ue += `
|
|
1989
|
-
`, ue += Y) : J === "id" ?
|
|
1989
|
+
`, ue += Y) : J === "id" ? $e = Y : J === "event" ? V = Y : J === "retry" ? (k = Be(Y, k), v = k) : J === "heartbeatTimeout" && (y = Be(Y, y), P !== 0 && (s(P), P = n(function() {
|
|
1990
1990
|
xe();
|
|
1991
1991
|
}, y)));
|
|
1992
1992
|
}
|
|
1993
1993
|
if (N === ne) {
|
|
1994
1994
|
if (ue !== "") {
|
|
1995
|
-
C =
|
|
1996
|
-
var he = new
|
|
1995
|
+
C = $e, V === "" && (V = "message");
|
|
1996
|
+
var he = new rt(V, {
|
|
1997
1997
|
data: ue.slice(1),
|
|
1998
|
-
lastEventId:
|
|
1998
|
+
lastEventId: $e
|
|
1999
1999
|
});
|
|
2000
2000
|
if (c.dispatchEvent(he), V === "open" ? ce(c, c.onopen, he) : V === "message" ? ce(c, c.onmessage, he) : V === "error" && ce(c, c.onerror, he), Q === be)
|
|
2001
2001
|
return;
|
|
2002
2002
|
}
|
|
2003
2003
|
ue = "", V = "";
|
|
2004
2004
|
}
|
|
2005
|
-
N = j === 13 ?
|
|
2005
|
+
N = j === 13 ? qe : ne;
|
|
2006
2006
|
} else
|
|
2007
|
-
N === ne && (He = D, N =
|
|
2007
|
+
N === ne && (He = D, N = Oe), N === Oe ? j === 58 && (re = D + 1, N = it) : N === it && (N = _t);
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
},
|
|
2010
|
+
}, ot = function(z) {
|
|
2011
2011
|
if (Q === le || Q === te) {
|
|
2012
2012
|
Q = Ne, P !== 0 && (s(P), P = 0), P = n(function() {
|
|
2013
2013
|
xe();
|
|
2014
2014
|
}, v), v = Fe(Math.min(k * 16, v * 2)), c.readyState = te;
|
|
2015
|
-
var L = new
|
|
2015
|
+
var L = new st("error", { error: z });
|
|
2016
2016
|
c.dispatchEvent(L), ce(c, c.onerror, L), z != null && console.error(z);
|
|
2017
2017
|
}
|
|
2018
2018
|
}, Me = function() {
|
|
@@ -2020,7 +2020,7 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2020
2020
|
}, xe = function() {
|
|
2021
2021
|
if (P = 0, Q !== Ne) {
|
|
2022
2022
|
if (!T && H != null)
|
|
2023
|
-
|
|
2023
|
+
ot(new Error("No activity within " + y + " milliseconds. " + (Q === te ? "No response received." : _ + " chars received.") + " Reconnecting.")), H != null && (H.abort(), H = void 0);
|
|
2024
2024
|
else {
|
|
2025
2025
|
var z = Math.max((T || Date.now()) + y - Date.now(), 1);
|
|
2026
2026
|
T = !1, P = n(function() {
|
|
@@ -2029,9 +2029,9 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2029
2029
|
}
|
|
2030
2030
|
return;
|
|
2031
2031
|
}
|
|
2032
|
-
T = !1,
|
|
2032
|
+
T = !1, _ = 0, P = n(function() {
|
|
2033
2033
|
xe();
|
|
2034
|
-
}, y), Q = te, ue = "", V = "",
|
|
2034
|
+
}, y), Q = te, ue = "", V = "", $e = C, _e = "", He = 0, re = 0, N = ne;
|
|
2035
2035
|
var L = f;
|
|
2036
2036
|
if (f.slice(0, 5) !== "data:" && f.slice(0, 5) !== "blob:" && C !== "") {
|
|
2037
2037
|
var M = f.indexOf("?");
|
|
@@ -2039,42 +2039,42 @@ var vn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2039
2039
|
return he === b ? "" : Y;
|
|
2040
2040
|
}), L += (f.indexOf("?") === -1 ? "?" : "&") + b + "=" + encodeURIComponent(C);
|
|
2041
2041
|
}
|
|
2042
|
-
var j = c.withCredentials,
|
|
2043
|
-
|
|
2042
|
+
var j = c.withCredentials, q = {};
|
|
2043
|
+
q.Accept = "text/event-stream";
|
|
2044
2044
|
var D = c.headers;
|
|
2045
2045
|
if (D != null)
|
|
2046
2046
|
for (var J in D)
|
|
2047
|
-
Object.prototype.hasOwnProperty.call(D, J) && (
|
|
2047
|
+
Object.prototype.hasOwnProperty.call(D, J) && (q[J] = D[J]);
|
|
2048
2048
|
try {
|
|
2049
|
-
H = we.open(K, Pt, Nt,
|
|
2049
|
+
H = we.open(K, Pt, Nt, ot, L, j, q);
|
|
2050
2050
|
} catch (Y) {
|
|
2051
2051
|
throw Me(), Y;
|
|
2052
2052
|
}
|
|
2053
2053
|
};
|
|
2054
2054
|
c.url = f, c.readyState = te, c.withCredentials = p, c.headers = w, c._close = Me, xe();
|
|
2055
2055
|
}
|
|
2056
|
-
|
|
2056
|
+
Z.prototype = Object.create(me.prototype), Z.prototype.CONNECTING = te, Z.prototype.OPEN = le, Z.prototype.CLOSED = be, Z.prototype.close = function() {
|
|
2057
2057
|
this._close();
|
|
2058
|
-
},
|
|
2059
|
-
var
|
|
2060
|
-
r != null && (u == null || !("withCredentials" in u.prototype)) && (
|
|
2058
|
+
}, Z.CONNECTING = te, Z.OPEN = le, Z.CLOSED = be, Z.prototype.withCredentials = void 0;
|
|
2059
|
+
var at = u;
|
|
2060
|
+
r != null && (u == null || !("withCredentials" in u.prototype)) && (at = Z), function(c) {
|
|
2061
2061
|
{
|
|
2062
2062
|
var f = c(e);
|
|
2063
2063
|
f !== void 0 && (h.exports = f);
|
|
2064
2064
|
}
|
|
2065
2065
|
}(function(c) {
|
|
2066
|
-
c.EventSourcePolyfill =
|
|
2066
|
+
c.EventSourcePolyfill = Z, c.NativeEventSource = u, c.EventSource = at;
|
|
2067
2067
|
});
|
|
2068
2068
|
})(typeof globalThis > "u" ? typeof window < "u" ? window : typeof self < "u" ? self : vn : globalThis);
|
|
2069
2069
|
})(Ze, Ze.exports);
|
|
2070
2070
|
var dt = Ze.exports;
|
|
2071
|
-
const
|
|
2071
|
+
const Ue = () => {
|
|
2072
2072
|
};
|
|
2073
2073
|
function Sn(h, e) {
|
|
2074
2074
|
return h != h ? e == e : h !== e || h !== null && typeof h == "object" || typeof h == "function";
|
|
2075
2075
|
}
|
|
2076
2076
|
const fe = [];
|
|
2077
|
-
function Rn(h, e =
|
|
2077
|
+
function Rn(h, e = Ue) {
|
|
2078
2078
|
let t = null;
|
|
2079
2079
|
const n = /* @__PURE__ */ new Set();
|
|
2080
2080
|
function s(a) {
|
|
@@ -2095,9 +2095,9 @@ function Rn(h, e = je) {
|
|
|
2095
2095
|
h
|
|
2096
2096
|
));
|
|
2097
2097
|
}
|
|
2098
|
-
function i(a, u =
|
|
2098
|
+
function i(a, u = Ue) {
|
|
2099
2099
|
const o = [a, u];
|
|
2100
|
-
return n.add(o), n.size === 1 && (t = e(s, r) ||
|
|
2100
|
+
return n.add(o), n.size === 1 && (t = e(s, r) || Ue), a(
|
|
2101
2101
|
/** @type {T} */
|
|
2102
2102
|
h
|
|
2103
2103
|
), () => {
|
|
@@ -2122,24 +2122,27 @@ const gt = (h) => Object.fromEntries(Object.entries(h).filter(([e, t]) => t != n
|
|
|
2122
2122
|
generated: {
|
|
2123
2123
|
title: h.usedLinks.title ?? "",
|
|
2124
2124
|
// TODO: Exclude the breadcrumbs
|
|
2125
|
-
summary: h.usedLinks.
|
|
2126
|
-
// TODO: use summary (available at alva endpoint) or strip content of markdown and titles
|
|
2125
|
+
summary: h.usedLinks.description ?? h.usedLinks.summary ?? ""
|
|
2127
2126
|
}
|
|
2128
2127
|
}), kt = (h, e) => {
|
|
2129
2128
|
const t = h.all.length, n = En(e);
|
|
2130
2129
|
return n.referenceNumber = t + 1, h.all.push(n), h;
|
|
2131
|
-
},
|
|
2130
|
+
}, $n = dt.NativeEventSource || dt.EventSourcePolyfill, In = {
|
|
2131
|
+
Positive: "positive",
|
|
2132
|
+
Negative: "negative"
|
|
2133
|
+
};
|
|
2132
2134
|
let mt;
|
|
2133
|
-
class
|
|
2135
|
+
class Cn {
|
|
2134
2136
|
constructor({ apiUrl: e, apiKey: t = "X9hL4Gp5W2D7eRtF" }) {
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2137
|
+
S(this, "apiUrl");
|
|
2138
|
+
S(this, "apiKey");
|
|
2139
|
+
S(this, "lastRequestId", null);
|
|
2140
|
+
S(this, "metadata");
|
|
2138
2141
|
this.apiUrl = e, this.apiKey = t, this.metadata = this.getUserData(), mt = this;
|
|
2139
2142
|
}
|
|
2140
2143
|
async getUserData() {
|
|
2141
2144
|
var n;
|
|
2142
|
-
const e =
|
|
2145
|
+
const e = je.getItem("uID"), t = await this.fetchData(
|
|
2143
2146
|
"/log",
|
|
2144
2147
|
{},
|
|
2145
2148
|
{
|
|
@@ -2160,7 +2163,7 @@ class An {
|
|
|
2160
2163
|
mode: "maintenance"
|
|
2161
2164
|
};
|
|
2162
2165
|
if (!("id" in t)) throw new Error("Could not retrieve a user id");
|
|
2163
|
-
return
|
|
2166
|
+
return je.setItem("uID", t.id), {
|
|
2164
2167
|
mode: "ready",
|
|
2165
2168
|
userId: t.id,
|
|
2166
2169
|
conversationId: t.cID
|
|
@@ -2169,6 +2172,21 @@ class An {
|
|
|
2169
2172
|
static getInstance() {
|
|
2170
2173
|
return mt;
|
|
2171
2174
|
}
|
|
2175
|
+
async postData(e, t, n) {
|
|
2176
|
+
const s = await fetch(`${this.apiUrl}${e}`, {
|
|
2177
|
+
method: "POST",
|
|
2178
|
+
headers: {
|
|
2179
|
+
"Content-Type": "application/json",
|
|
2180
|
+
"api-key": this.apiKey
|
|
2181
|
+
},
|
|
2182
|
+
body: JSON.stringify(t)
|
|
2183
|
+
});
|
|
2184
|
+
if (!s.ok) {
|
|
2185
|
+
const r = await s.text();
|
|
2186
|
+
throw new Error(`${n}: ${s.status} - ${r}`);
|
|
2187
|
+
}
|
|
2188
|
+
return s;
|
|
2189
|
+
}
|
|
2172
2190
|
async fetchData(e, t = {}, n = {}) {
|
|
2173
2191
|
return (await fetch(
|
|
2174
2192
|
`${this.apiUrl}${e}?${new URLSearchParams(gt(t)).toString()}`,
|
|
@@ -2182,13 +2200,41 @@ class An {
|
|
|
2182
2200
|
)).json();
|
|
2183
2201
|
}
|
|
2184
2202
|
async fetchSSE(e, t = {}) {
|
|
2185
|
-
return new
|
|
2203
|
+
return new $n(
|
|
2186
2204
|
`${this.apiUrl}${e}?${new URLSearchParams({
|
|
2187
2205
|
...gt(t),
|
|
2188
2206
|
key: this.apiKey
|
|
2189
2207
|
}).toString()}`
|
|
2190
2208
|
);
|
|
2191
2209
|
}
|
|
2210
|
+
async quickFeedback(e) {
|
|
2211
|
+
const t = {
|
|
2212
|
+
...e,
|
|
2213
|
+
rID: this.lastRequestId
|
|
2214
|
+
};
|
|
2215
|
+
return this.postData("/quickfeedback", t, "Got an error when trying to post quick feedback");
|
|
2216
|
+
}
|
|
2217
|
+
async feedback(e) {
|
|
2218
|
+
if ((await this.metadata).mode !== "ready")
|
|
2219
|
+
throw new Error("Can not post feedback unless we are in ready mode");
|
|
2220
|
+
const n = await je.getItem("uID"), s = {
|
|
2221
|
+
...e,
|
|
2222
|
+
rID: this.lastRequestId,
|
|
2223
|
+
uID: n
|
|
2224
|
+
};
|
|
2225
|
+
return this.postData("/feedback", s, "Got an error when trying to post feedback");
|
|
2226
|
+
}
|
|
2227
|
+
async classification(e) {
|
|
2228
|
+
const t = {
|
|
2229
|
+
...e,
|
|
2230
|
+
rID: this.lastRequestId
|
|
2231
|
+
};
|
|
2232
|
+
return this.postData(
|
|
2233
|
+
"/classification",
|
|
2234
|
+
t,
|
|
2235
|
+
"Got an error when trying to post feedback classification"
|
|
2236
|
+
);
|
|
2237
|
+
}
|
|
2192
2238
|
async getPredefinedQuestions(e) {
|
|
2193
2239
|
return (await this.fetchData("/topics/questions", e)).predefinedQuestions;
|
|
2194
2240
|
}
|
|
@@ -2212,7 +2258,7 @@ class An {
|
|
|
2212
2258
|
return this.chatInternal(e, t).then((a) => {
|
|
2213
2259
|
a.onmessage = (u) => {
|
|
2214
2260
|
const o = JSON.parse(u.data);
|
|
2215
|
-
"response" in o ? o.response === "__CLR__" ? s = !1 : o.response === "__THIS_IS_THE_ANSWER_END__" ? (r = !0, n.update((l) => {
|
|
2261
|
+
"id" in o && (this.lastRequestId = o.id), "response" in o ? o.response === "__CLR__" ? s = !1 : o.response === "__THIS_IS_THE_ANSWER_END__" ? (r = !0, n.update((l) => {
|
|
2216
2262
|
if (l.state !== "streaming") throw new Error("Invalid state transition to done");
|
|
2217
2263
|
return { payload: { ...l.payload, partial: !1 }, state: "done" };
|
|
2218
2264
|
})) : s === !1 && r === !1 && n.update((l) => {
|
|
@@ -2305,5 +2351,6 @@ class An {
|
|
|
2305
2351
|
}
|
|
2306
2352
|
}
|
|
2307
2353
|
export {
|
|
2308
|
-
|
|
2354
|
+
Cn as LiipGPTClient,
|
|
2355
|
+
In as QuickFeedbackType
|
|
2309
2356
|
};
|