@abyss-project/commons-front-core 11.0.0 → 11.1.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 (139) hide show
  1. package/README.md +15 -0
  2. package/catalog/catalog-entries.ts +2 -0
  3. package/catalog/pages/MarkdownEditor.tsx +48 -0
  4. package/catalog/pages/PdfEditor.tsx +153 -0
  5. package/catalog/pages/index.ts +4 -0
  6. package/catalog/specs/responsive.spec.ts +5 -1
  7. package/dist/AbyssCloud-IuD91X6C.js +2949 -0
  8. package/dist/{AbyssCookieConsentProvider-C3NZfWxR.js → AbyssCookieConsentProvider-PchfQjs2.js} +2038 -1407
  9. package/dist/{CookieConsentSettings.component-Dvbp3MIX.js → CookieConsentSettings.component-D8G0H6Wl.js} +1 -1
  10. package/dist/Tabs-CZQ1JYlW.js +2315 -0
  11. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  12. package/dist/components/editors/MarkdownEditor/MarkdownEditor.d.ts +19 -0
  13. package/dist/components/editors/MarkdownEditor/crepe-labels.d.ts +17 -0
  14. package/dist/components/editors/MarkdownEditor/index.d.ts +2 -0
  15. package/dist/components/editors/MarkdownEditor/markdown-theme.d.ts +7 -0
  16. package/dist/components/editors/PdfEditor/PdfEditor.d.ts +9 -0
  17. package/dist/components/editors/PdfEditor/engine/open-pdf-document.d.ts +8 -0
  18. package/dist/components/editors/PdfEditor/engine/operations/reducer.spec.d.ts +1 -0
  19. package/dist/components/editors/PdfEditor/engine/operations/rotate-coords.spec.d.ts +1 -0
  20. package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/types.d.ts +1 -2
  21. package/dist/components/editors/PdfEditor/index.d.ts +3 -0
  22. package/dist/components/editors/PdfEditor/pdf-colors.d.ts +26 -0
  23. package/dist/components/editors/PdfEditor/pdf-colors.spec.d.ts +1 -0
  24. package/dist/components/editors/PdfEditor/signature/SignatureDrawPad.d.ts +15 -0
  25. package/dist/components/editors/PdfEditor/signature/SignaturePicker.d.ts +31 -0
  26. package/dist/components/editors/PdfEditor/signature/SignaturePicker.spec.d.ts +1 -0
  27. package/dist/components/editors/PdfEditor/signature/SignatureSaveButton.d.ts +14 -0
  28. package/dist/components/editors/PdfEditor/signature/SignatureSavedList.d.ts +19 -0
  29. package/dist/components/editors/PdfEditor/signature/SignatureUploadPanel.d.ts +14 -0
  30. package/dist/components/editors/PdfEditor/signature/resolve-asset.d.ts +19 -0
  31. package/dist/components/editors/PdfEditor/signature/resolve-asset.spec.d.ts +1 -0
  32. package/dist/components/editors/PdfEditor/signature/test-support/pdf-editor-test-harness.d.ts +28 -0
  33. package/dist/components/editors/PdfEditor/toolbar/EraserIcon.d.ts +3 -0
  34. package/dist/components/editors/PdfEditor/toolbar/GroupPanel.d.ts +17 -0
  35. package/dist/components/editors/PdfEditor/toolbar/PanelRow.d.ts +14 -0
  36. package/dist/components/editors/PdfEditor/toolbar/PdfToolbar.d.ts +67 -0
  37. package/dist/components/editors/PdfEditor/toolbar/PdfToolbar.spec.d.ts +1 -0
  38. package/dist/components/editors/PdfEditor/toolbar/SavedAssets.d.ts +24 -0
  39. package/dist/components/editors/PdfEditor/toolbar/ToolGroupButton.d.ts +20 -0
  40. package/dist/components/editors/PdfEditor/toolbar/tool-groups.d.ts +34 -0
  41. package/dist/components/editors/PdfEditor/toolbar/tool-options/DrawOptions.d.ts +6 -0
  42. package/dist/components/editors/PdfEditor/toolbar/tool-options/FillFieldsOptions.d.ts +13 -0
  43. package/dist/components/editors/PdfEditor/toolbar/tool-options/HighlightOptions.d.ts +6 -0
  44. package/dist/components/editors/PdfEditor/toolbar/tool-options/RedactOptions.d.ts +6 -0
  45. package/dist/components/editors/PdfEditor/toolbar/tool-options/ShapeOptions.d.ts +6 -0
  46. package/dist/components/editors/PdfEditor/toolbar/tool-options/SignatureOptions.d.ts +5 -0
  47. package/dist/components/editors/PdfEditor/toolbar/tool-options/TextOptions.d.ts +6 -0
  48. package/dist/components/editors/PdfEditor/toolbar/tool-options/ToolOptions.d.ts +14 -0
  49. package/dist/components/editors/PdfEditor/toolbar/tool-options/swatches.d.ts +2 -0
  50. package/dist/components/editors/PdfEditor/toolbar/tool-settings.d.ts +14 -0
  51. package/dist/components/editors/PdfEditor/viewer/InsertPagesButton.d.ts +14 -0
  52. package/dist/components/editors/PdfEditor/viewer/InsertPagesButton.spec.d.ts +1 -0
  53. package/dist/components/editors/PdfEditor/viewer/InsertPagesDialog.d.ts +28 -0
  54. package/dist/components/editors/PdfEditor/viewer/PageOverlay.d.ts +37 -0
  55. package/dist/components/editors/PdfEditor/viewer/PageOverlay.spec.d.ts +1 -0
  56. package/dist/components/editors/PdfEditor/viewer/PageSidebar.d.ts +16 -0
  57. package/dist/components/editors/PdfEditor/viewer/PageSidebar.spec.d.ts +1 -0
  58. package/dist/components/editors/PdfEditor/viewer/PageThumbnail.d.ts +16 -0
  59. package/dist/components/editors/PdfEditor/viewer/PdfCanvas.d.ts +26 -0
  60. package/dist/components/editors/PdfEditor/viewer/PdfCanvas.spec.d.ts +1 -0
  61. package/dist/components/editors/PdfEditor/viewer/ViewerControls.d.ts +21 -0
  62. package/dist/components/editors/PdfEditor/viewer/ViewerControls.spec.d.ts +1 -0
  63. package/dist/components/editors/PdfEditor/viewer/test-support/viewer-test-harness.d.ts +30 -0
  64. package/dist/components/editors/editors-guard.spec.d.ts +1 -0
  65. package/dist/components/editors/index.d.ts +2 -0
  66. package/dist/cookie-consent.js +2 -2
  67. package/dist/{design-theme-sPEoMB7j.js → design-theme-DPp0aQVa.js} +9302 -12244
  68. package/dist/editors.d.ts +1 -0
  69. package/dist/editors.js +5239 -0
  70. package/dist/hooks/use-rich-intl.hook.d.ts +636 -0
  71. package/dist/{index-Cb-uMz_V.js → index-B2ZxOr31.js} +3 -3
  72. package/dist/{index-CCaW-38I.js → index-Bo9YtyKq.js} +2 -2
  73. package/dist/{index-DEqCdX0Q.js → index-Bv63SeVQ.js} +2 -2
  74. package/dist/{index-C2KrTHAO.js → index-ByTOd2ak.js} +2 -2
  75. package/dist/{index-DD25yrsQ.js → index-C2CPAKkL.js} +4 -4
  76. package/dist/{index-CB-jdY_E.js → index-C7XhFFZA.js} +2 -2
  77. package/dist/{index-DIpJhT2r.js → index-CBIn4IuA.js} +2 -2
  78. package/dist/{index-CNcmCFNN.js → index-CE5F7UaD.js} +1 -1
  79. package/dist/{index-CKCWWoQb.js → index-CS0JFqYy.js} +3 -3
  80. package/dist/{index-CXwwKVPn.js → index-CVp3TsdG.js} +3 -3
  81. package/dist/{index-C9FzqvHz.js → index-CaWs53z9.js} +2 -2
  82. package/dist/{index-CrWjgIMV.js → index-CjAqdRJ0.js} +4 -4
  83. package/dist/{index-D9s128sK.js → index-DNhK2v38.js} +4 -4
  84. package/dist/{index-Ut9uJwau.js → index-DVg7Zewe.js} +2 -2
  85. package/dist/{index-QNJIP2m4.js → index-DWi7OlB1.js} +2 -2
  86. package/dist/{index-DtHUaGVU.js → index-DY51R82n.js} +3 -3
  87. package/dist/{index-aYivWEyJ.js → index-DzXd6CTA.js} +2 -2
  88. package/dist/{index-whpnjq54.js → index-RIO2UT1x.js} +2 -2
  89. package/dist/{index-lE9lxmTc.js → index-ZXDv7i0D.js} +2 -2
  90. package/dist/{index-BVGdsnC4.js → index-yAKnJ5ME.js} +2 -2
  91. package/dist/{index-Di1amUHq.js → index-z9-0V3EC.js} +2 -2
  92. package/dist/index.js +5676 -7907
  93. package/dist/legacy/components/PdfEditor/PdfEditor.d.ts +1 -1
  94. package/dist/legacy/components/PdfEditor/index.d.ts +2 -2
  95. package/dist/legacy/components/PdfEditor/signature/SignatureDrawCanvas.d.ts +1 -1
  96. package/dist/legacy/components/PdfEditor/signature/SignaturePicker.d.ts +1 -1
  97. package/dist/legacy/components/PdfEditor/signature/SignatureSaveButton.d.ts +1 -1
  98. package/dist/legacy/components/PdfEditor/signature/SignatureSavedList.d.ts +1 -1
  99. package/dist/legacy/components/PdfEditor/signature/SignatureUploadDropzone.d.ts +1 -1
  100. package/dist/legacy/components/PdfEditor/signature/resolve-asset.d.ts +1 -1
  101. package/dist/legacy/components/PdfEditor/tools/FillFieldsTool.d.ts +1 -1
  102. package/dist/legacy/components/PdfEditor/tools/ShapeTool.d.ts +1 -1
  103. package/dist/legacy/components/PdfEditor/tools/SignatureTool.d.ts +1 -1
  104. package/dist/legacy/components/PdfEditor/tools/TextTool.d.ts +1 -1
  105. package/dist/legacy/components/PdfEditor/tools/Toolbar.d.ts +1 -1
  106. package/dist/legacy/components/PdfEditor/viewer/InsertPagesButton.d.ts +1 -1
  107. package/dist/legacy/components/PdfEditor/viewer/PageOverlay.d.ts +1 -1
  108. package/dist/legacy/components/PdfEditor/viewer/PageSidebar.d.ts +2 -2
  109. package/dist/legacy/components/PdfEditor/viewer/PageThumbnail.d.ts +2 -2
  110. package/dist/legacy/components/PdfEditor/viewer/PdfCanvas.d.ts +1 -1
  111. package/dist/legacy.js +26800 -209
  112. package/dist/sortable.esm-BYVnqZQ-.js +69330 -0
  113. package/dist/translations/editors-i18n.spec.d.ts +1 -0
  114. package/dist/translations/en.d.ts +318 -0
  115. package/dist/translations/fr.d.ts +318 -0
  116. package/package.json +13 -6
  117. package/vite.config.ts +4 -0
  118. package/dist/index-DPi7aKci.js +0 -95942
  119. /package/dist/{legacy/components/PdfEditor/operations/apply.spec.d.ts → components/editors/MarkdownEditor/MarkdownEditor.spec.d.ts} +0 -0
  120. /package/dist/{legacy/components/PdfEditor/operations/compute-page-order.spec.d.ts → components/editors/PdfEditor/PdfEditor.spec.d.ts} +0 -0
  121. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-acro-form-fields.d.ts +0 -0
  122. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-export.d.ts +0 -0
  123. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-page-order.d.ts +0 -0
  124. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-pdf-document.d.ts +0 -0
  125. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-undo-redo.d.ts +0 -0
  126. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/hooks/use-uploaded-docs.d.ts +0 -0
  127. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/actions.d.ts +0 -0
  128. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/apply.d.ts +0 -0
  129. /package/dist/{legacy/components/PdfEditor/operations/extract.spec.d.ts → components/editors/PdfEditor/engine/operations/apply.spec.d.ts} +0 -0
  130. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/compute-page-order.d.ts +0 -0
  131. /package/dist/{legacy/components/PdfEditor/operations/redact.spec.d.ts → components/editors/PdfEditor/engine/operations/compute-page-order.spec.d.ts} +0 -0
  132. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/extract.d.ts +0 -0
  133. /package/dist/{legacy/components/PdfEditor/operations/reducer.spec.d.ts → components/editors/PdfEditor/engine/operations/extract.spec.d.ts} +0 -0
  134. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/pdf-data-url.d.ts +0 -0
  135. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/rasterize.d.ts +0 -0
  136. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/redact.d.ts +0 -0
  137. /package/dist/{legacy/components/PdfEditor/operations/rotate-coords.spec.d.ts → components/editors/PdfEditor/engine/operations/redact.spec.d.ts} +0 -0
  138. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/reducer.d.ts +0 -0
  139. /package/dist/{legacy/components/PdfEditor → components/editors/PdfEditor/engine}/operations/rotate-coords.d.ts +0 -0
