@epam/statgpt-ui-components 0.7.0-dev.3 → 0.7.0-dev.30

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.
Files changed (38) hide show
  1. package/components/Alert/Alert.stories.d.ts +12 -0
  2. package/components/Button/Button.stories.d.ts +14 -0
  3. package/components/Calendar/Calendar.stories.d.ts +8 -0
  4. package/components/Checkbox/Checkbox.stories.d.ts +11 -0
  5. package/components/CloseButton/CloseButton.stories.d.ts +10 -0
  6. package/components/CollapsibleBlock/CollapsibleBlock.stories.d.ts +9 -0
  7. package/components/CopyButton/CopyButton.d.ts +1 -1
  8. package/components/CopyButton/CopyButton.stories.d.ts +10 -0
  9. package/components/DownloadFormatMessage/DownloadFormatMessage.stories.d.ts +9 -0
  10. package/components/DraggableList/DraggableList.d.ts +1 -1
  11. package/components/DraggableList/DraggableListOverlay.d.ts +1 -1
  12. package/components/DraggableList/DraggableListRow.d.ts +1 -1
  13. package/components/DraggableList/__stories__/DraggableList.stories.d.ts +11 -0
  14. package/components/DraggableList/__stories__/DraggableListOverlay.stories.d.ts +11 -0
  15. package/components/DraggableList/__stories__/DraggableListRow.stories.d.ts +12 -0
  16. package/components/Dropdown/Dropdown.stories.d.ts +9 -0
  17. package/components/HighlightText/HighlightText.stories.d.ts +11 -0
  18. package/components/IconButton/IconButton.stories.d.ts +11 -0
  19. package/components/InlineAlert/InlineAlert.d.ts +2 -2
  20. package/components/InlineAlert/InlineAlert.stories.d.ts +10 -0
  21. package/components/InlineAlert/InlineAlertContext.d.ts +1 -1
  22. package/components/Input/Input.stories.d.ts +12 -0
  23. package/components/Input/InputWithIcon.stories.d.ts +11 -0
  24. package/components/Link/Link.stories.d.ts +9 -0
  25. package/components/Loader/Loader.d.ts +1 -1
  26. package/components/Loader/Loader.stories.d.ts +6 -0
  27. package/components/Popup/Popup.stories.d.ts +10 -0
  28. package/components/Radio/Radio.stories.d.ts +11 -0
  29. package/components/RequestLimit/RequestLimit.stories.d.ts +9 -0
  30. package/components/Tag/Tag.stories.d.ts +8 -0
  31. package/constants/breakpoints.d.ts +1 -0
  32. package/constants/index.d.ts +1 -0
  33. package/contexts/AgentAvailabilityContext.d.ts +2 -2
  34. package/index.css +1 -1
  35. package/index.js +1 -1
  36. package/index.mjs +895 -1277
  37. package/package.json +11 -11
  38. package/LICENSE +0 -21
