@versini/sassysaint 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1010 @@
1
+ import { jsxs as N, Fragment as be, jsx as l } from "react/jsx-runtime";
2
+ import i from "clsx";
3
+ import H, { useContext as O, useRef as w, useState as J, useLayoutEffect as M, useSyncExternalStore as fe, useCallback as q, useEffect as ke } from "react";
4
+ import { A as _e, i as xe, f as we, S as Ne, f$1 as Te, M as ve, U as Se, r as Ce, o as Ie, n as ae, l as Ee, a as j, MODEL_GPT4 as He } from "./index.B6eo37ct.js";
5
+ const Oe = (e) => {
6
+ let r = "";
7
+ if (typeof e == "number" || typeof e == "string")
8
+ r = "m-" + e;
9
+ else {
10
+ const t = [];
11
+ (e == null ? void 0 : e.t) !== void 0 && t.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && t.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && t.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && t.push(`ml-${e.l}`), r = t.join(" ");
12
+ }
13
+ return r;
14
+ }, Q = ({
15
+ children: e,
16
+ fill: r,
17
+ viewBox: t,
18
+ className: a,
19
+ defaultViewBox: s,
20
+ defaultClassName: o,
21
+ spacing: c,
22
+ title: d,
23
+ semantic: n = !1,
24
+ ...m
25
+ }) => {
26
+ const h = Oe(c), y = i(
27
+ h,
28
+ a || o
29
+ );
30
+ return /* @__PURE__ */ N(be, { children: [
31
+ /* @__PURE__ */ l(
32
+ "svg",
33
+ {
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ className: y,
36
+ viewBox: t || s,
37
+ fill: r || "currentColor",
38
+ role: "img",
39
+ "aria-hidden": !n,
40
+ focusable: !1,
41
+ ...m,
42
+ children: e
43
+ }
44
+ ),
45
+ d && n && /* @__PURE__ */ l("span", { className: "sr-only", children: d })
46
+ ] });
47
+ };
48
+ /*!
49
+ @versini/ui-private v1.4.8
50
+ © 2024 gizmette.com
51
+ */
52
+ try {
53
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
54
+ version: "1.4.8",
55
+ buildTime: "08/25/2024 02:12 PM EDT",
56
+ homepage: "https://github.com/aversini/ui-components",
57
+ license: "MIT"
58
+ });
59
+ } catch {
60
+ }
61
+ /*!
62
+ @versini/ui-icons v1.11.0
63
+ © 2024 gizmette.com
64
+ */
65
+ try {
66
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
67
+ version: "1.11.0",
68
+ buildTime: "08/25/2024 02:12 PM EDT",
69
+ homepage: "https://github.com/aversini/ui-components",
70
+ license: "MIT"
71
+ });
72
+ } catch {
73
+ }
74
+ const Ae = ({
75
+ className: e,
76
+ viewBox: r,
77
+ spacing: t,
78
+ title: a,
79
+ monotone: s,
80
+ ...o
81
+ }) => /* @__PURE__ */ N(
82
+ Q,
83
+ {
84
+ defaultViewBox: "0 0 576 512",
85
+ defaultClassName: "size-5",
86
+ viewBox: r,
87
+ className: e,
88
+ spacing: t,
89
+ title: a || "Sort",
90
+ ...o,
91
+ children: [
92
+ /* @__PURE__ */ l(
93
+ "path",
94
+ {
95
+ opacity: s ? "1" : "0.4",
96
+ d: "M393.4 41.4c12.5-12.5 32.8-12.5 45.3 0l96 96c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L448 141.3V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V141.3l-41.4 41.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l96-96z"
97
+ }
98
+ ),
99
+ /* @__PURE__ */ l("path", { d: "M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 370.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V370.7L86.6 329.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96z" })
100
+ ]
101
+ }
102
+ ), $e = ({
103
+ className: e,
104
+ viewBox: r,
105
+ spacing: t,
106
+ title: a,
107
+ monotone: s,
108
+ ...o
109
+ }) => /* @__PURE__ */ N(
110
+ Q,
111
+ {
112
+ defaultViewBox: "0 0 576 512",
113
+ defaultClassName: "size-5",
114
+ viewBox: r,
115
+ className: e,
116
+ spacing: t,
117
+ title: a || "Sort Down",
118
+ ...o,
119
+ children: [
120
+ /* @__PURE__ */ l(
121
+ "path",
122
+ {
123
+ opacity: s ? "1" : "0.4",
124
+ d: "M288 448c0 17.7 14.3 32 32 32h32c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32H544c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32z"
125
+ }
126
+ ),
127
+ /* @__PURE__ */ l("path", { d: "M128 480c9 0 17.5-3.8 23.6-10.4l88-96c11.9-13 11.1-33.3-2-45.2s-33.3-11.1-45.2 2L160 365.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V365.7L63.6 330.4c-11.9-13-32.2-13.9-45.2-2s-13.9 32.2-2 45.2l88 96C110.5 476.2 119 480 128 480z" })
128
+ ]
129
+ }
130
+ ), Be = ({
131
+ className: e,
132
+ viewBox: r,
133
+ spacing: t,
134
+ title: a,
135
+ monotone: s,
136
+ ...o
137
+ }) => /* @__PURE__ */ N(
138
+ Q,
139
+ {
140
+ defaultViewBox: "0 0 576 512",
141
+ defaultClassName: "size-5",
142
+ viewBox: r,
143
+ className: e,
144
+ spacing: t,
145
+ title: a || "Sort Up",
146
+ ...o,
147
+ children: [
148
+ /* @__PURE__ */ l(
149
+ "path",
150
+ {
151
+ opacity: s ? "1" : "0.4",
152
+ d: "M288 64c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32H544c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32z"
153
+ }
154
+ ),
155
+ /* @__PURE__ */ l("path", { d: "M128 32c9 0 17.5 3.8 23.6 10.4l88 96c11.9 13 11.1 33.3-2 45.2s-33.3 11.1-45.2-2L160 146.3V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V146.3L63.6 181.6c-11.9 13-32.2 13.9-45.2 2s-13.9-32.2-2-45.2l88-96C110.5 35.8 119 32 128 32z" })
156
+ ]
157
+ }
158
+ ), se = H.forwardRef(
159
+ ({
160
+ children: e,
161
+ disabled: r = !1,
162
+ mode: t = "system",
163
+ focusMode: a = "system",
164
+ fullWidth: s = !1,
165
+ className: o,
166
+ type: c = "button",
167
+ raw: d = !1,
168
+ noBorder: n = !1,
169
+ "aria-label": m,
170
+ label: h,
171
+ size: y = "medium",
172
+ labelRight: p,
173
+ labelLeft: _,
174
+ spacing: g,
175
+ noBackground: C = !1,
176
+ align: x = "center",
177
+ active: A = !1,
178
+ ...$
179
+ }, B) => {
180
+ const V = _e({
181
+ type: we,
182
+ mode: t,
183
+ focusMode: a,
184
+ fullWidth: s,
185
+ disabled: r,
186
+ raw: d,
187
+ className: o,
188
+ noBorder: n,
189
+ size: y,
190
+ labelRight: p,
191
+ labelLeft: _,
192
+ spacing: g,
193
+ noBackground: C,
194
+ align: x
195
+ }), z = i({
196
+ "text-copy-accent-dark": t === "light" && !d,
197
+ "text-copy-light": t === "dark" && !d,
198
+ "text-copy-accent-dark dark:text-copy-light": t === "alt-system" && !d,
199
+ "text-copy-light dark:text-copy-accent-dark": t === "system" && !d
200
+ }), G = A ? i(
201
+ "relative",
202
+ "focus-within:static",
203
+ "focus-within:after:border-transparent",
204
+ "after:absolute",
205
+ "after:content-['']",
206
+ "after:border-b-2",
207
+ "after:bottom-[-4px]",
208
+ "after:left-0",
209
+ "after:right-0",
210
+ {
211
+ "after:border-table-dark": t === "dark",
212
+ "after:border-table-light": t === "light",
213
+ "after:border-table-dark dark:after:border-table-light": t === "system",
214
+ "after:border-table-light dark:after:border-table-dark": t === "alt-system"
215
+ }
216
+ ) : "";
217
+ return /* @__PURE__ */ l("div", { className: G, children: /* @__PURE__ */ N(
218
+ xe,
219
+ {
220
+ ref: B,
221
+ className: V,
222
+ disabled: r,
223
+ type: c,
224
+ "aria-label": m || h,
225
+ ...$,
226
+ children: [
227
+ _ && /* @__PURE__ */ l("span", { className: "pr-2", children: _ }),
228
+ /* @__PURE__ */ l("div", { className: z, children: e }),
229
+ p && /* @__PURE__ */ l("span", { className: "pl-2", children: p })
230
+ ]
231
+ }
232
+ ) });
233
+ }
234
+ );
235
+ se.displayName = "ButtonSort";
236
+ const S = H.createContext({
237
+ mode: "light",
238
+ cellWrapper: "thead",
239
+ stickyHeader: !1,
240
+ stickyFooter: !1,
241
+ compact: !1
242
+ }), R = "thead", Y = "tfoot", v = "tbody", U = {
243
+ ASC: "asc",
244
+ DESC: "desc"
245
+ }, Le = ({
246
+ mode: e,
247
+ className: r,
248
+ wrapperClassName: t,
249
+ stickyHeader: a,
250
+ stickyFooter: s,
251
+ spacing: o
252
+ }) => ({
253
+ wrapper: i(
254
+ "not-prose relative w-full rounded-lg shadow-md",
255
+ Ne(o),
256
+ {
257
+ "overflow-x-auto": !a && !s,
258
+ "overflow-y-scroll": a || s,
259
+ "bg-surface-darker text-copy-light": e === "dark",
260
+ "bg-surface-light text-copy-dark": e === "light",
261
+ "bg-surface-darker text-copy-light dark:bg-surface-light dark:text-copy-dark": e === "system",
262
+ "bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-light": e === "alt-system"
263
+ },
264
+ t
265
+ ),
266
+ table: i("my-0 w-full text-left text-sm", r, {
267
+ "text-copy-light": e === "dark",
268
+ "text-copy-dark": e === "light",
269
+ "text-copy-light dark:text-copy-dark": e === "system",
270
+ "text-copy-dark dark:text-copy-light": e === "alt-system"
271
+ }),
272
+ caption: i("py-2 text-sm font-bold", {
273
+ "text-copy-light": e === "dark",
274
+ "text-copy-dark": e === "light",
275
+ "text-copy-light dark:text-copy-dark": e === "system",
276
+ "text-copy-dark dark:text-copy-light": e === "alt-system"
277
+ })
278
+ }), Me = ({
279
+ className: e,
280
+ stickyHeader: r,
281
+ mode: t
282
+ }) => i(e, {
283
+ "sticky top-0 z-10": r,
284
+ "shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && t === "dark",
285
+ "shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && t === "system",
286
+ "shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && t === "light",
287
+ "shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && t === "alt-system"
288
+ }), Ue = ({
289
+ className: e,
290
+ stickyFooter: r,
291
+ mode: t
292
+ }) => i(e, {
293
+ "sticky bottom-0 z-10": r,
294
+ "shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && t === "dark",
295
+ "shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && t === "system",
296
+ "shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && t === "light",
297
+ "shadow-[rgb(65_65_65_/30%)_-0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && t === "alt-system"
298
+ }), Re = ({
299
+ mode: e,
300
+ className: r,
301
+ cellWrapper: t
302
+ }) => t === R || t === Y ? i({
303
+ "bg-table-head-dark": e === "dark",
304
+ "bg-table-head-light": e === "light",
305
+ "bg-table-head-dark dark:bg-table-head-light": e === "system",
306
+ "bg-table-head-light dark:bg-table-head-dark": e === "alt-system"
307
+ }) : i("border-b last:border-0", r, {
308
+ "border-table-dark": e === "dark",
309
+ "odd:bg-table-dark-odd even:bg-table-dark-even": t === v && e === "dark",
310
+ "border-table-light": e === "light",
311
+ "odd:bg-table-light-odd even:bg-table-light-even": t === v && e === "light",
312
+ "border-table-dark dark:border-table-light": e === "system",
313
+ "odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": t === v && e === "system",
314
+ "border-table-light dark:border-table-dark": e === "alt-system",
315
+ "odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": t === v && e === "alt-system"
316
+ }), Ve = ({
317
+ cellWrapper: e,
318
+ className: r,
319
+ compact: t,
320
+ mode: a
321
+ }) => i(r, {
322
+ "text-copy-light": a === "dark",
323
+ "text-copy-dark": a === "light",
324
+ "text-copy-light dark:text-copy-dark": a === "system",
325
+ "text-copy-dark dark:text-copy-light": a === "alt-system",
326
+ "px-4 py-3": !t && (e === R || e === Y),
327
+ "p-4": !t && e === v,
328
+ "px-4 py-1": t
329
+ }), st = ({
330
+ children: e,
331
+ mode: r = "system",
332
+ caption: t,
333
+ compact: a,
334
+ summary: s,
335
+ className: o,
336
+ wrapperClassName: c,
337
+ maxHeight: d,
338
+ stickyHeader: n,
339
+ stickyFooter: m,
340
+ spacing: h,
341
+ ...y
342
+ }) => {
343
+ const p = Le({
344
+ mode: r,
345
+ className: o,
346
+ wrapperClassName: c,
347
+ stickyHeader: n,
348
+ stickyFooter: m,
349
+ spacing: h
350
+ });
351
+ return /* @__PURE__ */ l(
352
+ S.Provider,
353
+ {
354
+ value: { mode: r, stickyHeader: n, stickyFooter: m, compact: a },
355
+ children: /* @__PURE__ */ l(
356
+ "div",
357
+ {
358
+ className: p.wrapper,
359
+ ...d && {
360
+ style: { maxHeight: d }
361
+ },
362
+ children: /* @__PURE__ */ N("table", { className: p.table, summary: s, ...y, children: [
363
+ t && /* @__PURE__ */ l("caption", { className: p.caption, children: t }),
364
+ e
365
+ ] })
366
+ }
367
+ )
368
+ }
369
+ );
370
+ }, ot = ({
371
+ children: e,
372
+ className: r,
373
+ ...t
374
+ }) => {
375
+ const a = O(S);
376
+ a.cellWrapper = R;
377
+ const s = Me({
378
+ className: r,
379
+ mode: a.mode,
380
+ stickyHeader: a.stickyHeader
381
+ });
382
+ return /* @__PURE__ */ l("thead", { className: s, ...t, children: e });
383
+ }, lt = ({
384
+ children: e,
385
+ className: r,
386
+ ...t
387
+ }) => {
388
+ const a = O(S);
389
+ a.cellWrapper = Y;
390
+ const s = Ue({
391
+ className: r,
392
+ mode: a.mode,
393
+ stickyFooter: a.stickyFooter
394
+ });
395
+ return /* @__PURE__ */ l("tfoot", { className: s, ...t, children: e });
396
+ }, ct = ({ children: e, ...r }) => {
397
+ const t = O(S);
398
+ return t.cellWrapper = v, /* @__PURE__ */ l("tbody", { ...r, children: e });
399
+ }, dt = ({
400
+ children: e,
401
+ className: r,
402
+ ...t
403
+ }) => {
404
+ const a = O(S), s = Re({
405
+ mode: a.mode,
406
+ cellWrapper: a.cellWrapper,
407
+ className: r
408
+ });
409
+ return /* @__PURE__ */ l("tr", { className: s, ...t, children: e });
410
+ }, ze = ({
411
+ children: e,
412
+ component: r,
413
+ className: t,
414
+ ...a
415
+ }) => {
416
+ const s = O(S), o = r || (s.cellWrapper === R ? "th" : "td"), c = Ve({
417
+ cellWrapper: s.cellWrapper,
418
+ className: t,
419
+ mode: s.mode,
420
+ compact: s.compact
421
+ });
422
+ return /* @__PURE__ */ l(o, { className: c, ...a, children: e });
423
+ }, it = ({
424
+ align: e,
425
+ children: r,
426
+ className: t,
427
+ component: a,
428
+ focusMode: s = "alt-system",
429
+ mode: o = "alt-system",
430
+ onClick: c,
431
+ sortDirection: d,
432
+ sortedCell: n,
433
+ cellId: m,
434
+ ...h
435
+ }) => /* @__PURE__ */ l(
436
+ ze,
437
+ {
438
+ component: a,
439
+ className: t,
440
+ role: "columnheader",
441
+ "aria-sort": d === U.ASC && n === m ? "ascending" : d === U.DESC && n === m ? "descending" : "other",
442
+ ...h,
443
+ children: /* @__PURE__ */ l(
444
+ se,
445
+ {
446
+ active: n === m,
447
+ className: "rounded-none text-sm",
448
+ onClick: c,
449
+ align: e,
450
+ noBorder: !0,
451
+ focusMode: s,
452
+ mode: o,
453
+ fullWidth: !0,
454
+ labelRight: r,
455
+ children: d === U.ASC && n === m ? /* @__PURE__ */ l(Be, { className: "size-4", monotone: !0 }) : d === U.DESC && n === m ? /* @__PURE__ */ l($e, { className: "size-4", monotone: !0 }) : /* @__PURE__ */ l(Ae, { className: "size-4", monotone: !0 })
456
+ }
457
+ )
458
+ }
459
+ );
460
+ function Ge({
461
+ value: e,
462
+ defaultValue: r,
463
+ finalValue: t,
464
+ onChange: a = () => {
465
+ }
466
+ }) {
467
+ const [s, o] = J(
468
+ r !== void 0 ? r : t
469
+ );
470
+ return e !== void 0 ? [e, a, !0] : [s, (c) => {
471
+ o(c), a == null || a(c);
472
+ }, !1];
473
+ }
474
+ const De = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", Fe = ({
475
+ mode: e
476
+ }) => i({
477
+ "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
478
+ "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
479
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
480
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
481
+ }), We = ({
482
+ focusMode: e
483
+ }) => i("focus:outline focus:outline-2 focus:outline-offset-2", {
484
+ "focus:outline-focus-dark": e === "dark",
485
+ "focus:outline-focus-light": e === "light",
486
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
487
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
488
+ }), Pe = ({
489
+ noBorder: e,
490
+ error: r
491
+ }) => i("border-2", {
492
+ "border-border-dark": !e && !r,
493
+ "focus:border-border-dark": !e && r,
494
+ "border-border-error-dark": !e && r,
495
+ "border-transparent": e
496
+ }), qe = ({
497
+ disabled: e,
498
+ raw: r,
499
+ error: t,
500
+ mode: a
501
+ }) => {
502
+ if (r)
503
+ return "";
504
+ if (e)
505
+ return i("absolute px-2 cursor-not-allowed opacity-50 font-medium");
506
+ if (!t)
507
+ return i("absolute px-2 cursor-text font-medium", {
508
+ "text-copy-medium": a === "dark",
509
+ "text-copy-dark": a === "light",
510
+ "text-copy-dark dark:text-copy-medium": a === "system",
511
+ "text-copy-medium dark:text-copy-dark": a === "alt-system"
512
+ });
513
+ if (t)
514
+ return i("absolute px-2 cursor-text font-medium", {
515
+ "text-copy-medium": a === "dark",
516
+ "text-copy-error-dark": a === "light",
517
+ "text-copy-error-dark dark:text-copy-error-light": a === "system",
518
+ "text-copy-medium dark:text-copy-error-dark": a === "alt-system"
519
+ });
520
+ }, je = ({
521
+ error: e,
522
+ raw: r,
523
+ mode: t,
524
+ disabled: a
525
+ }) => {
526
+ if (r)
527
+ return "";
528
+ if (a)
529
+ return i(
530
+ j,
531
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
532
+ );
533
+ if (!e)
534
+ return i(j, "absolute px-2 font-medium", {
535
+ "text-copy-medium": t === "dark",
536
+ "text-copy-dark": t === "light",
537
+ "text-copy-dark dark:text-copy-medium": t === "system",
538
+ "text-copy-medium dark:text-copy-dark": t === "alt-system"
539
+ });
540
+ if (e)
541
+ return i(j, "absolute px-2 font-medium", {
542
+ "text-copy-error-light": t === "dark",
543
+ "text-copy-error-dark": t === "light",
544
+ "text-copy-error-dark dark:text-copy-error-light": t === "system",
545
+ "dark:text-copy-error-dark text-copy-error-light": t === "alt-system"
546
+ });
547
+ }, Je = ({
548
+ className: e,
549
+ textAreaClassName: r,
550
+ raw: t,
551
+ focusMode: a,
552
+ disabled: s,
553
+ noBorder: o,
554
+ error: c,
555
+ spacing: d,
556
+ mode: n
557
+ }) => {
558
+ const m = t ? e : i(
559
+ "relative flex w-full flex-col justify-center",
560
+ Ce,
561
+ e,
562
+ Ie(d)
563
+ ), h = t ? i(r) : i(
564
+ ae,
565
+ r,
566
+ De(),
567
+ Fe({ mode: n }),
568
+ We({ focusMode: a }),
569
+ Pe({
570
+ noBorder: o,
571
+ error: c
572
+ }),
573
+ {
574
+ "disabled:cursor-not-allowed disabled:opacity-50": s
575
+ }
576
+ ), y = t ? void 0 : "sr-only", p = qe({
577
+ disabled: s,
578
+ raw: t,
579
+ error: c,
580
+ mode: n
581
+ }), _ = je({
582
+ error: c,
583
+ raw: t,
584
+ mode: n,
585
+ disabled: s
586
+ }), g = t ? void 0 : i(Ee, "absolute");
587
+ return {
588
+ wrapper: m,
589
+ textArea: h,
590
+ accessibleLabel: y,
591
+ visibleLabel: p,
592
+ helperText: _,
593
+ rightElement: g
594
+ };
595
+ }, Qe = ({
596
+ scrollHeight: e,
597
+ currentHeight: r,
598
+ currentLabelOffset: t = 0,
599
+ currentHelperTextOffset: a = 0
600
+ }) => {
601
+ let s, o;
602
+ if (e > 0 && e !== r) {
603
+ const c = e - r, d = Math.abs(c / 24);
604
+ s = t + -1 * Math.sign(c) * (12 * d), o = a + Math.sign(c) * (12 * d);
605
+ }
606
+ return {
607
+ labelOffset: s,
608
+ helperTextOffset: o,
609
+ scrollHeight: e
610
+ };
611
+ }, Ye = H.forwardRef(
612
+ ({
613
+ id: e,
614
+ name: r,
615
+ label: t,
616
+ error: a = !1,
617
+ raw: s = !1,
618
+ className: o,
619
+ textAreaClassName: c,
620
+ mode: d = "system",
621
+ focusMode: n = "system",
622
+ value: m,
623
+ defaultValue: h,
624
+ disabled: y = !1,
625
+ noBorder: p = !1,
626
+ labelId: _,
627
+ helperText: g = "",
628
+ helperTextOnFocus: C = !1,
629
+ rightElement: x,
630
+ onChange: A,
631
+ onFocus: $,
632
+ onBlur: B,
633
+ spacing: V,
634
+ ...z
635
+ }, G) => {
636
+ const b = w(null), ce = Te([G, b]), L = w(null), D = w(80), K = w(-25), I = w(null), X = w(30), F = w(null), E = ve({ id: e, prefix: `${ae}-` }), [de, ie] = J(0), [ne, Z] = J(
637
+ !!(!C && g)
638
+ ), me = `${r} error, ${g}`, T = Je({
639
+ className: o,
640
+ textAreaClassName: c,
641
+ error: a,
642
+ raw: s,
643
+ focusMode: n,
644
+ disabled: y,
645
+ noBorder: p,
646
+ spacing: V,
647
+ mode: d
648
+ }), [f, ue] = Ge({
649
+ value: m,
650
+ defaultValue: h,
651
+ onChange: (u) => {
652
+ A && A({
653
+ target: {
654
+ value: u
655
+ }
656
+ });
657
+ }
658
+ }), he = (u) => {
659
+ ue(u.target.value);
660
+ }, pe = (u) => {
661
+ C && g && Z(!0), $ && $(u);
662
+ }, ge = (u) => {
663
+ C && g && !f && Z(!1), B && B(u);
664
+ };
665
+ return M(() => {
666
+ !s && x && L.current && L.current.offsetWidth > 0 && ie(L.current.offsetWidth + 18 + 10);
667
+ }, [x, s]), M(() => {
668
+ s || b && b.current && f !== void 0 && (b.current.style.height = "inherit", b.current.style.height = b.current.scrollHeight + "px");
669
+ }, [f, s]), M(() => {
670
+ s || setTimeout(() => {
671
+ var u;
672
+ (u = I == null ? void 0 : I.current) == null || u.style.setProperty(
673
+ "--av-text-area-wrapper-transition",
674
+ f ? "none" : "all 0.2s ease-out"
675
+ );
676
+ }, 0);
677
+ }, [f, s]), M(() => {
678
+ var u, ee;
679
+ if (!s && b && b.current && f !== void 0) {
680
+ const { labelOffset: W, helperTextOffset: P, scrollHeight: ye } = Qe({
681
+ scrollHeight: b.current.scrollHeight,
682
+ currentHeight: D.current,
683
+ currentLabelOffset: K.current,
684
+ currentHelperTextOffset: X.current
685
+ });
686
+ W && (K.current = W, (u = I == null ? void 0 : I.current) == null || u.style.setProperty(
687
+ "--av-text-area-label",
688
+ `${W}px`
689
+ )), P && (X.current = P, (ee = F == null ? void 0 : F.current) == null || ee.style.setProperty(
690
+ "--av-text-area-helper-text",
691
+ `${P}px`
692
+ )), D.current = ye || D.current;
693
+ }
694
+ }, [f, s]), /* @__PURE__ */ N("div", { className: T.wrapper, children: [
695
+ /* @__PURE__ */ l(
696
+ "label",
697
+ {
698
+ htmlFor: E,
699
+ id: _,
700
+ className: T.accessibleLabel,
701
+ children: t
702
+ }
703
+ ),
704
+ /* @__PURE__ */ l(
705
+ "textarea",
706
+ {
707
+ ref: ce,
708
+ id: E,
709
+ name: r,
710
+ disabled: y,
711
+ placeholder: s ? void 0 : " ",
712
+ className: T.textArea,
713
+ rows: 1,
714
+ ...g && { "aria-describedby": `${E}-helper` },
715
+ ...a && { "aria-invalid": "true" },
716
+ ...x && !s && { style: { paddingRight: de } },
717
+ value: f,
718
+ onChange: he,
719
+ onFocus: pe,
720
+ onBlur: ge,
721
+ ...z
722
+ }
723
+ ),
724
+ !s && /* @__PURE__ */ l(
725
+ "label",
726
+ {
727
+ ref: I,
728
+ "aria-hidden": !0,
729
+ htmlFor: E,
730
+ className: T.visibleLabel,
731
+ children: t
732
+ }
733
+ ),
734
+ ne && /* @__PURE__ */ l(
735
+ "div",
736
+ {
737
+ ref: F,
738
+ id: `${E}-helper`,
739
+ className: T.helperText,
740
+ children: g
741
+ }
742
+ ),
743
+ x && /* @__PURE__ */ l(
744
+ "div",
745
+ {
746
+ ref: L,
747
+ className: T.rightElement,
748
+ children: x
749
+ }
750
+ ),
751
+ a && g && /* @__PURE__ */ l(Se, { politeness: "polite", clearAnnouncementDelay: 500, children: me })
752
+ ] });
753
+ }
754
+ );
755
+ Ye.displayName = "TextArea";
756
+ const k = {
757
+ GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
758
+ location(latitude: $latitude, longitude: $longitude) {
759
+ country
760
+ state
761
+ city
762
+ displayName
763
+ }
764
+ }`,
765
+ GET_CHATS: `query GetChats($userId: String!) {
766
+ chats(user: $userId) {
767
+ timestamp
768
+ id
769
+ messages {
770
+ content
771
+ }
772
+ }
773
+ }`,
774
+ GET_CHATS_STATS: `query GetChatsStats($userId: String!) {
775
+ chatsStats(user: $userId) {
776
+ totalChats
777
+ averageProcessingTimes
778
+ }
779
+ }`,
780
+ GET_CHAT: `query GetChatById($id: String!) {
781
+ chatById(id: $id) {
782
+ model
783
+ usage
784
+ messages {
785
+ content
786
+ role
787
+ name
788
+ processingTime
789
+ }
790
+ }
791
+ }`,
792
+ DELETE_CHAT: `mutation DeleteChat($id: String!, $userId: String!) {
793
+ deleteChat(id: $id, user: $userId) {
794
+ timestamp
795
+ id
796
+ messages {
797
+ content
798
+ }
799
+ }
800
+ }`,
801
+ ABOUT: `query About {
802
+ about {
803
+ version
804
+ models
805
+ plugins
806
+ }
807
+ }`,
808
+ GET_CUSTOM_INSTRUCTIONS: `query GetCustomInstructions($user: String!) {
809
+ getCustomInstructions(user: $user) {
810
+ instructions
811
+ location
812
+ }
813
+ }`,
814
+ SET_CUSTOM_INSTRUCTIONS: `mutation SetCustomInstructions(
815
+ $user: String!,
816
+ $instructions: String!,
817
+ $location: String) {
818
+ setCustomInstructions(
819
+ user: $user,
820
+ instructions: $instructions,
821
+ location: $location)
822
+ }`
823
+ }, nt = {
824
+ GET_LOCATION: {
825
+ schema: k.GET_LOCATION,
826
+ method: "location",
827
+ data: (e) => ({
828
+ latitude: e.latitude,
829
+ longitude: e.longitude
830
+ })
831
+ },
832
+ GET_CHATS: {
833
+ schema: k.GET_CHATS,
834
+ method: "chats",
835
+ data: (e) => ({
836
+ userId: e.userId
837
+ })
838
+ },
839
+ GET_CHATS_STATS: {
840
+ schema: k.GET_CHATS_STATS,
841
+ method: "chatsStats",
842
+ data: (e) => ({
843
+ userId: e.userId
844
+ })
845
+ },
846
+ GET_CHAT: {
847
+ schema: k.GET_CHAT,
848
+ method: "chatById",
849
+ data: (e) => ({
850
+ id: e.id
851
+ })
852
+ },
853
+ DELETE_CHAT: {
854
+ schema: k.DELETE_CHAT,
855
+ method: "deleteChat",
856
+ data: (e) => ({
857
+ id: e.id,
858
+ userId: e.userId
859
+ })
860
+ },
861
+ ABOUT: {
862
+ schema: k.ABOUT,
863
+ method: "about",
864
+ data: () => ({})
865
+ },
866
+ GET_CUSTOM_INSTRUCTIONS: {
867
+ schema: k.GET_CUSTOM_INSTRUCTIONS,
868
+ method: "getCustomInstructions",
869
+ data: (e) => ({
870
+ user: e.user
871
+ })
872
+ },
873
+ SET_CUSTOM_INSTRUCTIONS: {
874
+ schema: k.SET_CUSTOM_INSTRUCTIONS,
875
+ method: "setCustomInstructions",
876
+ data: (e) => ({
877
+ user: e.user,
878
+ instructions: e.instructions,
879
+ location: e.location
880
+ })
881
+ }
882
+ }, oe = process.env.PUBLIC_SASSY_API_SERVER_URL, Ke = async ({
883
+ query: e,
884
+ data: r,
885
+ headers: t = {}
886
+ }) => await fetch(`${oe}/graphql`, {
887
+ method: "POST",
888
+ credentials: "include",
889
+ headers: {
890
+ ...t,
891
+ "Content-Type": "application/json",
892
+ Accept: "application/json"
893
+ },
894
+ body: JSON.stringify({
895
+ query: e,
896
+ variables: r
897
+ })
898
+ }), mt = async ({
899
+ accessToken: e,
900
+ type: r,
901
+ params: t = {}
902
+ }) => {
903
+ const a = r != null && r.data ? r.data(t) : t;
904
+ try {
905
+ const s = `Bearer ${e}`, o = await Ke({
906
+ headers: {
907
+ authorization: s
908
+ },
909
+ query: r.schema,
910
+ data: a
911
+ });
912
+ if (o.status !== 200)
913
+ return { status: o.status, data: [] };
914
+ const { data: c, errors: d } = await o.json();
915
+ return {
916
+ status: o.status,
917
+ data: c[r.method],
918
+ errors: d
919
+ };
920
+ } catch (s) {
921
+ return console.error(s), { status: 500, data: [] };
922
+ }
923
+ }, ut = async ({
924
+ accessToken: e,
925
+ name: r,
926
+ data: t,
927
+ method: a = "POST"
928
+ }) => {
929
+ const s = `Bearer ${e}`;
930
+ return await fetch(`${oe}/api/${r}`, {
931
+ method: a,
932
+ credentials: "include",
933
+ headers: {
934
+ "Content-Type": "application/json",
935
+ authorization: s
936
+ },
937
+ body: JSON.stringify(t)
938
+ });
939
+ }, ht = H.createContext({
940
+ state: {
941
+ id: "",
942
+ model: He,
943
+ usage: 0,
944
+ messages: [],
945
+ isComponent: !1
946
+ },
947
+ dispatch: () => {
948
+ },
949
+ serverStats: { version: "", models: [], plugins: [] }
950
+ }), pt = H.createContext({
951
+ state: { searchString: "", sortedCell: "", sortDirection: "" },
952
+ dispatch: () => {
953
+ }
954
+ });
955
+ function le(e, r) {
956
+ window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: r }));
957
+ }
958
+ const te = (e, r) => {
959
+ const t = JSON.stringify(
960
+ typeof r == "function" ? r() : r
961
+ );
962
+ window.localStorage.setItem(e, t), le(e, t);
963
+ }, Xe = (e) => {
964
+ window.localStorage.removeItem(e), le(e, null);
965
+ }, re = (e) => window.localStorage.getItem(e), Ze = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
966
+ function gt({
967
+ key: e,
968
+ initialValue: r
969
+ }) {
970
+ const t = fe(Ze, () => re(e)), a = q(
971
+ (c) => {
972
+ try {
973
+ const d = typeof c == "function" ? c(JSON.parse(t)) : c;
974
+ d == null ? Xe(e) : te(e, d);
975
+ } catch (d) {
976
+ console.warn(d);
977
+ }
978
+ },
979
+ [e, t]
980
+ ), s = q(() => {
981
+ a(r);
982
+ }, [r, a]), o = q(() => {
983
+ a(null);
984
+ }, [a]);
985
+ return ke(() => {
986
+ try {
987
+ re(e) === null && typeof r < "u" && te(e, r);
988
+ } catch (c) {
989
+ console.warn(c);
990
+ }
991
+ }, [e, r]), [t ? JSON.parse(t) : null, a, s, o];
992
+ }
993
+ export {
994
+ ht as AppContext,
995
+ gt as E,
996
+ pt as HistoryContext,
997
+ ze as J,
998
+ nt as SERVICE_TYPES,
999
+ ot as at,
1000
+ it as ct,
1001
+ st as et,
1002
+ Q as g,
1003
+ U as k,
1004
+ Ye as kt,
1005
+ dt as lt,
1006
+ ut as restCall,
1007
+ lt as rt,
1008
+ mt as serviceCall,
1009
+ ct as st
1010
+ };