@gentiq/ui 1.0.0-alpha.1 → 1.0.0-alpha.10

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.
@@ -1,3505 +0,0 @@
1
- "use client";
2
- import { jsx as n, jsxs as c, Fragment as R } from "react/jsx-runtime";
3
- import { withDefaults as U, useServerConfig as De, createOptionsStore as fn, useOptionsStore as gn, useGentiqOptions as Te, useGentiqTranslation as k, References as et, useMessage as A, useGentiqLanguage as $, useToolApproval as hn, useFileUrl as bn, useChatReferencesActions as vn, useThreadView as Y, useThreadScope as yt, Thread as Ne, localizeError as xn, Message as X, ActionBar as J, getLocalizedErrorMessage as wt, Composer as G, useComposer as Pe, useGentiqUser as yn, useComposerVoice as Nt, useGentiqStatus as wn, useGentiqFeature as Nn, useComposerRoot as kn, useGentiqEntitlement as Cn } from "@gentiq/react";
4
- import * as ke from "react";
5
- import { useContext as le, useMemo as E, createContext as te, useSyncExternalStore as _n, useEffect as T, useState as C, useRef as P, useLayoutEffect as Sn, memo as fe, useCallback as ee, Component as zn, Suspense as Ce, lazy as Ae, Children as In, forwardRef as Dn } from "react";
6
- import { QuoteIcon as Re, ChevronDownIcon as ne, BrainIcon as Tn, XIcon as H, WrenchIcon as Pn, ImagePlusIcon as An, CodeIcon as Rn, DownloadIcon as de, GlobeIcon as Mn, XCircleIcon as kt, CopyIcon as Ct, BanIcon as En, CheckCircleIcon as On, ClockIcon as tt, ShieldQuestionIcon as qn, CircleIcon as jn, FileIcon as _t, ListChecksIcon as $n, ArrowUpIcon as St, BookIcon as Fn, ArrowDownIcon as Ln, CheckIcon as ce, RefreshCcwIcon as Bn, ThumbsUpIcon as Un, ThumbsDownIcon as Hn, PencilIcon as Vn, SquareIcon as Qn, AlertCircleIcon as Wn, RotateCwIcon as Gn, CameraOffIcon as Kn, Loader2Icon as zt, RotateCcwIcon as Jn, SwitchCameraIcon as Yn, PlusIcon as Xn, FileTextIcon as Zn, ImagesIcon as es, CameraIcon as ts, MicIcon as ns, Wrench as It, RefreshCw as ss, ChevronUpIcon as rs } from "lucide-react";
7
- import os from "rehype-sanitize";
8
- import { defaultRemarkPlugins as as, Streamdown as is, defaultRehypePlugins as Me } from "streamdown";
9
- import { cjk as ls } from "@streamdown/cjk";
10
- import { getTextDirection as F, resolveMessageId as cs, writeStored as ds, readStored as us, isGentiqError as Dt, HIDDEN_PART_TYPES as ms, messageText as ps, textOrKey as nt, createDateFormatter as fs } from "@gentiq/core";
11
- import { getToolName as Tt, isToolUIPart as Pt } from "ai";
12
- import * as Ee from "@radix-ui/react-collapsible";
13
- import { toast as K } from "sonner";
14
- import { Slot as At } from "@radix-ui/react-slot";
15
- import { cva as Oe } from "class-variance-authority";
16
- import * as Z from "@radix-ui/react-tooltip";
17
- import { flushSync as gs } from "react-dom";
18
- import * as _ from "@radix-ui/react-dialog";
19
- import * as ie from "@radix-ui/react-dropdown-menu";
20
- import * as ae from "@radix-ui/react-scroll-area";
21
- import * as me from "@radix-ui/react-hover-card";
22
- import { useControllableState as st } from "@radix-ui/react-use-controllable-state";
23
- import * as q from "@radix-ui/react-select";
24
- import * as rt from "@radix-ui/react-checkbox";
25
- import { clsx as hs } from "clsx";
26
- import { twMerge as bs } from "tailwind-merge";
27
- function p(...e) {
28
- return bs(hs(e));
29
- }
30
- function Qa(e, t) {
31
- return {
32
- history: B(e.history, t.history),
33
- welcome: B(e.welcome, t.welcome),
34
- threadActions: B(e.threadActions, t.threadActions),
35
- composer: e.composer && t.composer ? {
36
- ...U(e.composer, t.composer),
37
- attachments: B(e.composer.attachments, t.composer.attachments),
38
- references: B(e.composer.references, t.composer.references),
39
- voice: B(e.composer.voice, t.composer.voice)
40
- } : t.composer ?? e.composer,
41
- disclaimer: t.disclaimer ?? e.disclaimer,
42
- settings: e.settings && t.settings ? {
43
- sections: {
44
- profile: B(e.settings.sections?.profile, t.settings.sections?.profile),
45
- account: B(e.settings.sections?.account, t.settings.sections?.account)
46
- }
47
- } : t.settings ?? e.settings
48
- };
49
- }
50
- function B(e, t) {
51
- return e && t ? U(e, t) : t ?? e;
52
- }
53
- function vs(e, t) {
54
- const { history: s, welcome: r, threadActions: o, composer: i, disclaimer: a, settings: l } = e;
55
- return {
56
- history: U(
57
- { enabled: !0, showDelete: !0, showRename: !0, showShare: !0, showPin: !0 },
58
- s,
59
- {
60
- enabled: t?.history_enabled,
61
- showDelete: t?.history_show_delete,
62
- showRename: t?.history_show_rename,
63
- showShare: t?.history_show_share,
64
- showPin: t?.history_show_pin
65
- }
66
- ),
67
- welcome: U({ icon: null }, r, {
68
- greeting: typeof r?.greeting == "function" ? r.greeting : t?.welcome_greeting || r?.greeting,
69
- subtitle: t?.welcome_subtitle || r?.subtitle
70
- }),
71
- threadActions: U(
72
- { feedback: !0, retry: !0, edit: !0 },
73
- o,
74
- {
75
- feedback: t?.thread_actions_feedback,
76
- retry: t?.thread_actions_retry
77
- }
78
- ),
79
- composer: {
80
- ...U({ maxLength: 1e4, collapseLines: 8 }, i),
81
- attachments: U(
82
- { enabled: !0 },
83
- i?.attachments,
84
- {
85
- enabled: t?.composer_attachments
86
- }
87
- ),
88
- references: U(
89
- { enabled: !0, maxItems: 5, maxExcerptLength: 500 },
90
- i?.references
91
- ),
92
- // The microphone needs a transcriber on the backend, which only `/config` can vouch for:
93
- // until it has, or when it can't be reached, there's no microphone.
94
- voice: {
95
- ...i?.voice,
96
- enabled: (t?.composer_voice ?? i?.voice?.enabled ?? !0) && !!t?.voice_input
97
- }
98
- },
99
- disclaimer: t?.disclaimer || a,
100
- settings: {
101
- sections: {
102
- profile: ot(
103
- l?.sections?.profile,
104
- t?.settings_profile_mode,
105
- t?.settings_profile_fields
106
- ),
107
- account: ot(
108
- l?.sections?.account,
109
- t?.settings_account_mode,
110
- t?.settings_account_fields
111
- )
112
- }
113
- },
114
- headerActionsEnabled: t?.header_actions ?? void 0,
115
- configured: e
116
- };
117
- }
118
- function ot(e, t, s) {
119
- return {
120
- ...e,
121
- mode: t || e?.mode,
122
- enabled: e?.enabled ?? !0,
123
- fields: { ...e?.fields, ...s }
124
- };
125
- }
126
- const xs = te(null);
127
- function se(e) {
128
- const t = le(xs), s = De(), r = E(() => fn(vs({}, s)), [s]);
129
- return gn(t ?? r, e);
130
- }
131
- const qe = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
132
- "div",
133
- {
134
- className: p(
135
- "group flex w-full items-end gap-3",
136
- t === "user" ? "is-user justify-end" : "is-assistant",
137
- e
138
- ),
139
- ...s
140
- }
141
- ), je = ({ children: e, className: t, isPlain: s, ...r }) => /* @__PURE__ */ n(
142
- "div",
143
- {
144
- className: p(
145
- "flex flex-col gap-2 overflow-hidden text-base",
146
- // User bubble: a flat fill from the `--gentiq-bubble` tokens.
147
- !s && [
148
- "group-[.is-user]:rounded-lg group-[.is-user]:rounded-ee-sm",
149
- "group-[.is-user]:bg-bubble group-[.is-user]:text-bubble-foreground",
150
- "group-[.is-user]:px-5 group-[.is-user]:py-3.5",
151
- "group-[.is-user]:max-w-[88%] md:group-[.is-user]:max-w-[78%]"
152
- ],
153
- // Assistant: transparent, full-width, generous leading
154
- "group-[.is-assistant]:bg-transparent",
155
- "group-[.is-assistant]:px-0 group-[.is-assistant]:py-1",
156
- "group-[.is-assistant]:w-full group-[.is-assistant]:leading-[1.7]",
157
- t
158
- ),
159
- ...r,
160
- children: e
161
- }
162
- ), ys = /(```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)|`+[^`\n]*`+)|\\\[([\s\S]+?)\\\]|\\\(([\s\S]+?)\\\)|\$\$([^$]+?)\$\$/g, ws = /\n[ \t]*\n/, Ns = (e, t) => {
163
- let s = 0;
164
- for (; t - s > 0 && e[t - s - 1] === "\\"; ) s += 1;
165
- return s % 2 === 0;
166
- }, ks = /^[ \t]*\n[\s\S]*\n[ \t>]*$/, Cs = /(?:^|[^\\])%/, at = String.raw`(?:(?=\p{Script=Arabic})[\p{L}\p{M}])`, _s = new RegExp(
167
- `${at}(?:[\\p{Script=Arabic}\\p{M}\\s\\u200c]*${at})?`,
168
- "gu"
169
- ), Ss = (e) => (e.includes(`
170
- `) && !ks.test(e) && !Cs.test(e) ? e.replace(/[ \t]*\n[ \t]*/g, " ") : e).replace(_s, (s) => `\\text{${s}}`), zs = (e) => {
171
- if (!e.includes("\\") && !e.includes("$$")) return e;
172
- const t = (s, r, o, i, a, l) => {
173
- if (r !== void 0) return s;
174
- const d = o ?? i ?? a ?? "";
175
- return !d.trim() || ws.test(d) || !Ns(e, l) ? s : `$$${Ss(d)}$$`;
176
- };
177
- return e.replace(ys, t);
178
- }, Rt = (e) => e.type === "element", Mt = (e) => {
179
- const t = e.properties?.className;
180
- return Array.isArray(t) ? t.filter((s) => typeof s == "string") : typeof t == "string" ? t.split(/\s+/) : [];
181
- }, Is = (e) => Rt(e) && e.tagName === "code" && Mt(e).includes("language-math"), Ds = (e) => e.type === "text" && !e.value.trim(), Ts = (e) => {
182
- if (!Rt(e) || e.tagName !== "p") return null;
183
- const t = e.children.filter((r) => !Ds(r)), [s] = t;
184
- return t.length === 1 && Is(s) ? s : null;
185
- }, Ps = (e) => {
186
- e.properties = { ...e.properties, className: [...Mt(e), "math-display"] };
187
- }, Et = (e) => {
188
- for (const t of e.children ?? []) {
189
- const s = Ts(t);
190
- if (s) {
191
- Ps(s);
192
- continue;
193
- }
194
- Et(t);
195
- }
196
- }, As = () => (e) => {
197
- Et(e);
198
- }, Rs = /* @__PURE__ */ new Set(["a", "code", "pre", "math", "svg", "style", "script", "textarea"]), Ms = (e) => e.type === "element", Es = /* @__PURE__ */ new Set(["math", "math-inline", "math-display"]), Os = (e) => {
199
- const t = e.properties?.className;
200
- return (Array.isArray(t) ? t : typeof t == "string" ? [t] : []).some(
201
- (r) => typeof r == "string" && (r.startsWith("katex") || Es.has(r))
202
- );
203
- }, qs = /(\s+)/, js = (e) => {
204
- if (!e.trim()) return null;
205
- const t = [];
206
- for (const s of e.split(qs))
207
- if (s) {
208
- if (!s.trim()) {
209
- t.push({ type: "text", value: s });
210
- continue;
211
- }
212
- t.push({
213
- type: "element",
214
- tagName: "span",
215
- properties: { className: ["gentiq-word"] },
216
- children: [{ type: "text", value: s }]
217
- });
218
- }
219
- return t;
220
- }, Ot = (e) => {
221
- const t = e.children;
222
- if (!t?.length) return;
223
- const s = [];
224
- let r = !1;
225
- for (const o of t) {
226
- if (o.type === "text") {
227
- const i = js(o.value);
228
- if (i) {
229
- s.push(...i), r = !0;
230
- continue;
231
- }
232
- s.push(o);
233
- continue;
234
- }
235
- if (Ms(o) && (Rs.has(o.tagName) || Os(o))) {
236
- s.push(o);
237
- continue;
238
- }
239
- Ot(o), s.push(o);
240
- }
241
- r && (e.children = s);
242
- }, $s = () => (e) => {
243
- Ot(e);
244
- }, qt = (e) => e.type === "element", Fs = /* @__PURE__ */ new Set([
245
- "p",
246
- "h1",
247
- "h2",
248
- "h3",
249
- "h4",
250
- "h5",
251
- "h6",
252
- "li",
253
- "blockquote",
254
- "dt",
255
- "dd",
256
- "td",
257
- "th",
258
- "figcaption",
259
- "summary"
260
- ]), Ls = /* @__PURE__ */ new Set(["pre", "code", "kbd", "samp", "var"]), Bs = /* @__PURE__ */ new Set(["math", "svg", "style", "script", "textarea"]), it = (e) => e.type === "text" ? !!e.value.trim() : e.type === "element", jt = (e) => qt(e) && e.tagName === "br", Us = (e, t) => {
261
- const s = [[]], r = (o) => s[s.length - 1].push(o);
262
- for (const o of e) {
263
- if (jt(o)) {
264
- s.push([]);
265
- continue;
266
- }
267
- if (t && o.type === "text" && o.value.includes(`
268
- `)) {
269
- o.value.split(`
270
- `).forEach((a, l) => {
271
- l && s.push([]), a && r({ type: "text", value: a });
272
- });
273
- continue;
274
- }
275
- r(o);
276
- }
277
- return s;
278
- }, Hs = (e) => {
279
- const [t] = e;
280
- if (t?.type !== "text") return e;
281
- const s = t.value.replace(/^[^\S\n]*\n[^\S\n]*/, "");
282
- return s === t.value ? e : s ? [{ type: "text", value: s }, ...e.slice(1)] : e.slice(1);
283
- }, Vs = (e) => ({
284
- type: "element",
285
- tagName: "span",
286
- properties: { className: ["gentiq-line"], dir: "auto" },
287
- children: e
288
- }), lt = () => ({
289
- type: "element",
290
- tagName: "br",
291
- properties: {},
292
- children: []
293
- }), Qs = (e, t) => {
294
- const [s, ...r] = Us(e.children, t).map(Hs);
295
- e.children = [
296
- // An empty run is a blank line the author asked for; it keeps its break
297
- // rather than collapsing into a zero-height box.
298
- ...s.some(it) ? s : [lt()],
299
- ...r.map((o) => o.some(it) ? Vs(o) : lt())
300
- ];
301
- }, Ws = (e, t) => e.some(
302
- (s) => jt(s) || t && s.type === "text" && s.value.includes(`
303
- `)
304
- ), $t = (e, t) => {
305
- for (const s of e.children ?? [])
306
- if (qt(s) && !Bs.has(s.tagName)) {
307
- if (Ls.has(s.tagName)) {
308
- s.properties = { ...s.properties, dir: "ltr" };
309
- continue;
310
- }
311
- $t(s, t), Fs.has(s.tagName) && (Ws(s.children, t) && Qs(s, t), s.properties = { ...s.properties, dir: "auto" });
312
- }
313
- }, Gs = (e = {}) => (t) => {
314
- $t(t, e.preserveNewlines ?? !1);
315
- }, Ks = { cjk: ls };
316
- let _e = Ks;
317
- const Se = /* @__PURE__ */ new Set(), Js = (e) => (Se.add(e), () => {
318
- Se.delete(e);
319
- }), ct = () => _e, be = /* @__PURE__ */ new Map(), ve = (e) => {
320
- if (be.has(e)) return;
321
- const t = e === "code" ? import("@streamdown/code").then(({ code: s }) => ({ code: s })) : e === "math" ? import("@streamdown/math").then(({ math: s }) => ({ math: s })) : import("@streamdown/mermaid").then(({ mermaid: s }) => ({ mermaid: s }));
322
- be.set(
323
- e,
324
- t.then((s) => {
325
- _e = { ..._e, ...s };
326
- for (const r of Se) r();
327
- }).catch(() => {
328
- be.delete(e);
329
- })
330
- );
331
- }, Ys = "```", Xs = /```[ \t]*mermaid\b/;
332
- let Zs = null;
333
- function er(e) {
334
- const t = _n(Js, ct, ct), s = e.includes(Ys), r = s && Xs.test(e), o = e.includes("$$");
335
- return T(() => {
336
- s && ve("code");
337
- }, [s]), T(() => {
338
- r && ve("mermaid");
339
- }, [r]), T(() => {
340
- o && (ve("math"), Zs ??= import("katex/dist/katex.min.css").catch(() => {
341
- }));
342
- }, [o]), t;
343
- }
344
- const tr = { linkMode: "text-only" }, nr = { enabled: !1 }, $e = (e) => {
345
- const t = Me[e];
346
- return Array.isArray(t) ? t[1] ?? {} : {};
347
- }, sr = (e, t) => {
348
- const s = Me[e];
349
- return [Array.isArray(s) ? s[0] : s, { ...$e(e), ...t }];
350
- }, rr = (e) => {
351
- const t = $e("sanitize");
352
- return [
353
- os,
354
- {
355
- ...t,
356
- protocols: {
357
- ...t.protocols,
358
- href: [...t.protocols?.href ?? [], ...e]
359
- }
360
- }
361
- ];
362
- }, or = (e, t, s) => {
363
- const r = e.length ? {
364
- // Sanitizing is what drops the href: its schema is an allow-list of
365
- // schemes, and an unknown one leaves the link href-less.
366
- sanitize: rr(e),
367
- // Hardening runs a second, independent scheme check. Streamdown happens
368
- // to configure it wide open today, but riding on that would mean a
369
- // stricter upstream default silently blocking these links again.
370
- harden: sr("harden", {
371
- allowedProtocols: [
372
- ...$e("harden").allowedProtocols ?? [],
373
- ...e.map((o) => `${o}:`)
374
- ]
375
- })
376
- } : {};
377
- return [
378
- ...Object.entries(Me).map(([o, i]) => r[o] ?? i),
379
- // After sanitizing, which is what strips the marker it has to put back, and
380
- // before KaTeX, which Streamdown appends after everything supplied here.
381
- As,
382
- // After sanitizing and hardening, which both strip a `dir` they were not
383
- // configured to expect, and before the word spans, which are not blocks and
384
- // would only be walked for nothing.
385
- [Gs, { preserveNewlines: s }],
386
- // Dead last, after sanitizing and hardening: the spans it adds are ours,
387
- // not the model's, and neither pass should have an opinion about them.
388
- ...t ? [$s] : []
389
- ];
390
- }, dt = /* @__PURE__ */ new Map(), ar = (e, t, s) => {
391
- const r = `${t ? "w" : "-"}|${s ? "n" : "-"}|${e.join(",")}`;
392
- let o = dt.get(r);
393
- return o || (o = or(e, t, s), dt.set(r, o)), o;
394
- }, ge = ({
395
- className: e,
396
- children: t,
397
- remarkPlugins: s,
398
- rehypePlugins: r,
399
- linkProtocols: o,
400
- wordFade: i = !1,
401
- mode: a = "static",
402
- preserveNewlines: l = !1,
403
- ...d
404
- }) => {
405
- const u = typeof t == "string" ? t : "", m = E(() => zs(u), [u]), h = er(m), b = E(
406
- () => s?.length ? [...Object.values(as), ...s] : void 0,
407
- [s]
408
- ), g = o?.join(",") ?? "", f = E(() => {
409
- const w = ar(
410
- g ? g.split(",") : [],
411
- i,
412
- l
413
- );
414
- return r?.length ? [...w, ...r] : w;
415
- }, [r, g, i, l]);
416
- return (
417
- // `Streamdown` is itself memoized on `children`, so a settled message never
418
- // re-renders this subtree — no outer `memo` needed here.
419
- /* @__PURE__ */ n(
420
- is,
421
- {
422
- className: p("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 code-bg ", e),
423
- mode: a,
424
- plugins: h,
425
- remend: tr,
426
- linkSafety: nr,
427
- ...d,
428
- remarkPlugins: b,
429
- rehypePlugins: f,
430
- children: typeof t == "string" ? m : t
431
- }
432
- )
433
- );
434
- };
435
- ge.displayName = "Response";
436
- const Ft = 40, Lt = 900, ir = 220, lr = 120, cr = 250, dr = 1e3, ut = 48, ur = (e, t) => {
437
- if (t >= e.length) return e.length;
438
- const s = Math.max(0, t - ut);
439
- for (let r = t; r > s; r--)
440
- if (/\s/.test(e[r])) return r;
441
- return t < ut ? 0 : t;
442
- }, mr = 120, pr = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
443
- function Bt(e, t, s = {}) {
444
- const {
445
- minCharsPerSecond: r = Ft,
446
- maxCharsPerSecond: o = Lt,
447
- enabled: i = !0
448
- } = s, [a] = C(pr), l = i && !a, [d, u] = C(
449
- () => t && e.length <= mr ? Math.min(e.length, 1) : e.length
450
- ), m = P(d), h = P(0);
451
- T(() => {
452
- if (!l) {
453
- m.current = e.length;
454
- return;
455
- }
456
- if (e.length < m.current) {
457
- m.current = e.length, h.current = 0, u(e.length);
458
- return;
459
- }
460
- if (m.current >= e.length) {
461
- u((v) => v >= e.length ? v : e.length);
462
- return;
463
- }
464
- let g = 0, f = performance.now();
465
- const w = t ? 0 : Math.min(
466
- Math.max((e.length - m.current) / lr * 1e3, r),
467
- o
468
- ), x = Math.floor(o * dr / 1e3), y = (v) => {
469
- g = 0;
470
- const I = Math.min(v - f, cr);
471
- f = v, e.length - m.current > x && (m.current = e.length - x, h.current = 0);
472
- const N = e.length - m.current;
473
- if (N <= 0) return;
474
- const S = (t ? Math.min(Math.max(N / ir * 1e3, r), o) : w) * I / 1e3 + h.current, O = Math.floor(S);
475
- if (h.current = S - O, O > 0) {
476
- const D = Math.min(e.length, m.current + O);
477
- if (m.current = D, u(D), D >= e.length) return;
478
- }
479
- g = requestAnimationFrame(y);
480
- };
481
- return g = requestAnimationFrame(y), () => {
482
- g && cancelAnimationFrame(g);
483
- };
484
- }, [e, t, l, r, o]);
485
- const b = l && d < e.length;
486
- return [b ? e.slice(0, ur(e, d)) : e, b];
487
- }
488
- function Ut() {
489
- const t = Te((s) => s.app)?.smoothStreaming;
490
- return E(() => {
491
- const s = typeof t == "object" ? t : {};
492
- return {
493
- enabled: t !== !1,
494
- minCharsPerSecond: s.minCharsPerSecond ?? Ft,
495
- maxCharsPerSecond: s.maxCharsPerSecond ?? Lt
496
- };
497
- }, [t]);
498
- }
499
- function fr({
500
- showAction: e = !0,
501
- className: t,
502
- children: s,
503
- ...r
504
- }) {
505
- const { t: o } = k(["chat"]);
506
- return /* @__PURE__ */ c(
507
- et.Source,
508
- {
509
- className: `group/reference relative rounded-md transition-colors ${t ?? ""}`,
510
- ...r,
511
- children: [
512
- s,
513
- e && /* @__PURE__ */ n(
514
- et.Quote,
515
- {
516
- className: "absolute end-1.5 top-1.5 z-10 flex size-7 items-center justify-center rounded-lg bg-background text-muted-foreground opacity-0 shadow-sm ring-1 ring-border/60 transition hover:text-foreground group-hover/reference:opacity-100 focus-visible:opacity-100",
517
- "aria-label": o("reference"),
518
- title: o("reference"),
519
- children: /* @__PURE__ */ n(Re, { className: "size-3.5" })
520
- }
521
- )
522
- ]
523
- }
524
- );
525
- }
526
- function ze({
527
- text: e,
528
- role: t,
529
- streaming: s,
530
- reference: r
531
- }) {
532
- const { textComponents: o, remarkPlugins: i, rehypePlugins: a, linkProtocols: l } = Q(), d = se((x) => x.composer), u = Ut(), m = F(e), h = s && t === "assistant", [b] = Bt(e, h, u), g = P(!1);
533
- h && (g.current = !0);
534
- const f = g.current ? "streaming" : "static", w = t === "user" ? /* @__PURE__ */ n("div", { className: "whitespace-pre-wrap break-words", children: b.split(`
535
- `).map((x, y) => /* @__PURE__ */ n("div", { dir: "auto", children: x || /* @__PURE__ */ n("br", {}) }, y)) }) : /* @__PURE__ */ n(
536
- ge,
537
- {
538
- components: o,
539
- remarkPlugins: i,
540
- rehypePlugins: a,
541
- linkProtocols: l,
542
- wordFade: g.current,
543
- mode: f,
544
- children: b
545
- }
546
- );
547
- return /* @__PURE__ */ n("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: /* @__PURE__ */ n(qe, { from: t, children: /* @__PURE__ */ n(je, { dir: m, children: /* @__PURE__ */ n(gr, { lines: t === "user" ? d?.collapseLines ?? 0 : 0, children: /* @__PURE__ */ n(fr, { showAction: !1, reference: r, children: w }) }) }) }) });
548
- }
549
- function gr({ lines: e, children: t }) {
550
- const { t: s } = k(["chat"]), r = P(null), [o, i] = C(!1), [a, l] = C(!1);
551
- return Sn(() => {
552
- const u = r.current;
553
- if (!u || !e || a) return;
554
- const m = u.firstElementChild, h = () => i((m?.offsetHeight ?? u.scrollHeight) > u.clientHeight + 1);
555
- h();
556
- const b = typeof ResizeObserver > "u" ? null : new ResizeObserver(h);
557
- return b?.observe(u), m && b?.observe(m), () => b?.disconnect();
558
- }, [e, a]), e ? /* @__PURE__ */ c(R, { children: [
559
- /* @__PURE__ */ n(
560
- "div",
561
- {
562
- ref: r,
563
- className: "overflow-hidden",
564
- style: !a ? {
565
- maxHeight: `${e}lh`,
566
- ...o && {
567
- maskImage: "linear-gradient(to bottom, black calc(100% - 2lh), transparent)"
568
- }
569
- } : void 0,
570
- children: t
571
- }
572
- ),
573
- o && // `self-end` follows the bubble's `dir`, so it sits at the end the text runs toward.
574
- /* @__PURE__ */ n(
575
- "button",
576
- {
577
- type: "button",
578
- onClick: () => l((u) => !u),
579
- "aria-expanded": a,
580
- "aria-label": s(a ? "show_less" : "show_more"),
581
- title: s(a ? "show_less" : "show_more"),
582
- className: "-mb-1.5 -me-2 flex size-7 shrink-0 items-center justify-center self-end rounded-full bg-primary-foreground/15 transition-colors hover:bg-primary-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-foreground/50",
583
- children: /* @__PURE__ */ n(
584
- ne,
585
- {
586
- className: p("size-4 transition-transform duration-200", a && "rotate-180")
587
- }
588
- )
589
- }
590
- )
591
- ] }) : /* @__PURE__ */ n(R, { children: t });
592
- }
593
- function hr({ part: e, index: t }) {
594
- const s = e.text;
595
- return s.trim() ? /* @__PURE__ */ n(br, { text: s, index: t, segment: "text" }) : null;
596
- }
597
- function br({ text: e, index: t, segment: s }) {
598
- const { t: r } = k("chat"), o = A((l) => l.message.id), i = A((l) => l.message.role), a = A((l) => l.isStreaming);
599
- return /* @__PURE__ */ n(
600
- ze,
601
- {
602
- text: e,
603
- role: i,
604
- streaming: a,
605
- reference: {
606
- kind: "text",
607
- messageId: o,
608
- partIndex: t,
609
- sourceId: `${o}-${t}-${s}`,
610
- role: i,
611
- label: r(i === "user" ? "reference_user_message" : "reference_assistant_response"),
612
- excerpt: e
613
- }
614
- }
615
- );
616
- }
617
- function Fe({ ...e }) {
618
- return /* @__PURE__ */ n(Ee.Root, { "data-slot": "collapsible", ...e });
619
- }
620
- function Le({ ...e }) {
621
- return /* @__PURE__ */ n(Ee.CollapsibleTrigger, { "data-slot": "collapsible-trigger", ...e });
622
- }
623
- function Be({ ...e }) {
624
- return /* @__PURE__ */ n(Ee.CollapsibleContent, { "data-slot": "collapsible-content", ...e });
625
- }
626
- const Ht = te(null), vr = () => {
627
- const e = le(Ht);
628
- if (!e)
629
- throw new Error("Reasoning components must be used within Reasoning");
630
- return e;
631
- }, xr = 1e3, yr = 1e3, Vt = fe(
632
- ({
633
- className: e,
634
- isStreaming: t = !1,
635
- open: s,
636
- defaultOpen: r = !0,
637
- // eslint-disable-next-line @typescript-eslint/unbound-method
638
- onOpenChange: o,
639
- duration: i,
640
- children: a,
641
- ...l
642
- }) => {
643
- const [d, u] = st({
644
- prop: s,
645
- defaultProp: r,
646
- onChange: o
647
- }), [m, h] = st({
648
- prop: i,
649
- defaultProp: 0
650
- }), [b, g] = C(!1), [f, w] = C(null);
651
- T(() => {
652
- t ? f === null && w(Date.now()) : f !== null && (h(Math.ceil((Date.now() - f) / yr)), w(null));
653
- }, [t, f, h]), T(() => {
654
- if (r && !t && d && !b) {
655
- const v = setTimeout(() => {
656
- u(!1), g(!0);
657
- }, xr);
658
- return () => {
659
- clearTimeout(v);
660
- };
661
- }
662
- }, [t, d, r, u, b]);
663
- const x = ee(
664
- (v) => {
665
- u(v);
666
- },
667
- [u]
668
- ), y = E(
669
- () => ({ isStreaming: t, isOpen: d, setIsOpen: u, duration: m }),
670
- [t, d, u, m]
671
- );
672
- return /* @__PURE__ */ n(Ht.Provider, { value: y, children: /* @__PURE__ */ n(
673
- Fe,
674
- {
675
- className: p("not-prose mb-4", e),
676
- onOpenChange: x,
677
- open: d,
678
- ...l,
679
- children: a
680
- }
681
- ) });
682
- }
683
- ), Qt = fe(({ className: e, children: t, ...s }) => {
684
- const { isStreaming: r, isOpen: o, duration: i } = vr(), { t: a } = k(["chat"]);
685
- return /* @__PURE__ */ n(
686
- Le,
687
- {
688
- className: p("flex items-center gap-2 text-muted-foreground text-sm", e),
689
- ...s,
690
- children: t ?? /* @__PURE__ */ c(R, { children: [
691
- /* @__PURE__ */ n(Tn, { className: "size-4" }),
692
- r ? /* @__PURE__ */ n("p", { children: a("thinking") }) : i > 0 ? /* @__PURE__ */ n("p", { children: a("thought_for", { count: i }) }) : /* @__PURE__ */ n("p", { children: a("thought") }),
693
- /* @__PURE__ */ n(
694
- ne,
695
- {
696
- className: p(
697
- "size-4 text-muted-foreground transition-transform",
698
- o ? "rotate-180" : "rotate-0"
699
- )
700
- }
701
- )
702
- ] })
703
- }
704
- );
705
- }), Wt = fe(
706
- ({ className: e, children: t, wordFade: s, mode: r, ...o }) => /* @__PURE__ */ n(
707
- Be,
708
- {
709
- className: p(
710
- "mt-4 text-base",
711
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
712
- e
713
- ),
714
- ...o,
715
- children: /* @__PURE__ */ n(ge, { className: "grid gap-2", wordFade: s, mode: r, children: t })
716
- }
717
- )
718
- );
719
- Vt.displayName = "Reasoning";
720
- Qt.displayName = "ReasoningTrigger";
721
- Wt.displayName = "ReasoningContent";
722
- function wr({ part: e }) {
723
- const t = A((u) => u.isStreaming), { dir: s } = $(), r = Ut(), o = F(e.text), i = e.state === "streaming" && t, [a] = Bt(e.text, i, r), l = P(!1);
724
- i && (l.current = !0);
725
- const d = l.current ? "streaming" : "static";
726
- return e.text.trim() ? /* @__PURE__ */ c(Vt, { className: "w-full animate-in-bubble", dir: s, isStreaming: i, children: [
727
- /* @__PURE__ */ n(Qt, {}),
728
- /* @__PURE__ */ n(Wt, { dir: o, wordFade: l.current, mode: d, children: a })
729
- ] }) : null;
730
- }
731
- function Gt(e) {
732
- const [t, s] = C(!1), r = P(void 0);
733
- T(() => () => clearTimeout(r.current), []);
734
- const o = ee(() => {
735
- clearTimeout(r.current), s(!0), r.current = setTimeout(() => s(!1), e);
736
- }, [e]);
737
- return [t, o];
738
- }
739
- const Nr = Oe(
740
- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
741
- {
742
- variants: {
743
- variant: {
744
- default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
745
- secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
746
- destructive: "border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
747
- outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
748
- }
749
- },
750
- defaultVariants: {
751
- variant: "default"
752
- }
753
- }
754
- );
755
- function kr({
756
- className: e,
757
- variant: t,
758
- asChild: s = !1,
759
- ...r
760
- }) {
761
- return /* @__PURE__ */ n(s ? At : "span", { "data-slot": "badge", className: p(Nr({ variant: t }), e), ...r });
762
- }
763
- const Cr = Oe(
764
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
765
- {
766
- variants: {
767
- variant: {
768
- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
769
- destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
770
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
771
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
772
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
773
- link: "text-primary underline-offset-4 hover:underline"
774
- },
775
- size: {
776
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
777
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
778
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
779
- icon: "size-9"
780
- }
781
- },
782
- defaultVariants: {
783
- variant: "default",
784
- size: "default"
785
- }
786
- }
787
- );
788
- function L({
789
- className: e,
790
- variant: t,
791
- size: s,
792
- asChild: r = !1,
793
- ...o
794
- }) {
795
- return /* @__PURE__ */ n(r ? At : "button", { "data-slot": "button", className: p(Cr({ variant: t, size: s, className: e })), ...o });
796
- }
797
- const _r = te(null);
798
- function V() {
799
- return le(_r);
800
- }
801
- function Sr({ ...e }) {
802
- return /* @__PURE__ */ n(_.Root, { "data-slot": "dialog", ...e });
803
- }
804
- function zr({ ...e }) {
805
- return /* @__PURE__ */ n(_.Trigger, { "data-slot": "dialog-trigger", ...e });
806
- }
807
- function Ir({ ...e }) {
808
- const t = V();
809
- return /* @__PURE__ */ n(_.Portal, { "data-slot": "dialog-portal", container: t, ...e });
810
- }
811
- function Wa({ ...e }) {
812
- return /* @__PURE__ */ n(_.Close, { "data-slot": "dialog-close", ...e });
813
- }
814
- function Dr({ className: e, ...t }) {
815
- return /* @__PURE__ */ n(
816
- _.Overlay,
817
- {
818
- "data-slot": "dialog-overlay",
819
- className: p(
820
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay",
821
- e
822
- ),
823
- ...t
824
- }
825
- );
826
- }
827
- function Tr({
828
- className: e,
829
- children: t,
830
- showCloseButton: s = !0,
831
- ...r
832
- }) {
833
- return /* @__PURE__ */ c(Ir, { "data-slot": "dialog-portal", children: [
834
- /* @__PURE__ */ n(Dr, {}),
835
- /* @__PURE__ */ c(
836
- _.Content,
837
- {
838
- "data-slot": "dialog-content",
839
- className: p(
840
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed inset-0 z-50 m-auto grid h-fit w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
841
- e
842
- ),
843
- ...r,
844
- children: [
845
- t,
846
- s && /* @__PURE__ */ c(
847
- _.Close,
848
- {
849
- "data-slot": "dialog-close",
850
- className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 end-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
851
- children: [
852
- /* @__PURE__ */ n(H, {}),
853
- /* @__PURE__ */ n(Rr, {})
854
- ]
855
- }
856
- )
857
- ]
858
- }
859
- )
860
- ] });
861
- }
862
- function Pr({ className: e, ...t }) {
863
- return /* @__PURE__ */ n(
864
- "div",
865
- {
866
- "data-slot": "dialog-header",
867
- className: p("flex flex-col gap-2 text-center sm:text-start", e),
868
- ...t
869
- }
870
- );
871
- }
872
- function Ga({ className: e, ...t }) {
873
- return /* @__PURE__ */ n(
874
- "div",
875
- {
876
- "data-slot": "dialog-footer",
877
- className: p("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
878
- ...t
879
- }
880
- );
881
- }
882
- function Ar({ className: e, ...t }) {
883
- return /* @__PURE__ */ n(
884
- _.Title,
885
- {
886
- "data-slot": "dialog-title",
887
- className: p("text-xl leading-none font-semibold", e),
888
- ...t
889
- }
890
- );
891
- }
892
- function Ka({ className: e, ...t }) {
893
- return /* @__PURE__ */ n(
894
- _.Description,
895
- {
896
- "data-slot": "dialog-description",
897
- className: p("text-muted-foreground text-base", e),
898
- ...t
899
- }
900
- );
901
- }
902
- function Rr() {
903
- const { t: e } = k("common");
904
- return /* @__PURE__ */ n("span", { className: "sr-only", children: e("close") });
905
- }
906
- const Mr = te({
907
- code: ""
908
- }), Ie = fe(function({
909
- code: t,
910
- className: s,
911
- children: r,
912
- ...o
913
- }) {
914
- return /* @__PURE__ */ n(Mr.Provider, { value: { code: t }, children: /* @__PURE__ */ c(
915
- "div",
916
- {
917
- className: p(
918
- "relative w-full overflow-hidden rounded-md border bg-background text-foreground",
919
- s
920
- ),
921
- dir: "ltr",
922
- ...o,
923
- children: [
924
- /* @__PURE__ */ n("pre", { className: "m-0 overflow-x-auto p-4 font-mono text-sm", children: /* @__PURE__ */ n("code", { children: t }) }),
925
- r && /* @__PURE__ */ n("div", { className: "absolute top-2 end-2 flex items-center gap-2", children: r })
926
- ]
927
- }
928
- ) });
929
- });
930
- function Er(e, t = "size-4") {
931
- return {
932
- web_search: /* @__PURE__ */ n(Mn, { className: t }),
933
- web_fetch: /* @__PURE__ */ n(de, { className: t }),
934
- code_execution: /* @__PURE__ */ n(Rn, { className: t }),
935
- image_generation: /* @__PURE__ */ n(An, { className: t })
936
- }[e] ?? /* @__PURE__ */ n(Pn, { className: t });
937
- }
938
- const Or = ({ className: e, ...t }) => /* @__PURE__ */ n(Fe, { className: p("not-prose mb-4 w-full rounded-md border", e), ...t }), qr = ({ status: e }) => {
939
- const { t } = k(["tools_ui"]), s = {
940
- "input-streaming": t("pending"),
941
- "input-available": t("running"),
942
- "approval-requested": t("awaiting_approval"),
943
- "approval-responded": t("approval_responded"),
944
- "output-available": t("completed"),
945
- "output-error": t("error"),
946
- "output-denied": t("denied")
947
- };
948
- return /* @__PURE__ */ c(kr, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
949
- {
950
- "input-streaming": /* @__PURE__ */ n(jn, { className: "size-4" }),
951
- "input-available": /* @__PURE__ */ n(tt, { className: "size-4 animate-pulse" }),
952
- "approval-requested": /* @__PURE__ */ n(qn, { className: "size-4 text-warning" }),
953
- "approval-responded": /* @__PURE__ */ n(tt, { className: "size-4 animate-pulse" }),
954
- "output-available": /* @__PURE__ */ n(On, { className: "size-4 text-success" }),
955
- "output-error": /* @__PURE__ */ n(kt, { className: "size-4 text-destructive" }),
956
- "output-denied": /* @__PURE__ */ n(En, { className: "size-4 text-destructive" })
957
- }[e],
958
- s[e]
959
- ] });
960
- }, jr = ({ className: e, type: t, state: s, toolName: r, ...o }) => {
961
- const i = r || (t.startsWith("tool-") ? t.slice(5) : t), a = Er(i, "size-4 text-muted-foreground");
962
- return /* @__PURE__ */ c(
963
- Le,
964
- {
965
- className: p("flex w-full items-center justify-between gap-4 p-3", e),
966
- ...o,
967
- children: [
968
- /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
969
- a,
970
- /* @__PURE__ */ n("span", { className: "font-medium text-sm", children: i }),
971
- /* @__PURE__ */ n(qr, { status: s })
972
- ] }),
973
- /* @__PURE__ */ n(ne, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
974
- ]
975
- }
976
- );
977
- }, $r = ({ className: e, ...t }) => /* @__PURE__ */ n(
978
- Be,
979
- {
980
- className: p(
981
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
982
- e
983
- ),
984
- ...t
985
- }
986
- ), Kt = (e) => {
987
- if (typeof e == "string")
988
- try {
989
- return JSON.stringify(JSON.parse(e), null, 2);
990
- } catch {
991
- return e;
992
- }
993
- return JSON.stringify(e, null, 2);
994
- }, Fr = ({ className: e, input: t, state: s, ...r }) => {
995
- const { t: o } = k(["tools_ui"]), i = E(() => Kt(t), [t]), a = s === "input-streaming";
996
- return /* @__PURE__ */ c("div", { className: p("space-y-2 overflow-hidden p-4", e), ...r, children: [
997
- /* @__PURE__ */ n("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: o("parameters") }),
998
- /* @__PURE__ */ n("div", { className: "rounded-md bg-muted/50", children: a ? /* @__PURE__ */ n("pre", { className: "overflow-x-auto p-4 font-mono text-sm whitespace-pre-wrap", dir: "ltr", children: i }) : /* @__PURE__ */ n(Ie, { code: i }) })
999
- ] });
1000
- }, Lr = ({ className: e, output: t, errorText: s, ...r }) => {
1001
- const { t: o } = k(["tools_ui"]), [i, a] = Gt(2e3), l = E(() => {
1002
- if (typeof t == "string")
1003
- try {
1004
- return JSON.stringify(JSON.parse(t), null, 2);
1005
- } catch {
1006
- return null;
1007
- }
1008
- return typeof t == "object" && t !== null && !("$$typeof" in t) ? JSON.stringify(t, null, 2) : null;
1009
- }, [t]);
1010
- if (!(t || s))
1011
- return null;
1012
- const d = () => {
1013
- s && navigator.clipboard.writeText(s).then(() => {
1014
- a();
1015
- });
1016
- }, u = () => typeof t == "string" ? l === null ? /* @__PURE__ */ n("div", { className: "p-4 text-sm whitespace-pre-wrap", dir: "ltr", children: t }) : /* @__PURE__ */ n(Ie, { code: l }) : typeof t == "object" && t !== null && !("$$typeof" in t) ? /* @__PURE__ */ n(Ie, { code: l ?? "" }) : t;
1017
- return /* @__PURE__ */ c("div", { className: p("space-y-2 p-4", e), ...r, children: [
1018
- /* @__PURE__ */ n("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: o(s ? "error" : "result") }),
1019
- s && /* @__PURE__ */ c(Sr, { children: [
1020
- /* @__PURE__ */ n(zr, { asChild: !0, children: /* @__PURE__ */ c(L, { variant: "destructive", size: "sm", children: [
1021
- /* @__PURE__ */ n(kt, { className: "me-1.5 size-4" }),
1022
- o("view_error")
1023
- ] }) }),
1024
- /* @__PURE__ */ c(Tr, { className: "max-w-2xl", children: [
1025
- /* @__PURE__ */ n(Pr, { children: /* @__PURE__ */ n(Ar, { className: "text-destructive", children: o("tool_error") }) }),
1026
- /* @__PURE__ */ c("div", { className: "space-y-4", children: [
1027
- /* @__PURE__ */ n("div", { className: "max-h-96 overflow-auto rounded-md bg-destructive/10 p-4 text-destructive text-sm", children: /* @__PURE__ */ n("pre", { className: "whitespace-pre-wrap break-words", children: Kt(s) }) }),
1028
- /* @__PURE__ */ c(L, { variant: "outline", size: "sm", onClick: d, children: [
1029
- /* @__PURE__ */ n(Ct, { className: "me-1.5 size-4" }),
1030
- o(i ? "copied" : "copy_error")
1031
- ] })
1032
- ] })
1033
- ] })
1034
- ] }),
1035
- t && !s && /* @__PURE__ */ n("div", { className: "overflow-x-auto rounded-md bg-muted/50 text-foreground text-xs [&_table]:w-full line-clamp-[20]", children: /* @__PURE__ */ n("div", { children: u() }) })
1036
- ] });
1037
- };
1038
- function Br({ part: e }) {
1039
- const { t } = k(["tools_ui"]), s = hn(e);
1040
- if (!s.isPending) return null;
1041
- const r = t("approval_prompt", { tool: Tt(e) });
1042
- return /* @__PURE__ */ c(
1043
- "div",
1044
- {
1045
- role: "group",
1046
- "aria-label": r,
1047
- className: "flex flex-wrap items-center gap-2 border-t p-3",
1048
- children: [
1049
- /* @__PURE__ */ n("p", { className: "me-auto text-sm text-muted-foreground", children: r }),
1050
- /* @__PURE__ */ n(
1051
- L,
1052
- {
1053
- size: "sm",
1054
- variant: "outline",
1055
- disabled: !s.canRespond,
1056
- onClick: () => {
1057
- s.deny();
1058
- },
1059
- children: t("deny")
1060
- }
1061
- ),
1062
- /* @__PURE__ */ n(L, { size: "sm", disabled: !s.canRespond, onClick: () => {
1063
- s.approve();
1064
- }, children: t("approve") })
1065
- ]
1066
- }
1067
- );
1068
- }
1069
- function Ur({ part: e }) {
1070
- const t = Te((r) => r.app.showToolDetails ?? !0), s = e.state === "approval-requested";
1071
- return !t && !s ? null : /* @__PURE__ */ c(Or, { className: "animate-in-bubble", defaultOpen: s, children: [
1072
- /* @__PURE__ */ n(jr, { type: e.type, state: e.state, toolName: Tt(e) }),
1073
- /* @__PURE__ */ c($r, { children: [
1074
- /* @__PURE__ */ n(Fr, { input: e.input, state: e.state }),
1075
- (e.state === "output-available" || e.state === "output-error") && /* @__PURE__ */ n(Lr, { errorText: e.errorText, output: e.output })
1076
- ] }),
1077
- /* @__PURE__ */ n(Br, { part: e })
1078
- ] });
1079
- }
1080
- function Hr({ part: e }) {
1081
- const t = A((d) => d.message.role), { t: s } = k(["chat", "admin"]), r = e, o = bn(e), i = r.mediaType.startsWith("image/"), a = r.filename ?? "file", l = (d) => {
1082
- if (d.preventDefault(), !o) return;
1083
- const u = document.createElement("a");
1084
- u.href = o, u.download = a, document.body.appendChild(u), u.click(), document.body.removeChild(u);
1085
- };
1086
- return /* @__PURE__ */ n("div", { className: "py-2 animate-in-bubble", children: /* @__PURE__ */ n(qe, { from: t, children: /* @__PURE__ */ n(je, { isPlain: !0, children: i ? /* @__PURE__ */ c("div", { className: "group relative max-w-[280px] rounded-xl overflow-hidden border border-border/5 transition-all duration-300 hover:border-primary/30", children: [
1087
- /* @__PURE__ */ n(
1088
- "img",
1089
- {
1090
- src: o || void 0,
1091
- alt: a,
1092
- className: "max-h-[280px] w-full rounded-xl object-cover"
1093
- }
1094
- ),
1095
- /* @__PURE__ */ c("div", { className: "absolute inset-x-0 bottom-0 p-3 bg-black/60 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity flex items-center justify-between", children: [
1096
- /* @__PURE__ */ n("span", { className: "text-xs text-white truncate max-w-[150px] font-medium", children: a }),
1097
- /* @__PURE__ */ n(
1098
- "button",
1099
- {
1100
- onClick: l,
1101
- className: "p-1.5 bg-white/20 hover:bg-white/30 rounded-full text-white transition-all active:scale-95",
1102
- title: s("download", "Download"),
1103
- children: /* @__PURE__ */ n(de, { className: "size-4" })
1104
- }
1105
- )
1106
- ] }),
1107
- /* @__PURE__ */ n("div", { className: "absolute top-2 end-2 md:hidden", children: /* @__PURE__ */ n(
1108
- "button",
1109
- {
1110
- onClick: l,
1111
- className: "p-1.5 bg-black/60 rounded-full text-white",
1112
- children: /* @__PURE__ */ n(de, { className: "size-4" })
1113
- }
1114
- ) })
1115
- ] }) : /* @__PURE__ */ n("div", { className: "flex flex-col gap-1.5", children: /* @__PURE__ */ c("div", { className: "group inline-flex items-center gap-3 rounded-xl p-3 text-sm transition-all duration-300 bg-secondary/10 border border-border/5 hover:border-primary/30 hover:bg-secondary/20", children: [
1116
- /* @__PURE__ */ n("div", { className: "p-2.5 rounded-lg bg-background/50 border border-border/10 group-hover:border-primary/20 group-hover:text-primary transition-colors", children: /* @__PURE__ */ n(_t, { className: "size-4 shrink-0" }) }),
1117
- /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 me-4", children: [
1118
- /* @__PURE__ */ n("span", { className: "truncate max-w-[180px] font-semibold text-foreground/90 leading-none mb-1 group-hover:text-foreground transition-colors", children: a }),
1119
- r.mediaType && /* @__PURE__ */ n("span", { className: "text-xs text-muted-foreground uppercase font-bold tracking-widest opacity-60", children: r.mediaType.split("/").pop() })
1120
- ] }),
1121
- /* @__PURE__ */ n(
1122
- "button",
1123
- {
1124
- onClick: l,
1125
- className: "ms-auto p-2 hover:bg-primary hover:text-primary-foreground rounded-lg text-muted-foreground transition-all active:scale-90",
1126
- title: s("download", "Download"),
1127
- children: /* @__PURE__ */ n(de, { className: "size-4" })
1128
- }
1129
- )
1130
- ] }) }) }) }) });
1131
- }
1132
- function Vr({ part: e }) {
1133
- const t = A((u) => u.message.role), { t: s } = k(["chat"]), { focusReference: r } = vn(), [o, i] = Gt(1200), a = e.data, l = a.excerpt || a.label || s("source_unavailable"), d = a.label && a.label !== l ? a.label : s("referenced_context");
1134
- return /* @__PURE__ */ n("div", { className: p("my-1.5 flex", t === "user" && "justify-end"), children: /* @__PURE__ */ c(
1135
- "button",
1136
- {
1137
- type: "button",
1138
- className: p(
1139
- "inline-flex max-w-[min(100%,34rem)] items-start gap-2 rounded-lg border border-border/60 bg-muted/35 px-3 py-2 text-start text-xs text-foreground transition hover:border-primary/30 hover:bg-muted/55 focus-visible:ring-2 focus-visible:ring-primary/30",
1140
- o && "ring-2 ring-primary/35"
1141
- ),
1142
- onClick: () => {
1143
- r(a) || i();
1144
- },
1145
- title: d,
1146
- children: [
1147
- /* @__PURE__ */ n(Re, { className: "mt-0.5 size-3.5 shrink-0 opacity-70" }),
1148
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ n("span", { className: "line-clamp-2 opacity-85", dir: "auto", children: l }) })
1149
- ]
1150
- }
1151
- ) });
1152
- }
1153
- function Ue(e) {
1154
- const { input: t } = e, s = typeof t?.question == "string" ? t.question.trim() : "", r = (Array.isArray(t?.choices) ? t.choices : []).filter((o) => typeof o == "string").map((o) => o.trim()).filter(Boolean).map((o) => ({ label: o }));
1155
- return !s || r.length === 0 && e.state !== "input-streaming" ? null : { question: s, choices: r, allowCustom: t?.allow_custom !== !1 };
1156
- }
1157
- function Qr(e) {
1158
- return e.type === "tool-ask_user";
1159
- }
1160
- function Jt(e, { streaming: t = !1 } = {}) {
1161
- return e?.parts.find(
1162
- (s) => Qr(s) && (s.state === "input-available" || t && s.state === "input-streaming")
1163
- );
1164
- }
1165
- const Yt = (e) => e.replace(/\s+/g, " ").trim().toLowerCase().replace(/[?!.:؟،]+$/, ""), mt = /* @__PURE__ */ new WeakMap();
1166
- function Wr(e) {
1167
- const t = mt.get(e);
1168
- if (t !== void 0) return t;
1169
- const s = e.parts.flatMap((o) => o.type === "text" ? [o.text] : []).join(" "), r = Yt(s);
1170
- return mt.set(e, r), r;
1171
- }
1172
- function Xt(e, t) {
1173
- const s = Yt(t.question);
1174
- return s ? e ? Wr(e).includes(s) : !1 : !0;
1175
- }
1176
- function Gr(e) {
1177
- const { readonly: t, lastMessage: s, isFinished: r, status: o } = e;
1178
- return !t && !!s && !!r && o === "ready";
1179
- }
1180
- function Zt({
1181
- choices: e,
1182
- selected: t,
1183
- disabled: s,
1184
- dir: r,
1185
- onSelect: o,
1186
- className: i
1187
- }) {
1188
- return /* @__PURE__ */ n("div", { className: p("flex flex-col gap-1", i), children: e.map((a) => /* @__PURE__ */ n(
1189
- "button",
1190
- {
1191
- type: "button",
1192
- disabled: s,
1193
- dir: F(a.label, r),
1194
- onClick: () => o(a.label),
1195
- className: p(
1196
- "w-full rounded-full px-3 py-2.5 text-start text-sm leading-snug",
1197
- "transition-colors duration-150 outline-none",
1198
- // Inset, so a focus ring can never overflow a scrolling container
1199
- // (which would hand it a scrollbar).
1200
- "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
1201
- t === a.label ? "bg-primary/12 text-primary" : p(
1202
- "text-foreground/85 hover:bg-foreground/[0.06] hover:text-foreground",
1203
- "disabled:cursor-not-allowed disabled:opacity-55 disabled:hover:bg-transparent"
1204
- )
1205
- ),
1206
- children: a.label
1207
- },
1208
- a.label
1209
- )) });
1210
- }
1211
- function Kr({
1212
- part: e,
1213
- message: t,
1214
- disabled: s,
1215
- dismissed: r,
1216
- onReopen: o,
1217
- onAnswer: i
1218
- }) {
1219
- const { t: a } = k(["chat"]), { dir: l } = $(), { textComponents: d, remarkPlugins: u, rehypePlugins: m, linkProtocols: h } = Q(), b = E(() => Ue(e), [e]), [g, f] = C(""), [w, x] = C(null), [y, v] = C(!1);
1220
- if (!b) return null;
1221
- const I = !s && !!i, N = !I || y || w !== null, z = !Xt(t, b), S = F(b.question, l);
1222
- if (!z && !I && !r) return null;
1223
- const O = async (j) => {
1224
- const W = j.trim();
1225
- if (!(!W || N)) {
1226
- v(!0), x(W);
1227
- try {
1228
- await i?.(W);
1229
- } catch {
1230
- x(null), v(!1);
1231
- return;
1232
- }
1233
- v(!1);
1234
- }
1235
- }, D = (j) => {
1236
- j.preventDefault(), O(g);
1237
- };
1238
- return /* @__PURE__ */ c("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: [
1239
- z && /* @__PURE__ */ n(qe, { from: t.role, children: /* @__PURE__ */ n(je, { dir: S, children: /* @__PURE__ */ n(
1240
- ge,
1241
- {
1242
- components: d,
1243
- remarkPlugins: u,
1244
- rehypePlugins: m,
1245
- linkProtocols: h,
1246
- children: b.question
1247
- }
1248
- ) }) }),
1249
- r && /* @__PURE__ */ n(
1250
- "div",
1251
- {
1252
- className: p("flex w-full justify-start", z && "mt-2.5"),
1253
- dir: S,
1254
- children: /* @__PURE__ */ c(
1255
- "button",
1256
- {
1257
- type: "button",
1258
- onClick: o,
1259
- disabled: !o,
1260
- className: "inline-flex max-w-full items-center gap-2 rounded-full border border-border/60 px-3 py-1.5 text-start text-xs text-muted-foreground outline-none transition-colors hover:border-border hover:bg-foreground/[0.04] hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-default disabled:hover:border-border/60 disabled:hover:bg-transparent disabled:hover:text-muted-foreground",
1261
- children: [
1262
- /* @__PURE__ */ n($n, { className: "size-3.5 shrink-0" }),
1263
- /* @__PURE__ */ n("span", { className: "truncate", children: a("choice_dismissed") })
1264
- ]
1265
- }
1266
- )
1267
- }
1268
- ),
1269
- I && !r && /* @__PURE__ */ c("div", { className: p("max-w-xl", z && "mt-2.5"), dir: S, children: [
1270
- /* @__PURE__ */ n(
1271
- Zt,
1272
- {
1273
- choices: b.choices,
1274
- selected: w,
1275
- disabled: N,
1276
- dir: S,
1277
- onSelect: (j) => {
1278
- O(j);
1279
- }
1280
- }
1281
- ),
1282
- b.allowCustom && /* @__PURE__ */ c("form", { onSubmit: D, className: "mt-1.5 flex items-center gap-1.5", children: [
1283
- /* @__PURE__ */ n(
1284
- "input",
1285
- {
1286
- value: g,
1287
- disabled: N,
1288
- dir: F(g || a("choice_other_placeholder"), S),
1289
- onChange: (j) => f(j.target.value),
1290
- placeholder: a("choice_other_placeholder"),
1291
- className: "h-11 min-w-0 flex-1 rounded-full bg-transparent px-3 text-start text-sm outline-none transition-colors placeholder:text-muted-foreground/60 hover:bg-foreground/[0.04] focus-visible:bg-foreground/[0.06] disabled:cursor-not-allowed disabled:opacity-55"
1292
- }
1293
- ),
1294
- /* @__PURE__ */ n(
1295
- "button",
1296
- {
1297
- type: "submit",
1298
- disabled: N || !g.trim(),
1299
- className: "flex size-11 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-35",
1300
- "aria-label": a("choice_send_answer"),
1301
- title: a("choice_send_answer"),
1302
- children: /* @__PURE__ */ n(St, { className: "size-4" })
1303
- }
1304
- )
1305
- ] })
1306
- ] })
1307
- ] });
1308
- }
1309
- const en = "dismissed-choice-questions";
1310
- function Jr(e) {
1311
- const t = us(e, en);
1312
- if (!t) return [];
1313
- try {
1314
- const s = JSON.parse(t);
1315
- return Array.isArray(s) ? s.filter((r) => typeof r == "string") : [];
1316
- } catch {
1317
- return [];
1318
- }
1319
- }
1320
- const Yr = {
1321
- question: null,
1322
- messageId: null,
1323
- disabled: !0,
1324
- dismissed: !1,
1325
- setDismissed: () => {
1326
- },
1327
- answer: () => {
1328
- },
1329
- dockHeight: 0,
1330
- reportDockHeight: () => {
1331
- }
1332
- }, tn = te(null);
1333
- function Ja({
1334
- message: e,
1335
- disabled: t = !1,
1336
- readonly: s = !1,
1337
- cacheNamespace: r = "gentiq",
1338
- onAnswer: o,
1339
- children: i
1340
- }) {
1341
- const [a, l] = C(0), d = s || e?.role !== "assistant" ? void 0 : Jt(e, { streaming: t }), u = E(() => d ? Ue(d) : null, [d]), m = d?.toolCallId, h = ee((I) => {
1342
- l((N) => Math.abs(N - I) < 1 ? N : I);
1343
- }, []), b = u ? e?.id ?? null : null, g = u && e ? cs(e) : null, [f, w] = C(() => Jr(r)), x = g !== null && f.includes(g), y = ee(
1344
- (I) => {
1345
- g && w((N) => {
1346
- const z = N.filter((S) => S !== g);
1347
- return I ? [...z, g].slice(-50) : z.length === N.length ? N : z;
1348
- });
1349
- },
1350
- [g]
1351
- );
1352
- T(() => {
1353
- ds(r, en, JSON.stringify(f));
1354
- }, [r, f]);
1355
- const v = E(
1356
- () => ({
1357
- question: u,
1358
- messageId: b,
1359
- disabled: t || !o,
1360
- dismissed: x,
1361
- setDismissed: y,
1362
- answer: (I) => {
1363
- m && o?.({ toolCallId: m, output: { answer: I } });
1364
- },
1365
- dockHeight: u ? a : 0,
1366
- reportDockHeight: h
1367
- }),
1368
- [
1369
- u,
1370
- b,
1371
- t,
1372
- x,
1373
- y,
1374
- o,
1375
- m,
1376
- a,
1377
- h
1378
- ]
1379
- );
1380
- return /* @__PURE__ */ n(tn.Provider, { value: v, children: i });
1381
- }
1382
- function he() {
1383
- return le(tn) ?? Yr;
1384
- }
1385
- function He(e) {
1386
- const t = A((f) => f.message), s = A((f) => f.isLast), r = A((f) => f.isStreaming), o = Y((f) => f.status), { readonly: i, actions: a } = yt(), l = ee(
1387
- (f) => {
1388
- e && a?.addToolOutput({ toolCallId: e, output: { answer: f } });
1389
- },
1390
- [a, e]
1391
- ), d = ee((f) => {
1392
- a?.send({ text: f });
1393
- }, [a]), { messageId: u, dismissed: m, setDismissed: h } = he(), b = u === t.id, g = s && !r && t.role === "assistant";
1394
- return {
1395
- message: t,
1396
- isLast: s,
1397
- isFinished: g,
1398
- status: o,
1399
- readonly: i,
1400
- docked: b && !m,
1401
- dismissedHere: b && m,
1402
- reopen: () => h(!1),
1403
- answerable: Gr({ readonly: i, lastMessage: s, isFinished: g, status: o }),
1404
- answer: l,
1405
- sendText: d
1406
- };
1407
- }
1408
- function Xr({
1409
- part: e,
1410
- question: t,
1411
- index: s
1412
- }) {
1413
- const { t: r } = k("chat"), { ChoiceQuestionPart: o } = Q(), { message: i, answerable: a, dismissedHere: l, reopen: d, answer: u } = He(
1414
- e.toolCallId
1415
- );
1416
- if (a && e.state === "input-available")
1417
- return /* @__PURE__ */ n(
1418
- o,
1419
- {
1420
- part: e,
1421
- message: i,
1422
- disabled: !1,
1423
- dismissed: l,
1424
- onReopen: l ? d : void 0,
1425
- onAnswer: u
1426
- }
1427
- );
1428
- const m = e.state === "output-available" ? e.output?.answer : void 0;
1429
- return /* @__PURE__ */ c(R, { children: [
1430
- !Xt(i, t) && /* @__PURE__ */ n(
1431
- ze,
1432
- {
1433
- text: t.question,
1434
- role: i.role,
1435
- streaming: !1,
1436
- reference: {
1437
- kind: "text",
1438
- messageId: i.id,
1439
- partIndex: s,
1440
- sourceId: `${i.id}-${s}-choice-question`,
1441
- role: i.role,
1442
- label: r("reference_assistant_response"),
1443
- excerpt: t.question
1444
- }
1445
- }
1446
- ),
1447
- m && /* @__PURE__ */ n(
1448
- ze,
1449
- {
1450
- text: m,
1451
- role: "user",
1452
- streaming: !1,
1453
- reference: {
1454
- kind: "text",
1455
- messageId: i.id,
1456
- partIndex: s,
1457
- sourceId: `${i.id}-${s}-choice-answer`,
1458
- role: "user",
1459
- label: r("reference_user_message"),
1460
- excerpt: m
1461
- }
1462
- }
1463
- )
1464
- ] });
1465
- }
1466
- function Zr({ part: e, index: t }) {
1467
- const { docked: s } = He(e.toolCallId);
1468
- if (s && (e.state === "input-available" || e.state === "input-streaming")) return null;
1469
- const r = Ue(e);
1470
- return r ? /* @__PURE__ */ n(Xr, { part: e, question: r, index: t }) : null;
1471
- }
1472
- function ue(e) {
1473
- if (Array.isArray(e)) return ue(e[0]);
1474
- if (typeof e == "string")
1475
- try {
1476
- return ue(JSON.parse(e));
1477
- } catch {
1478
- return null;
1479
- }
1480
- if (!e || typeof e != "object") return null;
1481
- const t = e;
1482
- if (!t.suggestions && t.data) return ue(t.data);
1483
- if (!Array.isArray(t.suggestions)) return null;
1484
- const s = /* @__PURE__ */ new Set(), r = t.suggestions.filter((o) => typeof o == "string").map((o) => o.trim()).filter((o) => {
1485
- const i = o.toLocaleLowerCase();
1486
- return !o || s.has(i) ? !1 : (s.add(i), !0);
1487
- }).slice(0, 3);
1488
- return r.length > 0 ? { suggestions: r } : null;
1489
- }
1490
- function eo({ part: e }) {
1491
- const { FollowUpSuggestions: t } = Q(), s = A(
1492
- (m) => m.message.parts.find((h) => h.type === "tool-suggest_follow_ups") === e
1493
- ), { message: r, isLast: o, isFinished: i, status: a, readonly: l, sendText: d } = He();
1494
- if (!s || r.role !== "assistant" || !o || !i || a !== "ready" || l || Jt(r) !== void 0)
1495
- return null;
1496
- const u = ue(e.input);
1497
- return u ? /* @__PURE__ */ n(t, { suggestions: u.suggestions, onSelect: d }) : null;
1498
- }
1499
- const to = {
1500
- text: hr,
1501
- reasoning: wr,
1502
- file: Hr,
1503
- tool: Ur,
1504
- "source-url": null,
1505
- "source-document": null,
1506
- "data-reference": Vr,
1507
- "tool-ask_user": Zr,
1508
- "tool-suggest_follow_ups": eo
1509
- }, xe = (e) => Array.from({ length: e }, (t, s) => /* @__PURE__ */ n("span", {}, s)), no = () => /* @__PURE__ */ n(R, { children: [0, 1, 2].map((e) => /* @__PURE__ */ n(
1510
- "span",
1511
- {
1512
- className: "gentiq-loader-dot size-2 rounded-full bg-primary/70",
1513
- style: {
1514
- animation: "gentiq-typing-bounce 1.2s ease-in-out infinite",
1515
- animationDelay: `${e * 0.18}s`
1516
- }
1517
- },
1518
- e
1519
- )) }), so = {
1520
- orb: () => /* @__PURE__ */ n("span", { className: "gentiq-loader-orb" }),
1521
- triangle: () => /* @__PURE__ */ n("span", { className: "gentiq-loader-triangle", children: xe(3) }),
1522
- cross: () => /* @__PURE__ */ n("span", { className: "gentiq-loader-cross", children: xe(2) }),
1523
- comet: () => /* @__PURE__ */ n("span", { className: "gentiq-loader-comet" }),
1524
- aurora: () => /* @__PURE__ */ n("span", { className: "gentiq-loader-aurora", children: xe(3) })
1525
- }, ye = ({ className: e, variant: t, ...s }) => {
1526
- const r = Te((a) => a.theme), o = t ?? r?.loader ?? "dots", i = o === "dots" ? void 0 : so[o];
1527
- return /* @__PURE__ */ c(
1528
- "div",
1529
- {
1530
- "data-gentiq-loader": i ? o : "dots",
1531
- className: p("flex items-center gap-1.5 px-1 py-3", e),
1532
- ...s,
1533
- children: [
1534
- i && /* @__PURE__ */ n(i, {}),
1535
- /* @__PURE__ */ n(no, {})
1536
- ]
1537
- }
1538
- );
1539
- };
1540
- class pe extends zn {
1541
- state = { error: null };
1542
- static getDerivedStateFromError(t) {
1543
- return { error: t };
1544
- }
1545
- componentDidCatch(t, s) {
1546
- console.error("Gentiq: render error contained by ErrorBoundary", t, s), this.props.onError?.(t, s);
1547
- }
1548
- componentDidUpdate(t) {
1549
- if (!this.state.error) return;
1550
- const s = t.resetKeys, r = this.props.resetKeys;
1551
- if (!r) return;
1552
- (!s || s.length !== r.length || r.some((i, a) => !Object.is(i, s[a]))) && this.reset();
1553
- }
1554
- reset = () => {
1555
- this.setState({ error: null });
1556
- };
1557
- render() {
1558
- const { error: t } = this.state;
1559
- if (!t) return this.props.children;
1560
- const { fallback: s } = this.props;
1561
- return s !== void 0 ? typeof s == "function" ? s(t, this.reset) : s : /* @__PURE__ */ n("div", { className: "my-2 rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive/80", children: t.message || /* @__PURE__ */ n(ro, {}) });
1562
- }
1563
- }
1564
- function ro() {
1565
- const { t: e } = k("chat");
1566
- return e("render_error");
1567
- }
1568
- const oo = ({ className: e, ...t }) => /* @__PURE__ */ n(Fe, { className: p("not-prose mb-4 text-primary text-xs", e), ...t }), ao = ({ className: e, count: t, children: s, ...r }) => {
1569
- const { t: o } = k(["chat"]);
1570
- return /* @__PURE__ */ n(Le, { className: p("flex items-center gap-2", e), ...r, children: s ?? /* @__PURE__ */ c(R, { children: [
1571
- /* @__PURE__ */ n("p", { className: "font-medium", children: o("used_sources", { count: t }) }),
1572
- /* @__PURE__ */ n(ne, { className: "h-4 w-4" })
1573
- ] }) });
1574
- }, io = ({ className: e, ...t }) => /* @__PURE__ */ n(
1575
- Be,
1576
- {
1577
- className: p(
1578
- "mt-3 flex w-fit flex-col gap-2",
1579
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
1580
- e
1581
- ),
1582
- ...t
1583
- }
1584
- ), lo = ({ href: e, title: t, children: s, ...r }) => /* @__PURE__ */ n("a", { className: "flex items-center gap-2", href: e, rel: "noreferrer", target: "_blank", ...r, children: s ?? /* @__PURE__ */ c(R, { children: [
1585
- /* @__PURE__ */ n(Fn, { className: "h-4 w-4" }),
1586
- /* @__PURE__ */ n("span", { className: "block font-medium", children: t })
1587
- ] }) });
1588
- function co() {
1589
- const { t: e } = k(["chat"]);
1590
- return /* @__PURE__ */ n(
1591
- Ne.ScrollToBottom,
1592
- {
1593
- "aria-label": e("scroll_to_bottom"),
1594
- className: "absolute inset-x-0 bottom-32 z-10 mx-auto w-fit rounded-full border bg-background px-4 py-2 text-foreground/80 shadow-lg hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
1595
- children: /* @__PURE__ */ n(Ln, { className: "size-3.5" })
1596
- }
1597
- );
1598
- }
1599
- const uo = (e) => ms.includes(e.type) ? !1 : e.type === "text" || e.type === "reasoning" ? e.text.trim().length > 0 : e.type === "file" ? !0 : Pt(e), mo = ({
1600
- latestProgress: e,
1601
- parts: t,
1602
- isFinished: s
1603
- }) => {
1604
- const { status: r, message: o } = e.data;
1605
- if (!o) return null;
1606
- const i = t.lastIndexOf(e), a = t.slice(i + 1), l = a.some(
1607
- (g) => g.type === "text" && g.text.trim().length > 0 || g.type === "tool-ask_user"
1608
- ), d = a.some(Pt), u = r === "running";
1609
- if (!(u ? !l && !s : !l && !d)) return null;
1610
- const h = r === "error", b = F(o);
1611
- return /* @__PURE__ */ n(
1612
- "div",
1613
- {
1614
- className: p(
1615
- "flex w-full py-3 mx-auto max-w-4xl px-4 md:px-0 animate-in-bubble",
1616
- b === "rtl" ? "justify-end" : "justify-start"
1617
- ),
1618
- children: /* @__PURE__ */ c(
1619
- "div",
1620
- {
1621
- className: p(
1622
- "flex items-center gap-3 text-sm text-muted-foreground",
1623
- b === "rtl" && "flex-row-reverse"
1624
- ),
1625
- dir: b,
1626
- children: [
1627
- u ? /* @__PURE__ */ n("div", { className: "size-4 animate-spin rounded-full border-2 border-primary border-e-transparent shrink-0" }) : h ? /* @__PURE__ */ n(H, { className: "size-4 text-destructive shrink-0" }) : /* @__PURE__ */ n(ce, { className: "size-4 text-success shrink-0" }),
1628
- /* @__PURE__ */ n("span", { className: p("font-medium", u && "animate-pulse"), children: o })
1629
- ]
1630
- }
1631
- )
1632
- }
1633
- );
1634
- }, po = Ae(
1635
- () => import("./MessageEditor-HB-YJP7R.js").then((e) => ({ default: e.MessageEditor }))
1636
- ), fo = { UserMessage: go, AssistantMessage: bo };
1637
- function go() {
1638
- const e = A((o) => o.message.id), t = A((o) => o.isEditing), { MessageActions: s } = Q(), r = se((o) => o.threadActions);
1639
- return /* @__PURE__ */ c(
1640
- X.Root,
1641
- {
1642
- "data-gentiq-message-id": e,
1643
- "data-gentiq-message-role": "user",
1644
- className: "group/message",
1645
- children: [
1646
- t ? /* @__PURE__ */ c(Ce, { fallback: /* @__PURE__ */ n(X.Parts, {}), children: [
1647
- /* @__PURE__ */ n(X.Parts, { components: ho }),
1648
- /* @__PURE__ */ n(po, {})
1649
- ] }) : /* @__PURE__ */ n(X.Parts, {}),
1650
- /* @__PURE__ */ n(s, { retry: !1, feedback: !1, edit: r.edit })
1651
- ]
1652
- }
1653
- );
1654
- }
1655
- const ho = { text: null };
1656
- function bo() {
1657
- const e = A((a) => a.message.id), t = A((a) => a.message.parts), { MessageActions: s } = Q(), r = se((a) => a.threadActions), { sourceUrls: o, hasText: i } = E(
1658
- () => ({
1659
- sourceUrls: t.flatMap((a) => a.type === "source-url" ? [a.url] : []),
1660
- hasText: ps({ parts: t }).length > 0
1661
- }),
1662
- [t]
1663
- );
1664
- return /* @__PURE__ */ c(
1665
- X.Root,
1666
- {
1667
- "data-gentiq-message-id": e,
1668
- "data-gentiq-message-role": "assistant",
1669
- className: "group/message",
1670
- children: [
1671
- o.length > 0 && /* @__PURE__ */ c(oo, { children: [
1672
- /* @__PURE__ */ n(ao, { count: o.length }),
1673
- o.map((a, l) => /* @__PURE__ */ n(io, { children: /* @__PURE__ */ n(lo, { href: a, title: a }) }, `${e}-source-${l}`))
1674
- ] }),
1675
- /* @__PURE__ */ n(X.Parts, {}),
1676
- i && /* @__PURE__ */ n(
1677
- s,
1678
- {
1679
- retry: r.retry,
1680
- feedback: r.feedback,
1681
- edit: !1
1682
- }
1683
- )
1684
- ]
1685
- }
1686
- );
1687
- }
1688
- function vo({ className: e }) {
1689
- const { t } = k(["chat", "errors"]), { ChatError: s } = Q(), { actions: r } = yt(), o = Y((v) => v.messages), i = Y((v) => v.status), a = Y((v) => v.isLoadingHistory), l = Y((v) => v.error), d = E(
1690
- () => l === void 0 ? null : xn(l, t),
1691
- [l, t]
1692
- ), { dockHeight: u } = he(), m = `calc(var(--gentiq-composer-inset, calc(6.5rem + ${u}px)) + 1.5rem)`, h = a, b = Y((v) => v.earlier.status), g = r?.loadEarlier, f = o[o.length - 1], w = f?.role === "assistant" && (i === "ready" || f.parts.some((v) => v.type === "data-chat-finished")), x = !h && (i === "submitted" || i === "streaming" && !(f?.role === "assistant" && f.parts.some(uo)));
1693
- let y;
1694
- if (f?.role === "assistant")
1695
- for (const v of f.parts)
1696
- v.type === "data-progress-update" && (y = v);
1697
- return /* @__PURE__ */ c("div", { className: p("relative min-h-0 flex-1 overflow-hidden", e), children: [
1698
- /* @__PURE__ */ c(
1699
- Ne.Viewport,
1700
- {
1701
- scrollClassName: "custom-scrollbar",
1702
- className: "stick-to-bottom max-w-4xl mx-auto w-full p-4 pb-6 md:px-0",
1703
- style: { paddingBottom: m },
1704
- "aria-busy": h,
1705
- dir: "ltr",
1706
- children: [
1707
- /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(Ne.Messages, { components: fo }) }),
1708
- y && /* @__PURE__ */ n(
1709
- mo,
1710
- {
1711
- latestProgress: y,
1712
- parts: f.parts,
1713
- isFinished: w
1714
- }
1715
- ),
1716
- x && /* @__PURE__ */ n("div", { className: "animate-in-bubble", children: /* @__PURE__ */ n(ye, {}) }),
1717
- i === "error" && d && /* @__PURE__ */ n("div", { className: "mx-auto max-w-4xl w-full px-4 my-3 animate-in-bubble", children: /* @__PURE__ */ n(s, { error: d, code: Dt(d) ? d.code : void 0 }) })
1718
- ]
1719
- }
1720
- ),
1721
- b !== "idle" && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 top-2 flex justify-center pointer-events-none", children: b === "loading" ? /* @__PURE__ */ n("div", { role: "status", "aria-label": t("loading_earlier"), children: /* @__PURE__ */ n(ye, {}) }) : /* @__PURE__ */ n(
1722
- "button",
1723
- {
1724
- type: "button",
1725
- onClick: () => {
1726
- g?.();
1727
- },
1728
- className: "pointer-events-auto rounded-full border border-border bg-background px-3 py-1.5 text-sm text-muted-foreground shadow-sm hover:text-foreground",
1729
- children: t("load_earlier_failed")
1730
- }
1731
- ) }),
1732
- h && /* @__PURE__ */ n(
1733
- "div",
1734
- {
1735
- className: "absolute inset-0 flex items-center justify-center pointer-events-none",
1736
- role: "status",
1737
- "aria-label": t("loading_chat"),
1738
- children: /* @__PURE__ */ n(ye, { className: "animate-in fade-in duration-300" })
1739
- }
1740
- ),
1741
- !h && /* @__PURE__ */ n(co, {})
1742
- ] });
1743
- }
1744
- function xo({ delayDuration: e = 400, ...t }) {
1745
- return /* @__PURE__ */ n(Z.Provider, { "data-slot": "tooltip-provider", delayDuration: e, ...t });
1746
- }
1747
- function Ve({ ...e }) {
1748
- return /* @__PURE__ */ n(xo, { children: /* @__PURE__ */ n(Z.Root, { "data-slot": "tooltip", ...e }) });
1749
- }
1750
- function Qe({ ...e }) {
1751
- return /* @__PURE__ */ n(Z.Trigger, { "data-slot": "tooltip-trigger", ...e });
1752
- }
1753
- function We({
1754
- className: e,
1755
- sideOffset: t = 0,
1756
- children: s,
1757
- ...r
1758
- }) {
1759
- const o = V();
1760
- return /* @__PURE__ */ n(Z.Portal, { container: o, children: /* @__PURE__ */ c(
1761
- Z.Content,
1762
- {
1763
- "data-slot": "tooltip-content",
1764
- sideOffset: t,
1765
- className: p(
1766
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-sm text-balance",
1767
- e
1768
- ),
1769
- ...r,
1770
- children: [
1771
- s,
1772
- /* @__PURE__ */ n(Z.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
1773
- ]
1774
- }
1775
- ) });
1776
- }
1777
- const yo = 2e3, wo = "size-7 rounded-lg p-1 text-muted-foreground hover:bg-accent/70 hover:text-foreground disabled:opacity-40";
1778
- function No({ retry: e, feedback: t, edit: s }) {
1779
- const { t: r } = k(["chat", "errors"]), o = A((m) => m.message.role === "user"), i = (m) => K.error(wt(m, r)), [a, l] = C(!1), d = P(void 0), u = () => {
1780
- l(!0), clearTimeout(d.current), d.current = setTimeout(() => l(!1), yo);
1781
- };
1782
- return /* @__PURE__ */ c(
1783
- J.Root,
1784
- {
1785
- "aria-label": r("message_actions"),
1786
- className: `mt-1 flex items-center gap-0.5 group-data-[editing]/message:hidden ${o ? "justify-end" : "ms-0.5"}`,
1787
- children: [
1788
- e && /* @__PURE__ */ n(oe, { label: r("retry"), children: /* @__PURE__ */ n(J.Reload, { "aria-label": r("retry"), children: /* @__PURE__ */ n(Bn, { className: "size-4" }) }) }),
1789
- t && /* @__PURE__ */ c(R, { children: [
1790
- /* @__PURE__ */ n(oe, { label: r("like"), children: /* @__PURE__ */ n(
1791
- J.FeedbackPositive,
1792
- {
1793
- "aria-label": r("like"),
1794
- onError: i,
1795
- className: "data-[active]:text-primary",
1796
- children: /* @__PURE__ */ n(Un, { className: "size-4" })
1797
- }
1798
- ) }),
1799
- /* @__PURE__ */ n(oe, { label: r("dislike"), children: /* @__PURE__ */ n(
1800
- J.FeedbackNegative,
1801
- {
1802
- "aria-label": r("dislike"),
1803
- onError: i,
1804
- className: "data-[active]:text-destructive",
1805
- children: /* @__PURE__ */ n(Hn, { className: "size-4" })
1806
- }
1807
- ) })
1808
- ] }),
1809
- s && /* @__PURE__ */ n(oe, { label: r("edit_message"), children: /* @__PURE__ */ n(J.Edit, { "aria-label": r("edit_message"), children: /* @__PURE__ */ n(Vn, { className: "size-4" }) }) }),
1810
- /* @__PURE__ */ n(oe, { label: r("copy"), children: /* @__PURE__ */ c(
1811
- J.Copy,
1812
- {
1813
- "aria-label": r("copy"),
1814
- onCopied: u,
1815
- onError: () => K.error(r("copy_failed")),
1816
- className: "group/copy",
1817
- children: [
1818
- /* @__PURE__ */ n(Ct, { className: "size-4 group-data-[copied]/copy:hidden" }),
1819
- /* @__PURE__ */ n(ce, { className: "hidden size-4 group-data-[copied]/copy:block" })
1820
- ]
1821
- }
1822
- ) }),
1823
- /* @__PURE__ */ n("span", { role: "status", className: "sr-only", children: a ? r("copied") : null })
1824
- ]
1825
- }
1826
- );
1827
- }
1828
- function oe({ label: e, children: t }) {
1829
- return /* @__PURE__ */ c(Ve, { children: [
1830
- /* @__PURE__ */ n(Qe, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "ghost", size: "sm", className: wo, asChild: !0, children: t }) }),
1831
- /* @__PURE__ */ n(We, { children: e })
1832
- ] });
1833
- }
1834
- const ko = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg-transparent w-full", children: /* @__PURE__ */ n(
1835
- G.Root,
1836
- {
1837
- className: p(
1838
- "w-full flex items-end gap-2 overflow-hidden",
1839
- "rounded-lg bg-surface",
1840
- "px-3 py-2",
1841
- "transition-[border-color,box-shadow] duration-200 ease-out",
1842
- "border-[1.5px] border-border/60 shadow-sm shadow-foreground/[0.03]",
1843
- "hover:border-border",
1844
- "has-focus-visible:border-foreground/25 has-focus-visible:shadow-md has-focus-visible:shadow-foreground/[0.04]",
1845
- e
1846
- ),
1847
- ...t
1848
- }
1849
- ) }), Co = Dn(
1850
- function({ className: t, placeholder: s, ...r }, o) {
1851
- const { dir: i } = $(), a = Pe().draft, l = F(a, i), d = `${a || s || ""} `;
1852
- return /* @__PURE__ */ c("div", { className: "grid min-w-0 flex-1", children: [
1853
- /* @__PURE__ */ n(
1854
- "div",
1855
- {
1856
- "aria-hidden": !0,
1857
- dir: l,
1858
- className: p(
1859
- "invisible col-start-1 row-start-1 max-h-[6lh] overflow-hidden",
1860
- "whitespace-pre-wrap break-words px-2 py-2.5 text-base"
1861
- ),
1862
- children: d
1863
- }
1864
- ),
1865
- /* @__PURE__ */ n(
1866
- G.Input,
1867
- {
1868
- ref: o,
1869
- dir: l,
1870
- rows: 1,
1871
- placeholder: s,
1872
- className: p(
1873
- "col-start-1 row-start-1 w-full min-w-0 disabled:cursor-not-allowed disabled:opacity-50",
1874
- "resize-none rounded-none border-none shadow-none outline-none ring-0",
1875
- "px-2 py-2.5",
1876
- "field-sizing-content max-h-[6lh] bg-transparent dark:bg-transparent",
1877
- "focus-visible:ring-0 min-h-[40px] md:min-h-[44px]",
1878
- "text-base placeholder:text-muted-foreground/60",
1879
- "transition-all duration-200",
1880
- t
1881
- ),
1882
- ...r
1883
- }
1884
- )
1885
- ] });
1886
- }
1887
- ), _o = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: p("flex shrink-0 items-center gap-1.5 pb-1", e), ...t }), So = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: p("flex items-center gap-0.5", e), ...t }), nn = ({
1888
- variant: e = "ghost",
1889
- className: t,
1890
- size: s,
1891
- ...r
1892
- }) => {
1893
- const o = s ?? In.count(r.children) > 1 ? "default" : "icon";
1894
- return /* @__PURE__ */ n(
1895
- L,
1896
- {
1897
- className: p(
1898
- "shrink-0 gap-1.5 rounded-xl",
1899
- "text-muted-foreground hover:text-foreground",
1900
- "hover:bg-accent/60 transition-all duration-200",
1901
- "active:scale-95",
1902
- o === "default" && "px-3",
1903
- t
1904
- ),
1905
- size: o,
1906
- type: "button",
1907
- variant: e,
1908
- ...r
1909
- }
1910
- );
1911
- }, pt = ({
1912
- className: e,
1913
- variant: t = "default",
1914
- size: s = "icon",
1915
- status: r,
1916
- children: o,
1917
- ...i
1918
- }) => {
1919
- const { t: a } = k("chat");
1920
- let l = /* @__PURE__ */ n(St, { className: "size-4" }), d = a("send_message");
1921
- return r === "submitted" || r === "streaming" ? (l = /* @__PURE__ */ n(Qn, { className: "size-3.5 fill-current" }), d = a("stop_generation")) : r === "error" && (l = /* @__PURE__ */ n(H, { className: "size-4" }), d = a("send_failed")), /* @__PURE__ */ n(
1922
- L,
1923
- {
1924
- "aria-label": d,
1925
- className: p(
1926
- "shrink-0 rounded-lg size-9",
1927
- "bg-primary text-primary-foreground hover:bg-primary/90",
1928
- "transition-colors duration-200",
1929
- "disabled:opacity-40",
1930
- r === "submitted" && "bg-muted text-foreground hover:bg-muted",
1931
- e
1932
- ),
1933
- size: s,
1934
- type: r === "streaming" || r === "submitted" ? "button" : "submit",
1935
- variant: t,
1936
- ...i,
1937
- children: o ?? l
1938
- }
1939
- );
1940
- }, we = 768;
1941
- function zo() {
1942
- const [e, t] = ke.useState(void 0);
1943
- return ke.useEffect(() => {
1944
- const s = window.matchMedia(`(max-width: ${we - 1}px)`), r = () => {
1945
- t(window.innerWidth < we);
1946
- };
1947
- return s.addEventListener("change", r), t(window.innerWidth < we), () => {
1948
- s.removeEventListener("change", r);
1949
- };
1950
- }, []), !!e;
1951
- }
1952
- function Io({ entry: e, onRemove: t, onRetry: s }) {
1953
- const { t: r } = k(["chat", "errors"]), { file: o, status: i, progress: a, error: l, retryable: d } = e, u = Do(o.type.startsWith("image/") ? o : null), m = i === "failed";
1954
- return /* @__PURE__ */ c(
1955
- "div",
1956
- {
1957
- className: `flex max-w-full items-center gap-2 rounded-xl border bg-muted/60 py-1.5 ps-2.5 pe-1.5 text-sm ${m ? "border-destructive/50" : "border-border/60"}`,
1958
- "data-status": i,
1959
- children: [
1960
- u ? /* @__PURE__ */ n(
1961
- "img",
1962
- {
1963
- src: u,
1964
- alt: o.name,
1965
- className: "size-7 shrink-0 rounded-lg object-cover ring-1 ring-border/50"
1966
- }
1967
- ) : /* @__PURE__ */ n(_t, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": !0 }),
1968
- /* @__PURE__ */ c("span", { className: "flex min-w-0 flex-col", children: [
1969
- /* @__PURE__ */ n("span", { className: "max-w-[120px] truncate text-xs font-medium text-foreground/80", dir: "auto", children: o.name }),
1970
- i === "uploading" && /* @__PURE__ */ n(
1971
- "span",
1972
- {
1973
- role: "progressbar",
1974
- "aria-label": r("uploading_file", { name: o.name }),
1975
- "aria-valuemin": 0,
1976
- "aria-valuemax": 100,
1977
- "aria-valuenow": a === null ? void 0 : Math.round(a * 100),
1978
- className: "mt-1 block h-1 w-20 overflow-hidden rounded-full bg-foreground/10",
1979
- children: /* @__PURE__ */ n(
1980
- "span",
1981
- {
1982
- className: `block h-full rounded-full bg-primary transition-[width] motion-reduce:transition-none ${a === null ? "w-1/3 animate-pulse motion-reduce:animate-none" : ""}`,
1983
- style: a === null ? void 0 : { width: `${Math.round(a * 100)}%` }
1984
- }
1985
- )
1986
- }
1987
- ),
1988
- m && /* @__PURE__ */ c("span", { className: "flex items-center gap-1 text-xs text-destructive", role: "alert", children: [
1989
- /* @__PURE__ */ n(Wn, { className: "size-3 shrink-0", "aria-hidden": !0 }),
1990
- /* @__PURE__ */ n("span", { className: "max-w-[180px] truncate", title: ft(l, r), children: ft(l, r) })
1991
- ] })
1992
- ] }),
1993
- m && d && /* @__PURE__ */ n(
1994
- "button",
1995
- {
1996
- type: "button",
1997
- onClick: s,
1998
- className: "flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1999
- "aria-label": r("retry_upload", { name: o.name }),
2000
- children: /* @__PURE__ */ n(Gn, { className: "size-3.5", "aria-hidden": !0 })
2001
- }
2002
- ),
2003
- /* @__PURE__ */ n(
2004
- "button",
2005
- {
2006
- type: "button",
2007
- onClick: t,
2008
- className: "flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-destructive/15 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2009
- "aria-label": `${r("remove_file")}: ${o.name}`,
2010
- children: /* @__PURE__ */ n(H, { className: "size-3", "aria-hidden": !0 })
2011
- }
2012
- )
2013
- ]
2014
- }
2015
- );
2016
- }
2017
- function ft(e, t) {
2018
- return Dt(e) ? wt(e, t) : t("upload_failed");
2019
- }
2020
- function Do(e) {
2021
- const [t, s] = C();
2022
- return T(() => {
2023
- if (!e) return;
2024
- const r = URL.createObjectURL(e);
2025
- return s(r), () => {
2026
- URL.revokeObjectURL(r), s(void 0);
2027
- };
2028
- }, [e]), t;
2029
- }
2030
- function To({ reference: e, remove: t, focus: s }) {
2031
- const { t: r } = k(["chat"]);
2032
- return /* @__PURE__ */ c(
2033
- "div",
2034
- {
2035
- className: "group/reference-chip flex min-w-0 max-w-[min(100%,260px)] items-center gap-2 rounded-lg border border-primary/15 bg-primary/8 px-2.5 py-1.5 text-start text-xs shadow-sm transition hover:bg-primary/12",
2036
- title: e.excerpt,
2037
- children: [
2038
- /* @__PURE__ */ c(
2039
- "button",
2040
- {
2041
- type: "button",
2042
- onClick: s,
2043
- className: "flex min-w-0 flex-1 items-center gap-2 text-start",
2044
- children: [
2045
- /* @__PURE__ */ n(Re, { className: "size-3.5 shrink-0 text-primary" }),
2046
- /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ n("span", { className: "block truncate font-medium text-foreground/80", dir: "auto", children: e.excerpt }) })
2047
- ]
2048
- }
2049
- ),
2050
- /* @__PURE__ */ n(
2051
- "button",
2052
- {
2053
- type: "button",
2054
- onClick: (o) => {
2055
- o.stopPropagation(), t();
2056
- },
2057
- className: "ms-0.5 flex size-4 shrink-0 items-center justify-center rounded-full text-muted-foreground/60 transition hover:bg-destructive/15 hover:text-destructive",
2058
- "aria-label": `${r("remove_reference")}: ${e.excerpt}`,
2059
- title: r("remove_reference"),
2060
- children: /* @__PURE__ */ n(H, { className: "size-2.5" })
2061
- }
2062
- )
2063
- ]
2064
- }
2065
- );
2066
- }
2067
- const gt = ["byte", "kilobyte", "megabyte", "gigabyte"];
2068
- function Po(e, t) {
2069
- let s = e, r = 0;
2070
- for (; s >= 1024 && r < gt.length - 1; )
2071
- s /= 1024, r += 1;
2072
- return new Intl.NumberFormat(t, {
2073
- style: "unit",
2074
- unit: gt[r],
2075
- unitDisplay: "short",
2076
- maximumFractionDigits: r === 0 ? 0 : 1
2077
- }).format(s);
2078
- }
2079
- function Ao(e, { t, language: s, maxSize: r }) {
2080
- for (const { file: o, reason: i } of e)
2081
- i === "unsupported_type" ? K.error(t("chat:file_type_not_supported", { name: o.name })) : i === "too_large" && r !== void 0 && K.error(
2082
- t("chat:file_too_large", { name: o.name, size: Po(r, s) })
2083
- );
2084
- }
2085
- const Ro = {
2086
- mic_denied: "chat:voice_mic_denied",
2087
- mic_missing: "chat:voice_mic_missing",
2088
- mic_error: "chat:voice_mic_error",
2089
- no_speech: "chat:voice_no_speech",
2090
- time_limit: "chat:voice_time_limit",
2091
- failed: "chat:voice_failed"
2092
- };
2093
- function Mo(e, t) {
2094
- const s = t(Ro[e.kind]);
2095
- e.kind === "failed" ? K.error(s, { action: { label: t("chat:voice_retry"), onClick: e.retry } }) : e.kind === "no_speech" || e.kind === "time_limit" ? K(s) : K.error(s);
2096
- }
2097
- function sn({
2098
- enabled: e = !0
2099
- } = {}) {
2100
- const { t, i18n: s } = k(["chat"]), { dir: r } = $(), o = se((y) => y.welcome), i = typeof o?.greeting == "function", a = typeof o?.typingPrompts == "function", { user: l, firstName: d, isLoading: u } = yn({
2101
- enabled: e && (i || a)
2102
- }), m = o?.typingPrompts, h = typeof m == "function" ? m({ user: l, firstName: d, isLoading: u, t }) : m, b = t("welcome.typing_prompts", { returnObjects: !0, defaultValue: [] }), g = (h ? h.map((y) => t(y)) : Array.isArray(b) ? b : []).filter((y) => typeof y == "string" && y !== ""), f = o?.greeting, w = typeof f == "function" ? f({ user: l, firstName: d, isLoading: u, t }) : f ? nt(f, t, s, ["chat"]) : t("welcome.title"), x = o?.subtitle ? nt(o.subtitle, t, s, ["chat"]) : null;
2103
- return {
2104
- title: w,
2105
- subtitle: x,
2106
- typingMessages: g,
2107
- isRtl: r === "rtl",
2108
- icon: o?.icon
2109
- };
2110
- }
2111
- const Eo = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2112
- function Oo(e, t = {}) {
2113
- const { typingSpeed: s = 20, deletingSpeed: r = 15, pauseMs: o = 2e3, startDelayMs: i = 250 } = t, a = e.join("\0"), [l, d] = C(""), u = P(e);
2114
- return u.current = e, T(() => {
2115
- const m = u.current;
2116
- if (m.length === 0) {
2117
- d("");
2118
- return;
2119
- }
2120
- let h, b = 0, g = "typing", f = 0;
2121
- if (Eo()) {
2122
- d(m[0]);
2123
- const y = setInterval(() => {
2124
- b = (b + 1) % m.length, d(m[b]);
2125
- }, o);
2126
- return () => clearInterval(y);
2127
- }
2128
- const x = () => {
2129
- const y = m[b];
2130
- if (g === "typing") {
2131
- f++, d(y.slice(0, f)), f >= y.length ? (g = "pausing", h = setTimeout(x, o)) : h = setTimeout(x, s);
2132
- return;
2133
- }
2134
- if (g === "pausing") {
2135
- g = "deleting", h = setTimeout(x, r);
2136
- return;
2137
- }
2138
- f--, d(y.slice(0, Math.max(f, 0))), f <= 0 ? (g = "typing", b = (b + 1) % m.length, h = setTimeout(x, s)) : h = setTimeout(x, r);
2139
- };
2140
- return d(""), h = setTimeout(x, i), () => clearTimeout(h);
2141
- }, [a, s, r, o, i]), l;
2142
- }
2143
- function qo({ ...e }) {
2144
- return /* @__PURE__ */ n(ie.Root, { "data-slot": "dropdown-menu", ...e });
2145
- }
2146
- function jo({ ...e }) {
2147
- return /* @__PURE__ */ n(ie.Trigger, { "data-slot": "dropdown-menu-trigger", ...e });
2148
- }
2149
- function $o({
2150
- className: e,
2151
- sideOffset: t = 4,
2152
- ...s
2153
- }) {
2154
- const r = V();
2155
- return /* @__PURE__ */ n(ie.Portal, { container: r, children: /* @__PURE__ */ n(
2156
- ie.Content,
2157
- {
2158
- "data-slot": "dropdown-menu-content",
2159
- sideOffset: t,
2160
- className: p(
2161
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
2162
- e
2163
- ),
2164
- ...s
2165
- }
2166
- ) });
2167
- }
2168
- function Fo({
2169
- className: e,
2170
- inset: t,
2171
- variant: s = "default",
2172
- ...r
2173
- }) {
2174
- return /* @__PURE__ */ n(
2175
- ie.Item,
2176
- {
2177
- "data-slot": "dropdown-menu-item",
2178
- "data-inset": t,
2179
- "data-variant": s,
2180
- className: p(
2181
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
2182
- e
2183
- ),
2184
- ...r
2185
- }
2186
- );
2187
- }
2188
- function Lo({ open: e, onOpenChange: t, onCapture: s }) {
2189
- const r = V();
2190
- return /* @__PURE__ */ n(_.Root, { open: e, onOpenChange: t, children: /* @__PURE__ */ c(_.Portal, { container: r, children: [
2191
- /* @__PURE__ */ n(_.Overlay, { className: "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0" }),
2192
- /* @__PURE__ */ n(
2193
- _.Content,
2194
- {
2195
- "aria-describedby": void 0,
2196
- onOpenAutoFocus: (o) => {
2197
- o.preventDefault(), o.target.focus();
2198
- },
2199
- className: "fixed inset-0 z-50 m-auto h-fit w-[calc(100%-2rem)] max-w-2xl overflow-hidden rounded-3xl bg-black shadow-2xl ring-1 ring-white/10 outline-none duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
2200
- children: /* @__PURE__ */ n(
2201
- Bo,
2202
- {
2203
- onKeep: (o) => {
2204
- s(o), t(!1);
2205
- }
2206
- }
2207
- )
2208
- }
2209
- )
2210
- ] }) });
2211
- }
2212
- const ht = "grid size-10 place-items-center rounded-full bg-white/12 text-white backdrop-blur-md transition hover:bg-white/20 active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60", bt = "flex h-10 items-center gap-2 rounded-full px-4 text-sm font-medium transition active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60";
2213
- function Bo({ onKeep: e }) {
2214
- const { t } = k("chat"), s = P(null), [r, o] = C(), [i, a] = C(null), [l, d] = C([]), [u, m] = C(!1), [h, b] = C(!1), [g, f] = C(null);
2215
- T(() => {
2216
- let N = !1, z = null;
2217
- return navigator.mediaDevices.getUserMedia({
2218
- audio: !1,
2219
- video: {
2220
- ...r ? { deviceId: { exact: r } } : { facingMode: "user" },
2221
- width: { ideal: 1920 },
2222
- height: { ideal: 1080 }
2223
- }
2224
- }).then(async (S) => {
2225
- if (N) {
2226
- S.getTracks().forEach((D) => D.stop());
2227
- return;
2228
- }
2229
- z = S, a(S);
2230
- const O = await navigator.mediaDevices.enumerateDevices();
2231
- N || d(O.filter((D) => D.kind === "videoinput").map((D) => D.deviceId));
2232
- }).catch(() => {
2233
- N || b(!0);
2234
- }), () => {
2235
- N = !0, z?.getTracks().forEach((S) => S.stop());
2236
- };
2237
- }, [r]), T(() => {
2238
- s.current && (s.current.srcObject = i);
2239
- }, [i]), T(() => () => {
2240
- g && URL.revokeObjectURL(g.url);
2241
- }, [g]);
2242
- const w = i?.getVideoTracks()[0]?.getSettings(), x = w?.facingMode !== "environment", y = () => {
2243
- const N = l[(l.indexOf(w?.deviceId ?? "") + 1) % l.length];
2244
- !N || N === w?.deviceId || (a(null), m(!1), o(N));
2245
- }, v = () => {
2246
- const N = s.current;
2247
- if (!N?.videoWidth) return;
2248
- const z = document.createElement("canvas");
2249
- z.width = N.videoWidth, z.height = N.videoHeight, z.getContext("2d")?.drawImage(N, 0, 0), z.toBlob(
2250
- (S) => S && f({ blob: S, url: URL.createObjectURL(S) }),
2251
- "image/jpeg",
2252
- 0.92
2253
- );
2254
- }, I = () => {
2255
- if (!g) return;
2256
- const N = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[-:]/g, "").replace("T", "-");
2257
- e(new File([g.blob], `photo-${N}.jpg`, { type: "image/jpeg" }));
2258
- };
2259
- return /* @__PURE__ */ c("div", { className: "relative aspect-[3/4] max-h-[80dvh] w-full sm:aspect-video", children: [
2260
- /* @__PURE__ */ n(
2261
- "video",
2262
- {
2263
- ref: s,
2264
- autoPlay: !0,
2265
- playsInline: !0,
2266
- muted: !0,
2267
- onPlaying: () => m(!0),
2268
- className: p(
2269
- "absolute inset-0 size-full object-cover transition-opacity duration-500",
2270
- u ? "opacity-100" : "opacity-0",
2271
- x && "-scale-x-100"
2272
- )
2273
- }
2274
- ),
2275
- g && /* @__PURE__ */ n(
2276
- "img",
2277
- {
2278
- src: g.url,
2279
- alt: "",
2280
- className: "absolute inset-0 size-full object-cover animate-in fade-in-0 zoom-in-[1.02] duration-200"
2281
- }
2282
- ),
2283
- h ? /* @__PURE__ */ c("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center", children: [
2284
- /* @__PURE__ */ n("span", { className: "grid size-14 place-items-center rounded-full bg-white/10", children: /* @__PURE__ */ n(Kn, { className: "size-6 text-white/80" }) }),
2285
- /* @__PURE__ */ n("p", { className: "max-w-xs text-sm leading-relaxed text-white/70", children: t("camera_error") })
2286
- ] }) : !u && /* @__PURE__ */ n("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ n(zt, { className: "size-6 animate-spin text-white/50" }) }),
2287
- /* @__PURE__ */ c("div", { className: "absolute inset-x-0 top-0 flex items-center justify-between gap-4 bg-gradient-to-b from-black/55 to-transparent px-4 pt-4 pb-10", children: [
2288
- /* @__PURE__ */ n(_.Title, { className: "ps-1 text-sm font-medium text-white/90", children: t("camera_title") }),
2289
- /* @__PURE__ */ n(_.Close, { className: ht, "aria-label": t("camera_close"), children: /* @__PURE__ */ n(H, { className: "size-4.5" }) })
2290
- ] }),
2291
- !h && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 bottom-0 grid grid-cols-[1fr_auto_1fr] items-center gap-4 bg-gradient-to-t from-black/65 to-transparent px-5 pt-14 pb-5", children: g ? /* @__PURE__ */ c(R, { children: [
2292
- /* @__PURE__ */ c(
2293
- "button",
2294
- {
2295
- type: "button",
2296
- onClick: () => f(null),
2297
- className: p(
2298
- bt,
2299
- "justify-self-start bg-white/12 text-white backdrop-blur-md hover:bg-white/20"
2300
- ),
2301
- children: [
2302
- /* @__PURE__ */ n(Jn, { className: "size-4" }),
2303
- t("camera_retake")
2304
- ]
2305
- }
2306
- ),
2307
- /* @__PURE__ */ n("span", {}),
2308
- /* @__PURE__ */ c(
2309
- "button",
2310
- {
2311
- type: "button",
2312
- onClick: I,
2313
- className: p(
2314
- bt,
2315
- "justify-self-end bg-white text-black shadow-lg hover:bg-white/90"
2316
- ),
2317
- children: [
2318
- /* @__PURE__ */ n(ce, { className: "size-4" }),
2319
- t("camera_use")
2320
- ]
2321
- }
2322
- )
2323
- ] }) : /* @__PURE__ */ c(R, { children: [
2324
- /* @__PURE__ */ n("span", {}),
2325
- /* @__PURE__ */ n(
2326
- "button",
2327
- {
2328
- type: "button",
2329
- onClick: v,
2330
- disabled: !u,
2331
- "aria-label": t("camera_capture"),
2332
- className: "group grid size-[4.25rem] place-items-center rounded-full border-[3px] border-white/90 transition-opacity focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-white/40 disabled:opacity-40",
2333
- children: /* @__PURE__ */ n("span", { className: "size-[3.375rem] rounded-full bg-white transition-transform duration-150 ease-out group-hover:scale-[0.94] group-active:scale-[0.82]" })
2334
- }
2335
- ),
2336
- l.length > 1 ? /* @__PURE__ */ n(
2337
- "button",
2338
- {
2339
- type: "button",
2340
- onClick: y,
2341
- disabled: !u,
2342
- "aria-label": t("camera_switch"),
2343
- className: p(ht, "size-11 justify-self-end disabled:opacity-40"),
2344
- children: /* @__PURE__ */ n(Yn, { className: "size-5" })
2345
- }
2346
- ) : /* @__PURE__ */ n("span", {})
2347
- ] }) })
2348
- ] });
2349
- }
2350
- const rn = {
2351
- camera: {
2352
- icon: ts,
2353
- label: "attach_camera"
2354
- },
2355
- gallery: {
2356
- icon: es,
2357
- label: "attach_gallery"
2358
- },
2359
- files: {
2360
- icon: Zn,
2361
- label: "attach_files"
2362
- }
2363
- };
2364
- function Uo() {
2365
- return window.matchMedia("(pointer: coarse)").matches ? "native" : "mediaDevices" in navigator ? "webcam" : null;
2366
- }
2367
- function Ho({ disabled: e, addFiles: t, isMobile: s }) {
2368
- const { t: r } = k("chat"), { dir: o } = $(), [i, a] = C(!1), [l, d] = C(!1), [u] = C(Uo), m = {
2369
- camera: P(null),
2370
- gallery: P(null),
2371
- files: P(null)
2372
- }, h = De()?.attachments.types ?? [], b = h.filter((v) => v.startsWith("image/")), g = b.length ? [...u ? ["camera"] : [], "gallery", "files"] : ["files"], f = (v) => {
2373
- v === "camera" && u === "webcam" ? d(!0) : m[v].current?.click();
2374
- }, w = (v) => {
2375
- v.target.files && t(Array.from(v.target.files)), v.target.value = "";
2376
- }, x = r("attach"), y = /* @__PURE__ */ n(
2377
- nn,
2378
- {
2379
- variant: "ghost",
2380
- disabled: e,
2381
- "aria-label": x,
2382
- onClick: g.length === 1 ? () => f("files") : s ? () => a(!0) : void 0,
2383
- className: p(i && "bg-accent/60 text-foreground transition-colors active:scale-100"),
2384
- children: /* @__PURE__ */ n(
2385
- Xn,
2386
- {
2387
- className: p(
2388
- "size-6 transition-transform duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
2389
- i && "rotate-45"
2390
- )
2391
- }
2392
- )
2393
- }
2394
- );
2395
- return /* @__PURE__ */ c(R, { children: [
2396
- /* @__PURE__ */ n(
2397
- "input",
2398
- {
2399
- type: "file",
2400
- ref: m.camera,
2401
- onChange: w,
2402
- accept: b.join(","),
2403
- capture: "environment",
2404
- className: "hidden"
2405
- }
2406
- ),
2407
- /* @__PURE__ */ n(
2408
- "input",
2409
- {
2410
- type: "file",
2411
- ref: m.gallery,
2412
- onChange: w,
2413
- accept: b.join(","),
2414
- multiple: !0,
2415
- className: "hidden"
2416
- }
2417
- ),
2418
- /* @__PURE__ */ n(
2419
- "input",
2420
- {
2421
- type: "file",
2422
- ref: m.files,
2423
- onChange: w,
2424
- accept: h.join(","),
2425
- multiple: !0,
2426
- className: "hidden"
2427
- }
2428
- ),
2429
- g.length === 1 ? /* @__PURE__ */ c(Ve, { children: [
2430
- /* @__PURE__ */ n(Qe, { asChild: !0, children: y }),
2431
- /* @__PURE__ */ n(We, { children: x })
2432
- ] }) : s ? /* @__PURE__ */ c(R, { children: [
2433
- y,
2434
- /* @__PURE__ */ n(
2435
- Vo,
2436
- {
2437
- open: i,
2438
- onOpenChange: a,
2439
- title: x,
2440
- sources: g,
2441
- onPick: (v) => {
2442
- f(v), a(!1);
2443
- }
2444
- }
2445
- )
2446
- ] }) : (
2447
- // Not modal: a modal menu that hands off to the camera dialog leaves the
2448
- // page unclickable once both have closed. Given the language's direction
2449
- // because Radix doesn't read the document's: it would lay the menu out
2450
- // left-to-right, and `align="start"` would hug the left edge in RTL too.
2451
- /* @__PURE__ */ c(qo, { dir: o, modal: !1, open: i, onOpenChange: a, children: [
2452
- /* @__PURE__ */ n(jo, { asChild: !0, children: y }),
2453
- /* @__PURE__ */ n(
2454
- $o,
2455
- {
2456
- side: "bottom",
2457
- align: "start",
2458
- sideOffset: 10,
2459
- className: "min-w-0 rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl",
2460
- onCloseAutoFocus: (v) => l && v.preventDefault(),
2461
- children: g.map((v) => {
2462
- const { icon: I, label: N } = rn[v];
2463
- return /* @__PURE__ */ c(
2464
- Fo,
2465
- {
2466
- onSelect: () => f(v),
2467
- className: "cursor-pointer gap-3 rounded-xl py-1.5 ps-1.5 pe-4 font-medium",
2468
- children: [
2469
- /* @__PURE__ */ n("span", { className: "grid size-8 place-items-center rounded-lg bg-foreground/[0.06] text-foreground/75", children: /* @__PURE__ */ n(I, { className: "size-4 text-current" }) }),
2470
- r(N)
2471
- ]
2472
- },
2473
- v
2474
- );
2475
- })
2476
- }
2477
- )
2478
- ] })
2479
- ),
2480
- u === "webcam" && /* @__PURE__ */ n(
2481
- Lo,
2482
- {
2483
- open: l,
2484
- onOpenChange: d,
2485
- onCapture: (v) => t([v])
2486
- }
2487
- )
2488
- ] });
2489
- }
2490
- function Vo({ open: e, onOpenChange: t, title: s, sources: r, onPick: o }) {
2491
- const i = V();
2492
- return /* @__PURE__ */ n(_.Root, { open: e, onOpenChange: t, children: /* @__PURE__ */ c(_.Portal, { container: i, children: [
2493
- /* @__PURE__ */ n(_.Overlay, { className: "fixed inset-0 z-50 bg-overlay data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0" }),
2494
- /* @__PURE__ */ n(
2495
- _.Content,
2496
- {
2497
- "aria-describedby": void 0,
2498
- onOpenAutoFocus: (a) => a.preventDefault(),
2499
- className: "fixed inset-x-0 bottom-0 z-50 outline-none duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom",
2500
- children: /* @__PURE__ */ n(Wo, { title: s, onDismiss: () => t(!1), children: /* @__PURE__ */ n("div", { className: p("grid gap-3", r.length === 3 ? "grid-cols-3" : "grid-cols-2"), children: r.map((a, l) => /* @__PURE__ */ n(Go, { source: a, index: l, onPick: o }, a)) }) })
2501
- }
2502
- )
2503
- ] }) });
2504
- }
2505
- const Qo = 72;
2506
- function Wo({
2507
- title: e,
2508
- onDismiss: t,
2509
- children: s
2510
- }) {
2511
- const [r, o] = C(0), [i, a] = C(!1), l = P(0), d = (h) => {
2512
- l.current = h.clientY, a(!0), h.currentTarget.setPointerCapture(h.pointerId);
2513
- }, u = (h) => {
2514
- if (!i) return;
2515
- const b = h.clientY - l.current;
2516
- o(b > 0 ? b : -Math.sqrt(-b) * 2);
2517
- }, m = () => {
2518
- a(!1), r > Qo ? t() : o(0);
2519
- };
2520
- return /* @__PURE__ */ c(
2521
- "div",
2522
- {
2523
- className: "mx-auto w-full max-w-lg rounded-t-[1.75rem] border border-b-0 border-border/60 bg-popover px-4 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-[0_-12px_48px_-16px_rgb(0_0_0/0.3)]",
2524
- style: {
2525
- transform: r ? `translateY(${r}px)` : void 0,
2526
- transition: i ? "none" : "transform 250ms cubic-bezier(0.32,0.72,0,1)"
2527
- },
2528
- children: [
2529
- /* @__PURE__ */ c(
2530
- "div",
2531
- {
2532
- className: "cursor-grab touch-none pt-2.5 pb-5 select-none active:cursor-grabbing",
2533
- onPointerDown: d,
2534
- onPointerMove: u,
2535
- onPointerUp: m,
2536
- onPointerCancel: m,
2537
- children: [
2538
- /* @__PURE__ */ n("div", { className: "mx-auto h-1.5 w-10 rounded-full bg-muted-foreground/25" }),
2539
- /* @__PURE__ */ n(_.Title, { className: "mt-4 text-center text-base font-semibold text-foreground", children: e })
2540
- ]
2541
- }
2542
- ),
2543
- s
2544
- ]
2545
- }
2546
- );
2547
- }
2548
- function Go({
2549
- source: e,
2550
- index: t,
2551
- onPick: s
2552
- }) {
2553
- const { t: r } = k("chat"), { icon: o, label: i } = rn[e];
2554
- return /* @__PURE__ */ c(
2555
- "button",
2556
- {
2557
- type: "button",
2558
- onClick: () => s(e),
2559
- className: "flex flex-col items-center gap-2.5 rounded-2xl bg-muted/45 px-2 pt-4 pb-3.5 outline-none transition-[transform,background-color] duration-150 animate-in fade-in-0 slide-in-from-bottom-3 [-webkit-tap-highlight-color:transparent] focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.96] active:bg-muted/80",
2560
- style: {
2561
- animationDuration: "400ms",
2562
- animationDelay: `${90 + t * 45}ms`,
2563
- animationFillMode: "both"
2564
- },
2565
- children: [
2566
- /* @__PURE__ */ n("span", { className: "grid size-14 place-items-center rounded-full bg-background text-foreground/80 shadow-sm ring-1 ring-border/60", children: /* @__PURE__ */ n(o, { className: "size-6", strokeWidth: 1.75 }) }),
2567
- /* @__PURE__ */ n("span", { className: "text-sm font-medium text-foreground/85", children: r(i) })
2568
- ]
2569
- }
2570
- );
2571
- }
2572
- function Ko() {
2573
- const { t: e } = k("chat"), t = Nt().status === "starting", s = e("voice_dictate");
2574
- return /* @__PURE__ */ c(Ve, { children: [
2575
- /* @__PURE__ */ n(Qe, { asChild: !0, children: /* @__PURE__ */ n(G.Voice, { asChild: !0, children: /* @__PURE__ */ n(nn, { "aria-label": s, children: t ? /* @__PURE__ */ n(zt, { className: "size-5 animate-spin" }) : /* @__PURE__ */ n(ns, { className: "size-5" }) }) }) }),
2576
- /* @__PURE__ */ n(We, { children: s })
2577
- ] });
2578
- }
2579
- const Jo = Ae(
2580
- () => import("./VoiceInput-B3e7emmb.js").then((e) => ({ default: e.VoiceRecordingBar }))
2581
- ), Yo = Ae(
2582
- () => import("./VoiceInput-B3e7emmb.js").then((e) => ({ default: e.VoiceRecordingControls }))
2583
- );
2584
- function Xo({
2585
- onSend: e,
2586
- status: t,
2587
- isErrorVisible: s,
2588
- threadId: r,
2589
- newChat: o,
2590
- className: i
2591
- }) {
2592
- const { t: a, i18n: l } = k(["chat", "maintenance"]), d = se((M) => M.composer), u = De(), { ChoiceQuestionDock: m, ComposerFooter: h, composerTools: b } = Q(), { blocksChat: g } = wn(), {
2593
- question: f,
2594
- disabled: w,
2595
- dismissed: x,
2596
- setDismissed: y,
2597
- answer: v
2598
- } = he(), I = x ? null : f, { typingMessages: N } = sn({ enabled: !!o }), z = Oo(o ? N : []), S = !!o && N.length > 0, O = d?.placeholder ? a(d.placeholder) : a("input_placeholder"), D = g ? a("maintenance:composer_placeholder") : I?.allowCustom !== !1 && I ? a("choice_custom_placeholder") : S ? z : O, j = zo(), W = t === "streaming" || t === "submitted", cn = Nn("voice_input", { enabled: !!d?.voice?.enabled }), dn = !!d?.voice?.enabled && cn === !0, Ke = u?.attachments, Je = (d?.attachments?.enabled ?? !1) && !!Ke, un = E(
2599
- () => [...b ?? []].sort((M, re) => (M.order ?? 0) - (re.order ?? 0)),
2600
- [b]
2601
- ), { draft: mn, setDraft: pn, isClosed: Ye } = Pe(), Xe = P(null), Ze = {
2602
- newChat: !!o,
2603
- threadId: r,
2604
- status: t,
2605
- disabled: W || Ye,
2606
- draft: mn,
2607
- send: (M) => {
2608
- W || Ye || !M.trim() || e({ text: M });
2609
- },
2610
- setDraft: (M) => {
2611
- gs(() => pn(M));
2612
- const re = Xe.current;
2613
- re && (re.focus(), re.setSelectionRange(M.length, M.length));
2614
- }
2615
- };
2616
- return /* @__PURE__ */ n("div", { className: p("shrink-0 px-4 pb-5 pt-2 md:px-6 md:pb-6 w-full", i), children: /* @__PURE__ */ c("div", { className: "max-w-[50rem] mx-auto w-full", children: [
2617
- I && /* @__PURE__ */ n(
2618
- m,
2619
- {
2620
- question: I,
2621
- disabled: w || W || g,
2622
- onDismiss: () => y(!0),
2623
- onAnswer: v
2624
- }
2625
- ),
2626
- /* @__PURE__ */ n("div", { className: "relative z-10", children: /* @__PURE__ */ n(
2627
- ko,
2628
- {
2629
- className: "relative",
2630
- onSend: e,
2631
- allowFiles: Je,
2632
- maxVoiceDuration: d?.voice?.maxDuration,
2633
- onFilesRejected: (M) => Ao(M, {
2634
- t: a,
2635
- language: l.language,
2636
- maxSize: Ke?.max_size
2637
- }),
2638
- onVoiceNotice: (M) => Mo(M, a),
2639
- children: /* @__PURE__ */ n(
2640
- Zo,
2641
- {
2642
- textareaRef: Xe,
2643
- slotProps: Ze,
2644
- isErrorVisible: s,
2645
- placeholder: D,
2646
- isMobile: j,
2647
- attachEnabled: Je,
2648
- voiceEnabled: dn,
2649
- tools: un
2650
- }
2651
- )
2652
- }
2653
- ) }),
2654
- h && /* @__PURE__ */ n(pe, { fallback: null, resetKeys: [r], children: /* @__PURE__ */ n(h, { ...Ze }) })
2655
- ] }) });
2656
- }
2657
- function Zo({
2658
- textareaRef: e,
2659
- slotProps: t,
2660
- isErrorVisible: s,
2661
- placeholder: r,
2662
- isMobile: o,
2663
- attachEnabled: i,
2664
- voiceEnabled: a,
2665
- tools: l
2666
- }) {
2667
- const { t: d, i18n: u } = k(["chat"]), m = se((D) => D.composer?.maxLength), { draft: h, files: b, references: g, isBusy: f } = Pe(), { addFiles: w, dragging: x } = kn(), y = Nt(), { threadId: v, status: I } = t, N = !!m && h.length >= m * 0.9;
2668
- T(() => {
2669
- o || e.current?.focus();
2670
- }, [v, o, e]);
2671
- const z = g.length, S = P(z);
2672
- T(() => {
2673
- z > S.current && !o && e.current?.focus(), S.current = z;
2674
- }, [z, o, e]);
2675
- const O = { ...t, isMobile: o, addFiles: w };
2676
- return /* @__PURE__ */ c(R, { children: [
2677
- x && /* @__PURE__ */ n(
2678
- "div",
2679
- {
2680
- className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-lg border-2 border-dashed border-primary bg-background/90 text-sm font-medium text-foreground",
2681
- "aria-hidden": !0,
2682
- children: d("drop_files")
2683
- }
2684
- ),
2685
- i && !y.active && // Matches the toolbar's bottom padding, so the + lines up with the send button.
2686
- /* @__PURE__ */ n("div", { className: "-ms-1 -me-1 flex shrink-0 items-center pb-1", children: /* @__PURE__ */ n(pe, { fallback: null, resetKeys: [v], children: /* @__PURE__ */ n(Ho, { ...O }) }) }),
2687
- /* @__PURE__ */ c("div", { className: "flex flex-col flex-1 gap-2", children: [
2688
- g.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(G.References, { component: To }) }),
2689
- b.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(G.Attachments, { component: ea }) }),
2690
- y.active ? /* @__PURE__ */ n(Ce, { fallback: null, children: /* @__PURE__ */ n(Jo, {}) }) : /* @__PURE__ */ n(
2691
- Co,
2692
- {
2693
- ref: e,
2694
- autoFocus: !o,
2695
- placeholder: r,
2696
- maxLength: m,
2697
- "aria-label": d("input_placeholder")
2698
- }
2699
- )
2700
- ] }),
2701
- /* @__PURE__ */ n(_o, { children: y.active ? /* @__PURE__ */ n(Ce, { fallback: null, children: /* @__PURE__ */ n(Yo, {}) }) : /* @__PURE__ */ c(R, { children: [
2702
- N && /* @__PURE__ */ c(
2703
- "span",
2704
- {
2705
- className: p(
2706
- "px-1 text-xs tabular-nums text-muted-foreground",
2707
- h.length >= m && "text-destructive"
2708
- ),
2709
- "aria-live": "polite",
2710
- children: [
2711
- h.length.toLocaleString(u.language),
2712
- "/",
2713
- m.toLocaleString(u.language)
2714
- ]
2715
- }
2716
- ),
2717
- /* @__PURE__ */ c(So, { children: [
2718
- l.map(({ id: D, component: j }) => (
2719
- // Contained so a throwing tool can't take the composer or the other tools with it.
2720
- /* @__PURE__ */ n(pe, { fallback: null, resetKeys: [v], children: /* @__PURE__ */ n(j, { ...O }) }, D)
2721
- )),
2722
- a && /* @__PURE__ */ n(Ko, {})
2723
- ] }),
2724
- f ? /* @__PURE__ */ n(G.Stop, { asChild: !0, children: /* @__PURE__ */ n(pt, { status: I === "submitted" ? "submitted" : "streaming" }) }) : /* @__PURE__ */ n(G.Send, { asChild: !0, children: /* @__PURE__ */ n(pt, { status: s ? "error" : "ready" }) })
2725
- ] }) })
2726
- ] });
2727
- }
2728
- function ea({ file: e, remove: t, retry: s }) {
2729
- return /* @__PURE__ */ n(Io, { entry: e, onRemove: t, onRetry: s });
2730
- }
2731
- const ta = (e) => {
2732
- const { title: t, subtitle: s, isRtl: r, icon: o } = sn();
2733
- return /* @__PURE__ */ c(
2734
- "div",
2735
- {
2736
- dir: r ? "rtl" : "ltr",
2737
- className: "flex flex-col items-center text-center px-6 animate-in fade-in duration-700 ease-out",
2738
- children: [
2739
- o && /* @__PURE__ */ n("div", { className: "mb-8 flex items-center justify-center", children: /* @__PURE__ */ n("div", { className: "size-12 md:size-16 rounded-xl bg-secondary flex items-center justify-center border border-border", children: typeof o == "function" ? /* @__PURE__ */ n(o, { className: "size-6 md:size-8 text-primary opacity-80" }) : o }) }),
2740
- (t || s) && /* @__PURE__ */ c("div", { className: "space-y-3 max-w-xl mx-auto", children: [
2741
- t && /* @__PURE__ */ n("h1", { className: "text-2xl md:text-3xl font-black tracking-tight leading-tight text-foreground", children: t }),
2742
- s && /* @__PURE__ */ n("p", { className: "text-muted-foreground text-base md:text-lg font-medium max-w-md mx-auto leading-relaxed opacity-85 dark:opacity-70", children: s })
2743
- ] })
2744
- ]
2745
- }
2746
- );
2747
- };
2748
- function na({
2749
- question: e,
2750
- disabled: t,
2751
- onDismiss: s,
2752
- onAnswer: r,
2753
- className: o
2754
- }) {
2755
- const { t: i } = k(["chat"]), { dir: a } = $(), { reportDockHeight: l } = he(), d = P(null), [u, m] = C(null);
2756
- T(() => {
2757
- const f = d.current;
2758
- if (!f) return;
2759
- const w = () => l(f.offsetHeight);
2760
- w();
2761
- const x = typeof ResizeObserver > "u" ? null : new ResizeObserver(w);
2762
- return x?.observe(f), () => {
2763
- x?.disconnect(), l(0);
2764
- };
2765
- }, [l]);
2766
- const h = F(e.question, a), b = t || !r || u !== null, g = async (f) => {
2767
- if (!b) {
2768
- m(f);
2769
- try {
2770
- await r?.(f);
2771
- } catch {
2772
- m(null);
2773
- }
2774
- }
2775
- };
2776
- return /* @__PURE__ */ c(
2777
- "div",
2778
- {
2779
- ref: d,
2780
- dir: h,
2781
- className: p(
2782
- // `-mb-3` slides the bottom edge under the composer, which paints over
2783
- // it (see the `z-10` wrapper there) so the joint reads as one surface.
2784
- "animate-choice-dock relative z-0 -mb-3 rounded-t-lg bg-surface px-2 pb-6 pt-4",
2785
- o
2786
- ),
2787
- children: [
2788
- /* @__PURE__ */ c("div", { className: "flex items-start gap-2 px-3", children: [
2789
- /* @__PURE__ */ n("p", { className: "min-w-0 flex-1 text-base leading-snug text-foreground", children: e.question }),
2790
- s && /* @__PURE__ */ n(
2791
- "button",
2792
- {
2793
- type: "button",
2794
- onClick: s,
2795
- "aria-label": i("choice_dismiss"),
2796
- title: i("choice_dismiss"),
2797
- className: "-me-1 -mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground/70 outline-none transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
2798
- children: /* @__PURE__ */ n(H, { className: "size-4" })
2799
- }
2800
- )
2801
- ] }),
2802
- /* @__PURE__ */ n(
2803
- Zt,
2804
- {
2805
- choices: e.choices,
2806
- selected: u,
2807
- disabled: b,
2808
- dir: h,
2809
- onSelect: (f) => {
2810
- g(f);
2811
- },
2812
- className: "custom-scrollbar mt-3 max-h-[40vh] overflow-y-auto"
2813
- }
2814
- )
2815
- ]
2816
- }
2817
- );
2818
- }
2819
- function sa({ className: e, children: t, ...s }) {
2820
- return /* @__PURE__ */ c(ae.Root, { "data-slot": "scroll-area", className: p("relative", e), ...s, children: [
2821
- /* @__PURE__ */ n(
2822
- ae.Viewport,
2823
- {
2824
- "data-slot": "scroll-area-viewport",
2825
- className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
2826
- children: t
2827
- }
2828
- ),
2829
- /* @__PURE__ */ n(on, {}),
2830
- /* @__PURE__ */ n(ae.Corner, {})
2831
- ] });
2832
- }
2833
- function on({
2834
- className: e,
2835
- orientation: t = "vertical",
2836
- ...s
2837
- }) {
2838
- return /* @__PURE__ */ n(
2839
- ae.ScrollAreaScrollbar,
2840
- {
2841
- "data-slot": "scroll-area-scrollbar",
2842
- orientation: t,
2843
- className: p(
2844
- "flex touch-none p-px transition-colors select-none",
2845
- t === "vertical" && "h-full w-2.5 border-s border-s-transparent",
2846
- t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
2847
- e
2848
- ),
2849
- ...s,
2850
- children: /* @__PURE__ */ n(
2851
- ae.ScrollAreaThumb,
2852
- {
2853
- "data-slot": "scroll-area-thumb",
2854
- className: "bg-border relative flex-1 rounded-full"
2855
- }
2856
- )
2857
- }
2858
- );
2859
- }
2860
- const ra = ({ className: e, children: t, ...s }) => {
2861
- const { dir: r } = $();
2862
- return /* @__PURE__ */ c(sa, { className: "w-full overflow-x-auto whitespace-nowrap", dir: r, ...s, children: [
2863
- /* @__PURE__ */ n("div", { className: p("flex w-max flex-nowrap items-center gap-2", e), children: t }),
2864
- /* @__PURE__ */ n(on, { className: "hidden", orientation: "horizontal" })
2865
- ] });
2866
- }, oa = ({
2867
- suggestion: e,
2868
- onClick: t,
2869
- className: s,
2870
- variant: r = "outline",
2871
- size: o = "sm",
2872
- children: i,
2873
- ...a
2874
- }) => {
2875
- const l = () => {
2876
- t?.(e);
2877
- };
2878
- return /* @__PURE__ */ n(
2879
- L,
2880
- {
2881
- className: p("cursor-pointer rounded-full px-4", s),
2882
- onClick: l,
2883
- size: o,
2884
- type: "button",
2885
- variant: r,
2886
- ...a,
2887
- children: i ?? e
2888
- }
2889
- );
2890
- };
2891
- function aa({
2892
- suggestions: e,
2893
- disabled: t = !1,
2894
- onSelect: s,
2895
- className: r
2896
- }) {
2897
- const { t: o } = k("chat"), [i, a] = C(!1), l = async (d) => {
2898
- if (!(t || i || !s)) {
2899
- a(!0);
2900
- try {
2901
- await s(d);
2902
- } catch {
2903
- a(!1);
2904
- }
2905
- }
2906
- };
2907
- return /* @__PURE__ */ n("div", { className: p("mx-auto w-full max-w-4xl py-2", r), children: /* @__PURE__ */ n(ra, { className: "pb-1", "aria-label": o("follow_up_suggestions"), children: e.map((d) => /* @__PURE__ */ n(
2908
- oa,
2909
- {
2910
- suggestion: d,
2911
- onClick: (u) => {
2912
- l(u);
2913
- },
2914
- disabled: t || i || !s,
2915
- dir: F(d),
2916
- className: "max-w-[min(32rem,80vw)] shrink-0"
2917
- },
2918
- d
2919
- )) }) });
2920
- }
2921
- function ia({ error: e }) {
2922
- const { t } = k(["chat"]), s = $().dir === "rtl";
2923
- return /* @__PURE__ */ c(
2924
- "div",
2925
- {
2926
- className: "flex w-full items-start gap-3 px-4 py-3.5 rounded-xl bg-destructive/8 border border-destructive/15 border-s-2 border-s-destructive/60",
2927
- dir: s ? "rtl" : "ltr",
2928
- children: [
2929
- /* @__PURE__ */ n("div", { className: "size-1.5 rounded-full bg-destructive mt-2 shrink-0" }),
2930
- /* @__PURE__ */ c("div", { className: "text-sm text-destructive/90 leading-relaxed flex-1 text-start", children: [
2931
- /* @__PURE__ */ n("span", { className: "font-semibold", children: t("error") }),
2932
- " ",
2933
- e.message
2934
- ] })
2935
- ]
2936
- }
2937
- );
2938
- }
2939
- const Ya = ["messages", "tokens", "model_requests", "cost"], Xa = [
2940
- "minute",
2941
- "hour",
2942
- "day",
2943
- "week",
2944
- "month",
2945
- "subscription"
2946
- ];
2947
- function la(e, t) {
2948
- return e(`quota:meters.${t}`, { defaultValue: t.replace(/_/g, " ") });
2949
- }
2950
- function Za(e, t, s) {
2951
- return e === "cost" ? new Intl.NumberFormat(s, { maximumFractionDigits: 4 }).format(t / 1e6) : e === "tokens" && t >= 1e4 ? new Intl.NumberFormat(s, {
2952
- notation: "compact",
2953
- maximumFractionDigits: 1
2954
- }).format(t) : new Intl.NumberFormat(s).format(t);
2955
- }
2956
- function vt(e, t) {
2957
- if (t.per === "subscription") return e("quota:window.whole_plan");
2958
- const s = t.every ?? 1;
2959
- return s === 1 ? e(`quota:window.per_${t.per}`) : e("quota:window.every", { count: s, unit: e(`quota:units.${t.per}`) });
2960
- }
2961
- function ei(e, t) {
2962
- return t ? e(`quota:duration.${t.per}`, { count: t.every ?? 1 }) : e("quota:duration.until_canceled");
2963
- }
2964
- function ca(e, t) {
2965
- if (!e) return "";
2966
- const s = new Date(e);
2967
- return Number.isNaN(s.getTime()) ? e : fs(t, {
2968
- year: "numeric",
2969
- month: "short",
2970
- day: "numeric",
2971
- hour: "2-digit",
2972
- minute: "2-digit"
2973
- }).format(s);
2974
- }
2975
- function da(e) {
2976
- let t = null, s = 1 / 0;
2977
- for (const r of e) {
2978
- const o = Ge(r.remaining, r.amount);
2979
- o < s && (t = r, s = o);
2980
- }
2981
- return t;
2982
- }
2983
- function Ge(e, t) {
2984
- return t <= 0 ? 0 : Math.max(0, Math.min(100, e / t * 100));
2985
- }
2986
- function an(e, t) {
2987
- let s = Math.round(e);
2988
- return e > 0 && s === 0 && (s = 1), e < 100 && s === 100 && (s = 99), new Intl.NumberFormat(t, { style: "percent" }).format(s / 100);
2989
- }
2990
- function ln(e) {
2991
- return e > 60 ? "bg-success" : e > 20 ? "bg-warning" : "bg-destructive";
2992
- }
2993
- function ua(e) {
2994
- return e > 60 ? "border-success/70" : e > 20 ? "border-warning/70" : "border-destructive/70";
2995
- }
2996
- function ma({ ...e }) {
2997
- return /* @__PURE__ */ n(me.Root, { "data-slot": "hover-card", ...e });
2998
- }
2999
- function pa({ ...e }) {
3000
- return /* @__PURE__ */ n(me.Trigger, { "data-slot": "hover-card-trigger", ...e });
3001
- }
3002
- function fa({
3003
- className: e,
3004
- align: t = "center",
3005
- sideOffset: s = 4,
3006
- ...r
3007
- }) {
3008
- const o = V();
3009
- return /* @__PURE__ */ n(me.Portal, { "data-slot": "hover-card-portal", container: o, children: /* @__PURE__ */ n(
3010
- me.Content,
3011
- {
3012
- "data-slot": "hover-card-content",
3013
- align: t,
3014
- sideOffset: s,
3015
- className: p(
3016
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
3017
- e
3018
- ),
3019
- ...r
3020
- }
3021
- ) });
3022
- }
3023
- function xt({ label: e, remaining: t, amount: s }) {
3024
- const { t: r, i18n: o } = k(["quota"]), i = Ge(t, s);
3025
- return /* @__PURE__ */ c("div", { className: "space-y-1", children: [
3026
- /* @__PURE__ */ c("div", { className: "flex items-baseline justify-between gap-3", children: [
3027
- /* @__PURE__ */ n("span", { className: "truncate text-foreground/80", children: e }),
3028
- /* @__PURE__ */ n("span", { className: "shrink-0 tabular-nums font-medium text-foreground", children: r("quota:percent_left", { percent: an(i, o.language) }) })
3029
- ] }),
3030
- /* @__PURE__ */ n("div", { className: "h-1 w-full rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ n(
3031
- "div",
3032
- {
3033
- className: p("h-full rounded-full transition-all duration-700", ln(i)),
3034
- style: { width: `${i}%` }
3035
- }
3036
- ) })
3037
- ] });
3038
- }
3039
- function ga({ className: e, details: t = !0 }) {
3040
- const { t: s, i18n: r } = k(["quota"]), { data: o } = Cn(), [i, a] = C(!1);
3041
- if (!o) return null;
3042
- let l, d, u;
3043
- if (o.kind === "plan") {
3044
- const x = da(o.windows);
3045
- if (!x) return null;
3046
- ({ remaining: l, amount: d } = x), u = `${la(s, x.meter)} ${vt(s, x)}`;
3047
- } else if (o.kind === "credits" && o.credits)
3048
- ({ remaining: l } = o.credits), d = o.credits.granted, u = s("quota:credits");
3049
- else
3050
- return null;
3051
- const m = Ge(l, d), h = o.kind === "credits" ? s("quota:credits") : o.plan?.name ?? s("quota:plan"), b = an(m, r.language), g = l <= 0, f = p(
3052
- "flex items-center gap-2 h-8 ps-2.5 pe-3 rounded-full border text-xs font-medium tabular-nums transition-colors",
3053
- g ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-border/60 bg-background/40 text-muted-foreground",
3054
- e
3055
- ), w = /* @__PURE__ */ c(R, { children: [
3056
- /* @__PURE__ */ n(
3057
- "span",
3058
- {
3059
- className: p(
3060
- "block h-2 w-8 md:w-12 rounded-full border overflow-hidden bg-muted/40 transition-colors duration-700",
3061
- ua(m)
3062
- ),
3063
- role: "meter",
3064
- "aria-label": s("quota:usage_label", { label: u, percent: b }),
3065
- "aria-valuemin": 0,
3066
- "aria-valuemax": d,
3067
- "aria-valuenow": l,
3068
- children: /* @__PURE__ */ n(
3069
- "span",
3070
- {
3071
- className: p("block h-full transition-all duration-700", ln(m)),
3072
- style: { width: `${m}%` }
3073
- }
3074
- )
3075
- }
3076
- ),
3077
- /* @__PURE__ */ n("span", { "aria-hidden": !0, children: b })
3078
- ] });
3079
- return t ? /* @__PURE__ */ c(ma, { open: i, onOpenChange: a, openDelay: 150, closeDelay: 100, children: [
3080
- /* @__PURE__ */ n(pa, { asChild: !0, children: /* @__PURE__ */ n(
3081
- "button",
3082
- {
3083
- type: "button",
3084
- onClick: () => a((x) => !x),
3085
- className: p(
3086
- f,
3087
- g ? "hover:bg-destructive/15" : "hover:bg-accent/60 hover:text-foreground"
3088
- ),
3089
- children: w
3090
- }
3091
- ) }),
3092
- /* @__PURE__ */ c(fa, { align: "end", sideOffset: 6, className: "w-64 p-3 text-xs space-y-3", children: [
3093
- /* @__PURE__ */ c("div", { className: "flex items-baseline justify-between gap-2", children: [
3094
- /* @__PURE__ */ n("span", { className: "font-semibold text-foreground truncate", children: h }),
3095
- o.ends_at && /* @__PURE__ */ n("span", { className: "shrink-0 text-xs text-muted-foreground", children: s("quota:ends_at", { datetime: ca(o.ends_at, r.language) }) })
3096
- ] }),
3097
- o.kind === "plan" ? o.windows.map((x) => /* @__PURE__ */ n(
3098
- xt,
3099
- {
3100
- label: vt(s, x),
3101
- amount: x.amount,
3102
- remaining: x.remaining
3103
- },
3104
- x.key
3105
- )) : o.credits && /* @__PURE__ */ n(xt, { amount: o.credits.granted, remaining: o.credits.remaining })
3106
- ] })
3107
- ] }) : /* @__PURE__ */ n("div", { className: f, children: w });
3108
- }
3109
- function ha({ title: e, message: t, endsAt: s }) {
3110
- const { t: r } = k(["maintenance"]), o = $().dir === "rtl";
3111
- return /* @__PURE__ */ n(
3112
- "div",
3113
- {
3114
- role: "status",
3115
- "aria-live": "polite",
3116
- dir: o ? "rtl" : "ltr",
3117
- className: "shrink-0 border-b border-warning/30 bg-warning/10 px-4 py-2.5",
3118
- children: /* @__PURE__ */ c("div", { className: "mx-auto flex max-w-[50rem] items-start gap-2.5", children: [
3119
- /* @__PURE__ */ n(It, { className: "mt-0.5 size-4 shrink-0 text-warning" }),
3120
- /* @__PURE__ */ c("p", { className: "min-w-0 flex-1 text-sm leading-relaxed text-warning", children: [
3121
- /* @__PURE__ */ n("span", { className: "font-semibold", children: e }),
3122
- /* @__PURE__ */ n("span", { "aria-hidden": !0, className: "mx-1.5 opacity-50", children: "·" }),
3123
- /* @__PURE__ */ n("span", { children: t }),
3124
- s && /* @__PURE__ */ c("span", { className: "text-warning/80", children: [
3125
- " ",
3126
- r("maintenance:until", { datetime: s })
3127
- ] })
3128
- ] })
3129
- ] })
3130
- }
3131
- );
3132
- }
3133
- function ba({ title: e, message: t, endsAt: s, refresh: r }) {
3134
- const { t: o } = k(["maintenance"]), i = $().dir === "rtl";
3135
- return /* @__PURE__ */ n(
3136
- "div",
3137
- {
3138
- role: "status",
3139
- "aria-live": "polite",
3140
- dir: i ? "rtl" : "ltr",
3141
- className: "flex min-h-dvh w-full flex-1 items-center justify-center bg-background px-6",
3142
- children: /* @__PURE__ */ c("div", { className: "flex max-w-md flex-col items-center gap-4 text-center", children: [
3143
- /* @__PURE__ */ n("div", { className: "flex size-14 items-center justify-center rounded-2xl border border-warning/30 bg-warning/10", children: /* @__PURE__ */ n(It, { className: "size-6 text-warning" }) }),
3144
- /* @__PURE__ */ n("h1", { className: "text-xl font-semibold text-foreground", children: e }),
3145
- /* @__PURE__ */ n("p", { className: "text-sm leading-relaxed text-muted-foreground", children: t }),
3146
- s && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground/80", children: o("maintenance:until", { datetime: s }) }),
3147
- /* @__PURE__ */ c(L, { variant: "outline", size: "sm", onClick: r, className: "mt-2 gap-2", children: [
3148
- /* @__PURE__ */ n(ss, { className: "size-3.5" }),
3149
- o("maintenance:retry")
3150
- ] })
3151
- ] })
3152
- }
3153
- );
3154
- }
3155
- const va = {
3156
- MessageList: vo,
3157
- MessageActions: No,
3158
- PromptInput: Xo,
3159
- WelcomeScreen: ta,
3160
- parts: to,
3161
- ChoiceQuestionPart: Kr,
3162
- ChoiceQuestionDock: na,
3163
- FollowUpSuggestions: aa,
3164
- ChatError: ia,
3165
- UsageMeter: ga,
3166
- MaintenanceBanner: ha,
3167
- MaintenanceScreen: ba
3168
- };
3169
- function ti(e, t) {
3170
- if (!t) return e;
3171
- const s = { ...e };
3172
- for (const [r, o] of Object.entries(t))
3173
- o !== void 0 && (s[r] = o);
3174
- return {
3175
- ...s,
3176
- parts: t.parts ? { ...e.parts, ...t.parts } : e.parts,
3177
- referenceAdapters: t.referenceAdapters ? { ...e.referenceAdapters, ...t.referenceAdapters } : e.referenceAdapters
3178
- };
3179
- }
3180
- const xa = te(va);
3181
- function Q() {
3182
- return le(xa);
3183
- }
3184
- function ni({ ...e }) {
3185
- return /* @__PURE__ */ n(q.Root, { "data-slot": "select", ...e });
3186
- }
3187
- function si({ ...e }) {
3188
- return /* @__PURE__ */ n(q.Value, { "data-slot": "select-value", ...e });
3189
- }
3190
- function ri({
3191
- className: e,
3192
- size: t = "default",
3193
- children: s,
3194
- ...r
3195
- }) {
3196
- return /* @__PURE__ */ c(
3197
- q.Trigger,
3198
- {
3199
- "data-slot": "select-trigger",
3200
- "data-size": t,
3201
- className: p(
3202
- // Inside a form, Radix renders a hidden native <select> right after the trigger, so a trigger that
3203
- // ends its `space-y-*` stack is no longer the last child and picks up a stray bottom margin.
3204
- "[&:has(+select[aria-hidden]:last-child)]:mb-0",
3205
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3206
- e
3207
- ),
3208
- ...r,
3209
- children: [
3210
- s,
3211
- /* @__PURE__ */ n(q.Icon, { asChild: !0, children: /* @__PURE__ */ n(ne, { className: "size-4 opacity-50" }) })
3212
- ]
3213
- }
3214
- );
3215
- }
3216
- function oi({
3217
- className: e,
3218
- children: t,
3219
- position: s = "popper",
3220
- ...r
3221
- }) {
3222
- const o = V();
3223
- return /* @__PURE__ */ n(q.Portal, { container: o, children: /* @__PURE__ */ c(
3224
- q.Content,
3225
- {
3226
- "data-slot": "select-content",
3227
- className: p(
3228
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
3229
- s === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
3230
- e
3231
- ),
3232
- position: s,
3233
- ...r,
3234
- children: [
3235
- /* @__PURE__ */ n(ya, {}),
3236
- /* @__PURE__ */ n(
3237
- q.Viewport,
3238
- {
3239
- className: p(
3240
- "p-1",
3241
- s === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
3242
- ),
3243
- children: t
3244
- }
3245
- ),
3246
- /* @__PURE__ */ n(wa, {})
3247
- ]
3248
- }
3249
- ) });
3250
- }
3251
- function ai({ className: e, children: t, ...s }) {
3252
- return /* @__PURE__ */ c(
3253
- q.Item,
3254
- {
3255
- "data-slot": "select-item",
3256
- className: p(
3257
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 text-start",
3258
- e
3259
- ),
3260
- ...s,
3261
- children: [
3262
- /* @__PURE__ */ n("span", { className: "absolute end-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ n(q.ItemIndicator, { children: /* @__PURE__ */ n(ce, { className: "size-4" }) }) }),
3263
- /* @__PURE__ */ n(q.ItemText, { children: t })
3264
- ]
3265
- }
3266
- );
3267
- }
3268
- function ya({ className: e, ...t }) {
3269
- return /* @__PURE__ */ n(
3270
- q.ScrollUpButton,
3271
- {
3272
- "data-slot": "select-scroll-up-button",
3273
- className: p("flex cursor-default items-center justify-center py-1", e),
3274
- ...t,
3275
- children: /* @__PURE__ */ n(rs, { className: "size-4" })
3276
- }
3277
- );
3278
- }
3279
- function wa({
3280
- className: e,
3281
- ...t
3282
- }) {
3283
- return /* @__PURE__ */ n(
3284
- q.ScrollDownButton,
3285
- {
3286
- "data-slot": "select-scroll-down-button",
3287
- className: p("flex cursor-default items-center justify-center py-1", e),
3288
- ...t,
3289
- children: /* @__PURE__ */ n(ne, { className: "size-4" })
3290
- }
3291
- );
3292
- }
3293
- function ii({ className: e, ...t }) {
3294
- return /* @__PURE__ */ n(
3295
- rt.Root,
3296
- {
3297
- "data-slot": "checkbox",
3298
- className: p(
3299
- "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
3300
- e
3301
- ),
3302
- ...t,
3303
- children: /* @__PURE__ */ n(
3304
- rt.Indicator,
3305
- {
3306
- "data-slot": "checkbox-indicator",
3307
- className: "grid place-content-center text-current transition-none",
3308
- children: /* @__PURE__ */ n(ce, { className: "size-3.5" })
3309
- }
3310
- )
3311
- }
3312
- );
3313
- }
3314
- const Na = Oe(
3315
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
3316
- ), ka = ke.forwardRef(({ className: e, ...t }, s) => /* @__PURE__ */ n(
3317
- "label",
3318
- {
3319
- ref: s,
3320
- className: p(Na(), e),
3321
- ...t
3322
- }
3323
- ));
3324
- ka.displayName = "Label";
3325
- function li({ className: e, type: t, ...s }) {
3326
- return /* @__PURE__ */ n(
3327
- "input",
3328
- {
3329
- type: t,
3330
- "data-slot": "input",
3331
- className: p(
3332
- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
3333
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
3334
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
3335
- e
3336
- ),
3337
- ...s
3338
- }
3339
- );
3340
- }
3341
- function ci({ ...e }) {
3342
- return /* @__PURE__ */ n(_.Root, { "data-slot": "sheet", ...e });
3343
- }
3344
- function Ca({ ...e }) {
3345
- const t = V();
3346
- return /* @__PURE__ */ n(_.Portal, { "data-slot": "sheet-portal", container: t, ...e });
3347
- }
3348
- function _a({ className: e, ...t }) {
3349
- return /* @__PURE__ */ n(
3350
- _.Overlay,
3351
- {
3352
- "data-slot": "sheet-overlay",
3353
- className: p(
3354
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-overlay",
3355
- e
3356
- ),
3357
- ...t
3358
- }
3359
- );
3360
- }
3361
- function di({
3362
- className: e,
3363
- children: t,
3364
- side: s = "end",
3365
- ...r
3366
- }) {
3367
- return /* @__PURE__ */ c(Ca, { children: [
3368
- /* @__PURE__ */ n(_a, {}),
3369
- /* @__PURE__ */ c(
3370
- _.Content,
3371
- {
3372
- "data-slot": "sheet-content",
3373
- className: p(
3374
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
3375
- s === "end" && "data-[state=closed]:slide-out-to-end data-[state=open]:slide-in-from-end inset-y-0 end-0 h-full w-3/4 border-s sm:max-w-sm",
3376
- s === "start" && "data-[state=closed]:slide-out-to-start data-[state=open]:slide-in-from-start inset-y-0 start-0 h-full w-3/4 border-e sm:max-w-sm",
3377
- s === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
3378
- s === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
3379
- e
3380
- ),
3381
- ...r,
3382
- children: [
3383
- t,
3384
- /* @__PURE__ */ c(_.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 end-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
3385
- /* @__PURE__ */ n(H, { className: "size-4" }),
3386
- /* @__PURE__ */ n(Sa, {})
3387
- ] })
3388
- ]
3389
- }
3390
- )
3391
- ] });
3392
- }
3393
- function ui({ className: e, ...t }) {
3394
- return /* @__PURE__ */ n("div", { "data-slot": "sheet-header", className: p("flex flex-col gap-1.5 p-4", e), ...t });
3395
- }
3396
- function mi({ className: e, ...t }) {
3397
- return /* @__PURE__ */ n(
3398
- _.Title,
3399
- {
3400
- "data-slot": "sheet-title",
3401
- className: p("text-foreground font-semibold", e),
3402
- ...t
3403
- }
3404
- );
3405
- }
3406
- function pi({ className: e, ...t }) {
3407
- return /* @__PURE__ */ n(
3408
- _.Description,
3409
- {
3410
- "data-slot": "sheet-description",
3411
- className: p("text-muted-foreground text-sm", e),
3412
- ...t
3413
- }
3414
- );
3415
- }
3416
- function Sa() {
3417
- const { t: e } = k("common");
3418
- return /* @__PURE__ */ n("span", { className: "sr-only", children: e("close") });
3419
- }
3420
- const za = "data:image/svg+xml,%3csvg%20version='1.2'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201280%201280'%20width='500'%20height='500'%3e%3cstyle%3e%20.s0%20{%20opacity:%201;fill:%20%2317535d%20}%20.s1%20{%20opacity:%20.99;fill:%20%23fab185%20}%20%3c/style%3e%3cg%20id='gentiq%20(7)'%3e%3cpath%20id='Path%201'%20fill-rule='evenodd'%20class='s0'%20d='m616.5%2012.22c19.25-0.09%2038.15%200.29%2042%200.84%203.85%200.54%2011.73%201.43%2017.5%201.98%205.77%200.55%2016.35%201.85%2023.5%202.91%207.15%201.05%2016.6%202.62%2021%203.49%204.4%200.88%209.8%202.02%2012%202.53%202.2%200.52%207.15%201.65%2011%202.5%203.85%200.86%208.58%202%2010.5%202.54%201.92%200.54%207.77%202.15%2013%203.6%205.23%201.44%2016.02%204.77%2024%207.4%207.98%202.63%2017.65%205.99%2021.5%207.48%203.85%201.48%2011.95%204.74%2018%207.24%206.05%202.5%2014.6%206.16%2019%208.14%204.4%201.98%2013.4%206.35%2020%209.72%206.6%203.36%2014.48%207.47%2017.5%209.11%203.02%201.65%2011.35%206.5%2018.5%2010.77%207.15%204.27%2018.17%2011.2%2024.49%2015.4%206.32%204.2%2012.17%208.16%2013%208.82%200.83%200.65%207.36%205.55%2014.51%2010.88%207.15%205.33%2013.23%209.97%2013.5%2010.31%200.27%200.34%202.73%202.42%205.45%204.62%202.72%202.2%205.43%204.45%206.02%205%200.59%200.55%204.89%204.35%209.55%208.45%204.67%204.1%2015.04%2014%2023.05%2022%208.02%208%2018.22%2018.6%2022.67%2023.55%204.46%204.95%2011.4%2013.07%2015.43%2018.04%204.03%204.97%2011.43%2014.42%2016.43%2021%205.01%206.58%2012.65%2017.36%2016.97%2023.96%204.33%206.6%208.56%2013.15%209.4%2014.57%200.84%201.41%204.08%206.81%207.19%2012%203.11%205.18%207.29%2012.36%209.29%2015.93%202%203.57%207.6%2014.6%2012.44%2024.5%204.84%209.9%2010.51%2022.05%2012.6%2027%202.08%204.95%204.36%2010.35%205.07%2012%200.71%201.65%202.26%205.48%203.44%208.5%201.19%203.02%204.44%2012.25%207.22%2020.5%202.79%208.25%205.42%2016.35%205.84%2018%200.43%201.65%201.72%206.15%202.87%2010%201.15%203.85%203.86%2014.43%206.03%2023.5%202.16%209.07%204.38%2019.2%204.94%2022.5%200.56%203.3%201.5%208.7%202.1%2012%200.59%203.3%201.68%2010.05%202.43%2015%200.74%204.95%201.85%2013.27%202.47%2018.5%200.61%205.23%201.56%2018.95%202.11%2030.5%200.55%2011.55%200.99%2034.61%200.99%2051.25%200%2019.16-0.37%2030.43-1%2030.75-0.55%200.27-1%202.64-1.01%205.25%200%202.61-0.43%207.45-0.96%2010.75-0.52%203.3-1.7%2011.17-2.62%2017.5-0.92%206.33-2.02%2013.52-2.44%2016-0.43%202.48-1.29%207.42-1.93%2011-0.63%203.58-2.7%2013.02-4.6%2021-1.9%207.98-3.93%2016.3-4.51%2018.5-0.58%202.2-2.41%208.5-4.05%2014-1.64%205.5-4.8%2015.4-7.01%2022-2.21%206.6-4.39%2012.9-4.85%2014-0.46%201.1-2.22%205.71-3.92%2010.25-1.71%204.54-3.44%208.24-3.85%208.22-0.41-0.02-2.55-1.5-4.75-3.29-2.2-1.8-6.25-4.85-9-6.79-2.75-1.94-9.95-6.45-16-10.03-6.05-3.58-14.83-8.34-19.5-10.57-4.67-2.23-10.64-5.01-13.25-6.18-2.61-1.16-8.91-3.51-14-5.21-5.09-1.71-10.71-3.51-12.5-4-1.79-0.5-4.94-1.38-7-1.96-2.06-0.58-6.9-1.73-10.75-2.54-3.85-0.82-9.47-1.94-12.5-2.48-3.02-0.54-10.9-1.64-17.5-2.44-6.6-0.81-18.52-1.46-26.5-1.45-7.98%200-20.13%200.68-27%201.5-6.88%200.81-13.85%201.75-15.5%202.08-1.65%200.32-7.27%201.43-12.5%202.47-5.23%201.04-12.65%202.83-16.5%203.98-3.85%201.16-9.02%202.67-11.5%203.38-2.48%200.7-9.45%203.31-15.5%205.8-6.05%202.49-14.6%206.3-19%208.46-4.4%202.17-12.05%206.39-17%209.38-4.95%203-13.5%208.66-19%2012.58-5.5%203.92-12.7%209.48-16%2012.36-3.3%202.88-8.88%207.99-12.41%2011.36-3.52%203.36-9.6%209.72-13.5%2014.12-3.9%204.4-7.32%208.23-7.59%208.5-0.27%200.27-2.09%202.52-4.04%205-1.94%202.48-4.39%205.85-5.43%207.5-1.04%201.65-2.38%203.47-2.96%204.05-0.59%200.58-3.12%204.4-5.63%208.5-2.5%204.1-5.89%209.7-7.53%2012.45-1.63%202.75-4.16%207.48-5.61%2010.5-1.45%203.02-4.03%208.42-5.73%2012-1.71%203.58-3.1%206.95-3.09%207.5%200%200.55-0.69%202.35-1.54%204-0.85%201.65-2.83%206.83-4.39%2011.5-1.56%204.67-4.24%2014.12-5.95%2021-1.71%206.87-4.01%2019.25-5.1%2027.5-1.42%2010.7-1.99%2020.73-1.99%2035%200%2014.2%200.58%2024.35%201.98%2035%201.09%208.25%203.53%2021.08%205.43%2028.5%201.9%207.42%204.63%2016.87%206.07%2021%201.44%204.12%203.03%208.4%203.54%209.5%200.5%201.1%201.87%204.47%203.03%207.5%201.16%203.03%204.23%209.78%206.82%2015%202.59%205.22%205.48%2010.62%206.42%2012%200.94%201.37%201.73%202.72%201.74%203%200.01%200.28-1.91%201.07-4.26%201.77-2.35%200.7-8.55%202.17-13.78%203.28-5.23%201.11-11.98%202.47-15%203.03-3.02%200.55-7.75%201.43-10.5%201.95-2.75%200.52-10.63%201.65-17.5%202.53-6.88%200.87-16.33%202-21%202.5-4.67%200.5-17.27%201.4-28%202.01-11.32%200.65-29.56%200.85-43.5%200.48-13.2-0.35-27.83-1.06-32.5-1.57-4.67-0.52-14.8-1.66-22.5-2.54-7.7-0.88-17.6-2.21-22-2.95-4.4-0.75-14.98-2.78-23.5-4.5-8.52-1.73-18.88-4.05-23-5.15-4.13-1.1-10.2-2.68-13.5-3.51-3.3-0.83-10.27-2.86-15.5-4.51-5.23-1.65-12.88-4.1-17-5.45-4.13-1.35-8.4-2.85-9.5-3.33-1.1-0.47-6.5-2.54-12-4.6-5.5-2.05-11.8-4.52-14-5.49-2.2-0.97-8.73-3.88-14.5-6.47-5.77-2.59-15.45-7.18-21.5-10.21-6.05-3.02-14.38-7.3-18.5-9.51-4.13-2.2-7.95-4.36-8.5-4.78-0.55-0.42-3.25-2.02-6-3.54-2.75-1.52-12.65-7.69-22-13.71-9.35-6.02-23.75-16.02-32-22.22-8.25-6.21-16.78-12.8-18.96-14.65-2.18-1.85-8.68-7.41-14.44-12.36-5.77-4.95-17.28-15.75-25.58-24-8.3-8.25-17.33-17.48-20.07-20.5-2.74-3.02-7.71-8.65-11.05-12.5-3.34-3.85-9.97-11.95-14.75-18-4.77-6.05-9.02-11.45-9.44-12-0.42-0.55-3.51-4.83-6.87-9.5-3.36-4.67-8.78-12.55-12.05-17.5-3.26-4.95-8.45-13.05-11.52-18-3.07-4.95-8.47-14.17-11.99-20.5-3.53-6.33-9.38-17.58-13-25-3.63-7.42-7.59-15.75-8.8-18.5-1.21-2.75-3.22-7.25-4.45-10-1.24-2.75-2.6-6.13-3.02-7.5-0.43-1.38-1.6-4.3-2.61-6.5-1.01-2.2-3.68-9.17-5.94-15.5-2.27-6.33-4.71-13.3-5.43-15.5-0.73-2.2-2.52-8.05-3.99-13-1.46-4.95-3.06-10.13-3.55-11.5-0.49-1.38-2.5-9.25-4.47-17.5-1.98-8.25-4.02-16.8-4.54-19-0.52-2.2-1.42-6.7-2-10-0.58-3.3-1.67-9.6-2.42-14-0.75-4.4-1.83-11.6-2.41-16-0.58-4.4-1.54-12.5-2.13-18-0.59-5.5-1.51-10.11-2.05-10.25-0.6-0.16-0.97-11.89-0.96-31%200-16.91%200.44-39.3%200.97-49.75%200.53-10.45%201.45-23.73%202.03-29.5%200.59-5.77%201.55-14.1%202.13-18.5%200.58-4.4%201.67-11.6%202.42-16%200.75-4.4%201.84-10.7%202.42-14%200.58-3.3%201.48-7.8%202-10%200.52-2.2%202.56-10.75%204.54-19%201.97-8.25%203.98-16.13%204.47-17.5%200.48-1.38%201.84-5.88%203.02-10%201.18-4.13%204.4-14.02%207.15-22%202.75-7.98%205.36-15.4%205.81-16.5%200.44-1.1%201.97-4.7%203.39-8%201.43-3.3%202.6-6.34%202.61-6.75%200.02-0.41%201.2-3.34%202.64-6.5%201.43-3.16%203.3-7.32%204.15-9.25%200.86-1.93%204.59-9.8%208.3-17.5%203.71-7.7%209.76-19.4%2013.45-26%203.68-6.6%209.22-16.05%2012.3-21%203.08-4.95%208.58-13.5%2012.22-19%203.64-5.5%207.72-11.57%209.05-13.5%201.34-1.93%204.43-6.2%206.87-9.5%202.43-3.3%207.79-10.28%2011.91-15.5%204.11-5.22%2010.67-13.1%2014.56-17.5%203.89-4.4%209.08-10.25%2011.53-13%202.44-2.75%2010.77-11.3%2018.5-19.01%207.73-7.7%2019.23-18.52%2025.55-24.04%206.32-5.51%2015.1-12.94%2019.5-16.49%204.4-3.56%2010.02-7.96%2012.5-9.77%202.48-1.82%207.43-5.45%2011-8.06%203.57-2.62%209.43-6.72%2013-9.11%203.57-2.39%208.3-5.57%2010.5-7.06%202.2-1.49%209.85-6.21%2017-10.48%207.15-4.28%2015.48-9.13%2018.5-10.78%203.02-1.66%2010.92-5.75%2017.53-9.1%206.62-3.36%2015.17-7.53%2019-9.27%203.84-1.75%2010.12-4.52%2013.97-6.17%203.85-1.66%2012.4-5.11%2019-7.67%206.6-2.56%2018.64-6.87%2026.75-9.58%208.11-2.7%2016.44-5.33%2018.5-5.85%202.06-0.52%207.12-1.9%2011.25-3.06%204.12-1.17%2010.43-2.8%2014-3.63%203.57-0.84%208.07-1.88%2010-2.32%201.93-0.45%207.1-1.54%2011.5-2.42%204.4-0.89%2010.25-2.05%2013-2.58%202.75-0.53%207.25-1.24%2010-1.57%202.75-0.34%207.25-1.02%2010-1.52%202.75-0.5%2010.4-1.45%2017-2.1%206.6-0.65%2016.95-1.48%2023-1.84%206.05-0.36%2026.75-0.72%2046-0.8zm-42.29%20288.46c-6.99%200.78-16.76%202.31-21.71%203.4-4.95%201.09-11.48%202.67-14.5%203.51-3.02%200.84-7.98%202.24-11%203.12-3.02%200.88-10.45%203.5-16.5%205.83-6.05%202.33-14.82%206-19.5%208.16-4.68%202.15-12.77%206.32-18%209.26-5.23%202.94-13.32%207.87-18%2010.95-4.68%203.09-11.2%207.62-14.5%2010.08-3.3%202.45-8.93%206.92-12.5%209.92-3.57%203.01-12.15%2011.12-19.05%2018.03-6.9%206.91-15.61%2016.38-19.34%2021.06-3.73%204.68-10.49%2014.13-15.01%2021-4.53%206.88-9.98%2015.65-12.11%2019.5-2.13%203.85-5.64%2010.6-7.79%2015-2.15%204.4-5.5%2011.82-7.43%2016.5-1.94%204.68-4.38%2011.2-5.43%2014.5-1.06%203.3-3.22%2010.5-4.81%2016-1.59%205.5-3.42%2012.7-4.06%2016-0.64%203.3-1.58%208.25-2.08%2011-0.5%202.75-1.58%209.95-2.39%2016-0.95%207.05-1.49%2019.36-1.49%2034.25-0.01%2012.79%200.45%2026.51%201.02%2030.5%200.56%203.99%201.5%2010.17%202.07%2013.75%200.58%203.58%201.73%209.88%202.57%2014%200.84%204.13%202.88%2012.23%204.53%2018%201.65%205.77%204.12%2013.88%205.5%2018%201.37%204.13%202.84%207.95%203.27%208.5%200.42%200.55%201.68%203.48%202.79%206.5%201.11%203.02%203.79%209.1%205.94%2013.5%202.15%204.4%205.66%2011.15%207.78%2015%202.13%203.85%207.59%2012.63%2012.14%2019.5%204.54%206.88%2011.3%2016.33%2015.02%2021%203.73%204.67%2012.09%2013.9%2018.58%2020.5%206.5%206.6%2014.62%2014.29%2018.05%2017.09%203.43%202.8%2010.05%207.98%2014.73%2011.51%204.68%203.53%2012.1%208.74%2016.5%2011.58%204.4%202.83%2010.02%206.3%2012.5%207.7%202.48%201.4%209.45%204.99%2015.5%207.97%206.05%202.98%2013.25%206.42%2016%207.65%202.75%201.23%2012.2%204.61%2021%207.5%208.8%202.9%2021.62%206.44%2028.5%207.89%206.87%201.44%2014.52%203.04%2017%203.55%202.48%200.51%2013.27%201.48%2024%202.15%2015.34%200.97%2023.66%200.97%2039%200.01%2010.73-0.67%2021.3-1.6%2023.5-2.08%202.2-0.47%206.7-1.37%2010-1.99%203.3-0.63%208.92-1.82%2012.5-2.66%203.58-0.84%2010.1-2.58%2014.5-3.87%204.4-1.29%2012.27-3.89%2017.5-5.78%205.23-1.89%2011.51-4.29%2013.96-5.33%202.46-1.04%2010.33-4.84%2017.5-8.44%207.17-3.61%2018.21-9.87%2024.54-13.92%206.33-4.04%2012.68-8.3%2014.12-9.44%201.45-1.15%203.87-2.99%205.39-4.09%201.53-1.1%203.56-2.67%204.52-3.5%200.97-0.83%204.51-3.75%207.88-6.5%203.37-2.75%2011.85-10.86%2018.86-18.02%207-7.16%2016.15-17.51%2020.34-23%204.19-5.49%2010.3-14.03%2013.6-18.98%203.29-4.95%207.48-11.7%209.3-15%201.83-3.3%205.43-10.27%208.02-15.5%202.58-5.23%205.41-11.08%206.28-13%200.88-1.92%202.57-5.98%203.75-9%201.18-3.02%203.02-8.2%204.08-11.5%201.07-3.3%203.22-10.5%204.78-16%201.56-5.5%203.34-12.02%203.96-14.5%200.61-2.48%201.6-7.42%202.18-11%200.59-3.58%201.51-9.65%202.04-13.5%200.54-3.85%201.34-13.98%201.79-22.5%200.44-8.52%200.44-22.25%200-30.5-0.45-8.25-1.25-18.15-1.79-22-0.53-3.85-1.46-9.92-2.05-13.5-0.59-3.58-2.01-10.33-3.14-15-1.14-4.67-2.44-9.62-2.89-11-0.45-1.37-1.84-5.87-3.08-10-1.24-4.12-3.56-10.87-5.15-15-1.59-4.12-3.6-9.07-4.47-11-0.87-1.93-3.71-7.77-6.31-13-2.59-5.23-5.55-11.07-6.56-13-1.01-1.93-3.99-6.87-6.62-11-2.63-4.12-7.45-11.32-10.7-16-3.25-4.68-9.5-12.77-13.89-18-4.39-5.23-13.1-14.45-19.36-20.5-6.26-6.05-15.21-14.06-19.88-17.8-4.68-3.74-10.92-8.47-13.88-10.5-2.96-2.04-9.26-6.13-14-9.1-4.74-2.97-13.12-7.77-18.62-10.66-5.5-2.89-14.5-7.13-20-9.42-5.5-2.28-10.9-4.56-12-5.06-1.1-0.49-6.05-2.24-11-3.88-4.95-1.65-11.02-3.49-13.5-4.09-2.48-0.6-9.23-2.16-15-3.47-5.77-1.3-15.9-3.11-22.5-4.02-6.81-0.93-20.87-1.79-32.5-1.97-11.27-0.17-22.66-0.08-25.29%200.21-2.63%200.29-10.51%201.16-17.5%201.94z'/%3e%3cpath%20id='Path%202'%20class='s1'%20d='m953.5%20831.1c-2.75%200.49-7.7%201.38-11%201.99-3.3%200.61-8.48%201.77-11.5%202.57-3.02%200.81-9.33%202.84-14%204.52-4.67%201.68-13%205.31-18.5%208.06-5.5%202.75-12.48%206.61-15.5%208.58-3.02%201.97-8.2%205.61-11.5%208.08-3.3%202.47-9.33%207.44-13.39%2011.05-4.07%203.6-10.64%2010.38-14.61%2015.05-3.96%204.67-10.02%2012.77-13.46%2018-3.44%205.22-7.84%2012.65-9.78%2016.5-1.94%203.85-5.1%2011.05-7.02%2016-1.92%204.95-4.35%2011.92-5.39%2015.5-1.04%203.58-2.57%209.65-3.39%2013.5-0.83%203.85-2%2013.3-2.61%2021-0.81%2010.28-0.8%2017.79%200.02%2028.25%200.62%207.84%202.22%2018.86%203.55%2024.5%201.33%205.64%203.42%2013.17%204.65%2016.75%201.22%203.58%204%2010.55%206.17%2015.5%202.17%204.95%206.32%2013.05%209.22%2018%202.91%204.95%207.71%2012.22%2010.66%2016.15%202.96%203.94%208.08%2010.19%2011.38%2013.89%203.3%203.7%2010.05%2010.13%2015%2014.28%204.95%204.15%2013.05%2010.21%2018%2013.47%204.95%203.25%2011.92%207.4%2015.5%209.2%203.58%201.81%2010.55%204.92%2015.5%206.91%204.95%201.99%2012.83%204.69%2017.5%206%204.67%201.3%209.85%202.69%2011.5%203.07%201.65%200.39%206.83%201.33%2011.5%202.1%205.11%200.84%2015.89%201.4%2027%201.4%2010.17%200%2020.08-0.41%2022-0.92%201.92-0.5%206.2-1.45%209.5-2.1%203.3-0.65%2010.27-2.42%2015.5-3.93%205.22-1.5%2013.55-4.41%2018.5-6.46%204.95-2.05%2013.05-5.96%2018-8.68%204.95-2.73%2013.5-8.3%2019-12.39%205.5-4.08%2013.97-11.38%2018.82-16.21%204.86-4.83%2012.1-13.06%2016.09-18.28%203.99-5.22%209.09-12.65%2011.32-16.5%202.23-3.85%205.93-10.83%208.21-15.5%202.28-4.67%205.68-13.22%207.55-19%201.87-5.78%203.86-12.3%204.41-14.5%200.55-2.2%201.7-8.39%202.55-13.75%200.98-6.14%201.55-16.31%201.54-27.5%200-12.91-0.53-20.88-1.94-29.25-1.06-6.33-3.1-15.33-4.52-20-1.43-4.67-3.03-9.29-3.56-10.25-0.53-0.96-0.97-2.2-0.97-2.75%200-0.55-0.86-2.91-1.92-5.25-1.06-2.34-2.98-6.5-4.28-9.25-1.29-2.75-4.32-8.38-6.72-12.5-2.41-4.13-5.99-9.75-7.98-12.5-1.98-2.75-4.5-6.1-5.6-7.45-1.1-1.35-4.03-4.71-6.5-7.48-2.47-2.76-5.63-6.17-7-7.56-1.38-1.39-5.65-5.28-9.5-8.64-3.85-3.36-11.5-9.16-17-12.89-5.5-3.73-14.3-8.85-19.55-11.38-5.26-2.53-10.88-5.15-12.5-5.82-1.62-0.68-6.33-2.39-10.45-3.8-4.13-1.42-10.65-3.26-14.5-4.09-3.85-0.84-10.83-2.16-15.5-2.94-5.29-0.88-15.11-1.38-26-1.32-9.63%200.05-19.75%200.49-22.5%200.97z'/%3e%3c/g%3e%3c/svg%3e", fi = za;
3421
- export {
3422
- na as $,
3423
- ca as A,
3424
- L as B,
3425
- Ja as C,
3426
- vt as D,
3427
- pe as E,
3428
- Ge as F,
3429
- Sr as G,
3430
- zr as H,
3431
- li as I,
3432
- Tr as J,
3433
- fi as K,
3434
- ka as L,
3435
- ye as M,
3436
- Pr as N,
3437
- Ar as O,
3438
- _r as P,
3439
- Ka as Q,
3440
- fr as R,
3441
- xa as S,
3442
- xo as T,
3443
- xs as U,
3444
- Ga as V,
3445
- qo as W,
3446
- jo as X,
3447
- $o as Y,
3448
- Fo as Z,
3449
- ia as _,
3450
- ti as a,
3451
- Kr as a0,
3452
- Hr as a1,
3453
- aa as a2,
3454
- ha as a3,
3455
- ba as a4,
3456
- No as a5,
3457
- vo as a6,
3458
- Xo as a7,
3459
- nn as a8,
3460
- wr as a9,
3461
- Vr as aa,
3462
- oa as ab,
3463
- ra as ac,
3464
- hr as ad,
3465
- Ur as ae,
3466
- ga as af,
3467
- ta as ag,
3468
- he as ah,
3469
- Ut as ai,
3470
- Bt as aj,
3471
- Ya as ak,
3472
- kr as al,
3473
- Fe as am,
3474
- Be as an,
3475
- Le as ao,
3476
- Wa as ap,
3477
- Xa as aq,
3478
- ei as ar,
3479
- pt as as,
3480
- V as b,
3481
- p as c,
3482
- se as d,
3483
- to as e,
3484
- ni as f,
3485
- ri as g,
3486
- si as h,
3487
- oi as i,
3488
- ai as j,
3489
- ii as k,
3490
- zo as l,
3491
- Qa as m,
3492
- ci as n,
3493
- di as o,
3494
- ui as p,
3495
- mi as q,
3496
- vs as r,
3497
- pi as s,
3498
- Ve as t,
3499
- Q as u,
3500
- Qe as v,
3501
- We as w,
3502
- la as x,
3503
- Za as y,
3504
- ln as z
3505
- };