@donkit-ai/design-system 1.4.58 → 1.4.59
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/index.cjs.js +3 -3
- package/dist/index.d.ts +9 -0
- package/dist/index.es.js +167 -156
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import V, { useState as A, useRef as R, useEffect as B, useLayoutEffect as Ze, useContext as Ee, createContext as Qe, useCallback as
|
|
2
|
-
import { Check as
|
|
1
|
+
import V, { useState as A, useRef as R, useEffect as B, useLayoutEffect as Ze, useContext as Ee, createContext as Qe, useCallback as $e } from "react";
|
|
2
|
+
import { Check as Te, X as ee, ChevronDown as ve, Minus as et, Plus as tt, XCircle as Re, AlertTriangle as Se, CheckCircle as Ae, Info as Ie, ChevronUp as st, ChevronsUpDown as nt, ChevronLeft as rt, ChevronRight as at, Copy as ot, Brain as it, Loader as lt, Paperclip as Pe, Square as ct, ArrowUp as dt, Zap as ut, Cpu as Me, FileText as ft, ThumbsUp as mt, ThumbsDown as pt } from "lucide-react";
|
|
3
3
|
import pe from "react-dom";
|
|
4
4
|
const P = {
|
|
5
5
|
1: 16,
|
|
@@ -8,7 +8,7 @@ const P = {
|
|
|
8
8
|
4: 28,
|
|
9
9
|
5: 48
|
|
10
10
|
};
|
|
11
|
-
var
|
|
11
|
+
var ge = { exports: {} }, he = {};
|
|
12
12
|
/**
|
|
13
13
|
* @license React
|
|
14
14
|
* react-jsx-runtime.production.js
|
|
@@ -18,10 +18,10 @@ var we = { exports: {} }, he = {};
|
|
|
18
18
|
* This source code is licensed under the MIT license found in the
|
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
|
20
20
|
*/
|
|
21
|
-
var
|
|
21
|
+
var ze;
|
|
22
22
|
function ht() {
|
|
23
|
-
if (
|
|
24
|
-
|
|
23
|
+
if (ze) return he;
|
|
24
|
+
ze = 1;
|
|
25
25
|
var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
26
26
|
function n(a, o, r) {
|
|
27
27
|
var i = null;
|
|
@@ -50,16 +50,16 @@ var xe = {};
|
|
|
50
50
|
* This source code is licensed under the MIT license found in the
|
|
51
51
|
* LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
|
-
var
|
|
53
|
+
var Oe;
|
|
54
54
|
function xt() {
|
|
55
|
-
return
|
|
55
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
56
|
function t(f) {
|
|
57
57
|
if (f == null) return null;
|
|
58
58
|
if (typeof f == "function")
|
|
59
59
|
return f.$$typeof === O ? null : f.displayName || f.name || null;
|
|
60
60
|
if (typeof f == "string") return f;
|
|
61
61
|
switch (f) {
|
|
62
|
-
case
|
|
62
|
+
case g:
|
|
63
63
|
return "Fragment";
|
|
64
64
|
case k:
|
|
65
65
|
return "Profiler";
|
|
@@ -69,7 +69,7 @@ function xt() {
|
|
|
69
69
|
return "Suspense";
|
|
70
70
|
case H:
|
|
71
71
|
return "SuspenseList";
|
|
72
|
-
case
|
|
72
|
+
case w:
|
|
73
73
|
return "Activity";
|
|
74
74
|
}
|
|
75
75
|
if (typeof f == "object")
|
|
@@ -117,7 +117,7 @@ function xt() {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
function a(f) {
|
|
120
|
-
if (f ===
|
|
120
|
+
if (f === g) return "<>";
|
|
121
121
|
if (typeof f == "object" && f !== null && f.$$typeof === W)
|
|
122
122
|
return "<...>";
|
|
123
123
|
try {
|
|
@@ -246,7 +246,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
246
|
function h(f) {
|
|
247
247
|
return typeof f == "object" && f !== null && f.$$typeof === v;
|
|
248
248
|
}
|
|
249
|
-
var c = V, v = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"),
|
|
249
|
+
var c = V, v = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), k = Symbol.for("react.profiler"), j = Symbol.for("react.consumer"), S = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), H = Symbol.for("react.suspense_list"), q = Symbol.for("react.memo"), W = Symbol.for("react.lazy"), w = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), K = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, x = Array.isArray, b = console.createTask ? console.createTask : function() {
|
|
250
250
|
return null;
|
|
251
251
|
};
|
|
252
252
|
c = {
|
|
@@ -258,7 +258,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
258
258
|
c,
|
|
259
259
|
r
|
|
260
260
|
)(), G = b(a(r)), T = {};
|
|
261
|
-
xe.Fragment =
|
|
261
|
+
xe.Fragment = g, xe.jsx = function(f, $, z) {
|
|
262
262
|
var F = 1e4 > K.recentlyCreatedOwnerStacks++;
|
|
263
263
|
return m(
|
|
264
264
|
f,
|
|
@@ -281,8 +281,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
281
281
|
};
|
|
282
282
|
}()), xe;
|
|
283
283
|
}
|
|
284
|
-
process.env.NODE_ENV === "production" ?
|
|
285
|
-
var e =
|
|
284
|
+
process.env.NODE_ENV === "production" ? ge.exports = ht() : ge.exports = xt();
|
|
285
|
+
var e = ge.exports;
|
|
286
286
|
function vt({ size: t = "m", color: s = "default", className: n = "", ...a }) {
|
|
287
287
|
return /* @__PURE__ */ e.jsx(
|
|
288
288
|
"span",
|
|
@@ -310,7 +310,7 @@ function ae({
|
|
|
310
310
|
className: p = "",
|
|
311
311
|
...h
|
|
312
312
|
}) {
|
|
313
|
-
const c = o && !t, v = i === "loading", _ = i === "success",
|
|
313
|
+
const c = o && !t, v = i === "loading", _ = i === "success", g = i === "error", y = v || _ || g, k = n === "xs" ? "s" : "m", j = s === "danger" ? "on-accent" : "default", S = _t[n] ?? 16, M = v ? /* @__PURE__ */ e.jsx(vt, { size: k, color: j }) : _ ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(Te, { size: S, strokeWidth: 2.5 }) }) : g ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(ee, { size: S, strokeWidth: 2.5 }) }) : null, D = [
|
|
314
314
|
"ds-button",
|
|
315
315
|
`ds-button--${s}`,
|
|
316
316
|
`ds-button--${n}`,
|
|
@@ -322,12 +322,12 @@ function ae({
|
|
|
322
322
|
t
|
|
323
323
|
] });
|
|
324
324
|
if (d) {
|
|
325
|
-
const W = (
|
|
325
|
+
const W = (w) => {
|
|
326
326
|
if (r || v) {
|
|
327
|
-
|
|
327
|
+
w.preventDefault();
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
w.metaKey || w.ctrlKey || w.button === 1 || (w.preventDefault(), l == null || l(w));
|
|
331
331
|
};
|
|
332
332
|
return /* @__PURE__ */ e.jsx(
|
|
333
333
|
"a",
|
|
@@ -448,7 +448,7 @@ function ls({
|
|
|
448
448
|
id: d,
|
|
449
449
|
...m
|
|
450
450
|
}) {
|
|
451
|
-
const [p, h] = A(!1), [c, v] = A(!1), [_,
|
|
451
|
+
const [p, h] = A(!1), [c, v] = A(!1), [_, g] = A({}), [y, k] = A("down"), [j, S] = A(-1), M = R(null), D = R(null), H = R(null), q = R(null), W = d || `select-${V.useId()}`, w = `${W}-label`, O = r ? `${W}-error` : void 0, K = 150, C = (T = !1) => {
|
|
452
452
|
c || (v(!0), S(-1), q.current = setTimeout(() => {
|
|
453
453
|
var f;
|
|
454
454
|
h(!1), v(!1), T && ((f = H.current) == null || f.focus());
|
|
@@ -464,7 +464,7 @@ function ls({
|
|
|
464
464
|
const T = (oe = M.current) == null ? void 0 : oe.getBoundingClientRect();
|
|
465
465
|
if (!T) return;
|
|
466
466
|
const f = window.innerHeight, $ = f - T.bottom, z = T.top, ne = $ < 300 && z > $;
|
|
467
|
-
k(ne ? "up" : "down"),
|
|
467
|
+
k(ne ? "up" : "down"), g(
|
|
468
468
|
ne ? { bottom: f - T.top + 4, left: T.left, width: T.width } : { top: T.bottom + 4, left: T.left, width: T.width }
|
|
469
469
|
);
|
|
470
470
|
};
|
|
@@ -514,7 +514,7 @@ function ls({
|
|
|
514
514
|
ref: D,
|
|
515
515
|
"data-ds-portal": "",
|
|
516
516
|
role: "listbox",
|
|
517
|
-
"aria-labelledby": t ?
|
|
517
|
+
"aria-labelledby": t ? w : void 0,
|
|
518
518
|
tabIndex: -1,
|
|
519
519
|
className: [
|
|
520
520
|
"ds-select-dropdown ds-scrollable",
|
|
@@ -547,7 +547,7 @@ function ls({
|
|
|
547
547
|
}
|
|
548
548
|
);
|
|
549
549
|
return /* @__PURE__ */ e.jsxs("div", { className: `ds-select-wrapper ${i ? "ds-select-wrapper--full" : ""} ${u ? "ds-select-wrapper--disabled" : ""}`, children: [
|
|
550
|
-
t && /* @__PURE__ */ e.jsx("label", { id:
|
|
550
|
+
t && /* @__PURE__ */ e.jsx("label", { id: w, className: "ds-select-label", children: t }),
|
|
551
551
|
/* @__PURE__ */ e.jsx("div", { className: "ds-select-container", ref: M, children: /* @__PURE__ */ e.jsxs(
|
|
552
552
|
"button",
|
|
553
553
|
{
|
|
@@ -558,7 +558,7 @@ function ls({
|
|
|
558
558
|
"aria-haspopup": "listbox",
|
|
559
559
|
"aria-expanded": p,
|
|
560
560
|
"aria-activedescendant": p && j >= 0 ? `${W}-opt-${j}` : void 0,
|
|
561
|
-
"aria-labelledby": t ?
|
|
561
|
+
"aria-labelledby": t ? w : void 0,
|
|
562
562
|
"aria-invalid": r ? "true" : "false",
|
|
563
563
|
"aria-describedby": O,
|
|
564
564
|
className: `ds-select-trigger ds-select-trigger--${l} ${r ? "ds-select-trigger--error" : ""}`,
|
|
@@ -627,7 +627,7 @@ function cs({
|
|
|
627
627
|
"ds-stepper",
|
|
628
628
|
`ds-stepper--${i}`,
|
|
629
629
|
l && "ds-stepper--disabled"
|
|
630
|
-
].filter(Boolean).join(" "),
|
|
630
|
+
].filter(Boolean).join(" "), g = i === "xs" ? P[1] : i === "small" ? P[2] : P[3];
|
|
631
631
|
return /* @__PURE__ */ e.jsxs("div", { className: v, children: [
|
|
632
632
|
t && /* @__PURE__ */ e.jsx("label", { className: "ds-stepper-label", children: t }),
|
|
633
633
|
/* @__PURE__ */ e.jsxs("div", { className: _, children: [
|
|
@@ -639,7 +639,7 @@ function cs({
|
|
|
639
639
|
onClick: h,
|
|
640
640
|
disabled: l || s <= a,
|
|
641
641
|
"aria-label": "Decrease",
|
|
642
|
-
children: /* @__PURE__ */ e.jsx(et, { size:
|
|
642
|
+
children: /* @__PURE__ */ e.jsx(et, { size: g, strokeWidth: 1.5 })
|
|
643
643
|
}
|
|
644
644
|
),
|
|
645
645
|
/* @__PURE__ */ e.jsx(
|
|
@@ -664,7 +664,7 @@ function cs({
|
|
|
664
664
|
onClick: p,
|
|
665
665
|
disabled: l || s >= o,
|
|
666
666
|
"aria-label": "Increase",
|
|
667
|
-
children: /* @__PURE__ */ e.jsx(tt, { size:
|
|
667
|
+
children: /* @__PURE__ */ e.jsx(tt, { size: g, strokeWidth: 1.5 })
|
|
668
668
|
}
|
|
669
669
|
)
|
|
670
670
|
] }),
|
|
@@ -760,39 +760,37 @@ function de({
|
|
|
760
760
|
return /* @__PURE__ */ e.jsx("span", { className: r, role: i, ...o, children: t });
|
|
761
761
|
}
|
|
762
762
|
const jt = {
|
|
763
|
-
info:
|
|
764
|
-
success:
|
|
765
|
-
warning:
|
|
766
|
-
error:
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
i && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__icon", children: /* @__PURE__ */ e.jsx(i, { size: P[3], strokeWidth: 1.5 }) }),
|
|
763
|
+
info: Ie,
|
|
764
|
+
success: Ae,
|
|
765
|
+
warning: Se,
|
|
766
|
+
error: Re
|
|
767
|
+
}, xs = V.forwardRef(function({
|
|
768
|
+
children: s,
|
|
769
|
+
variant: n = "info",
|
|
770
|
+
title: a,
|
|
771
|
+
onClose: o,
|
|
772
|
+
role: r,
|
|
773
|
+
...i
|
|
774
|
+
}, l) {
|
|
775
|
+
const u = jt[n], d = r || (n === "error" ? "alert" : "status");
|
|
776
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: l, className: `ds-alert ds-alert--${n} ${a ? "" : "ds-alert--no-title"}`, role: d, ...i, children: [
|
|
777
|
+
u && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__icon", children: /* @__PURE__ */ e.jsx(u, { size: P[3], strokeWidth: 1.5 }) }),
|
|
779
778
|
/* @__PURE__ */ e.jsxs("div", { className: "ds-alert__content", children: [
|
|
780
|
-
|
|
781
|
-
|
|
779
|
+
a && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__title", children: a }),
|
|
780
|
+
s && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__message", children: s })
|
|
782
781
|
] }),
|
|
783
|
-
|
|
782
|
+
o && /* @__PURE__ */ e.jsx(
|
|
784
783
|
"button",
|
|
785
784
|
{
|
|
786
785
|
type: "button",
|
|
787
786
|
className: "ds-alert__close",
|
|
788
|
-
onClick:
|
|
787
|
+
onClick: o,
|
|
789
788
|
"aria-label": "Close alert",
|
|
790
789
|
children: /* @__PURE__ */ e.jsx(ee, { size: P[3], strokeWidth: 1.5 })
|
|
791
790
|
}
|
|
792
791
|
)
|
|
793
792
|
] });
|
|
794
|
-
}
|
|
795
|
-
const Nt = 200;
|
|
793
|
+
}), Nt = 200;
|
|
796
794
|
function vs({
|
|
797
795
|
children: t,
|
|
798
796
|
title: s,
|
|
@@ -810,13 +808,13 @@ function vs({
|
|
|
810
808
|
B(() => {
|
|
811
809
|
const _ = (y) => {
|
|
812
810
|
y.key === "Escape" && p();
|
|
813
|
-
},
|
|
811
|
+
}, g = (y) => {
|
|
814
812
|
var j, S, M;
|
|
815
813
|
const k = ((S = (j = y.composedPath) == null ? void 0 : j.call(y)) == null ? void 0 : S[0]) ?? y.target;
|
|
816
814
|
l.current && !l.current.contains(k) && !((M = k.closest) != null && M.call(k, "[data-ds-portal]")) && p();
|
|
817
815
|
};
|
|
818
|
-
return document.addEventListener("keydown", _), document.addEventListener("mousedown",
|
|
819
|
-
document.removeEventListener("keydown", _), document.removeEventListener("mousedown",
|
|
816
|
+
return document.addEventListener("keydown", _), document.addEventListener("mousedown", g), () => {
|
|
817
|
+
document.removeEventListener("keydown", _), document.removeEventListener("mousedown", g);
|
|
820
818
|
};
|
|
821
819
|
}, [n, d]);
|
|
822
820
|
const h = V.Children.toArray(t), c = h.find((_) => (_ == null ? void 0 : _.type) === fe), v = h.filter((_) => (_ == null ? void 0 : _.type) !== fe);
|
|
@@ -853,7 +851,7 @@ function vs({
|
|
|
853
851
|
function fe({ children: t }) {
|
|
854
852
|
return !t || V.Children.count(t) === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: "ds-modal__footer", children: t });
|
|
855
853
|
}
|
|
856
|
-
const
|
|
854
|
+
const wt = 320;
|
|
857
855
|
function _s({
|
|
858
856
|
children: t,
|
|
859
857
|
title: s,
|
|
@@ -864,15 +862,15 @@ function _s({
|
|
|
864
862
|
const r = R(null), i = V.useId(), [l, u] = A(!1), d = () => {
|
|
865
863
|
!n || l || (u(!0), setTimeout(() => {
|
|
866
864
|
u(!1), n();
|
|
867
|
-
},
|
|
865
|
+
}, wt));
|
|
868
866
|
};
|
|
869
867
|
B(() => {
|
|
870
868
|
const c = (_) => {
|
|
871
869
|
_.key === "Escape" && d();
|
|
872
870
|
}, v = (_) => {
|
|
873
871
|
var y, k, j;
|
|
874
|
-
const
|
|
875
|
-
r.current && !r.current.contains(
|
|
872
|
+
const g = ((k = (y = _.composedPath) == null ? void 0 : y.call(_)) == null ? void 0 : k[0]) ?? _.target;
|
|
873
|
+
r.current && !r.current.contains(g) && !((j = g.closest) != null && j.call(g, "[data-ds-portal]")) && d();
|
|
876
874
|
};
|
|
877
875
|
return document.addEventListener("keydown", c), document.addEventListener("mousedown", v), () => {
|
|
878
876
|
document.removeEventListener("keydown", c), document.removeEventListener("mousedown", v);
|
|
@@ -917,7 +915,7 @@ function _s({
|
|
|
917
915
|
}
|
|
918
916
|
);
|
|
919
917
|
}
|
|
920
|
-
function
|
|
918
|
+
function gt({
|
|
921
919
|
children: t,
|
|
922
920
|
title: s = "Code",
|
|
923
921
|
defaultExpanded: n = !1,
|
|
@@ -960,7 +958,7 @@ function wt({
|
|
|
960
958
|
] });
|
|
961
959
|
}
|
|
962
960
|
function bs({ children: t, block: s = !1, collapsible: n = !1, title: a = "Code", defaultExpanded: o = !1, ...r }) {
|
|
963
|
-
return s ? n ? /* @__PURE__ */ e.jsx(
|
|
961
|
+
return s ? n ? /* @__PURE__ */ e.jsx(gt, { title: a, defaultExpanded: o, ...r, children: t }) : /* @__PURE__ */ e.jsx("pre", { className: "ds-code-block ds-scrollable", ...r, children: /* @__PURE__ */ e.jsx("code", { children: t }) }) : /* @__PURE__ */ e.jsx("code", { className: "ds-code-inline", ...r, children: t });
|
|
964
962
|
}
|
|
965
963
|
function js({ href: t, children: s, onClick: n, target: a, rel: o, ...r }) {
|
|
966
964
|
const l = a === "_blank" ? o ? `${o} noopener noreferrer` : "noopener noreferrer" : o;
|
|
@@ -980,7 +978,7 @@ function js({ href: t, children: s, onClick: n, target: a, rel: o, ...r }) {
|
|
|
980
978
|
function Ns({ children: t, size: s = "m", variant: n = "ghost", ...a }) {
|
|
981
979
|
return /* @__PURE__ */ e.jsx("div", { className: "ds-tabs", role: "tablist", ...a, children: V.Children.map(t, (o) => V.isValidElement(o) ? V.cloneElement(o, { size: s, variant: n }) : o) });
|
|
982
980
|
}
|
|
983
|
-
function
|
|
981
|
+
function ws({ children: t, selected: s = !1, onClick: n, size: a = "m", variant: o = "ghost", disabled: r = !1, icon: i, href: l, ...u }) {
|
|
984
982
|
const d = i && !t, m = [
|
|
985
983
|
"ds-tab",
|
|
986
984
|
`ds-tab--${a}`,
|
|
@@ -1026,13 +1024,13 @@ function gs({ children: t, selected: s = !1, onClick: n, size: a = "m", variant:
|
|
|
1026
1024
|
}
|
|
1027
1025
|
);
|
|
1028
1026
|
}
|
|
1029
|
-
function
|
|
1027
|
+
function gs({ options: t, value: s, onChange: n, size: a = "m", disabled: o = !1 }) {
|
|
1030
1028
|
const r = R(null), i = R(null), [l, u] = A(!1), d = R(!1), m = R(null), p = R(null), h = () => {
|
|
1031
1029
|
if (!r.current) return;
|
|
1032
1030
|
const c = r.current.querySelector(`[data-value="${s}"]`);
|
|
1033
1031
|
if (!c) return;
|
|
1034
|
-
const v = r.current.getBoundingClientRect(), _ = c.getBoundingClientRect(),
|
|
1035
|
-
i.current ? (i.current.style.transition = d.current ? "left var(--transition-normal), width var(--transition-normal)" : "none", i.current.style.left =
|
|
1032
|
+
const v = r.current.getBoundingClientRect(), _ = c.getBoundingClientRect(), g = _.left - v.left, y = _.width;
|
|
1033
|
+
i.current ? (i.current.style.transition = d.current ? "left var(--transition-normal), width var(--transition-normal)" : "none", i.current.style.left = g + "px", i.current.style.width = y + "px", d.current = !1) : (u(!0), requestAnimationFrame(() => {
|
|
1036
1034
|
if (!i.current || !r.current) return;
|
|
1037
1035
|
const k = r.current.querySelector(`[data-value="${s}"]`);
|
|
1038
1036
|
if (!k) return;
|
|
@@ -1088,7 +1086,7 @@ function ws({ options: t, value: s, onChange: n, size: a = "m", disabled: o = !1
|
|
|
1088
1086
|
}
|
|
1089
1087
|
);
|
|
1090
1088
|
}
|
|
1091
|
-
function
|
|
1089
|
+
function Be({
|
|
1092
1090
|
children: t,
|
|
1093
1091
|
title: s,
|
|
1094
1092
|
defaultExpanded: n = !1,
|
|
@@ -1163,7 +1161,7 @@ function kt(t, s, n) {
|
|
|
1163
1161
|
function Ke({ children: t, content: s, position: n, ...a }) {
|
|
1164
1162
|
const [o, r] = A(!1), [i, l] = A({ visibility: "hidden" }), [u, d] = A(n || "top"), m = R(null), p = R(null), h = R(!1), c = () => {
|
|
1165
1163
|
if (!m.current || !p.current) return;
|
|
1166
|
-
const _ = m.current.getBoundingClientRect(),
|
|
1164
|
+
const _ = m.current.getBoundingClientRect(), g = p.current.getBoundingClientRect(), y = n || kt(_, g.height, g.width), { top: k, left: j, arrowOffset: S } = yt(y, _, g);
|
|
1167
1165
|
d(y), l({
|
|
1168
1166
|
position: "fixed",
|
|
1169
1167
|
top: k,
|
|
@@ -1181,8 +1179,8 @@ function Ke({ children: t, content: s, position: n, ...a }) {
|
|
|
1181
1179
|
};
|
|
1182
1180
|
}, [o, n]), B(() => {
|
|
1183
1181
|
if (!o) return;
|
|
1184
|
-
const _ = (
|
|
1185
|
-
m.current && !m.current.contains(
|
|
1182
|
+
const _ = (g) => {
|
|
1183
|
+
m.current && !m.current.contains(g.target) && r(!1);
|
|
1186
1184
|
};
|
|
1187
1185
|
return document.addEventListener("touchstart", _), () => document.removeEventListener("touchstart", _);
|
|
1188
1186
|
}, [o]), !s) return t;
|
|
@@ -1278,7 +1276,7 @@ function ks({
|
|
|
1278
1276
|
}
|
|
1279
1277
|
),
|
|
1280
1278
|
/* @__PURE__ */ e.jsx("span", { className: "ds-checkbox__box", children: t && /* @__PURE__ */ e.jsx(
|
|
1281
|
-
|
|
1279
|
+
Te,
|
|
1282
1280
|
{
|
|
1283
1281
|
size: d,
|
|
1284
1282
|
strokeWidth: 2.5,
|
|
@@ -1655,14 +1653,14 @@ function Cs({
|
|
|
1655
1653
|
_.key === "Escape" && d();
|
|
1656
1654
|
}, v = (_) => {
|
|
1657
1655
|
var y, k, j;
|
|
1658
|
-
const
|
|
1659
|
-
r.current && !r.current.contains(
|
|
1656
|
+
const g = ((k = (y = _.composedPath) == null ? void 0 : y.call(_)) == null ? void 0 : k[0]) ?? _.target;
|
|
1657
|
+
r.current && !r.current.contains(g) && !((j = g.closest) != null && j.call(g, "[data-ds-portal]")) && d();
|
|
1660
1658
|
};
|
|
1661
1659
|
return document.addEventListener("keydown", c), document.addEventListener("mousedown", v), () => {
|
|
1662
1660
|
document.removeEventListener("keydown", c), document.removeEventListener("mousedown", v);
|
|
1663
1661
|
};
|
|
1664
1662
|
}, [n, l]);
|
|
1665
|
-
const m = V.Children.toArray(t), p = m.find((c) => (c == null ? void 0 : c.type) ===
|
|
1663
|
+
const m = V.Children.toArray(t), p = m.find((c) => (c == null ? void 0 : c.type) === Ce), h = m.filter((c) => (c == null ? void 0 : c.type) !== Ce);
|
|
1666
1664
|
return /* @__PURE__ */ e.jsx(
|
|
1667
1665
|
"div",
|
|
1668
1666
|
{
|
|
@@ -1690,7 +1688,7 @@ function Cs({
|
|
|
1690
1688
|
}
|
|
1691
1689
|
);
|
|
1692
1690
|
}
|
|
1693
|
-
function
|
|
1691
|
+
function Ce({ children: t }) {
|
|
1694
1692
|
return /* @__PURE__ */ e.jsx("footer", { className: "ds-drawer-footer", children: t });
|
|
1695
1693
|
}
|
|
1696
1694
|
const It = 320;
|
|
@@ -1711,14 +1709,14 @@ function Fs({
|
|
|
1711
1709
|
_.key === "Escape" && d();
|
|
1712
1710
|
}, v = (_) => {
|
|
1713
1711
|
var y, k, j;
|
|
1714
|
-
const
|
|
1715
|
-
r.current && !r.current.contains(
|
|
1712
|
+
const g = ((k = (y = _.composedPath) == null ? void 0 : y.call(_)) == null ? void 0 : k[0]) ?? _.target;
|
|
1713
|
+
r.current && !r.current.contains(g) && !((j = g.closest) != null && j.call(g, "[data-ds-portal]")) && d();
|
|
1716
1714
|
};
|
|
1717
1715
|
return document.addEventListener("keydown", c), document.addEventListener("mousedown", v), () => {
|
|
1718
1716
|
document.removeEventListener("keydown", c), document.removeEventListener("mousedown", v);
|
|
1719
1717
|
};
|
|
1720
1718
|
}, [n, l]);
|
|
1721
|
-
const m = V.Children.toArray(t), p = m.find((c) => (c == null ? void 0 : c.type) ===
|
|
1719
|
+
const m = V.Children.toArray(t), p = m.find((c) => (c == null ? void 0 : c.type) === Fe || (c == null ? void 0 : c.type) === fe), h = m.filter((c) => (c == null ? void 0 : c.type) !== Fe && (c == null ? void 0 : c.type) !== fe);
|
|
1722
1720
|
return /* @__PURE__ */ e.jsx(
|
|
1723
1721
|
"div",
|
|
1724
1722
|
{
|
|
@@ -1756,7 +1754,7 @@ function Fs({
|
|
|
1756
1754
|
}
|
|
1757
1755
|
);
|
|
1758
1756
|
}
|
|
1759
|
-
function
|
|
1757
|
+
function Fe({ children: t }) {
|
|
1760
1758
|
return !t || V.Children.count(t) === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: "ds-side-page__footer", children: t });
|
|
1761
1759
|
}
|
|
1762
1760
|
const be = Qe({ collapsed: !1, side: "left" });
|
|
@@ -1789,7 +1787,7 @@ function Us({
|
|
|
1789
1787
|
className: m = "",
|
|
1790
1788
|
...p
|
|
1791
1789
|
}) {
|
|
1792
|
-
const { collapsed: h, side: c } = Ee(be),
|
|
1790
|
+
const { collapsed: h, side: c } = Ee(be), g = {
|
|
1793
1791
|
className: [
|
|
1794
1792
|
"ds-nav-rail__item",
|
|
1795
1793
|
m
|
|
@@ -1812,7 +1810,7 @@ function Us({
|
|
|
1812
1810
|
!h && l && /* @__PURE__ */ e.jsx(de, { size: "xs", variant: "accent", className: "ds-nav-rail__badge-expanded", children: "New" }),
|
|
1813
1811
|
!h && y && /* @__PURE__ */ e.jsx("span", { className: ["ds-nav-rail__count", i === 0 && "ds-nav-rail__count--zero"].filter(Boolean).join(" "), children: i }),
|
|
1814
1812
|
h && l && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__dot", "aria-hidden": "true" })
|
|
1815
|
-
] }), S = o ? /* @__PURE__ */ e.jsx("a", { href: a ? void 0 : o, ...
|
|
1813
|
+
] }), S = o ? /* @__PURE__ */ e.jsx("a", { href: a ? void 0 : o, ...g, children: j }) : /* @__PURE__ */ e.jsx("button", { type: "button", ...g, children: j });
|
|
1816
1814
|
return h ? /* @__PURE__ */ e.jsx(Ke, { content: s, position: k, children: S }) : S;
|
|
1817
1815
|
}
|
|
1818
1816
|
function Vs({ children: t, className: s = "", ...n }) {
|
|
@@ -1869,10 +1867,10 @@ function Gs({ avatar: t, label: s, selected: n = !1, disabled: a = !1, href: o,
|
|
|
1869
1867
|
return u ? /* @__PURE__ */ e.jsx(Ke, { content: s, position: v, children: _ }) : _;
|
|
1870
1868
|
}
|
|
1871
1869
|
const Bt = {
|
|
1872
|
-
info:
|
|
1873
|
-
success:
|
|
1874
|
-
warning:
|
|
1875
|
-
error:
|
|
1870
|
+
info: Ie,
|
|
1871
|
+
success: Ae,
|
|
1872
|
+
warning: Se,
|
|
1873
|
+
error: Re
|
|
1876
1874
|
};
|
|
1877
1875
|
function Xs({
|
|
1878
1876
|
children: t,
|
|
@@ -1926,7 +1924,7 @@ function Js({
|
|
|
1926
1924
|
style: i,
|
|
1927
1925
|
...l
|
|
1928
1926
|
}) {
|
|
1929
|
-
const [u, d] = A(!1), [m, p] = A(!1), h = n !== void 0, c = h ? n : u, v = R(null), _ = R(null),
|
|
1927
|
+
const [u, d] = A(!1), [m, p] = A(!1), h = n !== void 0, c = h ? n : u, v = R(null), _ = R(null), g = R(null), y = R(null), [k, j] = A({}), S = R(null), M = 150, D = () => {
|
|
1930
1928
|
if (h)
|
|
1931
1929
|
a == null || a(!1);
|
|
1932
1930
|
else {
|
|
@@ -1958,7 +1956,7 @@ function Js({
|
|
|
1958
1956
|
}, [c, o]);
|
|
1959
1957
|
const W = () => {
|
|
1960
1958
|
var b;
|
|
1961
|
-
const x = (b =
|
|
1959
|
+
const x = (b = g.current) == null ? void 0 : b.querySelector(
|
|
1962
1960
|
'button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea'
|
|
1963
1961
|
);
|
|
1964
1962
|
x == null || x.focus();
|
|
@@ -1976,25 +1974,25 @@ function Js({
|
|
|
1976
1974
|
};
|
|
1977
1975
|
}, [c]), B(() => {
|
|
1978
1976
|
if (!c || !y.current || !_.current) return;
|
|
1979
|
-
const x =
|
|
1977
|
+
const x = w(), b = y.current === "last" ? x[x.length - 1] : x[0];
|
|
1980
1978
|
b == null || b.focus(), y.current = null;
|
|
1981
1979
|
}, [c]);
|
|
1982
|
-
const
|
|
1980
|
+
const w = () => _.current ? [..._.current.querySelectorAll(
|
|
1983
1981
|
'button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])'
|
|
1984
1982
|
)] : [], O = (x) => {
|
|
1985
1983
|
var b, E;
|
|
1986
1984
|
if (x.key === "ArrowDown")
|
|
1987
|
-
x.preventDefault(), c ? (b =
|
|
1985
|
+
x.preventDefault(), c ? (b = w()[0]) == null || b.focus() : (y.current = "first", q());
|
|
1988
1986
|
else if (x.key === "ArrowUp")
|
|
1989
1987
|
if (x.preventDefault(), !c)
|
|
1990
1988
|
y.current = "last", q();
|
|
1991
1989
|
else {
|
|
1992
|
-
const L =
|
|
1990
|
+
const L = w();
|
|
1993
1991
|
(E = L[L.length - 1]) == null || E.focus();
|
|
1994
1992
|
}
|
|
1995
1993
|
}, K = (x) => {
|
|
1996
1994
|
var L, U, G, T;
|
|
1997
|
-
const b =
|
|
1995
|
+
const b = w(), E = b.findIndex((f) => f === document.activeElement);
|
|
1998
1996
|
switch (x.key) {
|
|
1999
1997
|
case "ArrowDown":
|
|
2000
1998
|
x.preventDefault(), (L = b[Math.min(E + 1, b.length - 1)]) == null || L.focus();
|
|
@@ -2069,7 +2067,7 @@ function Js({
|
|
|
2069
2067
|
/* @__PURE__ */ e.jsx(
|
|
2070
2068
|
"div",
|
|
2071
2069
|
{
|
|
2072
|
-
ref:
|
|
2070
|
+
ref: g,
|
|
2073
2071
|
className: "ds-dropdown__trigger",
|
|
2074
2072
|
onClick: H,
|
|
2075
2073
|
onKeyDown: O,
|
|
@@ -2176,11 +2174,11 @@ function en({
|
|
|
2176
2174
|
d && !m.current && (r == null || r()), !d && m.current && (i == null || i()), m.current = d;
|
|
2177
2175
|
}, [d]), /* @__PURE__ */ e.jsx(s, { ref: u, ...l, children: typeof t == "function" ? t(d) : t });
|
|
2178
2176
|
}
|
|
2179
|
-
const
|
|
2180
|
-
default:
|
|
2181
|
-
success:
|
|
2182
|
-
warning:
|
|
2183
|
-
error:
|
|
2177
|
+
const We = {
|
|
2178
|
+
default: Ie,
|
|
2179
|
+
success: Ae,
|
|
2180
|
+
warning: Se,
|
|
2181
|
+
error: Re
|
|
2184
2182
|
};
|
|
2185
2183
|
let me = [];
|
|
2186
2184
|
const ye = /* @__PURE__ */ new Set();
|
|
@@ -2211,7 +2209,7 @@ function Ct({ data: t, onDismiss: s }) {
|
|
|
2211
2209
|
function r() {
|
|
2212
2210
|
a(!1), setTimeout(() => s(t.id), 250);
|
|
2213
2211
|
}
|
|
2214
|
-
const i =
|
|
2212
|
+
const i = We[t.type] ?? We.default;
|
|
2215
2213
|
return /* @__PURE__ */ e.jsxs(
|
|
2216
2214
|
"div",
|
|
2217
2215
|
{
|
|
@@ -2274,7 +2272,7 @@ function nn({
|
|
|
2274
2272
|
className: ["ds-tool-card", m && "ds-tool-card--running", u].filter(Boolean).join(" "),
|
|
2275
2273
|
...d,
|
|
2276
2274
|
children: /* @__PURE__ */ e.jsx(
|
|
2277
|
-
|
|
2275
|
+
Be,
|
|
2278
2276
|
{
|
|
2279
2277
|
title: p,
|
|
2280
2278
|
padding: "s",
|
|
@@ -2324,7 +2322,7 @@ function rn({ content: t, streaming: s = !1, ...n }) {
|
|
|
2324
2322
|
return B(() => {
|
|
2325
2323
|
o(!!s);
|
|
2326
2324
|
}, [s]), /* @__PURE__ */ e.jsx(
|
|
2327
|
-
|
|
2325
|
+
Be,
|
|
2328
2326
|
{
|
|
2329
2327
|
expanded: a,
|
|
2330
2328
|
onToggle: o,
|
|
@@ -2368,7 +2366,7 @@ function an({
|
|
|
2368
2366
|
"aria-label": `Step ${d + 1}`,
|
|
2369
2367
|
disabled: !h || d === s,
|
|
2370
2368
|
onClick: () => a == null ? void 0 : a(d),
|
|
2371
|
-
children: p ? /* @__PURE__ */ e.jsx(
|
|
2369
|
+
children: p ? /* @__PURE__ */ e.jsx(Te, { size: 8, strokeWidth: 3 }) : null
|
|
2372
2370
|
},
|
|
2373
2371
|
d
|
|
2374
2372
|
);
|
|
@@ -2468,11 +2466,11 @@ function Ut({
|
|
|
2468
2466
|
v.current && clearTimeout(v.current);
|
|
2469
2467
|
};
|
|
2470
2468
|
}, [s, t, n, a, o, r]);
|
|
2471
|
-
const
|
|
2469
|
+
const g = (S) => {
|
|
2472
2470
|
if (t.length === 0) return;
|
|
2473
2471
|
const M = (S % t.length + t.length) % t.length, D = t[M];
|
|
2474
2472
|
c.current = M, h.current = D.length, p.current = "holding", _.current = Date.now() + i, u(M), m(D);
|
|
2475
|
-
}, y = () =>
|
|
2473
|
+
}, y = () => g(c.current + 1), k = () => g(c.current - 1), j = t[l % t.length] ?? "";
|
|
2476
2474
|
return { displayed: d, currentPrompt: j, index: l, next: y, prev: k };
|
|
2477
2475
|
}
|
|
2478
2476
|
let Vt = 0;
|
|
@@ -2493,7 +2491,7 @@ function dn({
|
|
|
2493
2491
|
onRemoveAttachment: c,
|
|
2494
2492
|
onRemoveImage: v,
|
|
2495
2493
|
acceptImage: _,
|
|
2496
|
-
acceptFile:
|
|
2494
|
+
acceptFile: g,
|
|
2497
2495
|
maxImages: y,
|
|
2498
2496
|
maxImageSize: k,
|
|
2499
2497
|
leftSlot: j,
|
|
@@ -2501,10 +2499,10 @@ function dn({
|
|
|
2501
2499
|
className: M = "",
|
|
2502
2500
|
...D
|
|
2503
2501
|
}) {
|
|
2504
|
-
const H = R(null), q = R(null), W = R(0), [
|
|
2502
|
+
const H = R(null), q = R(null), W = R(0), [w, O] = A(!1), [K, C] = A([]), x = (N) => {
|
|
2505
2503
|
const I = ++Vt;
|
|
2506
2504
|
C((X) => [...X, { id: I, msg: N }]), setTimeout(() => C((X) => X.filter((J) => J.id !== I)), 6e3);
|
|
2507
|
-
}, b = (N) => C((I) => I.filter((X) => X.id !== N)), E = (N) => N.type.startsWith("image/"), L = () => !0, U = _ ?? E, G =
|
|
2505
|
+
}, b = (N) => C((I) => I.filter((X) => X.id !== N)), E = (N) => N.type.startsWith("image/"), L = () => !0, U = _ ?? E, G = g ?? L, T = (N) => {
|
|
2508
2506
|
const I = [], X = [], J = [], Z = [];
|
|
2509
2507
|
let te = 0, ce = y != null ? y - ((m == null ? void 0 : m.length) ?? 0) : 1 / 0;
|
|
2510
2508
|
for (const se of N)
|
|
@@ -2546,8 +2544,8 @@ function dn({
|
|
|
2546
2544
|
if (!I) return;
|
|
2547
2545
|
const X = [];
|
|
2548
2546
|
for (const Je of I) {
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2547
|
+
const Le = Je.getAsFile();
|
|
2548
|
+
Le && X.push(Le);
|
|
2551
2549
|
}
|
|
2552
2550
|
if (X.length === 0) return;
|
|
2553
2551
|
const { imageFiles: J, tooLarge: Z, skipped: te, limitExceeded: ce } = T(X);
|
|
@@ -2571,9 +2569,9 @@ function dn({
|
|
|
2571
2569
|
}
|
|
2572
2570
|
}
|
|
2573
2571
|
o == null || o(N);
|
|
2574
|
-
}, Xe = (t.trim() || (m == null ? void 0 : m.length) > 0 || (d == null ? void 0 : d.length) > 0) && !i,
|
|
2572
|
+
}, Xe = (t.trim() || (m == null ? void 0 : m.length) > 0 || (d == null ? void 0 : d.length) > 0) && !i, De = p || h;
|
|
2575
2573
|
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-prompt-input", M].filter(Boolean).join(" "), ...D, children: [
|
|
2576
|
-
|
|
2574
|
+
De && /* @__PURE__ */ e.jsx(
|
|
2577
2575
|
"input",
|
|
2578
2576
|
{
|
|
2579
2577
|
ref: H,
|
|
@@ -2587,13 +2585,13 @@ function dn({
|
|
|
2587
2585
|
/* @__PURE__ */ e.jsxs(
|
|
2588
2586
|
"div",
|
|
2589
2587
|
{
|
|
2590
|
-
className: ["ds-prompt-input__box",
|
|
2588
|
+
className: ["ds-prompt-input__box", w && "ds-prompt-input__box--dragging"].filter(Boolean).join(" "),
|
|
2591
2589
|
onDragEnter: $,
|
|
2592
2590
|
onDragLeave: z,
|
|
2593
2591
|
onDragOver: F,
|
|
2594
2592
|
onDrop: ne,
|
|
2595
2593
|
children: [
|
|
2596
|
-
|
|
2594
|
+
w && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__drag-overlay", children: "Drop files here" }),
|
|
2597
2595
|
/* @__PURE__ */ e.jsx(
|
|
2598
2596
|
"textarea",
|
|
2599
2597
|
{
|
|
@@ -2639,7 +2637,7 @@ function dn({
|
|
|
2639
2637
|
)
|
|
2640
2638
|
] }, N.id)) }),
|
|
2641
2639
|
d && d.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__attachments", children: d.map((N, I) => /* @__PURE__ */ e.jsx(de, { size: "xs", children: /* @__PURE__ */ e.jsxs("span", { className: "ds-prompt-input__badge-content", children: [
|
|
2642
|
-
N.uploading ? /* @__PURE__ */ e.jsx(lt, { size: P[1], strokeWidth: 1.5, className: "spin" }) : /* @__PURE__ */ e.jsx(
|
|
2640
|
+
N.uploading ? /* @__PURE__ */ e.jsx(lt, { size: P[1], strokeWidth: 1.5, className: "spin" }) : /* @__PURE__ */ e.jsx(Pe, { size: P[1], strokeWidth: 1.5 }),
|
|
2643
2641
|
N.filename,
|
|
2644
2642
|
N.uploading ? /* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__uploading", children: "Uploading..." }) : /* @__PURE__ */ e.jsx(
|
|
2645
2643
|
"button",
|
|
@@ -2652,12 +2650,12 @@ function dn({
|
|
|
2652
2650
|
)
|
|
2653
2651
|
] }) }, I)) }),
|
|
2654
2652
|
/* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__toolbar", children: [
|
|
2655
|
-
|
|
2653
|
+
De && /* @__PURE__ */ e.jsx(
|
|
2656
2654
|
ae,
|
|
2657
2655
|
{
|
|
2658
2656
|
variant: "ghost",
|
|
2659
2657
|
size: "xs",
|
|
2660
|
-
icon: /* @__PURE__ */ e.jsx(
|
|
2658
|
+
icon: /* @__PURE__ */ e.jsx(Pe, { size: P[2], strokeWidth: 1.5 }),
|
|
2661
2659
|
"aria-label": "Attach files",
|
|
2662
2660
|
onClick: () => {
|
|
2663
2661
|
var N;
|
|
@@ -2694,7 +2692,7 @@ function dn({
|
|
|
2694
2692
|
)
|
|
2695
2693
|
] });
|
|
2696
2694
|
}
|
|
2697
|
-
const
|
|
2695
|
+
const Ue = { fast: 0, standard: 1, premium: 2 }, Ve = { fast: "data-5", standard: "data-3", premium: "data-6" };
|
|
2698
2696
|
function un({
|
|
2699
2697
|
models: t = [],
|
|
2700
2698
|
value: s,
|
|
@@ -2706,14 +2704,14 @@ function un({
|
|
|
2706
2704
|
className: l = "",
|
|
2707
2705
|
...u
|
|
2708
2706
|
}) {
|
|
2709
|
-
const [d, m] = A(!1), p = R(null), h = R(null), c = R(null), [v, _] = A({}),
|
|
2707
|
+
const [d, m] = A(!1), p = R(null), h = R(null), c = R(null), [v, _] = A({}), g = t.filter((w) => !o || w.name === "auto" ? !0 : (Ue[w.tier] ?? 1) >= (Ue[o] ?? 1)), y = g.find((w) => w.name === "auto"), k = g.filter((w) => w.name !== "auto"), j = t.find((w) => w.name === s), M = new Set(k.map((w) => w.tier).filter(Boolean)).size > 1;
|
|
2710
2708
|
B(() => {
|
|
2711
2709
|
if (!d) return;
|
|
2712
|
-
const
|
|
2710
|
+
const w = 320, O = () => {
|
|
2713
2711
|
var L;
|
|
2714
2712
|
const x = (L = h.current) == null ? void 0 : L.getBoundingClientRect();
|
|
2715
2713
|
if (!x) return;
|
|
2716
|
-
const b = window.innerHeight - x.bottom, E = b <
|
|
2714
|
+
const b = window.innerHeight - x.bottom, E = b < w + 8 && x.top > b;
|
|
2717
2715
|
_({
|
|
2718
2716
|
position: "fixed",
|
|
2719
2717
|
zIndex: "var(--z-dropdown, 500)",
|
|
@@ -2732,28 +2730,28 @@ function un({
|
|
|
2732
2730
|
window.removeEventListener("scroll", O, !0), window.removeEventListener("resize", O), document.removeEventListener("mousedown", K), document.removeEventListener("keydown", C);
|
|
2733
2731
|
};
|
|
2734
2732
|
}, [d]);
|
|
2735
|
-
const D = (
|
|
2736
|
-
n == null || n(
|
|
2737
|
-
}, H = (
|
|
2733
|
+
const D = (w) => {
|
|
2734
|
+
n == null || n(w), m(!1);
|
|
2735
|
+
}, H = (w) => /* @__PURE__ */ e.jsxs(
|
|
2738
2736
|
"button",
|
|
2739
2737
|
{
|
|
2740
2738
|
type: "button",
|
|
2741
2739
|
className: [
|
|
2742
2740
|
"ds-model-picker__item",
|
|
2743
|
-
|
|
2741
|
+
w.name === s && "ds-model-picker__item--active"
|
|
2744
2742
|
].filter(Boolean).join(" "),
|
|
2745
|
-
onClick: () => D(
|
|
2743
|
+
onClick: () => D(w.name),
|
|
2746
2744
|
children: [
|
|
2747
|
-
|
|
2748
|
-
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children:
|
|
2749
|
-
M &&
|
|
2745
|
+
w.icon ? /* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-icon", children: w.icon }) : /* @__PURE__ */ e.jsx(Me, { size: 12, strokeWidth: 1.5, className: "ds-model-picker__item-icon" }),
|
|
2746
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children: w.displayName || w.name }),
|
|
2747
|
+
M && w.tier && /* @__PURE__ */ e.jsx(de, { size: "xs", variant: Ve[w.tier] || "default", children: w.tier })
|
|
2750
2748
|
]
|
|
2751
2749
|
},
|
|
2752
|
-
|
|
2753
|
-
), q = () => !i || !M ? k.map(H) : ["fast", "standard", "premium"].flatMap((
|
|
2754
|
-
const O = k.filter((K) => K.tier ===
|
|
2750
|
+
w.name
|
|
2751
|
+
), q = () => !i || !M ? k.map(H) : ["fast", "standard", "premium"].flatMap((w) => {
|
|
2752
|
+
const O = k.filter((K) => K.tier === w);
|
|
2755
2753
|
return O.length ? [
|
|
2756
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__group-label", "data-tier":
|
|
2754
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__group-label", "data-tier": w, children: w.charAt(0).toUpperCase() + w.slice(1) }, `lbl-${w}`),
|
|
2757
2755
|
...O.map(H)
|
|
2758
2756
|
] : [];
|
|
2759
2757
|
}), W = d && /* @__PURE__ */ e.jsxs("div", { ref: c, className: "ds-model-picker__menu ds-scrollable", "data-ds-portal": "", style: v, children: [
|
|
@@ -2791,13 +2789,13 @@ function un({
|
|
|
2791
2789
|
ref: h,
|
|
2792
2790
|
type: "button",
|
|
2793
2791
|
className: "ds-model-picker__trigger",
|
|
2794
|
-
onClick: () => m((
|
|
2792
|
+
onClick: () => m((w) => !w),
|
|
2795
2793
|
"aria-haspopup": "listbox",
|
|
2796
2794
|
"aria-expanded": d,
|
|
2797
2795
|
children: [
|
|
2798
|
-
j != null && j.icon ? /* @__PURE__ */ e.jsx("span", { children: j.icon }) : /* @__PURE__ */ e.jsx(
|
|
2796
|
+
j != null && j.icon ? /* @__PURE__ */ e.jsx("span", { children: j.icon }) : /* @__PURE__ */ e.jsx(Me, { size: 12, strokeWidth: 1.5 }),
|
|
2799
2797
|
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__trigger-name", children: (j == null ? void 0 : j.displayName) || (j == null ? void 0 : j.name) || s }),
|
|
2800
|
-
M && (j == null ? void 0 : j.tier) && /* @__PURE__ */ e.jsx(de, { size: "xs", variant:
|
|
2798
|
+
M && (j == null ? void 0 : j.tier) && /* @__PURE__ */ e.jsx(de, { size: "xs", variant: Ve[j.tier] || "default", children: j.tier })
|
|
2801
2799
|
]
|
|
2802
2800
|
}
|
|
2803
2801
|
),
|
|
@@ -2854,18 +2852,18 @@ function fn({
|
|
|
2854
2852
|
d.map((h) => {
|
|
2855
2853
|
const c = h.items.map((_) => _.page).filter(Boolean), v = !!o;
|
|
2856
2854
|
return m ? /* @__PURE__ */ e.jsx(
|
|
2857
|
-
|
|
2855
|
+
Be,
|
|
2858
2856
|
{
|
|
2859
2857
|
title: /* @__PURE__ */ e.jsx(Yt, { filename: h.filename, pages: c }),
|
|
2860
2858
|
padding: "s",
|
|
2861
|
-
children: h.items.map((_,
|
|
2859
|
+
children: h.items.map((_, g) => /* @__PURE__ */ e.jsx(
|
|
2862
2860
|
"div",
|
|
2863
2861
|
{
|
|
2864
2862
|
className: `ds-sources-panel__snippet${v ? " ds-sources-panel__snippet--clickable" : ""}`,
|
|
2865
2863
|
onClick: v ? () => o(_) : void 0,
|
|
2866
2864
|
children: _.snippet ?? `p. ${_.page}`
|
|
2867
2865
|
},
|
|
2868
|
-
|
|
2866
|
+
g
|
|
2869
2867
|
))
|
|
2870
2868
|
},
|
|
2871
2869
|
h.filename
|
|
@@ -2889,7 +2887,7 @@ function fn({
|
|
|
2889
2887
|
] })
|
|
2890
2888
|
] });
|
|
2891
2889
|
}
|
|
2892
|
-
function
|
|
2890
|
+
function Ye(t) {
|
|
2893
2891
|
return t >= 1e6 ? (t / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : t >= 1e3 ? (t / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : String(t);
|
|
2894
2892
|
}
|
|
2895
2893
|
function mn({
|
|
@@ -2919,9 +2917,9 @@ function mn({
|
|
|
2919
2917
|
) }),
|
|
2920
2918
|
(a || o) && /* @__PURE__ */ e.jsxs("div", { className: `ds-token-counter__label ds-token-counter__label--${d}`, children: [
|
|
2921
2919
|
a && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
2922
|
-
|
|
2920
|
+
Ye(t),
|
|
2923
2921
|
" / ",
|
|
2924
|
-
|
|
2922
|
+
Ye(s)
|
|
2925
2923
|
] }),
|
|
2926
2924
|
o && /* @__PURE__ */ e.jsxs("span", { style: { marginLeft: "auto" }, children: [
|
|
2927
2925
|
Math.round(l * 100),
|
|
@@ -2932,7 +2930,7 @@ function mn({
|
|
|
2932
2930
|
}
|
|
2933
2931
|
);
|
|
2934
2932
|
}
|
|
2935
|
-
const
|
|
2933
|
+
const qe = 5;
|
|
2936
2934
|
function Ht(t) {
|
|
2937
2935
|
return t < 0.34 ? "low" : t < 0.67 ? "medium" : "high";
|
|
2938
2936
|
}
|
|
@@ -2942,14 +2940,14 @@ function pn({
|
|
|
2942
2940
|
showLabel: n = "none",
|
|
2943
2941
|
layout: a = "inline"
|
|
2944
2942
|
}) {
|
|
2945
|
-
const o = Math.max(0, Math.min(1, t)), r = Math.round(o *
|
|
2943
|
+
const o = Math.max(0, Math.min(1, t)), r = Math.round(o * qe), i = Ht(o);
|
|
2946
2944
|
return /* @__PURE__ */ e.jsxs("div", { className: [
|
|
2947
2945
|
"ds-confidence-bar",
|
|
2948
2946
|
`ds-confidence-bar--${s}`,
|
|
2949
2947
|
`ds-confidence-bar--${i}`,
|
|
2950
2948
|
a === "block" && "ds-confidence-bar--block"
|
|
2951
2949
|
].filter(Boolean).join(" "), children: [
|
|
2952
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-confidence-bar__segments", "aria-hidden": "true", children: Array.from({ length:
|
|
2950
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-confidence-bar__segments", "aria-hidden": "true", children: Array.from({ length: qe }, (l, u) => /* @__PURE__ */ e.jsx(
|
|
2953
2951
|
"div",
|
|
2954
2952
|
{
|
|
2955
2953
|
className: `ds-confidence-bar__seg${u < r ? " ds-confidence-bar__seg--filled" : ""}`
|
|
@@ -3152,7 +3150,7 @@ function bn({ children: t, axis: s = "y", style: n, className: a = "", ...o }) {
|
|
|
3152
3150
|
}
|
|
3153
3151
|
);
|
|
3154
3152
|
}
|
|
3155
|
-
const
|
|
3153
|
+
const we = 280, Jt = 22, Zt = 14, le = 8, _e = 6, Qt = 200;
|
|
3156
3154
|
function es(t) {
|
|
3157
3155
|
return t ? typeof t == "function" ? t() : typeof t == "string" ? document.querySelector(t) : null : null;
|
|
3158
3156
|
}
|
|
@@ -3200,19 +3198,19 @@ function jn({
|
|
|
3200
3198
|
statePrimary: h = "idle",
|
|
3201
3199
|
stateBack: c = "idle"
|
|
3202
3200
|
}) {
|
|
3203
|
-
const v = R(null), _ = R(t),
|
|
3204
|
-
_.current = t,
|
|
3205
|
-
const [k, j] = A(!1), [S, M] = A({ position: "fixed", visibility: "hidden", width:
|
|
3206
|
-
const x = _.current[
|
|
3201
|
+
const v = R(null), _ = R(t), g = R(s), y = R(l);
|
|
3202
|
+
_.current = t, g.current = s, y.current = l;
|
|
3203
|
+
const [k, j] = A(!1), [S, M] = A({ position: "fixed", visibility: "hidden", width: we }), [D, H] = A("bottom"), [q, W] = A(null), w = R(!1), O = t[s], K = s === t.length - 1, C = $e(() => {
|
|
3204
|
+
const x = _.current[g.current];
|
|
3207
3205
|
if (!x || !v.current) return;
|
|
3208
3206
|
const b = es(x.target);
|
|
3209
3207
|
if (!b) return;
|
|
3210
|
-
const E = b.getBoundingClientRect(), U = v.current.getBoundingClientRect().height || 160, G =
|
|
3208
|
+
const E = b.getBoundingClientRect(), U = v.current.getBoundingClientRect().height || 160, G = we, T = y.current ? Jt : Zt, f = x.position || ts(E, U, G, T), { top: $, left: z, arrowOffset: F } = ss(f, E, U, G, T);
|
|
3211
3209
|
H(f), M({
|
|
3212
3210
|
position: "fixed",
|
|
3213
3211
|
top: $,
|
|
3214
3212
|
left: z,
|
|
3215
|
-
width:
|
|
3213
|
+
width: we,
|
|
3216
3214
|
visibility: "visible",
|
|
3217
3215
|
"--arrow-offset": `${F}px`
|
|
3218
3216
|
}), W({
|
|
@@ -3225,13 +3223,13 @@ function jn({
|
|
|
3225
3223
|
return B(() => {
|
|
3226
3224
|
window.addEventListener("scroll", C, !0), window.addEventListener("resize", C);
|
|
3227
3225
|
const x = requestAnimationFrame(() => {
|
|
3228
|
-
C(), j(!0),
|
|
3226
|
+
C(), j(!0), w.current = !0;
|
|
3229
3227
|
});
|
|
3230
3228
|
return () => {
|
|
3231
3229
|
cancelAnimationFrame(x), window.removeEventListener("scroll", C, !0), window.removeEventListener("resize", C);
|
|
3232
3230
|
};
|
|
3233
3231
|
}, []), B(() => {
|
|
3234
|
-
if (!
|
|
3232
|
+
if (!w.current) return;
|
|
3235
3233
|
j(!1);
|
|
3236
3234
|
const x = setTimeout(() => {
|
|
3237
3235
|
M((b) => ({ ...b, visibility: "hidden" })), requestAnimationFrame(() => {
|
|
@@ -3321,7 +3319,7 @@ function jn({
|
|
|
3321
3319
|
);
|
|
3322
3320
|
}
|
|
3323
3321
|
function Nn(t, s = {}) {
|
|
3324
|
-
const { storageKey: n } = s, [a, o] = A(0), [r, i] = A(!1), l = () => n && typeof localStorage < "u" && localStorage.getItem(n) === "done", u =
|
|
3322
|
+
const { storageKey: n } = s, [a, o] = A(0), [r, i] = A(!1), l = () => n && typeof localStorage < "u" && localStorage.getItem(n) === "done", u = $e(() => {
|
|
3325
3323
|
i(!1), n && typeof localStorage < "u" && localStorage.setItem(n, "done");
|
|
3326
3324
|
}, [n]);
|
|
3327
3325
|
return {
|
|
@@ -3336,8 +3334,20 @@ function Nn(t, s = {}) {
|
|
|
3336
3334
|
finish: u
|
|
3337
3335
|
};
|
|
3338
3336
|
}
|
|
3337
|
+
function wn() {
|
|
3338
|
+
const t = R(null), s = $e(() => {
|
|
3339
|
+
const n = t.current;
|
|
3340
|
+
if (!n) return;
|
|
3341
|
+
n.classList.remove("ds-shake"), n.offsetWidth, n.classList.add("ds-shake");
|
|
3342
|
+
const a = () => {
|
|
3343
|
+
n.classList.remove("ds-shake"), n.removeEventListener("animationend", a);
|
|
3344
|
+
};
|
|
3345
|
+
n.addEventListener("animationend", a);
|
|
3346
|
+
}, []);
|
|
3347
|
+
return { ref: t, shake: s };
|
|
3348
|
+
}
|
|
3339
3349
|
export {
|
|
3340
|
-
|
|
3350
|
+
Be as Accordion,
|
|
3341
3351
|
xs as Alert,
|
|
3342
3352
|
Qs as AnimatedNumber,
|
|
3343
3353
|
$s as Avatar,
|
|
@@ -3351,12 +3361,12 @@ export {
|
|
|
3351
3361
|
ks as Checkbox,
|
|
3352
3362
|
jn as Coachmark,
|
|
3353
3363
|
bs as Code,
|
|
3354
|
-
|
|
3364
|
+
gt as CodeAccordion,
|
|
3355
3365
|
pn as ConfidenceBar,
|
|
3356
3366
|
Wt as CopyButton,
|
|
3357
3367
|
hn as DiffView,
|
|
3358
3368
|
Cs as Drawer,
|
|
3359
|
-
|
|
3369
|
+
Ce as DrawerFooter,
|
|
3360
3370
|
Js as Dropdown,
|
|
3361
3371
|
Ls as EmptyState,
|
|
3362
3372
|
_n as EngineerGrid,
|
|
@@ -3390,10 +3400,10 @@ export {
|
|
|
3390
3400
|
Es as Radio,
|
|
3391
3401
|
rn as ReasoningBlock,
|
|
3392
3402
|
bn as Scrollable,
|
|
3393
|
-
|
|
3403
|
+
gs as SegmentedControl,
|
|
3394
3404
|
ls as Select,
|
|
3395
3405
|
Fs as SidePage,
|
|
3396
|
-
|
|
3406
|
+
Fe as SidePageFooter,
|
|
3397
3407
|
Et as Skeleton,
|
|
3398
3408
|
fn as SourcesPanel,
|
|
3399
3409
|
vt as Spinner,
|
|
@@ -3401,7 +3411,7 @@ export {
|
|
|
3401
3411
|
an as StepIndicator,
|
|
3402
3412
|
cs as Stepper,
|
|
3403
3413
|
on as StreamingText,
|
|
3404
|
-
|
|
3414
|
+
ws as Tab,
|
|
3405
3415
|
Ts as Table,
|
|
3406
3416
|
Ss as TableBody,
|
|
3407
3417
|
Rs as TableHead,
|
|
@@ -3423,6 +3433,7 @@ export {
|
|
|
3423
3433
|
Ut as useAnimatedPlaceholder,
|
|
3424
3434
|
Nn as useCoachmark,
|
|
3425
3435
|
Mt as useInView,
|
|
3436
|
+
wn as useShake,
|
|
3426
3437
|
cn as useStreamScroll,
|
|
3427
3438
|
tn as useToast
|
|
3428
3439
|
};
|