@abyss-project/commons-front-core 13.3.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/catalog/captures-plan.ts +4 -1
  2. package/catalog/catalog-entries.ts +6 -1
  3. package/catalog/expected-error.ts +6 -0
  4. package/catalog/pages/CookieConsent.tsx +38 -0
  5. package/catalog/pages/ErrorBoundary.tsx +22 -0
  6. package/catalog/pages/PasswordField.tsx +62 -0
  7. package/catalog/pages/Toast.tsx +17 -6
  8. package/catalog/pages/index.ts +6 -0
  9. package/catalog/specs/captures.spec.ts +10 -0
  10. package/catalog/specs/catalog-page.ts +6 -1
  11. package/catalog/specs/write-capture-index.ts +1 -0
  12. package/dist/{AbyssCloud-D_AbU9k7.js → AbyssCloud-B3rMelRi.js} +636 -712
  13. package/dist/CookieConsentSettings-DyJGEnVA.js +505 -0
  14. package/dist/{use-rich-intl.hook-BETUyCkW.js → Surface-B_J_I_1i.js} +700 -147
  15. package/dist/Tabs-_TzugjHZ.js +1941 -0
  16. package/dist/auth/components/AuthHeroLayout/auth-hero-gradient.d.ts +18 -0
  17. package/dist/auth/components/shared/AuthLoadingScreen.component.d.ts +5 -0
  18. package/dist/auth/components/shared/use-async-resource.hook.d.ts +4 -1
  19. package/dist/auth/components/shared/use-async-resource.hook.spec.d.ts +1 -0
  20. package/dist/components/business/CookieConsent/AbyssCookieConsentProvider.spec.d.ts +1 -0
  21. package/dist/components/business/CookieConsent/CookieConsent.spec.d.ts +1 -0
  22. package/dist/{legacy/components/CookieConsent/CookieConsentBanner.component.d.ts → components/business/CookieConsent/CookieConsentBanner.d.ts} +1 -2
  23. package/dist/components/business/CookieConsent/CookieConsentSettings.d.ts +1 -0
  24. package/dist/{legacy/components → components/business}/CookieConsent/index.d.ts +2 -2
  25. package/dist/components/business/index.d.ts +3 -0
  26. package/dist/components/inputs/FormField/FormField.d.ts +5 -1
  27. package/dist/components/inputs/PasswordField/PasswordField.d.ts +40 -0
  28. package/dist/components/inputs/PasswordField/PasswordField.spec.d.ts +1 -0
  29. package/dist/components/inputs/index.d.ts +1 -0
  30. package/dist/components/layers/Toast/Toast.d.ts +3 -18
  31. package/dist/components/layers/Toast/toast-clearance.d.ts +6 -0
  32. package/dist/components/layers/Toast/toast-store.d.ts +76 -0
  33. package/dist/components/states/ErrorBoundary/ErrorBoundary.d.ts +17 -0
  34. package/dist/components/states/ErrorBoundary/ErrorBoundary.spec.d.ts +1 -0
  35. package/dist/components/states/PageState/PageState.d.ts +3 -1
  36. package/dist/components/states/index.d.ts +1 -0
  37. package/dist/cookie-consent.d.ts +1 -1
  38. package/dist/cookie-consent.js +14 -15
  39. package/dist/demo/DemoBanner/DemoBanner.d.ts +16 -0
  40. package/dist/demo/DemoBanner/DemoBanner.spec.d.ts +1 -0
  41. package/dist/demo/DemoBanner/index.d.ts +1 -0
  42. package/dist/demo/demo-blocked.interceptor.d.ts +7 -0
  43. package/dist/demo/demo.en.d.ts +17 -0
  44. package/dist/demo/demo.fr.d.ts +17 -0
  45. package/dist/demo/index.d.ts +3 -0
  46. package/dist/demo/tests/demo-blocked.interceptor.spec.d.ts +1 -0
  47. package/dist/demo/use-demo-account.hook.d.ts +19 -0
  48. package/dist/design-theme-D5L0JNbX.js +26599 -0
  49. package/dist/{editors-CUsZNFfw.js → editors-C6Rocm6M.js} +83 -83
  50. package/dist/editors.js +1 -1
  51. package/dist/hooks/use-rich-intl.hook.d.ts +80 -0
  52. package/dist/{index-BQ4GXlMJ.js → index-5AavH8Oo.js} +1 -1
  53. package/dist/{index-Bn4gTAno.js → index-B58_3EoW.js} +2 -2
  54. package/dist/{index-DuMzZrqc.js → index-BElPTqLa.js} +2 -2
  55. package/dist/{index-D1ro2oTw.js → index-BI4ooqu1.js} +2 -2
  56. package/dist/{index-TB7ekLl-.js → index-BYDMmzla.js} +2 -2
  57. package/dist/{index-CM0x-TnE.js → index-C1GCQ2Ke.js} +2 -2
  58. package/dist/{index-DEBTvCWD.js → index-C1I7MW-q.js} +3 -3
  59. package/dist/{index-pnfk6VZ7.js → index-CDI4_t7D.js} +4 -4
  60. package/dist/{index-Lyt4_W7a.js → index-CDWJlhuZ.js} +2 -2
  61. package/dist/{index-C7a2XXcz.js → index-CKJMsjnV.js} +4 -4
  62. package/dist/{index-CDpC4_po.js → index-Cskjr11h.js} +2 -2
  63. package/dist/{index-DErJ9c2q.js → index-CuYK_i3Q.js} +2 -2
  64. package/dist/{index-GTkZik4b.js → index-Cwgj3j50.js} +3 -3
  65. package/dist/{index-CjV5ui_B.js → index-Czhx2OUB.js} +2 -2
  66. package/dist/{index-CiDg4J7c.js → index-DGoR-pBV.js} +4 -4
  67. package/dist/{index-YzYX-H93.js → index-DjAZPCEQ.js} +3 -3
  68. package/dist/{index-Ba41aBBN.js → index-Dutd4cJm.js} +2 -2
  69. package/dist/{index-DobX4g2g.js → index-Dym_r-do.js} +2 -2
  70. package/dist/{index-BhFOCfCj.js → index-TshVV9T4.js} +2 -2
  71. package/dist/{index-BzoBMWdL.js → index-UjGNADrL.js} +3 -3
  72. package/dist/{index-CYUixRIB.js → index-u-EAOYOb.js} +2 -2
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.js +5483 -4750
  75. package/dist/legacy/components/Spotlight/ProjectLinkSelector/index.d.ts +1 -4
  76. package/dist/legacy/components/Support/AbyssServiceSelect.component.d.ts +1 -1
  77. package/dist/legacy/components/index.d.ts +1 -1
  78. package/dist/legacy.js +9626 -8129
  79. package/dist/translations/en.d.ts +39 -0
  80. package/dist/translations/fr.d.ts +39 -0
  81. package/dist/utils/index.d.ts +2 -0
  82. package/dist/utils/project-link-mode.d.ts +4 -0
  83. package/dist/utils/project-link-wording.utils.d.ts +1 -1
  84. package/dist/utils/service-config.d.ts +8 -0
  85. package/dist/utils/service-config.spec.d.ts +1 -0
  86. package/package.json +3 -3
  87. package/vite.config.ts +1 -1
  88. package/dist/AbyssCookieConsentProvider-Ds99df0E.js +0 -4562
  89. package/dist/CookieConsentSettings.component-DoWLHqw5.js +0 -78
  90. package/dist/Tabs-C1qcQ2i5.js +0 -2335
  91. package/dist/design-theme-CYGZ6mAh.js +0 -23975
  92. package/dist/legacy/components/CookieConsent/CookieConsentSettings.component.d.ts +0 -2
  93. /package/dist/{legacy/components/CookieConsent/AbyssCookieConsentProvider.spec.d.ts → auth/components/SecuritySettings/sections/SessionsSection.component.spec.d.ts} +0 -0
  94. /package/dist/{legacy/components → components/business}/CookieConsent/AbyssCookieConsentProvider.d.ts +0 -0
