@monoform-ui/react 0.0.0-stage → 0.2.0-beta.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 (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +228 -2
  3. package/THIRD_PARTY_NOTICES.md +37 -0
  4. package/dist/actions.d.ts +80 -0
  5. package/dist/advanced-forms.d.ts +107 -0
  6. package/dist/advanced-inputs.d.ts +103 -0
  7. package/dist/agent-chat.d.ts +98 -0
  8. package/dist/agent-input.d.ts +54 -0
  9. package/dist/ai-creation-input.d.ts +71 -0
  10. package/dist/ai-interactions.d.ts +90 -0
  11. package/dist/ai-status.d.ts +17 -0
  12. package/dist/ai.cjs +2 -0
  13. package/dist/ai.cjs.map +1 -0
  14. package/dist/ai.d.ts +6 -0
  15. package/dist/ai.js +29 -0
  16. package/dist/ai.js.map +1 -0
  17. package/dist/app-shell.d.ts +69 -0
  18. package/dist/assets/backgrounds/monolith-field-dark-desktop.avif +0 -0
  19. package/dist/assets/backgrounds/monolith-field-dark-desktop.webp +0 -0
  20. package/dist/assets/backgrounds/monolith-field-dark-mobile.avif +0 -0
  21. package/dist/assets/backgrounds/monolith-field-dark-mobile.webp +0 -0
  22. package/dist/assets/backgrounds/monolith-field-dark.svg +58 -0
  23. package/dist/assets/backgrounds/monolith-field-light-desktop.avif +0 -0
  24. package/dist/assets/backgrounds/monolith-field-light-desktop.webp +0 -0
  25. package/dist/assets/backgrounds/monolith-field-light-mobile.avif +0 -0
  26. package/dist/assets/backgrounds/monolith-field-light-mobile.webp +0 -0
  27. package/dist/assets/backgrounds/monolith-field-light.svg +58 -0
  28. package/dist/assets/backgrounds/optical-fog-dark-desktop.avif +0 -0
  29. package/dist/assets/backgrounds/optical-fog-dark-desktop.webp +0 -0
  30. package/dist/assets/backgrounds/optical-fog-dark-mobile.avif +0 -0
  31. package/dist/assets/backgrounds/optical-fog-dark-mobile.webp +0 -0
  32. package/dist/assets/backgrounds/optical-fog-dark.svg +50 -0
  33. package/dist/assets/backgrounds/optical-fog-light-desktop.avif +0 -0
  34. package/dist/assets/backgrounds/optical-fog-light-desktop.webp +0 -0
  35. package/dist/assets/backgrounds/optical-fog-light-mobile.avif +0 -0
  36. package/dist/assets/backgrounds/optical-fog-light-mobile.webp +0 -0
  37. package/dist/assets/backgrounds/optical-fog-light.svg +50 -0
  38. package/dist/assets/backgrounds/orbital-field-dark-desktop.avif +0 -0
  39. package/dist/assets/backgrounds/orbital-field-dark-desktop.webp +0 -0
  40. package/dist/assets/backgrounds/orbital-field-dark-mobile.avif +0 -0
  41. package/dist/assets/backgrounds/orbital-field-dark-mobile.webp +0 -0
  42. package/dist/assets/backgrounds/orbital-field-dark.svg +49 -0
  43. package/dist/assets/backgrounds/orbital-field-light-desktop.avif +0 -0
  44. package/dist/assets/backgrounds/orbital-field-light-desktop.webp +0 -0
  45. package/dist/assets/backgrounds/orbital-field-light-mobile.avif +0 -0
  46. package/dist/assets/backgrounds/orbital-field-light-mobile.webp +0 -0
  47. package/dist/assets/backgrounds/orbital-field-light.svg +49 -0
  48. package/dist/assets/backgrounds/signal-lattice-dark-desktop.avif +0 -0
  49. package/dist/assets/backgrounds/signal-lattice-dark-desktop.webp +0 -0
  50. package/dist/assets/backgrounds/signal-lattice-dark-mobile.avif +0 -0
  51. package/dist/assets/backgrounds/signal-lattice-dark-mobile.webp +0 -0
  52. package/dist/assets/backgrounds/signal-lattice-dark.svg +39 -0
  53. package/dist/assets/backgrounds/signal-lattice-light-desktop.avif +0 -0
  54. package/dist/assets/backgrounds/signal-lattice-light-desktop.webp +0 -0
  55. package/dist/assets/backgrounds/signal-lattice-light-mobile.avif +0 -0
  56. package/dist/assets/backgrounds/signal-lattice-light-mobile.webp +0 -0
  57. package/dist/assets/backgrounds/signal-lattice-light.svg +39 -0
  58. package/dist/background-assets.d.ts +144 -0
  59. package/dist/backgrounds.cjs +2 -0
  60. package/dist/backgrounds.cjs.map +1 -0
  61. package/dist/backgrounds.css +463 -0
  62. package/dist/backgrounds.d.ts +44 -0
  63. package/dist/backgrounds.js +256 -0
  64. package/dist/backgrounds.js.map +1 -0
  65. package/dist/catalog.cjs +2 -0
  66. package/dist/catalog.cjs.map +1 -0
  67. package/dist/catalog.d.ts +27 -0
  68. package/dist/catalog.js +307 -0
  69. package/dist/catalog.js.map +1 -0
  70. package/dist/collections-CXPc6huw.cjs +2 -0
  71. package/dist/collections-CXPc6huw.cjs.map +1 -0
  72. package/dist/collections-GglQdMPr.js +1308 -0
  73. package/dist/collections-GglQdMPr.js.map +1 -0
  74. package/dist/collections.d.ts +52 -0
  75. package/dist/command-palette-B4r2GzmF.cjs +2 -0
  76. package/dist/command-palette-B4r2GzmF.cjs.map +1 -0
  77. package/dist/command-palette-DwfgljM2.js +2773 -0
  78. package/dist/command-palette-DwfgljM2.js.map +1 -0
  79. package/dist/command-palette.d.ts +26 -0
  80. package/dist/core.cjs +2 -0
  81. package/dist/core.cjs.map +1 -0
  82. package/dist/core.css +8659 -0
  83. package/dist/core.d.ts +19 -0
  84. package/dist/core.js +176 -0
  85. package/dist/core.js.map +1 -0
  86. package/dist/data-grid.d.ts +62 -0
  87. package/dist/data-workbench.d.ts +103 -0
  88. package/dist/data.cjs +2 -0
  89. package/dist/data.cjs.map +1 -0
  90. package/dist/data.d.ts +6 -0
  91. package/dist/data.js +19 -0
  92. package/dist/data.js.map +1 -0
  93. package/dist/description-list.d.ts +8 -0
  94. package/dist/effects.cjs +2 -0
  95. package/dist/effects.cjs.map +1 -0
  96. package/dist/effects.css +442 -0
  97. package/dist/effects.d.ts +2 -0
  98. package/dist/effects.js +19 -0
  99. package/dist/effects.js.map +1 -0
  100. package/dist/feedback.d.ts +40 -0
  101. package/dist/forms.d.ts +89 -0
  102. package/dist/harness-D7tlTUb2.cjs +2 -0
  103. package/dist/harness-D7tlTUb2.cjs.map +1 -0
  104. package/dist/harness-Dcqe3-AP.js +2282 -0
  105. package/dist/harness-Dcqe3-AP.js.map +1 -0
  106. package/dist/harness.d.ts +89 -0
  107. package/dist/hooks.d.ts +6 -0
  108. package/dist/image-effects-BaXRloLB.js +164 -0
  109. package/dist/image-effects-BaXRloLB.js.map +1 -0
  110. package/dist/image-effects-D57JACXp.cjs +2 -0
  111. package/dist/image-effects-D57JACXp.cjs.map +1 -0
  112. package/dist/image-effects.d.ts +14 -0
  113. package/dist/index.cjs +2 -0
  114. package/dist/index.cjs.map +1 -0
  115. package/dist/index.d.ts +5 -0
  116. package/dist/index.js +239 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/locale.d.ts +358 -0
  119. package/dist/motion-effects-C1Rs4a2H.js +449 -0
  120. package/dist/motion-effects-C1Rs4a2H.js.map +1 -0
  121. package/dist/motion-effects-ze3SOVGs.cjs +2 -0
  122. package/dist/motion-effects-ze3SOVGs.cjs.map +1 -0
  123. package/dist/motion-effects.d.ts +76 -0
  124. package/dist/nav-menu.d.ts +45 -0
  125. package/dist/navigation-BG-qLyKt.cjs +2 -0
  126. package/dist/navigation-BG-qLyKt.cjs.map +1 -0
  127. package/dist/navigation-Bp7q1n-5.js +252 -0
  128. package/dist/navigation-Bp7q1n-5.js.map +1 -0
  129. package/dist/navigation.d.ts +53 -0
  130. package/dist/overlays-BhrWwlkN.js +1288 -0
  131. package/dist/overlays-BhrWwlkN.js.map +1 -0
  132. package/dist/overlays-DvozzH8D.cjs +2 -0
  133. package/dist/overlays-DvozzH8D.cjs.map +1 -0
  134. package/dist/overlays.d.ts +92 -0
  135. package/dist/people-picker.d.ts +65 -0
  136. package/dist/portal.d.ts +3 -0
  137. package/dist/primitives-Bb7v-uZh.js +217 -0
  138. package/dist/primitives-Bb7v-uZh.js.map +1 -0
  139. package/dist/primitives-CEcOVwUM.cjs +2 -0
  140. package/dist/primitives-CEcOVwUM.cjs.map +1 -0
  141. package/dist/primitives.d.ts +66 -0
  142. package/dist/rounded-card-border-B3d1HqwY.js +185 -0
  143. package/dist/rounded-card-border-B3d1HqwY.js.map +1 -0
  144. package/dist/rounded-card-border-CMiEPJIF.cjs +2 -0
  145. package/dist/rounded-card-border-CMiEPJIF.cjs.map +1 -0
  146. package/dist/rounded-card-border.d.ts +3 -0
  147. package/dist/sizes.d.ts +4 -0
  148. package/dist/status-toast.d.ts +20 -0
  149. package/dist/styles.css +9566 -0
  150. package/dist/theme-C3i6xkHd.cjs +2 -0
  151. package/dist/theme-C3i6xkHd.cjs.map +1 -0
  152. package/dist/theme-CHYnSgLv.js +914 -0
  153. package/dist/theme-CHYnSgLv.js.map +1 -0
  154. package/dist/theme.d.ts +24 -0
  155. package/dist/timeline.d.ts +15 -0
  156. package/dist/tree-view-Djlqyml-.js +132 -0
  157. package/dist/tree-view-Djlqyml-.js.map +1 -0
  158. package/dist/tree-view-iVh5jMNt.cjs +2 -0
  159. package/dist/tree-view-iVh5jMNt.cjs.map +1 -0
  160. package/dist/tree-view.d.ts +18 -0
  161. package/dist/utils.d.ts +2 -0
  162. package/package.json +162 -4
@@ -0,0 +1,2773 @@
1
+ import { jsx as e, jsxs as d, Fragment as De } from "react/jsx-runtime";
2
+ import { forwardRef as ue, useEffect as H, useState as A, useRef as Y, useId as me, useMemo as Z, useImperativeHandle as gn, useCallback as te, useContext as Fa, createContext as bn } from "react";
3
+ import { Info as vn, TriangleAlert as _n, XCircle as Nn, CheckCircle2 as yn, X as Ie, ChevronLeft as ua, ChevronRight as Le, ChevronDown as je, CalendarDays as Ta, UploadCloud as Cn, FileText as kn, Search as Me, Check as Ye, FileUp as wn, FolderTree as qe, Users as ta, UserRound as zn, AlertCircle as ra, PanelLeftOpen as Sn, PanelLeftClose as xn, Menu as Mn, Command as Dn } from "lucide-react";
4
+ import { u as U, c as E } from "./theme-CHYnSgLv.js";
5
+ import { aR as W, al as pe, ap as ge, aS as J, ao as be, s as ma, j as sa, S as Ln, Z as En, U as On, Y as In, at as An, l as xe, ac as Oe, ax as Re, B as Oa, K as $n, M as Pn, Q as Fn, N as Tn } from "./overlays-BhrWwlkN.js";
6
+ import * as de from "@radix-ui/react-navigation-menu";
7
+ import { K as Ia } from "./primitives-Bb7v-uZh.js";
8
+ const Bn = {
9
+ success: yn,
10
+ error: Nn,
11
+ warning: _n,
12
+ info: vn
13
+ };
14
+ function Rn({
15
+ item: a,
16
+ duration: n,
17
+ onDismiss: l
18
+ }) {
19
+ const { messages: i } = U(), [s, o] = A(1), [m, g] = A(!1), C = Y(n), N = Y(0), b = Y(null), p = Y(null), c = Y(l);
20
+ c.current = l;
21
+ const v = Number.isFinite(n) && n > 0, f = Bn[a.tone], r = () => {
22
+ b.current !== null && window.cancelAnimationFrame(b.current), p.current !== null && window.clearTimeout(p.current), b.current = null, p.current = null;
23
+ }, u = () => {
24
+ m || (r(), g(!0), p.current = window.setTimeout(() => c.current?.(a.id), 260));
25
+ }, _ = (w) => {
26
+ if (!v || w <= 0) return;
27
+ N.current = performance.now();
28
+ const L = (P) => {
29
+ const I = Math.max(0, w - (P - N.current));
30
+ if (o(I / n), I <= 0) {
31
+ u();
32
+ return;
33
+ }
34
+ b.current = window.requestAnimationFrame(L);
35
+ };
36
+ b.current = window.requestAnimationFrame(L);
37
+ };
38
+ H(() => (C.current = n, o(1), g(!1), _(n), r), [n, a.id]);
39
+ const z = () => {
40
+ !v || m || (b.current !== null && window.cancelAnimationFrame(b.current), b.current = null, C.current = Math.max(
41
+ 0,
42
+ C.current - (performance.now() - N.current)
43
+ ));
44
+ }, k = () => {
45
+ !v || m || C.current <= 0 || _(C.current);
46
+ };
47
+ return /* @__PURE__ */ d(
48
+ "div",
49
+ {
50
+ className: "mf-status-toast",
51
+ "data-tone": a.tone,
52
+ "data-state": m ? "closing" : "open",
53
+ role: "status",
54
+ "aria-live": "polite",
55
+ onMouseEnter: z,
56
+ onMouseLeave: k,
57
+ onFocus: z,
58
+ onBlur: (w) => {
59
+ w.currentTarget.contains(w.relatedTarget) || k();
60
+ },
61
+ children: [
62
+ /* @__PURE__ */ e(f, { className: "mf-status-toast__icon", size: 18, "aria-hidden": "true" }),
63
+ /* @__PURE__ */ d("div", { className: "mf-status-toast__body", children: [
64
+ /* @__PURE__ */ e("strong", { className: "mf-status-toast__title", children: a.title }),
65
+ a.message ? /* @__PURE__ */ e("span", { className: "mf-status-toast__message", children: a.message }) : null,
66
+ a.action ? /* @__PURE__ */ e("div", { className: "mf-status-toast__action", children: a.action }) : null
67
+ ] }),
68
+ /* @__PURE__ */ e(
69
+ "button",
70
+ {
71
+ type: "button",
72
+ className: "mf-status-toast__close",
73
+ "aria-label": i.overlays.closeNotification,
74
+ onClick: u,
75
+ children: /* @__PURE__ */ e(Ie, { size: 12, "aria-hidden": "true" })
76
+ }
77
+ ),
78
+ v ? /* @__PURE__ */ e(
79
+ "span",
80
+ {
81
+ className: "mf-status-toast__progress",
82
+ "aria-hidden": "true",
83
+ style: { transform: `scaleX(${s})` }
84
+ }
85
+ ) : null
86
+ ]
87
+ }
88
+ );
89
+ }
90
+ const Kn = ue(
91
+ ({
92
+ items: a,
93
+ onDismiss: n,
94
+ defaultDuration: l = 5e3,
95
+ maxVisible: i = 5,
96
+ position: s = "top-right",
97
+ fixed: o = !1,
98
+ label: m,
99
+ className: g,
100
+ ...C
101
+ }, N) => {
102
+ const { messages: b } = U();
103
+ return H(() => {
104
+ for (const p of a.slice(i)) n?.(p.id);
105
+ }, [a, i, n]), /* @__PURE__ */ e(
106
+ "div",
107
+ {
108
+ ref: N,
109
+ className: E("mf-status-toast-stack", g),
110
+ "data-position": s,
111
+ "data-fixed": o || void 0,
112
+ role: "log",
113
+ "aria-live": "polite",
114
+ "aria-label": m ?? b.common.notification,
115
+ ...C,
116
+ children: a.slice(0, i).map((p) => /* @__PURE__ */ e(
117
+ Rn,
118
+ {
119
+ item: p,
120
+ duration: p.duration ?? l,
121
+ onDismiss: n
122
+ },
123
+ p.id
124
+ ))
125
+ }
126
+ );
127
+ }
128
+ );
129
+ Kn.displayName = "StatusToastStack";
130
+ function Un(a, n) {
131
+ return Z(() => {
132
+ const l = n.trim().toLocaleLowerCase();
133
+ return l ? a.filter(
134
+ (i) => i.label.toLocaleLowerCase().includes(l) || i.description?.toLocaleLowerCase().includes(l)
135
+ ) : a;
136
+ }, [a, n]);
137
+ }
138
+ function Ba({
139
+ options: a,
140
+ selected: n,
141
+ multiple: l = !1,
142
+ query: i,
143
+ searchPlaceholder: s,
144
+ onQueryChange: o,
145
+ onToggle: m
146
+ }) {
147
+ const { messages: g } = U(), C = me().replaceAll(":", ""), N = Un(a, i), [b, p] = A(0), c = (f) => `${C}-option-${f}`;
148
+ return H(() => p(0), [i]), /* @__PURE__ */ d("div", { className: "mf-combobox__panel", children: [
149
+ /* @__PURE__ */ d("div", { className: "mf-combobox__search", children: [
150
+ /* @__PURE__ */ e(Me, { size: 14, "aria-hidden": "true" }),
151
+ /* @__PURE__ */ e(
152
+ "input",
153
+ {
154
+ autoFocus: !0,
155
+ role: "combobox",
156
+ value: i,
157
+ onChange: (f) => o(f.target.value),
158
+ onKeyDown: (f) => {
159
+ f.key === "ArrowDown" ? (f.preventDefault(), p((r) => Math.min(N.length - 1, r + 1))) : f.key === "ArrowUp" ? (f.preventDefault(), p((r) => Math.max(0, r - 1))) : f.key === "Enter" && N[b] && !N[b].disabled && (f.preventDefault(), m(N[b].value));
160
+ },
161
+ placeholder: s ?? g.forms.searchOptions,
162
+ "aria-label": s ?? g.forms.searchOptions,
163
+ "aria-haspopup": "listbox",
164
+ "aria-expanded": "true",
165
+ "aria-controls": C,
166
+ "aria-activedescendant": N[b] ? c(b) : void 0
167
+ }
168
+ )
169
+ ] }),
170
+ /* @__PURE__ */ e(
171
+ "div",
172
+ {
173
+ className: "mf-combobox__options",
174
+ id: C,
175
+ role: "listbox",
176
+ "aria-multiselectable": l,
177
+ children: N.length ? N.map((f, r) => {
178
+ const u = n.includes(f.value);
179
+ return /* @__PURE__ */ d(
180
+ "button",
181
+ {
182
+ id: c(r),
183
+ type: "button",
184
+ role: "option",
185
+ "aria-selected": u,
186
+ className: E(
187
+ "mf-combobox__option",
188
+ r === b && "is-active"
189
+ ),
190
+ disabled: f.disabled,
191
+ onMouseEnter: () => p(r),
192
+ onClick: () => m(f.value),
193
+ children: [
194
+ /* @__PURE__ */ d("span", { className: "mf-combobox__option-copy", children: [
195
+ /* @__PURE__ */ e("span", { children: f.label }),
196
+ f.description ? /* @__PURE__ */ e("small", { children: f.description }) : null
197
+ ] }),
198
+ u ? /* @__PURE__ */ e(Ye, { size: 13, "aria-hidden": "true" }) : null
199
+ ]
200
+ },
201
+ f.value
202
+ );
203
+ }) : /* @__PURE__ */ e("div", { className: "mf-combobox__empty", children: g.forms.noMatchingOptions })
204
+ }
205
+ )
206
+ ] });
207
+ }
208
+ function gt({
209
+ options: a,
210
+ value: n,
211
+ defaultValue: l,
212
+ onValueChange: i,
213
+ placeholder: s,
214
+ searchPlaceholder: o,
215
+ disabled: m,
216
+ size: g,
217
+ className: C,
218
+ ...N
219
+ }) {
220
+ const { messages: b } = U(), [p, c] = A(!1), [v, f] = A(""), [r, u] = W({
221
+ value: n,
222
+ defaultValue: l,
223
+ onChange: i
224
+ }), _ = a.find((w) => w.value === r), z = _?.label ?? s ?? b.forms.selectOption, k = N["aria-label"] ? `${N["aria-label"]}: ${z}` : void 0;
225
+ return /* @__PURE__ */ d(pe, { open: p, onOpenChange: c, children: [
226
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ d(
227
+ "button",
228
+ {
229
+ type: "button",
230
+ className: E("mf-combobox__trigger", J(g), C),
231
+ disabled: m,
232
+ ...N,
233
+ "aria-label": k,
234
+ children: [
235
+ /* @__PURE__ */ e("span", { className: E(!_ && "is-placeholder"), children: z }),
236
+ /* @__PURE__ */ e(je, { size: 14, "aria-hidden": "true" })
237
+ ]
238
+ }
239
+ ) }),
240
+ /* @__PURE__ */ e(be, { className: "mf-combobox__content", align: "start", children: /* @__PURE__ */ e(
241
+ Ba,
242
+ {
243
+ options: a,
244
+ selected: r ? [r] : [],
245
+ query: v,
246
+ searchPlaceholder: o,
247
+ onQueryChange: f,
248
+ onToggle: (w) => {
249
+ u(w), c(!1);
250
+ }
251
+ }
252
+ ) })
253
+ ] });
254
+ }
255
+ function bt({
256
+ options: a,
257
+ value: n,
258
+ defaultValue: l = [],
259
+ onValueChange: i,
260
+ placeholder: s,
261
+ disabled: o,
262
+ size: m,
263
+ maxDisplay: g = 2,
264
+ className: C,
265
+ ...N
266
+ }) {
267
+ const { messages: b } = U(), [p, c] = A(!1), [v, f] = A(""), [r, u] = W({
268
+ value: n,
269
+ defaultValue: l,
270
+ onChange: i
271
+ }), _ = r.map((w) => a.find((L) => L.value === w)?.label).filter(Boolean), z = _.length ? `${_.slice(0, g).join(", ")}${_.length > g ? ` +${_.length - g}` : ""}` : s ?? b.forms.selectOptions, k = N["aria-label"] ? `${N["aria-label"]}: ${z}` : void 0;
272
+ return /* @__PURE__ */ d(pe, { open: p, onOpenChange: c, children: [
273
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ d(
274
+ "button",
275
+ {
276
+ type: "button",
277
+ className: E("mf-combobox__trigger", J(m), C),
278
+ disabled: o,
279
+ ...N,
280
+ "aria-label": k,
281
+ children: [
282
+ /* @__PURE__ */ e("span", { className: E(!r.length && "is-placeholder"), children: z }),
283
+ /* @__PURE__ */ e(je, { size: 14, "aria-hidden": "true" })
284
+ ]
285
+ }
286
+ ) }),
287
+ /* @__PURE__ */ d(be, { className: "mf-combobox__content", align: "start", children: [
288
+ /* @__PURE__ */ e(
289
+ Ba,
290
+ {
291
+ multiple: !0,
292
+ options: a,
293
+ selected: r,
294
+ query: v,
295
+ onQueryChange: f,
296
+ onToggle: (w) => u(
297
+ (L) => L.includes(w) ? L.filter((P) => P !== w) : [...L, w]
298
+ )
299
+ }
300
+ ),
301
+ /* @__PURE__ */ d("div", { className: "mf-combobox__footer", children: [
302
+ /* @__PURE__ */ e("span", { children: b.common.selectedCount(r.length) }),
303
+ /* @__PURE__ */ e("button", { type: "button", onClick: () => u([]), children: b.forms.clearSelection })
304
+ ] })
305
+ ] })
306
+ ] });
307
+ }
308
+ function vt({
309
+ value: a,
310
+ defaultValue: n = [],
311
+ onValueChange: l,
312
+ maxTags: i = Number.POSITIVE_INFINITY,
313
+ placeholder: s,
314
+ disabled: o,
315
+ size: m,
316
+ className: g,
317
+ ...C
318
+ }) {
319
+ const { messages: N } = U(), [b, p] = W({
320
+ value: a,
321
+ defaultValue: n,
322
+ onChange: l
323
+ }), [c, v] = A(""), f = Y(null), r = (u) => {
324
+ const _ = u.trim().replace(/,$/, "");
325
+ if (!_ || b.includes(_) || b.length >= i) {
326
+ v("");
327
+ return;
328
+ }
329
+ p([...b, _]), v("");
330
+ };
331
+ return (
332
+ // The nested input owns interaction; this wrapper click only redirects focus to it.
333
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
334
+ /* @__PURE__ */ d(
335
+ "div",
336
+ {
337
+ className: E(
338
+ "mf-tag-input",
339
+ J(m),
340
+ o && "is-disabled",
341
+ g
342
+ ),
343
+ onClick: () => f.current?.focus(),
344
+ children: [
345
+ b.map((u) => /* @__PURE__ */ d("span", { className: "mf-tag-input__tag", children: [
346
+ u,
347
+ /* @__PURE__ */ e(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ "aria-label": N.forms.removeTag(u),
352
+ disabled: o,
353
+ onClick: (_) => {
354
+ _.stopPropagation(), p(b.filter((z) => z !== u));
355
+ },
356
+ children: /* @__PURE__ */ e(Ie, { size: 10, "aria-hidden": "true" })
357
+ }
358
+ )
359
+ ] }, u)),
360
+ /* @__PURE__ */ e(
361
+ "input",
362
+ {
363
+ ref: f,
364
+ className: "mf-tag-input__field",
365
+ value: c,
366
+ placeholder: b.length ? "" : s ?? N.forms.addTag,
367
+ disabled: o || b.length >= i,
368
+ ...C,
369
+ onChange: (u) => v(u.target.value),
370
+ onKeyDown: (u) => {
371
+ u.key === "Enter" || u.key === "," ? (u.preventDefault(), r(c)) : u.key === "Backspace" && !c && b.length && p(b.slice(0, -1));
372
+ },
373
+ onBlur: () => c && r(c)
374
+ }
375
+ )
376
+ ]
377
+ }
378
+ )
379
+ );
380
+ }
381
+ function la(a) {
382
+ return a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB`;
383
+ }
384
+ function Aa(a, n) {
385
+ const l = n?.split(",").map((o) => o.trim().toLowerCase()).filter(Boolean);
386
+ if (!l?.length) return !0;
387
+ const i = a.name.toLowerCase(), s = a.type.toLowerCase();
388
+ return l.some((o) => o.startsWith(".") ? i.endsWith(o) : o.endsWith("/*") ? s.startsWith(o.slice(0, -1)) : s === o);
389
+ }
390
+ function _t({
391
+ value: a,
392
+ defaultValue: n = [],
393
+ onFilesChange: l,
394
+ accept: i,
395
+ multiple: s = !0,
396
+ maxSize: o = 10 * 1024 * 1024,
397
+ disabled: m,
398
+ className: g,
399
+ label: C,
400
+ description: N,
401
+ size: b
402
+ }) {
403
+ const { messages: p } = U(), c = me(), v = Y(null), [f, r] = W({
404
+ value: a,
405
+ defaultValue: n,
406
+ onChange: l
407
+ }), [u, _] = A(!1), [z, k] = A(""), w = (P) => {
408
+ const I = Array.from(P), D = I.find((T) => T.size > o), $ = I.find((T) => !Aa(T, i)), Q = I.filter(
409
+ (T) => T.size <= o && Aa(T, i)
410
+ );
411
+ k($ ? p.forms.fileTypeNotAllowed($.name) : D ? p.forms.filesTooLarge(la(o)) : ""), Q.length && r(s ? [...f, ...Q] : Q.slice(0, 1));
412
+ }, L = (P) => {
413
+ P.preventDefault(), _(!1), m || w(P.dataTransfer.files);
414
+ };
415
+ return /* @__PURE__ */ d(
416
+ "div",
417
+ {
418
+ className: E(
419
+ "mf-upload",
420
+ J(b),
421
+ m && "is-disabled",
422
+ g
423
+ ),
424
+ children: [
425
+ /* @__PURE__ */ d(
426
+ "label",
427
+ {
428
+ htmlFor: c,
429
+ className: E("mf-upload__dropzone", u && "is-dragging"),
430
+ onDragOver: (P) => {
431
+ P.preventDefault(), m || _(!0);
432
+ },
433
+ onDragLeave: () => _(!1),
434
+ onDrop: L,
435
+ children: [
436
+ /* @__PURE__ */ e(
437
+ "input",
438
+ {
439
+ ref: v,
440
+ id: c,
441
+ className: "mf-upload__input",
442
+ type: "file",
443
+ accept: i,
444
+ multiple: s,
445
+ disabled: m,
446
+ onChange: (P) => {
447
+ P.target.files && w(P.target.files), v.current && (v.current.value = "");
448
+ }
449
+ }
450
+ ),
451
+ /* @__PURE__ */ e("span", { className: "mf-upload__icon", children: /* @__PURE__ */ e(Cn, { size: 20, "aria-hidden": "true" }) }),
452
+ /* @__PURE__ */ e("strong", { children: C ?? p.forms.uploadFiles }),
453
+ /* @__PURE__ */ e("span", { children: N ?? p.forms.uploadDescription }),
454
+ /* @__PURE__ */ e("small", { children: p.forms.maxFileSize(la(o)) })
455
+ ]
456
+ }
457
+ ),
458
+ f.length ? /* @__PURE__ */ e("ul", { className: "mf-upload__list", "aria-label": p.forms.selectedFiles, children: f.map((P, I) => /* @__PURE__ */ d("li", { children: [
459
+ /* @__PURE__ */ e(kn, { size: 14, "aria-hidden": "true" }),
460
+ /* @__PURE__ */ e("span", { children: P.name }),
461
+ /* @__PURE__ */ e("small", { children: la(P.size) }),
462
+ /* @__PURE__ */ e(
463
+ "button",
464
+ {
465
+ type: "button",
466
+ "aria-label": p.forms.removeFile(P.name),
467
+ disabled: m,
468
+ onClick: () => r(f.filter((D, $) => $ !== I)),
469
+ children: /* @__PURE__ */ e(Ie, { size: 12, "aria-hidden": "true" })
470
+ }
471
+ )
472
+ ] }, `${P.name}-${P.lastModified}-${I}`)) }) : null,
473
+ z ? /* @__PURE__ */ e("p", { className: "mf-upload__error", role: "alert", children: z }) : null
474
+ ]
475
+ }
476
+ );
477
+ }
478
+ function qn(a) {
479
+ return new Date(a.getFullYear(), a.getMonth(), 1);
480
+ }
481
+ function Qe(a, n) {
482
+ return new Date(a.getFullYear(), a.getMonth() + n, 1);
483
+ }
484
+ function ia(a, n) {
485
+ return new Date(a.getFullYear(), a.getMonth(), a.getDate() + n);
486
+ }
487
+ function fa(a) {
488
+ return a.toLowerCase().startsWith("zh") ? 1 : 0;
489
+ }
490
+ function Ke(a, n) {
491
+ return !!(a && n && a.getFullYear() === n.getFullYear() && a.getMonth() === n.getMonth() && a.getDate() === n.getDate());
492
+ }
493
+ function Vn(a) {
494
+ return `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}-${String(a.getDate()).padStart(2, "0")}`;
495
+ }
496
+ function Qn(a, n = "zh-CN") {
497
+ return a ? new Intl.DateTimeFormat(n, {
498
+ year: "numeric",
499
+ month: "short",
500
+ day: "numeric"
501
+ }).format(a) : "";
502
+ }
503
+ function Ra({
504
+ month: a,
505
+ selected: n,
506
+ range: l,
507
+ onSelect: i,
508
+ disabledDate: s,
509
+ locale: o,
510
+ weekStartsOn: m
511
+ }) {
512
+ const g = qn(a), C = (g.getDay() - m + 7) % 7, N = ia(g, -C), b = Array.from(
513
+ { length: 42 },
514
+ (v, f) => ia(g, f - C)
515
+ ), p = Array.from(
516
+ { length: 7 },
517
+ (v, f) => new Intl.DateTimeFormat(o, { weekday: "narrow" }).format(
518
+ ia(N, f)
519
+ )
520
+ ), c = /* @__PURE__ */ new Date();
521
+ return /* @__PURE__ */ d(
522
+ "div",
523
+ {
524
+ className: "mf-calendar__grid",
525
+ "aria-label": new Intl.DateTimeFormat(o, {
526
+ month: "long",
527
+ year: "numeric"
528
+ }).format(a),
529
+ children: [
530
+ p.map((v, f) => /* @__PURE__ */ e("span", { className: "mf-calendar__weekday", children: v }, `${v}-${f}`)),
531
+ b.map((v) => {
532
+ const f = v.getMonth() !== a.getMonth(), r = Ke(v, n), u = Ke(v, l?.from), _ = Ke(v, l?.to), z = !!(l?.from && l?.to && v > l.from && v < l.to), k = s?.(v);
533
+ return /* @__PURE__ */ e(
534
+ "button",
535
+ {
536
+ type: "button",
537
+ className: E(
538
+ "mf-calendar__day",
539
+ f && "is-outside",
540
+ Ke(v, c) && "is-today",
541
+ (r || u || _) && "is-selected",
542
+ z && "is-in-range"
543
+ ),
544
+ disabled: k,
545
+ "aria-label": Qn(v, o),
546
+ "aria-pressed": r || u || _,
547
+ onClick: () => i(v),
548
+ children: v.getDate()
549
+ },
550
+ Vn(v)
551
+ );
552
+ })
553
+ ]
554
+ }
555
+ );
556
+ }
557
+ function jn({
558
+ value: a,
559
+ defaultValue: n,
560
+ onValueChange: l,
561
+ month: i,
562
+ defaultMonth: s,
563
+ onMonthChange: o,
564
+ disabledDate: m,
565
+ locale: g,
566
+ weekStartsOn: C,
567
+ className: N
568
+ }) {
569
+ const { locale: b, messages: p } = U(), c = g ?? b, v = C ?? fa(c), [f, r] = W({
570
+ value: a,
571
+ defaultValue: n,
572
+ onChange: l
573
+ }), [u, _] = W({
574
+ value: i,
575
+ defaultValue: s ?? f ?? /* @__PURE__ */ new Date(),
576
+ onChange: o
577
+ });
578
+ return /* @__PURE__ */ d("div", { className: E("mf-calendar", N), children: [
579
+ /* @__PURE__ */ d("div", { className: "mf-calendar__header", children: [
580
+ /* @__PURE__ */ e(
581
+ "button",
582
+ {
583
+ type: "button",
584
+ "aria-label": p.forms.previousMonth,
585
+ onClick: () => _(Qe(u, -1)),
586
+ children: /* @__PURE__ */ e(ua, { size: 14, "aria-hidden": "true" })
587
+ }
588
+ ),
589
+ /* @__PURE__ */ e("strong", { children: new Intl.DateTimeFormat(c, {
590
+ month: "long",
591
+ year: "numeric"
592
+ }).format(u) }),
593
+ /* @__PURE__ */ e(
594
+ "button",
595
+ {
596
+ type: "button",
597
+ "aria-label": p.forms.nextMonth,
598
+ onClick: () => _(Qe(u, 1)),
599
+ children: /* @__PURE__ */ e(Le, { size: 14, "aria-hidden": "true" })
600
+ }
601
+ )
602
+ ] }),
603
+ /* @__PURE__ */ e(
604
+ Ra,
605
+ {
606
+ month: u,
607
+ selected: f,
608
+ onSelect: r,
609
+ disabledDate: m,
610
+ locale: c,
611
+ weekStartsOn: v
612
+ }
613
+ )
614
+ ] });
615
+ }
616
+ function Nt({
617
+ value: a,
618
+ defaultValue: n,
619
+ defaultMonth: l,
620
+ onValueChange: i,
621
+ placeholder: s,
622
+ disabled: o,
623
+ size: m,
624
+ locale: g,
625
+ weekStartsOn: C,
626
+ disabledDate: N,
627
+ className: b,
628
+ ...p
629
+ }) {
630
+ const { locale: c, messages: v } = U(), f = g ?? c, r = C ?? fa(f), u = (I, D) => new Intl.DateTimeFormat(f, D).format(I), [_, z] = A(!1), [k, w] = W({
631
+ value: a,
632
+ defaultValue: n,
633
+ onChange: i
634
+ }), L = k ? u(k, { year: "numeric", month: "short", day: "numeric" }) : s ?? v.forms.selectDate, P = p["aria-label"] ? `${p["aria-label"]}: ${L}` : void 0;
635
+ return /* @__PURE__ */ d(pe, { open: _, onOpenChange: z, children: [
636
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ d(
637
+ "button",
638
+ {
639
+ type: "button",
640
+ className: E("mf-datepicker__trigger", J(m), b),
641
+ disabled: o,
642
+ ...p,
643
+ "aria-label": P,
644
+ children: [
645
+ /* @__PURE__ */ e(Ta, { size: 14, "aria-hidden": "true" }),
646
+ /* @__PURE__ */ e("span", { className: E(!k && "is-placeholder"), children: L })
647
+ ]
648
+ }
649
+ ) }),
650
+ /* @__PURE__ */ d(be, { className: "mf-datepicker__content", align: "start", children: [
651
+ /* @__PURE__ */ e(
652
+ jn,
653
+ {
654
+ value: k,
655
+ defaultMonth: l ?? k,
656
+ locale: f,
657
+ disabledDate: N,
658
+ weekStartsOn: r,
659
+ onValueChange: (I) => {
660
+ w(I), I && z(!1);
661
+ }
662
+ }
663
+ ),
664
+ k ? /* @__PURE__ */ e(
665
+ "button",
666
+ {
667
+ type: "button",
668
+ className: "mf-datepicker__clear",
669
+ onClick: () => {
670
+ w(void 0), z(!1);
671
+ },
672
+ children: v.forms.clearDate
673
+ }
674
+ ) : null
675
+ ] })
676
+ ] });
677
+ }
678
+ function yt({
679
+ value: a,
680
+ defaultValue: n = {},
681
+ onValueChange: l,
682
+ placeholder: i,
683
+ disabled: s,
684
+ size: o,
685
+ locale: m,
686
+ weekStartsOn: g,
687
+ disabledDate: C,
688
+ className: N,
689
+ ...b
690
+ }) {
691
+ const { locale: p, messages: c } = U(), v = m ?? p, f = g ?? fa(v), r = ($, Q) => new Intl.DateTimeFormat(v, Q).format($), [u, _] = A(!1), [z, k] = W({
692
+ value: a,
693
+ defaultValue: n,
694
+ onChange: l
695
+ }), [w, L] = A(z.from ?? /* @__PURE__ */ new Date()), P = ($) => {
696
+ !z.from || z.to ? k({ from: $ }) : $ < z.from ? (k({ from: $, to: z.from }), _(!1)) : (k({ from: z.from, to: $ }), _(!1));
697
+ }, I = z.from ? `${r(z.from, {
698
+ year: "numeric",
699
+ month: "short",
700
+ day: "numeric"
701
+ })}${z.to ? ` – ${r(z.to, {
702
+ year: "numeric",
703
+ month: "short",
704
+ day: "numeric"
705
+ })}` : ""}` : i ?? c.forms.selectDateRange, D = b["aria-label"] ? `${b["aria-label"]}: ${I}` : void 0;
706
+ return /* @__PURE__ */ d(pe, { open: u, onOpenChange: _, children: [
707
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ d(
708
+ "button",
709
+ {
710
+ type: "button",
711
+ className: E("mf-datepicker__trigger", J(o), N),
712
+ disabled: s,
713
+ ...b,
714
+ "aria-label": D,
715
+ children: [
716
+ /* @__PURE__ */ e(Ta, { size: 14, "aria-hidden": "true" }),
717
+ /* @__PURE__ */ e("span", { className: E(!z.from && "is-placeholder"), children: I })
718
+ ]
719
+ }
720
+ ) }),
721
+ /* @__PURE__ */ d(be, { className: "mf-datepicker__content", align: "start", children: [
722
+ /* @__PURE__ */ d("div", { className: "mf-datepicker__range-heading", children: [
723
+ /* @__PURE__ */ e(
724
+ "button",
725
+ {
726
+ type: "button",
727
+ "aria-label": c.forms.previousMonth,
728
+ onClick: () => L(Qe(w, -1)),
729
+ children: /* @__PURE__ */ e(ua, { size: 14, "aria-hidden": "true" })
730
+ }
731
+ ),
732
+ /* @__PURE__ */ e("strong", { children: new Intl.DateTimeFormat(v, {
733
+ month: "long",
734
+ year: "numeric"
735
+ }).format(w) }),
736
+ /* @__PURE__ */ e(
737
+ "button",
738
+ {
739
+ type: "button",
740
+ "aria-label": c.forms.nextMonth,
741
+ onClick: () => L(Qe(w, 1)),
742
+ children: /* @__PURE__ */ e(Le, { size: 14, "aria-hidden": "true" })
743
+ }
744
+ )
745
+ ] }),
746
+ /* @__PURE__ */ e(
747
+ Ra,
748
+ {
749
+ month: w,
750
+ range: z,
751
+ onSelect: P,
752
+ disabledDate: C,
753
+ locale: v,
754
+ weekStartsOn: f
755
+ }
756
+ ),
757
+ /* @__PURE__ */ e(
758
+ "button",
759
+ {
760
+ type: "button",
761
+ className: "mf-datepicker__clear",
762
+ onClick: () => {
763
+ k({}), _(!1);
764
+ },
765
+ children: c.forms.clearRange
766
+ }
767
+ )
768
+ ] })
769
+ ] });
770
+ }
771
+ const Yn = ue(
772
+ ({ prefix: a, suffix: n, invalid: l, disabled: i, size: s, className: o, ...m }, g) => /* @__PURE__ */ d(
773
+ "div",
774
+ {
775
+ className: E(
776
+ "mf-input-group",
777
+ J(s),
778
+ l && "mf-input-group--invalid",
779
+ i && "is-disabled",
780
+ o
781
+ ),
782
+ children: [
783
+ a ? /* @__PURE__ */ e("span", { className: "mf-input-group__affix", children: a }) : null,
784
+ /* @__PURE__ */ e(
785
+ "input",
786
+ {
787
+ ref: g,
788
+ className: "mf-input-group__input",
789
+ disabled: i,
790
+ "aria-invalid": l || void 0,
791
+ ...m
792
+ }
793
+ ),
794
+ n ? /* @__PURE__ */ e("span", { className: "mf-input-group__affix", children: n }) : null
795
+ ]
796
+ }
797
+ )
798
+ );
799
+ Yn.displayName = "InputGroup";
800
+ function Ct({
801
+ options: a,
802
+ label: n,
803
+ value: l,
804
+ defaultValue: i = [],
805
+ onValueChange: s,
806
+ disabled: o,
807
+ size: m,
808
+ direction: g = "vertical",
809
+ className: C,
810
+ ...N
811
+ }) {
812
+ const [b, p] = W({
813
+ value: l,
814
+ defaultValue: i,
815
+ onChange: s
816
+ });
817
+ return /* @__PURE__ */ d(
818
+ "fieldset",
819
+ {
820
+ className: E(
821
+ "mf-checkbox-group",
822
+ J(m),
823
+ `mf-checkbox-group--${g}`,
824
+ C
825
+ ),
826
+ disabled: o,
827
+ ...N,
828
+ children: [
829
+ n ? /* @__PURE__ */ e("legend", { className: "mf-checkbox-group__legend", children: n }) : null,
830
+ a.map((c) => {
831
+ const v = b.includes(c.value);
832
+ return /* @__PURE__ */ e(
833
+ ma,
834
+ {
835
+ checked: v,
836
+ size: m,
837
+ disabled: o || c.disabled,
838
+ onCheckedChange: (f) => {
839
+ p(
840
+ (r) => f ? [...r.filter((u) => u !== c.value), c.value] : r.filter((u) => u !== c.value)
841
+ );
842
+ },
843
+ children: /* @__PURE__ */ d("span", { className: "mf-checkbox-group__copy", children: [
844
+ /* @__PURE__ */ e("span", { children: c.label }),
845
+ c.description ? /* @__PURE__ */ e("small", { children: c.description }) : null
846
+ ] })
847
+ },
848
+ c.value
849
+ );
850
+ })
851
+ ]
852
+ }
853
+ );
854
+ }
855
+ function oa(a, n, l) {
856
+ return Math.min(l, Math.max(n, a));
857
+ }
858
+ const Wn = ue(
859
+ ({
860
+ value: a,
861
+ defaultValue: n,
862
+ onValueChange: l,
863
+ min: i = 0,
864
+ max: s = 100,
865
+ step: o = 1,
866
+ formatValue: m = (c) => c,
867
+ disabled: g,
868
+ size: C,
869
+ className: N,
870
+ ...b
871
+ }, p) => {
872
+ const c = Number(i), v = Number(s), [f, r] = W({
873
+ value: a,
874
+ defaultValue: n ?? c,
875
+ onChange: l
876
+ }), u = v === c ? 0 : (f - c) / (v - c) * 100;
877
+ return /* @__PURE__ */ d(
878
+ "div",
879
+ {
880
+ className: E(
881
+ "mf-slider",
882
+ J(C),
883
+ g && "is-disabled",
884
+ N
885
+ ),
886
+ children: [
887
+ /* @__PURE__ */ e(
888
+ "input",
889
+ {
890
+ ref: p,
891
+ type: "range",
892
+ className: "mf-slider__input",
893
+ value: f,
894
+ min: i,
895
+ max: s,
896
+ step: o,
897
+ disabled: g,
898
+ "aria-valuetext": String(m(f)),
899
+ style: { "--mf-slider-progress": `${u}%` },
900
+ onChange: (_) => r(Number(_.target.value)),
901
+ ...b
902
+ }
903
+ ),
904
+ /* @__PURE__ */ e("output", { className: "mf-slider__output", children: m(f) })
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ );
910
+ Wn.displayName = "Slider";
911
+ function kt({
912
+ value: a,
913
+ defaultValue: n = { start: 0, end: 100 },
914
+ onValueChange: l,
915
+ min: i = 0,
916
+ max: s = 100,
917
+ step: o = 1,
918
+ formatValue: m = (c) => c,
919
+ disabled: g,
920
+ size: C,
921
+ className: N,
922
+ "aria-label": b,
923
+ ...p
924
+ }) {
925
+ const { messages: c } = U(), v = b ?? c.forms.options, [f, r] = W({
926
+ value: a,
927
+ defaultValue: n,
928
+ onChange: l
929
+ }), u = oa(Math.min(f.start, f.end), i, s), _ = oa(Math.max(f.start, f.end), i, s), z = s === i ? 0 : (u - i) / (s - i) * 100, k = s === i ? 0 : (_ - i) / (s - i) * 100;
930
+ return /* @__PURE__ */ d(
931
+ "div",
932
+ {
933
+ className: E(
934
+ "mf-range-slider",
935
+ J(C),
936
+ g && "is-disabled",
937
+ N
938
+ ),
939
+ role: "group",
940
+ "aria-label": v,
941
+ ...p,
942
+ children: [
943
+ /* @__PURE__ */ d(
944
+ "div",
945
+ {
946
+ className: "mf-range-slider__track",
947
+ style: {
948
+ "--mf-range-start": `${z}%`,
949
+ "--mf-range-end": `${k}%`
950
+ },
951
+ children: [
952
+ /* @__PURE__ */ e(
953
+ "input",
954
+ {
955
+ type: "range",
956
+ className: "mf-range-slider__input",
957
+ value: u,
958
+ min: i,
959
+ max: s,
960
+ step: o,
961
+ disabled: g,
962
+ "aria-label": c.forms.rangeMinimum(v),
963
+ "aria-valuetext": String(m(u)),
964
+ onChange: (w) => r({
965
+ start: Math.min(Number(w.target.value), _),
966
+ end: _
967
+ })
968
+ }
969
+ ),
970
+ /* @__PURE__ */ e(
971
+ "input",
972
+ {
973
+ type: "range",
974
+ className: "mf-range-slider__input",
975
+ value: _,
976
+ min: i,
977
+ max: s,
978
+ step: o,
979
+ disabled: g,
980
+ "aria-label": c.forms.rangeMaximum(v),
981
+ "aria-valuetext": String(m(_)),
982
+ onChange: (w) => r({
983
+ start: u,
984
+ end: Math.max(Number(w.target.value), u)
985
+ })
986
+ }
987
+ )
988
+ ]
989
+ }
990
+ ),
991
+ /* @__PURE__ */ d("div", { className: "mf-range-slider__values", "aria-hidden": "true", children: [
992
+ /* @__PURE__ */ e("output", { children: m(u) }),
993
+ /* @__PURE__ */ e("span", { children: "to" }),
994
+ /* @__PURE__ */ e("output", { children: m(_) })
995
+ ] })
996
+ ]
997
+ }
998
+ );
999
+ }
1000
+ function wt({
1001
+ options: a,
1002
+ value: n,
1003
+ defaultValue: l = "",
1004
+ onValueChange: i,
1005
+ onOptionSelect: s,
1006
+ placeholder: o,
1007
+ emptyMessage: m,
1008
+ disabled: g,
1009
+ size: C,
1010
+ className: N,
1011
+ name: b,
1012
+ ...p
1013
+ }) {
1014
+ const { messages: c } = U(), v = me(), [f, r] = A(!1), [u, _] = W({
1015
+ value: n,
1016
+ defaultValue: l,
1017
+ onChange: i
1018
+ }), [z, k] = A(0), w = u.trim().toLocaleLowerCase(), L = Z(
1019
+ () => a.filter((D) => w ? D.label.toLocaleLowerCase().includes(w) || D.description?.toLocaleLowerCase().includes(w) : !0),
1020
+ [w, a]
1021
+ ), P = (D) => {
1022
+ D.disabled || (_(D.label), s?.(D), r(!1));
1023
+ }, I = (D) => {
1024
+ D.key === "ArrowDown" ? (D.preventDefault(), r(!0), k(($) => Math.min(L.length - 1, $ + 1))) : D.key === "ArrowUp" ? (D.preventDefault(), r(!0), k(($) => Math.max(0, $ - 1))) : D.key === "Enter" && f && L[z] ? (D.preventDefault(), P(L[z])) : D.key === "Escape" && r(!1);
1025
+ };
1026
+ return /* @__PURE__ */ d(pe, { open: f && !g, onOpenChange: r, children: [
1027
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ e(
1028
+ "input",
1029
+ {
1030
+ type: "text",
1031
+ role: "combobox",
1032
+ className: E("mf-autocomplete__input", J(C), N),
1033
+ value: u,
1034
+ placeholder: o ?? c.forms.startTyping,
1035
+ disabled: g,
1036
+ name: b,
1037
+ autoComplete: "off",
1038
+ "aria-autocomplete": "list",
1039
+ "aria-expanded": f && !g,
1040
+ "aria-controls": f ? v : void 0,
1041
+ "aria-activedescendant": f && L[z] ? `${v}-${L[z].value}` : void 0,
1042
+ onChange: (D) => {
1043
+ _(D.target.value), k(0), r(!0);
1044
+ },
1045
+ onFocus: () => r(!0),
1046
+ onKeyDown: I,
1047
+ ...p
1048
+ }
1049
+ ) }),
1050
+ /* @__PURE__ */ d(be, { className: "mf-autocomplete__content", align: "start", children: [
1051
+ /* @__PURE__ */ d("div", { className: "mf-autocomplete__header", children: [
1052
+ /* @__PURE__ */ e(Me, { size: 13, "aria-hidden": "true" }),
1053
+ /* @__PURE__ */ e("span", { children: c.forms.suggestions })
1054
+ ] }),
1055
+ /* @__PURE__ */ e("div", { className: "mf-combobox__options", id: v, role: "listbox", children: L.length ? L.map((D, $) => /* @__PURE__ */ d(
1056
+ "button",
1057
+ {
1058
+ id: `${v}-${D.value}`,
1059
+ type: "button",
1060
+ role: "option",
1061
+ "aria-selected": u === D.label,
1062
+ className: E(
1063
+ "mf-combobox__option",
1064
+ $ === z && "is-active"
1065
+ ),
1066
+ disabled: D.disabled,
1067
+ onMouseEnter: () => k($),
1068
+ onClick: () => P(D),
1069
+ children: [
1070
+ /* @__PURE__ */ d("span", { className: "mf-combobox__option-copy", children: [
1071
+ /* @__PURE__ */ e("span", { children: D.label }),
1072
+ D.description ? /* @__PURE__ */ e("small", { children: D.description }) : null
1073
+ ] }),
1074
+ u === D.label ? /* @__PURE__ */ e(Ye, { size: 13, "aria-hidden": "true" }) : null
1075
+ ]
1076
+ },
1077
+ D.value
1078
+ )) : /* @__PURE__ */ e("div", { className: "mf-combobox__empty", children: m ?? c.forms.noMatchingOptions }) })
1079
+ ] })
1080
+ ] });
1081
+ }
1082
+ function ca(a, n) {
1083
+ for (const l of a) {
1084
+ if (l.value === n) return l;
1085
+ const i = l.children ? ca(l.children, n) : void 0;
1086
+ if (i) return i;
1087
+ }
1088
+ }
1089
+ function Ka(a, n, l = []) {
1090
+ for (const i of a) {
1091
+ const s = [...l, i];
1092
+ if (i.value === n) return s;
1093
+ if (i.children) {
1094
+ const o = Ka(i.children, n, s);
1095
+ if (o.length) return o;
1096
+ }
1097
+ }
1098
+ return [];
1099
+ }
1100
+ function Ua(a, n) {
1101
+ return n ? a.flatMap((l) => {
1102
+ const i = l.children ? Ua(l.children, n) : [];
1103
+ return !(l.label.toLocaleLowerCase().includes(n) || l.description?.toLocaleLowerCase().includes(n)) && !i.length ? [] : [{ ...l, children: i.length ? i : l.children }];
1104
+ }) : a;
1105
+ }
1106
+ function Hn(a, n, l = !1) {
1107
+ const i = [], s = (o, m, g) => {
1108
+ o.forEach((C) => {
1109
+ i.push({ ...C, level: m, parentValues: g }), C.children?.length && (l || n.has(C.value)) && s(C.children, m + 1, [...g, C.value]);
1110
+ });
1111
+ };
1112
+ return s(a, 1, []), i;
1113
+ }
1114
+ function zt({
1115
+ nodes: a,
1116
+ value: n,
1117
+ defaultValue: l,
1118
+ onValueChange: i,
1119
+ placeholder: s,
1120
+ searchPlaceholder: o,
1121
+ emptyMessage: m,
1122
+ disabled: g,
1123
+ size: C,
1124
+ defaultExpanded: N = [],
1125
+ className: b,
1126
+ ...p
1127
+ }) {
1128
+ const { messages: c } = U(), v = me(), [f, r] = A(!1), [u, _] = A(""), [z, k] = A(0), w = Y(/* @__PURE__ */ new Map()), [L, P] = W({
1129
+ value: n,
1130
+ defaultValue: l,
1131
+ onChange: (S) => {
1132
+ const K = S ? ca(a, S) : void 0;
1133
+ S && K && i?.(S, K);
1134
+ }
1135
+ }), [I, D] = A(() => new Set(N)), $ = L ? ca(a, L) : void 0, Q = L ? Ka(a, L) : [], T = $ ? Q.map((S) => S.label).join(" / ") : s ?? c.forms.selectNode, q = p["aria-label"] ? `${p["aria-label"]}: ${T}` : void 0, V = u.trim().toLocaleLowerCase(), x = Z(
1136
+ () => Ua(a, V),
1137
+ [a, V]
1138
+ ), M = Z(
1139
+ () => Hn(x, I, !!V),
1140
+ [I, x, V]
1141
+ ), G = (S) => {
1142
+ const K = oa(S, 0, Math.max(0, M.length - 1));
1143
+ k(K), w.current.get(M[K]?.value)?.focus();
1144
+ }, ee = (S) => {
1145
+ D((K) => {
1146
+ const ne = new Set(K);
1147
+ return ne.has(S.value) ? ne.delete(S.value) : ne.add(S.value), ne;
1148
+ });
1149
+ }, re = (S) => {
1150
+ S.disabled || (P(S.value), r(!1));
1151
+ }, ve = (S, K) => {
1152
+ S.key === "ArrowDown" ? (S.preventDefault(), G(z + 1)) : S.key === "ArrowUp" ? (S.preventDefault(), G(z - 1)) : S.key === "ArrowRight" && K.children?.length ? (S.preventDefault(), I.has(K.value) || ee(K)) : S.key === "ArrowLeft" && K.children?.length ? (S.preventDefault(), I.has(K.value) && ee(K)) : S.key === "Enter" || S.key === " " ? (S.preventDefault(), re(K)) : S.key === "Escape" && r(!1);
1153
+ };
1154
+ return /* @__PURE__ */ d(
1155
+ pe,
1156
+ {
1157
+ open: f && !g,
1158
+ onOpenChange: (S) => {
1159
+ r(S), S && (_(""), k(0));
1160
+ },
1161
+ children: [
1162
+ /* @__PURE__ */ e(ge, { asChild: !0, children: /* @__PURE__ */ d(
1163
+ "button",
1164
+ {
1165
+ type: "button",
1166
+ className: E("mf-tree-select__trigger", J(C), b),
1167
+ disabled: g,
1168
+ "aria-haspopup": "tree",
1169
+ "aria-expanded": f && !g,
1170
+ ...p,
1171
+ "aria-label": q,
1172
+ children: [
1173
+ /* @__PURE__ */ e(qe, { size: 14, "aria-hidden": "true" }),
1174
+ /* @__PURE__ */ e("span", { className: E(!$ && "is-placeholder"), children: T }),
1175
+ /* @__PURE__ */ e(je, { size: 14, "aria-hidden": "true" })
1176
+ ]
1177
+ }
1178
+ ) }),
1179
+ /* @__PURE__ */ d(be, { className: "mf-tree-select__content", align: "start", children: [
1180
+ /* @__PURE__ */ d("label", { className: "mf-tree-select__search", children: [
1181
+ /* @__PURE__ */ e(Me, { size: 13, "aria-hidden": "true" }),
1182
+ /* @__PURE__ */ e("span", { className: "mf-visually-hidden", children: c.forms.searchNodes }),
1183
+ /* @__PURE__ */ e(
1184
+ "input",
1185
+ {
1186
+ autoFocus: !0,
1187
+ value: u,
1188
+ placeholder: o ?? c.forms.searchNodes,
1189
+ onChange: (S) => {
1190
+ _(S.target.value), k(0);
1191
+ }
1192
+ }
1193
+ )
1194
+ ] }),
1195
+ /* @__PURE__ */ e(
1196
+ "div",
1197
+ {
1198
+ id: v,
1199
+ className: "mf-tree-select__tree",
1200
+ role: "tree",
1201
+ "aria-label": p["aria-label"] ?? c.forms.options,
1202
+ children: M.length ? M.map((S, K) => {
1203
+ const ne = L === S.value, Ae = I.has(S.value) || !!V;
1204
+ return /* @__PURE__ */ e(
1205
+ "div",
1206
+ {
1207
+ className: E("mf-tree-select__row", ne && "is-selected"),
1208
+ style: { "--mf-tree-level": S.level - 1 },
1209
+ children: /* @__PURE__ */ d(
1210
+ "button",
1211
+ {
1212
+ ref: (le) => {
1213
+ le ? w.current.set(S.value, le) : w.current.delete(S.value);
1214
+ },
1215
+ type: "button",
1216
+ role: "treeitem",
1217
+ "aria-level": S.level,
1218
+ "aria-selected": ne,
1219
+ "aria-expanded": S.children?.length ? Ae : void 0,
1220
+ disabled: S.disabled,
1221
+ tabIndex: K === z ? 0 : -1,
1222
+ className: "mf-tree-select__item",
1223
+ onFocus: () => k(K),
1224
+ onClick: () => re(S),
1225
+ onKeyDown: (le) => ve(le, S),
1226
+ children: [
1227
+ /* @__PURE__ */ e(
1228
+ "span",
1229
+ {
1230
+ className: E(
1231
+ "mf-tree-select__toggle",
1232
+ !S.children?.length && "is-empty",
1233
+ Ae && "is-expanded"
1234
+ ),
1235
+ "aria-hidden": "true",
1236
+ onClick: (le) => {
1237
+ le.stopPropagation(), S.children?.length && ee(S);
1238
+ },
1239
+ children: /* @__PURE__ */ e(Le, { size: 12 })
1240
+ }
1241
+ ),
1242
+ /* @__PURE__ */ d("span", { className: "mf-tree-select__copy", children: [
1243
+ /* @__PURE__ */ e("span", { children: S.label }),
1244
+ S.description ? /* @__PURE__ */ e("small", { children: S.description }) : null
1245
+ ] }),
1246
+ ne ? /* @__PURE__ */ e(Ye, { size: 13, "aria-hidden": "true" }) : null
1247
+ ]
1248
+ }
1249
+ )
1250
+ },
1251
+ S.value
1252
+ );
1253
+ }) : /* @__PURE__ */ e("div", { className: "mf-combobox__empty", children: m ?? c.forms.noMatchingNodes })
1254
+ }
1255
+ )
1256
+ ] })
1257
+ ]
1258
+ }
1259
+ );
1260
+ }
1261
+ function Gn(a) {
1262
+ return a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB`;
1263
+ }
1264
+ const Xn = ue(
1265
+ ({
1266
+ value: a,
1267
+ defaultValue: n = [],
1268
+ onFilesChange: l,
1269
+ label: i,
1270
+ description: s,
1271
+ invalid: o,
1272
+ size: m,
1273
+ disabled: g,
1274
+ multiple: C,
1275
+ className: N,
1276
+ id: b,
1277
+ ...p
1278
+ }, c) => {
1279
+ const { messages: v } = U(), f = me(), r = b ?? f, u = s ? `${r}-description` : void 0, _ = Y(null), [z, k] = W({
1280
+ value: a,
1281
+ defaultValue: n,
1282
+ onChange: l
1283
+ });
1284
+ return gn(c, () => _.current), /* @__PURE__ */ d(
1285
+ "div",
1286
+ {
1287
+ className: E(
1288
+ "mf-file-input",
1289
+ J(m),
1290
+ g && "is-disabled",
1291
+ N
1292
+ ),
1293
+ children: [
1294
+ /* @__PURE__ */ e(
1295
+ "input",
1296
+ {
1297
+ ref: _,
1298
+ id: r,
1299
+ type: "file",
1300
+ className: "mf-file-input__native",
1301
+ disabled: g,
1302
+ multiple: C,
1303
+ ...p,
1304
+ "aria-invalid": o || void 0,
1305
+ "aria-describedby": [p["aria-describedby"], u].filter(Boolean).join(" ") || void 0,
1306
+ onChange: (w) => {
1307
+ const L = w.target.files ? Array.from(w.target.files) : [];
1308
+ k(C ? L : L.slice(0, 1));
1309
+ }
1310
+ }
1311
+ ),
1312
+ /* @__PURE__ */ d("label", { htmlFor: r, className: "mf-file-input__trigger", children: [
1313
+ /* @__PURE__ */ e(wn, { size: 14, "aria-hidden": "true" }),
1314
+ /* @__PURE__ */ e("span", { children: i ?? v.forms.chooseFiles })
1315
+ ] }),
1316
+ z.length ? /* @__PURE__ */ e("ul", { className: "mf-file-input__list", "aria-label": v.forms.selectedFiles, children: z.map((w, L) => /* @__PURE__ */ d("li", { children: [
1317
+ /* @__PURE__ */ e("span", { children: w.name }),
1318
+ /* @__PURE__ */ e("small", { children: Gn(w.size) }),
1319
+ /* @__PURE__ */ e(
1320
+ "button",
1321
+ {
1322
+ type: "button",
1323
+ "aria-label": v.forms.removeFile(w.name),
1324
+ disabled: g,
1325
+ onClick: () => {
1326
+ k(z.filter((P, I) => I !== L)), _.current && (_.current.value = "");
1327
+ },
1328
+ children: /* @__PURE__ */ e(Ie, { size: 11, "aria-hidden": "true" })
1329
+ }
1330
+ )
1331
+ ] }, `${w.name}-${w.lastModified}-${L}`)) }) : null,
1332
+ s ? /* @__PURE__ */ e("p", { className: "mf-file-input__description", id: u, children: s }) : null
1333
+ ]
1334
+ }
1335
+ );
1336
+ }
1337
+ );
1338
+ Xn.displayName = "FileInput";
1339
+ const Zn = "(max-width: 760px)";
1340
+ function Jn(a) {
1341
+ const [n, l] = A(
1342
+ () => typeof window > "u" ? !1 : window.matchMedia(a).matches
1343
+ );
1344
+ return H(() => {
1345
+ const i = window.matchMedia(a), s = () => l(i.matches);
1346
+ return s(), i.addEventListener("change", s), () => i.removeEventListener("change", s);
1347
+ }, [a]), n;
1348
+ }
1349
+ function Ue(a) {
1350
+ return Array.from(new Set(a));
1351
+ }
1352
+ function da(a) {
1353
+ const n = a.trim().split(/\s+/).filter(Boolean);
1354
+ return (n.length > 1 ? `${n[0][0]}${n[1][0]}` : a.slice(0, 2)).toUpperCase();
1355
+ }
1356
+ function Ve(a, n, l) {
1357
+ for (const i of a) {
1358
+ if (i.id === n) return i;
1359
+ const s = Ve(
1360
+ l(i),
1361
+ n,
1362
+ l
1363
+ );
1364
+ if (s) return s;
1365
+ }
1366
+ }
1367
+ function et(a, n, l, i = !1) {
1368
+ const s = [], o = (m, g, C) => {
1369
+ m.forEach((N) => {
1370
+ s.push({ organization: N, level: g, parents: C });
1371
+ const b = n(N);
1372
+ b.length && (i || l.has(N.id)) && o(b, g + 1, [...C, N]);
1373
+ });
1374
+ };
1375
+ return o(a, 1, []), s;
1376
+ }
1377
+ function at(a, n, l) {
1378
+ const i = /* @__PURE__ */ new Map(), s = (o) => {
1379
+ o.forEach((m) => {
1380
+ l(m).forEach((g) => i.set(g.id, g)), s(n(m));
1381
+ });
1382
+ };
1383
+ return s(a), i;
1384
+ }
1385
+ function nt(a, n, l, i) {
1386
+ const s = n.trim().toLocaleLowerCase(), o = /* @__PURE__ */ new Map();
1387
+ if (!s) return [];
1388
+ const m = (g, C) => {
1389
+ g.forEach((N) => {
1390
+ const b = [...C, N.name];
1391
+ i(N).forEach((p) => {
1392
+ (p.name.toLocaleLowerCase().includes(s) || p.description?.toLocaleLowerCase().includes(s)) && !o.has(p.id) && o.set(p.id, { person: p, organizationPath: b });
1393
+ }), m(l(N), b);
1394
+ });
1395
+ };
1396
+ return m(a, []), Array.from(o.values());
1397
+ }
1398
+ function tt(a, n, l) {
1399
+ const i = /* @__PURE__ */ new Map(), s = (o) => {
1400
+ l(o).forEach((m) => i.set(m.id, m)), n(o).forEach(s);
1401
+ };
1402
+ return s(a), Array.from(i.values());
1403
+ }
1404
+ function $a({
1405
+ person: a,
1406
+ path: n
1407
+ }) {
1408
+ return /* @__PURE__ */ d(De, { children: [
1409
+ /* @__PURE__ */ e(sa, { src: a.avatarSrc, alt: "", fallback: da(a.name), size: "sm" }),
1410
+ /* @__PURE__ */ d("span", { className: "mf-people-picker__person-copy", children: [
1411
+ /* @__PURE__ */ e("strong", { children: a.name }),
1412
+ a.description || n?.length ? /* @__PURE__ */ e("small", { children: [a.description, n?.join(" / ")].filter(Boolean).join(" · ") }) : null
1413
+ ] })
1414
+ ] });
1415
+ }
1416
+ function rt({
1417
+ person: a,
1418
+ path: n,
1419
+ selected: l,
1420
+ multiple: i,
1421
+ onSelect: s,
1422
+ onKeyDown: o,
1423
+ disabled: m
1424
+ }) {
1425
+ return i ? /* @__PURE__ */ e(
1426
+ ma,
1427
+ {
1428
+ className: E("mf-people-picker__person", l && "is-selected"),
1429
+ checked: l,
1430
+ disabled: m || a.disabled,
1431
+ "data-people-picker-option": !0,
1432
+ onKeyDown: o,
1433
+ onCheckedChange: (g) => s(g === !0),
1434
+ children: /* @__PURE__ */ e($a, { person: a, path: n })
1435
+ }
1436
+ ) : /* @__PURE__ */ d(
1437
+ "button",
1438
+ {
1439
+ type: "button",
1440
+ role: "option",
1441
+ "aria-selected": l,
1442
+ className: E("mf-people-picker__person", l && "is-selected"),
1443
+ disabled: m || a.disabled,
1444
+ "data-people-picker-option": !0,
1445
+ onKeyDown: o,
1446
+ onClick: () => s(!0),
1447
+ children: [
1448
+ /* @__PURE__ */ e($a, { person: a, path: n }),
1449
+ l ? /* @__PURE__ */ e(Ye, { size: 14, "aria-hidden": "true" }) : null
1450
+ ]
1451
+ }
1452
+ );
1453
+ }
1454
+ function St(a) {
1455
+ const {
1456
+ data: n,
1457
+ placeholder: l,
1458
+ searchPlaceholder: i,
1459
+ emptyMessage: s,
1460
+ disabled: o,
1461
+ invalid: m,
1462
+ size: g,
1463
+ name: C,
1464
+ open: N,
1465
+ defaultOpen: b = !1,
1466
+ onOpenChange: p,
1467
+ "aria-label": c,
1468
+ "aria-describedby": v
1469
+ } = a, { messages: f } = U(), r = f.peoplePicker, u = a.mode === "multiple", _ = Jn(Zn), z = me(), [k, w] = W({
1470
+ value: N,
1471
+ defaultValue: b,
1472
+ onChange: p
1473
+ }), [L, P] = A(
1474
+ a.mode === "multiple" ? void 0 : a.defaultValue
1475
+ ), [I, D] = A(
1476
+ a.mode === "multiple" ? Ue(a.defaultValue ?? []) : []
1477
+ ), $ = Z(() => {
1478
+ if (a.mode === "multiple")
1479
+ return Ue(a.value ?? I);
1480
+ const t = a.value ?? L;
1481
+ return t ? [t] : [];
1482
+ }, [a.mode, a.value, I, L]), Q = $.join(""), [T, q] = A($), V = k && u ? T : $, x = Z(() => new Set(V), [V]), [M, G] = A(""), [ee, re] = A(
1483
+ n.organizations[0]?.id ?? null
1484
+ ), [ve, S] = A(null), [K, ne] = A(
1485
+ () => new Set(n.organizations[0] ? [n.organizations[0].id] : [])
1486
+ ), [Ae, le] = A(0), We = Y(/* @__PURE__ */ new Map()), [_e, pa] = A({
1487
+ children: {},
1488
+ members: {}
1489
+ }), $e = Y(_e);
1490
+ $e.current = _e;
1491
+ const [ga, Ha] = A(/* @__PURE__ */ new Set()), [He, Ga] = A({}), [Pe, ba] = A(null), [Xa, se] = A(!1), [va, _a] = A({}), [Ne, Fe] = A({
1492
+ query: "",
1493
+ status: "idle",
1494
+ results: []
1495
+ }), [Za, Ja] = A(0), ye = Y(
1496
+ /* @__PURE__ */ new Map()
1497
+ ), Te = Y(/* @__PURE__ */ new Set());
1498
+ H(() => {
1499
+ k || q($);
1500
+ }, [Q, $, k]), H(() => {
1501
+ if (!n.organizations.length) {
1502
+ re(null);
1503
+ return;
1504
+ }
1505
+ re(
1506
+ (t) => t && Ve(
1507
+ n.organizations,
1508
+ t,
1509
+ (h) => $e.current.children[h.id] ?? h.children ?? []
1510
+ ) ? t : n.organizations[0].id
1511
+ );
1512
+ }, [n.organizations]), H(
1513
+ () => () => {
1514
+ Te.current.forEach((t) => t.abort()), Te.current.clear();
1515
+ },
1516
+ []
1517
+ );
1518
+ const oe = te(() => {
1519
+ const t = new AbortController();
1520
+ return Te.current.add(t), t;
1521
+ }, []), ce = te((t) => {
1522
+ Te.current.delete(t);
1523
+ }, []), ae = te(
1524
+ (t) => _e.children[t.id] ?? t.children ?? [],
1525
+ [_e.children]
1526
+ ), Ce = te(
1527
+ (t) => _e.members[t.id] ?? t.members ?? [],
1528
+ [_e.members]
1529
+ ), Na = Z(
1530
+ () => at(n.organizations, ae, Ce),
1531
+ [n.organizations, ae, Ce]
1532
+ ), Ge = Z(
1533
+ () => ({ ...Object.fromEntries(Na), ...va }),
1534
+ [va, Na]
1535
+ ), ke = te((t, h) => {
1536
+ Ha((y) => {
1537
+ const O = new Set(y);
1538
+ return h ? O.add(t) : O.delete(t), O;
1539
+ });
1540
+ }, []), ie = te((t, h) => {
1541
+ Ga((y) => {
1542
+ const O = { ...y };
1543
+ return h ? O[t] = h : delete O[t], O;
1544
+ });
1545
+ }, []), we = te(
1546
+ async (t) => {
1547
+ const h = $e.current.members[t.id];
1548
+ if (h) return h;
1549
+ if (!t.hasMoreMembers) return t.members ?? [];
1550
+ const y = `members:${t.id}`, O = ye.current.get(y);
1551
+ if (O) return O;
1552
+ const F = n.loadMembers;
1553
+ if (!F) {
1554
+ const j = r.loadError;
1555
+ throw ie(y, j), new Error(j);
1556
+ }
1557
+ const R = oe();
1558
+ ke(y, !0), ie(y);
1559
+ const B = F(t.id, { signal: R.signal }).then((j) => (pa((he) => ({
1560
+ ...he,
1561
+ members: { ...he.members, [t.id]: j }
1562
+ })), j)).catch((j) => {
1563
+ throw R.signal.aborted || ie(y, r.loadError), j;
1564
+ }).finally(() => {
1565
+ ke(y, !1), ye.current.delete(y), ce(R);
1566
+ });
1567
+ return ye.current.set(y, B), B;
1568
+ },
1569
+ [
1570
+ oe,
1571
+ n.loadMembers,
1572
+ r.loadError,
1573
+ ce,
1574
+ ke,
1575
+ ie
1576
+ ]
1577
+ ), Xe = te(
1578
+ async (t) => {
1579
+ const h = $e.current.children[t.id];
1580
+ if (h) return h;
1581
+ if (!t.hasMoreChildren) return t.children ?? [];
1582
+ const y = `children:${t.id}`, O = ye.current.get(y);
1583
+ if (O) return O;
1584
+ const F = n.loadChildren;
1585
+ if (!F) {
1586
+ const j = r.loadError;
1587
+ throw ie(y, j), new Error(j);
1588
+ }
1589
+ const R = oe();
1590
+ ke(y, !0), ie(y);
1591
+ const B = F(t.id, { signal: R.signal }).then((j) => (pa((he) => ({
1592
+ ...he,
1593
+ children: { ...he.children, [t.id]: j }
1594
+ })), j)).catch((j) => {
1595
+ throw R.signal.aborted || ie(y, r.loadError), j;
1596
+ }).finally(() => {
1597
+ ke(y, !1), ye.current.delete(y), ce(R);
1598
+ });
1599
+ return ye.current.set(y, B), B;
1600
+ },
1601
+ [
1602
+ oe,
1603
+ n.loadChildren,
1604
+ r.loadError,
1605
+ ce,
1606
+ ke,
1607
+ ie
1608
+ ]
1609
+ ), ya = te(
1610
+ async (t, h = /* @__PURE__ */ new Set()) => {
1611
+ if (h.has(t.id)) return [];
1612
+ h.add(t.id);
1613
+ const y = await we(t), O = await Xe(t), F = await Promise.all(
1614
+ O.map((B) => ya(B, h))
1615
+ ), R = /* @__PURE__ */ new Map();
1616
+ return [...y, ...F.flat()].forEach((B) => R.set(B.id, B)), Array.from(R.values());
1617
+ },
1618
+ [Xe, we]
1619
+ ), Ze = Z(
1620
+ () => $.filter((t) => !Ge[t]).sort().join(""),
1621
+ [Ge, $]
1622
+ );
1623
+ H(() => {
1624
+ const t = n.resolvePeople, h = Ze ? Ze.split("") : [];
1625
+ if (!t || !h.length) return;
1626
+ const y = oe();
1627
+ return t(h, { signal: y.signal }).then((O) => {
1628
+ y.signal.aborted || _a((F) => {
1629
+ const R = { ...F };
1630
+ return O.forEach((B) => {
1631
+ R[B.id] = B;
1632
+ }), R;
1633
+ });
1634
+ }).catch(() => {
1635
+ }).finally(() => ce(y)), () => y.abort();
1636
+ }, [oe, n.resolvePeople, ce, Ze]);
1637
+ const en = Z(
1638
+ () => ee ? Ve(n.organizations, ee, ae) : void 0,
1639
+ [ee, n.organizations, ae]
1640
+ ), an = Z(
1641
+ () => ve ? Ve(n.organizations, ve, ae) : void 0,
1642
+ [n.organizations, ae, ve]
1643
+ ), X = _ ? an : en, Ee = Z(
1644
+ () => et(n.organizations, ae, K),
1645
+ [n.organizations, K, ae]
1646
+ ), Je = X ? Ce(X) : [], ea = X ? `members:${X.id}` : "", nn = ga.has(ea), tn = He[ea];
1647
+ H(() => {
1648
+ !k || !X || we(X).catch(() => {
1649
+ });
1650
+ }, [X, we, k]), H(() => {
1651
+ !k || !n.organizations[0] || ne((t) => t.size ? t : /* @__PURE__ */ new Set([n.organizations[0].id]));
1652
+ }, [n.organizations, k]), H(() => {
1653
+ const t = M.trim(), h = n.searchPeople;
1654
+ if (!t || !h) {
1655
+ Fe({ query: t, status: "idle", results: [] });
1656
+ return;
1657
+ }
1658
+ const y = oe(), O = window.setTimeout(() => {
1659
+ Fe({ query: t, status: "loading", results: [] }), h(t, { signal: y.signal }).then((F) => {
1660
+ y.signal.aborted || (_a((R) => {
1661
+ const B = { ...R };
1662
+ return F.forEach(({ person: j }) => {
1663
+ B[j.id] = j;
1664
+ }), B;
1665
+ }), Fe({
1666
+ query: t,
1667
+ status: "complete",
1668
+ results: F
1669
+ }));
1670
+ }).catch(() => {
1671
+ y.signal.aborted || Fe({
1672
+ query: t,
1673
+ status: "error",
1674
+ results: []
1675
+ });
1676
+ });
1677
+ }, 200);
1678
+ return () => {
1679
+ window.clearTimeout(O), y.abort(), ce(y);
1680
+ };
1681
+ }, [oe, n.searchPeople, M, ce, Za]);
1682
+ const rn = Z(
1683
+ () => M.trim() && !n.searchPeople ? nt(n.organizations, M, ae, Ce) : [],
1684
+ [n.organizations, n.searchPeople, ae, Ce, M]
1685
+ ), Ca = n.searchPeople ? Ne.query === M.trim() ? Ne.results : [] : rn, ln = !!n.searchPeople && !!M.trim() && (Ne.status === "idle" || Ne.status === "loading" || Ne.query !== M.trim()), sn = !!n.searchPeople && !!M.trim() && Ne.status === "error", ze = (t, h = !1) => {
1686
+ t ? (u && q($), G(""), se(!1), ee && ne((y) => {
1687
+ const O = new Set(y);
1688
+ return O.add(ee), O;
1689
+ })) : (G(""), S(null), se(!1), u && !h && q($)), w(t);
1690
+ }, aa = (t) => {
1691
+ const h = Ue(t);
1692
+ if (a.mode === "multiple") {
1693
+ a.value === void 0 && D(h), a.onValueChange?.(h);
1694
+ return;
1695
+ }
1696
+ const y = h[0];
1697
+ a.value === void 0 && P(y), a.onValueChange?.(y);
1698
+ }, on = (t) => {
1699
+ t.disabled || (aa([t.id]), ze(!1));
1700
+ }, cn = (t, h) => {
1701
+ a.mode === "multiple" && q((y) => h ? a.maxSelected && y.length >= a.maxSelected ? (se(!0), y) : (se(!1), y.includes(t) ? y : [...y, t]) : (se(!1), y.filter((O) => O !== t)));
1702
+ }, dn = () => {
1703
+ const t = Ue(T);
1704
+ q(t), aa(t), ze(!1, !0);
1705
+ }, un = () => {
1706
+ if (u) {
1707
+ q([]), se(!1);
1708
+ return;
1709
+ }
1710
+ aa([]), ze(!1);
1711
+ }, na = async (t) => {
1712
+ const h = ae(t);
1713
+ if (!K.has(t.id) && !h.length && t.hasMoreChildren)
1714
+ try {
1715
+ await Xe(t);
1716
+ } catch {
1717
+ return;
1718
+ }
1719
+ ne((O) => {
1720
+ const F = new Set(O);
1721
+ return F.has(t.id) ? F.delete(t.id) : F.add(t.id), F;
1722
+ });
1723
+ }, ka = (t) => {
1724
+ re(t.id), _ && S(t.id), we(t).catch(() => {
1725
+ });
1726
+ }, mn = (t) => {
1727
+ const h = tt(t, ae, Ce), y = h.filter((O) => x.has(O.id));
1728
+ return !h.length || !y.length ? !1 : y.length === h.length ? !0 : "indeterminate";
1729
+ }, fn = async (t, h) => {
1730
+ if (!(a.mode !== "multiple" || Pe)) {
1731
+ ba(t.id);
1732
+ try {
1733
+ const O = (await ya(t)).filter((B) => !B.disabled).map((B) => B.id), F = new Set(T);
1734
+ h ? O.forEach((B) => F.add(B)) : O.forEach((B) => F.delete(B));
1735
+ const R = Array.from(F);
1736
+ if (h && a.maxSelected && R.length > a.maxSelected) {
1737
+ se(!0);
1738
+ return;
1739
+ }
1740
+ se(!1), q(R);
1741
+ } catch {
1742
+ } finally {
1743
+ ba(null);
1744
+ }
1745
+ }
1746
+ }, Be = (t) => {
1747
+ const h = Math.min(
1748
+ Math.max(t, 0),
1749
+ Math.max(Ee.length - 1, 0)
1750
+ );
1751
+ le(h);
1752
+ const y = Ee[h];
1753
+ y && We.current.get(y.organization.id)?.focus();
1754
+ }, hn = (t, h, y) => {
1755
+ t.key === "ArrowDown" ? (t.preventDefault(), Be(y + 1)) : t.key === "ArrowUp" ? (t.preventDefault(), Be(y - 1)) : t.key === "Home" ? (t.preventDefault(), Be(0)) : t.key === "End" ? (t.preventDefault(), Be(Ee.length - 1)) : t.key === "ArrowRight" ? (t.preventDefault(), K.has(h.organization.id) || na(h.organization)) : t.key === "ArrowLeft" ? (t.preventDefault(), K.has(h.organization.id) && na(h.organization)) : (t.key === "Enter" || t.key === " ") && (t.preventDefault(), ka(h.organization));
1756
+ }, pn = (t) => {
1757
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(t.key)) return;
1758
+ const h = t.currentTarget.closest(".mf-people-picker__people-list");
1759
+ if (!h) return;
1760
+ const y = Array.from(
1761
+ h.querySelectorAll("[data-people-picker-option]")
1762
+ ).filter((R) => !R.hasAttribute("disabled"));
1763
+ if (!y.length) return;
1764
+ t.preventDefault();
1765
+ const O = y.indexOf(document.activeElement);
1766
+ let F = O;
1767
+ t.key === "Home" ? F = 0 : t.key === "End" ? F = y.length - 1 : t.key === "ArrowDown" ? F = Math.min(O + 1, y.length - 1) : t.key === "ArrowUp" && (F = Math.max(O - 1, 0)), y[F]?.focus();
1768
+ }, fe = V.map((t) => Ge[t]).filter((t) => !!t), wa = u ? V.length ? r.selectedCount(V.length) : l ?? r.selectPeople : fe[0]?.name ?? l ?? r.selectPerson, za = (t = !0) => /* @__PURE__ */ d("div", { className: "mf-people-picker__organization-pane", children: [
1769
+ t ? /* @__PURE__ */ d("div", { className: "mf-people-picker__pane-heading", children: [
1770
+ /* @__PURE__ */ e("span", { children: r.organizations }),
1771
+ /* @__PURE__ */ e(qe, { size: 14, "aria-hidden": "true" })
1772
+ ] }) : null,
1773
+ /* @__PURE__ */ e(
1774
+ "div",
1775
+ {
1776
+ id: `${z}-tree`,
1777
+ className: "mf-people-picker__tree",
1778
+ role: "tree",
1779
+ "aria-label": r.organizations,
1780
+ children: Ee.length ? Ee.map((h, y) => {
1781
+ const F = !!(ae(h.organization).length || h.organization.hasMoreChildren), R = K.has(h.organization.id), B = ee === h.organization.id, j = ga.has(`children:${h.organization.id}`), he = a.mode === "multiple" ? mn(h.organization) : !1;
1782
+ return /* @__PURE__ */ d(
1783
+ "div",
1784
+ {
1785
+ role: "treeitem",
1786
+ "aria-level": h.level,
1787
+ "aria-expanded": F ? R : void 0,
1788
+ "aria-selected": B,
1789
+ "aria-current": B ? "true" : void 0,
1790
+ className: E(
1791
+ "mf-people-picker__organization-row",
1792
+ B && "is-active"
1793
+ ),
1794
+ style: { "--mf-people-picker-level": h.level - 1 },
1795
+ children: [
1796
+ a.mode === "multiple" ? /* @__PURE__ */ e(
1797
+ ma,
1798
+ {
1799
+ checked: he,
1800
+ disabled: !!(o || Pe),
1801
+ "aria-label": r.selectOrganization(h.organization.name),
1802
+ onCheckedChange: (Se) => {
1803
+ fn(
1804
+ h.organization,
1805
+ Se === !0
1806
+ );
1807
+ }
1808
+ }
1809
+ ) : null,
1810
+ /* @__PURE__ */ e(
1811
+ "button",
1812
+ {
1813
+ ref: (Se) => {
1814
+ Se ? We.current.set(h.organization.id, Se) : We.current.delete(h.organization.id);
1815
+ },
1816
+ type: "button",
1817
+ tabIndex: Ae === y ? 0 : -1,
1818
+ className: "mf-people-picker__organization-main",
1819
+ onFocus: () => le(y),
1820
+ onClick: () => ka(h.organization),
1821
+ onKeyDown: (Se) => hn(Se, h, y),
1822
+ children: /* @__PURE__ */ d("span", { className: "mf-people-picker__organization-copy", children: [
1823
+ /* @__PURE__ */ e("strong", { children: h.organization.name }),
1824
+ h.organization.description || h.organization.memberCount !== void 0 ? /* @__PURE__ */ e("small", { children: [
1825
+ h.organization.description,
1826
+ h.organization.memberCount !== void 0 ? r.memberCount(h.organization.memberCount) : void 0
1827
+ ].filter(Boolean).join(" · ") }) : null
1828
+ ] })
1829
+ }
1830
+ ),
1831
+ Pe === h.organization.id ? /* @__PURE__ */ e(Re, { size: "sm", label: r.loadingMembers }) : F ? /* @__PURE__ */ e(
1832
+ "button",
1833
+ {
1834
+ type: "button",
1835
+ tabIndex: -1,
1836
+ className: E(
1837
+ "mf-people-picker__organization-toggle",
1838
+ R && "is-expanded"
1839
+ ),
1840
+ "aria-label": R ? r.collapseOrganization(h.organization.name) : r.expandOrganization(h.organization.name),
1841
+ onClick: () => {
1842
+ na(h.organization);
1843
+ },
1844
+ children: j ? /* @__PURE__ */ e(Re, { size: "sm" }) : /* @__PURE__ */ e(Le, { size: 14, "aria-hidden": "true" })
1845
+ }
1846
+ ) : /* @__PURE__ */ e("span", { className: "mf-people-picker__organization-toggle is-empty" }),
1847
+ He[`children:${h.organization.id}`] ? /* @__PURE__ */ e(
1848
+ "span",
1849
+ {
1850
+ className: "mf-people-picker__organization-error",
1851
+ title: He[`children:${h.organization.id}`],
1852
+ children: /* @__PURE__ */ e(ra, { size: 13, "aria-hidden": "true" })
1853
+ }
1854
+ ) : null
1855
+ ]
1856
+ },
1857
+ h.organization.id
1858
+ );
1859
+ }) : /* @__PURE__ */ e(
1860
+ Oe,
1861
+ {
1862
+ icon: /* @__PURE__ */ e(qe, { size: 20, "aria-hidden": "true" }),
1863
+ title: r.noOrganizations
1864
+ }
1865
+ )
1866
+ }
1867
+ )
1868
+ ] }), Sa = (t, h, y = r.noPeople) => t.length ? /* @__PURE__ */ e(
1869
+ "div",
1870
+ {
1871
+ className: "mf-people-picker__people-list",
1872
+ role: u ? "group" : "listbox",
1873
+ "aria-label": r.members,
1874
+ children: t.map((O, F) => /* @__PURE__ */ e(
1875
+ rt,
1876
+ {
1877
+ person: O,
1878
+ path: h?.[F],
1879
+ selected: x.has(O.id),
1880
+ multiple: u,
1881
+ disabled: o,
1882
+ onKeyDown: pn,
1883
+ onSelect: (R) => {
1884
+ u ? cn(O.id, R) : on(O);
1885
+ }
1886
+ },
1887
+ `${O.id}-${F}`
1888
+ ))
1889
+ }
1890
+ ) : /* @__PURE__ */ e(
1891
+ Oe,
1892
+ {
1893
+ icon: /* @__PURE__ */ e(ta, { size: 21, "aria-hidden": "true" }),
1894
+ title: s ?? y
1895
+ }
1896
+ ), xa = () => ln ? /* @__PURE__ */ d("div", { className: "mf-people-picker__status", children: [
1897
+ /* @__PURE__ */ e(Re, { label: r.searchingPeople }),
1898
+ /* @__PURE__ */ e("span", { children: r.searchingPeople })
1899
+ ] }) : sn ? /* @__PURE__ */ e(
1900
+ Oe,
1901
+ {
1902
+ icon: /* @__PURE__ */ e(ra, { size: 21, "aria-hidden": "true" }),
1903
+ title: r.searchError,
1904
+ action: /* @__PURE__ */ e(xe, { size: "sm", onClick: () => Ja((t) => t + 1), children: r.retry })
1905
+ }
1906
+ ) : Sa(
1907
+ Ca.map((t) => t.person),
1908
+ Ca.map((t) => t.organizationPath),
1909
+ r.noSearchResults
1910
+ ), Ma = () => M.trim() ? xa() : X ? nn && !Je.length ? /* @__PURE__ */ d("div", { className: "mf-people-picker__status", children: [
1911
+ /* @__PURE__ */ e(Re, { label: r.loadingMembers }),
1912
+ /* @__PURE__ */ e("span", { children: r.loadingMembers })
1913
+ ] }) : tn ? /* @__PURE__ */ e(
1914
+ Oe,
1915
+ {
1916
+ icon: /* @__PURE__ */ e(ra, { size: 21, "aria-hidden": "true" }),
1917
+ title: r.loadError,
1918
+ action: /* @__PURE__ */ e(
1919
+ xe,
1920
+ {
1921
+ size: "sm",
1922
+ onClick: () => {
1923
+ we(X).then(() => ie(ea)).catch(() => {
1924
+ });
1925
+ },
1926
+ children: r.retry
1927
+ }
1928
+ )
1929
+ }
1930
+ ) : Sa(Je, void 0, r.noDirectMembers) : /* @__PURE__ */ e(
1931
+ Oe,
1932
+ {
1933
+ icon: /* @__PURE__ */ e(qe, { size: 21, "aria-hidden": "true" }),
1934
+ title: r.noOrganizations
1935
+ }
1936
+ ), Da = () => /* @__PURE__ */ d("div", { className: "mf-people-picker__footer", children: [
1937
+ /* @__PURE__ */ d("div", { className: "mf-people-picker__footer-summary", children: [
1938
+ /* @__PURE__ */ e("span", { children: u ? r.selectedCount(V.length) : V.length ? r.singleSelected : r.noneSelected }),
1939
+ Xa && a.mode === "multiple" && a.maxSelected ? /* @__PURE__ */ e("small", { role: "alert", children: r.maxSelectedError(a.maxSelected) }) : null
1940
+ ] }),
1941
+ /* @__PURE__ */ d("div", { className: "mf-people-picker__footer-actions", children: [
1942
+ V.length ? /* @__PURE__ */ e(xe, { size: "sm", variant: "ghost", onClick: un, children: f.common.clear }) : null,
1943
+ u ? /* @__PURE__ */ d(De, { children: [
1944
+ /* @__PURE__ */ e(xe, { size: "sm", onClick: () => ze(!1), children: r.cancel }),
1945
+ /* @__PURE__ */ e(
1946
+ xe,
1947
+ {
1948
+ size: "sm",
1949
+ variant: "primary",
1950
+ disabled: !!Pe,
1951
+ onClick: dn,
1952
+ children: r.done
1953
+ }
1954
+ )
1955
+ ] }) : null
1956
+ ] })
1957
+ ] }), La = () => {
1958
+ const t = /* @__PURE__ */ e(
1959
+ An,
1960
+ {
1961
+ autoFocus: !0,
1962
+ size: g,
1963
+ value: M,
1964
+ placeholder: i ?? r.searchPeople,
1965
+ "aria-label": r.searchPeople,
1966
+ onValueChange: G
1967
+ }
1968
+ );
1969
+ if (_) {
1970
+ const h = !!ve && !M.trim();
1971
+ return /* @__PURE__ */ d("div", { className: "mf-people-picker__panel mf-people-picker__panel--mobile", children: [
1972
+ /* @__PURE__ */ d("div", { className: "mf-people-picker__drawer-header", children: [
1973
+ h ? /* @__PURE__ */ e(
1974
+ xe,
1975
+ {
1976
+ size: "sm",
1977
+ variant: "ghost",
1978
+ leadingIcon: /* @__PURE__ */ e(ua, { size: 14, "aria-hidden": "true" }),
1979
+ onClick: () => {
1980
+ S(null), G("");
1981
+ },
1982
+ children: r.back
1983
+ }
1984
+ ) : /* @__PURE__ */ d("span", { className: "mf-people-picker__drawer-title", children: [
1985
+ /* @__PURE__ */ e(ta, { size: 16, "aria-hidden": "true" }),
1986
+ r.selectPeople
1987
+ ] }),
1988
+ h && X ? /* @__PURE__ */ e("strong", { children: X.name }) : null
1989
+ ] }),
1990
+ /* @__PURE__ */ e("div", { className: "mf-people-picker__search", children: t }),
1991
+ /* @__PURE__ */ e("div", { className: "mf-people-picker__body", children: h ? Ma() : za(!1) }),
1992
+ Da()
1993
+ ] });
1994
+ }
1995
+ return /* @__PURE__ */ d("div", { className: "mf-people-picker__panel", children: [
1996
+ /* @__PURE__ */ e("div", { className: "mf-people-picker__search", children: t }),
1997
+ /* @__PURE__ */ e("div", { className: "mf-people-picker__body", children: M.trim() ? xa() : /* @__PURE__ */ d("div", { className: "mf-people-picker__browser", children: [
1998
+ za(),
1999
+ /* @__PURE__ */ d("div", { className: "mf-people-picker__member-pane", children: [
2000
+ /* @__PURE__ */ d("div", { className: "mf-people-picker__pane-heading", children: [
2001
+ /* @__PURE__ */ e("span", { children: X?.name ?? r.members }),
2002
+ X ? /* @__PURE__ */ e("small", { children: X.memberCount ?? Je.length }) : null
2003
+ ] }),
2004
+ /* @__PURE__ */ e("div", { className: "mf-people-picker__people-region", children: Ma() })
2005
+ ] })
2006
+ ] }) }),
2007
+ Da()
2008
+ ] });
2009
+ }, Ea = /* @__PURE__ */ d(
2010
+ "button",
2011
+ {
2012
+ type: "button",
2013
+ className: E(
2014
+ "mf-people-picker__trigger",
2015
+ J(g),
2016
+ m && "mf-input--invalid",
2017
+ o && "is-disabled"
2018
+ ),
2019
+ disabled: o,
2020
+ "aria-haspopup": "dialog",
2021
+ "aria-expanded": k,
2022
+ "aria-label": c ? `${c}: ${wa}` : void 0,
2023
+ "aria-describedby": v,
2024
+ children: [
2025
+ u ? fe.length ? /* @__PURE__ */ e(
2026
+ sa,
2027
+ {
2028
+ src: fe[0].avatarSrc,
2029
+ alt: "",
2030
+ fallback: da(fe[0].name),
2031
+ size: "sm"
2032
+ }
2033
+ ) : /* @__PURE__ */ e(ta, { size: 15, "aria-hidden": "true" }) : fe[0] ? /* @__PURE__ */ e(
2034
+ sa,
2035
+ {
2036
+ src: fe[0].avatarSrc,
2037
+ alt: "",
2038
+ fallback: da(fe[0].name),
2039
+ size: "sm"
2040
+ }
2041
+ ) : /* @__PURE__ */ e(zn, { size: 15, "aria-hidden": "true" }),
2042
+ /* @__PURE__ */ e(
2043
+ "span",
2044
+ {
2045
+ className: E(
2046
+ "mf-people-picker__trigger-copy",
2047
+ !V.length && "is-placeholder"
2048
+ ),
2049
+ children: wa
2050
+ }
2051
+ ),
2052
+ /* @__PURE__ */ e(
2053
+ Le,
2054
+ {
2055
+ className: "mf-people-picker__trigger-chevron",
2056
+ size: 15,
2057
+ "aria-hidden": "true"
2058
+ }
2059
+ )
2060
+ ]
2061
+ }
2062
+ );
2063
+ return /* @__PURE__ */ d(De, { children: [
2064
+ C ? V.map((t, h) => /* @__PURE__ */ e(
2065
+ "input",
2066
+ {
2067
+ type: "hidden",
2068
+ name: C,
2069
+ value: t
2070
+ },
2071
+ `${t}-${h}`
2072
+ )) : null,
2073
+ _ ? /* @__PURE__ */ d(Ln, { open: k, onOpenChange: (t) => ze(t), children: [
2074
+ /* @__PURE__ */ e(En, { asChild: !0, children: Ea }),
2075
+ /* @__PURE__ */ d(
2076
+ On,
2077
+ {
2078
+ side: "right",
2079
+ size: "full",
2080
+ className: "mf-people-picker__drawer",
2081
+ "aria-label": c ?? r.selectPeople,
2082
+ children: [
2083
+ /* @__PURE__ */ e(In, { className: "mf-visually-hidden", children: c ?? r.selectPeople }),
2084
+ La()
2085
+ ]
2086
+ }
2087
+ )
2088
+ ] }) : /* @__PURE__ */ d(pe, { open: k, onOpenChange: (t) => ze(t), children: [
2089
+ /* @__PURE__ */ e(ge, { asChild: !0, children: Ea }),
2090
+ /* @__PURE__ */ e(
2091
+ be,
2092
+ {
2093
+ align: "start",
2094
+ className: "mf-people-picker__popover",
2095
+ "aria-label": c ?? r.selectPeople,
2096
+ children: La()
2097
+ }
2098
+ )
2099
+ ] })
2100
+ ] });
2101
+ }
2102
+ const ha = bn(null), lt = "(max-width: 900px)";
2103
+ function it(a) {
2104
+ const [n, l] = A(!1);
2105
+ return H(() => {
2106
+ const i = window.matchMedia(a), s = () => l(i.matches);
2107
+ return s(), i.addEventListener("change", s), () => i.removeEventListener("change", s);
2108
+ }, [a]), n;
2109
+ }
2110
+ function Pa(a) {
2111
+ return [
2112
+ ...a.querySelectorAll(
2113
+ 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
2114
+ )
2115
+ ].filter((n) => !n.hasAttribute("hidden"));
2116
+ }
2117
+ function qa() {
2118
+ const a = Fa(ha);
2119
+ if (!a) throw new Error("useAppShell must be used inside AppShell.");
2120
+ return a;
2121
+ }
2122
+ function Va() {
2123
+ return Fa(ha);
2124
+ }
2125
+ const Qa = ue(
2126
+ ({ className: a, children: n, ...l }, i) => {
2127
+ const { messages: s } = U();
2128
+ return /* @__PURE__ */ e("a", { ref: i, className: E("mf-skip-link", a), ...l, children: n ?? s.navigation.skipToContent });
2129
+ }
2130
+ );
2131
+ Qa.displayName = "SkipLink";
2132
+ const st = ue(
2133
+ ({
2134
+ header: a,
2135
+ primarySidebar: n,
2136
+ sidebar: l,
2137
+ children: i,
2138
+ sidebarOpen: s,
2139
+ defaultSidebarOpen: o = !1,
2140
+ onSidebarOpenChange: m,
2141
+ sidebarCollapsed: g,
2142
+ defaultSidebarCollapsed: C = !1,
2143
+ onSidebarCollapsedChange: N,
2144
+ contentId: b,
2145
+ className: p,
2146
+ mainClassName: c,
2147
+ ...v
2148
+ }, f) => {
2149
+ const { messages: r } = U(), u = me(), _ = b ?? `mf-content-${u}`, z = Y(null), k = Y(!1), w = it(lt), L = !!l, P = !!n, [I, D] = W({
2150
+ value: s,
2151
+ defaultValue: o,
2152
+ onChange: m
2153
+ }), [$, Q] = W({
2154
+ value: g,
2155
+ defaultValue: C,
2156
+ onChange: N
2157
+ });
2158
+ return H(() => {
2159
+ const q = z.current?.querySelector(".mf-sidebar");
2160
+ q && (w && !I ? (q.setAttribute("inert", ""), q.setAttribute("aria-hidden", "true")) : (q.removeAttribute("inert"), q.removeAttribute("aria-hidden")));
2161
+ }, [L, w, I]), H(() => {
2162
+ const T = z.current;
2163
+ if (!w || !T) {
2164
+ k.current = !1;
2165
+ return;
2166
+ }
2167
+ const q = T.querySelector(".mf-sidebar");
2168
+ if (!I) {
2169
+ k.current && (k.current = !1, (T.querySelector(".mf-sidebar-trigger") ?? T.querySelector(".mf-primary-navigation__item.is-active") ?? T.querySelector(".mf-primary-navigation__item"))?.focus());
2170
+ return;
2171
+ }
2172
+ k.current = !0;
2173
+ const V = window.requestAnimationFrame(() => {
2174
+ (q?.querySelector(
2175
+ ".mf-sidebar__mobile-close"
2176
+ ) ?? Pa(q ?? T)[0])?.focus();
2177
+ }), x = (M) => {
2178
+ if (M.key === "Escape") {
2179
+ M.preventDefault(), D(!1);
2180
+ return;
2181
+ }
2182
+ if (M.key !== "Tab" || !q) return;
2183
+ const G = Pa(q);
2184
+ if (!G.length) {
2185
+ M.preventDefault();
2186
+ return;
2187
+ }
2188
+ const ee = G[0], re = G[G.length - 1];
2189
+ M.shiftKey && document.activeElement === ee ? (M.preventDefault(), re.focus()) : !M.shiftKey && document.activeElement === re && (M.preventDefault(), ee.focus());
2190
+ };
2191
+ return document.addEventListener("keydown", x), () => {
2192
+ window.cancelAnimationFrame(V), document.removeEventListener("keydown", x);
2193
+ };
2194
+ }, [w, I, D]), /* @__PURE__ */ e(
2195
+ ha.Provider,
2196
+ {
2197
+ value: {
2198
+ sidebarOpen: I,
2199
+ setSidebarOpen: D,
2200
+ sidebarCollapsed: $,
2201
+ setSidebarCollapsed: Q,
2202
+ contentId: _,
2203
+ isMobile: w
2204
+ },
2205
+ children: /* @__PURE__ */ d(
2206
+ "div",
2207
+ {
2208
+ ref: (T) => {
2209
+ z.current = T, typeof f == "function" ? f(T) : f && (f.current = T);
2210
+ },
2211
+ className: E("mf-app-shell", p),
2212
+ "data-header": a ? !0 : void 0,
2213
+ "data-has-primary-sidebar": P || void 0,
2214
+ "data-sidebar-open": I || void 0,
2215
+ "data-sidebar-collapsed": $ || void 0,
2216
+ ...v,
2217
+ children: [
2218
+ /* @__PURE__ */ e(Qa, { href: `#${_}` }),
2219
+ a ? /* @__PURE__ */ d("div", { className: "mf-app-shell__header", children: [
2220
+ l ? /* @__PURE__ */ e(ja, {}) : null,
2221
+ /* @__PURE__ */ e("div", { className: "mf-app-shell__header-content", children: a })
2222
+ ] }) : null,
2223
+ /* @__PURE__ */ d("div", { className: "mf-app-shell__body", children: [
2224
+ n,
2225
+ l,
2226
+ /* @__PURE__ */ e(
2227
+ "main",
2228
+ {
2229
+ id: _,
2230
+ className: E("mf-app-shell__main", c),
2231
+ tabIndex: -1,
2232
+ children: i
2233
+ }
2234
+ )
2235
+ ] }),
2236
+ l ? /* @__PURE__ */ e(
2237
+ "button",
2238
+ {
2239
+ type: "button",
2240
+ className: "mf-app-shell__backdrop",
2241
+ "aria-label": r.navigation.closeNavigation,
2242
+ onClick: () => D(!1)
2243
+ }
2244
+ ) : null
2245
+ ]
2246
+ }
2247
+ )
2248
+ }
2249
+ );
2250
+ }
2251
+ );
2252
+ st.displayName = "AppShell";
2253
+ function ot({
2254
+ items: a,
2255
+ activeId: n,
2256
+ label: l,
2257
+ header: i,
2258
+ footer: s,
2259
+ onItemSelect: o,
2260
+ openSecondaryNavigation: m = !0,
2261
+ className: g,
2262
+ ...C
2263
+ }) {
2264
+ const { messages: N } = U(), b = Va(), p = (c) => {
2265
+ c.disabled || (o?.(c), m && b?.isMobile && b.setSidebarOpen(!0));
2266
+ };
2267
+ return /* @__PURE__ */ d(
2268
+ "nav",
2269
+ {
2270
+ className: E("mf-primary-navigation", g),
2271
+ "aria-label": l ?? N.navigation.primaryNavigation,
2272
+ ...C,
2273
+ children: [
2274
+ i ? /* @__PURE__ */ e("div", { className: "mf-primary-navigation__header", children: i }) : null,
2275
+ /* @__PURE__ */ e("ul", { className: "mf-primary-navigation__list", children: a.map((c) => {
2276
+ const v = c.id === n, f = E(
2277
+ "mf-primary-navigation__item",
2278
+ v && "is-active",
2279
+ c.disabled && "is-disabled"
2280
+ ), r = /* @__PURE__ */ d(De, { children: [
2281
+ /* @__PURE__ */ e("span", { className: "mf-primary-navigation__icon", "aria-hidden": "true", children: c.icon }),
2282
+ /* @__PURE__ */ e("span", { className: "mf-primary-navigation__tooltip", "aria-hidden": "true", children: c.label })
2283
+ ] });
2284
+ return /* @__PURE__ */ e("li", { className: "mf-primary-navigation__list-item", children: c.href ? /* @__PURE__ */ e(
2285
+ "a",
2286
+ {
2287
+ className: f,
2288
+ href: c.href,
2289
+ target: c.external ? "_blank" : void 0,
2290
+ rel: c.external ? "noopener noreferrer" : void 0,
2291
+ "aria-current": v ? "page" : void 0,
2292
+ "aria-label": c.label,
2293
+ "aria-disabled": c.disabled || void 0,
2294
+ tabIndex: c.disabled ? -1 : void 0,
2295
+ onClick: (u) => {
2296
+ if (c.disabled) {
2297
+ u.preventDefault();
2298
+ return;
2299
+ }
2300
+ p(c);
2301
+ },
2302
+ children: r
2303
+ }
2304
+ ) : /* @__PURE__ */ e(
2305
+ "button",
2306
+ {
2307
+ className: f,
2308
+ type: "button",
2309
+ "aria-label": c.label,
2310
+ "aria-pressed": v,
2311
+ disabled: c.disabled,
2312
+ onClick: () => p(c),
2313
+ children: r
2314
+ }
2315
+ ) }, c.id);
2316
+ }) }),
2317
+ s ? /* @__PURE__ */ e("div", { className: "mf-primary-navigation__footer", children: s }) : null
2318
+ ]
2319
+ }
2320
+ );
2321
+ }
2322
+ ot.displayName = "PrimaryNavigation";
2323
+ function xt({
2324
+ header: a,
2325
+ footer: n,
2326
+ collapsible: l = !0,
2327
+ className: i,
2328
+ children: s,
2329
+ ...o
2330
+ }) {
2331
+ const { sidebarCollapsed: m, setSidebarCollapsed: g, setSidebarOpen: C } = qa(), { messages: N } = U();
2332
+ return /* @__PURE__ */ d(
2333
+ "aside",
2334
+ {
2335
+ className: E("mf-sidebar", i),
2336
+ "data-collapsed": m || void 0,
2337
+ ...o,
2338
+ children: [
2339
+ /* @__PURE__ */ e(
2340
+ "button",
2341
+ {
2342
+ type: "button",
2343
+ className: "mf-sidebar__mobile-close",
2344
+ "aria-label": N.navigation.closeNavigation,
2345
+ onClick: () => C(!1),
2346
+ children: /* @__PURE__ */ e(Ie, { size: 15, "aria-hidden": "true" })
2347
+ }
2348
+ ),
2349
+ a ? /* @__PURE__ */ e("div", { className: "mf-sidebar__header", children: a }) : null,
2350
+ /* @__PURE__ */ e("div", { className: "mf-sidebar__content", children: s }),
2351
+ n ? /* @__PURE__ */ e("div", { className: "mf-sidebar__footer", children: n }) : null,
2352
+ l ? /* @__PURE__ */ d(
2353
+ "button",
2354
+ {
2355
+ type: "button",
2356
+ className: "mf-sidebar__collapse",
2357
+ "aria-label": m ? N.navigation.expandSidebar : N.navigation.collapseSidebar,
2358
+ "aria-pressed": m,
2359
+ onClick: () => g(!m),
2360
+ children: [
2361
+ m ? /* @__PURE__ */ e(Sn, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ e(xn, { size: 14, "aria-hidden": "true" }),
2362
+ /* @__PURE__ */ e("span", { children: m ? N.navigation.expandSidebar : N.navigation.collapseSidebar })
2363
+ ]
2364
+ }
2365
+ ) : null
2366
+ ]
2367
+ }
2368
+ );
2369
+ }
2370
+ const ja = ue(
2371
+ ({ label: a, className: n, ...l }, i) => {
2372
+ const { setSidebarOpen: s } = qa(), { messages: o } = U();
2373
+ return /* @__PURE__ */ e(
2374
+ "button",
2375
+ {
2376
+ ref: i,
2377
+ type: "button",
2378
+ className: E("mf-sidebar-trigger", n),
2379
+ "aria-label": a ?? o.navigation.openNavigation,
2380
+ onClick: () => s(!0),
2381
+ ...l,
2382
+ children: /* @__PURE__ */ e(Mn, { size: 16, "aria-hidden": "true" })
2383
+ }
2384
+ );
2385
+ }
2386
+ );
2387
+ ja.displayName = "SidebarTrigger";
2388
+ function Mt({
2389
+ breadcrumbs: a,
2390
+ title: n,
2391
+ description: l,
2392
+ status: i,
2393
+ actions: s,
2394
+ className: o,
2395
+ ...m
2396
+ }) {
2397
+ return /* @__PURE__ */ d("header", { className: E("mf-page-header", o), ...m, children: [
2398
+ a ? /* @__PURE__ */ e("div", { className: "mf-page-header__breadcrumbs", children: a }) : null,
2399
+ /* @__PURE__ */ d("div", { className: "mf-page-header__main", children: [
2400
+ /* @__PURE__ */ d("div", { className: "mf-page-header__copy", children: [
2401
+ /* @__PURE__ */ d("div", { className: "mf-page-header__title-row", children: [
2402
+ /* @__PURE__ */ e("h1", { children: n }),
2403
+ i
2404
+ ] }),
2405
+ l ? /* @__PURE__ */ e("p", { children: l }) : null
2406
+ ] }),
2407
+ s ? /* @__PURE__ */ e("div", { className: "mf-page-header__actions", children: s }) : null
2408
+ ] })
2409
+ ] });
2410
+ }
2411
+ function Ya(a, n) {
2412
+ return a.id === n ? !0 : a.children?.some((l) => Ya(l, n)) ?? !1;
2413
+ }
2414
+ function Wa({
2415
+ item: a,
2416
+ activeId: n,
2417
+ expanded: l,
2418
+ onToggle: i,
2419
+ onNavigate: s
2420
+ }) {
2421
+ const o = a.id === n, m = Ya(a, n), g = !!a.children?.length, C = l.has(a.id), N = {
2422
+ className: E(
2423
+ "mf-nav-menu__item",
2424
+ o && "is-active",
2425
+ m && !o && "has-active-child",
2426
+ a.disabled && "is-disabled"
2427
+ ),
2428
+ "aria-current": o ? "page" : void 0
2429
+ };
2430
+ return g ? /* @__PURE__ */ d("li", { className: "mf-nav-menu__li", children: [
2431
+ /* @__PURE__ */ d(
2432
+ "button",
2433
+ {
2434
+ type: "button",
2435
+ ...N,
2436
+ className: E(N.className, "mf-nav-menu__item--button"),
2437
+ "aria-expanded": C,
2438
+ disabled: a.disabled,
2439
+ onClick: () => i(a.id),
2440
+ children: [
2441
+ a.icon ? /* @__PURE__ */ e("span", { className: "mf-nav-menu__icon", children: a.icon }) : null,
2442
+ /* @__PURE__ */ e("span", { className: "mf-nav-menu__label", children: a.label }),
2443
+ a.badge ? /* @__PURE__ */ e(Oa, { tone: a.badge.tone, className: "mf-nav-menu__badge", children: a.badge.label }) : null,
2444
+ /* @__PURE__ */ e(Le, { className: "mf-nav-menu__chevron", size: 12, "aria-hidden": "true" })
2445
+ ]
2446
+ }
2447
+ ),
2448
+ C ? /* @__PURE__ */ e("ul", { className: "mf-nav-menu__sublist", children: a.children?.map((b) => /* @__PURE__ */ e(
2449
+ Wa,
2450
+ {
2451
+ item: b,
2452
+ activeId: n,
2453
+ expanded: l,
2454
+ onToggle: i,
2455
+ onNavigate: s
2456
+ },
2457
+ b.id
2458
+ )) }) : null
2459
+ ] }) : /* @__PURE__ */ e("li", { className: "mf-nav-menu__li", children: /* @__PURE__ */ d(
2460
+ "a",
2461
+ {
2462
+ ...N,
2463
+ href: a.href,
2464
+ target: a.external ? "_blank" : void 0,
2465
+ rel: a.external ? "noreferrer" : void 0,
2466
+ "aria-disabled": a.disabled || void 0,
2467
+ onClick: (b) => {
2468
+ if (a.disabled) {
2469
+ b.preventDefault();
2470
+ return;
2471
+ }
2472
+ s?.(a);
2473
+ },
2474
+ children: [
2475
+ a.icon ? /* @__PURE__ */ e("span", { className: "mf-nav-menu__icon", children: a.icon }) : null,
2476
+ /* @__PURE__ */ d("span", { className: "mf-nav-menu__copy", children: [
2477
+ /* @__PURE__ */ e("span", { className: "mf-nav-menu__label", children: a.label }),
2478
+ a.description ? /* @__PURE__ */ e("small", { className: "mf-nav-menu__description", children: a.description }) : null
2479
+ ] }),
2480
+ a.badge ? /* @__PURE__ */ e(Oa, { tone: a.badge.tone, className: "mf-nav-menu__badge", children: a.badge.label }) : null
2481
+ ]
2482
+ }
2483
+ ) });
2484
+ }
2485
+ const ct = ue(
2486
+ ({
2487
+ groups: a,
2488
+ activeId: n,
2489
+ expanded: l,
2490
+ defaultExpanded: i = [],
2491
+ onExpandedChange: s,
2492
+ onNavigate: o,
2493
+ className: m,
2494
+ ...g
2495
+ }, C) => {
2496
+ const { messages: N } = U(), b = Va(), [p, c] = A(
2497
+ () => new Set(i)
2498
+ ), v = new Set(l ?? p);
2499
+ H(() => {
2500
+ if (!n) return;
2501
+ const r = [], u = (_, z) => {
2502
+ _.forEach((k) => {
2503
+ k.id === n && r.push(...z), k.children && u(k.children, [...z, k.id]);
2504
+ });
2505
+ };
2506
+ a.forEach((_) => u(_.items, [])), r.length && (l === void 0 ? c((_) => /* @__PURE__ */ new Set([..._, ...r])) : s?.([.../* @__PURE__ */ new Set([...l, ...r])]));
2507
+ }, [n, l, a, s]);
2508
+ const f = (r) => {
2509
+ const u = new Set(v);
2510
+ u.has(r) ? u.delete(r) : u.add(r);
2511
+ const _ = [...u];
2512
+ l === void 0 && c(u), s?.(_);
2513
+ };
2514
+ return /* @__PURE__ */ e(
2515
+ "nav",
2516
+ {
2517
+ ref: C,
2518
+ className: E("mf-nav-menu", m),
2519
+ "aria-label": N.navigation.appNavigation,
2520
+ ...g,
2521
+ children: a.map((r) => /* @__PURE__ */ d("section", { className: "mf-nav-menu__group", children: [
2522
+ r.label ? /* @__PURE__ */ e("h2", { className: "mf-nav-menu__group-label", children: r.label }) : null,
2523
+ /* @__PURE__ */ e("ul", { className: "mf-nav-menu__list", children: r.items.map((u) => /* @__PURE__ */ e(
2524
+ Wa,
2525
+ {
2526
+ item: u,
2527
+ activeId: n,
2528
+ expanded: v,
2529
+ onToggle: f,
2530
+ onNavigate: (_) => {
2531
+ b?.setSidebarOpen(!1), o?.(_);
2532
+ }
2533
+ },
2534
+ u.id
2535
+ )) })
2536
+ ] }, r.id))
2537
+ }
2538
+ );
2539
+ }
2540
+ );
2541
+ ct.displayName = "NavMenu";
2542
+ function Dt({
2543
+ items: a,
2544
+ label: n,
2545
+ className: l,
2546
+ ...i
2547
+ }) {
2548
+ const { messages: s } = U();
2549
+ return /* @__PURE__ */ d(
2550
+ de.Root,
2551
+ {
2552
+ className: E("mf-top-nav", l),
2553
+ "aria-label": n ?? s.navigation.appNavigation,
2554
+ ...i,
2555
+ children: [
2556
+ /* @__PURE__ */ e(de.List, { className: "mf-top-nav__list", children: a.map((o) => /* @__PURE__ */ e(de.Item, { value: o.id, children: o.children?.length ? /* @__PURE__ */ d(De, { children: [
2557
+ /* @__PURE__ */ d(
2558
+ de.Trigger,
2559
+ {
2560
+ className: "mf-top-nav__trigger",
2561
+ "data-active": o.active || void 0,
2562
+ children: [
2563
+ o.label,
2564
+ /* @__PURE__ */ e(je, { size: 12, "aria-hidden": "true" })
2565
+ ]
2566
+ }
2567
+ ),
2568
+ /* @__PURE__ */ e(de.Content, { className: "mf-top-nav__flyout", children: /* @__PURE__ */ e("ul", { className: "mf-top-nav__flyout-list", children: o.children.map((m) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(de.Link, { asChild: !0, children: /* @__PURE__ */ e(
2569
+ "a",
2570
+ {
2571
+ href: m.href,
2572
+ target: m.external ? "_blank" : void 0,
2573
+ rel: m.external ? "noreferrer" : void 0,
2574
+ "aria-current": m.active ? "page" : void 0,
2575
+ "data-active": m.active || void 0,
2576
+ children: m.label
2577
+ }
2578
+ ) }) }, m.id)) }) })
2579
+ ] }) : /* @__PURE__ */ e(de.Link, { asChild: !0, children: /* @__PURE__ */ e(
2580
+ "a",
2581
+ {
2582
+ className: "mf-top-nav__link",
2583
+ href: o.href,
2584
+ target: o.external ? "_blank" : void 0,
2585
+ rel: o.external ? "noreferrer" : void 0,
2586
+ "aria-current": o.active ? "page" : void 0,
2587
+ "data-active": o.active || void 0,
2588
+ children: o.label
2589
+ }
2590
+ ) }) }, o.id)) }),
2591
+ /* @__PURE__ */ e("div", { className: "mf-top-nav__viewport-wrap", children: /* @__PURE__ */ e(de.Viewport, { className: "mf-top-nav__viewport" }) })
2592
+ ]
2593
+ }
2594
+ );
2595
+ }
2596
+ function Lt({
2597
+ commands: a,
2598
+ open: n,
2599
+ defaultOpen: l = !1,
2600
+ onOpenChange: i,
2601
+ shortcut: s = !0,
2602
+ showTrigger: o = !1,
2603
+ triggerLabel: m,
2604
+ placeholder: g,
2605
+ emptyMessage: C,
2606
+ onCommandError: N,
2607
+ className: b
2608
+ }) {
2609
+ const { messages: p } = U(), c = me(), v = Y(null), f = Y(null), r = Y(null), [u, _] = W({
2610
+ value: n,
2611
+ defaultValue: l,
2612
+ onChange: i
2613
+ }), [z, k] = A(""), [w, L] = A(0), [P, I] = A(null), D = te(
2614
+ (x) => {
2615
+ r.current = x ?? f.current ?? (document.activeElement instanceof HTMLElement ? document.activeElement : null), _(!0);
2616
+ },
2617
+ [_]
2618
+ ), $ = te(() => {
2619
+ const x = r.current;
2620
+ _(!1), x && window.setTimeout(() => x.focus(), 0);
2621
+ }, [_]);
2622
+ H(() => {
2623
+ if (!s) return;
2624
+ const x = (M) => {
2625
+ (M.metaKey || M.ctrlKey) && M.key.toLowerCase() === "k" && (M.preventDefault(), u ? $() : D(f.current));
2626
+ };
2627
+ return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
2628
+ }, [$, u, D, s]), H(() => {
2629
+ u || (k(""), L(0), I(null));
2630
+ }, [u]);
2631
+ const Q = Z(() => {
2632
+ const x = z.trim().toLocaleLowerCase();
2633
+ return x ? a.filter((M) => M.disabled ? !1 : M.label.toLocaleLowerCase().includes(x) || M.description?.toLocaleLowerCase().includes(x) || M.group?.toLocaleLowerCase().includes(x) || M.keywords?.some(
2634
+ (G) => G.toLocaleLowerCase().includes(x)
2635
+ )) : a.filter((M) => !M.disabled);
2636
+ }, [a, z]), T = async (x) => {
2637
+ if (!x.disabled) {
2638
+ I(null), $();
2639
+ try {
2640
+ await x.onSelect();
2641
+ } catch (M) {
2642
+ N ? N(M, x) : (I(p.navigation.commandError), D(r.current));
2643
+ }
2644
+ }
2645
+ }, q = (x) => {
2646
+ x.key === "ArrowDown" ? (x.preventDefault(), L(
2647
+ (M) => Q.length ? Math.min(Q.length - 1, M + 1) : 0
2648
+ )) : x.key === "ArrowUp" ? (x.preventDefault(), L((M) => Math.max(0, M - 1))) : x.key === "Enter" && Q[w] && (x.preventDefault(), T(Q[w]));
2649
+ };
2650
+ let V;
2651
+ return /* @__PURE__ */ d(De, { children: [
2652
+ o ? /* @__PURE__ */ d(
2653
+ "button",
2654
+ {
2655
+ ref: f,
2656
+ type: "button",
2657
+ className: E("mf-command-trigger", b),
2658
+ "aria-label": `${m ?? p.navigation.openCommands} ⌘K`,
2659
+ onClick: () => D(),
2660
+ children: [
2661
+ /* @__PURE__ */ e(Me, { size: 14, "aria-hidden": "true" }),
2662
+ /* @__PURE__ */ e("span", { children: m ?? p.navigation.openCommands }),
2663
+ /* @__PURE__ */ d(Ia, { children: [
2664
+ /* @__PURE__ */ e(Dn, { size: 10, "aria-hidden": "true" }),
2665
+ "K"
2666
+ ] })
2667
+ ]
2668
+ }
2669
+ ) : null,
2670
+ /* @__PURE__ */ e(
2671
+ $n,
2672
+ {
2673
+ open: u,
2674
+ onOpenChange: (x) => {
2675
+ x ? D() : $();
2676
+ },
2677
+ children: /* @__PURE__ */ d(Pn, { className: "mf-command-palette", "aria-describedby": void 0, children: [
2678
+ /* @__PURE__ */ e(Fn, { className: "mf-visually-hidden", children: p.navigation.openCommands }),
2679
+ /* @__PURE__ */ e(Tn, { className: "mf-visually-hidden", children: g ?? p.navigation.commandPlaceholder }),
2680
+ /* @__PURE__ */ d("div", { className: "mf-command-palette__search", children: [
2681
+ /* @__PURE__ */ e(Me, { size: 16, "aria-hidden": "true" }),
2682
+ /* @__PURE__ */ e(
2683
+ "input",
2684
+ {
2685
+ ref: v,
2686
+ autoFocus: !0,
2687
+ role: "combobox",
2688
+ "aria-label": g ?? p.navigation.commandPlaceholder,
2689
+ "aria-autocomplete": "list",
2690
+ "aria-expanded": "true",
2691
+ "aria-controls": c,
2692
+ "aria-activedescendant": Q[w] ? `${c}-${Q[w].id}` : void 0,
2693
+ value: z,
2694
+ placeholder: g ?? p.navigation.commandPlaceholder,
2695
+ onChange: (x) => {
2696
+ k(x.target.value), L(0);
2697
+ },
2698
+ onKeyDown: q
2699
+ }
2700
+ )
2701
+ ] }),
2702
+ /* @__PURE__ */ d("div", { className: "mf-command-palette__list", id: c, role: "listbox", children: [
2703
+ P ? /* @__PURE__ */ e("div", { className: "mf-command-palette__error", role: "alert", children: P }) : null,
2704
+ Q.length ? Q.map((x, M) => {
2705
+ const G = x.group && x.group !== V;
2706
+ return V = x.group, /* @__PURE__ */ d("div", { className: "mf-command-palette__option-wrap", children: [
2707
+ G ? /* @__PURE__ */ e("div", { className: "mf-command-palette__group", children: x.group }) : null,
2708
+ /* @__PURE__ */ d(
2709
+ "button",
2710
+ {
2711
+ type: "button",
2712
+ id: `${c}-${x.id}`,
2713
+ role: "option",
2714
+ "aria-selected": M === w,
2715
+ tabIndex: -1,
2716
+ className: E(
2717
+ "mf-command-palette__option",
2718
+ M === w && "is-active"
2719
+ ),
2720
+ disabled: x.disabled,
2721
+ onMouseEnter: () => L(M),
2722
+ onClick: () => {
2723
+ T(x);
2724
+ },
2725
+ children: [
2726
+ x.icon ? /* @__PURE__ */ e("span", { className: "mf-command-palette__icon", children: x.icon }) : /* @__PURE__ */ e("span", { className: "mf-command-palette__icon", children: /* @__PURE__ */ e(Me, { size: 13, "aria-hidden": "true" }) }),
2727
+ /* @__PURE__ */ d("span", { className: "mf-command-palette__copy", children: [
2728
+ /* @__PURE__ */ e("span", { children: x.label }),
2729
+ x.description ? /* @__PURE__ */ e("small", { children: x.description }) : null
2730
+ ] }),
2731
+ x.shortcut ? /* @__PURE__ */ e(Ia, { children: x.shortcut }) : null
2732
+ ]
2733
+ }
2734
+ )
2735
+ ] }, x.id);
2736
+ }) : /* @__PURE__ */ e("div", { className: "mf-command-palette__empty", children: C ?? p.navigation.noCommands })
2737
+ ] }),
2738
+ /* @__PURE__ */ e("div", { className: "mf-command-palette__footer", children: p.navigation.commandKeyboardHint })
2739
+ ] })
2740
+ }
2741
+ )
2742
+ ] });
2743
+ }
2744
+ export {
2745
+ st as A,
2746
+ jn as C,
2747
+ Nt as D,
2748
+ Xn as F,
2749
+ Yn as I,
2750
+ bt as M,
2751
+ ct as N,
2752
+ Mt as P,
2753
+ kt as R,
2754
+ xt as S,
2755
+ vt as T,
2756
+ _t as U,
2757
+ wt as a,
2758
+ Ct as b,
2759
+ gt as c,
2760
+ Lt as d,
2761
+ yt as e,
2762
+ Dt as f,
2763
+ St as g,
2764
+ ot as h,
2765
+ ja as i,
2766
+ Qa as j,
2767
+ Wn as k,
2768
+ Kn as l,
2769
+ zt as m,
2770
+ Va as n,
2771
+ qa as u
2772
+ };
2773
+ //# sourceMappingURL=command-palette-DwfgljM2.js.map