package/index.mjs CHANGED
@@ -1,1301 +1,919 @@
1
- import { jsx as r, jsxs as u, Fragment as V } from "react/jsx-runtime";
2
- import * as ue from "react";
3
- import { useEffect as L, useState as j, useRef as z, useCallback as P, useMemo as q, useId as me, createContext as Q, useContext as K } from "react";
4
- import g from "classnames";
5
- import { IconX as he, IconCalendarEvent as fe, IconSquareCheckFilled as pe, IconSquareMinusFilled as ge, IconChevronDown as xe, IconGripVertical as X, IconChevronRight as Z, IconDatabase as be } from "@tabler/icons-react";
6
- import { extendTailwindMerge as Ne } from "tailwind-merge";
7
- import we from "react-flatpickr";
8
- import { CalendarResolution as A } from "@epam/statgpt-shared-toolkit";
9
- import { useFloating as J, useRole as ve, useDismiss as ee, useInteractions as te, FloatingPortal as ne, FloatingOverlay as Ce, FloatingFocusManager as ye, autoUpdate as Ee, offset as Ie, flip as Se, size as ke, shift as De, useClick as Le } from "@floating-ui/react";
10
- import { useSensors as Oe, useSensor as Fe, PointerSensor as Re, DndContext as _e, closestCenter as Ae, DragOverlay as Me } from "@dnd-kit/core";
11
- import { useSortable as Te, SortableContext as Pe, verticalListSortingStrategy as Ye, arrayMove as je } from "@dnd-kit/sortable";
12
- import { CSS as ze } from "@dnd-kit/utilities";
13
- const re = ({
14
- title: e,
15
- btnClassNames: t,
16
- iconWidth: n,
17
- iconHeight: s,
18
- onClick: l
19
- }) => /* @__PURE__ */ r(
20
- "button",
21
- {
22
- type: "button",
23
- "aria-label": "button",
24
- className: t,
25
- title: e,
26
- onClick: l,
27
- children: /* @__PURE__ */ r(he, { height: s || 20, width: n || 20 })
28
- }
29
- );
30
- var _ = /* @__PURE__ */ ((e) => (e.INFO = "info", e.ERROR = "error", e.SUCCESS = "success", e.IN_PROGRESS = "in_progress", e))(_ || {});
31
- const He = 3e4, Nt = ({
32
- alertDetails: e,
33
- infoIcon: t,
34
- successIcon: n,
35
- errorIcon: s,
36
- onClose: l,
37
- closeButtonTitle: a,
38
- children: i
39
- }) => {
40
- const m = e?.type, h = m === _.IN_PROGRESS || m === _.INFO, o = () => h ? "alert-in-progress" : m === _.SUCCESS ? "alert-success" : "alert-error", f = h ? t : m === _.SUCCESS ? n : m === _.ERROR ? s : null, p = e?.text;
41
- return L(() => {
42
- if (!e || h)
43
- return;
44
- const v = setTimeout(() => {
45
- l?.();
46
- }, He);
47
- return () => clearTimeout(v);
48
- }, [e, h, l]), /* @__PURE__ */ r(
49
- "div",
50
- {
51
- className: g(
52
- "alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",
53
- o()
54
- ),
55
- children: /* @__PURE__ */ u("div", { className: "alert-content flex items-start", children: [
56
- f && /* @__PURE__ */ r("div", { className: "alert-icon", children: f }),
57
- /* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
58
- /* @__PURE__ */ r("h3", { className: "alert-title truncate", children: e?.title }),
59
- i ?? (p && /* @__PURE__ */ r(
60
- "div",
61
- {
62
- className: "alert-text whitespace-pre-line break-words",
63
- title: p,
64
- children: p
65
- }
66
- ))
67
- ] }),
68
- /* @__PURE__ */ r(re, { title: a, onClick: l })
69
- ] })
70
- }
71
- );
72
- }, $e = () => /* @__PURE__ */ r("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ r("div", { className: "loader" }) }), Ge = Ne({
73
- extend: {
74
- classGroups: {
75
- typography: [
76
- "h1",
77
- "h2",
78
- "h3",
79
- "h4",
80
- "h5",
81
- "body-1",
82
- "body-2",
83
- "body-3",
84
- "caption"
85
- ]
86
- }
87
- }
88
- });
89
- function F(...e) {
90
- return Ge(g(...e));
1
+ import * as e from "react";
2
+ import { createContext as t, useCallback as n, useContext as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
3
+ import l from "classnames";
4
+ import { IconCalendarEvent as u, IconChevronDown as d, IconChevronRight as f, IconDatabase as p, IconGripVertical as m, IconSquareCheckFilled as h, IconSquareMinusFilled as g, IconX as _ } from "@tabler/icons-react";
5
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
6
+ import { extendTailwindMerge as x } from "tailwind-merge";
7
+ import S from "react-flatpickr";
8
+ import { CalendarResolution as C } from "@epam/statgpt-shared-toolkit";
9
+ import { FloatingFocusManager as w, FloatingOverlay as T, FloatingPortal as E, autoUpdate as D, flip as ee, offset as te, shift as ne, size as re, useClick as ie, useDismiss as O, useFloating as k, useInteractions as A, useRole as ae } from "@floating-ui/react";
10
+ import { DndContext as oe, DragOverlay as se, PointerSensor as ce, closestCenter as le, useSensor as ue, useSensors as de } from "@dnd-kit/core";
11
+ import { SortableContext as fe, arrayMove as pe, useSortable as me, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
12
+ import { CSS as ge } from "@dnd-kit/utilities";
13
+ //#region libs/ui-components/src/components/CloseButton/CloseButton.tsx
14
+ var j = ({ title: e, btnClassNames: t, iconWidth: n, iconHeight: r, onClick: i }) => /* @__PURE__ */ y("button", {
15
+ type: "button",
16
+ "aria-label": "button",
17
+ className: t,
18
+ title: e,
19
+ onClick: i,
20
+ children: /* @__PURE__ */ y(_, {
21
+ height: r || 20,
22
+ width: n || 20
23
+ })
24
+ }), M = /* @__PURE__ */ function(e) {
25
+ return e.INFO = "info", e.ERROR = "error", e.SUCCESS = "success", e.IN_PROGRESS = "in_progress", e;
26
+ }({}), _e = 3e4, ve = ({ alertDetails: e, infoIcon: t, successIcon: n, errorIcon: r, onClose: a, closeButtonTitle: o, children: s }) => {
27
+ let c = e?.type, u = c === M.IN_PROGRESS || c === M.INFO, d = () => u ? "alert-in-progress" : c === M.SUCCESS ? "alert-success" : "alert-error", f = u ? t : c === M.SUCCESS ? n : c === M.ERROR ? r : null, p = e?.text;
28
+ return i(() => {
29
+ if (!e || u) return;
30
+ let t = setTimeout(() => {
31
+ a?.();
32
+ }, _e);
33
+ return () => clearTimeout(t);
34
+ }, [
35
+ e,
36
+ u,
37
+ a
38
+ ]), /* @__PURE__ */ y("div", {
39
+ className: l("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]", d()),
40
+ children: /* @__PURE__ */ b("div", {
41
+ className: "alert-content flex items-start",
42
+ children: [
43
+ f && /* @__PURE__ */ y("div", {
44
+ className: "alert-icon",
45
+ children: f
46
+ }),
47
+ /* @__PURE__ */ b("div", {
48
+ className: "flex min-w-0 flex-1 flex-col gap-2",
49
+ children: [/* @__PURE__ */ y("h3", {
50
+ className: "alert-title truncate",
51
+ children: e?.title
52
+ }), s ?? (p && /* @__PURE__ */ y("div", {
53
+ className: "alert-text whitespace-pre-line break-words",
54
+ title: p,
55
+ children: p
56
+ }))]
57
+ }),
58
+ /* @__PURE__ */ y(j, {
59
+ title: o,
60
+ onClick: a
61
+ })
62
+ ]
63
+ })
64
+ });
65
+ }, N = () => /* @__PURE__ */ y("div", {
66
+ className: "flex h-full items-center justify-center",
67
+ children: /* @__PURE__ */ y("div", { className: "loader" })
68
+ }), ye = x({ extend: { classGroups: { typography: [
69
+ "h1",
70
+ "h2",
71
+ "h3",
72
+ "h4",
73
+ "h5",
74
+ "body-1",
75
+ "body-2",
76
+ "body-3",
77
+ "caption"
78
+ ] } } });
79
+ function P(...e) {
80
+ return ye(l(...e));
91
81
  }
92
- const Be = ({
93
- buttonClassName: e,
94
- textClassName: t,
95
- isLoading: n = !1,
96
- title: s,
97
- disabled: l,
98
- iconAfter: a,
99
- iconBefore: i,
100
- onClick: m,
101
- isSmallButton: h
102
- }) => {
103
- const o = F([
104
- h ? "font-semibold" : "",
105
- a ? "mr-2" : "",
106
- i ? "ml-2" : "",
107
- t
108
- ]);
109
- return /* @__PURE__ */ u(
110
- "button",
111
- {
112
- type: "button",
113
- className: g(
114
- "base-button",
115
- e,
116
- h ? "small-button" : ""
117
- ),
118
- disabled: l || n,
119
- "aria-label": "button",
120
- onClick: (f) => m?.(f),
121
- title: s,
122
- children: [
123
- i,
124
- n && /* @__PURE__ */ r($e, {}),
125
- s ? h ? /* @__PURE__ */ r("h4", { className: o, children: s }) : /* @__PURE__ */ r("h3", { className: o, children: s }) : null,
126
- a
127
- ]
128
- }
129
- );
82
+ //#endregion
83
+ //#region libs/ui-components/src/components/Button/Button.tsx
84
+ var F = ({ buttonClassName: e, textClassName: t, isLoading: n = !1, title: r, disabled: i, iconAfter: a, iconBefore: o, onClick: s, isSmallButton: c }) => {
85
+ let u = P([
86
+ c ? "font-semibold" : "",
87
+ a ? "mr-2" : "",
88
+ o ? "ml-2" : "",
89
+ t
90
+ ]);
91
+ return /* @__PURE__ */ b("button", {
92
+ type: "button",
93
+ className: l("base-button", e, c ? "small-button" : ""),
94
+ disabled: i || n,
95
+ "aria-label": "button",
96
+ onClick: (e) => s?.(e),
97
+ title: r,
98
+ children: [
99
+ o,
100
+ n && /* @__PURE__ */ y(N, {}),
101
+ r ? y(c ? "h4" : "h3", {
102
+ className: u,
103
+ children: r
104
+ }) : null,
105
+ a
106
+ ]
107
+ });
130
108
  };
131
- function We(e = 719) {
132
- const [t, n] = j(
133
- () => typeof window < "u" ? window.innerWidth < e : !1
134
- );
135
- return L(() => {
136
- const s = window.matchMedia(`(max-width: ${e}px)`), l = (a) => {
137
- n(a.matches);
138
- };
139
- return n(s.matches), s.addEventListener("change", l), () => s.removeEventListener("change", l);
140
- }, [e]), t;
109
+ //#endregion
110
+ //#region libs/ui-components/src/hooks/isMobile.tsx
111
+ function I(e = 719) {
112
+ let [t, n] = c(() => typeof window < "u" ? window.innerWidth < e : !1);
113
+ return i(() => {
114
+ let t = window.matchMedia(`(max-width: ${e}px)`), r = (e) => {
115
+ n(e.matches);
116
+ };
117
+ return n(t.matches), t.addEventListener("change", r), () => t.removeEventListener("change", r);
118
+ }, [e]), t;
141
119
  }
142
- function wt(e, t) {
143
- const n = z(null);
144
- return P(
145
- (...l) => {
146
- n.current && clearTimeout(n.current), n.current = setTimeout(() => {
147
- e(...l);
148
- }, t);
149
- },
150
- [e, t]
151
- );
120
+ //#endregion
121
+ //#region libs/ui-components/src/hooks/debounce.ts
122
+ function be(e, t) {
123
+ let r = s(null);
124
+ return n((...n) => {
125
+ r.current && clearTimeout(r.current), r.current = setTimeout(() => {
126
+ e(...n);
127
+ }, t);
128
+ }, [e, t]);
152
129
  }
153
- const vt = 24, Ct = 24, U = 1e3, qe = 24, yt = ({
154
- label: e,
155
- onChange: t,
156
- value: n,
157
- options: s,
158
- calendarResolution: l = A.DAY,
159
- id: a,
160
- icon: i,
161
- isEndDate: m
162
- }) => {
163
- const h = z(null), o = We();
164
- L(() => {
165
- const N = h?.current;
166
- N && N.querySelector("input")?.setAttribute("aria-label", e);
167
- }, [e]);
168
- const f = {
169
- ...s,
170
- disableMobile: !0,
171
- defaultDate: l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n
172
- }, p = (N, w, b) => {
173
- const d = `calendar__${l === A.MONTH ? "month" : "day"}`;
174
- b.calendarContainer && b.calendarContainer.classList.add(d);
175
- }, v = (N, w, b) => {
176
- if (l === A.MONTH && N.length > 0) {
177
- const d = s.minDate, c = s.maxDate, x = N[0].getFullYear(), C = b.calendarContainer, S = "flatpickr-disabled", y = C.querySelectorAll(
178
- ".flatpickr-monthSelect-month"
179
- ), E = C.querySelectorAll(
180
- ".flatpickr-next-month"
181
- )[0], D = C.querySelectorAll(
182
- ".flatpickr-prev-month"
183
- )[0];
184
- x === c.getFullYear() && E.classList.add(S), x === d.getFullYear() && D.classList.add(S), (x === d.getFullYear() || x === c.getFullYear()) && y.forEach((k) => {
185
- k.classList.remove(S);
186
- const I = new Date(k.getAttribute("aria-label")), R = I.getFullYear() === d.getFullYear() && I.getMonth() === d.getMonth(), H = I.getFullYear() === c.getFullYear() && I.getMonth() === c.getMonth();
187
- R || H || (I < d || I > c) && k.classList.add(S);
188
- });
189
- }
190
- setTimeout(() => {
191
- const d = b.calendarContainer, c = b._input?.getBoundingClientRect();
192
- d && (d.style.top = `${c.top - d.offsetHeight - 8}px`, d.style.width = `${d.style.width}px`, m ? (d.style.right = `${window.innerWidth - c.right - (o ? qe : 0)}px`, d.style.left = "auto") : d.style.left = `${c.left}px`);
193
- }, 0);
194
- };
195
- return /* @__PURE__ */ u("div", { className: "calendar relative", ref: h, children: [
196
- /* @__PURE__ */ r("div", { className: "calendar-title mb-1", children: e }),
197
- /* @__PURE__ */ r(
198
- "label",
199
- {
200
- htmlFor: a,
201
- className: "absolute right-[11px] top-[29px] cursor-pointer",
202
- children: i || /* @__PURE__ */ r(fe, {})
203
- }
204
- ),
205
- /* @__PURE__ */ r(
206
- we,
207
- {
208
- defaultValue: (l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n)?.toDateString(),
209
- options: f,
210
- onChange: (N) => {
211
- t(N[0]);
212
- },
213
- onOpen: [v],
214
- onReady: [p],
215
- id: a
216
- }
217
- )
218
- ] });
219
- }, se = ({
220
- label: e,
221
- id: t,
222
- checked: n,
223
- indeterminate: s = !1,
224
- checkboxIcon: l,
225
- onChange: a,
226
- disabled: i = !1,
227
- disabledScope: m = "full",
228
- className: h,
229
- stopPropagation: o = !0
230
- }) => {
231
- const f = z(null);
232
- L(() => {
233
- f.current && (f.current.indeterminate = !n && s);
234
- }, [n, s]);
235
- const p = P(
236
- (w) => {
237
- o && w.stopPropagation();
238
- },
239
- [o]
240
- ), v = P(
241
- (w) => {
242
- o && w.stopPropagation(), a?.(t, w.target.checked);
243
- },
244
- [a, t, o]
245
- ), N = () => {
246
- if (n)
247
- return l || /* @__PURE__ */ r(pe, { className: "absolute size-4" });
248
- if (s)
249
- return /* @__PURE__ */ r(ge, { className: "absolute size-4" });
250
- };
251
- return /* @__PURE__ */ u(
252
- "label",
253
- {
254
- htmlFor: t,
255
- onClick: p,
256
- className: F(
257
- "flex min-w-0 items-center py-1 shrink-0",
258
- i ? "cursor-not-allowed" : "cursor-pointer",
259
- i && m === "full" && "opacity-50",
260
- h
261
- ),
262
- children: [
263
- /* @__PURE__ */ r(
264
- "span",
265
- {
266
- className: g(
267
- "checkbox-button relative flex size-[14px] items-center justify-center",
268
- i && m === "icon" && "opacity-50"
269
- ),
270
- "aria-hidden": !0,
271
- children: N()
272
- }
273
- ),
274
- e ? /* @__PURE__ */ r(
275
- "p",
276
- {
277
- className: g(
278
- "checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"
279
- ),
280
- title: e,
281
- children: e
282
- }
283
- ) : null,
284
- /* @__PURE__ */ r(
285
- "input",
286
- {
287
- ref: f,
288
- id: t,
289
- type: "checkbox",
290
- checked: n,
291
- disabled: i,
292
- onChange: v,
293
- className: "hidden"
294
- }
295
- )
296
- ]
297
- }
298
- );
299
- }, Et = ({
300
- title: e,
301
- icon: t,
302
- children: n,
303
- value: s
304
- }) => {
305
- const [l, a] = j(!1);
306
- return /* @__PURE__ */ u(
307
- "div",
308
- {
309
- className: `collapsible-block flex flex-col border-t-2 border-neutrals-600 ${l ? "collapsible-block-open" : ""}`,
310
- children: [
311
- /* @__PURE__ */ u(
312
- "div",
313
- {
314
- className: "collapsible-block-title flex cursor-pointer items-center py-4",
315
- onClick: () => a(!l),
316
- children: [
317
- /* @__PURE__ */ r("div", { className: `${l ? "rotate-180" : ""} transition-transform`, children: t || /* @__PURE__ */ r(xe, { className: "mr-3 size-5" }) }),
318
- /* @__PURE__ */ u("div", { className: "flex flex-1 items-center justify-between", children: [
319
- /* @__PURE__ */ r("span", { children: e }),
320
- s && /* @__PURE__ */ r("p", { className: "body-1 text-neutrals-800", children: s })
321
- ] })
322
- ]
323
- }
324
- ),
325
- l && /* @__PURE__ */ r("div", { className: "collapsible-block-content pb-4", children: n })
326
- ]
327
- }
328
- );
329
- }, It = ({ text: e, highlightText: t }) => {
330
- const n = q(() => {
331
- const s = [];
332
- if (!t)
333
- return [{ id: 0, text: e, highlight: !1 }];
334
- const l = t?.toLowerCase() || "", a = e?.toLowerCase()?.split(l) || "";
335
- for (let i = 0, m = 0; i < a?.length; i++) {
336
- const h = a?.[i], o = h.length;
337
- h !== "" && s.push({
338
- id: s.length,
339
- highlight: !1,
340
- text: e?.substring(
341
- m,
342
- m + o
343
- )
344
- }), m += o, i !== a?.length - 1 && (s.push({
345
- id: s.length,
346
- highlight: !0,
347
- text: e?.substring(
348
- m,
349
- m + t.length
350
- )
351
- }), m += t.length);
352
- }
353
- return s;
354
- }, [t, e]);
355
- return /* @__PURE__ */ r(V, { children: n.map((s) => /* @__PURE__ */ r(
356
- "span",
357
- {
358
- className: g(s?.highlight && "bg-highlight"),
359
- children: s?.text
360
- },
361
- s?.id
362
- )) });
363
- }, St = ({
364
- icon: e,
365
- onClick: t,
366
- buttonClassName: n,
367
- disabled: s,
368
- title: l,
369
- isBaseIconStyles: a = !0
370
- }) => /* @__PURE__ */ r(
371
- "button",
372
- {
373
- type: "button",
374
- className: g(
375
- a && "base-icon-button",
376
- n
377
- ),
378
- onClick: (i) => t?.(i),
379
- disabled: s,
380
- title: l,
381
- "aria-label": "button",
382
- children: e
383
- }
384
- ), Ue = ({
385
- value: e,
386
- inputId: t,
387
- placeholder: n = "",
388
- cssClass: s = "",
389
- type: l = "text",
390
- disabled: a,
391
- readonly: i,
392
- onChange: m,
393
- onKeyDown: h,
394
- onFocus: o,
395
- onBlur: f
396
- }) => {
397
- const p = g(
398
- "truncate outline-none shadow-none body-1",
399
- s,
400
- i ? "pointer-events-none" : ""
401
- );
402
- return /* @__PURE__ */ r(
403
- "input",
404
- {
405
- type: l,
406
- autoComplete: "off",
407
- id: t,
408
- placeholder: n,
409
- value: e || "",
410
- title: e ? String(e) : "",
411
- disabled: a,
412
- className: p,
413
- onKeyDown: h,
414
- onFocus: o,
415
- onBlur: f,
416
- onChange: (v) => m?.(v.currentTarget.value)
417
- }
418
- );
419
- }, kt = ({
420
- iconBeforeInput: e,
421
- iconAfterInput: t,
422
- containerClasses: n,
423
- cssClass: s,
424
- ...l
425
- }) => /* @__PURE__ */ u("div", { className: g("input w-full flex flex-row", n), children: [
426
- e,
427
- /* @__PURE__ */ r(
428
- Ue,
429
- {
430
- cssClass: g(
431
- "border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",
432
- s
433
- ),
434
- ...l
435
- }
436
- ),
437
- t
438
- ] }), Dt = ({
439
- url: e,
440
- title: t,
441
- linkClassName: n = "",
442
- iconBefore: s,
443
- iconAfter: l
444
- }) => {
445
- const a = g(
446
- l ? "mr-2" : "",
447
- s ? "ml-2" : ""
448
- );
449
- return /* @__PURE__ */ u(
450
- "a",
451
- {
452
- href: e,
453
- target: "_blank",
454
- rel: "noopener noreferrer",
455
- className: g("base-link", n),
456
- title: t,
457
- children: [
458
- s,
459
- /* @__PURE__ */ r("span", { className: a, children: t }),
460
- l
461
- ]
462
- }
463
- );
464
- }, Lt = ({ title: e, text: t, disabled: n, onClick: s }) => /* @__PURE__ */ r(
465
- "button",
466
- {
467
- type: "button",
468
- className: g(
469
- "tag flex items-center justify-center",
470
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"
471
- ),
472
- disabled: n,
473
- onClick: () => s?.(t || e),
474
- "aria-label": "button",
475
- children: /* @__PURE__ */ r("h4", { children: e })
476
- }
477
- ), Ot = ({
478
- label: e,
479
- id: t,
480
- checked: n,
481
- radioIcon: s,
482
- description: l,
483
- onChange: a
484
- }) => {
485
- const i = P(
486
- (m) => {
487
- m.stopPropagation(), a?.(t, m.target.checked);
488
- },
489
- [a, t]
490
- );
491
- return /* @__PURE__ */ u(
492
- "label",
493
- {
494
- className: "flex min-w-0 cursor-pointer flex-col py-[6px]",
495
- htmlFor: t,
496
- children: [
497
- /* @__PURE__ */ u("p", { className: "radio-label flex min-w-0 items-center", children: [
498
- /* @__PURE__ */ r(
499
- "span",
500
- {
501
- className: g(
502
- "flex justify-center items-center w-4 h-4 mr-2 relative",
503
- "radio-button",
504
- n ? "radio-button-active" : ""
505
- ),
506
- children: n && s
507
- }
508
- ),
509
- e && /* @__PURE__ */ r(
510
- "span",
511
- {
512
- className: "radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",
513
- title: e,
514
- children: e
515
- }
516
- )
517
- ] }),
518
- l && /* @__PURE__ */ r(
519
- "span",
520
- {
521
- className: "radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",
522
- title: l,
523
- children: l
524
- }
525
- ),
526
- /* @__PURE__ */ r(
527
- "input",
528
- {
529
- type: "radio",
530
- onChange: i,
531
- id: t,
532
- checked: n,
533
- className: "hidden"
534
- }
535
- )
536
- ]
537
- }
538
- );
539
- };
540
- var T = /* @__PURE__ */ ((e) => (e.Closed = "Closed", e.Opened = "Opened", e))(T || {}), B = /* @__PURE__ */ ((e) => (e.LG = "Large", e.SM = "Small", e))(B || {});
541
- const Ve = ({
542
- portalId: e,
543
- state: t = T.Opened,
544
- heading: n,
545
- size: s,
546
- onClose: l,
547
- children: a,
548
- overlayClassName: i,
549
- containerClassName: m,
550
- dividers: h = !0,
551
- closeButtonTitle: o
552
- }) => {
553
- const { refs: f, context: p } = J({
554
- open: t !== T.Closed && !!t,
555
- onOpenChange: l
556
- }), v = ve(p, { role: "dialog" }), N = ee(p, { outsidePress: !0 }), { getFloatingProps: w } = te([v, N]), b = P(
557
- (d) => {
558
- d?.preventDefault(), d?.stopPropagation(), l();
559
- },
560
- [l]
561
- );
562
- return /* @__PURE__ */ r(ne, { id: e, children: t !== T.Closed && /* @__PURE__ */ r(
563
- Ce,
564
- {
565
- className: g(
566
- "z-modal flex items-center justify-center bg-blackout p-4",
567
- i
568
- ),
569
- children: /* @__PURE__ */ r(ye, { context: p, children: /* @__PURE__ */ u(
570
- "div",
571
- {
572
- className: g(
573
- "relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
574
- s === B.LG && "max-w-[65%]",
575
- s === B.SM && "max-w-[30%]",
576
- h && "divide-neutrals-400 divide-y",
577
- m,
578
- "sm:w-full sm:max-w-full sm:px-4 sm:py-6"
579
- ),
580
- ref: f.setFloating,
581
- ...w({
582
- onClick(d) {
583
- d.stopPropagation();
584
- }
585
- }),
586
- children: [
587
- /* @__PURE__ */ u("div", { className: "modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2", children: [
588
- n && (typeof n == "string" ? /* @__PURE__ */ r("h2", { className: "modal-heading-title sm:h3 mr-3 min-w-0 flex-1", children: n }) : n),
589
- /* @__PURE__ */ r(
590
- re,
591
- {
592
- title: o,
593
- onClick: b,
594
- btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
595
- }
596
- )
597
- ] }),
598
- a.map((d) => d)
599
- ]
600
- }
601
- ) })
602
- }
603
- ) });
604
- }, Ft = (e) => e.state === T.Closed ? null : /* @__PURE__ */ r(Ve, { ...e }), $ = "statgpt-dropdown-open", O = 8, Qe = {
605
- name: "keepDropdownWithinViewport",
606
- fn({ y: e, rects: t }) {
607
- if (typeof window > "u")
608
- return {};
609
- const n = document.documentElement.clientHeight || window.innerHeight, s = Math.min(
610
- t.floating.height,
611
- Math.max(0, n - O * 2)
612
- ), l = O, a = n - s - O;
613
- return {
614
- y: Math.min(Math.max(e, l), Math.max(l, a))
615
- };
616
- }
617
- }, Rt = ({
618
- triggerButton: e,
619
- options: t,
620
- content: n,
621
- selectedOption: s,
622
- disabled: l,
623
- containerClassName: a,
624
- openedClassName: i,
625
- onOptionSelect: m
626
- }) => {
627
- const h = me(), [o, f] = j(!1), { refs: p, floatingStyles: v, context: N } = J({
628
- open: o,
629
- onOpenChange: l ? void 0 : f,
630
- placement: "bottom-end",
631
- strategy: "fixed",
632
- middleware: [
633
- Ie(O),
634
- Se({ padding: O }),
635
- ke({
636
- padding: O,
637
- apply({ availableHeight: x, elements: C }) {
638
- C.floating.style.maxHeight = `${Math.max(
639
- 0,
640
- x
641
- )}px`;
642
- }
643
- }),
644
- De({ padding: O }),
645
- Qe
646
- ],
647
- whileElementsMounted: Ee
648
- }), w = Le(N), b = ee(N, { outsidePress: !0 }), { getReferenceProps: d, getFloatingProps: c } = te([
649
- w,
650
- b
651
- ]);
652
- return L(() => {
653
- o && window.dispatchEvent(
654
- new CustomEvent($, { detail: h })
655
- );
656
- }, [h, o]), L(() => {
657
- const x = (C) => {
658
- C instanceof CustomEvent && C.detail !== h && f(!1);
659
- };
660
- return window.addEventListener($, x), () => {
661
- window.removeEventListener($, x);
662
- };
663
- }, [h]), L(() => {
664
- l && f(!1);
665
- }, [l]), /* @__PURE__ */ u(V, { children: [
666
- /* @__PURE__ */ r(
667
- "div",
668
- {
669
- ref: p.setReference,
670
- ...d({
671
- onClick(x) {
672
- x.stopPropagation();
673
- }
674
- }),
675
- className: g(a, o && i),
676
- children: e
677
- }
678
- ),
679
- o && /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ u(
680
- "div",
681
- {
682
- ref: p.setFloating,
683
- style: { ...v, overflowY: "auto" },
684
- className: "dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",
685
- ...c(),
686
- children: [
687
- n && n,
688
- t && t.map((x) => /* @__PURE__ */ r(
689
- "div",
690
- {
691
- onClick: (C) => {
692
- C.stopPropagation(), m?.(x.key), f(!1);
693
- },
694
- className: g(
695
- "text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
696
- s === x.key && "bg-hues-100"
697
- ),
698
- children: /* @__PURE__ */ u(
699
- "div",
700
- {
701
- className: "dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",
702
- title: x.title,
703
- children: [
704
- x.icon ? x.icon : null,
705
- /* @__PURE__ */ r("p", { children: x?.title })
706
- ]
707
- }
708
- )
709
- },
710
- x.key
711
- ))
712
- ]
713
- }
714
- ) })
715
- ] });
716
- }, _t = ({ limitMessages: e, query: t }) => /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1", children: [
717
- /* @__PURE__ */ r("div", { className: "flex gap-x-[4px]", children: /* @__PURE__ */ r("div", { className: "flex flex-col", children: /* @__PURE__ */ u("div", { className: "flex gap-x-[4px]", children: [
718
- /* @__PURE__ */ u("span", { className: "h5 text-primary", children: [
719
- e?.excelFormatTitle,
720
- " "
721
- ] }),
722
- /* @__PURE__ */ r("span", { className: "body-3 text-neutrals-800", children: e?.excelFormatText })
723
- ] }) }) }),
724
- /* @__PURE__ */ r("a", { href: t, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ u("span", { className: "body-3 flex cursor-pointer items-center gap-x-[4px]", children: [
725
- e?.dataExplorerIcon,
726
- e?.dataExplorer
727
- ] }) })
728
- ] }), At = ({
729
- limitMessages: e,
730
- isDownload: t,
731
- showAdvancedViewButton: n,
732
- onAdvancedViewClick: s,
733
- query: l
734
- }) => /* @__PURE__ */ u(
735
- "div",
736
- {
737
- className: g(
738
- "bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",
739
- e?.containerClassName
740
- ),
741
- children: [
742
- /* @__PURE__ */ u("div", { className: "flex items-center gap-x-2", children: [
743
- /* @__PURE__ */ r("span", { children: e?.warningIcon }),
744
- /* @__PURE__ */ u("div", { className: "flex flex-col gap-1", children: [
745
- /* @__PURE__ */ u("div", { className: "flex gap-x-[4px]", children: [
746
- /* @__PURE__ */ u(
747
- "span",
748
- {
749
- className: g(
750
- "text-primary h5",
751
- e?.largeQueryClassName
752
- ),
753
- children: [
754
- e?.largeQuery,
755
- ":",
756
- " "
757
- ]
758
- }
759
- ),
760
- /* @__PURE__ */ r(
761
- "span",
762
- {
763
- className: g(
764
- "text-neutrals-800 body-3",
765
- e?.limitMessageClassName
766
- ),
767
- children: t ? e?.downloadMessage?.(U) : e?.showingLimit?.(U)
768
- }
769
- )
770
- ] }),
771
- t && /* @__PURE__ */ r(
772
- "span",
773
- {
774
- className: g(
775
- "text-neutrals-800 body-3",
776
- e?.limitMessageClassName
777
- ),
778
- children: e?.fullLimitMessage
779
- }
780
- )
781
- ] })
782
- ] }),
783
- n && /* @__PURE__ */ u(
784
- "span",
785
- {
786
- onClick: () => s?.(),
787
- className: "h4 flex cursor-pointer items-center gap-x-[4px] text-primary",
788
- children: [
789
- e?.editIcon,
790
- e?.refineInAdvancedView
791
- ]
792
- }
793
- ),
794
- t && /* @__PURE__ */ r("a", { href: l || "", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ u("span", { className: "body-3 flex cursor-pointer items-center gap-x-[4px]", children: [
795
- e?.dataExplorerIcon,
796
- e?.dataExplorer
797
- ] }) })
798
- ]
799
- }
800
- ), le = Q(null);
801
- function Mt({
802
- value: e,
803
- children: t
804
- }) {
805
- const n = q(() => e ?? {}, [e]);
806
- return /* @__PURE__ */ r(le.Provider, { value: n, children: t });
130
+ //#endregion
131
+ //#region libs/ui-components/src/constants/tree-view.ts
132
+ var xe = 24, Se = 24, L = 1e3, Ce = 24, we = 768, Te = ({ label: e, onChange: t, value: n, options: r, calendarResolution: a = C.DAY, id: o, icon: c, isEndDate: l }) => {
133
+ let d = s(null), f = I();
134
+ i(() => {
135
+ let t = d?.current;
136
+ t && t.querySelector("input")?.setAttribute("aria-label", e);
137
+ }, [e]);
138
+ let p = {
139
+ ...r,
140
+ disableMobile: !0,
141
+ defaultDate: a === C.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n
142
+ };
143
+ return /* @__PURE__ */ b("div", {
144
+ className: "calendar relative",
145
+ ref: d,
146
+ children: [
147
+ /* @__PURE__ */ y("div", {
148
+ className: "calendar-title mb-1",
149
+ children: e
150
+ }),
151
+ /* @__PURE__ */ y("label", {
152
+ htmlFor: o,
153
+ className: "absolute right-[11px] top-[29px] cursor-pointer",
154
+ children: c || /* @__PURE__ */ y(u, {})
155
+ }),
156
+ /* @__PURE__ */ y(S, {
157
+ defaultValue: (a === C.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n)?.toDateString(),
158
+ options: p,
159
+ onChange: (e) => {
160
+ t(e[0]);
161
+ },
162
+ onOpen: [(e, t, n) => {
163
+ if (a === C.MONTH && e.length > 0) {
164
+ let t = r.minDate, i = r.maxDate, a = e[0].getFullYear(), o = n.calendarContainer, s = "flatpickr-disabled", c = o.querySelectorAll(".flatpickr-monthSelect-month"), l = o.querySelectorAll(".flatpickr-next-month")[0], u = o.querySelectorAll(".flatpickr-prev-month")[0];
165
+ a === i.getFullYear() && l.classList.add(s), a === t.getFullYear() && u.classList.add(s), (a === t.getFullYear() || a === i.getFullYear()) && c.forEach((e) => {
166
+ e.classList.remove(s);
167
+ let n = new Date(e.getAttribute("aria-label")), r = n.getFullYear() === t.getFullYear() && n.getMonth() === t.getMonth(), a = n.getFullYear() === i.getFullYear() && n.getMonth() === i.getMonth();
168
+ r || a || (n < t || n > i) && e.classList.add(s);
169
+ });
170
+ }
171
+ setTimeout(() => {
172
+ let e = n.calendarContainer, t = n._input?.getBoundingClientRect();
173
+ e && (e.style.top = `${t.top - e.offsetHeight - 8}px`, e.style.width = `${e.style.width}px`, l ? (e.style.right = `${window.innerWidth - t.right - (f ? 24 : 0)}px`, e.style.left = "auto") : e.style.left = `${t.left}px`);
174
+ }, 0);
175
+ }],
176
+ onReady: [(e, t, n) => {
177
+ let r = `calendar__${a === C.MONTH ? "month" : "day"}`;
178
+ n.calendarContainer && n.calendarContainer.classList.add(r);
179
+ }],
180
+ id: o
181
+ })
182
+ ]
183
+ });
184
+ }, R = ({ label: e, id: t, checked: r, indeterminate: a = !1, checkboxIcon: o, onChange: c, disabled: u = !1, disabledScope: d = "full", className: f, stopPropagation: p = !0 }) => {
185
+ let m = s(null);
186
+ i(() => {
187
+ m.current && (m.current.indeterminate = !r && a);
188
+ }, [r, a]);
189
+ let _ = n((e) => {
190
+ p && e.stopPropagation();
191
+ }, [p]), v = n((e) => {
192
+ p && e.stopPropagation(), c?.(t, e.target.checked);
193
+ }, [
194
+ c,
195
+ t,
196
+ p
197
+ ]);
198
+ return /* @__PURE__ */ b("label", {
199
+ htmlFor: t,
200
+ onClick: _,
201
+ className: P("flex min-w-0 items-center py-1 shrink-0", u ? "cursor-not-allowed" : "cursor-pointer", u && d === "full" && "opacity-50", f),
202
+ children: [
203
+ /* @__PURE__ */ y("span", {
204
+ className: l("checkbox-button relative flex size-[14px] items-center justify-center", u && d === "icon" && "opacity-50"),
205
+ "aria-hidden": !0,
206
+ children: (() => {
207
+ if (r) return o || /* @__PURE__ */ y(h, { className: "absolute size-4" });
208
+ if (a) return /* @__PURE__ */ y(g, { className: "absolute size-4" });
209
+ })()
210
+ }),
211
+ e ? /* @__PURE__ */ y("p", {
212
+ className: l("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),
213
+ title: e,
214
+ children: e
215
+ }) : null,
216
+ /* @__PURE__ */ y("input", {
217
+ ref: m,
218
+ id: t,
219
+ type: "checkbox",
220
+ checked: r,
221
+ disabled: u,
222
+ onChange: v,
223
+ className: "hidden"
224
+ })
225
+ ]
226
+ });
227
+ }, Ee = ({ title: e, icon: t, children: n, value: r }) => {
228
+ let [i, a] = c(!1);
229
+ return /* @__PURE__ */ b("div", {
230
+ className: `collapsible-block flex flex-col border-t-2 border-neutrals-600 ${i ? "collapsible-block-open" : ""}`,
231
+ children: [/* @__PURE__ */ b("div", {
232
+ className: "collapsible-block-title flex cursor-pointer items-center py-4",
233
+ onClick: () => a(!i),
234
+ children: [/* @__PURE__ */ y("div", {
235
+ className: `${i ? "rotate-180" : ""} transition-transform`,
236
+ children: t || /* @__PURE__ */ y(d, { className: "mr-3 size-5" })
237
+ }), /* @__PURE__ */ b("div", {
238
+ className: "flex flex-1 items-center justify-between",
239
+ children: [/* @__PURE__ */ y("span", { children: e }), r && /* @__PURE__ */ y("p", {
240
+ className: "body-1 text-neutrals-800",
241
+ children: r
242
+ })]
243
+ })]
244
+ }), i && /* @__PURE__ */ y("div", {
245
+ className: "collapsible-block-content pb-4",
246
+ children: n
247
+ })]
248
+ });
249
+ }, De = ({ text: e, highlightText: t }) => /* @__PURE__ */ y(v, { children: o(() => {
250
+ let n = [];
251
+ if (!t) return [{
252
+ id: 0,
253
+ text: e,
254
+ highlight: !1
255
+ }];
256
+ let r = t?.toLowerCase() || "", i = e?.toLowerCase()?.split(r) || "";
257
+ for (let r = 0, a = 0; r < i?.length; r++) {
258
+ let o = i?.[r], s = o.length;
259
+ o !== "" && n.push({
260
+ id: n.length,
261
+ highlight: !1,
262
+ text: e?.substring(a, a + s)
263
+ }), a += s, r !== i?.length - 1 && (n.push({
264
+ id: n.length,
265
+ highlight: !0,
266
+ text: e?.substring(a, a + t.length)
267
+ }), a += t.length);
268
+ }
269
+ return n;
270
+ }, [t, e]).map((e) => /* @__PURE__ */ y("span", {
271
+ className: l(e?.highlight && "bg-highlight"),
272
+ children: e?.text
273
+ }, e?.id)) }), Oe = ({ icon: e, onClick: t, buttonClassName: n, disabled: r, title: i, isBaseIconStyles: a = !0 }) => /* @__PURE__ */ y("button", {
274
+ type: "button",
275
+ className: l(a && "base-icon-button", n),
276
+ onClick: (e) => t?.(e),
277
+ disabled: r,
278
+ title: i,
279
+ "aria-label": "button",
280
+ children: e
281
+ }), z = ({ value: e, inputId: t, placeholder: n = "", cssClass: r = "", type: i = "text", disabled: a, readonly: o, onChange: s, onKeyDown: c, onFocus: u, onBlur: d }) => {
282
+ let f = l("truncate outline-none shadow-none body-1", r, o ? "pointer-events-none" : "");
283
+ return /* @__PURE__ */ y("input", {
284
+ type: i,
285
+ autoComplete: "off",
286
+ id: t,
287
+ placeholder: n,
288
+ value: e || "",
289
+ title: e ? String(e) : "",
290
+ disabled: a,
291
+ className: f,
292
+ onKeyDown: c,
293
+ onFocus: u,
294
+ onBlur: d,
295
+ onChange: (e) => s?.(e.currentTarget.value)
296
+ });
297
+ }, ke = ({ iconBeforeInput: e, iconAfterInput: t, containerClasses: n, cssClass: r, ...i }) => /* @__PURE__ */ b("div", {
298
+ className: l("input w-full flex flex-row", n),
299
+ children: [
300
+ e,
301
+ /* @__PURE__ */ y(z, {
302
+ cssClass: l("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none", r),
303
+ ...i
304
+ }),
305
+ t
306
+ ]
307
+ }), Ae = ({ url: e, title: t, linkClassName: n = "", iconBefore: r, iconAfter: i }) => {
308
+ let a = l(i ? "mr-2" : "", r ? "ml-2" : "");
309
+ return /* @__PURE__ */ b("a", {
310
+ href: e,
311
+ target: "_blank",
312
+ rel: "noopener noreferrer",
313
+ className: l("base-link", n),
314
+ title: t,
315
+ children: [
316
+ r,
317
+ /* @__PURE__ */ y("span", {
318
+ className: a,
319
+ children: t
320
+ }),
321
+ i
322
+ ]
323
+ });
324
+ }, je = ({ title: e, text: t, disabled: n, onClick: r }) => /* @__PURE__ */ y("button", {
325
+ type: "button",
326
+ className: l("tag flex items-center justify-center", "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),
327
+ disabled: n,
328
+ onClick: () => r?.(t || e),
329
+ "aria-label": "button",
330
+ children: /* @__PURE__ */ y("h4", { children: e })
331
+ }), Me = ({ label: e, id: t, checked: r, radioIcon: i, description: a, onChange: o }) => {
332
+ let s = n((e) => {
333
+ e.stopPropagation(), o?.(t, e.target.checked);
334
+ }, [o, t]);
335
+ return /* @__PURE__ */ b("label", {
336
+ className: "flex min-w-0 cursor-pointer flex-col py-[6px]",
337
+ htmlFor: t,
338
+ children: [
339
+ /* @__PURE__ */ b("p", {
340
+ className: "radio-label flex min-w-0 items-center",
341
+ children: [/* @__PURE__ */ y("span", {
342
+ className: l("flex justify-center items-center w-4 h-4 mr-2 relative", "radio-button", r ? "radio-button-active" : ""),
343
+ children: r && i
344
+ }), e && /* @__PURE__ */ y("span", {
345
+ className: "radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",
346
+ title: e,
347
+ children: e
348
+ })]
349
+ }),
350
+ a && /* @__PURE__ */ y("span", {
351
+ className: "radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",
352
+ title: a,
353
+ children: a
354
+ }),
355
+ /* @__PURE__ */ y("input", {
356
+ type: "radio",
357
+ onChange: s,
358
+ id: t,
359
+ checked: r,
360
+ className: "hidden"
361
+ })
362
+ ]
363
+ });
364
+ }, B = /* @__PURE__ */ function(e) {
365
+ return e.Closed = "Closed", e.Opened = "Opened", e;
366
+ }({}), V = /* @__PURE__ */ function(e) {
367
+ return e.LG = "Large", e.SM = "Small", e;
368
+ }({}), Ne = ({ portalId: e, state: t = B.Opened, heading: r, size: i, onClose: a, children: o, overlayClassName: s, containerClassName: c, dividers: u = !0, closeButtonTitle: d }) => {
369
+ let { refs: f, context: p } = k({
370
+ open: t !== B.Closed && !!t,
371
+ onOpenChange: a
372
+ }), { getFloatingProps: m } = A([ae(p, { role: "dialog" }), O(p, { outsidePress: !0 })]), h = n((e) => {
373
+ e?.preventDefault(), e?.stopPropagation(), a();
374
+ }, [a]);
375
+ return /* @__PURE__ */ y(E, {
376
+ id: e,
377
+ children: t !== B.Closed && /* @__PURE__ */ y(T, {
378
+ className: l("z-modal flex items-center justify-center bg-blackout p-4", s),
379
+ children: /* @__PURE__ */ y(w, {
380
+ context: p,
381
+ children: /* @__PURE__ */ b("div", {
382
+ className: l("relative max-h-full modal rounded bg-white flex flex-col shadow w-full", i === V.LG && "max-w-[65%]", i === V.SM && "max-w-[30%]", u && "divide-neutrals-400 divide-y", c, "sm:w-full sm:max-w-full sm:px-4 sm:py-6"),
383
+ ref: f.setFloating,
384
+ ...m({ onClick(e) {
385
+ e.stopPropagation();
386
+ } }),
387
+ children: [/* @__PURE__ */ b("div", {
388
+ className: "modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2",
389
+ children: [r && (typeof r == "string" ? /* @__PURE__ */ y("h2", {
390
+ className: "modal-heading-title sm:h3 mr-3 min-w-0 flex-1",
391
+ children: r
392
+ }) : r), /* @__PURE__ */ y(j, {
393
+ title: d,
394
+ onClick: h,
395
+ btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
396
+ })]
397
+ }), o.map((e) => e)]
398
+ })
399
+ })
400
+ })
401
+ });
402
+ }, Pe = (e) => e.state === B.Closed ? null : /* @__PURE__ */ y(Ne, { ...e }), H = "statgpt-dropdown-open", U = 8, Fe = {
403
+ name: "keepDropdownWithinViewport",
404
+ fn({ y: e, rects: t }) {
405
+ if (typeof window > "u") return {};
406
+ let n = document.documentElement.clientHeight || window.innerHeight, r = Math.min(t.floating.height, Math.max(0, n - U * 2)), i = U, a = n - r - U;
407
+ return { y: Math.min(Math.max(e, i), Math.max(i, a)) };
408
+ }
409
+ }, Ie = ({ triggerButton: e, options: t, content: n, selectedOption: r, disabled: o, containerClassName: s, openedClassName: u, onOptionSelect: d }) => {
410
+ let f = a(), [p, m] = c(!1), { refs: h, floatingStyles: g, context: _ } = k({
411
+ open: p,
412
+ onOpenChange: o ? void 0 : m,
413
+ placement: "bottom-end",
414
+ strategy: "fixed",
415
+ middleware: [
416
+ te(U),
417
+ ee({ padding: U }),
418
+ re({
419
+ padding: U,
420
+ apply({ availableHeight: e, elements: t }) {
421
+ t.floating.style.maxHeight = `${Math.max(0, e)}px`;
422
+ }
423
+ }),
424
+ ne({ padding: U }),
425
+ Fe
426
+ ],
427
+ whileElementsMounted: D
428
+ }), { getReferenceProps: x, getFloatingProps: S } = A([ie(_), O(_, { outsidePress: !0 })]);
429
+ return i(() => {
430
+ p && window.dispatchEvent(new CustomEvent(H, { detail: f }));
431
+ }, [f, p]), i(() => {
432
+ let e = (e) => {
433
+ e instanceof CustomEvent && e.detail !== f && m(!1);
434
+ };
435
+ return window.addEventListener(H, e), () => {
436
+ window.removeEventListener(H, e);
437
+ };
438
+ }, [f]), i(() => {
439
+ o && m(!1);
440
+ }, [o]), /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y("div", {
441
+ ref: h.setReference,
442
+ ...x({ onClick(e) {
443
+ e.stopPropagation();
444
+ } }),
445
+ className: l(s, p && u),
446
+ children: e
447
+ }), p && /* @__PURE__ */ y(E, { children: /* @__PURE__ */ b("div", {
448
+ ref: h.setFloating,
449
+ style: {
450
+ ...g,
451
+ overflowY: "auto"
452
+ },
453
+ className: "dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",
454
+ ...S(),
455
+ children: [n && n, t && t.map((e) => /* @__PURE__ */ y("div", {
456
+ onClick: (t) => {
457
+ t.stopPropagation(), d?.(e.key), m(!1);
458
+ },
459
+ className: l("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]", r === e.key && "bg-hues-100"),
460
+ children: /* @__PURE__ */ b("div", {
461
+ className: "dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",
462
+ title: e.title,
463
+ children: [e.icon ? e.icon : null, /* @__PURE__ */ y("p", { children: e?.title })]
464
+ })
465
+ }, e.key))]
466
+ }) })] });
467
+ }, Le = ({ limitMessages: e, query: t }) => /* @__PURE__ */ b("div", {
468
+ className: "flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",
469
+ children: [/* @__PURE__ */ y("div", {
470
+ className: "flex gap-x-[4px]",
471
+ children: /* @__PURE__ */ y("div", {
472
+ className: "flex flex-col",
473
+ children: /* @__PURE__ */ b("div", {
474
+ className: "flex gap-x-[4px]",
475
+ children: [/* @__PURE__ */ b("span", {
476
+ className: "h5 text-primary",
477
+ children: [e?.excelFormatTitle, " "]
478
+ }), /* @__PURE__ */ y("span", {
479
+ className: "body-3 text-neutrals-800",
480
+ children: e?.excelFormatText
481
+ })]
482
+ })
483
+ })
484
+ }), /* @__PURE__ */ y("a", {
485
+ href: t,
486
+ target: "_blank",
487
+ rel: "noreferrer",
488
+ children: /* @__PURE__ */ b("span", {
489
+ className: "body-3 flex cursor-pointer items-center gap-x-[4px]",
490
+ children: [e?.dataExplorerIcon, e?.dataExplorer]
491
+ })
492
+ })]
493
+ }), Re = ({ limitMessages: e, isDownload: t, showAdvancedViewButton: n, onAdvancedViewClick: r, query: i }) => /* @__PURE__ */ b("div", {
494
+ className: l("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center", e?.containerClassName),
495
+ children: [
496
+ /* @__PURE__ */ b("div", {
497
+ className: "flex items-center gap-x-2",
498
+ children: [/* @__PURE__ */ y("span", { children: e?.warningIcon }), /* @__PURE__ */ b("div", {
499
+ className: "flex flex-col gap-1",
500
+ children: [/* @__PURE__ */ b("div", {
501
+ className: "flex gap-x-[4px]",
502
+ children: [/* @__PURE__ */ b("span", {
503
+ className: l("text-primary h5", e?.largeQueryClassName),
504
+ children: [
505
+ e?.largeQuery,
506
+ ":",
507
+ " "
508
+ ]
509
+ }), /* @__PURE__ */ y("span", {
510
+ className: l("text-neutrals-800 body-3", e?.limitMessageClassName),
511
+ children: t ? e?.downloadMessage?.(L) : e?.showingLimit?.(L)
512
+ })]
513
+ }), t && /* @__PURE__ */ y("span", {
514
+ className: l("text-neutrals-800 body-3", e?.limitMessageClassName),
515
+ children: e?.fullLimitMessage
516
+ })]
517
+ })]
518
+ }),
519
+ n && /* @__PURE__ */ b("span", {
520
+ onClick: () => r?.(),
521
+ className: "h4 flex cursor-pointer items-center gap-x-[4px] text-primary",
522
+ children: [e?.editIcon, e?.refineInAdvancedView]
523
+ }),
524
+ t && /* @__PURE__ */ y("a", {
525
+ href: i || "",
526
+ target: "_blank",
527
+ rel: "noreferrer",
528
+ children: /* @__PURE__ */ b("span", {
529
+ className: "body-3 flex cursor-pointer items-center gap-x-[4px]",
530
+ children: [e?.dataExplorerIcon, e?.dataExplorer]
531
+ })
532
+ })
533
+ ]
534
+ }), W = t(null);
535
+ function ze({ value: e, children: t }) {
536
+ let n = o(() => e ?? {}, [e]);
537
+ return /* @__PURE__ */ y(W.Provider, {
538
+ value: n,
539
+ children: t
540
+ });
807
541
  }
808
- function Ke() {
809
- return K(le);
542
+ function Be() {
543
+ return r(W);
810
544
  }
811
- var M = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Warning = "warning", e.Note = "note", e))(M || {});
812
- const Xe = {
813
- [M.Info]: "border-neutrals-800 bg-neutrals-300 text-neutrals-1000",
814
- [M.Error]: "border-semantic-error bg-semantic-error-light text-neutrals-1000",
815
- [M.Warning]: "border-semantic-warning bg-semantic-warning-light text-neutrals-1000",
816
- [M.Note]: "border-hues-900 bg-neutrals-200 text-neutrals-1000"
817
- }, Ze = "shrink-0", Je = "min-w-0 body-2", et = "flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";
818
- function Tt({
819
- type: e,
820
- icon: t,
821
- children: n,
822
- className: s,
823
- contentClassName: l
824
- }) {
825
- const a = Ke(), i = t ?? a?.icons?.[e], m = a?.classes?.container ?? et, h = a?.classes?.types?.[e] ?? Xe[e], o = F(m, h, s), f = F(Ze, a?.classes?.icon), p = F(
826
- Je,
827
- a?.classes?.content,
828
- l
829
- );
830
- return /* @__PURE__ */ u("div", { "data-type": e, className: o, children: [
831
- i ? /* @__PURE__ */ r("span", { className: f, children: i }) : null,
832
- n ? /* @__PURE__ */ r("div", { className: p, children: n }) : null
833
- ] });
545
+ //#endregion
546
+ //#region libs/ui-components/src/components/InlineAlert/types.ts
547
+ var G = /* @__PURE__ */ function(e) {
548
+ return e.Info = "info", e.Error = "error", e.Warning = "warning", e.Note = "note", e;
549
+ }({}), Ve = {
550
+ [G.Info]: "border-neutrals-800 bg-neutrals-300 text-neutrals-1000",
551
+ [G.Error]: "border-semantic-error bg-semantic-error-light text-neutrals-1000",
552
+ [G.Warning]: "border-semantic-warning bg-semantic-warning-light text-neutrals-1000",
553
+ [G.Note]: "border-hues-900 bg-neutrals-200 text-neutrals-1000"
554
+ }, He = "shrink-0", Ue = "min-w-0 body-2", We = "flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";
555
+ function Ge({ type: e, icon: t, children: n, className: r, contentClassName: i }) {
556
+ let a = Be(), o = t ?? a?.icons?.[e], s = P(a?.classes?.container ?? We, a?.classes?.types?.[e] ?? Ve[e], r), c = P(He, a?.classes?.icon), l = P(Ue, a?.classes?.content, i);
557
+ return /* @__PURE__ */ b("div", {
558
+ "data-type": e,
559
+ className: s,
560
+ children: [o ? /* @__PURE__ */ y("span", {
561
+ className: c,
562
+ children: o
563
+ }) : null, n ? /* @__PURE__ */ y("div", {
564
+ className: l,
565
+ children: n
566
+ }) : null]
567
+ });
834
568
  }
835
- const Pt = ({
836
- title: e,
837
- copiedTitle: t,
838
- tooltip: n,
839
- hoverTooltip: s,
840
- icon: l,
841
- copiedIcon: a,
842
- className: i,
843
- buttonTextClassName: m,
844
- onClick: h
845
- }) => {
846
- const [o, f] = j(!1), p = z(null), v = () => {
847
- h(), f(!0), p.current && clearTimeout(p.current), p.current = setTimeout(() => {
848
- f(!1);
849
- }, 1e3);
850
- };
851
- return L(() => () => {
852
- p.current && clearTimeout(p.current);
853
- }, []), /* @__PURE__ */ u("div", { className: "relative w-fit", title: s, children: [
854
- /* @__PURE__ */ r(
855
- Be,
856
- {
857
- title: o ? t : e,
858
- isSmallButton: !0,
859
- disabled: o,
860
- buttonClassName: F([
861
- "text-button-tertiary small-icon-button !h-6 !p-0",
862
- i
863
- ]),
864
- textClassName: F(["ml-1", m]),
865
- onClick: v,
866
- iconBefore: o ? a : l
867
- }
868
- ),
869
- n && o && /* @__PURE__ */ r("div", { className: "h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow", children: n })
870
- ] });
569
+ //#endregion
570
+ //#region libs/ui-components/src/components/CopyButton/CopyButton.tsx
571
+ var Ke = ({ title: e, copiedTitle: t, tooltip: n, hoverTooltip: r, icon: a, copiedIcon: o, className: l, buttonTextClassName: u, onClick: d }) => {
572
+ let [f, p] = c(!1), m = s(null);
573
+ return i(() => () => {
574
+ m.current && clearTimeout(m.current);
575
+ }, []), /* @__PURE__ */ b("div", {
576
+ className: "relative w-fit",
577
+ title: r,
578
+ children: [/* @__PURE__ */ y(F, {
579
+ title: f ? t : e,
580
+ isSmallButton: !0,
581
+ disabled: f,
582
+ buttonClassName: P(["text-button-tertiary small-icon-button !h-6 !p-0", l]),
583
+ textClassName: P(["ml-1", u]),
584
+ onClick: () => {
585
+ d(), p(!0), m.current && clearTimeout(m.current), m.current = setTimeout(() => {
586
+ p(!1);
587
+ }, 1e3);
588
+ },
589
+ iconBefore: f ? o : a
590
+ }), n && f && /* @__PURE__ */ y("div", {
591
+ className: "h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",
592
+ children: n
593
+ })]
594
+ });
871
595
  };
872
- function tt({
873
- id: e,
874
- label: t,
875
- hasChildren: n,
876
- showDragHandle: s,
877
- showCheckbox: l,
878
- isChecked: a,
879
- isExpanded: i
880
- }) {
881
- return /* @__PURE__ */ u("div", { className: "relative cursor-grabbing rounded bg-neutrals-200 shadow", children: [
882
- /* @__PURE__ */ r("div", { className: "absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light" }),
883
- /* @__PURE__ */ u("div", { className: "flex items-stretch overflow-hidden rounded", children: [
884
- s ? /* @__PURE__ */ r("div", { className: "flex w-6 items-center justify-center", children: /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "rounded p-1", children: /* @__PURE__ */ r(X, { size: 16 }) }) }) : null,
885
- /* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 items-center gap-2 p-1", children: [
886
- l ? /* @__PURE__ */ r(se, { id: e, checked: !!a, className: "p-0" }) : null,
887
- /* @__PURE__ */ r("span", { className: "body-3 truncate", children: t })
888
- ] }),
889
- n ? /* @__PURE__ */ r("div", { className: "flex w-8 items-center justify-center", children: /* @__PURE__ */ r(
890
- "span",
891
- {
892
- "aria-hidden": !0,
893
- className: g(
894
- "transition-transform",
895
- i ? "rotate-90" : "rotate-0"
896
- ),
897
- children: /* @__PURE__ */ r(Z, { size: 16 })
898
- }
899
- ) }) : null
900
- ] })
901
- ] });
596
+ //#endregion
597
+ //#region libs/ui-components/src/components/DraggableList/DraggableListOverlay.tsx
598
+ function qe({ id: e, label: t, hasChildren: n, showDragHandle: r, showCheckbox: i, isChecked: a, isExpanded: o }) {
599
+ return /* @__PURE__ */ b("div", {
600
+ className: "relative cursor-grabbing rounded bg-neutrals-200 shadow",
601
+ children: [/* @__PURE__ */ y("div", { className: "absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light" }), /* @__PURE__ */ b("div", {
602
+ className: "flex items-stretch overflow-hidden rounded",
603
+ children: [
604
+ r ? /* @__PURE__ */ y("div", {
605
+ className: "flex w-6 items-center justify-center",
606
+ children: /* @__PURE__ */ y("span", {
607
+ "aria-hidden": !0,
608
+ className: "rounded p-1",
609
+ children: /* @__PURE__ */ y(m, { size: 16 })
610
+ })
611
+ }) : null,
612
+ /* @__PURE__ */ b("div", {
613
+ className: "flex min-w-0 flex-1 items-center gap-2 p-1",
614
+ children: [i ? /* @__PURE__ */ y(R, {
615
+ id: e,
616
+ checked: !!a,
617
+ className: "p-0"
618
+ }) : null, /* @__PURE__ */ y("span", {
619
+ className: "body-3 truncate",
620
+ children: t
621
+ })]
622
+ }),
623
+ n ? /* @__PURE__ */ y("div", {
624
+ className: "flex w-8 items-center justify-center",
625
+ children: /* @__PURE__ */ y("span", {
626
+ "aria-hidden": !0,
627
+ className: l("transition-transform", o ? "rotate-90" : "rotate-0"),
628
+ children: /* @__PURE__ */ y(f, { size: 16 })
629
+ })
630
+ }) : null
631
+ ]
632
+ })]
633
+ });
902
634
  }
