@epam/statgpt-conversation-list 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.mjs ADDED
@@ -0,0 +1,4392 @@
1
+ import { jsx as R, Fragment as Ne, jsxs as z } from "react/jsx-runtime";
2
+ import J from "classnames";
3
+ import * as E from "react";
4
+ import X, { useMemo as bt, useLayoutEffect as Ln, useCallback as me, useState as te, useEffect as Ye, useRef as Fr } from "react";
5
+ import { cloneDeep as kr, omit as Br, uniqBy as _r } from "lodash";
6
+ import { IconX as Fn, IconCheck as $r, IconCopy as Ur, IconDotsVertical as Vr, IconCaretRightFilled as Hr, IconSearch as Wr } from "@tabler/icons-react";
7
+ import * as kn from "react-dom";
8
+ import zr from "jszip";
9
+ var pe = /* @__PURE__ */ ((e) => (e.DELETE = "delete", e.EXPORT = "export", e.SHARE = "share", e))(pe || {}), ne = /* @__PURE__ */ ((e) => (e.SHARED = "shared", e.TODAY = "today", e.YESTERDAY = "yesterday", e.WEEK = "week", e.EARLIER = "earlier", e))(ne || {});
10
+ const Yr = {
11
+ [ne.TODAY]: [],
12
+ [ne.YESTERDAY]: [],
13
+ [ne.WEEK]: [],
14
+ [ne.EARLIER]: []
15
+ }, Bn = (e, t) => e.toDateString() === t.toDateString(), jr = (e, t) => {
16
+ const n = new Date(
17
+ e.getFullYear(),
18
+ e.getMonth(),
19
+ e.getDate() - 1
20
+ );
21
+ return Bn(t, n);
22
+ }, Kr = (e, t) => {
23
+ const n = e.getTime() - t.getTime();
24
+ return Math.floor(n / (1e3 * 60 * 60 * 24));
25
+ }, Gr = (e) => {
26
+ const t = /* @__PURE__ */ new Date(), n = kr(Yr);
27
+ for (const r of e)
28
+ if (r.updatedAt) {
29
+ const o = new Date(r.updatedAt);
30
+ let l;
31
+ Bn(t, o) ? l = n[ne.TODAY] : jr(t, o) ? l = n[ne.YESTERDAY] : Kr(t, o) <= 7 ? l = n[ne.WEEK] : l = n[ne.EARLIER], l != null && l.some(
32
+ (a) => a.id === r.id
33
+ ) || l.push(r);
34
+ }
35
+ return n;
36
+ }, _n = (e) => e == null ? void 0 : e.sort(
37
+ (t, n) => ((n == null ? void 0 : n.updatedAt) || 0) - ((t == null ? void 0 : t.updatedAt) || 0)
38
+ ), Xr = (e, t) => e === ne.SHARED ? (t == null ? void 0 : t.shared) || "Shared" : e === ne.TODAY ? (t == null ? void 0 : t.today) || "Today" : e === ne.YESTERDAY ? (t == null ? void 0 : t.yesterday) || "Yesterday" : e === ne.WEEK ? (t == null ? void 0 : t.lastWeek) || "Last week" : (t == null ? void 0 : t.earlier) || "Earlier", Qr = ({ text: e, highlightText: t }) => {
39
+ const n = bt(() => {
40
+ var a;
41
+ const r = [];
42
+ if (!t)
43
+ return [{ id: 0, text: e, highlight: !1 }];
44
+ const o = (t == null ? void 0 : t.toLowerCase()) || "", l = ((a = e == null ? void 0 : e.toLowerCase()) == null ? void 0 : a.split(o)) || "";
45
+ for (let u = 0, i = 0; u < (l == null ? void 0 : l.length); u++) {
46
+ const s = l == null ? void 0 : l[u], c = s.length;
47
+ s !== "" && r.push({
48
+ id: r.length,
49
+ highlight: !1,
50
+ text: e == null ? void 0 : e.substring(
51
+ i,
52
+ i + c
53
+ )
54
+ }), i += c, u !== (l == null ? void 0 : l.length) - 1 && (r.push({
55
+ id: r.length,
56
+ highlight: !0,
57
+ text: e == null ? void 0 : e.substring(
58
+ i,
59
+ i + t.length
60
+ )
61
+ }), i += t.length);
62
+ }
63
+ return r;
64
+ }, [t, e]);
65
+ return /* @__PURE__ */ R(Ne, { children: n.map((r) => /* @__PURE__ */ R(
66
+ "span",
67
+ {
68
+ className: J((r == null ? void 0 : r.highlight) && "bg-highlight"),
69
+ children: r == null ? void 0 : r.text
70
+ },
71
+ r == null ? void 0 : r.id
72
+ )) });
73
+ }, Kt = () => /* @__PURE__ */ R("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ R("div", { className: "loader" }) }), je = ({
74
+ buttonClassName: e,
75
+ isLoading: t = !1,
76
+ title: n,
77
+ disabled: r,
78
+ iconAfter: o,
79
+ iconBefore: l,
80
+ onClick: a,
81
+ isSmallButton: u
82
+ }) => {
83
+ const i = J(
84
+ u ? "font-semibold" : "",
85
+ o ? "mr-2" : "",
86
+ l ? "ml-2" : ""
87
+ );
88
+ return /* @__PURE__ */ z(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ className: J(
93
+ "base-button",
94
+ e,
95
+ u ? "small-button" : ""
96
+ ),
97
+ disabled: r || t,
98
+ "aria-label": "button",
99
+ onClick: (s) => a == null ? void 0 : a(s),
100
+ title: n,
101
+ children: [
102
+ l,
103
+ t && /* @__PURE__ */ R(Kt, {}),
104
+ n ? u ? /* @__PURE__ */ R("h4", { className: i, children: n }) : /* @__PURE__ */ R("h3", { className: i, children: n }) : null,
105
+ o
106
+ ]
107
+ }
108
+ );
109
+ };
110
+ function wt() {
111
+ return typeof window < "u";
112
+ }
113
+ function Pe(e) {
114
+ return Gt(e) ? (e.nodeName || "").toLowerCase() : "#document";
115
+ }
116
+ function le(e) {
117
+ var t;
118
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
119
+ }
120
+ function we(e) {
121
+ var t;
122
+ return (t = (Gt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
123
+ }
124
+ function Gt(e) {
125
+ return wt() ? e instanceof Node || e instanceof le(e).Node : !1;
126
+ }
127
+ function j(e) {
128
+ return wt() ? e instanceof Element || e instanceof le(e).Element : !1;
129
+ }
130
+ function Q(e) {
131
+ return wt() ? e instanceof HTMLElement || e instanceof le(e).HTMLElement : !1;
132
+ }
133
+ function kt(e) {
134
+ return !wt() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof le(e).ShadowRoot;
135
+ }
136
+ const qr = /* @__PURE__ */ new Set(["inline", "contents"]);
137
+ function Qe(e) {
138
+ const {
139
+ overflow: t,
140
+ overflowX: n,
141
+ overflowY: r,
142
+ display: o
143
+ } = fe(e);
144
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !qr.has(o);
145
+ }
146
+ const Zr = /* @__PURE__ */ new Set(["table", "td", "th"]);
147
+ function Jr(e) {
148
+ return Zr.has(Pe(e));
149
+ }
150
+ const eo = [":popover-open", ":modal"];
151
+ function yt(e) {
152
+ return eo.some((t) => {
153
+ try {
154
+ return e.matches(t);
155
+ } catch {
156
+ return !1;
157
+ }
158
+ });
159
+ }
160
+ const to = ["transform", "translate", "scale", "rotate", "perspective"], no = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ro = ["paint", "layout", "strict", "content"];
161
+ function Xt(e) {
162
+ const t = Et(), n = j(e) ? fe(e) : e;
163
+ return to.some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || no.some((r) => (n.willChange || "").includes(r)) || ro.some((r) => (n.contain || "").includes(r));
164
+ }
165
+ function oo(e) {
166
+ let t = Re(e);
167
+ for (; Q(t) && !ve(t); ) {
168
+ if (Xt(t))
169
+ return t;
170
+ if (yt(t))
171
+ return null;
172
+ t = Re(t);
173
+ }
174
+ return null;
175
+ }
176
+ function Et() {
177
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
178
+ }
179
+ const io = /* @__PURE__ */ new Set(["html", "body", "#document"]);
180
+ function ve(e) {
181
+ return io.has(Pe(e));
182
+ }
183
+ function fe(e) {
184
+ return le(e).getComputedStyle(e);
185
+ }
186
+ function vt(e) {
187
+ return j(e) ? {
188
+ scrollLeft: e.scrollLeft,
189
+ scrollTop: e.scrollTop
190
+ } : {
191
+ scrollLeft: e.scrollX,
192
+ scrollTop: e.scrollY
193
+ };
194
+ }
195
+ function Re(e) {
196
+ if (Pe(e) === "html")
197
+ return e;
198
+ const t = (
199
+ // Step into the shadow DOM of the parent of a slotted node.
200
+ e.assignedSlot || // DOM Element detected.
201
+ e.parentNode || // ShadowRoot detected.
202
+ kt(e) && e.host || // Fallback.
203
+ we(e)
204
+ );
205
+ return kt(t) ? t.host : t;
206
+ }
207
+ function $n(e) {
208
+ const t = Re(e);
209
+ return ve(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : Q(t) && Qe(t) ? t : $n(t);
210
+ }
211
+ function Ie(e, t, n) {
212
+ var r;
213
+ t === void 0 && (t = []), n === void 0 && (n = !0);
214
+ const o = $n(e), l = o === ((r = e.ownerDocument) == null ? void 0 : r.body), a = le(o);
215
+ if (l) {
216
+ const u = Bt(a);
217
+ return t.concat(a, a.visualViewport || [], Qe(o) ? o : [], u && n ? Ie(u) : []);
218
+ }
219
+ return t.concat(o, Ie(o, [], n));
220
+ }
221
+ function Bt(e) {
222
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
223
+ }
224
+ const st = Math.min, De = Math.max, lt = Math.round, et = Math.floor, be = (e) => ({
225
+ x: e,
226
+ y: e
227
+ }), so = {
228
+ left: "right",
229
+ right: "left",
230
+ bottom: "top",
231
+ top: "bottom"
232
+ }, lo = {
233
+ start: "end",
234
+ end: "start"
235
+ };
236
+ function tn(e, t, n) {
237
+ return De(e, st(t, n));
238
+ }
239
+ function Rt(e, t) {
240
+ return typeof e == "function" ? e(t) : e;
241
+ }
242
+ function Le(e) {
243
+ return e.split("-")[0];
244
+ }
245
+ function xt(e) {
246
+ return e.split("-")[1];
247
+ }
248
+ function Un(e) {
249
+ return e === "x" ? "y" : "x";
250
+ }
251
+ function Vn(e) {
252
+ return e === "y" ? "height" : "width";
253
+ }
254
+ const co = /* @__PURE__ */ new Set(["top", "bottom"]);
255
+ function Te(e) {
256
+ return co.has(Le(e)) ? "y" : "x";
257
+ }
258
+ function Hn(e) {
259
+ return Un(Te(e));
260
+ }
261
+ function ao(e, t, n) {
262
+ n === void 0 && (n = !1);
263
+ const r = xt(e), o = Hn(e), l = Vn(o);
264
+ let a = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
265
+ return t.reference[l] > t.floating[l] && (a = ct(a)), [a, ct(a)];
266
+ }
267
+ function uo(e) {
268
+ const t = ct(e);
269
+ return [_t(e), t, _t(t)];
270
+ }
271
+ function _t(e) {
272
+ return e.replace(/start|end/g, (t) => lo[t]);
273
+ }
274
+ const nn = ["left", "right"], rn = ["right", "left"], fo = ["top", "bottom"], ho = ["bottom", "top"];
275
+ function mo(e, t, n) {
276
+ switch (e) {
277
+ case "top":
278
+ case "bottom":
279
+ return n ? t ? rn : nn : t ? nn : rn;
280
+ case "left":
281
+ case "right":
282
+ return t ? fo : ho;
283
+ default:
284
+ return [];
285
+ }
286
+ }
287
+ function po(e, t, n, r) {
288
+ const o = xt(e);
289
+ let l = mo(Le(e), n === "start", r);
290
+ return o && (l = l.map((a) => a + "-" + o), t && (l = l.concat(l.map(_t)))), l;
291
+ }
292
+ function ct(e) {
293
+ return e.replace(/left|right|bottom|top/g, (t) => so[t]);
294
+ }
295
+ function go(e) {
296
+ return {
297
+ top: 0,
298
+ right: 0,
299
+ bottom: 0,
300
+ left: 0,
301
+ ...e
302
+ };
303
+ }
304
+ function bo(e) {
305
+ return typeof e != "number" ? go(e) : {
306
+ top: e,
307
+ right: e,
308
+ bottom: e,
309
+ left: e
310
+ };
311
+ }
312
+ function at(e) {
313
+ const {
314
+ x: t,
315
+ y: n,
316
+ width: r,
317
+ height: o
318
+ } = e;
319
+ return {
320
+ width: r,
321
+ height: o,
322
+ top: n,
323
+ left: t,
324
+ right: t + r,
325
+ bottom: n + o,
326
+ x: t,
327
+ y: n
328
+ };
329
+ }
330
+ /*!
331
+ * tabbable 6.2.0
332
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
333
+ */
334
+ var wo = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], ut = /* @__PURE__ */ wo.join(","), Wn = typeof Element > "u", We = Wn ? function() {
335
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, ft = !Wn && Element.prototype.getRootNode ? function(e) {
336
+ var t;
337
+ return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
338
+ } : function(e) {
339
+ return e == null ? void 0 : e.ownerDocument;
340
+ }, dt = function e(t, n) {
341
+ var r;
342
+ n === void 0 && (n = !0);
343
+ var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), l = o === "" || o === "true", a = l || n && t && e(t.parentNode);
344
+ return a;
345
+ }, yo = function(t) {
346
+ var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
347
+ return r === "" || r === "true";
348
+ }, zn = function(t, n, r) {
349
+ if (dt(t))
350
+ return [];
351
+ var o = Array.prototype.slice.apply(t.querySelectorAll(ut));
352
+ return n && We.call(t, ut) && o.unshift(t), o = o.filter(r), o;
353
+ }, Yn = function e(t, n, r) {
354
+ for (var o = [], l = Array.from(t); l.length; ) {
355
+ var a = l.shift();
356
+ if (!dt(a, !1))
357
+ if (a.tagName === "SLOT") {
358
+ var u = a.assignedElements(), i = u.length ? u : a.children, s = e(i, !0, r);
359
+ r.flatten ? o.push.apply(o, s) : o.push({
360
+ scopeParent: a,
361
+ candidates: s
362
+ });
363
+ } else {
364
+ var c = We.call(a, ut);
365
+ c && r.filter(a) && (n || !t.includes(a)) && o.push(a);
366
+ var f = a.shadowRoot || // check for an undisclosed shadow
367
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(a), d = !dt(f, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
368
+ if (f && d) {
369
+ var h = e(f === !0 ? a.children : f.children, !0, r);
370
+ r.flatten ? o.push.apply(o, h) : o.push({
371
+ scopeParent: a,
372
+ candidates: h
373
+ });
374
+ } else
375
+ l.unshift.apply(l, a.children);
376
+ }
377
+ }
378
+ return o;
379
+ }, jn = function(t) {
380
+ return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
381
+ }, Kn = function(t) {
382
+ if (!t)
383
+ throw new Error("No node provided");
384
+ return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || yo(t)) && !jn(t) ? 0 : t.tabIndex;
385
+ }, Eo = function(t, n) {
386
+ var r = Kn(t);
387
+ return r < 0 && n && !jn(t) ? 0 : r;
388
+ }, vo = function(t, n) {
389
+ return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
390
+ }, Gn = function(t) {
391
+ return t.tagName === "INPUT";
392
+ }, Ro = function(t) {
393
+ return Gn(t) && t.type === "hidden";
394
+ }, xo = function(t) {
395
+ var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
396
+ return r.tagName === "SUMMARY";
397
+ });
398
+ return n;
399
+ }, Co = function(t, n) {
400
+ for (var r = 0; r < t.length; r++)
401
+ if (t[r].checked && t[r].form === n)
402
+ return t[r];
403
+ }, Ao = function(t) {
404
+ if (!t.name)
405
+ return !0;
406
+ var n = t.form || ft(t), r = function(u) {
407
+ return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
408
+ }, o;
409
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
410
+ o = r(window.CSS.escape(t.name));
411
+ else
412
+ try {
413
+ o = r(t.name);
414
+ } catch (a) {
415
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", a.message), !1;
416
+ }
417
+ var l = Co(o, t.form);
418
+ return !l || l === t;
419
+ }, So = function(t) {
420
+ return Gn(t) && t.type === "radio";
421
+ }, To = function(t) {
422
+ return So(t) && !Ao(t);
423
+ }, Mo = function(t) {
424
+ var n, r = t && ft(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, l = !1;
425
+ if (r && r !== t) {
426
+ var a, u, i;
427
+ for (l = !!((a = o) !== null && a !== void 0 && (u = a.ownerDocument) !== null && u !== void 0 && u.contains(o) || t != null && (i = t.ownerDocument) !== null && i !== void 0 && i.contains(t)); !l && o; ) {
428
+ var s, c, f;
429
+ r = ft(o), o = (s = r) === null || s === void 0 ? void 0 : s.host, l = !!((c = o) !== null && c !== void 0 && (f = c.ownerDocument) !== null && f !== void 0 && f.contains(o));
430
+ }
431
+ }
432
+ return l;
433
+ }, on = function(t) {
434
+ var n = t.getBoundingClientRect(), r = n.width, o = n.height;
435
+ return r === 0 && o === 0;
436
+ }, Io = function(t, n) {
437
+ var r = n.displayCheck, o = n.getShadowRoot;
438
+ if (getComputedStyle(t).visibility === "hidden")
439
+ return !0;
440
+ var l = We.call(t, "details>summary:first-of-type"), a = l ? t.parentElement : t;
441
+ if (We.call(a, "details:not([open]) *"))
442
+ return !0;
443
+ if (!r || r === "full" || r === "legacy-full") {
444
+ if (typeof o == "function") {
445
+ for (var u = t; t; ) {
446
+ var i = t.parentElement, s = ft(t);
447
+ if (i && !i.shadowRoot && o(i) === !0)
448
+ return on(t);
449
+ t.assignedSlot ? t = t.assignedSlot : !i && s !== t.ownerDocument ? t = s.host : t = i;
450
+ }
451
+ t = u;
452
+ }
453
+ if (Mo(t))
454
+ return !t.getClientRects().length;
455
+ if (r !== "legacy-full")
456
+ return !0;
457
+ } else if (r === "non-zero-area")
458
+ return on(t);
459
+ return !1;
460
+ }, No = function(t) {
461
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
462
+ for (var n = t.parentElement; n; ) {
463
+ if (n.tagName === "FIELDSET" && n.disabled) {
464
+ for (var r = 0; r < n.children.length; r++) {
465
+ var o = n.children.item(r);
466
+ if (o.tagName === "LEGEND")
467
+ return We.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
468
+ }
469
+ return !0;
470
+ }
471
+ n = n.parentElement;
472
+ }
473
+ return !1;
474
+ }, $t = function(t, n) {
475
+ return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
476
+ // because we're limited in the type of selectors we can use in JSDom (see related
477
+ // note related to `candidateSelectors`)
478
+ dt(n) || Ro(n) || Io(n, t) || // For a details element with a summary, the summary element gets the focus
479
+ xo(n) || No(n));
480
+ }, Ut = function(t, n) {
481
+ return !(To(n) || Kn(n) < 0 || !$t(t, n));
482
+ }, Po = function(t) {
483
+ var n = parseInt(t.getAttribute("tabindex"), 10);
484
+ return !!(isNaN(n) || n >= 0);
485
+ }, Oo = function e(t) {
486
+ var n = [], r = [];
487
+ return t.forEach(function(o, l) {
488
+ var a = !!o.scopeParent, u = a ? o.scopeParent : o, i = Eo(u, a), s = a ? e(o.candidates) : u;
489
+ i === 0 ? a ? n.push.apply(n, s) : n.push(u) : r.push({
490
+ documentOrder: l,
491
+ tabIndex: i,
492
+ item: o,
493
+ isScope: a,
494
+ content: s
495
+ });
496
+ }), r.sort(vo).reduce(function(o, l) {
497
+ return l.isScope ? o.push.apply(o, l.content) : o.push(l.content), o;
498
+ }, []).concat(n);
499
+ }, Ct = function(t, n) {
500
+ n = n || {};
501
+ var r;
502
+ return n.getShadowRoot ? r = Yn([t], n.includeContainer, {
503
+ filter: Ut.bind(null, n),
504
+ flatten: !1,
505
+ getShadowRoot: n.getShadowRoot,
506
+ shadowRootFilter: Po
507
+ }) : r = zn(t, n.includeContainer, Ut.bind(null, n)), Oo(r);
508
+ }, Do = function(t, n) {
509
+ n = n || {};
510
+ var r;
511
+ return n.getShadowRoot ? r = Yn([t], n.includeContainer, {
512
+ filter: $t.bind(null, n),
513
+ flatten: !0,
514
+ getShadowRoot: n.getShadowRoot
515
+ }) : r = zn(t, n.includeContainer, $t.bind(null, n)), r;
516
+ }, Xn = function(t, n) {
517
+ if (n = n || {}, !t)
518
+ throw new Error("No node provided");
519
+ return We.call(t, ut) === !1 ? !1 : Ut(n, t);
520
+ };
521
+ function Qn() {
522
+ const e = navigator.userAgentData;
523
+ return e != null && e.platform ? e.platform : navigator.platform;
524
+ }
525
+ function qn() {
526
+ const e = navigator.userAgentData;
527
+ return e && Array.isArray(e.brands) ? e.brands.map((t) => {
528
+ let {
529
+ brand: n,
530
+ version: r
531
+ } = t;
532
+ return n + "/" + r;
533
+ }).join(" ") : navigator.userAgent;
534
+ }
535
+ function Lo() {
536
+ return /apple/i.test(navigator.vendor);
537
+ }
538
+ function Vt() {
539
+ const e = /android/i;
540
+ return e.test(Qn()) || e.test(qn());
541
+ }
542
+ function Fo() {
543
+ return qn().includes("jsdom/");
544
+ }
545
+ const sn = "data-floating-ui-focusable", ko = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
546
+ function _e(e) {
547
+ let t = e.activeElement;
548
+ for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
549
+ var n;
550
+ t = t.shadowRoot.activeElement;
551
+ }
552
+ return t;
553
+ }
554
+ function oe(e, t) {
555
+ if (!e || !t)
556
+ return !1;
557
+ const n = t.getRootNode == null ? void 0 : t.getRootNode();
558
+ if (e.contains(t))
559
+ return !0;
560
+ if (n && kt(n)) {
561
+ let r = t;
562
+ for (; r; ) {
563
+ if (e === r)
564
+ return !0;
565
+ r = r.parentNode || r.host;
566
+ }
567
+ }
568
+ return !1;
569
+ }
570
+ function Se(e) {
571
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
572
+ }
573
+ function It(e, t) {
574
+ if (t == null)
575
+ return !1;
576
+ if ("composedPath" in e)
577
+ return e.composedPath().includes(t);
578
+ const n = e;
579
+ return n.target != null && t.contains(n.target);
580
+ }
581
+ function Bo(e) {
582
+ return e.matches("html,body");
583
+ }
584
+ function he(e) {
585
+ return (e == null ? void 0 : e.ownerDocument) || document;
586
+ }
587
+ function Zn(e) {
588
+ return Q(e) && e.matches(ko);
589
+ }
590
+ function ln(e) {
591
+ return e ? e.getAttribute("role") === "combobox" && Zn(e) : !1;
592
+ }
593
+ function Ht(e) {
594
+ return e ? e.hasAttribute(sn) ? e : e.querySelector("[" + sn + "]") || e : null;
595
+ }
596
+ function Ue(e, t, n) {
597
+ return n === void 0 && (n = !0), e.filter((o) => {
598
+ var l;
599
+ return o.parentId === t && (!n || ((l = o.context) == null ? void 0 : l.open));
600
+ }).flatMap((o) => [o, ...Ue(e, o.id, n)]);
601
+ }
602
+ function cn(e, t) {
603
+ var n;
604
+ let r = [], o = (n = e.find((l) => l.id === t)) == null ? void 0 : n.parentId;
605
+ for (; o; ) {
606
+ const l = e.find((a) => a.id === o);
607
+ o = l == null ? void 0 : l.parentId, l && (r = r.concat(l));
608
+ }
609
+ return r;
610
+ }
611
+ function Nt(e) {
612
+ e.preventDefault(), e.stopPropagation();
613
+ }
614
+ function _o(e) {
615
+ return "nativeEvent" in e;
616
+ }
617
+ function $o(e) {
618
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : Vt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
619
+ }
620
+ function Uo(e) {
621
+ return Fo() ? !1 : !Vt() && e.width === 0 && e.height === 0 || Vt() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
622
+ e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
623
+ }
624
+ function an(e, t) {
625
+ return ["mouse", "pen"].includes(e);
626
+ }
627
+ var Vo = typeof document < "u", Ho = function() {
628
+ }, se = Vo ? Ln : Ho;
629
+ const Wo = {
630
+ ...E
631
+ };
632
+ function Pt(e) {
633
+ const t = E.useRef(e);
634
+ return se(() => {
635
+ t.current = e;
636
+ }), t;
637
+ }
638
+ const zo = Wo.useInsertionEffect, Yo = zo || ((e) => e());
639
+ function ge(e) {
640
+ const t = E.useRef(() => {
641
+ if (process.env.NODE_ENV !== "production")
642
+ throw new Error("Cannot call an event handler while rendering.");
643
+ });
644
+ return Yo(() => {
645
+ t.current = e;
646
+ }), E.useCallback(function() {
647
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
648
+ r[o] = arguments[o];
649
+ return t.current == null ? void 0 : t.current(...r);
650
+ }, []);
651
+ }
652
+ const qe = () => ({
653
+ getShadowRoot: !0,
654
+ displayCheck: (
655
+ // JSDOM does not support the `tabbable` library. To solve this we can
656
+ // check if `ResizeObserver` is a real function (not polyfilled), which
657
+ // determines if the current environment is JSDOM-like.
658
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
659
+ )
660
+ });
661
+ function Jn(e, t) {
662
+ const n = Ct(e, qe()), r = n.length;
663
+ if (r === 0) return;
664
+ const o = _e(he(e)), l = n.indexOf(o), a = l === -1 ? t === 1 ? 0 : r - 1 : l + t;
665
+ return n[a];
666
+ }
667
+ function er(e) {
668
+ return Jn(he(e).body, 1) || e;
669
+ }
670
+ function tr(e) {
671
+ return Jn(he(e).body, -1) || e;
672
+ }
673
+ function ze(e, t) {
674
+ const n = t || e.currentTarget, r = e.relatedTarget;
675
+ return !r || !oe(n, r);
676
+ }
677
+ function jo(e) {
678
+ Ct(e, qe()).forEach((n) => {
679
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
680
+ });
681
+ }
682
+ function un(e) {
683
+ e.querySelectorAll("[data-tabindex]").forEach((n) => {
684
+ const r = n.dataset.tabindex;
685
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
686
+ });
687
+ }
688
+ function fn(e, t, n) {
689
+ let {
690
+ reference: r,
691
+ floating: o
692
+ } = e;
693
+ const l = Te(t), a = Hn(t), u = Vn(a), i = Le(t), s = l === "y", c = r.x + r.width / 2 - o.width / 2, f = r.y + r.height / 2 - o.height / 2, d = r[u] / 2 - o[u] / 2;
694
+ let h;
695
+ switch (i) {
696
+ case "top":
697
+ h = {
698
+ x: c,
699
+ y: r.y - o.height
700
+ };
701
+ break;
702
+ case "bottom":
703
+ h = {
704
+ x: c,
705
+ y: r.y + r.height
706
+ };
707
+ break;
708
+ case "right":
709
+ h = {
710
+ x: r.x + r.width,
711
+ y: f
712
+ };
713
+ break;
714
+ case "left":
715
+ h = {
716
+ x: r.x - o.width,
717
+ y: f
718
+ };
719
+ break;
720
+ default:
721
+ h = {
722
+ x: r.x,
723
+ y: r.y
724
+ };
725
+ }
726
+ switch (xt(t)) {
727
+ case "start":
728
+ h[a] -= d * (n && s ? -1 : 1);
729
+ break;
730
+ case "end":
731
+ h[a] += d * (n && s ? -1 : 1);
732
+ break;
733
+ }
734
+ return h;
735
+ }
736
+ const Ko = async (e, t, n) => {
737
+ const {
738
+ placement: r = "bottom",
739
+ strategy: o = "absolute",
740
+ middleware: l = [],
741
+ platform: a
742
+ } = n, u = l.filter(Boolean), i = await (a.isRTL == null ? void 0 : a.isRTL(t));
743
+ let s = await a.getElementRects({
744
+ reference: e,
745
+ floating: t,
746
+ strategy: o
747
+ }), {
748
+ x: c,
749
+ y: f
750
+ } = fn(s, r, i), d = r, h = {}, m = 0;
751
+ for (let p = 0; p < u.length; p++) {
752
+ const {
753
+ name: g,
754
+ fn: y
755
+ } = u[p], {
756
+ x: w,
757
+ y: b,
758
+ data: C,
759
+ reset: S
760
+ } = await y({
761
+ x: c,
762
+ y: f,
763
+ initialPlacement: r,
764
+ placement: d,
765
+ strategy: o,
766
+ middlewareData: h,
767
+ rects: s,
768
+ platform: a,
769
+ elements: {
770
+ reference: e,
771
+ floating: t
772
+ }
773
+ });
774
+ c = w ?? c, f = b ?? f, h = {
775
+ ...h,
776
+ [g]: {
777
+ ...h[g],
778
+ ...C
779
+ }
780
+ }, S && m <= 50 && (m++, typeof S == "object" && (S.placement && (d = S.placement), S.rects && (s = S.rects === !0 ? await a.getElementRects({
781
+ reference: e,
782
+ floating: t,
783
+ strategy: o
784
+ }) : S.rects), {
785
+ x: c,
786
+ y: f
787
+ } = fn(s, d, i)), p = -1);
788
+ }
789
+ return {
790
+ x: c,
791
+ y: f,
792
+ placement: d,
793
+ strategy: o,
794
+ middlewareData: h
795
+ };
796
+ };
797
+ async function nr(e, t) {
798
+ var n;
799
+ t === void 0 && (t = {});
800
+ const {
801
+ x: r,
802
+ y: o,
803
+ platform: l,
804
+ rects: a,
805
+ elements: u,
806
+ strategy: i
807
+ } = e, {
808
+ boundary: s = "clippingAncestors",
809
+ rootBoundary: c = "viewport",
810
+ elementContext: f = "floating",
811
+ altBoundary: d = !1,
812
+ padding: h = 0
813
+ } = Rt(t, e), m = bo(h), g = u[d ? f === "floating" ? "reference" : "floating" : f], y = at(await l.getClippingRect({
814
+ element: (n = await (l.isElement == null ? void 0 : l.isElement(g))) == null || n ? g : g.contextElement || await (l.getDocumentElement == null ? void 0 : l.getDocumentElement(u.floating)),
815
+ boundary: s,
816
+ rootBoundary: c,
817
+ strategy: i
818
+ })), w = f === "floating" ? {
819
+ x: r,
820
+ y: o,
821
+ width: a.floating.width,
822
+ height: a.floating.height
823
+ } : a.reference, b = await (l.getOffsetParent == null ? void 0 : l.getOffsetParent(u.floating)), C = await (l.isElement == null ? void 0 : l.isElement(b)) ? await (l.getScale == null ? void 0 : l.getScale(b)) || {
824
+ x: 1,
825
+ y: 1
826
+ } : {
827
+ x: 1,
828
+ y: 1
829
+ }, S = at(l.convertOffsetParentRelativeRectToViewportRelativeRect ? await l.convertOffsetParentRelativeRectToViewportRelativeRect({
830
+ elements: u,
831
+ rect: w,
832
+ offsetParent: b,
833
+ strategy: i
834
+ }) : w);
835
+ return {
836
+ top: (y.top - S.top + m.top) / C.y,
837
+ bottom: (S.bottom - y.bottom + m.bottom) / C.y,
838
+ left: (y.left - S.left + m.left) / C.x,
839
+ right: (S.right - y.right + m.right) / C.x
840
+ };
841
+ }
842
+ const Go = function(e) {
843
+ return e === void 0 && (e = {}), {
844
+ name: "flip",
845
+ options: e,
846
+ async fn(t) {
847
+ var n, r;
848
+ const {
849
+ placement: o,
850
+ middlewareData: l,
851
+ rects: a,
852
+ initialPlacement: u,
853
+ platform: i,
854
+ elements: s
855
+ } = t, {
856
+ mainAxis: c = !0,
857
+ crossAxis: f = !0,
858
+ fallbackPlacements: d,
859
+ fallbackStrategy: h = "bestFit",
860
+ fallbackAxisSideDirection: m = "none",
861
+ flipAlignment: p = !0,
862
+ ...g
863
+ } = Rt(e, t);
864
+ if ((n = l.arrow) != null && n.alignmentOffset)
865
+ return {};
866
+ const y = Le(o), w = Te(u), b = Le(u) === u, C = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), S = d || (b || !p ? [ct(u)] : uo(u)), T = m !== "none";
867
+ !d && T && S.push(...po(u, p, m, C));
868
+ const L = [u, ...S], $ = await nr(t, g), W = [];
869
+ let U = ((r = l.flip) == null ? void 0 : r.overflows) || [];
870
+ if (c && W.push($[y]), f) {
871
+ const v = ao(o, a, C);
872
+ W.push($[v[0]], $[v[1]]);
873
+ }
874
+ if (U = [...U, {
875
+ placement: o,
876
+ overflows: W
877
+ }], !W.every((v) => v <= 0)) {
878
+ var I, q;
879
+ const v = (((I = l.flip) == null ? void 0 : I.index) || 0) + 1, A = L[v];
880
+ if (A && (!(f === "alignment" ? w !== Te(A) : !1) || // We leave the current main axis only if every placement on that axis
881
+ // overflows the main axis.
882
+ U.every((x) => Te(x.placement) === w ? x.overflows[0] > 0 : !0)))
883
+ return {
884
+ data: {
885
+ index: v,
886
+ overflows: U
887
+ },
888
+ reset: {
889
+ placement: A
890
+ }
891
+ };
892
+ let F = (q = U.filter((k) => k.overflows[0] <= 0).sort((k, x) => k.overflows[1] - x.overflows[1])[0]) == null ? void 0 : q.placement;
893
+ if (!F)
894
+ switch (h) {
895
+ case "bestFit": {
896
+ var P;
897
+ const k = (P = U.filter((x) => {
898
+ if (T) {
899
+ const M = Te(x.placement);
900
+ return M === w || // Create a bias to the `y` side axis due to horizontal
901
+ // reading directions favoring greater width.
902
+ M === "y";
903
+ }
904
+ return !0;
905
+ }).map((x) => [x.placement, x.overflows.filter((M) => M > 0).reduce((M, _) => M + _, 0)]).sort((x, M) => x[1] - M[1])[0]) == null ? void 0 : P[0];
906
+ k && (F = k);
907
+ break;
908
+ }
909
+ case "initialPlacement":
910
+ F = u;
911
+ break;
912
+ }
913
+ if (o !== F)
914
+ return {
915
+ reset: {
916
+ placement: F
917
+ }
918
+ };
919
+ }
920
+ return {};
921
+ }
922
+ };
923
+ }, Xo = /* @__PURE__ */ new Set(["left", "top"]);
924
+ async function Qo(e, t) {
925
+ const {
926
+ placement: n,
927
+ platform: r,
928
+ elements: o
929
+ } = e, l = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Le(n), u = xt(n), i = Te(n) === "y", s = Xo.has(a) ? -1 : 1, c = l && i ? -1 : 1, f = Rt(t, e);
930
+ let {
931
+ mainAxis: d,
932
+ crossAxis: h,
933
+ alignmentAxis: m
934
+ } = typeof f == "number" ? {
935
+ mainAxis: f,
936
+ crossAxis: 0,
937
+ alignmentAxis: null
938
+ } : {
939
+ mainAxis: f.mainAxis || 0,
940
+ crossAxis: f.crossAxis || 0,
941
+ alignmentAxis: f.alignmentAxis
942
+ };
943
+ return u && typeof m == "number" && (h = u === "end" ? m * -1 : m), i ? {
944
+ x: h * c,
945
+ y: d * s
946
+ } : {
947
+ x: d * s,
948
+ y: h * c
949
+ };
950
+ }
951
+ const qo = function(e) {
952
+ return e === void 0 && (e = 0), {
953
+ name: "offset",
954
+ options: e,
955
+ async fn(t) {
956
+ var n, r;
957
+ const {
958
+ x: o,
959
+ y: l,
960
+ placement: a,
961
+ middlewareData: u
962
+ } = t, i = await Qo(t, e);
963
+ return a === ((n = u.offset) == null ? void 0 : n.placement) && (r = u.arrow) != null && r.alignmentOffset ? {} : {
964
+ x: o + i.x,
965
+ y: l + i.y,
966
+ data: {
967
+ ...i,
968
+ placement: a
969
+ }
970
+ };
971
+ }
972
+ };
973
+ }, Zo = function(e) {
974
+ return e === void 0 && (e = {}), {
975
+ name: "shift",
976
+ options: e,
977
+ async fn(t) {
978
+ const {
979
+ x: n,
980
+ y: r,
981
+ placement: o
982
+ } = t, {
983
+ mainAxis: l = !0,
984
+ crossAxis: a = !1,
985
+ limiter: u = {
986
+ fn: (g) => {
987
+ let {
988
+ x: y,
989
+ y: w
990
+ } = g;
991
+ return {
992
+ x: y,
993
+ y: w
994
+ };
995
+ }
996
+ },
997
+ ...i
998
+ } = Rt(e, t), s = {
999
+ x: n,
1000
+ y: r
1001
+ }, c = await nr(t, i), f = Te(Le(o)), d = Un(f);
1002
+ let h = s[d], m = s[f];
1003
+ if (l) {
1004
+ const g = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", w = h + c[g], b = h - c[y];
1005
+ h = tn(w, h, b);
1006
+ }
1007
+ if (a) {
1008
+ const g = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", w = m + c[g], b = m - c[y];
1009
+ m = tn(w, m, b);
1010
+ }
1011
+ const p = u.fn({
1012
+ ...t,
1013
+ [d]: h,
1014
+ [f]: m
1015
+ });
1016
+ return {
1017
+ ...p,
1018
+ data: {
1019
+ x: p.x - n,
1020
+ y: p.y - r,
1021
+ enabled: {
1022
+ [d]: l,
1023
+ [f]: a
1024
+ }
1025
+ }
1026
+ };
1027
+ }
1028
+ };
1029
+ };
1030
+ function rr(e) {
1031
+ const t = fe(e);
1032
+ let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
1033
+ const o = Q(e), l = o ? e.offsetWidth : n, a = o ? e.offsetHeight : r, u = lt(n) !== l || lt(r) !== a;
1034
+ return u && (n = l, r = a), {
1035
+ width: n,
1036
+ height: r,
1037
+ $: u
1038
+ };
1039
+ }
1040
+ function Qt(e) {
1041
+ return j(e) ? e : e.contextElement;
1042
+ }
1043
+ function Ve(e) {
1044
+ const t = Qt(e);
1045
+ if (!Q(t))
1046
+ return be(1);
1047
+ const n = t.getBoundingClientRect(), {
1048
+ width: r,
1049
+ height: o,
1050
+ $: l
1051
+ } = rr(t);
1052
+ let a = (l ? lt(n.width) : n.width) / r, u = (l ? lt(n.height) : n.height) / o;
1053
+ return (!a || !Number.isFinite(a)) && (a = 1), (!u || !Number.isFinite(u)) && (u = 1), {
1054
+ x: a,
1055
+ y: u
1056
+ };
1057
+ }
1058
+ const Jo = /* @__PURE__ */ be(0);
1059
+ function or(e) {
1060
+ const t = le(e);
1061
+ return !Et() || !t.visualViewport ? Jo : {
1062
+ x: t.visualViewport.offsetLeft,
1063
+ y: t.visualViewport.offsetTop
1064
+ };
1065
+ }
1066
+ function ei(e, t, n) {
1067
+ return t === void 0 && (t = !1), !n || t && n !== le(e) ? !1 : t;
1068
+ }
1069
+ function Fe(e, t, n, r) {
1070
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1071
+ const o = e.getBoundingClientRect(), l = Qt(e);
1072
+ let a = be(1);
1073
+ t && (r ? j(r) && (a = Ve(r)) : a = Ve(e));
1074
+ const u = ei(l, n, r) ? or(l) : be(0);
1075
+ let i = (o.left + u.x) / a.x, s = (o.top + u.y) / a.y, c = o.width / a.x, f = o.height / a.y;
1076
+ if (l) {
1077
+ const d = le(l), h = r && j(r) ? le(r) : r;
1078
+ let m = d, p = Bt(m);
1079
+ for (; p && r && h !== m; ) {
1080
+ const g = Ve(p), y = p.getBoundingClientRect(), w = fe(p), b = y.left + (p.clientLeft + parseFloat(w.paddingLeft)) * g.x, C = y.top + (p.clientTop + parseFloat(w.paddingTop)) * g.y;
1081
+ i *= g.x, s *= g.y, c *= g.x, f *= g.y, i += b, s += C, m = le(p), p = Bt(m);
1082
+ }
1083
+ }
1084
+ return at({
1085
+ width: c,
1086
+ height: f,
1087
+ x: i,
1088
+ y: s
1089
+ });
1090
+ }
1091
+ function At(e, t) {
1092
+ const n = vt(e).scrollLeft;
1093
+ return t ? t.left + n : Fe(we(e)).left + n;
1094
+ }
1095
+ function ir(e, t) {
1096
+ const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - At(e, n), o = n.top + t.scrollTop;
1097
+ return {
1098
+ x: r,
1099
+ y: o
1100
+ };
1101
+ }
1102
+ function ti(e) {
1103
+ let {
1104
+ elements: t,
1105
+ rect: n,
1106
+ offsetParent: r,
1107
+ strategy: o
1108
+ } = e;
1109
+ const l = o === "fixed", a = we(r), u = t ? yt(t.floating) : !1;
1110
+ if (r === a || u && l)
1111
+ return n;
1112
+ let i = {
1113
+ scrollLeft: 0,
1114
+ scrollTop: 0
1115
+ }, s = be(1);
1116
+ const c = be(0), f = Q(r);
1117
+ if ((f || !f && !l) && ((Pe(r) !== "body" || Qe(a)) && (i = vt(r)), Q(r))) {
1118
+ const h = Fe(r);
1119
+ s = Ve(r), c.x = h.x + r.clientLeft, c.y = h.y + r.clientTop;
1120
+ }
1121
+ const d = a && !f && !l ? ir(a, i) : be(0);
1122
+ return {
1123
+ width: n.width * s.x,
1124
+ height: n.height * s.y,
1125
+ x: n.x * s.x - i.scrollLeft * s.x + c.x + d.x,
1126
+ y: n.y * s.y - i.scrollTop * s.y + c.y + d.y
1127
+ };
1128
+ }
1129
+ function ni(e) {
1130
+ return Array.from(e.getClientRects());
1131
+ }
1132
+ function ri(e) {
1133
+ const t = we(e), n = vt(e), r = e.ownerDocument.body, o = De(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), l = De(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1134
+ let a = -n.scrollLeft + At(e);
1135
+ const u = -n.scrollTop;
1136
+ return fe(r).direction === "rtl" && (a += De(t.clientWidth, r.clientWidth) - o), {
1137
+ width: o,
1138
+ height: l,
1139
+ x: a,
1140
+ y: u
1141
+ };
1142
+ }
1143
+ const dn = 25;
1144
+ function oi(e, t) {
1145
+ const n = le(e), r = we(e), o = n.visualViewport;
1146
+ let l = r.clientWidth, a = r.clientHeight, u = 0, i = 0;
1147
+ if (o) {
1148
+ l = o.width, a = o.height;
1149
+ const c = Et();
1150
+ (!c || c && t === "fixed") && (u = o.offsetLeft, i = o.offsetTop);
1151
+ }
1152
+ const s = At(r);
1153
+ if (s <= 0) {
1154
+ const c = r.ownerDocument, f = c.body, d = getComputedStyle(f), h = c.compatMode === "CSS1Compat" && parseFloat(d.marginLeft) + parseFloat(d.marginRight) || 0, m = Math.abs(r.clientWidth - f.clientWidth - h);
1155
+ m <= dn && (l -= m);
1156
+ } else s <= dn && (l += s);
1157
+ return {
1158
+ width: l,
1159
+ height: a,
1160
+ x: u,
1161
+ y: i
1162
+ };
1163
+ }
1164
+ const ii = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1165
+ function si(e, t) {
1166
+ const n = Fe(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, l = Q(e) ? Ve(e) : be(1), a = e.clientWidth * l.x, u = e.clientHeight * l.y, i = o * l.x, s = r * l.y;
1167
+ return {
1168
+ width: a,
1169
+ height: u,
1170
+ x: i,
1171
+ y: s
1172
+ };
1173
+ }
1174
+ function hn(e, t, n) {
1175
+ let r;
1176
+ if (t === "viewport")
1177
+ r = oi(e, n);
1178
+ else if (t === "document")
1179
+ r = ri(we(e));
1180
+ else if (j(t))
1181
+ r = si(t, n);
1182
+ else {
1183
+ const o = or(e);
1184
+ r = {
1185
+ x: t.x - o.x,
1186
+ y: t.y - o.y,
1187
+ width: t.width,
1188
+ height: t.height
1189
+ };
1190
+ }
1191
+ return at(r);
1192
+ }
1193
+ function sr(e, t) {
1194
+ const n = Re(e);
1195
+ return n === t || !j(n) || ve(n) ? !1 : fe(n).position === "fixed" || sr(n, t);
1196
+ }
1197
+ function li(e, t) {
1198
+ const n = t.get(e);
1199
+ if (n)
1200
+ return n;
1201
+ let r = Ie(e, [], !1).filter((u) => j(u) && Pe(u) !== "body"), o = null;
1202
+ const l = fe(e).position === "fixed";
1203
+ let a = l ? Re(e) : e;
1204
+ for (; j(a) && !ve(a); ) {
1205
+ const u = fe(a), i = Xt(a);
1206
+ !i && u.position === "fixed" && (o = null), (l ? !i && !o : !i && u.position === "static" && !!o && ii.has(o.position) || Qe(a) && !i && sr(e, a)) ? r = r.filter((c) => c !== a) : o = u, a = Re(a);
1207
+ }
1208
+ return t.set(e, r), r;
1209
+ }
1210
+ function ci(e) {
1211
+ let {
1212
+ element: t,
1213
+ boundary: n,
1214
+ rootBoundary: r,
1215
+ strategy: o
1216
+ } = e;
1217
+ const a = [...n === "clippingAncestors" ? yt(t) ? [] : li(t, this._c) : [].concat(n), r], u = a[0], i = a.reduce((s, c) => {
1218
+ const f = hn(t, c, o);
1219
+ return s.top = De(f.top, s.top), s.right = st(f.right, s.right), s.bottom = st(f.bottom, s.bottom), s.left = De(f.left, s.left), s;
1220
+ }, hn(t, u, o));
1221
+ return {
1222
+ width: i.right - i.left,
1223
+ height: i.bottom - i.top,
1224
+ x: i.left,
1225
+ y: i.top
1226
+ };
1227
+ }
1228
+ function ai(e) {
1229
+ const {
1230
+ width: t,
1231
+ height: n
1232
+ } = rr(e);
1233
+ return {
1234
+ width: t,
1235
+ height: n
1236
+ };
1237
+ }
1238
+ function ui(e, t, n) {
1239
+ const r = Q(t), o = we(t), l = n === "fixed", a = Fe(e, !0, l, t);
1240
+ let u = {
1241
+ scrollLeft: 0,
1242
+ scrollTop: 0
1243
+ };
1244
+ const i = be(0);
1245
+ function s() {
1246
+ i.x = At(o);
1247
+ }
1248
+ if (r || !r && !l)
1249
+ if ((Pe(t) !== "body" || Qe(o)) && (u = vt(t)), r) {
1250
+ const h = Fe(t, !0, l, t);
1251
+ i.x = h.x + t.clientLeft, i.y = h.y + t.clientTop;
1252
+ } else o && s();
1253
+ l && !r && o && s();
1254
+ const c = o && !r && !l ? ir(o, u) : be(0), f = a.left + u.scrollLeft - i.x - c.x, d = a.top + u.scrollTop - i.y - c.y;
1255
+ return {
1256
+ x: f,
1257
+ y: d,
1258
+ width: a.width,
1259
+ height: a.height
1260
+ };
1261
+ }
1262
+ function Ot(e) {
1263
+ return fe(e).position === "static";
1264
+ }
1265
+ function mn(e, t) {
1266
+ if (!Q(e) || fe(e).position === "fixed")
1267
+ return null;
1268
+ if (t)
1269
+ return t(e);
1270
+ let n = e.offsetParent;
1271
+ return we(e) === n && (n = n.ownerDocument.body), n;
1272
+ }
1273
+ function lr(e, t) {
1274
+ const n = le(e);
1275
+ if (yt(e))
1276
+ return n;
1277
+ if (!Q(e)) {
1278
+ let o = Re(e);
1279
+ for (; o && !ve(o); ) {
1280
+ if (j(o) && !Ot(o))
1281
+ return o;
1282
+ o = Re(o);
1283
+ }
1284
+ return n;
1285
+ }
1286
+ let r = mn(e, t);
1287
+ for (; r && Jr(r) && Ot(r); )
1288
+ r = mn(r, t);
1289
+ return r && ve(r) && Ot(r) && !Xt(r) ? n : r || oo(e) || n;
1290
+ }
1291
+ const fi = async function(e) {
1292
+ const t = this.getOffsetParent || lr, n = this.getDimensions, r = await n(e.floating);
1293
+ return {
1294
+ reference: ui(e.reference, await t(e.floating), e.strategy),
1295
+ floating: {
1296
+ x: 0,
1297
+ y: 0,
1298
+ width: r.width,
1299
+ height: r.height
1300
+ }
1301
+ };
1302
+ };
1303
+ function di(e) {
1304
+ return fe(e).direction === "rtl";
1305
+ }
1306
+ const hi = {
1307
+ convertOffsetParentRelativeRectToViewportRelativeRect: ti,
1308
+ getDocumentElement: we,
1309
+ getClippingRect: ci,
1310
+ getOffsetParent: lr,
1311
+ getElementRects: fi,
1312
+ getClientRects: ni,
1313
+ getDimensions: ai,
1314
+ getScale: Ve,
1315
+ isElement: j,
1316
+ isRTL: di
1317
+ };
1318
+ function cr(e, t) {
1319
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1320
+ }
1321
+ function mi(e, t) {
1322
+ let n = null, r;
1323
+ const o = we(e);
1324
+ function l() {
1325
+ var u;
1326
+ clearTimeout(r), (u = n) == null || u.disconnect(), n = null;
1327
+ }
1328
+ function a(u, i) {
1329
+ u === void 0 && (u = !1), i === void 0 && (i = 1), l();
1330
+ const s = e.getBoundingClientRect(), {
1331
+ left: c,
1332
+ top: f,
1333
+ width: d,
1334
+ height: h
1335
+ } = s;
1336
+ if (u || t(), !d || !h)
1337
+ return;
1338
+ const m = et(f), p = et(o.clientWidth - (c + d)), g = et(o.clientHeight - (f + h)), y = et(c), b = {
1339
+ rootMargin: -m + "px " + -p + "px " + -g + "px " + -y + "px",
1340
+ threshold: De(0, st(1, i)) || 1
1341
+ };
1342
+ let C = !0;
1343
+ function S(T) {
1344
+ const L = T[0].intersectionRatio;
1345
+ if (L !== i) {
1346
+ if (!C)
1347
+ return a();
1348
+ L ? a(!1, L) : r = setTimeout(() => {
1349
+ a(!1, 1e-7);
1350
+ }, 1e3);
1351
+ }
1352
+ L === 1 && !cr(s, e.getBoundingClientRect()) && a(), C = !1;
1353
+ }
1354
+ try {
1355
+ n = new IntersectionObserver(S, {
1356
+ ...b,
1357
+ // Handle <iframe>s
1358
+ root: o.ownerDocument
1359
+ });
1360
+ } catch {
1361
+ n = new IntersectionObserver(S, b);
1362
+ }
1363
+ n.observe(e);
1364
+ }
1365
+ return a(!0), l;
1366
+ }
1367
+ function pi(e, t, n, r) {
1368
+ r === void 0 && (r = {});
1369
+ const {
1370
+ ancestorScroll: o = !0,
1371
+ ancestorResize: l = !0,
1372
+ elementResize: a = typeof ResizeObserver == "function",
1373
+ layoutShift: u = typeof IntersectionObserver == "function",
1374
+ animationFrame: i = !1
1375
+ } = r, s = Qt(e), c = o || l ? [...s ? Ie(s) : [], ...Ie(t)] : [];
1376
+ c.forEach((y) => {
1377
+ o && y.addEventListener("scroll", n, {
1378
+ passive: !0
1379
+ }), l && y.addEventListener("resize", n);
1380
+ });
1381
+ const f = s && u ? mi(s, n) : null;
1382
+ let d = -1, h = null;
1383
+ a && (h = new ResizeObserver((y) => {
1384
+ let [w] = y;
1385
+ w && w.target === s && h && (h.unobserve(t), cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1386
+ var b;
1387
+ (b = h) == null || b.observe(t);
1388
+ })), n();
1389
+ }), s && !i && h.observe(s), h.observe(t));
1390
+ let m, p = i ? Fe(e) : null;
1391
+ i && g();
1392
+ function g() {
1393
+ const y = Fe(e);
1394
+ p && !cr(p, y) && n(), p = y, m = requestAnimationFrame(g);
1395
+ }
1396
+ return n(), () => {
1397
+ var y;
1398
+ c.forEach((w) => {
1399
+ o && w.removeEventListener("scroll", n), l && w.removeEventListener("resize", n);
1400
+ }), f == null || f(), (y = h) == null || y.disconnect(), h = null, i && cancelAnimationFrame(m);
1401
+ };
1402
+ }
1403
+ const gi = qo, bi = Zo, wi = Go, yi = (e, t, n) => {
1404
+ const r = /* @__PURE__ */ new Map(), o = {
1405
+ platform: hi,
1406
+ ...n
1407
+ }, l = {
1408
+ ...o.platform,
1409
+ _c: r
1410
+ };
1411
+ return Ko(e, t, {
1412
+ ...o,
1413
+ platform: l
1414
+ });
1415
+ };
1416
+ var Ei = typeof document < "u", vi = function() {
1417
+ }, it = Ei ? Ln : vi;
1418
+ function ht(e, t) {
1419
+ if (e === t)
1420
+ return !0;
1421
+ if (typeof e != typeof t)
1422
+ return !1;
1423
+ if (typeof e == "function" && e.toString() === t.toString())
1424
+ return !0;
1425
+ let n, r, o;
1426
+ if (e && t && typeof e == "object") {
1427
+ if (Array.isArray(e)) {
1428
+ if (n = e.length, n !== t.length) return !1;
1429
+ for (r = n; r-- !== 0; )
1430
+ if (!ht(e[r], t[r]))
1431
+ return !1;
1432
+ return !0;
1433
+ }
1434
+ if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1435
+ return !1;
1436
+ for (r = n; r-- !== 0; )
1437
+ if (!{}.hasOwnProperty.call(t, o[r]))
1438
+ return !1;
1439
+ for (r = n; r-- !== 0; ) {
1440
+ const l = o[r];
1441
+ if (!(l === "_owner" && e.$$typeof) && !ht(e[l], t[l]))
1442
+ return !1;
1443
+ }
1444
+ return !0;
1445
+ }
1446
+ return e !== e && t !== t;
1447
+ }
1448
+ function ar(e) {
1449
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1450
+ }
1451
+ function pn(e, t) {
1452
+ const n = ar(e);
1453
+ return Math.round(t * n) / n;
1454
+ }
1455
+ function Dt(e) {
1456
+ const t = E.useRef(e);
1457
+ return it(() => {
1458
+ t.current = e;
1459
+ }), t;
1460
+ }
1461
+ function Ri(e) {
1462
+ e === void 0 && (e = {});
1463
+ const {
1464
+ placement: t = "bottom",
1465
+ strategy: n = "absolute",
1466
+ middleware: r = [],
1467
+ platform: o,
1468
+ elements: {
1469
+ reference: l,
1470
+ floating: a
1471
+ } = {},
1472
+ transform: u = !0,
1473
+ whileElementsMounted: i,
1474
+ open: s
1475
+ } = e, [c, f] = E.useState({
1476
+ x: 0,
1477
+ y: 0,
1478
+ strategy: n,
1479
+ placement: t,
1480
+ middlewareData: {},
1481
+ isPositioned: !1
1482
+ }), [d, h] = E.useState(r);
1483
+ ht(d, r) || h(r);
1484
+ const [m, p] = E.useState(null), [g, y] = E.useState(null), w = E.useCallback((x) => {
1485
+ x !== T.current && (T.current = x, p(x));
1486
+ }, []), b = E.useCallback((x) => {
1487
+ x !== L.current && (L.current = x, y(x));
1488
+ }, []), C = l || m, S = a || g, T = E.useRef(null), L = E.useRef(null), $ = E.useRef(c), W = i != null, U = Dt(i), I = Dt(o), q = Dt(s), P = E.useCallback(() => {
1489
+ if (!T.current || !L.current)
1490
+ return;
1491
+ const x = {
1492
+ placement: t,
1493
+ strategy: n,
1494
+ middleware: d
1495
+ };
1496
+ I.current && (x.platform = I.current), yi(T.current, L.current, x).then((M) => {
1497
+ const _ = {
1498
+ ...M,
1499
+ // The floating element's position may be recomputed while it's closed
1500
+ // but still mounted (such as when transitioning out). To ensure
1501
+ // `isPositioned` will be `false` initially on the next open, avoid
1502
+ // setting it to `true` when `open === false` (must be specified).
1503
+ isPositioned: q.current !== !1
1504
+ };
1505
+ v.current && !ht($.current, _) && ($.current = _, kn.flushSync(() => {
1506
+ f(_);
1507
+ }));
1508
+ });
1509
+ }, [d, t, n, I, q]);
1510
+ it(() => {
1511
+ s === !1 && $.current.isPositioned && ($.current.isPositioned = !1, f((x) => ({
1512
+ ...x,
1513
+ isPositioned: !1
1514
+ })));
1515
+ }, [s]);
1516
+ const v = E.useRef(!1);
1517
+ it(() => (v.current = !0, () => {
1518
+ v.current = !1;
1519
+ }), []), it(() => {
1520
+ if (C && (T.current = C), S && (L.current = S), C && S) {
1521
+ if (U.current)
1522
+ return U.current(C, S, P);
1523
+ P();
1524
+ }
1525
+ }, [C, S, P, U, W]);
1526
+ const A = E.useMemo(() => ({
1527
+ reference: T,
1528
+ floating: L,
1529
+ setReference: w,
1530
+ setFloating: b
1531
+ }), [w, b]), F = E.useMemo(() => ({
1532
+ reference: C,
1533
+ floating: S
1534
+ }), [C, S]), k = E.useMemo(() => {
1535
+ const x = {
1536
+ position: n,
1537
+ left: 0,
1538
+ top: 0
1539
+ };
1540
+ if (!F.floating)
1541
+ return x;
1542
+ const M = pn(F.floating, c.x), _ = pn(F.floating, c.y);
1543
+ return u ? {
1544
+ ...x,
1545
+ transform: "translate(" + M + "px, " + _ + "px)",
1546
+ ...ar(F.floating) >= 1.5 && {
1547
+ willChange: "transform"
1548
+ }
1549
+ } : {
1550
+ position: n,
1551
+ left: M,
1552
+ top: _
1553
+ };
1554
+ }, [n, u, F.floating, c.x, c.y]);
1555
+ return E.useMemo(() => ({
1556
+ ...c,
1557
+ update: P,
1558
+ refs: A,
1559
+ elements: F,
1560
+ floatingStyles: k
1561
+ }), [c, P, A, F, k]);
1562
+ }
1563
+ const xi = (e, t) => ({
1564
+ ...gi(e),
1565
+ options: [e, t]
1566
+ }), Ci = (e, t) => ({
1567
+ ...bi(e),
1568
+ options: [e, t]
1569
+ }), Ai = (e, t) => ({
1570
+ ...wi(e),
1571
+ options: [e, t]
1572
+ }), Si = "data-floating-ui-focusable", gn = "active", bn = "selected", Ti = {
1573
+ ...E
1574
+ };
1575
+ let wn = !1, Mi = 0;
1576
+ const yn = () => (
1577
+ // Ensure the id is unique with multiple independent versions of Floating UI
1578
+ // on <React 18
1579
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + Mi++
1580
+ );
1581
+ function Ii() {
1582
+ const [e, t] = E.useState(() => wn ? yn() : void 0);
1583
+ return se(() => {
1584
+ e == null && t(yn());
1585
+ }, []), E.useEffect(() => {
1586
+ wn = !0;
1587
+ }, []), e;
1588
+ }
1589
+ const Ni = Ti.useId, qt = Ni || Ii;
1590
+ let Wt;
1591
+ process.env.NODE_ENV !== "production" && (Wt = /* @__PURE__ */ new Set());
1592
+ function Pi() {
1593
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1594
+ n[r] = arguments[r];
1595
+ const o = "Floating UI: " + n.join(" ");
1596
+ if (!((e = Wt) != null && e.has(o))) {
1597
+ var l;
1598
+ (l = Wt) == null || l.add(o), console.error(o);
1599
+ }
1600
+ }
1601
+ function Oi() {
1602
+ const e = /* @__PURE__ */ new Map();
1603
+ return {
1604
+ emit(t, n) {
1605
+ var r;
1606
+ (r = e.get(t)) == null || r.forEach((o) => o(n));
1607
+ },
1608
+ on(t, n) {
1609
+ e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
1610
+ },
1611
+ off(t, n) {
1612
+ var r;
1613
+ (r = e.get(t)) == null || r.delete(n);
1614
+ }
1615
+ };
1616
+ }
1617
+ const Di = /* @__PURE__ */ E.createContext(null), Li = /* @__PURE__ */ E.createContext(null), ur = () => {
1618
+ var e;
1619
+ return ((e = E.useContext(Di)) == null ? void 0 : e.id) || null;
1620
+ }, Zt = () => E.useContext(Li);
1621
+ function Ke(e) {
1622
+ return "data-floating-ui-" + e;
1623
+ }
1624
+ function Fi(e) {
1625
+ e.current !== -1 && (clearTimeout(e.current), e.current = -1);
1626
+ }
1627
+ let En = 0;
1628
+ function Be(e, t) {
1629
+ t === void 0 && (t = {});
1630
+ const {
1631
+ preventScroll: n = !1,
1632
+ cancelPrevious: r = !0,
1633
+ sync: o = !1
1634
+ } = t;
1635
+ r && cancelAnimationFrame(En);
1636
+ const l = () => e == null ? void 0 : e.focus({
1637
+ preventScroll: n
1638
+ });
1639
+ o ? l() : En = requestAnimationFrame(l);
1640
+ }
1641
+ function ki(e) {
1642
+ return (e == null ? void 0 : e.ownerDocument) || document;
1643
+ }
1644
+ const He = {
1645
+ inert: /* @__PURE__ */ new WeakMap(),
1646
+ "aria-hidden": /* @__PURE__ */ new WeakMap(),
1647
+ none: /* @__PURE__ */ new WeakMap()
1648
+ };
1649
+ function vn(e) {
1650
+ return e === "inert" ? He.inert : e === "aria-hidden" ? He["aria-hidden"] : He.none;
1651
+ }
1652
+ let tt = /* @__PURE__ */ new WeakSet(), nt = {}, Lt = 0;
1653
+ const Bi = () => typeof HTMLElement < "u" && "inert" in HTMLElement.prototype, fr = (e) => e && (e.host || fr(e.parentNode)), _i = (e, t) => t.map((n) => {
1654
+ if (e.contains(n))
1655
+ return n;
1656
+ const r = fr(n);
1657
+ return e.contains(r) ? r : null;
1658
+ }).filter((n) => n != null);
1659
+ function $i(e, t, n, r) {
1660
+ const o = "data-floating-ui-inert", l = r ? "inert" : n ? "aria-hidden" : null, a = _i(t, e), u = /* @__PURE__ */ new Set(), i = new Set(a), s = [];
1661
+ nt[o] || (nt[o] = /* @__PURE__ */ new WeakMap());
1662
+ const c = nt[o];
1663
+ a.forEach(f), d(t), u.clear();
1664
+ function f(h) {
1665
+ !h || u.has(h) || (u.add(h), h.parentNode && f(h.parentNode));
1666
+ }
1667
+ function d(h) {
1668
+ !h || i.has(h) || [].forEach.call(h.children, (m) => {
1669
+ if (Pe(m) !== "script")
1670
+ if (u.has(m))
1671
+ d(m);
1672
+ else {
1673
+ const p = l ? m.getAttribute(l) : null, g = p !== null && p !== "false", y = vn(l), w = (y.get(m) || 0) + 1, b = (c.get(m) || 0) + 1;
1674
+ y.set(m, w), c.set(m, b), s.push(m), w === 1 && g && tt.add(m), b === 1 && m.setAttribute(o, ""), !g && l && m.setAttribute(l, l === "inert" ? "" : "true");
1675
+ }
1676
+ });
1677
+ }
1678
+ return Lt++, () => {
1679
+ s.forEach((h) => {
1680
+ const m = vn(l), g = (m.get(h) || 0) - 1, y = (c.get(h) || 0) - 1;
1681
+ m.set(h, g), c.set(h, y), g || (!tt.has(h) && l && h.removeAttribute(l), tt.delete(h)), y || h.removeAttribute(o);
1682
+ }), Lt--, Lt || (He.inert = /* @__PURE__ */ new WeakMap(), He["aria-hidden"] = /* @__PURE__ */ new WeakMap(), He.none = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakSet(), nt = {});
1683
+ };
1684
+ }
1685
+ function Rn(e, t, n) {
1686
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1687
+ const r = ki(e[0]).body;
1688
+ return $i(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))), r, t, n);
1689
+ }
1690
+ const St = {
1691
+ border: 0,
1692
+ clip: "rect(0 0 0 0)",
1693
+ height: "1px",
1694
+ margin: "-1px",
1695
+ overflow: "hidden",
1696
+ padding: 0,
1697
+ position: "fixed",
1698
+ whiteSpace: "nowrap",
1699
+ width: "1px",
1700
+ top: 0,
1701
+ left: 0
1702
+ }, mt = /* @__PURE__ */ E.forwardRef(function(t, n) {
1703
+ const [r, o] = E.useState();
1704
+ se(() => {
1705
+ Lo() && o("button");
1706
+ }, []);
1707
+ const l = {
1708
+ ref: n,
1709
+ tabIndex: 0,
1710
+ // Role is only for VoiceOver
1711
+ role: r,
1712
+ "aria-hidden": r ? void 0 : !0,
1713
+ [Ke("focus-guard")]: "",
1714
+ style: St
1715
+ };
1716
+ return /* @__PURE__ */ R("span", {
1717
+ ...t,
1718
+ ...l
1719
+ });
1720
+ }), dr = /* @__PURE__ */ E.createContext(null), xn = /* @__PURE__ */ Ke("portal");
1721
+ function Ui(e) {
1722
+ e === void 0 && (e = {});
1723
+ const {
1724
+ id: t,
1725
+ root: n
1726
+ } = e, r = qt(), o = hr(), [l, a] = E.useState(null), u = E.useRef(null);
1727
+ return se(() => () => {
1728
+ l == null || l.remove(), queueMicrotask(() => {
1729
+ u.current = null;
1730
+ });
1731
+ }, [l]), se(() => {
1732
+ if (!r || u.current) return;
1733
+ const i = t ? document.getElementById(t) : null;
1734
+ if (!i) return;
1735
+ const s = document.createElement("div");
1736
+ s.id = r, s.setAttribute(xn, ""), i.appendChild(s), u.current = s, a(s);
1737
+ }, [t, r]), se(() => {
1738
+ if (n === null || !r || u.current) return;
1739
+ let i = n || (o == null ? void 0 : o.portalNode);
1740
+ i && !Gt(i) && (i = i.current), i = i || document.body;
1741
+ let s = null;
1742
+ t && (s = document.createElement("div"), s.id = t, i.appendChild(s));
1743
+ const c = document.createElement("div");
1744
+ c.id = r, c.setAttribute(xn, ""), i = s || i, i.appendChild(c), u.current = c, a(c);
1745
+ }, [t, n, r, o]), l;
1746
+ }
1747
+ function Vi(e) {
1748
+ const {
1749
+ children: t,
1750
+ id: n,
1751
+ root: r,
1752
+ preserveTabOrder: o = !0
1753
+ } = e, l = Ui({
1754
+ id: n,
1755
+ root: r
1756
+ }), [a, u] = E.useState(null), i = E.useRef(null), s = E.useRef(null), c = E.useRef(null), f = E.useRef(null), d = a == null ? void 0 : a.modal, h = a == null ? void 0 : a.open, m = (
1757
+ // The FocusManager and therefore floating element are currently open/
1758
+ // rendered.
1759
+ !!a && // Guards are only for non-modal focus management.
1760
+ !a.modal && // Don't render if unmount is transitioning.
1761
+ a.open && o && !!(r || l)
1762
+ );
1763
+ return E.useEffect(() => {
1764
+ if (!l || !o || d)
1765
+ return;
1766
+ function p(g) {
1767
+ l && ze(g) && (g.type === "focusin" ? un : jo)(l);
1768
+ }
1769
+ return l.addEventListener("focusin", p, !0), l.addEventListener("focusout", p, !0), () => {
1770
+ l.removeEventListener("focusin", p, !0), l.removeEventListener("focusout", p, !0);
1771
+ };
1772
+ }, [l, o, d]), E.useEffect(() => {
1773
+ l && (h || un(l));
1774
+ }, [h, l]), /* @__PURE__ */ z(dr.Provider, {
1775
+ value: E.useMemo(() => ({
1776
+ preserveTabOrder: o,
1777
+ beforeOutsideRef: i,
1778
+ afterOutsideRef: s,
1779
+ beforeInsideRef: c,
1780
+ afterInsideRef: f,
1781
+ portalNode: l,
1782
+ setFocusManagerState: u
1783
+ }), [o, l]),
1784
+ children: [m && l && /* @__PURE__ */ R(mt, {
1785
+ "data-type": "outside",
1786
+ ref: i,
1787
+ onFocus: (p) => {
1788
+ if (ze(p, l)) {
1789
+ var g;
1790
+ (g = c.current) == null || g.focus();
1791
+ } else {
1792
+ const y = a ? a.domReference : null, w = tr(y);
1793
+ w == null || w.focus();
1794
+ }
1795
+ }
1796
+ }), m && l && /* @__PURE__ */ R("span", {
1797
+ "aria-owns": l.id,
1798
+ style: St
1799
+ }), l && /* @__PURE__ */ kn.createPortal(t, l), m && l && /* @__PURE__ */ R(mt, {
1800
+ "data-type": "outside",
1801
+ ref: s,
1802
+ onFocus: (p) => {
1803
+ if (ze(p, l)) {
1804
+ var g;
1805
+ (g = f.current) == null || g.focus();
1806
+ } else {
1807
+ const y = a ? a.domReference : null, w = er(y);
1808
+ w == null || w.focus(), a != null && a.closeOnFocusOut && (a == null || a.onOpenChange(!1, p.nativeEvent, "focus-out"));
1809
+ }
1810
+ }
1811
+ })]
1812
+ });
1813
+ }
1814
+ const hr = () => E.useContext(dr);
1815
+ function Cn(e) {
1816
+ return E.useMemo(() => (t) => {
1817
+ e.forEach((n) => {
1818
+ n && (n.current = t);
1819
+ });
1820
+ }, e);
1821
+ }
1822
+ const Hi = 20;
1823
+ let Me = [];
1824
+ function Jt() {
1825
+ Me = Me.filter((e) => e.isConnected);
1826
+ }
1827
+ function Wi(e) {
1828
+ Jt(), e && Pe(e) !== "body" && (Me.push(e), Me.length > Hi && (Me = Me.slice(-20)));
1829
+ }
1830
+ function An() {
1831
+ return Jt(), Me[Me.length - 1];
1832
+ }
1833
+ function zi(e) {
1834
+ const t = qe();
1835
+ return Xn(e, t) ? e : Ct(e, t)[0] || e;
1836
+ }
1837
+ function Sn(e, t) {
1838
+ var n;
1839
+ if (!t.current.includes("floating") && !((n = e.getAttribute("role")) != null && n.includes("dialog")))
1840
+ return;
1841
+ const r = qe(), l = Do(e, r).filter((u) => {
1842
+ const i = u.getAttribute("data-tabindex") || "";
1843
+ return Xn(u, r) || u.hasAttribute("data-tabindex") && !i.startsWith("-");
1844
+ }), a = e.getAttribute("tabindex");
1845
+ t.current.includes("floating") || l.length === 0 ? a !== "0" && e.setAttribute("tabindex", "0") : (a !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
1846
+ }
1847
+ const Yi = /* @__PURE__ */ E.forwardRef(function(t, n) {
1848
+ return /* @__PURE__ */ R("button", {
1849
+ ...t,
1850
+ type: "button",
1851
+ ref: n,
1852
+ tabIndex: -1,
1853
+ style: St
1854
+ });
1855
+ });
1856
+ function ji(e) {
1857
+ const {
1858
+ context: t,
1859
+ children: n,
1860
+ disabled: r = !1,
1861
+ order: o = ["content"],
1862
+ guards: l = !0,
1863
+ initialFocus: a = 0,
1864
+ returnFocus: u = !0,
1865
+ restoreFocus: i = !1,
1866
+ modal: s = !0,
1867
+ visuallyHiddenDismiss: c = !1,
1868
+ closeOnFocusOut: f = !0,
1869
+ outsideElementsInert: d = !1,
1870
+ getInsideElements: h = () => []
1871
+ } = e, {
1872
+ open: m,
1873
+ onOpenChange: p,
1874
+ events: g,
1875
+ dataRef: y,
1876
+ elements: {
1877
+ domReference: w,
1878
+ floating: b
1879
+ }
1880
+ } = t, C = ge(() => {
1881
+ var D;
1882
+ return (D = y.current.floatingContext) == null ? void 0 : D.nodeId;
1883
+ }), S = ge(h), T = typeof a == "number" && a < 0, L = ln(w) && T, $ = Bi(), W = $ ? l : !0, U = !W || $ && d, I = Pt(o), q = Pt(a), P = Pt(u), v = Zt(), A = hr(), F = E.useRef(null), k = E.useRef(null), x = E.useRef(!1), M = E.useRef(!1), _ = E.useRef(-1), ee = E.useRef(-1), de = A != null, N = Ht(b), ce = ge(function(D) {
1884
+ return D === void 0 && (D = N), D ? Ct(D, qe()) : [];
1885
+ }), G = ge((D) => {
1886
+ const V = ce(D);
1887
+ return I.current.map((B) => w && B === "reference" ? w : N && B === "floating" ? N : V).filter(Boolean).flat();
1888
+ });
1889
+ E.useEffect(() => {
1890
+ if (r || !s) return;
1891
+ function D(B) {
1892
+ if (B.key === "Tab") {
1893
+ oe(N, _e(he(N))) && ce().length === 0 && !L && Nt(B);
1894
+ const K = G(), Z = Se(B);
1895
+ I.current[0] === "reference" && Z === w && (Nt(B), B.shiftKey ? Be(K[K.length - 1]) : Be(K[1])), I.current[1] === "floating" && Z === N && B.shiftKey && (Nt(B), Be(K[0]));
1896
+ }
1897
+ }
1898
+ const V = he(N);
1899
+ return V.addEventListener("keydown", D), () => {
1900
+ V.removeEventListener("keydown", D);
1901
+ };
1902
+ }, [r, w, N, s, I, L, ce, G]), E.useEffect(() => {
1903
+ if (r || !b) return;
1904
+ function D(V) {
1905
+ const B = Se(V), Z = ce().indexOf(B);
1906
+ Z !== -1 && (_.current = Z);
1907
+ }
1908
+ return b.addEventListener("focusin", D), () => {
1909
+ b.removeEventListener("focusin", D);
1910
+ };
1911
+ }, [r, b, ce]), E.useEffect(() => {
1912
+ if (r || !f) return;
1913
+ function D() {
1914
+ M.current = !0, setTimeout(() => {
1915
+ M.current = !1;
1916
+ });
1917
+ }
1918
+ function V(Z) {
1919
+ const H = Z.relatedTarget, ye = Z.currentTarget, ue = Se(Z);
1920
+ queueMicrotask(() => {
1921
+ const re = C(), Oe = !(oe(w, H) || oe(b, H) || oe(H, b) || oe(A == null ? void 0 : A.portalNode, H) || H != null && H.hasAttribute(Ke("focus-guard")) || v && (Ue(v.nodesRef.current, re).find((Ce) => {
1922
+ var Ee, Ae;
1923
+ return oe((Ee = Ce.context) == null ? void 0 : Ee.elements.floating, H) || oe((Ae = Ce.context) == null ? void 0 : Ae.elements.domReference, H);
1924
+ }) || cn(v.nodesRef.current, re).find((Ce) => {
1925
+ var Ee, Ae, en;
1926
+ return [(Ee = Ce.context) == null ? void 0 : Ee.elements.floating, Ht((Ae = Ce.context) == null ? void 0 : Ae.elements.floating)].includes(H) || ((en = Ce.context) == null ? void 0 : en.elements.domReference) === H;
1927
+ })));
1928
+ if (ye === w && N && Sn(N, I), i && ye !== w && !(ue != null && ue.isConnected) && _e(he(N)) === he(N).body) {
1929
+ Q(N) && N.focus();
1930
+ const Ce = _.current, Ee = ce(), Ae = Ee[Ce] || Ee[Ee.length - 1] || N;
1931
+ Q(Ae) && Ae.focus();
1932
+ }
1933
+ if (y.current.insideReactTree) {
1934
+ y.current.insideReactTree = !1;
1935
+ return;
1936
+ }
1937
+ (L || !s) && H && Oe && !M.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
1938
+ H !== An() && (x.current = !0, p(!1, Z, "focus-out"));
1939
+ });
1940
+ }
1941
+ const B = !!(!v && A);
1942
+ function K() {
1943
+ Fi(ee), y.current.insideReactTree = !0, ee.current = window.setTimeout(() => {
1944
+ y.current.insideReactTree = !1;
1945
+ });
1946
+ }
1947
+ if (b && Q(w))
1948
+ return w.addEventListener("focusout", V), w.addEventListener("pointerdown", D), b.addEventListener("focusout", V), B && b.addEventListener("focusout", K, !0), () => {
1949
+ w.removeEventListener("focusout", V), w.removeEventListener("pointerdown", D), b.removeEventListener("focusout", V), B && b.removeEventListener("focusout", K, !0);
1950
+ };
1951
+ }, [r, w, b, N, s, v, A, p, f, i, ce, L, C, I, y]);
1952
+ const ae = E.useRef(null), xe = E.useRef(null), Tt = Cn([ae, A == null ? void 0 : A.beforeInsideRef]), Mt = Cn([xe, A == null ? void 0 : A.afterInsideRef]);
1953
+ E.useEffect(() => {
1954
+ var D, V;
1955
+ if (r || !b) return;
1956
+ const B = Array.from((A == null || (D = A.portalNode) == null ? void 0 : D.querySelectorAll("[" + Ke("portal") + "]")) || []), Z = (V = (v ? cn(v.nodesRef.current, C()) : []).find((ue) => {
1957
+ var re;
1958
+ return ln(((re = ue.context) == null ? void 0 : re.elements.domReference) || null);
1959
+ })) == null || (V = V.context) == null ? void 0 : V.elements.domReference, H = [b, Z, ...B, ...S(), F.current, k.current, ae.current, xe.current, A == null ? void 0 : A.beforeOutsideRef.current, A == null ? void 0 : A.afterOutsideRef.current, I.current.includes("reference") || L ? w : null].filter((ue) => ue != null), ye = s || L ? Rn(H, !U, U) : Rn(H);
1960
+ return () => {
1961
+ ye();
1962
+ };
1963
+ }, [r, w, b, s, I, A, L, W, U, v, C, S]), se(() => {
1964
+ if (r || !Q(N)) return;
1965
+ const D = he(N), V = _e(D);
1966
+ queueMicrotask(() => {
1967
+ const B = G(N), K = q.current, Z = (typeof K == "number" ? B[K] : K.current) || N, H = oe(N, V);
1968
+ !T && !H && m && Be(Z, {
1969
+ preventScroll: Z === N
1970
+ });
1971
+ });
1972
+ }, [r, m, N, T, G, q]), se(() => {
1973
+ if (r || !N) return;
1974
+ const D = he(N), V = _e(D);
1975
+ Wi(V);
1976
+ function B(H) {
1977
+ let {
1978
+ reason: ye,
1979
+ event: ue,
1980
+ nested: re
1981
+ } = H;
1982
+ if (["hover", "safe-polygon"].includes(ye) && ue.type === "mouseleave" && (x.current = !0), ye === "outside-press")
1983
+ if (re)
1984
+ x.current = !1;
1985
+ else if ($o(ue) || Uo(ue))
1986
+ x.current = !1;
1987
+ else {
1988
+ let Oe = !1;
1989
+ document.createElement("div").focus({
1990
+ get preventScroll() {
1991
+ return Oe = !0, !1;
1992
+ }
1993
+ }), Oe ? x.current = !1 : x.current = !0;
1994
+ }
1995
+ }
1996
+ g.on("openchange", B);
1997
+ const K = D.createElement("span");
1998
+ K.setAttribute("tabindex", "-1"), K.setAttribute("aria-hidden", "true"), Object.assign(K.style, St), de && w && w.insertAdjacentElement("afterend", K);
1999
+ function Z() {
2000
+ if (typeof P.current == "boolean") {
2001
+ const H = w || An();
2002
+ return H && H.isConnected ? H : K;
2003
+ }
2004
+ return P.current.current || K;
2005
+ }
2006
+ return () => {
2007
+ g.off("openchange", B);
2008
+ const H = _e(D), ye = oe(b, H) || v && Ue(v.nodesRef.current, C(), !1).some((re) => {
2009
+ var Oe;
2010
+ return oe((Oe = re.context) == null ? void 0 : Oe.elements.floating, H);
2011
+ }), ue = Z();
2012
+ queueMicrotask(() => {
2013
+ const re = zi(ue);
2014
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2015
+ P.current && !x.current && Q(re) && // If the focus moved somewhere else after mount, avoid returning focus
2016
+ // since it likely entered a different element which should be
2017
+ // respected: https://github.com/floating-ui/floating-ui/issues/2607
2018
+ (!(re !== H && H !== D.body) || ye) && re.focus({
2019
+ preventScroll: !0
2020
+ }), K.remove();
2021
+ });
2022
+ };
2023
+ }, [r, b, N, P, y, g, v, de, w, C]), E.useEffect(() => (queueMicrotask(() => {
2024
+ x.current = !1;
2025
+ }), () => {
2026
+ queueMicrotask(Jt);
2027
+ }), [r]), se(() => {
2028
+ if (!r && A)
2029
+ return A.setFocusManagerState({
2030
+ modal: s,
2031
+ closeOnFocusOut: f,
2032
+ open: m,
2033
+ onOpenChange: p,
2034
+ domReference: w
2035
+ }), () => {
2036
+ A.setFocusManagerState(null);
2037
+ };
2038
+ }, [r, A, s, m, p, f, w]), se(() => {
2039
+ r || N && Sn(N, I);
2040
+ }, [r, N, I]);
2041
+ function Ze(D) {
2042
+ return r || !c || !s ? null : /* @__PURE__ */ R(Yi, {
2043
+ ref: D === "start" ? F : k,
2044
+ onClick: (V) => p(!1, V.nativeEvent),
2045
+ children: typeof c == "string" ? c : "Dismiss"
2046
+ });
2047
+ }
2048
+ const Je = !r && W && (s ? !L : !0) && (de || s);
2049
+ return /* @__PURE__ */ z(Ne, {
2050
+ children: [Je && /* @__PURE__ */ R(mt, {
2051
+ "data-type": "inside",
2052
+ ref: Tt,
2053
+ onFocus: (D) => {
2054
+ if (s) {
2055
+ const B = G();
2056
+ Be(o[0] === "reference" ? B[0] : B[B.length - 1]);
2057
+ } else if (A != null && A.preserveTabOrder && A.portalNode)
2058
+ if (x.current = !1, ze(D, A.portalNode)) {
2059
+ const B = er(w);
2060
+ B == null || B.focus();
2061
+ } else {
2062
+ var V;
2063
+ (V = A.beforeOutsideRef.current) == null || V.focus();
2064
+ }
2065
+ }
2066
+ }), !L && Ze("start"), n, Ze("end"), Je && /* @__PURE__ */ R(mt, {
2067
+ "data-type": "inside",
2068
+ ref: Mt,
2069
+ onFocus: (D) => {
2070
+ if (s)
2071
+ Be(G()[0]);
2072
+ else if (A != null && A.preserveTabOrder && A.portalNode)
2073
+ if (f && (x.current = !0), ze(D, A.portalNode)) {
2074
+ const B = tr(w);
2075
+ B == null || B.focus();
2076
+ } else {
2077
+ var V;
2078
+ (V = A.afterOutsideRef.current) == null || V.focus();
2079
+ }
2080
+ }
2081
+ })]
2082
+ });
2083
+ }
2084
+ let rt = 0;
2085
+ const Tn = "--floating-ui-scrollbar-width";
2086
+ function Ki() {
2087
+ const e = Qn(), t = /iP(hone|ad|od)|iOS/.test(e) || // iPads can claim to be MacIntel
2088
+ e === "MacIntel" && navigator.maxTouchPoints > 1, n = document.body.style, o = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight", l = window.innerWidth - document.documentElement.clientWidth, a = n.left ? parseFloat(n.left) : window.scrollX, u = n.top ? parseFloat(n.top) : window.scrollY;
2089
+ if (n.overflow = "hidden", n.setProperty(Tn, l + "px"), l && (n[o] = l + "px"), t) {
2090
+ var i, s;
2091
+ const c = ((i = window.visualViewport) == null ? void 0 : i.offsetLeft) || 0, f = ((s = window.visualViewport) == null ? void 0 : s.offsetTop) || 0;
2092
+ Object.assign(n, {
2093
+ position: "fixed",
2094
+ top: -(u - Math.floor(f)) + "px",
2095
+ left: -(a - Math.floor(c)) + "px",
2096
+ right: "0"
2097
+ });
2098
+ }
2099
+ return () => {
2100
+ Object.assign(n, {
2101
+ overflow: "",
2102
+ [o]: ""
2103
+ }), n.removeProperty(Tn), t && (Object.assign(n, {
2104
+ position: "",
2105
+ top: "",
2106
+ left: "",
2107
+ right: ""
2108
+ }), window.scrollTo(a, u));
2109
+ };
2110
+ }
2111
+ let Mn = () => {
2112
+ };
2113
+ const Gi = /* @__PURE__ */ E.forwardRef(function(t, n) {
2114
+ const {
2115
+ lockScroll: r = !1,
2116
+ ...o
2117
+ } = t;
2118
+ return se(() => {
2119
+ if (r)
2120
+ return rt++, rt === 1 && (Mn = Ki()), () => {
2121
+ rt--, rt === 0 && Mn();
2122
+ };
2123
+ }, [r]), /* @__PURE__ */ R("div", {
2124
+ ref: n,
2125
+ ...o,
2126
+ style: {
2127
+ position: "fixed",
2128
+ overflow: "auto",
2129
+ top: 0,
2130
+ right: 0,
2131
+ bottom: 0,
2132
+ left: 0,
2133
+ ...o.style
2134
+ }
2135
+ });
2136
+ });
2137
+ function In(e) {
2138
+ return Q(e.target) && e.target.tagName === "BUTTON";
2139
+ }
2140
+ function Xi(e) {
2141
+ return Q(e.target) && e.target.tagName === "A";
2142
+ }
2143
+ function Nn(e) {
2144
+ return Zn(e);
2145
+ }
2146
+ function Qi(e, t) {
2147
+ t === void 0 && (t = {});
2148
+ const {
2149
+ open: n,
2150
+ onOpenChange: r,
2151
+ dataRef: o,
2152
+ elements: {
2153
+ domReference: l
2154
+ }
2155
+ } = e, {
2156
+ enabled: a = !0,
2157
+ event: u = "click",
2158
+ toggle: i = !0,
2159
+ ignoreMouse: s = !1,
2160
+ keyboardHandlers: c = !0,
2161
+ stickIfOpen: f = !0
2162
+ } = t, d = E.useRef(), h = E.useRef(!1), m = E.useMemo(() => ({
2163
+ onPointerDown(p) {
2164
+ d.current = p.pointerType;
2165
+ },
2166
+ onMouseDown(p) {
2167
+ const g = d.current;
2168
+ p.button === 0 && u !== "click" && (an(g) && s || (n && i && (!(o.current.openEvent && f) || o.current.openEvent.type === "mousedown") ? r(!1, p.nativeEvent, "click") : (p.preventDefault(), r(!0, p.nativeEvent, "click"))));
2169
+ },
2170
+ onClick(p) {
2171
+ const g = d.current;
2172
+ if (u === "mousedown" && d.current) {
2173
+ d.current = void 0;
2174
+ return;
2175
+ }
2176
+ an(g) && s || (n && i && (!(o.current.openEvent && f) || o.current.openEvent.type === "click") ? r(!1, p.nativeEvent, "click") : r(!0, p.nativeEvent, "click"));
2177
+ },
2178
+ onKeyDown(p) {
2179
+ d.current = void 0, !(p.defaultPrevented || !c || In(p)) && (p.key === " " && !Nn(l) && (p.preventDefault(), h.current = !0), !Xi(p) && p.key === "Enter" && r(!(n && i), p.nativeEvent, "click"));
2180
+ },
2181
+ onKeyUp(p) {
2182
+ p.defaultPrevented || !c || In(p) || Nn(l) || p.key === " " && h.current && (h.current = !1, r(!(n && i), p.nativeEvent, "click"));
2183
+ }
2184
+ }), [o, l, u, s, c, r, n, f, i]);
2185
+ return E.useMemo(() => a ? {
2186
+ reference: m
2187
+ } : {}, [a, m]);
2188
+ }
2189
+ const qi = {
2190
+ pointerdown: "onPointerDown",
2191
+ mousedown: "onMouseDown",
2192
+ click: "onClick"
2193
+ }, Zi = {
2194
+ pointerdown: "onPointerDownCapture",
2195
+ mousedown: "onMouseDownCapture",
2196
+ click: "onClickCapture"
2197
+ }, Pn = (e) => {
2198
+ var t, n;
2199
+ return {
2200
+ escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
2201
+ outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
2202
+ };
2203
+ };
2204
+ function mr(e, t) {
2205
+ t === void 0 && (t = {});
2206
+ const {
2207
+ open: n,
2208
+ onOpenChange: r,
2209
+ elements: o,
2210
+ dataRef: l
2211
+ } = e, {
2212
+ enabled: a = !0,
2213
+ escapeKey: u = !0,
2214
+ outsidePress: i = !0,
2215
+ outsidePressEvent: s = "pointerdown",
2216
+ referencePress: c = !1,
2217
+ referencePressEvent: f = "pointerdown",
2218
+ ancestorScroll: d = !1,
2219
+ bubbles: h,
2220
+ capture: m
2221
+ } = t, p = Zt(), g = ge(typeof i == "function" ? i : () => !1), y = typeof i == "function" ? g : i, w = E.useRef(!1), {
2222
+ escapeKey: b,
2223
+ outsidePress: C
2224
+ } = Pn(h), {
2225
+ escapeKey: S,
2226
+ outsidePress: T
2227
+ } = Pn(m), L = E.useRef(!1), $ = ge((v) => {
2228
+ var A;
2229
+ if (!n || !a || !u || v.key !== "Escape" || L.current)
2230
+ return;
2231
+ const F = (A = l.current.floatingContext) == null ? void 0 : A.nodeId, k = p ? Ue(p.nodesRef.current, F) : [];
2232
+ if (!b && (v.stopPropagation(), k.length > 0)) {
2233
+ let x = !0;
2234
+ if (k.forEach((M) => {
2235
+ var _;
2236
+ if ((_ = M.context) != null && _.open && !M.context.dataRef.current.__escapeKeyBubbles) {
2237
+ x = !1;
2238
+ return;
2239
+ }
2240
+ }), !x)
2241
+ return;
2242
+ }
2243
+ r(!1, _o(v) ? v.nativeEvent : v, "escape-key");
2244
+ }), W = ge((v) => {
2245
+ var A;
2246
+ const F = () => {
2247
+ var k;
2248
+ $(v), (k = Se(v)) == null || k.removeEventListener("keydown", F);
2249
+ };
2250
+ (A = Se(v)) == null || A.addEventListener("keydown", F);
2251
+ }), U = ge((v) => {
2252
+ var A;
2253
+ const F = l.current.insideReactTree;
2254
+ l.current.insideReactTree = !1;
2255
+ const k = w.current;
2256
+ if (w.current = !1, s === "click" && k || F || typeof y == "function" && !y(v))
2257
+ return;
2258
+ const x = Se(v), M = "[" + Ke("inert") + "]", _ = he(o.floating).querySelectorAll(M);
2259
+ let ee = j(x) ? x : null;
2260
+ for (; ee && !ve(ee); ) {
2261
+ const G = Re(ee);
2262
+ if (ve(G) || !j(G))
2263
+ break;
2264
+ ee = G;
2265
+ }
2266
+ if (_.length && j(x) && !Bo(x) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2267
+ !oe(x, o.floating) && // If the target root element contains none of the markers, then the
2268
+ // element was injected after the floating element rendered.
2269
+ Array.from(_).every((G) => !oe(ee, G)))
2270
+ return;
2271
+ if (Q(x) && P) {
2272
+ const G = ve(x), ae = fe(x), xe = /auto|scroll/, Tt = G || xe.test(ae.overflowX), Mt = G || xe.test(ae.overflowY), Ze = Tt && x.clientWidth > 0 && x.scrollWidth > x.clientWidth, Je = Mt && x.clientHeight > 0 && x.scrollHeight > x.clientHeight, D = ae.direction === "rtl", V = Je && (D ? v.offsetX <= x.offsetWidth - x.clientWidth : v.offsetX > x.clientWidth), B = Ze && v.offsetY > x.clientHeight;
2273
+ if (V || B)
2274
+ return;
2275
+ }
2276
+ const de = (A = l.current.floatingContext) == null ? void 0 : A.nodeId, N = p && Ue(p.nodesRef.current, de).some((G) => {
2277
+ var ae;
2278
+ return It(v, (ae = G.context) == null ? void 0 : ae.elements.floating);
2279
+ });
2280
+ if (It(v, o.floating) || It(v, o.domReference) || N)
2281
+ return;
2282
+ const ce = p ? Ue(p.nodesRef.current, de) : [];
2283
+ if (ce.length > 0) {
2284
+ let G = !0;
2285
+ if (ce.forEach((ae) => {
2286
+ var xe;
2287
+ if ((xe = ae.context) != null && xe.open && !ae.context.dataRef.current.__outsidePressBubbles) {
2288
+ G = !1;
2289
+ return;
2290
+ }
2291
+ }), !G)
2292
+ return;
2293
+ }
2294
+ r(!1, v, "outside-press");
2295
+ }), I = ge((v) => {
2296
+ var A;
2297
+ const F = () => {
2298
+ var k;
2299
+ U(v), (k = Se(v)) == null || k.removeEventListener(s, F);
2300
+ };
2301
+ (A = Se(v)) == null || A.addEventListener(s, F);
2302
+ });
2303
+ E.useEffect(() => {
2304
+ if (!n || !a)
2305
+ return;
2306
+ l.current.__escapeKeyBubbles = b, l.current.__outsidePressBubbles = C;
2307
+ let v = -1;
2308
+ function A(_) {
2309
+ r(!1, _, "ancestor-scroll");
2310
+ }
2311
+ function F() {
2312
+ window.clearTimeout(v), L.current = !0;
2313
+ }
2314
+ function k() {
2315
+ v = window.setTimeout(
2316
+ () => {
2317
+ L.current = !1;
2318
+ },
2319
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2320
+ // Only apply to WebKit for the test to remain 0ms.
2321
+ Et() ? 5 : 0
2322
+ );
2323
+ }
2324
+ const x = he(o.floating);
2325
+ u && (x.addEventListener("keydown", S ? W : $, S), x.addEventListener("compositionstart", F), x.addEventListener("compositionend", k)), y && x.addEventListener(s, T ? I : U, T);
2326
+ let M = [];
2327
+ return d && (j(o.domReference) && (M = Ie(o.domReference)), j(o.floating) && (M = M.concat(Ie(o.floating))), !j(o.reference) && o.reference && o.reference.contextElement && (M = M.concat(Ie(o.reference.contextElement)))), M = M.filter((_) => {
2328
+ var ee;
2329
+ return _ !== ((ee = x.defaultView) == null ? void 0 : ee.visualViewport);
2330
+ }), M.forEach((_) => {
2331
+ _.addEventListener("scroll", A, {
2332
+ passive: !0
2333
+ });
2334
+ }), () => {
2335
+ u && (x.removeEventListener("keydown", S ? W : $, S), x.removeEventListener("compositionstart", F), x.removeEventListener("compositionend", k)), y && x.removeEventListener(s, T ? I : U, T), M.forEach((_) => {
2336
+ _.removeEventListener("scroll", A);
2337
+ }), window.clearTimeout(v);
2338
+ };
2339
+ }, [l, o, u, y, s, n, r, d, a, b, C, $, S, W, U, T, I]), E.useEffect(() => {
2340
+ l.current.insideReactTree = !1;
2341
+ }, [l, y, s]);
2342
+ const q = E.useMemo(() => ({
2343
+ onKeyDown: $,
2344
+ ...c && {
2345
+ [qi[f]]: (v) => {
2346
+ r(!1, v.nativeEvent, "reference-press");
2347
+ },
2348
+ ...f !== "click" && {
2349
+ onClick(v) {
2350
+ r(!1, v.nativeEvent, "reference-press");
2351
+ }
2352
+ }
2353
+ }
2354
+ }), [$, r, c, f]), P = E.useMemo(() => ({
2355
+ onKeyDown: $,
2356
+ onMouseDown() {
2357
+ w.current = !0;
2358
+ },
2359
+ onMouseUp() {
2360
+ w.current = !0;
2361
+ },
2362
+ [Zi[s]]: () => {
2363
+ l.current.insideReactTree = !0;
2364
+ }
2365
+ }), [$, s, l]);
2366
+ return E.useMemo(() => a ? {
2367
+ reference: q,
2368
+ floating: P
2369
+ } : {}, [a, q, P]);
2370
+ }
2371
+ function Ji(e) {
2372
+ const {
2373
+ open: t = !1,
2374
+ onOpenChange: n,
2375
+ elements: r
2376
+ } = e, o = qt(), l = E.useRef({}), [a] = E.useState(() => Oi()), u = ur() != null;
2377
+ if (process.env.NODE_ENV !== "production") {
2378
+ const h = r.reference;
2379
+ h && !j(h) && Pi("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2380
+ }
2381
+ const [i, s] = E.useState(r.reference), c = ge((h, m, p) => {
2382
+ l.current.openEvent = h ? m : void 0, a.emit("openchange", {
2383
+ open: h,
2384
+ event: m,
2385
+ reason: p,
2386
+ nested: u
2387
+ }), n == null || n(h, m, p);
2388
+ }), f = E.useMemo(() => ({
2389
+ setPositionReference: s
2390
+ }), []), d = E.useMemo(() => ({
2391
+ reference: i || r.reference || null,
2392
+ floating: r.floating || null,
2393
+ domReference: r.reference
2394
+ }), [i, r.reference, r.floating]);
2395
+ return E.useMemo(() => ({
2396
+ dataRef: l,
2397
+ open: t,
2398
+ onOpenChange: c,
2399
+ elements: d,
2400
+ events: a,
2401
+ floatingId: o,
2402
+ refs: f
2403
+ }), [t, c, d, a, o, f]);
2404
+ }
2405
+ function pr(e) {
2406
+ e === void 0 && (e = {});
2407
+ const {
2408
+ nodeId: t
2409
+ } = e, n = Ji({
2410
+ ...e,
2411
+ elements: {
2412
+ reference: null,
2413
+ floating: null,
2414
+ ...e.elements
2415
+ }
2416
+ }), r = e.rootContext || n, o = r.elements, [l, a] = E.useState(null), [u, i] = E.useState(null), c = (o == null ? void 0 : o.domReference) || l, f = E.useRef(null), d = Zt();
2417
+ se(() => {
2418
+ c && (f.current = c);
2419
+ }, [c]);
2420
+ const h = Ri({
2421
+ ...e,
2422
+ elements: {
2423
+ ...o,
2424
+ ...u && {
2425
+ reference: u
2426
+ }
2427
+ }
2428
+ }), m = E.useCallback((b) => {
2429
+ const C = j(b) ? {
2430
+ getBoundingClientRect: () => b.getBoundingClientRect(),
2431
+ getClientRects: () => b.getClientRects(),
2432
+ contextElement: b
2433
+ } : b;
2434
+ i(C), h.refs.setReference(C);
2435
+ }, [h.refs]), p = E.useCallback((b) => {
2436
+ (j(b) || b === null) && (f.current = b, a(b)), (j(h.refs.reference.current) || h.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2437
+ // `null` to support `positionReference` + an unstable `reference`
2438
+ // callback ref.
2439
+ b !== null && !j(b)) && h.refs.setReference(b);
2440
+ }, [h.refs]), g = E.useMemo(() => ({
2441
+ ...h.refs,
2442
+ setReference: p,
2443
+ setPositionReference: m,
2444
+ domReference: f
2445
+ }), [h.refs, p, m]), y = E.useMemo(() => ({
2446
+ ...h.elements,
2447
+ domReference: c
2448
+ }), [h.elements, c]), w = E.useMemo(() => ({
2449
+ ...h,
2450
+ ...r,
2451
+ refs: g,
2452
+ elements: y,
2453
+ nodeId: t
2454
+ }), [h, g, y, t, r]);
2455
+ return se(() => {
2456
+ r.dataRef.current.floatingContext = w;
2457
+ const b = d == null ? void 0 : d.nodesRef.current.find((C) => C.id === t);
2458
+ b && (b.context = w);
2459
+ }), E.useMemo(() => ({
2460
+ ...h,
2461
+ context: w,
2462
+ refs: g,
2463
+ elements: y
2464
+ }), [h, g, y, w]);
2465
+ }
2466
+ function Ft(e, t, n) {
2467
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
2468
+ let l = e;
2469
+ if (o && e) {
2470
+ const {
2471
+ [gn]: a,
2472
+ [bn]: u,
2473
+ ...i
2474
+ } = e;
2475
+ l = i;
2476
+ }
2477
+ return {
2478
+ ...n === "floating" && {
2479
+ tabIndex: -1,
2480
+ [Si]: ""
2481
+ },
2482
+ ...l,
2483
+ ...t.map((a) => {
2484
+ const u = a ? a[n] : null;
2485
+ return typeof u == "function" ? e ? u(e) : null : u;
2486
+ }).concat(e).reduce((a, u) => (u && Object.entries(u).forEach((i) => {
2487
+ let [s, c] = i;
2488
+ if (!(o && [gn, bn].includes(s)))
2489
+ if (s.indexOf("on") === 0) {
2490
+ if (r.has(s) || r.set(s, []), typeof c == "function") {
2491
+ var f;
2492
+ (f = r.get(s)) == null || f.push(c), a[s] = function() {
2493
+ for (var d, h = arguments.length, m = new Array(h), p = 0; p < h; p++)
2494
+ m[p] = arguments[p];
2495
+ return (d = r.get(s)) == null ? void 0 : d.map((g) => g(...m)).find((g) => g !== void 0);
2496
+ };
2497
+ }
2498
+ } else
2499
+ a[s] = c;
2500
+ }), a), {})
2501
+ };
2502
+ }
2503
+ function gr(e) {
2504
+ e === void 0 && (e = []);
2505
+ const t = e.map((u) => u == null ? void 0 : u.reference), n = e.map((u) => u == null ? void 0 : u.floating), r = e.map((u) => u == null ? void 0 : u.item), o = E.useCallback(
2506
+ (u) => Ft(u, e, "reference"),
2507
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2508
+ t
2509
+ ), l = E.useCallback(
2510
+ (u) => Ft(u, e, "floating"),
2511
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2512
+ n
2513
+ ), a = E.useCallback(
2514
+ (u) => Ft(u, e, "item"),
2515
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2516
+ r
2517
+ );
2518
+ return E.useMemo(() => ({
2519
+ getReferenceProps: o,
2520
+ getFloatingProps: l,
2521
+ getItemProps: a
2522
+ }), [o, l, a]);
2523
+ }
2524
+ const es = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2525
+ function ts(e, t) {
2526
+ var n, r;
2527
+ t === void 0 && (t = {});
2528
+ const {
2529
+ open: o,
2530
+ elements: l,
2531
+ floatingId: a
2532
+ } = e, {
2533
+ enabled: u = !0,
2534
+ role: i = "dialog"
2535
+ } = t, s = qt(), c = ((n = l.domReference) == null ? void 0 : n.id) || s, f = E.useMemo(() => {
2536
+ var w;
2537
+ return ((w = Ht(l.floating)) == null ? void 0 : w.id) || a;
2538
+ }, [l.floating, a]), d = (r = es.get(i)) != null ? r : i, m = ur() != null, p = E.useMemo(() => d === "tooltip" || i === "label" ? {
2539
+ ["aria-" + (i === "label" ? "labelledby" : "describedby")]: o ? f : void 0
2540
+ } : {
2541
+ "aria-expanded": o ? "true" : "false",
2542
+ "aria-haspopup": d === "alertdialog" ? "dialog" : d,
2543
+ "aria-controls": o ? f : void 0,
2544
+ ...d === "listbox" && {
2545
+ role: "combobox"
2546
+ },
2547
+ ...d === "menu" && {
2548
+ id: c
2549
+ },
2550
+ ...d === "menu" && m && {
2551
+ role: "menuitem"
2552
+ },
2553
+ ...i === "select" && {
2554
+ "aria-autocomplete": "none"
2555
+ },
2556
+ ...i === "combobox" && {
2557
+ "aria-autocomplete": "list"
2558
+ }
2559
+ }, [d, f, m, o, c, i]), g = E.useMemo(() => {
2560
+ const w = {
2561
+ id: f,
2562
+ ...d && {
2563
+ role: d
2564
+ }
2565
+ };
2566
+ return d === "tooltip" || i === "label" ? w : {
2567
+ ...w,
2568
+ ...d === "menu" && {
2569
+ "aria-labelledby": c
2570
+ }
2571
+ };
2572
+ }, [d, f, c, i]), y = E.useCallback((w) => {
2573
+ let {
2574
+ active: b,
2575
+ selected: C
2576
+ } = w;
2577
+ const S = {
2578
+ role: "option",
2579
+ ...b && {
2580
+ id: f + "-fui-option"
2581
+ }
2582
+ };
2583
+ switch (i) {
2584
+ case "select":
2585
+ case "combobox":
2586
+ return {
2587
+ ...S,
2588
+ "aria-selected": C
2589
+ };
2590
+ }
2591
+ return {};
2592
+ }, [f, i]);
2593
+ return E.useMemo(() => u ? {
2594
+ reference: p,
2595
+ floating: g,
2596
+ item: y
2597
+ } : {}, [u, p, g, y]);
2598
+ }
2599
+ var ie = /* @__PURE__ */ ((e) => (e.Closed = "Closed", e.Opened = "Opened", e))(ie || {}), Ge = /* @__PURE__ */ ((e) => (e.LG = "Large", e.SM = "Small", e))(Ge || {});
2600
+ const ns = ({
2601
+ title: e,
2602
+ btnClassNames: t,
2603
+ iconWidth: n,
2604
+ iconHeight: r,
2605
+ onClick: o
2606
+ }) => /* @__PURE__ */ R(
2607
+ "button",
2608
+ {
2609
+ type: "button",
2610
+ "aria-label": "button",
2611
+ className: t,
2612
+ title: e,
2613
+ onClick: o,
2614
+ children: /* @__PURE__ */ R(Fn, { height: r || 20, width: n || 20 })
2615
+ }
2616
+ ), rs = ({
2617
+ portalId: e,
2618
+ state: t = ie.Opened,
2619
+ heading: n,
2620
+ size: r,
2621
+ onClose: o,
2622
+ children: l,
2623
+ overlayClassName: a,
2624
+ containerClassName: u,
2625
+ dividers: i = !0,
2626
+ closeButtonTitle: s
2627
+ }) => {
2628
+ const { refs: c, context: f } = pr({
2629
+ open: t !== ie.Closed && !!t,
2630
+ onOpenChange: o
2631
+ }), d = ts(f, { role: "dialog" }), h = mr(f, { outsidePress: !0 }), { getFloatingProps: m } = gr([d, h]), p = me(
2632
+ (g) => {
2633
+ g == null || g.preventDefault(), g == null || g.stopPropagation(), o();
2634
+ },
2635
+ [o]
2636
+ );
2637
+ return /* @__PURE__ */ R(Vi, { id: e, children: t !== ie.Closed && /* @__PURE__ */ R(
2638
+ Gi,
2639
+ {
2640
+ className: J(
2641
+ "z-[52] flex items-center justify-center bg-blackout p-4",
2642
+ a
2643
+ ),
2644
+ children: /* @__PURE__ */ R(ji, { context: f, children: /* @__PURE__ */ z(
2645
+ "div",
2646
+ {
2647
+ className: J(
2648
+ "relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
2649
+ r === Ge.LG && "max-w-[65%]",
2650
+ r === Ge.SM && "max-w-[30%]",
2651
+ i && "divide-neutrals-400 divide-y",
2652
+ u,
2653
+ "sm:w-full sm:max-w-full sm:px-4 sm:py-6"
2654
+ ),
2655
+ ref: c.setFloating,
2656
+ ...m({
2657
+ onClick(g) {
2658
+ g.stopPropagation();
2659
+ }
2660
+ }),
2661
+ children: [
2662
+ /* @__PURE__ */ z("div", { className: "flex flex-row justify-between py-3 px-6 items-center mb-2 modal-heading sm:p-0 sm:pb-2", children: [
2663
+ n && (typeof n == "string" ? /* @__PURE__ */ R("h2", { className: "flex-1 min-w-0 mr-3 modal-heading-title sm:h3", children: n }) : n),
2664
+ /* @__PURE__ */ R(
2665
+ ns,
2666
+ {
2667
+ title: s,
2668
+ onClick: p,
2669
+ btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
2670
+ }
2671
+ )
2672
+ ] }),
2673
+ l.map((g) => g)
2674
+ ]
2675
+ }
2676
+ ) })
2677
+ }
2678
+ ) });
2679
+ }, br = (e) => e.state === ie.Closed ? null : /* @__PURE__ */ R(rs, { ...e }), os = ({
2680
+ onCloseModal: e,
2681
+ disableModalDividers: t,
2682
+ deleteConversation: n,
2683
+ isSmallButton: r,
2684
+ titles: o,
2685
+ locale: l
2686
+ }) => /* @__PURE__ */ z(
2687
+ br,
2688
+ {
2689
+ heading: (o == null ? void 0 : o.deleteTitle) ?? "Delete conversation",
2690
+ portalId: "delete-conversation",
2691
+ containerClassName: "delete-conversation-popup",
2692
+ size: Ge.SM,
2693
+ dividers: !t,
2694
+ onClose: e,
2695
+ closeButtonTitle: (o == null ? void 0 : o.close) ?? "Cancel",
2696
+ children: [
2697
+ /* @__PURE__ */ R("div", { className: "py-4 px-6", lang: l, children: (o == null ? void 0 : o.deleteMessage) ?? "Are you sure you want to delete this conversation? This action cannot be undone." }),
2698
+ /* @__PURE__ */ z("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
2699
+ /* @__PURE__ */ R(
2700
+ je,
2701
+ {
2702
+ buttonClassName: "cancel-button",
2703
+ title: (o == null ? void 0 : o.cancel) ?? "Cancel",
2704
+ isSmallButton: r,
2705
+ onClick: (a) => {
2706
+ a.stopPropagation(), e();
2707
+ }
2708
+ }
2709
+ ),
2710
+ /* @__PURE__ */ R(
2711
+ je,
2712
+ {
2713
+ buttonClassName: "text-button-primary text-button-primary-error",
2714
+ title: (o == null ? void 0 : o.delete) ?? "Delete",
2715
+ isSmallButton: r,
2716
+ onClick: (a) => {
2717
+ a.stopPropagation(), n();
2718
+ }
2719
+ }
2720
+ )
2721
+ ] })
2722
+ ]
2723
+ }
2724
+ ), is = (e) => {
2725
+ const t = e.messages.flatMap((r) => {
2726
+ var a, u, i;
2727
+ const o = ((a = r.custom_content) == null ? void 0 : a.attachments) || [], l = ((i = (u = r.custom_content) == null ? void 0 : u.stages) == null ? void 0 : i.flatMap(
2728
+ ({ attachments: s }) => s ?? []
2729
+ )) || [];
2730
+ return [...o, ...l];
2731
+ }) || [], n = as(t).map(
2732
+ (r) => ({
2733
+ ...r,
2734
+ relativePath: "",
2735
+ contentLength: 0
2736
+ })
2737
+ );
2738
+ return _r(
2739
+ n,
2740
+ (r) => Xe(r.relativePath, r.name)
2741
+ );
2742
+ }, ss = (e) => e.endsWith("/"), ls = (e) => {
2743
+ const t = e.toLowerCase();
2744
+ return [
2745
+ "data:",
2746
+ "//",
2747
+ "http://",
2748
+ "https://",
2749
+ "file://",
2750
+ "ftp://",
2751
+ "mailto:",
2752
+ "telnet://",
2753
+ "api/files"
2754
+ ].some((n) => t.startsWith(n));
2755
+ }, cs = (e) => {
2756
+ const t = Xe(
2757
+ ...e.split("/").map((r) => decodeURIComponent(r))
2758
+ ), n = t.lastIndexOf("/");
2759
+ return {
2760
+ absolutePath: t.slice(0, n),
2761
+ name: t.slice(n + 1)
2762
+ };
2763
+ }, as = (e) => e ? e.map((t) => {
2764
+ if (!t.url || ls(t.url) || ss(t.url))
2765
+ return null;
2766
+ const { absolutePath: n, name: r } = cs(t.url);
2767
+ return {
2768
+ id: t.url,
2769
+ name: r,
2770
+ contentType: t.type,
2771
+ folderId: n,
2772
+ absolutePath: n
2773
+ };
2774
+ }).filter(Boolean) : [];
2775
+ async function us(e, t) {
2776
+ const n = is(e), r = new zr();
2777
+ n.forEach((u) => {
2778
+ const i = encodeURI(Xe(u.absolutePath, u.name)), s = t(`${i}`.replace("files/", "")), c = fs(u.folderId), f = Xe("res", c, u.name);
2779
+ r.file(f, s);
2780
+ });
2781
+ const o = {
2782
+ version: 5,
2783
+ history: [e].map(ds) || [],
2784
+ folders: []
2785
+ }, l = JSON.stringify(o, null, 2);
2786
+ return r.file("conversations/conversations_history.json", l), await r.generateAsync({ type: "base64" });
2787
+ }
2788
+ const fs = (e) => {
2789
+ const t = e.split("/");
2790
+ return t.length > 2 ? Xe(...t.slice(2)) : void 0;
2791
+ }, ds = (e) => Br(e, ["publicationInfo"]), Xe = (...e) => e.filter(Boolean).join("/");
2792
+ function hs(e, t) {
2793
+ const n = document.createElement("a");
2794
+ n.download = t, n.href = e, n.style.display = "none", document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(e);
2795
+ }
2796
+ var ms = Object.defineProperty, pt = Object.getOwnPropertySymbols, wr = Object.prototype.hasOwnProperty, yr = Object.prototype.propertyIsEnumerable, On = (e, t, n) => t in e ? ms(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, zt = (e, t) => {
2797
+ for (var n in t || (t = {}))
2798
+ wr.call(t, n) && On(e, n, t[n]);
2799
+ if (pt)
2800
+ for (var n of pt(t))
2801
+ yr.call(t, n) && On(e, n, t[n]);
2802
+ return e;
2803
+ }, Yt = (e, t) => {
2804
+ var n = {};
2805
+ for (var r in e)
2806
+ wr.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
2807
+ if (e != null && pt)
2808
+ for (var r of pt(e))
2809
+ t.indexOf(r) < 0 && yr.call(e, r) && (n[r] = e[r]);
2810
+ return n;
2811
+ };
2812
+ /**
2813
+ * @license QR Code generator library (TypeScript)
2814
+ * Copyright (c) Project Nayuki.
2815
+ * SPDX-License-Identifier: MIT
2816
+ */
2817
+ var ke;
2818
+ ((e) => {
2819
+ const t = class O {
2820
+ /*-- Constructor (low level) and fields --*/
2821
+ // Creates a new QR Code with the given version number,
2822
+ // error correction level, data codeword bytes, and mask number.
2823
+ // This is a low-level API that most users should not use directly.
2824
+ // A mid-level API is the encodeSegments() function.
2825
+ constructor(i, s, c, f) {
2826
+ if (this.version = i, this.errorCorrectionLevel = s, this.modules = [], this.isFunction = [], i < O.MIN_VERSION || i > O.MAX_VERSION)
2827
+ throw new RangeError("Version value out of range");
2828
+ if (f < -1 || f > 7)
2829
+ throw new RangeError("Mask value out of range");
2830
+ this.size = i * 4 + 17;
2831
+ let d = [];
2832
+ for (let m = 0; m < this.size; m++)
2833
+ d.push(!1);
2834
+ for (let m = 0; m < this.size; m++)
2835
+ this.modules.push(d.slice()), this.isFunction.push(d.slice());
2836
+ this.drawFunctionPatterns();
2837
+ const h = this.addEccAndInterleave(c);
2838
+ if (this.drawCodewords(h), f == -1) {
2839
+ let m = 1e9;
2840
+ for (let p = 0; p < 8; p++) {
2841
+ this.applyMask(p), this.drawFormatBits(p);
2842
+ const g = this.getPenaltyScore();
2843
+ g < m && (f = p, m = g), this.applyMask(p);
2844
+ }
2845
+ }
2846
+ o(0 <= f && f <= 7), this.mask = f, this.applyMask(f), this.drawFormatBits(f), this.isFunction = [];
2847
+ }
2848
+ /*-- Static factory functions (high level) --*/
2849
+ // Returns a QR Code representing the given Unicode text string at the given error correction level.
2850
+ // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
2851
+ // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
2852
+ // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
2853
+ // ecl argument if it can be done without increasing the version.
2854
+ static encodeText(i, s) {
2855
+ const c = e.QrSegment.makeSegments(i);
2856
+ return O.encodeSegments(c, s);
2857
+ }
2858
+ // Returns a QR Code representing the given binary data at the given error correction level.
2859
+ // This function always encodes using the binary segment mode, not any text mode. The maximum number of
2860
+ // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
2861
+ // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
2862
+ static encodeBinary(i, s) {
2863
+ const c = e.QrSegment.makeBytes(i);
2864
+ return O.encodeSegments([c], s);
2865
+ }
2866
+ /*-- Static factory functions (mid level) --*/
2867
+ // Returns a QR Code representing the given segments with the given encoding parameters.
2868
+ // The smallest possible QR Code version within the given range is automatically
2869
+ // chosen for the output. Iff boostEcl is true, then the ECC level of the result
2870
+ // may be higher than the ecl argument if it can be done without increasing the
2871
+ // version. The mask number is either between 0 to 7 (inclusive) to force that
2872
+ // mask, or -1 to automatically choose an appropriate mask (which may be slow).
2873
+ // This function allows the user to create a custom sequence of segments that switches
2874
+ // between modes (such as alphanumeric and byte) to encode text in less space.
2875
+ // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
2876
+ static encodeSegments(i, s, c = 1, f = 40, d = -1, h = !0) {
2877
+ if (!(O.MIN_VERSION <= c && c <= f && f <= O.MAX_VERSION) || d < -1 || d > 7)
2878
+ throw new RangeError("Invalid value");
2879
+ let m, p;
2880
+ for (m = c; ; m++) {
2881
+ const b = O.getNumDataCodewords(m, s) * 8, C = a.getTotalBits(i, m);
2882
+ if (C <= b) {
2883
+ p = C;
2884
+ break;
2885
+ }
2886
+ if (m >= f)
2887
+ throw new RangeError("Data too long");
2888
+ }
2889
+ for (const b of [O.Ecc.MEDIUM, O.Ecc.QUARTILE, O.Ecc.HIGH])
2890
+ h && p <= O.getNumDataCodewords(m, b) * 8 && (s = b);
2891
+ let g = [];
2892
+ for (const b of i) {
2893
+ n(b.mode.modeBits, 4, g), n(b.numChars, b.mode.numCharCountBits(m), g);
2894
+ for (const C of b.getData())
2895
+ g.push(C);
2896
+ }
2897
+ o(g.length == p);
2898
+ const y = O.getNumDataCodewords(m, s) * 8;
2899
+ o(g.length <= y), n(0, Math.min(4, y - g.length), g), n(0, (8 - g.length % 8) % 8, g), o(g.length % 8 == 0);
2900
+ for (let b = 236; g.length < y; b ^= 253)
2901
+ n(b, 8, g);
2902
+ let w = [];
2903
+ for (; w.length * 8 < g.length; )
2904
+ w.push(0);
2905
+ return g.forEach((b, C) => w[C >>> 3] |= b << 7 - (C & 7)), new O(m, s, w, d);
2906
+ }
2907
+ /*-- Accessor methods --*/
2908
+ // Returns the color of the module (pixel) at the given coordinates, which is false
2909
+ // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
2910
+ // If the given coordinates are out of bounds, then false (light) is returned.
2911
+ getModule(i, s) {
2912
+ return 0 <= i && i < this.size && 0 <= s && s < this.size && this.modules[s][i];
2913
+ }
2914
+ // Modified to expose modules for easy access
2915
+ getModules() {
2916
+ return this.modules;
2917
+ }
2918
+ /*-- Private helper methods for constructor: Drawing function modules --*/
2919
+ // Reads this object's version field, and draws and marks all function modules.
2920
+ drawFunctionPatterns() {
2921
+ for (let c = 0; c < this.size; c++)
2922
+ this.setFunctionModule(6, c, c % 2 == 0), this.setFunctionModule(c, 6, c % 2 == 0);
2923
+ this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
2924
+ const i = this.getAlignmentPatternPositions(), s = i.length;
2925
+ for (let c = 0; c < s; c++)
2926
+ for (let f = 0; f < s; f++)
2927
+ c == 0 && f == 0 || c == 0 && f == s - 1 || c == s - 1 && f == 0 || this.drawAlignmentPattern(i[c], i[f]);
2928
+ this.drawFormatBits(0), this.drawVersion();
2929
+ }
2930
+ // Draws two copies of the format bits (with its own error correction code)
2931
+ // based on the given mask and this object's error correction level field.
2932
+ drawFormatBits(i) {
2933
+ const s = this.errorCorrectionLevel.formatBits << 3 | i;
2934
+ let c = s;
2935
+ for (let d = 0; d < 10; d++)
2936
+ c = c << 1 ^ (c >>> 9) * 1335;
2937
+ const f = (s << 10 | c) ^ 21522;
2938
+ o(f >>> 15 == 0);
2939
+ for (let d = 0; d <= 5; d++)
2940
+ this.setFunctionModule(8, d, r(f, d));
2941
+ this.setFunctionModule(8, 7, r(f, 6)), this.setFunctionModule(8, 8, r(f, 7)), this.setFunctionModule(7, 8, r(f, 8));
2942
+ for (let d = 9; d < 15; d++)
2943
+ this.setFunctionModule(14 - d, 8, r(f, d));
2944
+ for (let d = 0; d < 8; d++)
2945
+ this.setFunctionModule(this.size - 1 - d, 8, r(f, d));
2946
+ for (let d = 8; d < 15; d++)
2947
+ this.setFunctionModule(8, this.size - 15 + d, r(f, d));
2948
+ this.setFunctionModule(8, this.size - 8, !0);
2949
+ }
2950
+ // Draws two copies of the version bits (with its own error correction code),
2951
+ // based on this object's version field, iff 7 <= version <= 40.
2952
+ drawVersion() {
2953
+ if (this.version < 7)
2954
+ return;
2955
+ let i = this.version;
2956
+ for (let c = 0; c < 12; c++)
2957
+ i = i << 1 ^ (i >>> 11) * 7973;
2958
+ const s = this.version << 12 | i;
2959
+ o(s >>> 18 == 0);
2960
+ for (let c = 0; c < 18; c++) {
2961
+ const f = r(s, c), d = this.size - 11 + c % 3, h = Math.floor(c / 3);
2962
+ this.setFunctionModule(d, h, f), this.setFunctionModule(h, d, f);
2963
+ }
2964
+ }
2965
+ // Draws a 9*9 finder pattern including the border separator,
2966
+ // with the center module at (x, y). Modules can be out of bounds.
2967
+ drawFinderPattern(i, s) {
2968
+ for (let c = -4; c <= 4; c++)
2969
+ for (let f = -4; f <= 4; f++) {
2970
+ const d = Math.max(Math.abs(f), Math.abs(c)), h = i + f, m = s + c;
2971
+ 0 <= h && h < this.size && 0 <= m && m < this.size && this.setFunctionModule(h, m, d != 2 && d != 4);
2972
+ }
2973
+ }
2974
+ // Draws a 5*5 alignment pattern, with the center module
2975
+ // at (x, y). All modules must be in bounds.
2976
+ drawAlignmentPattern(i, s) {
2977
+ for (let c = -2; c <= 2; c++)
2978
+ for (let f = -2; f <= 2; f++)
2979
+ this.setFunctionModule(i + f, s + c, Math.max(Math.abs(f), Math.abs(c)) != 1);
2980
+ }
2981
+ // Sets the color of a module and marks it as a function module.
2982
+ // Only used by the constructor. Coordinates must be in bounds.
2983
+ setFunctionModule(i, s, c) {
2984
+ this.modules[s][i] = c, this.isFunction[s][i] = !0;
2985
+ }
2986
+ /*-- Private helper methods for constructor: Codewords and masking --*/
2987
+ // Returns a new byte string representing the given data with the appropriate error correction
2988
+ // codewords appended to it, based on this object's version and error correction level.
2989
+ addEccAndInterleave(i) {
2990
+ const s = this.version, c = this.errorCorrectionLevel;
2991
+ if (i.length != O.getNumDataCodewords(s, c))
2992
+ throw new RangeError("Invalid argument");
2993
+ const f = O.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][s], d = O.ECC_CODEWORDS_PER_BLOCK[c.ordinal][s], h = Math.floor(O.getNumRawDataModules(s) / 8), m = f - h % f, p = Math.floor(h / f);
2994
+ let g = [];
2995
+ const y = O.reedSolomonComputeDivisor(d);
2996
+ for (let b = 0, C = 0; b < f; b++) {
2997
+ let S = i.slice(C, C + p - d + (b < m ? 0 : 1));
2998
+ C += S.length;
2999
+ const T = O.reedSolomonComputeRemainder(S, y);
3000
+ b < m && S.push(0), g.push(S.concat(T));
3001
+ }
3002
+ let w = [];
3003
+ for (let b = 0; b < g[0].length; b++)
3004
+ g.forEach((C, S) => {
3005
+ (b != p - d || S >= m) && w.push(C[b]);
3006
+ });
3007
+ return o(w.length == h), w;
3008
+ }
3009
+ // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
3010
+ // data area of this QR Code. Function modules need to be marked off before this is called.
3011
+ drawCodewords(i) {
3012
+ if (i.length != Math.floor(O.getNumRawDataModules(this.version) / 8))
3013
+ throw new RangeError("Invalid argument");
3014
+ let s = 0;
3015
+ for (let c = this.size - 1; c >= 1; c -= 2) {
3016
+ c == 6 && (c = 5);
3017
+ for (let f = 0; f < this.size; f++)
3018
+ for (let d = 0; d < 2; d++) {
3019
+ const h = c - d, p = (c + 1 & 2) == 0 ? this.size - 1 - f : f;
3020
+ !this.isFunction[p][h] && s < i.length * 8 && (this.modules[p][h] = r(i[s >>> 3], 7 - (s & 7)), s++);
3021
+ }
3022
+ }
3023
+ o(s == i.length * 8);
3024
+ }
3025
+ // XORs the codeword modules in this QR Code with the given mask pattern.
3026
+ // The function modules must be marked and the codeword bits must be drawn
3027
+ // before masking. Due to the arithmetic of XOR, calling applyMask() with
3028
+ // the same mask value a second time will undo the mask. A final well-formed
3029
+ // QR Code needs exactly one (not zero, two, etc.) mask applied.
3030
+ applyMask(i) {
3031
+ if (i < 0 || i > 7)
3032
+ throw new RangeError("Mask value out of range");
3033
+ for (let s = 0; s < this.size; s++)
3034
+ for (let c = 0; c < this.size; c++) {
3035
+ let f;
3036
+ switch (i) {
3037
+ case 0:
3038
+ f = (c + s) % 2 == 0;
3039
+ break;
3040
+ case 1:
3041
+ f = s % 2 == 0;
3042
+ break;
3043
+ case 2:
3044
+ f = c % 3 == 0;
3045
+ break;
3046
+ case 3:
3047
+ f = (c + s) % 3 == 0;
3048
+ break;
3049
+ case 4:
3050
+ f = (Math.floor(c / 3) + Math.floor(s / 2)) % 2 == 0;
3051
+ break;
3052
+ case 5:
3053
+ f = c * s % 2 + c * s % 3 == 0;
3054
+ break;
3055
+ case 6:
3056
+ f = (c * s % 2 + c * s % 3) % 2 == 0;
3057
+ break;
3058
+ case 7:
3059
+ f = ((c + s) % 2 + c * s % 3) % 2 == 0;
3060
+ break;
3061
+ default:
3062
+ throw new Error("Unreachable");
3063
+ }
3064
+ !this.isFunction[s][c] && f && (this.modules[s][c] = !this.modules[s][c]);
3065
+ }
3066
+ }
3067
+ // Calculates and returns the penalty score based on state of this QR Code's current modules.
3068
+ // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
3069
+ getPenaltyScore() {
3070
+ let i = 0;
3071
+ for (let d = 0; d < this.size; d++) {
3072
+ let h = !1, m = 0, p = [0, 0, 0, 0, 0, 0, 0];
3073
+ for (let g = 0; g < this.size; g++)
3074
+ this.modules[d][g] == h ? (m++, m == 5 ? i += O.PENALTY_N1 : m > 5 && i++) : (this.finderPenaltyAddHistory(m, p), h || (i += this.finderPenaltyCountPatterns(p) * O.PENALTY_N3), h = this.modules[d][g], m = 1);
3075
+ i += this.finderPenaltyTerminateAndCount(h, m, p) * O.PENALTY_N3;
3076
+ }
3077
+ for (let d = 0; d < this.size; d++) {
3078
+ let h = !1, m = 0, p = [0, 0, 0, 0, 0, 0, 0];
3079
+ for (let g = 0; g < this.size; g++)
3080
+ this.modules[g][d] == h ? (m++, m == 5 ? i += O.PENALTY_N1 : m > 5 && i++) : (this.finderPenaltyAddHistory(m, p), h || (i += this.finderPenaltyCountPatterns(p) * O.PENALTY_N3), h = this.modules[g][d], m = 1);
3081
+ i += this.finderPenaltyTerminateAndCount(h, m, p) * O.PENALTY_N3;
3082
+ }
3083
+ for (let d = 0; d < this.size - 1; d++)
3084
+ for (let h = 0; h < this.size - 1; h++) {
3085
+ const m = this.modules[d][h];
3086
+ m == this.modules[d][h + 1] && m == this.modules[d + 1][h] && m == this.modules[d + 1][h + 1] && (i += O.PENALTY_N2);
3087
+ }
3088
+ let s = 0;
3089
+ for (const d of this.modules)
3090
+ s = d.reduce((h, m) => h + (m ? 1 : 0), s);
3091
+ const c = this.size * this.size, f = Math.ceil(Math.abs(s * 20 - c * 10) / c) - 1;
3092
+ return o(0 <= f && f <= 9), i += f * O.PENALTY_N4, o(0 <= i && i <= 2568888), i;
3093
+ }
3094
+ /*-- Private helper functions --*/
3095
+ // Returns an ascending list of positions of alignment patterns for this version number.
3096
+ // Each position is in the range [0,177), and are used on both the x and y axes.
3097
+ // This could be implemented as lookup table of 40 variable-length lists of integers.
3098
+ getAlignmentPatternPositions() {
3099
+ if (this.version == 1)
3100
+ return [];
3101
+ {
3102
+ const i = Math.floor(this.version / 7) + 2, s = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (i * 2 - 2)) * 2;
3103
+ let c = [6];
3104
+ for (let f = this.size - 7; c.length < i; f -= s)
3105
+ c.splice(1, 0, f);
3106
+ return c;
3107
+ }
3108
+ }
3109
+ // Returns the number of data bits that can be stored in a QR Code of the given version number, after
3110
+ // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
3111
+ // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
3112
+ static getNumRawDataModules(i) {
3113
+ if (i < O.MIN_VERSION || i > O.MAX_VERSION)
3114
+ throw new RangeError("Version number out of range");
3115
+ let s = (16 * i + 128) * i + 64;
3116
+ if (i >= 2) {
3117
+ const c = Math.floor(i / 7) + 2;
3118
+ s -= (25 * c - 10) * c - 55, i >= 7 && (s -= 36);
3119
+ }
3120
+ return o(208 <= s && s <= 29648), s;
3121
+ }
3122
+ // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
3123
+ // QR Code of the given version number and error correction level, with remainder bits discarded.
3124
+ // This stateless pure function could be implemented as a (40*4)-cell lookup table.
3125
+ static getNumDataCodewords(i, s) {
3126
+ return Math.floor(O.getNumRawDataModules(i) / 8) - O.ECC_CODEWORDS_PER_BLOCK[s.ordinal][i] * O.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][i];
3127
+ }
3128
+ // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
3129
+ // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
3130
+ static reedSolomonComputeDivisor(i) {
3131
+ if (i < 1 || i > 255)
3132
+ throw new RangeError("Degree out of range");
3133
+ let s = [];
3134
+ for (let f = 0; f < i - 1; f++)
3135
+ s.push(0);
3136
+ s.push(1);
3137
+ let c = 1;
3138
+ for (let f = 0; f < i; f++) {
3139
+ for (let d = 0; d < s.length; d++)
3140
+ s[d] = O.reedSolomonMultiply(s[d], c), d + 1 < s.length && (s[d] ^= s[d + 1]);
3141
+ c = O.reedSolomonMultiply(c, 2);
3142
+ }
3143
+ return s;
3144
+ }
3145
+ // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
3146
+ static reedSolomonComputeRemainder(i, s) {
3147
+ let c = s.map((f) => 0);
3148
+ for (const f of i) {
3149
+ const d = f ^ c.shift();
3150
+ c.push(0), s.forEach((h, m) => c[m] ^= O.reedSolomonMultiply(h, d));
3151
+ }
3152
+ return c;
3153
+ }
3154
+ // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
3155
+ // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
3156
+ static reedSolomonMultiply(i, s) {
3157
+ if (i >>> 8 || s >>> 8)
3158
+ throw new RangeError("Byte out of range");
3159
+ let c = 0;
3160
+ for (let f = 7; f >= 0; f--)
3161
+ c = c << 1 ^ (c >>> 7) * 285, c ^= (s >>> f & 1) * i;
3162
+ return o(c >>> 8 == 0), c;
3163
+ }
3164
+ // Can only be called immediately after a light run is added, and
3165
+ // returns either 0, 1, or 2. A helper function for getPenaltyScore().
3166
+ finderPenaltyCountPatterns(i) {
3167
+ const s = i[1];
3168
+ o(s <= this.size * 3);
3169
+ const c = s > 0 && i[2] == s && i[3] == s * 3 && i[4] == s && i[5] == s;
3170
+ return (c && i[0] >= s * 4 && i[6] >= s ? 1 : 0) + (c && i[6] >= s * 4 && i[0] >= s ? 1 : 0);
3171
+ }
3172
+ // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
3173
+ finderPenaltyTerminateAndCount(i, s, c) {
3174
+ return i && (this.finderPenaltyAddHistory(s, c), s = 0), s += this.size, this.finderPenaltyAddHistory(s, c), this.finderPenaltyCountPatterns(c);
3175
+ }
3176
+ // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
3177
+ finderPenaltyAddHistory(i, s) {
3178
+ s[0] == 0 && (i += this.size), s.pop(), s.unshift(i);
3179
+ }
3180
+ };
3181
+ 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 = [
3182
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
3183
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 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 Error correction level
3184
+ [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
3185
+ // Low
3186
+ [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
3187
+ // Medium
3188
+ [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
3189
+ // Quartile
3190
+ [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
3191
+ // High
3192
+ ], t.NUM_ERROR_CORRECTION_BLOCKS = [
3193
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
3194
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,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 Error correction level
3195
+ [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
3196
+ // Low
3197
+ [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
3198
+ // Medium
3199
+ [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
3200
+ // Quartile
3201
+ [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
3202
+ // High
3203
+ ], e.QrCode = t;
3204
+ function n(u, i, s) {
3205
+ if (i < 0 || i > 31 || u >>> i)
3206
+ throw new RangeError("Value out of range");
3207
+ for (let c = i - 1; c >= 0; c--)
3208
+ s.push(u >>> c & 1);
3209
+ }
3210
+ function r(u, i) {
3211
+ return (u >>> i & 1) != 0;
3212
+ }
3213
+ function o(u) {
3214
+ if (!u)
3215
+ throw new Error("Assertion error");
3216
+ }
3217
+ const l = class Y {
3218
+ /*-- Constructor (low level) and fields --*/
3219
+ // Creates a new QR Code segment with the given attributes and data.
3220
+ // The character count (numChars) must agree with the mode and the bit buffer length,
3221
+ // but the constraint isn't checked. The given bit buffer is cloned and stored.
3222
+ constructor(i, s, c) {
3223
+ if (this.mode = i, this.numChars = s, this.bitData = c, s < 0)
3224
+ throw new RangeError("Invalid argument");
3225
+ this.bitData = c.slice();
3226
+ }
3227
+ /*-- Static factory functions (mid level) --*/
3228
+ // Returns a segment representing the given binary data encoded in
3229
+ // byte mode. All input byte arrays are acceptable. Any text string
3230
+ // can be converted to UTF-8 bytes and encoded as a byte mode segment.
3231
+ static makeBytes(i) {
3232
+ let s = [];
3233
+ for (const c of i)
3234
+ n(c, 8, s);
3235
+ return new Y(Y.Mode.BYTE, i.length, s);
3236
+ }
3237
+ // Returns a segment representing the given string of decimal digits encoded in numeric mode.
3238
+ static makeNumeric(i) {
3239
+ if (!Y.isNumeric(i))
3240
+ throw new RangeError("String contains non-numeric characters");
3241
+ let s = [];
3242
+ for (let c = 0; c < i.length; ) {
3243
+ const f = Math.min(i.length - c, 3);
3244
+ n(parseInt(i.substring(c, c + f), 10), f * 3 + 1, s), c += f;
3245
+ }
3246
+ return new Y(Y.Mode.NUMERIC, i.length, s);
3247
+ }
3248
+ // Returns a segment representing the given text string encoded in alphanumeric mode.
3249
+ // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
3250
+ // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
3251
+ static makeAlphanumeric(i) {
3252
+ if (!Y.isAlphanumeric(i))
3253
+ throw new RangeError("String contains unencodable characters in alphanumeric mode");
3254
+ let s = [], c;
3255
+ for (c = 0; c + 2 <= i.length; c += 2) {
3256
+ let f = Y.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)) * 45;
3257
+ f += Y.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c + 1)), n(f, 11, s);
3258
+ }
3259
+ return c < i.length && n(Y.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)), 6, s), new Y(Y.Mode.ALPHANUMERIC, i.length, s);
3260
+ }
3261
+ // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
3262
+ // The result may use various segment modes and switch modes to optimize the length of the bit stream.
3263
+ static makeSegments(i) {
3264
+ return i == "" ? [] : Y.isNumeric(i) ? [Y.makeNumeric(i)] : Y.isAlphanumeric(i) ? [Y.makeAlphanumeric(i)] : [Y.makeBytes(Y.toUtf8ByteArray(i))];
3265
+ }
3266
+ // Returns a segment representing an Extended Channel Interpretation
3267
+ // (ECI) designator with the given assignment value.
3268
+ static makeEci(i) {
3269
+ let s = [];
3270
+ if (i < 0)
3271
+ throw new RangeError("ECI assignment value out of range");
3272
+ if (i < 128)
3273
+ n(i, 8, s);
3274
+ else if (i < 16384)
3275
+ n(2, 2, s), n(i, 14, s);
3276
+ else if (i < 1e6)
3277
+ n(6, 3, s), n(i, 21, s);
3278
+ else
3279
+ throw new RangeError("ECI assignment value out of range");
3280
+ return new Y(Y.Mode.ECI, 0, s);
3281
+ }
3282
+ // Tests whether the given string can be encoded as a segment in numeric mode.
3283
+ // A string is encodable iff each character is in the range 0 to 9.
3284
+ static isNumeric(i) {
3285
+ return Y.NUMERIC_REGEX.test(i);
3286
+ }
3287
+ // Tests whether the given string can be encoded as a segment in alphanumeric mode.
3288
+ // A string is encodable iff each character is in the following set: 0 to 9, A to Z
3289
+ // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
3290
+ static isAlphanumeric(i) {
3291
+ return Y.ALPHANUMERIC_REGEX.test(i);
3292
+ }
3293
+ /*-- Methods --*/
3294
+ // Returns a new copy of the data bits of this segment.
3295
+ getData() {
3296
+ return this.bitData.slice();
3297
+ }
3298
+ // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
3299
+ // the given version. The result is infinity if a segment has too many characters to fit its length field.
3300
+ static getTotalBits(i, s) {
3301
+ let c = 0;
3302
+ for (const f of i) {
3303
+ const d = f.mode.numCharCountBits(s);
3304
+ if (f.numChars >= 1 << d)
3305
+ return 1 / 0;
3306
+ c += 4 + d + f.bitData.length;
3307
+ }
3308
+ return c;
3309
+ }
3310
+ // Returns a new array of bytes representing the given string encoded in UTF-8.
3311
+ static toUtf8ByteArray(i) {
3312
+ i = encodeURI(i);
3313
+ let s = [];
3314
+ for (let c = 0; c < i.length; c++)
3315
+ i.charAt(c) != "%" ? s.push(i.charCodeAt(c)) : (s.push(parseInt(i.substring(c + 1, c + 3), 16)), c += 2);
3316
+ return s;
3317
+ }
3318
+ };
3319
+ l.NUMERIC_REGEX = /^[0-9]*$/, l.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, l.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
3320
+ let a = l;
3321
+ e.QrSegment = l;
3322
+ })(ke || (ke = {}));
3323
+ ((e) => {
3324
+ ((t) => {
3325
+ const n = class {
3326
+ // The QR Code can tolerate about 30% erroneous codewords
3327
+ /*-- Constructor and fields --*/
3328
+ constructor(o, l) {
3329
+ this.ordinal = o, this.formatBits = l;
3330
+ }
3331
+ };
3332
+ n.LOW = new n(0, 1), n.MEDIUM = new n(1, 0), n.QUARTILE = new n(2, 3), n.HIGH = new n(3, 2), t.Ecc = n;
3333
+ })(e.QrCode || (e.QrCode = {}));
3334
+ })(ke || (ke = {}));
3335
+ ((e) => {
3336
+ ((t) => {
3337
+ const n = class {
3338
+ /*-- Constructor and fields --*/
3339
+ constructor(o, l) {
3340
+ this.modeBits = o, this.numBitsCharCount = l;
3341
+ }
3342
+ /*-- Method --*/
3343
+ // (Package-private) Returns the bit width of the character count field for a segment in
3344
+ // this mode in a QR Code at the given version number. The result is in the range [0, 16].
3345
+ numCharCountBits(o) {
3346
+ return this.numBitsCharCount[Math.floor((o + 7) / 17)];
3347
+ }
3348
+ };
3349
+ n.NUMERIC = new n(1, [10, 12, 14]), n.ALPHANUMERIC = new n(2, [9, 11, 13]), n.BYTE = new n(4, [8, 16, 16]), n.KANJI = new n(8, [8, 10, 12]), n.ECI = new n(7, [0, 0, 0]), t.Mode = n;
3350
+ })(e.QrSegment || (e.QrSegment = {}));
3351
+ })(ke || (ke = {}));
3352
+ var $e = ke;
3353
+ /**
3354
+ * @license qrcode.react
3355
+ * Copyright (c) Paul O'Shannessy
3356
+ * SPDX-License-Identifier: ISC
3357
+ */
3358
+ var ps = {
3359
+ L: $e.QrCode.Ecc.LOW,
3360
+ M: $e.QrCode.Ecc.MEDIUM,
3361
+ Q: $e.QrCode.Ecc.QUARTILE,
3362
+ H: $e.QrCode.Ecc.HIGH
3363
+ }, Er = 128, vr = "L", Rr = "#FFFFFF", xr = "#000000", Cr = !1, Ar = 1, gs = 4, bs = 0, ws = 0.1;
3364
+ function Sr(e, t = 0) {
3365
+ const n = [];
3366
+ return e.forEach(function(r, o) {
3367
+ let l = null;
3368
+ r.forEach(function(a, u) {
3369
+ if (!a && l !== null) {
3370
+ n.push(
3371
+ `M${l + t} ${o + t}h${u - l}v1H${l + t}z`
3372
+ ), l = null;
3373
+ return;
3374
+ }
3375
+ if (u === r.length - 1) {
3376
+ if (!a)
3377
+ return;
3378
+ l === null ? n.push(`M${u + t},${o + t} h1v1H${u + t}z`) : n.push(
3379
+ `M${l + t},${o + t} h${u + 1 - l}v1H${l + t}z`
3380
+ );
3381
+ return;
3382
+ }
3383
+ a && l === null && (l = u);
3384
+ });
3385
+ }), n.join("");
3386
+ }
3387
+ function Tr(e, t) {
3388
+ return e.slice().map((n, r) => r < t.y || r >= t.y + t.h ? n : n.map((o, l) => l < t.x || l >= t.x + t.w ? o : !1));
3389
+ }
3390
+ function ys(e, t, n, r) {
3391
+ if (r == null)
3392
+ return null;
3393
+ const o = e.length + n * 2, l = Math.floor(t * ws), a = o / t, u = (r.width || l) * a, i = (r.height || l) * a, s = r.x == null ? e.length / 2 - u / 2 : r.x * a, c = r.y == null ? e.length / 2 - i / 2 : r.y * a, f = r.opacity == null ? 1 : r.opacity;
3394
+ let d = null;
3395
+ if (r.excavate) {
3396
+ let m = Math.floor(s), p = Math.floor(c), g = Math.ceil(u + s - m), y = Math.ceil(i + c - p);
3397
+ d = { x: m, y: p, w: g, h: y };
3398
+ }
3399
+ const h = r.crossOrigin;
3400
+ return { x: s, y: c, h: i, w: u, excavation: d, opacity: f, crossOrigin: h };
3401
+ }
3402
+ function Es(e, t) {
3403
+ return t != null ? Math.max(Math.floor(t), 0) : e ? gs : bs;
3404
+ }
3405
+ function Mr({
3406
+ value: e,
3407
+ level: t,
3408
+ minVersion: n,
3409
+ includeMargin: r,
3410
+ marginSize: o,
3411
+ imageSettings: l,
3412
+ size: a,
3413
+ boostLevel: u
3414
+ }) {
3415
+ let i = X.useMemo(() => {
3416
+ const m = (Array.isArray(e) ? e : [e]).reduce((p, g) => (p.push(...$e.QrSegment.makeSegments(g)), p), []);
3417
+ return $e.QrCode.encodeSegments(
3418
+ m,
3419
+ ps[t],
3420
+ n,
3421
+ void 0,
3422
+ void 0,
3423
+ u
3424
+ );
3425
+ }, [e, t, n, u]);
3426
+ const { cells: s, margin: c, numCells: f, calculatedImageSettings: d } = X.useMemo(() => {
3427
+ let h = i.getModules();
3428
+ const m = Es(r, o), p = h.length + m * 2, g = ys(
3429
+ h,
3430
+ a,
3431
+ m,
3432
+ l
3433
+ );
3434
+ return {
3435
+ cells: h,
3436
+ margin: m,
3437
+ numCells: p,
3438
+ calculatedImageSettings: g
3439
+ };
3440
+ }, [i, a, l, r, o]);
3441
+ return {
3442
+ qrcode: i,
3443
+ margin: c,
3444
+ cells: s,
3445
+ numCells: f,
3446
+ calculatedImageSettings: d
3447
+ };
3448
+ }
3449
+ var vs = (function() {
3450
+ try {
3451
+ new Path2D().addPath(new Path2D());
3452
+ } catch {
3453
+ return !1;
3454
+ }
3455
+ return !0;
3456
+ })(), Rs = X.forwardRef(
3457
+ function(t, n) {
3458
+ const r = t, {
3459
+ value: o,
3460
+ size: l = Er,
3461
+ level: a = vr,
3462
+ bgColor: u = Rr,
3463
+ fgColor: i = xr,
3464
+ includeMargin: s = Cr,
3465
+ minVersion: c = Ar,
3466
+ boostLevel: f,
3467
+ marginSize: d,
3468
+ imageSettings: h
3469
+ } = r, p = Yt(r, [
3470
+ "value",
3471
+ "size",
3472
+ "level",
3473
+ "bgColor",
3474
+ "fgColor",
3475
+ "includeMargin",
3476
+ "minVersion",
3477
+ "boostLevel",
3478
+ "marginSize",
3479
+ "imageSettings"
3480
+ ]), { style: g } = p, y = Yt(p, ["style"]), w = h == null ? void 0 : h.src, b = X.useRef(null), C = X.useRef(null), S = X.useCallback(
3481
+ (v) => {
3482
+ b.current = v, typeof n == "function" ? n(v) : n && (n.current = v);
3483
+ },
3484
+ [n]
3485
+ ), [T, L] = X.useState(!1), { margin: $, cells: W, numCells: U, calculatedImageSettings: I } = Mr({
3486
+ value: o,
3487
+ level: a,
3488
+ minVersion: c,
3489
+ boostLevel: f,
3490
+ includeMargin: s,
3491
+ marginSize: d,
3492
+ imageSettings: h,
3493
+ size: l
3494
+ });
3495
+ X.useEffect(() => {
3496
+ if (b.current != null) {
3497
+ const v = b.current, A = v.getContext("2d");
3498
+ if (!A)
3499
+ return;
3500
+ let F = W;
3501
+ const k = C.current, x = I != null && k !== null && k.complete && k.naturalHeight !== 0 && k.naturalWidth !== 0;
3502
+ x && I.excavation != null && (F = Tr(
3503
+ W,
3504
+ I.excavation
3505
+ ));
3506
+ const M = window.devicePixelRatio || 1;
3507
+ v.height = v.width = l * M;
3508
+ const _ = l / U * M;
3509
+ A.scale(_, _), A.fillStyle = u, A.fillRect(0, 0, U, U), A.fillStyle = i, vs ? A.fill(new Path2D(Sr(F, $))) : W.forEach(function(ee, de) {
3510
+ ee.forEach(function(N, ce) {
3511
+ N && A.fillRect(ce + $, de + $, 1, 1);
3512
+ });
3513
+ }), I && (A.globalAlpha = I.opacity), x && A.drawImage(
3514
+ k,
3515
+ I.x + $,
3516
+ I.y + $,
3517
+ I.w,
3518
+ I.h
3519
+ );
3520
+ }
3521
+ }), X.useEffect(() => {
3522
+ L(!1);
3523
+ }, [w]);
3524
+ const q = zt({ height: l, width: l }, g);
3525
+ let P = null;
3526
+ return w != null && (P = /* @__PURE__ */ X.createElement(
3527
+ "img",
3528
+ {
3529
+ src: w,
3530
+ key: w,
3531
+ style: { display: "none" },
3532
+ onLoad: () => {
3533
+ L(!0);
3534
+ },
3535
+ ref: C,
3536
+ crossOrigin: I == null ? void 0 : I.crossOrigin
3537
+ }
3538
+ )), /* @__PURE__ */ X.createElement(X.Fragment, null, /* @__PURE__ */ X.createElement(
3539
+ "canvas",
3540
+ zt({
3541
+ style: q,
3542
+ height: l,
3543
+ width: l,
3544
+ ref: S,
3545
+ role: "img"
3546
+ }, y)
3547
+ ), P);
3548
+ }
3549
+ );
3550
+ Rs.displayName = "QRCodeCanvas";
3551
+ var Ir = X.forwardRef(
3552
+ function(t, n) {
3553
+ const r = t, {
3554
+ value: o,
3555
+ size: l = Er,
3556
+ level: a = vr,
3557
+ bgColor: u = Rr,
3558
+ fgColor: i = xr,
3559
+ includeMargin: s = Cr,
3560
+ minVersion: c = Ar,
3561
+ boostLevel: f,
3562
+ title: d,
3563
+ marginSize: h,
3564
+ imageSettings: m
3565
+ } = r, p = Yt(r, [
3566
+ "value",
3567
+ "size",
3568
+ "level",
3569
+ "bgColor",
3570
+ "fgColor",
3571
+ "includeMargin",
3572
+ "minVersion",
3573
+ "boostLevel",
3574
+ "title",
3575
+ "marginSize",
3576
+ "imageSettings"
3577
+ ]), { margin: g, cells: y, numCells: w, calculatedImageSettings: b } = Mr({
3578
+ value: o,
3579
+ level: a,
3580
+ minVersion: c,
3581
+ boostLevel: f,
3582
+ includeMargin: s,
3583
+ marginSize: h,
3584
+ imageSettings: m,
3585
+ size: l
3586
+ });
3587
+ let C = y, S = null;
3588
+ m != null && b != null && (b.excavation != null && (C = Tr(
3589
+ y,
3590
+ b.excavation
3591
+ )), S = /* @__PURE__ */ X.createElement(
3592
+ "image",
3593
+ {
3594
+ href: m.src,
3595
+ height: b.h,
3596
+ width: b.w,
3597
+ x: b.x + g,
3598
+ y: b.y + g,
3599
+ preserveAspectRatio: "none",
3600
+ opacity: b.opacity,
3601
+ crossOrigin: b.crossOrigin
3602
+ }
3603
+ ));
3604
+ const T = Sr(C, g);
3605
+ return /* @__PURE__ */ X.createElement(
3606
+ "svg",
3607
+ zt({
3608
+ height: l,
3609
+ width: l,
3610
+ viewBox: `0 0 ${w} ${w}`,
3611
+ ref: n,
3612
+ role: "img"
3613
+ }, p),
3614
+ !!d && /* @__PURE__ */ X.createElement("title", null, d),
3615
+ /* @__PURE__ */ X.createElement(
3616
+ "path",
3617
+ {
3618
+ fill: u,
3619
+ d: `M0,0 h${w}v${w}H0z`,
3620
+ shapeRendering: "crispEdges"
3621
+ }
3622
+ ),
3623
+ /* @__PURE__ */ X.createElement("path", { fill: i, d: T, shapeRendering: "crispEdges" }),
3624
+ S
3625
+ );
3626
+ }
3627
+ );
3628
+ Ir.displayName = "QRCodeSVG";
3629
+ var Nr = /* @__PURE__ */ ((e) => (e.LINK = "link", e))(Nr || {});
3630
+ const xs = (e, t) => ({
3631
+ invitationType: Nr.LINK,
3632
+ resources: [
3633
+ {
3634
+ url: `conversations/${encodeURI(e)}`
3635
+ },
3636
+ ...t
3637
+ ]
3638
+ }), Cs = (e) => {
3639
+ var n;
3640
+ return `/share/${((n = e == null ? void 0 : e.invitationLink) == null ? void 0 : n.split("/").at(-1)) || ""}`;
3641
+ }, As = (e, t) => t == null ? void 0 : t.find((n) => {
3642
+ var l, a, u, i;
3643
+ const r = (a = (l = e == null ? void 0 : e.id) == null ? void 0 : l.split("/")) == null ? void 0 : a.pop(), o = ((i = (u = n == null ? void 0 : n.url) == null ? void 0 : u.split("/")) == null ? void 0 : i.pop()) || "";
3644
+ return o === r || decodeURI(o) === r;
3645
+ }), Ss = (e) => {
3646
+ var n, r;
3647
+ const t = (n = e == null ? void 0 : e.messages) == null ? void 0 : n.filter(
3648
+ (o) => {
3649
+ var l;
3650
+ return !!((l = o == null ? void 0 : o.custom_content) != null && l.attachments);
3651
+ }
3652
+ );
3653
+ return ((r = t == null ? void 0 : t.flatMap((o) => {
3654
+ var l, a;
3655
+ return ((a = (l = o == null ? void 0 : o.custom_content) == null ? void 0 : l.attachments) == null ? void 0 : a.map((u) => ({
3656
+ url: (u == null ? void 0 : u.url) || ""
3657
+ }))) || [];
3658
+ })) == null ? void 0 : r.filter((o) => !!(o != null && o.url))) || [];
3659
+ }, Ts = ({
3660
+ value: e,
3661
+ inputId: t,
3662
+ placeholder: n = "",
3663
+ cssClass: r = "",
3664
+ type: o = "text",
3665
+ disabled: l,
3666
+ readonly: a,
3667
+ onChange: u,
3668
+ onKeyDown: i
3669
+ }) => {
3670
+ const s = J(
3671
+ "truncate outline-none shadow-none body-1",
3672
+ r,
3673
+ a ? "pointer-events-none" : ""
3674
+ );
3675
+ return /* @__PURE__ */ R(
3676
+ "input",
3677
+ {
3678
+ type: o,
3679
+ autoComplete: "off",
3680
+ id: t,
3681
+ placeholder: n,
3682
+ value: e || "",
3683
+ title: e ? String(e) : "",
3684
+ disabled: l,
3685
+ className: s,
3686
+ onKeyDown: i,
3687
+ onChange: (c) => u == null ? void 0 : u(c.currentTarget.value)
3688
+ }
3689
+ );
3690
+ }, Pr = ({
3691
+ iconBeforeInput: e,
3692
+ iconAfterInput: t,
3693
+ containerClasses: n,
3694
+ cssClass: r,
3695
+ ...o
3696
+ }) => /* @__PURE__ */ z("div", { className: J("input w-full flex flex-row", n), children: [
3697
+ e,
3698
+ /* @__PURE__ */ R(
3699
+ Ts,
3700
+ {
3701
+ cssClass: J(
3702
+ "border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",
3703
+ r
3704
+ ),
3705
+ ...o
3706
+ }
3707
+ ),
3708
+ t
3709
+ ] });
3710
+ var Or = /* @__PURE__ */ ((e) => (e.CONVERSATION = "CONVERSATION", e))(Or || {}), gt = /* @__PURE__ */ ((e) => (e.ME = "me", e.OTHERS = "others", e))(gt || {});
3711
+ const jt = (e) => ({ resourceTypes: [Or.CONVERSATION], with: e }), Ms = ({
3712
+ conversation: e,
3713
+ locale: t,
3714
+ onCloseModal: n,
3715
+ modalDividers: r,
3716
+ getConversation: o,
3717
+ generateConversationLink: l,
3718
+ chatExpiration: a,
3719
+ chatExpirationDays: u,
3720
+ close: i,
3721
+ chatWarning: s,
3722
+ shareLink: c,
3723
+ shareCopyLink: f,
3724
+ shareCopiedLink: d,
3725
+ shareDescription: h,
3726
+ shareRemoveAccessToUsers: m,
3727
+ chatName: p,
3728
+ getSharedConversations: g,
3729
+ revokeSharedConversations: y,
3730
+ baseUrl: w,
3731
+ id: b
3732
+ }) => {
3733
+ const [C, S] = te(null), [T, L] = te(), [$, W] = te(!1), [U, I] = te(!1), [q, P] = te(), v = bt(() => `${w || window.location.origin}/${t}${C}`, [w, C, t]);
3734
+ Ye(() => {
3735
+ (async () => {
3736
+ try {
3737
+ const _ = decodeURI(e ? e == null ? void 0 : e.id : `${b == null ? void 0 : b[0]}/${t}/${b == null ? void 0 : b[1]}`), ee = await (o == null ? void 0 : o(
3738
+ decodeURI(_)
3739
+ )), de = await (l == null ? void 0 : l(
3740
+ xs(
3741
+ _,
3742
+ Ss(ee)
3743
+ )
3744
+ )), N = await (g == null ? void 0 : g(
3745
+ jt(gt.OTHERS)
3746
+ ));
3747
+ de && N && (W(!0), S(Cs(de)), L(
3748
+ As(
3749
+ e,
3750
+ N == null ? void 0 : N.resources
3751
+ )
3752
+ ));
3753
+ } catch (_) {
3754
+ W(!1), console.error("Error sharing conversation", _);
3755
+ }
3756
+ })();
3757
+ }, [
3758
+ e,
3759
+ l,
3760
+ o,
3761
+ g,
3762
+ b,
3763
+ t
3764
+ ]);
3765
+ const A = me(() => {
3766
+ n(), S(null), W(!1), I(!1);
3767
+ }, [n]), F = me(() => {
3768
+ I(!0), navigator.clipboard.writeText(v || "");
3769
+ }, [v]), k = async () => {
3770
+ try {
3771
+ P(!0), T && await (y == null ? void 0 : y({ resources: [T] }));
3772
+ } catch (M) {
3773
+ P(!1), console.error("Error revoking shared conversation", M);
3774
+ }
3775
+ }, x = me(() => /* @__PURE__ */ R(
3776
+ je,
3777
+ {
3778
+ buttonClassName: U ? "text-button-secondary" : "text-button-primary",
3779
+ iconBefore: U ? /* @__PURE__ */ R($r, { width: 20, height: 20 }) : /* @__PURE__ */ R(Ur, { width: 20, height: 20 }),
3780
+ title: U ? d ?? "Copied" : f ?? "Copy link",
3781
+ disabled: U,
3782
+ onClick: F
3783
+ }
3784
+ ), [U, F, d, f]);
3785
+ return /* @__PURE__ */ z(
3786
+ br,
3787
+ {
3788
+ heading: c ?? "Share link",
3789
+ portalId: "share",
3790
+ size: Ge.SM,
3791
+ dividers: r,
3792
+ onClose: A,
3793
+ closeButtonTitle: i ?? "Close",
3794
+ children: [
3795
+ $ ? /* @__PURE__ */ z("div", { className: "share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0", children: [
3796
+ e != null && e.name ? /* @__PURE__ */ z("div", { className: "flex share-info w-full", children: [
3797
+ /* @__PURE__ */ R("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: p ?? "Chat name:" }),
3798
+ /* @__PURE__ */ R(
3799
+ "h3",
3800
+ {
3801
+ className: "flex-1 min-w-0 truncate",
3802
+ title: e == null ? void 0 : e.name,
3803
+ children: e == null ? void 0 : e.name
3804
+ }
3805
+ )
3806
+ ] }) : null,
3807
+ /* @__PURE__ */ z("div", { className: "flex share-info", children: [
3808
+ /* @__PURE__ */ R("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: a ?? "Link expiration date:" }),
3809
+ /* @__PURE__ */ z("h3", { children: [
3810
+ "3 ",
3811
+ u ?? "days"
3812
+ ] })
3813
+ ] }),
3814
+ /* @__PURE__ */ R(
3815
+ Ir,
3816
+ {
3817
+ className: "self-center border border-neutrals-600 p-2 rounded min-h-[200px]",
3818
+ value: v,
3819
+ size: 200
3820
+ }
3821
+ ),
3822
+ /* @__PURE__ */ R("p", { className: "body-2 text-neutrals-1000", children: h ?? "Your name, special instructions, and any messages you add after sharing remain confidential." }),
3823
+ /* @__PURE__ */ R(
3824
+ Pr,
3825
+ {
3826
+ containerClasses: "share-input-container",
3827
+ cssClass: "share-input",
3828
+ readonly: !0,
3829
+ placeholder: v,
3830
+ value: v,
3831
+ inputId: "conversationLink",
3832
+ iconAfterInput: x()
3833
+ }
3834
+ )
3835
+ ] }) : /* @__PURE__ */ R("div", { className: "flex justify-center items-center py-6 px-6", children: /* @__PURE__ */ R(Kt, {}) }),
3836
+ $ ? e && T ? /* @__PURE__ */ R("div", { className: "remove-access", children: /* @__PURE__ */ R(
3837
+ je,
3838
+ {
3839
+ title: m ?? "Remove access to all users",
3840
+ buttonClassName: "remove-access-button py-3 px-4",
3841
+ isSmallButton: !0,
3842
+ disabled: q,
3843
+ onClick: k
3844
+ }
3845
+ ) }) : /* @__PURE__ */ R("p", { className: "body-2 text-neutrals-800 share-footer", children: s ?? "This chat has not been shared with anyone yet." }) : /* @__PURE__ */ R("div", {})
3846
+ ]
3847
+ }
3848
+ );
3849
+ }, Is = ({
3850
+ triggerButton: e,
3851
+ options: t,
3852
+ selectedOption: n,
3853
+ disabled: r,
3854
+ containerClassName: o,
3855
+ openedClassName: l,
3856
+ onOptionSelect: a
3857
+ }) => {
3858
+ const [u, i] = te(!1), { refs: s, floatingStyles: c, context: f } = pr({
3859
+ open: u,
3860
+ onOpenChange: r ? void 0 : i,
3861
+ placement: "bottom-end",
3862
+ middleware: [xi(8), Ai(), Ci()],
3863
+ whileElementsMounted: pi
3864
+ }), d = Qi(f), h = mr(f, { outsidePress: !0 }), { getReferenceProps: m, getFloatingProps: p } = gr([
3865
+ d,
3866
+ h
3867
+ ]);
3868
+ return /* @__PURE__ */ z(Ne, { children: [
3869
+ /* @__PURE__ */ R(
3870
+ "div",
3871
+ {
3872
+ ref: s.setReference,
3873
+ ...m({
3874
+ onClick(g) {
3875
+ g.stopPropagation();
3876
+ }
3877
+ }),
3878
+ className: J(o, u && l),
3879
+ children: e
3880
+ }
3881
+ ),
3882
+ u && /* @__PURE__ */ R(
3883
+ "div",
3884
+ {
3885
+ ref: s.setFloating,
3886
+ style: c,
3887
+ className: "flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",
3888
+ ...p(),
3889
+ children: t.map((g) => /* @__PURE__ */ R(
3890
+ "div",
3891
+ {
3892
+ onClick: (y) => {
3893
+ y.stopPropagation(), a == null || a(g.key), i(!1);
3894
+ },
3895
+ className: J(
3896
+ "text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
3897
+ n === g.key && "bg-hues-100"
3898
+ ),
3899
+ children: /* @__PURE__ */ z(
3900
+ "div",
3901
+ {
3902
+ className: "p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",
3903
+ title: g.title,
3904
+ children: [
3905
+ g.icon ? g.icon : null,
3906
+ /* @__PURE__ */ R("p", { children: g == null ? void 0 : g.title })
3907
+ ]
3908
+ }
3909
+ )
3910
+ },
3911
+ g.key
3912
+ ))
3913
+ }
3914
+ )
3915
+ ] });
3916
+ }, Ns = ({
3917
+ conversation: e,
3918
+ conversationStyles: t,
3919
+ shareConversationProps: n,
3920
+ onConversationDelete: r,
3921
+ getConversation: o,
3922
+ getFileBlob: l,
3923
+ triggerButton: a,
3924
+ locale: u
3925
+ }) => {
3926
+ const i = bt(() => {
3927
+ var y, w, b, C, S, T;
3928
+ return [
3929
+ ...e.isShared ? [] : [
3930
+ {
3931
+ key: pe.SHARE,
3932
+ title: ((y = t == null ? void 0 : t.titles) == null ? void 0 : y.share) ?? "Share",
3933
+ icon: (w = t.actionsIcons) == null ? void 0 : w[pe.SHARE]
3934
+ }
3935
+ ],
3936
+ {
3937
+ key: pe.EXPORT,
3938
+ title: ((b = t == null ? void 0 : t.titles) == null ? void 0 : b.export) ?? "Export",
3939
+ icon: (C = t.actionsIcons) == null ? void 0 : C[pe.EXPORT]
3940
+ },
3941
+ {
3942
+ key: pe.DELETE,
3943
+ title: ((S = t == null ? void 0 : t.titles) == null ? void 0 : S.delete) ?? "Delete",
3944
+ icon: (T = t.actionsIcons) == null ? void 0 : T[pe.DELETE]
3945
+ }
3946
+ ];
3947
+ }, [
3948
+ e.isShared,
3949
+ t.titles,
3950
+ t.actionsIcons
3951
+ ]), [s, c] = te(ie.Closed), [f, d] = te(ie.Closed), h = me(() => {
3952
+ c(ie.Closed);
3953
+ }, [c]), m = me(() => {
3954
+ d(ie.Closed);
3955
+ }, [d]), p = me(() => {
3956
+ r(e), h();
3957
+ }, [e, r, h]);
3958
+ return /* @__PURE__ */ z(Ne, { children: [
3959
+ /* @__PURE__ */ R(
3960
+ Is,
3961
+ {
3962
+ containerClassName: "transition-opacity ml-3 group-hover:opacity-100",
3963
+ triggerButton: a ?? /* @__PURE__ */ R(Ps, {}),
3964
+ options: i,
3965
+ openedClassName: "action-menu-opened",
3966
+ onOptionSelect: (y) => {
3967
+ y === pe.DELETE && c(ie.Opened), y === pe.SHARE && d(ie.Opened), y === pe.EXPORT && o(decodeURI(e.id)).then((w) => {
3968
+ us(w, l).then((b) => {
3969
+ hs(
3970
+ `data:application/zip;base64,${b}`,
3971
+ `chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`
3972
+ );
3973
+ });
3974
+ });
3975
+ }
3976
+ }
3977
+ ),
3978
+ s === ie.Opened && /* @__PURE__ */ R(
3979
+ os,
3980
+ {
3981
+ titles: t.titles,
3982
+ locale: u,
3983
+ disableModalDividers: t.disableModalDividers,
3984
+ isSmallButton: t.isSmallModalButton,
3985
+ deleteConversation: p,
3986
+ onCloseModal: h
3987
+ }
3988
+ ),
3989
+ f === ie.Opened && /* @__PURE__ */ R(
3990
+ Ms,
3991
+ {
3992
+ conversation: e,
3993
+ locale: u,
3994
+ onCloseModal: m,
3995
+ ...n
3996
+ }
3997
+ )
3998
+ ] });
3999
+ }, Ps = () => /* @__PURE__ */ R("div", { className: "cursor-pointer flex items-center justify-center w-[24px]", children: /* @__PURE__ */ R(
4000
+ Vr,
4001
+ {
4002
+ width: 20,
4003
+ height: 20,
4004
+ stroke: 2,
4005
+ className: "text-primary"
4006
+ }
4007
+ ) }), Dr = (e) => (e == null ? void 0 : e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "").replace(/-/g, " ")) || "", Lr = ({
4008
+ conversation: e,
4009
+ selectedConversationId: t,
4010
+ searchQuery: n,
4011
+ onConversationClick: r,
4012
+ actions: o,
4013
+ locale: l,
4014
+ conversationStyles: a,
4015
+ shareConversationProps: u
4016
+ }) => {
4017
+ const i = Fr(null), s = Dr(e == null ? void 0 : e.name);
4018
+ return Ye(() => {
4019
+ var c;
4020
+ (e == null ? void 0 : e.id) === t && ((c = i == null ? void 0 : i.current) == null || c.scrollIntoView({
4021
+ block: "center",
4022
+ behavior: "smooth"
4023
+ }));
4024
+ }, [e, t]), /* @__PURE__ */ z(
4025
+ "div",
4026
+ {
4027
+ ref: i,
4028
+ className: J(
4029
+ "flex justify-between items-center py-2 px-3 border-transparent relative group cursor-pointer border hover:border-hues-600",
4030
+ "conversation-item",
4031
+ t === (e == null ? void 0 : e.id) && "bg-hues-100 conversation-item-active"
4032
+ ),
4033
+ onClick: () => r(e.folderId, e == null ? void 0 : e.id),
4034
+ title: s,
4035
+ children: [
4036
+ /* @__PURE__ */ z("div", { className: "flex w-full min-w-0 items-center", children: [
4037
+ a.conversationItemIcon ? a.conversationItemIcon : null,
4038
+ /* @__PURE__ */ R(
4039
+ "h3",
4040
+ {
4041
+ className: J(
4042
+ "truncate font-semibold text-neutrals-1000 sm:body-2",
4043
+ "conversation-item-text",
4044
+ t === (e == null ? void 0 : e.id) ? "conversation-item-text-active" : ""
4045
+ ),
4046
+ title: s,
4047
+ children: n != null && n.length ? /* @__PURE__ */ R(
4048
+ Qr,
4049
+ {
4050
+ text: s,
4051
+ highlightText: n
4052
+ }
4053
+ ) : s
4054
+ }
4055
+ )
4056
+ ] }),
4057
+ /* @__PURE__ */ R(
4058
+ Ns,
4059
+ {
4060
+ locale: l,
4061
+ conversationStyles: a,
4062
+ conversation: e,
4063
+ onConversationDelete: o.deleteConversation,
4064
+ getConversation: o.getConversation,
4065
+ getFileBlob: o.getFileBlob,
4066
+ shareConversationProps: u
4067
+ }
4068
+ )
4069
+ ]
4070
+ }
4071
+ );
4072
+ }, Os = ({
4073
+ handleConversationClick: e,
4074
+ actions: t,
4075
+ selectedConversationId: n,
4076
+ groupLabel: r,
4077
+ conversationStyles: o,
4078
+ groupedConversations: l,
4079
+ shareConversationProps: a,
4080
+ locale: u
4081
+ }) => {
4082
+ const [i, s] = te(!1), c = me(() => {
4083
+ s((f) => !f);
4084
+ }, [s]);
4085
+ return /* @__PURE__ */ z("div", { children: [
4086
+ /* @__PURE__ */ z(
4087
+ "div",
4088
+ {
4089
+ className: "inline-flex gap-1 items-center text-neutrals-700 mb-3 cursor-pointer conversation-group-items-title",
4090
+ onClick: c,
4091
+ children: [
4092
+ /* @__PURE__ */ R(
4093
+ Hr,
4094
+ {
4095
+ className: J(
4096
+ "w-3 h-3 conversation-group-items-arrow",
4097
+ i ? "rotate-[90deg]" : "rotate-0"
4098
+ )
4099
+ }
4100
+ ),
4101
+ /* @__PURE__ */ R("span", { className: "body-3 conversation-group-items-title-text", children: Xr(r, o == null ? void 0 : o.titles) })
4102
+ ]
4103
+ }
4104
+ ),
4105
+ !i && /* @__PURE__ */ R(
4106
+ "div",
4107
+ {
4108
+ className: J(
4109
+ "flex flex-col gap-y-3",
4110
+ "conversation-group-items"
4111
+ ),
4112
+ children: _n(l).map(
4113
+ (f) => /* @__PURE__ */ R(
4114
+ Lr,
4115
+ {
4116
+ locale: u,
4117
+ conversationStyles: o,
4118
+ conversation: f,
4119
+ selectedConversationId: n,
4120
+ onConversationClick: e,
4121
+ actions: t,
4122
+ shareConversationProps: a
4123
+ },
4124
+ f.id || f.name
4125
+ )
4126
+ )
4127
+ }
4128
+ )
4129
+ ] }, r);
4130
+ }, Ds = ({
4131
+ icon: e,
4132
+ onClick: t,
4133
+ buttonClassName: n,
4134
+ disabled: r,
4135
+ title: o
4136
+ }) => /* @__PURE__ */ R(
4137
+ "button",
4138
+ {
4139
+ type: "button",
4140
+ className: J(n, "base-icon-button"),
4141
+ onClick: (l) => t == null ? void 0 : t(l),
4142
+ disabled: r,
4143
+ title: o,
4144
+ "aria-label": "button",
4145
+ children: e
4146
+ }
4147
+ ), Ls = ({
4148
+ searchQuery: e,
4149
+ isExpandedSearch: t,
4150
+ titles: n,
4151
+ onSearchConversations: r,
4152
+ toggleSearchField: o
4153
+ }) => /* @__PURE__ */ R(Ne, { children: t ? /* @__PURE__ */ R(
4154
+ Pr,
4155
+ {
4156
+ inputId: "conversations-search",
4157
+ placeholder: (n == null ? void 0 : n.searchPlaceholder) ?? "Search",
4158
+ containerClasses: "h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",
4159
+ cssClass: "h-auto",
4160
+ value: e,
4161
+ iconAfterInput: /* @__PURE__ */ R(
4162
+ Ds,
4163
+ {
4164
+ buttonClassName: "text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",
4165
+ onClick: o,
4166
+ icon: /* @__PURE__ */ R(Fn, {})
4167
+ }
4168
+ ),
4169
+ onChange: r
4170
+ }
4171
+ ) : /* @__PURE__ */ R(
4172
+ je,
4173
+ {
4174
+ buttonClassName: "text-button-tertiary p-0",
4175
+ iconBefore: /* @__PURE__ */ R(Wr, { className: "w-5 h-5" }),
4176
+ onClick: o
4177
+ }
4178
+ ) }), Fs = ({
4179
+ conversations: e,
4180
+ selectedConversationId: t,
4181
+ searchQuery: n,
4182
+ conversationStyles: r,
4183
+ handleConversationClick: o,
4184
+ actions: l,
4185
+ locale: a,
4186
+ shareConversationProps: u
4187
+ }) => {
4188
+ var c;
4189
+ const [i, s] = te([]);
4190
+ return Ye(() => {
4191
+ s(
4192
+ _n(
4193
+ e == null ? void 0 : e.filter(
4194
+ (f) => {
4195
+ var d;
4196
+ return (d = Dr(f == null ? void 0 : f.name)) == null ? void 0 : d.includes(
4197
+ n || ""
4198
+ );
4199
+ }
4200
+ )
4201
+ )
4202
+ );
4203
+ }, [e, n]), /* @__PURE__ */ R(Ne, { children: i != null && i.length ? i.map((f) => /* @__PURE__ */ R(
4204
+ Lr,
4205
+ {
4206
+ locale: a,
4207
+ conversationStyles: r,
4208
+ conversation: f,
4209
+ searchQuery: n,
4210
+ selectedConversationId: t,
4211
+ onConversationClick: o,
4212
+ actions: l,
4213
+ shareConversationProps: u
4214
+ },
4215
+ f.id
4216
+ )) : /* @__PURE__ */ R("h3", { className: "text-neutrals-800", children: ((c = r == null ? void 0 : r.titles) == null ? void 0 : c.noConversation) ?? "No conversations yet" }) });
4217
+ }, ks = ({ titles: e }) => /* @__PURE__ */ z("div", { className: "p-8 text-center flex flex-col", children: [
4218
+ /* @__PURE__ */ R("p", { className: "text-neutrals-800", children: (e == null ? void 0 : e.noConversation) ?? "No conversations yet" }),
4219
+ /* @__PURE__ */ R("p", { className: "text-sm text-neutrals-800 mt-2", children: (e == null ? void 0 : e.clickNewChat) ?? 'Click "New Chat" to start a conversation' })
4220
+ ] }), ot = (e) => e.map((t) => ({
4221
+ ...t,
4222
+ name: t.name.split(/-\d+$/)[0]
4223
+ })), Dn = (e, t) => {
4224
+ var n, r;
4225
+ return ((r = (n = e == null ? void 0 : e.resources) == null ? void 0 : n.filter((o) => (o == null ? void 0 : o.parentPath) === t)) == null ? void 0 : r.map((o) => {
4226
+ var u, i, s;
4227
+ const l = `${o == null ? void 0 : o.bucket}/${t}`, a = (s = (i = (u = o == null ? void 0 : o.url) == null ? void 0 : u.split("/")) == null ? void 0 : i.slice(1)) == null ? void 0 : s.join("/");
4228
+ return {
4229
+ ...o,
4230
+ folderId: l,
4231
+ id: a,
4232
+ isShared: !0
4233
+ };
4234
+ })) || [];
4235
+ }, Bs = (e) => ({
4236
+ [ne.SHARED]: e
4237
+ }), js = ({
4238
+ handleConversationClick: e,
4239
+ selectedConversationId: t,
4240
+ actions: n,
4241
+ children: r,
4242
+ isCollapsed: o,
4243
+ conversationStyles: l,
4244
+ conversations: a,
4245
+ locale: u,
4246
+ sharedConversations: i,
4247
+ setConversations: s,
4248
+ setSharedConversations: c,
4249
+ shareConversationProps: f,
4250
+ handleSelectedConversationRemove: d
4251
+ }) => {
4252
+ var q;
4253
+ const [h, m] = te({}), [p, g] = te(!0), [y, w] = te(""), [b, C] = te(!1), { getConversations: S, getSharedConversations: T, deleteConversation: L } = n, $ = bt(() => !!(y != null && y.length), [y]);
4254
+ Ye(() => {
4255
+ m({
4256
+ ...Bs(i),
4257
+ ...Gr(a)
4258
+ });
4259
+ }, [a, i]), Ye(() => {
4260
+ async function P() {
4261
+ try {
4262
+ g(!0);
4263
+ const v = await S(u), A = await T(
4264
+ jt(gt.ME)
4265
+ );
4266
+ s(ot(v)), c(
4267
+ ot(
4268
+ Dn(A, u)
4269
+ )
4270
+ );
4271
+ } catch (v) {
4272
+ console.error("Error loading conversation", v);
4273
+ } finally {
4274
+ g(!1);
4275
+ }
4276
+ }
4277
+ P();
4278
+ }, [
4279
+ S,
4280
+ s,
4281
+ u,
4282
+ T,
4283
+ c
4284
+ ]);
4285
+ const W = me(
4286
+ async (P) => {
4287
+ try {
4288
+ await L(P);
4289
+ const v = await S(u), A = await T(
4290
+ jt(gt.ME)
4291
+ );
4292
+ s(ot(v)), c(
4293
+ ot(
4294
+ Dn(A, u)
4295
+ )
4296
+ ), t === (P == null ? void 0 : P.id) && d();
4297
+ } catch (v) {
4298
+ console.error("Error deleting conversation", v);
4299
+ }
4300
+ },
4301
+ [
4302
+ L,
4303
+ S,
4304
+ u,
4305
+ T,
4306
+ s,
4307
+ c,
4308
+ t,
4309
+ d
4310
+ ]
4311
+ ), U = me(
4312
+ (P) => {
4313
+ w(P);
4314
+ },
4315
+ [w]
4316
+ ), I = me(() => {
4317
+ C((P) => !P), w("");
4318
+ }, [C]);
4319
+ return p ? /* @__PURE__ */ R(Kt, {}) : /* @__PURE__ */ z(Ne, { children: [
4320
+ !o && /* @__PURE__ */ z(
4321
+ "div",
4322
+ {
4323
+ className: J(
4324
+ "flex justify-between items-center",
4325
+ b ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"
4326
+ ),
4327
+ children: [
4328
+ !b && /* @__PURE__ */ R("h3", { className: "text-neutrals-700 sm:body-2", children: ((q = l == null ? void 0 : l.titles) == null ? void 0 : q.allChats) ?? "All Chats" }),
4329
+ /* @__PURE__ */ R(
4330
+ Ls,
4331
+ {
4332
+ searchQuery: y,
4333
+ titles: l.titles,
4334
+ isExpandedSearch: b,
4335
+ onSearchConversations: U,
4336
+ toggleSearchField: I
4337
+ }
4338
+ )
4339
+ ]
4340
+ }
4341
+ ),
4342
+ /* @__PURE__ */ R(
4343
+ "div",
4344
+ {
4345
+ className: J(
4346
+ "overflow-y-auto flex flex-col mt-4 flex-1 min-h-0 pr-2",
4347
+ $ ? "gap-y-1" : "gap-y-6"
4348
+ ),
4349
+ children: o ? null : /* @__PURE__ */ R(Ne, { children: (a == null ? void 0 : a.length) === 0 && (i == null ? void 0 : i.length) === 0 ? /* @__PURE__ */ R(ks, { titles: l.titles }) : $ ? /* @__PURE__ */ R(
4350
+ Fs,
4351
+ {
4352
+ locale: u,
4353
+ conversationStyles: l,
4354
+ conversations: [...i, ...a],
4355
+ searchQuery: y,
4356
+ selectedConversationId: t,
4357
+ handleConversationClick: e,
4358
+ shareConversationProps: f,
4359
+ actions: {
4360
+ ...n,
4361
+ deleteConversation: W
4362
+ }
4363
+ }
4364
+ ) : Object.entries(h).map(
4365
+ ([P, v]) => (v == null ? void 0 : v.length) > 0 && /* @__PURE__ */ R(
4366
+ Os,
4367
+ {
4368
+ locale: u,
4369
+ groupLabel: P,
4370
+ conversationStyles: l,
4371
+ groupedConversations: v,
4372
+ handleConversationClick: e,
4373
+ actions: {
4374
+ ...n,
4375
+ deleteConversation: W
4376
+ },
4377
+ shareConversationProps: f,
4378
+ selectedConversationId: t
4379
+ },
4380
+ P
4381
+ )
4382
+ ) })
4383
+ }
4384
+ ),
4385
+ r
4386
+ ] });
4387
+ };
4388
+ export {
4389
+ Ns as ActionMenu,
4390
+ pe as ActionMenuItem,
4391
+ js as ConversationList
4392
+ };