@paramms/chat-widget 1.6.3 → 1.7.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.
- package/dist/chatlist.d.ts +4 -0
- package/dist/chatlist2.js +406 -353
- package/dist/chatlist2.js.map +1 -1
- package/dist/embed-lite.js +3 -3
- package/dist/embed-lite.js.map +1 -1
- package/dist/embed.d.ts +3 -0
- package/dist/embed.js +3 -3
- package/dist/embed.js.map +1 -1
- package/dist/i18n.d.ts +41 -0
- package/dist/index.d.ts +8 -13
- package/dist/index.js +389 -370
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +7 -3
- package/dist/react.js +322 -312
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/chatlist2.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
4
|
-
function de(
|
|
1
|
+
var ve = Object.defineProperty;
|
|
2
|
+
var Ue = (s, e, t) => e in s ? ve(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var a = (s, e, t) => Ue(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
function de(s, e) {
|
|
5
5
|
var d;
|
|
6
|
-
const t =
|
|
7
|
-
return { wsUrl: `${
|
|
6
|
+
const t = s.trim().replace(/\/+$/, ""), i = (d = t.match(/^(https|http|wss|ws):\/\//)) == null ? void 0 : d[1], n = i ? i === "https" || i === "wss" : !0, r = (i ? t.slice(i.length + 3) : t).replace(/\/ws$/, ""), o = e ? e.trim().replace(/\/+$/, "") : `${n ? "https" : "http"}://${r}`;
|
|
7
|
+
return { wsUrl: `${n ? "wss" : "ws"}://${r}/ws`, httpBase: o };
|
|
8
8
|
}
|
|
9
|
-
function Se(
|
|
10
|
-
return de(
|
|
9
|
+
function Se(s) {
|
|
10
|
+
return de(s).httpBase;
|
|
11
11
|
}
|
|
12
|
-
function be(
|
|
13
|
-
const
|
|
12
|
+
function be(s, e, t, i) {
|
|
13
|
+
const n = `beforeSeq=${t}&limit=${i}`;
|
|
14
14
|
return [
|
|
15
|
-
`${
|
|
16
|
-
`${
|
|
15
|
+
`${s}/conversations/${e}/messages?${n}`,
|
|
16
|
+
`${s}/conversations/${e}/history?${n}`
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
|
-
async function ae(
|
|
19
|
+
async function ae(s, e, t, i, n = 20) {
|
|
20
20
|
let r, o = !1;
|
|
21
|
-
for (const
|
|
21
|
+
for (const l of be(s, e, i, n))
|
|
22
22
|
try {
|
|
23
|
-
const d = await fetch(
|
|
23
|
+
const d = await fetch(l, { headers: { authorization: `Bearer ${t}` } });
|
|
24
24
|
if (o = !0, !d.ok) continue;
|
|
25
|
-
const
|
|
26
|
-
return { messages:
|
|
25
|
+
const v = await d.json();
|
|
26
|
+
return { messages: v.messages ?? [], hasMore: v.hasMore ?? !1 };
|
|
27
27
|
} catch (d) {
|
|
28
28
|
r = d;
|
|
29
29
|
}
|
|
30
|
-
return o ? console.error(`[chat-widget] history request to ${
|
|
31
|
-
`[chat-widget] could not load history from ${
|
|
30
|
+
return o ? console.error(`[chat-widget] history request to ${s} was rejected for conversation ${e}.`) : console.error(
|
|
31
|
+
`[chat-widget] could not load history from ${s} — the request never reached the server. This is almost always CORS: add this site's origin to the chatroom's allowed origins (dashboard → chatroom → allowed origins) or to the server's CORS_ORIGINS.`,
|
|
32
32
|
r
|
|
33
33
|
), null;
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
36
|
-
const o = r ? r.replace(/\/+$/, "") : Se(
|
|
37
|
-
if (!
|
|
35
|
+
async function bt(s, e, t, i, n, r) {
|
|
36
|
+
const o = r ? r.replace(/\/+$/, "") : Se(s), l = await ae(o, t, e, Number.MAX_SAFE_INTEGER);
|
|
37
|
+
if (!l || (l.messages.length ? (i.apply({ type: "sync", conversationId: t, messages: l.messages }), i.apply({ type: "history", conversationId: t, messages: [], hasMore: l.hasMore }), n.render(i)) : i.apply({ type: "history", conversationId: t, messages: [], hasMore: !1 }), !l.hasMore)) return;
|
|
38
38
|
let d = !1;
|
|
39
|
-
const
|
|
39
|
+
const v = async () => {
|
|
40
40
|
if (d || !i.hasMoreHistory) return;
|
|
41
41
|
d = !0;
|
|
42
42
|
const I = i.messages()[0];
|
|
@@ -44,18 +44,18 @@ async function yt(n, e, t, i, s, r) {
|
|
|
44
44
|
d = !1;
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
}, b =
|
|
47
|
+
const U = await ae(o, t, e, I.seq);
|
|
48
|
+
U && (i.apply({ type: "history", conversationId: t, messages: U.messages, hasMore: U.hasMore }), n.render(i)), d = !1;
|
|
49
|
+
}, b = n.getScrollEl();
|
|
50
50
|
if (!b) return;
|
|
51
51
|
let x = !1;
|
|
52
52
|
setTimeout(() => {
|
|
53
53
|
x = !0;
|
|
54
54
|
}, 300);
|
|
55
55
|
const g = () => {
|
|
56
|
-
x && b.scrollTop < 80 && i.hasMoreHistory && !d &&
|
|
56
|
+
x && b.scrollTop < 80 && i.hasMoreHistory && !d && v();
|
|
57
57
|
};
|
|
58
|
-
b.addEventListener("scroll", g, { passive: !0 }),
|
|
58
|
+
b.addEventListener("scroll", g, { passive: !0 }), n.setScrollCleanup(() => b.removeEventListener("scroll", g));
|
|
59
59
|
}
|
|
60
60
|
const Ee = {
|
|
61
61
|
accent: "#6c5ce7",
|
|
@@ -82,16 +82,16 @@ const Ee = {
|
|
|
82
82
|
rowhover: "#39325e",
|
|
83
83
|
shadow: "0 12px 32px rgba(0,0,0,.4)"
|
|
84
84
|
}, Ie = "'Nunito',-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif";
|
|
85
|
-
function fe(
|
|
86
|
-
return Object.entries(e).map(([t, i]) => `--${
|
|
85
|
+
function fe(s, e) {
|
|
86
|
+
return Object.entries(e).map(([t, i]) => `--${s}-${t}:${i};`).join(" ");
|
|
87
87
|
}
|
|
88
|
-
function ke(
|
|
89
|
-
return `${fe(
|
|
88
|
+
function ke(s) {
|
|
89
|
+
return `${fe(s, Ee)} --${s}-fb:${Ie}; --${s}-fh:'Baloo 2',var(--${s}-fb);`;
|
|
90
90
|
}
|
|
91
|
-
function ce(
|
|
92
|
-
return fe(
|
|
91
|
+
function ce(s) {
|
|
92
|
+
return fe(s, Be);
|
|
93
93
|
}
|
|
94
|
-
const
|
|
94
|
+
const Ae = `
|
|
95
95
|
.ocl { ${ke("ocl")}
|
|
96
96
|
display:flex; flex-direction:column; height:100%; background:var(--ocl-bg);
|
|
97
97
|
font-family:var(--ocl-fb); color:var(--ocl-ink); overflow:hidden; }
|
|
@@ -139,53 +139,105 @@ const Te = `
|
|
|
139
139
|
.ocl-compact .ocl-search { font-size:16px; }
|
|
140
140
|
.ocl-compact .ocl-compose { width:36px; height:36px; }
|
|
141
141
|
.ocl-row:focus-visible, .ocl button:focus-visible, .ocl input:focus-visible { outline:2px solid var(--ocl-accent); outline-offset:2px; border-radius:12px; }
|
|
142
|
-
`,
|
|
143
|
-
|
|
142
|
+
`, Te = {
|
|
143
|
+
placeholder: "Message…",
|
|
144
|
+
offline: "We're offline right now",
|
|
145
|
+
online: "Online",
|
|
146
|
+
away: "Away",
|
|
147
|
+
aiAssistant: "AI Assistant",
|
|
148
|
+
resolved: "Marked as resolved",
|
|
149
|
+
reopen: "Reopen conversation",
|
|
150
|
+
sources: "Sources",
|
|
151
|
+
helpful: "Helpful",
|
|
152
|
+
notHelpful: "Not helpful",
|
|
153
|
+
title: "Your conversations",
|
|
154
|
+
newChat: "New conversation",
|
|
155
|
+
startChat: "Start a conversation",
|
|
156
|
+
all: "All conversations",
|
|
157
|
+
empty: "No conversations yet.",
|
|
158
|
+
error: "Could not load conversations.",
|
|
159
|
+
retry: "Retry",
|
|
160
|
+
search: "🔍 Search",
|
|
161
|
+
unread: "Unread",
|
|
162
|
+
close: "Close"
|
|
163
|
+
}, Ce = {
|
|
164
|
+
placeholder: "메시지…",
|
|
165
|
+
offline: "지금은 오프라인입니다",
|
|
166
|
+
online: "온라인",
|
|
167
|
+
away: "자리 비움",
|
|
168
|
+
aiAssistant: "AI 어시스턴트",
|
|
169
|
+
resolved: "해결됨으로 표시됨",
|
|
170
|
+
reopen: "대화 다시 열기",
|
|
171
|
+
sources: "출처",
|
|
172
|
+
helpful: "도움돼요",
|
|
173
|
+
notHelpful: "도움 안돼요",
|
|
174
|
+
title: "내 대화",
|
|
175
|
+
newChat: "새 대화",
|
|
176
|
+
startChat: "대화 시작하기",
|
|
177
|
+
all: "전체 대화",
|
|
178
|
+
empty: "아직 대화가 없습니다.",
|
|
179
|
+
error: "대화를 불러오지 못했습니다.",
|
|
180
|
+
retry: "다시 시도",
|
|
181
|
+
search: "🔍 검색",
|
|
182
|
+
unread: "읽지 않음",
|
|
183
|
+
close: "닫기"
|
|
184
|
+
}, $e = { en: Te, ko: Ce };
|
|
185
|
+
function ze(s) {
|
|
186
|
+
const e = (s ?? (typeof navigator < "u" ? navigator.language : "") ?? "").toLowerCase();
|
|
187
|
+
return e.startsWith("ko") || e.includes("korean") || e.includes("한국") ? "ko" : "en";
|
|
188
|
+
}
|
|
189
|
+
function Le(s, e) {
|
|
190
|
+
const t = $e[ze(s)], i = {};
|
|
191
|
+
for (const [n, r] of Object.entries(e ?? {})) typeof r == "string" && r !== "" && (i[n] = r);
|
|
192
|
+
return { ...t, ...i };
|
|
193
|
+
}
|
|
194
|
+
const R = "oc_uid";
|
|
195
|
+
function Me(s) {
|
|
144
196
|
try {
|
|
145
|
-
const e = document.cookie.match(new RegExp(`(?:^|; )${
|
|
197
|
+
const e = document.cookie.match(new RegExp(`(?:^|; )${s}=([^;]*)`));
|
|
146
198
|
return e ? decodeURIComponent(e[1]) : null;
|
|
147
199
|
} catch {
|
|
148
200
|
return null;
|
|
149
201
|
}
|
|
150
202
|
}
|
|
151
|
-
function
|
|
203
|
+
function De(s, e) {
|
|
152
204
|
try {
|
|
153
205
|
const i = location.protocol === "https:" ? "; Secure" : "";
|
|
154
|
-
document.cookie = `${
|
|
206
|
+
document.cookie = `${s}=${encodeURIComponent(e)}; Max-Age=31536000; Path=/; SameSite=Lax${i}`;
|
|
155
207
|
} catch {
|
|
156
208
|
}
|
|
157
209
|
}
|
|
158
|
-
function
|
|
210
|
+
function Re() {
|
|
159
211
|
return `g_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
160
212
|
}
|
|
161
|
-
function
|
|
162
|
-
let
|
|
213
|
+
function _e() {
|
|
214
|
+
let s = null;
|
|
163
215
|
try {
|
|
164
|
-
|
|
216
|
+
s = localStorage.getItem(R);
|
|
165
217
|
} catch {
|
|
166
218
|
}
|
|
167
|
-
|
|
168
|
-
const e =
|
|
219
|
+
s || (s = Me(R));
|
|
220
|
+
const e = s ?? Re();
|
|
169
221
|
try {
|
|
170
|
-
localStorage.setItem(
|
|
222
|
+
localStorage.setItem(R, e);
|
|
171
223
|
} catch {
|
|
172
224
|
}
|
|
173
|
-
return
|
|
225
|
+
return De(R, e), e;
|
|
174
226
|
}
|
|
175
|
-
function
|
|
176
|
-
const e =
|
|
227
|
+
function Fe(s) {
|
|
228
|
+
const e = s.length;
|
|
177
229
|
let t = 0, i = 0;
|
|
178
230
|
for (; i < e; ) {
|
|
179
|
-
let
|
|
180
|
-
if (
|
|
181
|
-
if (!(
|
|
231
|
+
let n = s.charCodeAt(i++);
|
|
232
|
+
if (n & 4294967168)
|
|
233
|
+
if (!(n & 4294965248))
|
|
182
234
|
t += 2;
|
|
183
235
|
else {
|
|
184
|
-
if (
|
|
185
|
-
const r =
|
|
186
|
-
(r & 64512) === 56320 && (++i,
|
|
236
|
+
if (n >= 55296 && n <= 56319 && i < e) {
|
|
237
|
+
const r = s.charCodeAt(i);
|
|
238
|
+
(r & 64512) === 56320 && (++i, n = ((n & 1023) << 10) + (r & 1023) + 65536);
|
|
187
239
|
}
|
|
188
|
-
|
|
240
|
+
n & 4294901760 ? t += 4 : t += 3;
|
|
189
241
|
}
|
|
190
242
|
else {
|
|
191
243
|
t++;
|
|
@@ -194,69 +246,69 @@ function Le(n) {
|
|
|
194
246
|
}
|
|
195
247
|
return t;
|
|
196
248
|
}
|
|
197
|
-
function
|
|
198
|
-
const i =
|
|
199
|
-
let
|
|
249
|
+
function Pe(s, e, t) {
|
|
250
|
+
const i = s.length;
|
|
251
|
+
let n = t, r = 0;
|
|
200
252
|
for (; r < i; ) {
|
|
201
|
-
let o =
|
|
253
|
+
let o = s.charCodeAt(r++);
|
|
202
254
|
if (o & 4294967168)
|
|
203
255
|
if (!(o & 4294965248))
|
|
204
|
-
e[
|
|
256
|
+
e[n++] = o >> 6 & 31 | 192;
|
|
205
257
|
else {
|
|
206
258
|
if (o >= 55296 && o <= 56319 && r < i) {
|
|
207
|
-
const
|
|
208
|
-
(
|
|
259
|
+
const l = s.charCodeAt(r);
|
|
260
|
+
(l & 64512) === 56320 && (++r, o = ((o & 1023) << 10) + (l & 1023) + 65536);
|
|
209
261
|
}
|
|
210
|
-
o & 4294901760 ? (e[
|
|
262
|
+
o & 4294901760 ? (e[n++] = o >> 18 & 7 | 240, e[n++] = o >> 12 & 63 | 128, e[n++] = o >> 6 & 63 | 128) : (e[n++] = o >> 12 & 15 | 224, e[n++] = o >> 6 & 63 | 128);
|
|
211
263
|
}
|
|
212
264
|
else {
|
|
213
|
-
e[
|
|
265
|
+
e[n++] = o;
|
|
214
266
|
continue;
|
|
215
267
|
}
|
|
216
|
-
e[
|
|
268
|
+
e[n++] = o & 63 | 128;
|
|
217
269
|
}
|
|
218
270
|
}
|
|
219
|
-
const
|
|
220
|
-
function
|
|
221
|
-
|
|
271
|
+
const Ne = new TextEncoder(), He = 50;
|
|
272
|
+
function Ke(s, e, t) {
|
|
273
|
+
Ne.encodeInto(s, e.subarray(t));
|
|
222
274
|
}
|
|
223
|
-
function
|
|
224
|
-
|
|
275
|
+
function We(s, e, t) {
|
|
276
|
+
s.length > He ? Ke(s, e, t) : Pe(s, e, t);
|
|
225
277
|
}
|
|
226
|
-
const
|
|
227
|
-
function ue(
|
|
278
|
+
const Oe = 4096;
|
|
279
|
+
function ue(s, e, t) {
|
|
228
280
|
let i = e;
|
|
229
|
-
const
|
|
281
|
+
const n = i + t, r = [];
|
|
230
282
|
let o = "";
|
|
231
|
-
for (; i <
|
|
232
|
-
const
|
|
233
|
-
if (!(
|
|
234
|
-
r.push(
|
|
235
|
-
else if ((
|
|
236
|
-
const d =
|
|
237
|
-
r.push((
|
|
238
|
-
} else if ((
|
|
239
|
-
const d =
|
|
240
|
-
r.push((
|
|
241
|
-
} else if ((
|
|
242
|
-
const d =
|
|
243
|
-
let x = (
|
|
283
|
+
for (; i < n; ) {
|
|
284
|
+
const l = s[i++];
|
|
285
|
+
if (!(l & 128))
|
|
286
|
+
r.push(l);
|
|
287
|
+
else if ((l & 224) === 192) {
|
|
288
|
+
const d = s[i++] & 63;
|
|
289
|
+
r.push((l & 31) << 6 | d);
|
|
290
|
+
} else if ((l & 240) === 224) {
|
|
291
|
+
const d = s[i++] & 63, v = s[i++] & 63;
|
|
292
|
+
r.push((l & 31) << 12 | d << 6 | v);
|
|
293
|
+
} else if ((l & 248) === 240) {
|
|
294
|
+
const d = s[i++] & 63, v = s[i++] & 63, b = s[i++] & 63;
|
|
295
|
+
let x = (l & 7) << 18 | d << 12 | v << 6 | b;
|
|
244
296
|
x > 65535 && (x -= 65536, r.push(x >>> 10 & 1023 | 55296), x = 56320 | x & 1023), r.push(x);
|
|
245
297
|
} else
|
|
246
|
-
r.push(
|
|
247
|
-
r.length >=
|
|
298
|
+
r.push(l);
|
|
299
|
+
r.length >= Oe && (o += String.fromCharCode(...r), r.length = 0);
|
|
248
300
|
}
|
|
249
301
|
return r.length > 0 && (o += String.fromCharCode(...r)), o;
|
|
250
302
|
}
|
|
251
|
-
const
|
|
252
|
-
function
|
|
253
|
-
const i =
|
|
254
|
-
return
|
|
303
|
+
const Ve = new TextDecoder(), Ye = 200;
|
|
304
|
+
function qe(s, e, t) {
|
|
305
|
+
const i = s.subarray(e, e + t);
|
|
306
|
+
return Ve.decode(i);
|
|
255
307
|
}
|
|
256
|
-
function
|
|
257
|
-
return t >
|
|
308
|
+
function Xe(s, e, t) {
|
|
309
|
+
return t > Ye ? qe(s, e, t) : ue(s, e, t);
|
|
258
310
|
}
|
|
259
|
-
class
|
|
311
|
+
class _ {
|
|
260
312
|
constructor(e, t) {
|
|
261
313
|
a(this, "type");
|
|
262
314
|
a(this, "data");
|
|
@@ -274,77 +326,77 @@ class y extends Error {
|
|
|
274
326
|
});
|
|
275
327
|
}
|
|
276
328
|
}
|
|
277
|
-
const
|
|
278
|
-
function
|
|
279
|
-
const i = t / 4294967296,
|
|
280
|
-
|
|
329
|
+
const $ = 4294967295;
|
|
330
|
+
function Ge(s, e, t) {
|
|
331
|
+
const i = t / 4294967296, n = t;
|
|
332
|
+
s.setUint32(e, i), s.setUint32(e + 4, n);
|
|
281
333
|
}
|
|
282
|
-
function xe(
|
|
283
|
-
const i = Math.floor(t / 4294967296),
|
|
284
|
-
|
|
334
|
+
function xe(s, e, t) {
|
|
335
|
+
const i = Math.floor(t / 4294967296), n = t;
|
|
336
|
+
s.setUint32(e, i), s.setUint32(e + 4, n);
|
|
285
337
|
}
|
|
286
|
-
function pe(
|
|
287
|
-
const t =
|
|
338
|
+
function pe(s, e) {
|
|
339
|
+
const t = s.getInt32(e), i = s.getUint32(e + 4);
|
|
288
340
|
return t * 4294967296 + i;
|
|
289
341
|
}
|
|
290
|
-
function
|
|
291
|
-
const t =
|
|
342
|
+
function Je(s, e) {
|
|
343
|
+
const t = s.getUint32(e), i = s.getUint32(e + 4);
|
|
292
344
|
return t * 4294967296 + i;
|
|
293
345
|
}
|
|
294
|
-
const
|
|
295
|
-
function
|
|
296
|
-
if (
|
|
297
|
-
if (e === 0 &&
|
|
346
|
+
const Ze = -1, Qe = 4294967296 - 1, je = 17179869184 - 1;
|
|
347
|
+
function et({ sec: s, nsec: e }) {
|
|
348
|
+
if (s >= 0 && e >= 0 && s <= je)
|
|
349
|
+
if (e === 0 && s <= Qe) {
|
|
298
350
|
const t = new Uint8Array(4);
|
|
299
|
-
return new DataView(t.buffer).setUint32(0,
|
|
351
|
+
return new DataView(t.buffer).setUint32(0, s), t;
|
|
300
352
|
} else {
|
|
301
|
-
const t =
|
|
302
|
-
return r.setUint32(0, e << 2 | t & 3), r.setUint32(4, i),
|
|
353
|
+
const t = s / 4294967296, i = s & 4294967295, n = new Uint8Array(8), r = new DataView(n.buffer);
|
|
354
|
+
return r.setUint32(0, e << 2 | t & 3), r.setUint32(4, i), n;
|
|
303
355
|
}
|
|
304
356
|
else {
|
|
305
357
|
const t = new Uint8Array(12), i = new DataView(t.buffer);
|
|
306
|
-
return i.setUint32(0, e), xe(i, 4,
|
|
358
|
+
return i.setUint32(0, e), xe(i, 4, s), t;
|
|
307
359
|
}
|
|
308
360
|
}
|
|
309
|
-
function
|
|
310
|
-
const e =
|
|
361
|
+
function tt(s) {
|
|
362
|
+
const e = s.getTime(), t = Math.floor(e / 1e3), i = (e - t * 1e3) * 1e6, n = Math.floor(i / 1e9);
|
|
311
363
|
return {
|
|
312
|
-
sec: t +
|
|
313
|
-
nsec: i -
|
|
364
|
+
sec: t + n,
|
|
365
|
+
nsec: i - n * 1e9
|
|
314
366
|
};
|
|
315
367
|
}
|
|
316
|
-
function
|
|
317
|
-
if (
|
|
318
|
-
const e =
|
|
319
|
-
return
|
|
368
|
+
function st(s) {
|
|
369
|
+
if (s instanceof Date) {
|
|
370
|
+
const e = tt(s);
|
|
371
|
+
return et(e);
|
|
320
372
|
} else
|
|
321
373
|
return null;
|
|
322
374
|
}
|
|
323
|
-
function
|
|
324
|
-
const e = new DataView(
|
|
325
|
-
switch (
|
|
375
|
+
function it(s) {
|
|
376
|
+
const e = new DataView(s.buffer, s.byteOffset, s.byteLength);
|
|
377
|
+
switch (s.byteLength) {
|
|
326
378
|
case 4:
|
|
327
379
|
return { sec: e.getUint32(0), nsec: 0 };
|
|
328
380
|
case 8: {
|
|
329
|
-
const t = e.getUint32(0), i = e.getUint32(4),
|
|
330
|
-
return { sec:
|
|
381
|
+
const t = e.getUint32(0), i = e.getUint32(4), n = (t & 3) * 4294967296 + i, r = t >>> 2;
|
|
382
|
+
return { sec: n, nsec: r };
|
|
331
383
|
}
|
|
332
384
|
case 12: {
|
|
333
385
|
const t = pe(e, 4), i = e.getUint32(0);
|
|
334
386
|
return { sec: t, nsec: i };
|
|
335
387
|
}
|
|
336
388
|
default:
|
|
337
|
-
throw new y(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${
|
|
389
|
+
throw new y(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${s.length}`);
|
|
338
390
|
}
|
|
339
391
|
}
|
|
340
|
-
function
|
|
341
|
-
const e =
|
|
392
|
+
function nt(s) {
|
|
393
|
+
const e = it(s);
|
|
342
394
|
return new Date(e.sec * 1e3 + e.nsec / 1e6);
|
|
343
395
|
}
|
|
344
|
-
const
|
|
345
|
-
type:
|
|
346
|
-
encode:
|
|
347
|
-
decode:
|
|
396
|
+
const rt = {
|
|
397
|
+
type: Ze,
|
|
398
|
+
encode: st,
|
|
399
|
+
decode: nt
|
|
348
400
|
}, P = class P {
|
|
349
401
|
constructor() {
|
|
350
402
|
// ensures ExtensionCodecType<X> matches ExtensionCodec<X>
|
|
@@ -357,53 +409,53 @@ const et = {
|
|
|
357
409
|
// custom extensions
|
|
358
410
|
a(this, "encoders", []);
|
|
359
411
|
a(this, "decoders", []);
|
|
360
|
-
this.register(
|
|
412
|
+
this.register(rt);
|
|
361
413
|
}
|
|
362
414
|
register({ type: e, encode: t, decode: i }) {
|
|
363
415
|
if (e >= 0)
|
|
364
416
|
this.encoders[e] = t, this.decoders[e] = i;
|
|
365
417
|
else {
|
|
366
|
-
const
|
|
367
|
-
this.builtInEncoders[
|
|
418
|
+
const n = -1 - e;
|
|
419
|
+
this.builtInEncoders[n] = t, this.builtInDecoders[n] = i;
|
|
368
420
|
}
|
|
369
421
|
}
|
|
370
422
|
tryToEncode(e, t) {
|
|
371
423
|
for (let i = 0; i < this.builtInEncoders.length; i++) {
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
const r =
|
|
424
|
+
const n = this.builtInEncoders[i];
|
|
425
|
+
if (n != null) {
|
|
426
|
+
const r = n(e, t);
|
|
375
427
|
if (r != null) {
|
|
376
428
|
const o = -1 - i;
|
|
377
|
-
return new
|
|
429
|
+
return new _(o, r);
|
|
378
430
|
}
|
|
379
431
|
}
|
|
380
432
|
}
|
|
381
433
|
for (let i = 0; i < this.encoders.length; i++) {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
const r =
|
|
434
|
+
const n = this.encoders[i];
|
|
435
|
+
if (n != null) {
|
|
436
|
+
const r = n(e, t);
|
|
385
437
|
if (r != null) {
|
|
386
438
|
const o = i;
|
|
387
|
-
return new
|
|
439
|
+
return new _(o, r);
|
|
388
440
|
}
|
|
389
441
|
}
|
|
390
442
|
}
|
|
391
|
-
return e instanceof
|
|
443
|
+
return e instanceof _ ? e : null;
|
|
392
444
|
}
|
|
393
445
|
decode(e, t, i) {
|
|
394
|
-
const
|
|
395
|
-
return
|
|
446
|
+
const n = t < 0 ? this.builtInDecoders[-1 - t] : this.decoders[t];
|
|
447
|
+
return n ? n(e, t, i) : new _(t, e);
|
|
396
448
|
}
|
|
397
449
|
};
|
|
398
450
|
a(P, "defaultCodec", new P());
|
|
399
451
|
let F = P;
|
|
400
|
-
function
|
|
401
|
-
return
|
|
452
|
+
function ot(s) {
|
|
453
|
+
return s instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && s instanceof SharedArrayBuffer;
|
|
402
454
|
}
|
|
403
|
-
function W(
|
|
404
|
-
return
|
|
455
|
+
function W(s) {
|
|
456
|
+
return s instanceof Uint8Array ? s : ArrayBuffer.isView(s) ? new Uint8Array(s.buffer, s.byteOffset, s.byteLength) : ot(s) ? new Uint8Array(s) : Uint8Array.from(s);
|
|
405
457
|
}
|
|
406
|
-
const
|
|
458
|
+
const at = 100, ct = 2048;
|
|
407
459
|
class V {
|
|
408
460
|
constructor(e) {
|
|
409
461
|
a(this, "extensionCodec");
|
|
@@ -419,7 +471,7 @@ class V {
|
|
|
419
471
|
a(this, "view");
|
|
420
472
|
a(this, "bytes");
|
|
421
473
|
a(this, "entered", !1);
|
|
422
|
-
this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? F.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ??
|
|
474
|
+
this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? F.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.maxDepth = (e == null ? void 0 : e.maxDepth) ?? at, this.initialBufferSize = (e == null ? void 0 : e.initialBufferSize) ?? ct, this.sortKeys = (e == null ? void 0 : e.sortKeys) ?? !1, this.forceFloat32 = (e == null ? void 0 : e.forceFloat32) ?? !1, this.ignoreUndefined = (e == null ? void 0 : e.ignoreUndefined) ?? !1, this.forceIntegerToFloat = (e == null ? void 0 : e.forceIntegerToFloat) ?? !1, this.pos = 0, this.view = new DataView(new ArrayBuffer(this.initialBufferSize)), this.bytes = new Uint8Array(this.view.buffer);
|
|
423
475
|
}
|
|
424
476
|
clone() {
|
|
425
477
|
return new V({
|
|
@@ -473,8 +525,8 @@ class V {
|
|
|
473
525
|
this.view.byteLength < t && this.resizeBuffer(t * 2);
|
|
474
526
|
}
|
|
475
527
|
resizeBuffer(e) {
|
|
476
|
-
const t = new ArrayBuffer(e), i = new Uint8Array(t),
|
|
477
|
-
i.set(this.bytes), this.view =
|
|
528
|
+
const t = new ArrayBuffer(e), i = new Uint8Array(t), n = new DataView(t);
|
|
529
|
+
i.set(this.bytes), this.view = n, this.bytes = i;
|
|
478
530
|
}
|
|
479
531
|
encodeNil() {
|
|
480
532
|
this.writeU8(192);
|
|
@@ -504,8 +556,8 @@ class V {
|
|
|
504
556
|
throw new Error(`Too long string: ${e} bytes in UTF-8`);
|
|
505
557
|
}
|
|
506
558
|
encodeString(e) {
|
|
507
|
-
const i =
|
|
508
|
-
this.ensureBufferSizeToWrite(5 + i), this.writeStringHeader(i),
|
|
559
|
+
const i = Fe(e);
|
|
560
|
+
this.ensureBufferSizeToWrite(5 + i), this.writeStringHeader(i), We(e, this.bytes, this.pos), this.pos += i;
|
|
509
561
|
}
|
|
510
562
|
encodeObject(e, t) {
|
|
511
563
|
const i = this.extensionCodec.tryToEncode(e, this.context);
|
|
@@ -543,27 +595,27 @@ class V {
|
|
|
543
595
|
this.writeU8(221), this.writeU32(i);
|
|
544
596
|
else
|
|
545
597
|
throw new Error(`Too large array: ${i}`);
|
|
546
|
-
for (const
|
|
547
|
-
this.doEncode(
|
|
598
|
+
for (const n of e)
|
|
599
|
+
this.doEncode(n, t + 1);
|
|
548
600
|
}
|
|
549
601
|
countWithoutUndefined(e, t) {
|
|
550
602
|
let i = 0;
|
|
551
|
-
for (const
|
|
552
|
-
e[
|
|
603
|
+
for (const n of t)
|
|
604
|
+
e[n] !== void 0 && i++;
|
|
553
605
|
return i;
|
|
554
606
|
}
|
|
555
607
|
encodeMap(e, t) {
|
|
556
608
|
const i = Object.keys(e);
|
|
557
609
|
this.sortKeys && i.sort();
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
this.writeU8(128 +
|
|
561
|
-
else if (
|
|
562
|
-
this.writeU8(222), this.writeU16(
|
|
563
|
-
else if (
|
|
564
|
-
this.writeU8(223), this.writeU32(
|
|
610
|
+
const n = this.ignoreUndefined ? this.countWithoutUndefined(e, i) : i.length;
|
|
611
|
+
if (n < 16)
|
|
612
|
+
this.writeU8(128 + n);
|
|
613
|
+
else if (n < 65536)
|
|
614
|
+
this.writeU8(222), this.writeU16(n);
|
|
615
|
+
else if (n < 4294967296)
|
|
616
|
+
this.writeU8(223), this.writeU32(n);
|
|
565
617
|
else
|
|
566
|
-
throw new Error(`Too large map object: ${
|
|
618
|
+
throw new Error(`Too large map object: ${n}`);
|
|
567
619
|
for (const r of i) {
|
|
568
620
|
const o = e[r];
|
|
569
621
|
this.ignoreUndefined && o === void 0 || (this.encodeString(r), this.doEncode(o, t + 1));
|
|
@@ -571,10 +623,10 @@ class V {
|
|
|
571
623
|
}
|
|
572
624
|
encodeExtension(e) {
|
|
573
625
|
if (typeof e.data == "function") {
|
|
574
|
-
const i = e.data(this.pos + 6),
|
|
575
|
-
if (
|
|
576
|
-
throw new Error(`Too large extension object: ${
|
|
577
|
-
this.writeU8(201), this.writeU32(
|
|
626
|
+
const i = e.data(this.pos + 6), n = i.length;
|
|
627
|
+
if (n >= 4294967296)
|
|
628
|
+
throw new Error(`Too large extension object: ${n}`);
|
|
629
|
+
this.writeU8(201), this.writeU32(n), this.writeI8(e.type), this.writeU8a(i);
|
|
578
630
|
return;
|
|
579
631
|
}
|
|
580
632
|
const t = e.data.length;
|
|
@@ -627,7 +679,7 @@ class V {
|
|
|
627
679
|
this.ensureBufferSizeToWrite(8), this.view.setFloat64(this.pos, e), this.pos += 8;
|
|
628
680
|
}
|
|
629
681
|
writeU64(e) {
|
|
630
|
-
this.ensureBufferSizeToWrite(8),
|
|
682
|
+
this.ensureBufferSizeToWrite(8), Ge(this.view, this.pos, e), this.pos += 8;
|
|
631
683
|
}
|
|
632
684
|
writeI64(e) {
|
|
633
685
|
this.ensureBufferSizeToWrite(8), xe(this.view, this.pos, e), this.pos += 8;
|
|
@@ -639,15 +691,15 @@ class V {
|
|
|
639
691
|
this.ensureBufferSizeToWrite(8), this.view.setBigInt64(this.pos, e), this.pos += 8;
|
|
640
692
|
}
|
|
641
693
|
}
|
|
642
|
-
function
|
|
643
|
-
return new V(e).encodeSharedRef(
|
|
694
|
+
function lt(s, e) {
|
|
695
|
+
return new V(e).encodeSharedRef(s);
|
|
644
696
|
}
|
|
645
|
-
function K(
|
|
646
|
-
return `${
|
|
697
|
+
function K(s) {
|
|
698
|
+
return `${s < 0 ? "-" : ""}0x${Math.abs(s).toString(16).padStart(2, "0")}`;
|
|
647
699
|
}
|
|
648
|
-
const
|
|
649
|
-
class
|
|
650
|
-
constructor(e =
|
|
700
|
+
const ht = 16, dt = 16;
|
|
701
|
+
class ft {
|
|
702
|
+
constructor(e = ht, t = dt) {
|
|
651
703
|
a(this, "hit", 0);
|
|
652
704
|
a(this, "miss", 0);
|
|
653
705
|
a(this, "caches");
|
|
@@ -661,35 +713,35 @@ class at {
|
|
|
661
713
|
return e > 0 && e <= this.maxKeyLength;
|
|
662
714
|
}
|
|
663
715
|
find(e, t, i) {
|
|
664
|
-
const
|
|
665
|
-
e: for (const r of
|
|
716
|
+
const n = this.caches[i - 1];
|
|
717
|
+
e: for (const r of n) {
|
|
666
718
|
const o = r.bytes;
|
|
667
|
-
for (let
|
|
668
|
-
if (o[
|
|
719
|
+
for (let l = 0; l < i; l++)
|
|
720
|
+
if (o[l] !== e[t + l])
|
|
669
721
|
continue e;
|
|
670
722
|
return r.str;
|
|
671
723
|
}
|
|
672
724
|
return null;
|
|
673
725
|
}
|
|
674
726
|
store(e, t) {
|
|
675
|
-
const i = this.caches[e.length - 1],
|
|
676
|
-
i.length >= this.maxLengthPerKey ? i[Math.random() * i.length | 0] =
|
|
727
|
+
const i = this.caches[e.length - 1], n = { bytes: e, str: t };
|
|
728
|
+
i.length >= this.maxLengthPerKey ? i[Math.random() * i.length | 0] = n : i.push(n);
|
|
677
729
|
}
|
|
678
730
|
decode(e, t, i) {
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
return this.hit++,
|
|
731
|
+
const n = this.find(e, t, i);
|
|
732
|
+
if (n != null)
|
|
733
|
+
return this.hit++, n;
|
|
682
734
|
this.miss++;
|
|
683
735
|
const r = ue(e, t, i), o = Uint8Array.prototype.slice.call(e, t, t + i);
|
|
684
736
|
return this.store(o, r), r;
|
|
685
737
|
}
|
|
686
738
|
}
|
|
687
|
-
const O = "array", L = "map_key", ge = "map_value",
|
|
688
|
-
if (typeof
|
|
689
|
-
return
|
|
690
|
-
throw new y("The type of key must be string or number but " + typeof
|
|
739
|
+
const O = "array", L = "map_key", ge = "map_value", ut = (s) => {
|
|
740
|
+
if (typeof s == "string" || typeof s == "number")
|
|
741
|
+
return s;
|
|
742
|
+
throw new y("The type of key must be string or number but " + typeof s);
|
|
691
743
|
};
|
|
692
|
-
class
|
|
744
|
+
class xt {
|
|
693
745
|
constructor() {
|
|
694
746
|
a(this, "stack", []);
|
|
695
747
|
a(this, "stackHeadPosition", -1);
|
|
@@ -740,14 +792,14 @@ class ht {
|
|
|
740
792
|
this.stack.length = 0, this.stackHeadPosition = -1;
|
|
741
793
|
}
|
|
742
794
|
}
|
|
743
|
-
const
|
|
795
|
+
const z = -1, Y = new DataView(new ArrayBuffer(0)), pt = new Uint8Array(Y.buffer);
|
|
744
796
|
try {
|
|
745
797
|
Y.getInt8(0);
|
|
746
|
-
} catch (
|
|
747
|
-
if (!(
|
|
798
|
+
} catch (s) {
|
|
799
|
+
if (!(s instanceof RangeError))
|
|
748
800
|
throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access");
|
|
749
801
|
}
|
|
750
|
-
const
|
|
802
|
+
const le = new RangeError("Insufficient data"), gt = new ft();
|
|
751
803
|
class q {
|
|
752
804
|
constructor(e) {
|
|
753
805
|
a(this, "extensionCodec");
|
|
@@ -764,11 +816,11 @@ class q {
|
|
|
764
816
|
a(this, "totalPos", 0);
|
|
765
817
|
a(this, "pos", 0);
|
|
766
818
|
a(this, "view", Y);
|
|
767
|
-
a(this, "bytes",
|
|
768
|
-
a(this, "headByte",
|
|
769
|
-
a(this, "stack", new
|
|
819
|
+
a(this, "bytes", pt);
|
|
820
|
+
a(this, "headByte", z);
|
|
821
|
+
a(this, "stack", new xt());
|
|
770
822
|
a(this, "entered", !1);
|
|
771
|
-
this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? F.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ??
|
|
823
|
+
this.extensionCodec = (e == null ? void 0 : e.extensionCodec) ?? F.defaultCodec, this.context = e == null ? void 0 : e.context, this.useBigInt64 = (e == null ? void 0 : e.useBigInt64) ?? !1, this.rawStrings = (e == null ? void 0 : e.rawStrings) ?? !1, this.maxStrLength = (e == null ? void 0 : e.maxStrLength) ?? $, this.maxBinLength = (e == null ? void 0 : e.maxBinLength) ?? $, this.maxArrayLength = (e == null ? void 0 : e.maxArrayLength) ?? $, this.maxMapLength = (e == null ? void 0 : e.maxMapLength) ?? $, this.maxExtLength = (e == null ? void 0 : e.maxExtLength) ?? $, this.keyDecoder = (e == null ? void 0 : e.keyDecoder) !== void 0 ? e.keyDecoder : gt, this.mapKeyConverter = (e == null ? void 0 : e.mapKeyConverter) ?? ut;
|
|
772
824
|
}
|
|
773
825
|
clone() {
|
|
774
826
|
return new q({
|
|
@@ -785,18 +837,18 @@ class q {
|
|
|
785
837
|
});
|
|
786
838
|
}
|
|
787
839
|
reinitializeState() {
|
|
788
|
-
this.totalPos = 0, this.headByte =
|
|
840
|
+
this.totalPos = 0, this.headByte = z, this.stack.reset();
|
|
789
841
|
}
|
|
790
842
|
setBuffer(e) {
|
|
791
843
|
const t = W(e);
|
|
792
844
|
this.bytes = t, this.view = new DataView(t.buffer, t.byteOffset, t.byteLength), this.pos = 0;
|
|
793
845
|
}
|
|
794
846
|
appendBuffer(e) {
|
|
795
|
-
if (this.headByte ===
|
|
847
|
+
if (this.headByte === z && !this.hasRemaining(1))
|
|
796
848
|
this.setBuffer(e);
|
|
797
849
|
else {
|
|
798
|
-
const t = this.bytes.subarray(this.pos), i = W(e),
|
|
799
|
-
|
|
850
|
+
const t = this.bytes.subarray(this.pos), i = W(e), n = new Uint8Array(t.length + i.length);
|
|
851
|
+
n.set(t), n.set(i, t.length), this.setBuffer(n);
|
|
800
852
|
}
|
|
801
853
|
}
|
|
802
854
|
hasRemaining(e) {
|
|
@@ -841,10 +893,10 @@ class q {
|
|
|
841
893
|
try {
|
|
842
894
|
this.entered = !0;
|
|
843
895
|
let t = !1, i;
|
|
844
|
-
for await (const
|
|
896
|
+
for await (const l of e) {
|
|
845
897
|
if (t)
|
|
846
898
|
throw this.entered = !1, this.createExtraByteError(this.totalPos);
|
|
847
|
-
this.appendBuffer(
|
|
899
|
+
this.appendBuffer(l);
|
|
848
900
|
try {
|
|
849
901
|
i = this.doDecodeSync(), t = !0;
|
|
850
902
|
} catch (d) {
|
|
@@ -858,8 +910,8 @@ class q {
|
|
|
858
910
|
throw this.createExtraByteError(this.totalPos);
|
|
859
911
|
return i;
|
|
860
912
|
}
|
|
861
|
-
const { headByte:
|
|
862
|
-
throw new RangeError(`Insufficient data in parsing ${K(
|
|
913
|
+
const { headByte: n, pos: r, totalPos: o } = this;
|
|
914
|
+
throw new RangeError(`Insufficient data in parsing ${K(n)} at ${o} (${r} in the current buffer)`);
|
|
863
915
|
} finally {
|
|
864
916
|
this.entered = !1;
|
|
865
917
|
}
|
|
@@ -877,13 +929,13 @@ class q {
|
|
|
877
929
|
}
|
|
878
930
|
try {
|
|
879
931
|
this.entered = !0;
|
|
880
|
-
let i = t,
|
|
932
|
+
let i = t, n = -1;
|
|
881
933
|
for await (const r of e) {
|
|
882
|
-
if (t &&
|
|
934
|
+
if (t && n === 0)
|
|
883
935
|
throw this.createExtraByteError(this.totalPos);
|
|
884
|
-
this.appendBuffer(r), i && (
|
|
936
|
+
this.appendBuffer(r), i && (n = this.readArraySize(), i = !1, this.complete());
|
|
885
937
|
try {
|
|
886
|
-
for (; yield this.doDecodeSync(), --
|
|
938
|
+
for (; yield this.doDecodeSync(), --n !== 0; )
|
|
887
939
|
;
|
|
888
940
|
} catch (o) {
|
|
889
941
|
if (!(o instanceof RangeError))
|
|
@@ -905,22 +957,22 @@ class q {
|
|
|
905
957
|
if (e < 128)
|
|
906
958
|
t = e;
|
|
907
959
|
else if (e < 144) {
|
|
908
|
-
const
|
|
909
|
-
if (
|
|
910
|
-
this.pushMapState(
|
|
960
|
+
const n = e - 128;
|
|
961
|
+
if (n !== 0) {
|
|
962
|
+
this.pushMapState(n), this.complete();
|
|
911
963
|
continue e;
|
|
912
964
|
} else
|
|
913
965
|
t = {};
|
|
914
966
|
} else if (e < 160) {
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
this.pushArrayState(
|
|
967
|
+
const n = e - 144;
|
|
968
|
+
if (n !== 0) {
|
|
969
|
+
this.pushArrayState(n), this.complete();
|
|
918
970
|
continue e;
|
|
919
971
|
} else
|
|
920
972
|
t = [];
|
|
921
973
|
} else {
|
|
922
|
-
const
|
|
923
|
-
t = this.decodeString(
|
|
974
|
+
const n = e - 160;
|
|
975
|
+
t = this.decodeString(n, 0);
|
|
924
976
|
}
|
|
925
977
|
else if (e === 192)
|
|
926
978
|
t = null;
|
|
@@ -949,51 +1001,51 @@ class q {
|
|
|
949
1001
|
else if (e === 211)
|
|
950
1002
|
this.useBigInt64 ? t = this.readI64AsBigInt() : t = this.readI64();
|
|
951
1003
|
else if (e === 217) {
|
|
952
|
-
const
|
|
953
|
-
t = this.decodeString(
|
|
1004
|
+
const n = this.lookU8();
|
|
1005
|
+
t = this.decodeString(n, 1);
|
|
954
1006
|
} else if (e === 218) {
|
|
955
|
-
const
|
|
956
|
-
t = this.decodeString(
|
|
1007
|
+
const n = this.lookU16();
|
|
1008
|
+
t = this.decodeString(n, 2);
|
|
957
1009
|
} else if (e === 219) {
|
|
958
|
-
const
|
|
959
|
-
t = this.decodeString(
|
|
1010
|
+
const n = this.lookU32();
|
|
1011
|
+
t = this.decodeString(n, 4);
|
|
960
1012
|
} else if (e === 220) {
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
this.pushArrayState(
|
|
1013
|
+
const n = this.readU16();
|
|
1014
|
+
if (n !== 0) {
|
|
1015
|
+
this.pushArrayState(n), this.complete();
|
|
964
1016
|
continue e;
|
|
965
1017
|
} else
|
|
966
1018
|
t = [];
|
|
967
1019
|
} else if (e === 221) {
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
970
|
-
this.pushArrayState(
|
|
1020
|
+
const n = this.readU32();
|
|
1021
|
+
if (n !== 0) {
|
|
1022
|
+
this.pushArrayState(n), this.complete();
|
|
971
1023
|
continue e;
|
|
972
1024
|
} else
|
|
973
1025
|
t = [];
|
|
974
1026
|
} else if (e === 222) {
|
|
975
|
-
const
|
|
976
|
-
if (
|
|
977
|
-
this.pushMapState(
|
|
1027
|
+
const n = this.readU16();
|
|
1028
|
+
if (n !== 0) {
|
|
1029
|
+
this.pushMapState(n), this.complete();
|
|
978
1030
|
continue e;
|
|
979
1031
|
} else
|
|
980
1032
|
t = {};
|
|
981
1033
|
} else if (e === 223) {
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
984
|
-
this.pushMapState(
|
|
1034
|
+
const n = this.readU32();
|
|
1035
|
+
if (n !== 0) {
|
|
1036
|
+
this.pushMapState(n), this.complete();
|
|
985
1037
|
continue e;
|
|
986
1038
|
} else
|
|
987
1039
|
t = {};
|
|
988
1040
|
} else if (e === 196) {
|
|
989
|
-
const
|
|
990
|
-
t = this.decodeBinary(
|
|
1041
|
+
const n = this.lookU8();
|
|
1042
|
+
t = this.decodeBinary(n, 1);
|
|
991
1043
|
} else if (e === 197) {
|
|
992
|
-
const
|
|
993
|
-
t = this.decodeBinary(
|
|
1044
|
+
const n = this.lookU16();
|
|
1045
|
+
t = this.decodeBinary(n, 2);
|
|
994
1046
|
} else if (e === 198) {
|
|
995
|
-
const
|
|
996
|
-
t = this.decodeBinary(
|
|
1047
|
+
const n = this.lookU32();
|
|
1048
|
+
t = this.decodeBinary(n, 4);
|
|
997
1049
|
} else if (e === 212)
|
|
998
1050
|
t = this.decodeExtension(1, 0);
|
|
999
1051
|
else if (e === 213)
|
|
@@ -1005,34 +1057,34 @@ class q {
|
|
|
1005
1057
|
else if (e === 216)
|
|
1006
1058
|
t = this.decodeExtension(16, 0);
|
|
1007
1059
|
else if (e === 199) {
|
|
1008
|
-
const
|
|
1009
|
-
t = this.decodeExtension(
|
|
1060
|
+
const n = this.lookU8();
|
|
1061
|
+
t = this.decodeExtension(n, 1);
|
|
1010
1062
|
} else if (e === 200) {
|
|
1011
|
-
const
|
|
1012
|
-
t = this.decodeExtension(
|
|
1063
|
+
const n = this.lookU16();
|
|
1064
|
+
t = this.decodeExtension(n, 2);
|
|
1013
1065
|
} else if (e === 201) {
|
|
1014
|
-
const
|
|
1015
|
-
t = this.decodeExtension(
|
|
1066
|
+
const n = this.lookU32();
|
|
1067
|
+
t = this.decodeExtension(n, 4);
|
|
1016
1068
|
} else
|
|
1017
1069
|
throw new y(`Unrecognized type byte: ${K(e)}`);
|
|
1018
1070
|
this.complete();
|
|
1019
1071
|
const i = this.stack;
|
|
1020
1072
|
for (; i.length > 0; ) {
|
|
1021
|
-
const
|
|
1022
|
-
if (
|
|
1023
|
-
if (
|
|
1024
|
-
t =
|
|
1073
|
+
const n = i.top();
|
|
1074
|
+
if (n.type === O)
|
|
1075
|
+
if (n.array[n.position] = t, n.position++, n.position === n.size)
|
|
1076
|
+
t = n.array, i.release(n);
|
|
1025
1077
|
else
|
|
1026
1078
|
continue e;
|
|
1027
|
-
else if (
|
|
1079
|
+
else if (n.type === L) {
|
|
1028
1080
|
if (t === "__proto__")
|
|
1029
1081
|
throw new y("The key __proto__ is not allowed");
|
|
1030
|
-
|
|
1082
|
+
n.key = this.mapKeyConverter(t), n.type = ge;
|
|
1031
1083
|
continue e;
|
|
1032
|
-
} else if (
|
|
1033
|
-
t =
|
|
1084
|
+
} else if (n.map[n.key] = t, n.readCount++, n.readCount === n.size)
|
|
1085
|
+
t = n.map, i.release(n);
|
|
1034
1086
|
else {
|
|
1035
|
-
|
|
1087
|
+
n.key = null, n.type = L;
|
|
1036
1088
|
continue e;
|
|
1037
1089
|
}
|
|
1038
1090
|
}
|
|
@@ -1040,10 +1092,10 @@ class q {
|
|
|
1040
1092
|
}
|
|
1041
1093
|
}
|
|
1042
1094
|
readHeadByte() {
|
|
1043
|
-
return this.headByte ===
|
|
1095
|
+
return this.headByte === z && (this.headByte = this.readU8()), this.headByte;
|
|
1044
1096
|
}
|
|
1045
1097
|
complete() {
|
|
1046
|
-
this.headByte =
|
|
1098
|
+
this.headByte = z;
|
|
1047
1099
|
}
|
|
1048
1100
|
readArraySize() {
|
|
1049
1101
|
const e = this.readHeadByte();
|
|
@@ -1080,10 +1132,10 @@ class q {
|
|
|
1080
1132
|
if (e > this.maxStrLength)
|
|
1081
1133
|
throw new y(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);
|
|
1082
1134
|
if (this.bytes.byteLength < this.pos + t + e)
|
|
1083
|
-
throw
|
|
1135
|
+
throw le;
|
|
1084
1136
|
const i = this.pos + t;
|
|
1085
|
-
let
|
|
1086
|
-
return this.stateIsMapKey() && ((r = this.keyDecoder) != null && r.canBeCached(e)) ?
|
|
1137
|
+
let n;
|
|
1138
|
+
return this.stateIsMapKey() && ((r = this.keyDecoder) != null && r.canBeCached(e)) ? n = this.keyDecoder.decode(this.bytes, i, e) : n = Xe(this.bytes, i, e), this.pos += t + e, n;
|
|
1087
1139
|
}
|
|
1088
1140
|
stateIsMapKey() {
|
|
1089
1141
|
return this.stack.length > 0 ? this.stack.top().type === L : !1;
|
|
@@ -1095,19 +1147,19 @@ class q {
|
|
|
1095
1147
|
if (e > this.maxBinLength)
|
|
1096
1148
|
throw new y(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);
|
|
1097
1149
|
if (!this.hasRemaining(e + t))
|
|
1098
|
-
throw
|
|
1099
|
-
const i = this.pos + t,
|
|
1100
|
-
return this.pos += t + e,
|
|
1150
|
+
throw le;
|
|
1151
|
+
const i = this.pos + t, n = this.bytes.subarray(i, i + e);
|
|
1152
|
+
return this.pos += t + e, n;
|
|
1101
1153
|
}
|
|
1102
1154
|
decodeExtension(e, t) {
|
|
1103
1155
|
if (e > this.maxExtLength)
|
|
1104
1156
|
throw new y(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);
|
|
1105
|
-
const i = this.view.getInt8(this.pos + t),
|
|
1157
|
+
const i = this.view.getInt8(this.pos + t), n = this.decodeBinary(
|
|
1106
1158
|
e,
|
|
1107
1159
|
t + 1
|
|
1108
1160
|
/* extType */
|
|
1109
1161
|
);
|
|
1110
|
-
return this.extensionCodec.decode(
|
|
1162
|
+
return this.extensionCodec.decode(n, i, this.context);
|
|
1111
1163
|
}
|
|
1112
1164
|
lookU8() {
|
|
1113
1165
|
return this.view.getUint8(this.pos);
|
|
@@ -1143,7 +1195,7 @@ class q {
|
|
|
1143
1195
|
return this.pos += 4, e;
|
|
1144
1196
|
}
|
|
1145
1197
|
readU64() {
|
|
1146
|
-
const e =
|
|
1198
|
+
const e = Je(this.view, this.pos);
|
|
1147
1199
|
return this.pos += 8, e;
|
|
1148
1200
|
}
|
|
1149
1201
|
readI64() {
|
|
@@ -1167,10 +1219,10 @@ class q {
|
|
|
1167
1219
|
return this.pos += 8, e;
|
|
1168
1220
|
}
|
|
1169
1221
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return new q(e).decode(
|
|
1222
|
+
function wt(s, e) {
|
|
1223
|
+
return new q(e).decode(s);
|
|
1172
1224
|
}
|
|
1173
|
-
const
|
|
1225
|
+
const yt = /* @__PURE__ */ new Set([
|
|
1174
1226
|
"auth",
|
|
1175
1227
|
"open",
|
|
1176
1228
|
"send",
|
|
@@ -1193,23 +1245,23 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1193
1245
|
"subscribe_inbox",
|
|
1194
1246
|
"unsubscribe_inbox"
|
|
1195
1247
|
]);
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1248
|
+
function Et(s) {
|
|
1249
|
+
return yt.has(s.type);
|
|
1198
1250
|
}
|
|
1199
|
-
function
|
|
1200
|
-
return
|
|
1251
|
+
function he(s) {
|
|
1252
|
+
return lt(s);
|
|
1201
1253
|
}
|
|
1202
|
-
function
|
|
1254
|
+
function mt(s) {
|
|
1203
1255
|
let e;
|
|
1204
1256
|
try {
|
|
1205
|
-
e =
|
|
1257
|
+
e = wt(s);
|
|
1206
1258
|
} catch {
|
|
1207
1259
|
return null;
|
|
1208
1260
|
}
|
|
1209
1261
|
return typeof e != "object" || e === null || typeof e.type != "string" ? null : e;
|
|
1210
1262
|
}
|
|
1211
|
-
function
|
|
1212
|
-
switch (
|
|
1263
|
+
function vt(s) {
|
|
1264
|
+
switch (s) {
|
|
1213
1265
|
case "open":
|
|
1214
1266
|
return { label: "Open", cls: "open" };
|
|
1215
1267
|
case "awaiting_staff":
|
|
@@ -1222,55 +1274,55 @@ function pt(n) {
|
|
|
1222
1274
|
return null;
|
|
1223
1275
|
}
|
|
1224
1276
|
}
|
|
1225
|
-
function
|
|
1226
|
-
const e = Math.floor((Date.now() -
|
|
1277
|
+
function Ut(s) {
|
|
1278
|
+
const e = Math.floor((Date.now() - s) / 1e3);
|
|
1227
1279
|
if (e < 60) return "just now";
|
|
1228
1280
|
if (e < 3600) return `${Math.floor(e / 60)}m`;
|
|
1229
1281
|
if (e < 86400) return `${Math.floor(e / 3600)}h`;
|
|
1230
1282
|
const t = Math.floor(e / 86400);
|
|
1231
1283
|
if (t <= 7) return `${t}d`;
|
|
1232
1284
|
try {
|
|
1233
|
-
return new Date(
|
|
1285
|
+
return new Date(s).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
1234
1286
|
} catch {
|
|
1235
1287
|
return `${t}d`;
|
|
1236
1288
|
}
|
|
1237
1289
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const i = document.createElement(
|
|
1290
|
+
function h(s, e, t) {
|
|
1291
|
+
const i = document.createElement(s);
|
|
1240
1292
|
return e && (i.className = e), t !== void 0 && (i.textContent = t), i;
|
|
1241
1293
|
}
|
|
1242
|
-
function
|
|
1243
|
-
const e =
|
|
1294
|
+
function Bt(s) {
|
|
1295
|
+
const e = s.token ?? s.userId ?? _e(), { httpBase: t, wsUrl: i } = de(s.url, s.apiUrl), n = Le(s.locale, s.i18n), r = s.accent ?? "#6c5ce7";
|
|
1244
1296
|
if (!document.getElementById("ocl-styles")) {
|
|
1245
1297
|
const c = document.createElement("style");
|
|
1246
|
-
c.id = "ocl-styles", c.textContent =
|
|
1298
|
+
c.id = "ocl-styles", c.textContent = Ae, document.head.append(c);
|
|
1247
1299
|
}
|
|
1248
|
-
if (
|
|
1300
|
+
if (s.webfont !== !1 && typeof document < "u" && !document.getElementById("ocw-webfont")) {
|
|
1249
1301
|
const c = document.createElement("link");
|
|
1250
1302
|
c.id = "ocw-webfont", c.rel = "stylesheet", c.href = "https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700&family=Nunito:wght@400;500;600;700&display=swap", document.head.append(c);
|
|
1251
1303
|
}
|
|
1252
|
-
const o =
|
|
1253
|
-
o.style.setProperty("--ocl-accent", r), o.dataset.theme =
|
|
1254
|
-
const
|
|
1255
|
-
if (
|
|
1256
|
-
const c =
|
|
1257
|
-
c.title =
|
|
1258
|
-
}
|
|
1259
|
-
const b =
|
|
1260
|
-
x.placeholder =
|
|
1261
|
-
const g =
|
|
1262
|
-
g.append(
|
|
1304
|
+
const o = h("div", "ocl");
|
|
1305
|
+
o.style.setProperty("--ocl-accent", r), o.dataset.theme = s.theme ?? "light", s.reserveCloseSpace && o.classList.add("ocl-has-close");
|
|
1306
|
+
const l = h("div", "ocl-head"), d = n.title ?? "Your conversations", v = h("span", "ocl-title", d);
|
|
1307
|
+
if (v.setAttribute("aria-label", d), l.append(v), s.onNewChat) {
|
|
1308
|
+
const c = h("button", "ocl-compose", "✎");
|
|
1309
|
+
c.title = n.newChat ?? "New conversation", c.addEventListener("click", () => s.onNewChat()), l.append(c);
|
|
1310
|
+
}
|
|
1311
|
+
const b = h("div", "ocl-search-wrap"), x = h("input", "ocl-search");
|
|
1312
|
+
x.placeholder = n.search ?? "🔍 Search", x.type = "search", b.append(x);
|
|
1313
|
+
const g = h("div", "ocl-body");
|
|
1314
|
+
g.append(h("div", "ocl-spinner", "Loading…")), o.append(l, b, g), s.el.replaceChildren(o);
|
|
1263
1315
|
const I = (c) => {
|
|
1264
1316
|
o.classList.toggle("ocl-compact", c > 0 && c < 400);
|
|
1265
1317
|
};
|
|
1266
1318
|
I(o.clientWidth);
|
|
1267
|
-
let
|
|
1268
|
-
if (typeof ResizeObserver < "u" && (
|
|
1319
|
+
let U = null;
|
|
1320
|
+
if (typeof ResizeObserver < "u" && (U = new ResizeObserver((c) => {
|
|
1269
1321
|
var u;
|
|
1270
1322
|
return I(((u = c[0]) == null ? void 0 : u.contentRect.width) ?? o.clientWidth);
|
|
1271
|
-
}),
|
|
1323
|
+
}), U.observe(o)), !s.profileId && !s.tenantId) throw new Error("[relay chatlist] provide profileId or tenantId");
|
|
1272
1324
|
let X;
|
|
1273
|
-
const G = `ocl_seen_${
|
|
1325
|
+
const G = `ocl_seen_${s.profileId ?? `t_${s.tenantId}`}_${(s.userId ?? e).slice(-8)}`;
|
|
1274
1326
|
let k = {};
|
|
1275
1327
|
try {
|
|
1276
1328
|
k = JSON.parse(localStorage.getItem(G) ?? "{}");
|
|
@@ -1284,7 +1336,7 @@ function Ut(n) {
|
|
|
1284
1336
|
};
|
|
1285
1337
|
let J = [], B = !1;
|
|
1286
1338
|
const ye = async () => {
|
|
1287
|
-
const c =
|
|
1339
|
+
const c = s.profileId ? `profileId=${encodeURIComponent(s.profileId)}${s.scope === "tenant" ? "&scope=tenant" : ""}` : `tenantId=${encodeURIComponent(s.tenantId)}`, u = `${t}/conversations/mine?${c}`, w = { authorization: `Bearer ${e}` };
|
|
1288
1340
|
let S;
|
|
1289
1341
|
try {
|
|
1290
1342
|
S = await fetch(u, { headers: w });
|
|
@@ -1300,43 +1352,43 @@ function Ut(n) {
|
|
|
1300
1352
|
(f) => Q(f).toLowerCase().includes(u) || (f.lastMessage ?? "").toLowerCase().includes(u)
|
|
1301
1353
|
) : c;
|
|
1302
1354
|
if (g.replaceChildren(), !w.length) {
|
|
1303
|
-
const f =
|
|
1304
|
-
if (!u &&
|
|
1305
|
-
f.append(
|
|
1306
|
-
const D =
|
|
1307
|
-
D.addEventListener("click", () =>
|
|
1355
|
+
const f = h("div", "ocl-empty", u ? "No results." : n.empty ?? "No conversations yet.");
|
|
1356
|
+
if (!u && s.onNewChat) {
|
|
1357
|
+
f.append(h("br"));
|
|
1358
|
+
const D = h("button", "ocl-start", n.startChat ?? "Start a conversation");
|
|
1359
|
+
D.addEventListener("click", () => s.onNewChat()), f.append(D);
|
|
1308
1360
|
}
|
|
1309
1361
|
g.append(f);
|
|
1310
1362
|
return;
|
|
1311
1363
|
}
|
|
1312
1364
|
const S = (f) => (f.lastSeq ?? 0) > (k[f.id] ?? 0), m = w.filter(S), E = w.filter((f) => !S(f));
|
|
1313
1365
|
if (m.length) {
|
|
1314
|
-
g.append(
|
|
1366
|
+
g.append(h("div", "ocl-section", `${n.unread ?? "Unread"} (${m.length})`));
|
|
1315
1367
|
for (const f of m) g.append(j(f, S(f)));
|
|
1316
1368
|
}
|
|
1317
1369
|
if (E.length) {
|
|
1318
|
-
g.append(
|
|
1370
|
+
g.append(h("div", "ocl-section", m.length ? n.all ?? "All conversations" : ""));
|
|
1319
1371
|
for (const f of E) g.append(j(f, !1));
|
|
1320
1372
|
}
|
|
1321
1373
|
}, Q = (c) => c.subjectTitle ?? (c.kind === "direct" ? c.peerId ?? "Direct message" : "General enquiry"), j = (c, u) => {
|
|
1322
1374
|
var re;
|
|
1323
|
-
const w = Q(c), S = (((re = w.match(new RegExp("\\p{L}", "u"))) == null ? void 0 : re[0]) ?? w.trim()[0] ?? "?").toUpperCase(), m = c.lastSeq ?? 0, E = u ? Math.max(1, m - (k[c.id] ?? 0)) : 0, f =
|
|
1375
|
+
const w = Q(c), S = (((re = w.match(new RegExp("\\p{L}", "u"))) == null ? void 0 : re[0]) ?? w.trim()[0] ?? "?").toUpperCase(), m = c.lastSeq ?? 0, E = u ? Math.max(1, m - (k[c.id] ?? 0)) : 0, f = h("button", `ocl-row${u ? " unread" : ""}`), D = h("div", "ocl-av", S);
|
|
1324
1376
|
f.append(D);
|
|
1325
|
-
const N =
|
|
1326
|
-
N.append(
|
|
1377
|
+
const N = h("div", "ocl-info");
|
|
1378
|
+
N.append(h("div", "ocl-name", w));
|
|
1327
1379
|
const me = {
|
|
1328
1380
|
open: "Open",
|
|
1329
1381
|
awaiting_staff: "Waiting for reply…",
|
|
1330
1382
|
resolved: "Resolved ✓",
|
|
1331
1383
|
closed: "Closed"
|
|
1332
1384
|
};
|
|
1333
|
-
N.append(
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
const H =
|
|
1337
|
-
return H &&
|
|
1385
|
+
N.append(h("div", "ocl-preview", c.lastMessage ?? me[c.state] ?? c.state)), f.append(N);
|
|
1386
|
+
const C = h("div", "ocl-right");
|
|
1387
|
+
C.append(h("div", "ocl-time", Ut(c.updatedAt)));
|
|
1388
|
+
const H = vt(c.state);
|
|
1389
|
+
return H && C.append(h("div", `ocl-status ${H.cls}`, H.label)), E > 0 && C.append(h("div", "ocl-badge", String(E > 99 ? "99+" : E))), f.append(C), f.addEventListener("click", () => {
|
|
1338
1390
|
var oe;
|
|
1339
|
-
m > 0 && (k[c.id] = m, we()), f.classList.remove("unread"), (oe =
|
|
1391
|
+
m > 0 && (k[c.id] = m, we()), f.classList.remove("unread"), (oe = C.querySelector(".ocl-badge")) == null || oe.remove(), s.onSelect(c);
|
|
1340
1392
|
}), f;
|
|
1341
1393
|
}, M = () => {
|
|
1342
1394
|
B || ye().then((c) => {
|
|
@@ -1344,21 +1396,21 @@ function Ut(n) {
|
|
|
1344
1396
|
}).catch((c) => {
|
|
1345
1397
|
if (B) return;
|
|
1346
1398
|
console.error(`[chat-widget] failed to load conversations from ${t}/conversations/mine — check the apiUrl/CORS config.`, c);
|
|
1347
|
-
const u =
|
|
1348
|
-
u.append(
|
|
1349
|
-
const w =
|
|
1399
|
+
const u = h("div", "ocl-empty", n.error ?? "Could not load conversations.");
|
|
1400
|
+
u.append(h("br"));
|
|
1401
|
+
const w = h("button", "ocl-retry", n.retry ?? "Retry");
|
|
1350
1402
|
w.addEventListener("click", () => {
|
|
1351
|
-
g.replaceChildren(
|
|
1403
|
+
g.replaceChildren(h("div", "ocl-spinner", "Loading…")), M();
|
|
1352
1404
|
}), u.append(w), g.replaceChildren(u);
|
|
1353
1405
|
});
|
|
1354
1406
|
};
|
|
1355
1407
|
x.addEventListener("input", () => Z(J, x.value.trim().toLowerCase())), M();
|
|
1356
|
-
let p = null,
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
|
|
1408
|
+
let p = null, A, T, ee = 0, te = !1;
|
|
1409
|
+
const se = () => {
|
|
1410
|
+
T || (T = setTimeout(() => {
|
|
1411
|
+
T = void 0, M();
|
|
1360
1412
|
}, 300));
|
|
1361
|
-
},
|
|
1413
|
+
}, ie = () => {
|
|
1362
1414
|
if (!B) {
|
|
1363
1415
|
try {
|
|
1364
1416
|
p = new WebSocket(i);
|
|
@@ -1367,10 +1419,10 @@ function Ut(n) {
|
|
|
1367
1419
|
return;
|
|
1368
1420
|
}
|
|
1369
1421
|
p.binaryType = "arraybuffer", p.onopen = () => {
|
|
1370
|
-
ee = 0, p.send(
|
|
1422
|
+
ee = 0, p.send(he({ type: "auth", token: e })), p.send(he({ type: "subscribe_inbox" })), te && se(), te = !0;
|
|
1371
1423
|
}, p.onmessage = (c) => {
|
|
1372
|
-
const u =
|
|
1373
|
-
u && u.type === "inbox_event" &&
|
|
1424
|
+
const u = mt(new Uint8Array(c.data));
|
|
1425
|
+
u && u.type === "inbox_event" && se();
|
|
1374
1426
|
}, p.onclose = () => {
|
|
1375
1427
|
p = null, ne();
|
|
1376
1428
|
}, p.onerror = () => {
|
|
@@ -1381,37 +1433,38 @@ function Ut(n) {
|
|
|
1381
1433
|
};
|
|
1382
1434
|
}
|
|
1383
1435
|
}, ne = () => {
|
|
1384
|
-
if (B ||
|
|
1436
|
+
if (B || A) return;
|
|
1385
1437
|
const c = Math.min(15e3, 500 * 2 ** ee++) + Math.random() * 250;
|
|
1386
|
-
|
|
1387
|
-
|
|
1438
|
+
A = setTimeout(() => {
|
|
1439
|
+
A = void 0, ie();
|
|
1388
1440
|
}, c);
|
|
1389
1441
|
};
|
|
1390
|
-
return
|
|
1442
|
+
return ie(), {
|
|
1391
1443
|
refresh: M,
|
|
1392
1444
|
close() {
|
|
1393
|
-
B = !0,
|
|
1445
|
+
B = !0, A && clearTimeout(A), T && clearTimeout(T), U == null || U.disconnect(), U = null;
|
|
1394
1446
|
try {
|
|
1395
1447
|
p == null || p.close();
|
|
1396
1448
|
} catch {
|
|
1397
1449
|
}
|
|
1398
|
-
p = null,
|
|
1450
|
+
p = null, s.el.replaceChildren();
|
|
1399
1451
|
},
|
|
1400
1452
|
defaultProfileId() {
|
|
1401
|
-
return
|
|
1453
|
+
return s.profileId ?? X;
|
|
1402
1454
|
}
|
|
1403
1455
|
};
|
|
1404
1456
|
}
|
|
1405
1457
|
export {
|
|
1406
|
-
|
|
1458
|
+
bt as a,
|
|
1407
1459
|
ce as b,
|
|
1408
|
-
|
|
1409
|
-
|
|
1460
|
+
Le as c,
|
|
1461
|
+
mt as d,
|
|
1462
|
+
he as e,
|
|
1410
1463
|
Se as h,
|
|
1411
|
-
|
|
1464
|
+
Et as i,
|
|
1412
1465
|
ke as l,
|
|
1413
|
-
|
|
1414
|
-
|
|
1466
|
+
Bt as m,
|
|
1467
|
+
_e as p,
|
|
1415
1468
|
de as r
|
|
1416
1469
|
};
|
|
1417
1470
|
//# sourceMappingURL=chatlist2.js.map
|