@epam/statgpt-conversation-list 0.7.0-dev.3 → 0.7.0-dev.30
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/index.js +1 -1
- package/index.mjs +1703 -1915
- package/package.json +8 -8
- package/LICENSE +0 -21
package/index.mjs
CHANGED
|
@@ -1,1927 +1,1715 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { InvitationType as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(C) => C.id === a.id
|
|
44
|
-
) || c.push(a);
|
|
45
|
-
}
|
|
46
|
-
return r;
|
|
47
|
-
}, Pe = (t) => t?.sort(
|
|
48
|
-
(s, r) => (ye(r) || 0) - (ye(s) || 0)
|
|
49
|
-
), vt = (t, s) => t === F.SHARED ? s?.shared || "Shared" : t === F.TODAY ? s?.today || "Today" : t === F.YESTERDAY ? s?.yesterday || "Yesterday" : t === F.WEEK ? s?.lastWeek || "Last week" : s?.earlier || "Earlier", De = Re(null);
|
|
50
|
-
function K() {
|
|
51
|
-
const t = Se(De);
|
|
52
|
-
if (!t)
|
|
53
|
-
throw new Error(
|
|
54
|
-
"useConversationStyles must be used within ConversationStylesContext.Provider"
|
|
55
|
-
);
|
|
56
|
-
return t;
|
|
1
|
+
import e from "classnames";
|
|
2
|
+
import t, { createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
3
|
+
import { cloneDeep as l, omit as u, uniqBy as d } from "lodash";
|
|
4
|
+
import { Button as f, Dropdown as p, HighlightText as m, IconButton as h, InlineAlert as g, InlineAlertType as _, Input as v, InputWithIcon as y, Loader as b, PopUpSize as x, PopUpState as S, Popup as C } from "@epam/statgpt-ui-components";
|
|
5
|
+
import { IconCaretRightFilled as w, IconCheck as T, IconCopy as E, IconDotsVertical as D, IconInfoCircle as O, IconSearch as k, IconX as A } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
7
|
+
import P from "jszip";
|
|
8
|
+
import { ONBOARDING_MODEL_POSTFIX as F, SHARE_CONVERSATION_ROUTE as ee, cleanConversationNames as I, getClearedConversationName as L, getConversationAttachments as R } from "@epam/statgpt-shared-toolkit";
|
|
9
|
+
import { InvitationType as te, ShareTarget as z, getSharedConversationsRequest as ne } from "@epam/statgpt-dial-toolkit";
|
|
10
|
+
//#region libs/conversation-list/src/types/action-menu-item.ts
|
|
11
|
+
var B = /* @__PURE__ */ function(e) {
|
|
12
|
+
return e.DELETE = "delete", e.EXPORT = "export", e.SHARE = "share", e.RENAME = "rename", e;
|
|
13
|
+
}({}), V = /* @__PURE__ */ function(e) {
|
|
14
|
+
return e.SHARED = "shared", e.TODAY = "today", e.YESTERDAY = "yesterday", e.WEEK = "week", e.EARLIER = "earlier", e;
|
|
15
|
+
}({}), H = (e, t) => e?.resources?.filter((e) => e?.parentPath === t)?.map((e) => {
|
|
16
|
+
let n = `${e?.bucket}/${t}`, r = e?.url?.split("/")?.slice(1)?.join("/");
|
|
17
|
+
return {
|
|
18
|
+
...e,
|
|
19
|
+
folderId: n,
|
|
20
|
+
id: r,
|
|
21
|
+
isShared: !0
|
|
22
|
+
};
|
|
23
|
+
}) || [], U = (e) => ({ [V.SHARED]: e }), re = {
|
|
24
|
+
[V.TODAY]: [],
|
|
25
|
+
[V.YESTERDAY]: [],
|
|
26
|
+
[V.WEEK]: [],
|
|
27
|
+
[V.EARLIER]: []
|
|
28
|
+
}, W = (e, t) => e.toDateString() === t.toDateString(), G = (e, t) => W(t, new Date(e.getFullYear(), e.getMonth(), e.getDate() - 1)), ie = (e, t) => {
|
|
29
|
+
let n = e.getTime() - t.getTime();
|
|
30
|
+
return Math.floor(n / (1e3 * 60 * 60 * 24));
|
|
31
|
+
}, ae = (e) => e.updatedAt || Number(e.id?.split("-").pop()), oe = (e) => {
|
|
32
|
+
let t = /* @__PURE__ */ new Date(), n = l(re);
|
|
33
|
+
for (let r of e) if (r.updatedAt) {
|
|
34
|
+
let e = new Date(r.updatedAt), i;
|
|
35
|
+
i = W(t, e) ? n[V.TODAY] : G(t, e) ? n[V.YESTERDAY] : ie(t, e) <= 7 ? n[V.WEEK] : n[V.EARLIER], i?.some((e) => e.id === r.id) || i.push(r);
|
|
36
|
+
}
|
|
37
|
+
return n;
|
|
38
|
+
}, K = (e) => e?.sort((e, t) => (ae(t) || 0) - (ae(e) || 0)), q = (e, t) => e === V.SHARED ? t?.shared || "Shared" : e === V.TODAY ? t?.today || "Today" : e === V.YESTERDAY ? t?.yesterday || "Yesterday" : e === V.WEEK ? t?.lastWeek || "Last week" : t?.earlier || "Earlier", J = n(null);
|
|
39
|
+
function Y() {
|
|
40
|
+
let e = i(J);
|
|
41
|
+
if (!e) throw Error("useConversationStyles must be used within ConversationStylesContext.Provider");
|
|
42
|
+
return e;
|
|
57
43
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"api/files"
|
|
127
|
-
].some((r) => s.startsWith(r));
|
|
128
|
-
}, St = (t) => {
|
|
129
|
-
const s = re(
|
|
130
|
-
...t.split("/").map((a) => decodeURIComponent(a))
|
|
131
|
-
), r = s.lastIndexOf("/");
|
|
132
|
-
return {
|
|
133
|
-
absolutePath: s.slice(0, r),
|
|
134
|
-
name: s.slice(r + 1)
|
|
135
|
-
};
|
|
136
|
-
}, bt = (t) => t ? t.map((s) => {
|
|
137
|
-
if (!s.url || Rt(s.url) || Nt(s.url))
|
|
138
|
-
return null;
|
|
139
|
-
const { absolutePath: r, name: a } = St(s.url);
|
|
140
|
-
return {
|
|
141
|
-
id: s.url,
|
|
142
|
-
name: a,
|
|
143
|
-
contentType: s.type,
|
|
144
|
-
folderId: r,
|
|
145
|
-
absolutePath: r
|
|
146
|
-
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region libs/conversation-list/src/components/ConversationDelete/ConversationDelete.tsx
|
|
46
|
+
var X = ({ onCloseModal: e, deleteConversation: t, locale: n }) => {
|
|
47
|
+
let { titles: r, disableModalDividers: i, isSmallModalButton: a } = Y();
|
|
48
|
+
return /* @__PURE__ */ N(C, {
|
|
49
|
+
heading: r?.deleteTitle ?? "Delete conversation",
|
|
50
|
+
portalId: "delete-conversation",
|
|
51
|
+
containerClassName: "delete-conversation-popup",
|
|
52
|
+
size: x.SM,
|
|
53
|
+
dividers: !i,
|
|
54
|
+
onClose: e,
|
|
55
|
+
closeButtonTitle: r?.close ?? "Cancel",
|
|
56
|
+
children: [/* @__PURE__ */ M("div", {
|
|
57
|
+
className: "px-6 py-4 sm:px-0",
|
|
58
|
+
lang: n,
|
|
59
|
+
children: r?.deleteMessage ?? "Are you sure you want to delete this conversation? This action cannot be undone."
|
|
60
|
+
}), /* @__PURE__ */ N("div", {
|
|
61
|
+
className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
|
|
62
|
+
children: [/* @__PURE__ */ M(f, {
|
|
63
|
+
buttonClassName: "cancel-button",
|
|
64
|
+
title: r?.cancel ?? "Cancel",
|
|
65
|
+
isSmallButton: a,
|
|
66
|
+
onClick: (t) => {
|
|
67
|
+
t.stopPropagation(), e();
|
|
68
|
+
}
|
|
69
|
+
}), /* @__PURE__ */ M(f, {
|
|
70
|
+
buttonClassName: "text-button-primary text-button-primary-error",
|
|
71
|
+
title: r?.delete ?? "Delete",
|
|
72
|
+
isSmallButton: a,
|
|
73
|
+
onClick: (e) => {
|
|
74
|
+
e.stopPropagation(), t();
|
|
75
|
+
}
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
}, se = (e) => d(de(R(e)).map((e) => ({
|
|
80
|
+
...e,
|
|
81
|
+
relativePath: "",
|
|
82
|
+
contentLength: 0
|
|
83
|
+
})), (e) => Z(e.relativePath, e.name)), ce = (e) => e.endsWith("/"), le = (e) => {
|
|
84
|
+
let t = e.toLowerCase();
|
|
85
|
+
return [
|
|
86
|
+
"data:",
|
|
87
|
+
"//",
|
|
88
|
+
"http://",
|
|
89
|
+
"https://",
|
|
90
|
+
"file://",
|
|
91
|
+
"ftp://",
|
|
92
|
+
"mailto:",
|
|
93
|
+
"telnet://",
|
|
94
|
+
"api/files"
|
|
95
|
+
].some((e) => t.startsWith(e));
|
|
96
|
+
}, ue = (e) => {
|
|
97
|
+
let t = Z(...e.split("/").map((e) => decodeURIComponent(e))), n = t.lastIndexOf("/");
|
|
98
|
+
return {
|
|
99
|
+
absolutePath: t.slice(0, n),
|
|
100
|
+
name: t.slice(n + 1)
|
|
101
|
+
};
|
|
102
|
+
}, de = (e) => e ? e.map((e) => {
|
|
103
|
+
if (!e.url || le(e.url) || ce(e.url)) return null;
|
|
104
|
+
let { absolutePath: t, name: n } = ue(e.url);
|
|
105
|
+
return {
|
|
106
|
+
id: e.url,
|
|
107
|
+
name: n,
|
|
108
|
+
contentType: e.type,
|
|
109
|
+
folderId: t,
|
|
110
|
+
absolutePath: t
|
|
111
|
+
};
|
|
147
112
|
}).filter(Boolean) : [];
|
|
148
|
-
async function
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
113
|
+
async function fe(e, t) {
|
|
114
|
+
let n = se(e), r = new P();
|
|
115
|
+
n.forEach((e) => {
|
|
116
|
+
let n = t(`${encodeURI(Z(e.absolutePath, e.name))}`.replace("files/", "")), i = Z("res", pe(e.folderId), e.name);
|
|
117
|
+
r.file(i, n);
|
|
118
|
+
});
|
|
119
|
+
let i = {
|
|
120
|
+
version: 5,
|
|
121
|
+
history: [e].map(me) || [],
|
|
122
|
+
folders: []
|
|
123
|
+
}, a = JSON.stringify(i, null, 2);
|
|
124
|
+
return r.file("conversations/conversations_history.json", a), await r.generateAsync({ type: "base64" });
|
|
160
125
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
126
|
+
var pe = (e) => {
|
|
127
|
+
let t = e.split("/");
|
|
128
|
+
return t.length > 2 ? Z(...t.slice(2)) : void 0;
|
|
129
|
+
}, me = (e) => u(e, ["publicationInfo"]), Z = (...e) => e.filter(Boolean).join("/");
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region libs/conversation-list/src/utils/download.ts
|
|
132
|
+
function he(e, t) {
|
|
133
|
+
let n = document.createElement("a");
|
|
134
|
+
n.download = t, n.href = e, n.style.display = "none", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(e);
|
|
168
135
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
((
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region node_modules/qrcode.react/lib/esm/index.js
|
|
138
|
+
var ge = Object.defineProperty, Q = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, ve = Object.prototype.propertyIsEnumerable, ye = (e, t, n) => t in e ? ge(e, t, {
|
|
139
|
+
enumerable: !0,
|
|
140
|
+
configurable: !0,
|
|
141
|
+
writable: !0,
|
|
142
|
+
value: n
|
|
143
|
+
}) : e[t] = n, be = (e, t) => {
|
|
144
|
+
for (var n in t ||= {}) _e.call(t, n) && ye(e, n, t[n]);
|
|
145
|
+
if (Q) for (var n of Q(t)) ve.call(t, n) && ye(e, n, t[n]);
|
|
146
|
+
return e;
|
|
147
|
+
}, xe = (e, t) => {
|
|
148
|
+
var n = {};
|
|
149
|
+
for (var r in e) _e.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
150
|
+
if (e != null && Q) for (var r of Q(e)) t.indexOf(r) < 0 && ve.call(e, r) && (n[r] = e[r]);
|
|
151
|
+
return n;
|
|
152
|
+
}, Se;
|
|
153
|
+
((e) => {
|
|
154
|
+
let t = class t {
|
|
155
|
+
constructor(e, n, r, a) {
|
|
156
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version value out of range");
|
|
157
|
+
if (a < -1 || a > 7) throw RangeError("Mask value out of range");
|
|
158
|
+
this.size = e * 4 + 17;
|
|
159
|
+
let o = [];
|
|
160
|
+
for (let e = 0; e < this.size; e++) o.push(!1);
|
|
161
|
+
for (let e = 0; e < this.size; e++) this.modules.push(o.slice()), this.isFunction.push(o.slice());
|
|
162
|
+
this.drawFunctionPatterns();
|
|
163
|
+
let s = this.addEccAndInterleave(r);
|
|
164
|
+
if (this.drawCodewords(s), a == -1) {
|
|
165
|
+
let e = 1e9;
|
|
166
|
+
for (let t = 0; t < 8; t++) {
|
|
167
|
+
this.applyMask(t), this.drawFormatBits(t);
|
|
168
|
+
let n = this.getPenaltyScore();
|
|
169
|
+
n < e && (a = t, e = n), this.applyMask(t);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
i(0 <= a && a <= 7), this.mask = a, this.applyMask(a), this.drawFormatBits(a), this.isFunction = [];
|
|
173
|
+
}
|
|
174
|
+
static encodeText(n, r) {
|
|
175
|
+
let i = e.QrSegment.makeSegments(n);
|
|
176
|
+
return t.encodeSegments(i, r);
|
|
177
|
+
}
|
|
178
|
+
static encodeBinary(n, r) {
|
|
179
|
+
let i = e.QrSegment.makeBytes(n);
|
|
180
|
+
return t.encodeSegments([i], r);
|
|
181
|
+
}
|
|
182
|
+
static encodeSegments(e, r, a = 1, s = 40, c = -1, l = !0) {
|
|
183
|
+
if (!(t.MIN_VERSION <= a && a <= s && s <= t.MAX_VERSION) || c < -1 || c > 7) throw RangeError("Invalid value");
|
|
184
|
+
let u, d;
|
|
185
|
+
for (u = a;; u++) {
|
|
186
|
+
let n = t.getNumDataCodewords(u, r) * 8, i = o.getTotalBits(e, u);
|
|
187
|
+
if (i <= n) {
|
|
188
|
+
d = i;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (u >= s) throw RangeError("Data too long");
|
|
192
|
+
}
|
|
193
|
+
for (let e of [
|
|
194
|
+
t.Ecc.MEDIUM,
|
|
195
|
+
t.Ecc.QUARTILE,
|
|
196
|
+
t.Ecc.HIGH
|
|
197
|
+
]) l && d <= t.getNumDataCodewords(u, e) * 8 && (r = e);
|
|
198
|
+
let f = [];
|
|
199
|
+
for (let t of e) {
|
|
200
|
+
n(t.mode.modeBits, 4, f), n(t.numChars, t.mode.numCharCountBits(u), f);
|
|
201
|
+
for (let e of t.getData()) f.push(e);
|
|
202
|
+
}
|
|
203
|
+
i(f.length == d);
|
|
204
|
+
let p = t.getNumDataCodewords(u, r) * 8;
|
|
205
|
+
i(f.length <= p), n(0, Math.min(4, p - f.length), f), n(0, (8 - f.length % 8) % 8, f), i(f.length % 8 == 0);
|
|
206
|
+
for (let e = 236; f.length < p; e ^= 253) n(e, 8, f);
|
|
207
|
+
let m = [];
|
|
208
|
+
for (; m.length * 8 < f.length;) m.push(0);
|
|
209
|
+
return f.forEach((e, t) => m[t >>> 3] |= e << 7 - (t & 7)), new t(u, r, m, c);
|
|
210
|
+
}
|
|
211
|
+
getModule(e, t) {
|
|
212
|
+
return 0 <= e && e < this.size && 0 <= t && t < this.size && this.modules[t][e];
|
|
213
|
+
}
|
|
214
|
+
getModules() {
|
|
215
|
+
return this.modules;
|
|
216
|
+
}
|
|
217
|
+
drawFunctionPatterns() {
|
|
218
|
+
for (let e = 0; e < this.size; e++) this.setFunctionModule(6, e, e % 2 == 0), this.setFunctionModule(e, 6, e % 2 == 0);
|
|
219
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
220
|
+
let e = this.getAlignmentPatternPositions(), t = e.length;
|
|
221
|
+
for (let n = 0; n < t; n++) for (let r = 0; r < t; r++) n == 0 && r == 0 || n == 0 && r == t - 1 || n == t - 1 && r == 0 || this.drawAlignmentPattern(e[n], e[r]);
|
|
222
|
+
this.drawFormatBits(0), this.drawVersion();
|
|
223
|
+
}
|
|
224
|
+
drawFormatBits(e) {
|
|
225
|
+
let t = this.errorCorrectionLevel.formatBits << 3 | e, n = t;
|
|
226
|
+
for (let e = 0; e < 10; e++) n = n << 1 ^ (n >>> 9) * 1335;
|
|
227
|
+
let a = (t << 10 | n) ^ 21522;
|
|
228
|
+
i(a >>> 15 == 0);
|
|
229
|
+
for (let e = 0; e <= 5; e++) this.setFunctionModule(8, e, r(a, e));
|
|
230
|
+
this.setFunctionModule(8, 7, r(a, 6)), this.setFunctionModule(8, 8, r(a, 7)), this.setFunctionModule(7, 8, r(a, 8));
|
|
231
|
+
for (let e = 9; e < 15; e++) this.setFunctionModule(14 - e, 8, r(a, e));
|
|
232
|
+
for (let e = 0; e < 8; e++) this.setFunctionModule(this.size - 1 - e, 8, r(a, e));
|
|
233
|
+
for (let e = 8; e < 15; e++) this.setFunctionModule(8, this.size - 15 + e, r(a, e));
|
|
234
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
|
235
|
+
}
|
|
236
|
+
drawVersion() {
|
|
237
|
+
if (this.version < 7) return;
|
|
238
|
+
let e = this.version;
|
|
239
|
+
for (let t = 0; t < 12; t++) e = e << 1 ^ (e >>> 11) * 7973;
|
|
240
|
+
let t = this.version << 12 | e;
|
|
241
|
+
i(t >>> 18 == 0);
|
|
242
|
+
for (let e = 0; e < 18; e++) {
|
|
243
|
+
let n = r(t, e), i = this.size - 11 + e % 3, a = Math.floor(e / 3);
|
|
244
|
+
this.setFunctionModule(i, a, n), this.setFunctionModule(a, i, n);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
drawFinderPattern(e, t) {
|
|
248
|
+
for (let n = -4; n <= 4; n++) for (let r = -4; r <= 4; r++) {
|
|
249
|
+
let i = Math.max(Math.abs(r), Math.abs(n)), a = e + r, o = t + n;
|
|
250
|
+
0 <= a && a < this.size && 0 <= o && o < this.size && this.setFunctionModule(a, o, i != 2 && i != 4);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
drawAlignmentPattern(e, t) {
|
|
254
|
+
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) this.setFunctionModule(e + r, t + n, Math.max(Math.abs(r), Math.abs(n)) != 1);
|
|
255
|
+
}
|
|
256
|
+
setFunctionModule(e, t, n) {
|
|
257
|
+
this.modules[t][e] = n, this.isFunction[t][e] = !0;
|
|
258
|
+
}
|
|
259
|
+
addEccAndInterleave(e) {
|
|
260
|
+
let n = this.version, r = this.errorCorrectionLevel;
|
|
261
|
+
if (e.length != t.getNumDataCodewords(n, r)) throw RangeError("Invalid argument");
|
|
262
|
+
let a = t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n], o = t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n], s = Math.floor(t.getNumRawDataModules(n) / 8), c = a - s % a, l = Math.floor(s / a), u = [], d = t.reedSolomonComputeDivisor(o);
|
|
263
|
+
for (let n = 0, r = 0; n < a; n++) {
|
|
264
|
+
let i = e.slice(r, r + l - o + (n < c ? 0 : 1));
|
|
265
|
+
r += i.length;
|
|
266
|
+
let a = t.reedSolomonComputeRemainder(i, d);
|
|
267
|
+
n < c && i.push(0), u.push(i.concat(a));
|
|
268
|
+
}
|
|
269
|
+
let f = [];
|
|
270
|
+
for (let e = 0; e < u[0].length; e++) u.forEach((t, n) => {
|
|
271
|
+
(e != l - o || n >= c) && f.push(t[e]);
|
|
272
|
+
});
|
|
273
|
+
return i(f.length == s), f;
|
|
274
|
+
}
|
|
275
|
+
drawCodewords(e) {
|
|
276
|
+
if (e.length != Math.floor(t.getNumRawDataModules(this.version) / 8)) throw RangeError("Invalid argument");
|
|
277
|
+
let n = 0;
|
|
278
|
+
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
279
|
+
t == 6 && (t = 5);
|
|
280
|
+
for (let i = 0; i < this.size; i++) for (let a = 0; a < 2; a++) {
|
|
281
|
+
let o = t - a, s = t + 1 & 2 ? i : this.size - 1 - i;
|
|
282
|
+
!this.isFunction[s][o] && n < e.length * 8 && (this.modules[s][o] = r(e[n >>> 3], 7 - (n & 7)), n++);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
i(n == e.length * 8);
|
|
286
|
+
}
|
|
287
|
+
applyMask(e) {
|
|
288
|
+
if (e < 0 || e > 7) throw RangeError("Mask value out of range");
|
|
289
|
+
for (let t = 0; t < this.size; t++) for (let n = 0; n < this.size; n++) {
|
|
290
|
+
let r;
|
|
291
|
+
switch (e) {
|
|
292
|
+
case 0:
|
|
293
|
+
r = (n + t) % 2 == 0;
|
|
294
|
+
break;
|
|
295
|
+
case 1:
|
|
296
|
+
r = t % 2 == 0;
|
|
297
|
+
break;
|
|
298
|
+
case 2:
|
|
299
|
+
r = n % 3 == 0;
|
|
300
|
+
break;
|
|
301
|
+
case 3:
|
|
302
|
+
r = (n + t) % 3 == 0;
|
|
303
|
+
break;
|
|
304
|
+
case 4:
|
|
305
|
+
r = (Math.floor(n / 3) + Math.floor(t / 2)) % 2 == 0;
|
|
306
|
+
break;
|
|
307
|
+
case 5:
|
|
308
|
+
r = n * t % 2 + n * t % 3 == 0;
|
|
309
|
+
break;
|
|
310
|
+
case 6:
|
|
311
|
+
r = (n * t % 2 + n * t % 3) % 2 == 0;
|
|
312
|
+
break;
|
|
313
|
+
case 7:
|
|
314
|
+
r = ((n + t) % 2 + n * t % 3) % 2 == 0;
|
|
315
|
+
break;
|
|
316
|
+
default: throw Error("Unreachable");
|
|
317
|
+
}
|
|
318
|
+
!this.isFunction[t][n] && r && (this.modules[t][n] = !this.modules[t][n]);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
getPenaltyScore() {
|
|
322
|
+
let e = 0;
|
|
323
|
+
for (let n = 0; n < this.size; n++) {
|
|
324
|
+
let r = !1, i = 0, a = [
|
|
325
|
+
0,
|
|
326
|
+
0,
|
|
327
|
+
0,
|
|
328
|
+
0,
|
|
329
|
+
0,
|
|
330
|
+
0,
|
|
331
|
+
0
|
|
332
|
+
];
|
|
333
|
+
for (let o = 0; o < this.size; o++) this.modules[n][o] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[n][o], i = 1);
|
|
334
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
335
|
+
}
|
|
336
|
+
for (let n = 0; n < this.size; n++) {
|
|
337
|
+
let r = !1, i = 0, a = [
|
|
338
|
+
0,
|
|
339
|
+
0,
|
|
340
|
+
0,
|
|
341
|
+
0,
|
|
342
|
+
0,
|
|
343
|
+
0,
|
|
344
|
+
0
|
|
345
|
+
];
|
|
346
|
+
for (let o = 0; o < this.size; o++) this.modules[o][n] == r ? (i++, i == 5 ? e += t.PENALTY_N1 : i > 5 && e++) : (this.finderPenaltyAddHistory(i, a), r || (e += this.finderPenaltyCountPatterns(a) * t.PENALTY_N3), r = this.modules[o][n], i = 1);
|
|
347
|
+
e += this.finderPenaltyTerminateAndCount(r, i, a) * t.PENALTY_N3;
|
|
348
|
+
}
|
|
349
|
+
for (let n = 0; n < this.size - 1; n++) for (let r = 0; r < this.size - 1; r++) {
|
|
350
|
+
let i = this.modules[n][r];
|
|
351
|
+
i == this.modules[n][r + 1] && i == this.modules[n + 1][r] && i == this.modules[n + 1][r + 1] && (e += t.PENALTY_N2);
|
|
352
|
+
}
|
|
353
|
+
let n = 0;
|
|
354
|
+
for (let e of this.modules) n = e.reduce((e, t) => e + +!!t, n);
|
|
355
|
+
let r = this.size * this.size, a = Math.ceil(Math.abs(n * 20 - r * 10) / r) - 1;
|
|
356
|
+
return i(0 <= a && a <= 9), e += a * t.PENALTY_N4, i(0 <= e && e <= 2568888), e;
|
|
357
|
+
}
|
|
358
|
+
getAlignmentPatternPositions() {
|
|
359
|
+
if (this.version == 1) return [];
|
|
360
|
+
{
|
|
361
|
+
let e = Math.floor(this.version / 7) + 2, t = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2, n = [6];
|
|
362
|
+
for (let r = this.size - 7; n.length < e; r -= t) n.splice(1, 0, r);
|
|
363
|
+
return n;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
static getNumRawDataModules(e) {
|
|
367
|
+
if (e < t.MIN_VERSION || e > t.MAX_VERSION) throw RangeError("Version number out of range");
|
|
368
|
+
let n = (16 * e + 128) * e + 64;
|
|
369
|
+
if (e >= 2) {
|
|
370
|
+
let t = Math.floor(e / 7) + 2;
|
|
371
|
+
n -= (25 * t - 10) * t - 55, e >= 7 && (n -= 36);
|
|
372
|
+
}
|
|
373
|
+
return i(208 <= n && n <= 29648), n;
|
|
374
|
+
}
|
|
375
|
+
static getNumDataCodewords(e, n) {
|
|
376
|
+
return Math.floor(t.getNumRawDataModules(e) / 8) - t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
377
|
+
}
|
|
378
|
+
static reedSolomonComputeDivisor(e) {
|
|
379
|
+
if (e < 1 || e > 255) throw RangeError("Degree out of range");
|
|
380
|
+
let n = [];
|
|
381
|
+
for (let t = 0; t < e - 1; t++) n.push(0);
|
|
382
|
+
n.push(1);
|
|
383
|
+
let r = 1;
|
|
384
|
+
for (let i = 0; i < e; i++) {
|
|
385
|
+
for (let e = 0; e < n.length; e++) n[e] = t.reedSolomonMultiply(n[e], r), e + 1 < n.length && (n[e] ^= n[e + 1]);
|
|
386
|
+
r = t.reedSolomonMultiply(r, 2);
|
|
387
|
+
}
|
|
388
|
+
return n;
|
|
389
|
+
}
|
|
390
|
+
static reedSolomonComputeRemainder(e, n) {
|
|
391
|
+
let r = n.map((e) => 0);
|
|
392
|
+
for (let i of e) {
|
|
393
|
+
let e = i ^ r.shift();
|
|
394
|
+
r.push(0), n.forEach((n, i) => r[i] ^= t.reedSolomonMultiply(n, e));
|
|
395
|
+
}
|
|
396
|
+
return r;
|
|
397
|
+
}
|
|
398
|
+
static reedSolomonMultiply(e, t) {
|
|
399
|
+
if (e >>> 8 || t >>> 8) throw RangeError("Byte out of range");
|
|
400
|
+
let n = 0;
|
|
401
|
+
for (let r = 7; r >= 0; r--) n = n << 1 ^ (n >>> 7) * 285, n ^= (t >>> r & 1) * e;
|
|
402
|
+
return i(n >>> 8 == 0), n;
|
|
403
|
+
}
|
|
404
|
+
finderPenaltyCountPatterns(e) {
|
|
405
|
+
let t = e[1];
|
|
406
|
+
i(t <= this.size * 3);
|
|
407
|
+
let n = t > 0 && e[2] == t && e[3] == t * 3 && e[4] == t && e[5] == t;
|
|
408
|
+
return (n && e[0] >= t * 4 && e[6] >= t ? 1 : 0) + (n && e[6] >= t * 4 && e[0] >= t ? 1 : 0);
|
|
409
|
+
}
|
|
410
|
+
finderPenaltyTerminateAndCount(e, t, n) {
|
|
411
|
+
return e && (this.finderPenaltyAddHistory(t, n), t = 0), t += this.size, this.finderPenaltyAddHistory(t, n), this.finderPenaltyCountPatterns(n);
|
|
412
|
+
}
|
|
413
|
+
finderPenaltyAddHistory(e, t) {
|
|
414
|
+
t[0] == 0 && (e += this.size), t.pop(), t.unshift(e);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
t.MIN_VERSION = 1, t.MAX_VERSION = 40, t.PENALTY_N1 = 3, t.PENALTY_N2 = 3, t.PENALTY_N3 = 40, t.PENALTY_N4 = 10, t.ECC_CODEWORDS_PER_BLOCK = [
|
|
418
|
+
[
|
|
419
|
+
-1,
|
|
420
|
+
7,
|
|
421
|
+
10,
|
|
422
|
+
15,
|
|
423
|
+
20,
|
|
424
|
+
26,
|
|
425
|
+
18,
|
|
426
|
+
20,
|
|
427
|
+
24,
|
|
428
|
+
30,
|
|
429
|
+
18,
|
|
430
|
+
20,
|
|
431
|
+
24,
|
|
432
|
+
26,
|
|
433
|
+
30,
|
|
434
|
+
22,
|
|
435
|
+
24,
|
|
436
|
+
28,
|
|
437
|
+
30,
|
|
438
|
+
28,
|
|
439
|
+
28,
|
|
440
|
+
28,
|
|
441
|
+
28,
|
|
442
|
+
30,
|
|
443
|
+
30,
|
|
444
|
+
26,
|
|
445
|
+
28,
|
|
446
|
+
30,
|
|
447
|
+
30,
|
|
448
|
+
30,
|
|
449
|
+
30,
|
|
450
|
+
30,
|
|
451
|
+
30,
|
|
452
|
+
30,
|
|
453
|
+
30,
|
|
454
|
+
30,
|
|
455
|
+
30,
|
|
456
|
+
30,
|
|
457
|
+
30,
|
|
458
|
+
30,
|
|
459
|
+
30
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
-1,
|
|
463
|
+
10,
|
|
464
|
+
16,
|
|
465
|
+
26,
|
|
466
|
+
18,
|
|
467
|
+
24,
|
|
468
|
+
16,
|
|
469
|
+
18,
|
|
470
|
+
22,
|
|
471
|
+
22,
|
|
472
|
+
26,
|
|
473
|
+
30,
|
|
474
|
+
22,
|
|
475
|
+
22,
|
|
476
|
+
24,
|
|
477
|
+
24,
|
|
478
|
+
28,
|
|
479
|
+
28,
|
|
480
|
+
26,
|
|
481
|
+
26,
|
|
482
|
+
26,
|
|
483
|
+
26,
|
|
484
|
+
28,
|
|
485
|
+
28,
|
|
486
|
+
28,
|
|
487
|
+
28,
|
|
488
|
+
28,
|
|
489
|
+
28,
|
|
490
|
+
28,
|
|
491
|
+
28,
|
|
492
|
+
28,
|
|
493
|
+
28,
|
|
494
|
+
28,
|
|
495
|
+
28,
|
|
496
|
+
28,
|
|
497
|
+
28,
|
|
498
|
+
28,
|
|
499
|
+
28,
|
|
500
|
+
28,
|
|
501
|
+
28,
|
|
502
|
+
28
|
|
503
|
+
],
|
|
504
|
+
[
|
|
505
|
+
-1,
|
|
506
|
+
13,
|
|
507
|
+
22,
|
|
508
|
+
18,
|
|
509
|
+
26,
|
|
510
|
+
18,
|
|
511
|
+
24,
|
|
512
|
+
18,
|
|
513
|
+
22,
|
|
514
|
+
20,
|
|
515
|
+
24,
|
|
516
|
+
28,
|
|
517
|
+
26,
|
|
518
|
+
24,
|
|
519
|
+
20,
|
|
520
|
+
30,
|
|
521
|
+
24,
|
|
522
|
+
28,
|
|
523
|
+
28,
|
|
524
|
+
26,
|
|
525
|
+
30,
|
|
526
|
+
28,
|
|
527
|
+
30,
|
|
528
|
+
30,
|
|
529
|
+
30,
|
|
530
|
+
30,
|
|
531
|
+
28,
|
|
532
|
+
30,
|
|
533
|
+
30,
|
|
534
|
+
30,
|
|
535
|
+
30,
|
|
536
|
+
30,
|
|
537
|
+
30,
|
|
538
|
+
30,
|
|
539
|
+
30,
|
|
540
|
+
30,
|
|
541
|
+
30,
|
|
542
|
+
30,
|
|
543
|
+
30,
|
|
544
|
+
30,
|
|
545
|
+
30
|
|
546
|
+
],
|
|
547
|
+
[
|
|
548
|
+
-1,
|
|
549
|
+
17,
|
|
550
|
+
28,
|
|
551
|
+
22,
|
|
552
|
+
16,
|
|
553
|
+
22,
|
|
554
|
+
28,
|
|
555
|
+
26,
|
|
556
|
+
26,
|
|
557
|
+
24,
|
|
558
|
+
28,
|
|
559
|
+
24,
|
|
560
|
+
28,
|
|
561
|
+
22,
|
|
562
|
+
24,
|
|
563
|
+
24,
|
|
564
|
+
30,
|
|
565
|
+
28,
|
|
566
|
+
28,
|
|
567
|
+
26,
|
|
568
|
+
28,
|
|
569
|
+
30,
|
|
570
|
+
24,
|
|
571
|
+
30,
|
|
572
|
+
30,
|
|
573
|
+
30,
|
|
574
|
+
30,
|
|
575
|
+
30,
|
|
576
|
+
30,
|
|
577
|
+
30,
|
|
578
|
+
30,
|
|
579
|
+
30,
|
|
580
|
+
30,
|
|
581
|
+
30,
|
|
582
|
+
30,
|
|
583
|
+
30,
|
|
584
|
+
30,
|
|
585
|
+
30,
|
|
586
|
+
30,
|
|
587
|
+
30,
|
|
588
|
+
30
|
|
589
|
+
]
|
|
590
|
+
], t.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
591
|
+
[
|
|
592
|
+
-1,
|
|
593
|
+
1,
|
|
594
|
+
1,
|
|
595
|
+
1,
|
|
596
|
+
1,
|
|
597
|
+
1,
|
|
598
|
+
2,
|
|
599
|
+
2,
|
|
600
|
+
2,
|
|
601
|
+
2,
|
|
602
|
+
4,
|
|
603
|
+
4,
|
|
604
|
+
4,
|
|
605
|
+
4,
|
|
606
|
+
4,
|
|
607
|
+
6,
|
|
608
|
+
6,
|
|
609
|
+
6,
|
|
610
|
+
6,
|
|
611
|
+
7,
|
|
612
|
+
8,
|
|
613
|
+
8,
|
|
614
|
+
9,
|
|
615
|
+
9,
|
|
616
|
+
10,
|
|
617
|
+
12,
|
|
618
|
+
12,
|
|
619
|
+
12,
|
|
620
|
+
13,
|
|
621
|
+
14,
|
|
622
|
+
15,
|
|
623
|
+
16,
|
|
624
|
+
17,
|
|
625
|
+
18,
|
|
626
|
+
19,
|
|
627
|
+
19,
|
|
628
|
+
20,
|
|
629
|
+
21,
|
|
630
|
+
22,
|
|
631
|
+
24,
|
|
632
|
+
25
|
|
633
|
+
],
|
|
634
|
+
[
|
|
635
|
+
-1,
|
|
636
|
+
1,
|
|
637
|
+
1,
|
|
638
|
+
1,
|
|
639
|
+
2,
|
|
640
|
+
2,
|
|
641
|
+
4,
|
|
642
|
+
4,
|
|
643
|
+
4,
|
|
644
|
+
5,
|
|
645
|
+
5,
|
|
646
|
+
5,
|
|
647
|
+
8,
|
|
648
|
+
9,
|
|
649
|
+
9,
|
|
650
|
+
10,
|
|
651
|
+
10,
|
|
652
|
+
11,
|
|
653
|
+
13,
|
|
654
|
+
14,
|
|
655
|
+
16,
|
|
656
|
+
17,
|
|
657
|
+
17,
|
|
658
|
+
18,
|
|
659
|
+
20,
|
|
660
|
+
21,
|
|
661
|
+
23,
|
|
662
|
+
25,
|
|
663
|
+
26,
|
|
664
|
+
28,
|
|
665
|
+
29,
|
|
666
|
+
31,
|
|
667
|
+
33,
|
|
668
|
+
35,
|
|
669
|
+
37,
|
|
670
|
+
38,
|
|
671
|
+
40,
|
|
672
|
+
43,
|
|
673
|
+
45,
|
|
674
|
+
47,
|
|
675
|
+
49
|
|
676
|
+
],
|
|
677
|
+
[
|
|
678
|
+
-1,
|
|
679
|
+
1,
|
|
680
|
+
1,
|
|
681
|
+
2,
|
|
682
|
+
2,
|
|
683
|
+
4,
|
|
684
|
+
4,
|
|
685
|
+
6,
|
|
686
|
+
6,
|
|
687
|
+
8,
|
|
688
|
+
8,
|
|
689
|
+
8,
|
|
690
|
+
10,
|
|
691
|
+
12,
|
|
692
|
+
16,
|
|
693
|
+
12,
|
|
694
|
+
17,
|
|
695
|
+
16,
|
|
696
|
+
18,
|
|
697
|
+
21,
|
|
698
|
+
20,
|
|
699
|
+
23,
|
|
700
|
+
23,
|
|
701
|
+
25,
|
|
702
|
+
27,
|
|
703
|
+
29,
|
|
704
|
+
34,
|
|
705
|
+
34,
|
|
706
|
+
35,
|
|
707
|
+
38,
|
|
708
|
+
40,
|
|
709
|
+
43,
|
|
710
|
+
45,
|
|
711
|
+
48,
|
|
712
|
+
51,
|
|
713
|
+
53,
|
|
714
|
+
56,
|
|
715
|
+
59,
|
|
716
|
+
62,
|
|
717
|
+
65,
|
|
718
|
+
68
|
|
719
|
+
],
|
|
720
|
+
[
|
|
721
|
+
-1,
|
|
722
|
+
1,
|
|
723
|
+
1,
|
|
724
|
+
2,
|
|
725
|
+
4,
|
|
726
|
+
4,
|
|
727
|
+
4,
|
|
728
|
+
5,
|
|
729
|
+
6,
|
|
730
|
+
8,
|
|
731
|
+
8,
|
|
732
|
+
11,
|
|
733
|
+
11,
|
|
734
|
+
16,
|
|
735
|
+
16,
|
|
736
|
+
18,
|
|
737
|
+
16,
|
|
738
|
+
19,
|
|
739
|
+
21,
|
|
740
|
+
25,
|
|
741
|
+
25,
|
|
742
|
+
25,
|
|
743
|
+
34,
|
|
744
|
+
30,
|
|
745
|
+
32,
|
|
746
|
+
35,
|
|
747
|
+
37,
|
|
748
|
+
40,
|
|
749
|
+
42,
|
|
750
|
+
45,
|
|
751
|
+
48,
|
|
752
|
+
51,
|
|
753
|
+
54,
|
|
754
|
+
57,
|
|
755
|
+
60,
|
|
756
|
+
63,
|
|
757
|
+
66,
|
|
758
|
+
70,
|
|
759
|
+
74,
|
|
760
|
+
77,
|
|
761
|
+
81
|
|
762
|
+
]
|
|
763
|
+
], e.QrCode = t;
|
|
764
|
+
function n(e, t, n) {
|
|
765
|
+
if (t < 0 || t > 31 || e >>> t) throw RangeError("Value out of range");
|
|
766
|
+
for (let r = t - 1; r >= 0; r--) n.push(e >>> r & 1);
|
|
767
|
+
}
|
|
768
|
+
function r(e, t) {
|
|
769
|
+
return (e >>> t & 1) != 0;
|
|
770
|
+
}
|
|
771
|
+
function i(e) {
|
|
772
|
+
if (!e) throw Error("Assertion error");
|
|
773
|
+
}
|
|
774
|
+
let a = class e {
|
|
775
|
+
constructor(e, t, n) {
|
|
776
|
+
if (this.mode = e, this.numChars = t, this.bitData = n, t < 0) throw RangeError("Invalid argument");
|
|
777
|
+
this.bitData = n.slice();
|
|
778
|
+
}
|
|
779
|
+
static makeBytes(t) {
|
|
780
|
+
let r = [];
|
|
781
|
+
for (let e of t) n(e, 8, r);
|
|
782
|
+
return new e(e.Mode.BYTE, t.length, r);
|
|
783
|
+
}
|
|
784
|
+
static makeNumeric(t) {
|
|
785
|
+
if (!e.isNumeric(t)) throw RangeError("String contains non-numeric characters");
|
|
786
|
+
let r = [];
|
|
787
|
+
for (let e = 0; e < t.length;) {
|
|
788
|
+
let i = Math.min(t.length - e, 3);
|
|
789
|
+
n(parseInt(t.substring(e, e + i), 10), i * 3 + 1, r), e += i;
|
|
790
|
+
}
|
|
791
|
+
return new e(e.Mode.NUMERIC, t.length, r);
|
|
792
|
+
}
|
|
793
|
+
static makeAlphanumeric(t) {
|
|
794
|
+
if (!e.isAlphanumeric(t)) throw RangeError("String contains unencodable characters in alphanumeric mode");
|
|
795
|
+
let r = [], i;
|
|
796
|
+
for (i = 0; i + 2 <= t.length; i += 2) {
|
|
797
|
+
let a = e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)) * 45;
|
|
798
|
+
a += e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i + 1)), n(a, 11, r);
|
|
799
|
+
}
|
|
800
|
+
return i < t.length && n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)), 6, r), new e(e.Mode.ALPHANUMERIC, t.length, r);
|
|
801
|
+
}
|
|
802
|
+
static makeSegments(t) {
|
|
803
|
+
return t == "" ? [] : e.isNumeric(t) ? [e.makeNumeric(t)] : e.isAlphanumeric(t) ? [e.makeAlphanumeric(t)] : [e.makeBytes(e.toUtf8ByteArray(t))];
|
|
804
|
+
}
|
|
805
|
+
static makeEci(t) {
|
|
806
|
+
let r = [];
|
|
807
|
+
if (t < 0) throw RangeError("ECI assignment value out of range");
|
|
808
|
+
if (t < 128) n(t, 8, r);
|
|
809
|
+
else if (t < 16384) n(2, 2, r), n(t, 14, r);
|
|
810
|
+
else if (t < 1e6) n(6, 3, r), n(t, 21, r);
|
|
811
|
+
else throw RangeError("ECI assignment value out of range");
|
|
812
|
+
return new e(e.Mode.ECI, 0, r);
|
|
813
|
+
}
|
|
814
|
+
static isNumeric(t) {
|
|
815
|
+
return e.NUMERIC_REGEX.test(t);
|
|
816
|
+
}
|
|
817
|
+
static isAlphanumeric(t) {
|
|
818
|
+
return e.ALPHANUMERIC_REGEX.test(t);
|
|
819
|
+
}
|
|
820
|
+
getData() {
|
|
821
|
+
return this.bitData.slice();
|
|
822
|
+
}
|
|
823
|
+
static getTotalBits(e, t) {
|
|
824
|
+
let n = 0;
|
|
825
|
+
for (let r of e) {
|
|
826
|
+
let e = r.mode.numCharCountBits(t);
|
|
827
|
+
if (r.numChars >= 1 << e) return Infinity;
|
|
828
|
+
n += 4 + e + r.bitData.length;
|
|
829
|
+
}
|
|
830
|
+
return n;
|
|
831
|
+
}
|
|
832
|
+
static toUtf8ByteArray(e) {
|
|
833
|
+
e = encodeURI(e);
|
|
834
|
+
let t = [];
|
|
835
|
+
for (let n = 0; n < e.length; n++) e.charAt(n) == "%" ? (t.push(parseInt(e.substring(n + 1, n + 3), 16)), n += 2) : t.push(e.charCodeAt(n));
|
|
836
|
+
return t;
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
840
|
+
let o = a;
|
|
841
|
+
e.QrSegment = a;
|
|
842
|
+
})(Se ||= {}), ((e) => {
|
|
843
|
+
((e) => {
|
|
844
|
+
let t = class {
|
|
845
|
+
constructor(e, t) {
|
|
846
|
+
this.ordinal = e, this.formatBits = t;
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), e.Ecc = t;
|
|
850
|
+
})(e.QrCode ||= {});
|
|
851
|
+
})(Se ||= {}), ((e) => {
|
|
852
|
+
((e) => {
|
|
853
|
+
let t = class {
|
|
854
|
+
constructor(e, t) {
|
|
855
|
+
this.modeBits = e, this.numBitsCharCount = t;
|
|
856
|
+
}
|
|
857
|
+
numCharCountBits(e) {
|
|
858
|
+
return this.numBitsCharCount[Math.floor((e + 7) / 17)];
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
t.NUMERIC = new t(1, [
|
|
862
|
+
10,
|
|
863
|
+
12,
|
|
864
|
+
14
|
|
865
|
+
]), t.ALPHANUMERIC = new t(2, [
|
|
866
|
+
9,
|
|
867
|
+
11,
|
|
868
|
+
13
|
|
869
|
+
]), t.BYTE = new t(4, [
|
|
870
|
+
8,
|
|
871
|
+
16,
|
|
872
|
+
16
|
|
873
|
+
]), t.KANJI = new t(8, [
|
|
874
|
+
8,
|
|
875
|
+
10,
|
|
876
|
+
12
|
|
877
|
+
]), t.ECI = new t(7, [
|
|
878
|
+
0,
|
|
879
|
+
0,
|
|
880
|
+
0
|
|
881
|
+
]), e.Mode = t;
|
|
882
|
+
})(e.QrSegment ||= {});
|
|
883
|
+
})(Se ||= {});
|
|
884
|
+
var $ = Se, Ce = {
|
|
885
|
+
L: $.QrCode.Ecc.LOW,
|
|
886
|
+
M: $.QrCode.Ecc.MEDIUM,
|
|
887
|
+
Q: $.QrCode.Ecc.QUARTILE,
|
|
888
|
+
H: $.QrCode.Ecc.HIGH
|
|
889
|
+
}, we = 128, Te = "L", Ee = "#FFFFFF", De = "#000000", Oe = !1, ke = 1, Ae = 4, je = 0, Me = .1;
|
|
890
|
+
function Ne(e, t = 0) {
|
|
891
|
+
let n = [];
|
|
892
|
+
return e.forEach(function(e, r) {
|
|
893
|
+
let i = null;
|
|
894
|
+
e.forEach(function(a, o) {
|
|
895
|
+
if (!a && i !== null) {
|
|
896
|
+
n.push(`M${i + t} ${r + t}h${o - i}v1H${i + t}z`), i = null;
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
if (o === e.length - 1) {
|
|
900
|
+
if (!a) return;
|
|
901
|
+
i === null ? n.push(`M${o + t},${r + t} h1v1H${o + t}z`) : n.push(`M${i + t},${r + t} h${o + 1 - i}v1H${i + t}z`);
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
a && i === null && (i = o);
|
|
905
|
+
});
|
|
906
|
+
}), n.join("");
|
|
749
907
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
908
|
+
function Pe(e, t) {
|
|
909
|
+
return e.slice().map((e, n) => n < t.y || n >= t.y + t.h ? e : e.map((e, n) => n < t.x || n >= t.x + t.w ? e : !1));
|
|
752
910
|
}
|
|
753
|
-
function
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
911
|
+
function Fe(e, t, n, r) {
|
|
912
|
+
if (r == null) return null;
|
|
913
|
+
let i = e.length + n * 2, a = Math.floor(t * Me), o = i / t, s = (r.width || a) * o, c = (r.height || a) * o, l = r.x == null ? e.length / 2 - s / 2 : r.x * o, u = r.y == null ? e.length / 2 - c / 2 : r.y * o, d = r.opacity == null ? 1 : r.opacity, f = null;
|
|
914
|
+
if (r.excavate) {
|
|
915
|
+
let e = Math.floor(l), t = Math.floor(u);
|
|
916
|
+
f = {
|
|
917
|
+
x: e,
|
|
918
|
+
y: t,
|
|
919
|
+
w: Math.ceil(s + l - e),
|
|
920
|
+
h: Math.ceil(c + u - t)
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
let p = r.crossOrigin;
|
|
924
|
+
return {
|
|
925
|
+
x: l,
|
|
926
|
+
y: u,
|
|
927
|
+
h: c,
|
|
928
|
+
w: s,
|
|
929
|
+
excavation: f,
|
|
930
|
+
opacity: d,
|
|
931
|
+
crossOrigin: p
|
|
932
|
+
};
|
|
764
933
|
}
|
|
765
|
-
function
|
|
766
|
-
|
|
934
|
+
function Ie(e, t) {
|
|
935
|
+
return t == null ? e ? Ae : je : Math.max(Math.floor(t), 0);
|
|
767
936
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
}) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
margin: d,
|
|
800
|
-
numCells: E,
|
|
801
|
-
calculatedImageSettings: m
|
|
802
|
-
};
|
|
803
|
-
}, [e, C, c, a, u]);
|
|
804
|
-
return {
|
|
805
|
-
qrcode: e,
|
|
806
|
-
margin: n,
|
|
807
|
-
cells: o,
|
|
808
|
-
numCells: i,
|
|
809
|
-
calculatedImageSettings: l
|
|
810
|
-
};
|
|
937
|
+
function Le({ value: e, level: n, minVersion: r, includeMargin: i, marginSize: a, imageSettings: o, size: s, boostLevel: c }) {
|
|
938
|
+
let l = t.useMemo(() => {
|
|
939
|
+
let t = (Array.isArray(e) ? e : [e]).reduce((e, t) => (e.push(...$.QrSegment.makeSegments(t)), e), []);
|
|
940
|
+
return $.QrCode.encodeSegments(t, Ce[n], r, void 0, void 0, c);
|
|
941
|
+
}, [
|
|
942
|
+
e,
|
|
943
|
+
n,
|
|
944
|
+
r,
|
|
945
|
+
c
|
|
946
|
+
]), { cells: u, margin: d, numCells: f, calculatedImageSettings: p } = t.useMemo(() => {
|
|
947
|
+
let e = l.getModules(), t = Ie(i, a);
|
|
948
|
+
return {
|
|
949
|
+
cells: e,
|
|
950
|
+
margin: t,
|
|
951
|
+
numCells: e.length + t * 2,
|
|
952
|
+
calculatedImageSettings: Fe(e, s, t, o)
|
|
953
|
+
};
|
|
954
|
+
}, [
|
|
955
|
+
l,
|
|
956
|
+
s,
|
|
957
|
+
o,
|
|
958
|
+
i,
|
|
959
|
+
a
|
|
960
|
+
]);
|
|
961
|
+
return {
|
|
962
|
+
qrcode: l,
|
|
963
|
+
margin: d,
|
|
964
|
+
cells: u,
|
|
965
|
+
numCells: f,
|
|
966
|
+
calculatedImageSettings: p
|
|
967
|
+
};
|
|
811
968
|
}
|
|
812
|
-
var
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
);
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
},
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
/* @__PURE__ */ h(
|
|
1136
|
-
"h3",
|
|
1137
|
-
{
|
|
1138
|
-
className: "min-w-0 flex-1 truncate",
|
|
1139
|
-
title: t?.name,
|
|
1140
|
-
children: t?.name
|
|
1141
|
-
}
|
|
1142
|
-
)
|
|
1143
|
-
] }) : null,
|
|
1144
|
-
/* @__PURE__ */ b("div", { className: "share-info flex", children: [
|
|
1145
|
-
/* @__PURE__ */ h("p", { className: "share-info-title body-1 mr-1 text-neutrals-800", children: C ?? "Link expiration date:" }),
|
|
1146
|
-
/* @__PURE__ */ b("h3", { children: [
|
|
1147
|
-
"3 ",
|
|
1148
|
-
p ?? "days"
|
|
1149
|
-
] })
|
|
1150
|
-
] }),
|
|
1151
|
-
/* @__PURE__ */ h(
|
|
1152
|
-
Ye,
|
|
1153
|
-
{
|
|
1154
|
-
className: "min-h-[200px] self-center rounded border border-neutrals-600 p-2",
|
|
1155
|
-
value: X,
|
|
1156
|
-
size: 200
|
|
1157
|
-
}
|
|
1158
|
-
),
|
|
1159
|
-
/* @__PURE__ */ h("p", { className: "body-2 text-neutrals-1000", children: f ?? "Your name, special instructions, and any messages you add after sharing remain confidential." }),
|
|
1160
|
-
/* @__PURE__ */ h(
|
|
1161
|
-
Me,
|
|
1162
|
-
{
|
|
1163
|
-
containerClasses: "share-input-container",
|
|
1164
|
-
cssClass: "share-input",
|
|
1165
|
-
readonly: !0,
|
|
1166
|
-
placeholder: X,
|
|
1167
|
-
value: X,
|
|
1168
|
-
inputId: "conversationLink",
|
|
1169
|
-
iconAfterInput: je()
|
|
1170
|
-
}
|
|
1171
|
-
)
|
|
1172
|
-
] }) : /* @__PURE__ */ h("div", { className: "flex items-center justify-center p-6", children: /* @__PURE__ */ h(be, {}) }),
|
|
1173
|
-
T ? t && _ ? /* @__PURE__ */ h("div", { className: "remove-access", children: /* @__PURE__ */ h(
|
|
1174
|
-
W,
|
|
1175
|
-
{
|
|
1176
|
-
title: d ?? "Remove access to all users",
|
|
1177
|
-
buttonClassName: "remove-access-button py-3 px-4",
|
|
1178
|
-
isSmallButton: !0,
|
|
1179
|
-
disabled: R,
|
|
1180
|
-
onClick: he
|
|
1181
|
-
}
|
|
1182
|
-
) }) : /* @__PURE__ */ h("p", { className: "body-2 share-footer text-neutrals-800", children: o ?? "This chat has not been shared with anyone yet." }) : /* @__PURE__ */ h("div", {})
|
|
1183
|
-
]
|
|
1184
|
-
}
|
|
1185
|
-
);
|
|
1186
|
-
}, Qt = ({
|
|
1187
|
-
conversation: t,
|
|
1188
|
-
onCloseModal: s,
|
|
1189
|
-
renameConversation: r,
|
|
1190
|
-
locale: a
|
|
1191
|
-
}) => {
|
|
1192
|
-
const { titles: u, disableModalDividers: c, isSmallModalButton: C } = K(), [p, e] = O(t?.name || ""), o = (i) => {
|
|
1193
|
-
e(i);
|
|
1194
|
-
}, n = () => {
|
|
1195
|
-
const i = `${t?.folderId}/${encodeURIComponent(ve(p))}-${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1196
|
-
r(
|
|
1197
|
-
`conversations/${t.id}`,
|
|
1198
|
-
`conversations/${i}`
|
|
1199
|
-
);
|
|
1200
|
-
};
|
|
1201
|
-
return /* @__PURE__ */ b(
|
|
1202
|
-
ce,
|
|
1203
|
-
{
|
|
1204
|
-
heading: u?.renameTitle ?? "Rename conversation",
|
|
1205
|
-
portalId: "rename-conversation",
|
|
1206
|
-
containerClassName: "rename-conversation-popup",
|
|
1207
|
-
size: ue.SM,
|
|
1208
|
-
dividers: !c,
|
|
1209
|
-
onClose: s,
|
|
1210
|
-
closeButtonTitle: u?.close ?? "Cancel",
|
|
1211
|
-
children: [
|
|
1212
|
-
/* @__PURE__ */ h("div", { className: "px-6 py-4 sm:px-0", lang: a, children: /* @__PURE__ */ h(
|
|
1213
|
-
et,
|
|
1214
|
-
{
|
|
1215
|
-
inputId: "rename",
|
|
1216
|
-
value: p,
|
|
1217
|
-
onChange: o,
|
|
1218
|
-
cssClass: "w-full"
|
|
1219
|
-
}
|
|
1220
|
-
) }),
|
|
1221
|
-
/* @__PURE__ */ b("div", { className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3", children: [
|
|
1222
|
-
/* @__PURE__ */ h(
|
|
1223
|
-
W,
|
|
1224
|
-
{
|
|
1225
|
-
buttonClassName: "cancel-button",
|
|
1226
|
-
title: u?.cancel ?? "Cancel",
|
|
1227
|
-
isSmallButton: C,
|
|
1228
|
-
onClick: (i) => {
|
|
1229
|
-
i.stopPropagation(), s();
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
),
|
|
1233
|
-
/* @__PURE__ */ h(
|
|
1234
|
-
W,
|
|
1235
|
-
{
|
|
1236
|
-
buttonClassName: "text-button-primary text-button-primary",
|
|
1237
|
-
title: u?.save ?? "Rename",
|
|
1238
|
-
isSmallButton: C,
|
|
1239
|
-
disabled: !p,
|
|
1240
|
-
onClick: (i) => {
|
|
1241
|
-
i.stopPropagation(), n();
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
)
|
|
1245
|
-
] })
|
|
1246
|
-
]
|
|
1247
|
-
}
|
|
1248
|
-
);
|
|
1249
|
-
}, Qe = Re(null);
|
|
1250
|
-
function Gt({
|
|
1251
|
-
children: t,
|
|
1252
|
-
value: s
|
|
1253
|
-
}) {
|
|
1254
|
-
return /* @__PURE__ */ h(Qe.Provider, { value: s, children: t });
|
|
969
|
+
var Re = function() {
|
|
970
|
+
try {
|
|
971
|
+
new Path2D().addPath(new Path2D());
|
|
972
|
+
} catch {
|
|
973
|
+
return !1;
|
|
974
|
+
}
|
|
975
|
+
return !0;
|
|
976
|
+
}(), ze = t.forwardRef(function(e, n) {
|
|
977
|
+
let r = e, { value: i, size: a = we, level: o = Te, bgColor: s = Ee, fgColor: c = De, includeMargin: l = Oe, minVersion: u = ke, boostLevel: d, marginSize: f, imageSettings: p } = r, m = xe(r, [
|
|
978
|
+
"value",
|
|
979
|
+
"size",
|
|
980
|
+
"level",
|
|
981
|
+
"bgColor",
|
|
982
|
+
"fgColor",
|
|
983
|
+
"includeMargin",
|
|
984
|
+
"minVersion",
|
|
985
|
+
"boostLevel",
|
|
986
|
+
"marginSize",
|
|
987
|
+
"imageSettings"
|
|
988
|
+
]), { style: h } = m, g = xe(m, ["style"]), _ = p?.src, v = t.useRef(null), y = t.useRef(null), b = t.useCallback((e) => {
|
|
989
|
+
v.current = e, typeof n == "function" ? n(e) : n && (n.current = e);
|
|
990
|
+
}, [n]), [x, S] = t.useState(!1), { margin: C, cells: w, numCells: T, calculatedImageSettings: E } = Le({
|
|
991
|
+
value: i,
|
|
992
|
+
level: o,
|
|
993
|
+
minVersion: u,
|
|
994
|
+
boostLevel: d,
|
|
995
|
+
includeMargin: l,
|
|
996
|
+
marginSize: f,
|
|
997
|
+
imageSettings: p,
|
|
998
|
+
size: a
|
|
999
|
+
});
|
|
1000
|
+
t.useEffect(() => {
|
|
1001
|
+
if (v.current != null) {
|
|
1002
|
+
let e = v.current, t = e.getContext("2d");
|
|
1003
|
+
if (!t) return;
|
|
1004
|
+
let n = w, r = y.current, i = E != null && r !== null && r.complete && r.naturalHeight !== 0 && r.naturalWidth !== 0;
|
|
1005
|
+
i && E.excavation != null && (n = Pe(w, E.excavation));
|
|
1006
|
+
let o = window.devicePixelRatio || 1;
|
|
1007
|
+
e.height = e.width = a * o;
|
|
1008
|
+
let l = a / T * o;
|
|
1009
|
+
t.scale(l, l), t.fillStyle = s, t.fillRect(0, 0, T, T), t.fillStyle = c, Re ? t.fill(new Path2D(Ne(n, C))) : w.forEach(function(e, n) {
|
|
1010
|
+
e.forEach(function(e, r) {
|
|
1011
|
+
e && t.fillRect(r + C, n + C, 1, 1);
|
|
1012
|
+
});
|
|
1013
|
+
}), E && (t.globalAlpha = E.opacity), i && t.drawImage(r, E.x + C, E.y + C, E.w, E.h);
|
|
1014
|
+
}
|
|
1015
|
+
}), t.useEffect(() => {
|
|
1016
|
+
S(!1);
|
|
1017
|
+
}, [_]);
|
|
1018
|
+
let D = be({
|
|
1019
|
+
height: a,
|
|
1020
|
+
width: a
|
|
1021
|
+
}, h), O = null;
|
|
1022
|
+
return _ != null && (O = /* @__PURE__ */ t.createElement("img", {
|
|
1023
|
+
src: _,
|
|
1024
|
+
key: _,
|
|
1025
|
+
style: { display: "none" },
|
|
1026
|
+
onLoad: () => {
|
|
1027
|
+
S(!0);
|
|
1028
|
+
},
|
|
1029
|
+
ref: y,
|
|
1030
|
+
crossOrigin: E?.crossOrigin
|
|
1031
|
+
})), /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("canvas", be({
|
|
1032
|
+
style: D,
|
|
1033
|
+
height: a,
|
|
1034
|
+
width: a,
|
|
1035
|
+
ref: b,
|
|
1036
|
+
role: "img"
|
|
1037
|
+
}, g)), O);
|
|
1038
|
+
});
|
|
1039
|
+
ze.displayName = "QRCodeCanvas";
|
|
1040
|
+
var Be = t.forwardRef(function(e, n) {
|
|
1041
|
+
let r = e, { value: i, size: a = we, level: o = Te, bgColor: s = Ee, fgColor: c = De, includeMargin: l = Oe, minVersion: u = ke, boostLevel: d, title: f, marginSize: p, imageSettings: m } = r, h = xe(r, [
|
|
1042
|
+
"value",
|
|
1043
|
+
"size",
|
|
1044
|
+
"level",
|
|
1045
|
+
"bgColor",
|
|
1046
|
+
"fgColor",
|
|
1047
|
+
"includeMargin",
|
|
1048
|
+
"minVersion",
|
|
1049
|
+
"boostLevel",
|
|
1050
|
+
"title",
|
|
1051
|
+
"marginSize",
|
|
1052
|
+
"imageSettings"
|
|
1053
|
+
]), { margin: g, cells: _, numCells: v, calculatedImageSettings: y } = Le({
|
|
1054
|
+
value: i,
|
|
1055
|
+
level: o,
|
|
1056
|
+
minVersion: u,
|
|
1057
|
+
boostLevel: d,
|
|
1058
|
+
includeMargin: l,
|
|
1059
|
+
marginSize: p,
|
|
1060
|
+
imageSettings: m,
|
|
1061
|
+
size: a
|
|
1062
|
+
}), b = _, x = null;
|
|
1063
|
+
m != null && y != null && (y.excavation != null && (b = Pe(_, y.excavation)), x = /* @__PURE__ */ t.createElement("image", {
|
|
1064
|
+
href: m.src,
|
|
1065
|
+
height: y.h,
|
|
1066
|
+
width: y.w,
|
|
1067
|
+
x: y.x + g,
|
|
1068
|
+
y: y.y + g,
|
|
1069
|
+
preserveAspectRatio: "none",
|
|
1070
|
+
opacity: y.opacity,
|
|
1071
|
+
crossOrigin: y.crossOrigin
|
|
1072
|
+
}));
|
|
1073
|
+
let S = Ne(b, g);
|
|
1074
|
+
return /* @__PURE__ */ t.createElement("svg", be({
|
|
1075
|
+
height: a,
|
|
1076
|
+
width: a,
|
|
1077
|
+
viewBox: `0 0 ${v} ${v}`,
|
|
1078
|
+
ref: n,
|
|
1079
|
+
role: "img"
|
|
1080
|
+
}, h), !!f && /* @__PURE__ */ t.createElement("title", null, f), /* @__PURE__ */ t.createElement("path", {
|
|
1081
|
+
fill: s,
|
|
1082
|
+
d: `M0,0 h${v}v${v}H0z`,
|
|
1083
|
+
shapeRendering: "crispEdges"
|
|
1084
|
+
}), /* @__PURE__ */ t.createElement("path", {
|
|
1085
|
+
fill: c,
|
|
1086
|
+
d: S,
|
|
1087
|
+
shapeRendering: "crispEdges"
|
|
1088
|
+
}), x);
|
|
1089
|
+
});
|
|
1090
|
+
Be.displayName = "QRCodeSVG";
|
|
1091
|
+
//#endregion
|
|
1092
|
+
//#region libs/share-conversation/src/utils/shared-conversations.ts
|
|
1093
|
+
var Ve = (e, t) => ({
|
|
1094
|
+
invitationType: te.LINK,
|
|
1095
|
+
resources: [{ url: `conversations/${encodeURI(e)}` }, ...t]
|
|
1096
|
+
}), He = (e) => `/${ee}/${e?.invitationLink?.split("/").at(-1) || ""}`, Ue = (e, t) => t?.find((t) => {
|
|
1097
|
+
let n = e?.id?.split("/")?.pop(), r = t?.url?.split("/")?.pop() || "";
|
|
1098
|
+
return r === n || decodeURI(r) === n;
|
|
1099
|
+
}), We = (e) => (e?.messages?.filter((e) => !!e?.custom_content?.attachments))?.flatMap((e) => e?.custom_content?.attachments?.map((e) => ({ url: e?.url || "" })) || [])?.filter((e) => !!e?.url) || [], Ge = ({ conversation: e, locale: t, onCloseModal: n, modalDividers: i, getConversation: l, generateConversationLink: u, chatExpiration: d, chatExpirationDays: p, close: m, chatWarning: h, shareLink: v, shareCopyLink: S, shareCopiedLink: w, shareDescription: D, shareRemoveAccessToUsers: k, chatName: A, getSharedConversations: j, revokeSharedConversations: P, baseUrl: F, id: I, clientSharedPage: L, clientSharedProp: R, shareAlertMessage: te }) => {
|
|
1100
|
+
let [B, V] = c(null), [H, U] = c(), [re, W] = c(!1), [G, ie] = c(!1), [ae, oe] = c(), K = s(null), q = s(null), J = o(() => e?.id ? decodeURI(e.id) : I?.[0] && I?.[1] && t ? decodeURI(`${I[0]}/${t}/${I[1]}`) : null, [
|
|
1101
|
+
e?.id,
|
|
1102
|
+
I,
|
|
1103
|
+
t
|
|
1104
|
+
]), Y = o(() => {
|
|
1105
|
+
if (!B) return "";
|
|
1106
|
+
let e = F || window.location.origin;
|
|
1107
|
+
return F && F !== window.location.origin && L && R ? `${e}/${L}?${R}=${B.split(`/${ee}/`)?.[1]}` : `${e}/${t}${B}`;
|
|
1108
|
+
}, [
|
|
1109
|
+
F,
|
|
1110
|
+
B,
|
|
1111
|
+
t,
|
|
1112
|
+
L,
|
|
1113
|
+
R
|
|
1114
|
+
]), X = r(async (e) => {
|
|
1115
|
+
let t = await j?.(ne(z.OTHERS));
|
|
1116
|
+
if (t) return Ue({ id: e }, t.resources);
|
|
1117
|
+
}, [j]);
|
|
1118
|
+
a(() => {
|
|
1119
|
+
if (!J || K.current === J) return;
|
|
1120
|
+
K.current = J, W(!1), q.current?.abort();
|
|
1121
|
+
let e = new AbortController();
|
|
1122
|
+
return q.current = e, (async () => {
|
|
1123
|
+
try {
|
|
1124
|
+
let t = Ve(J, We(await l?.(J))), n = await u?.(t), r = await X(J);
|
|
1125
|
+
if (e.signal.aborted || !n) return;
|
|
1126
|
+
V(He(n)), U(r), W(!0);
|
|
1127
|
+
} catch (t) {
|
|
1128
|
+
if (e.signal.aborted) return;
|
|
1129
|
+
W(!1), console.error("Error sharing conversation", t);
|
|
1130
|
+
}
|
|
1131
|
+
})(), () => {
|
|
1132
|
+
e.abort(), K.current = null;
|
|
1133
|
+
};
|
|
1134
|
+
}, [
|
|
1135
|
+
J,
|
|
1136
|
+
u,
|
|
1137
|
+
l,
|
|
1138
|
+
X
|
|
1139
|
+
]);
|
|
1140
|
+
let se = r(() => {
|
|
1141
|
+
q.current?.abort(), K.current = null, n(), V(null), W(!1), ie(!1);
|
|
1142
|
+
}, [n]), ce = r(() => {
|
|
1143
|
+
ie(!0), navigator.clipboard.writeText(Y || "");
|
|
1144
|
+
}, [Y]), le = async () => {
|
|
1145
|
+
try {
|
|
1146
|
+
if (oe(!0), H && await P?.({ resources: [H] }), J) {
|
|
1147
|
+
let e = await X(J);
|
|
1148
|
+
q.current?.signal.aborted || U(e);
|
|
1149
|
+
}
|
|
1150
|
+
} catch (e) {
|
|
1151
|
+
console.error("Error revoking shared conversation", e);
|
|
1152
|
+
} finally {
|
|
1153
|
+
q.current?.signal.aborted || oe(!1);
|
|
1154
|
+
}
|
|
1155
|
+
}, ue = r(() => /* @__PURE__ */ M(f, {
|
|
1156
|
+
buttonClassName: G ? "text-button-secondary" : "text-button-primary",
|
|
1157
|
+
iconBefore: M(G ? T : E, {
|
|
1158
|
+
width: 20,
|
|
1159
|
+
height: 20
|
|
1160
|
+
}),
|
|
1161
|
+
title: G ? w ?? "Copied" : S ?? "Copy link",
|
|
1162
|
+
disabled: G,
|
|
1163
|
+
onClick: ce
|
|
1164
|
+
}), [
|
|
1165
|
+
G,
|
|
1166
|
+
ce,
|
|
1167
|
+
w,
|
|
1168
|
+
S
|
|
1169
|
+
]);
|
|
1170
|
+
return /* @__PURE__ */ N(C, {
|
|
1171
|
+
heading: v ?? "Share link",
|
|
1172
|
+
portalId: "share",
|
|
1173
|
+
size: x.SM,
|
|
1174
|
+
dividers: i,
|
|
1175
|
+
onClose: se,
|
|
1176
|
+
closeButtonTitle: m ?? "Close",
|
|
1177
|
+
children: [re ? /* @__PURE__ */ N("div", {
|
|
1178
|
+
className: "share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0",
|
|
1179
|
+
children: [
|
|
1180
|
+
te ? /* @__PURE__ */ M(g, {
|
|
1181
|
+
type: _.Note,
|
|
1182
|
+
icon: /* @__PURE__ */ M(O, {
|
|
1183
|
+
width: 16,
|
|
1184
|
+
height: 16
|
|
1185
|
+
}),
|
|
1186
|
+
children: te
|
|
1187
|
+
}) : null,
|
|
1188
|
+
e?.name ? /* @__PURE__ */ N("div", {
|
|
1189
|
+
className: "share-info flex w-full",
|
|
1190
|
+
children: [/* @__PURE__ */ M("p", {
|
|
1191
|
+
className: "share-info-title body-1 mr-1 text-neutrals-800",
|
|
1192
|
+
children: A ?? "Chat name:"
|
|
1193
|
+
}), /* @__PURE__ */ M("h3", {
|
|
1194
|
+
className: "min-w-0 flex-1 truncate",
|
|
1195
|
+
title: e?.name,
|
|
1196
|
+
children: e?.name
|
|
1197
|
+
})]
|
|
1198
|
+
}) : null,
|
|
1199
|
+
/* @__PURE__ */ N("div", {
|
|
1200
|
+
className: "share-info flex",
|
|
1201
|
+
children: [/* @__PURE__ */ M("p", {
|
|
1202
|
+
className: "share-info-title body-1 mr-1 text-neutrals-800",
|
|
1203
|
+
children: d ?? "Link expiration date:"
|
|
1204
|
+
}), /* @__PURE__ */ N("h3", { children: ["3 ", p ?? "days"] })]
|
|
1205
|
+
}),
|
|
1206
|
+
/* @__PURE__ */ M(Be, {
|
|
1207
|
+
className: "min-h-[200px] self-center rounded border border-neutrals-600 p-2",
|
|
1208
|
+
value: Y,
|
|
1209
|
+
size: 200
|
|
1210
|
+
}),
|
|
1211
|
+
/* @__PURE__ */ M("p", {
|
|
1212
|
+
className: "body-2 text-neutrals-1000",
|
|
1213
|
+
children: D ?? "Your name, special instructions, and any messages you add after sharing remain confidential."
|
|
1214
|
+
}),
|
|
1215
|
+
/* @__PURE__ */ M(y, {
|
|
1216
|
+
containerClasses: "share-input-container",
|
|
1217
|
+
cssClass: "share-input",
|
|
1218
|
+
readonly: !0,
|
|
1219
|
+
placeholder: Y,
|
|
1220
|
+
value: Y,
|
|
1221
|
+
inputId: "conversationLink",
|
|
1222
|
+
iconAfterInput: ue()
|
|
1223
|
+
})
|
|
1224
|
+
]
|
|
1225
|
+
}) : /* @__PURE__ */ M("div", {
|
|
1226
|
+
className: "flex items-center justify-center p-6",
|
|
1227
|
+
children: /* @__PURE__ */ M(b, {})
|
|
1228
|
+
}), re ? e && H ? /* @__PURE__ */ M("div", {
|
|
1229
|
+
className: "remove-access",
|
|
1230
|
+
children: /* @__PURE__ */ M(f, {
|
|
1231
|
+
title: k ?? "Remove access to all users",
|
|
1232
|
+
buttonClassName: "remove-access-button py-3 px-4",
|
|
1233
|
+
isSmallButton: !0,
|
|
1234
|
+
disabled: ae,
|
|
1235
|
+
onClick: le
|
|
1236
|
+
})
|
|
1237
|
+
}) : /* @__PURE__ */ M("p", {
|
|
1238
|
+
className: "body-2 share-footer text-neutrals-800",
|
|
1239
|
+
children: h ?? "This chat has not been shared with anyone yet."
|
|
1240
|
+
}) : /* @__PURE__ */ M("div", {})]
|
|
1241
|
+
});
|
|
1242
|
+
}, Ke = ({ conversation: e, onCloseModal: t, renameConversation: n, locale: r }) => {
|
|
1243
|
+
let { titles: i, disableModalDividers: a, isSmallModalButton: o } = Y(), [s, l] = c(e?.name || ""), u = (e) => {
|
|
1244
|
+
l(e);
|
|
1245
|
+
}, d = () => {
|
|
1246
|
+
let t = `${e?.folderId}/${encodeURIComponent(L(s))}-${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1247
|
+
n(`conversations/${e.id}`, `conversations/${t}`);
|
|
1248
|
+
};
|
|
1249
|
+
return /* @__PURE__ */ N(C, {
|
|
1250
|
+
heading: i?.renameTitle ?? "Rename conversation",
|
|
1251
|
+
portalId: "rename-conversation",
|
|
1252
|
+
containerClassName: "rename-conversation-popup",
|
|
1253
|
+
size: x.SM,
|
|
1254
|
+
dividers: !a,
|
|
1255
|
+
onClose: t,
|
|
1256
|
+
closeButtonTitle: i?.close ?? "Cancel",
|
|
1257
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1258
|
+
className: "px-6 py-4 sm:px-0",
|
|
1259
|
+
lang: r,
|
|
1260
|
+
children: /* @__PURE__ */ M(v, {
|
|
1261
|
+
inputId: "rename",
|
|
1262
|
+
value: s,
|
|
1263
|
+
onChange: u,
|
|
1264
|
+
cssClass: "w-full"
|
|
1265
|
+
})
|
|
1266
|
+
}), /* @__PURE__ */ N("div", {
|
|
1267
|
+
className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
|
|
1268
|
+
children: [/* @__PURE__ */ M(f, {
|
|
1269
|
+
buttonClassName: "cancel-button",
|
|
1270
|
+
title: i?.cancel ?? "Cancel",
|
|
1271
|
+
isSmallButton: o,
|
|
1272
|
+
onClick: (e) => {
|
|
1273
|
+
e.stopPropagation(), t();
|
|
1274
|
+
}
|
|
1275
|
+
}), /* @__PURE__ */ M(f, {
|
|
1276
|
+
buttonClassName: "text-button-primary text-button-primary",
|
|
1277
|
+
title: i?.save ?? "Rename",
|
|
1278
|
+
isSmallButton: o,
|
|
1279
|
+
disabled: !s,
|
|
1280
|
+
onClick: (e) => {
|
|
1281
|
+
e.stopPropagation(), d();
|
|
1282
|
+
}
|
|
1283
|
+
})]
|
|
1284
|
+
})]
|
|
1285
|
+
});
|
|
1286
|
+
}, qe = n(null);
|
|
1287
|
+
function Je({ children: e, value: t }) {
|
|
1288
|
+
return /* @__PURE__ */ M(qe.Provider, {
|
|
1289
|
+
value: t,
|
|
1290
|
+
children: e
|
|
1291
|
+
});
|
|
1255
1292
|
}
|
|
1256
|
-
function
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
"useConversationListActions must be used within ConversationListActionsProvider"
|
|
1261
|
-
);
|
|
1262
|
-
return t;
|
|
1293
|
+
function Ye() {
|
|
1294
|
+
let e = i(qe);
|
|
1295
|
+
if (!e) throw Error("useConversationListActions must be used within ConversationListActionsProvider");
|
|
1296
|
+
return e;
|
|
1263
1297
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
)
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
})
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
Gt,
|
|
1680
|
-
{
|
|
1681
|
-
value: {
|
|
1682
|
-
locale: e,
|
|
1683
|
-
deleteConversation: T,
|
|
1684
|
-
renameConversation: V,
|
|
1685
|
-
getConversation: r.getConversation,
|
|
1686
|
-
getFileBlob: r.getFileBlob,
|
|
1687
|
-
shareConversationProps: l
|
|
1688
|
-
},
|
|
1689
|
-
children: /* @__PURE__ */ b(De.Provider, { value: C, children: [
|
|
1690
|
-
!u && /* @__PURE__ */ b(
|
|
1691
|
-
"div",
|
|
1692
|
-
{
|
|
1693
|
-
className: k(
|
|
1694
|
-
"flex justify-between items-center pr-6",
|
|
1695
|
-
y ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"
|
|
1696
|
-
),
|
|
1697
|
-
children: [
|
|
1698
|
-
!y && /* @__PURE__ */ h("h3", { className: "sm:body-2 text-neutrals-700", children: C?.titles?.allChats ?? "All Chats" }),
|
|
1699
|
-
/* @__PURE__ */ h(
|
|
1700
|
-
Kt,
|
|
1701
|
-
{
|
|
1702
|
-
searchQuery: w,
|
|
1703
|
-
isExpandedSearch: y,
|
|
1704
|
-
onSearchConversations: Q,
|
|
1705
|
-
toggleSearchField: $
|
|
1706
|
-
}
|
|
1707
|
-
)
|
|
1708
|
-
]
|
|
1709
|
-
}
|
|
1710
|
-
),
|
|
1711
|
-
/* @__PURE__ */ h("div", { className: "scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0", children: u ? null : /* @__PURE__ */ h(
|
|
1712
|
-
"div",
|
|
1713
|
-
{
|
|
1714
|
-
className: k(
|
|
1715
|
-
"flex flex-col pr-4",
|
|
1716
|
-
j ? "gap-y-1" : "gap-y-6"
|
|
1717
|
-
),
|
|
1718
|
-
children: p?.length === 0 && o?.length === 0 ? /* @__PURE__ */ h(Jt, {}) : j ? /* @__PURE__ */ h(
|
|
1719
|
-
Zt,
|
|
1720
|
-
{
|
|
1721
|
-
conversations: [...o, ...p],
|
|
1722
|
-
searchQuery: w,
|
|
1723
|
-
selectedConversationId: s,
|
|
1724
|
-
handleConversationClick: t,
|
|
1725
|
-
isDisabled: c
|
|
1726
|
-
}
|
|
1727
|
-
) : Object.entries(d).map(
|
|
1728
|
-
([R, x]) => x?.length > 0 && /* @__PURE__ */ h(
|
|
1729
|
-
Xt,
|
|
1730
|
-
{
|
|
1731
|
-
isDisabled: c,
|
|
1732
|
-
groupLabel: R,
|
|
1733
|
-
groupedConversations: x,
|
|
1734
|
-
handleConversationClick: t,
|
|
1735
|
-
selectedConversationId: s
|
|
1736
|
-
},
|
|
1737
|
-
R
|
|
1738
|
-
)
|
|
1739
|
-
)
|
|
1740
|
-
}
|
|
1741
|
-
) }),
|
|
1742
|
-
a
|
|
1743
|
-
] })
|
|
1744
|
-
}
|
|
1745
|
-
);
|
|
1746
|
-
}, qt = ({
|
|
1747
|
-
onCloseModal: t,
|
|
1748
|
-
disableModalDividers: s,
|
|
1749
|
-
signOut: r,
|
|
1750
|
-
isSmallButton: a,
|
|
1751
|
-
locale: u,
|
|
1752
|
-
titles: c
|
|
1753
|
-
}) => /* @__PURE__ */ b(
|
|
1754
|
-
ce,
|
|
1755
|
-
{
|
|
1756
|
-
heading: c?.popupTitle || "Log out?",
|
|
1757
|
-
portalId: "sign-out",
|
|
1758
|
-
containerClassName: "sign-out-popup",
|
|
1759
|
-
size: ue.SM,
|
|
1760
|
-
dividers: !s,
|
|
1761
|
-
onClose: t,
|
|
1762
|
-
closeButtonTitle: "Cancel",
|
|
1763
|
-
children: [
|
|
1764
|
-
/* @__PURE__ */ h("div", { className: "px-6 py-4 sm:px-0", lang: u, children: c?.popupText }),
|
|
1765
|
-
/* @__PURE__ */ b("div", { className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3", children: [
|
|
1766
|
-
/* @__PURE__ */ h(
|
|
1767
|
-
W,
|
|
1768
|
-
{
|
|
1769
|
-
buttonClassName: "cancel-button",
|
|
1770
|
-
title: c?.popupCancel || "Cancel",
|
|
1771
|
-
isSmallButton: a,
|
|
1772
|
-
onClick: (C) => {
|
|
1773
|
-
C.stopPropagation(), t();
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
),
|
|
1777
|
-
/* @__PURE__ */ h(
|
|
1778
|
-
W,
|
|
1779
|
-
{
|
|
1780
|
-
buttonClassName: "text-button-primary",
|
|
1781
|
-
title: c?.popupApply || "Sign Out",
|
|
1782
|
-
isSmallButton: a,
|
|
1783
|
-
onClick: (C) => {
|
|
1784
|
-
C.stopPropagation(), r?.();
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
)
|
|
1788
|
-
] })
|
|
1789
|
-
]
|
|
1790
|
-
}
|
|
1791
|
-
), fn = ({
|
|
1792
|
-
userInfo: t,
|
|
1793
|
-
signOutAction: s,
|
|
1794
|
-
contactSupportUrl: r,
|
|
1795
|
-
styles: a,
|
|
1796
|
-
locale: u,
|
|
1797
|
-
titles: c
|
|
1798
|
-
}) => {
|
|
1799
|
-
const C = (N) => N?.split(" ")?.map((w, g) => g < 2 ? w[0].toUpperCase() : "")?.join("") ?? "", p = Z(
|
|
1800
|
-
() => t?.name ? C(t?.name) : t?.email?.[0].toUpperCase() ?? "",
|
|
1801
|
-
[t]
|
|
1802
|
-
), [e, o] = O(!1), n = t?.name?.split(" "), i = n ? `${n?.[0] ?? ""} ${n?.[1]?.[0] ? n?.[1]?.[0] + "." : ""}` : t?.email ?? "", l = D(() => {
|
|
1803
|
-
o(!0);
|
|
1804
|
-
}, []), f = D(() => {
|
|
1805
|
-
o(!1);
|
|
1806
|
-
}, []), d = D(() => {
|
|
1807
|
-
window.open(r || "#", "_blank", "noopener,noreferrer");
|
|
1808
|
-
}, [r]), E = Z(() => /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
1809
|
-
/* @__PURE__ */ h(
|
|
1810
|
-
"div",
|
|
1811
|
-
{
|
|
1812
|
-
className: k(
|
|
1813
|
-
"cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0",
|
|
1814
|
-
a?.initialStyles
|
|
1815
|
-
),
|
|
1816
|
-
children: p
|
|
1817
|
-
}
|
|
1818
|
-
),
|
|
1819
|
-
/* @__PURE__ */ h(
|
|
1820
|
-
"p",
|
|
1821
|
-
{
|
|
1822
|
-
className: k(
|
|
1823
|
-
"h3 cursor-pointer overflow-hidden text-ellipsis",
|
|
1824
|
-
a?.userNameStyles
|
|
1825
|
-
),
|
|
1826
|
-
children: (a?.showShortName ? i : t?.name) ?? t?.email ?? ""
|
|
1827
|
-
}
|
|
1828
|
-
)
|
|
1829
|
-
] }), [p, i, a, t]), m = Z(() => /* @__PURE__ */ b("div", { className: k("py-1", a?.dropDownStyles), children: [
|
|
1830
|
-
a?.settingsIcon && /* @__PURE__ */ b(
|
|
1831
|
-
"button",
|
|
1832
|
-
{
|
|
1833
|
-
className: k(
|
|
1834
|
-
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1835
|
-
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1836
|
-
a?.dropdownButtonStyles
|
|
1837
|
-
),
|
|
1838
|
-
title: c?.settings,
|
|
1839
|
-
children: [
|
|
1840
|
-
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.settingsIcon }),
|
|
1841
|
-
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.settings || "Settings" })
|
|
1842
|
-
]
|
|
1843
|
-
}
|
|
1844
|
-
),
|
|
1845
|
-
a?.contactSupportIcon && /* @__PURE__ */ b(
|
|
1846
|
-
"button",
|
|
1847
|
-
{
|
|
1848
|
-
className: k(
|
|
1849
|
-
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1850
|
-
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1851
|
-
a?.dropdownButtonStyles
|
|
1852
|
-
),
|
|
1853
|
-
title: c?.contactSupport,
|
|
1854
|
-
onClick: d,
|
|
1855
|
-
children: [
|
|
1856
|
-
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.contactSupportIcon }),
|
|
1857
|
-
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.contactSupport || "Contact support" })
|
|
1858
|
-
]
|
|
1859
|
-
}
|
|
1860
|
-
),
|
|
1861
|
-
/* @__PURE__ */ h(
|
|
1862
|
-
"div",
|
|
1863
|
-
{
|
|
1864
|
-
className: k(
|
|
1865
|
-
"h-0 border-t border-neutrals-600 my-2",
|
|
1866
|
-
a?.showSeparator ? "block" : "hidden"
|
|
1867
|
-
)
|
|
1868
|
-
}
|
|
1869
|
-
),
|
|
1870
|
-
/* @__PURE__ */ b(
|
|
1871
|
-
"button",
|
|
1872
|
-
{
|
|
1873
|
-
className: k(
|
|
1874
|
-
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1875
|
-
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1876
|
-
a?.dropdownButtonStyles
|
|
1877
|
-
),
|
|
1878
|
-
title: c?.signOut,
|
|
1879
|
-
onClick: l,
|
|
1880
|
-
children: [
|
|
1881
|
-
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.signOutIcon }),
|
|
1882
|
-
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.signOut || "Sign out" }),
|
|
1883
|
-
e && /* @__PURE__ */ h(
|
|
1884
|
-
qt,
|
|
1885
|
-
{
|
|
1886
|
-
onCloseModal: f,
|
|
1887
|
-
signOut: () => s?.(),
|
|
1888
|
-
locale: u,
|
|
1889
|
-
disableModalDividers: a?.disableModalDividers,
|
|
1890
|
-
titles: c
|
|
1891
|
-
}
|
|
1892
|
-
)
|
|
1893
|
-
]
|
|
1894
|
-
}
|
|
1895
|
-
)
|
|
1896
|
-
] }), [
|
|
1897
|
-
a,
|
|
1898
|
-
c,
|
|
1899
|
-
l,
|
|
1900
|
-
d,
|
|
1901
|
-
e,
|
|
1902
|
-
f,
|
|
1903
|
-
u,
|
|
1904
|
-
s
|
|
1905
|
-
]);
|
|
1906
|
-
if (t)
|
|
1907
|
-
return /* @__PURE__ */ h(
|
|
1908
|
-
Ae,
|
|
1909
|
-
{
|
|
1910
|
-
containerClassName: k(
|
|
1911
|
-
"transition-opacity group-hover:opacity-100 shrink w-full",
|
|
1912
|
-
a?.dropdownContainerClassName
|
|
1913
|
-
),
|
|
1914
|
-
triggerButton: E,
|
|
1915
|
-
content: m,
|
|
1916
|
-
openedClassName: "action-menu-opened"
|
|
1917
|
-
}
|
|
1918
|
-
);
|
|
1919
|
-
};
|
|
1920
|
-
export {
|
|
1921
|
-
Wt as ActionMenu,
|
|
1922
|
-
z as ActionMenuItem,
|
|
1923
|
-
hn as ConversationList,
|
|
1924
|
-
fn as User,
|
|
1925
|
-
pt as getSharedConversationsGroup,
|
|
1926
|
-
pe as transformSharedConversations
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region libs/conversation-list/src/components/ActionMenu/ActionMenu.tsx
|
|
1300
|
+
var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
|
|
1301
|
+
let i = Y(), { locale: a, deleteConversation: s, renameConversation: l, getConversation: u, getFileBlob: d, shareConversationProps: f } = Ye(), m = o(() => {
|
|
1302
|
+
let t = [{
|
|
1303
|
+
key: B.DELETE,
|
|
1304
|
+
title: i?.titles?.delete ?? "Delete",
|
|
1305
|
+
icon: i.actionsIcons?.[B.DELETE]
|
|
1306
|
+
}];
|
|
1307
|
+
return e?.model?.id?.endsWith(F) ? t : [
|
|
1308
|
+
...e.isShared ? [] : [{
|
|
1309
|
+
key: B.SHARE,
|
|
1310
|
+
title: i?.titles?.share ?? "Share",
|
|
1311
|
+
icon: i.actionsIcons?.[B.SHARE]
|
|
1312
|
+
}, {
|
|
1313
|
+
key: B.RENAME,
|
|
1314
|
+
title: i?.titles?.rename ?? "Rename",
|
|
1315
|
+
icon: i.actionsIcons?.[B.RENAME]
|
|
1316
|
+
}],
|
|
1317
|
+
{
|
|
1318
|
+
key: B.EXPORT,
|
|
1319
|
+
title: i?.titles?.export ?? "Export",
|
|
1320
|
+
icon: i.actionsIcons?.[B.EXPORT]
|
|
1321
|
+
},
|
|
1322
|
+
...t
|
|
1323
|
+
];
|
|
1324
|
+
}, [
|
|
1325
|
+
e.isShared,
|
|
1326
|
+
e?.model?.id,
|
|
1327
|
+
i.titles,
|
|
1328
|
+
i.actionsIcons
|
|
1329
|
+
]), [h, g] = c(S.Closed), [_, v] = c(S.Closed), [y, b] = c(S.Closed), x = r(() => {
|
|
1330
|
+
g(S.Closed);
|
|
1331
|
+
}, [g]), C = r(() => {
|
|
1332
|
+
v(S.Closed);
|
|
1333
|
+
}, [v]), w = r(() => {
|
|
1334
|
+
b(S.Closed);
|
|
1335
|
+
}, [b]), T = r(() => {
|
|
1336
|
+
s(e), x();
|
|
1337
|
+
}, [
|
|
1338
|
+
e,
|
|
1339
|
+
s,
|
|
1340
|
+
x
|
|
1341
|
+
]), E = r((e, t) => {
|
|
1342
|
+
l(e, t), w();
|
|
1343
|
+
}, [l, w]);
|
|
1344
|
+
return /* @__PURE__ */ N(j, { children: [
|
|
1345
|
+
/* @__PURE__ */ M(p, {
|
|
1346
|
+
containerClassName: "ml-3 hidden group-hover:flex",
|
|
1347
|
+
triggerButton: t ?? /* @__PURE__ */ M(Ze, { disabled: n }),
|
|
1348
|
+
options: m,
|
|
1349
|
+
openedClassName: "!flex action-menu-opened",
|
|
1350
|
+
onOptionSelect: (t) => {
|
|
1351
|
+
t === B.DELETE && g(S.Opened), t === B.SHARE && v(S.Opened), t === B.RENAME && b(S.Opened), t === B.EXPORT && u(decodeURI(e.id)).then((e) => {
|
|
1352
|
+
fe(e, d).then((e) => {
|
|
1353
|
+
he(`data:application/zip;base64,${e}`, `chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`);
|
|
1354
|
+
});
|
|
1355
|
+
});
|
|
1356
|
+
},
|
|
1357
|
+
disabled: n
|
|
1358
|
+
}),
|
|
1359
|
+
h === S.Opened && /* @__PURE__ */ M(X, {
|
|
1360
|
+
locale: a,
|
|
1361
|
+
deleteConversation: T,
|
|
1362
|
+
onCloseModal: x
|
|
1363
|
+
}),
|
|
1364
|
+
_ === S.Opened && /* @__PURE__ */ M(Ge, {
|
|
1365
|
+
conversation: e,
|
|
1366
|
+
locale: a,
|
|
1367
|
+
onCloseModal: C,
|
|
1368
|
+
...f
|
|
1369
|
+
}),
|
|
1370
|
+
y === S.Opened && /* @__PURE__ */ M(Ke, {
|
|
1371
|
+
conversation: e,
|
|
1372
|
+
locale: a,
|
|
1373
|
+
renameConversation: E,
|
|
1374
|
+
onCloseModal: w
|
|
1375
|
+
})
|
|
1376
|
+
] });
|
|
1377
|
+
}, Ze = ({ disabled: t }) => /* @__PURE__ */ M("div", {
|
|
1378
|
+
className: e("flex items-center justify-center w-[24px]", t ? "cursor-not-allowed" : "cursor-pointer"),
|
|
1379
|
+
children: /* @__PURE__ */ M(D, {
|
|
1380
|
+
width: 20,
|
|
1381
|
+
height: 20,
|
|
1382
|
+
stroke: 2,
|
|
1383
|
+
className: "text-primary"
|
|
1384
|
+
})
|
|
1385
|
+
}), Qe = ({ conversation: t, selectedConversationId: n, searchQuery: r, onConversationClick: i, isDisabled: o }) => {
|
|
1386
|
+
let { titles: c, conversationItemIcon: l } = Y(), u = s(null), d = L(t?.name);
|
|
1387
|
+
return a(() => {
|
|
1388
|
+
if (t?.id === n && u?.current) {
|
|
1389
|
+
let e = u.current.parentElement?.parentElement?.parentElement;
|
|
1390
|
+
if (e) {
|
|
1391
|
+
let t = u.current.getBoundingClientRect(), n = e.getBoundingClientRect(), r = t.height, i = n.height, a = t.top - n.top + e.scrollTop - (i / 2 - r / 2);
|
|
1392
|
+
e.scrollTo({
|
|
1393
|
+
top: a,
|
|
1394
|
+
behavior: "smooth"
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}, [t, n]), /* @__PURE__ */ N("div", {
|
|
1399
|
+
ref: u,
|
|
1400
|
+
className: e("flex justify-between items-center py-2 px-3 border-transparent relative group border", "conversation-item", n === t?.id && "bg-hues-100 conversation-item-active", o ? "cursor-not-allowed" : "cursor-pointer hover:border-hues-600"),
|
|
1401
|
+
onClick: () => !o && i(t.folderId, t?.id),
|
|
1402
|
+
title: o ? c?.noActionsAllowed : d,
|
|
1403
|
+
children: [/* @__PURE__ */ N("div", {
|
|
1404
|
+
className: "flex min-w-0 flex-1 items-center",
|
|
1405
|
+
children: [l || null, /* @__PURE__ */ M("h3", {
|
|
1406
|
+
className: e("truncate font-semibold text-neutrals-1000 sm:body-2", "conversation-item-text", n === t?.id ? "conversation-item-text-active" : ""),
|
|
1407
|
+
title: o ? c?.noActionsAllowed : d,
|
|
1408
|
+
children: r?.length ? /* @__PURE__ */ M(m, {
|
|
1409
|
+
text: d,
|
|
1410
|
+
highlightText: r
|
|
1411
|
+
}) : d
|
|
1412
|
+
})]
|
|
1413
|
+
}), /* @__PURE__ */ M(Xe, {
|
|
1414
|
+
conversation: t,
|
|
1415
|
+
isDisabled: o
|
|
1416
|
+
})]
|
|
1417
|
+
});
|
|
1418
|
+
}, $e = ({ handleConversationClick: t, selectedConversationId: n, groupLabel: i, groupedConversations: a, isDisabled: o }) => {
|
|
1419
|
+
let { titles: s } = Y(), [l, u] = c(!1);
|
|
1420
|
+
return /* @__PURE__ */ N("div", { children: [/* @__PURE__ */ N("div", {
|
|
1421
|
+
className: "conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700",
|
|
1422
|
+
onClick: r(() => {
|
|
1423
|
+
u((e) => !e);
|
|
1424
|
+
}, [u]),
|
|
1425
|
+
children: [/* @__PURE__ */ M(w, { className: e("w-3 h-3 conversation-group-items-arrow", l ? "rotate-[90deg]" : "rotate-0") }), /* @__PURE__ */ M("span", {
|
|
1426
|
+
className: "body-3 conversation-group-items-title-text",
|
|
1427
|
+
children: q(i, s)
|
|
1428
|
+
})]
|
|
1429
|
+
}), !l && /* @__PURE__ */ M("div", {
|
|
1430
|
+
className: e("flex flex-col gap-y-3", "conversation-group-items"),
|
|
1431
|
+
children: K(a).map((e) => /* @__PURE__ */ M(Qe, {
|
|
1432
|
+
isDisabled: o,
|
|
1433
|
+
conversation: e,
|
|
1434
|
+
selectedConversationId: n,
|
|
1435
|
+
onConversationClick: t
|
|
1436
|
+
}, e.id || e.name))
|
|
1437
|
+
})] }, i);
|
|
1438
|
+
}, et = ({ searchQuery: e, isExpandedSearch: t, onSearchConversations: n, toggleSearchField: r }) => {
|
|
1439
|
+
let { titles: i, searchIcon: a } = Y();
|
|
1440
|
+
return /* @__PURE__ */ M(j, { children: t ? /* @__PURE__ */ M(y, {
|
|
1441
|
+
inputId: "conversations-search",
|
|
1442
|
+
placeholder: i?.searchPlaceholder ?? "Search",
|
|
1443
|
+
containerClasses: "conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",
|
|
1444
|
+
cssClass: "h-auto",
|
|
1445
|
+
value: e,
|
|
1446
|
+
iconAfterInput: /* @__PURE__ */ M(h, {
|
|
1447
|
+
buttonClassName: "text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",
|
|
1448
|
+
onClick: r,
|
|
1449
|
+
icon: /* @__PURE__ */ M(A, {})
|
|
1450
|
+
}),
|
|
1451
|
+
onChange: n
|
|
1452
|
+
}) : /* @__PURE__ */ M(f, {
|
|
1453
|
+
buttonClassName: "text-button-tertiary p-0 search-button",
|
|
1454
|
+
iconBefore: a || /* @__PURE__ */ M(k, { className: "size-5" }),
|
|
1455
|
+
onClick: r
|
|
1456
|
+
}) });
|
|
1457
|
+
}, tt = ({ conversations: e, selectedConversationId: t, searchQuery: n, handleConversationClick: r, isDisabled: i }) => {
|
|
1458
|
+
let { titles: o } = Y(), [s, l] = c([]);
|
|
1459
|
+
return a(() => {
|
|
1460
|
+
l(K(e?.filter((e) => L(e?.name)?.includes(n || ""))));
|
|
1461
|
+
}, [e, n]), /* @__PURE__ */ M(j, { children: s?.length ? s.map((e) => /* @__PURE__ */ M(Qe, {
|
|
1462
|
+
conversation: e,
|
|
1463
|
+
searchQuery: n,
|
|
1464
|
+
selectedConversationId: t,
|
|
1465
|
+
onConversationClick: r,
|
|
1466
|
+
isDisabled: i
|
|
1467
|
+
}, e.id)) : /* @__PURE__ */ M("h3", {
|
|
1468
|
+
className: "text-neutrals-800",
|
|
1469
|
+
children: o?.noConversation ?? "No conversations yet"
|
|
1470
|
+
}) });
|
|
1471
|
+
}, nt = () => {
|
|
1472
|
+
let { titles: e } = Y();
|
|
1473
|
+
return /* @__PURE__ */ N("div", {
|
|
1474
|
+
className: "flex flex-col p-8 text-center",
|
|
1475
|
+
children: [/* @__PURE__ */ M("p", {
|
|
1476
|
+
className: "text-neutrals-800",
|
|
1477
|
+
children: e?.noConversation ?? "No conversations yet"
|
|
1478
|
+
}), /* @__PURE__ */ M("p", {
|
|
1479
|
+
className: "mt-2 text-sm text-neutrals-800",
|
|
1480
|
+
children: e?.clickNewChat ?? "Click \"New Chat\" to start a conversation"
|
|
1481
|
+
})]
|
|
1482
|
+
});
|
|
1483
|
+
}, rt = ({ handleConversationClick: t, selectedConversationId: n, actions: i, children: s, isCollapsed: l, isStreaming: u, conversationStyles: d, conversations: f, locale: p, sharedConversations: m, setConversations: h, setSharedConversations: g, shareConversationProps: _, handleSelectedConversationRemove: v }) => {
|
|
1484
|
+
let [y, x] = c({}), [S, C] = c(!0), [w, T] = c(""), [E, D] = c(!1), { getConversations: O, getSharedConversations: k, deleteConversation: A, renameConversation: j } = i, P = o(() => !!w?.length, [w]);
|
|
1485
|
+
a(() => {
|
|
1486
|
+
x({
|
|
1487
|
+
...U(m),
|
|
1488
|
+
...oe(f)
|
|
1489
|
+
});
|
|
1490
|
+
}, [f, m]), a(() => {
|
|
1491
|
+
async function e() {
|
|
1492
|
+
try {
|
|
1493
|
+
C(!0);
|
|
1494
|
+
let e = await O(p), t = await k(ne(z.ME));
|
|
1495
|
+
h(I(e)), g(I(H(t, p)));
|
|
1496
|
+
} catch (e) {
|
|
1497
|
+
console.error("Error loading conversation", e);
|
|
1498
|
+
} finally {
|
|
1499
|
+
C(!1);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
e();
|
|
1503
|
+
}, [
|
|
1504
|
+
O,
|
|
1505
|
+
h,
|
|
1506
|
+
p,
|
|
1507
|
+
k,
|
|
1508
|
+
g
|
|
1509
|
+
]);
|
|
1510
|
+
let F = r(async (e) => {
|
|
1511
|
+
try {
|
|
1512
|
+
await A(e);
|
|
1513
|
+
let t = await O(p), r = await k(ne(z.ME));
|
|
1514
|
+
h(I(t)), g(I(H(r, p))), n === e?.id && v();
|
|
1515
|
+
} catch (e) {
|
|
1516
|
+
console.error("Error deleting conversation", e);
|
|
1517
|
+
}
|
|
1518
|
+
}, [
|
|
1519
|
+
A,
|
|
1520
|
+
O,
|
|
1521
|
+
p,
|
|
1522
|
+
k,
|
|
1523
|
+
h,
|
|
1524
|
+
g,
|
|
1525
|
+
n,
|
|
1526
|
+
v
|
|
1527
|
+
]), ee = r(async (e, t) => {
|
|
1528
|
+
try {
|
|
1529
|
+
C(!0), await j(e, t);
|
|
1530
|
+
let n = await O(p), r = await k(ne(z.ME));
|
|
1531
|
+
h(I(n)), g(I(H(r, p)));
|
|
1532
|
+
} catch (e) {
|
|
1533
|
+
console.error("Error renaming conversation", e);
|
|
1534
|
+
} finally {
|
|
1535
|
+
C(!1);
|
|
1536
|
+
}
|
|
1537
|
+
}, [
|
|
1538
|
+
O,
|
|
1539
|
+
p,
|
|
1540
|
+
k,
|
|
1541
|
+
h,
|
|
1542
|
+
g,
|
|
1543
|
+
j
|
|
1544
|
+
]), L = r((e) => {
|
|
1545
|
+
T(e);
|
|
1546
|
+
}, [T]), R = r(() => {
|
|
1547
|
+
D((e) => !e), T("");
|
|
1548
|
+
}, [D]);
|
|
1549
|
+
return S ? /* @__PURE__ */ M(b, {}) : /* @__PURE__ */ M(Je, {
|
|
1550
|
+
value: {
|
|
1551
|
+
locale: p,
|
|
1552
|
+
deleteConversation: F,
|
|
1553
|
+
renameConversation: ee,
|
|
1554
|
+
getConversation: i.getConversation,
|
|
1555
|
+
getFileBlob: i.getFileBlob,
|
|
1556
|
+
shareConversationProps: _
|
|
1557
|
+
},
|
|
1558
|
+
children: /* @__PURE__ */ N(J.Provider, {
|
|
1559
|
+
value: d,
|
|
1560
|
+
children: [
|
|
1561
|
+
!l && /* @__PURE__ */ N("div", {
|
|
1562
|
+
className: e("flex justify-between items-center pr-6", E ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"),
|
|
1563
|
+
children: [!E && /* @__PURE__ */ M("h3", {
|
|
1564
|
+
className: "sm:body-2 text-neutrals-700",
|
|
1565
|
+
children: d?.titles?.allChats ?? "All Chats"
|
|
1566
|
+
}), /* @__PURE__ */ M(et, {
|
|
1567
|
+
searchQuery: w,
|
|
1568
|
+
isExpandedSearch: E,
|
|
1569
|
+
onSearchConversations: L,
|
|
1570
|
+
toggleSearchField: R
|
|
1571
|
+
})]
|
|
1572
|
+
}),
|
|
1573
|
+
/* @__PURE__ */ M("div", {
|
|
1574
|
+
className: "scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0",
|
|
1575
|
+
children: l ? null : /* @__PURE__ */ M("div", {
|
|
1576
|
+
className: e("flex flex-col pr-4", P ? "gap-y-1" : "gap-y-6"),
|
|
1577
|
+
children: f?.length === 0 && m?.length === 0 ? /* @__PURE__ */ M(nt, {}) : P ? /* @__PURE__ */ M(tt, {
|
|
1578
|
+
conversations: [...m, ...f],
|
|
1579
|
+
searchQuery: w,
|
|
1580
|
+
selectedConversationId: n,
|
|
1581
|
+
handleConversationClick: t,
|
|
1582
|
+
isDisabled: u
|
|
1583
|
+
}) : Object.entries(y).map(([e, r]) => r?.length > 0 && /* @__PURE__ */ M($e, {
|
|
1584
|
+
isDisabled: u,
|
|
1585
|
+
groupLabel: e,
|
|
1586
|
+
groupedConversations: r,
|
|
1587
|
+
handleConversationClick: t,
|
|
1588
|
+
selectedConversationId: n
|
|
1589
|
+
}, e))
|
|
1590
|
+
})
|
|
1591
|
+
}),
|
|
1592
|
+
s
|
|
1593
|
+
]
|
|
1594
|
+
})
|
|
1595
|
+
});
|
|
1596
|
+
}, it = ({ onCloseModal: e, disableModalDividers: t, signOut: n, isSmallButton: r, locale: i, titles: a }) => /* @__PURE__ */ N(C, {
|
|
1597
|
+
heading: a?.popupTitle || "Log out?",
|
|
1598
|
+
portalId: "sign-out",
|
|
1599
|
+
containerClassName: "sign-out-popup",
|
|
1600
|
+
size: x.SM,
|
|
1601
|
+
dividers: !t,
|
|
1602
|
+
onClose: e,
|
|
1603
|
+
closeButtonTitle: "Cancel",
|
|
1604
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1605
|
+
className: "px-6 py-4 sm:px-0",
|
|
1606
|
+
lang: i,
|
|
1607
|
+
children: a?.popupText
|
|
1608
|
+
}), /* @__PURE__ */ N("div", {
|
|
1609
|
+
className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
|
|
1610
|
+
children: [/* @__PURE__ */ M(f, {
|
|
1611
|
+
buttonClassName: "cancel-button",
|
|
1612
|
+
title: a?.popupCancel || "Cancel",
|
|
1613
|
+
isSmallButton: r,
|
|
1614
|
+
onClick: (t) => {
|
|
1615
|
+
t.stopPropagation(), e();
|
|
1616
|
+
}
|
|
1617
|
+
}), /* @__PURE__ */ M(f, {
|
|
1618
|
+
buttonClassName: "text-button-primary",
|
|
1619
|
+
title: a?.popupApply || "Sign Out",
|
|
1620
|
+
isSmallButton: r,
|
|
1621
|
+
onClick: (e) => {
|
|
1622
|
+
e.stopPropagation(), n?.();
|
|
1623
|
+
}
|
|
1624
|
+
})]
|
|
1625
|
+
})]
|
|
1626
|
+
}), at = ({ userInfo: t, signOutAction: n, contactSupportUrl: i, styles: a, locale: s, titles: l }) => {
|
|
1627
|
+
let u = (e) => e?.split(" ")?.map((e, t) => t < 2 ? e[0].toUpperCase() : "")?.join("") ?? "", d = o(() => t?.name ? u(t?.name) : t?.email?.[0].toUpperCase() ?? "", [t]), [f, m] = c(!1), h = t?.name?.split(" "), g = h ? `${h?.[0] ?? ""} ${h?.[1]?.[0] ? h?.[1]?.[0] + "." : ""}` : t?.email ?? "", _ = r(() => {
|
|
1628
|
+
m(!0);
|
|
1629
|
+
}, []), v = r(() => {
|
|
1630
|
+
m(!1);
|
|
1631
|
+
}, []), y = r(() => {
|
|
1632
|
+
window.open(i || "#", "_blank", "noopener,noreferrer");
|
|
1633
|
+
}, [i]), b = o(() => /* @__PURE__ */ N("div", {
|
|
1634
|
+
className: "flex items-center gap-2",
|
|
1635
|
+
children: [/* @__PURE__ */ M("div", {
|
|
1636
|
+
className: e("cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0", a?.initialStyles),
|
|
1637
|
+
children: d
|
|
1638
|
+
}), /* @__PURE__ */ M("p", {
|
|
1639
|
+
className: e("h3 cursor-pointer overflow-hidden text-ellipsis", a?.userNameStyles),
|
|
1640
|
+
children: (a?.showShortName ? g : t?.name) ?? t?.email ?? ""
|
|
1641
|
+
})]
|
|
1642
|
+
}), [
|
|
1643
|
+
d,
|
|
1644
|
+
g,
|
|
1645
|
+
a,
|
|
1646
|
+
t
|
|
1647
|
+
]), x = o(() => /* @__PURE__ */ N("div", {
|
|
1648
|
+
className: e("py-1", a?.dropDownStyles),
|
|
1649
|
+
children: [
|
|
1650
|
+
a?.settingsIcon && /* @__PURE__ */ N("button", {
|
|
1651
|
+
className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
|
|
1652
|
+
title: l?.settings,
|
|
1653
|
+
children: [/* @__PURE__ */ M("span", {
|
|
1654
|
+
className: "shrink-0",
|
|
1655
|
+
children: a?.settingsIcon
|
|
1656
|
+
}), /* @__PURE__ */ M("span", {
|
|
1657
|
+
className: "min-w-0 break-words",
|
|
1658
|
+
children: l?.settings || "Settings"
|
|
1659
|
+
})]
|
|
1660
|
+
}),
|
|
1661
|
+
a?.contactSupportIcon && /* @__PURE__ */ N("button", {
|
|
1662
|
+
className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
|
|
1663
|
+
title: l?.contactSupport,
|
|
1664
|
+
onClick: y,
|
|
1665
|
+
children: [/* @__PURE__ */ M("span", {
|
|
1666
|
+
className: "shrink-0",
|
|
1667
|
+
children: a?.contactSupportIcon
|
|
1668
|
+
}), /* @__PURE__ */ M("span", {
|
|
1669
|
+
className: "min-w-0 break-words",
|
|
1670
|
+
children: l?.contactSupport || "Contact support"
|
|
1671
|
+
})]
|
|
1672
|
+
}),
|
|
1673
|
+
/* @__PURE__ */ M("div", { className: e("h-0 border-t border-neutrals-600 my-2", a?.showSeparator ? "block" : "hidden") }),
|
|
1674
|
+
/* @__PURE__ */ N("button", {
|
|
1675
|
+
className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
|
|
1676
|
+
title: l?.signOut,
|
|
1677
|
+
onClick: _,
|
|
1678
|
+
children: [
|
|
1679
|
+
/* @__PURE__ */ M("span", {
|
|
1680
|
+
className: "shrink-0",
|
|
1681
|
+
children: a?.signOutIcon
|
|
1682
|
+
}),
|
|
1683
|
+
/* @__PURE__ */ M("span", {
|
|
1684
|
+
className: "min-w-0 break-words",
|
|
1685
|
+
children: l?.signOut || "Sign out"
|
|
1686
|
+
}),
|
|
1687
|
+
f && /* @__PURE__ */ M(it, {
|
|
1688
|
+
onCloseModal: v,
|
|
1689
|
+
signOut: () => n?.(),
|
|
1690
|
+
locale: s,
|
|
1691
|
+
disableModalDividers: a?.disableModalDividers,
|
|
1692
|
+
titles: l
|
|
1693
|
+
})
|
|
1694
|
+
]
|
|
1695
|
+
})
|
|
1696
|
+
]
|
|
1697
|
+
}), [
|
|
1698
|
+
a,
|
|
1699
|
+
l,
|
|
1700
|
+
_,
|
|
1701
|
+
y,
|
|
1702
|
+
f,
|
|
1703
|
+
v,
|
|
1704
|
+
s,
|
|
1705
|
+
n
|
|
1706
|
+
]);
|
|
1707
|
+
if (t) return /* @__PURE__ */ M(p, {
|
|
1708
|
+
containerClassName: e("transition-opacity group-hover:opacity-100 shrink w-full", a?.dropdownContainerClassName),
|
|
1709
|
+
triggerButton: b,
|
|
1710
|
+
content: x,
|
|
1711
|
+
openedClassName: "action-menu-opened"
|
|
1712
|
+
});
|
|
1927
1713
|
};
|
|
1714
|
+
//#endregion
|
|
1715
|
+
export { Xe as ActionMenu, B as ActionMenuItem, rt as ConversationList, at as User, U as getSharedConversationsGroup, H as transformSharedConversations };
|