@agentatom/design-system 1.4.78
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/README.md +24 -0
- package/dist/high-contrast.css +92 -0
- package/dist/index.cjs.js +22 -0
- package/dist/index.d.ts +1057 -0
- package/dist/index.es.js +3535 -0
- package/dist/light.css +2 -0
- package/dist/tokens.css +49 -0
- package/package.json +36 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,3535 @@
|
|
|
1
|
+
import q, { useState as B, useRef as R, useEffect as P, useLayoutEffect as nt, forwardRef as Je, useCallback as ce, useContext as ue, createContext as Ze } from "react";
|
|
2
|
+
import { Check as Re, X as ee, ChevronDown as je, Minus as rt, Plus as at, XCircle as Se, AlertTriangle as Ae, CheckCircle as De, Info as Ie, ChevronUp as ot, ChevronsUpDown as it, ChevronLeft as lt, ChevronRight as ct, Copy as dt, Brain as ut, Loader as ft, Paperclip as ze, Square as mt, ArrowUp as pt, Zap as ht, Cpu as Fe, FileText as xt, ThumbsUp as vt, ThumbsDown as _t } from "lucide-react";
|
|
3
|
+
import re from "react-dom";
|
|
4
|
+
const C = {
|
|
5
|
+
1: 16,
|
|
6
|
+
2: 20,
|
|
7
|
+
3: 24,
|
|
8
|
+
4: 28,
|
|
9
|
+
5: 48
|
|
10
|
+
};
|
|
11
|
+
var Ee = { exports: {} }, _e = {};
|
|
12
|
+
/**
|
|
13
|
+
* @license React
|
|
14
|
+
* react-jsx-runtime.production.js
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
17
|
+
*
|
|
18
|
+
* This source code is licensed under the MIT license found in the
|
|
19
|
+
* LICENSE file in the root directory of this source tree.
|
|
20
|
+
*/
|
|
21
|
+
var We;
|
|
22
|
+
function bt() {
|
|
23
|
+
if (We) return _e;
|
|
24
|
+
We = 1;
|
|
25
|
+
var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
26
|
+
function n(r, a, o) {
|
|
27
|
+
var i = null;
|
|
28
|
+
if (o !== void 0 && (i = "" + o), a.key !== void 0 && (i = "" + a.key), "key" in a) {
|
|
29
|
+
o = {};
|
|
30
|
+
for (var l in a)
|
|
31
|
+
l !== "key" && (o[l] = a[l]);
|
|
32
|
+
} else o = a;
|
|
33
|
+
return a = o.ref, {
|
|
34
|
+
$$typeof: t,
|
|
35
|
+
type: r,
|
|
36
|
+
key: i,
|
|
37
|
+
ref: a !== void 0 ? a : null,
|
|
38
|
+
props: o
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return _e.Fragment = s, _e.jsx = n, _e.jsxs = n, _e;
|
|
42
|
+
}
|
|
43
|
+
var be = {};
|
|
44
|
+
/**
|
|
45
|
+
* @license React
|
|
46
|
+
* react-jsx-runtime.development.js
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/
|
|
53
|
+
var Ce;
|
|
54
|
+
function jt() {
|
|
55
|
+
return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
|
+
function t(f) {
|
|
57
|
+
if (f == null) return null;
|
|
58
|
+
if (typeof f == "function")
|
|
59
|
+
return f.$$typeof === F ? null : f.displayName || f.name || null;
|
|
60
|
+
if (typeof f == "string") return f;
|
|
61
|
+
switch (f) {
|
|
62
|
+
case b:
|
|
63
|
+
return "Fragment";
|
|
64
|
+
case N:
|
|
65
|
+
return "Profiler";
|
|
66
|
+
case $:
|
|
67
|
+
return "StrictMode";
|
|
68
|
+
case D:
|
|
69
|
+
return "Suspense";
|
|
70
|
+
case M:
|
|
71
|
+
return "SuspenseList";
|
|
72
|
+
case j:
|
|
73
|
+
return "Activity";
|
|
74
|
+
}
|
|
75
|
+
if (typeof f == "object")
|
|
76
|
+
switch (typeof f.tag == "number" && console.error(
|
|
77
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
78
|
+
), f.$$typeof) {
|
|
79
|
+
case w:
|
|
80
|
+
return "Portal";
|
|
81
|
+
case y:
|
|
82
|
+
return f.displayName || "Context";
|
|
83
|
+
case _:
|
|
84
|
+
return (f._context.displayName || "Context") + ".Consumer";
|
|
85
|
+
case S:
|
|
86
|
+
var T = f.render;
|
|
87
|
+
return f = f.displayName, f || (f = T.displayName || T.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
|
|
88
|
+
case W:
|
|
89
|
+
return T = f.displayName || null, T !== null ? T : t(f.type) || "Memo";
|
|
90
|
+
case z:
|
|
91
|
+
T = f._payload, f = f._init;
|
|
92
|
+
try {
|
|
93
|
+
return t(f(T));
|
|
94
|
+
} catch {
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function s(f) {
|
|
100
|
+
return "" + f;
|
|
101
|
+
}
|
|
102
|
+
function n(f) {
|
|
103
|
+
try {
|
|
104
|
+
s(f);
|
|
105
|
+
var T = !1;
|
|
106
|
+
} catch {
|
|
107
|
+
T = !0;
|
|
108
|
+
}
|
|
109
|
+
if (T) {
|
|
110
|
+
T = console;
|
|
111
|
+
var O = T.error, Y = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
|
|
112
|
+
return O.call(
|
|
113
|
+
T,
|
|
114
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
115
|
+
Y
|
|
116
|
+
), s(f);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function r(f) {
|
|
120
|
+
if (f === b) return "<>";
|
|
121
|
+
if (typeof f == "object" && f !== null && f.$$typeof === z)
|
|
122
|
+
return "<...>";
|
|
123
|
+
try {
|
|
124
|
+
var T = t(f);
|
|
125
|
+
return T ? "<" + T + ">" : "<...>";
|
|
126
|
+
} catch {
|
|
127
|
+
return "<...>";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function a() {
|
|
131
|
+
var f = K.A;
|
|
132
|
+
return f === null ? null : f.getOwner();
|
|
133
|
+
}
|
|
134
|
+
function o() {
|
|
135
|
+
return Error("react-stack-top-frame");
|
|
136
|
+
}
|
|
137
|
+
function i(f) {
|
|
138
|
+
if (V.call(f, "key")) {
|
|
139
|
+
var T = Object.getOwnPropertyDescriptor(f, "key").get;
|
|
140
|
+
if (T && T.isReactWarning) return !1;
|
|
141
|
+
}
|
|
142
|
+
return f.key !== void 0;
|
|
143
|
+
}
|
|
144
|
+
function l(f, T) {
|
|
145
|
+
function O() {
|
|
146
|
+
k || (k = !0, console.error(
|
|
147
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
148
|
+
T
|
|
149
|
+
));
|
|
150
|
+
}
|
|
151
|
+
O.isReactWarning = !0, Object.defineProperty(f, "key", {
|
|
152
|
+
get: O,
|
|
153
|
+
configurable: !0
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function c() {
|
|
157
|
+
var f = t(this.type);
|
|
158
|
+
return A[f] || (A[f] = !0, console.error(
|
|
159
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
160
|
+
)), f = this.props.ref, f !== void 0 ? f : null;
|
|
161
|
+
}
|
|
162
|
+
function d(f, T, O, Y, te, ie) {
|
|
163
|
+
var H = O.ref;
|
|
164
|
+
return f = {
|
|
165
|
+
$$typeof: h,
|
|
166
|
+
type: f,
|
|
167
|
+
key: T,
|
|
168
|
+
props: O,
|
|
169
|
+
_owner: Y
|
|
170
|
+
}, (H !== void 0 ? H : null) !== null ? Object.defineProperty(f, "ref", {
|
|
171
|
+
enumerable: !1,
|
|
172
|
+
get: c
|
|
173
|
+
}) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: 0
|
|
178
|
+
}), Object.defineProperty(f, "_debugInfo", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: null
|
|
183
|
+
}), Object.defineProperty(f, "_debugStack", {
|
|
184
|
+
configurable: !1,
|
|
185
|
+
enumerable: !1,
|
|
186
|
+
writable: !0,
|
|
187
|
+
value: te
|
|
188
|
+
}), Object.defineProperty(f, "_debugTask", {
|
|
189
|
+
configurable: !1,
|
|
190
|
+
enumerable: !1,
|
|
191
|
+
writable: !0,
|
|
192
|
+
value: ie
|
|
193
|
+
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
194
|
+
}
|
|
195
|
+
function u(f, T, O, Y, te, ie) {
|
|
196
|
+
var H = T.children;
|
|
197
|
+
if (H !== void 0)
|
|
198
|
+
if (Y)
|
|
199
|
+
if (I(H)) {
|
|
200
|
+
for (Y = 0; Y < H.length; Y++)
|
|
201
|
+
m(H[Y]);
|
|
202
|
+
Object.freeze && Object.freeze(H);
|
|
203
|
+
} else
|
|
204
|
+
console.error(
|
|
205
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
206
|
+
);
|
|
207
|
+
else m(H);
|
|
208
|
+
if (V.call(T, "key")) {
|
|
209
|
+
H = t(f);
|
|
210
|
+
var Q = Object.keys(T).filter(function(ge) {
|
|
211
|
+
return ge !== "key";
|
|
212
|
+
});
|
|
213
|
+
Y = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", E[H + Y] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
214
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
215
|
+
let props = %s;
|
|
216
|
+
<%s {...props} />
|
|
217
|
+
React keys must be passed directly to JSX without using spread:
|
|
218
|
+
let props = %s;
|
|
219
|
+
<%s key={someKey} {...props} />`,
|
|
220
|
+
Y,
|
|
221
|
+
H,
|
|
222
|
+
Q,
|
|
223
|
+
H
|
|
224
|
+
), E[H + Y] = !0);
|
|
225
|
+
}
|
|
226
|
+
if (H = null, O !== void 0 && (n(O), H = "" + O), i(T) && (n(T.key), H = "" + T.key), "key" in T) {
|
|
227
|
+
O = {};
|
|
228
|
+
for (var le in T)
|
|
229
|
+
le !== "key" && (O[le] = T[le]);
|
|
230
|
+
} else O = T;
|
|
231
|
+
return H && l(
|
|
232
|
+
O,
|
|
233
|
+
typeof f == "function" ? f.displayName || f.name || "Unknown" : f
|
|
234
|
+
), d(
|
|
235
|
+
f,
|
|
236
|
+
H,
|
|
237
|
+
O,
|
|
238
|
+
a(),
|
|
239
|
+
te,
|
|
240
|
+
ie
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function m(f) {
|
|
244
|
+
x(f) ? f._store && (f._store.validated = 1) : typeof f == "object" && f !== null && f.$$typeof === z && (f._payload.status === "fulfilled" ? x(f._payload.value) && f._payload.value._store && (f._payload.value._store.validated = 1) : f._store && (f._store.validated = 1));
|
|
245
|
+
}
|
|
246
|
+
function x(f) {
|
|
247
|
+
return typeof f == "object" && f !== null && f.$$typeof === h;
|
|
248
|
+
}
|
|
249
|
+
var p = q, h = Symbol.for("react.transitional.element"), w = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), y = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), M = Symbol.for("react.suspense_list"), W = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), F = Symbol.for("react.client.reference"), K = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, I = Array.isArray, v = console.createTask ? console.createTask : function() {
|
|
250
|
+
return null;
|
|
251
|
+
};
|
|
252
|
+
p = {
|
|
253
|
+
react_stack_bottom_frame: function(f) {
|
|
254
|
+
return f();
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var k, A = {}, U = p.react_stack_bottom_frame.bind(
|
|
258
|
+
p,
|
|
259
|
+
o
|
|
260
|
+
)(), G = v(r(o)), E = {};
|
|
261
|
+
be.Fragment = b, be.jsx = function(f, T, O) {
|
|
262
|
+
var Y = 1e4 > K.recentlyCreatedOwnerStacks++;
|
|
263
|
+
return u(
|
|
264
|
+
f,
|
|
265
|
+
T,
|
|
266
|
+
O,
|
|
267
|
+
!1,
|
|
268
|
+
Y ? Error("react-stack-top-frame") : U,
|
|
269
|
+
Y ? v(r(f)) : G
|
|
270
|
+
);
|
|
271
|
+
}, be.jsxs = function(f, T, O) {
|
|
272
|
+
var Y = 1e4 > K.recentlyCreatedOwnerStacks++;
|
|
273
|
+
return u(
|
|
274
|
+
f,
|
|
275
|
+
T,
|
|
276
|
+
O,
|
|
277
|
+
!0,
|
|
278
|
+
Y ? Error("react-stack-top-frame") : U,
|
|
279
|
+
Y ? v(r(f)) : G
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
}()), be;
|
|
283
|
+
}
|
|
284
|
+
process.env.NODE_ENV === "production" ? Ee.exports = bt() : Ee.exports = jt();
|
|
285
|
+
var e = Ee.exports;
|
|
286
|
+
function Nt({ size: t = "m", color: s = "default", className: n = "", ...r }) {
|
|
287
|
+
return /* @__PURE__ */ e.jsx(
|
|
288
|
+
"span",
|
|
289
|
+
{
|
|
290
|
+
className: ["ds-spinner", `ds-spinner--${t}`, `ds-spinner--${s}`, n].filter(Boolean).join(" "),
|
|
291
|
+
role: "status",
|
|
292
|
+
"aria-label": "Loading",
|
|
293
|
+
...r
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
const wt = { xs: 12, s: 14, m: 16, l: 20 };
|
|
298
|
+
function oe({
|
|
299
|
+
children: t,
|
|
300
|
+
variant: s = "primary",
|
|
301
|
+
size: n = "m",
|
|
302
|
+
fullWidth: r = !1,
|
|
303
|
+
icon: a,
|
|
304
|
+
disabled: o = !1,
|
|
305
|
+
state: i = "idle",
|
|
306
|
+
onClick: l,
|
|
307
|
+
type: c = "button",
|
|
308
|
+
href: d,
|
|
309
|
+
"aria-label": u,
|
|
310
|
+
className: m = "",
|
|
311
|
+
...x
|
|
312
|
+
}) {
|
|
313
|
+
const p = a && !t, h = i === "loading", w = i === "success", b = i === "error", $ = h || w || b, N = n === "xs" ? "s" : "m", _ = s === "danger" ? "on-accent" : "default", y = wt[n] ?? 16, S = h ? /* @__PURE__ */ e.jsx(Nt, { size: N, color: _ }) : w ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(Re, { size: y, strokeWidth: 2.5 }) }) : b ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(ee, { size: y, strokeWidth: 2.5 }) }) : null, D = [
|
|
314
|
+
"ds-button",
|
|
315
|
+
`ds-button--${s}`,
|
|
316
|
+
`ds-button--${n}`,
|
|
317
|
+
r && "ds-button--full",
|
|
318
|
+
p && "ds-button--icon-only",
|
|
319
|
+
m
|
|
320
|
+
].filter(Boolean).join(" "), M = i !== "idle" ? i : void 0, W = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
321
|
+
$ ? S : a && /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: a }),
|
|
322
|
+
t
|
|
323
|
+
] });
|
|
324
|
+
if (d) {
|
|
325
|
+
const z = (j) => {
|
|
326
|
+
if (o || h) {
|
|
327
|
+
j.preventDefault();
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
j.metaKey || j.ctrlKey || j.button === 1 || (j.preventDefault(), l == null || l(j));
|
|
331
|
+
};
|
|
332
|
+
return /* @__PURE__ */ e.jsx(
|
|
333
|
+
"a",
|
|
334
|
+
{
|
|
335
|
+
className: D,
|
|
336
|
+
href: o || h ? void 0 : d,
|
|
337
|
+
onClick: z,
|
|
338
|
+
"aria-label": u,
|
|
339
|
+
"aria-disabled": o || h ? "true" : void 0,
|
|
340
|
+
"aria-busy": h ? "true" : void 0,
|
|
341
|
+
"data-state": M,
|
|
342
|
+
...x,
|
|
343
|
+
children: W
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
return /* @__PURE__ */ e.jsx(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
type: c,
|
|
351
|
+
className: D,
|
|
352
|
+
disabled: o,
|
|
353
|
+
onClick: h ? void 0 : l,
|
|
354
|
+
"aria-label": u,
|
|
355
|
+
"aria-busy": h ? "true" : void 0,
|
|
356
|
+
"data-state": M,
|
|
357
|
+
...x,
|
|
358
|
+
children: W
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
function cs({
|
|
363
|
+
label: t,
|
|
364
|
+
error: s,
|
|
365
|
+
hint: n,
|
|
366
|
+
fullWidth: r = !0,
|
|
367
|
+
icon: a,
|
|
368
|
+
iconRight: o,
|
|
369
|
+
onIconRightClick: i,
|
|
370
|
+
size: l = "m",
|
|
371
|
+
disabled: c,
|
|
372
|
+
id: d,
|
|
373
|
+
...u
|
|
374
|
+
}) {
|
|
375
|
+
const m = d || `input-${q.useId()}`, x = n ? `${m}-hint` : void 0, p = s ? `${m}-error` : void 0, h = p || x;
|
|
376
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `ds-input-wrapper ${r ? "ds-input-wrapper--full" : ""} ${c ? "ds-input-wrapper--disabled" : ""} ${s ? "ds-input-wrapper--error" : ""}`, children: [
|
|
377
|
+
t && /* @__PURE__ */ e.jsx("label", { className: "ds-input-label", htmlFor: m, children: t }),
|
|
378
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-input-container", children: [
|
|
379
|
+
a && /* @__PURE__ */ e.jsx("span", { className: `ds-input-icon ds-input-icon--${l}`, "aria-hidden": "true", children: a }),
|
|
380
|
+
/* @__PURE__ */ e.jsx(
|
|
381
|
+
"input",
|
|
382
|
+
{
|
|
383
|
+
id: m,
|
|
384
|
+
className: `ds-input ds-input--${l} ${a ? "ds-input--with-icon" : ""} ${o ? "ds-input--with-icon-right" : ""} ${s ? "ds-input--error" : ""}`,
|
|
385
|
+
disabled: c,
|
|
386
|
+
"aria-invalid": s ? "true" : "false",
|
|
387
|
+
"aria-describedby": h,
|
|
388
|
+
...u
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
o && /* @__PURE__ */ e.jsx(
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
type: "button",
|
|
395
|
+
className: `ds-input-icon-right ds-input-icon-right--${l}`,
|
|
396
|
+
onClick: i,
|
|
397
|
+
tabIndex: -1,
|
|
398
|
+
"aria-label": "Toggle visibility",
|
|
399
|
+
children: o
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
] }),
|
|
403
|
+
n && !s && /* @__PURE__ */ e.jsx("span", { id: x, className: "ds-input-hint", children: n }),
|
|
404
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-input-error-wrap", children: /* @__PURE__ */ e.jsx("div", { className: "ds-input-error-inner", children: s && /* @__PURE__ */ e.jsx("span", { id: p, className: "ds-input-error", role: "alert", children: s }) }) })
|
|
405
|
+
] });
|
|
406
|
+
}
|
|
407
|
+
function ds({
|
|
408
|
+
label: t,
|
|
409
|
+
error: s,
|
|
410
|
+
hint: n,
|
|
411
|
+
fullWidth: r = !0,
|
|
412
|
+
size: a = "m",
|
|
413
|
+
disabled: o,
|
|
414
|
+
id: i,
|
|
415
|
+
resize: l = !0,
|
|
416
|
+
rows: c = 3,
|
|
417
|
+
...d
|
|
418
|
+
}) {
|
|
419
|
+
const u = i || `textarea-${q.useId()}`, m = n ? `${u}-hint` : void 0, x = s ? `${u}-error` : void 0, p = x || m;
|
|
420
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `ds-textarea-wrapper ${r ? "ds-textarea-wrapper--full" : ""} ${o ? "ds-textarea-wrapper--disabled" : ""}`, children: [
|
|
421
|
+
t && /* @__PURE__ */ e.jsx("label", { className: "ds-textarea-label", htmlFor: u, children: t }),
|
|
422
|
+
/* @__PURE__ */ e.jsx(
|
|
423
|
+
"textarea",
|
|
424
|
+
{
|
|
425
|
+
id: u,
|
|
426
|
+
className: `ds-textarea ds-textarea--${a} ${s ? "ds-textarea--error" : ""} ${l ? "" : "ds-textarea--no-resize"}`,
|
|
427
|
+
disabled: o,
|
|
428
|
+
"aria-invalid": s ? "true" : "false",
|
|
429
|
+
"aria-describedby": p,
|
|
430
|
+
rows: c,
|
|
431
|
+
...d
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
n && !s && /* @__PURE__ */ e.jsx("span", { id: m, className: "ds-textarea-hint", children: n }),
|
|
435
|
+
s && /* @__PURE__ */ e.jsx("span", { id: x, className: "ds-textarea-error", role: "alert", children: s })
|
|
436
|
+
] });
|
|
437
|
+
}
|
|
438
|
+
function us({
|
|
439
|
+
label: t,
|
|
440
|
+
value: s,
|
|
441
|
+
onChange: n,
|
|
442
|
+
options: r = [],
|
|
443
|
+
placeholder: a = "Select option",
|
|
444
|
+
error: o,
|
|
445
|
+
fullWidth: i = !0,
|
|
446
|
+
size: l = "m",
|
|
447
|
+
disabled: c = !1,
|
|
448
|
+
id: d,
|
|
449
|
+
...u
|
|
450
|
+
}) {
|
|
451
|
+
const [m, x] = B(!1), [p, h] = B(!1), [w, b] = B({}), [$, N] = B("down"), [_, y] = B(-1), S = R(null), D = R(null), M = R(null), W = R(null), z = d || `select-${q.useId()}`, j = `${z}-label`, F = o ? `${z}-error` : void 0, K = 150, V = (E = !1) => {
|
|
452
|
+
p || (h(!0), y(-1), W.current = setTimeout(() => {
|
|
453
|
+
var f;
|
|
454
|
+
x(!1), h(!1), E && ((f = M.current) == null || f.focus());
|
|
455
|
+
}, K));
|
|
456
|
+
}, I = (E) => {
|
|
457
|
+
clearTimeout(W.current), h(!1);
|
|
458
|
+
const f = E !== void 0 ? E : Math.max(r.findIndex((T) => T.value === s), 0);
|
|
459
|
+
y(f), x(!0);
|
|
460
|
+
};
|
|
461
|
+
P(() => () => clearTimeout(W.current), []);
|
|
462
|
+
const v = () => {
|
|
463
|
+
var ie;
|
|
464
|
+
const E = (ie = S.current) == null ? void 0 : ie.getBoundingClientRect();
|
|
465
|
+
if (!E) return;
|
|
466
|
+
const f = window.innerHeight, T = f - E.bottom, O = E.top, te = T < 300 && O > T;
|
|
467
|
+
N(te ? "up" : "down"), b(
|
|
468
|
+
te ? { bottom: f - E.top + 4, left: E.left, width: E.width } : { top: E.bottom + 4, left: E.left, width: E.width }
|
|
469
|
+
);
|
|
470
|
+
};
|
|
471
|
+
P(() => {
|
|
472
|
+
if (m)
|
|
473
|
+
return v(), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v), () => {
|
|
474
|
+
window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
|
|
475
|
+
};
|
|
476
|
+
}, [m]), P(() => {
|
|
477
|
+
const E = (f) => {
|
|
478
|
+
S.current && !S.current.contains(f.target) && D.current && !D.current.contains(f.target) && V();
|
|
479
|
+
};
|
|
480
|
+
return document.addEventListener("mousedown", E), () => document.removeEventListener("mousedown", E);
|
|
481
|
+
}, [p]), P(() => {
|
|
482
|
+
var f;
|
|
483
|
+
if (!m || _ < 0 || !D.current) return;
|
|
484
|
+
(f = D.current.querySelectorAll(".ds-select-option")[_]) == null || f.scrollIntoView({ block: "nearest" });
|
|
485
|
+
}, [_, m]);
|
|
486
|
+
const k = (E) => {
|
|
487
|
+
switch (E.key) {
|
|
488
|
+
case "ArrowDown":
|
|
489
|
+
E.preventDefault(), m ? y((f) => Math.min(f + 1, r.length - 1)) : I();
|
|
490
|
+
break;
|
|
491
|
+
case "ArrowUp":
|
|
492
|
+
E.preventDefault(), m ? y((f) => Math.max(f - 1, 0)) : I(r.length - 1);
|
|
493
|
+
break;
|
|
494
|
+
case "Home":
|
|
495
|
+
m && (E.preventDefault(), y(0));
|
|
496
|
+
break;
|
|
497
|
+
case "End":
|
|
498
|
+
m && (E.preventDefault(), y(r.length - 1));
|
|
499
|
+
break;
|
|
500
|
+
case "Enter":
|
|
501
|
+
case " ":
|
|
502
|
+
E.preventDefault(), m ? _ >= 0 && (n == null || n(r[_].value), V(!0)) : I();
|
|
503
|
+
break;
|
|
504
|
+
case "Escape":
|
|
505
|
+
m && (E.preventDefault(), V(!0));
|
|
506
|
+
break;
|
|
507
|
+
case "Tab":
|
|
508
|
+
m && V(!1);
|
|
509
|
+
break;
|
|
510
|
+
}
|
|
511
|
+
}, A = r.find((E) => E.value === s), U = l === "xs" ? C[1] : l === "small" ? C[2] : C[3], G = m && /* @__PURE__ */ e.jsx(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
ref: D,
|
|
515
|
+
"data-ds-portal": "",
|
|
516
|
+
role: "listbox",
|
|
517
|
+
"aria-labelledby": t ? j : void 0,
|
|
518
|
+
tabIndex: -1,
|
|
519
|
+
className: [
|
|
520
|
+
"ds-select-dropdown ds-scrollable",
|
|
521
|
+
`ds-select-dropdown--${l}`,
|
|
522
|
+
`ds-select-dropdown--${$}`,
|
|
523
|
+
p && "ds-select-dropdown--closing"
|
|
524
|
+
].filter(Boolean).join(" "),
|
|
525
|
+
style: w,
|
|
526
|
+
children: r.map((E, f) => /* @__PURE__ */ e.jsx(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
id: `${z}-opt-${f}`,
|
|
530
|
+
type: "button",
|
|
531
|
+
role: "option",
|
|
532
|
+
tabIndex: -1,
|
|
533
|
+
"aria-selected": s === E.value,
|
|
534
|
+
className: [
|
|
535
|
+
"ds-select-option",
|
|
536
|
+
`ds-select-option--${l}`,
|
|
537
|
+
s === E.value && "ds-select-option--selected",
|
|
538
|
+
f === _ && "ds-select-option--active"
|
|
539
|
+
].filter(Boolean).join(" "),
|
|
540
|
+
onClick: () => {
|
|
541
|
+
n == null || n(E.value), V(!0);
|
|
542
|
+
},
|
|
543
|
+
children: E.label
|
|
544
|
+
},
|
|
545
|
+
E.value
|
|
546
|
+
))
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `ds-select-wrapper ${i ? "ds-select-wrapper--full" : ""} ${c ? "ds-select-wrapper--disabled" : ""}`, children: [
|
|
550
|
+
t && /* @__PURE__ */ e.jsx("label", { id: j, className: "ds-select-label", children: t }),
|
|
551
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-select-container", ref: S, children: /* @__PURE__ */ e.jsxs(
|
|
552
|
+
"button",
|
|
553
|
+
{
|
|
554
|
+
ref: M,
|
|
555
|
+
type: "button",
|
|
556
|
+
id: z,
|
|
557
|
+
role: "combobox",
|
|
558
|
+
"aria-haspopup": "listbox",
|
|
559
|
+
"aria-expanded": m,
|
|
560
|
+
"aria-activedescendant": m && _ >= 0 ? `${z}-opt-${_}` : void 0,
|
|
561
|
+
"aria-labelledby": t ? j : void 0,
|
|
562
|
+
"aria-invalid": o ? "true" : "false",
|
|
563
|
+
"aria-describedby": F,
|
|
564
|
+
className: `ds-select-trigger ds-select-trigger--${l} ${o ? "ds-select-trigger--error" : ""}`,
|
|
565
|
+
onClick: () => {
|
|
566
|
+
c || (m ? V() : I());
|
|
567
|
+
},
|
|
568
|
+
onKeyDown: k,
|
|
569
|
+
disabled: c,
|
|
570
|
+
...u,
|
|
571
|
+
children: [
|
|
572
|
+
/* @__PURE__ */ e.jsx("span", { className: A ? "" : "ds-select-placeholder", children: (A == null ? void 0 : A.label) || a }),
|
|
573
|
+
/* @__PURE__ */ e.jsx(
|
|
574
|
+
je,
|
|
575
|
+
{
|
|
576
|
+
size: U,
|
|
577
|
+
strokeWidth: 1.5,
|
|
578
|
+
className: `ds-select-icon ${m && $ === "down" ? "ds-select-icon--open" : ""} ${m && $ === "up" ? "ds-select-icon--up" : ""}`,
|
|
579
|
+
"aria-hidden": "true"
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
) }),
|
|
585
|
+
o && /* @__PURE__ */ e.jsx("span", { id: F, className: "ds-select-error", role: "alert", children: o }),
|
|
586
|
+
typeof document < "u" && re.createPortal(G, document.body)
|
|
587
|
+
] });
|
|
588
|
+
}
|
|
589
|
+
function fs({
|
|
590
|
+
label: t,
|
|
591
|
+
value: s = 0,
|
|
592
|
+
onChange: n,
|
|
593
|
+
min: r = 0,
|
|
594
|
+
max: a = 100,
|
|
595
|
+
step: o = 1,
|
|
596
|
+
size: i = "m",
|
|
597
|
+
disabled: l = !1,
|
|
598
|
+
hint: c,
|
|
599
|
+
error: d,
|
|
600
|
+
...u
|
|
601
|
+
}) {
|
|
602
|
+
const m = () => {
|
|
603
|
+
if (l) return;
|
|
604
|
+
const $ = Math.min(Number(s) + o, a);
|
|
605
|
+
n == null || n($);
|
|
606
|
+
}, x = () => {
|
|
607
|
+
if (l) return;
|
|
608
|
+
const $ = Math.max(Number(s) - o, r);
|
|
609
|
+
n == null || n($);
|
|
610
|
+
}, p = ($) => {
|
|
611
|
+
if (l) return;
|
|
612
|
+
const N = $.target.value;
|
|
613
|
+
if (N === "") {
|
|
614
|
+
n == null || n(r);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const _ = Number(N);
|
|
618
|
+
if (!isNaN(_)) {
|
|
619
|
+
const y = Math.min(Math.max(_, r), a);
|
|
620
|
+
n == null || n(y);
|
|
621
|
+
}
|
|
622
|
+
}, h = [
|
|
623
|
+
"ds-stepper-wrapper",
|
|
624
|
+
l && "ds-stepper-wrapper--disabled",
|
|
625
|
+
d && "ds-stepper-wrapper--error"
|
|
626
|
+
].filter(Boolean).join(" "), w = [
|
|
627
|
+
"ds-stepper",
|
|
628
|
+
`ds-stepper--${i}`,
|
|
629
|
+
l && "ds-stepper--disabled"
|
|
630
|
+
].filter(Boolean).join(" "), b = i === "xs" ? C[1] : i === "small" ? C[2] : C[3];
|
|
631
|
+
return /* @__PURE__ */ e.jsxs("div", { className: h, children: [
|
|
632
|
+
t && /* @__PURE__ */ e.jsx("label", { className: "ds-stepper-label", children: t }),
|
|
633
|
+
/* @__PURE__ */ e.jsxs("div", { className: w, children: [
|
|
634
|
+
/* @__PURE__ */ e.jsx(
|
|
635
|
+
"button",
|
|
636
|
+
{
|
|
637
|
+
type: "button",
|
|
638
|
+
className: "ds-stepper-button ds-stepper-button--minus",
|
|
639
|
+
onClick: x,
|
|
640
|
+
disabled: l || s <= r,
|
|
641
|
+
"aria-label": "Decrease",
|
|
642
|
+
children: /* @__PURE__ */ e.jsx(rt, { size: b, strokeWidth: 1.5 })
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
/* @__PURE__ */ e.jsx(
|
|
646
|
+
"input",
|
|
647
|
+
{
|
|
648
|
+
type: "number",
|
|
649
|
+
className: "ds-stepper-input",
|
|
650
|
+
value: s,
|
|
651
|
+
onChange: p,
|
|
652
|
+
min: r,
|
|
653
|
+
max: a,
|
|
654
|
+
step: o,
|
|
655
|
+
disabled: l,
|
|
656
|
+
...u
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ e.jsx(
|
|
660
|
+
"button",
|
|
661
|
+
{
|
|
662
|
+
type: "button",
|
|
663
|
+
className: "ds-stepper-button ds-stepper-button--plus",
|
|
664
|
+
onClick: m,
|
|
665
|
+
disabled: l || s >= a,
|
|
666
|
+
"aria-label": "Increase",
|
|
667
|
+
children: /* @__PURE__ */ e.jsx(at, { size: b, strokeWidth: 1.5 })
|
|
668
|
+
}
|
|
669
|
+
)
|
|
670
|
+
] }),
|
|
671
|
+
c && !d && /* @__PURE__ */ e.jsx("div", { className: "ds-stepper-hint", children: c }),
|
|
672
|
+
d && /* @__PURE__ */ e.jsx("div", { className: "ds-stepper-error", children: d })
|
|
673
|
+
] });
|
|
674
|
+
}
|
|
675
|
+
function ms({
|
|
676
|
+
children: t,
|
|
677
|
+
padding: s = "m",
|
|
678
|
+
variant: n = "info",
|
|
679
|
+
hover: r = !1,
|
|
680
|
+
// deprecated, use variant="interactive"
|
|
681
|
+
onClick: a,
|
|
682
|
+
href: o,
|
|
683
|
+
disabled: i = !1,
|
|
684
|
+
...l
|
|
685
|
+
}) {
|
|
686
|
+
const d = (r ? "interactive" : n) === "interactive" || a || o, u = [
|
|
687
|
+
"ds-card",
|
|
688
|
+
`ds-card--${s}`,
|
|
689
|
+
d && "ds-card--interactive"
|
|
690
|
+
].filter(Boolean).join(" ");
|
|
691
|
+
if (o) {
|
|
692
|
+
const p = (h) => {
|
|
693
|
+
if (i) {
|
|
694
|
+
h.preventDefault();
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
h.metaKey || h.ctrlKey || h.button === 1 || (h.preventDefault(), a == null || a(h));
|
|
698
|
+
};
|
|
699
|
+
return /* @__PURE__ */ e.jsx(
|
|
700
|
+
"a",
|
|
701
|
+
{
|
|
702
|
+
className: u,
|
|
703
|
+
href: i ? void 0 : o,
|
|
704
|
+
onClick: p,
|
|
705
|
+
"aria-disabled": i ? "true" : void 0,
|
|
706
|
+
...l,
|
|
707
|
+
children: t
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
const m = d && a ? "button" : "div", x = d && a ? {
|
|
712
|
+
type: "button",
|
|
713
|
+
onClick: a,
|
|
714
|
+
disabled: i
|
|
715
|
+
} : {};
|
|
716
|
+
return /* @__PURE__ */ e.jsx(
|
|
717
|
+
m,
|
|
718
|
+
{
|
|
719
|
+
className: u,
|
|
720
|
+
role: d && !a ? "article" : void 0,
|
|
721
|
+
...x,
|
|
722
|
+
...l,
|
|
723
|
+
children: t
|
|
724
|
+
}
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
function ps({ children: t, ...s }) {
|
|
728
|
+
return /* @__PURE__ */ e.jsx("h1", { className: "ds-h1", ...s, children: t });
|
|
729
|
+
}
|
|
730
|
+
function hs({ children: t, ...s }) {
|
|
731
|
+
return /* @__PURE__ */ e.jsx("h2", { className: "ds-h2", ...s, children: t });
|
|
732
|
+
}
|
|
733
|
+
function xs({ children: t, ...s }) {
|
|
734
|
+
return /* @__PURE__ */ e.jsx("h3", { className: "ds-h3", ...s, children: t });
|
|
735
|
+
}
|
|
736
|
+
function vs({ children: t, ...s }) {
|
|
737
|
+
return /* @__PURE__ */ e.jsx("h4", { className: "ds-h4", ...s, children: t });
|
|
738
|
+
}
|
|
739
|
+
function _s({ children: t, secondary: s = !1, ...n }) {
|
|
740
|
+
return /* @__PURE__ */ e.jsx("p", { className: `ds-p1 ${s ? "ds-p1--secondary" : ""}`, ...n, children: t });
|
|
741
|
+
}
|
|
742
|
+
function gt({ children: t, secondary: s = !1, ...n }) {
|
|
743
|
+
return /* @__PURE__ */ e.jsx("p", { className: `ds-p2 ${s ? "ds-p2--secondary" : ""}`, ...n, children: t });
|
|
744
|
+
}
|
|
745
|
+
function Qe({ children: t, secondary: s = !1, ...n }) {
|
|
746
|
+
return /* @__PURE__ */ e.jsx("p", { className: `ds-p3 ${s ? "ds-p3--secondary" : ""}`, ...n, children: t });
|
|
747
|
+
}
|
|
748
|
+
function pe({
|
|
749
|
+
children: t,
|
|
750
|
+
variant: s = "default",
|
|
751
|
+
size: n = "m",
|
|
752
|
+
role: r,
|
|
753
|
+
...a
|
|
754
|
+
}) {
|
|
755
|
+
const o = [
|
|
756
|
+
"ds-badge",
|
|
757
|
+
`ds-badge--${s}`,
|
|
758
|
+
`ds-badge--${n}`
|
|
759
|
+
].filter(Boolean).join(" "), i = r || (["info", "success", "warning", "error"].includes(s) ? "status" : void 0);
|
|
760
|
+
return /* @__PURE__ */ e.jsx("span", { className: o, role: i, ...a, children: t });
|
|
761
|
+
}
|
|
762
|
+
const yt = {
|
|
763
|
+
info: Ie,
|
|
764
|
+
success: De,
|
|
765
|
+
warning: Ae,
|
|
766
|
+
error: Se
|
|
767
|
+
}, bs = q.forwardRef(function({
|
|
768
|
+
children: s,
|
|
769
|
+
variant: n = "info",
|
|
770
|
+
title: r,
|
|
771
|
+
onClose: a,
|
|
772
|
+
role: o,
|
|
773
|
+
...i
|
|
774
|
+
}, l) {
|
|
775
|
+
const c = yt[n], d = o || (n === "error" ? "alert" : "status");
|
|
776
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: l, className: `ds-alert ds-alert--${n} ${r ? "" : "ds-alert--no-title"}`, role: d, ...i, children: [
|
|
777
|
+
c && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__icon", children: /* @__PURE__ */ e.jsx(c, { size: C[3], strokeWidth: 1.5 }) }),
|
|
778
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-alert__content", children: [
|
|
779
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__title", children: r }),
|
|
780
|
+
s && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__message", children: s })
|
|
781
|
+
] }),
|
|
782
|
+
a && /* @__PURE__ */ e.jsx(
|
|
783
|
+
"button",
|
|
784
|
+
{
|
|
785
|
+
type: "button",
|
|
786
|
+
className: "ds-alert__close",
|
|
787
|
+
onClick: a,
|
|
788
|
+
"aria-label": "Close alert",
|
|
789
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: C[3], strokeWidth: 1.5 })
|
|
790
|
+
}
|
|
791
|
+
)
|
|
792
|
+
] });
|
|
793
|
+
}), kt = 200;
|
|
794
|
+
function js({
|
|
795
|
+
children: t,
|
|
796
|
+
title: s,
|
|
797
|
+
onClose: n,
|
|
798
|
+
size: r = "m",
|
|
799
|
+
scrollable: a = !1,
|
|
800
|
+
subHeader: o,
|
|
801
|
+
...i
|
|
802
|
+
}) {
|
|
803
|
+
const l = R(null), c = q.useId(), [d, u] = B(!1), m = () => {
|
|
804
|
+
!n || d || (u(!0), setTimeout(() => {
|
|
805
|
+
u(!1), n();
|
|
806
|
+
}, kt));
|
|
807
|
+
};
|
|
808
|
+
P(() => {
|
|
809
|
+
const b = (N) => {
|
|
810
|
+
N.key === "Escape" && m();
|
|
811
|
+
}, $ = (N) => {
|
|
812
|
+
var y, S, D;
|
|
813
|
+
const _ = ((S = (y = N.composedPath) == null ? void 0 : y.call(N)) == null ? void 0 : S[0]) ?? N.target;
|
|
814
|
+
l.current && !l.current.contains(_) && !((D = _.closest) != null && D.call(_, "[data-ds-portal]")) && m();
|
|
815
|
+
};
|
|
816
|
+
return document.addEventListener("keydown", b), document.addEventListener("mousedown", $), () => {
|
|
817
|
+
document.removeEventListener("keydown", b), document.removeEventListener("mousedown", $);
|
|
818
|
+
};
|
|
819
|
+
}, [n, d]);
|
|
820
|
+
const x = q.Children.toArray(t), p = x.find((b) => (b == null ? void 0 : b.type) === he), h = x.filter((b) => (b == null ? void 0 : b.type) !== he), w = /* @__PURE__ */ e.jsx("div", { className: ["ds-modal-overlay", d && "ds-modal-overlay--closing"].filter(Boolean).join(" "), ...i, children: /* @__PURE__ */ e.jsxs(
|
|
821
|
+
"div",
|
|
822
|
+
{
|
|
823
|
+
className: [`ds-modal ds-modal--${r}`, a && "ds-modal--scrollable"].filter(Boolean).join(" "),
|
|
824
|
+
ref: l,
|
|
825
|
+
role: "dialog",
|
|
826
|
+
"aria-modal": "true",
|
|
827
|
+
"aria-labelledby": s ? c : void 0,
|
|
828
|
+
children: [
|
|
829
|
+
n && /* @__PURE__ */ e.jsx(
|
|
830
|
+
oe,
|
|
831
|
+
{
|
|
832
|
+
className: "ds-modal__close",
|
|
833
|
+
variant: "ghost",
|
|
834
|
+
size: "small",
|
|
835
|
+
icon: /* @__PURE__ */ e.jsx(ee, { size: C[2], strokeWidth: 1.5 }),
|
|
836
|
+
onClick: m,
|
|
837
|
+
"aria-label": "Close modal"
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
(s || o) && /* @__PURE__ */ e.jsxs("div", { className: "ds-modal__header", children: [
|
|
841
|
+
s && /* @__PURE__ */ e.jsx("h3", { id: c, className: "ds-modal__title", children: s }),
|
|
842
|
+
o && /* @__PURE__ */ e.jsx("div", { className: "ds-modal__subheader", children: o })
|
|
843
|
+
] }),
|
|
844
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-modal__body ds-scrollable", children: h }),
|
|
845
|
+
p
|
|
846
|
+
]
|
|
847
|
+
}
|
|
848
|
+
) });
|
|
849
|
+
return typeof document > "u" ? w : re.createPortal(w, document.body);
|
|
850
|
+
}
|
|
851
|
+
function he({ children: t }) {
|
|
852
|
+
return !t || q.Children.count(t) === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: "ds-modal__footer", children: t });
|
|
853
|
+
}
|
|
854
|
+
const Et = 320;
|
|
855
|
+
function Ns({
|
|
856
|
+
children: t,
|
|
857
|
+
title: s,
|
|
858
|
+
onClose: n,
|
|
859
|
+
subHeader: r,
|
|
860
|
+
...a
|
|
861
|
+
}) {
|
|
862
|
+
const o = R(null), i = q.useId(), [l, c] = B(!1), d = () => {
|
|
863
|
+
!n || l || (c(!0), setTimeout(() => {
|
|
864
|
+
c(!1), n();
|
|
865
|
+
}, Et));
|
|
866
|
+
};
|
|
867
|
+
P(() => {
|
|
868
|
+
const h = (b) => {
|
|
869
|
+
b.key === "Escape" && d();
|
|
870
|
+
}, w = (b) => {
|
|
871
|
+
var N, _, y;
|
|
872
|
+
const $ = ((_ = (N = b.composedPath) == null ? void 0 : N.call(b)) == null ? void 0 : _[0]) ?? b.target;
|
|
873
|
+
o.current && !o.current.contains($) && !((y = $.closest) != null && y.call($, "[data-ds-portal]")) && d();
|
|
874
|
+
};
|
|
875
|
+
return document.addEventListener("keydown", h), document.addEventListener("mousedown", w), () => {
|
|
876
|
+
document.removeEventListener("keydown", h), document.removeEventListener("mousedown", w);
|
|
877
|
+
};
|
|
878
|
+
}, [n, l]);
|
|
879
|
+
const u = q.Children.toArray(t), m = u.find((h) => (h == null ? void 0 : h.type) === he), x = u.filter((h) => (h == null ? void 0 : h.type) !== he), p = /* @__PURE__ */ e.jsx(
|
|
880
|
+
"div",
|
|
881
|
+
{
|
|
882
|
+
className: ["ds-bottom-sheet-overlay", l && "ds-bottom-sheet-overlay--closing"].filter(Boolean).join(" "),
|
|
883
|
+
...a,
|
|
884
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
885
|
+
"div",
|
|
886
|
+
{
|
|
887
|
+
ref: o,
|
|
888
|
+
className: ["ds-bottom-sheet", l && "ds-bottom-sheet--closing"].filter(Boolean).join(" "),
|
|
889
|
+
role: "dialog",
|
|
890
|
+
"aria-modal": "true",
|
|
891
|
+
"aria-labelledby": s ? i : void 0,
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
894
|
+
n && /* @__PURE__ */ e.jsx(
|
|
895
|
+
oe,
|
|
896
|
+
{
|
|
897
|
+
className: "ds-bottom-sheet__close",
|
|
898
|
+
variant: "ghost",
|
|
899
|
+
size: "small",
|
|
900
|
+
icon: /* @__PURE__ */ e.jsx(ee, { size: C[2], strokeWidth: 1.5 }),
|
|
901
|
+
onClick: d,
|
|
902
|
+
"aria-label": "Close"
|
|
903
|
+
}
|
|
904
|
+
),
|
|
905
|
+
(s || r) && /* @__PURE__ */ e.jsxs("div", { className: "ds-bottom-sheet__header", children: [
|
|
906
|
+
s && /* @__PURE__ */ e.jsx("h3", { id: i, className: "ds-bottom-sheet__title", children: s }),
|
|
907
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__subheader", children: r })
|
|
908
|
+
] }),
|
|
909
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__body ds-scrollable", children: x }),
|
|
910
|
+
m
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
)
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
return typeof document > "u" ? p : re.createPortal(p, document.body);
|
|
917
|
+
}
|
|
918
|
+
function $t({
|
|
919
|
+
children: t,
|
|
920
|
+
title: s = "Code",
|
|
921
|
+
defaultExpanded: n = !1,
|
|
922
|
+
expanded: r,
|
|
923
|
+
onToggle: a,
|
|
924
|
+
padding: o = "s",
|
|
925
|
+
className: i = "",
|
|
926
|
+
...l
|
|
927
|
+
}) {
|
|
928
|
+
const [c, d] = B(n), u = r !== void 0, m = u ? r : c, x = () => {
|
|
929
|
+
u ? a == null || a(!r) : d((h) => !h);
|
|
930
|
+
}, p = [
|
|
931
|
+
"ds-code-accordion",
|
|
932
|
+
`ds-code-accordion--${o}`,
|
|
933
|
+
m && "ds-code-accordion--expanded",
|
|
934
|
+
i
|
|
935
|
+
].filter(Boolean).join(" ");
|
|
936
|
+
return /* @__PURE__ */ e.jsxs("div", { className: p, ...l, children: [
|
|
937
|
+
/* @__PURE__ */ e.jsxs(
|
|
938
|
+
"button",
|
|
939
|
+
{
|
|
940
|
+
type: "button",
|
|
941
|
+
className: "ds-code-accordion__header",
|
|
942
|
+
onClick: x,
|
|
943
|
+
"aria-expanded": m,
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-code-accordion__title", children: s }),
|
|
946
|
+
/* @__PURE__ */ e.jsx(
|
|
947
|
+
je,
|
|
948
|
+
{
|
|
949
|
+
size: C[2],
|
|
950
|
+
strokeWidth: 1.5,
|
|
951
|
+
className: `ds-code-accordion__icon ${m ? "ds-code-accordion__icon--expanded" : ""}`
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
]
|
|
955
|
+
}
|
|
956
|
+
),
|
|
957
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-code-accordion__content", children: /* @__PURE__ */ e.jsx("div", { className: "ds-code-accordion__inner", children: /* @__PURE__ */ e.jsx("pre", { className: "ds-code-accordion__pre ds-scrollable", children: /* @__PURE__ */ e.jsx("code", { children: t }) }) }) })
|
|
958
|
+
] });
|
|
959
|
+
}
|
|
960
|
+
function ws({ children: t, block: s = !1, collapsible: n = !1, title: r = "Code", defaultExpanded: a = !1, ...o }) {
|
|
961
|
+
return s ? n ? /* @__PURE__ */ e.jsx($t, { title: r, defaultExpanded: a, ...o, children: t }) : /* @__PURE__ */ e.jsx("pre", { className: "ds-code-block ds-scrollable", ...o, children: /* @__PURE__ */ e.jsx("code", { children: t }) }) : /* @__PURE__ */ e.jsx("code", { className: "ds-code-inline", ...o, children: t });
|
|
962
|
+
}
|
|
963
|
+
function gs({ href: t, children: s, onClick: n, target: r, rel: a, ...o }) {
|
|
964
|
+
const l = r === "_blank" ? a ? `${a} noopener noreferrer` : "noopener noreferrer" : a;
|
|
965
|
+
return /* @__PURE__ */ e.jsx(
|
|
966
|
+
"a",
|
|
967
|
+
{
|
|
968
|
+
href: t,
|
|
969
|
+
className: "ds-link",
|
|
970
|
+
onClick: n,
|
|
971
|
+
target: r,
|
|
972
|
+
rel: l,
|
|
973
|
+
...o,
|
|
974
|
+
children: s
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
function ys({ children: t, size: s = "m", variant: n = "ghost", ...r }) {
|
|
979
|
+
return /* @__PURE__ */ e.jsx("div", { className: "ds-tabs", role: "tablist", ...r, children: q.Children.map(t, (a) => q.isValidElement(a) ? q.cloneElement(a, { size: s, variant: n }) : a) });
|
|
980
|
+
}
|
|
981
|
+
function ks({ children: t, selected: s = !1, onClick: n, size: r = "m", variant: a = "ghost", disabled: o = !1, icon: i, href: l, ...c }) {
|
|
982
|
+
const d = i && !t, u = [
|
|
983
|
+
"ds-tab",
|
|
984
|
+
`ds-tab--${r}`,
|
|
985
|
+
`ds-tab--${a}`,
|
|
986
|
+
s && "ds-tab--selected",
|
|
987
|
+
d && "ds-tab--icon-only"
|
|
988
|
+
].filter(Boolean).join(" "), m = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
989
|
+
i && /* @__PURE__ */ e.jsx("span", { className: "ds-tab-icon", children: i }),
|
|
990
|
+
t
|
|
991
|
+
] });
|
|
992
|
+
if (l) {
|
|
993
|
+
const x = (p) => {
|
|
994
|
+
if (o) {
|
|
995
|
+
p.preventDefault();
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
p.metaKey || p.ctrlKey || p.button === 1 || (p.preventDefault(), n == null || n(p));
|
|
999
|
+
};
|
|
1000
|
+
return /* @__PURE__ */ e.jsx(
|
|
1001
|
+
"a",
|
|
1002
|
+
{
|
|
1003
|
+
role: "tab",
|
|
1004
|
+
"aria-current": s ? "page" : void 0,
|
|
1005
|
+
"aria-disabled": o ? "true" : void 0,
|
|
1006
|
+
className: u,
|
|
1007
|
+
href: o ? void 0 : l,
|
|
1008
|
+
onClick: x,
|
|
1009
|
+
...c,
|
|
1010
|
+
children: m
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
return /* @__PURE__ */ e.jsx(
|
|
1015
|
+
"button",
|
|
1016
|
+
{
|
|
1017
|
+
role: "tab",
|
|
1018
|
+
"aria-selected": s,
|
|
1019
|
+
className: u,
|
|
1020
|
+
onClick: n,
|
|
1021
|
+
disabled: o,
|
|
1022
|
+
...c,
|
|
1023
|
+
children: m
|
|
1024
|
+
}
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
function Es({ options: t, value: s, onChange: n, size: r = "m", disabled: a = !1 }) {
|
|
1028
|
+
const o = R(null), i = R(null), [l, c] = B(!1), d = R(!1), u = R(null), m = R(null), x = () => {
|
|
1029
|
+
if (!o.current) return;
|
|
1030
|
+
const p = o.current.querySelector(`[data-value="${s}"]`);
|
|
1031
|
+
if (!p) return;
|
|
1032
|
+
const h = o.current.getBoundingClientRect(), w = p.getBoundingClientRect(), b = w.left - h.left, $ = w.width;
|
|
1033
|
+
i.current ? (i.current.style.transition = d.current ? "left var(--transition-normal), width var(--transition-normal)" : "none", i.current.style.left = b + "px", i.current.style.width = $ + "px", d.current = !1) : (c(!0), requestAnimationFrame(() => {
|
|
1034
|
+
if (!i.current || !o.current) return;
|
|
1035
|
+
const N = o.current.querySelector(`[data-value="${s}"]`);
|
|
1036
|
+
if (!N) return;
|
|
1037
|
+
const _ = o.current.getBoundingClientRect(), y = N.getBoundingClientRect();
|
|
1038
|
+
i.current.style.transition = "none", i.current.style.left = y.left - _.left + "px", i.current.style.width = y.width + "px";
|
|
1039
|
+
}));
|
|
1040
|
+
};
|
|
1041
|
+
return m.current = x, nt(() => {
|
|
1042
|
+
const p = u.current !== s;
|
|
1043
|
+
u.current = s, d.current = l && p, x();
|
|
1044
|
+
}), P(() => {
|
|
1045
|
+
if (!o.current) return;
|
|
1046
|
+
const p = new ResizeObserver(() => {
|
|
1047
|
+
d.current = !1, m.current();
|
|
1048
|
+
});
|
|
1049
|
+
return p.observe(o.current), () => p.disconnect();
|
|
1050
|
+
}, []), /* @__PURE__ */ e.jsxs(
|
|
1051
|
+
"div",
|
|
1052
|
+
{
|
|
1053
|
+
className: [
|
|
1054
|
+
"ds-seg",
|
|
1055
|
+
`ds-seg--${r}`,
|
|
1056
|
+
a && "ds-seg--disabled"
|
|
1057
|
+
].filter(Boolean).join(" "),
|
|
1058
|
+
ref: o,
|
|
1059
|
+
role: "group",
|
|
1060
|
+
children: [
|
|
1061
|
+
l && /* @__PURE__ */ e.jsx(
|
|
1062
|
+
"div",
|
|
1063
|
+
{
|
|
1064
|
+
ref: i,
|
|
1065
|
+
className: "ds-seg__pill",
|
|
1066
|
+
"aria-hidden": "true"
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
t.map((p) => /* @__PURE__ */ e.jsxs(
|
|
1070
|
+
"button",
|
|
1071
|
+
{
|
|
1072
|
+
type: "button",
|
|
1073
|
+
"data-value": p.value,
|
|
1074
|
+
className: ["ds-seg__btn", s === p.value && "ds-seg__btn--active"].filter(Boolean).join(" "),
|
|
1075
|
+
onClick: () => !a && n(p.value),
|
|
1076
|
+
"aria-pressed": s === p.value,
|
|
1077
|
+
disabled: a,
|
|
1078
|
+
children: [
|
|
1079
|
+
p.icon && /* @__PURE__ */ e.jsx("span", { className: "ds-seg__btn-icon", "aria-hidden": "true", children: p.icon }),
|
|
1080
|
+
p.label
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
p.value
|
|
1084
|
+
))
|
|
1085
|
+
]
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
function Be({
|
|
1090
|
+
children: t,
|
|
1091
|
+
title: s,
|
|
1092
|
+
defaultExpanded: n = !1,
|
|
1093
|
+
expanded: r,
|
|
1094
|
+
onToggle: a,
|
|
1095
|
+
padding: o = "m",
|
|
1096
|
+
...i
|
|
1097
|
+
}) {
|
|
1098
|
+
const [l, c] = B(n), d = r !== void 0, u = d ? r : l, m = () => {
|
|
1099
|
+
d ? a == null || a(!r) : c((p) => !p);
|
|
1100
|
+
}, x = [
|
|
1101
|
+
"ds-accordion",
|
|
1102
|
+
`ds-accordion--${o}`,
|
|
1103
|
+
u && "ds-accordion--expanded"
|
|
1104
|
+
].filter(Boolean).join(" ");
|
|
1105
|
+
return /* @__PURE__ */ e.jsxs("div", { className: x, ...i, children: [
|
|
1106
|
+
/* @__PURE__ */ e.jsxs(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
type: "button",
|
|
1110
|
+
className: "ds-accordion__header",
|
|
1111
|
+
onClick: m,
|
|
1112
|
+
"aria-expanded": u,
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-accordion__title", children: s }),
|
|
1115
|
+
/* @__PURE__ */ e.jsx(
|
|
1116
|
+
je,
|
|
1117
|
+
{
|
|
1118
|
+
size: C[2],
|
|
1119
|
+
strokeWidth: 1.5,
|
|
1120
|
+
className: `ds-accordion__icon ${u ? "ds-accordion__icon--expanded" : ""}`
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
]
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-accordion__content", children: /* @__PURE__ */ e.jsx("div", { className: "ds-accordion__content-inner", children: /* @__PURE__ */ e.jsx("div", { className: "ds-accordion__content-body", children: t }) }) })
|
|
1127
|
+
] });
|
|
1128
|
+
}
|
|
1129
|
+
const ae = 8, me = 8;
|
|
1130
|
+
function Tt(t, s, n) {
|
|
1131
|
+
const r = window.innerWidth;
|
|
1132
|
+
let a, o;
|
|
1133
|
+
switch (t) {
|
|
1134
|
+
case "top":
|
|
1135
|
+
a = s.top - n.height - ae, o = s.left + s.width / 2 - n.width / 2;
|
|
1136
|
+
break;
|
|
1137
|
+
case "bottom":
|
|
1138
|
+
a = s.bottom + ae, o = s.left + s.width / 2 - n.width / 2;
|
|
1139
|
+
break;
|
|
1140
|
+
case "left":
|
|
1141
|
+
a = s.top + s.height / 2 - n.height / 2, o = s.left - n.width - ae;
|
|
1142
|
+
break;
|
|
1143
|
+
case "right":
|
|
1144
|
+
a = s.top + s.height / 2 - n.height / 2, o = s.right + ae;
|
|
1145
|
+
break;
|
|
1146
|
+
default:
|
|
1147
|
+
a = s.bottom + ae, o = s.left;
|
|
1148
|
+
}
|
|
1149
|
+
const i = Math.max(me, Math.min(r - n.width - me, o)), l = o - i;
|
|
1150
|
+
return { top: a, left: i, arrowOffset: l };
|
|
1151
|
+
}
|
|
1152
|
+
function Rt(t, s, n) {
|
|
1153
|
+
const r = window.innerWidth, a = window.innerHeight;
|
|
1154
|
+
if (t.top >= s + ae + me) return "top";
|
|
1155
|
+
if (a - t.bottom >= s + ae + me) return "bottom";
|
|
1156
|
+
if (r - t.right >= n + ae + me) return "right";
|
|
1157
|
+
if (t.left >= n + ae + me) return "left";
|
|
1158
|
+
const o = Math.max(t.top, a - t.bottom, t.left, r - t.right);
|
|
1159
|
+
return o === t.top ? "top" : o === a - t.bottom ? "bottom" : o === r - t.right ? "right" : "left";
|
|
1160
|
+
}
|
|
1161
|
+
function Le({ children: t, content: s, position: n, ...r }) {
|
|
1162
|
+
const [a, o] = B(!1), [i, l] = B({ visibility: "hidden" }), [c, d] = B(n || "top"), u = R(null), m = R(null), x = R(!1), p = () => {
|
|
1163
|
+
if (!u.current || !m.current) return;
|
|
1164
|
+
const w = u.current.getBoundingClientRect(), b = m.current.getBoundingClientRect(), $ = n || Rt(w, b.height, b.width), { top: N, left: _, arrowOffset: y } = Tt($, w, b);
|
|
1165
|
+
d($), l({
|
|
1166
|
+
position: "fixed",
|
|
1167
|
+
top: N,
|
|
1168
|
+
left: _,
|
|
1169
|
+
visibility: "visible",
|
|
1170
|
+
"--arrow-offset": `${y}px`
|
|
1171
|
+
});
|
|
1172
|
+
};
|
|
1173
|
+
if (P(() => {
|
|
1174
|
+
if (!a) return;
|
|
1175
|
+
l({ position: "fixed", visibility: "hidden" });
|
|
1176
|
+
const w = requestAnimationFrame(p);
|
|
1177
|
+
return window.addEventListener("scroll", p, !0), window.addEventListener("resize", p), () => {
|
|
1178
|
+
cancelAnimationFrame(w), window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", p);
|
|
1179
|
+
};
|
|
1180
|
+
}, [a, n]), P(() => {
|
|
1181
|
+
if (!a) return;
|
|
1182
|
+
const w = (b) => {
|
|
1183
|
+
u.current && !u.current.contains(b.target) && o(!1);
|
|
1184
|
+
};
|
|
1185
|
+
return document.addEventListener("touchstart", w), () => document.removeEventListener("touchstart", w);
|
|
1186
|
+
}, [a]), !s) return t;
|
|
1187
|
+
const h = a && /* @__PURE__ */ e.jsx(
|
|
1188
|
+
"div",
|
|
1189
|
+
{
|
|
1190
|
+
ref: m,
|
|
1191
|
+
"data-ds-portal": "",
|
|
1192
|
+
className: `ds-tooltip ds-tooltip--${c}`,
|
|
1193
|
+
role: "tooltip",
|
|
1194
|
+
style: i,
|
|
1195
|
+
children: s
|
|
1196
|
+
}
|
|
1197
|
+
);
|
|
1198
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1199
|
+
"div",
|
|
1200
|
+
{
|
|
1201
|
+
ref: u,
|
|
1202
|
+
className: "ds-tooltip-wrapper",
|
|
1203
|
+
onMouseEnter: () => {
|
|
1204
|
+
x.current || o(!0);
|
|
1205
|
+
},
|
|
1206
|
+
onMouseLeave: () => {
|
|
1207
|
+
x.current || o(!1);
|
|
1208
|
+
},
|
|
1209
|
+
onTouchStart: () => {
|
|
1210
|
+
x.current = !0, o((w) => !w);
|
|
1211
|
+
},
|
|
1212
|
+
...r,
|
|
1213
|
+
children: [
|
|
1214
|
+
t,
|
|
1215
|
+
typeof document < "u" && re.createPortal(h, document.body)
|
|
1216
|
+
]
|
|
1217
|
+
}
|
|
1218
|
+
);
|
|
1219
|
+
}
|
|
1220
|
+
function $s({
|
|
1221
|
+
checked: t = !1,
|
|
1222
|
+
onChange: s,
|
|
1223
|
+
size: n = "m",
|
|
1224
|
+
disabled: r = !1,
|
|
1225
|
+
label: a,
|
|
1226
|
+
id: o,
|
|
1227
|
+
...i
|
|
1228
|
+
}) {
|
|
1229
|
+
const l = o || `toggle-${q.useId()}`, c = [
|
|
1230
|
+
"ds-toggle",
|
|
1231
|
+
`ds-toggle--${n}`,
|
|
1232
|
+
r && "ds-toggle--disabled"
|
|
1233
|
+
].filter(Boolean).join(" ");
|
|
1234
|
+
return /* @__PURE__ */ e.jsxs("label", { className: c, htmlFor: l, children: [
|
|
1235
|
+
/* @__PURE__ */ e.jsx(
|
|
1236
|
+
"input",
|
|
1237
|
+
{
|
|
1238
|
+
type: "checkbox",
|
|
1239
|
+
id: l,
|
|
1240
|
+
className: "ds-toggle__input",
|
|
1241
|
+
checked: t,
|
|
1242
|
+
onChange: (d) => s == null ? void 0 : s(d.target.checked),
|
|
1243
|
+
disabled: r,
|
|
1244
|
+
...i
|
|
1245
|
+
}
|
|
1246
|
+
),
|
|
1247
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-toggle__track", children: /* @__PURE__ */ e.jsx("span", { className: "ds-toggle__thumb" }) }),
|
|
1248
|
+
a && /* @__PURE__ */ e.jsx("span", { className: "ds-toggle__label", children: a })
|
|
1249
|
+
] });
|
|
1250
|
+
}
|
|
1251
|
+
function Ts({
|
|
1252
|
+
checked: t = !1,
|
|
1253
|
+
onChange: s,
|
|
1254
|
+
size: n = "m",
|
|
1255
|
+
disabled: r = !1,
|
|
1256
|
+
label: a,
|
|
1257
|
+
id: o,
|
|
1258
|
+
...i
|
|
1259
|
+
}) {
|
|
1260
|
+
const l = o || `checkbox-${q.useId()}`, c = [
|
|
1261
|
+
"ds-checkbox",
|
|
1262
|
+
`ds-checkbox--${n}`,
|
|
1263
|
+
r && "ds-checkbox--disabled"
|
|
1264
|
+
].filter(Boolean).join(" "), d = n === "xs" ? 10 : n === "small" ? 14 : n === "large" ? 20 : 16;
|
|
1265
|
+
return /* @__PURE__ */ e.jsxs("label", { className: c, htmlFor: l, children: [
|
|
1266
|
+
/* @__PURE__ */ e.jsx(
|
|
1267
|
+
"input",
|
|
1268
|
+
{
|
|
1269
|
+
type: "checkbox",
|
|
1270
|
+
id: l,
|
|
1271
|
+
className: "ds-checkbox__input",
|
|
1272
|
+
checked: t,
|
|
1273
|
+
onChange: (u) => s == null ? void 0 : s(u.target.checked),
|
|
1274
|
+
disabled: r,
|
|
1275
|
+
...i
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-checkbox__box", children: t && /* @__PURE__ */ e.jsx(
|
|
1279
|
+
Re,
|
|
1280
|
+
{
|
|
1281
|
+
size: d,
|
|
1282
|
+
strokeWidth: 2.5,
|
|
1283
|
+
className: "ds-checkbox__icon"
|
|
1284
|
+
}
|
|
1285
|
+
) }),
|
|
1286
|
+
a && /* @__PURE__ */ e.jsx("span", { className: "ds-checkbox__label", children: a })
|
|
1287
|
+
] });
|
|
1288
|
+
}
|
|
1289
|
+
function Rs({
|
|
1290
|
+
checked: t = !1,
|
|
1291
|
+
onChange: s,
|
|
1292
|
+
size: n = "m",
|
|
1293
|
+
disabled: r = !1,
|
|
1294
|
+
label: a,
|
|
1295
|
+
name: o,
|
|
1296
|
+
value: i,
|
|
1297
|
+
id: l,
|
|
1298
|
+
...c
|
|
1299
|
+
}) {
|
|
1300
|
+
const d = l || `radio-${q.useId()}`, u = [
|
|
1301
|
+
"ds-radio",
|
|
1302
|
+
`ds-radio--${n}`,
|
|
1303
|
+
r && "ds-radio--disabled"
|
|
1304
|
+
].filter(Boolean).join(" ");
|
|
1305
|
+
return /* @__PURE__ */ e.jsxs("label", { className: u, htmlFor: d, children: [
|
|
1306
|
+
/* @__PURE__ */ e.jsx(
|
|
1307
|
+
"input",
|
|
1308
|
+
{
|
|
1309
|
+
type: "radio",
|
|
1310
|
+
id: d,
|
|
1311
|
+
className: "ds-radio__input",
|
|
1312
|
+
checked: t,
|
|
1313
|
+
onChange: (m) => s == null ? void 0 : s(m.target.checked),
|
|
1314
|
+
disabled: r,
|
|
1315
|
+
name: o,
|
|
1316
|
+
value: i,
|
|
1317
|
+
...c
|
|
1318
|
+
}
|
|
1319
|
+
),
|
|
1320
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-radio__circle", children: /* @__PURE__ */ e.jsx("span", { className: "ds-radio__dot" }) }),
|
|
1321
|
+
a && /* @__PURE__ */ e.jsx("span", { className: "ds-radio__label", children: a })
|
|
1322
|
+
] });
|
|
1323
|
+
}
|
|
1324
|
+
function St({ width: t, height: s, shape: n = "rect", aspectRatio: r, className: a = "", style: o = {}, ...i }) {
|
|
1325
|
+
return /* @__PURE__ */ e.jsx(
|
|
1326
|
+
"span",
|
|
1327
|
+
{
|
|
1328
|
+
className: ["ds-skeleton", `ds-skeleton--${n}`, a].filter(Boolean).join(" "),
|
|
1329
|
+
style: { width: t, height: s, aspectRatio: r, ...o },
|
|
1330
|
+
"aria-hidden": "true",
|
|
1331
|
+
...i
|
|
1332
|
+
}
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
function At({ lines: t = 1, lastLineWidth: s = "70%", gap: n, className: r = "", style: a = {}, ...o }) {
|
|
1336
|
+
return /* @__PURE__ */ e.jsx(
|
|
1337
|
+
"span",
|
|
1338
|
+
{
|
|
1339
|
+
className: ["ds-skeleton-text", r].filter(Boolean).join(" "),
|
|
1340
|
+
style: { gap: n, ...a },
|
|
1341
|
+
"aria-hidden": "true",
|
|
1342
|
+
...o,
|
|
1343
|
+
children: Array.from({ length: t }, (i, l) => /* @__PURE__ */ e.jsx(
|
|
1344
|
+
"span",
|
|
1345
|
+
{
|
|
1346
|
+
className: "ds-skeleton ds-skeleton--text",
|
|
1347
|
+
style: l === t - 1 && t > 1 ? { width: s } : void 0
|
|
1348
|
+
},
|
|
1349
|
+
l
|
|
1350
|
+
))
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
St.Text = At;
|
|
1355
|
+
function Dt(t) {
|
|
1356
|
+
let s = 2166136261;
|
|
1357
|
+
for (let n = 0; n < t.length; n++)
|
|
1358
|
+
s ^= t.charCodeAt(n), s = Math.imul(s, 16777619) >>> 0;
|
|
1359
|
+
return s % 360;
|
|
1360
|
+
}
|
|
1361
|
+
function It(t) {
|
|
1362
|
+
if (!t) return "";
|
|
1363
|
+
const s = t.trim().split(/\s+/);
|
|
1364
|
+
return s.length >= 2 ? (s[0][0] + s[1][0]).toUpperCase() : t[0].toUpperCase();
|
|
1365
|
+
}
|
|
1366
|
+
function Ss({ seed: t, icon: s, src: n, size: r = 32, className: a = "", style: o = {}, ...i }) {
|
|
1367
|
+
const l = Dt(t ?? ""), [c, d] = B(!1), u = s ?? /* @__PURE__ */ e.jsx("span", { className: "ds-avatar__initials", children: It(t) });
|
|
1368
|
+
return /* @__PURE__ */ e.jsx(
|
|
1369
|
+
"div",
|
|
1370
|
+
{
|
|
1371
|
+
className: ["ds-avatar", a].filter(Boolean).join(" "),
|
|
1372
|
+
style: { width: r, height: r, "--ds-avatar-h": l, ...o },
|
|
1373
|
+
"aria-hidden": "true",
|
|
1374
|
+
...i,
|
|
1375
|
+
children: n && !c ? /* @__PURE__ */ e.jsx("img", { src: n, alt: "", onError: () => d(!0) }) : u
|
|
1376
|
+
}
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
function As({
|
|
1380
|
+
children: t,
|
|
1381
|
+
size: s = "compact",
|
|
1382
|
+
stickyTop: n,
|
|
1383
|
+
maxHeight: r,
|
|
1384
|
+
className: a = "",
|
|
1385
|
+
style: o = {},
|
|
1386
|
+
...i
|
|
1387
|
+
}) {
|
|
1388
|
+
const l = {
|
|
1389
|
+
...r ? { maxHeight: r } : {},
|
|
1390
|
+
...n !== void 0 ? { "--ds-table-sticky-top": typeof n == "number" ? `${n}px` : n } : {},
|
|
1391
|
+
...o
|
|
1392
|
+
};
|
|
1393
|
+
return /* @__PURE__ */ e.jsx(
|
|
1394
|
+
"div",
|
|
1395
|
+
{
|
|
1396
|
+
className: ["ds-table-wrap", "ds-scrollable", r ? "ds-table-wrap--scroll" : ""].filter(Boolean).join(" "),
|
|
1397
|
+
style: l,
|
|
1398
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1399
|
+
"table",
|
|
1400
|
+
{
|
|
1401
|
+
className: ["ds-table", `ds-table--${s}`, a].filter(Boolean).join(" "),
|
|
1402
|
+
...i,
|
|
1403
|
+
children: t
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
}
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
function Ds({ children: t, ...s }) {
|
|
1410
|
+
return /* @__PURE__ */ e.jsx("thead", { ...s, children: t });
|
|
1411
|
+
}
|
|
1412
|
+
function Is({ children: t, ...s }) {
|
|
1413
|
+
return /* @__PURE__ */ e.jsx("tbody", { ...s, children: t });
|
|
1414
|
+
}
|
|
1415
|
+
function Bs({ children: t, interactive: s, selected: n, subheader: r, exiting: a, updated: o, className: i = "", onClick: l, ...c }) {
|
|
1416
|
+
return /* @__PURE__ */ e.jsx(
|
|
1417
|
+
"tr",
|
|
1418
|
+
{
|
|
1419
|
+
className: [
|
|
1420
|
+
"ds-table-row",
|
|
1421
|
+
s || l ? "ds-table-row--interactive" : "",
|
|
1422
|
+
n ? "ds-table-row--selected" : "",
|
|
1423
|
+
r ? "ds-table-row--subheader" : "",
|
|
1424
|
+
a ? "ds-table-row--exiting" : "",
|
|
1425
|
+
o ? "ds-table-row--updated" : "",
|
|
1426
|
+
i
|
|
1427
|
+
].filter(Boolean).join(" "),
|
|
1428
|
+
onClick: l,
|
|
1429
|
+
...c,
|
|
1430
|
+
children: t
|
|
1431
|
+
}
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
function Ls({ children: t, colSpan: s = 999, ...n }) {
|
|
1435
|
+
return /* @__PURE__ */ e.jsx("tr", { className: "ds-table-row ds-table-row--subheader", ...n, children: /* @__PURE__ */ e.jsx("td", { colSpan: s, children: t }) });
|
|
1436
|
+
}
|
|
1437
|
+
function Ps({ children: t, align: s = "left", sortDir: n, onSort: r, width: a, className: o = "", style: i = {}, ...l }) {
|
|
1438
|
+
const c = !!r || n !== void 0, d = n === "asc" ? ot : n === "desc" ? je : it;
|
|
1439
|
+
return /* @__PURE__ */ e.jsx(
|
|
1440
|
+
"th",
|
|
1441
|
+
{
|
|
1442
|
+
className: [
|
|
1443
|
+
"ds-th",
|
|
1444
|
+
c ? "ds-th--sortable" : "",
|
|
1445
|
+
n ? "ds-th--sorted" : "",
|
|
1446
|
+
s !== "left" ? `ds-table-cell--${s}` : "",
|
|
1447
|
+
o
|
|
1448
|
+
].filter(Boolean).join(" "),
|
|
1449
|
+
onClick: r,
|
|
1450
|
+
style: { width: a, ...i },
|
|
1451
|
+
...l,
|
|
1452
|
+
children: c ? /* @__PURE__ */ e.jsxs("span", { className: "ds-th__inner", children: [
|
|
1453
|
+
t,
|
|
1454
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-th__sort-icon", children: /* @__PURE__ */ e.jsx(d, { size: 11, strokeWidth: 2.5 }) })
|
|
1455
|
+
] }) : t
|
|
1456
|
+
}
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1459
|
+
function Ms({ children: t, align: s = "left", secondary: n, muted: r, truncate: a, nowrap: o, className: i = "", ...l }) {
|
|
1460
|
+
return /* @__PURE__ */ e.jsx(
|
|
1461
|
+
"td",
|
|
1462
|
+
{
|
|
1463
|
+
className: [
|
|
1464
|
+
"ds-td",
|
|
1465
|
+
s !== "left" ? `ds-table-cell--${s}` : "",
|
|
1466
|
+
n ? "ds-table-cell--secondary" : "",
|
|
1467
|
+
r ? "ds-table-cell--muted" : "",
|
|
1468
|
+
a ? "ds-table-cell--truncate" : "",
|
|
1469
|
+
o ? "ds-table-cell--nowrap" : "",
|
|
1470
|
+
i
|
|
1471
|
+
].filter(Boolean).join(" "),
|
|
1472
|
+
...l,
|
|
1473
|
+
children: t
|
|
1474
|
+
}
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
function zs({
|
|
1478
|
+
icon: t,
|
|
1479
|
+
title: s,
|
|
1480
|
+
description: n,
|
|
1481
|
+
action: r,
|
|
1482
|
+
size: a = "m",
|
|
1483
|
+
className: o = "",
|
|
1484
|
+
...i
|
|
1485
|
+
}) {
|
|
1486
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1487
|
+
"div",
|
|
1488
|
+
{
|
|
1489
|
+
className: ["ds-empty-state", `ds-empty-state--${a}`, o].filter(Boolean).join(" "),
|
|
1490
|
+
...i,
|
|
1491
|
+
children: [
|
|
1492
|
+
t && /* @__PURE__ */ e.jsx("div", { className: "ds-empty-state__icon", children: t }),
|
|
1493
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-empty-state__title", children: s }),
|
|
1494
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "ds-empty-state__description", children: n }),
|
|
1495
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-empty-state__action", children: r })
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1500
|
+
function Fs({
|
|
1501
|
+
label: t,
|
|
1502
|
+
hint: s,
|
|
1503
|
+
error: n,
|
|
1504
|
+
required: r = !1,
|
|
1505
|
+
disabled: a = !1,
|
|
1506
|
+
htmlFor: o,
|
|
1507
|
+
children: i,
|
|
1508
|
+
className: l = "",
|
|
1509
|
+
style: c,
|
|
1510
|
+
...d
|
|
1511
|
+
}) {
|
|
1512
|
+
const u = q.useId(), m = o ?? u, x = `${m}-hint`, p = `${m}-error`;
|
|
1513
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1514
|
+
"div",
|
|
1515
|
+
{
|
|
1516
|
+
className: `ds-field${l ? ` ${l}` : ""}`,
|
|
1517
|
+
"data-state": n ? "error" : void 0,
|
|
1518
|
+
"data-required": r ? "" : void 0,
|
|
1519
|
+
"data-disabled": a ? "" : void 0,
|
|
1520
|
+
style: c,
|
|
1521
|
+
...d,
|
|
1522
|
+
children: [
|
|
1523
|
+
t && /* @__PURE__ */ e.jsx("label", { className: "ds-field-label", htmlFor: m, children: t }),
|
|
1524
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-field-control", children: i }),
|
|
1525
|
+
s && !n && /* @__PURE__ */ e.jsx("p", { className: "ds-field-hint", id: x, children: s }),
|
|
1526
|
+
n && /* @__PURE__ */ e.jsx("p", { className: "ds-field-error", id: p, role: "alert", children: n })
|
|
1527
|
+
]
|
|
1528
|
+
}
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
function Ws({ label: t, value: s, delta: n, size: r = "m", inline: a = !1, className: o = "", style: i, ...l }) {
|
|
1532
|
+
const c = n != null && n.startsWith("+") ? "up" : n != null && n.startsWith("-") ? "down" : "neutral";
|
|
1533
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1534
|
+
"div",
|
|
1535
|
+
{
|
|
1536
|
+
className: [
|
|
1537
|
+
"ds-stat",
|
|
1538
|
+
`ds-stat--${r}`,
|
|
1539
|
+
a && "ds-stat--inline",
|
|
1540
|
+
o
|
|
1541
|
+
].filter(Boolean).join(" "),
|
|
1542
|
+
style: i,
|
|
1543
|
+
...l,
|
|
1544
|
+
children: [
|
|
1545
|
+
t && /* @__PURE__ */ e.jsx("span", { className: "ds-stat-label", children: t }),
|
|
1546
|
+
s != null && /* @__PURE__ */ e.jsx("span", { className: "ds-stat-value", children: s }),
|
|
1547
|
+
n != null && /* @__PURE__ */ e.jsx("span", { className: `ds-stat-delta ds-stat-delta--${c}`, children: n })
|
|
1548
|
+
]
|
|
1549
|
+
}
|
|
1550
|
+
);
|
|
1551
|
+
}
|
|
1552
|
+
function Cs({
|
|
1553
|
+
children: t,
|
|
1554
|
+
separator: s = "/",
|
|
1555
|
+
"aria-label": n = "Breadcrumb",
|
|
1556
|
+
className: r = "",
|
|
1557
|
+
style: a,
|
|
1558
|
+
...o
|
|
1559
|
+
}) {
|
|
1560
|
+
const i = q.Children.toArray(t).filter(Boolean);
|
|
1561
|
+
return /* @__PURE__ */ e.jsx(
|
|
1562
|
+
"nav",
|
|
1563
|
+
{
|
|
1564
|
+
className: `ds-breadcrumb${r ? ` ${r}` : ""}`,
|
|
1565
|
+
"aria-label": n,
|
|
1566
|
+
style: a,
|
|
1567
|
+
...o,
|
|
1568
|
+
children: /* @__PURE__ */ e.jsx("ol", { className: "ds-breadcrumb-list", children: i.map((l, c) => /* @__PURE__ */ e.jsxs("li", { className: "ds-breadcrumb-item", children: [
|
|
1569
|
+
l,
|
|
1570
|
+
c < i.length - 1 && /* @__PURE__ */ e.jsx("span", { className: "ds-breadcrumb-sep", "aria-hidden": "true", children: s })
|
|
1571
|
+
] }, c)) })
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
function Os({
|
|
1576
|
+
page: t,
|
|
1577
|
+
total: s,
|
|
1578
|
+
onChange: n,
|
|
1579
|
+
siblings: r = 1,
|
|
1580
|
+
"aria-label": a = "Pagination",
|
|
1581
|
+
className: o = "",
|
|
1582
|
+
style: i,
|
|
1583
|
+
...l
|
|
1584
|
+
}) {
|
|
1585
|
+
const c = Bt(t, s, r);
|
|
1586
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1587
|
+
"nav",
|
|
1588
|
+
{
|
|
1589
|
+
className: `ds-pagination${o ? ` ${o}` : ""}`,
|
|
1590
|
+
"aria-label": a,
|
|
1591
|
+
style: i,
|
|
1592
|
+
...l,
|
|
1593
|
+
children: [
|
|
1594
|
+
/* @__PURE__ */ e.jsx(
|
|
1595
|
+
"button",
|
|
1596
|
+
{
|
|
1597
|
+
className: "ds-pagination-arrow",
|
|
1598
|
+
onClick: () => n == null ? void 0 : n(t - 1),
|
|
1599
|
+
disabled: t <= 1,
|
|
1600
|
+
"aria-label": "Previous page",
|
|
1601
|
+
children: /* @__PURE__ */ e.jsx(lt, { size: 16 })
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
c.map(
|
|
1605
|
+
(d, u) => d === "…" ? /* @__PURE__ */ e.jsx("span", { className: "ds-pagination-gap", "aria-hidden": "true", children: "…" }, `gap-${u}`) : /* @__PURE__ */ e.jsx(
|
|
1606
|
+
"button",
|
|
1607
|
+
{
|
|
1608
|
+
className: `ds-pagination-page${d === t ? " ds-pagination-page--current" : ""}`,
|
|
1609
|
+
onClick: () => d !== t && (n == null ? void 0 : n(d)),
|
|
1610
|
+
"aria-current": d === t ? "page" : void 0,
|
|
1611
|
+
"aria-label": `Page ${d}`,
|
|
1612
|
+
children: d
|
|
1613
|
+
},
|
|
1614
|
+
d
|
|
1615
|
+
)
|
|
1616
|
+
),
|
|
1617
|
+
/* @__PURE__ */ e.jsx(
|
|
1618
|
+
"button",
|
|
1619
|
+
{
|
|
1620
|
+
className: "ds-pagination-arrow",
|
|
1621
|
+
onClick: () => n == null ? void 0 : n(t + 1),
|
|
1622
|
+
disabled: t >= s,
|
|
1623
|
+
"aria-label": "Next page",
|
|
1624
|
+
children: /* @__PURE__ */ e.jsx(ct, { size: 16 })
|
|
1625
|
+
}
|
|
1626
|
+
)
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
function Bt(t, s, n) {
|
|
1632
|
+
if (s <= 7) return Array.from({ length: s }, (i, l) => l + 1);
|
|
1633
|
+
const r = Math.max(2, t - n), a = Math.min(s - 1, t + n), o = [1];
|
|
1634
|
+
r > 2 && o.push("…");
|
|
1635
|
+
for (let i = r; i <= a; i++) o.push(i);
|
|
1636
|
+
return a < s - 1 && o.push("…"), o.push(s), o;
|
|
1637
|
+
}
|
|
1638
|
+
const Lt = 300;
|
|
1639
|
+
function Us({
|
|
1640
|
+
children: t,
|
|
1641
|
+
title: s,
|
|
1642
|
+
onClose: n,
|
|
1643
|
+
subHeader: r,
|
|
1644
|
+
side: a = "right",
|
|
1645
|
+
size: o = "wide",
|
|
1646
|
+
offsetLeft: i = 0,
|
|
1647
|
+
offsetRight: l = 0,
|
|
1648
|
+
keepOpenRef: c,
|
|
1649
|
+
...d
|
|
1650
|
+
}) {
|
|
1651
|
+
const u = R(null), m = q.useId(), [x, p] = B(!1), h = () => {
|
|
1652
|
+
!n || x || (p(!0), setTimeout(() => {
|
|
1653
|
+
p(!1), n();
|
|
1654
|
+
}, Lt));
|
|
1655
|
+
};
|
|
1656
|
+
P(() => {
|
|
1657
|
+
const _ = (S) => {
|
|
1658
|
+
S.key === "Escape" && h();
|
|
1659
|
+
}, y = (S) => {
|
|
1660
|
+
var M, W, z, j;
|
|
1661
|
+
const D = ((W = (M = S.composedPath) == null ? void 0 : M.call(S)) == null ? void 0 : W[0]) ?? S.target;
|
|
1662
|
+
(z = c == null ? void 0 : c.current) != null && z.contains(D) || u.current && !u.current.contains(D) && !((j = D.closest) != null && j.call(D, "[data-ds-portal]")) && h();
|
|
1663
|
+
};
|
|
1664
|
+
return document.addEventListener("keydown", _), document.addEventListener("mousedown", y), () => {
|
|
1665
|
+
document.removeEventListener("keydown", _), document.removeEventListener("mousedown", y);
|
|
1666
|
+
};
|
|
1667
|
+
}, [n, x, c]);
|
|
1668
|
+
const w = q.Children.toArray(t), b = w.find((_) => (_ == null ? void 0 : _.type) === Oe || (_ == null ? void 0 : _.type) === he), $ = w.filter((_) => (_ == null ? void 0 : _.type) !== Oe && (_ == null ? void 0 : _.type) !== he), N = /* @__PURE__ */ e.jsx(
|
|
1669
|
+
"div",
|
|
1670
|
+
{
|
|
1671
|
+
className: ["ds-side-page-overlay", x && "ds-side-page-overlay--closing"].filter(Boolean).join(" "),
|
|
1672
|
+
"data-side": a,
|
|
1673
|
+
style: { "--ds-side-page-offset-left": `${i}px`, "--ds-side-page-offset-right": `${l}px` },
|
|
1674
|
+
...d,
|
|
1675
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
1676
|
+
"div",
|
|
1677
|
+
{
|
|
1678
|
+
ref: u,
|
|
1679
|
+
className: ["ds-side-page", x && "ds-side-page--closing"].filter(Boolean).join(" "),
|
|
1680
|
+
"data-side": a,
|
|
1681
|
+
"data-size": o,
|
|
1682
|
+
role: "dialog",
|
|
1683
|
+
"aria-modal": "true",
|
|
1684
|
+
"aria-labelledby": s ? m : void 0,
|
|
1685
|
+
children: [
|
|
1686
|
+
n && /* @__PURE__ */ e.jsx(
|
|
1687
|
+
oe,
|
|
1688
|
+
{
|
|
1689
|
+
className: "ds-side-page__close",
|
|
1690
|
+
variant: "ghost",
|
|
1691
|
+
size: "small",
|
|
1692
|
+
icon: /* @__PURE__ */ e.jsx(ee, { size: C[2], strokeWidth: 1.5 }),
|
|
1693
|
+
onClick: h,
|
|
1694
|
+
"aria-label": "Close"
|
|
1695
|
+
}
|
|
1696
|
+
),
|
|
1697
|
+
(s || r) && /* @__PURE__ */ e.jsxs("div", { className: "ds-side-page__header", children: [
|
|
1698
|
+
s && /* @__PURE__ */ e.jsx("h3", { id: m, className: "ds-side-page__title", children: s }),
|
|
1699
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-side-page__subheader", children: r })
|
|
1700
|
+
] }),
|
|
1701
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-side-page__body ds-scrollable", children: $ }),
|
|
1702
|
+
b
|
|
1703
|
+
]
|
|
1704
|
+
}
|
|
1705
|
+
)
|
|
1706
|
+
}
|
|
1707
|
+
);
|
|
1708
|
+
return typeof document > "u" ? N : re.createPortal(N, document.body);
|
|
1709
|
+
}
|
|
1710
|
+
function Oe({ children: t }) {
|
|
1711
|
+
return !t || q.Children.count(t) === 0 ? null : /* @__PURE__ */ e.jsx("div", { className: "ds-side-page__footer", children: t });
|
|
1712
|
+
}
|
|
1713
|
+
const ve = Ze({ collapsed: !1, side: "left" }), we = Ze(!1), Vs = Je(function({
|
|
1714
|
+
children: s,
|
|
1715
|
+
collapsed: n = !1,
|
|
1716
|
+
side: r = "left",
|
|
1717
|
+
onExpand: a,
|
|
1718
|
+
onCollapse: o,
|
|
1719
|
+
className: i = "",
|
|
1720
|
+
...l
|
|
1721
|
+
}, c) {
|
|
1722
|
+
const d = [
|
|
1723
|
+
"ds-nav-rail",
|
|
1724
|
+
n && "ds-nav-rail--collapsed",
|
|
1725
|
+
`ds-nav-rail--${r}`,
|
|
1726
|
+
i
|
|
1727
|
+
].filter(Boolean).join(" "), u = ce((m) => {
|
|
1728
|
+
if (!m.target.closest('button, a, input, select, textarea, [role="button"], [tabindex]')) {
|
|
1729
|
+
if (n && a) {
|
|
1730
|
+
a();
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
!n && o && o();
|
|
1734
|
+
}
|
|
1735
|
+
}, [n, a, o]);
|
|
1736
|
+
return /* @__PURE__ */ e.jsx(ve.Provider, { value: { collapsed: n, side: r }, children: /* @__PURE__ */ e.jsx(
|
|
1737
|
+
"nav",
|
|
1738
|
+
{
|
|
1739
|
+
ref: c,
|
|
1740
|
+
className: d,
|
|
1741
|
+
onClick: u,
|
|
1742
|
+
"data-expandable": n && a ? "" : void 0,
|
|
1743
|
+
"data-collapsible": !n && o ? "" : void 0,
|
|
1744
|
+
...l,
|
|
1745
|
+
children: s
|
|
1746
|
+
}
|
|
1747
|
+
) });
|
|
1748
|
+
});
|
|
1749
|
+
function Ys({
|
|
1750
|
+
icon: t,
|
|
1751
|
+
label: s,
|
|
1752
|
+
selected: n = !1,
|
|
1753
|
+
disabled: r = !1,
|
|
1754
|
+
href: a,
|
|
1755
|
+
onClick: o,
|
|
1756
|
+
count: i,
|
|
1757
|
+
updated: l = !1,
|
|
1758
|
+
open: c = !1,
|
|
1759
|
+
onboarding: d = !1,
|
|
1760
|
+
className: u = "",
|
|
1761
|
+
...m
|
|
1762
|
+
}) {
|
|
1763
|
+
const { collapsed: x, side: p } = ue(ve), h = ue(we), $ = {
|
|
1764
|
+
className: [
|
|
1765
|
+
"ds-nav-rail__item",
|
|
1766
|
+
u
|
|
1767
|
+
].filter(Boolean).join(" "),
|
|
1768
|
+
onClick: r ? void 0 : o,
|
|
1769
|
+
"aria-current": n ? "page" : void 0,
|
|
1770
|
+
"aria-disabled": r ? "true" : void 0,
|
|
1771
|
+
"aria-label": x ? s : void 0,
|
|
1772
|
+
tabIndex: r ? -1 : void 0,
|
|
1773
|
+
...{
|
|
1774
|
+
"data-selected": n || void 0,
|
|
1775
|
+
"data-disabled": r || void 0,
|
|
1776
|
+
"data-open": c || void 0,
|
|
1777
|
+
"data-onboarding": d || void 0
|
|
1778
|
+
},
|
|
1779
|
+
...m
|
|
1780
|
+
}, N = i != null, _ = p === "left" ? "right" : "left", y = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1781
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__icon", "aria-hidden": "true", children: t }),
|
|
1782
|
+
!x && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__label", children: s }),
|
|
1783
|
+
!x && N && /* @__PURE__ */ e.jsx(
|
|
1784
|
+
"span",
|
|
1785
|
+
{
|
|
1786
|
+
className: ["ds-nav-rail__count", i === 0 && "ds-nav-rail__count--zero"].filter(Boolean).join(" "),
|
|
1787
|
+
"data-updated": l && i !== 0 || void 0,
|
|
1788
|
+
children: i
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
!x && l && (!N || i === 0) && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__dot ds-nav-rail__dot--inline", "aria-hidden": "true" }),
|
|
1792
|
+
x && N && i !== 0 && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__count-collapsed", "data-updated": l || void 0, children: i > 99 ? "99+" : i }),
|
|
1793
|
+
x && l && (!N || i === 0) && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__dot", "aria-hidden": "true" })
|
|
1794
|
+
] }), S = a ? /* @__PURE__ */ e.jsx("a", { href: r ? void 0 : a, ...$, children: y }) : /* @__PURE__ */ e.jsx("button", { type: "button", ...$, children: y });
|
|
1795
|
+
return x && !h ? /* @__PURE__ */ e.jsx(Le, { content: s, position: _, children: S }) : S;
|
|
1796
|
+
}
|
|
1797
|
+
function Hs({ children: t, className: s = "", ...n }) {
|
|
1798
|
+
return /* @__PURE__ */ e.jsx("div", { className: ["ds-nav-rail__body", "ds-scrollable", s].filter(Boolean).join(" "), ...n, children: t });
|
|
1799
|
+
}
|
|
1800
|
+
function qs({ children: t, className: s = "", ...n }) {
|
|
1801
|
+
return /* @__PURE__ */ e.jsx("div", { className: ["ds-nav-rail__header", s].filter(Boolean).join(" "), ...n, children: t });
|
|
1802
|
+
}
|
|
1803
|
+
function Gs({ children: t, className: s = "", ...n }) {
|
|
1804
|
+
return /* @__PURE__ */ e.jsx("div", { className: ["ds-nav-rail__footer", s].filter(Boolean).join(" "), ...n, children: t });
|
|
1805
|
+
}
|
|
1806
|
+
function Ks({ className: t = "", ...s }) {
|
|
1807
|
+
return /* @__PURE__ */ e.jsx("hr", { className: ["ds-nav-rail__divider", t].filter(Boolean).join(" "), ...s });
|
|
1808
|
+
}
|
|
1809
|
+
function Xs({ children: t, label: s = "Recents", defaultOpen: n = !0, className: r = "", ...a }) {
|
|
1810
|
+
const { collapsed: o } = ue(ve), [i, l] = B(n);
|
|
1811
|
+
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-nav-rail__recents", r].filter(Boolean).join(" "), ...a, children: [
|
|
1812
|
+
!o && /* @__PURE__ */ e.jsxs(
|
|
1813
|
+
"button",
|
|
1814
|
+
{
|
|
1815
|
+
type: "button",
|
|
1816
|
+
className: ["ds-nav-rail__recents-toggle", !i && "ds-nav-rail__recents-toggle--closed"].filter(Boolean).join(" "),
|
|
1817
|
+
onClick: () => l((c) => !c),
|
|
1818
|
+
"aria-expanded": i,
|
|
1819
|
+
children: [
|
|
1820
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__recents-label", children: s }),
|
|
1821
|
+
/* @__PURE__ */ e.jsx(je, { size: 12, strokeWidth: 2, className: "ds-nav-rail__recents-chevron", "aria-hidden": "true" })
|
|
1822
|
+
]
|
|
1823
|
+
}
|
|
1824
|
+
),
|
|
1825
|
+
(i || o) && /* @__PURE__ */ e.jsx("div", { className: "ds-nav-rail__recents-body", children: t })
|
|
1826
|
+
] });
|
|
1827
|
+
}
|
|
1828
|
+
const Js = Je(function({
|
|
1829
|
+
as: s = "button",
|
|
1830
|
+
avatar: n,
|
|
1831
|
+
label: r,
|
|
1832
|
+
className: a = "",
|
|
1833
|
+
...o
|
|
1834
|
+
}, i) {
|
|
1835
|
+
const { collapsed: l, side: c } = ue(ve), d = ue(we), u = c === "left" ? "right" : "left", m = [
|
|
1836
|
+
"ds-nav-rail__item",
|
|
1837
|
+
"ds-nav-rail__agent",
|
|
1838
|
+
a
|
|
1839
|
+
].filter(Boolean).join(" "), x = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1840
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__icon", "aria-hidden": "true", children: n }),
|
|
1841
|
+
!l && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__label", children: r })
|
|
1842
|
+
] }), p = /* @__PURE__ */ e.jsx(
|
|
1843
|
+
s,
|
|
1844
|
+
{
|
|
1845
|
+
ref: i,
|
|
1846
|
+
className: m,
|
|
1847
|
+
"aria-label": l ? r : void 0,
|
|
1848
|
+
...s === "button" ? { type: "button" } : {},
|
|
1849
|
+
...o,
|
|
1850
|
+
children: x
|
|
1851
|
+
}
|
|
1852
|
+
);
|
|
1853
|
+
return l && !d ? /* @__PURE__ */ e.jsx(Le, { content: r, position: u, children: p }) : p;
|
|
1854
|
+
});
|
|
1855
|
+
function Zs({ avatar: t, label: s, selected: n = !1, disabled: r = !1, href: a, onClick: o, className: i = "", ...l }) {
|
|
1856
|
+
const { collapsed: c, side: d } = ue(ve), u = ue(we), p = {
|
|
1857
|
+
className: [
|
|
1858
|
+
"ds-nav-rail__item",
|
|
1859
|
+
"ds-nav-rail__agent",
|
|
1860
|
+
i
|
|
1861
|
+
].filter(Boolean).join(" "),
|
|
1862
|
+
onClick: r ? void 0 : o,
|
|
1863
|
+
"aria-current": n ? "page" : void 0,
|
|
1864
|
+
"aria-disabled": r ? "true" : void 0,
|
|
1865
|
+
tabIndex: r ? -1 : void 0,
|
|
1866
|
+
...{
|
|
1867
|
+
"data-selected": n || void 0,
|
|
1868
|
+
"data-disabled": r || void 0
|
|
1869
|
+
},
|
|
1870
|
+
...l
|
|
1871
|
+
}, h = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1872
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__icon", "aria-hidden": "true", children: t }),
|
|
1873
|
+
!c && /* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail__label", children: s })
|
|
1874
|
+
] }), w = d === "left" ? "right" : "left", b = a ? /* @__PURE__ */ e.jsx("a", { href: r ? void 0 : a, ...p, children: h }) : /* @__PURE__ */ e.jsx("button", { type: "button", ...p, children: h });
|
|
1875
|
+
return c && !u ? /* @__PURE__ */ e.jsx(Le, { content: s, position: w, children: b }) : b;
|
|
1876
|
+
}
|
|
1877
|
+
const Ue = 240, Ve = 6, Ye = 8;
|
|
1878
|
+
function Qs({
|
|
1879
|
+
trigger: t,
|
|
1880
|
+
title: s,
|
|
1881
|
+
children: n,
|
|
1882
|
+
open: r,
|
|
1883
|
+
onOpenChange: a,
|
|
1884
|
+
defaultOpen: o = !1
|
|
1885
|
+
}) {
|
|
1886
|
+
const { side: i } = ue(ve), [l, c] = B(o), d = r !== void 0, u = d ? r : l, [m, x] = B(!1), p = R(null), h = R(null), [w, b] = B({}), $ = ce(() => {
|
|
1887
|
+
d ? a == null || a(!0) : c(!0);
|
|
1888
|
+
}, [d, a]), N = ce(() => {
|
|
1889
|
+
d ? a == null || a(!1) : c(!1);
|
|
1890
|
+
}, [d, a]), _ = ce(() => u ? N() : $(), [u, $, N]), y = ce(() => {
|
|
1891
|
+
var F;
|
|
1892
|
+
const D = p.current;
|
|
1893
|
+
if (!D) return;
|
|
1894
|
+
const M = D.getBoundingClientRect(), W = window.innerHeight, z = ((F = h.current) == null ? void 0 : F.offsetHeight) ?? 300, j = Math.max(Ye, Math.min(W - z - Ye, M.top));
|
|
1895
|
+
b(i === "right" ? {
|
|
1896
|
+
position: "fixed",
|
|
1897
|
+
top: j,
|
|
1898
|
+
right: window.innerWidth - M.left + Ve,
|
|
1899
|
+
width: Ue
|
|
1900
|
+
} : {
|
|
1901
|
+
position: "fixed",
|
|
1902
|
+
top: j,
|
|
1903
|
+
left: M.right + Ve,
|
|
1904
|
+
width: Ue
|
|
1905
|
+
});
|
|
1906
|
+
}, [i]);
|
|
1907
|
+
P(() => {
|
|
1908
|
+
if (!u) {
|
|
1909
|
+
x(!1);
|
|
1910
|
+
return;
|
|
1911
|
+
}
|
|
1912
|
+
return y(), requestAnimationFrame(() => x(!0)), window.addEventListener("scroll", y, !0), window.addEventListener("resize", y), () => {
|
|
1913
|
+
window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", y);
|
|
1914
|
+
};
|
|
1915
|
+
}, [u, y]), P(() => {
|
|
1916
|
+
if (!u) return;
|
|
1917
|
+
const D = (W) => {
|
|
1918
|
+
var z, j;
|
|
1919
|
+
!((z = h.current) != null && z.contains(W.target)) && !((j = p.current) != null && j.contains(W.target)) && N();
|
|
1920
|
+
}, M = (W) => {
|
|
1921
|
+
W.key === "Escape" && N();
|
|
1922
|
+
};
|
|
1923
|
+
return document.addEventListener("mousedown", D), document.addEventListener("keydown", M), () => {
|
|
1924
|
+
document.removeEventListener("mousedown", D), document.removeEventListener("keydown", M);
|
|
1925
|
+
};
|
|
1926
|
+
}, [u, N]);
|
|
1927
|
+
const S = u && /* @__PURE__ */ e.jsxs(
|
|
1928
|
+
"div",
|
|
1929
|
+
{
|
|
1930
|
+
ref: h,
|
|
1931
|
+
className: [
|
|
1932
|
+
"ds-nav-rail-flyout",
|
|
1933
|
+
`ds-nav-rail-flyout--${i}`,
|
|
1934
|
+
m && "ds-nav-rail-flyout--visible"
|
|
1935
|
+
].filter(Boolean).join(" "),
|
|
1936
|
+
style: w,
|
|
1937
|
+
"data-ds-portal": "",
|
|
1938
|
+
role: "dialog",
|
|
1939
|
+
"aria-modal": "false",
|
|
1940
|
+
children: [
|
|
1941
|
+
s != null && /* @__PURE__ */ e.jsxs("div", { className: "ds-nav-rail-flyout__header", children: [
|
|
1942
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-nav-rail-flyout__title", children: s }),
|
|
1943
|
+
/* @__PURE__ */ e.jsx(
|
|
1944
|
+
"button",
|
|
1945
|
+
{
|
|
1946
|
+
type: "button",
|
|
1947
|
+
className: "ds-nav-rail-flyout__close",
|
|
1948
|
+
onClick: N,
|
|
1949
|
+
"aria-label": "Close",
|
|
1950
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: 16, strokeWidth: 2 })
|
|
1951
|
+
}
|
|
1952
|
+
)
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-nav-rail-flyout__body", children: n })
|
|
1955
|
+
]
|
|
1956
|
+
}
|
|
1957
|
+
);
|
|
1958
|
+
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1959
|
+
/* @__PURE__ */ e.jsx(we.Provider, { value: u, children: /* @__PURE__ */ e.jsx("div", { ref: p, onClick: _, style: { display: "flex", flexDirection: "column", width: "100%" }, children: t }) }),
|
|
1960
|
+
typeof document < "u" && re.createPortal(S, document.body)
|
|
1961
|
+
] });
|
|
1962
|
+
}
|
|
1963
|
+
const Pt = {
|
|
1964
|
+
info: Ie,
|
|
1965
|
+
success: De,
|
|
1966
|
+
warning: Ae,
|
|
1967
|
+
error: Se
|
|
1968
|
+
};
|
|
1969
|
+
function en({
|
|
1970
|
+
children: t,
|
|
1971
|
+
variant: s = "info",
|
|
1972
|
+
action: n,
|
|
1973
|
+
onAction: r,
|
|
1974
|
+
onDismiss: a,
|
|
1975
|
+
role: o,
|
|
1976
|
+
...i
|
|
1977
|
+
}) {
|
|
1978
|
+
const l = Pt[s], c = o || (s === "error" ? "alert" : "status");
|
|
1979
|
+
return /* @__PURE__ */ e.jsxs(
|
|
1980
|
+
"div",
|
|
1981
|
+
{
|
|
1982
|
+
className: `ds-banner ds-banner--${s}`,
|
|
1983
|
+
role: c,
|
|
1984
|
+
...i,
|
|
1985
|
+
children: [
|
|
1986
|
+
l && /* @__PURE__ */ e.jsx("span", { className: "ds-banner-icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(l, { size: C[2], strokeWidth: 1.5 }) }),
|
|
1987
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-banner-text", children: t }),
|
|
1988
|
+
n && /* @__PURE__ */ e.jsx(
|
|
1989
|
+
"button",
|
|
1990
|
+
{
|
|
1991
|
+
type: "button",
|
|
1992
|
+
className: "ds-banner-action",
|
|
1993
|
+
onClick: r,
|
|
1994
|
+
children: n
|
|
1995
|
+
}
|
|
1996
|
+
),
|
|
1997
|
+
a && /* @__PURE__ */ e.jsx(
|
|
1998
|
+
"button",
|
|
1999
|
+
{
|
|
2000
|
+
type: "button",
|
|
2001
|
+
className: "ds-banner-dismiss",
|
|
2002
|
+
onClick: a,
|
|
2003
|
+
"aria-label": "Dismiss",
|
|
2004
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: C[2], strokeWidth: 1.5 })
|
|
2005
|
+
}
|
|
2006
|
+
)
|
|
2007
|
+
]
|
|
2008
|
+
}
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2011
|
+
function tn({
|
|
2012
|
+
trigger: t,
|
|
2013
|
+
items: s = [],
|
|
2014
|
+
open: n,
|
|
2015
|
+
onOpenChange: r,
|
|
2016
|
+
align: a = "left",
|
|
2017
|
+
fullWidth: o = !1,
|
|
2018
|
+
className: i = "",
|
|
2019
|
+
style: l,
|
|
2020
|
+
...c
|
|
2021
|
+
}) {
|
|
2022
|
+
const [d, u] = B(!1), [m, x] = B(!1), p = n !== void 0, h = p ? n : d, w = R(null), b = R(null), $ = R(null), N = R(null), [_, y] = B({}), S = R(null), D = 150, M = () => {
|
|
2023
|
+
if (p)
|
|
2024
|
+
r == null || r(!1);
|
|
2025
|
+
else {
|
|
2026
|
+
if (m) return;
|
|
2027
|
+
x(!0), S.current = setTimeout(() => {
|
|
2028
|
+
u(!1), x(!1);
|
|
2029
|
+
}, D);
|
|
2030
|
+
}
|
|
2031
|
+
}, W = () => {
|
|
2032
|
+
const v = !h;
|
|
2033
|
+
p ? r == null || r(v) : v ? (clearTimeout(S.current), x(!1), u(!0)) : M();
|
|
2034
|
+
}, z = () => {
|
|
2035
|
+
h || (p ? r == null || r(!0) : (clearTimeout(S.current), x(!1), u(!0)));
|
|
2036
|
+
};
|
|
2037
|
+
P(() => () => clearTimeout(S.current), []), P(() => {
|
|
2038
|
+
if (!h) return;
|
|
2039
|
+
const v = 300, k = () => {
|
|
2040
|
+
var E;
|
|
2041
|
+
const A = (E = w.current) == null ? void 0 : E.getBoundingClientRect();
|
|
2042
|
+
if (!A) return;
|
|
2043
|
+
const U = window.innerHeight - A.bottom, G = U < v + 8 && A.top > U;
|
|
2044
|
+
y(
|
|
2045
|
+
a === "right" ? G ? { bottom: window.innerHeight - A.top + 4, top: "auto", right: window.innerWidth - A.right } : { top: A.bottom + 4, bottom: "auto", right: window.innerWidth - A.right } : G ? { bottom: window.innerHeight - A.top + 4, top: "auto", left: A.left } : { top: A.bottom + 4, bottom: "auto", left: A.left }
|
|
2046
|
+
);
|
|
2047
|
+
};
|
|
2048
|
+
return k(), window.addEventListener("scroll", k, !0), window.addEventListener("resize", k), () => {
|
|
2049
|
+
window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k);
|
|
2050
|
+
};
|
|
2051
|
+
}, [h, a]);
|
|
2052
|
+
const j = () => {
|
|
2053
|
+
var k;
|
|
2054
|
+
const v = (k = $.current) == null ? void 0 : k.querySelector(
|
|
2055
|
+
'button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea'
|
|
2056
|
+
);
|
|
2057
|
+
v == null || v.focus();
|
|
2058
|
+
};
|
|
2059
|
+
P(() => {
|
|
2060
|
+
if (!h) return;
|
|
2061
|
+
const v = (A) => {
|
|
2062
|
+
var U, G;
|
|
2063
|
+
!((U = w.current) != null && U.contains(A.target)) && !((G = b.current) != null && G.contains(A.target)) && M();
|
|
2064
|
+
}, k = (A) => {
|
|
2065
|
+
A.key === "Escape" && (M(), j());
|
|
2066
|
+
};
|
|
2067
|
+
return document.addEventListener("mousedown", v), document.addEventListener("keydown", k), () => {
|
|
2068
|
+
document.removeEventListener("mousedown", v), document.removeEventListener("keydown", k);
|
|
2069
|
+
};
|
|
2070
|
+
}, [h]), P(() => {
|
|
2071
|
+
if (!h || !N.current || !b.current) return;
|
|
2072
|
+
const v = F(), k = N.current === "last" ? v[v.length - 1] : v[0];
|
|
2073
|
+
k == null || k.focus(), N.current = null;
|
|
2074
|
+
}, [h]);
|
|
2075
|
+
const F = () => b.current ? [...b.current.querySelectorAll(
|
|
2076
|
+
'button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])'
|
|
2077
|
+
)] : [], K = (v) => {
|
|
2078
|
+
var k, A;
|
|
2079
|
+
if (v.key === "ArrowDown")
|
|
2080
|
+
v.preventDefault(), h ? (k = F()[0]) == null || k.focus() : (N.current = "first", z());
|
|
2081
|
+
else if (v.key === "ArrowUp")
|
|
2082
|
+
if (v.preventDefault(), !h)
|
|
2083
|
+
N.current = "last", z();
|
|
2084
|
+
else {
|
|
2085
|
+
const U = F();
|
|
2086
|
+
(A = U[U.length - 1]) == null || A.focus();
|
|
2087
|
+
}
|
|
2088
|
+
}, V = (v) => {
|
|
2089
|
+
var U, G, E, f;
|
|
2090
|
+
const k = F(), A = k.findIndex((T) => T === document.activeElement);
|
|
2091
|
+
switch (v.key) {
|
|
2092
|
+
case "ArrowDown":
|
|
2093
|
+
v.preventDefault(), (U = k[Math.min(A + 1, k.length - 1)]) == null || U.focus();
|
|
2094
|
+
break;
|
|
2095
|
+
case "ArrowUp":
|
|
2096
|
+
v.preventDefault(), A <= 0 ? j() : (G = k[A - 1]) == null || G.focus();
|
|
2097
|
+
break;
|
|
2098
|
+
case "Home":
|
|
2099
|
+
v.preventDefault(), (E = k[0]) == null || E.focus();
|
|
2100
|
+
break;
|
|
2101
|
+
case "End":
|
|
2102
|
+
v.preventDefault(), (f = k[k.length - 1]) == null || f.focus();
|
|
2103
|
+
break;
|
|
2104
|
+
case "Tab":
|
|
2105
|
+
M();
|
|
2106
|
+
break;
|
|
2107
|
+
}
|
|
2108
|
+
}, I = h && /* @__PURE__ */ e.jsx(
|
|
2109
|
+
"div",
|
|
2110
|
+
{
|
|
2111
|
+
ref: b,
|
|
2112
|
+
role: "menu",
|
|
2113
|
+
"data-ds-portal": "",
|
|
2114
|
+
className: [
|
|
2115
|
+
"ds-dropdown__menu",
|
|
2116
|
+
`ds-dropdown__menu--${a}`,
|
|
2117
|
+
m && "ds-dropdown__menu--closing"
|
|
2118
|
+
].filter(Boolean).join(" "),
|
|
2119
|
+
style: _,
|
|
2120
|
+
onKeyDown: V,
|
|
2121
|
+
children: s.map((v, k) => {
|
|
2122
|
+
if (v.separator)
|
|
2123
|
+
return /* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__separator" }, k);
|
|
2124
|
+
if (v.type === "section")
|
|
2125
|
+
return /* @__PURE__ */ e.jsxs("div", { className: "ds-dropdown__section", children: [
|
|
2126
|
+
v.label && /* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__section-label", children: v.label }),
|
|
2127
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__section-content", children: v.content })
|
|
2128
|
+
] }, k);
|
|
2129
|
+
const A = !!v.href, U = A ? "a" : "button", G = A ? { href: v.disabled ? void 0 : v.href, "aria-disabled": v.disabled ? "true" : void 0 } : { type: "button", disabled: v.disabled };
|
|
2130
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2131
|
+
U,
|
|
2132
|
+
{
|
|
2133
|
+
role: "menuitem",
|
|
2134
|
+
className: [
|
|
2135
|
+
"ds-dropdown__item",
|
|
2136
|
+
v.danger && "ds-dropdown__item--danger"
|
|
2137
|
+
].filter(Boolean).join(" "),
|
|
2138
|
+
...G,
|
|
2139
|
+
onClick: () => {
|
|
2140
|
+
var E;
|
|
2141
|
+
(E = v.onClick) == null || E.call(v), M();
|
|
2142
|
+
},
|
|
2143
|
+
children: [
|
|
2144
|
+
v.icon && /* @__PURE__ */ e.jsx("span", { className: "ds-dropdown__item-icon", children: v.icon }),
|
|
2145
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-dropdown__item-label", children: v.label }),
|
|
2146
|
+
v.shortcut && /* @__PURE__ */ e.jsx("span", { className: "ds-dropdown__item-shortcut", children: v.shortcut })
|
|
2147
|
+
]
|
|
2148
|
+
},
|
|
2149
|
+
k
|
|
2150
|
+
);
|
|
2151
|
+
})
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
2154
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2155
|
+
"div",
|
|
2156
|
+
{
|
|
2157
|
+
ref: w,
|
|
2158
|
+
className: ["ds-dropdown", o && "ds-dropdown--full-width", i].filter(Boolean).join(" "),
|
|
2159
|
+
style: l,
|
|
2160
|
+
...c,
|
|
2161
|
+
children: [
|
|
2162
|
+
/* @__PURE__ */ e.jsx(
|
|
2163
|
+
"div",
|
|
2164
|
+
{
|
|
2165
|
+
ref: $,
|
|
2166
|
+
className: "ds-dropdown__trigger",
|
|
2167
|
+
onClick: W,
|
|
2168
|
+
onKeyDown: K,
|
|
2169
|
+
children: t
|
|
2170
|
+
}
|
|
2171
|
+
),
|
|
2172
|
+
typeof document < "u" && re.createPortal(I, document.body)
|
|
2173
|
+
]
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
2177
|
+
function sn({
|
|
2178
|
+
value: t = 0,
|
|
2179
|
+
size: s = "m",
|
|
2180
|
+
variant: n = "default",
|
|
2181
|
+
showValue: r = !1,
|
|
2182
|
+
min: a = 2,
|
|
2183
|
+
animate: o = !0
|
|
2184
|
+
}) {
|
|
2185
|
+
const i = Math.min(100, Math.max(0, t)), l = Math.max(a, i), c = n === "auto" ? i >= 70 ? "success" : i >= 50 ? "warning" : "danger" : n;
|
|
2186
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2187
|
+
"div",
|
|
2188
|
+
{
|
|
2189
|
+
className: [
|
|
2190
|
+
"ds-progress",
|
|
2191
|
+
`ds-progress--${s}`,
|
|
2192
|
+
!o && "ds-progress--instant"
|
|
2193
|
+
].filter(Boolean).join(" "),
|
|
2194
|
+
role: "progressbar",
|
|
2195
|
+
"aria-valuenow": i,
|
|
2196
|
+
"aria-valuemin": 0,
|
|
2197
|
+
"aria-valuemax": 100,
|
|
2198
|
+
children: [
|
|
2199
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-progress__track", children: /* @__PURE__ */ e.jsx(
|
|
2200
|
+
"div",
|
|
2201
|
+
{
|
|
2202
|
+
className: `ds-progress__fill ds-progress__fill--${c}`,
|
|
2203
|
+
style: { width: `${l}%` }
|
|
2204
|
+
}
|
|
2205
|
+
) }),
|
|
2206
|
+
r && /* @__PURE__ */ e.jsxs("span", { className: "ds-progress__value", children: [
|
|
2207
|
+
Math.round(i),
|
|
2208
|
+
"%"
|
|
2209
|
+
] })
|
|
2210
|
+
]
|
|
2211
|
+
}
|
|
2212
|
+
);
|
|
2213
|
+
}
|
|
2214
|
+
const Mt = (t) => 1 - Math.pow(1 - t, 3), zt = () => typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2215
|
+
function Ft(t, { duration: s = 600 } = {}) {
|
|
2216
|
+
const [n, r] = B(t), a = R(t), o = R(null);
|
|
2217
|
+
return P(() => {
|
|
2218
|
+
if (zt()) {
|
|
2219
|
+
r(t), a.current = t;
|
|
2220
|
+
return;
|
|
2221
|
+
}
|
|
2222
|
+
const i = a.current, l = t - i;
|
|
2223
|
+
if (l === 0) return;
|
|
2224
|
+
let c = null;
|
|
2225
|
+
const d = (u) => {
|
|
2226
|
+
c || (c = u);
|
|
2227
|
+
const m = Math.min((u - c) / s, 1);
|
|
2228
|
+
r(i + l * Mt(m)), m < 1 ? o.current = requestAnimationFrame(d) : a.current = t;
|
|
2229
|
+
};
|
|
2230
|
+
return o.current = requestAnimationFrame(d), () => cancelAnimationFrame(o.current);
|
|
2231
|
+
}, [t, s]), n;
|
|
2232
|
+
}
|
|
2233
|
+
function nn({
|
|
2234
|
+
value: t,
|
|
2235
|
+
duration: s = 600,
|
|
2236
|
+
decimals: n = 0,
|
|
2237
|
+
prefix: r = "",
|
|
2238
|
+
suffix: a = ""
|
|
2239
|
+
}) {
|
|
2240
|
+
const i = Ft(t, { duration: s }).toFixed(n);
|
|
2241
|
+
return `${r}${i}${a}`;
|
|
2242
|
+
}
|
|
2243
|
+
function Wt({ threshold: t = 0.1, rootMargin: s = "0px", once: n = !1 } = {}) {
|
|
2244
|
+
const r = R(null), [a, o] = B(!1);
|
|
2245
|
+
return P(() => {
|
|
2246
|
+
const i = r.current;
|
|
2247
|
+
if (!i) return;
|
|
2248
|
+
const l = new IntersectionObserver(
|
|
2249
|
+
([c]) => {
|
|
2250
|
+
c.isIntersecting ? (o(!0), n && l.disconnect()) : n || o(!1);
|
|
2251
|
+
},
|
|
2252
|
+
{ threshold: t, rootMargin: s }
|
|
2253
|
+
);
|
|
2254
|
+
return l.observe(i), () => l.disconnect();
|
|
2255
|
+
}, [t, s, n]), { ref: r, inView: a };
|
|
2256
|
+
}
|
|
2257
|
+
function rn({
|
|
2258
|
+
children: t,
|
|
2259
|
+
as: s = "div",
|
|
2260
|
+
once: n = !1,
|
|
2261
|
+
threshold: r = 0.1,
|
|
2262
|
+
rootMargin: a = "0px",
|
|
2263
|
+
onEnter: o,
|
|
2264
|
+
onLeave: i,
|
|
2265
|
+
...l
|
|
2266
|
+
}) {
|
|
2267
|
+
const { ref: c, inView: d } = Wt({ threshold: r, rootMargin: a, once: n }), u = R(!1);
|
|
2268
|
+
return P(() => {
|
|
2269
|
+
d && !u.current && (o == null || o()), !d && u.current && (i == null || i()), u.current = d;
|
|
2270
|
+
}, [d]), /* @__PURE__ */ e.jsx(s, { ref: c, ...l, children: typeof t == "function" ? t(d) : t });
|
|
2271
|
+
}
|
|
2272
|
+
const He = {
|
|
2273
|
+
default: Ie,
|
|
2274
|
+
success: De,
|
|
2275
|
+
warning: Ae,
|
|
2276
|
+
error: Se
|
|
2277
|
+
};
|
|
2278
|
+
let xe = [];
|
|
2279
|
+
const $e = /* @__PURE__ */ new Set();
|
|
2280
|
+
function et() {
|
|
2281
|
+
$e.forEach((t) => t([...xe]));
|
|
2282
|
+
}
|
|
2283
|
+
function Ct(t) {
|
|
2284
|
+
xe = [...xe, t], et();
|
|
2285
|
+
}
|
|
2286
|
+
function Ot(t) {
|
|
2287
|
+
xe = xe.filter((s) => s.id !== t), et();
|
|
2288
|
+
}
|
|
2289
|
+
function an() {
|
|
2290
|
+
const t = (s, n = {}) => {
|
|
2291
|
+
Ct({
|
|
2292
|
+
id: `${Date.now()}-${Math.random()}`,
|
|
2293
|
+
message: s,
|
|
2294
|
+
type: "default",
|
|
2295
|
+
duration: 4e3,
|
|
2296
|
+
...n
|
|
2297
|
+
});
|
|
2298
|
+
};
|
|
2299
|
+
return t.success = (s, n) => t(s, { ...n, type: "success" }), t.error = (s, n) => t(s, { ...n, type: "error" }), t.warning = (s, n) => t(s, { ...n, type: "warning" }), { toast: t };
|
|
2300
|
+
}
|
|
2301
|
+
function Ut({ data: t, onDismiss: s }) {
|
|
2302
|
+
const [n, r] = B(!1), a = R(null);
|
|
2303
|
+
P(() => (requestAnimationFrame(() => r(!0)), t.duration > 0 && (a.current = setTimeout(() => o(), t.duration)), () => clearTimeout(a.current)), []);
|
|
2304
|
+
function o() {
|
|
2305
|
+
r(!1), setTimeout(() => s(t.id), 250);
|
|
2306
|
+
}
|
|
2307
|
+
const i = He[t.type] ?? He.default;
|
|
2308
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2309
|
+
"div",
|
|
2310
|
+
{
|
|
2311
|
+
className: [
|
|
2312
|
+
"ds-toast",
|
|
2313
|
+
`ds-toast--${t.type}`,
|
|
2314
|
+
n && "ds-toast--visible"
|
|
2315
|
+
].filter(Boolean).join(" "),
|
|
2316
|
+
role: t.type === "error" ? "alert" : "status",
|
|
2317
|
+
"aria-live": "polite",
|
|
2318
|
+
children: [
|
|
2319
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-toast__icon", children: /* @__PURE__ */ e.jsx(i, { size: C[3], strokeWidth: 1.5 }) }),
|
|
2320
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-toast__message", children: t.message }),
|
|
2321
|
+
/* @__PURE__ */ e.jsx(
|
|
2322
|
+
"button",
|
|
2323
|
+
{
|
|
2324
|
+
className: "ds-toast__close",
|
|
2325
|
+
onClick: o,
|
|
2326
|
+
"aria-label": "Закрыть",
|
|
2327
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: C[3], strokeWidth: 1.5 })
|
|
2328
|
+
}
|
|
2329
|
+
)
|
|
2330
|
+
]
|
|
2331
|
+
}
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
function on({ position: t = "bottom-right" }) {
|
|
2335
|
+
const [s, n] = B(() => [...xe]);
|
|
2336
|
+
return P(() => ($e.add(n), () => $e.delete(n)), []), !s.length || typeof document > "u" ? null : re.createPortal(
|
|
2337
|
+
/* @__PURE__ */ e.jsx("div", { "data-ds-portal": "", className: ["ds-toast-container", `ds-toast-container--${t}`].join(" "), children: s.map((r) => /* @__PURE__ */ e.jsx(Ut, { data: r, onDismiss: Ot }, r.id)) }),
|
|
2338
|
+
document.body
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
const Vt = {
|
|
2342
|
+
running: /* @__PURE__ */ e.jsx(pe, { size: "xs", variant: "info", children: "Running..." }),
|
|
2343
|
+
success: /* @__PURE__ */ e.jsx(pe, { size: "xs", variant: "success", children: "Done" }),
|
|
2344
|
+
error: /* @__PURE__ */ e.jsx(pe, { size: "xs", variant: "error", children: "Error" })
|
|
2345
|
+
};
|
|
2346
|
+
function ln({
|
|
2347
|
+
label: t,
|
|
2348
|
+
status: s = "idle",
|
|
2349
|
+
icon: n,
|
|
2350
|
+
badge: r,
|
|
2351
|
+
defaultExpanded: a = !1,
|
|
2352
|
+
expanded: o,
|
|
2353
|
+
onToggle: i,
|
|
2354
|
+
children: l,
|
|
2355
|
+
className: c = "",
|
|
2356
|
+
...d
|
|
2357
|
+
}) {
|
|
2358
|
+
const u = s === "running", m = /* @__PURE__ */ e.jsxs("span", { className: "ds-tool-card__title-row", children: [
|
|
2359
|
+
n && /* @__PURE__ */ e.jsx("span", { className: "ds-tool-card__icon", children: n }),
|
|
2360
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-tool-card__label", children: t }),
|
|
2361
|
+
Vt[s],
|
|
2362
|
+
r
|
|
2363
|
+
] });
|
|
2364
|
+
return l ? /* @__PURE__ */ e.jsx(
|
|
2365
|
+
"div",
|
|
2366
|
+
{
|
|
2367
|
+
className: ["ds-tool-card", u && "ds-tool-card--running", c].filter(Boolean).join(" "),
|
|
2368
|
+
...d,
|
|
2369
|
+
children: /* @__PURE__ */ e.jsx(
|
|
2370
|
+
Be,
|
|
2371
|
+
{
|
|
2372
|
+
title: m,
|
|
2373
|
+
padding: "s",
|
|
2374
|
+
defaultExpanded: a,
|
|
2375
|
+
expanded: u ? !1 : o,
|
|
2376
|
+
onToggle: u ? void 0 : i,
|
|
2377
|
+
children: /* @__PURE__ */ e.jsx("div", { className: "ds-tool-card__body", children: l })
|
|
2378
|
+
}
|
|
2379
|
+
)
|
|
2380
|
+
}
|
|
2381
|
+
) : /* @__PURE__ */ e.jsx(
|
|
2382
|
+
"div",
|
|
2383
|
+
{
|
|
2384
|
+
className: ["ds-tool-card", "ds-tool-card--bubble", c].filter(Boolean).join(" "),
|
|
2385
|
+
...d,
|
|
2386
|
+
children: m
|
|
2387
|
+
}
|
|
2388
|
+
);
|
|
2389
|
+
}
|
|
2390
|
+
function Yt({
|
|
2391
|
+
text: t,
|
|
2392
|
+
size: s = "xs",
|
|
2393
|
+
timeout: n = 800,
|
|
2394
|
+
"aria-label": r = "Copy to clipboard",
|
|
2395
|
+
...a
|
|
2396
|
+
}) {
|
|
2397
|
+
const [o, i] = B(!1), l = (c) => {
|
|
2398
|
+
c.currentTarget.blur(), navigator.clipboard.writeText(t).then(() => {
|
|
2399
|
+
i(!0), setTimeout(() => i(!1), n);
|
|
2400
|
+
});
|
|
2401
|
+
};
|
|
2402
|
+
return /* @__PURE__ */ e.jsx(
|
|
2403
|
+
oe,
|
|
2404
|
+
{
|
|
2405
|
+
variant: "ghost",
|
|
2406
|
+
size: s,
|
|
2407
|
+
state: o ? "success" : "idle",
|
|
2408
|
+
icon: /* @__PURE__ */ e.jsx(dt, { size: C[1], strokeWidth: 1.5 }),
|
|
2409
|
+
"aria-label": r,
|
|
2410
|
+
onClick: l,
|
|
2411
|
+
...a
|
|
2412
|
+
}
|
|
2413
|
+
);
|
|
2414
|
+
}
|
|
2415
|
+
function cn({ content: t, streaming: s = !1, ...n }) {
|
|
2416
|
+
const [r, a] = B(s);
|
|
2417
|
+
return P(() => {
|
|
2418
|
+
a(!!s);
|
|
2419
|
+
}, [s]), /* @__PURE__ */ e.jsx(
|
|
2420
|
+
Be,
|
|
2421
|
+
{
|
|
2422
|
+
expanded: r,
|
|
2423
|
+
onToggle: a,
|
|
2424
|
+
padding: "s",
|
|
2425
|
+
title: /* @__PURE__ */ e.jsxs("div", { className: "ds-reasoning__title", children: [
|
|
2426
|
+
/* @__PURE__ */ e.jsx(ut, { size: C[1], strokeWidth: 1.5, className: "ds-reasoning__icon" }),
|
|
2427
|
+
/* @__PURE__ */ e.jsx(gt, { secondary: !0, children: "Thinking" })
|
|
2428
|
+
] }),
|
|
2429
|
+
...n,
|
|
2430
|
+
children: /* @__PURE__ */ e.jsxs(Qe, { secondary: !0, style: { whiteSpace: "pre-wrap" }, children: [
|
|
2431
|
+
t,
|
|
2432
|
+
s && /* @__PURE__ */ e.jsx("span", { className: "ds-cursor ds-cursor--line" })
|
|
2433
|
+
] })
|
|
2434
|
+
}
|
|
2435
|
+
);
|
|
2436
|
+
}
|
|
2437
|
+
function dn({
|
|
2438
|
+
count: t,
|
|
2439
|
+
current: s = 0,
|
|
2440
|
+
done: n = [],
|
|
2441
|
+
onChange: r,
|
|
2442
|
+
showCounter: a = !0,
|
|
2443
|
+
className: o = "",
|
|
2444
|
+
"aria-label": i = "Steps",
|
|
2445
|
+
...l
|
|
2446
|
+
}) {
|
|
2447
|
+
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-step-indicator", o].filter(Boolean).join(" "), ...l, children: [
|
|
2448
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-step-indicator__dots", role: "tablist", "aria-label": i, children: Array.from({ length: t }, (c, d) => {
|
|
2449
|
+
const u = d === s, m = n.includes(d) && !u, x = r && (d <= s || n.includes(d)), p = [
|
|
2450
|
+
"ds-step-indicator__dot",
|
|
2451
|
+
u && "ds-step-indicator__dot--active",
|
|
2452
|
+
m && "ds-step-indicator__dot--done"
|
|
2453
|
+
].filter(Boolean).join(" ");
|
|
2454
|
+
return /* @__PURE__ */ e.jsx(
|
|
2455
|
+
"button",
|
|
2456
|
+
{
|
|
2457
|
+
type: "button",
|
|
2458
|
+
className: p,
|
|
2459
|
+
role: "tab",
|
|
2460
|
+
"aria-selected": u,
|
|
2461
|
+
"aria-label": `Step ${d + 1}`,
|
|
2462
|
+
disabled: !x || d === s,
|
|
2463
|
+
onClick: () => r == null ? void 0 : r(d),
|
|
2464
|
+
children: m ? /* @__PURE__ */ e.jsx(Re, { size: 8, strokeWidth: 3 }) : null
|
|
2465
|
+
},
|
|
2466
|
+
d
|
|
2467
|
+
);
|
|
2468
|
+
}) }),
|
|
2469
|
+
a && /* @__PURE__ */ e.jsxs(Qe, { secondary: !0, className: "ds-step-indicator__counter", children: [
|
|
2470
|
+
s + 1,
|
|
2471
|
+
" / ",
|
|
2472
|
+
t
|
|
2473
|
+
] })
|
|
2474
|
+
] });
|
|
2475
|
+
}
|
|
2476
|
+
function un({
|
|
2477
|
+
content: t,
|
|
2478
|
+
isStreaming: s = !1,
|
|
2479
|
+
cursor: n = "line",
|
|
2480
|
+
onChunk: r,
|
|
2481
|
+
className: a = "",
|
|
2482
|
+
...o
|
|
2483
|
+
}) {
|
|
2484
|
+
const i = R(t);
|
|
2485
|
+
return P(() => {
|
|
2486
|
+
t !== i.current && (r == null || r(t), i.current = t);
|
|
2487
|
+
}, [t, r]), /* @__PURE__ */ e.jsxs("span", { className: ["ds-streaming-text", a].filter(Boolean).join(" "), ...o, children: [
|
|
2488
|
+
t,
|
|
2489
|
+
s && n !== "none" && /* @__PURE__ */ e.jsx("span", { className: `ds-cursor ds-cursor--${n}`, "aria-hidden": "true" })
|
|
2490
|
+
] });
|
|
2491
|
+
}
|
|
2492
|
+
function fn({
|
|
2493
|
+
role: t = "assistant",
|
|
2494
|
+
header: s,
|
|
2495
|
+
footer: n,
|
|
2496
|
+
attachments: r,
|
|
2497
|
+
isStreaming: a = !1,
|
|
2498
|
+
children: o,
|
|
2499
|
+
className: i = "",
|
|
2500
|
+
...l
|
|
2501
|
+
}) {
|
|
2502
|
+
const c = [
|
|
2503
|
+
"ds-chat-message",
|
|
2504
|
+
`ds-chat-message--${t}`,
|
|
2505
|
+
a && "ds-chat-message--streaming",
|
|
2506
|
+
i
|
|
2507
|
+
].filter(Boolean).join(" ");
|
|
2508
|
+
return t === "system" ? /* @__PURE__ */ e.jsx("div", { className: c, ...l, children: /* @__PURE__ */ e.jsx("span", { className: "ds-chat-message__system-label", children: o }) }) : t === "user" ? /* @__PURE__ */ e.jsxs("div", { className: c, ...l, children: [
|
|
2509
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__attachments", children: r }),
|
|
2510
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__bubble", children: o }),
|
|
2511
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__footer", children: n })
|
|
2512
|
+
] }) : /* @__PURE__ */ e.jsxs("div", { className: c, ...l, children: [
|
|
2513
|
+
s && /* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__header", children: s }),
|
|
2514
|
+
r && /* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__attachments", children: r }),
|
|
2515
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__body", children: o }),
|
|
2516
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "ds-chat-message__footer", children: n })
|
|
2517
|
+
] });
|
|
2518
|
+
}
|
|
2519
|
+
function mn(t, { containerRef: s, smartPause: n = !0 } = {}) {
|
|
2520
|
+
const r = R(!1), a = R(0);
|
|
2521
|
+
P(() => {
|
|
2522
|
+
const o = s == null ? void 0 : s.current;
|
|
2523
|
+
if (!o) return;
|
|
2524
|
+
const i = () => {
|
|
2525
|
+
const l = o.scrollHeight - o.scrollTop - o.clientHeight < 64;
|
|
2526
|
+
!l && o.scrollTop < a.current && (r.current = !0), l && (r.current = !1), a.current = o.scrollTop;
|
|
2527
|
+
};
|
|
2528
|
+
return o.addEventListener("scroll", i, { passive: !0 }), () => o.removeEventListener("scroll", i);
|
|
2529
|
+
}, [s]), P(() => {
|
|
2530
|
+
const o = s == null ? void 0 : s.current;
|
|
2531
|
+
o && (n && r.current || (o.scrollTop = o.scrollHeight));
|
|
2532
|
+
}, t);
|
|
2533
|
+
}
|
|
2534
|
+
function Ht({
|
|
2535
|
+
prompts: t,
|
|
2536
|
+
enabled: s,
|
|
2537
|
+
typingSpeed: n = 38,
|
|
2538
|
+
erasingSpeed: r = 18,
|
|
2539
|
+
holdTime: a = 2200,
|
|
2540
|
+
betweenTime: o = 380,
|
|
2541
|
+
manualPauseMs: i = 5e3
|
|
2542
|
+
}) {
|
|
2543
|
+
const [l, c] = B(0), [d, u] = B(""), m = R("typing"), x = R(0), p = R(0), h = R(null), w = R(0);
|
|
2544
|
+
P(() => {
|
|
2545
|
+
p.current = l;
|
|
2546
|
+
}, [l]), P(() => {
|
|
2547
|
+
if (h.current && (clearTimeout(h.current), h.current = null), !s || t.length === 0) {
|
|
2548
|
+
u(""), x.current = 0, m.current = "typing";
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
const y = () => {
|
|
2552
|
+
const S = Date.now();
|
|
2553
|
+
if (w.current > S) {
|
|
2554
|
+
h.current = setTimeout(y, w.current - S);
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
const D = t[p.current % t.length] ?? "";
|
|
2558
|
+
m.current === "typing" ? (x.current += 1, u(D.slice(0, x.current)), x.current >= D.length ? (m.current = "holding", h.current = setTimeout(y, a)) : h.current = setTimeout(y, n + Math.random() * 28)) : m.current === "holding" ? (m.current = "erasing", h.current = setTimeout(y, r)) : (x.current = Math.max(0, x.current - 1), u(D.slice(0, x.current)), x.current <= 0 ? (m.current = "typing", p.current = (p.current + 1) % t.length, c(p.current), h.current = setTimeout(y, o)) : h.current = setTimeout(y, r));
|
|
2559
|
+
};
|
|
2560
|
+
return h.current = setTimeout(y, 260), () => {
|
|
2561
|
+
h.current && clearTimeout(h.current);
|
|
2562
|
+
};
|
|
2563
|
+
}, [s, t, n, r, a, o]);
|
|
2564
|
+
const b = (y) => {
|
|
2565
|
+
if (t.length === 0) return;
|
|
2566
|
+
const S = (y % t.length + t.length) % t.length, D = t[S];
|
|
2567
|
+
p.current = S, x.current = D.length, m.current = "holding", w.current = Date.now() + i, c(S), u(D);
|
|
2568
|
+
}, $ = () => b(p.current + 1), N = () => b(p.current - 1), _ = t[l % t.length] ?? "";
|
|
2569
|
+
return { displayed: d, currentPrompt: _, index: l, next: $, prev: N };
|
|
2570
|
+
}
|
|
2571
|
+
let qt = 0;
|
|
2572
|
+
function pn({
|
|
2573
|
+
value: t = "",
|
|
2574
|
+
onChange: s,
|
|
2575
|
+
onSubmit: n,
|
|
2576
|
+
onStop: r,
|
|
2577
|
+
onKeyDown: a,
|
|
2578
|
+
loading: o = !1,
|
|
2579
|
+
disabled: i = !1,
|
|
2580
|
+
placeholder: l = "Let's get things done...",
|
|
2581
|
+
animatedPlaceholders: c,
|
|
2582
|
+
attachments: d,
|
|
2583
|
+
images: u,
|
|
2584
|
+
onAttachFiles: m,
|
|
2585
|
+
onAttachImages: x,
|
|
2586
|
+
onRemoveAttachment: p,
|
|
2587
|
+
onRemoveImage: h,
|
|
2588
|
+
acceptImage: w,
|
|
2589
|
+
acceptFile: b,
|
|
2590
|
+
maxImages: $,
|
|
2591
|
+
maxImageSize: N,
|
|
2592
|
+
leftSlot: _,
|
|
2593
|
+
rightSlot: y,
|
|
2594
|
+
className: S = "",
|
|
2595
|
+
...D
|
|
2596
|
+
}) {
|
|
2597
|
+
const M = R(null), W = R(null), z = R(0), [j, F] = B(!1), [K, V] = B([]), I = (g) => {
|
|
2598
|
+
const L = ++qt;
|
|
2599
|
+
V((X) => [...X, { id: L, msg: g }]), setTimeout(() => V((X) => X.filter((J) => J.id !== L)), 6e3);
|
|
2600
|
+
}, v = (g) => V((L) => L.filter((X) => X.id !== g)), k = (g) => g.type.startsWith("image/"), A = () => !0, U = w ?? k, G = b ?? A, E = (g) => {
|
|
2601
|
+
const L = [], X = [], J = [], Z = [];
|
|
2602
|
+
let se = 0, fe = $ != null ? $ - ((u == null ? void 0 : u.length) ?? 0) : 1 / 0;
|
|
2603
|
+
for (const ne of g)
|
|
2604
|
+
U(ne) ? N && ne.size > N ? J.push(ne.name) : fe > 0 ? (L.push(ne), fe--) : se++ : G(ne) ? X.push(ne) : Z.push(ne.name);
|
|
2605
|
+
return { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded: se };
|
|
2606
|
+
}, f = (g) => {
|
|
2607
|
+
const { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded: se } = E(g);
|
|
2608
|
+
J.length && I(`File${J.length > 1 ? "s" : ""} too large${N ? ` (max ${N / 1024 / 1024}MB)` : ""}: ${J.join(", ")}`), Z.length && I(`Skipped unsupported file${Z.length > 1 ? "s" : ""}: ${Z.join(", ")}`), se && I(`Max ${$} images per message`), x && L.length && x(L);
|
|
2609
|
+
const fe = X.concat(x ? [] : L);
|
|
2610
|
+
m && fe.length && m(fe);
|
|
2611
|
+
};
|
|
2612
|
+
P(() => {
|
|
2613
|
+
const g = W.current;
|
|
2614
|
+
g && (g.style.height = "auto", g.style.height = `${Math.min(g.scrollHeight, 200)}px`);
|
|
2615
|
+
}, [t]), P(() => {
|
|
2616
|
+
const g = (L) => {
|
|
2617
|
+
var J, Z, se;
|
|
2618
|
+
if (o || i) return;
|
|
2619
|
+
const X = (J = L.target) == null ? void 0 : J.tagName;
|
|
2620
|
+
X === "INPUT" || X === "TEXTAREA" || X === "SELECT" || (Z = L.target) != null && Z.isContentEditable || L.ctrlKey || L.metaKey || L.altKey || L.key.length !== 1 && L.key !== "Backspace" && L.key !== "Delete" || (se = W.current) == null || se.focus();
|
|
2621
|
+
};
|
|
2622
|
+
return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
|
|
2623
|
+
}, [o, i]);
|
|
2624
|
+
const T = (g) => {
|
|
2625
|
+
g.preventDefault(), z.current++, g.dataTransfer.types.includes("Files") && F(!0);
|
|
2626
|
+
}, O = (g) => {
|
|
2627
|
+
g.preventDefault(), z.current--, z.current === 0 && F(!1);
|
|
2628
|
+
}, Y = (g) => g.preventDefault(), te = (g) => {
|
|
2629
|
+
g.preventDefault(), z.current = 0, F(!1);
|
|
2630
|
+
const L = Array.from(g.dataTransfer.files);
|
|
2631
|
+
L.length && f(L);
|
|
2632
|
+
}, ie = (g) => {
|
|
2633
|
+
const L = Array.from(g.target.files || []);
|
|
2634
|
+
M.current && (M.current.value = ""), L.length && f(L);
|
|
2635
|
+
}, H = (g) => {
|
|
2636
|
+
var ne;
|
|
2637
|
+
if (!x) return;
|
|
2638
|
+
const L = (ne = g.clipboardData) == null ? void 0 : ne.items;
|
|
2639
|
+
if (!L) return;
|
|
2640
|
+
const X = [];
|
|
2641
|
+
for (const st of L) {
|
|
2642
|
+
const Me = st.getAsFile();
|
|
2643
|
+
Me && X.push(Me);
|
|
2644
|
+
}
|
|
2645
|
+
if (X.length === 0) return;
|
|
2646
|
+
const { imageFiles: J, tooLarge: Z, skipped: se, limitExceeded: fe } = E(X);
|
|
2647
|
+
Z.length && I(`File${Z.length > 1 ? "s" : ""} too large: ${Z.join(", ")}`), se.length && I(`Skipped unsupported file${se.length > 1 ? "s" : ""}: ${se.join(", ")}`), fe && I(`Max ${$} images per message`), J.length && (g.preventDefault(), x(J));
|
|
2648
|
+
}, Q = !o && !i && !!(c != null && c.length) && t.length === 0, le = Ht({
|
|
2649
|
+
prompts: c ?? [],
|
|
2650
|
+
enabled: Q
|
|
2651
|
+
}), ge = (g) => {
|
|
2652
|
+
if (Q) {
|
|
2653
|
+
if (g.key === "ArrowDown" || g.key === "ArrowRight") {
|
|
2654
|
+
g.preventDefault(), le.next();
|
|
2655
|
+
return;
|
|
2656
|
+
}
|
|
2657
|
+
if (g.key === "ArrowUp" || g.key === "ArrowLeft") {
|
|
2658
|
+
g.preventDefault(), le.prev();
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
if (g.key === "Tab" && !g.shiftKey) {
|
|
2662
|
+
g.preventDefault(), s == null || s(le.currentPrompt);
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
a == null || a(g);
|
|
2667
|
+
}, tt = (t.trim() || (u == null ? void 0 : u.length) > 0 || (d == null ? void 0 : d.length) > 0) && !i, Pe = m || x;
|
|
2668
|
+
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-prompt-input", S].filter(Boolean).join(" "), ...D, children: [
|
|
2669
|
+
Pe && /* @__PURE__ */ e.jsx(
|
|
2670
|
+
"input",
|
|
2671
|
+
{
|
|
2672
|
+
ref: M,
|
|
2673
|
+
type: "file",
|
|
2674
|
+
multiple: !0,
|
|
2675
|
+
accept: "*/*",
|
|
2676
|
+
className: "ds-prompt-input__file-input",
|
|
2677
|
+
onChange: ie
|
|
2678
|
+
}
|
|
2679
|
+
),
|
|
2680
|
+
/* @__PURE__ */ e.jsxs(
|
|
2681
|
+
"div",
|
|
2682
|
+
{
|
|
2683
|
+
className: ["ds-prompt-input__box", j && "ds-prompt-input__box--dragging"].filter(Boolean).join(" "),
|
|
2684
|
+
onDragEnter: T,
|
|
2685
|
+
onDragLeave: O,
|
|
2686
|
+
onDragOver: Y,
|
|
2687
|
+
onDrop: te,
|
|
2688
|
+
children: [
|
|
2689
|
+
j && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__drag-overlay", children: "Drop files here" }),
|
|
2690
|
+
/* @__PURE__ */ e.jsx(
|
|
2691
|
+
"textarea",
|
|
2692
|
+
{
|
|
2693
|
+
ref: W,
|
|
2694
|
+
value: t,
|
|
2695
|
+
onChange: (g) => s == null ? void 0 : s(g.target.value),
|
|
2696
|
+
onKeyDown: ge,
|
|
2697
|
+
onPaste: H,
|
|
2698
|
+
placeholder: Q ? "" : l,
|
|
2699
|
+
disabled: o || i,
|
|
2700
|
+
rows: 1,
|
|
2701
|
+
className: ["ds-prompt-input__textarea", Q && "ds-prompt-input__textarea--anim"].filter(Boolean).join(" ")
|
|
2702
|
+
}
|
|
2703
|
+
),
|
|
2704
|
+
Q && /* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__anim", "aria-hidden": "true", children: [
|
|
2705
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__anim-text", children: le.displayed }),
|
|
2706
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__anim-cursor" })
|
|
2707
|
+
] }),
|
|
2708
|
+
u && u.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__images", children: u.map((g, L) => /* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__image-thumb", children: [
|
|
2709
|
+
/* @__PURE__ */ e.jsx("img", { src: g.preview, alt: "" }),
|
|
2710
|
+
/* @__PURE__ */ e.jsx(
|
|
2711
|
+
"button",
|
|
2712
|
+
{
|
|
2713
|
+
className: "ds-prompt-input__image-remove",
|
|
2714
|
+
onClick: () => h == null ? void 0 : h(L),
|
|
2715
|
+
"aria-label": "Remove image",
|
|
2716
|
+
type: "button",
|
|
2717
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: 12, strokeWidth: 2 })
|
|
2718
|
+
}
|
|
2719
|
+
)
|
|
2720
|
+
] }, L)) }),
|
|
2721
|
+
K.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__warnings", children: K.map((g) => /* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__warning", role: "alert", children: [
|
|
2722
|
+
/* @__PURE__ */ e.jsx("span", { children: g.msg }),
|
|
2723
|
+
/* @__PURE__ */ e.jsx(
|
|
2724
|
+
"button",
|
|
2725
|
+
{
|
|
2726
|
+
type: "button",
|
|
2727
|
+
className: "ds-prompt-input__warning-close",
|
|
2728
|
+
onClick: () => v(g.id),
|
|
2729
|
+
"aria-label": "Dismiss",
|
|
2730
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: C[1], strokeWidth: 1.5 })
|
|
2731
|
+
}
|
|
2732
|
+
)
|
|
2733
|
+
] }, g.id)) }),
|
|
2734
|
+
d && d.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__attachments", children: d.map((g, L) => /* @__PURE__ */ e.jsx(pe, { size: "xs", children: /* @__PURE__ */ e.jsxs("span", { className: "ds-prompt-input__badge-content", children: [
|
|
2735
|
+
g.uploading ? /* @__PURE__ */ e.jsx(ft, { size: C[1], strokeWidth: 1.5, className: "spin" }) : /* @__PURE__ */ e.jsx(ze, { size: C[1], strokeWidth: 1.5 }),
|
|
2736
|
+
g.filename,
|
|
2737
|
+
g.uploading ? /* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__uploading", children: "Uploading..." }) : /* @__PURE__ */ e.jsx(
|
|
2738
|
+
"button",
|
|
2739
|
+
{
|
|
2740
|
+
type: "button",
|
|
2741
|
+
className: "ds-prompt-input__remove-btn",
|
|
2742
|
+
onClick: () => p == null ? void 0 : p(L),
|
|
2743
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: C[1], strokeWidth: 1.5 })
|
|
2744
|
+
}
|
|
2745
|
+
)
|
|
2746
|
+
] }) }, L)) }),
|
|
2747
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__toolbar", children: [
|
|
2748
|
+
Pe && /* @__PURE__ */ e.jsx(
|
|
2749
|
+
oe,
|
|
2750
|
+
{
|
|
2751
|
+
variant: "ghost",
|
|
2752
|
+
size: "xs",
|
|
2753
|
+
icon: /* @__PURE__ */ e.jsx(ze, { size: C[2], strokeWidth: 1.5 }),
|
|
2754
|
+
"aria-label": "Attach files",
|
|
2755
|
+
onClick: () => {
|
|
2756
|
+
var g;
|
|
2757
|
+
return (g = M.current) == null ? void 0 : g.click();
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
),
|
|
2761
|
+
_,
|
|
2762
|
+
y,
|
|
2763
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__spacer" }),
|
|
2764
|
+
o ? /* @__PURE__ */ e.jsx(
|
|
2765
|
+
oe,
|
|
2766
|
+
{
|
|
2767
|
+
variant: "primary",
|
|
2768
|
+
size: "xs",
|
|
2769
|
+
icon: /* @__PURE__ */ e.jsx(mt, { size: C[2], strokeWidth: 1.5 }),
|
|
2770
|
+
onClick: r,
|
|
2771
|
+
"aria-label": "Stop"
|
|
2772
|
+
}
|
|
2773
|
+
) : /* @__PURE__ */ e.jsx(
|
|
2774
|
+
oe,
|
|
2775
|
+
{
|
|
2776
|
+
variant: "primary",
|
|
2777
|
+
size: "xs",
|
|
2778
|
+
icon: /* @__PURE__ */ e.jsx(pt, { size: C[2], strokeWidth: 1.5 }),
|
|
2779
|
+
onClick: n,
|
|
2780
|
+
disabled: !tt,
|
|
2781
|
+
"aria-label": "Send"
|
|
2782
|
+
}
|
|
2783
|
+
)
|
|
2784
|
+
] })
|
|
2785
|
+
]
|
|
2786
|
+
}
|
|
2787
|
+
)
|
|
2788
|
+
] });
|
|
2789
|
+
}
|
|
2790
|
+
const qe = { fast: 0, standard: 1, premium: 2 }, Ge = { fast: "data-5", standard: "data-3", premium: "data-6" };
|
|
2791
|
+
function hn({
|
|
2792
|
+
models: t = [],
|
|
2793
|
+
value: s,
|
|
2794
|
+
onChange: n,
|
|
2795
|
+
size: r = "xs",
|
|
2796
|
+
minTier: a,
|
|
2797
|
+
showAutoOption: o = !1,
|
|
2798
|
+
groupByTier: i = !0,
|
|
2799
|
+
className: l = "",
|
|
2800
|
+
...c
|
|
2801
|
+
}) {
|
|
2802
|
+
const [d, u] = B(!1), m = R(null), x = R(null), p = R(null), [h, w] = B({}), b = t.filter((j) => !a || j.name === "auto" ? !0 : (qe[j.tier] ?? 1) >= (qe[a] ?? 1)), $ = b.find((j) => j.name === "auto"), N = b.filter((j) => j.name !== "auto"), _ = t.find((j) => j.name === s), S = new Set(N.map((j) => j.tier).filter(Boolean)).size > 1;
|
|
2803
|
+
P(() => {
|
|
2804
|
+
if (!d) return;
|
|
2805
|
+
const j = 320, F = () => {
|
|
2806
|
+
var A;
|
|
2807
|
+
const I = (A = x.current) == null ? void 0 : A.getBoundingClientRect();
|
|
2808
|
+
if (!I) return;
|
|
2809
|
+
const v = window.innerHeight - I.bottom, k = v < j + 8 && I.top > v;
|
|
2810
|
+
w({
|
|
2811
|
+
position: "fixed",
|
|
2812
|
+
zIndex: "var(--z-dropdown, 500)",
|
|
2813
|
+
left: I.left,
|
|
2814
|
+
...k ? { bottom: window.innerHeight - I.top + 4, top: "auto" } : { top: I.bottom + 4, bottom: "auto" }
|
|
2815
|
+
});
|
|
2816
|
+
};
|
|
2817
|
+
F(), window.addEventListener("scroll", F, !0), window.addEventListener("resize", F);
|
|
2818
|
+
const K = (I) => {
|
|
2819
|
+
var v, k;
|
|
2820
|
+
!((v = m.current) != null && v.contains(I.target)) && !((k = p.current) != null && k.contains(I.target)) && u(!1);
|
|
2821
|
+
}, V = (I) => {
|
|
2822
|
+
I.key === "Escape" && u(!1);
|
|
2823
|
+
};
|
|
2824
|
+
return document.addEventListener("mousedown", K), document.addEventListener("keydown", V), () => {
|
|
2825
|
+
window.removeEventListener("scroll", F, !0), window.removeEventListener("resize", F), document.removeEventListener("mousedown", K), document.removeEventListener("keydown", V);
|
|
2826
|
+
};
|
|
2827
|
+
}, [d]);
|
|
2828
|
+
const D = (j) => {
|
|
2829
|
+
n == null || n(j), u(!1);
|
|
2830
|
+
}, M = (j) => /* @__PURE__ */ e.jsxs(
|
|
2831
|
+
"button",
|
|
2832
|
+
{
|
|
2833
|
+
type: "button",
|
|
2834
|
+
className: [
|
|
2835
|
+
"ds-model-picker__item",
|
|
2836
|
+
j.name === s && "ds-model-picker__item--active"
|
|
2837
|
+
].filter(Boolean).join(" "),
|
|
2838
|
+
onClick: () => D(j.name),
|
|
2839
|
+
children: [
|
|
2840
|
+
j.icon ? /* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-icon", children: j.icon }) : /* @__PURE__ */ e.jsx(Fe, { size: 12, strokeWidth: 1.5, className: "ds-model-picker__item-icon" }),
|
|
2841
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children: j.displayName || j.name }),
|
|
2842
|
+
S && j.tier && /* @__PURE__ */ e.jsx(pe, { size: "xs", variant: Ge[j.tier] || "default", children: j.tier })
|
|
2843
|
+
]
|
|
2844
|
+
},
|
|
2845
|
+
j.name
|
|
2846
|
+
), W = () => !i || !S ? N.map(M) : ["fast", "standard", "premium"].flatMap((j) => {
|
|
2847
|
+
const F = N.filter((K) => K.tier === j);
|
|
2848
|
+
return F.length ? [
|
|
2849
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__group-label", "data-tier": j, children: j.charAt(0).toUpperCase() + j.slice(1) }, `lbl-${j}`),
|
|
2850
|
+
...F.map(M)
|
|
2851
|
+
] : [];
|
|
2852
|
+
}), z = d && /* @__PURE__ */ e.jsxs("div", { ref: p, className: "ds-model-picker__menu ds-scrollable", "data-ds-portal": "", style: h, children: [
|
|
2853
|
+
o && $ && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2854
|
+
/* @__PURE__ */ e.jsxs(
|
|
2855
|
+
"button",
|
|
2856
|
+
{
|
|
2857
|
+
type: "button",
|
|
2858
|
+
className: [
|
|
2859
|
+
"ds-model-picker__item",
|
|
2860
|
+
"ds-model-picker__item--auto",
|
|
2861
|
+
s === "auto" && "ds-model-picker__item--active"
|
|
2862
|
+
].filter(Boolean).join(" "),
|
|
2863
|
+
onClick: () => D("auto"),
|
|
2864
|
+
children: [
|
|
2865
|
+
/* @__PURE__ */ e.jsx(ht, { size: 12, strokeWidth: 1.5, className: "ds-model-picker__item-icon" }),
|
|
2866
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children: "Auto (smart routing)" })
|
|
2867
|
+
]
|
|
2868
|
+
}
|
|
2869
|
+
),
|
|
2870
|
+
N.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__separator" })
|
|
2871
|
+
] }),
|
|
2872
|
+
W()
|
|
2873
|
+
] });
|
|
2874
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2875
|
+
"div",
|
|
2876
|
+
{
|
|
2877
|
+
ref: m,
|
|
2878
|
+
className: ["ds-model-picker", l].filter(Boolean).join(" "),
|
|
2879
|
+
...c,
|
|
2880
|
+
children: [
|
|
2881
|
+
/* @__PURE__ */ e.jsxs(
|
|
2882
|
+
"button",
|
|
2883
|
+
{
|
|
2884
|
+
ref: x,
|
|
2885
|
+
type: "button",
|
|
2886
|
+
className: "ds-model-picker__trigger",
|
|
2887
|
+
onClick: () => u((j) => !j),
|
|
2888
|
+
"aria-haspopup": "listbox",
|
|
2889
|
+
"aria-expanded": d,
|
|
2890
|
+
children: [
|
|
2891
|
+
_ != null && _.icon ? /* @__PURE__ */ e.jsx("span", { children: _.icon }) : /* @__PURE__ */ e.jsx(Fe, { size: 12, strokeWidth: 1.5 }),
|
|
2892
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__trigger-name", children: (_ == null ? void 0 : _.displayName) || (_ == null ? void 0 : _.name) || s }),
|
|
2893
|
+
S && (_ == null ? void 0 : _.tier) && /* @__PURE__ */ e.jsx(pe, { size: "xs", variant: Ge[_.tier] || "default", children: _.tier })
|
|
2894
|
+
]
|
|
2895
|
+
}
|
|
2896
|
+
),
|
|
2897
|
+
typeof document < "u" && re.createPortal(z, document.body)
|
|
2898
|
+
]
|
|
2899
|
+
}
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
const Gt = ({ filename: t, pages: s }) => /* @__PURE__ */ e.jsxs("span", { style: { display: "flex", alignItems: "center", gap: "var(--space-2)", minWidth: 0 }, children: [
|
|
2903
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__filename", children: t }),
|
|
2904
|
+
s.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__pages", children: Te(s) })
|
|
2905
|
+
] });
|
|
2906
|
+
function Te(t) {
|
|
2907
|
+
return t != null && t.length ? "p. " + t.join(", ") : null;
|
|
2908
|
+
}
|
|
2909
|
+
function Kt(t) {
|
|
2910
|
+
const s = /* @__PURE__ */ new Map();
|
|
2911
|
+
for (const n of t)
|
|
2912
|
+
s.has(n.filename) || s.set(n.filename, { filename: n.filename, url: n.url, items: [] }), s.get(n.filename).items.push(n);
|
|
2913
|
+
return [...s.values()];
|
|
2914
|
+
}
|
|
2915
|
+
function xn({
|
|
2916
|
+
sources: t = [],
|
|
2917
|
+
layout: s = "list",
|
|
2918
|
+
title: n = "Sources",
|
|
2919
|
+
maxVisible: r = 5,
|
|
2920
|
+
onSourceClick: a
|
|
2921
|
+
}) {
|
|
2922
|
+
const [o, i] = B(!1), l = Kt(t), c = l.length > r, d = o ? l : l.slice(0, r), u = t.some((x) => x.snippet), m = ["ds-sources-panel", s === "compact" && "ds-sources-panel--compact"].filter(Boolean).join(" ");
|
|
2923
|
+
return s === "compact" ? /* @__PURE__ */ e.jsxs("div", { className: m, children: [
|
|
2924
|
+
d.map((x) => {
|
|
2925
|
+
const p = x.items.map((w) => w.page).filter(Boolean), h = !!a;
|
|
2926
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2927
|
+
"div",
|
|
2928
|
+
{
|
|
2929
|
+
className: `ds-sources-panel__compact-row${h ? " ds-sources-panel__compact-row--clickable" : ""}`,
|
|
2930
|
+
onClick: h ? () => a(x.items[0]) : void 0,
|
|
2931
|
+
children: [
|
|
2932
|
+
/* @__PURE__ */ e.jsx(xt, { size: C[1], strokeWidth: 1.5, className: "ds-sources-panel__compact-icon" }),
|
|
2933
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__filename", children: x.filename }),
|
|
2934
|
+
p.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__pages", children: Te(p) })
|
|
2935
|
+
]
|
|
2936
|
+
},
|
|
2937
|
+
x.filename
|
|
2938
|
+
);
|
|
2939
|
+
}),
|
|
2940
|
+
c && !o && /* @__PURE__ */ e.jsxs("button", { className: "ds-sources-panel__more", onClick: () => i(!0), children: [
|
|
2941
|
+
"+",
|
|
2942
|
+
l.length - r,
|
|
2943
|
+
" more sources"
|
|
2944
|
+
] })
|
|
2945
|
+
] }) : /* @__PURE__ */ e.jsxs("div", { className: m, children: [
|
|
2946
|
+
n && /* @__PURE__ */ e.jsx("div", { className: "ds-sources-panel__title", children: n }),
|
|
2947
|
+
d.map((x) => {
|
|
2948
|
+
const p = x.items.map((w) => w.page).filter(Boolean), h = !!a;
|
|
2949
|
+
return u ? /* @__PURE__ */ e.jsx(
|
|
2950
|
+
Be,
|
|
2951
|
+
{
|
|
2952
|
+
title: /* @__PURE__ */ e.jsx(Gt, { filename: x.filename, pages: p }),
|
|
2953
|
+
padding: "s",
|
|
2954
|
+
children: x.items.map((w, b) => /* @__PURE__ */ e.jsx(
|
|
2955
|
+
"div",
|
|
2956
|
+
{
|
|
2957
|
+
className: `ds-sources-panel__snippet${h ? " ds-sources-panel__snippet--clickable" : ""}`,
|
|
2958
|
+
onClick: h ? () => a(w) : void 0,
|
|
2959
|
+
children: w.snippet ?? `p. ${w.page}`
|
|
2960
|
+
},
|
|
2961
|
+
b
|
|
2962
|
+
))
|
|
2963
|
+
},
|
|
2964
|
+
x.filename
|
|
2965
|
+
) : /* @__PURE__ */ e.jsxs(
|
|
2966
|
+
"div",
|
|
2967
|
+
{
|
|
2968
|
+
className: `ds-sources-panel__row${h ? " ds-sources-panel__row--clickable" : ""}`,
|
|
2969
|
+
onClick: h ? () => a(x.items[0]) : void 0,
|
|
2970
|
+
children: [
|
|
2971
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__filename", children: x.filename }),
|
|
2972
|
+
p.length > 0 && /* @__PURE__ */ e.jsx("span", { className: "ds-sources-panel__pages", children: Te(p) })
|
|
2973
|
+
]
|
|
2974
|
+
},
|
|
2975
|
+
x.filename
|
|
2976
|
+
);
|
|
2977
|
+
}),
|
|
2978
|
+
c && !o && /* @__PURE__ */ e.jsxs("button", { className: "ds-sources-panel__more", onClick: () => i(!0), children: [
|
|
2979
|
+
"+",
|
|
2980
|
+
l.length - r,
|
|
2981
|
+
" more sources"
|
|
2982
|
+
] })
|
|
2983
|
+
] });
|
|
2984
|
+
}
|
|
2985
|
+
function Ke(t) {
|
|
2986
|
+
return t >= 1e6 ? (t / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : t >= 1e3 ? (t / 1e3).toFixed(1).replace(/\.0$/, "") + "K" : String(t);
|
|
2987
|
+
}
|
|
2988
|
+
function vn({
|
|
2989
|
+
used: t,
|
|
2990
|
+
limit: s,
|
|
2991
|
+
size: n = "s",
|
|
2992
|
+
showCount: r = !0,
|
|
2993
|
+
showPercent: a = !1,
|
|
2994
|
+
warningThreshold: o = 0.8,
|
|
2995
|
+
errorThreshold: i = 1
|
|
2996
|
+
}) {
|
|
2997
|
+
const l = s > 0 ? t / s : 0, c = Math.min(l * 100, 100), d = l >= i ? "error" : l >= o ? "warning" : "normal";
|
|
2998
|
+
return /* @__PURE__ */ e.jsxs(
|
|
2999
|
+
"div",
|
|
3000
|
+
{
|
|
3001
|
+
className: `ds-token-counter ds-token-counter--${n}`,
|
|
3002
|
+
role: "meter",
|
|
3003
|
+
"aria-valuenow": t,
|
|
3004
|
+
"aria-valuemax": s,
|
|
3005
|
+
children: [
|
|
3006
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-token-counter__track", children: /* @__PURE__ */ e.jsx(
|
|
3007
|
+
"div",
|
|
3008
|
+
{
|
|
3009
|
+
className: `ds-token-counter__fill ds-token-counter__fill--${d}`,
|
|
3010
|
+
style: { width: `${c}%` }
|
|
3011
|
+
}
|
|
3012
|
+
) }),
|
|
3013
|
+
(r || a) && /* @__PURE__ */ e.jsxs("div", { className: `ds-token-counter__label ds-token-counter__label--${d}`, children: [
|
|
3014
|
+
r && /* @__PURE__ */ e.jsxs("span", { children: [
|
|
3015
|
+
Ke(t),
|
|
3016
|
+
" / ",
|
|
3017
|
+
Ke(s)
|
|
3018
|
+
] }),
|
|
3019
|
+
a && /* @__PURE__ */ e.jsxs("span", { style: { marginLeft: "auto" }, children: [
|
|
3020
|
+
Math.round(l * 100),
|
|
3021
|
+
"%"
|
|
3022
|
+
] })
|
|
3023
|
+
] })
|
|
3024
|
+
]
|
|
3025
|
+
}
|
|
3026
|
+
);
|
|
3027
|
+
}
|
|
3028
|
+
const Xe = 5;
|
|
3029
|
+
function Xt(t) {
|
|
3030
|
+
return t < 0.34 ? "low" : t < 0.67 ? "medium" : "high";
|
|
3031
|
+
}
|
|
3032
|
+
function _n({
|
|
3033
|
+
value: t = 0,
|
|
3034
|
+
size: s = "xs",
|
|
3035
|
+
showLabel: n = "none",
|
|
3036
|
+
layout: r = "inline"
|
|
3037
|
+
}) {
|
|
3038
|
+
const a = Math.max(0, Math.min(1, t)), o = Math.round(a * Xe), i = Xt(a);
|
|
3039
|
+
return /* @__PURE__ */ e.jsxs("div", { className: [
|
|
3040
|
+
"ds-confidence-bar",
|
|
3041
|
+
`ds-confidence-bar--${s}`,
|
|
3042
|
+
`ds-confidence-bar--${i}`,
|
|
3043
|
+
r === "block" && "ds-confidence-bar--block"
|
|
3044
|
+
].filter(Boolean).join(" "), children: [
|
|
3045
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-confidence-bar__segments", "aria-hidden": "true", children: Array.from({ length: Xe }, (l, c) => /* @__PURE__ */ e.jsx(
|
|
3046
|
+
"div",
|
|
3047
|
+
{
|
|
3048
|
+
className: `ds-confidence-bar__seg${c < o ? " ds-confidence-bar__seg--filled" : ""}`
|
|
3049
|
+
},
|
|
3050
|
+
c
|
|
3051
|
+
)) }),
|
|
3052
|
+
n === "text" && /* @__PURE__ */ e.jsx("span", { className: "ds-confidence-bar__label", children: i })
|
|
3053
|
+
] });
|
|
3054
|
+
}
|
|
3055
|
+
const Jt = { add: "+", remove: "-", context: " " };
|
|
3056
|
+
function ye({ line: t, lineNumbers: s }) {
|
|
3057
|
+
return /* @__PURE__ */ e.jsxs("div", { className: `ds-diff-view__line ds-diff-view__line--${t.type}`, children: [
|
|
3058
|
+
s && t.lineNo != null && /* @__PURE__ */ e.jsx("span", { className: "ds-diff-view__lineno", children: t.lineNo }),
|
|
3059
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-diff-view__prefix", children: Jt[t.type] }),
|
|
3060
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-diff-view__text", children: t.text })
|
|
3061
|
+
] });
|
|
3062
|
+
}
|
|
3063
|
+
function bn({
|
|
3064
|
+
lines: t = [],
|
|
3065
|
+
layout: s = "inline",
|
|
3066
|
+
wordWrap: n = !1,
|
|
3067
|
+
lineNumbers: r = !0,
|
|
3068
|
+
maxHeight: a,
|
|
3069
|
+
title: o
|
|
3070
|
+
}) {
|
|
3071
|
+
const i = [
|
|
3072
|
+
"ds-diff-view",
|
|
3073
|
+
`ds-diff-view--${s}`,
|
|
3074
|
+
n && "ds-diff-view--wrap"
|
|
3075
|
+
].filter(Boolean).join(" "), l = a ? { maxHeight: a, overflowY: "auto" } : void 0;
|
|
3076
|
+
if (s === "split") {
|
|
3077
|
+
const c = t.filter((u) => u.type === "remove" || u.type === "context"), d = t.filter((u) => u.type === "add" || u.type === "context");
|
|
3078
|
+
return /* @__PURE__ */ e.jsxs("div", { className: i, children: [
|
|
3079
|
+
o && /* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__title", children: o }),
|
|
3080
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-diff-view__body ds-scrollable", style: l, children: [
|
|
3081
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: c.map((u, m) => /* @__PURE__ */ e.jsx(ye, { line: u, lineNumbers: r }, m)) }),
|
|
3082
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: d.map((u, m) => /* @__PURE__ */ e.jsx(ye, { line: u, lineNumbers: r }, m)) })
|
|
3083
|
+
] })
|
|
3084
|
+
] });
|
|
3085
|
+
}
|
|
3086
|
+
return /* @__PURE__ */ e.jsxs("div", { className: i, children: [
|
|
3087
|
+
o && /* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__title", children: o }),
|
|
3088
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__body ds-scrollable", style: l, children: t.map((c, d) => /* @__PURE__ */ e.jsx(ye, { line: c, lineNumbers: r }, d)) })
|
|
3089
|
+
] });
|
|
3090
|
+
}
|
|
3091
|
+
function Zt({
|
|
3092
|
+
value: t = "idle",
|
|
3093
|
+
onLike: s,
|
|
3094
|
+
onDislike: n,
|
|
3095
|
+
className: r = "",
|
|
3096
|
+
...a
|
|
3097
|
+
}) {
|
|
3098
|
+
const o = t !== "idle";
|
|
3099
|
+
return /* @__PURE__ */ e.jsxs(
|
|
3100
|
+
"div",
|
|
3101
|
+
{
|
|
3102
|
+
className: [
|
|
3103
|
+
"ds-message-feedback",
|
|
3104
|
+
o && "ds-message-feedback--voted",
|
|
3105
|
+
r
|
|
3106
|
+
].filter(Boolean).join(" "),
|
|
3107
|
+
...a,
|
|
3108
|
+
children: [
|
|
3109
|
+
(!o || t === "liked") && /* @__PURE__ */ e.jsx(
|
|
3110
|
+
"button",
|
|
3111
|
+
{
|
|
3112
|
+
className: [
|
|
3113
|
+
"ds-message-feedback__btn",
|
|
3114
|
+
t === "liked" && "ds-message-feedback__btn--liked"
|
|
3115
|
+
].filter(Boolean).join(" "),
|
|
3116
|
+
onClick: s,
|
|
3117
|
+
disabled: o,
|
|
3118
|
+
"aria-label": "Like",
|
|
3119
|
+
"aria-pressed": t === "liked",
|
|
3120
|
+
children: /* @__PURE__ */ e.jsx(
|
|
3121
|
+
vt,
|
|
3122
|
+
{
|
|
3123
|
+
size: C[1],
|
|
3124
|
+
strokeWidth: 1.5,
|
|
3125
|
+
fill: t === "liked" ? "currentColor" : "none"
|
|
3126
|
+
}
|
|
3127
|
+
)
|
|
3128
|
+
}
|
|
3129
|
+
),
|
|
3130
|
+
(!o || t === "disliked") && /* @__PURE__ */ e.jsx(
|
|
3131
|
+
"button",
|
|
3132
|
+
{
|
|
3133
|
+
className: [
|
|
3134
|
+
"ds-message-feedback__btn",
|
|
3135
|
+
t === "disliked" && "ds-message-feedback__btn--disliked"
|
|
3136
|
+
].filter(Boolean).join(" "),
|
|
3137
|
+
onClick: n,
|
|
3138
|
+
disabled: o,
|
|
3139
|
+
"aria-label": "Dislike",
|
|
3140
|
+
"aria-pressed": t === "disliked",
|
|
3141
|
+
children: /* @__PURE__ */ e.jsx(
|
|
3142
|
+
_t,
|
|
3143
|
+
{
|
|
3144
|
+
size: C[1],
|
|
3145
|
+
strokeWidth: 1.5,
|
|
3146
|
+
fill: t === "disliked" ? "currentColor" : "none"
|
|
3147
|
+
}
|
|
3148
|
+
)
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
]
|
|
3152
|
+
}
|
|
3153
|
+
);
|
|
3154
|
+
}
|
|
3155
|
+
function Qt(t) {
|
|
3156
|
+
const s = t instanceof Date ? t : new Date(t);
|
|
3157
|
+
if (isNaN(s)) return null;
|
|
3158
|
+
const n = /* @__PURE__ */ new Date(), r = s.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: !1 }), a = new Date(n.getFullYear(), n.getMonth(), n.getDate()), o = new Date(a - 864e5);
|
|
3159
|
+
if (s >= a) return r;
|
|
3160
|
+
if (s >= o) return `Yesterday ${r}`;
|
|
3161
|
+
const i = s.getDate(), l = s.toLocaleString([], { month: "short" });
|
|
3162
|
+
return `${i} ${l} ${r}`;
|
|
3163
|
+
}
|
|
3164
|
+
function jn({
|
|
3165
|
+
role: t = "assistant",
|
|
3166
|
+
text: s,
|
|
3167
|
+
timestamp: n,
|
|
3168
|
+
feedbackValue: r = "idle",
|
|
3169
|
+
onLike: a,
|
|
3170
|
+
onDislike: o,
|
|
3171
|
+
className: i = "",
|
|
3172
|
+
...l
|
|
3173
|
+
}) {
|
|
3174
|
+
const c = t === "assistant" && (a || o), d = !!s, u = n ? Qt(n) : null;
|
|
3175
|
+
return !c && !d && !u ? null : /* @__PURE__ */ e.jsxs(
|
|
3176
|
+
"div",
|
|
3177
|
+
{
|
|
3178
|
+
className: ["ds-message-footer", `ds-message-footer--${t}`, i].filter(Boolean).join(" "),
|
|
3179
|
+
...l,
|
|
3180
|
+
children: [
|
|
3181
|
+
t === "user" && u && /* @__PURE__ */ e.jsx("span", { className: "ds-message-footer__timestamp ds-message-action", children: u }),
|
|
3182
|
+
c && /* @__PURE__ */ e.jsx(Zt, { className: "ds-message-action", value: r, onLike: a, onDislike: o }),
|
|
3183
|
+
d && /* @__PURE__ */ e.jsx(Yt, { className: "ds-message-action", text: s }),
|
|
3184
|
+
t === "assistant" && u && /* @__PURE__ */ e.jsx("span", { className: "ds-message-footer__timestamp ds-message-action", children: u })
|
|
3185
|
+
]
|
|
3186
|
+
}
|
|
3187
|
+
);
|
|
3188
|
+
}
|
|
3189
|
+
function Nn({ label: t, className: s = "", ...n }) {
|
|
3190
|
+
return /* @__PURE__ */ e.jsxs("span", { className: ["ds-thinking-dot", s].filter(Boolean).join(" "), ...n, children: [
|
|
3191
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-thinking-dot__pulse" }),
|
|
3192
|
+
t && /* @__PURE__ */ e.jsx("span", { className: "ds-thinking-dot__label", children: t })
|
|
3193
|
+
] });
|
|
3194
|
+
}
|
|
3195
|
+
function wn({ variant: t = "light", glow: s, mask: n = !0, style: r, ...a }) {
|
|
3196
|
+
const o = t === "dark", i = s ?? o, l = o ? "rgba(255,250,250,0.05)" : "var(--color-border-light)", c = o ? "rgba(255,250,250,0.025)" : "color-mix(in srgb, var(--color-border-light) 50%, transparent)";
|
|
3197
|
+
return /* @__PURE__ */ e.jsx(
|
|
3198
|
+
"div",
|
|
3199
|
+
{
|
|
3200
|
+
style: {
|
|
3201
|
+
position: "absolute",
|
|
3202
|
+
inset: 0,
|
|
3203
|
+
pointerEvents: "none",
|
|
3204
|
+
overflow: "hidden",
|
|
3205
|
+
zIndex: 0,
|
|
3206
|
+
...i && {
|
|
3207
|
+
background: "radial-gradient(ellipse 1000px 500px at 50% 30%, rgba(234,100,100,0.18), transparent 70%)"
|
|
3208
|
+
},
|
|
3209
|
+
...r
|
|
3210
|
+
},
|
|
3211
|
+
...a,
|
|
3212
|
+
children: /* @__PURE__ */ e.jsx(
|
|
3213
|
+
"div",
|
|
3214
|
+
{
|
|
3215
|
+
style: {
|
|
3216
|
+
position: "absolute",
|
|
3217
|
+
inset: 0,
|
|
3218
|
+
backgroundImage: [
|
|
3219
|
+
`linear-gradient(${l} 1px, transparent 1px)`,
|
|
3220
|
+
`linear-gradient(90deg, ${l} 1px, transparent 1px)`,
|
|
3221
|
+
`linear-gradient(${c} 1px, transparent 1px)`,
|
|
3222
|
+
`linear-gradient(90deg, ${c} 1px, transparent 1px)`
|
|
3223
|
+
].join(", "),
|
|
3224
|
+
backgroundSize: "80px 80px, 80px 80px, 16px 16px, 16px 16px",
|
|
3225
|
+
backgroundPosition: "-1px -1px, -1px -1px, -1px -1px, -1px -1px",
|
|
3226
|
+
...n && {
|
|
3227
|
+
WebkitMaskImage: "radial-gradient(ellipse at center, #000 30%, transparent 85%)",
|
|
3228
|
+
maskImage: "radial-gradient(ellipse at center, #000 30%, transparent 85%)"
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
)
|
|
3233
|
+
}
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
function gn({ children: t, axis: s = "y", style: n, className: r = "", ...a }) {
|
|
3237
|
+
const o = s === "x" ? { overflowX: "auto", overflowY: "hidden" } : s === "both" ? { overflow: "auto" } : { overflowY: "auto", overflowX: "hidden" };
|
|
3238
|
+
return /* @__PURE__ */ e.jsx(
|
|
3239
|
+
"div",
|
|
3240
|
+
{
|
|
3241
|
+
className: `ds-scrollable ${r}`,
|
|
3242
|
+
style: { ...o, ...n },
|
|
3243
|
+
...a,
|
|
3244
|
+
children: t
|
|
3245
|
+
}
|
|
3246
|
+
);
|
|
3247
|
+
}
|
|
3248
|
+
const ke = 280, es = 22, ts = 14, de = 8, Ne = 6, ss = 200;
|
|
3249
|
+
function ns(t) {
|
|
3250
|
+
return t ? typeof t == "function" ? t() : typeof t == "string" ? document.querySelector(t) : null : null;
|
|
3251
|
+
}
|
|
3252
|
+
function rs(t, s, n, r) {
|
|
3253
|
+
const a = window.innerWidth, o = window.innerHeight;
|
|
3254
|
+
if (o - t.bottom >= s + r + de) return "bottom";
|
|
3255
|
+
if (t.top >= s + r + de) return "top";
|
|
3256
|
+
if (a - t.right >= n + r + de) return "right";
|
|
3257
|
+
if (t.left >= n + r + de) return "left";
|
|
3258
|
+
const i = Math.max(t.top, o - t.bottom, a - t.right, t.left);
|
|
3259
|
+
return i === o - t.bottom ? "bottom" : i === t.top ? "top" : i === a - t.right ? "right" : "left";
|
|
3260
|
+
}
|
|
3261
|
+
function as(t, s, n, r, a) {
|
|
3262
|
+
const o = window.innerWidth, i = window.innerHeight;
|
|
3263
|
+
let l, c;
|
|
3264
|
+
switch (t) {
|
|
3265
|
+
case "top":
|
|
3266
|
+
l = s.top - n - a, c = s.left + s.width / 2 - r / 2;
|
|
3267
|
+
break;
|
|
3268
|
+
case "bottom":
|
|
3269
|
+
l = s.bottom + a, c = s.left + s.width / 2 - r / 2;
|
|
3270
|
+
break;
|
|
3271
|
+
case "left":
|
|
3272
|
+
l = s.top + s.height / 2 - n / 2, c = s.left - r - a;
|
|
3273
|
+
break;
|
|
3274
|
+
default:
|
|
3275
|
+
l = s.top + s.height / 2 - n / 2, c = s.right + a;
|
|
3276
|
+
}
|
|
3277
|
+
const d = Math.max(de, Math.min(o - r - de, c)), u = Math.max(de, Math.min(i - n - de, l));
|
|
3278
|
+
return { top: u, left: d, arrowOffset: c - d, arrowOffsetY: l - u };
|
|
3279
|
+
}
|
|
3280
|
+
function yn({
|
|
3281
|
+
steps: t,
|
|
3282
|
+
currentStep: s,
|
|
3283
|
+
onNext: n,
|
|
3284
|
+
onBack: r,
|
|
3285
|
+
onSkip: a,
|
|
3286
|
+
onFinish: o,
|
|
3287
|
+
overlay: i = !0,
|
|
3288
|
+
ring: l = !0,
|
|
3289
|
+
labelNext: c = "Next",
|
|
3290
|
+
labelBack: d = "Back",
|
|
3291
|
+
labelSkip: u = "Skip tour",
|
|
3292
|
+
labelFinish: m = "Done",
|
|
3293
|
+
statePrimary: x = "idle",
|
|
3294
|
+
stateBack: p = "idle"
|
|
3295
|
+
}) {
|
|
3296
|
+
const h = R(null), w = R(t), b = R(s), $ = R(l);
|
|
3297
|
+
w.current = t, b.current = s, $.current = l;
|
|
3298
|
+
const [N, _] = B(!1), [y, S] = B({ position: "fixed", visibility: "hidden", width: ke }), [D, M] = B("bottom"), [W, z] = B(null), j = R(!1), F = t[s], K = s === t.length - 1, V = ce(() => {
|
|
3299
|
+
const I = w.current[b.current];
|
|
3300
|
+
if (!I || !h.current) return;
|
|
3301
|
+
const v = ns(I.target);
|
|
3302
|
+
if (!v) return;
|
|
3303
|
+
const k = v.getBoundingClientRect(), U = h.current.getBoundingClientRect().height || 160, G = ke, E = $.current ? es : ts, f = I.position || rs(k, U, G, E), { top: T, left: O, arrowOffset: Y, arrowOffsetY: te } = as(f, k, U, G, E);
|
|
3304
|
+
M(f), S({
|
|
3305
|
+
position: "fixed",
|
|
3306
|
+
top: T,
|
|
3307
|
+
left: O,
|
|
3308
|
+
width: ke,
|
|
3309
|
+
visibility: "visible",
|
|
3310
|
+
"--arrow-offset": `${Y}px`,
|
|
3311
|
+
"--arrow-offset-y": `${te}px`
|
|
3312
|
+
}), z({
|
|
3313
|
+
top: k.top - Ne,
|
|
3314
|
+
left: k.left - Ne,
|
|
3315
|
+
width: k.width + Ne * 2,
|
|
3316
|
+
height: k.height + Ne * 2
|
|
3317
|
+
});
|
|
3318
|
+
}, []);
|
|
3319
|
+
return P(() => {
|
|
3320
|
+
window.addEventListener("scroll", V, !0), window.addEventListener("resize", V);
|
|
3321
|
+
const I = requestAnimationFrame(() => {
|
|
3322
|
+
V(), _(!0), j.current = !0;
|
|
3323
|
+
});
|
|
3324
|
+
return () => {
|
|
3325
|
+
cancelAnimationFrame(I), window.removeEventListener("scroll", V, !0), window.removeEventListener("resize", V);
|
|
3326
|
+
};
|
|
3327
|
+
}, []), P(() => {
|
|
3328
|
+
if (!j.current) return;
|
|
3329
|
+
_(!1);
|
|
3330
|
+
const I = setTimeout(() => {
|
|
3331
|
+
S((v) => ({ ...v, visibility: "hidden" })), requestAnimationFrame(() => {
|
|
3332
|
+
V(), _(!0);
|
|
3333
|
+
});
|
|
3334
|
+
}, ss + 20);
|
|
3335
|
+
return () => clearTimeout(I);
|
|
3336
|
+
}, [s]), P(() => {
|
|
3337
|
+
N && h.current && h.current.focus({ preventScroll: !0 });
|
|
3338
|
+
}, [N]), P(() => {
|
|
3339
|
+
const I = (v) => {
|
|
3340
|
+
v.key === "Escape" && a();
|
|
3341
|
+
};
|
|
3342
|
+
return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
|
|
3343
|
+
}, [a]), P(() => {
|
|
3344
|
+
if (!N) return;
|
|
3345
|
+
const I = (v) => {
|
|
3346
|
+
if (v.key !== "Tab" || !h.current) return;
|
|
3347
|
+
const k = Array.from(
|
|
3348
|
+
h.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')
|
|
3349
|
+
);
|
|
3350
|
+
if (!k.length) return;
|
|
3351
|
+
const A = k[0], U = k[k.length - 1];
|
|
3352
|
+
v.shiftKey && document.activeElement === A ? (v.preventDefault(), U.focus()) : !v.shiftKey && document.activeElement === U && (v.preventDefault(), A.focus());
|
|
3353
|
+
};
|
|
3354
|
+
return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
|
|
3355
|
+
}, [N]), !F || typeof document > "u" ? null : re.createPortal(
|
|
3356
|
+
/* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3357
|
+
W && /* @__PURE__ */ e.jsx(
|
|
3358
|
+
"div",
|
|
3359
|
+
{
|
|
3360
|
+
className: [
|
|
3361
|
+
"ds-coachmark__spotlight",
|
|
3362
|
+
i && "ds-coachmark__spotlight--overlay",
|
|
3363
|
+
!l && "ds-coachmark__spotlight--no-ring",
|
|
3364
|
+
N && "ds-coachmark__spotlight--visible"
|
|
3365
|
+
].filter(Boolean).join(" "),
|
|
3366
|
+
style: W,
|
|
3367
|
+
"aria-hidden": "true"
|
|
3368
|
+
}
|
|
3369
|
+
),
|
|
3370
|
+
/* @__PURE__ */ e.jsxs(
|
|
3371
|
+
"div",
|
|
3372
|
+
{
|
|
3373
|
+
ref: h,
|
|
3374
|
+
"data-ds-portal": "",
|
|
3375
|
+
role: "dialog",
|
|
3376
|
+
"aria-modal": "false",
|
|
3377
|
+
"aria-live": "polite",
|
|
3378
|
+
"aria-label": F.title ?? `Step ${s + 1} of ${t.length}`,
|
|
3379
|
+
className: [
|
|
3380
|
+
"ds-coachmark__bubble",
|
|
3381
|
+
`ds-coachmark__bubble--${D}`,
|
|
3382
|
+
N && "ds-coachmark__bubble--visible"
|
|
3383
|
+
].filter(Boolean).join(" "),
|
|
3384
|
+
style: y,
|
|
3385
|
+
tabIndex: -1,
|
|
3386
|
+
children: [
|
|
3387
|
+
/* @__PURE__ */ e.jsx(
|
|
3388
|
+
"button",
|
|
3389
|
+
{
|
|
3390
|
+
type: "button",
|
|
3391
|
+
className: "ds-coachmark__close",
|
|
3392
|
+
onClick: a,
|
|
3393
|
+
"aria-label": u,
|
|
3394
|
+
children: /* @__PURE__ */ e.jsx(ee, { size: 16, strokeWidth: 2 })
|
|
3395
|
+
}
|
|
3396
|
+
),
|
|
3397
|
+
F.title && /* @__PURE__ */ e.jsx("div", { className: "ds-coachmark__title", children: F.title }),
|
|
3398
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-coachmark__body", children: F.content }),
|
|
3399
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-coachmark__footer", children: [
|
|
3400
|
+
t.length > 1 && /* @__PURE__ */ e.jsxs("span", { className: "ds-coachmark__counter", children: [
|
|
3401
|
+
s + 1,
|
|
3402
|
+
" / ",
|
|
3403
|
+
t.length
|
|
3404
|
+
] }),
|
|
3405
|
+
/* @__PURE__ */ e.jsxs("div", { className: "ds-coachmark__footer-nav", children: [
|
|
3406
|
+
s > 0 && /* @__PURE__ */ e.jsx(oe, { variant: "secondary", size: "s", state: p, onClick: r, children: d }),
|
|
3407
|
+
/* @__PURE__ */ e.jsx(oe, { variant: "primary", size: "s", state: x, onClick: K ? o : n, children: K ? m : c })
|
|
3408
|
+
] })
|
|
3409
|
+
] })
|
|
3410
|
+
]
|
|
3411
|
+
}
|
|
3412
|
+
)
|
|
3413
|
+
] }),
|
|
3414
|
+
document.body
|
|
3415
|
+
);
|
|
3416
|
+
}
|
|
3417
|
+
function kn(t, s = {}) {
|
|
3418
|
+
const { storageKey: n } = s, [r, a] = B(0), [o, i] = B(!1), l = () => n && typeof localStorage < "u" && localStorage.getItem(n) === "done", c = ce(() => {
|
|
3419
|
+
i(!1), n && typeof localStorage < "u" && localStorage.setItem(n, "done");
|
|
3420
|
+
}, [n]);
|
|
3421
|
+
return {
|
|
3422
|
+
currentStep: r,
|
|
3423
|
+
isActive: o,
|
|
3424
|
+
start: () => {
|
|
3425
|
+
l() || (a(0), i(!0));
|
|
3426
|
+
},
|
|
3427
|
+
next: () => a((d) => Math.min(d + 1, t.length - 1)),
|
|
3428
|
+
back: () => a((d) => Math.max(d - 1, 0)),
|
|
3429
|
+
skip: c,
|
|
3430
|
+
finish: c
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3433
|
+
function En() {
|
|
3434
|
+
const t = R(null), s = ce(() => {
|
|
3435
|
+
const n = t.current;
|
|
3436
|
+
if (!n) return;
|
|
3437
|
+
n.classList.remove("ds-shake"), n.offsetWidth, n.classList.add("ds-shake");
|
|
3438
|
+
const r = () => {
|
|
3439
|
+
n.classList.remove("ds-shake"), n.removeEventListener("animationend", r);
|
|
3440
|
+
};
|
|
3441
|
+
n.addEventListener("animationend", r);
|
|
3442
|
+
}, []);
|
|
3443
|
+
return { ref: t, shake: s };
|
|
3444
|
+
}
|
|
3445
|
+
export {
|
|
3446
|
+
Be as Accordion,
|
|
3447
|
+
bs as Alert,
|
|
3448
|
+
nn as AnimatedNumber,
|
|
3449
|
+
Ss as Avatar,
|
|
3450
|
+
pe as Badge,
|
|
3451
|
+
en as Banner,
|
|
3452
|
+
Ns as BottomSheet,
|
|
3453
|
+
Cs as Breadcrumb,
|
|
3454
|
+
oe as Button,
|
|
3455
|
+
ms as Card,
|
|
3456
|
+
fn as ChatMessage,
|
|
3457
|
+
Ts as Checkbox,
|
|
3458
|
+
yn as Coachmark,
|
|
3459
|
+
ws as Code,
|
|
3460
|
+
$t as CodeAccordion,
|
|
3461
|
+
_n as ConfidenceBar,
|
|
3462
|
+
Yt as CopyButton,
|
|
3463
|
+
bn as DiffView,
|
|
3464
|
+
tn as Dropdown,
|
|
3465
|
+
zs as EmptyState,
|
|
3466
|
+
wn as EngineerGrid,
|
|
3467
|
+
Fs as FormField,
|
|
3468
|
+
ps as H1,
|
|
3469
|
+
hs as H2,
|
|
3470
|
+
xs as H3,
|
|
3471
|
+
vs as H4,
|
|
3472
|
+
rn as InView,
|
|
3473
|
+
cs as Input,
|
|
3474
|
+
gs as Link,
|
|
3475
|
+
Zt as MessageFeedback,
|
|
3476
|
+
jn as MessageFooter,
|
|
3477
|
+
js as Modal,
|
|
3478
|
+
he as ModalFooter,
|
|
3479
|
+
hn as ModelPicker,
|
|
3480
|
+
Vs as NavRail,
|
|
3481
|
+
Zs as NavRailAgent,
|
|
3482
|
+
Hs as NavRailBody,
|
|
3483
|
+
Js as NavRailCustomItem,
|
|
3484
|
+
Ks as NavRailDivider,
|
|
3485
|
+
Qs as NavRailFlyout,
|
|
3486
|
+
Gs as NavRailFooter,
|
|
3487
|
+
qs as NavRailHeader,
|
|
3488
|
+
Ys as NavRailItem,
|
|
3489
|
+
Xs as NavRailRecents,
|
|
3490
|
+
_s as P1,
|
|
3491
|
+
gt as P2,
|
|
3492
|
+
Qe as P3,
|
|
3493
|
+
Os as Pagination,
|
|
3494
|
+
sn as ProgressBar,
|
|
3495
|
+
pn as PromptInput,
|
|
3496
|
+
Rs as Radio,
|
|
3497
|
+
cn as ReasoningBlock,
|
|
3498
|
+
gn as Scrollable,
|
|
3499
|
+
Es as SegmentedControl,
|
|
3500
|
+
us as Select,
|
|
3501
|
+
Us as SidePage,
|
|
3502
|
+
Oe as SidePageFooter,
|
|
3503
|
+
St as Skeleton,
|
|
3504
|
+
xn as SourcesPanel,
|
|
3505
|
+
Nt as Spinner,
|
|
3506
|
+
Ws as Stat,
|
|
3507
|
+
dn as StepIndicator,
|
|
3508
|
+
fs as Stepper,
|
|
3509
|
+
un as StreamingText,
|
|
3510
|
+
ks as Tab,
|
|
3511
|
+
As as Table,
|
|
3512
|
+
Is as TableBody,
|
|
3513
|
+
Ds as TableHead,
|
|
3514
|
+
Bs as TableRow,
|
|
3515
|
+
Ls as TableSubheaderRow,
|
|
3516
|
+
ys as Tabs,
|
|
3517
|
+
Ms as Td,
|
|
3518
|
+
ds as Textarea,
|
|
3519
|
+
Ps as Th,
|
|
3520
|
+
Nn as ThinkingDot,
|
|
3521
|
+
on as ToastContainer,
|
|
3522
|
+
$s as Toggle,
|
|
3523
|
+
vn as TokenCounter,
|
|
3524
|
+
ln as ToolCallBubble,
|
|
3525
|
+
ln as ToolCallCard,
|
|
3526
|
+
Le as Tooltip,
|
|
3527
|
+
C as iconSizes,
|
|
3528
|
+
Ft as useAnimatedNumber,
|
|
3529
|
+
Ht as useAnimatedPlaceholder,
|
|
3530
|
+
kn as useCoachmark,
|
|
3531
|
+
Wt as useInView,
|
|
3532
|
+
En as useShake,
|
|
3533
|
+
mn as useStreamScroll,
|
|
3534
|
+
an as useToast
|
|
3535
|
+
};
|