@@ -0,0 +1,1941 @@
1
+ import { jsxs as x, jsx as i, Fragment as J } from "react/jsx-runtime";
2
+ import { useId as D, cloneElement as fn, useState as I, useMemo as ge, useRef as Y, useCallback as Q, useEffect as B, createContext as Ee, useContext as ze, useLayoutEffect as Ae } from "react";
3
+ import le from "@mui/material/FormControl";
4
+ import se from "@mui/material/FormHelperText";
5
+ import $e from "@mui/material/InputLabel";
6
+ import xe from "@mui/material/MenuItem";
7
+ import mn from "@mui/material/Select";
8
+ import { styled as d, useTheme as hn, getContrastRatio as Ce } from "@mui/material/styles";
9
+ import { visuallyHidden as bn } from "@mui/utils";
10
+ import { useIntl as $ } from "react-intl";
11
+ import { a as R, p as o, h as A, d as Z, D as K, c as yn, t as Le, s as de, e as oe, g as te, M as De, b as Pe, i as vn, B as wn } from "./Surface-B_J_I_1i.js";
12
+ import He from "@mui/material/ButtonBase";
13
+ import fe from "@mui/material/OutlinedInput";
14
+ import xn from "@mui/material/InputAdornment";
15
+ import { i as Cn, b as kn, r as Sn, u as In, A as Fn, E as Mn } from "./AbyssCloud-B3rMelRi.js";
16
+ import X from "@mui/material/Button";
17
+ import { byteSizeIEC as Wn } from "@abyss-project/main";
18
+ import On from "@mui/icons-material/FileUploadOutlined";
19
+ import Tn, { autocompleteClasses as ke } from "@mui/material/Autocomplete";
20
+ import Se from "@mui/material/CircularProgress";
21
+ import ae from "@mui/material/IconButton";
22
+ import Ie from "@mui/material/Tooltip";
23
+ import Fe from "@mui/icons-material/CloudOutlined";
24
+ import Rn from "@mui/icons-material/CloudOffOutlined";
25
+ import En from "@mui/icons-material/FileDownloadOutlined";
26
+ import Ne from "@mui/icons-material/FolderOpenOutlined";
27
+ import zn from "@mui/icons-material/OpenInNewRounded";
28
+ import An from "@mui/icons-material/RefreshRounded";
29
+ import $n from "@mui/material/FormLabel";
30
+ import { isMuiElement as Ln } from "@mui/material/utils";
31
+ import Dn from "@mui/icons-material/CheckCircleOutline";
32
+ import _e from "@mui/icons-material/Close";
33
+ import Pn from "@mui/icons-material/ErrorOutline";
34
+ import Hn from "@mui/icons-material/InfoOutlined";
35
+ import Nn from "@mui/icons-material/WarningAmber";
36
+ import _n from "@mui/material/Checkbox";
37
+ import Bn from "@mui/icons-material/DescriptionOutlined";
38
+ import Vn from "@mui/icons-material/FolderOutlined";
39
+ import jn from "@mui/icons-material/ChevronRightRounded";
40
+ import Gn from "@mui/material/Popover";
41
+ import qn from "@mui/material/Alert";
42
+ import Un from "@mui/material/TextField";
43
+ import { Link as Kn } from "react-router-dom";
44
+ const Yn = d($n)(({ theme: e }) => ({
45
+ display: "block",
46
+ maxWidth: "100%",
47
+ marginBottom: o(e.design.space[2]),
48
+ fontSize: o(e.design.typeScale.small),
49
+ fontWeight: R.medium,
50
+ lineHeight: e.typography.caption.lineHeight,
51
+ color: e.design.tokens["text.secondary"],
52
+ "&.Mui-focused": { color: e.design.tokens["text.secondary"] },
53
+ "&.Mui-error": { color: e.design.tokens["status.danger"] },
54
+ "&.Mui-disabled": { color: e.design.tokens["text.muted"] }
55
+ }));
56
+ function Be({
57
+ label: e,
58
+ help: n,
59
+ error: t,
60
+ required: r = !1,
61
+ children: s
62
+ }) {
63
+ const c = D(), a = s.props.id ?? c, l = `${a}-label`, g = n !== void 0 ? `${a}-help` : void 0, b = t != null && t !== !1 && t !== "", f = b && t !== !0, m = f ? `${a}-error` : void 0, h = [s.props["aria-describedby"], g, m].filter((p) => p !== void 0 && p !== "").join(" ") || void 0, y = fn(s, {
64
+ id: a,
65
+ "aria-describedby": h,
66
+ ...Ln(s, ["Select"]) && { labelId: l }
67
+ });
68
+ return /* @__PURE__ */ x(le, { fullWidth: !0, error: b, required: r, children: [
69
+ /* @__PURE__ */ i(Yn, { id: l, htmlFor: a, children: e }),
70
+ y,
71
+ n !== void 0 && /* @__PURE__ */ i(se, { id: g, error: !1, children: n }),
72
+ f && /* @__PURE__ */ i(se, { id: m, children: t })
73
+ ] });
74
+ }
75
+ var Ve = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Danger = "danger", e))(Ve || {});
76
+ const je = {
77
+ info: { solid: "status.info", soft: "status.info.soft" },
78
+ success: {
79
+ solid: "status.success",
80
+ soft: "status.success.soft"
81
+ },
82
+ warning: {
83
+ solid: "status.warning",
84
+ soft: "status.warning.soft"
85
+ },
86
+ danger: {
87
+ solid: "status.danger",
88
+ soft: "status.danger.soft"
89
+ }
90
+ }, Xn = {
91
+ info: Hn,
92
+ success: Dn,
93
+ warning: Nn,
94
+ danger: Pn
95
+ }, Qn = d("div", {
96
+ shouldForwardProp: (e) => e !== "severity"
97
+ })(({ theme: e, severity: n }) => {
98
+ const { tokens: t, space: r, radii: s, fonts: c, typeScale: a } = e.design, { solid: l, soft: g } = je[n];
99
+ return {
100
+ display: "flex",
101
+ alignItems: "flex-start",
102
+ gap: o(r[3]),
103
+ minWidth: 0,
104
+ boxSizing: "border-box",
105
+ padding: `${o(r[3])} ${o(r[3])} ${o(r[3])} ${o(r[4])}`,
106
+ backgroundColor: t[g],
107
+ border: A(t[l]),
108
+ borderRadius: o(s.md),
109
+ color: t["text.primary"],
110
+ fontFamily: c.sans,
111
+ fontSize: o(a.body)
112
+ };
113
+ }), Zn = d("span", {
114
+ shouldForwardProp: (e) => e !== "severity"
115
+ })(({ theme: e, severity: n }) => {
116
+ const { tokens: t, space: r } = e.design;
117
+ return {
118
+ display: "inline-flex",
119
+ flex: "none",
120
+ // Centered on the first line of text.
121
+ paddingTop: o(r[1] / 2),
122
+ color: t[je[n].solid],
123
+ "& svg": {
124
+ width: o(r[4] + r[1]),
125
+ height: o(r[4] + r[1])
126
+ }
127
+ };
128
+ }), Jn = d("div")(({ theme: e }) => ({
129
+ display: "flex",
130
+ flex: "1 1 auto",
131
+ flexWrap: "wrap",
132
+ alignItems: "center",
133
+ columnGap: o(e.design.space[4]),
134
+ rowGap: o(e.design.space[2]),
135
+ minWidth: 0,
136
+ [Z.down(K.Tablet)]: {
137
+ flexDirection: "column",
138
+ alignItems: "flex-start"
139
+ }
140
+ })), et = d("div")(({ theme: e }) => ({
141
+ display: "flex",
142
+ flexDirection: "column",
143
+ gap: o(e.design.space[1]),
144
+ flex: "1 1 auto",
145
+ minWidth: 0,
146
+ paddingTop: o(e.design.space[1] / 2),
147
+ lineHeight: e.typography.body2.lineHeight,
148
+ overflowWrap: "anywhere"
149
+ })), nt = d("strong")({
150
+ display: "block",
151
+ fontWeight: R.semibold
152
+ }), tt = d("div")({
153
+ display: "flex",
154
+ flex: "none",
155
+ alignItems: "center"
156
+ }), ot = d(ae)(({ theme: e }) => yn(e));
157
+ function rt({
158
+ severity: e,
159
+ title: n,
160
+ children: t,
161
+ action: r,
162
+ onClose: s,
163
+ icon: c
164
+ }) {
165
+ const a = $(), l = D(), g = Xn[e];
166
+ return /* @__PURE__ */ x(
167
+ Qn,
168
+ {
169
+ severity: e,
170
+ role: e === "danger" ? "alert" : "status",
171
+ "aria-labelledby": n !== void 0 ? l : void 0,
172
+ "data-severity": e,
173
+ children: [
174
+ /* @__PURE__ */ i(Zn, { severity: e, "aria-hidden": !0, children: c ?? /* @__PURE__ */ i(g, {}) }),
175
+ /* @__PURE__ */ x(Jn, { children: [
176
+ /* @__PURE__ */ x(et, { children: [
177
+ n !== void 0 && /* @__PURE__ */ i(nt, { id: l, children: n }),
178
+ /* @__PURE__ */ i("div", { children: t })
179
+ ] }),
180
+ r !== void 0 && /* @__PURE__ */ i(tt, { children: r })
181
+ ] }),
182
+ s !== void 0 && /* @__PURE__ */ i(
183
+ ot,
184
+ {
185
+ size: "small",
186
+ "aria-label": a.formatMessage({ id: "ds.states.callout.close" }),
187
+ onClick: s,
188
+ children: /* @__PURE__ */ i(_e, { "aria-hidden": !0 })
189
+ }
190
+ )
191
+ ]
192
+ }
193
+ );
194
+ }
195
+ const U = (e) => e.id ?? e.name, Ge = (e, n, t) => (n === void 0 || e.sizeOctet <= n) && Cn(e, t), qe = (e, n, t) => [
196
+ ...(e.childFile ?? []).filter(
197
+ (r) => Ge(r, n, t)
198
+ ),
199
+ ...(e.childFolder ?? []).flatMap(
200
+ (r) => qe(r, n, t)
201
+ )
202
+ ], ue = d("div", {
203
+ shouldForwardProp: (e) => e !== "selected"
204
+ })(({ theme: e, selected: n }) => {
205
+ const { tokens: t, space: r, radii: s, densityValues: c, density: a, typeScale: l } = e.design;
206
+ return {
207
+ display: "flex",
208
+ alignItems: "center",
209
+ gap: o(r[1]),
210
+ minHeight: o(c[a].control),
211
+ borderRadius: o(s.md),
212
+ backgroundColor: n ? de(t.accent) : "transparent",
213
+ fontSize: o(l.body),
214
+ color: t["text.primary"],
215
+ ...Le(e)
216
+ };
217
+ }), Ue = (e) => {
218
+ const { tokens: n, space: t, radii: r, fonts: s } = e.design;
219
+ return {
220
+ flex: "1 1 auto",
221
+ minWidth: 0,
222
+ display: "flex",
223
+ alignItems: "center",
224
+ gap: o(t[2]),
225
+ alignSelf: "stretch",
226
+ margin: 0,
227
+ padding: `0 ${o(t[2])}`,
228
+ border: "none",
229
+ borderRadius: o(r.md),
230
+ background: "none",
231
+ color: "inherit",
232
+ font: "inherit",
233
+ fontFamily: s.sans,
234
+ textAlign: "left",
235
+ cursor: "pointer",
236
+ transition: oe(e, ["background-color"]),
237
+ "&:hover": { backgroundColor: n["bg.hover"] },
238
+ "&:focus-visible": te(e)
239
+ };
240
+ }, Ke = d("button")(({ theme: e }) => Ue(e)), it = d("label")(({ theme: e }) => Ue(e)), Ye = d("span", {
241
+ shouldForwardProp: (e) => e !== "strong"
242
+ })(({ strong: e }) => ({
243
+ flex: "1 1 auto",
244
+ minWidth: 0,
245
+ overflow: "hidden",
246
+ textOverflow: "ellipsis",
247
+ whiteSpace: "nowrap",
248
+ fontWeight: e ? R.medium : R.regular
249
+ })), Xe = d("span")(({ theme: e }) => {
250
+ const { tokens: n, space: t, radii: r } = e.design;
251
+ return {
252
+ display: "inline-flex",
253
+ flex: "none",
254
+ alignItems: "center",
255
+ justifyContent: "center",
256
+ width: o(t[5]),
257
+ height: o(t[5]),
258
+ overflow: "hidden",
259
+ borderRadius: o(r.sm),
260
+ color: n["text.muted"],
261
+ "& svg": { width: o(t[5]), height: o(t[5]) },
262
+ "& img": { width: "100%", height: "100%", objectFit: "cover" }
263
+ };
264
+ }), st = d(jn, {
265
+ shouldForwardProp: (e) => e !== "open"
266
+ })(({ theme: e, open: n }) => ({
267
+ flex: "none",
268
+ width: o(e.design.space[4]),
269
+ height: o(e.design.space[4]),
270
+ color: e.design.tokens["text.muted"],
271
+ transform: n ? "rotate(90deg)" : "none",
272
+ transition: oe(e, ["transform"])
273
+ })), Qe = d(_n)(({ theme: e }) => ({
274
+ [Z.down(K.Tablet)]: {
275
+ padding: o(
276
+ (e.design.densityValues.touchTarget - e.design.space[5]) / 2
277
+ )
278
+ }
279
+ })), at = d("ul")(({ theme: e }) => ({
280
+ margin: 0,
281
+ padding: 0,
282
+ listStyle: "none",
283
+ borderLeft: A(e.design.tokens["border.subtle"]),
284
+ marginLeft: o(e.design.space[3])
285
+ })), Me = d("li")({ listStyle: "none" });
286
+ function Ze({
287
+ folders: e,
288
+ files: n,
289
+ context: t
290
+ }) {
291
+ return /* @__PURE__ */ x(J, { children: [
292
+ e.map((r) => /* @__PURE__ */ i(Me, { children: /* @__PURE__ */ i(ct, { folder: r, context: t }) }, r.id ?? r.name)),
293
+ n.filter((r) => Ge(r, t.maxSize, t.accept)).map((r) => /* @__PURE__ */ i(Me, { children: /* @__PURE__ */ i(dt, { file: r, context: t }) }, U(r)))
294
+ ] });
295
+ }
296
+ function lt({
297
+ file: e,
298
+ getFileThumbnailUrl: n
299
+ }) {
300
+ const [t, r] = I(!1), s = e.thumbnailPublicAccessId !== null && !e.isEncrypt && !t ? n(e.thumbnailPublicAccessId) : null;
301
+ return /* @__PURE__ */ i(Xe, { "aria-hidden": !0, children: s !== null ? /* @__PURE__ */ i(
302
+ "img",
303
+ {
304
+ src: s,
305
+ alt: "",
306
+ draggable: !1,
307
+ onError: () => r(!0)
308
+ }
309
+ ) : /* @__PURE__ */ i(Bn, {}) });
310
+ }
311
+ function dt({
312
+ file: e,
313
+ context: n
314
+ }) {
315
+ const t = D(), r = n.selectedIds.has(U(e)), s = () => r ? n.unselect([e]) : n.select([e]), c = /* @__PURE__ */ x(J, { children: [
316
+ /* @__PURE__ */ i(
317
+ lt,
318
+ {
319
+ file: e,
320
+ getFileThumbnailUrl: n.getFileThumbnailUrl
321
+ }
322
+ ),
323
+ /* @__PURE__ */ i(Ye, { strong: r, title: e.name, children: e.name })
324
+ ] });
325
+ return n.multiple ? /* @__PURE__ */ x(ue, { selected: r, children: [
326
+ /* @__PURE__ */ i(
327
+ Qe,
328
+ {
329
+ id: t,
330
+ size: "small",
331
+ checked: r,
332
+ onChange: s
333
+ }
334
+ ),
335
+ /* @__PURE__ */ i(it, { htmlFor: t, children: c })
336
+ ] }) : /* @__PURE__ */ i(ue, { selected: r, children: /* @__PURE__ */ i(Ke, { type: "button", "aria-pressed": r, onClick: s, children: c }) });
337
+ }
338
+ function ct({
339
+ folder: e,
340
+ context: n
341
+ }) {
342
+ const t = $(), r = D(), [s, c] = I(!1), a = qe(e, n.maxSize, n.accept), l = a.filter(
343
+ (b) => n.selectedIds.has(U(b))
344
+ ).length, g = a.length > 0 && l === a.length;
345
+ return /* @__PURE__ */ x(J, { children: [
346
+ /* @__PURE__ */ x(ue, { selected: g, children: [
347
+ n.multiple && /* @__PURE__ */ i(
348
+ Qe,
349
+ {
350
+ size: "small",
351
+ checked: g,
352
+ indeterminate: l > 0 && !g,
353
+ disabled: a.length === 0,
354
+ onChange: () => g ? n.unselect(a) : n.select(a),
355
+ inputProps: {
356
+ "aria-label": t.formatMessage(
357
+ { id: "ds.business.cloud-import.select-folder" },
358
+ { name: e.name }
359
+ )
360
+ }
361
+ }
362
+ ),
363
+ /* @__PURE__ */ x(
364
+ Ke,
365
+ {
366
+ type: "button",
367
+ "aria-expanded": s,
368
+ "aria-controls": s ? r : void 0,
369
+ onClick: () => c(!s),
370
+ children: [
371
+ /* @__PURE__ */ i(st, { open: s, "aria-hidden": !0 }),
372
+ /* @__PURE__ */ i(Xe, { "aria-hidden": !0, children: s ? /* @__PURE__ */ i(Ne, {}) : /* @__PURE__ */ i(Vn, {}) }),
373
+ /* @__PURE__ */ i(Ye, { strong: g, title: e.name, children: e.name })
374
+ ]
375
+ }
376
+ )
377
+ ] }),
378
+ s && /* @__PURE__ */ i(at, { id: r, children: /* @__PURE__ */ i(
379
+ Ze,
380
+ {
381
+ folders: e.childFolder ?? [],
382
+ files: e.childFile ?? [],
383
+ context: n
384
+ }
385
+ ) })
386
+ ] });
387
+ }
388
+ const We = "shared", Oe = {
389
+ "org-common": 0,
390
+ "perso-in-org": 1,
391
+ project: 2,
392
+ personal: 3
393
+ }, ut = d("div")(({ theme: e }) => ({
394
+ display: "flex",
395
+ flexDirection: "column",
396
+ gap: o(e.design.space[3]),
397
+ minWidth: 0
398
+ })), pt = d("div")(({ theme: e }) => ({
399
+ display: "flex",
400
+ alignItems: "flex-end",
401
+ gap: o(e.design.space[2]),
402
+ minWidth: 0,
403
+ // The Space field takes the room the two icon buttons leave.
404
+ [`& > .${ke.root}`]: { flex: "1 1 auto", minWidth: 0 },
405
+ [`& > :not(.${ke.root})`]: { flex: "none" }
406
+ })), gt = d("p")(({ theme: e }) => ({
407
+ margin: 0,
408
+ fontSize: o(e.design.typeScale.small),
409
+ color: e.design.tokens["text.muted"]
410
+ })), ft = d("ul")(({ theme: e }) => {
411
+ const { tokens: n, space: t, radii: r } = e.design;
412
+ return {
413
+ margin: 0,
414
+ padding: o(t[1]),
415
+ listStyle: "none",
416
+ minHeight: o(t[10] * 3),
417
+ border: A(n["border.subtle"]),
418
+ borderRadius: o(r.md)
419
+ };
420
+ }), ne = d("div")(({ theme: e }) => {
421
+ const { tokens: n, space: t, typeScale: r } = e.design;
422
+ return {
423
+ display: "flex",
424
+ flexDirection: "column",
425
+ alignItems: "center",
426
+ justifyContent: "center",
427
+ gap: o(t[3]),
428
+ minHeight: o(t[10] * 3),
429
+ padding: o(t[5]),
430
+ textAlign: "center",
431
+ fontSize: o(r.body),
432
+ color: n["text.secondary"],
433
+ "& > svg": {
434
+ width: o(t[7]),
435
+ height: o(t[7]),
436
+ color: n["text.muted"]
437
+ }
438
+ };
439
+ }), mt = d("span")(({ theme: e }) => {
440
+ const { tokens: n, space: t, radii: r } = e.design;
441
+ return {
442
+ display: "inline-flex",
443
+ alignItems: "center",
444
+ justifyContent: "center",
445
+ width: o(t[9] + t[2]),
446
+ height: o(t[9] + t[2]),
447
+ borderRadius: o(r.lg),
448
+ backgroundColor: de(n["status.warning"]),
449
+ color: n["status.warning"],
450
+ "& svg": { width: o(t[6]), height: o(t[6]) }
451
+ };
452
+ }), ht = d("p")(({ theme: e }) => ({
453
+ margin: 0,
454
+ fontWeight: R.semibold,
455
+ color: e.design.tokens["text.primary"]
456
+ })), bt = d("p")({ margin: 0 }), yt = d("div")(({ theme: e }) => ({
457
+ display: "flex",
458
+ flexWrap: "wrap",
459
+ alignItems: "center",
460
+ justifyContent: "space-between",
461
+ gap: o(e.design.space[3])
462
+ })), vt = d("span")(({ theme: e }) => ({
463
+ fontSize: o(e.design.typeScale.body),
464
+ color: e.design.tokens["text.secondary"]
465
+ })), wt = d("li")(({ theme: e }) => ({
466
+ display: "flex",
467
+ alignItems: "center",
468
+ gap: o(e.design.space[2]),
469
+ ...Le(e)
470
+ })), xt = d("span")({
471
+ display: "flex",
472
+ flexDirection: "column",
473
+ minWidth: 0
474
+ }), Ct = d("span")({
475
+ overflow: "hidden",
476
+ textOverflow: "ellipsis",
477
+ whiteSpace: "nowrap"
478
+ }), kt = d("span")(({ theme: e }) => ({
479
+ fontSize: o(e.design.typeScale.caption),
480
+ color: e.design.tokens["text.muted"],
481
+ // A narrow screen wraps it: the scope and the organization tell same-named Spaces apart.
482
+ overflowWrap: "anywhere"
483
+ })), Je = d("span")(({ theme: e }) => {
484
+ const { tokens: n, space: t, radii: r } = e.design;
485
+ return {
486
+ display: "inline-flex",
487
+ flex: "none",
488
+ alignItems: "center",
489
+ justifyContent: "center",
490
+ minWidth: o(t[5]),
491
+ height: o(t[5]),
492
+ borderRadius: o(r.sm),
493
+ color: n["accent.text"],
494
+ "& > svg": { width: o(t[4]), height: o(t[4]) }
495
+ };
496
+ }), St = d(Je)(({ theme: e }) => ({
497
+ marginRight: o(e.design.space[2])
498
+ })), It = d("li")({ listStyle: "none" }), Ft = d("div")(({ theme: e }) => {
499
+ const { space: n, tokens: t, typeScale: r } = e.design;
500
+ return {
501
+ padding: `${o(n[2])} ${o(n[3])} ${o(n[1])}`,
502
+ fontSize: o(r.caption),
503
+ fontWeight: R.semibold,
504
+ letterSpacing: "0.05em",
505
+ textTransform: "uppercase",
506
+ color: t["text.muted"]
507
+ };
508
+ }), Mt = d("ul")({ margin: 0, padding: 0 });
509
+ function Wt({
510
+ cloudPicker: e,
511
+ onImport: n,
512
+ multiple: t = !1,
513
+ maxSize: r,
514
+ accept: s
515
+ }) {
516
+ const {
517
+ abyssCloudUrl: c,
518
+ getFileThumbnailUrl: a,
519
+ getSpaceDisplay: l,
520
+ clouds: g,
521
+ cloudShares: b,
522
+ isLoading: f,
523
+ hasError: m,
524
+ refresh: h,
525
+ onCreateCloud: y,
526
+ fetchCloudRepository: p
527
+ } = e, u = $(), [w, C] = I(null), [F, P] = I(null), [O, H] = I(
528
+ "loading"
529
+ /* Loading */
530
+ ), [V, T] = I([]), [M, ee] = I(!1), [re, N] = I(!1), j = ge(() => {
531
+ const v = [], S = /* @__PURE__ */ new Map(), k = u.formatMessage({
532
+ id: "ds.business.cloud-import.section-organization"
533
+ });
534
+ for (const W of g ?? []) {
535
+ if (!W.organizationId) {
536
+ v.push(W);
537
+ continue;
538
+ }
539
+ const z = l == null ? void 0 : l(W), _ = S.get(W.organizationId) ?? {
540
+ name: (z == null ? void 0 : z.organizationName) ?? k,
541
+ items: []
542
+ };
543
+ _.items.push(W), S.set(W.organizationId, _);
544
+ }
545
+ if (l)
546
+ for (const W of S.values())
547
+ W.items.sort((z, _) => {
548
+ const E = Oe[l(z).scope ?? "personal"], we = Oe[l(_).scope ?? "personal"];
549
+ return E !== we ? E - we : l(z).label.localeCompare(l(_).label);
550
+ });
551
+ const L = (W, z) => (_) => {
552
+ const E = l == null ? void 0 : l(_);
553
+ return {
554
+ space: _,
555
+ sectionKey: W,
556
+ sectionLabel: z,
557
+ label: (E == null ? void 0 : E.label) ?? Sn(_, u),
558
+ subtitle: E == null ? void 0 : E.subtitle,
559
+ avatar: E == null ? void 0 : E.avatar
560
+ };
561
+ };
562
+ return [
563
+ ...v.map(
564
+ L(
565
+ "personal",
566
+ u.formatMessage({
567
+ id: "ds.business.cloud-import.section-personal"
568
+ })
569
+ )
570
+ ),
571
+ ...[...S].flatMap(
572
+ ([W, z]) => z.items.map(L(`org:${W}`, z.name))
573
+ ),
574
+ ...(b ?? []).map(
575
+ L(
576
+ We,
577
+ u.formatMessage({ id: "ds.business.cloud-import.section-shared" })
578
+ )
579
+ )
580
+ ];
581
+ }, [g, b, l, u]), G = j.find((v) => v.space.id === (w == null ? void 0 : w.id)) ?? null, ce = Y(0), me = Y(p);
582
+ me.current = p;
583
+ const ie = Q(async (v) => {
584
+ const S = ++ce.current;
585
+ H(
586
+ "loading"
587
+ /* Loading */
588
+ ), T([]);
589
+ try {
590
+ if (v.id === void 0)
591
+ throw new Error("A Space without an id has no tree");
592
+ const k = await me.current(v.id);
593
+ S === ce.current && (P(k), H(
594
+ "ready"
595
+ /* Ready */
596
+ ));
597
+ } catch {
598
+ S === ce.current && H(
599
+ "failed"
600
+ /* Failed */
601
+ );
602
+ }
603
+ }, []), ln = Y(h);
604
+ B(() => {
605
+ ln.current();
606
+ }, []), B(() => {
607
+ if (w && j.some((k) => k.space.id === w.id))
608
+ return;
609
+ const v = j.map((k) => k.space), S = v.find(
610
+ (k) => !!k.userId && !k.organizationId && !k.projectId
611
+ );
612
+ C(S ?? v[0] ?? null);
613
+ }, [j, w]), B(() => {
614
+ w && ie(w);
615
+ }, [w, ie]);
616
+ const dn = async () => {
617
+ if (N(!1), !await h()) {
618
+ N(!0);
619
+ return;
620
+ }
621
+ w && await ie(w);
622
+ }, cn = async () => {
623
+ ee(!0);
624
+ try {
625
+ await y();
626
+ } finally {
627
+ ee(!1);
628
+ }
629
+ }, un = {
630
+ multiple: t,
631
+ maxSize: r,
632
+ accept: s,
633
+ selectedIds: new Set(V.map(U)),
634
+ getFileThumbnailUrl: a,
635
+ select: (v) => T((S) => {
636
+ if (!t)
637
+ return v.slice(0, 1);
638
+ const k = new Set(S.map(U));
639
+ return [
640
+ ...S,
641
+ ...v.filter((L) => !k.has(U(L)))
642
+ ];
643
+ }),
644
+ unselect: (v) => {
645
+ const S = new Set(v.map(U));
646
+ T(
647
+ (k) => k.filter((L) => !S.has(U(L)))
648
+ );
649
+ }
650
+ }, pn = g !== null && b !== null, he = /* @__PURE__ */ i(ne, { children: /* @__PURE__ */ i(
651
+ Se,
652
+ {
653
+ size: 32,
654
+ "aria-label": u.formatMessage({
655
+ id: "ds.business.cloud-import.loading"
656
+ })
657
+ }
658
+ ) });
659
+ if (!pn && (f || !m))
660
+ return he;
661
+ if (j.length === 0)
662
+ return /* @__PURE__ */ x(ne, { children: [
663
+ /* @__PURE__ */ i(mt, { "aria-hidden": !0, children: /* @__PURE__ */ i(Rn, {}) }),
664
+ /* @__PURE__ */ i(ht, { children: u.formatMessage({
665
+ id: "ds.business.cloud-import.create-error.title"
666
+ }) }),
667
+ /* @__PURE__ */ i(bt, { children: u.formatMessage({
668
+ id: "ds.business.cloud-import.create-error.description"
669
+ }) }),
670
+ /* @__PURE__ */ i(
671
+ X,
672
+ {
673
+ variant: "contained",
674
+ startIcon: /* @__PURE__ */ i(Fe, { "aria-hidden": !0 }),
675
+ loading: M || f,
676
+ onClick: () => void cn(),
677
+ children: u.formatMessage({
678
+ id: "ds.business.cloud-import.create-error.create-button"
679
+ })
680
+ }
681
+ )
682
+ ] });
683
+ if (G === null)
684
+ return he;
685
+ const gn = kn(
686
+ c,
687
+ G.space,
688
+ G.sectionKey === We
689
+ ), be = u.formatMessage({
690
+ id: "ds.business.cloud-import.refresh"
691
+ }), ye = u.formatMessage({
692
+ id: "ds.business.cloud-import.open-in-cloud"
693
+ }), ve = (v) => v.avatar ?? /* @__PURE__ */ i(Fe, {});
694
+ return /* @__PURE__ */ x(ut, { children: [
695
+ re && /* @__PURE__ */ i(
696
+ rt,
697
+ {
698
+ severity: Ve.Danger,
699
+ onClose: () => N(!1),
700
+ children: u.formatMessage({ id: "ds.business.cloud-import.refresh-error" })
701
+ }
702
+ ),
703
+ /* @__PURE__ */ x(pt, { children: [
704
+ /* @__PURE__ */ i(
705
+ Tn,
706
+ {
707
+ fullWidth: !0,
708
+ disableClearable: !0,
709
+ options: j,
710
+ value: G,
711
+ groupBy: (v) => v.sectionLabel,
712
+ getOptionLabel: (v) => v.label,
713
+ isOptionEqualToValue: (v, S) => v.space.id === S.space.id,
714
+ onChange: (v, S) => C(S.space),
715
+ filterOptions: (v, { inputValue: S }) => {
716
+ const k = S.trim().toLowerCase();
717
+ return k === "" || k === G.label.toLowerCase() ? v : v.filter(
718
+ (L) => [L.label, L.subtitle ?? ""].some(
719
+ (W) => W.toLowerCase().includes(k)
720
+ )
721
+ );
722
+ },
723
+ renderGroup: (v) => /* @__PURE__ */ x(It, { children: [
724
+ /* @__PURE__ */ i(Ft, { children: v.group }),
725
+ /* @__PURE__ */ i(Mt, { children: v.children })
726
+ ] }, v.key),
727
+ renderOption: ({ key: v, ...S }, k) => /* @__PURE__ */ x(wt, { ...S, children: [
728
+ /* @__PURE__ */ i(Je, { "aria-hidden": !0, children: ve(k) }),
729
+ /* @__PURE__ */ x(xt, { children: [
730
+ /* @__PURE__ */ i(Ct, { children: k.label }),
731
+ k.subtitle !== void 0 && /* @__PURE__ */ i(kt, { children: k.subtitle })
732
+ ] })
733
+ ] }, v),
734
+ renderInput: (v) => /* @__PURE__ */ i(
735
+ Be,
736
+ {
737
+ label: u.formatMessage({
738
+ id: "ds.business.cloud-import.space-label"
739
+ }),
740
+ children: /* @__PURE__ */ i(
741
+ fe,
742
+ {
743
+ ...v.InputProps,
744
+ id: v.id,
745
+ fullWidth: !0,
746
+ inputProps: v.inputProps,
747
+ startAdornment: /* @__PURE__ */ i(St, { "aria-hidden": !0, children: ve(G) })
748
+ }
749
+ )
750
+ }
751
+ )
752
+ }
753
+ ),
754
+ /* @__PURE__ */ i(Ie, { title: be, children: /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(
755
+ ae,
756
+ {
757
+ "aria-label": be,
758
+ disabled: O === "loading" || f,
759
+ onClick: () => void dn(),
760
+ children: /* @__PURE__ */ i(An, { "aria-hidden": !0 })
761
+ }
762
+ ) }) }),
763
+ /* @__PURE__ */ i(Ie, { title: ye, children: /* @__PURE__ */ i(
764
+ ae,
765
+ {
766
+ component: "a",
767
+ href: gn,
768
+ target: "_blank",
769
+ rel: "noreferrer",
770
+ "aria-label": ye,
771
+ children: /* @__PURE__ */ i(zn, { "aria-hidden": !0 })
772
+ }
773
+ ) })
774
+ ] }),
775
+ /* @__PURE__ */ i(gt, { children: u.formatMessage({ id: "ds.business.cloud-import.filtered-hint" }) }),
776
+ O === "loading" && /* @__PURE__ */ i(ne, { children: /* @__PURE__ */ i(
777
+ Se,
778
+ {
779
+ size: 24,
780
+ "aria-label": u.formatMessage({
781
+ id: "ds.business.cloud-import.tree-loading"
782
+ })
783
+ }
784
+ ) }),
785
+ O === "failed" && /* @__PURE__ */ x(ne, { role: "alert", children: [
786
+ u.formatMessage({ id: "ds.business.cloud-import.tree-error" }),
787
+ /* @__PURE__ */ i(
788
+ X,
789
+ {
790
+ variant: "outlined",
791
+ onClick: () => void ie(G.space),
792
+ children: u.formatMessage({ id: "ds.business.cloud-import.retry" })
793
+ }
794
+ )
795
+ ] }),
796
+ O === "ready" && F !== null && (F.folders.length === 0 && F.files.length === 0 ? /* @__PURE__ */ x(ne, { children: [
797
+ /* @__PURE__ */ i(Ne, { "aria-hidden": !0 }),
798
+ u.formatMessage({ id: "ds.business.cloud-import.empty-space" })
799
+ ] }) : /* @__PURE__ */ i(
800
+ ft,
801
+ {
802
+ "aria-label": u.formatMessage({
803
+ id: "ds.business.cloud-import.tree-label"
804
+ }),
805
+ children: /* @__PURE__ */ i(
806
+ Ze,
807
+ {
808
+ folders: F.folders,
809
+ files: F.files,
810
+ context: un
811
+ }
812
+ )
813
+ }
814
+ )),
815
+ /* @__PURE__ */ x(yt, { children: [
816
+ /* @__PURE__ */ i(vt, { role: "status", children: u.formatMessage(
817
+ { id: "ds.business.cloud-import.selected" },
818
+ { count: V.length }
819
+ ) }),
820
+ /* @__PURE__ */ i(
821
+ X,
822
+ {
823
+ variant: "contained",
824
+ startIcon: /* @__PURE__ */ i(En, { "aria-hidden": !0 }),
825
+ disabled: V.length === 0,
826
+ onClick: () => n(G.space, V),
827
+ children: u.formatMessage({ id: "ds.business.cloud-import.import" })
828
+ }
829
+ )
830
+ ] })
831
+ ] });
832
+ }
833
+ function Ot({
834
+ open: e,
835
+ onClose: n,
836
+ onImport: t,
837
+ cloudPicker: r,
838
+ multiple: s,
839
+ maxSize: c,
840
+ accept: a
841
+ }) {
842
+ const l = $();
843
+ return /* @__PURE__ */ i(
844
+ De,
845
+ {
846
+ open: e,
847
+ onClose: n,
848
+ size: Pe.Medium,
849
+ title: l.formatMessage({ id: "ds.business.cloud-import.title" }),
850
+ children: e && /* @__PURE__ */ i(
851
+ Wt,
852
+ {
853
+ cloudPicker: r,
854
+ multiple: s,
855
+ maxSize: c,
856
+ accept: a,
857
+ onImport: (g, b) => {
858
+ t(g, b), n();
859
+ }
860
+ }
861
+ )
862
+ }
863
+ );
864
+ }
865
+ var en = /* @__PURE__ */ ((e) => (e.Medium = "medium", e.Compact = "compact", e))(en || {});
866
+ const Tt = Ee(
867
+ "medium"
868
+ /* Medium */
869
+ ), Rt = d(le)(({ theme: e }) => ({
870
+ // Three times the largest spacing step: room for a label and the arrow.
871
+ minWidth: o(e.design.space[10] * 3),
872
+ maxWidth: "100%"
873
+ })), Et = d($e)(({ theme: e }) => ({
874
+ position: "relative",
875
+ transform: "none",
876
+ maxWidth: "100%",
877
+ pointerEvents: "auto",
878
+ marginBottom: o(e.design.space[2]),
879
+ fontSize: o(e.design.typeScale.small),
880
+ fontWeight: R.medium,
881
+ lineHeight: e.typography.caption.lineHeight,
882
+ color: e.design.tokens["text.secondary"],
883
+ "&.Mui-focused": { color: e.design.tokens["text.secondary"] },
884
+ "&.Mui-error": { color: e.design.tokens["status.danger"] },
885
+ "&.Mui-disabled": { color: e.design.tokens["text.muted"] }
886
+ })), zt = d("span")(({ theme: e }) => ({
887
+ display: "flex",
888
+ alignItems: "center",
889
+ gap: o(e.design.space[2]),
890
+ minWidth: 0
891
+ })), At = d("i", {
892
+ shouldForwardProp: (e) => e !== "token"
893
+ })(({ theme: e, token: n }) => ({
894
+ flex: "none",
895
+ width: o(e.design.space[2]),
896
+ height: o(e.design.space[2]),
897
+ borderRadius: o(e.design.radii.sm / 2),
898
+ backgroundColor: e.design.tokens[n]
899
+ })), $t = d("span")({
900
+ display: "flex",
901
+ flexDirection: "column",
902
+ minWidth: 0
903
+ }), Lt = d("span")(({ theme: e }) => ({
904
+ fontSize: o(e.design.typeScale.caption),
905
+ color: e.design.tokens["text.muted"],
906
+ whiteSpace: "normal"
907
+ })), pe = d("span")({
908
+ overflow: "hidden",
909
+ textOverflow: "ellipsis",
910
+ whiteSpace: "nowrap"
911
+ }), Dt = d(pe)(({ theme: e }) => ({
912
+ color: e.design.tokens["text.muted"]
913
+ }));
914
+ function hr({
915
+ label: e,
916
+ options: n,
917
+ value: t,
918
+ onChange: r,
919
+ multiple: s = !1,
920
+ disabled: c,
921
+ error: a,
922
+ size: l
923
+ }) {
924
+ const g = $(), b = ze(Tt), f = (l ?? b) === en.Compact, m = f ? Rt : le, h = D(), y = `${h}-label`, p = `${h}-helper`, u = new Map(n.map((C) => [C.value, C]));
925
+ return /* @__PURE__ */ x(m, { fullWidth: !f, disabled: c, error: !!a, children: [
926
+ /* @__PURE__ */ i(
927
+ Et,
928
+ {
929
+ id: y,
930
+ shrink: !0,
931
+ style: f ? bn : void 0,
932
+ children: e
933
+ }
934
+ ),
935
+ /* @__PURE__ */ x(
936
+ mn,
937
+ {
938
+ labelId: y,
939
+ multiple: s,
940
+ value: t,
941
+ displayEmpty: !0,
942
+ renderValue: (C) => {
943
+ const F = Array.isArray(C) ? C : [C];
944
+ return f && F.length === 0 ? /* @__PURE__ */ i(Dt, { "aria-hidden": !0, children: e }) : /* @__PURE__ */ i(pe, { children: F.map((P) => {
945
+ var O;
946
+ return ((O = u.get(P)) == null ? void 0 : O.label) ?? P;
947
+ }).join(", ") });
948
+ },
949
+ "aria-describedby": a ? p : void 0,
950
+ onChange: (C) => r(C.target.value),
951
+ children: [
952
+ n.length === 0 && /* @__PURE__ */ i(xe, { disabled: !0, value: "", children: g.formatMessage({ id: "ds.inputs.rich-select.empty" }) }),
953
+ n.map((C) => /* @__PURE__ */ i(xe, { value: C.value, children: /* @__PURE__ */ x(zt, { children: [
954
+ C.tone && /* @__PURE__ */ i(At, { token: C.tone }),
955
+ C.icon,
956
+ /* @__PURE__ */ x($t, { children: [
957
+ /* @__PURE__ */ i(pe, { children: C.label }),
958
+ C.description && /* @__PURE__ */ i(Lt, { children: C.description })
959
+ ] })
960
+ ] }) }, C.value))
961
+ ]
962
+ }
963
+ ),
964
+ a && /* @__PURE__ */ i(se, { id: p, children: a })
965
+ ] });
966
+ }
967
+ const br = { l: 0.72, c: 0.12 }, yr = [
968
+ 266,
969
+ 296,
970
+ 326,
971
+ 356,
972
+ 26,
973
+ 56,
974
+ 86,
975
+ 116,
976
+ 146,
977
+ 176,
978
+ 206,
979
+ 236
980
+ ], nn = [
981
+ "#81a2f0",
982
+ "#ab94e7",
983
+ "#cb89cd",
984
+ "#e084a7",
985
+ "#e6867d",
986
+ "#de9056",
987
+ "#c69f41",
988
+ "#a1ae50",
989
+ "#70b976",
990
+ "#37bda2",
991
+ "#18b9c9",
992
+ "#4eb0e5"
993
+ ], vr = "#767676", wr = nn[6], xr = "#111a2f", Cr = "#5674be", Pt = /^#?([0-9a-f]{6})$/i, q = (e) => {
994
+ const n = Pt.exec(e.trim());
995
+ return n ? `#${n[1].toLowerCase()}` : null;
996
+ }, Ht = d("div")(({ theme: e }) => ({
997
+ display: "flex",
998
+ alignItems: "center",
999
+ gap: o(e.design.space[3])
1000
+ })), Nt = d("span")(({ theme: e }) => ({
1001
+ flex: "none",
1002
+ width: o(e.design.densityValues[e.design.density].control),
1003
+ height: o(e.design.densityValues[e.design.density].control),
1004
+ borderRadius: o(e.design.radii.md),
1005
+ border: A(e.design.tokens["border.control"])
1006
+ })), _t = d("div")(({ theme: e }) => ({
1007
+ display: "flex",
1008
+ flexWrap: "wrap",
1009
+ gap: o(e.design.space[2]),
1010
+ marginTop: o(e.design.space[2])
1011
+ })), Bt = d(He)(({ theme: e }) => {
1012
+ const { densityValues: n, density: t, space: r } = e.design, s = n[t].control - r[2];
1013
+ return {
1014
+ width: o(s),
1015
+ height: o(s),
1016
+ borderRadius: o(e.design.radii.sm),
1017
+ border: A(e.design.tokens["border.control"]),
1018
+ // The chosen swatch carries the ring of the design system (`focus.ring` is the accent).
1019
+ '&[aria-pressed="true"]': te(e),
1020
+ "&.Mui-focusVisible": te(e),
1021
+ [Z.down(K.Tablet)]: {
1022
+ width: o(e.design.densityValues.touchTarget),
1023
+ height: o(e.design.densityValues.touchTarget)
1024
+ }
1025
+ };
1026
+ });
1027
+ function kr({
1028
+ label: e,
1029
+ value: n,
1030
+ onChange: t,
1031
+ swatches: r = nn
1032
+ }) {
1033
+ const s = $(), c = D(), [a, l] = I(n), g = a !== "" && q(a) === null;
1034
+ B(() => {
1035
+ l(
1036
+ (m) => q(m) === q(n) ? m : n
1037
+ );
1038
+ }, [n]);
1039
+ const b = (m) => {
1040
+ l(m);
1041
+ const h = q(m);
1042
+ h !== null && h !== q(n) && t(h);
1043
+ }, f = q(n);
1044
+ return /* @__PURE__ */ x(le, { fullWidth: !0, error: g, children: [
1045
+ /* @__PURE__ */ i($e, { htmlFor: `${c}-hex`, children: e }),
1046
+ /* @__PURE__ */ x(Ht, { children: [
1047
+ /* @__PURE__ */ i(
1048
+ Nt,
1049
+ {
1050
+ "aria-hidden": "true",
1051
+ style: { backgroundColor: f ?? void 0 }
1052
+ }
1053
+ ),
1054
+ /* @__PURE__ */ i(
1055
+ fe,
1056
+ {
1057
+ id: `${c}-hex`,
1058
+ fullWidth: !0,
1059
+ value: a,
1060
+ error: g,
1061
+ inputProps: {
1062
+ "aria-describedby": g ? `${c}-error` : void 0,
1063
+ spellCheck: !1,
1064
+ autoComplete: "off"
1065
+ },
1066
+ onChange: (m) => b(m.target.value)
1067
+ }
1068
+ )
1069
+ ] }),
1070
+ g && /* @__PURE__ */ i(se, { id: `${c}-error`, children: s.formatMessage({ id: "ds.inputs.color.invalid" }) }),
1071
+ /* @__PURE__ */ i(
1072
+ _t,
1073
+ {
1074
+ role: "group",
1075
+ "aria-label": s.formatMessage({ id: "ds.inputs.color.swatches" }),
1076
+ children: r.map((m) => /* @__PURE__ */ i(
1077
+ Bt,
1078
+ {
1079
+ "aria-pressed": q(m) === f,
1080
+ "aria-label": m,
1081
+ style: { backgroundColor: m },
1082
+ onClick: () => t(q(m) ?? m)
1083
+ },
1084
+ m
1085
+ ))
1086
+ }
1087
+ )
1088
+ ] });
1089
+ }
1090
+ const Vt = 6, jt = d("div", {
1091
+ shouldForwardProp: (e) => e !== "edges"
1092
+ })(({ theme: e, edges: n }) => {
1093
+ const { tokens: t, radii: r, space: s } = e.design, c = o(s[1] * Vt), a = t["text.primary"], l = n.start ? `transparent, ${a} ${c}` : a, g = n.end ? `${a} calc(100% - ${c}), transparent` : a;
1094
+ return {
1095
+ maskImage: n.start || n.end ? `linear-gradient(to right, ${l}, ${g})` : "none",
1096
+ display: "inline-flex",
1097
+ maxWidth: "100%",
1098
+ minWidth: 0,
1099
+ border: A(t["border.subtle"]),
1100
+ borderRadius: o(r.md),
1101
+ overflowX: "auto",
1102
+ overflowY: "hidden",
1103
+ backgroundColor: t["bg.surface"],
1104
+ // Below 768 px each segment keeps a 44 px target: the band wraps onto more rows rather than
1105
+ // hiding segments behind a sideways scroll. A rule between neighbours would then start the
1106
+ // second row with a stray line and leave the rows unsplit: the band loses its border and each
1107
+ // segment draws its own, apart by a gap in both directions.
1108
+ [Z.down(K.Tablet)]: {
1109
+ flexWrap: "wrap",
1110
+ rowGap: o(s[1]),
1111
+ columnGap: o(s[1]),
1112
+ overflowX: "visible",
1113
+ maskImage: "none",
1114
+ border: "none",
1115
+ backgroundColor: "transparent"
1116
+ }
1117
+ };
1118
+ }), Gt = d(He)(({ theme: e }) => {
1119
+ const { tokens: n, space: t, typeScale: r, fonts: s, densityValues: c, radii: a } = e.design;
1120
+ return {
1121
+ flex: "none",
1122
+ gap: o(t[2]),
1123
+ minHeight: o(c[e.design.density].control),
1124
+ paddingLeft: o(t[3]),
1125
+ paddingRight: o(t[3]),
1126
+ fontFamily: s.sans,
1127
+ fontSize: o(r.body),
1128
+ whiteSpace: "nowrap",
1129
+ color: n["text.secondary"],
1130
+ transition: oe(e, ["background-color", "color"]),
1131
+ "& + &": { borderLeft: A(n["border.subtle"]) },
1132
+ '&[aria-checked="true"]': {
1133
+ backgroundColor: n["bg.raised"],
1134
+ color: n["text.primary"],
1135
+ fontWeight: R.medium
1136
+ },
1137
+ "&:hover": { backgroundColor: n["bg.hover"] },
1138
+ "&.Mui-focusVisible": { ...te(e), outlineOffset: "-2px" },
1139
+ // A short label (« 1 h », « 7 j ») would leave a segment narrower than a finger. Each segment
1140
+ // is its own bordered tile once the band wraps.
1141
+ [Z.down(K.Tablet)]: {
1142
+ minWidth: o(c.touchTarget),
1143
+ minHeight: o(c.touchTarget),
1144
+ border: A(n["border.subtle"]),
1145
+ borderRadius: o(a.md),
1146
+ backgroundColor: n["bg.surface"],
1147
+ '&[aria-checked="true"]': { backgroundColor: n["bg.raised"] }
1148
+ }
1149
+ };
1150
+ }), qt = d("span")(({ theme: e }) => ({
1151
+ fontFamily: e.design.fonts.mono,
1152
+ fontSize: o(e.design.typeScale.caption),
1153
+ color: e.design.tokens["text.muted"]
1154
+ }));
1155
+ function Sr({
1156
+ options: e,
1157
+ value: n,
1158
+ onChange: t,
1159
+ ariaLabel: r
1160
+ }) {
1161
+ const s = Y(null), [c, a] = I({ start: !1, end: !1 }), l = Q(() => {
1162
+ const f = s.current;
1163
+ if (!f)
1164
+ return;
1165
+ const m = f.scrollLeft > 0, h = f.scrollLeft + f.clientWidth < f.scrollWidth - 1;
1166
+ a(
1167
+ (y) => y.start === m && y.end === h ? y : { start: m, end: h }
1168
+ );
1169
+ }, []);
1170
+ B(() => (l(), window.addEventListener("resize", l), () => window.removeEventListener("resize", l)), [l, e]);
1171
+ const g = (f) => {
1172
+ var y, p;
1173
+ const m = e.findIndex((u) => u.value === n);
1174
+ let h;
1175
+ switch (f.key) {
1176
+ case "ArrowRight":
1177
+ case "ArrowDown":
1178
+ h = (m + 1) % e.length;
1179
+ break;
1180
+ case "ArrowLeft":
1181
+ case "ArrowUp":
1182
+ h = (m - 1 + e.length) % e.length;
1183
+ break;
1184
+ case "Home":
1185
+ h = 0;
1186
+ break;
1187
+ case "End":
1188
+ h = e.length - 1;
1189
+ break;
1190
+ default:
1191
+ return;
1192
+ }
1193
+ f.preventDefault(), t(e[h].value), (p = (y = s.current) == null ? void 0 : y.querySelectorAll('[role="radio"]')[h]) == null || p.focus();
1194
+ }, b = Math.max(
1195
+ e.findIndex((f) => f.value === n),
1196
+ 0
1197
+ );
1198
+ return /* @__PURE__ */ i(
1199
+ jt,
1200
+ {
1201
+ ref: s,
1202
+ role: "radiogroup",
1203
+ "aria-label": r,
1204
+ edges: c,
1205
+ onKeyDown: g,
1206
+ onScroll: l,
1207
+ children: e.map((f, m) => {
1208
+ const h = f.value === n;
1209
+ return /* @__PURE__ */ x(
1210
+ Gt,
1211
+ {
1212
+ role: "radio",
1213
+ "aria-checked": h,
1214
+ tabIndex: m === b ? 0 : -1,
1215
+ onClick: () => t(f.value),
1216
+ children: [
1217
+ f.label,
1218
+ f.count !== void 0 && /* @__PURE__ */ i(qt, { children: f.count })
1219
+ ]
1220
+ },
1221
+ f.value
1222
+ );
1223
+ })
1224
+ }
1225
+ );
1226
+ }
1227
+ const Ut = [32, 160, 8239, 8201].map(
1228
+ (e) => String.fromCharCode(e)
1229
+ ), Kt = (e) => {
1230
+ var t, r;
1231
+ const n = new Intl.NumberFormat(e).formatToParts(11111.1);
1232
+ return {
1233
+ group: ((t = n.find((s) => s.type === "group")) == null ? void 0 : t.value) ?? " ",
1234
+ decimal: ((r = n.find((s) => s.type === "decimal")) == null ? void 0 : r.value) ?? "."
1235
+ };
1236
+ }, Te = (e, n) => {
1237
+ const r = [n.group, ...Ut].reduce(
1238
+ (c, a) => c.split(a).join(""),
1239
+ e.trim()
1240
+ ).replace(",", ".");
1241
+ if (r === "" || !/^-?\d*\.?\d+$|^-?\d+\.$/.test(r))
1242
+ return null;
1243
+ const s = Number.parseFloat(r);
1244
+ return Number.isFinite(s) ? s : null;
1245
+ };
1246
+ function Ir({
1247
+ label: e,
1248
+ value: n,
1249
+ onChange: t,
1250
+ decimals: r = 0,
1251
+ min: s = 0,
1252
+ disabled: c,
1253
+ adornment: a
1254
+ }) {
1255
+ const l = $(), g = ge(
1256
+ () => Kt(l.locale),
1257
+ [l.locale]
1258
+ ), b = Q(
1259
+ (u) => u === null ? "" : l.formatNumber(u, {
1260
+ minimumFractionDigits: r,
1261
+ maximumFractionDigits: r
1262
+ }),
1263
+ [l, r]
1264
+ ), [f, m] = I(!1), [h, y] = I(() => b(n));
1265
+ return B(() => {
1266
+ f || y(b(n));
1267
+ }, [n, f, b]), /* @__PURE__ */ i(Be, { label: e, children: /* @__PURE__ */ i(
1268
+ fe,
1269
+ {
1270
+ disabled: c,
1271
+ value: h,
1272
+ inputProps: { inputMode: "decimal" },
1273
+ onFocus: () => {
1274
+ m(!0), n !== null && y(String(n).replace(".", g.decimal));
1275
+ },
1276
+ onChange: (u) => {
1277
+ y(u.target.value);
1278
+ const w = Te(u.target.value, g);
1279
+ w !== null ? t(w) : u.target.value === "" && t(null);
1280
+ },
1281
+ onBlur: () => {
1282
+ m(!1);
1283
+ let u = Te(h, g);
1284
+ u !== null && (u = Number.parseFloat(Math.max(u, s).toFixed(r))), t(u), y(b(u));
1285
+ },
1286
+ endAdornment: a ? /* @__PURE__ */ i(xn, { position: "end", children: a }) : void 0
1287
+ }
1288
+ ) });
1289
+ }
1290
+ const Yt = d("div")(({ theme: e }) => ({
1291
+ display: "flex",
1292
+ flexDirection: "column",
1293
+ gap: o(e.design.space[2]),
1294
+ minWidth: 0
1295
+ })), Xt = d("span")(({ theme: e }) => ({
1296
+ fontSize: o(e.design.typeScale.small),
1297
+ fontWeight: R.medium,
1298
+ color: e.design.tokens["text.secondary"]
1299
+ })), Qt = d("div", {
1300
+ shouldForwardProp: (e) => e !== "active"
1301
+ })(({ theme: e, active: n }) => {
1302
+ const { tokens: t, space: r, radii: s } = e.design;
1303
+ return {
1304
+ display: "flex",
1305
+ flexDirection: "column",
1306
+ alignItems: "center",
1307
+ justifyContent: "center",
1308
+ gap: o(r[3]),
1309
+ minHeight: o(r[10] * 3),
1310
+ padding: `${o(r[6])} ${o(r[4])}`,
1311
+ boxSizing: "border-box",
1312
+ border: `1px dashed ${n ? t.accent : t["border.control"]}`,
1313
+ borderRadius: o(s.md),
1314
+ backgroundColor: n ? de(t.accent) : t["bg.raised"],
1315
+ color: t["text.secondary"],
1316
+ textAlign: "center",
1317
+ cursor: "pointer",
1318
+ transition: oe(e, ["border-color", "background-color"]),
1319
+ "&:hover": { borderColor: t.accent }
1320
+ };
1321
+ }), Zt = d("span")(({ theme: e }) => {
1322
+ const { tokens: n, space: t } = e.design;
1323
+ return {
1324
+ display: "inline-flex",
1325
+ alignItems: "center",
1326
+ justifyContent: "center",
1327
+ width: o(t[9]),
1328
+ height: o(t[9]),
1329
+ borderRadius: "50%",
1330
+ backgroundColor: de(n.accent),
1331
+ color: n["accent.text"],
1332
+ "& svg": { width: o(t[5]), height: o(t[5]) }
1333
+ };
1334
+ }), Jt = d("span")(({ theme: e }) => ({
1335
+ fontSize: o(e.design.typeScale.body),
1336
+ [Z.down(K.Tablet)]: { display: "none" }
1337
+ })), eo = d("div")(({ theme: e }) => ({
1338
+ display: "flex",
1339
+ flexWrap: "wrap",
1340
+ alignItems: "center",
1341
+ justifyContent: "space-between",
1342
+ gap: o(e.design.space[2])
1343
+ })), no = d("span")(({ theme: e }) => ({
1344
+ fontSize: o(e.design.typeScale.small),
1345
+ color: e.design.tokens["text.muted"]
1346
+ })), to = d("p")(({ theme: e }) => ({
1347
+ margin: 0,
1348
+ fontSize: o(e.design.typeScale.small),
1349
+ color: e.design.tokens["status.danger"]
1350
+ })), oo = d("img")(({ theme: e }) => ({
1351
+ width: o(e.design.space[4]),
1352
+ height: o(e.design.space[4])
1353
+ })), ro = (e) => {
1354
+ const { value: n, unit: t } = Wn(e);
1355
+ return `${n} ${t}`;
1356
+ };
1357
+ function Fr({
1358
+ onDrop: e,
1359
+ multiple: n = !0,
1360
+ accept: t,
1361
+ maxSize: r,
1362
+ caption: s,
1363
+ title: c,
1364
+ cloudImport: a,
1365
+ children: l
1366
+ }) {
1367
+ const g = $(), b = D(), f = D(), [m, h] = I(null), [y, p] = I(!1), u = r === void 0 ? null : ro(r), w = s ?? (u === null ? null : g.formatMessage(
1368
+ { id: "ds.inputs.drop-zone.max-size" },
1369
+ { size: u, multiple: String(n) }
1370
+ )), C = (T, M) => {
1371
+ const ee = r === void 0 ? [] : T.filter((N) => N.size > r), re = T.filter((N) => !ee.includes(N));
1372
+ M.some(
1373
+ (N) => N.errors.some((j) => j.code === Mn.TooManyFiles)
1374
+ ) ? h(
1375
+ "too-many"
1376
+ /* TooMany */
1377
+ ) : M.length > 0 ? h(
1378
+ "rejected-type"
1379
+ /* Rejected */
1380
+ ) : ee.length > 0 ? h(
1381
+ T.length === 1 ? "too-big" : "some-too-big"
1382
+ /* SomeTooBig */
1383
+ ) : h(null), re.length > 0 && e(re);
1384
+ }, { getRootProps: F, getInputProps: P, isDragActive: O, open: H } = In({
1385
+ onDrop: C,
1386
+ multiple: n,
1387
+ accept: t,
1388
+ // The zone itself is not a control: the button inside is, for the keyboard and screen readers.
1389
+ noClick: !0,
1390
+ noKeyboard: !0
1391
+ }), V = g.formatMessage(
1392
+ { id: "ds.inputs.drop-zone.browse" },
1393
+ { multiple: String(n) }
1394
+ );
1395
+ return /* @__PURE__ */ x(
1396
+ Yt,
1397
+ {
1398
+ role: "group",
1399
+ "aria-labelledby": c !== void 0 ? b : void 0,
1400
+ "aria-describedby": w !== null ? f : void 0,
1401
+ children: [
1402
+ c !== void 0 && /* @__PURE__ */ i(Xt, { id: b, children: c }),
1403
+ /* @__PURE__ */ x(Qt, { ...F({ onClick: H }), active: O, children: [
1404
+ /* @__PURE__ */ i("input", { ...P({ "aria-hidden": !0 }) }),
1405
+ l ?? /* @__PURE__ */ x(J, { children: [
1406
+ /* @__PURE__ */ i(Zt, { "aria-hidden": !0, children: /* @__PURE__ */ i(On, {}) }),
1407
+ /* @__PURE__ */ i(Jt, { children: g.formatMessage(
1408
+ {
1409
+ id: O ? "ds.inputs.drop-zone.release" : "ds.inputs.drop-zone.prompt"
1410
+ },
1411
+ { multiple: String(n) }
1412
+ ) })
1413
+ ] }),
1414
+ /* @__PURE__ */ i(
1415
+ X,
1416
+ {
1417
+ variant: "outlined",
1418
+ onClick: (T) => {
1419
+ T.stopPropagation(), H();
1420
+ },
1421
+ children: V
1422
+ }
1423
+ )
1424
+ ] }),
1425
+ (a !== void 0 || w !== null) && /* @__PURE__ */ x(eo, { children: [
1426
+ a !== void 0 && /* @__PURE__ */ i(
1427
+ X,
1428
+ {
1429
+ variant: "text",
1430
+ startIcon: /* @__PURE__ */ i(oo, { src: Fn, alt: "" }),
1431
+ onClick: () => p(!0),
1432
+ children: g.formatMessage({ id: "ds.inputs.drop-zone.cloud" })
1433
+ }
1434
+ ),
1435
+ w !== null && /* @__PURE__ */ i(no, { id: f, children: w })
1436
+ ] }),
1437
+ /* @__PURE__ */ i(to, { role: "alert", children: m !== null && g.formatMessage(
1438
+ { id: `ds.inputs.drop-zone.${m}` },
1439
+ { size: u ?? "" }
1440
+ ) }),
1441
+ a !== void 0 && /* @__PURE__ */ i(
1442
+ Ot,
1443
+ {
1444
+ open: y,
1445
+ onClose: () => p(!1),
1446
+ onImport: a.onImport,
1447
+ cloudPicker: a,
1448
+ multiple: n,
1449
+ maxSize: r,
1450
+ accept: t === void 0 ? void 0 : Object.entries(t).flatMap(([T, M]) => [
1451
+ T,
1452
+ ...M
1453
+ ])
1454
+ }
1455
+ )
1456
+ ]
1457
+ }
1458
+ );
1459
+ }
1460
+ var io = /* @__PURE__ */ ((e) => (e.Default = "default", e.Danger = "danger", e.Warning = "warning", e))(io || {});
1461
+ const so = d("form")(({ theme: e }) => ({
1462
+ display: "flex",
1463
+ flexDirection: "column",
1464
+ gap: o(e.design.space[4]),
1465
+ color: e.design.tokens["text.secondary"],
1466
+ overflowWrap: "anywhere"
1467
+ })), ao = (e, n) => {
1468
+ const { paper: t } = e.design.tokens, r = e.design.tokens["paper.on"];
1469
+ return Ce(n, t) >= Ce(n, r) ? t : r;
1470
+ }, lo = {
1471
+ default: "primary",
1472
+ danger: "error",
1473
+ warning: "warning"
1474
+ };
1475
+ function co({
1476
+ open: e,
1477
+ title: n,
1478
+ body: t,
1479
+ confirmLabel: r,
1480
+ tone: s = "default",
1481
+ confirmationText: c,
1482
+ onConfirm: a,
1483
+ onCancel: l
1484
+ }) {
1485
+ const g = $(), b = hn(), f = D(), [m, h] = I(""), [y, p] = I(!1), [u, w] = I(!1), [C, F] = I(e);
1486
+ e !== C && (F(e), e && (h(""), w(!1)));
1487
+ const P = !y && (c === void 0 || m === c), O = s !== "default", H = () => {
1488
+ y || l();
1489
+ }, V = () => {
1490
+ if (!P)
1491
+ return;
1492
+ w(!1);
1493
+ let M;
1494
+ try {
1495
+ M = a();
1496
+ } catch {
1497
+ w(!0);
1498
+ return;
1499
+ }
1500
+ M instanceof Promise && (p(!0), M.then(
1501
+ () => p(!1),
1502
+ () => {
1503
+ p(!1), w(!0);
1504
+ }
1505
+ ));
1506
+ }, T = (M) => {
1507
+ M.preventDefault(), V();
1508
+ };
1509
+ return /* @__PURE__ */ i(
1510
+ De,
1511
+ {
1512
+ open: e,
1513
+ onClose: H,
1514
+ size: Pe.Small,
1515
+ title: n,
1516
+ actions: /* @__PURE__ */ x(J, { children: [
1517
+ /* @__PURE__ */ i(
1518
+ X,
1519
+ {
1520
+ variant: "outlined",
1521
+ disabled: y,
1522
+ autoFocus: c === void 0 && O,
1523
+ onClick: H,
1524
+ children: g.formatMessage({ id: "ds.layers.confirm-dialog.cancel" })
1525
+ }
1526
+ ),
1527
+ /* @__PURE__ */ i(
1528
+ X,
1529
+ {
1530
+ type: "submit",
1531
+ form: f,
1532
+ variant: "contained",
1533
+ color: lo[s],
1534
+ disabled: !P,
1535
+ loading: y,
1536
+ autoFocus: c === void 0 && !O,
1537
+ sx: s === "warning" ? {
1538
+ "&:not(.Mui-disabled)": {
1539
+ color: ao(
1540
+ b,
1541
+ b.design.tokens["status.warning"]
1542
+ )
1543
+ }
1544
+ } : void 0,
1545
+ children: r
1546
+ }
1547
+ )
1548
+ ] }),
1549
+ children: /* @__PURE__ */ x(so, { id: f, onSubmit: T, noValidate: !0, children: [
1550
+ /* @__PURE__ */ i("div", { children: t }),
1551
+ c !== void 0 && /* @__PURE__ */ i(
1552
+ Un,
1553
+ {
1554
+ label: g.formatMessage(
1555
+ { id: "ds.layers.confirm-dialog.type-to-confirm" },
1556
+ { text: c }
1557
+ ),
1558
+ value: m,
1559
+ onChange: (M) => h(M.target.value),
1560
+ disabled: y,
1561
+ autoFocus: !0,
1562
+ autoComplete: "off",
1563
+ fullWidth: !0
1564
+ }
1565
+ ),
1566
+ u && /* @__PURE__ */ i(qn, { severity: "error", children: g.formatMessage({ id: "ds.layers.confirm-dialog.failed" }) })
1567
+ ] })
1568
+ }
1569
+ );
1570
+ }
1571
+ var uo = /* @__PURE__ */ ((e) => (e.BottomStart = "bottom-start", e.BottomEnd = "bottom-end", e))(uo || {});
1572
+ const po = 320, go = d("div")(({ theme: e }) => {
1573
+ const { tokens: n, space: t } = e.design;
1574
+ return {
1575
+ flex: "none",
1576
+ display: "flex",
1577
+ alignItems: "center",
1578
+ justifyContent: "space-between",
1579
+ gap: o(t[3]),
1580
+ padding: `${o(t[2])} ${o(t[2])} ${o(t[2])} ${o(t[4])}`,
1581
+ borderBottom: A(n["border.subtle"])
1582
+ };
1583
+ }), fo = d("h2")(({ theme: e }) => ({
1584
+ margin: 0,
1585
+ minWidth: 0,
1586
+ color: e.design.tokens["text.primary"],
1587
+ fontSize: o(e.design.typeScale.body),
1588
+ fontWeight: R.semibold,
1589
+ overflowWrap: "anywhere"
1590
+ })), tn = d("div")(({ theme: e }) => ({
1591
+ display: "flex",
1592
+ flexDirection: "column",
1593
+ gap: o(e.design.space[3]),
1594
+ fontSize: o(e.design.typeScale.body)
1595
+ })), mo = d(tn)(({ theme: e }) => ({
1596
+ padding: o(e.design.space[4])
1597
+ }));
1598
+ function Mr({
1599
+ anchorEl: e,
1600
+ open: n,
1601
+ onClose: t,
1602
+ title: r,
1603
+ placement: s = "bottom-start",
1604
+ width: c = po,
1605
+ children: a
1606
+ }) {
1607
+ const l = $(), g = D(), b = vn() === K.Mobile, f = l.formatMessage({
1608
+ id: "ds.layers.anchored-panel.close"
1609
+ }), m = n && e !== null;
1610
+ if (b)
1611
+ return /* @__PURE__ */ i(
1612
+ wn,
1613
+ {
1614
+ open: m,
1615
+ onClose: t,
1616
+ title: r,
1617
+ closeLabel: f,
1618
+ children: /* @__PURE__ */ i(tn, { children: a })
1619
+ }
1620
+ );
1621
+ const h = s === "bottom-end" ? "right" : "left";
1622
+ return /* @__PURE__ */ x(
1623
+ Gn,
1624
+ {
1625
+ anchorEl: e,
1626
+ open: m,
1627
+ onClose: () => t(),
1628
+ anchorOrigin: { vertical: "bottom", horizontal: h },
1629
+ transformOrigin: { vertical: "top", horizontal: h },
1630
+ slotProps: {
1631
+ paper: {
1632
+ role: "dialog",
1633
+ "aria-modal": !0,
1634
+ "aria-labelledby": g,
1635
+ sx: (y) => ({
1636
+ width: o(c),
1637
+ maxWidth: `calc(100vw - ${o(y.design.space[4] * 2)})`,
1638
+ marginTop: o(y.design.space[1]),
1639
+ color: y.design.tokens["text.primary"],
1640
+ fontFamily: y.design.fonts.sans
1641
+ })
1642
+ }
1643
+ },
1644
+ children: [
1645
+ /* @__PURE__ */ x(go, { children: [
1646
+ /* @__PURE__ */ i(fo, { id: g, children: r }),
1647
+ /* @__PURE__ */ i(ae, { "aria-label": f, onClick: t, children: /* @__PURE__ */ i(_e, { "aria-hidden": !0 }) })
1648
+ ] }),
1649
+ /* @__PURE__ */ i(mo, { children: a })
1650
+ ]
1651
+ }
1652
+ );
1653
+ }
1654
+ const on = Ee(null);
1655
+ function Wr({ children: e }) {
1656
+ const [n, t] = I([]), [r, s] = I(null), c = Y(0), a = Y([]);
1657
+ a.current = n;
1658
+ const l = n.length > 0 ? n[0] : null;
1659
+ l !== null && l !== r && s(l), B(
1660
+ () => () => {
1661
+ a.current.forEach((m) => m.resolve(!1));
1662
+ },
1663
+ []
1664
+ );
1665
+ const g = Q(
1666
+ (m) => new Promise((h) => {
1667
+ c.current += 1;
1668
+ const y = { id: c.current, options: m, resolve: h };
1669
+ t((p) => [...p, y]);
1670
+ }),
1671
+ []
1672
+ ), b = (m) => {
1673
+ l !== null && (l.resolve(m), t((h) => h.filter((y) => y !== l)));
1674
+ }, f = ge(() => ({ confirm: g }), [g]);
1675
+ return /* @__PURE__ */ x(on.Provider, { value: f, children: [
1676
+ e,
1677
+ r !== null && // A new key per request: each one starts from an empty confirmation field.
1678
+ /* @__PURE__ */ i(
1679
+ co,
1680
+ {
1681
+ open: l === r,
1682
+ ...r.options,
1683
+ onConfirm: () => b(!0),
1684
+ onCancel: () => b(!1)
1685
+ },
1686
+ r.id
1687
+ )
1688
+ ] });
1689
+ }
1690
+ function Or() {
1691
+ const e = ze(on);
1692
+ if (e === null)
1693
+ throw new Error(
1694
+ "useConfirmDialog must be called inside a ConfirmDialogProvider"
1695
+ );
1696
+ return e;
1697
+ }
1698
+ const ho = 1, bo = (e, n) => n === "vertical" ? e.scrollHeight - e.clientHeight - e.scrollTop : e.scrollWidth - e.clientWidth - e.scrollLeft, yo = (e, n, t) => {
1699
+ const [r, s] = I(!1), c = Q(() => {
1700
+ const a = e.current;
1701
+ a !== null && s(bo(a, n) > ho);
1702
+ }, [e, n]);
1703
+ return Ae(c, [c, t]), B(() => {
1704
+ const a = e.current;
1705
+ if (a === null)
1706
+ return;
1707
+ a.addEventListener("scroll", c, { passive: !0 });
1708
+ const l = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
1709
+ return l !== null && (l.observe(a), Array.from(a.children).forEach((g) => l.observe(g))), () => {
1710
+ a.removeEventListener("scroll", c), l == null || l.disconnect();
1711
+ };
1712
+ }, [e, c, t]), r;
1713
+ };
1714
+ var vo = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e))(vo || {});
1715
+ const wo = 2, xo = /* @__PURE__ */ new Set(["Enter", " "]), Co = d("div", {
1716
+ shouldForwardProp: (e) => e !== "variant"
1717
+ })(({ theme: e, variant: n }) => ({
1718
+ minWidth: 0,
1719
+ ...n === "primary" && {
1720
+ borderBottom: A(e.design.tokens["border.subtle"])
1721
+ }
1722
+ })), rn = 32, ko = d("div", {
1723
+ shouldForwardProp: (e) => e !== "variant" && e !== "fade"
1724
+ })(({ theme: e, variant: n, fade: t }) => {
1725
+ const s = `linear-gradient(to right, ${e.design.tokens["text.primary"]} calc(100% - ${o(
1726
+ rn
1727
+ )}), transparent)`;
1728
+ return {
1729
+ position: "relative",
1730
+ display: "flex",
1731
+ gap: o(e.design.space[n === "primary" ? 1 : 2]),
1732
+ overflowX: "auto",
1733
+ overflowY: "hidden",
1734
+ scrollbarWidth: "none",
1735
+ "&::-webkit-scrollbar": { display: "none" },
1736
+ ...t && { maskImage: s, WebkitMaskImage: s }
1737
+ };
1738
+ }), sn = (e, n) => {
1739
+ const { tokens: t, space: r, radii: s, typeScale: c, fonts: a, densityValues: l, density: g } = e.design, b = {
1740
+ position: "relative",
1741
+ display: "inline-flex",
1742
+ alignItems: "center",
1743
+ flex: "none",
1744
+ gap: o(r[2]),
1745
+ boxSizing: "border-box",
1746
+ margin: 0,
1747
+ border: 0,
1748
+ backgroundColor: "transparent",
1749
+ cursor: "pointer",
1750
+ fontFamily: a.sans,
1751
+ whiteSpace: "nowrap",
1752
+ textDecoration: "none",
1753
+ color: t["text.secondary"],
1754
+ transition: oe(e, ["color", "background-color"]),
1755
+ "&:hover": { color: t["text.primary"] },
1756
+ '&[aria-selected="true"]': {
1757
+ color: t["text.primary"],
1758
+ fontWeight: R.medium
1759
+ },
1760
+ // Inside the scrolling row, an outer ring would be clipped: it is drawn inside the tab.
1761
+ "&:focus-visible": { ...te(e), outlineOffset: "-2px" }
1762
+ }, f = {
1763
+ [Z.down(K.Tablet)]: {
1764
+ minHeight: o(l.touchTarget)
1765
+ }
1766
+ };
1767
+ return n === "primary" ? {
1768
+ ...b,
1769
+ minHeight: o(l[g].control + r[2]),
1770
+ padding: `0 ${o(r[3])}`,
1771
+ fontSize: o(c.body),
1772
+ '&[aria-selected="true"]::after': {
1773
+ content: '""',
1774
+ position: "absolute",
1775
+ left: 0,
1776
+ right: 0,
1777
+ bottom: 0,
1778
+ height: o(wo),
1779
+ backgroundColor: t.accent
1780
+ },
1781
+ ...f
1782
+ } : {
1783
+ ...b,
1784
+ minHeight: o(l.compact.control),
1785
+ padding: `0 ${o(r[3])}`,
1786
+ borderRadius: o(s.md),
1787
+ fontSize: o(c.small),
1788
+ "&:hover": {
1789
+ color: t["text.primary"],
1790
+ backgroundColor: t["bg.hover"]
1791
+ },
1792
+ '&[aria-selected="true"]': {
1793
+ color: t["text.primary"],
1794
+ fontWeight: R.medium,
1795
+ backgroundColor: t["bg.raised"]
1796
+ },
1797
+ ...f
1798
+ };
1799
+ }, an = (e) => e !== "variant", So = d(Kn, { shouldForwardProp: an })(({ theme: e, variant: n }) => sn(e, n)), Io = d("button", { shouldForwardProp: an })(({ theme: e, variant: n }) => sn(e, n)), Fo = d("span")(({ theme: e }) => {
1800
+ const { tokens: n, space: t, radii: r, fonts: s, typeScale: c } = e.design;
1801
+ return {
1802
+ display: "inline-flex",
1803
+ alignItems: "center",
1804
+ padding: `0 ${o(t[1])}`,
1805
+ borderRadius: o(r.sm),
1806
+ border: A(n["border.subtle"]),
1807
+ fontFamily: s.mono,
1808
+ fontSize: o(c.caption),
1809
+ fontWeight: R.regular,
1810
+ lineHeight: 1.6,
1811
+ color: n["text.muted"]
1812
+ };
1813
+ }), Re = (e, n) => {
1814
+ const t = n.offsetLeft, r = t + n.offsetWidth + rn;
1815
+ t < e.scrollLeft ? e.scrollLeft = t : r > e.scrollLeft + e.clientWidth && (e.scrollLeft = r - e.clientWidth);
1816
+ };
1817
+ function Tr({
1818
+ items: e,
1819
+ value: n,
1820
+ onChange: t,
1821
+ variant: r,
1822
+ "aria-label": s
1823
+ }) {
1824
+ const c = $(), a = Y(null), l = e.filter((p) => p.hidden !== !0), g = yo(a, "horizontal", l.length), b = Q(
1825
+ () => {
1826
+ var p;
1827
+ return Array.from(
1828
+ ((p = a.current) == null ? void 0 : p.querySelectorAll('[role="tab"]')) ?? []
1829
+ );
1830
+ },
1831
+ []
1832
+ ), f = Q(() => {
1833
+ const p = a.current, u = p == null ? void 0 : p.querySelector('[aria-selected="true"]');
1834
+ p && u && Re(p, u);
1835
+ }, []);
1836
+ Ae(f, [f, n]);
1837
+ const m = l.map((p) => p.value).join("|");
1838
+ B(() => {
1839
+ const p = a.current;
1840
+ if (p === null || typeof ResizeObserver > "u")
1841
+ return;
1842
+ const u = new ResizeObserver(f);
1843
+ return u.observe(p), Array.from(p.children).forEach((w) => u.observe(w)), () => u.disconnect();
1844
+ }, [f, m]);
1845
+ const h = (p) => {
1846
+ const u = b(), w = u.findIndex((F) => F === document.activeElement);
1847
+ if (w < 0)
1848
+ return;
1849
+ if (xo.has(p.key)) {
1850
+ p.key === " " && u[w] instanceof HTMLAnchorElement && (p.preventDefault(), u[w].click());
1851
+ return;
1852
+ }
1853
+ let C;
1854
+ switch (p.key) {
1855
+ case "ArrowRight":
1856
+ C = (w + 1) % u.length;
1857
+ break;
1858
+ case "ArrowLeft":
1859
+ C = (w - 1 + u.length) % u.length;
1860
+ break;
1861
+ case "Home":
1862
+ C = 0;
1863
+ break;
1864
+ case "End":
1865
+ C = u.length - 1;
1866
+ break;
1867
+ default:
1868
+ return;
1869
+ }
1870
+ p.preventDefault(), u[C].focus(), a.current && Re(a.current, u[C]);
1871
+ }, y = Math.max(
1872
+ l.findIndex((p) => p.value === n),
1873
+ 0
1874
+ );
1875
+ return /* @__PURE__ */ i(Co, { variant: r, children: /* @__PURE__ */ i(
1876
+ ko,
1877
+ {
1878
+ ref: a,
1879
+ role: "tablist",
1880
+ "aria-label": s,
1881
+ variant: r,
1882
+ fade: g,
1883
+ "data-overflowing": g || void 0,
1884
+ onKeyDown: h,
1885
+ children: l.map((p, u) => {
1886
+ const w = p.value === n, C = /* @__PURE__ */ x(J, { children: [
1887
+ p.label,
1888
+ p.badge !== void 0 && /* @__PURE__ */ i(Fo, { children: typeof p.badge == "number" ? c.formatNumber(p.badge) : p.badge })
1889
+ ] }), F = {
1890
+ role: "tab",
1891
+ "aria-selected": w,
1892
+ tabIndex: u === y ? 0 : -1,
1893
+ "data-testid": p.testId,
1894
+ variant: r,
1895
+ onClick: () => t == null ? void 0 : t(p.value)
1896
+ };
1897
+ return p.to !== void 0 ? /* @__PURE__ */ i(
1898
+ So,
1899
+ {
1900
+ to: p.to,
1901
+ "aria-current": w ? "page" : void 0,
1902
+ ...F,
1903
+ children: C
1904
+ },
1905
+ p.value
1906
+ ) : /* @__PURE__ */ i(Io, { type: "button", ...F, children: C }, p.value);
1907
+ })
1908
+ }
1909
+ ) });
1910
+ }
1911
+ export {
1912
+ uo as A,
1913
+ rt as C,
1914
+ Fr as D,
1915
+ Be as F,
1916
+ Ot as I,
1917
+ Ir as N,
1918
+ Tt as R,
1919
+ Sr as S,
1920
+ vo as T,
1921
+ Ve as a,
1922
+ en as b,
1923
+ co as c,
1924
+ io as d,
1925
+ Wt as e,
1926
+ hr as f,
1927
+ kr as g,
1928
+ Mr as h,
1929
+ Wr as i,
1930
+ Or as j,
1931
+ Tr as k,
1932
+ br as l,
1933
+ yr as m,
1934
+ q as n,
1935
+ nn as o,
1936
+ vr as p,
1937
+ wr as q,
1938
+ xr as r,
1939
+ Cr as s,
1940
+ yo as u
1941
+ };