@gentiq/ui 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MessageEditor-HB-YJP7R.js → MessageEditor-PAl3Jjcu.js} +1 -1
- package/dist/{VoiceInput-B3e7emmb.js → VoiceInput-DX0ZCnIA.js} +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.es.js +749 -715
- package/dist/internal.d.ts +7 -6
- package/dist/internal.es.js +2 -2
- package/dist/{shared-BNCHeyvj.js → shared-MFlvTavE.js} +797 -786
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e, jsxs as s, Fragment as fe } from "react/jsx-runtime";
|
|
3
|
-
import * as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
import { Slot as
|
|
7
|
-
import { cva as
|
|
8
|
-
import { QuoteIcon as
|
|
9
|
-
import { E as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { Toaster as
|
|
12
|
-
import { getToolName as
|
|
13
|
-
import { createPortal as
|
|
14
|
-
import { textOrKey as
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
17
|
-
return
|
|
3
|
+
import * as Q from "react";
|
|
4
|
+
import { useRef as Ae, useState as S, useEffect as R, createElement as Ct, useContext as We, useMemo as O, useLayoutEffect as _t, forwardRef as Tt, useCallback as Le, memo as It, useId as Fe, createContext as qt, useSyncExternalStore as Lt, Suspense as Mt } from "react";
|
|
5
|
+
import { useMessage as Pt, useOptionsStore as At, useServerConfig as Et, createOptionsStore as Xe, Message as Ye, useGentiqTranslation as q, References as Ee, useTheme as se, useGentiqLanguage as J, useGentiqOptions as H, useThreadSelection as Ze, ThreadSelectionProvider as Je, useThread as zt, Thread as et, GentiqRuntimeProvider as Rt, useLoginCodeExchange as Dt, useAuthSession as Ft, useGentiqApi as ze, useGentiqQueryClient as tt, getLocalizedErrorMessage as re, useGentiqKeys as Ot, useGentiqEntitlement as $t, ThreadList as G, ThreadRename as ye, useThreadListItem as Re, useGentiqStatus as Ut } from "@gentiq/react";
|
|
6
|
+
import { Slot as jt } from "@radix-ui/react-slot";
|
|
7
|
+
import { cva as Bt } from "class-variance-authority";
|
|
8
|
+
import { QuoteIcon as Gt, Loader2Icon as Ht, OctagonXIcon as Vt, TriangleAlertIcon as Kt, InfoIcon as Qt, CircleCheckIcon as Wt, PanelLeftIcon as Xt, User as Yt, Palette as Zt, ShieldCheck as Jt, Settings as Me, AtSign as ea, Mail as ta, Smartphone as aa, Lock as na, Save as ra, Coins as sa, Infinity as ia, Zap as oa, LogOut as la, SquarePen as at, Check as ca, X as da, MoreVertical as ua, PinOff as ma, Pin as nt, Share2 as ha, Link2Off as ga, Pencil as pa, Trash as fa, Search as ba } from "lucide-react";
|
|
9
|
+
import { E as rt, u as ie, R as va, U as Oe, r as st, m as xa, a as ya, S as Na, b as wa, P as Sa, c as x, d as ee, C as ka, e as Ca, L as A, I as F, B as $, f as we, g as Se, h as ke, i as Ce, j as _e, k as _a, l as it, T as ot, n as Ta, o as Ia, p as qa, q as La, s as Ma, t as lt, v as ct, w as dt, x as ut, y as $e, z as Pa, A as mt, D as Aa, F as Ea, G as ht, H as za, J as gt, K as Ra, M as Da, N as Fa, O as Oa, Q as $a, V as Ua, W as ja, X as Ba, Y as Ga, Z as he } from "./shared-MFlvTavE.js";
|
|
10
|
+
import { _ as Cr, $ as _r, a0 as Tr, a1 as Ir, a2 as qr, a3 as Lr, a4 as Mr, a5 as Pr, a6 as Ar, a7 as Er, a8 as zr, a9 as Rr, aa as Dr, ab as Fr, ac as Or, ad as $r, ae as Ur, af as jr, ag as Br, ah as Gr, ai as Hr, aj as Vr } from "./shared-MFlvTavE.js";
|
|
11
|
+
import { Toaster as Ha, toast as E } from "sonner";
|
|
12
|
+
import { getToolName as pt, isToolUIPart as ft } from "ai";
|
|
13
|
+
import { createPortal as Va } from "react-dom";
|
|
14
|
+
import { textOrKey as Ka, evaluateCondition as Te, getAvailableLanguages as Qa, getLanguageNativeName as Wa, isGentiqError as Xa, withAttachmentUrls as Ya, toGentiqMessages as Za } from "@gentiq/core";
|
|
15
|
+
function Ja() {
|
|
16
|
+
const t = Ae(null), [a, n] = S(0);
|
|
17
|
+
return R(() => {
|
|
18
18
|
const r = t.current;
|
|
19
19
|
if (!r) return;
|
|
20
|
-
const
|
|
20
|
+
const i = () => {
|
|
21
21
|
const m = r.offsetHeight;
|
|
22
22
|
n((u) => Math.abs(u - m) < 1 ? u : m);
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
return
|
|
24
|
+
i();
|
|
25
|
+
const o = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
|
|
26
|
+
return o?.observe(r), () => o?.disconnect();
|
|
27
27
|
}, []), [t, a];
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const Ue = (t) => {
|
|
30
30
|
if (!t || typeof t != "object") return null;
|
|
31
31
|
const a = Object.values(t).filter((n) => ["string", "number", "boolean"].includes(typeof n)).slice(0, 3).map(String);
|
|
32
32
|
return a.length > 0 ? a.join(" · ") : null;
|
|
33
33
|
};
|
|
34
|
-
function
|
|
35
|
-
return typeof t.output == "string" ? t.output :
|
|
34
|
+
function en(t) {
|
|
35
|
+
return typeof t.output == "string" ? t.output : Ue(t.output) ?? Ue(t.input) ?? pt(t);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function tn({
|
|
38
38
|
part: t,
|
|
39
39
|
index: a,
|
|
40
40
|
component: n
|
|
@@ -43,24 +43,24 @@ function an({
|
|
|
43
43
|
return (
|
|
44
44
|
// resetKeys: a streamed part can be malformed for a token and valid on the next. Without it
|
|
45
45
|
// the boundary would latch for good, since the part's key never changes.
|
|
46
|
-
/* @__PURE__ */ e(
|
|
46
|
+
/* @__PURE__ */ e(rt, { resetKeys: [t], children: ft(t) || t.type === "file" ? /* @__PURE__ */ e(an, { part: t, index: a, children: r }) : r })
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function an({
|
|
50
50
|
part: t,
|
|
51
51
|
index: a,
|
|
52
52
|
children: n
|
|
53
53
|
}) {
|
|
54
|
-
const r =
|
|
54
|
+
const r = Pt((u) => u.message), { referenceAdapters: i } = ie(), o = { messageId: r.id, partIndex: a, role: r.role, data: t };
|
|
55
55
|
let m;
|
|
56
|
-
if (
|
|
57
|
-
const u =
|
|
58
|
-
...
|
|
56
|
+
if (ft(t)) {
|
|
57
|
+
const u = pt(t), g = {
|
|
58
|
+
...o,
|
|
59
59
|
kind: "tool",
|
|
60
60
|
sourceId: `${r.id}-${a}-tool`,
|
|
61
61
|
label: u,
|
|
62
|
-
excerpt:
|
|
63
|
-
}, c =
|
|
62
|
+
excerpt: en(t)
|
|
63
|
+
}, c = i?.[u]?.({ part: t, message: r, toolName: u }) || {};
|
|
64
64
|
m = {
|
|
65
65
|
...g,
|
|
66
66
|
...c,
|
|
@@ -72,7 +72,7 @@ function nn({
|
|
|
72
72
|
};
|
|
73
73
|
} else if (t.type === "file")
|
|
74
74
|
m = {
|
|
75
|
-
...
|
|
75
|
+
...o,
|
|
76
76
|
kind: "file",
|
|
77
77
|
sourceId: `${r.id}-${a}-file`,
|
|
78
78
|
label: t.filename || t.mediaType,
|
|
@@ -80,170 +80,176 @@ function nn({
|
|
|
80
80
|
};
|
|
81
81
|
else
|
|
82
82
|
return n;
|
|
83
|
-
return /* @__PURE__ */ e(
|
|
83
|
+
return /* @__PURE__ */ e(va, { reference: m, children: n });
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
function
|
|
87
|
-
let a =
|
|
85
|
+
const je = /* @__PURE__ */ new WeakMap();
|
|
86
|
+
function nn(t) {
|
|
87
|
+
let a = je.get(t);
|
|
88
88
|
if (!a) {
|
|
89
89
|
const n = t;
|
|
90
|
-
a = ({ part:
|
|
90
|
+
a = ({ part: i, index: o }) => Ct(tn, { part: i, index: o, component: n }), je.set(t, a);
|
|
91
91
|
}
|
|
92
92
|
return a;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function bt(t) {
|
|
95
95
|
const a = {};
|
|
96
96
|
for (const [n, r] of Object.entries(t))
|
|
97
|
-
a[n] = r &&
|
|
97
|
+
a[n] = r && nn(r);
|
|
98
98
|
return a;
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
function
|
|
100
|
+
const rn = Xe(st({}, null));
|
|
101
|
+
function De({
|
|
102
102
|
components: t,
|
|
103
103
|
children: a,
|
|
104
104
|
history: n,
|
|
105
105
|
welcome: r,
|
|
106
|
-
threadActions:
|
|
107
|
-
composer:
|
|
106
|
+
threadActions: i,
|
|
107
|
+
composer: o,
|
|
108
108
|
disclaimer: m,
|
|
109
109
|
settings: u
|
|
110
110
|
}) {
|
|
111
|
-
const g =
|
|
112
|
-
() =>
|
|
113
|
-
|
|
111
|
+
const g = We(Oe) ?? rn, c = At(g, (k) => k.configured), h = ie(), p = Et(), f = O(
|
|
112
|
+
() => st(
|
|
113
|
+
xa(c, {
|
|
114
114
|
history: n,
|
|
115
115
|
welcome: r,
|
|
116
|
-
threadActions:
|
|
117
|
-
composer:
|
|
116
|
+
threadActions: i,
|
|
117
|
+
composer: o,
|
|
118
118
|
disclaimer: m,
|
|
119
119
|
settings: u
|
|
120
120
|
}),
|
|
121
121
|
p
|
|
122
122
|
),
|
|
123
|
-
[c, p, n, r,
|
|
124
|
-
), [
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
return /* @__PURE__ */ e(
|
|
123
|
+
[c, p, n, r, i, o, m, u]
|
|
124
|
+
), [b] = S(() => Xe(f));
|
|
125
|
+
_t(() => b.setState(f), [b, f]);
|
|
126
|
+
const _ = O(() => ya(h, t), [h, t]), v = O(() => bt(_.parts), [_.parts]);
|
|
127
|
+
return /* @__PURE__ */ e(Na.Provider, { value: _, children: /* @__PURE__ */ e(Oe.Provider, { value: b, children: /* @__PURE__ */ e(Ye.PartsProvider, { components: v, children: a }) }) });
|
|
128
128
|
}
|
|
129
|
-
const
|
|
129
|
+
const sn = {
|
|
130
130
|
top: "max(0.5rem, calc(var(--gentiq-selection-top) - 2.625rem))",
|
|
131
131
|
left: "calc(var(--gentiq-selection-left) + var(--gentiq-selection-width) / 2)"
|
|
132
132
|
};
|
|
133
|
-
function
|
|
134
|
-
const { t } =
|
|
135
|
-
return a ?
|
|
133
|
+
function on() {
|
|
134
|
+
const { t } = q(["chat"]), a = wa();
|
|
135
|
+
return a ? Va(
|
|
136
136
|
/* @__PURE__ */ e(
|
|
137
|
-
|
|
137
|
+
Ee.SelectionQuote,
|
|
138
138
|
{
|
|
139
|
-
style:
|
|
139
|
+
style: sn,
|
|
140
140
|
className: "fixed z-50 flex size-9 -translate-x-1/2 items-center justify-center rounded-lg bg-background text-foreground shadow-lg ring-1 ring-border/60 transition hover:bg-muted",
|
|
141
141
|
"aria-label": t("reference_selection"),
|
|
142
142
|
title: t("reference_selection"),
|
|
143
|
-
children: /* @__PURE__ */ e(
|
|
143
|
+
children: /* @__PURE__ */ e(Gt, { className: "size-4" })
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
146
|
a
|
|
147
147
|
) : null;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function ln(t, a) {
|
|
150
150
|
if (typeof t != "object" || t === null) return t || void 0;
|
|
151
151
|
const n = a.split("-")[0];
|
|
152
152
|
return t[a] || t[n] || t.en || Object.values(t)[0];
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function cn({
|
|
155
155
|
accent: t,
|
|
156
156
|
radius: a,
|
|
157
|
-
fontFamily: n
|
|
157
|
+
fontFamily: n,
|
|
158
|
+
userBubbleAccent: r
|
|
158
159
|
}) {
|
|
159
|
-
const
|
|
160
|
-
if (t && (
|
|
160
|
+
const i = {};
|
|
161
|
+
if (t && (i["--gentiq-primary"] = t), r && (i["--gentiq-bubble"] = "var(--gentiq-primary)", i["--gentiq-bubble-foreground"] = "var(--gentiq-primary-foreground)"), a && (i["--gentiq-radius"] = a), n) {
|
|
161
162
|
const o = n.includes(" ") && !/^['"]/.test(n) ? `"${n}"` : n;
|
|
162
|
-
|
|
163
|
+
i["--gentiq-font-family"] = `${o}, var(--gentiq-font-script)`;
|
|
163
164
|
}
|
|
164
|
-
return
|
|
165
|
+
return i;
|
|
165
166
|
}
|
|
166
|
-
const
|
|
167
|
-
const { resolvedTheme: m, accent: u, radius: g } =
|
|
167
|
+
const W = Tt(function({ className: a, style: n, children: r, ...i }, o) {
|
|
168
|
+
const { resolvedTheme: m, accent: u, radius: g } = se(), { language: c, dir: h } = J(), p = H((v) => v.theme.typography?.fontFamily), f = H((v) => v.theme.userBubbleAccent), [b, _] = S(null);
|
|
168
169
|
return /* @__PURE__ */ s(
|
|
169
170
|
"div",
|
|
170
171
|
{
|
|
171
|
-
ref:
|
|
172
|
-
...
|
|
173
|
-
className:
|
|
172
|
+
ref: o,
|
|
173
|
+
...i,
|
|
174
|
+
className: x("gentiq", m, a),
|
|
174
175
|
lang: c,
|
|
175
176
|
dir: h,
|
|
176
177
|
style: {
|
|
177
|
-
...
|
|
178
|
+
...cn({
|
|
179
|
+
accent: u,
|
|
180
|
+
radius: g,
|
|
181
|
+
fontFamily: ln(p, c),
|
|
182
|
+
userBubbleAccent: f
|
|
183
|
+
}),
|
|
178
184
|
...n
|
|
179
185
|
},
|
|
180
186
|
children: [
|
|
181
|
-
/* @__PURE__ */ e(
|
|
182
|
-
/* @__PURE__ */ e("div", { ref:
|
|
187
|
+
/* @__PURE__ */ e(Sa.Provider, { value: b, children: r }),
|
|
188
|
+
/* @__PURE__ */ e("div", { ref: _, "data-gentiq-portal": "", className: "contents" })
|
|
183
189
|
]
|
|
184
190
|
}
|
|
185
191
|
);
|
|
186
192
|
});
|
|
187
|
-
function
|
|
188
|
-
const { t: a, i18n: n } =
|
|
189
|
-
m({ text:
|
|
190
|
-
}, [m]), { MessageList: c, PromptInput: h, WelcomeScreen: p } =
|
|
191
|
-
() =>
|
|
192
|
-
[
|
|
193
|
+
function dn({ classNames: t = {} }) {
|
|
194
|
+
const { t: a, i18n: n } = q(["chat"]), { threadId: r, messages: i, status: o, send: m, addToolOutput: u } = zt(), g = Le((z) => {
|
|
195
|
+
m({ text: z });
|
|
196
|
+
}, [m]), { MessageList: c, PromptInput: h, WelcomeScreen: p } = ie(), f = ee((z) => z.composer), b = ee((z) => z.disclaimer), _ = H((z) => z.app.cacheNamespace), v = n.exists("chat:disclaimer") ? a("chat:disclaimer") : null, k = typeof b == "string" ? Ka(b, a, n, ["chat"]) : b ?? v, I = i[i.length - 1], y = I?.role === "assistant" && (o === "ready" || I.parts.some((z) => z.type === "data-chat-finished")), U = o === "error", D = r === null && i.length === 0 && o !== "submitted", T = O(() => It(h), [h]), [te, V] = Ja(), X = O(
|
|
197
|
+
() => V ? { "--gentiq-composer-inset": `${V}px` } : void 0,
|
|
198
|
+
[V]
|
|
193
199
|
);
|
|
194
200
|
return /* @__PURE__ */ s(
|
|
195
|
-
|
|
201
|
+
Ee.Root,
|
|
196
202
|
{
|
|
197
203
|
enabled: f?.references?.enabled ?? !0,
|
|
198
204
|
maxItems: f?.references?.maxItems,
|
|
199
205
|
maxExcerptLength: f?.references?.maxExcerptLength,
|
|
200
206
|
children: [
|
|
201
207
|
/* @__PURE__ */ e(
|
|
202
|
-
|
|
208
|
+
ka,
|
|
203
209
|
{
|
|
204
|
-
message:
|
|
205
|
-
disabled: !
|
|
206
|
-
cacheNamespace:
|
|
210
|
+
message: I,
|
|
211
|
+
disabled: !y || o !== "ready",
|
|
212
|
+
cacheNamespace: _,
|
|
207
213
|
onAnswer: u,
|
|
208
214
|
children: /* @__PURE__ */ s(
|
|
209
|
-
|
|
215
|
+
et.Root,
|
|
210
216
|
{
|
|
211
|
-
className:
|
|
217
|
+
className: x(
|
|
212
218
|
"relative flex flex-col h-full overflow-hidden bg-background",
|
|
213
219
|
t.container
|
|
214
220
|
),
|
|
215
221
|
style: X,
|
|
216
222
|
children: [
|
|
217
|
-
!
|
|
223
|
+
!D && /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(c, { className: x("flex-1", t.messageList) }) }),
|
|
218
224
|
/* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
|
|
219
|
-
/* @__PURE__ */ e("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children:
|
|
220
|
-
/* @__PURE__ */ s("div", { ref:
|
|
225
|
+
/* @__PURE__ */ e("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children: D && /* @__PURE__ */ e(p, { onSuggestionClick: g }) }),
|
|
226
|
+
/* @__PURE__ */ s("div", { ref: te, className: "shrink-0 flex flex-col items-stretch", children: [
|
|
221
227
|
/* @__PURE__ */ e(
|
|
222
|
-
|
|
228
|
+
T,
|
|
223
229
|
{
|
|
224
230
|
onSend: m,
|
|
225
|
-
status:
|
|
226
|
-
isErrorVisible:
|
|
231
|
+
status: o,
|
|
232
|
+
isErrorVisible: U,
|
|
227
233
|
threadId: r,
|
|
228
|
-
newChat:
|
|
229
|
-
className:
|
|
234
|
+
newChat: D,
|
|
235
|
+
className: x(
|
|
230
236
|
"pointer-events-auto",
|
|
231
237
|
t.inputArea,
|
|
232
|
-
|
|
238
|
+
k && "pb-0 md:pb-0"
|
|
233
239
|
)
|
|
234
240
|
}
|
|
235
241
|
),
|
|
236
|
-
|
|
242
|
+
k && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
|
|
237
243
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 bg-background pointer-events-none -z-10" }),
|
|
238
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground select-none text-center leading-tight", children:
|
|
244
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground select-none text-center leading-tight", children: k })
|
|
239
245
|
] })
|
|
240
246
|
] }),
|
|
241
247
|
/* @__PURE__ */ e(
|
|
242
248
|
"div",
|
|
243
249
|
{
|
|
244
|
-
className:
|
|
250
|
+
className: x(
|
|
245
251
|
"basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out",
|
|
246
|
-
|
|
252
|
+
D ? "grow" : "grow-0"
|
|
247
253
|
)
|
|
248
254
|
}
|
|
249
255
|
)
|
|
@@ -253,34 +259,34 @@ function un({ classNames: t = {} }) {
|
|
|
253
259
|
)
|
|
254
260
|
}
|
|
255
261
|
),
|
|
256
|
-
/* @__PURE__ */ e(
|
|
262
|
+
/* @__PURE__ */ e(on, {})
|
|
257
263
|
]
|
|
258
264
|
}
|
|
259
265
|
);
|
|
260
266
|
}
|
|
261
|
-
const
|
|
267
|
+
const un = ({
|
|
262
268
|
threadId: t,
|
|
263
269
|
onThreadChange: a,
|
|
264
270
|
components: n,
|
|
265
271
|
welcome: r,
|
|
266
|
-
threadActions:
|
|
267
|
-
composer:
|
|
272
|
+
threadActions: i,
|
|
273
|
+
composer: o,
|
|
268
274
|
disclaimer: m,
|
|
269
275
|
...u
|
|
270
276
|
}) => {
|
|
271
|
-
const g =
|
|
272
|
-
|
|
277
|
+
const g = Ze(), c = /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(
|
|
278
|
+
De,
|
|
273
279
|
{
|
|
274
280
|
components: n,
|
|
275
281
|
welcome: r,
|
|
276
|
-
threadActions:
|
|
277
|
-
composer:
|
|
282
|
+
threadActions: i,
|
|
283
|
+
composer: o,
|
|
278
284
|
disclaimer: m,
|
|
279
|
-
children: /* @__PURE__ */ e(
|
|
285
|
+
children: /* @__PURE__ */ e(dn, { ...u })
|
|
280
286
|
}
|
|
281
287
|
) });
|
|
282
288
|
return g && t === void 0 && a === void 0 ? c : /* @__PURE__ */ e(
|
|
283
|
-
|
|
289
|
+
Je,
|
|
284
290
|
{
|
|
285
291
|
threadId: t,
|
|
286
292
|
onThreadChange: a,
|
|
@@ -289,20 +295,20 @@ const mn = ({
|
|
|
289
295
|
}
|
|
290
296
|
);
|
|
291
297
|
};
|
|
292
|
-
function
|
|
293
|
-
return /* @__PURE__ */ e(
|
|
298
|
+
function mn() {
|
|
299
|
+
return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e("div", { className: "min-h-dvh bg-background" }) });
|
|
294
300
|
}
|
|
295
|
-
const
|
|
296
|
-
|
|
301
|
+
const hn = ({ theme: t = "system", ...a }) => /* @__PURE__ */ e(
|
|
302
|
+
Ha,
|
|
297
303
|
{
|
|
298
304
|
theme: t,
|
|
299
305
|
className: "toaster group",
|
|
300
306
|
icons: {
|
|
301
|
-
success: /* @__PURE__ */ e(
|
|
302
|
-
info: /* @__PURE__ */ e(
|
|
303
|
-
warning: /* @__PURE__ */ e(
|
|
304
|
-
error: /* @__PURE__ */ e(
|
|
305
|
-
loading: /* @__PURE__ */ e(
|
|
307
|
+
success: /* @__PURE__ */ e(Wt, { className: "size-4" }),
|
|
308
|
+
info: /* @__PURE__ */ e(Qt, { className: "size-4" }),
|
|
309
|
+
warning: /* @__PURE__ */ e(Kt, { className: "size-4" }),
|
|
310
|
+
error: /* @__PURE__ */ e(Vt, { className: "size-4" }),
|
|
311
|
+
loading: /* @__PURE__ */ e(Ht, { className: "size-4 animate-spin" })
|
|
306
312
|
},
|
|
307
313
|
style: {
|
|
308
314
|
"--normal-bg": "var(--gentiq-popover)",
|
|
@@ -314,67 +320,67 @@ const gn = ({ theme: t = "system", ...a }) => /* @__PURE__ */ e(
|
|
|
314
320
|
...a
|
|
315
321
|
}
|
|
316
322
|
);
|
|
317
|
-
function
|
|
318
|
-
const { resolvedTheme: t } =
|
|
319
|
-
return /* @__PURE__ */ e(
|
|
323
|
+
function gn() {
|
|
324
|
+
const { resolvedTheme: t } = se();
|
|
325
|
+
return /* @__PURE__ */ e(hn, { richColors: !0, theme: t });
|
|
320
326
|
}
|
|
321
|
-
const
|
|
322
|
-
|
|
327
|
+
const pn = bt(Ca), fn = ({ message: t }) => {
|
|
328
|
+
E.error(t);
|
|
323
329
|
};
|
|
324
|
-
function
|
|
330
|
+
function bn({
|
|
325
331
|
toaster: t = !0,
|
|
326
332
|
fallback: a,
|
|
327
|
-
onConfigUnavailable: n =
|
|
333
|
+
onConfigUnavailable: n = fn,
|
|
328
334
|
children: r,
|
|
329
|
-
...
|
|
335
|
+
...i
|
|
330
336
|
}) {
|
|
331
337
|
return /* @__PURE__ */ e(
|
|
332
|
-
|
|
338
|
+
Rt,
|
|
333
339
|
{
|
|
334
|
-
...
|
|
335
|
-
fallback: a ?? /* @__PURE__ */ e(
|
|
340
|
+
...i,
|
|
341
|
+
fallback: a ?? /* @__PURE__ */ e(mn, {}),
|
|
336
342
|
onConfigUnavailable: n,
|
|
337
|
-
overlay: t && /* @__PURE__ */ e(
|
|
338
|
-
children: /* @__PURE__ */ e(
|
|
343
|
+
overlay: t && /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(gn, {}) }),
|
|
344
|
+
children: /* @__PURE__ */ e(Ye.PartsProvider, { components: pn, children: r })
|
|
339
345
|
}
|
|
340
346
|
);
|
|
341
347
|
}
|
|
342
|
-
function
|
|
343
|
-
const { language: t, dir: a } =
|
|
344
|
-
return
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
|
|
348
|
+
function vn() {
|
|
349
|
+
const { language: t, dir: a } = J(), { resolvedTheme: n } = se(), r = H((o) => o.app.name), i = H((o) => o.app.favicon);
|
|
350
|
+
return R(() => {
|
|
351
|
+
const o = document.documentElement, m = { lang: o.lang, dir: o.dir };
|
|
352
|
+
return o.lang = t, o.dir = a, () => {
|
|
353
|
+
o.lang = m.lang, o.dir = m.dir;
|
|
348
354
|
};
|
|
349
|
-
}, [t, a]),
|
|
350
|
-
const
|
|
351
|
-
return
|
|
352
|
-
u ||
|
|
355
|
+
}, [t, a]), R(() => {
|
|
356
|
+
const o = document.documentElement, m = o.style.colorScheme, u = o.classList.contains(n);
|
|
357
|
+
return o.classList.add(n), o.style.colorScheme = n, () => {
|
|
358
|
+
u || o.classList.remove(n), o.style.colorScheme = m;
|
|
353
359
|
};
|
|
354
|
-
}, [n]),
|
|
360
|
+
}, [n]), R(() => {
|
|
355
361
|
if (!r) return;
|
|
356
|
-
const
|
|
362
|
+
const o = document.title;
|
|
357
363
|
return document.title = r, () => {
|
|
358
|
-
document.title =
|
|
364
|
+
document.title = o;
|
|
359
365
|
};
|
|
360
|
-
}, [r]),
|
|
361
|
-
if (!
|
|
362
|
-
const
|
|
363
|
-
return m.href =
|
|
364
|
-
|
|
366
|
+
}, [r]), R(() => {
|
|
367
|
+
if (!i) return;
|
|
368
|
+
const o = document.querySelector("link[rel~='icon']"), m = o ?? Object.assign(document.createElement("link"), { rel: "icon" }), u = m.getAttribute("href");
|
|
369
|
+
return m.href = i, o || document.head.appendChild(m), () => {
|
|
370
|
+
o ? u === null ? m.removeAttribute("href") : m.setAttribute("href", u) : m.remove();
|
|
365
371
|
};
|
|
366
|
-
}, [
|
|
372
|
+
}, [i]), null;
|
|
367
373
|
}
|
|
368
|
-
function
|
|
369
|
-
const
|
|
374
|
+
function xn({ children: t, fallback: a, loginCode: n, onLoginCodeUsed: r }) {
|
|
375
|
+
const i = Dt(), [o, m] = S(
|
|
370
376
|
() => n ? "pending" : "idle"
|
|
371
377
|
);
|
|
372
|
-
|
|
378
|
+
R(() => {
|
|
373
379
|
if (!n) return;
|
|
374
380
|
let c = !1;
|
|
375
381
|
return m("pending"), (async () => {
|
|
376
382
|
try {
|
|
377
|
-
await
|
|
383
|
+
await i(n);
|
|
378
384
|
} catch (h) {
|
|
379
385
|
if (c) return;
|
|
380
386
|
console.error("Could not sign in with the login code:", h), m("failed");
|
|
@@ -385,68 +391,68 @@ function yn({ children: t, fallback: a, loginCode: n, onLoginCodeUsed: r }) {
|
|
|
385
391
|
c = !0;
|
|
386
392
|
};
|
|
387
393
|
}, [n]);
|
|
388
|
-
const u =
|
|
389
|
-
return g ? /* @__PURE__ */ e(fe, { children: typeof a == "function" ? a(g) : a }) :
|
|
394
|
+
const u = Ft({ enabled: o === "idle" }), g = o === "failed" ? "handoff_failed" : o === "idle" && (u === "signed_out" || u === "session_expired") ? u : null;
|
|
395
|
+
return g ? /* @__PURE__ */ e(fe, { children: typeof a == "function" ? a(g) : a }) : o === "pending" || u === "checking" ? /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center bg-background", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) }) : /* @__PURE__ */ e(fe, { children: t });
|
|
390
396
|
}
|
|
391
|
-
const
|
|
392
|
-
function
|
|
393
|
-
return /* @__PURE__ */ e(
|
|
397
|
+
const Be = (t) => t.replace(/[^0-9]/g, "");
|
|
398
|
+
function yn(t) {
|
|
399
|
+
return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(Nn, { ...t }) });
|
|
394
400
|
}
|
|
395
|
-
function
|
|
396
|
-
const { t: n } =
|
|
401
|
+
function Nn({ onSignedIn: t, reason: a }) {
|
|
402
|
+
const { t: n } = q(["login"]), r = H((d) => d.app), i = ze(), o = J().dir === "rtl", m = tt(), [u, g] = S("login"), c = !!r?.disableSignup, h = !!r?.disableAuthPage, p = O(
|
|
397
403
|
() => r?.loginFields ?? ["username"],
|
|
398
404
|
[r?.loginFields]
|
|
399
405
|
), f = {
|
|
400
406
|
username: { labelKey: "username", labelDefault: "Username", inputType: "text" },
|
|
401
407
|
email: { labelKey: "email", labelDefault: "Email", inputType: "email" },
|
|
402
408
|
phone: { labelKey: "phone", labelDefault: "Phone", inputType: "tel" }
|
|
403
|
-
},
|
|
409
|
+
}, b = p.map((d) => n(f[d].labelKey, f[d].labelDefault)).join(" / "), _ = p.length === 1 ? f[p[0]].inputType : "text", v = p.length === 1 && p[0] === "phone", k = (d) => v ? Be(d) : d, [I, y] = S(""), [U, D] = S(""), [T, te] = S({}), V = (d, N) => te((P) => ({ ...P, [d]: N })), [X, z] = S(""), [oe, ve] = S(""), [le, ce] = S(""), Y = O(
|
|
404
410
|
() => r?.userMetadataFields?.filter((d) => d.showInSignup) || [],
|
|
405
411
|
[r?.userMetadataFields]
|
|
406
|
-
), [
|
|
412
|
+
), [L, M] = S(() => {
|
|
407
413
|
const d = {};
|
|
408
|
-
return
|
|
409
|
-
|
|
414
|
+
return Y.forEach((N) => {
|
|
415
|
+
N.defaultValue !== void 0 && (d[N.key] = N.defaultValue);
|
|
410
416
|
}), d;
|
|
411
417
|
});
|
|
412
|
-
|
|
413
|
-
const d = { ...
|
|
414
|
-
let
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}),
|
|
418
|
-
}, [
|
|
419
|
-
const [
|
|
420
|
-
|
|
418
|
+
R(() => {
|
|
419
|
+
const d = { ...L };
|
|
420
|
+
let N = !1;
|
|
421
|
+
Y.forEach((P) => {
|
|
422
|
+
P.condition && !Te(P.condition, L) && d[P.key] !== void 0 && (delete d[P.key], N = !0);
|
|
423
|
+
}), N && M(d);
|
|
424
|
+
}, [L, Y]);
|
|
425
|
+
const [j, B] = S(""), [Z, K] = S(!1);
|
|
426
|
+
R(() => {
|
|
421
427
|
c && u === "register" && g("login");
|
|
422
428
|
}, [c, u]);
|
|
423
429
|
const de = async (d) => {
|
|
424
|
-
d.preventDefault(),
|
|
430
|
+
d.preventDefault(), B(""), K(!0);
|
|
425
431
|
try {
|
|
426
|
-
await
|
|
427
|
-
} catch (
|
|
428
|
-
|
|
432
|
+
await i.login(I, U), m.clear(), t();
|
|
433
|
+
} catch (N) {
|
|
434
|
+
B(re(N, n));
|
|
429
435
|
} finally {
|
|
430
|
-
|
|
436
|
+
K(!1);
|
|
431
437
|
}
|
|
432
|
-
},
|
|
433
|
-
d.preventDefault(),
|
|
434
|
-
const
|
|
435
|
-
for (const
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
+
}, Ie = async (d) => {
|
|
439
|
+
d.preventDefault(), B("");
|
|
440
|
+
const N = {};
|
|
441
|
+
for (const P of p) {
|
|
442
|
+
const l = T[P]?.trim();
|
|
443
|
+
l && (N[P] = l);
|
|
438
444
|
}
|
|
439
|
-
if (Object.keys(
|
|
440
|
-
|
|
445
|
+
if (Object.keys(N).length === 0) {
|
|
446
|
+
B(n("at_least_one_login_field", "Please provide at least one login field."));
|
|
441
447
|
return;
|
|
442
448
|
}
|
|
443
|
-
|
|
449
|
+
K(!0);
|
|
444
450
|
try {
|
|
445
|
-
await
|
|
446
|
-
} catch (
|
|
447
|
-
|
|
451
|
+
await i.register(N, X, oe, le, L), m.clear(), t();
|
|
452
|
+
} catch (P) {
|
|
453
|
+
B(re(P, n));
|
|
448
454
|
} finally {
|
|
449
|
-
|
|
455
|
+
K(!1);
|
|
450
456
|
}
|
|
451
457
|
};
|
|
452
458
|
if (h) {
|
|
@@ -455,7 +461,7 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
455
461
|
"div",
|
|
456
462
|
{
|
|
457
463
|
className: "min-h-screen bg-background flex items-center justify-center p-4",
|
|
458
|
-
dir:
|
|
464
|
+
dir: o ? "rtl" : "ltr",
|
|
459
465
|
children: /* @__PURE__ */ s("div", { className: "w-full max-w-lg bg-card border border-border rounded-xl shadow-lg p-8 text-center space-y-4", children: [
|
|
460
466
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: r?.name }),
|
|
461
467
|
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: d ? n("handoff_failed_title", "This sign-in link has expired or was already used.") : n("auth_page_disabled_title", "The sign-in page is currently disabled.") }),
|
|
@@ -468,7 +474,7 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
468
474
|
"div",
|
|
469
475
|
{
|
|
470
476
|
className: "min-h-screen bg-background flex flex-col items-center justify-center p-4",
|
|
471
|
-
dir:
|
|
477
|
+
dir: o ? "rtl" : "ltr",
|
|
472
478
|
children: /* @__PURE__ */ s("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
|
|
473
479
|
/* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground", children: r?.name }) }),
|
|
474
480
|
/* @__PURE__ */ s("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
|
|
@@ -477,7 +483,7 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
477
483
|
{
|
|
478
484
|
type: "button",
|
|
479
485
|
onClick: () => {
|
|
480
|
-
g("login"),
|
|
486
|
+
g("login"), B("");
|
|
481
487
|
},
|
|
482
488
|
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${u === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
483
489
|
children: n("login_tab", "Login")
|
|
@@ -488,7 +494,7 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
488
494
|
{
|
|
489
495
|
type: "button",
|
|
490
496
|
onClick: () => {
|
|
491
|
-
g("register"),
|
|
497
|
+
g("register"), B("");
|
|
492
498
|
},
|
|
493
499
|
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${u === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
494
500
|
children: n("signup_tab", "Sign Up")
|
|
@@ -497,30 +503,30 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
497
503
|
] }),
|
|
498
504
|
u === "login" && /* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-4", children: [
|
|
499
505
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
500
|
-
/* @__PURE__ */ e(
|
|
506
|
+
/* @__PURE__ */ e(A, { htmlFor: "login-identity", children: b }),
|
|
501
507
|
/* @__PURE__ */ e(
|
|
502
|
-
|
|
508
|
+
F,
|
|
503
509
|
{
|
|
504
510
|
id: "login-identity",
|
|
505
|
-
type:
|
|
506
|
-
value:
|
|
507
|
-
onChange: (d) =>
|
|
511
|
+
type: _,
|
|
512
|
+
value: I,
|
|
513
|
+
onChange: (d) => y(k(d.target.value)),
|
|
508
514
|
required: !0,
|
|
509
515
|
className: "text-start",
|
|
510
|
-
placeholder:
|
|
516
|
+
placeholder: b,
|
|
511
517
|
dir: "ltr"
|
|
512
518
|
}
|
|
513
519
|
)
|
|
514
520
|
] }),
|
|
515
521
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
516
|
-
/* @__PURE__ */ e(
|
|
522
|
+
/* @__PURE__ */ e(A, { htmlFor: "login-pass", children: n("password", "Password") }),
|
|
517
523
|
/* @__PURE__ */ e(
|
|
518
|
-
|
|
524
|
+
F,
|
|
519
525
|
{
|
|
520
526
|
id: "login-pass",
|
|
521
527
|
type: "password",
|
|
522
|
-
value:
|
|
523
|
-
onChange: (d) =>
|
|
528
|
+
value: U,
|
|
529
|
+
onChange: (d) => D(d.target.value),
|
|
524
530
|
required: !0,
|
|
525
531
|
className: "text-start",
|
|
526
532
|
placeholder: "••••••••",
|
|
@@ -528,38 +534,38 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
528
534
|
}
|
|
529
535
|
)
|
|
530
536
|
] }),
|
|
531
|
-
|
|
532
|
-
/* @__PURE__ */ e($, { type: "submit", disabled:
|
|
537
|
+
j && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: j }),
|
|
538
|
+
/* @__PURE__ */ e($, { type: "submit", disabled: Z, className: "w-full font-semibold", children: Z ? n("logging_in", "Logging in...") : n("login_button", "Login") })
|
|
533
539
|
] }),
|
|
534
|
-
!c && u === "register" && /* @__PURE__ */ s("form", { onSubmit:
|
|
540
|
+
!c && u === "register" && /* @__PURE__ */ s("form", { onSubmit: Ie, className: "space-y-4", children: [
|
|
535
541
|
p.map((d) => {
|
|
536
|
-
const
|
|
542
|
+
const N = f[d], P = n(N.labelKey, N.labelDefault), l = (C) => d === "phone" ? Be(C) : C;
|
|
537
543
|
return /* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
538
|
-
/* @__PURE__ */ e(
|
|
544
|
+
/* @__PURE__ */ e(A, { htmlFor: `reg-${d}`, children: P }),
|
|
539
545
|
/* @__PURE__ */ e(
|
|
540
|
-
|
|
546
|
+
F,
|
|
541
547
|
{
|
|
542
548
|
id: `reg-${d}`,
|
|
543
|
-
type:
|
|
544
|
-
value:
|
|
545
|
-
onChange: (
|
|
549
|
+
type: N.inputType,
|
|
550
|
+
value: T[d] ?? "",
|
|
551
|
+
onChange: (C) => V(d, l(C.target.value)),
|
|
546
552
|
required: p.length === 1,
|
|
547
553
|
className: "text-start",
|
|
548
|
-
placeholder: n(`${
|
|
554
|
+
placeholder: n(`${N.labelKey}_placeholder`, N.labelDefault),
|
|
549
555
|
dir: "ltr"
|
|
550
556
|
}
|
|
551
557
|
)
|
|
552
558
|
] }, d);
|
|
553
559
|
}),
|
|
554
560
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
555
|
-
/* @__PURE__ */ e(
|
|
561
|
+
/* @__PURE__ */ e(A, { htmlFor: "reg-pass", children: n("password", "Password") }),
|
|
556
562
|
/* @__PURE__ */ e(
|
|
557
|
-
|
|
563
|
+
F,
|
|
558
564
|
{
|
|
559
565
|
id: "reg-pass",
|
|
560
566
|
type: "password",
|
|
561
567
|
value: X,
|
|
562
|
-
onChange: (d) =>
|
|
568
|
+
onChange: (d) => z(d.target.value),
|
|
563
569
|
required: !0,
|
|
564
570
|
className: "text-start",
|
|
565
571
|
placeholder: "••••••••",
|
|
@@ -569,13 +575,13 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
569
575
|
] }),
|
|
570
576
|
/* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
571
577
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
572
|
-
/* @__PURE__ */ e(
|
|
578
|
+
/* @__PURE__ */ e(A, { htmlFor: "reg-name", children: n("name", "Name") }),
|
|
573
579
|
/* @__PURE__ */ e(
|
|
574
|
-
|
|
580
|
+
F,
|
|
575
581
|
{
|
|
576
582
|
id: "reg-name",
|
|
577
583
|
type: "text",
|
|
578
|
-
value:
|
|
584
|
+
value: oe,
|
|
579
585
|
onChange: (d) => ve(d.target.value),
|
|
580
586
|
required: !0,
|
|
581
587
|
className: "text-start",
|
|
@@ -584,14 +590,14 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
584
590
|
)
|
|
585
591
|
] }),
|
|
586
592
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
587
|
-
/* @__PURE__ */ e(
|
|
593
|
+
/* @__PURE__ */ e(A, { htmlFor: "reg-surname", children: n("surname", "Surname") }),
|
|
588
594
|
/* @__PURE__ */ e(
|
|
589
|
-
|
|
595
|
+
F,
|
|
590
596
|
{
|
|
591
597
|
id: "reg-surname",
|
|
592
598
|
type: "text",
|
|
593
|
-
value:
|
|
594
|
-
onChange: (d) =>
|
|
599
|
+
value: le,
|
|
600
|
+
onChange: (d) => ce(d.target.value),
|
|
595
601
|
required: !0,
|
|
596
602
|
className: "text-start",
|
|
597
603
|
placeholder: n("surname_placeholder", "Last Name")
|
|
@@ -599,31 +605,31 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
599
605
|
)
|
|
600
606
|
] })
|
|
601
607
|
] }),
|
|
602
|
-
|
|
608
|
+
Y.map((d) => Te(d.condition, L) ? /* @__PURE__ */ s(
|
|
603
609
|
"div",
|
|
604
610
|
{
|
|
605
611
|
className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
606
612
|
children: [
|
|
607
|
-
/* @__PURE__ */ e(
|
|
613
|
+
/* @__PURE__ */ e(A, { htmlFor: `signup-${d.key}`, children: n(d.label) }),
|
|
608
614
|
d.type === "select" ? /* @__PURE__ */ s(
|
|
609
615
|
we,
|
|
610
616
|
{
|
|
611
|
-
value: String(
|
|
612
|
-
onValueChange: (
|
|
617
|
+
value: String(L[d.key] || ""),
|
|
618
|
+
onValueChange: (N) => M({ ...L, [d.key]: N }),
|
|
613
619
|
required: d.required,
|
|
614
|
-
dir:
|
|
620
|
+
dir: o ? "rtl" : "ltr",
|
|
615
621
|
children: [
|
|
616
622
|
/* @__PURE__ */ e(Se, { className: "bg-background text-start", children: /* @__PURE__ */ e(ke, { placeholder: n(d.placeholder || "select_placeholder") }) }),
|
|
617
|
-
/* @__PURE__ */ e(Ce, { className: "rounded-xl", children: d.options?.map((
|
|
623
|
+
/* @__PURE__ */ e(Ce, { className: "rounded-xl", children: d.options?.map((N) => /* @__PURE__ */ e(_e, { value: String(N.value), children: n(N.label) }, String(N.value))) })
|
|
618
624
|
]
|
|
619
625
|
}
|
|
620
626
|
) : d.type === "checkbox" ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-2", children: [
|
|
621
627
|
/* @__PURE__ */ e(
|
|
622
|
-
|
|
628
|
+
_a,
|
|
623
629
|
{
|
|
624
630
|
id: `signup-${d.key}`,
|
|
625
|
-
checked: !!
|
|
626
|
-
onCheckedChange: (
|
|
631
|
+
checked: !!L[d.key],
|
|
632
|
+
onCheckedChange: (N) => M({ ...L, [d.key]: !!N }),
|
|
627
633
|
required: d.required
|
|
628
634
|
}
|
|
629
635
|
),
|
|
@@ -636,12 +642,12 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
636
642
|
}
|
|
637
643
|
)
|
|
638
644
|
] }) : /* @__PURE__ */ e(
|
|
639
|
-
|
|
645
|
+
F,
|
|
640
646
|
{
|
|
641
647
|
id: `signup-${d.key}`,
|
|
642
648
|
type: d.type,
|
|
643
|
-
value:
|
|
644
|
-
onChange: (
|
|
649
|
+
value: L[d.key] || "",
|
|
650
|
+
onChange: (N) => M({ ...L, [d.key]: N.target.value }),
|
|
645
651
|
required: d.required,
|
|
646
652
|
className: "text-start",
|
|
647
653
|
placeholder: n(d.placeholder || "")
|
|
@@ -651,92 +657,92 @@ function wn({ onSignedIn: t, reason: a }) {
|
|
|
651
657
|
},
|
|
652
658
|
d.key
|
|
653
659
|
) : null),
|
|
654
|
-
|
|
655
|
-
/* @__PURE__ */ e($, { type: "submit", disabled:
|
|
660
|
+
j && /* @__PURE__ */ e("div", { role: "alert", className: "text-sm text-destructive", children: j }),
|
|
661
|
+
/* @__PURE__ */ e($, { type: "submit", disabled: Z, className: "w-full font-semibold", children: Z ? n("signing_up", "Signing up...") : n("signup_button", "Sign Up") })
|
|
656
662
|
] })
|
|
657
663
|
] })
|
|
658
664
|
}
|
|
659
665
|
);
|
|
660
666
|
}
|
|
661
|
-
const
|
|
667
|
+
const wn = "sidebar_state", Sn = 3600 * 24 * 7, kn = "19rem", Cn = "18rem", _n = "3rem", Tn = "b", vt = Q.createContext(null);
|
|
662
668
|
function be() {
|
|
663
|
-
const t =
|
|
669
|
+
const t = Q.useContext(vt);
|
|
664
670
|
if (!t)
|
|
665
671
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
666
672
|
return t;
|
|
667
673
|
}
|
|
668
|
-
function
|
|
674
|
+
function In({
|
|
669
675
|
defaultOpen: t = !0,
|
|
670
676
|
open: a,
|
|
671
677
|
onOpenChange: n,
|
|
672
678
|
className: r,
|
|
673
|
-
style:
|
|
674
|
-
children:
|
|
679
|
+
style: i,
|
|
680
|
+
children: o,
|
|
675
681
|
...m
|
|
676
682
|
}) {
|
|
677
|
-
const u =
|
|
678
|
-
(
|
|
679
|
-
const
|
|
680
|
-
n ? n(
|
|
683
|
+
const u = it(), [g, c] = Q.useState(!1), [h, p] = Q.useState(t), f = a ?? h, b = Q.useCallback(
|
|
684
|
+
(I) => {
|
|
685
|
+
const y = typeof I == "function" ? I(f) : I;
|
|
686
|
+
n ? n(y) : p(y), document.cookie = `${wn}=${y}; path=/; max-age=${Sn}`;
|
|
681
687
|
},
|
|
682
688
|
[n, f]
|
|
683
|
-
),
|
|
684
|
-
u ? c((
|
|
685
|
-
}, [u,
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
+
), _ = Q.useCallback(() => {
|
|
690
|
+
u ? c((I) => !I) : b((I) => !I);
|
|
691
|
+
}, [u, b, c]);
|
|
692
|
+
Q.useEffect(() => {
|
|
693
|
+
const I = (y) => {
|
|
694
|
+
y.key === Tn && (y.metaKey || y.ctrlKey) && (y.preventDefault(), _());
|
|
689
695
|
};
|
|
690
|
-
return window.addEventListener("keydown",
|
|
691
|
-
window.removeEventListener("keydown",
|
|
696
|
+
return window.addEventListener("keydown", I), () => {
|
|
697
|
+
window.removeEventListener("keydown", I);
|
|
692
698
|
};
|
|
693
|
-
}, [
|
|
694
|
-
const
|
|
699
|
+
}, [_]);
|
|
700
|
+
const v = f ? "expanded" : "collapsed", k = Q.useMemo(
|
|
695
701
|
() => ({
|
|
696
|
-
state:
|
|
702
|
+
state: v,
|
|
697
703
|
open: f,
|
|
698
|
-
setOpen:
|
|
704
|
+
setOpen: b,
|
|
699
705
|
isMobile: u,
|
|
700
706
|
openMobile: g,
|
|
701
707
|
setOpenMobile: c,
|
|
702
|
-
toggleSidebar:
|
|
708
|
+
toggleSidebar: _
|
|
703
709
|
}),
|
|
704
|
-
[
|
|
710
|
+
[v, f, b, u, g, c, _]
|
|
705
711
|
);
|
|
706
|
-
return /* @__PURE__ */ e(
|
|
712
|
+
return /* @__PURE__ */ e(vt.Provider, { value: k, children: /* @__PURE__ */ e(ot, { delayDuration: 0, children: /* @__PURE__ */ e(
|
|
707
713
|
"div",
|
|
708
714
|
{
|
|
709
715
|
"data-slot": "sidebar-wrapper",
|
|
710
716
|
style: {
|
|
711
|
-
"--gentiq-sidebar-width":
|
|
712
|
-
"--gentiq-sidebar-width-icon":
|
|
713
|
-
...
|
|
717
|
+
"--gentiq-sidebar-width": kn,
|
|
718
|
+
"--gentiq-sidebar-width-icon": _n,
|
|
719
|
+
...i
|
|
714
720
|
},
|
|
715
|
-
className:
|
|
721
|
+
className: x("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", r),
|
|
716
722
|
...m,
|
|
717
|
-
children:
|
|
723
|
+
children: o
|
|
718
724
|
}
|
|
719
725
|
) }) });
|
|
720
726
|
}
|
|
721
|
-
function
|
|
727
|
+
function qn({
|
|
722
728
|
side: t = "start",
|
|
723
729
|
variant: a = "sidebar",
|
|
724
730
|
collapsible: n = "offcanvas",
|
|
725
731
|
className: r,
|
|
726
|
-
children:
|
|
727
|
-
...
|
|
732
|
+
children: i,
|
|
733
|
+
...o
|
|
728
734
|
}) {
|
|
729
|
-
const { isMobile: m, state: u, openMobile: g, setOpenMobile: c } = be(), { t: h } =
|
|
735
|
+
const { isMobile: m, state: u, openMobile: g, setOpenMobile: c } = be(), { t: h } = q("sidebar");
|
|
730
736
|
return n === "none" ? /* @__PURE__ */ e(
|
|
731
737
|
"div",
|
|
732
738
|
{
|
|
733
739
|
"data-slot": "sidebar",
|
|
734
|
-
className:
|
|
735
|
-
...
|
|
736
|
-
children:
|
|
740
|
+
className: x("bg-sidebar text-sidebar-foreground flex h-full w-(--gentiq-sidebar-width) flex-col", r),
|
|
741
|
+
...o,
|
|
742
|
+
children: i
|
|
737
743
|
}
|
|
738
|
-
) : m ? /* @__PURE__ */ e(
|
|
739
|
-
|
|
744
|
+
) : m ? /* @__PURE__ */ e(Ta, { open: g, onOpenChange: c, ...o, children: /* @__PURE__ */ s(
|
|
745
|
+
Ia,
|
|
740
746
|
{
|
|
741
747
|
onOpenAutoFocus: (p) => p.preventDefault(),
|
|
742
748
|
"data-sidebar": "sidebar",
|
|
@@ -744,15 +750,15 @@ function Ln({
|
|
|
744
750
|
"data-mobile": "true",
|
|
745
751
|
className: "bg-sidebar text-sidebar-foreground w-(--gentiq-sidebar-width) p-0 [&>button]:hidden",
|
|
746
752
|
style: {
|
|
747
|
-
"--gentiq-sidebar-width":
|
|
753
|
+
"--gentiq-sidebar-width": Cn
|
|
748
754
|
},
|
|
749
755
|
side: t,
|
|
750
756
|
children: [
|
|
751
|
-
/* @__PURE__ */ s(
|
|
752
|
-
/* @__PURE__ */ e(
|
|
757
|
+
/* @__PURE__ */ s(qa, { className: "sr-only", children: [
|
|
758
|
+
/* @__PURE__ */ e(La, { children: h("title") }),
|
|
753
759
|
/* @__PURE__ */ e(Ma, { children: h("mobile_description") })
|
|
754
760
|
] }),
|
|
755
|
-
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children:
|
|
761
|
+
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i })
|
|
756
762
|
]
|
|
757
763
|
}
|
|
758
764
|
) }) : /* @__PURE__ */ s(
|
|
@@ -769,7 +775,7 @@ function Ln({
|
|
|
769
775
|
"div",
|
|
770
776
|
{
|
|
771
777
|
"data-slot": "sidebar-gap",
|
|
772
|
-
className:
|
|
778
|
+
className: x(
|
|
773
779
|
"relative w-(--gentiq-sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
774
780
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
775
781
|
a === "floating" || a === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--gentiq-sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--gentiq-sidebar-width-icon)"
|
|
@@ -780,21 +786,21 @@ function Ln({
|
|
|
780
786
|
"div",
|
|
781
787
|
{
|
|
782
788
|
"data-slot": "sidebar-container",
|
|
783
|
-
className:
|
|
789
|
+
className: x(
|
|
784
790
|
"fixed inset-y-0 z-10 hidden h-svh w-(--gentiq-sidebar-width) transition-[inset-inline-start,inset-inline-end,width] duration-200 ease-linear md:flex",
|
|
785
791
|
t === "start" ? "start-0 group-data-[collapsible=offcanvas]:start-[calc(var(--gentiq-sidebar-width)*-1)]" : "end-0 group-data-[collapsible=offcanvas]:end-[calc(var(--gentiq-sidebar-width)*-1)]",
|
|
786
792
|
// Adjust the padding for floating and inset variants.
|
|
787
793
|
a === "floating" || a === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--gentiq-sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--gentiq-sidebar-width-icon) group-data-[side=start]:border-e group-data-[side=end]:border-s",
|
|
788
794
|
r
|
|
789
795
|
),
|
|
790
|
-
...
|
|
796
|
+
...o,
|
|
791
797
|
children: /* @__PURE__ */ e(
|
|
792
798
|
"div",
|
|
793
799
|
{
|
|
794
800
|
"data-sidebar": "sidebar",
|
|
795
801
|
"data-slot": "sidebar-inner",
|
|
796
802
|
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
797
|
-
children:
|
|
803
|
+
children: i
|
|
798
804
|
}
|
|
799
805
|
)
|
|
800
806
|
}
|
|
@@ -803,8 +809,8 @@ function Ln({
|
|
|
803
809
|
}
|
|
804
810
|
);
|
|
805
811
|
}
|
|
806
|
-
function
|
|
807
|
-
const { toggleSidebar: r } = be(), { t:
|
|
812
|
+
function Ln({ className: t, onClick: a, ...n }) {
|
|
813
|
+
const { toggleSidebar: r } = be(), { t: i } = q("sidebar");
|
|
808
814
|
return /* @__PURE__ */ s(
|
|
809
815
|
$,
|
|
810
816
|
{
|
|
@@ -812,14 +818,14 @@ function Pn({ className: t, onClick: a, ...n }) {
|
|
|
812
818
|
"data-slot": "sidebar-trigger",
|
|
813
819
|
variant: "ghost",
|
|
814
820
|
size: "icon",
|
|
815
|
-
className:
|
|
816
|
-
onClick: (
|
|
817
|
-
a?.(
|
|
821
|
+
className: x("size-7", t),
|
|
822
|
+
onClick: (o) => {
|
|
823
|
+
a?.(o), r();
|
|
818
824
|
},
|
|
819
825
|
...n,
|
|
820
826
|
children: [
|
|
821
|
-
/* @__PURE__ */ e(
|
|
822
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children:
|
|
827
|
+
/* @__PURE__ */ e(Xt, {}),
|
|
828
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: i("toggle") })
|
|
823
829
|
]
|
|
824
830
|
}
|
|
825
831
|
);
|
|
@@ -830,7 +836,7 @@ function Mn({ className: t, ...a }) {
|
|
|
830
836
|
{
|
|
831
837
|
"data-slot": "sidebar-content",
|
|
832
838
|
"data-sidebar": "content",
|
|
833
|
-
className:
|
|
839
|
+
className: x(
|
|
834
840
|
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
835
841
|
t
|
|
836
842
|
),
|
|
@@ -838,51 +844,51 @@ function Mn({ className: t, ...a }) {
|
|
|
838
844
|
}
|
|
839
845
|
);
|
|
840
846
|
}
|
|
841
|
-
function
|
|
847
|
+
function Pn({ className: t, ...a }) {
|
|
842
848
|
return /* @__PURE__ */ e(
|
|
843
849
|
"div",
|
|
844
850
|
{
|
|
845
851
|
"data-slot": "sidebar-group",
|
|
846
852
|
"data-sidebar": "group",
|
|
847
|
-
className:
|
|
853
|
+
className: x("relative flex w-full min-w-0 flex-col p-2", t),
|
|
848
854
|
...a
|
|
849
855
|
}
|
|
850
856
|
);
|
|
851
857
|
}
|
|
852
|
-
function
|
|
858
|
+
function Ge({ className: t, ...a }) {
|
|
853
859
|
return /* @__PURE__ */ e(
|
|
854
860
|
"div",
|
|
855
861
|
{
|
|
856
862
|
"data-slot": "sidebar-group-content",
|
|
857
863
|
"data-sidebar": "group-content",
|
|
858
|
-
className:
|
|
864
|
+
className: x("w-full text-sm", t),
|
|
859
865
|
...a
|
|
860
866
|
}
|
|
861
867
|
);
|
|
862
868
|
}
|
|
863
|
-
function
|
|
869
|
+
function xt({ className: t, ...a }) {
|
|
864
870
|
return /* @__PURE__ */ e(
|
|
865
871
|
"ul",
|
|
866
872
|
{
|
|
867
873
|
"data-slot": "sidebar-menu",
|
|
868
874
|
"data-sidebar": "menu",
|
|
869
|
-
className:
|
|
875
|
+
className: x("flex w-full min-w-0 flex-col gap-1", t),
|
|
870
876
|
...a
|
|
871
877
|
}
|
|
872
878
|
);
|
|
873
879
|
}
|
|
874
|
-
function
|
|
880
|
+
function yt({ className: t, ...a }) {
|
|
875
881
|
return /* @__PURE__ */ e(
|
|
876
882
|
"li",
|
|
877
883
|
{
|
|
878
884
|
"data-slot": "sidebar-menu-item",
|
|
879
885
|
"data-sidebar": "menu-item",
|
|
880
|
-
className:
|
|
886
|
+
className: x("group/menu-item relative", t),
|
|
881
887
|
...a
|
|
882
888
|
}
|
|
883
889
|
);
|
|
884
890
|
}
|
|
885
|
-
const
|
|
891
|
+
const An = Bt(
|
|
886
892
|
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
887
893
|
{
|
|
888
894
|
variants: {
|
|
@@ -902,43 +908,43 @@ const zn = Gt(
|
|
|
902
908
|
}
|
|
903
909
|
}
|
|
904
910
|
);
|
|
905
|
-
function
|
|
911
|
+
function Nt({
|
|
906
912
|
asChild: t = !1,
|
|
907
913
|
isActive: a = !1,
|
|
908
914
|
variant: n = "default",
|
|
909
915
|
size: r = "default",
|
|
910
|
-
tooltip:
|
|
911
|
-
className:
|
|
916
|
+
tooltip: i,
|
|
917
|
+
className: o,
|
|
912
918
|
...m
|
|
913
919
|
}) {
|
|
914
|
-
const u = t ?
|
|
920
|
+
const u = t ? jt : "button", { isMobile: g, state: c } = be(), h = /* @__PURE__ */ e(
|
|
915
921
|
u,
|
|
916
922
|
{
|
|
917
923
|
"data-slot": "sidebar-menu-button",
|
|
918
924
|
"data-sidebar": "menu-button",
|
|
919
925
|
"data-size": r,
|
|
920
926
|
"data-active": a,
|
|
921
|
-
className:
|
|
927
|
+
className: x(An({ variant: n, size: r }), o),
|
|
922
928
|
...m
|
|
923
929
|
}
|
|
924
930
|
);
|
|
925
|
-
return
|
|
926
|
-
children:
|
|
927
|
-
}), /* @__PURE__ */ s(
|
|
928
|
-
/* @__PURE__ */ e(
|
|
929
|
-
/* @__PURE__ */ e(
|
|
931
|
+
return i ? (typeof i == "string" && (i = {
|
|
932
|
+
children: i
|
|
933
|
+
}), /* @__PURE__ */ s(lt, { children: [
|
|
934
|
+
/* @__PURE__ */ e(ct, { asChild: !0, children: h }),
|
|
935
|
+
/* @__PURE__ */ e(dt, { side: "right", align: "center", hidden: c !== "collapsed" || g, ...i })
|
|
930
936
|
] })) : h;
|
|
931
937
|
}
|
|
932
|
-
function
|
|
938
|
+
function wt({
|
|
933
939
|
label: t,
|
|
934
940
|
detail: a,
|
|
935
941
|
meter: n,
|
|
936
942
|
remaining: r,
|
|
937
|
-
amount:
|
|
938
|
-
resetsAt:
|
|
943
|
+
amount: i,
|
|
944
|
+
resetsAt: o,
|
|
939
945
|
action: m
|
|
940
946
|
}) {
|
|
941
|
-
const { t: u, i18n: g } =
|
|
947
|
+
const { t: u, i18n: g } = q(["quota"]), c = Ea(r, i);
|
|
942
948
|
return /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
|
|
943
949
|
/* @__PURE__ */ s("div", { className: "flex items-baseline justify-between gap-3 text-sm", children: [
|
|
944
950
|
/* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
|
|
@@ -948,10 +954,10 @@ function St({
|
|
|
948
954
|
] }),
|
|
949
955
|
/* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
950
956
|
/* @__PURE__ */ s("span", { className: "font-semibold tabular-nums text-foreground", children: [
|
|
951
|
-
|
|
957
|
+
$e(n, r, g.language),
|
|
952
958
|
/* @__PURE__ */ s("span", { className: "text-muted-foreground font-normal", children: [
|
|
953
959
|
" / ",
|
|
954
|
-
|
|
960
|
+
$e(n, i, g.language)
|
|
955
961
|
] })
|
|
956
962
|
] }),
|
|
957
963
|
m
|
|
@@ -963,44 +969,44 @@ function St({
|
|
|
963
969
|
className: "h-2 w-full bg-muted/50 rounded-full overflow-hidden",
|
|
964
970
|
role: "meter",
|
|
965
971
|
"aria-valuemin": 0,
|
|
966
|
-
"aria-valuemax":
|
|
972
|
+
"aria-valuemax": i,
|
|
967
973
|
"aria-valuenow": r,
|
|
968
974
|
"aria-label": typeof t == "string" ? t : void 0,
|
|
969
975
|
children: /* @__PURE__ */ e(
|
|
970
976
|
"div",
|
|
971
977
|
{
|
|
972
|
-
className:
|
|
978
|
+
className: x("h-full rounded-full transition-all duration-700", Pa(c)),
|
|
973
979
|
style: { width: `${c}%` }
|
|
974
980
|
}
|
|
975
981
|
)
|
|
976
982
|
}
|
|
977
983
|
),
|
|
978
|
-
|
|
984
|
+
o && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: u("quota:resets_at", { datetime: mt(o, g.language) }) })
|
|
979
985
|
] });
|
|
980
986
|
}
|
|
981
|
-
function
|
|
982
|
-
const { t: r } =
|
|
983
|
-
return /* @__PURE__ */ e("div", { className:
|
|
984
|
-
|
|
987
|
+
function En({ windows: t, className: a, renderAction: n }) {
|
|
988
|
+
const { t: r } = q(["quota"]);
|
|
989
|
+
return /* @__PURE__ */ e("div", { className: x("space-y-4", a), children: t.map((i) => /* @__PURE__ */ e(
|
|
990
|
+
wt,
|
|
985
991
|
{
|
|
986
|
-
label:
|
|
987
|
-
detail:
|
|
988
|
-
meter:
|
|
989
|
-
remaining:
|
|
990
|
-
amount:
|
|
991
|
-
resetsAt:
|
|
992
|
-
action: n?.(
|
|
992
|
+
label: ut(r, i.meter),
|
|
993
|
+
detail: Aa(r, i),
|
|
994
|
+
meter: i.meter,
|
|
995
|
+
remaining: i.remaining,
|
|
996
|
+
amount: i.amount,
|
|
997
|
+
resetsAt: i.resets_at,
|
|
998
|
+
action: n?.(i)
|
|
993
999
|
},
|
|
994
|
-
|
|
1000
|
+
i.key
|
|
995
1001
|
)) });
|
|
996
1002
|
}
|
|
997
|
-
function
|
|
998
|
-
const { t: n } =
|
|
1003
|
+
function zn({ credits: t, action: a }) {
|
|
1004
|
+
const { t: n } = q(["quota"]);
|
|
999
1005
|
return /* @__PURE__ */ e(
|
|
1000
|
-
|
|
1006
|
+
wt,
|
|
1001
1007
|
{
|
|
1002
1008
|
label: n("quota:credits"),
|
|
1003
|
-
detail: n("quota:credits_unit", { meter:
|
|
1009
|
+
detail: n("quota:credits_unit", { meter: ut(n, t.meter) }),
|
|
1004
1010
|
meter: t.meter,
|
|
1005
1011
|
remaining: t.remaining,
|
|
1006
1012
|
amount: t.granted,
|
|
@@ -1008,139 +1014,160 @@ function An({ credits: t, action: a }) {
|
|
|
1008
1014
|
}
|
|
1009
1015
|
);
|
|
1010
1016
|
}
|
|
1011
|
-
const
|
|
1012
|
-
function Dn(
|
|
1013
|
-
|
|
1017
|
+
const Rn = ["system", "light", "dark"], He = "h-11 w-full rounded-xl border-border/50 bg-muted/30 text-base", Ve = "rounded-xl border-border/40 bg-background shadow-xl", Ke = "rounded-lg py-2 text-base focus:bg-primary/10";
|
|
1018
|
+
function Dn({
|
|
1019
|
+
sectionMode: t = "editable",
|
|
1020
|
+
themeMode: a = "editable",
|
|
1021
|
+
languageMode: n = "editable"
|
|
1022
|
+
} = {}) {
|
|
1023
|
+
const { t: r, i18n: i } = q("settings"), o = H((T) => T.app), { theme: m, setTheme: u, locked: g } = se(), { language: c, setLanguage: h, locked: p, dir: f } = J(), b = Fe(), _ = Fe(), v = Qa(i, o?.languages), k = v.find((T) => T === c) ?? c.split("-")[0], I = !g && a !== "hidden", y = !p && n !== "hidden", U = t === "faded" || a === "faded", D = t === "faded" || n === "faded";
|
|
1014
1024
|
return /* @__PURE__ */ s("div", { className: "grid gap-6", children: [
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1025
|
+
I && /* @__PURE__ */ s(
|
|
1026
|
+
"div",
|
|
1027
|
+
{
|
|
1028
|
+
className: `flex flex-col gap-3 ${U ? "opacity-60 pointer-events-none" : ""}`,
|
|
1029
|
+
children: [
|
|
1030
|
+
/* @__PURE__ */ e(A, { htmlFor: b, className: "px-1", children: r("general.theme") }),
|
|
1031
|
+
/* @__PURE__ */ s(
|
|
1032
|
+
we,
|
|
1033
|
+
{
|
|
1034
|
+
value: m,
|
|
1035
|
+
onValueChange: (T) => u(T),
|
|
1036
|
+
dir: f,
|
|
1037
|
+
disabled: U,
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ e(Se, { id: b, className: He, children: /* @__PURE__ */ e(ke, {}) }),
|
|
1040
|
+
/* @__PURE__ */ e(Ce, { className: Ve, children: Rn.map((T) => /* @__PURE__ */ e(_e, { value: T, className: Ke, children: r(`general.themes.${T}`) }, T)) })
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
)
|
|
1044
|
+
]
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
y && /* @__PURE__ */ s(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
className: `flex flex-col gap-3 ${D ? "opacity-60 pointer-events-none" : ""}`,
|
|
1051
|
+
children: [
|
|
1052
|
+
/* @__PURE__ */ e(A, { htmlFor: _, className: "px-1", children: r("general.language") }),
|
|
1053
|
+
/* @__PURE__ */ s(we, { value: k, onValueChange: h, dir: f, disabled: D, children: [
|
|
1054
|
+
/* @__PURE__ */ e(Se, { id: _, className: He, children: /* @__PURE__ */ e(ke, {}) }),
|
|
1055
|
+
/* @__PURE__ */ e(Ce, { className: Ve, children: v.map((T) => /* @__PURE__ */ e(_e, { value: T, lang: T, className: Ke, children: Wa(T) }, T)) })
|
|
1056
|
+
] })
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
)
|
|
1037
1060
|
] });
|
|
1038
1061
|
}
|
|
1039
|
-
function
|
|
1040
|
-
const { t: a, i18n: n } =
|
|
1062
|
+
function Fn({ trigger: t }) {
|
|
1063
|
+
const { t: a, i18n: n } = q(["settings"]), r = H((l) => l.app), i = ee((l) => l.settings), o = ze(), m = tt(), u = Ot(), [g, c] = S(!1), { data: h, refetch: p } = $t({
|
|
1041
1064
|
enabled: g
|
|
1042
|
-
}), f =
|
|
1043
|
-
{ id: "profile", label: a("sections.profile", "Profile"), icon:
|
|
1044
|
-
{ id: "general", label: a("sections.general"), icon:
|
|
1045
|
-
{ id: "account", label: a("sections.account", "Account"), icon:
|
|
1065
|
+
}), f = Ae(null), { locked: b } = se(), { locked: _ } = J(), v = O(() => [
|
|
1066
|
+
{ id: "profile", label: a("sections.profile", "Profile"), icon: Yt },
|
|
1067
|
+
{ id: "general", label: a("sections.general"), icon: Zt },
|
|
1068
|
+
{ id: "account", label: a("sections.account", "Account"), icon: Jt }
|
|
1046
1069
|
].filter((C) => {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1070
|
+
const w = i?.sections?.[C.id];
|
|
1071
|
+
if ((w?.mode ?? (w?.enabled === !1 ? "hidden" : "editable")) === "hidden") return !1;
|
|
1072
|
+
if (C.id === "general") {
|
|
1073
|
+
const me = w?.fields?.theme ?? "editable", xe = w?.fields?.language ?? "editable";
|
|
1074
|
+
return !b && me !== "hidden" || !_ && xe !== "hidden";
|
|
1075
|
+
}
|
|
1076
|
+
return !0;
|
|
1077
|
+
}), [a, i, b, _]), [k, I] = S(v[0]?.id || "profile"), y = Le(
|
|
1078
|
+
(l, C, w = "editable") => {
|
|
1079
|
+
const ue = i?.sections?.[l]?.fields;
|
|
1080
|
+
return ue && ue[C] || w;
|
|
1054
1081
|
},
|
|
1055
|
-
[
|
|
1056
|
-
), [
|
|
1082
|
+
[i]
|
|
1083
|
+
), [U, D] = S(""), [T, te] = S(""), [V, X] = S(""), [z, oe] = S(""), [ve, le] = S(""), [ce, Y] = S(""), L = O(
|
|
1057
1084
|
() => r?.userMetadataFields?.filter((l) => l.showInProfile) || [],
|
|
1058
1085
|
[r?.userMetadataFields]
|
|
1059
|
-
), [
|
|
1086
|
+
), [M, j] = S({}), [B, Z] = S(!1), K = J().dir === "rtl", de = Le(async () => {
|
|
1060
1087
|
try {
|
|
1061
1088
|
p();
|
|
1062
|
-
const l = await
|
|
1063
|
-
|
|
1089
|
+
const l = await o.getMe();
|
|
1090
|
+
D(l.name || ""), te(l.surname || ""), X(l.username || ""), oe(l.email || ""), le(l.phone || "");
|
|
1064
1091
|
const C = {};
|
|
1065
|
-
|
|
1066
|
-
C[
|
|
1067
|
-
}),
|
|
1092
|
+
L.forEach((w) => {
|
|
1093
|
+
C[w.key] = l.metadata?.[w.key] ?? w.defaultValue ?? "";
|
|
1094
|
+
}), j(C);
|
|
1068
1095
|
} catch (l) {
|
|
1069
|
-
console.error("Failed to fetch user:", l),
|
|
1096
|
+
console.error("Failed to fetch user:", l), E.error(re(l, a));
|
|
1070
1097
|
}
|
|
1071
|
-
}, [a,
|
|
1072
|
-
|
|
1098
|
+
}, [a, L, o, p]);
|
|
1099
|
+
R(() => {
|
|
1073
1100
|
if (!g) {
|
|
1074
1101
|
f.current = null;
|
|
1075
1102
|
return;
|
|
1076
1103
|
}
|
|
1077
|
-
(f.current === null ||
|
|
1078
|
-
}, [g,
|
|
1079
|
-
const l = { ...
|
|
1104
|
+
(f.current === null || k === "account") && de(), f.current = k;
|
|
1105
|
+
}, [g, k, de]), R(() => {
|
|
1106
|
+
const l = { ...M };
|
|
1080
1107
|
let C = !1;
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}), C &&
|
|
1084
|
-
}, [
|
|
1085
|
-
const
|
|
1108
|
+
L.forEach((w) => {
|
|
1109
|
+
w.condition && !Te(w.condition, M) && l[w.key] !== void 0 && (delete l[w.key], C = !0);
|
|
1110
|
+
}), C && j(l);
|
|
1111
|
+
}, [M, L]);
|
|
1112
|
+
const Ie = async () => {
|
|
1086
1113
|
Z(!0);
|
|
1087
1114
|
try {
|
|
1088
1115
|
const l = {
|
|
1089
|
-
name:
|
|
1090
|
-
surname:
|
|
1091
|
-
username:
|
|
1092
|
-
email:
|
|
1093
|
-
phone:
|
|
1094
|
-
metadata:
|
|
1116
|
+
name: U,
|
|
1117
|
+
surname: T,
|
|
1118
|
+
username: V || void 0,
|
|
1119
|
+
email: z || void 0,
|
|
1120
|
+
phone: ve || void 0,
|
|
1121
|
+
metadata: M
|
|
1095
1122
|
};
|
|
1096
|
-
|
|
1097
|
-
const C = await
|
|
1098
|
-
m.setQueryData(u.currentUser(), C),
|
|
1123
|
+
ce && (l.password = ce);
|
|
1124
|
+
const C = await o.updateMe(l);
|
|
1125
|
+
m.setQueryData(u.currentUser(), C), E.success(a("profile.success", "Profile updated successfully")), Y(""), de();
|
|
1099
1126
|
} catch (l) {
|
|
1100
|
-
|
|
1127
|
+
E.error(re(l, a));
|
|
1101
1128
|
} finally {
|
|
1102
1129
|
Z(!1);
|
|
1103
1130
|
}
|
|
1104
|
-
},
|
|
1131
|
+
}, d = async () => {
|
|
1105
1132
|
if (window.confirm(a("account.logout_confirm", "Are you sure you want to logout?")))
|
|
1106
1133
|
try {
|
|
1107
|
-
await
|
|
1134
|
+
await o.logout(), window.location.reload();
|
|
1108
1135
|
} catch (l) {
|
|
1109
|
-
|
|
1136
|
+
E.error(re(l, a));
|
|
1110
1137
|
}
|
|
1111
|
-
},
|
|
1112
|
-
return /* @__PURE__ */ s(
|
|
1113
|
-
/* @__PURE__ */ e(
|
|
1138
|
+
}, P = i?.sections?.account?.fields?.usage ?? "editable";
|
|
1139
|
+
return /* @__PURE__ */ s(ht, { open: g, onOpenChange: c, children: [
|
|
1140
|
+
/* @__PURE__ */ e(za, { asChild: !0, children: t || /* @__PURE__ */ e($, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5" }) }) }),
|
|
1114
1141
|
/* @__PURE__ */ e(
|
|
1115
|
-
|
|
1142
|
+
gt,
|
|
1116
1143
|
{
|
|
1117
|
-
dir:
|
|
1118
|
-
className:
|
|
1144
|
+
dir: K ? "rtl" : "ltr",
|
|
1145
|
+
className: x(
|
|
1119
1146
|
"w-full sm:w-[95vw] sm:max-w-[700px] p-0 gap-0 overflow-hidden rounded-t-2xl sm:rounded-3xl border-none shadow-lg bg-background h-[90vh] sm:h-[min(750px,90vh)]",
|
|
1120
|
-
|
|
1147
|
+
K && "rtl"
|
|
1121
1148
|
),
|
|
1122
1149
|
children: /* @__PURE__ */ s("div", { className: "flex flex-col h-full w-full min-h-0 overflow-hidden", children: [
|
|
1123
1150
|
/* @__PURE__ */ s("div", { className: "w-full bg-muted/20 sm:bg-muted/30 border-b border-border/40 pt-12 sm:pt-6 flex flex-col shrink-0", children: [
|
|
1124
1151
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
1125
|
-
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(
|
|
1152
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Me, { className: "h-5 w-5 text-primary" }) }),
|
|
1126
1153
|
/* @__PURE__ */ e("span", { className: "font-bold text-lg", children: a("title", "Settings") })
|
|
1127
1154
|
] }) }),
|
|
1128
|
-
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children:
|
|
1155
|
+
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: v.map((l) => /* @__PURE__ */ s(
|
|
1129
1156
|
"button",
|
|
1130
1157
|
{
|
|
1131
|
-
onClick: () =>
|
|
1132
|
-
className:
|
|
1158
|
+
onClick: () => I(l.id),
|
|
1159
|
+
className: x(
|
|
1133
1160
|
"flex items-center gap-1.5 sm:gap-2 pb-2 sm:pb-3 pt-1 px-2 sm:px-1 text-sm sm:text-base font-medium transition-all border-b-2 whitespace-nowrap shrink-0",
|
|
1134
|
-
|
|
1135
|
-
l.id !== "general" &&
|
|
1161
|
+
k === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
1162
|
+
l.id !== "general" && i?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1136
1163
|
),
|
|
1137
1164
|
children: [
|
|
1138
1165
|
/* @__PURE__ */ e(
|
|
1139
1166
|
l.icon,
|
|
1140
1167
|
{
|
|
1141
|
-
className:
|
|
1168
|
+
className: x(
|
|
1142
1169
|
"h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
|
|
1143
|
-
|
|
1170
|
+
k === l.id && "scale-110"
|
|
1144
1171
|
)
|
|
1145
1172
|
}
|
|
1146
1173
|
),
|
|
@@ -1151,30 +1178,30 @@ function On({ trigger: t }) {
|
|
|
1151
1178
|
)) }) })
|
|
1152
1179
|
] }),
|
|
1153
1180
|
/* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ s("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
|
|
1154
|
-
|
|
1181
|
+
k === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1155
1182
|
/* @__PURE__ */ s("div", { children: [
|
|
1156
1183
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("profile.title", "Profile Information") }),
|
|
1157
1184
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("profile.subtitle", "Update your personal details below.") })
|
|
1158
1185
|
] }),
|
|
1159
1186
|
/* @__PURE__ */ s("div", { className: "grid gap-6", children: [
|
|
1160
1187
|
/* @__PURE__ */ s("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
1161
|
-
|
|
1188
|
+
y("profile", "name") !== "hidden" && /* @__PURE__ */ s(
|
|
1162
1189
|
"div",
|
|
1163
1190
|
{
|
|
1164
|
-
className:
|
|
1191
|
+
className: x(
|
|
1165
1192
|
"flex flex-col gap-3",
|
|
1166
|
-
|
|
1193
|
+
y("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1167
1194
|
),
|
|
1168
1195
|
children: [
|
|
1169
|
-
/* @__PURE__ */ e(
|
|
1196
|
+
/* @__PURE__ */ e(A, { htmlFor: "name", className: "px-1", children: a("profile.name", "First Name") }),
|
|
1170
1197
|
/* @__PURE__ */ e(
|
|
1171
|
-
|
|
1198
|
+
F,
|
|
1172
1199
|
{
|
|
1173
1200
|
id: "name",
|
|
1174
|
-
value:
|
|
1175
|
-
onChange: (l) =>
|
|
1176
|
-
disabled:
|
|
1177
|
-
className:
|
|
1201
|
+
value: U,
|
|
1202
|
+
onChange: (l) => D(l.target.value),
|
|
1203
|
+
disabled: y("profile", "name") === "faded",
|
|
1204
|
+
className: x(
|
|
1178
1205
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1179
1206
|
"text-start"
|
|
1180
1207
|
)
|
|
@@ -1183,23 +1210,23 @@ function On({ trigger: t }) {
|
|
|
1183
1210
|
]
|
|
1184
1211
|
}
|
|
1185
1212
|
),
|
|
1186
|
-
|
|
1213
|
+
y("profile", "surname") !== "hidden" && /* @__PURE__ */ s(
|
|
1187
1214
|
"div",
|
|
1188
1215
|
{
|
|
1189
|
-
className:
|
|
1216
|
+
className: x(
|
|
1190
1217
|
"flex flex-col gap-3",
|
|
1191
|
-
|
|
1218
|
+
y("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1192
1219
|
),
|
|
1193
1220
|
children: [
|
|
1194
|
-
/* @__PURE__ */ e(
|
|
1221
|
+
/* @__PURE__ */ e(A, { htmlFor: "surname", className: "px-1", children: a("profile.surname", "Last Name") }),
|
|
1195
1222
|
/* @__PURE__ */ e(
|
|
1196
|
-
|
|
1223
|
+
F,
|
|
1197
1224
|
{
|
|
1198
1225
|
id: "surname",
|
|
1199
|
-
value:
|
|
1200
|
-
onChange: (l) =>
|
|
1201
|
-
disabled:
|
|
1202
|
-
className:
|
|
1226
|
+
value: T,
|
|
1227
|
+
onChange: (l) => te(l.target.value),
|
|
1228
|
+
disabled: y("profile", "surname") === "faded",
|
|
1229
|
+
className: x(
|
|
1203
1230
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1204
1231
|
"text-start"
|
|
1205
1232
|
)
|
|
@@ -1210,32 +1237,32 @@ function On({ trigger: t }) {
|
|
|
1210
1237
|
)
|
|
1211
1238
|
] }),
|
|
1212
1239
|
[
|
|
1213
|
-
{ key: "username", icon:
|
|
1214
|
-
{ key: "email", icon:
|
|
1215
|
-
{ key: "phone", icon:
|
|
1216
|
-
].map(({ key: l, icon: C, value:
|
|
1217
|
-
const
|
|
1218
|
-
return
|
|
1240
|
+
{ key: "username", icon: ea, value: V, set: X },
|
|
1241
|
+
{ key: "email", icon: ta, value: z, set: oe },
|
|
1242
|
+
{ key: "phone", icon: aa, value: ve, set: le }
|
|
1243
|
+
].map(({ key: l, icon: C, value: w, set: ue }) => {
|
|
1244
|
+
const me = y("profile", l);
|
|
1245
|
+
return me === "hidden" ? null : /* @__PURE__ */ s(
|
|
1219
1246
|
"div",
|
|
1220
1247
|
{
|
|
1221
|
-
className:
|
|
1248
|
+
className: x(
|
|
1222
1249
|
"flex flex-col gap-3",
|
|
1223
|
-
|
|
1250
|
+
me === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1224
1251
|
),
|
|
1225
1252
|
children: [
|
|
1226
|
-
/* @__PURE__ */ e(
|
|
1253
|
+
/* @__PURE__ */ e(A, { htmlFor: l, className: "px-1 text-start", children: a(`profile.${l}`) }),
|
|
1227
1254
|
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
1228
1255
|
/* @__PURE__ */ e(C, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
|
|
1229
1256
|
/* @__PURE__ */ e(
|
|
1230
|
-
|
|
1257
|
+
F,
|
|
1231
1258
|
{
|
|
1232
1259
|
id: l,
|
|
1233
1260
|
type: l === "email" ? "email" : "text",
|
|
1234
|
-
value:
|
|
1235
|
-
onChange: (
|
|
1236
|
-
l === "phone" ?
|
|
1261
|
+
value: w,
|
|
1262
|
+
onChange: (xe) => ue(
|
|
1263
|
+
l === "phone" ? xe.target.value.replace(/[^0-9]/g, "") : xe.target.value
|
|
1237
1264
|
),
|
|
1238
|
-
disabled:
|
|
1265
|
+
disabled: me === "faded",
|
|
1239
1266
|
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary ps-10 pe-3 text-start",
|
|
1240
1267
|
dir: "ltr"
|
|
1241
1268
|
}
|
|
@@ -1246,25 +1273,25 @@ function On({ trigger: t }) {
|
|
|
1246
1273
|
l
|
|
1247
1274
|
);
|
|
1248
1275
|
}),
|
|
1249
|
-
|
|
1276
|
+
y("profile", "password") !== "hidden" && /* @__PURE__ */ s(
|
|
1250
1277
|
"div",
|
|
1251
1278
|
{
|
|
1252
|
-
className:
|
|
1279
|
+
className: x(
|
|
1253
1280
|
"flex flex-col gap-3",
|
|
1254
|
-
|
|
1281
|
+
y("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1255
1282
|
),
|
|
1256
1283
|
children: [
|
|
1257
|
-
/* @__PURE__ */ e(
|
|
1284
|
+
/* @__PURE__ */ e(A, { htmlFor: "pass", className: "px-1 text-start", children: a("profile.password", "New Password") }),
|
|
1258
1285
|
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
1259
|
-
/* @__PURE__ */ e(
|
|
1286
|
+
/* @__PURE__ */ e(na, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground start-3" }),
|
|
1260
1287
|
/* @__PURE__ */ e(
|
|
1261
|
-
|
|
1288
|
+
F,
|
|
1262
1289
|
{
|
|
1263
1290
|
id: "pass",
|
|
1264
1291
|
type: "password",
|
|
1265
|
-
value:
|
|
1266
|
-
onChange: (l) =>
|
|
1267
|
-
disabled:
|
|
1292
|
+
value: ce,
|
|
1293
|
+
onChange: (l) => Y(l.target.value),
|
|
1294
|
+
disabled: y("profile", "password") === "faded",
|
|
1268
1295
|
placeholder: a(
|
|
1269
1296
|
"profile.password_placeholder",
|
|
1270
1297
|
"Leave empty to keep current"
|
|
@@ -1277,24 +1304,24 @@ function On({ trigger: t }) {
|
|
|
1277
1304
|
]
|
|
1278
1305
|
}
|
|
1279
1306
|
),
|
|
1280
|
-
|
|
1281
|
-
const C =
|
|
1282
|
-
return C === "hidden" || !Te(l.condition,
|
|
1307
|
+
L.map((l) => {
|
|
1308
|
+
const C = y("profile", l.key, l.mode || "editable");
|
|
1309
|
+
return C === "hidden" || !Te(l.condition, M) ? null : /* @__PURE__ */ s(
|
|
1283
1310
|
"div",
|
|
1284
1311
|
{
|
|
1285
|
-
className:
|
|
1312
|
+
className: x(
|
|
1286
1313
|
"flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
1287
1314
|
C === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1288
1315
|
),
|
|
1289
1316
|
children: [
|
|
1290
|
-
/* @__PURE__ */ e(
|
|
1317
|
+
/* @__PURE__ */ e(A, { htmlFor: `profile-${l.key}`, className: "px-1", children: a(l.label) }),
|
|
1291
1318
|
l.type === "select" ? /* @__PURE__ */ s(
|
|
1292
1319
|
we,
|
|
1293
1320
|
{
|
|
1294
|
-
value: String(
|
|
1295
|
-
onValueChange: (
|
|
1321
|
+
value: String(M[l.key] || ""),
|
|
1322
|
+
onValueChange: (w) => j({ ...M, [l.key]: w }),
|
|
1296
1323
|
disabled: C === "faded",
|
|
1297
|
-
dir:
|
|
1324
|
+
dir: K ? "rtl" : "ltr",
|
|
1298
1325
|
children: [
|
|
1299
1326
|
/* @__PURE__ */ e(Se, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(
|
|
1300
1327
|
ke,
|
|
@@ -1302,14 +1329,14 @@ function On({ trigger: t }) {
|
|
|
1302
1329
|
placeholder: a(l.placeholder || "profile.select_placeholder")
|
|
1303
1330
|
}
|
|
1304
1331
|
) }),
|
|
1305
|
-
/* @__PURE__ */ e(Ce, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: l.options?.map((
|
|
1332
|
+
/* @__PURE__ */ e(Ce, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: l.options?.map((w) => /* @__PURE__ */ e(
|
|
1306
1333
|
_e,
|
|
1307
1334
|
{
|
|
1308
|
-
value: String(
|
|
1335
|
+
value: String(w.value),
|
|
1309
1336
|
className: "rounded-lg focus:bg-primary/10",
|
|
1310
|
-
children: a(
|
|
1337
|
+
children: a(w.label)
|
|
1311
1338
|
},
|
|
1312
|
-
String(
|
|
1339
|
+
String(w.value)
|
|
1313
1340
|
)) })
|
|
1314
1341
|
]
|
|
1315
1342
|
}
|
|
@@ -1319,14 +1346,14 @@ function On({ trigger: t }) {
|
|
|
1319
1346
|
{
|
|
1320
1347
|
id: `profile-${l.key}`,
|
|
1321
1348
|
type: "checkbox",
|
|
1322
|
-
checked: !!
|
|
1349
|
+
checked: !!M[l.key],
|
|
1323
1350
|
disabled: C === "faded",
|
|
1324
|
-
onChange: (
|
|
1351
|
+
onChange: (w) => j({ ...M, [l.key]: w.target.checked }),
|
|
1325
1352
|
className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
|
|
1326
1353
|
}
|
|
1327
1354
|
),
|
|
1328
1355
|
/* @__PURE__ */ e(
|
|
1329
|
-
|
|
1356
|
+
A,
|
|
1330
1357
|
{
|
|
1331
1358
|
htmlFor: `profile-${l.key}`,
|
|
1332
1359
|
className: "text-sm font-medium text-muted-foreground cursor-pointer",
|
|
@@ -1334,15 +1361,15 @@ function On({ trigger: t }) {
|
|
|
1334
1361
|
}
|
|
1335
1362
|
)
|
|
1336
1363
|
] }) : /* @__PURE__ */ e(
|
|
1337
|
-
|
|
1364
|
+
F,
|
|
1338
1365
|
{
|
|
1339
1366
|
id: `profile-${l.key}`,
|
|
1340
1367
|
type: l.type,
|
|
1341
|
-
value:
|
|
1368
|
+
value: M[l.key] || "",
|
|
1342
1369
|
disabled: C === "faded",
|
|
1343
|
-
onChange: (
|
|
1370
|
+
onChange: (w) => j({ ...M, [l.key]: w.target.value }),
|
|
1344
1371
|
placeholder: a(l.placeholder || ""),
|
|
1345
|
-
className:
|
|
1372
|
+
className: x(
|
|
1346
1373
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1347
1374
|
"text-start"
|
|
1348
1375
|
)
|
|
@@ -1356,52 +1383,59 @@ function On({ trigger: t }) {
|
|
|
1356
1383
|
/* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ s(
|
|
1357
1384
|
$,
|
|
1358
1385
|
{
|
|
1359
|
-
onClick:
|
|
1360
|
-
disabled:
|
|
1386
|
+
onClick: Ie,
|
|
1387
|
+
disabled: B,
|
|
1361
1388
|
className: "w-full sm:w-auto px-8 rounded-xl gap-2 font-semibold h-11 transition-all active:scale-[0.98]",
|
|
1362
1389
|
children: [
|
|
1363
|
-
/* @__PURE__ */ e(
|
|
1364
|
-
|
|
1390
|
+
/* @__PURE__ */ e(ra, { className: "h-4 w-4" }),
|
|
1391
|
+
B ? a("profile.saving", "Saving...") : a("profile.save", "Save Changes")
|
|
1365
1392
|
]
|
|
1366
1393
|
}
|
|
1367
1394
|
) })
|
|
1368
1395
|
] })
|
|
1369
1396
|
] }),
|
|
1370
|
-
|
|
1397
|
+
k === "general" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1371
1398
|
/* @__PURE__ */ s("div", { children: [
|
|
1372
1399
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("general.title") }),
|
|
1373
1400
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("general.subtitle") })
|
|
1374
1401
|
] }),
|
|
1375
|
-
/* @__PURE__ */ e(
|
|
1402
|
+
/* @__PURE__ */ e(
|
|
1403
|
+
Dn,
|
|
1404
|
+
{
|
|
1405
|
+
sectionMode: i?.sections?.general?.mode ?? "editable",
|
|
1406
|
+
themeMode: y("general", "theme"),
|
|
1407
|
+
languageMode: y("general", "language")
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1376
1410
|
] }),
|
|
1377
|
-
|
|
1411
|
+
k === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1378
1412
|
/* @__PURE__ */ s("div", { children: [
|
|
1379
1413
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: a("account.title", "Account & Usage") }),
|
|
1380
1414
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("account.subtitle", "Monitor your quotas and manage your session.") })
|
|
1381
1415
|
] }),
|
|
1382
1416
|
/* @__PURE__ */ s("div", { className: "space-y-6", children: [
|
|
1383
|
-
|
|
1417
|
+
P !== "hidden" && h && /* @__PURE__ */ s(
|
|
1384
1418
|
"div",
|
|
1385
1419
|
{
|
|
1386
|
-
className:
|
|
1420
|
+
className: x(
|
|
1387
1421
|
"p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-5",
|
|
1388
|
-
|
|
1422
|
+
P === "faded" && "opacity-50"
|
|
1389
1423
|
),
|
|
1390
1424
|
children: [
|
|
1391
1425
|
/* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1392
|
-
/* @__PURE__ */ s(
|
|
1393
|
-
h.kind === "credits" ? /* @__PURE__ */ e(
|
|
1426
|
+
/* @__PURE__ */ s(A, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
|
|
1427
|
+
h.kind === "credits" ? /* @__PURE__ */ e(sa, { className: "h-4 w-4" }) : h.kind === "unlimited" ? /* @__PURE__ */ e(ia, { className: "h-4 w-4" }) : /* @__PURE__ */ e(oa, { className: "h-4 w-4" }),
|
|
1394
1428
|
a("account.usage", "Your usage")
|
|
1395
1429
|
] }),
|
|
1396
1430
|
/* @__PURE__ */ s("div", { className: "text-end", children: [
|
|
1397
1431
|
/* @__PURE__ */ e("p", { className: "text-sm font-semibold text-foreground", children: h.kind === "credits" ? a("account.on_credits", "Credits") : h.kind === "unlimited" ? a("account.unlimited", "No usage limits") : h.plan?.name ?? a("account.custom_plan", "Custom plan") }),
|
|
1398
1432
|
h.ends_at && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a("account.plan_until", {
|
|
1399
|
-
datetime:
|
|
1433
|
+
datetime: mt(h.ends_at, n.language)
|
|
1400
1434
|
}) })
|
|
1401
1435
|
] })
|
|
1402
1436
|
] }),
|
|
1403
|
-
h.kind === "plan" && (h.windows.length > 0 ? /* @__PURE__ */ e(
|
|
1404
|
-
h.kind === "credits" && h.credits && /* @__PURE__ */ e(
|
|
1437
|
+
h.kind === "plan" && (h.windows.length > 0 ? /* @__PURE__ */ e(En, { windows: h.windows }) : /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a("account.unlimited", "No usage limits") })),
|
|
1438
|
+
h.kind === "credits" && h.credits && /* @__PURE__ */ e(zn, { credits: h.credits }),
|
|
1405
1439
|
h.kind === "unlimited" && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a(
|
|
1406
1440
|
"account.unlimited_help",
|
|
1407
1441
|
"You can use the assistant as much as you like."
|
|
@@ -1409,20 +1443,20 @@ function On({ trigger: t }) {
|
|
|
1409
1443
|
]
|
|
1410
1444
|
}
|
|
1411
1445
|
),
|
|
1412
|
-
/* @__PURE__ */ e("div", { className: "pt-2 flex flex-col gap-3", children:
|
|
1446
|
+
/* @__PURE__ */ e("div", { className: "pt-2 flex flex-col gap-3", children: y("account", "logout") !== "hidden" && /* @__PURE__ */ s(
|
|
1413
1447
|
$,
|
|
1414
1448
|
{
|
|
1415
1449
|
variant: "destructive",
|
|
1416
1450
|
onClick: () => {
|
|
1417
|
-
|
|
1451
|
+
d();
|
|
1418
1452
|
},
|
|
1419
|
-
disabled:
|
|
1420
|
-
className:
|
|
1453
|
+
disabled: y("account", "logout") === "faded",
|
|
1454
|
+
className: x(
|
|
1421
1455
|
"rounded-2xl gap-2 font-bold h-12 transition-all active:scale-[0.98]",
|
|
1422
|
-
|
|
1456
|
+
y("account", "logout") === "faded" && "opacity-50 pointer-events-none"
|
|
1423
1457
|
),
|
|
1424
1458
|
children: [
|
|
1425
|
-
/* @__PURE__ */ e(
|
|
1459
|
+
/* @__PURE__ */ e(la, { className: "h-4 w-4" }),
|
|
1426
1460
|
a("account.logout", "Logout from Account")
|
|
1427
1461
|
]
|
|
1428
1462
|
}
|
|
@@ -1439,40 +1473,40 @@ function On({ trigger: t }) {
|
|
|
1439
1473
|
)
|
|
1440
1474
|
] });
|
|
1441
1475
|
}
|
|
1442
|
-
function
|
|
1443
|
-
const a =
|
|
1476
|
+
function St({ hideActions: t = !1 }) {
|
|
1477
|
+
const a = Ze(), { t: n } = q(["sidebar", "settings"]), r = H((v) => v.app), i = ee((v) => v.history), o = ee((v) => v.headerActionsEnabled), { HeaderActions: m, headerActions: u, UsageMeter: g } = ie(), c = O(
|
|
1444
1478
|
() => (u ?? []).filter(
|
|
1445
|
-
(
|
|
1479
|
+
(v) => o?.[v.id] ?? v.defaultEnabled ?? !0
|
|
1446
1480
|
),
|
|
1447
|
-
[u,
|
|
1448
|
-
), h =
|
|
1481
|
+
[u, o]
|
|
1482
|
+
), h = it(), { resolvedTheme: p } = se(), f = !t && (i?.enabled ?? !0), b = O(() => r?.logo ? typeof r.logo == "string" ? r.logo : p === "dark" ? r.logo.dark : r.logo.light : Ra, [r?.logo, p]), _ = r?.name || "Gentiq";
|
|
1449
1483
|
return /* @__PURE__ */ s("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full bg-background border-b border-border/30 transition-all duration-300", children: [
|
|
1450
1484
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: [
|
|
1451
|
-
f && /* @__PURE__ */ e(
|
|
1452
|
-
!t && /* @__PURE__ */ s(
|
|
1453
|
-
/* @__PURE__ */ e(
|
|
1485
|
+
f && /* @__PURE__ */ e(Ln, { className: "hover:bg-accent/60 transition-all duration-200 active:scale-95 rounded-lg size-9" }),
|
|
1486
|
+
!t && /* @__PURE__ */ s(lt, { children: [
|
|
1487
|
+
/* @__PURE__ */ e(ct, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1454
1488
|
"button",
|
|
1455
1489
|
{
|
|
1456
1490
|
type: "button",
|
|
1457
|
-
className:
|
|
1491
|
+
className: x(
|
|
1458
1492
|
"flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 active:scale-95 text-muted-foreground hover:text-primary",
|
|
1459
1493
|
f && "md:hidden"
|
|
1460
1494
|
),
|
|
1461
1495
|
onClick: () => a?.selectThread(null),
|
|
1462
1496
|
"aria-label": n("new_chat"),
|
|
1463
|
-
children: /* @__PURE__ */ e(
|
|
1497
|
+
children: /* @__PURE__ */ e(at, { className: "size-5" })
|
|
1464
1498
|
}
|
|
1465
1499
|
) }),
|
|
1466
|
-
/* @__PURE__ */ e(
|
|
1500
|
+
/* @__PURE__ */ e(dt, { side: "bottom", className: "text-xs", children: n("new_chat") })
|
|
1467
1501
|
] })
|
|
1468
1502
|
] }),
|
|
1469
|
-
/* @__PURE__ */ e("div", { className: "absolute inset-0 m-auto size-fit", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e("img", { src:
|
|
1503
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0 m-auto size-fit", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e("img", { src: b, alt: _, className: "size-8 object-contain" }) }) }),
|
|
1470
1504
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-[36px] md:min-w-[80px] justify-end", children: !t && /* @__PURE__ */ s(fe, { children: [
|
|
1471
1505
|
m && /* @__PURE__ */ e(m, { isMobile: h }),
|
|
1472
|
-
c.map(({ id:
|
|
1506
|
+
c.map(({ id: v, component: k }) => /* @__PURE__ */ e(k, { isMobile: h }, v)),
|
|
1473
1507
|
r?.showUsageBar && /* @__PURE__ */ e(g, { details: r.showUsageDetails ?? !0, isMobile: h }),
|
|
1474
1508
|
r?.showSettings !== !1 && /* @__PURE__ */ e(
|
|
1475
|
-
|
|
1509
|
+
Fn,
|
|
1476
1510
|
{
|
|
1477
1511
|
trigger: /* @__PURE__ */ e(
|
|
1478
1512
|
"button",
|
|
@@ -1480,7 +1514,7 @@ function kt({ hideActions: t = !1 }) {
|
|
|
1480
1514
|
type: "button",
|
|
1481
1515
|
"aria-label": n("settings:title"),
|
|
1482
1516
|
className: "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 active:scale-95 text-muted-foreground hover:text-primary",
|
|
1483
|
-
children: /* @__PURE__ */ e(
|
|
1517
|
+
children: /* @__PURE__ */ e(Me, { className: "size-5" })
|
|
1484
1518
|
}
|
|
1485
1519
|
)
|
|
1486
1520
|
}
|
|
@@ -1488,66 +1522,66 @@ function kt({ hideActions: t = !1 }) {
|
|
|
1488
1522
|
] }) })
|
|
1489
1523
|
] });
|
|
1490
1524
|
}
|
|
1491
|
-
function
|
|
1492
|
-
return /* @__PURE__ */ e(
|
|
1525
|
+
function On(t) {
|
|
1526
|
+
return /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e($n, { ...t }) });
|
|
1493
1527
|
}
|
|
1494
|
-
function
|
|
1495
|
-
const [a, n] =
|
|
1528
|
+
function $n({ shareId: t }) {
|
|
1529
|
+
const [a, n] = S(
|
|
1496
1530
|
null
|
|
1497
|
-
), [r,
|
|
1498
|
-
return
|
|
1531
|
+
), [r, i] = S(!0), [o, m] = S(null), { t: u } = q(["chat", "errors"]), { MessageList: g } = ie(), c = ze(), h = Ae(/* @__PURE__ */ new Set());
|
|
1532
|
+
return R(() => () => {
|
|
1499
1533
|
h.current.forEach((p) => URL.revokeObjectURL(p)), h.current.clear();
|
|
1500
|
-
}, []),
|
|
1534
|
+
}, []), R(() => {
|
|
1501
1535
|
if (!t) return;
|
|
1502
1536
|
let p = !1;
|
|
1503
1537
|
return (async () => {
|
|
1504
1538
|
try {
|
|
1505
|
-
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1508
|
-
async (
|
|
1539
|
+
i(!0);
|
|
1540
|
+
const b = await c.getSharedThread(t), _ = await Ya(
|
|
1541
|
+
Za(b.items),
|
|
1542
|
+
async (v) => {
|
|
1509
1543
|
try {
|
|
1510
|
-
const
|
|
1511
|
-
return h.current.add(
|
|
1512
|
-
} catch (
|
|
1513
|
-
return console.error("Failed to resolve shared attachment:",
|
|
1544
|
+
const k = await c.getPublicAttachmentBlobUrl(t, v);
|
|
1545
|
+
return h.current.add(k), k;
|
|
1546
|
+
} catch (k) {
|
|
1547
|
+
return console.error("Failed to resolve shared attachment:", v, k), "";
|
|
1514
1548
|
}
|
|
1515
1549
|
}
|
|
1516
1550
|
);
|
|
1517
|
-
p || n({ id:
|
|
1518
|
-
} catch (
|
|
1551
|
+
p || n({ id: b.id, messages: _ });
|
|
1552
|
+
} catch (b) {
|
|
1519
1553
|
if (p) return;
|
|
1520
|
-
console.error("Failed to fetch shared chat:",
|
|
1554
|
+
console.error("Failed to fetch shared chat:", b), m(b);
|
|
1521
1555
|
} finally {
|
|
1522
|
-
p ||
|
|
1556
|
+
p || i(!1);
|
|
1523
1557
|
}
|
|
1524
1558
|
})(), () => {
|
|
1525
1559
|
p = !0;
|
|
1526
1560
|
};
|
|
1527
1561
|
}, [t, c]), r ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center bg-background", children: /* @__PURE__ */ e(Da, {}) }) : a ? /* @__PURE__ */ s("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
|
|
1528
|
-
/* @__PURE__ */ e(
|
|
1529
|
-
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(
|
|
1562
|
+
/* @__PURE__ */ e(St, { hideActions: !0 }),
|
|
1563
|
+
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(Ee.Root, { readonly: !0, children: /* @__PURE__ */ e(et.Root, { messages: a.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ e(g, { className: "pb-8" }) }) }) })
|
|
1530
1564
|
] }) : /* @__PURE__ */ s("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center bg-background", children: [
|
|
1531
1565
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: u("shared_not_found_title") }),
|
|
1532
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children:
|
|
1566
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: Xa(o) ? re(o, u) : u("shared_not_found_description") })
|
|
1533
1567
|
] });
|
|
1534
1568
|
}
|
|
1535
|
-
function
|
|
1536
|
-
const { t } =
|
|
1537
|
-
return /* @__PURE__ */ e(
|
|
1538
|
-
|
|
1569
|
+
function Un() {
|
|
1570
|
+
const { t } = q("sidebar"), { isMobile: a, setOpenMobile: n } = be();
|
|
1571
|
+
return /* @__PURE__ */ e(xt, { className: "mt-2 mb-6 px-2 group-data-[collapsible=icon]:px-0", children: /* @__PURE__ */ e(yt, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ e(
|
|
1572
|
+
Nt,
|
|
1539
1573
|
{
|
|
1540
1574
|
asChild: !0,
|
|
1541
1575
|
tooltip: t("tooltip_new_conversation"),
|
|
1542
1576
|
className: "h-10 rounded-xl bg-surface border border-border/60 shadow-sm shadow-foreground/[0.03] text-foreground/85 hover:bg-surface hover:border-border hover:text-foreground active:bg-surface transition-[width,height,padding,border-color,color] duration-200 group-data-[collapsible=icon]:mx-auto group/new-chat",
|
|
1543
1577
|
children: /* @__PURE__ */ s(
|
|
1544
|
-
|
|
1578
|
+
G.New,
|
|
1545
1579
|
{
|
|
1546
1580
|
onOpen: () => a && n(!1),
|
|
1547
1581
|
className: "flex items-center gap-2.5 px-3 group-data-[collapsible=icon]:justify-center",
|
|
1548
1582
|
children: [
|
|
1549
1583
|
/* @__PURE__ */ e(
|
|
1550
|
-
|
|
1584
|
+
at,
|
|
1551
1585
|
{
|
|
1552
1586
|
"aria-hidden": !0,
|
|
1553
1587
|
className: "size-4! shrink-0 text-muted-foreground transition-colors group-hover/new-chat:text-foreground"
|
|
@@ -1560,9 +1594,9 @@ function jn() {
|
|
|
1560
1594
|
}
|
|
1561
1595
|
) }) });
|
|
1562
1596
|
}
|
|
1563
|
-
function
|
|
1564
|
-
const { t } =
|
|
1565
|
-
return /* @__PURE__ */ e(
|
|
1597
|
+
function jn() {
|
|
1598
|
+
const { t } = q("sidebar");
|
|
1599
|
+
return /* @__PURE__ */ e(G.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */ s(
|
|
1566
1600
|
"div",
|
|
1567
1601
|
{
|
|
1568
1602
|
role: "status",
|
|
@@ -1580,13 +1614,13 @@ function Bn() {
|
|
|
1580
1614
|
}
|
|
1581
1615
|
) });
|
|
1582
1616
|
}
|
|
1583
|
-
function
|
|
1584
|
-
const { t } =
|
|
1617
|
+
function Bn() {
|
|
1618
|
+
const { t } = q("sidebar");
|
|
1585
1619
|
return /* @__PURE__ */ s(
|
|
1586
1620
|
ye.Root,
|
|
1587
1621
|
{
|
|
1588
|
-
onRenamed: () =>
|
|
1589
|
-
onRenameFailed: () =>
|
|
1622
|
+
onRenamed: () => E.success(t("rename_success")),
|
|
1623
|
+
onRenameFailed: () => E.error(t("rename_failed")),
|
|
1590
1624
|
className: "flex items-center gap-1 px-2 py-1.5 w-full",
|
|
1591
1625
|
children: [
|
|
1592
1626
|
/* @__PURE__ */ e(
|
|
@@ -1604,7 +1638,7 @@ function Gn() {
|
|
|
1604
1638
|
variant: "ghost",
|
|
1605
1639
|
"aria-label": t("save"),
|
|
1606
1640
|
className: "size-8 shrink-0 text-primary hover:bg-primary/10",
|
|
1607
|
-
children: /* @__PURE__ */ e(
|
|
1641
|
+
children: /* @__PURE__ */ e(ca, { "aria-hidden": !0, className: "size-4" })
|
|
1608
1642
|
}
|
|
1609
1643
|
) }),
|
|
1610
1644
|
/* @__PURE__ */ e(ye.Cancel, { asChild: !0, children: /* @__PURE__ */ e(
|
|
@@ -1615,99 +1649,99 @@ function Gn() {
|
|
|
1615
1649
|
variant: "ghost",
|
|
1616
1650
|
"aria-label": t("cancel"),
|
|
1617
1651
|
className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
|
|
1618
|
-
children: /* @__PURE__ */ e(
|
|
1652
|
+
children: /* @__PURE__ */ e(da, { "aria-hidden": !0, className: "size-4" })
|
|
1619
1653
|
}
|
|
1620
1654
|
) })
|
|
1621
1655
|
]
|
|
1622
1656
|
}
|
|
1623
1657
|
);
|
|
1624
1658
|
}
|
|
1625
|
-
function
|
|
1626
|
-
const { t: n } =
|
|
1659
|
+
function Gn({ open: t, onOpenChange: a }) {
|
|
1660
|
+
const { t: n } = q(["sidebar", "errors"]), { remove: r } = Re(), i = async () => {
|
|
1627
1661
|
a(!1);
|
|
1628
1662
|
try {
|
|
1629
1663
|
await r();
|
|
1630
1664
|
} catch {
|
|
1631
|
-
|
|
1665
|
+
E.error(n("errors:thread_delete_failed"));
|
|
1632
1666
|
return;
|
|
1633
1667
|
}
|
|
1634
|
-
|
|
1668
|
+
E.success(n("chat_deleted_success"));
|
|
1635
1669
|
};
|
|
1636
|
-
return /* @__PURE__ */ e(
|
|
1637
|
-
/* @__PURE__ */ s(
|
|
1638
|
-
/* @__PURE__ */ e(
|
|
1639
|
-
/* @__PURE__ */ e(
|
|
1670
|
+
return /* @__PURE__ */ e(ht, { open: t, onOpenChange: a, children: /* @__PURE__ */ s(gt, { children: [
|
|
1671
|
+
/* @__PURE__ */ s(Fa, { children: [
|
|
1672
|
+
/* @__PURE__ */ e(Oa, { children: n("delete_confirm_title") }),
|
|
1673
|
+
/* @__PURE__ */ e($a, { children: n("delete_confirm_description") })
|
|
1640
1674
|
] }),
|
|
1641
|
-
/* @__PURE__ */ s(
|
|
1675
|
+
/* @__PURE__ */ s(Ua, { children: [
|
|
1642
1676
|
/* @__PURE__ */ e($, { variant: "outline", onClick: () => a(!1), children: n("cancel") }),
|
|
1643
1677
|
/* @__PURE__ */ e($, { variant: "destructive", onClick: () => {
|
|
1644
|
-
|
|
1678
|
+
i();
|
|
1645
1679
|
}, autoFocus: !0, children: n("delete") })
|
|
1646
1680
|
] })
|
|
1647
1681
|
] }) });
|
|
1648
1682
|
}
|
|
1649
|
-
const
|
|
1683
|
+
const kt = qt({
|
|
1650
1684
|
pin: !0,
|
|
1651
1685
|
share: !0,
|
|
1652
1686
|
rename: !0,
|
|
1653
1687
|
delete: !0
|
|
1654
1688
|
}), ge = "cursor-pointer flex items-center gap-2";
|
|
1655
|
-
function
|
|
1656
|
-
const { t } =
|
|
1689
|
+
function Hn() {
|
|
1690
|
+
const { t } = q("sidebar"), { dir: a } = J(), n = We(kt), { thread: r, setPinned: i, share: o, unshare: m, startRenaming: u } = Re(), [g, c] = S(!1);
|
|
1657
1691
|
if (!n.pin && !n.share && !n.rename && !n.delete) return null;
|
|
1658
1692
|
const h = async () => {
|
|
1659
1693
|
try {
|
|
1660
|
-
await
|
|
1694
|
+
await i(!r.pinned), E.success(r.pinned ? t("unpinned_success") : t("pinned_success"));
|
|
1661
1695
|
} catch {
|
|
1662
|
-
|
|
1696
|
+
E.error(t("pin_failed"));
|
|
1663
1697
|
}
|
|
1664
1698
|
}, p = async () => {
|
|
1665
1699
|
try {
|
|
1666
|
-
const
|
|
1667
|
-
await navigator.clipboard.writeText(`${window.location.origin}${
|
|
1700
|
+
const b = await o();
|
|
1701
|
+
await navigator.clipboard.writeText(`${window.location.origin}${b}`), E.success(t("share_success"), { description: t("share_description") });
|
|
1668
1702
|
} catch {
|
|
1669
|
-
|
|
1703
|
+
E.error(t("share_failed"));
|
|
1670
1704
|
}
|
|
1671
1705
|
}, f = async () => {
|
|
1672
1706
|
try {
|
|
1673
|
-
await m(),
|
|
1707
|
+
await m(), E.success(t("unshare_success"));
|
|
1674
1708
|
} catch {
|
|
1675
|
-
|
|
1709
|
+
E.error(t("unshare_failed"));
|
|
1676
1710
|
}
|
|
1677
1711
|
};
|
|
1678
1712
|
return /* @__PURE__ */ s(fe, { children: [
|
|
1679
|
-
/* @__PURE__ */ s(
|
|
1680
|
-
/* @__PURE__ */ e(
|
|
1713
|
+
/* @__PURE__ */ s(ja, { dir: a, children: [
|
|
1714
|
+
/* @__PURE__ */ e(Ba, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1681
1715
|
$,
|
|
1682
1716
|
{
|
|
1683
1717
|
variant: "ghost",
|
|
1684
1718
|
size: "icon",
|
|
1685
1719
|
"aria-label": t("thread_actions", { title: r.title ?? t("new_conversation") }),
|
|
1686
1720
|
className: "size-7 rounded-full opacity-100 md:opacity-0 md:group-hover/sidebar-menu-item:opacity-100 md:group-focus-within/sidebar-menu-item:opacity-100 focus-visible:opacity-100 hover:bg-accent hover:text-accent-foreground data-[state=open]:opacity-100 transition-all",
|
|
1687
|
-
children: /* @__PURE__ */ e(
|
|
1721
|
+
children: /* @__PURE__ */ e(ua, { "aria-hidden": !0, className: "size-3.5" })
|
|
1688
1722
|
}
|
|
1689
1723
|
) }),
|
|
1690
|
-
/* @__PURE__ */ s(
|
|
1724
|
+
/* @__PURE__ */ s(Ga, { align: "end", className: "min-w-[120px] p-1", children: [
|
|
1691
1725
|
n.pin && /* @__PURE__ */ s(he, { onSelect: () => {
|
|
1692
1726
|
h();
|
|
1693
1727
|
}, className: ge, children: [
|
|
1694
|
-
r.pinned ? /* @__PURE__ */ e(
|
|
1728
|
+
r.pinned ? /* @__PURE__ */ e(ma, { "aria-hidden": !0, className: "size-4" }) : /* @__PURE__ */ e(nt, { "aria-hidden": !0, className: "size-4" }),
|
|
1695
1729
|
/* @__PURE__ */ e("span", { children: r.pinned ? t("unpin_conversation") : t("pin_conversation") })
|
|
1696
1730
|
] }),
|
|
1697
1731
|
n.share && /* @__PURE__ */ s(he, { onSelect: () => {
|
|
1698
1732
|
p();
|
|
1699
1733
|
}, className: ge, children: [
|
|
1700
|
-
/* @__PURE__ */ e(
|
|
1734
|
+
/* @__PURE__ */ e(ha, { "aria-hidden": !0, className: "size-4" }),
|
|
1701
1735
|
/* @__PURE__ */ e("span", { children: t("share_conversation") })
|
|
1702
1736
|
] }),
|
|
1703
1737
|
n.share && r.shared && /* @__PURE__ */ s(he, { onSelect: () => {
|
|
1704
1738
|
f();
|
|
1705
1739
|
}, className: ge, children: [
|
|
1706
|
-
/* @__PURE__ */ e(
|
|
1740
|
+
/* @__PURE__ */ e(ga, { "aria-hidden": !0, className: "size-4" }),
|
|
1707
1741
|
/* @__PURE__ */ e("span", { children: t("stop_sharing") })
|
|
1708
1742
|
] }),
|
|
1709
1743
|
n.rename && /* @__PURE__ */ s(he, { onSelect: u, className: ge, children: [
|
|
1710
|
-
/* @__PURE__ */ e(
|
|
1744
|
+
/* @__PURE__ */ e(pa, { "aria-hidden": !0, className: "size-4" }),
|
|
1711
1745
|
/* @__PURE__ */ e("span", { children: t("rename_conversation") })
|
|
1712
1746
|
] }),
|
|
1713
1747
|
n.delete && /* @__PURE__ */ s(
|
|
@@ -1716,38 +1750,38 @@ function Vn() {
|
|
|
1716
1750
|
onSelect: () => c(!0),
|
|
1717
1751
|
className: `${ge} text-destructive focus:text-destructive focus:bg-destructive/10`,
|
|
1718
1752
|
children: [
|
|
1719
|
-
/* @__PURE__ */ e(
|
|
1753
|
+
/* @__PURE__ */ e(fa, { "aria-hidden": !0, className: "size-4" }),
|
|
1720
1754
|
/* @__PURE__ */ e("span", { children: t("delete_conversation") })
|
|
1721
1755
|
]
|
|
1722
1756
|
}
|
|
1723
1757
|
)
|
|
1724
1758
|
] })
|
|
1725
1759
|
] }),
|
|
1726
|
-
n.delete && /* @__PURE__ */ e(
|
|
1760
|
+
n.delete && /* @__PURE__ */ e(Gn, { open: g, onOpenChange: c })
|
|
1727
1761
|
] });
|
|
1728
1762
|
}
|
|
1729
|
-
function
|
|
1730
|
-
const { t } =
|
|
1731
|
-
return /* @__PURE__ */ e(
|
|
1763
|
+
function Vn() {
|
|
1764
|
+
const { t } = q("sidebar"), { isMobile: a, setOpenMobile: n } = be(), { thread: r, isRenaming: i } = Re();
|
|
1765
|
+
return /* @__PURE__ */ e(G.Item, { asChild: !0, children: /* @__PURE__ */ e(yt, { className: "group/sidebar-menu-item relative", children: i ? /* @__PURE__ */ e(Bn, {}) : /* @__PURE__ */ s(fe, { children: [
|
|
1732
1766
|
/* @__PURE__ */ e(
|
|
1733
|
-
|
|
1767
|
+
Nt,
|
|
1734
1768
|
{
|
|
1735
1769
|
asChild: !0,
|
|
1736
1770
|
className: "h-auto py-2.5 px-3 opacity-70 hover:opacity-100 aria-[current=page]:bg-accent aria-[current=page]:opacity-100 aria-busy:thread-streaming",
|
|
1737
1771
|
children: /* @__PURE__ */ s(
|
|
1738
|
-
|
|
1772
|
+
G.ItemTrigger,
|
|
1739
1773
|
{
|
|
1740
1774
|
onOpen: () => a && n(!1),
|
|
1741
1775
|
className: "flex flex-col items-start gap-0.5 w-full overflow-hidden pe-16",
|
|
1742
1776
|
children: [
|
|
1743
1777
|
/* @__PURE__ */ e(
|
|
1744
|
-
|
|
1778
|
+
G.ItemTitle,
|
|
1745
1779
|
{
|
|
1746
1780
|
fallback: t("new_conversation"),
|
|
1747
1781
|
className: "truncate w-full text-start font-medium text-sm"
|
|
1748
1782
|
}
|
|
1749
1783
|
),
|
|
1750
|
-
/* @__PURE__ */ e(
|
|
1784
|
+
/* @__PURE__ */ e(G.ItemTime, { className: "w-full text-start text-xs opacity-60" })
|
|
1751
1785
|
]
|
|
1752
1786
|
}
|
|
1753
1787
|
)
|
|
@@ -1755,25 +1789,25 @@ function Kn() {
|
|
|
1755
1789
|
),
|
|
1756
1790
|
/* @__PURE__ */ s("div", { className: "absolute top-1/2 -translate-y-1/2 end-1.5 flex items-center gap-1 z-10", children: [
|
|
1757
1791
|
r.pinned && /* @__PURE__ */ s("span", { className: "md:absolute md:inset-0 md:m-auto md:size-3.5 md:group-hover/sidebar-menu-item:opacity-0 md:group-focus-within/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none", children: [
|
|
1758
|
-
/* @__PURE__ */ e(
|
|
1792
|
+
/* @__PURE__ */ e(nt, { "aria-hidden": !0, className: "size-3.5 text-primary opacity-70" }),
|
|
1759
1793
|
/* @__PURE__ */ e("span", { className: "sr-only", children: t("pinned") })
|
|
1760
1794
|
] }),
|
|
1761
|
-
/* @__PURE__ */ e(
|
|
1795
|
+
/* @__PURE__ */ e(Hn, {})
|
|
1762
1796
|
] })
|
|
1763
1797
|
] }) }) });
|
|
1764
1798
|
}
|
|
1765
|
-
function
|
|
1766
|
-
const { t } =
|
|
1799
|
+
function Kn() {
|
|
1800
|
+
const { t } = q("sidebar");
|
|
1767
1801
|
return /* @__PURE__ */ s("div", { className: "relative group/search", children: [
|
|
1768
1802
|
/* @__PURE__ */ e(
|
|
1769
|
-
|
|
1803
|
+
ba,
|
|
1770
1804
|
{
|
|
1771
1805
|
"aria-hidden": !0,
|
|
1772
1806
|
className: "absolute start-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity"
|
|
1773
1807
|
}
|
|
1774
1808
|
),
|
|
1775
1809
|
/* @__PURE__ */ e(
|
|
1776
|
-
|
|
1810
|
+
G.Search,
|
|
1777
1811
|
{
|
|
1778
1812
|
"aria-label": t("search_conversations"),
|
|
1779
1813
|
placeholder: t("search_conversations"),
|
|
@@ -1782,36 +1816,36 @@ function Qn() {
|
|
|
1782
1816
|
)
|
|
1783
1817
|
] });
|
|
1784
1818
|
}
|
|
1785
|
-
function
|
|
1786
|
-
const { t: a } =
|
|
1787
|
-
() => ({ pin: r, share:
|
|
1788
|
-
[r,
|
|
1819
|
+
function Qn({ side: t = "start" }) {
|
|
1820
|
+
const { t: a } = q("sidebar"), n = ee((g) => g.history), { showPin: r, showShare: i, showRename: o, showDelete: m } = n, u = O(
|
|
1821
|
+
() => ({ pin: r, share: i, rename: o, delete: m }),
|
|
1822
|
+
[r, i, o, m]
|
|
1789
1823
|
);
|
|
1790
|
-
return /* @__PURE__ */ e(
|
|
1791
|
-
/* @__PURE__ */ e(
|
|
1792
|
-
n.enabled && /* @__PURE__ */ s(
|
|
1793
|
-
/* @__PURE__ */ e(
|
|
1794
|
-
/* @__PURE__ */ s(
|
|
1795
|
-
/* @__PURE__ */ e(
|
|
1796
|
-
/* @__PURE__ */ e(
|
|
1797
|
-
/* @__PURE__ */ e(
|
|
1824
|
+
return /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ e(qn, { collapsible: "icon", side: t, children: /* @__PURE__ */ e(Mn, { className: "custom-scrollbar", children: /* @__PURE__ */ s(Pn, { children: [
|
|
1825
|
+
/* @__PURE__ */ e(Un, {}),
|
|
1826
|
+
n.enabled && /* @__PURE__ */ s(G.Root, { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
1827
|
+
/* @__PURE__ */ e(Ge, { className: "mb-6 px-2", children: /* @__PURE__ */ e(Kn, {}) }),
|
|
1828
|
+
/* @__PURE__ */ s(Ge, { children: [
|
|
1829
|
+
/* @__PURE__ */ e(xt, { children: /* @__PURE__ */ e(kt.Provider, { value: u, children: /* @__PURE__ */ e(G.Items, { component: Vn }) }) }),
|
|
1830
|
+
/* @__PURE__ */ e(G.Empty, { className: "px-4 py-8 text-center text-sm opacity-60", children: a("no_conversations") }),
|
|
1831
|
+
/* @__PURE__ */ e(jn, {})
|
|
1798
1832
|
] })
|
|
1799
1833
|
] })
|
|
1800
1834
|
] }) }) }) });
|
|
1801
1835
|
}
|
|
1802
|
-
function
|
|
1803
|
-
return /* @__PURE__ */ e(
|
|
1836
|
+
function Wn({ components: t, disclaimer: a, welcome: n, ...r }) {
|
|
1837
|
+
return /* @__PURE__ */ e(De, { components: t, disclaimer: a, welcome: n, children: /* @__PURE__ */ e(Xn, { ...r }) });
|
|
1804
1838
|
}
|
|
1805
|
-
function
|
|
1839
|
+
function Xn({
|
|
1806
1840
|
threadId: t,
|
|
1807
1841
|
onThreadChange: a,
|
|
1808
1842
|
getThreadHref: n,
|
|
1809
1843
|
getShareHref: r,
|
|
1810
|
-
sidebar:
|
|
1811
|
-
header:
|
|
1844
|
+
sidebar: i,
|
|
1845
|
+
header: o,
|
|
1812
1846
|
classNames: m
|
|
1813
1847
|
}) {
|
|
1814
|
-
const u =
|
|
1848
|
+
const u = ee((f) => f.history.enabled), { MaintenanceBanner: g, MaintenanceScreen: c } = ie(), h = Ut(), p = h.isUnderMaintenance && h.status ? {
|
|
1815
1849
|
status: h.status,
|
|
1816
1850
|
title: h.title,
|
|
1817
1851
|
message: h.message,
|
|
@@ -1819,65 +1853,65 @@ function Yn({
|
|
|
1819
1853
|
blocksChat: h.blocksChat,
|
|
1820
1854
|
refresh: h.refresh
|
|
1821
1855
|
} : null;
|
|
1822
|
-
return p && h.display === "fullscreen" && c ? /* @__PURE__ */ e(
|
|
1823
|
-
|
|
1856
|
+
return p && h.display === "fullscreen" && c ? /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(c, { ...p }) }) : /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e(
|
|
1857
|
+
Je,
|
|
1824
1858
|
{
|
|
1825
1859
|
threadId: t,
|
|
1826
1860
|
onThreadChange: a,
|
|
1827
1861
|
getThreadHref: n,
|
|
1828
1862
|
getShareHref: r,
|
|
1829
|
-
children: /* @__PURE__ */ s(
|
|
1830
|
-
|
|
1863
|
+
children: /* @__PURE__ */ s(In, { defaultOpen: u, className: "bg-background", children: [
|
|
1864
|
+
i !== void 0 ? i : u ? /* @__PURE__ */ e(Qn, {}) : null,
|
|
1831
1865
|
/* @__PURE__ */ s("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
|
|
1832
|
-
|
|
1866
|
+
o !== void 0 ? o : /* @__PURE__ */ e(St, {}),
|
|
1833
1867
|
p && g && /* @__PURE__ */ e(g, { ...p }),
|
|
1834
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ e(
|
|
1868
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ e(un, { classNames: m }) })
|
|
1835
1869
|
] })
|
|
1836
1870
|
] })
|
|
1837
1871
|
}
|
|
1838
1872
|
) });
|
|
1839
1873
|
}
|
|
1840
1874
|
const pe = /* @__PURE__ */ new Set();
|
|
1841
|
-
let
|
|
1842
|
-
function
|
|
1875
|
+
let ae = null;
|
|
1876
|
+
function Pe() {
|
|
1843
1877
|
for (const t of pe) t();
|
|
1844
1878
|
}
|
|
1845
|
-
function
|
|
1846
|
-
return pe.size === 0 && window.addEventListener("popstate",
|
|
1847
|
-
pe.delete(t), pe.size === 0 && window.removeEventListener("popstate",
|
|
1879
|
+
function Yn(t) {
|
|
1880
|
+
return pe.size === 0 && window.addEventListener("popstate", Pe), pe.add(t), () => {
|
|
1881
|
+
pe.delete(t), pe.size === 0 && window.removeEventListener("popstate", Pe);
|
|
1848
1882
|
};
|
|
1849
1883
|
}
|
|
1850
|
-
function
|
|
1884
|
+
function Zn() {
|
|
1851
1885
|
const { pathname: t, search: a, hash: n } = window.location, r = window.history.state;
|
|
1852
|
-
return (
|
|
1886
|
+
return (ae?.pathname !== t || ae.search !== a || ae.hash !== n || ae.state !== r) && (ae = { pathname: t, search: a, hash: n, state: r }), ae;
|
|
1853
1887
|
}
|
|
1854
|
-
const
|
|
1855
|
-
function
|
|
1856
|
-
return
|
|
1888
|
+
const Jn = () => null;
|
|
1889
|
+
function er() {
|
|
1890
|
+
return Lt(Yn, Zn, Jn);
|
|
1857
1891
|
}
|
|
1858
1892
|
function Ne(t, { replace: a = !1, state: n = null } = {}) {
|
|
1859
|
-
a ? window.history.replaceState(n, "", t) : window.history.pushState(n, "", t),
|
|
1893
|
+
a ? window.history.replaceState(n, "", t) : window.history.pushState(n, "", t), Pe();
|
|
1860
1894
|
}
|
|
1861
|
-
const
|
|
1895
|
+
const tr = {
|
|
1862
1896
|
chat: "/chat",
|
|
1863
1897
|
login: "/login",
|
|
1864
1898
|
shared: "/shared",
|
|
1865
1899
|
admin: "/admin"
|
|
1866
1900
|
};
|
|
1867
|
-
function
|
|
1901
|
+
function ne(t) {
|
|
1868
1902
|
const a = t.replace(/^\/+|\/+$/g, "");
|
|
1869
1903
|
return a ? `/${a}` : "";
|
|
1870
1904
|
}
|
|
1871
|
-
function
|
|
1872
|
-
const n =
|
|
1905
|
+
function ar(t, a = {}) {
|
|
1906
|
+
const n = ne(t), r = { ...tr, ...a };
|
|
1873
1907
|
return {
|
|
1874
|
-
chat: n +
|
|
1875
|
-
login: n +
|
|
1876
|
-
shared: n +
|
|
1877
|
-
admin: n +
|
|
1908
|
+
chat: n + ne(r.chat),
|
|
1909
|
+
login: n + ne(r.login),
|
|
1910
|
+
shared: n + ne(r.shared),
|
|
1911
|
+
admin: n + ne(r.admin)
|
|
1878
1912
|
};
|
|
1879
1913
|
}
|
|
1880
|
-
function
|
|
1914
|
+
function Qe(t, a) {
|
|
1881
1915
|
if (t !== a && !t.startsWith(`${a}/`)) return;
|
|
1882
1916
|
const n = t.slice(a.length).replace(/^\/+|\/+$/g, "");
|
|
1883
1917
|
if (!n) return null;
|
|
@@ -1888,23 +1922,23 @@ function We(t, a) {
|
|
|
1888
1922
|
return;
|
|
1889
1923
|
}
|
|
1890
1924
|
}
|
|
1891
|
-
function
|
|
1892
|
-
const n =
|
|
1925
|
+
function nr(t, a) {
|
|
1926
|
+
const n = ne(t);
|
|
1893
1927
|
if (n === a.admin || n.startsWith(`${a.admin}/`)) return { name: "admin" };
|
|
1894
1928
|
if (n === a.login) return { name: "login" };
|
|
1895
|
-
const r =
|
|
1896
|
-
return r ? { name: "shared", shareId: r } : { name: "chat", threadId:
|
|
1929
|
+
const r = Qe(n, a.shared);
|
|
1930
|
+
return r ? { name: "shared", shareId: r } : { name: "chat", threadId: Qe(n, a.chat) ?? null };
|
|
1897
1931
|
}
|
|
1898
1932
|
function qe(t, a) {
|
|
1899
1933
|
return t === null ? a.chat || "/" : `${a.chat}/${encodeURIComponent(t)}`;
|
|
1900
1934
|
}
|
|
1901
|
-
function
|
|
1935
|
+
function wr({
|
|
1902
1936
|
url: t,
|
|
1903
1937
|
api: a,
|
|
1904
1938
|
basePath: n = "/",
|
|
1905
1939
|
paths: r,
|
|
1906
|
-
admin:
|
|
1907
|
-
components:
|
|
1940
|
+
admin: i,
|
|
1941
|
+
components: o,
|
|
1908
1942
|
history: m,
|
|
1909
1943
|
welcome: u,
|
|
1910
1944
|
threadActions: g,
|
|
@@ -1913,35 +1947,35 @@ function Nr({
|
|
|
1913
1947
|
settings: p,
|
|
1914
1948
|
...f
|
|
1915
1949
|
}) {
|
|
1916
|
-
const
|
|
1917
|
-
return
|
|
1918
|
-
/* @__PURE__ */ e(
|
|
1950
|
+
const b = er();
|
|
1951
|
+
return b ? /* @__PURE__ */ s(bn, { ...f, api: { ...a, basePath: t }, children: [
|
|
1952
|
+
/* @__PURE__ */ e(vn, {}),
|
|
1919
1953
|
/* @__PURE__ */ e(
|
|
1920
|
-
|
|
1954
|
+
De,
|
|
1921
1955
|
{
|
|
1922
|
-
components:
|
|
1956
|
+
components: o,
|
|
1923
1957
|
history: m,
|
|
1924
1958
|
welcome: u,
|
|
1925
1959
|
threadActions: g,
|
|
1926
1960
|
composer: c,
|
|
1927
1961
|
disclaimer: h,
|
|
1928
1962
|
settings: p,
|
|
1929
|
-
children: /* @__PURE__ */ e(
|
|
1963
|
+
children: /* @__PURE__ */ e(rr, { location: b, paths: ar(n, r), admin: i })
|
|
1930
1964
|
}
|
|
1931
1965
|
)
|
|
1932
1966
|
] }) : null;
|
|
1933
1967
|
}
|
|
1934
|
-
function
|
|
1935
|
-
const r =
|
|
1968
|
+
function rr({ location: t, paths: a, admin: n }) {
|
|
1969
|
+
const r = nr(t.pathname, a), i = qe(null, a);
|
|
1936
1970
|
if (r.name === "admin" && n) return /* @__PURE__ */ e(Mt, { fallback: null, children: n });
|
|
1937
1971
|
if (r.name === "login") {
|
|
1938
|
-
const { reason: c, from: h } =
|
|
1939
|
-
return /* @__PURE__ */ e(
|
|
1972
|
+
const { reason: c, from: h } = or(t.state);
|
|
1973
|
+
return /* @__PURE__ */ e(yn, { reason: c, onSignedIn: () => Ne(h ?? i, { replace: !0 }) });
|
|
1940
1974
|
}
|
|
1941
|
-
if (r.name === "shared") return /* @__PURE__ */ e(
|
|
1942
|
-
const
|
|
1975
|
+
if (r.name === "shared") return /* @__PURE__ */ e(On, { shareId: r.shareId });
|
|
1976
|
+
const o = r.name === "chat" ? r.threadId : null, m = new URLSearchParams(t.search), u = m.get("code");
|
|
1943
1977
|
return /* @__PURE__ */ e(
|
|
1944
|
-
|
|
1978
|
+
xn,
|
|
1945
1979
|
{
|
|
1946
1980
|
loginCode: u,
|
|
1947
1981
|
onLoginCodeUsed: () => {
|
|
@@ -1949,11 +1983,11 @@ function sr({ location: t, paths: a, admin: n }) {
|
|
|
1949
1983
|
const c = m.toString();
|
|
1950
1984
|
Ne(t.pathname + (c ? `?${c}` : "") + t.hash, { replace: !0 });
|
|
1951
1985
|
},
|
|
1952
|
-
fallback: (c) => /* @__PURE__ */ e(
|
|
1986
|
+
fallback: (c) => /* @__PURE__ */ e(lr, { to: a.login, reason: c, from: t.pathname + t.search }),
|
|
1953
1987
|
children: /* @__PURE__ */ e(
|
|
1954
|
-
|
|
1988
|
+
Wn,
|
|
1955
1989
|
{
|
|
1956
|
-
threadId:
|
|
1990
|
+
threadId: o,
|
|
1957
1991
|
onThreadChange: (c) => Ne(qe(c, a)),
|
|
1958
1992
|
getThreadHref: (c) => qe(c, a),
|
|
1959
1993
|
getShareHref: (c) => `${a.shared}/${encodeURIComponent(c)}`
|
|
@@ -1962,71 +1996,71 @@ function sr({ location: t, paths: a, admin: n }) {
|
|
|
1962
1996
|
}
|
|
1963
1997
|
);
|
|
1964
1998
|
}
|
|
1965
|
-
const
|
|
1999
|
+
const sr = [
|
|
1966
2000
|
"signed_out",
|
|
1967
2001
|
"session_expired",
|
|
1968
2002
|
"handoff_failed"
|
|
1969
2003
|
];
|
|
1970
|
-
function
|
|
1971
|
-
return typeof t == "string" &&
|
|
2004
|
+
function ir(t) {
|
|
2005
|
+
return typeof t == "string" && sr.includes(t);
|
|
1972
2006
|
}
|
|
1973
|
-
function
|
|
2007
|
+
function or(t) {
|
|
1974
2008
|
if (typeof t != "object" || t === null) return {};
|
|
1975
2009
|
const { reason: a, from: n } = t;
|
|
1976
2010
|
return {
|
|
1977
|
-
reason:
|
|
2011
|
+
reason: ir(a) ? a : void 0,
|
|
1978
2012
|
// Only a path on this site: a full URL here would make the sign-in page an open redirect.
|
|
1979
2013
|
from: typeof n == "string" && n.startsWith("/") && !n.startsWith("//") ? n : void 0
|
|
1980
2014
|
};
|
|
1981
2015
|
}
|
|
1982
|
-
function
|
|
1983
|
-
return
|
|
2016
|
+
function lr({ to: t, reason: a, from: n }) {
|
|
2017
|
+
return R(() => {
|
|
1984
2018
|
Ne(t, { replace: !0, state: { reason: a, from: n } });
|
|
1985
2019
|
}, [t, a, n]), null;
|
|
1986
2020
|
}
|
|
1987
2021
|
export {
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2022
|
+
Qn as AppSidebar,
|
|
2023
|
+
un as Chat,
|
|
2024
|
+
Cr as ChatError,
|
|
2025
|
+
Wn as ChatLayout,
|
|
2026
|
+
_r as ChoiceQuestionDock,
|
|
2027
|
+
Tr as ChoiceQuestionPart,
|
|
2028
|
+
ka as ChoiceQuestionProvider,
|
|
2029
|
+
zn as CreditsBar,
|
|
2030
|
+
vn as DocumentSync,
|
|
2031
|
+
Ir as FilePart,
|
|
2032
|
+
qr as FollowUpSuggestions,
|
|
2033
|
+
wr as GentiqChatApp,
|
|
2034
|
+
bn as GentiqProvider,
|
|
2035
|
+
W as GentiqRoot,
|
|
2036
|
+
De as GentiqUI,
|
|
2037
|
+
Lr as MaintenanceBanner,
|
|
2038
|
+
Mr as MaintenanceScreen,
|
|
2005
2039
|
Pr as MessageActions,
|
|
2006
|
-
|
|
2040
|
+
Ar as MessageList,
|
|
2007
2041
|
Er as PromptInputArea,
|
|
2008
2042
|
zr as PromptInputButton,
|
|
2009
|
-
|
|
2010
|
-
|
|
2043
|
+
wt as QuotaBar,
|
|
2044
|
+
En as QuotaWindows,
|
|
2011
2045
|
Rr as ReasoningPart,
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2046
|
+
Dr as ReferencePart,
|
|
2047
|
+
va as Referenceable,
|
|
2048
|
+
xn as RequireAuth,
|
|
2049
|
+
Fn as SettingsDialog,
|
|
2050
|
+
On as SharedChatView,
|
|
2051
|
+
In as SidebarProvider,
|
|
2018
2052
|
Fr as Suggestion,
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2053
|
+
Or as Suggestions,
|
|
2054
|
+
$r as TextPart,
|
|
2055
|
+
Ur as ToolPart,
|
|
2056
|
+
lt as Tooltip,
|
|
2057
|
+
dt as TooltipContent,
|
|
2058
|
+
ct as TooltipTrigger,
|
|
2059
|
+
jr as UsageMeter,
|
|
2060
|
+
yn as UserLoginPage,
|
|
2061
|
+
Br as WelcomeScreen,
|
|
2062
|
+
Gr as useChoiceQuestion,
|
|
2063
|
+
ee as useGentiqUIOptions,
|
|
2064
|
+
Hr as useSmoothStreamingConfig,
|
|
2065
|
+
Vr as useSmoothText
|
|
2032
2066
|
};
|