903
- function ae(e, t) {
904
- return `i:${[...e, t].join("/")}`;
635
+ //#endregion
636
+ //#region libs/ui-components/src/components/DraggableList/utils/utils.ts
637
+ function K(e, t) {
638
+ return `i:${[...e, t].join("/")}`;
905
639
  }
906
- function G(e) {
907
- if (!e.startsWith("i:")) return null;
908
- const n = e.slice(2).split("/").filter(Boolean);
909
- return n.length ? {
910
- parentPath: n.slice(0, -1),
911
- itemId: n[n.length - 1]
912
- } : null;
640
+ function q(e) {
641
+ if (!e.startsWith("i:")) return null;
642
+ let t = e.slice(2).split("/").filter(Boolean);
643
+ return t.length ? {
644
+ parentPath: t.slice(0, -1),
645
+ itemId: t[t.length - 1]
646
+ } : null;
913
647
  }
914
- function nt(e, t, n) {
915
- const s = oe(e, t);
916
- return s ? s.find((l) => l.id === n) ?? null : null;
648
+ function Je(e, t, n) {
649
+ let r = Y(e, t);
650
+ return r ? r.find((e) => e.id === n) ?? null : null;
917
651
  }
918
- function ie(e, t) {
919
- if (t.length === 0) return e;
920
- const [n, ...s] = t, l = e.find((a) => a.id === n);
921
- return l?.items ? ie(l.items, s) : null;
652
+ function J(e, t) {
653
+ if (t.length === 0) return e;
654
+ let [n, ...r] = t, i = e.find((e) => e.id === n);
655
+ return i?.items ? J(i.items, r) : null;
922
656
  }
923
- function oe(e, t) {
924
- const n = ie(e, t);
925
- return n ? n.filter(
926
- (s) => s.type === "item"
927
- ) : null;
657
+ function Y(e, t) {
658
+ let n = J(e, t);
659
+ return n ? n.filter((e) => e.type === "item") : null;
928
660
  }
929
- function ce(e, t, n) {
930
- if (t.length === 0)
931
- return n(e);
932
- const [s, ...l] = t;
933
- return e.map((a) => a.id !== s || !a.items ? a : {
934
- ...a,
935
- items: ce(a.items, l, n)
936
- });
661
+ function X(e, t, n) {
662
+ if (t.length === 0) return n(e);
663
+ let [r, ...i] = t;
664
+ return e.map((e) => e.id !== r || !e.items ? e : {
665
+ ...e,
666
+ items: X(e.items, i, n)
667
+ });
937
668
  }
938
- function rt({
939
- parentPath: e,
940
- item: t,
941
- showDragHandle: n,
942
- showCheckbox: s,
943
- renderLabel: l,
944
- onItemClick: a,
945
- onToggleExpanded: i,
946
- onToggleChecked: m
947
- }) {
948
- const h = !!t.items?.length, o = !!t.isExpanded, f = t.isDisabled ? !1 : t.draggable ?? !0, p = t.isDisabled ? !1 : t.checkable ?? !0, v = ae(e, t.id), {
949
- attributes: N,
950
- listeners: w,
951
- setNodeRef: b,
952
- setActivatorNodeRef: d,
953
- transform: c,
954
- transition: x,
955
- isDragging: C
956
- } = Te({ id: v, disabled: !f }), S = {
957
- transform: ze.Transform.toString(c),
958
- transition: x,
959
- opacity: C ? 0.6 : void 0
960
- }, y = !!t.isDisabled, E = y || !p, D = [...e, t.id];
961
- return /* @__PURE__ */ u(
962
- "div",
963
- {
964
- ref: b,
965
- style: S,
966
- className: g([
967
- "group flex items-stretch overflow-hidden rounded bg-white",
968
- "select-none",
969
- y ? "opacity-50" : ""
970
- ]),
971
- children: [
972
- n ? /* @__PURE__ */ r(
973
- "div",
974
- {
975
- className: g([
976
- "group/drag-handle flex w-6 items-center justify-center rounded",
977
- y ? "" : "hover:bg-neutrals-100 cursor-grab"
978
- ]),
979
- children: /* @__PURE__ */ r(
980
- "span",
981
- {
982
- ref: d,
983
- "aria-hidden": !0,
984
- className: g([
985
- "rounded p-1",
986
- f ? "cursor-grab" : "cursor-default",
987
- "transition-opacity"
988
- ]),
989
- ...f ? w : {},
990
- ...f ? N : {},
991
- children: /* @__PURE__ */ r(
992
- X,
993
- {
994
- size: 16,
995
- className: "text-neutrals-800 group-hover/drag-handle:text-primary"
996
- }
997
- )
998
- }
999
- )
1000
- }
1001
- ) : null,
1002
- /* @__PURE__ */ u(
1003
- "button",
1004
- {
1005
- type: "button",
1006
- disabled: y,
1007
- "aria-disabled": E,
1008
- onClick: (k) => {
1009
- E || a?.({
1010
- itemId: t.id,
1011
- path: D,
1012
- nativeEvent: k
1013
- });
1014
- },
1015
- className: g([
1016
- "flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",
1017
- y ? "" : "hover:bg-neutrals-100",
1018
- y ? "" : "hover:text-blue-700",
1019
- "focus:outline-none"
1020
- ]),
1021
- children: [
1022
- s ? /* @__PURE__ */ r(
1023
- se,
1024
- {
1025
- id: `draggable-list-${D.join("-")}`,
1026
- checked: !!t.isChecked,
1027
- disabled: !p,
1028
- className: "p-0",
1029
- stopPropagation: !0,
1030
- onChange: (k, I) => m?.({
1031
- itemId: t.id,
1032
- path: D,
1033
- nextChecked: !!I
1034
- })
1035
- }
1036
- ) : null,
1037
- /* @__PURE__ */ r("span", { className: "body-3 w-full truncate text-neutrals-800", children: l ? l(t) : t.label })
1038
- ]
1039
- }
1040
- ),
1041
- h ? /* @__PURE__ */ r(
1042
- "button",
1043
- {
1044
- type: "button",
1045
- disabled: y,
1046
- onClick: (k) => {
1047
- k.stopPropagation(), i?.({
1048
- itemId: t.id,
1049
- path: D,
1050
- nextExpanded: !o
1051
- });
1052
- },
1053
- "aria-label": o ? "Collapse" : "Expand",
1054
- className: g([
1055
- "flex w-8 items-center justify-center rounded",
1056
- y ? "" : "hover:bg-neutrals-100",
1057
- "focus:outline-none"
1058
- ]),
1059
- children: /* @__PURE__ */ r(
1060
- "span",
1061
- {
1062
- "aria-hidden": !0,
1063
- className: g(
1064
- "transition-transform duration-150 ease-out",
1065
- o ? "rotate-90" : "rotate-0"
1066
- ),
1067
- children: /* @__PURE__ */ r(Z, { size: 16 })
1068
- }
1069
- )
1070
- }
1071
- ) : null
1072
- ]
1073
- }
1074
- );
669
+ //#endregion
670
+ //#region libs/ui-components/src/components/DraggableList/DraggableListRow.tsx
671
+ function Ye({ parentPath: e, item: t, showDragHandle: n, showCheckbox: r, renderLabel: i, onItemClick: a, onToggleExpanded: o, onToggleChecked: s }) {
672
+ let c = !!t.items?.length, u = !!t.isExpanded, d = t.isDisabled ? !1 : t.draggable ?? !0, p = t.isDisabled ? !1 : t.checkable ?? !0, { attributes: h, listeners: g, setNodeRef: _, setActivatorNodeRef: v, transform: x, transition: S, isDragging: C } = me({
673
+ id: K(e, t.id),
674
+ disabled: !d
675
+ }), w = {
676
+ transform: ge.Transform.toString(x),
677
+ transition: S,
678
+ opacity: C ? .6 : void 0
679
+ }, T = !!t.isDisabled, E = T || !p, D = [...e, t.id];
680
+ return /* @__PURE__ */ b("div", {
681
+ ref: _,
682
+ style: w,
683
+ className: l([
684
+ "group flex items-stretch overflow-hidden rounded bg-white",
685
+ "select-none",
686
+ T ? "opacity-50" : ""
687
+ ]),
688
+ children: [
689
+ n ? /* @__PURE__ */ y("div", {
690
+ className: l(["group/drag-handle flex w-6 items-center justify-center rounded", T ? "" : "hover:bg-neutrals-100 cursor-grab"]),
691
+ children: /* @__PURE__ */ y("span", {
692
+ ref: v,
693
+ "aria-hidden": !0,
694
+ className: l([
695
+ "rounded p-1",
696
+ d ? "cursor-grab" : "cursor-default",
697
+ "transition-opacity"
698
+ ]),
699
+ ...d ? g : {},
700
+ ...d ? h : {},
701
+ children: /* @__PURE__ */ y(m, {
702
+ size: 16,
703
+ className: "text-neutrals-800 group-hover/drag-handle:text-primary"
704
+ })
705
+ })
706
+ }) : null,
707
+ /* @__PURE__ */ b("button", {
708
+ type: "button",
709
+ disabled: T,
710
+ "aria-disabled": E,
711
+ onClick: (e) => {
712
+ E || a?.({
713
+ itemId: t.id,
714
+ path: D,
715
+ nativeEvent: e
716
+ });
717
+ },
718
+ className: l([
719
+ "flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",
720
+ T ? "" : "hover:bg-neutrals-100",
721
+ T ? "" : "hover:text-blue-700",
722
+ "focus:outline-none"
723
+ ]),
724
+ children: [r ? /* @__PURE__ */ y(R, {
725
+ id: `draggable-list-${D.join("-")}`,
726
+ checked: !!t.isChecked,
727
+ disabled: !p,
728
+ className: "p-0",
729
+ stopPropagation: !0,
730
+ onChange: (e, n) => s?.({
731
+ itemId: t.id,
732
+ path: D,
733
+ nextChecked: !!n
734
+ })
735
+ }) : null, /* @__PURE__ */ y("span", {
736
+ className: "body-3 w-full truncate text-neutrals-800",
737
+ children: i ? i(t) : t.label
738
+ })]
739
+ }),
740
+ c ? /* @__PURE__ */ y("button", {
741
+ type: "button",
742
+ disabled: T,
743
+ onClick: (e) => {
744
+ e.stopPropagation(), o?.({
745
+ itemId: t.id,
746
+ path: D,
747
+ nextExpanded: !u
748
+ });
749
+ },
750
+ "aria-label": u ? "Collapse" : "Expand",
751
+ className: l([
752
+ "flex w-8 items-center justify-center rounded",
753
+ T ? "" : "hover:bg-neutrals-100",
754
+ "focus:outline-none"
755
+ ]),
756
+ children: /* @__PURE__ */ y("span", {
757
+ "aria-hidden": !0,
758
+ className: l("transition-transform duration-150 ease-out", u ? "rotate-90" : "rotate-0"),
759
+ children: /* @__PURE__ */ y(f, { size: 16 })
760
+ })
761
+ }) : null
762
+ ]
763
+ });
1075
764
  }
1076
- function Yt({
1077
- items: e,
1078
- showDragHandle: t = !0,
1079
- showCheckbox: n = !0,
1080
- onItemsChange: s,
1081
- onToggleExpanded: l,
1082
- onToggleChecked: a,
1083
- onItemClick: i,
1084
- renderLabel: m
1085
- }) {
1086
- const h = Oe(
1087
- Fe(Re, { activationConstraint: { distance: 6 } })
1088
- ), [o, f] = ue.useState(null), p = (w) => {
1089
- const b = String(w.active.id), d = G(b);
1090
- if (!d) return;
1091
- const c = nt(e, d.parentPath, d.itemId);
1092
- !c || c.type !== "item" || f({
1093
- id: b,
1094
- label: c.label,
1095
- hasChildren: !!c.items?.length,
1096
- isChecked: c.isChecked,
1097
- isExpanded: c.isExpanded
1098
- });
1099
- }, v = (w) => {
1100
- f(null);
1101
- const b = w.over;
1102
- if (!b) return;
1103
- const d = G(String(w.active.id)), c = G(String(b.id));
1104
- if (!d || !c || d.parentPath.join("/") !== c.parentPath.join("/")) return;
1105
- const x = oe(e, d.parentPath);
1106
- if (!x) return;
1107
- const C = x.findIndex((E) => E.id === d.itemId), S = x.findIndex((E) => E.id === c.itemId);
1108
- if (C === -1 || S === -1 || C === S) return;
1109
- const y = ce(e, d.parentPath, (E) => {
1110
- const D = E.filter(
1111
- (R) => R.type === "item"
1112
- ), k = je(D, C, S);
1113
- let I = 0;
1114
- return E.map((R) => {
1115
- if (R.type !== "item") return R;
1116
- const H = k[I];
1117
- return I += 1, H;
1118
- });
1119
- });
1120
- s(y);
1121
- }, N = (w, b = []) => {
1122
- const d = w.filter((c) => c.type === "item").map((c) => ae(b, c.id));
1123
- return /* @__PURE__ */ r(
1124
- Pe,
1125
- {
1126
- items: d,
1127
- strategy: Ye,
1128
- children: /* @__PURE__ */ r("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children: w.map((c) => c.type === "group" ? /* @__PURE__ */ u(
1129
- "li",
1130
- {
1131
- className: "m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",
1132
- children: [
1133
- /* @__PURE__ */ u("div", { className: "h5 flex items-center gap-2 py-1 text-neutrals-1000", children: [
1134
- /* @__PURE__ */ r(be, { size: 12, className: "shrink-0" }),
1135
- c.label
1136
- ] }),
1137
- /* @__PURE__ */ r("div", { className: "border-l border-neutrals-600 pl-2", children: N(c.items, [...b, c.id]) })
1138
- ]
1139
- },
1140
- c.id
1141
- ) : /* @__PURE__ */ u("li", { className: "m-0 flex flex-col gap-2 p-0", children: [
1142
- /* @__PURE__ */ r(
1143
- rt,
1144
- {
1145
- parentPath: b,
1146
- item: c,
1147
- showDragHandle: t,
1148
- showCheckbox: n,
1149
- renderLabel: m,
1150
- onItemClick: i,
1151
- onToggleExpanded: l,
1152
- onToggleChecked: a
1153
- }
1154
- ),
1155
- c.items?.length && c.isExpanded ? /* @__PURE__ */ r("div", { className: "pl-7", children: N(c.items, [...b, c.id]) }) : null
1156
- ] }, c.id)) })
1157
- }
1158
- );
1159
- };
1160
- return /* @__PURE__ */ u(
1161
- _e,
1162
- {
1163
- sensors: h,
1164
- collisionDetection: Ae,
1165
- onDragStart: p,
1166
- onDragEnd: v,
1167
- children: [
1168
- /* @__PURE__ */ r("div", { className: "flex flex-col", children: N(e) }),
1169
- /* @__PURE__ */ r(Me, { children: o ? /* @__PURE__ */ r(
1170
- tt,
1171
- {
1172
- id: o.id,
1173
- label: o.label,
1174
- hasChildren: o.hasChildren,
1175
- showDragHandle: t,
1176
- showCheckbox: n,
1177
- isChecked: o.isChecked,
1178
- isExpanded: o.isExpanded
1179
- }
1180
- ) : null })
1181
- ]
1182
- }
1183
- );
765
+ //#endregion
766
+ //#region libs/ui-components/src/components/DraggableList/DraggableList.tsx
767
+ function Xe({ items: t, showDragHandle: n = !0, showCheckbox: r = !0, onItemsChange: i, onToggleExpanded: a, onToggleChecked: o, onItemClick: s, renderLabel: c }) {
768
+ let l = de(ue(ce, { activationConstraint: { distance: 6 } })), [u, d] = e.useState(null), f = (e) => {
769
+ let n = String(e.active.id), r = q(n);
770
+ if (!r) return;
771
+ let i = Je(t, r.parentPath, r.itemId);
772
+ !i || i.type !== "item" || d({
773
+ id: n,
774
+ label: i.label,
775
+ hasChildren: !!i.items?.length,
776
+ isChecked: i.isChecked,
777
+ isExpanded: i.isExpanded
778
+ });
779
+ }, m = (e) => {
780
+ d(null);
781
+ let n = e.over;
782
+ if (!n) return;
783
+ let r = q(String(e.active.id)), a = q(String(n.id));
784
+ if (!r || !a || r.parentPath.join("/") !== a.parentPath.join("/")) return;
785
+ let o = Y(t, r.parentPath);
786
+ if (!o) return;
787
+ let s = o.findIndex((e) => e.id === r.itemId), c = o.findIndex((e) => e.id === a.itemId);
788
+ s === -1 || c === -1 || s === c || i(X(t, r.parentPath, (e) => {
789
+ let t = pe(e.filter((e) => e.type === "item"), s, c), n = 0;
790
+ return e.map((e) => {
791
+ if (e.type !== "item") return e;
792
+ let r = t[n];
793
+ return n += 1, r;
794
+ });
795
+ }));
796
+ }, h = (e, t = []) => /* @__PURE__ */ y(fe, {
797
+ items: e.filter((e) => e.type === "item").map((e) => K(t, e.id)),
798
+ strategy: he,
799
+ children: /* @__PURE__ */ y("ul", {
800
+ className: "m-0 flex list-none flex-col gap-2 p-0",
801
+ children: e.map((e) => e.type === "group" ? /* @__PURE__ */ b("li", {
802
+ className: "m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",
803
+ children: [/* @__PURE__ */ b("div", {
804
+ className: "h5 flex items-center gap-2 py-1 text-neutrals-1000",
805
+ children: [/* @__PURE__ */ y(p, {
806
+ size: 12,
807
+ className: "shrink-0"
808
+ }), e.label]
809
+ }), /* @__PURE__ */ y("div", {
810
+ className: "border-l border-neutrals-600 pl-2",
811
+ children: h(e.items, [...t, e.id])
812
+ })]
813
+ }, e.id) : /* @__PURE__ */ b("li", {
814
+ className: "m-0 flex flex-col gap-2 p-0",
815
+ children: [/* @__PURE__ */ y(Ye, {
816
+ parentPath: t,
817
+ item: e,
818
+ showDragHandle: n,
819
+ showCheckbox: r,
820
+ renderLabel: c,
821
+ onItemClick: s,
822
+ onToggleExpanded: a,
823
+ onToggleChecked: o
824
+ }), e.items?.length && e.isExpanded ? /* @__PURE__ */ y("div", {
825
+ className: "pl-7",
826
+ children: h(e.items, [...t, e.id])
827
+ }) : null]
828
+ }, e.id))
829
+ })
830
+ });
831
+ return /* @__PURE__ */ b(oe, {
832
+ sensors: l,
833
+ collisionDetection: le,
834
+ onDragStart: f,
835
+ onDragEnd: m,
836
+ children: [/* @__PURE__ */ y("div", {
837
+ className: "flex flex-col",
838
+ children: h(t)
839
+ }), /* @__PURE__ */ y(se, { children: u ? /* @__PURE__ */ y(qe, {
840
+ id: u.id,
841
+ label: u.label,
842
+ hasChildren: u.hasChildren,
843
+ showDragHandle: n,
844
+ showCheckbox: r,
845
+ isChecked: u.isChecked,
846
+ isExpanded: u.isExpanded
847
+ }) : null })]
848
+ });
1184
849
  }
1185
- const st = (e, t) => e.label.toLowerCase().includes(t);
1186
- function jt(e, t, n = {}) {
1187
- const s = at(t);
1188
- if (!s)
1189
- return e;
1190
- const {
1191
- expandMatchedBranches: l = !0,
1192
- includeGroupDescendantsOnMatch: a = !0,
1193
- includeItemDescendantsOnMatch: i = !1,
1194
- match: m = st
1195
- } = n;
1196
- return W(e, s, {
1197
- expandMatchedBranches: l,
1198
- includeGroupDescendantsOnMatch: a,
1199
- includeItemDescendantsOnMatch: i,
1200
- match: m
1201
- }) ?? [];
850
+ //#endregion
851
+ //#region libs/ui-components/src/components/DraggableList/utils/filter-util.ts
852
+ var Ze = (e, t) => e.label.toLowerCase().includes(t);
853
+ function Qe(e, t, n = {}) {
854
+ let r = et(t);
855
+ if (!r) return e;
856
+ let { expandMatchedBranches: i = !0, includeGroupDescendantsOnMatch: a = !0, includeItemDescendantsOnMatch: o = !1, match: s = Ze } = n;
857
+ return Z(e, r, {
858
+ expandMatchedBranches: i,
859
+ includeGroupDescendantsOnMatch: a,
860
+ includeItemDescendantsOnMatch: o,
861
+ match: s
862
+ }) ?? [];
1202
863
  }
1203
- function W(e, t, n) {
1204
- const s = [];
1205
- for (const l of e) {
1206
- const a = lt(l, t, n);
1207
- a && s.push(a);
1208
- }
1209
- return s.length ? s : null;
864
+ function Z(e, t, n) {
865
+ let r = [];
866
+ for (let i of e) {
867
+ let e = $e(i, t, n);
868
+ e && r.push(e);
869
+ }
870
+ return r.length ? r : null;
1210
871
  }
1211
- function lt(e, t, n) {
1212
- const s = n.match(e, t);
1213
- if (e.type === "group") {
1214
- if (s && n.includeGroupDescendantsOnMatch)
1215
- return Y(e, n.expandMatchedBranches);
1216
- const i = e.items?.length ? W(e.items, t, n) : null;
1217
- return !s && !i ? null : {
1218
- ...e,
1219
- items: i ?? []
1220
- };
1221
- }
1222
- const l = e.items?.length ? W(e.items, t, n) : null;
1223
- if (s && n.includeItemDescendantsOnMatch)
1224
- return Y(e, n.expandMatchedBranches);
1225
- if (!s && !l)
1226
- return null;
1227
- const a = {
1228
- ...e
1229
- };
1230
- return l ? (a.items = l, n.expandMatchedBranches && (a.isExpanded = !0)) : delete a.items, a;
872
+ function $e(e, t, n) {
873
+ let r = n.match(e, t);
874
+ if (e.type === "group") {
875
+ if (r && n.includeGroupDescendantsOnMatch) return Q(e, n.expandMatchedBranches);
876
+ let i = e.items?.length ? Z(e.items, t, n) : null;
877
+ return !r && !i ? null : {
878
+ ...e,
879
+ items: i ?? []
880
+ };
881
+ }
882
+ let i = e.items?.length ? Z(e.items, t, n) : null;
883
+ if (r && n.includeItemDescendantsOnMatch) return Q(e, n.expandMatchedBranches);
884
+ if (!r && !i) return null;
885
+ let a = { ...e };
886
+ return i ? (a.items = i, n.expandMatchedBranches && (a.isExpanded = !0)) : delete a.items, a;
1231
887
  }
1232
- function Y(e, t) {
1233
- return e.type === "group" ? {
1234
- ...e,
1235
- items: e.items.map(
1236
- (n) => Y(n, t)
1237
- )
1238
- } : {
1239
- ...e,
1240
- isExpanded: t && e.items?.length ? !0 : e.isExpanded,
1241
- items: e.items?.map((n) => Y(n, t))
1242
- };
888
+ function Q(e, t) {
889
+ return e.type === "group" ? {
890
+ ...e,
891
+ items: e.items.map((e) => Q(e, t))
892
+ } : {
893
+ ...e,
894
+ isExpanded: t && e.items?.length ? !0 : e.isExpanded,
895
+ items: e.items?.map((e) => Q(e, t))
896
+ };
1243
897
  }
1244
- function at(e) {
1245
- return e.trim().toLowerCase();
898
+ function et(e) {
899
+ return e.trim().toLowerCase();
1246
900
  }
1247
- var it = /* @__PURE__ */ ((e) => (e.Enter = "Enter", e))(it || {});
1248
- const de = Q(null);
1249
- function zt({
1250
- children: e,
1251
- isAgentAvailable: t
1252
- }) {
1253
- const n = q(() => ({ isAgentAvailable: t }), [t]);
1254
- return /* @__PURE__ */ r(de.Provider, { value: n, children: e });
901
+ //#endregion
902
+ //#region libs/ui-components/src/types/keyboard.ts
903
+ var tt = /* @__PURE__ */ function(e) {
904
+ return e.Enter = "Enter", e;
905
+ }({}), $ = t(null);
906
+ function nt({ children: e, isAgentAvailable: t }) {
907
+ let n = o(() => ({ isAgentAvailable: t }), [t]);
908
+ return /* @__PURE__ */ y($.Provider, {
909
+ value: n,
910
+ children: e
911
+ });
1255
912
  }
1256
- function Ht() {
1257
- const e = K(de);
1258
- if (!e)
1259
- throw new Error(
1260
- "useAgentAvailability must be used within AgentAvailabilityProvider"
1261
- );
1262
- return e;
913
+ function rt() {
914
+ let e = r($);
915
+ if (!e) throw Error("useAgentAvailability must be used within AgentAvailabilityProvider");
916
+ return e;
1263
917
  }
1264
- export {
1265
- zt as AgentAvailabilityProvider,
1266
- Nt as Alert,
1267
- _ as AlertType,
1268
- Be as Button,
1269
- qe as CALENDAR_MOBILE_PADDING,
1270
- yt as Calendar,
1271
- se as Checkbox,
1272
- re as CloseButton,
1273
- Et as CollapsibleBlock,
1274
- Pt as CopyButton,
1275
- _t as DownloadFormatMessage,
1276
- Yt as DraggableList,
1277
- Rt as Dropdown,
1278
- It as HighlightText,
1279
- St as IconButton,
1280
- Tt as InlineAlert,
1281
- Mt as InlineAlertProvider,
1282
- M as InlineAlertType,
1283
- Ue as Input,
1284
- kt as InputWithIcon,
1285
- it as KeyboardKey,
1286
- Dt as Link,
1287
- $e as Loader,
1288
- B as PopUpSize,
1289
- T as PopUpState,
1290
- Ft as Popup,
1291
- Ot as Radio,
1292
- At as RequestLimitMessage,
1293
- U as SERIES_LIMIT,
1294
- vt as TREE_NODE_ARROW_SIZE,
1295
- Ct as TREE_NODE_PADDING,
1296
- Lt as Tag,
1297
- jt as filterDraggableListNodes,
1298
- Ht as useAgentAvailability,
1299
- wt as useDebounce,
1300
- We as useIsMobile
1301
- };
918
+ //#endregion
919
+ export { nt as AgentAvailabilityProvider, ve as Alert, M as AlertType, F as Button, Ce as CALENDAR_MOBILE_PADDING, Te as Calendar, R as Checkbox, j as CloseButton, Ee as CollapsibleBlock, Ke as CopyButton, Le as DownloadFormatMessage, Xe as DraggableList, Ie as Dropdown, De as HighlightText, Oe as IconButton, Ge as InlineAlert, ze as InlineAlertProvider, G as InlineAlertType, z as Input, ke as InputWithIcon, tt as KeyboardKey, Ae as Link, N as Loader, we as MOBILE_BREAKPOINT, V as PopUpSize, B as PopUpState, Pe as Popup, Me as Radio, Re as RequestLimitMessage, L as SERIES_LIMIT, xe as TREE_NODE_ARROW_SIZE, Se as TREE_NODE_PADDING, je as Tag, Qe as filterDraggableListNodes, rt as useAgentAvailability, be as useDebounce, I as useIsMobile };