@@ -0,0 +1,2315 @@
1
+ import { jsx as i, jsxs as v, Fragment as ne } from "react/jsx-runtime";
2
+ import { useId as E, useRef as j, useState as I, cloneElement as Ct, useMemo as ye, useCallback as X, useEffect as G, forwardRef as St, createContext as Be, useContext as Ne, useLayoutEffect as _e } from "react";
3
+ import { alpha as It, styled as a, useTheme as Ve, getContrastRatio as $e } from "@mui/material/styles";
4
+ import ce from "@mui/material/FormControl";
5
+ import de from "@mui/material/FormHelperText";
6
+ import je from "@mui/material/InputLabel";
7
+ import Fe from "@mui/material/MenuItem";
8
+ import Tt from "@mui/material/Select";
9
+ import { visuallyHidden as $t } from "@mui/utils";
10
+ import { useIntl as z } from "react-intl";
11
+ import { b as Me, S as Ft, f as M, i as Mt, a as Rt, r as Wt, u as Ot, A as At, E as Et } from "./AbyssCloud-IuD91X6C.js";
12
+ import Ge from "@mui/material/ButtonBase";
13
+ import ve from "@mui/material/OutlinedInput";
14
+ import zt from "@mui/material/InputAdornment";
15
+ import Z from "@mui/material/Button";
16
+ import { byteSizeIEC as Dt } from "@abyss-project/main";
17
+ import Lt from "@mui/icons-material/FileUploadOutlined";
18
+ import Pt, { autocompleteClasses as Re } from "@mui/material/Autocomplete";
19
+ import We from "@mui/material/CircularProgress";
20
+ import ee from "@mui/material/IconButton";
21
+ import Oe from "@mui/material/Tooltip";
22
+ import Ae from "@mui/icons-material/CloudOutlined";
23
+ import Ht from "@mui/icons-material/CloudOffOutlined";
24
+ import Bt from "@mui/icons-material/FileDownloadOutlined";
25
+ import Ue from "@mui/icons-material/FolderOpenOutlined";
26
+ import Nt from "@mui/icons-material/OpenInNewRounded";
27
+ import _t from "@mui/icons-material/RefreshRounded";
28
+ import Vt from "@mui/material/FormLabel";
29
+ import { isMuiElement as jt } from "@mui/material/utils";
30
+ import Gt from "@mui/icons-material/CheckCircleOutline";
31
+ import ue from "@mui/icons-material/Close";
32
+ import Ut from "@mui/icons-material/ErrorOutline";
33
+ import qt from "@mui/icons-material/InfoOutlined";
34
+ import Kt from "@mui/icons-material/WarningAmber";
35
+ import Yt from "@mui/material/Checkbox";
36
+ import Qt from "@mui/icons-material/DescriptionOutlined";
37
+ import Xt from "@mui/icons-material/FolderOutlined";
38
+ import Zt from "@mui/icons-material/ChevronRightRounded";
39
+ import Jt from "@mui/material/Popover";
40
+ import en from "@mui/material/Alert";
41
+ import tn from "@mui/material/TextField";
42
+ import nn from "@mui/material/Dialog";
43
+ import Ee from "@mui/material/useMediaQuery";
44
+ import on from "@mui/material/Modal";
45
+ import rn from "@mui/material/Slide";
46
+ import { Link as sn } from "react-router-dom";
47
+ var F = /* @__PURE__ */ ((e) => (e.Mobile = "mobile", e.Tablet = "tablet", e.Desktop = "desktop", e))(F || {});
48
+ const qe = {
49
+ tablet: Me.md,
50
+ desktop: Me.lg
51
+ }, an = 0.05, fe = (e) => `(min-width:${qe[e]}px)`, me = (e) => `(max-width:${qe[e] - an}px)`, N = {
52
+ /** From the start of `tier` up. */
53
+ up: (e) => `@media ${fe(e)}`,
54
+ /** Below the start of `tier`. */
55
+ down: (e) => `@media ${me(e)}`,
56
+ /** The widths of `tier` only. */
57
+ only: (e) => {
58
+ switch (e) {
59
+ case "mobile":
60
+ return `@media ${me(
61
+ "tablet"
62
+ /* Tablet */
63
+ )}`;
64
+ case "tablet":
65
+ return `@media ${fe(
66
+ "tablet"
67
+ /* Tablet */
68
+ )} and ${me(
69
+ "desktop"
70
+ /* Desktop */
71
+ )}`;
72
+ case "desktop":
73
+ return `@media ${fe(
74
+ "desktop"
75
+ /* Desktop */
76
+ )}`;
77
+ }
78
+ }
79
+ }, o = (e) => `${e}px`, O = (e) => `1px solid ${e}`, ge = (e) => It(e, Ft), te = (e) => ({
80
+ outline: `2px solid ${e.design.tokens["focus.ring"]}`,
81
+ outlineOffset: "2px"
82
+ }), Xr = (e, t) => t === "small" ? e.design.densityValues.compact.control : e.design.densityValues[e.design.density].control, Zr = (e) => e.design.densityValues[e.design.density].row, Ke = (e) => ({
83
+ [N.down(F.Tablet)]: {
84
+ minHeight: o(e.design.densityValues.touchTarget)
85
+ }
86
+ }), ln = (e) => ({
87
+ [N.down(F.Tablet)]: {
88
+ minWidth: o(e.design.densityValues.touchTarget),
89
+ minHeight: o(e.design.densityValues.touchTarget)
90
+ }
91
+ }), oe = (e, t, n = "fast") => t.map(
92
+ (r) => `${r} ${e.design.durations[n]}ms ${e.design.easings.standard}`
93
+ ).join(", "), Ye = () => {
94
+ const e = Ee(N.up(F.Desktop), {
95
+ noSsr: !0
96
+ }), t = Ee(N.down(F.Tablet), {
97
+ noSsr: !0
98
+ });
99
+ return e ? F.Desktop : t ? F.Mobile : F.Tablet;
100
+ };
101
+ var J = /* @__PURE__ */ ((e) => (e.Top = "top", e.Bottom = "bottom", e.Left = "left", e.Right = "right", e))(J || {});
102
+ const se = (e, t) => `calc(${o(t)} + env(safe-area-inset-${e}))`, dn = 0.3, cn = a("div")({
103
+ position: "absolute",
104
+ left: 0,
105
+ right: 0,
106
+ bottom: 0,
107
+ maxHeight: "100%",
108
+ display: "flex",
109
+ outline: "none"
110
+ }), un = a("div")(({ theme: e }) => {
111
+ const { tokens: t, radii: n, space: r, elevations: s, fonts: c } = e.design;
112
+ return {
113
+ flex: "1 1 auto",
114
+ minWidth: 0,
115
+ maxHeight: `calc(100vh - ${se(J.Top, r[8])})`,
116
+ display: "flex",
117
+ flexDirection: "column",
118
+ gap: o(r[3]),
119
+ paddingTop: o(r[2]),
120
+ paddingBottom: se(J.Bottom, r[6]),
121
+ paddingLeft: se(J.Left, r[4]),
122
+ paddingRight: se(J.Right, r[4]),
123
+ backgroundColor: t["bg.surface"],
124
+ color: t["text.primary"],
125
+ fontFamily: c.sans,
126
+ borderTop: O(t["border.strong"]),
127
+ borderTopLeftRadius: o(n.lg),
128
+ borderTopRightRadius: o(n.lg),
129
+ boxShadow: s.modal,
130
+ outline: "none",
131
+ position: "relative"
132
+ };
133
+ }), gn = a(ee)(({ theme: e }) => ({
134
+ position: "absolute",
135
+ top: o(e.design.space[1]),
136
+ right: se(J.Right, e.design.space[2]),
137
+ ...ln(e)
138
+ })), pn = a("div")(({ theme: e }) => {
139
+ const { space: t, densityValues: n } = e.design;
140
+ return {
141
+ flex: "none",
142
+ display: "flex",
143
+ flexDirection: "column",
144
+ alignItems: "center",
145
+ gap: o(t[2]),
146
+ minHeight: o(n.touchTarget / 2),
147
+ touchAction: "none",
148
+ cursor: "grab"
149
+ };
150
+ }), fn = a("span")(({ theme: e }) => {
151
+ const { tokens: t, radii: n, space: r } = e.design;
152
+ return {
153
+ width: o(r[8]),
154
+ height: o(r[1]),
155
+ borderRadius: o(n.sm),
156
+ backgroundColor: t["border.strong"]
157
+ };
158
+ }), mn = a("h2", {
159
+ shouldForwardProp: (e) => e !== "besideClose"
160
+ })(({ theme: e, besideClose: t }) => {
161
+ const { typeScale: n, densityValues: r, space: s } = e.design;
162
+ return {
163
+ alignSelf: "stretch",
164
+ margin: 0,
165
+ // Clear of the close button in the corner.
166
+ paddingRight: t ? o(r.touchTarget + s[2]) : void 0,
167
+ fontSize: o(n.sectionTitle),
168
+ fontWeight: M.semibold,
169
+ overflowWrap: "anywhere"
170
+ };
171
+ }), hn = a("div")({
172
+ flex: "1 1 auto",
173
+ minHeight: 0,
174
+ overflowY: "auto",
175
+ overscrollBehavior: "contain"
176
+ });
177
+ function Qe({
178
+ open: e,
179
+ onClose: t,
180
+ title: n,
181
+ closeLabel: r,
182
+ children: s
183
+ }) {
184
+ const c = Ve(), l = z(), d = E(), g = j(null), m = j(null), [p, h] = I(0), [y, b] = I(!1), f = (C) => {
185
+ C.currentTarget.setPointerCapture(C.pointerId), m.current = C.clientY, b(!0);
186
+ }, u = (C) => {
187
+ m.current !== null && h(Math.max(0, C.clientY - m.current));
188
+ }, x = (C) => {
189
+ var D;
190
+ if (m.current === null)
191
+ return;
192
+ const P = Math.max(0, C.clientY - m.current), $ = ((D = g.current) == null ? void 0 : D.getBoundingClientRect().height) ?? 0;
193
+ m.current = null, b(!1), h(0), $ > 0 && P >= $ * dn && t();
194
+ }, k = () => {
195
+ m.current = null, b(!1), h(0);
196
+ };
197
+ return /* @__PURE__ */ i(on, { open: e, onClose: () => t(), children: /* @__PURE__ */ i(
198
+ rn,
199
+ {
200
+ in: e,
201
+ direction: "up",
202
+ timeout: c.design.durations.slow,
203
+ easing: c.design.easings.sheet,
204
+ children: /* @__PURE__ */ i(cn, { children: /* @__PURE__ */ v(
205
+ un,
206
+ {
207
+ ref: g,
208
+ role: "dialog",
209
+ "aria-modal": "true",
210
+ "aria-labelledby": n ? d : void 0,
211
+ "aria-label": n ? void 0 : l.formatMessage({ id: "ds.mobile.bottom-sheet.label" }),
212
+ tabIndex: -1,
213
+ style: {
214
+ transform: `translateY(${o(p)})`,
215
+ transition: y ? "none" : `transform ${c.design.durations.base}ms ${c.design.easings.sheet}`
216
+ },
217
+ children: [
218
+ /* @__PURE__ */ v(
219
+ pn,
220
+ {
221
+ "data-testid": "bottom-sheet-drag-zone",
222
+ onPointerDown: f,
223
+ onPointerMove: u,
224
+ onPointerUp: x,
225
+ onPointerCancel: k,
226
+ children: [
227
+ /* @__PURE__ */ i(fn, { "aria-hidden": "true" }),
228
+ n ? /* @__PURE__ */ i(mn, { id: d, besideClose: r !== void 0, children: n }) : null
229
+ ]
230
+ }
231
+ ),
232
+ r !== void 0 && /* @__PURE__ */ i(gn, { "aria-label": r, onClick: () => t(), children: /* @__PURE__ */ i(ue, { "aria-hidden": !0 }) }),
233
+ /* @__PURE__ */ i(hn, { children: s })
234
+ ]
235
+ }
236
+ ) })
237
+ }
238
+ ) });
239
+ }
240
+ var xe = /* @__PURE__ */ ((e) => (e.Small = "sm", e.Medium = "md", e.Large = "lg", e))(xe || {});
241
+ const bn = a(nn)(({ theme: e }) => {
242
+ const { tokens: t, fonts: n, space: r } = e.design;
243
+ return {
244
+ "& .MuiDialog-paper": {
245
+ margin: o(r[4]),
246
+ maxHeight: `calc(100% - ${o(r[7])})`,
247
+ backgroundColor: t["bg.surface"],
248
+ color: t["text.primary"],
249
+ fontFamily: n.sans,
250
+ overflow: "hidden"
251
+ },
252
+ "& .MuiDialog-paperFullWidth": {
253
+ width: `calc(100% - ${o(r[7])})`
254
+ }
255
+ };
256
+ }), yn = a("div")(({ theme: e }) => {
257
+ const { tokens: t, space: n } = e.design;
258
+ return {
259
+ flex: "none",
260
+ display: "flex",
261
+ justifyContent: "space-between",
262
+ alignItems: "flex-start",
263
+ gap: o(n[4]),
264
+ padding: `${o(n[4])} ${o(n[5])}`,
265
+ borderBottom: O(t["border.subtle"])
266
+ };
267
+ }), vn = a("div")({ minWidth: 0 }), xn = a("h2")(({ theme: e }) => ({
268
+ margin: 0,
269
+ fontSize: o(e.design.typeScale.sectionTitle),
270
+ fontWeight: M.semibold,
271
+ overflowWrap: "anywhere"
272
+ })), wn = a("p")(({ theme: e }) => {
273
+ const { tokens: t, space: n, typeScale: r } = e.design;
274
+ return {
275
+ margin: `${o(n[1])} 0 0`,
276
+ color: t["text.muted"],
277
+ fontSize: o(r.body),
278
+ overflowWrap: "anywhere"
279
+ };
280
+ }), kn = a("div")(({ theme: e }) => ({
281
+ flex: "1 1 auto",
282
+ minHeight: 0,
283
+ overflowY: "auto",
284
+ padding: o(e.design.space[5]),
285
+ fontSize: o(e.design.typeScale.body)
286
+ })), Cn = a("div")(({ theme: e }) => {
287
+ const { tokens: t, space: n } = e.design;
288
+ return {
289
+ flex: "none",
290
+ display: "flex",
291
+ flexWrap: "wrap",
292
+ justifyContent: "flex-end",
293
+ alignItems: "center",
294
+ gap: o(n[3]),
295
+ padding: `${o(n[3])} ${o(n[5])}`,
296
+ borderTop: O(t["border.subtle"])
297
+ };
298
+ }), Sn = a("p")(({ theme: e }) => ({
299
+ margin: `0 0 ${o(e.design.space[3])}`,
300
+ color: e.design.tokens["text.muted"],
301
+ fontSize: o(e.design.typeScale.bodyMobile),
302
+ overflowWrap: "anywhere"
303
+ })), In = a("div")(({ theme: e }) => ({
304
+ display: "flex",
305
+ flexWrap: "wrap",
306
+ gap: o(e.design.space[2]),
307
+ marginTop: o(e.design.space[4]),
308
+ "& > *": { flex: "1 1 0" }
309
+ }));
310
+ function Xe({
311
+ open: e,
312
+ onClose: t,
313
+ title: n,
314
+ description: r,
315
+ size: s = "md",
316
+ actions: c,
317
+ children: l
318
+ }) {
319
+ const d = z(), g = Ye() === F.Mobile, m = E(), p = E();
320
+ return g ? /* @__PURE__ */ v(
321
+ Qe,
322
+ {
323
+ open: e,
324
+ onClose: t,
325
+ title: n,
326
+ closeLabel: d.formatMessage({ id: "ds.layers.modal.close" }),
327
+ children: [
328
+ r !== void 0 && /* @__PURE__ */ i(Sn, { children: r }),
329
+ l,
330
+ c !== void 0 && /* @__PURE__ */ i(In, { children: c })
331
+ ]
332
+ }
333
+ ) : /* @__PURE__ */ v(
334
+ bn,
335
+ {
336
+ open: e,
337
+ onClose: () => t(),
338
+ maxWidth: s,
339
+ fullWidth: !0,
340
+ "aria-labelledby": m,
341
+ "aria-describedby": r !== void 0 ? p : void 0,
342
+ children: [
343
+ /* @__PURE__ */ v(yn, { children: [
344
+ /* @__PURE__ */ v(vn, { children: [
345
+ /* @__PURE__ */ i(xn, { id: m, children: n }),
346
+ r !== void 0 && /* @__PURE__ */ i(wn, { id: p, children: r })
347
+ ] }),
348
+ /* @__PURE__ */ i(
349
+ ee,
350
+ {
351
+ "aria-label": d.formatMessage({ id: "ds.layers.modal.close" }),
352
+ onClick: t,
353
+ children: /* @__PURE__ */ i(ue, { "aria-hidden": !0 })
354
+ }
355
+ )
356
+ ] }),
357
+ /* @__PURE__ */ i(kn, { children: l }),
358
+ c !== void 0 && /* @__PURE__ */ i(Cn, { children: c })
359
+ ]
360
+ }
361
+ );
362
+ }
363
+ const Tn = a(Vt)(({ theme: e }) => ({
364
+ display: "block",
365
+ maxWidth: "100%",
366
+ marginBottom: o(e.design.space[2]),
367
+ fontSize: o(e.design.typeScale.small),
368
+ fontWeight: M.medium,
369
+ lineHeight: e.typography.caption.lineHeight,
370
+ color: e.design.tokens["text.secondary"],
371
+ "&.Mui-focused": { color: e.design.tokens["text.secondary"] },
372
+ "&.Mui-error": { color: e.design.tokens["status.danger"] },
373
+ "&.Mui-disabled": { color: e.design.tokens["text.muted"] }
374
+ }));
375
+ function Ze({
376
+ label: e,
377
+ help: t,
378
+ error: n,
379
+ required: r = !1,
380
+ children: s
381
+ }) {
382
+ const c = E(), l = s.props.id ?? c, d = `${l}-label`, g = t !== void 0 ? `${l}-help` : void 0, m = n !== void 0 ? `${l}-error` : void 0, p = [s.props["aria-describedby"], g, m].filter((y) => y !== void 0 && y !== "").join(" ") || void 0, h = Ct(s, {
383
+ id: l,
384
+ "aria-describedby": p,
385
+ ...jt(s, ["Select"]) && { labelId: d }
386
+ });
387
+ return /* @__PURE__ */ v(ce, { fullWidth: !0, error: n !== void 0, required: r, children: [
388
+ /* @__PURE__ */ i(Tn, { id: d, htmlFor: l, children: e }),
389
+ h,
390
+ t !== void 0 && /* @__PURE__ */ i(de, { id: g, error: !1, children: t }),
391
+ n !== void 0 && /* @__PURE__ */ i(de, { id: m, children: n })
392
+ ] });
393
+ }
394
+ var Je = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Danger = "danger", e))(Je || {});
395
+ const et = {
396
+ info: { solid: "status.info", soft: "status.info.soft" },
397
+ success: {
398
+ solid: "status.success",
399
+ soft: "status.success.soft"
400
+ },
401
+ warning: {
402
+ solid: "status.warning",
403
+ soft: "status.warning.soft"
404
+ },
405
+ danger: {
406
+ solid: "status.danger",
407
+ soft: "status.danger.soft"
408
+ }
409
+ }, $n = {
410
+ info: qt,
411
+ success: Gt,
412
+ warning: Kt,
413
+ danger: Ut
414
+ }, Fn = a("div", {
415
+ shouldForwardProp: (e) => e !== "severity"
416
+ })(({ theme: e, severity: t }) => {
417
+ const { tokens: n, space: r, radii: s, fonts: c, typeScale: l } = e.design, { solid: d, soft: g } = et[t];
418
+ return {
419
+ display: "flex",
420
+ alignItems: "flex-start",
421
+ gap: o(r[3]),
422
+ minWidth: 0,
423
+ boxSizing: "border-box",
424
+ padding: `${o(r[3])} ${o(r[3])} ${o(r[3])} ${o(r[4])}`,
425
+ backgroundColor: n[g],
426
+ border: O(n[d]),
427
+ borderRadius: o(s.md),
428
+ color: n["text.primary"],
429
+ fontFamily: c.sans,
430
+ fontSize: o(l.body)
431
+ };
432
+ }), Mn = a("span", {
433
+ shouldForwardProp: (e) => e !== "severity"
434
+ })(({ theme: e, severity: t }) => {
435
+ const { tokens: n, space: r } = e.design;
436
+ return {
437
+ display: "inline-flex",
438
+ flex: "none",
439
+ // Centered on the first line of text.
440
+ paddingTop: o(r[1] / 2),
441
+ color: n[et[t].solid],
442
+ "& svg": {
443
+ width: o(r[4] + r[1]),
444
+ height: o(r[4] + r[1])
445
+ }
446
+ };
447
+ }), Rn = a("div")(({ theme: e }) => ({
448
+ display: "flex",
449
+ flex: "1 1 auto",
450
+ flexWrap: "wrap",
451
+ alignItems: "center",
452
+ columnGap: o(e.design.space[4]),
453
+ rowGap: o(e.design.space[2]),
454
+ minWidth: 0,
455
+ [N.down(F.Tablet)]: {
456
+ flexDirection: "column",
457
+ alignItems: "flex-start"
458
+ }
459
+ })), Wn = a("div")(({ theme: e }) => ({
460
+ display: "flex",
461
+ flexDirection: "column",
462
+ gap: o(e.design.space[1]),
463
+ flex: "1 1 auto",
464
+ minWidth: 0,
465
+ paddingTop: o(e.design.space[1] / 2),
466
+ lineHeight: e.typography.body2.lineHeight,
467
+ overflowWrap: "anywhere"
468
+ })), On = a("strong")({
469
+ display: "block",
470
+ fontWeight: M.semibold
471
+ }), An = a("div")({
472
+ display: "flex",
473
+ flex: "none",
474
+ alignItems: "center"
475
+ });
476
+ function En({
477
+ severity: e,
478
+ title: t,
479
+ children: n,
480
+ action: r,
481
+ onClose: s,
482
+ icon: c
483
+ }) {
484
+ const l = z(), d = E(), g = $n[e];
485
+ return /* @__PURE__ */ v(
486
+ Fn,
487
+ {
488
+ severity: e,
489
+ role: e === "danger" ? "alert" : "status",
490
+ "aria-labelledby": t !== void 0 ? d : void 0,
491
+ "data-severity": e,
492
+ children: [
493
+ /* @__PURE__ */ i(Mn, { severity: e, "aria-hidden": !0, children: c ?? /* @__PURE__ */ i(g, {}) }),
494
+ /* @__PURE__ */ v(Rn, { children: [
495
+ /* @__PURE__ */ v(Wn, { children: [
496
+ t !== void 0 && /* @__PURE__ */ i(On, { id: d, children: t }),
497
+ /* @__PURE__ */ i("div", { children: n })
498
+ ] }),
499
+ r !== void 0 && /* @__PURE__ */ i(An, { children: r })
500
+ ] }),
501
+ s !== void 0 && /* @__PURE__ */ i(
502
+ ee,
503
+ {
504
+ size: "small",
505
+ "aria-label": l.formatMessage({ id: "ds.states.callout.close" }),
506
+ onClick: s,
507
+ children: /* @__PURE__ */ i(ue, { "aria-hidden": !0 })
508
+ }
509
+ )
510
+ ]
511
+ }
512
+ );
513
+ }
514
+ const Q = (e) => e.id ?? e.name, tt = (e, t, n) => (t === void 0 || e.sizeOctet <= t) && Mt(e, n), nt = (e, t, n) => [
515
+ ...(e.childFile ?? []).filter(
516
+ (r) => tt(r, t, n)
517
+ ),
518
+ ...(e.childFolder ?? []).flatMap(
519
+ (r) => nt(r, t, n)
520
+ )
521
+ ], he = a("div", {
522
+ shouldForwardProp: (e) => e !== "selected"
523
+ })(({ theme: e, selected: t }) => {
524
+ const { tokens: n, space: r, radii: s, densityValues: c, density: l, typeScale: d } = e.design;
525
+ return {
526
+ display: "flex",
527
+ alignItems: "center",
528
+ gap: o(r[1]),
529
+ minHeight: o(c[l].control),
530
+ borderRadius: o(s.md),
531
+ backgroundColor: t ? ge(n.accent) : "transparent",
532
+ fontSize: o(d.body),
533
+ color: n["text.primary"],
534
+ ...Ke(e)
535
+ };
536
+ }), ot = (e) => {
537
+ const { tokens: t, space: n, radii: r, fonts: s } = e.design;
538
+ return {
539
+ flex: "1 1 auto",
540
+ minWidth: 0,
541
+ display: "flex",
542
+ alignItems: "center",
543
+ gap: o(n[2]),
544
+ alignSelf: "stretch",
545
+ margin: 0,
546
+ padding: `0 ${o(n[2])}`,
547
+ border: "none",
548
+ borderRadius: o(r.md),
549
+ background: "none",
550
+ color: "inherit",
551
+ font: "inherit",
552
+ fontFamily: s.sans,
553
+ textAlign: "left",
554
+ cursor: "pointer",
555
+ transition: oe(e, ["background-color"]),
556
+ "&:hover": { backgroundColor: t["bg.hover"] },
557
+ "&:focus-visible": te(e)
558
+ };
559
+ }, rt = a("button")(({ theme: e }) => ot(e)), zn = a("label")(({ theme: e }) => ot(e)), it = a("span", {
560
+ shouldForwardProp: (e) => e !== "strong"
561
+ })(({ strong: e }) => ({
562
+ flex: "1 1 auto",
563
+ minWidth: 0,
564
+ overflow: "hidden",
565
+ textOverflow: "ellipsis",
566
+ whiteSpace: "nowrap",
567
+ fontWeight: e ? M.medium : M.regular
568
+ })), st = a("span")(({ theme: e }) => {
569
+ const { tokens: t, space: n, radii: r } = e.design;
570
+ return {
571
+ display: "inline-flex",
572
+ flex: "none",
573
+ alignItems: "center",
574
+ justifyContent: "center",
575
+ width: o(n[5]),
576
+ height: o(n[5]),
577
+ overflow: "hidden",
578
+ borderRadius: o(r.sm),
579
+ color: t["text.muted"],
580
+ "& svg": { width: o(n[5]), height: o(n[5]) },
581
+ "& img": { width: "100%", height: "100%", objectFit: "cover" }
582
+ };
583
+ }), Dn = a(Zt, {
584
+ shouldForwardProp: (e) => e !== "open"
585
+ })(({ theme: e, open: t }) => ({
586
+ flex: "none",
587
+ width: o(e.design.space[4]),
588
+ height: o(e.design.space[4]),
589
+ color: e.design.tokens["text.muted"],
590
+ transform: t ? "rotate(90deg)" : "none",
591
+ transition: oe(e, ["transform"])
592
+ })), at = a(Yt)(({ theme: e }) => ({
593
+ [N.down(F.Tablet)]: {
594
+ padding: o(
595
+ (e.design.densityValues.touchTarget - e.design.space[5]) / 2
596
+ )
597
+ }
598
+ })), Ln = a("ul")(({ theme: e }) => ({
599
+ margin: 0,
600
+ padding: 0,
601
+ listStyle: "none",
602
+ borderLeft: O(e.design.tokens["border.subtle"]),
603
+ marginLeft: o(e.design.space[3])
604
+ })), ze = a("li")({ listStyle: "none" });
605
+ function lt({
606
+ folders: e,
607
+ files: t,
608
+ context: n
609
+ }) {
610
+ return /* @__PURE__ */ v(ne, { children: [
611
+ e.map((r) => /* @__PURE__ */ i(ze, { children: /* @__PURE__ */ i(Bn, { folder: r, context: n }) }, r.id ?? r.name)),
612
+ t.filter((r) => tt(r, n.maxSize, n.accept)).map((r) => /* @__PURE__ */ i(ze, { children: /* @__PURE__ */ i(Hn, { file: r, context: n }) }, Q(r)))
613
+ ] });
614
+ }
615
+ function Pn({
616
+ file: e,
617
+ getFileThumbnailUrl: t
618
+ }) {
619
+ const [n, r] = I(!1), s = e.thumbnailPublicAccessId !== null && !e.isEncrypt && !n ? t(e.thumbnailPublicAccessId) : null;
620
+ return /* @__PURE__ */ i(st, { "aria-hidden": !0, children: s !== null ? /* @__PURE__ */ i(
621
+ "img",
622
+ {
623
+ src: s,
624
+ alt: "",
625
+ draggable: !1,
626
+ onError: () => r(!0)
627
+ }
628
+ ) : /* @__PURE__ */ i(Qt, {}) });
629
+ }
630
+ function Hn({
631
+ file: e,
632
+ context: t
633
+ }) {
634
+ const n = E(), r = t.selectedIds.has(Q(e)), s = () => r ? t.unselect([e]) : t.select([e]), c = /* @__PURE__ */ v(ne, { children: [
635
+ /* @__PURE__ */ i(
636
+ Pn,
637
+ {
638
+ file: e,
639
+ getFileThumbnailUrl: t.getFileThumbnailUrl
640
+ }
641
+ ),
642
+ /* @__PURE__ */ i(it, { strong: r, title: e.name, children: e.name })
643
+ ] });
644
+ return t.multiple ? /* @__PURE__ */ v(he, { selected: r, children: [
645
+ /* @__PURE__ */ i(
646
+ at,
647
+ {
648
+ id: n,
649
+ size: "small",
650
+ checked: r,
651
+ onChange: s
652
+ }
653
+ ),
654
+ /* @__PURE__ */ i(zn, { htmlFor: n, children: c })
655
+ ] }) : /* @__PURE__ */ i(he, { selected: r, children: /* @__PURE__ */ i(rt, { type: "button", "aria-pressed": r, onClick: s, children: c }) });
656
+ }
657
+ function Bn({
658
+ folder: e,
659
+ context: t
660
+ }) {
661
+ const n = z(), r = E(), [s, c] = I(!1), l = nt(e, t.maxSize, t.accept), d = l.filter(
662
+ (m) => t.selectedIds.has(Q(m))
663
+ ).length, g = l.length > 0 && d === l.length;
664
+ return /* @__PURE__ */ v(ne, { children: [
665
+ /* @__PURE__ */ v(he, { selected: g, children: [
666
+ t.multiple && /* @__PURE__ */ i(
667
+ at,
668
+ {
669
+ size: "small",
670
+ checked: g,
671
+ indeterminate: d > 0 && !g,
672
+ disabled: l.length === 0,
673
+ onChange: () => g ? t.unselect(l) : t.select(l),
674
+ inputProps: {
675
+ "aria-label": n.formatMessage(
676
+ { id: "ds.business.cloud-import.select-folder" },
677
+ { name: e.name }
678
+ )
679
+ }
680
+ }
681
+ ),
682
+ /* @__PURE__ */ v(
683
+ rt,
684
+ {
685
+ type: "button",
686
+ "aria-expanded": s,
687
+ "aria-controls": s ? r : void 0,
688
+ onClick: () => c(!s),
689
+ children: [
690
+ /* @__PURE__ */ i(Dn, { open: s, "aria-hidden": !0 }),
691
+ /* @__PURE__ */ i(st, { "aria-hidden": !0, children: s ? /* @__PURE__ */ i(Ue, {}) : /* @__PURE__ */ i(Xt, {}) }),
692
+ /* @__PURE__ */ i(it, { strong: g, title: e.name, children: e.name })
693
+ ]
694
+ }
695
+ )
696
+ ] }),
697
+ s && /* @__PURE__ */ i(Ln, { id: r, children: /* @__PURE__ */ i(
698
+ lt,
699
+ {
700
+ folders: e.childFolder ?? [],
701
+ files: e.childFile ?? [],
702
+ context: t
703
+ }
704
+ ) })
705
+ ] });
706
+ }
707
+ const De = "shared", Le = {
708
+ "org-common": 0,
709
+ "perso-in-org": 1,
710
+ project: 2,
711
+ personal: 3
712
+ }, Nn = a("div")(({ theme: e }) => ({
713
+ display: "flex",
714
+ flexDirection: "column",
715
+ gap: o(e.design.space[3]),
716
+ minWidth: 0
717
+ })), _n = a("div")(({ theme: e }) => ({
718
+ display: "flex",
719
+ alignItems: "flex-end",
720
+ gap: o(e.design.space[2]),
721
+ minWidth: 0,
722
+ // The Space field takes the room the two icon buttons leave.
723
+ [`& > .${Re.root}`]: { flex: "1 1 auto", minWidth: 0 },
724
+ [`& > :not(.${Re.root})`]: { flex: "none" }
725
+ })), Vn = a("p")(({ theme: e }) => ({
726
+ margin: 0,
727
+ fontSize: o(e.design.typeScale.small),
728
+ color: e.design.tokens["text.muted"]
729
+ })), jn = a("ul")(({ theme: e }) => {
730
+ const { tokens: t, space: n, radii: r } = e.design;
731
+ return {
732
+ margin: 0,
733
+ padding: o(n[1]),
734
+ listStyle: "none",
735
+ minHeight: o(n[10] * 3),
736
+ border: O(t["border.subtle"]),
737
+ borderRadius: o(r.md)
738
+ };
739
+ }), ie = a("div")(({ theme: e }) => {
740
+ const { tokens: t, space: n, typeScale: r } = e.design;
741
+ return {
742
+ display: "flex",
743
+ flexDirection: "column",
744
+ alignItems: "center",
745
+ justifyContent: "center",
746
+ gap: o(n[3]),
747
+ minHeight: o(n[10] * 3),
748
+ padding: o(n[5]),
749
+ textAlign: "center",
750
+ fontSize: o(r.body),
751
+ color: t["text.secondary"],
752
+ "& > svg": {
753
+ width: o(n[7]),
754
+ height: o(n[7]),
755
+ color: t["text.muted"]
756
+ }
757
+ };
758
+ }), Gn = a("span")(({ theme: e }) => {
759
+ const { tokens: t, space: n, radii: r } = e.design;
760
+ return {
761
+ display: "inline-flex",
762
+ alignItems: "center",
763
+ justifyContent: "center",
764
+ width: o(n[9] + n[2]),
765
+ height: o(n[9] + n[2]),
766
+ borderRadius: o(r.lg),
767
+ backgroundColor: ge(t["status.warning"]),
768
+ color: t["status.warning"],
769
+ "& svg": { width: o(n[6]), height: o(n[6]) }
770
+ };
771
+ }), Un = a("p")(({ theme: e }) => ({
772
+ margin: 0,
773
+ fontWeight: M.semibold,
774
+ color: e.design.tokens["text.primary"]
775
+ })), qn = a("p")({ margin: 0 }), Kn = a("div")(({ theme: e }) => ({
776
+ display: "flex",
777
+ flexWrap: "wrap",
778
+ alignItems: "center",
779
+ justifyContent: "space-between",
780
+ gap: o(e.design.space[3])
781
+ })), Yn = a("span")(({ theme: e }) => ({
782
+ fontSize: o(e.design.typeScale.body),
783
+ color: e.design.tokens["text.secondary"]
784
+ })), Qn = a("li")(({ theme: e }) => ({
785
+ display: "flex",
786
+ alignItems: "center",
787
+ gap: o(e.design.space[2]),
788
+ ...Ke(e)
789
+ })), Xn = a("span")({
790
+ display: "flex",
791
+ flexDirection: "column",
792
+ minWidth: 0
793
+ }), Zn = a("span")({
794
+ overflow: "hidden",
795
+ textOverflow: "ellipsis",
796
+ whiteSpace: "nowrap"
797
+ }), Jn = a("span")(({ theme: e }) => ({
798
+ fontSize: o(e.design.typeScale.caption),
799
+ color: e.design.tokens["text.muted"],
800
+ // A narrow screen wraps it: the scope and the organization tell same-named Spaces apart.
801
+ overflowWrap: "anywhere"
802
+ })), dt = a("span")(({ theme: e }) => {
803
+ const { tokens: t, space: n, radii: r } = e.design;
804
+ return {
805
+ display: "inline-flex",
806
+ flex: "none",
807
+ alignItems: "center",
808
+ justifyContent: "center",
809
+ minWidth: o(n[5]),
810
+ height: o(n[5]),
811
+ borderRadius: o(r.sm),
812
+ color: t["accent.text"],
813
+ "& > svg": { width: o(n[4]), height: o(n[4]) }
814
+ };
815
+ }), eo = a(dt)(({ theme: e }) => ({
816
+ marginRight: o(e.design.space[2])
817
+ })), to = a("li")({ listStyle: "none" }), no = a("div")(({ theme: e }) => {
818
+ const { space: t, tokens: n, typeScale: r } = e.design;
819
+ return {
820
+ padding: `${o(t[2])} ${o(t[3])} ${o(t[1])}`,
821
+ fontSize: o(r.caption),
822
+ fontWeight: M.semibold,
823
+ letterSpacing: "0.05em",
824
+ textTransform: "uppercase",
825
+ color: n["text.muted"]
826
+ };
827
+ }), oo = a("ul")({ margin: 0, padding: 0 });
828
+ function ro({
829
+ cloudPicker: e,
830
+ onImport: t,
831
+ multiple: n = !1,
832
+ maxSize: r,
833
+ accept: s
834
+ }) {
835
+ const {
836
+ abyssCloudUrl: c,
837
+ getFileThumbnailUrl: l,
838
+ getSpaceDisplay: d,
839
+ clouds: g,
840
+ cloudShares: m,
841
+ isLoading: p,
842
+ hasError: h,
843
+ refresh: y,
844
+ onCreateCloud: b,
845
+ fetchCloudRepository: f
846
+ } = e, u = z(), [x, k] = I(null), [C, P] = I(null), [$, D] = I(
847
+ "loading"
848
+ /* Loading */
849
+ ), [U, A] = I([]), [R, re] = I(!1), [ae, _] = I(!1), q = ye(() => {
850
+ const w = [], T = /* @__PURE__ */ new Map(), S = u.formatMessage({
851
+ id: "ds.business.cloud-import.section-organization"
852
+ });
853
+ for (const W of g ?? []) {
854
+ if (!W.organizationId) {
855
+ w.push(W);
856
+ continue;
857
+ }
858
+ const H = d == null ? void 0 : d(W), V = T.get(W.organizationId) ?? {
859
+ name: (H == null ? void 0 : H.organizationName) ?? S,
860
+ items: []
861
+ };
862
+ V.items.push(W), T.set(W.organizationId, V);
863
+ }
864
+ if (d)
865
+ for (const W of T.values())
866
+ W.items.sort((H, V) => {
867
+ const L = Le[d(H).scope ?? "personal"], Te = Le[d(V).scope ?? "personal"];
868
+ return L !== Te ? L - Te : d(H).label.localeCompare(d(V).label);
869
+ });
870
+ const B = (W, H) => (V) => {
871
+ const L = d == null ? void 0 : d(V);
872
+ return {
873
+ space: V,
874
+ sectionKey: W,
875
+ sectionLabel: H,
876
+ label: (L == null ? void 0 : L.label) ?? Wt(V, u),
877
+ subtitle: L == null ? void 0 : L.subtitle,
878
+ avatar: L == null ? void 0 : L.avatar
879
+ };
880
+ };
881
+ return [
882
+ ...w.map(
883
+ B(
884
+ "personal",
885
+ u.formatMessage({
886
+ id: "ds.business.cloud-import.section-personal"
887
+ })
888
+ )
889
+ ),
890
+ ...[...T].flatMap(
891
+ ([W, H]) => H.items.map(B(`org:${W}`, H.name))
892
+ ),
893
+ ...(m ?? []).map(
894
+ B(
895
+ De,
896
+ u.formatMessage({ id: "ds.business.cloud-import.section-shared" })
897
+ )
898
+ )
899
+ ];
900
+ }, [g, m, d, u]), K = q.find((w) => w.space.id === (x == null ? void 0 : x.id)) ?? null, pe = j(0), we = j(f);
901
+ we.current = f;
902
+ const le = X(async (w) => {
903
+ const T = ++pe.current;
904
+ D(
905
+ "loading"
906
+ /* Loading */
907
+ ), A([]);
908
+ try {
909
+ if (w.id === void 0)
910
+ throw new Error("A Space without an id has no tree");
911
+ const S = await we.current(w.id);
912
+ T === pe.current && (P(S), D(
913
+ "ready"
914
+ /* Ready */
915
+ ));
916
+ } catch {
917
+ T === pe.current && D(
918
+ "failed"
919
+ /* Failed */
920
+ );
921
+ }
922
+ }, []), bt = j(y);
923
+ G(() => {
924
+ bt.current();
925
+ }, []), G(() => {
926
+ if (x && q.some((S) => S.space.id === x.id))
927
+ return;
928
+ const w = q.map((S) => S.space), T = w.find(
929
+ (S) => !!S.userId && !S.organizationId && !S.projectId
930
+ );
931
+ k(T ?? w[0] ?? null);
932
+ }, [q, x]), G(() => {
933
+ x && le(x);
934
+ }, [x, le]);
935
+ const yt = async () => {
936
+ if (_(!1), !await y()) {
937
+ _(!0);
938
+ return;
939
+ }
940
+ x && await le(x);
941
+ }, vt = async () => {
942
+ re(!0);
943
+ try {
944
+ await b();
945
+ } finally {
946
+ re(!1);
947
+ }
948
+ }, xt = {
949
+ multiple: n,
950
+ maxSize: r,
951
+ accept: s,
952
+ selectedIds: new Set(U.map(Q)),
953
+ getFileThumbnailUrl: l,
954
+ select: (w) => A((T) => {
955
+ if (!n)
956
+ return w.slice(0, 1);
957
+ const S = new Set(T.map(Q));
958
+ return [
959
+ ...T,
960
+ ...w.filter((B) => !S.has(Q(B)))
961
+ ];
962
+ }),
963
+ unselect: (w) => {
964
+ const T = new Set(w.map(Q));
965
+ A(
966
+ (S) => S.filter((B) => !T.has(Q(B)))
967
+ );
968
+ }
969
+ }, wt = g !== null && m !== null, ke = /* @__PURE__ */ i(ie, { children: /* @__PURE__ */ i(
970
+ We,
971
+ {
972
+ size: 32,
973
+ "aria-label": u.formatMessage({
974
+ id: "ds.business.cloud-import.loading"
975
+ })
976
+ }
977
+ ) });
978
+ if (!wt && (p || !h))
979
+ return ke;
980
+ if (q.length === 0)
981
+ return /* @__PURE__ */ v(ie, { children: [
982
+ /* @__PURE__ */ i(Gn, { "aria-hidden": !0, children: /* @__PURE__ */ i(Ht, {}) }),
983
+ /* @__PURE__ */ i(Un, { children: u.formatMessage({
984
+ id: "ds.business.cloud-import.create-error.title"
985
+ }) }),
986
+ /* @__PURE__ */ i(qn, { children: u.formatMessage({
987
+ id: "ds.business.cloud-import.create-error.description"
988
+ }) }),
989
+ /* @__PURE__ */ i(
990
+ Z,
991
+ {
992
+ variant: "contained",
993
+ startIcon: /* @__PURE__ */ i(Ae, { "aria-hidden": !0 }),
994
+ loading: R || p,
995
+ onClick: () => void vt(),
996
+ children: u.formatMessage({
997
+ id: "ds.business.cloud-import.create-error.create-button"
998
+ })
999
+ }
1000
+ )
1001
+ ] });
1002
+ if (K === null)
1003
+ return ke;
1004
+ const kt = Rt(
1005
+ c,
1006
+ K.space,
1007
+ K.sectionKey === De
1008
+ ), Ce = u.formatMessage({
1009
+ id: "ds.business.cloud-import.refresh"
1010
+ }), Se = u.formatMessage({
1011
+ id: "ds.business.cloud-import.open-in-cloud"
1012
+ }), Ie = (w) => w.avatar ?? /* @__PURE__ */ i(Ae, {});
1013
+ return /* @__PURE__ */ v(Nn, { children: [
1014
+ ae && /* @__PURE__ */ i(
1015
+ En,
1016
+ {
1017
+ severity: Je.Danger,
1018
+ onClose: () => _(!1),
1019
+ children: u.formatMessage({ id: "ds.business.cloud-import.refresh-error" })
1020
+ }
1021
+ ),
1022
+ /* @__PURE__ */ v(_n, { children: [
1023
+ /* @__PURE__ */ i(
1024
+ Pt,
1025
+ {
1026
+ fullWidth: !0,
1027
+ disableClearable: !0,
1028
+ options: q,
1029
+ value: K,
1030
+ groupBy: (w) => w.sectionLabel,
1031
+ getOptionLabel: (w) => w.label,
1032
+ isOptionEqualToValue: (w, T) => w.space.id === T.space.id,
1033
+ onChange: (w, T) => k(T.space),
1034
+ filterOptions: (w, { inputValue: T }) => {
1035
+ const S = T.trim().toLowerCase();
1036
+ return S === "" || S === K.label.toLowerCase() ? w : w.filter(
1037
+ (B) => [B.label, B.subtitle ?? ""].some(
1038
+ (W) => W.toLowerCase().includes(S)
1039
+ )
1040
+ );
1041
+ },
1042
+ renderGroup: (w) => /* @__PURE__ */ v(to, { children: [
1043
+ /* @__PURE__ */ i(no, { children: w.group }),
1044
+ /* @__PURE__ */ i(oo, { children: w.children })
1045
+ ] }, w.key),
1046
+ renderOption: ({ key: w, ...T }, S) => /* @__PURE__ */ v(Qn, { ...T, children: [
1047
+ /* @__PURE__ */ i(dt, { "aria-hidden": !0, children: Ie(S) }),
1048
+ /* @__PURE__ */ v(Xn, { children: [
1049
+ /* @__PURE__ */ i(Zn, { children: S.label }),
1050
+ S.subtitle !== void 0 && /* @__PURE__ */ i(Jn, { children: S.subtitle })
1051
+ ] })
1052
+ ] }, w),
1053
+ renderInput: (w) => /* @__PURE__ */ i(
1054
+ Ze,
1055
+ {
1056
+ label: u.formatMessage({
1057
+ id: "ds.business.cloud-import.space-label"
1058
+ }),
1059
+ children: /* @__PURE__ */ i(
1060
+ ve,
1061
+ {
1062
+ ...w.InputProps,
1063
+ id: w.id,
1064
+ fullWidth: !0,
1065
+ inputProps: w.inputProps,
1066
+ startAdornment: /* @__PURE__ */ i(eo, { "aria-hidden": !0, children: Ie(K) })
1067
+ }
1068
+ )
1069
+ }
1070
+ )
1071
+ }
1072
+ ),
1073
+ /* @__PURE__ */ i(Oe, { title: Ce, children: /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(
1074
+ ee,
1075
+ {
1076
+ "aria-label": Ce,
1077
+ disabled: $ === "loading" || p,
1078
+ onClick: () => void yt(),
1079
+ children: /* @__PURE__ */ i(_t, { "aria-hidden": !0 })
1080
+ }
1081
+ ) }) }),
1082
+ /* @__PURE__ */ i(Oe, { title: Se, children: /* @__PURE__ */ i(
1083
+ ee,
1084
+ {
1085
+ component: "a",
1086
+ href: kt,
1087
+ target: "_blank",
1088
+ rel: "noreferrer",
1089
+ "aria-label": Se,
1090
+ children: /* @__PURE__ */ i(Nt, { "aria-hidden": !0 })
1091
+ }
1092
+ ) })
1093
+ ] }),
1094
+ /* @__PURE__ */ i(Vn, { children: u.formatMessage({ id: "ds.business.cloud-import.filtered-hint" }) }),
1095
+ $ === "loading" && /* @__PURE__ */ i(ie, { children: /* @__PURE__ */ i(
1096
+ We,
1097
+ {
1098
+ size: 24,
1099
+ "aria-label": u.formatMessage({
1100
+ id: "ds.business.cloud-import.tree-loading"
1101
+ })
1102
+ }
1103
+ ) }),
1104
+ $ === "failed" && /* @__PURE__ */ v(ie, { role: "alert", children: [
1105
+ u.formatMessage({ id: "ds.business.cloud-import.tree-error" }),
1106
+ /* @__PURE__ */ i(
1107
+ Z,
1108
+ {
1109
+ variant: "outlined",
1110
+ onClick: () => void le(K.space),
1111
+ children: u.formatMessage({ id: "ds.business.cloud-import.retry" })
1112
+ }
1113
+ )
1114
+ ] }),
1115
+ $ === "ready" && C !== null && (C.folders.length === 0 && C.files.length === 0 ? /* @__PURE__ */ v(ie, { children: [
1116
+ /* @__PURE__ */ i(Ue, { "aria-hidden": !0 }),
1117
+ u.formatMessage({ id: "ds.business.cloud-import.empty-space" })
1118
+ ] }) : /* @__PURE__ */ i(
1119
+ jn,
1120
+ {
1121
+ "aria-label": u.formatMessage({
1122
+ id: "ds.business.cloud-import.tree-label"
1123
+ }),
1124
+ children: /* @__PURE__ */ i(
1125
+ lt,
1126
+ {
1127
+ folders: C.folders,
1128
+ files: C.files,
1129
+ context: xt
1130
+ }
1131
+ )
1132
+ }
1133
+ )),
1134
+ /* @__PURE__ */ v(Kn, { children: [
1135
+ /* @__PURE__ */ i(Yn, { role: "status", children: u.formatMessage(
1136
+ { id: "ds.business.cloud-import.selected" },
1137
+ { count: U.length }
1138
+ ) }),
1139
+ /* @__PURE__ */ i(
1140
+ Z,
1141
+ {
1142
+ variant: "contained",
1143
+ startIcon: /* @__PURE__ */ i(Bt, { "aria-hidden": !0 }),
1144
+ disabled: U.length === 0,
1145
+ onClick: () => t(K.space, U),
1146
+ children: u.formatMessage({ id: "ds.business.cloud-import.import" })
1147
+ }
1148
+ )
1149
+ ] })
1150
+ ] });
1151
+ }
1152
+ function io({
1153
+ open: e,
1154
+ onClose: t,
1155
+ onImport: n,
1156
+ cloudPicker: r,
1157
+ multiple: s,
1158
+ maxSize: c,
1159
+ accept: l
1160
+ }) {
1161
+ const d = z();
1162
+ return /* @__PURE__ */ i(
1163
+ Xe,
1164
+ {
1165
+ open: e,
1166
+ onClose: t,
1167
+ size: xe.Medium,
1168
+ title: d.formatMessage({ id: "ds.business.cloud-import.title" }),
1169
+ children: e && /* @__PURE__ */ i(
1170
+ ro,
1171
+ {
1172
+ cloudPicker: r,
1173
+ multiple: s,
1174
+ maxSize: c,
1175
+ accept: l,
1176
+ onImport: (g, m) => {
1177
+ n(g, m), t();
1178
+ }
1179
+ }
1180
+ )
1181
+ }
1182
+ );
1183
+ }
1184
+ const so = /* @__PURE__ */ new Set(["a", "button"]), ao = a("div", {
1185
+ shouldForwardProp: (e) => e !== "ownerState" && e !== "theme" && e !== "sx" && e !== "as"
1186
+ })(({ theme: e, ownerState: t }) => {
1187
+ const { tokens: n, radii: r, space: s } = e.design;
1188
+ return {
1189
+ display: "flex",
1190
+ flexDirection: "column",
1191
+ minWidth: 0,
1192
+ boxSizing: "border-box",
1193
+ backgroundColor: n["bg.surface"],
1194
+ border: O(n["border.subtle"]),
1195
+ borderRadius: o(r.md),
1196
+ padding: o(s[t.padding]),
1197
+ color: n["text.primary"],
1198
+ ...t.interactive && {
1199
+ cursor: "pointer",
1200
+ font: "inherit",
1201
+ textAlign: "inherit",
1202
+ textDecoration: "none",
1203
+ transition: oe(e, ["border-color"]),
1204
+ "&:hover": { borderColor: n["border.strong"] },
1205
+ "&:focus-visible": te(e)
1206
+ }
1207
+ };
1208
+ }), Jr = St(function({
1209
+ interactive: t = !1,
1210
+ padding: n = 4,
1211
+ component: r = "div",
1212
+ children: s,
1213
+ onKeyDown: c,
1214
+ role: l,
1215
+ tabIndex: d,
1216
+ ...g
1217
+ }, m) {
1218
+ const p = t && typeof r == "string" && !so.has(r), h = X(
1219
+ (b) => {
1220
+ typeof m == "function" ? m(b) : m !== null && (m.current = b);
1221
+ },
1222
+ [m]
1223
+ );
1224
+ return /* @__PURE__ */ i(
1225
+ ao,
1226
+ {
1227
+ ref: h,
1228
+ as: r,
1229
+ ownerState: { interactive: t, padding: n },
1230
+ role: l ?? (p ? "button" : void 0),
1231
+ tabIndex: d ?? (p ? 0 : void 0),
1232
+ onKeyDown: (b) => {
1233
+ c == null || c(b), p && !b.defaultPrevented && b.target === b.currentTarget && (b.key === "Enter" || b.key === " ") && (b.preventDefault(), b.currentTarget.click());
1234
+ },
1235
+ ...g,
1236
+ children: s
1237
+ }
1238
+ );
1239
+ });
1240
+ var ct = /* @__PURE__ */ ((e) => (e.Medium = "medium", e.Compact = "compact", e))(ct || {});
1241
+ const lo = Be(
1242
+ "medium"
1243
+ /* Medium */
1244
+ ), co = a(ce)(({ theme: e }) => ({
1245
+ // Three times the largest spacing step: room for a label and the arrow.
1246
+ minWidth: o(e.design.space[10] * 3),
1247
+ maxWidth: "100%"
1248
+ })), uo = a(je)(({ theme: e }) => ({
1249
+ position: "relative",
1250
+ transform: "none",
1251
+ maxWidth: "100%",
1252
+ pointerEvents: "auto",
1253
+ marginBottom: o(e.design.space[2]),
1254
+ fontSize: o(e.design.typeScale.small),
1255
+ fontWeight: M.medium,
1256
+ lineHeight: e.typography.caption.lineHeight,
1257
+ color: e.design.tokens["text.secondary"],
1258
+ "&.Mui-focused": { color: e.design.tokens["text.secondary"] },
1259
+ "&.Mui-error": { color: e.design.tokens["status.danger"] },
1260
+ "&.Mui-disabled": { color: e.design.tokens["text.muted"] }
1261
+ })), go = a("span")(({ theme: e }) => ({
1262
+ display: "flex",
1263
+ alignItems: "center",
1264
+ gap: o(e.design.space[2]),
1265
+ minWidth: 0
1266
+ })), po = a("i", {
1267
+ shouldForwardProp: (e) => e !== "token"
1268
+ })(({ theme: e, token: t }) => ({
1269
+ flex: "none",
1270
+ width: o(e.design.space[2]),
1271
+ height: o(e.design.space[2]),
1272
+ borderRadius: o(e.design.radii.sm / 2),
1273
+ backgroundColor: e.design.tokens[t]
1274
+ })), fo = a("span")({
1275
+ display: "flex",
1276
+ flexDirection: "column",
1277
+ minWidth: 0
1278
+ }), mo = a("span")(({ theme: e }) => ({
1279
+ fontSize: o(e.design.typeScale.caption),
1280
+ color: e.design.tokens["text.muted"],
1281
+ whiteSpace: "normal"
1282
+ })), be = a("span")({
1283
+ overflow: "hidden",
1284
+ textOverflow: "ellipsis",
1285
+ whiteSpace: "nowrap"
1286
+ }), ho = a(be)(({ theme: e }) => ({
1287
+ color: e.design.tokens["text.muted"]
1288
+ }));
1289
+ function ei({
1290
+ label: e,
1291
+ options: t,
1292
+ value: n,
1293
+ onChange: r,
1294
+ multiple: s = !1,
1295
+ disabled: c,
1296
+ error: l,
1297
+ size: d
1298
+ }) {
1299
+ const g = z(), m = Ne(lo), p = (d ?? m) === ct.Compact, h = p ? co : ce, y = E(), b = `${y}-label`, f = `${y}-helper`, u = new Map(t.map((k) => [k.value, k]));
1300
+ return /* @__PURE__ */ v(h, { fullWidth: !p, disabled: c, error: !!l, children: [
1301
+ /* @__PURE__ */ i(
1302
+ uo,
1303
+ {
1304
+ id: b,
1305
+ shrink: !0,
1306
+ style: p ? $t : void 0,
1307
+ children: e
1308
+ }
1309
+ ),
1310
+ /* @__PURE__ */ v(
1311
+ Tt,
1312
+ {
1313
+ labelId: b,
1314
+ multiple: s,
1315
+ value: n,
1316
+ displayEmpty: !0,
1317
+ renderValue: (k) => {
1318
+ const C = Array.isArray(k) ? k : [k];
1319
+ return p && C.length === 0 ? /* @__PURE__ */ i(ho, { "aria-hidden": !0, children: e }) : /* @__PURE__ */ i(be, { children: C.map((P) => {
1320
+ var $;
1321
+ return (($ = u.get(P)) == null ? void 0 : $.label) ?? P;
1322
+ }).join(", ") });
1323
+ },
1324
+ "aria-describedby": l ? f : void 0,
1325
+ onChange: (k) => r(k.target.value),
1326
+ children: [
1327
+ t.length === 0 && /* @__PURE__ */ i(Fe, { disabled: !0, value: "", children: g.formatMessage({ id: "ds.inputs.rich-select.empty" }) }),
1328
+ t.map((k) => /* @__PURE__ */ i(Fe, { value: k.value, children: /* @__PURE__ */ v(go, { children: [
1329
+ k.tone && /* @__PURE__ */ i(po, { token: k.tone }),
1330
+ k.icon,
1331
+ /* @__PURE__ */ v(fo, { children: [
1332
+ /* @__PURE__ */ i(be, { children: k.label }),
1333
+ k.description && /* @__PURE__ */ i(mo, { children: k.description })
1334
+ ] })
1335
+ ] }) }, k.value))
1336
+ ]
1337
+ }
1338
+ ),
1339
+ l && /* @__PURE__ */ i(de, { id: f, children: l })
1340
+ ] });
1341
+ }
1342
+ const ti = { l: 0.72, c: 0.12 }, ni = [
1343
+ 266,
1344
+ 296,
1345
+ 326,
1346
+ 356,
1347
+ 26,
1348
+ 56,
1349
+ 86,
1350
+ 116,
1351
+ 146,
1352
+ 176,
1353
+ 206,
1354
+ 236
1355
+ ], ut = [
1356
+ "#81a2f0",
1357
+ "#ab94e7",
1358
+ "#cb89cd",
1359
+ "#e084a7",
1360
+ "#e6867d",
1361
+ "#de9056",
1362
+ "#c69f41",
1363
+ "#a1ae50",
1364
+ "#70b976",
1365
+ "#37bda2",
1366
+ "#18b9c9",
1367
+ "#4eb0e5"
1368
+ ], oi = "#767676", ri = ut[6], ii = "#111a2f", si = "#5674be", bo = /^#?([0-9a-f]{6})$/i, Y = (e) => {
1369
+ const t = bo.exec(e.trim());
1370
+ return t ? `#${t[1].toLowerCase()}` : null;
1371
+ }, yo = a("div")(({ theme: e }) => ({
1372
+ display: "flex",
1373
+ alignItems: "center",
1374
+ gap: o(e.design.space[3])
1375
+ })), vo = a("span")(({ theme: e }) => ({
1376
+ flex: "none",
1377
+ width: o(e.design.densityValues[e.design.density].control),
1378
+ height: o(e.design.densityValues[e.design.density].control),
1379
+ borderRadius: o(e.design.radii.md),
1380
+ border: O(e.design.tokens["border.control"])
1381
+ })), xo = a("div")(({ theme: e }) => ({
1382
+ display: "flex",
1383
+ flexWrap: "wrap",
1384
+ gap: o(e.design.space[2]),
1385
+ marginTop: o(e.design.space[2])
1386
+ })), wo = a(Ge)(({ theme: e }) => {
1387
+ const { densityValues: t, density: n, space: r } = e.design, s = t[n].control - r[2];
1388
+ return {
1389
+ width: o(s),
1390
+ height: o(s),
1391
+ borderRadius: o(e.design.radii.sm),
1392
+ border: O(e.design.tokens["border.control"]),
1393
+ // The chosen swatch carries the ring of the design system (`focus.ring` is the accent).
1394
+ '&[aria-pressed="true"]': te(e),
1395
+ "&.Mui-focusVisible": te(e),
1396
+ [N.down(F.Tablet)]: {
1397
+ width: o(e.design.densityValues.touchTarget),
1398
+ height: o(e.design.densityValues.touchTarget)
1399
+ }
1400
+ };
1401
+ });
1402
+ function ai({
1403
+ label: e,
1404
+ value: t,
1405
+ onChange: n,
1406
+ swatches: r = ut
1407
+ }) {
1408
+ const s = z(), c = E(), [l, d] = I(t), g = l !== "" && Y(l) === null;
1409
+ G(() => {
1410
+ d(
1411
+ (h) => Y(h) === Y(t) ? h : t
1412
+ );
1413
+ }, [t]);
1414
+ const m = (h) => {
1415
+ d(h);
1416
+ const y = Y(h);
1417
+ y !== null && y !== Y(t) && n(y);
1418
+ }, p = Y(t);
1419
+ return /* @__PURE__ */ v(ce, { fullWidth: !0, error: g, children: [
1420
+ /* @__PURE__ */ i(je, { htmlFor: `${c}-hex`, children: e }),
1421
+ /* @__PURE__ */ v(yo, { children: [
1422
+ /* @__PURE__ */ i(
1423
+ vo,
1424
+ {
1425
+ "aria-hidden": "true",
1426
+ style: { backgroundColor: p ?? void 0 }
1427
+ }
1428
+ ),
1429
+ /* @__PURE__ */ i(
1430
+ ve,
1431
+ {
1432
+ id: `${c}-hex`,
1433
+ fullWidth: !0,
1434
+ value: l,
1435
+ error: g,
1436
+ inputProps: {
1437
+ "aria-describedby": g ? `${c}-error` : void 0,
1438
+ spellCheck: !1,
1439
+ autoComplete: "off"
1440
+ },
1441
+ onChange: (h) => m(h.target.value)
1442
+ }
1443
+ )
1444
+ ] }),
1445
+ g && /* @__PURE__ */ i(de, { id: `${c}-error`, children: s.formatMessage({ id: "ds.inputs.color.invalid" }) }),
1446
+ /* @__PURE__ */ i(
1447
+ xo,
1448
+ {
1449
+ role: "group",
1450
+ "aria-label": s.formatMessage({ id: "ds.inputs.color.swatches" }),
1451
+ children: r.map((h) => /* @__PURE__ */ i(
1452
+ wo,
1453
+ {
1454
+ "aria-pressed": Y(h) === p,
1455
+ "aria-label": h,
1456
+ style: { backgroundColor: h },
1457
+ onClick: () => n(Y(h) ?? h)
1458
+ },
1459
+ h
1460
+ ))
1461
+ }
1462
+ )
1463
+ ] });
1464
+ }
1465
+ const ko = 6, Co = a("div", {
1466
+ shouldForwardProp: (e) => e !== "edges"
1467
+ })(({ theme: e, edges: t }) => {
1468
+ const { tokens: n, radii: r, space: s } = e.design, c = o(s[1] * ko), l = n["text.primary"], d = t.start ? `transparent, ${l} ${c}` : l, g = t.end ? `${l} calc(100% - ${c}), transparent` : l;
1469
+ return {
1470
+ maskImage: t.start || t.end ? `linear-gradient(to right, ${d}, ${g})` : "none",
1471
+ display: "inline-flex",
1472
+ maxWidth: "100%",
1473
+ minWidth: 0,
1474
+ border: O(n["border.subtle"]),
1475
+ borderRadius: o(r.md),
1476
+ overflowX: "auto",
1477
+ overflowY: "hidden",
1478
+ backgroundColor: n["bg.surface"]
1479
+ };
1480
+ }), So = a(Ge)(({ theme: e }) => {
1481
+ const { tokens: t, space: n, typeScale: r, fonts: s, densityValues: c } = e.design;
1482
+ return {
1483
+ flex: "none",
1484
+ gap: o(n[2]),
1485
+ minHeight: o(c[e.design.density].control),
1486
+ paddingLeft: o(n[3]),
1487
+ paddingRight: o(n[3]),
1488
+ fontFamily: s.sans,
1489
+ fontSize: o(r.body),
1490
+ whiteSpace: "nowrap",
1491
+ color: t["text.secondary"],
1492
+ transition: oe(e, ["background-color", "color"]),
1493
+ "& + &": { borderLeft: O(t["border.subtle"]) },
1494
+ '&[aria-checked="true"]': {
1495
+ backgroundColor: t["bg.raised"],
1496
+ color: t["text.primary"],
1497
+ fontWeight: M.medium
1498
+ },
1499
+ "&:hover": { backgroundColor: t["bg.hover"] },
1500
+ "&.Mui-focusVisible": { ...te(e), outlineOffset: "-2px" },
1501
+ [N.down(F.Tablet)]: {
1502
+ minHeight: o(c.touchTarget)
1503
+ }
1504
+ };
1505
+ }), Io = a("span")(({ theme: e }) => ({
1506
+ fontFamily: e.design.fonts.mono,
1507
+ fontSize: o(e.design.typeScale.caption),
1508
+ color: e.design.tokens["text.muted"]
1509
+ }));
1510
+ function li({
1511
+ options: e,
1512
+ value: t,
1513
+ onChange: n,
1514
+ ariaLabel: r
1515
+ }) {
1516
+ const s = j(null), [c, l] = I({ start: !1, end: !1 }), d = X(() => {
1517
+ const p = s.current;
1518
+ if (!p)
1519
+ return;
1520
+ const h = p.scrollLeft > 0, y = p.scrollLeft + p.clientWidth < p.scrollWidth - 1;
1521
+ l(
1522
+ (b) => b.start === h && b.end === y ? b : { start: h, end: y }
1523
+ );
1524
+ }, []);
1525
+ G(() => (d(), window.addEventListener("resize", d), () => window.removeEventListener("resize", d)), [d, e]);
1526
+ const g = (p) => {
1527
+ var b, f;
1528
+ const h = e.findIndex((u) => u.value === t);
1529
+ let y;
1530
+ switch (p.key) {
1531
+ case "ArrowRight":
1532
+ case "ArrowDown":
1533
+ y = (h + 1) % e.length;
1534
+ break;
1535
+ case "ArrowLeft":
1536
+ case "ArrowUp":
1537
+ y = (h - 1 + e.length) % e.length;
1538
+ break;
1539
+ case "Home":
1540
+ y = 0;
1541
+ break;
1542
+ case "End":
1543
+ y = e.length - 1;
1544
+ break;
1545
+ default:
1546
+ return;
1547
+ }
1548
+ p.preventDefault(), n(e[y].value), (f = (b = s.current) == null ? void 0 : b.querySelectorAll('[role="radio"]')[y]) == null || f.focus();
1549
+ }, m = Math.max(
1550
+ e.findIndex((p) => p.value === t),
1551
+ 0
1552
+ );
1553
+ return /* @__PURE__ */ i(
1554
+ Co,
1555
+ {
1556
+ ref: s,
1557
+ role: "radiogroup",
1558
+ "aria-label": r,
1559
+ edges: c,
1560
+ onKeyDown: g,
1561
+ onScroll: d,
1562
+ children: e.map((p, h) => {
1563
+ const y = p.value === t;
1564
+ return /* @__PURE__ */ v(
1565
+ So,
1566
+ {
1567
+ role: "radio",
1568
+ "aria-checked": y,
1569
+ tabIndex: h === m ? 0 : -1,
1570
+ onClick: () => n(p.value),
1571
+ children: [
1572
+ p.label,
1573
+ p.count !== void 0 && /* @__PURE__ */ i(Io, { children: p.count })
1574
+ ]
1575
+ },
1576
+ p.value
1577
+ );
1578
+ })
1579
+ }
1580
+ );
1581
+ }
1582
+ const To = [32, 160, 8239, 8201].map(
1583
+ (e) => String.fromCharCode(e)
1584
+ ), $o = (e) => {
1585
+ var n, r;
1586
+ const t = new Intl.NumberFormat(e).formatToParts(11111.1);
1587
+ return {
1588
+ group: ((n = t.find((s) => s.type === "group")) == null ? void 0 : n.value) ?? " ",
1589
+ decimal: ((r = t.find((s) => s.type === "decimal")) == null ? void 0 : r.value) ?? "."
1590
+ };
1591
+ }, Pe = (e, t) => {
1592
+ const r = [t.group, ...To].reduce(
1593
+ (c, l) => c.split(l).join(""),
1594
+ e.trim()
1595
+ ).replace(",", ".");
1596
+ if (r === "" || !/^-?\d*\.?\d+$|^-?\d+\.$/.test(r))
1597
+ return null;
1598
+ const s = Number.parseFloat(r);
1599
+ return Number.isFinite(s) ? s : null;
1600
+ };
1601
+ function di({
1602
+ label: e,
1603
+ value: t,
1604
+ onChange: n,
1605
+ decimals: r = 0,
1606
+ min: s = 0,
1607
+ disabled: c,
1608
+ adornment: l
1609
+ }) {
1610
+ const d = z(), g = ye(
1611
+ () => $o(d.locale),
1612
+ [d.locale]
1613
+ ), m = X(
1614
+ (u) => u === null ? "" : d.formatNumber(u, {
1615
+ minimumFractionDigits: r,
1616
+ maximumFractionDigits: r
1617
+ }),
1618
+ [d, r]
1619
+ ), [p, h] = I(!1), [y, b] = I(() => m(t));
1620
+ return G(() => {
1621
+ p || b(m(t));
1622
+ }, [t, p, m]), /* @__PURE__ */ i(Ze, { label: e, children: /* @__PURE__ */ i(
1623
+ ve,
1624
+ {
1625
+ disabled: c,
1626
+ value: y,
1627
+ inputProps: { inputMode: "decimal" },
1628
+ onFocus: () => {
1629
+ h(!0), t !== null && b(String(t).replace(".", g.decimal));
1630
+ },
1631
+ onChange: (u) => {
1632
+ b(u.target.value);
1633
+ const x = Pe(u.target.value, g);
1634
+ x !== null ? n(x) : u.target.value === "" && n(null);
1635
+ },
1636
+ onBlur: () => {
1637
+ h(!1);
1638
+ let u = Pe(y, g);
1639
+ u !== null && (u = Number.parseFloat(Math.max(u, s).toFixed(r))), n(u), b(m(u));
1640
+ },
1641
+ endAdornment: l ? /* @__PURE__ */ i(zt, { position: "end", children: l }) : void 0
1642
+ }
1643
+ ) });
1644
+ }
1645
+ const Fo = a("div")(({ theme: e }) => ({
1646
+ display: "flex",
1647
+ flexDirection: "column",
1648
+ gap: o(e.design.space[2]),
1649
+ minWidth: 0
1650
+ })), Mo = a("span")(({ theme: e }) => ({
1651
+ fontSize: o(e.design.typeScale.small),
1652
+ fontWeight: M.medium,
1653
+ color: e.design.tokens["text.secondary"]
1654
+ })), Ro = a("div", {
1655
+ shouldForwardProp: (e) => e !== "active"
1656
+ })(({ theme: e, active: t }) => {
1657
+ const { tokens: n, space: r, radii: s } = e.design;
1658
+ return {
1659
+ display: "flex",
1660
+ flexDirection: "column",
1661
+ alignItems: "center",
1662
+ justifyContent: "center",
1663
+ gap: o(r[3]),
1664
+ minHeight: o(r[10] * 3),
1665
+ padding: `${o(r[6])} ${o(r[4])}`,
1666
+ boxSizing: "border-box",
1667
+ border: `1px dashed ${t ? n.accent : n["border.control"]}`,
1668
+ borderRadius: o(s.md),
1669
+ backgroundColor: t ? ge(n.accent) : n["bg.raised"],
1670
+ color: n["text.secondary"],
1671
+ textAlign: "center",
1672
+ cursor: "pointer",
1673
+ transition: oe(e, ["border-color", "background-color"]),
1674
+ "&:hover": { borderColor: n.accent }
1675
+ };
1676
+ }), Wo = a("span")(({ theme: e }) => {
1677
+ const { tokens: t, space: n } = e.design;
1678
+ return {
1679
+ display: "inline-flex",
1680
+ alignItems: "center",
1681
+ justifyContent: "center",
1682
+ width: o(n[9]),
1683
+ height: o(n[9]),
1684
+ borderRadius: "50%",
1685
+ backgroundColor: ge(t.accent),
1686
+ color: t["accent.text"],
1687
+ "& svg": { width: o(n[5]), height: o(n[5]) }
1688
+ };
1689
+ }), Oo = a("span")(({ theme: e }) => ({
1690
+ fontSize: o(e.design.typeScale.body),
1691
+ [N.down(F.Tablet)]: { display: "none" }
1692
+ })), Ao = a("div")(({ theme: e }) => ({
1693
+ display: "flex",
1694
+ flexWrap: "wrap",
1695
+ alignItems: "center",
1696
+ justifyContent: "space-between",
1697
+ gap: o(e.design.space[2])
1698
+ })), Eo = a("span")(({ theme: e }) => ({
1699
+ fontSize: o(e.design.typeScale.small),
1700
+ color: e.design.tokens["text.muted"]
1701
+ })), zo = a("p")(({ theme: e }) => ({
1702
+ margin: 0,
1703
+ fontSize: o(e.design.typeScale.small),
1704
+ color: e.design.tokens["status.danger"]
1705
+ })), Do = a("img")(({ theme: e }) => ({
1706
+ width: o(e.design.space[4]),
1707
+ height: o(e.design.space[4])
1708
+ })), Lo = (e) => {
1709
+ const { value: t, unit: n } = Dt(e);
1710
+ return `${t} ${n}`;
1711
+ };
1712
+ function ci({
1713
+ onDrop: e,
1714
+ multiple: t = !0,
1715
+ accept: n,
1716
+ maxSize: r,
1717
+ caption: s,
1718
+ title: c,
1719
+ cloudImport: l,
1720
+ children: d
1721
+ }) {
1722
+ const g = z(), m = E(), p = E(), [h, y] = I(null), [b, f] = I(!1), u = r === void 0 ? null : Lo(r), x = s ?? (u === null ? null : g.formatMessage(
1723
+ { id: "ds.inputs.drop-zone.max-size" },
1724
+ { size: u, multiple: String(t) }
1725
+ )), k = (A, R) => {
1726
+ const re = r === void 0 ? [] : A.filter((_) => _.size > r), ae = A.filter((_) => !re.includes(_));
1727
+ R.some(
1728
+ (_) => _.errors.some((q) => q.code === Et.TooManyFiles)
1729
+ ) ? y(
1730
+ "too-many"
1731
+ /* TooMany */
1732
+ ) : R.length > 0 ? y(
1733
+ "rejected-type"
1734
+ /* Rejected */
1735
+ ) : re.length > 0 ? y(
1736
+ A.length === 1 ? "too-big" : "some-too-big"
1737
+ /* SomeTooBig */
1738
+ ) : y(null), ae.length > 0 && e(ae);
1739
+ }, { getRootProps: C, getInputProps: P, isDragActive: $, open: D } = Ot({
1740
+ onDrop: k,
1741
+ multiple: t,
1742
+ accept: n,
1743
+ // The zone itself is not a control: the button inside is, for the keyboard and screen readers.
1744
+ noClick: !0,
1745
+ noKeyboard: !0
1746
+ }), U = g.formatMessage(
1747
+ { id: "ds.inputs.drop-zone.browse" },
1748
+ { multiple: String(t) }
1749
+ );
1750
+ return /* @__PURE__ */ v(
1751
+ Fo,
1752
+ {
1753
+ role: "group",
1754
+ "aria-labelledby": c !== void 0 ? m : void 0,
1755
+ "aria-describedby": x !== null ? p : void 0,
1756
+ children: [
1757
+ c !== void 0 && /* @__PURE__ */ i(Mo, { id: m, children: c }),
1758
+ /* @__PURE__ */ v(Ro, { ...C({ onClick: D }), active: $, children: [
1759
+ /* @__PURE__ */ i("input", { ...P({ "aria-hidden": !0 }) }),
1760
+ d ?? /* @__PURE__ */ v(ne, { children: [
1761
+ /* @__PURE__ */ i(Wo, { "aria-hidden": !0, children: /* @__PURE__ */ i(Lt, {}) }),
1762
+ /* @__PURE__ */ i(Oo, { children: g.formatMessage(
1763
+ {
1764
+ id: $ ? "ds.inputs.drop-zone.release" : "ds.inputs.drop-zone.prompt"
1765
+ },
1766
+ { multiple: String(t) }
1767
+ ) })
1768
+ ] }),
1769
+ /* @__PURE__ */ i(
1770
+ Z,
1771
+ {
1772
+ variant: "outlined",
1773
+ onClick: (A) => {
1774
+ A.stopPropagation(), D();
1775
+ },
1776
+ children: U
1777
+ }
1778
+ )
1779
+ ] }),
1780
+ (l !== void 0 || x !== null) && /* @__PURE__ */ v(Ao, { children: [
1781
+ l !== void 0 && /* @__PURE__ */ i(
1782
+ Z,
1783
+ {
1784
+ variant: "text",
1785
+ startIcon: /* @__PURE__ */ i(Do, { src: At, alt: "" }),
1786
+ onClick: () => f(!0),
1787
+ children: g.formatMessage({ id: "ds.inputs.drop-zone.cloud" })
1788
+ }
1789
+ ),
1790
+ x !== null && /* @__PURE__ */ i(Eo, { id: p, children: x })
1791
+ ] }),
1792
+ /* @__PURE__ */ i(zo, { role: "alert", children: h !== null && g.formatMessage(
1793
+ { id: `ds.inputs.drop-zone.${h}` },
1794
+ { size: u ?? "" }
1795
+ ) }),
1796
+ l !== void 0 && /* @__PURE__ */ i(
1797
+ io,
1798
+ {
1799
+ open: b,
1800
+ onClose: () => f(!1),
1801
+ onImport: l.onImport,
1802
+ cloudPicker: l,
1803
+ multiple: t,
1804
+ maxSize: r,
1805
+ accept: n === void 0 ? void 0 : Object.entries(n).flatMap(([A, R]) => [
1806
+ A,
1807
+ ...R
1808
+ ])
1809
+ }
1810
+ )
1811
+ ]
1812
+ }
1813
+ );
1814
+ }
1815
+ var Po = /* @__PURE__ */ ((e) => (e.Default = "default", e.Danger = "danger", e.Warning = "warning", e))(Po || {});
1816
+ const Ho = a("form")(({ theme: e }) => ({
1817
+ display: "flex",
1818
+ flexDirection: "column",
1819
+ gap: o(e.design.space[4]),
1820
+ color: e.design.tokens["text.secondary"],
1821
+ overflowWrap: "anywhere"
1822
+ })), Bo = (e, t) => {
1823
+ const { paper: n } = e.design.tokens, r = e.design.tokens["paper.on"];
1824
+ return $e(t, n) >= $e(t, r) ? n : r;
1825
+ }, No = {
1826
+ default: "primary",
1827
+ danger: "error",
1828
+ warning: "warning"
1829
+ };
1830
+ function _o({
1831
+ open: e,
1832
+ title: t,
1833
+ body: n,
1834
+ confirmLabel: r,
1835
+ tone: s = "default",
1836
+ confirmationText: c,
1837
+ onConfirm: l,
1838
+ onCancel: d
1839
+ }) {
1840
+ const g = z(), m = Ve(), p = E(), [h, y] = I(""), [b, f] = I(!1), [u, x] = I(!1), [k, C] = I(e);
1841
+ e !== k && (C(e), e && (y(""), x(!1)));
1842
+ const P = !b && (c === void 0 || h === c), $ = s !== "default", D = () => {
1843
+ b || d();
1844
+ }, U = () => {
1845
+ if (!P)
1846
+ return;
1847
+ x(!1);
1848
+ let R;
1849
+ try {
1850
+ R = l();
1851
+ } catch {
1852
+ x(!0);
1853
+ return;
1854
+ }
1855
+ R instanceof Promise && (f(!0), R.then(
1856
+ () => f(!1),
1857
+ () => {
1858
+ f(!1), x(!0);
1859
+ }
1860
+ ));
1861
+ }, A = (R) => {
1862
+ R.preventDefault(), U();
1863
+ };
1864
+ return /* @__PURE__ */ i(
1865
+ Xe,
1866
+ {
1867
+ open: e,
1868
+ onClose: D,
1869
+ size: xe.Small,
1870
+ title: t,
1871
+ actions: /* @__PURE__ */ v(ne, { children: [
1872
+ /* @__PURE__ */ i(
1873
+ Z,
1874
+ {
1875
+ variant: "outlined",
1876
+ disabled: b,
1877
+ autoFocus: c === void 0 && $,
1878
+ onClick: D,
1879
+ children: g.formatMessage({ id: "ds.layers.confirm-dialog.cancel" })
1880
+ }
1881
+ ),
1882
+ /* @__PURE__ */ i(
1883
+ Z,
1884
+ {
1885
+ type: "submit",
1886
+ form: p,
1887
+ variant: "contained",
1888
+ color: No[s],
1889
+ disabled: !P,
1890
+ loading: b,
1891
+ autoFocus: c === void 0 && !$,
1892
+ sx: s === "warning" ? {
1893
+ "&:not(.Mui-disabled)": {
1894
+ color: Bo(
1895
+ m,
1896
+ m.design.tokens["status.warning"]
1897
+ )
1898
+ }
1899
+ } : void 0,
1900
+ children: r
1901
+ }
1902
+ )
1903
+ ] }),
1904
+ children: /* @__PURE__ */ v(Ho, { id: p, onSubmit: A, noValidate: !0, children: [
1905
+ /* @__PURE__ */ i("div", { children: n }),
1906
+ c !== void 0 && /* @__PURE__ */ i(
1907
+ tn,
1908
+ {
1909
+ label: g.formatMessage(
1910
+ { id: "ds.layers.confirm-dialog.type-to-confirm" },
1911
+ { text: c }
1912
+ ),
1913
+ value: h,
1914
+ onChange: (R) => y(R.target.value),
1915
+ disabled: b,
1916
+ autoFocus: !0,
1917
+ autoComplete: "off",
1918
+ fullWidth: !0
1919
+ }
1920
+ ),
1921
+ u && /* @__PURE__ */ i(en, { severity: "error", children: g.formatMessage({ id: "ds.layers.confirm-dialog.failed" }) })
1922
+ ] })
1923
+ }
1924
+ );
1925
+ }
1926
+ var Vo = /* @__PURE__ */ ((e) => (e.BottomStart = "bottom-start", e.BottomEnd = "bottom-end", e))(Vo || {});
1927
+ const jo = 320, Go = a("div")(({ theme: e }) => {
1928
+ const { tokens: t, space: n } = e.design;
1929
+ return {
1930
+ flex: "none",
1931
+ display: "flex",
1932
+ alignItems: "center",
1933
+ justifyContent: "space-between",
1934
+ gap: o(n[3]),
1935
+ padding: `${o(n[2])} ${o(n[2])} ${o(n[2])} ${o(n[4])}`,
1936
+ borderBottom: O(t["border.subtle"])
1937
+ };
1938
+ }), Uo = a("h2")(({ theme: e }) => ({
1939
+ margin: 0,
1940
+ minWidth: 0,
1941
+ color: e.design.tokens["text.primary"],
1942
+ fontSize: o(e.design.typeScale.body),
1943
+ fontWeight: M.semibold,
1944
+ overflowWrap: "anywhere"
1945
+ })), gt = a("div")(({ theme: e }) => ({
1946
+ display: "flex",
1947
+ flexDirection: "column",
1948
+ gap: o(e.design.space[3]),
1949
+ fontSize: o(e.design.typeScale.body)
1950
+ })), qo = a(gt)(({ theme: e }) => ({
1951
+ padding: o(e.design.space[4])
1952
+ }));
1953
+ function ui({
1954
+ anchorEl: e,
1955
+ open: t,
1956
+ onClose: n,
1957
+ title: r,
1958
+ placement: s = "bottom-start",
1959
+ width: c = jo,
1960
+ children: l
1961
+ }) {
1962
+ const d = z(), g = E(), m = Ye() === F.Mobile, p = d.formatMessage({
1963
+ id: "ds.layers.anchored-panel.close"
1964
+ }), h = t && e !== null;
1965
+ if (m)
1966
+ return /* @__PURE__ */ i(
1967
+ Qe,
1968
+ {
1969
+ open: h,
1970
+ onClose: n,
1971
+ title: r,
1972
+ closeLabel: p,
1973
+ children: /* @__PURE__ */ i(gt, { children: l })
1974
+ }
1975
+ );
1976
+ const y = s === "bottom-end" ? "right" : "left";
1977
+ return /* @__PURE__ */ v(
1978
+ Jt,
1979
+ {
1980
+ anchorEl: e,
1981
+ open: h,
1982
+ onClose: () => n(),
1983
+ anchorOrigin: { vertical: "bottom", horizontal: y },
1984
+ transformOrigin: { vertical: "top", horizontal: y },
1985
+ slotProps: {
1986
+ paper: {
1987
+ role: "dialog",
1988
+ "aria-modal": !0,
1989
+ "aria-labelledby": g,
1990
+ sx: (b) => ({
1991
+ width: o(c),
1992
+ maxWidth: `calc(100vw - ${o(b.design.space[4] * 2)})`,
1993
+ marginTop: o(b.design.space[1]),
1994
+ color: b.design.tokens["text.primary"],
1995
+ fontFamily: b.design.fonts.sans
1996
+ })
1997
+ }
1998
+ },
1999
+ children: [
2000
+ /* @__PURE__ */ v(Go, { children: [
2001
+ /* @__PURE__ */ i(Uo, { id: g, children: r }),
2002
+ /* @__PURE__ */ i(ee, { "aria-label": p, onClick: n, children: /* @__PURE__ */ i(ue, { "aria-hidden": !0 }) })
2003
+ ] }),
2004
+ /* @__PURE__ */ i(qo, { children: l })
2005
+ ]
2006
+ }
2007
+ );
2008
+ }
2009
+ const pt = Be(null);
2010
+ function gi({ children: e }) {
2011
+ const [t, n] = I([]), [r, s] = I(null), c = j(0), l = j([]);
2012
+ l.current = t;
2013
+ const d = t.length > 0 ? t[0] : null;
2014
+ d !== null && d !== r && s(d), G(
2015
+ () => () => {
2016
+ l.current.forEach((h) => h.resolve(!1));
2017
+ },
2018
+ []
2019
+ );
2020
+ const g = X(
2021
+ (h) => new Promise((y) => {
2022
+ c.current += 1;
2023
+ const b = { id: c.current, options: h, resolve: y };
2024
+ n((f) => [...f, b]);
2025
+ }),
2026
+ []
2027
+ ), m = (h) => {
2028
+ d !== null && (d.resolve(h), n((y) => y.filter((b) => b !== d)));
2029
+ }, p = ye(() => ({ confirm: g }), [g]);
2030
+ return /* @__PURE__ */ v(pt.Provider, { value: p, children: [
2031
+ e,
2032
+ r !== null && // A new key per request: each one starts from an empty confirmation field.
2033
+ /* @__PURE__ */ i(
2034
+ _o,
2035
+ {
2036
+ open: d === r,
2037
+ ...r.options,
2038
+ onConfirm: () => m(!0),
2039
+ onCancel: () => m(!1)
2040
+ },
2041
+ r.id
2042
+ )
2043
+ ] });
2044
+ }
2045
+ function pi() {
2046
+ const e = Ne(pt);
2047
+ if (e === null)
2048
+ throw new Error(
2049
+ "useConfirmDialog must be called inside a ConfirmDialogProvider"
2050
+ );
2051
+ return e;
2052
+ }
2053
+ const Ko = 1, Yo = (e, t) => t === "vertical" ? e.scrollHeight - e.clientHeight - e.scrollTop : e.scrollWidth - e.clientWidth - e.scrollLeft, Qo = (e, t, n) => {
2054
+ const [r, s] = I(!1), c = X(() => {
2055
+ const l = e.current;
2056
+ l !== null && s(Yo(l, t) > Ko);
2057
+ }, [e, t]);
2058
+ return _e(c, [c, n]), G(() => {
2059
+ const l = e.current;
2060
+ if (l === null)
2061
+ return;
2062
+ l.addEventListener("scroll", c, { passive: !0 });
2063
+ const d = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
2064
+ return d !== null && (d.observe(l), Array.from(l.children).forEach((g) => d.observe(g))), () => {
2065
+ l.removeEventListener("scroll", c), d == null || d.disconnect();
2066
+ };
2067
+ }, [e, c, n]), r;
2068
+ };
2069
+ var Xo = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e))(Xo || {});
2070
+ const Zo = 2, Jo = /* @__PURE__ */ new Set(["Enter", " "]), er = a("div", {
2071
+ shouldForwardProp: (e) => e !== "variant"
2072
+ })(({ theme: e, variant: t }) => ({
2073
+ minWidth: 0,
2074
+ ...t === "primary" && {
2075
+ borderBottom: O(e.design.tokens["border.subtle"])
2076
+ }
2077
+ })), ft = 32, tr = a("div", {
2078
+ shouldForwardProp: (e) => e !== "variant" && e !== "fade"
2079
+ })(({ theme: e, variant: t, fade: n }) => {
2080
+ const s = `linear-gradient(to right, ${e.design.tokens["text.primary"]} calc(100% - ${o(
2081
+ ft
2082
+ )}), transparent)`;
2083
+ return {
2084
+ position: "relative",
2085
+ display: "flex",
2086
+ gap: o(e.design.space[t === "primary" ? 1 : 2]),
2087
+ overflowX: "auto",
2088
+ overflowY: "hidden",
2089
+ scrollbarWidth: "none",
2090
+ "&::-webkit-scrollbar": { display: "none" },
2091
+ ...n && { maskImage: s, WebkitMaskImage: s }
2092
+ };
2093
+ }), mt = (e, t) => {
2094
+ const { tokens: n, space: r, radii: s, typeScale: c, fonts: l, densityValues: d, density: g } = e.design, m = {
2095
+ position: "relative",
2096
+ display: "inline-flex",
2097
+ alignItems: "center",
2098
+ flex: "none",
2099
+ gap: o(r[2]),
2100
+ boxSizing: "border-box",
2101
+ margin: 0,
2102
+ border: 0,
2103
+ backgroundColor: "transparent",
2104
+ cursor: "pointer",
2105
+ fontFamily: l.sans,
2106
+ whiteSpace: "nowrap",
2107
+ textDecoration: "none",
2108
+ color: n["text.secondary"],
2109
+ transition: oe(e, ["color", "background-color"]),
2110
+ "&:hover": { color: n["text.primary"] },
2111
+ '&[aria-selected="true"]': {
2112
+ color: n["text.primary"],
2113
+ fontWeight: M.medium
2114
+ },
2115
+ // Inside the scrolling row, an outer ring would be clipped: it is drawn inside the tab.
2116
+ "&:focus-visible": { ...te(e), outlineOffset: "-2px" }
2117
+ }, p = {
2118
+ [N.down(F.Tablet)]: {
2119
+ minHeight: o(d.touchTarget)
2120
+ }
2121
+ };
2122
+ return t === "primary" ? {
2123
+ ...m,
2124
+ minHeight: o(d[g].control + r[2]),
2125
+ padding: `0 ${o(r[3])}`,
2126
+ fontSize: o(c.body),
2127
+ '&[aria-selected="true"]::after': {
2128
+ content: '""',
2129
+ position: "absolute",
2130
+ left: 0,
2131
+ right: 0,
2132
+ bottom: 0,
2133
+ height: o(Zo),
2134
+ backgroundColor: n.accent
2135
+ },
2136
+ ...p
2137
+ } : {
2138
+ ...m,
2139
+ minHeight: o(d.compact.control),
2140
+ padding: `0 ${o(r[3])}`,
2141
+ borderRadius: o(s.md),
2142
+ fontSize: o(c.small),
2143
+ "&:hover": {
2144
+ color: n["text.primary"],
2145
+ backgroundColor: n["bg.hover"]
2146
+ },
2147
+ '&[aria-selected="true"]': {
2148
+ color: n["text.primary"],
2149
+ fontWeight: M.medium,
2150
+ backgroundColor: n["bg.raised"]
2151
+ },
2152
+ ...p
2153
+ };
2154
+ }, ht = (e) => e !== "variant", nr = a(sn, { shouldForwardProp: ht })(({ theme: e, variant: t }) => mt(e, t)), or = a("button", { shouldForwardProp: ht })(({ theme: e, variant: t }) => mt(e, t)), rr = a("span")(({ theme: e }) => {
2155
+ const { tokens: t, space: n, radii: r, fonts: s, typeScale: c } = e.design;
2156
+ return {
2157
+ display: "inline-flex",
2158
+ alignItems: "center",
2159
+ padding: `0 ${o(n[1])}`,
2160
+ borderRadius: o(r.sm),
2161
+ border: O(t["border.subtle"]),
2162
+ fontFamily: s.mono,
2163
+ fontSize: o(c.caption),
2164
+ fontWeight: M.regular,
2165
+ lineHeight: 1.6,
2166
+ color: t["text.muted"]
2167
+ };
2168
+ }), He = (e, t) => {
2169
+ const n = t.offsetLeft, r = n + t.offsetWidth + ft;
2170
+ n < e.scrollLeft ? e.scrollLeft = n : r > e.scrollLeft + e.clientWidth && (e.scrollLeft = r - e.clientWidth);
2171
+ };
2172
+ function fi({
2173
+ items: e,
2174
+ value: t,
2175
+ onChange: n,
2176
+ variant: r,
2177
+ "aria-label": s
2178
+ }) {
2179
+ const c = z(), l = j(null), d = e.filter((f) => f.hidden !== !0), g = Qo(l, "horizontal", d.length), m = X(
2180
+ () => {
2181
+ var f;
2182
+ return Array.from(
2183
+ ((f = l.current) == null ? void 0 : f.querySelectorAll('[role="tab"]')) ?? []
2184
+ );
2185
+ },
2186
+ []
2187
+ ), p = X(() => {
2188
+ const f = l.current, u = f == null ? void 0 : f.querySelector('[aria-selected="true"]');
2189
+ f && u && He(f, u);
2190
+ }, []);
2191
+ _e(p, [p, t]);
2192
+ const h = d.map((f) => f.value).join("|");
2193
+ G(() => {
2194
+ const f = l.current;
2195
+ if (f === null || typeof ResizeObserver > "u")
2196
+ return;
2197
+ const u = new ResizeObserver(p);
2198
+ return u.observe(f), Array.from(f.children).forEach((x) => u.observe(x)), () => u.disconnect();
2199
+ }, [p, h]);
2200
+ const y = (f) => {
2201
+ const u = m(), x = u.findIndex((C) => C === document.activeElement);
2202
+ if (x < 0)
2203
+ return;
2204
+ if (Jo.has(f.key)) {
2205
+ f.key === " " && u[x] instanceof HTMLAnchorElement && (f.preventDefault(), u[x].click());
2206
+ return;
2207
+ }
2208
+ let k;
2209
+ switch (f.key) {
2210
+ case "ArrowRight":
2211
+ k = (x + 1) % u.length;
2212
+ break;
2213
+ case "ArrowLeft":
2214
+ k = (x - 1 + u.length) % u.length;
2215
+ break;
2216
+ case "Home":
2217
+ k = 0;
2218
+ break;
2219
+ case "End":
2220
+ k = u.length - 1;
2221
+ break;
2222
+ default:
2223
+ return;
2224
+ }
2225
+ f.preventDefault(), u[k].focus(), l.current && He(l.current, u[k]);
2226
+ }, b = Math.max(
2227
+ d.findIndex((f) => f.value === t),
2228
+ 0
2229
+ );
2230
+ return /* @__PURE__ */ i(er, { variant: r, children: /* @__PURE__ */ i(
2231
+ tr,
2232
+ {
2233
+ ref: l,
2234
+ role: "tablist",
2235
+ "aria-label": s,
2236
+ variant: r,
2237
+ fade: g,
2238
+ "data-overflowing": g || void 0,
2239
+ onKeyDown: y,
2240
+ children: d.map((f, u) => {
2241
+ const x = f.value === t, k = /* @__PURE__ */ v(ne, { children: [
2242
+ f.label,
2243
+ f.badge !== void 0 && /* @__PURE__ */ i(rr, { children: typeof f.badge == "number" ? c.formatNumber(f.badge) : f.badge })
2244
+ ] }), C = {
2245
+ role: "tab",
2246
+ "aria-selected": x,
2247
+ tabIndex: u === b ? 0 : -1,
2248
+ "data-testid": f.testId,
2249
+ variant: r,
2250
+ onClick: () => n == null ? void 0 : n(f.value)
2251
+ };
2252
+ return f.to !== void 0 ? /* @__PURE__ */ i(
2253
+ nr,
2254
+ {
2255
+ to: f.to,
2256
+ "aria-current": x ? "page" : void 0,
2257
+ ...C,
2258
+ children: k
2259
+ },
2260
+ f.value
2261
+ ) : /* @__PURE__ */ i(or, { type: "button", ...C, children: k }, f.value);
2262
+ })
2263
+ }
2264
+ ) });
2265
+ }
2266
+ export {
2267
+ ui as A,
2268
+ Qe as B,
2269
+ En as C,
2270
+ F as D,
2271
+ ro as E,
2272
+ Ze as F,
2273
+ Y as G,
2274
+ _o as H,
2275
+ io as I,
2276
+ Vo as J,
2277
+ ti as K,
2278
+ ni as L,
2279
+ Xe as M,
2280
+ di as N,
2281
+ ut as O,
2282
+ oi as P,
2283
+ ri as Q,
2284
+ ei as R,
2285
+ li as S,
2286
+ fi as T,
2287
+ ii as U,
2288
+ si as V,
2289
+ xe as a,
2290
+ Je as b,
2291
+ ai as c,
2292
+ N as d,
2293
+ Jr as e,
2294
+ ci as f,
2295
+ Xo as g,
2296
+ O as h,
2297
+ te as i,
2298
+ oe as j,
2299
+ Xr as k,
2300
+ ln as l,
2301
+ Po as m,
2302
+ gi as n,
2303
+ Ye as o,
2304
+ o as p,
2305
+ J as q,
2306
+ dn as r,
2307
+ ge as s,
2308
+ Ke as t,
2309
+ pi as u,
2310
+ Zr as v,
2311
+ se as w,
2312
+ Qo as x,
2313
+ lo as y,
2314
+ ct as z
2315
+ };