@amateescu/portal-ui-components 0.0.38 → 0.0.40

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 (54) hide show
  1. package/dist/{Button-BM72-1G6.js → Button-BPIbs5cw.js} +3 -3
  2. package/dist/{ButtonBase-D6nf3ymf.js → ButtonBase-Cj889DO9.js} +4 -4
  3. package/dist/CheckBox-B3iprBDG.js +11 -0
  4. package/dist/{CircularProgress-BlQFR6DW.js → CircularProgress-BjeN7Xv-.js} +8 -8
  5. package/dist/{Clear-BauR3cPE.js → Clear-BzF0WMi7.js} +1 -1
  6. package/dist/{DefaultPropsProvider-BtPfTrMq.js → DefaultPropsProvider-8An9vBcT.js} +13 -12
  7. package/dist/Search-BxOqluZm.js +8 -0
  8. package/dist/assets/index.css +1 -1
  9. package/dist/components/LoadingAnimation/LoadingAnimation.js +18 -17
  10. package/dist/components/Login/Login.js +1 -1
  11. package/dist/components/PassportButton/PassportButton.js +1 -1
  12. package/dist/components/PassportDatePicker/PassportDatePicker.js +7 -6
  13. package/dist/components/PassportDateTimePicker/PassportDateTimePicker.js +32 -31
  14. package/dist/components/PassportInput/PassportInput.js +9 -12
  15. package/dist/components/PassportMultiSelect/PassportMultiSelect.js +1 -1
  16. package/dist/components/PassportPagination/PassportPagination.js +7 -6
  17. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.d.ts +3 -0
  18. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.d.ts.map +1 -0
  19. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.js +76 -0
  20. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.stories.d.ts +30 -0
  21. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.stories.d.ts.map +1 -0
  22. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.types.d.ts +17 -0
  23. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.types.d.ts.map +1 -0
  24. package/dist/components/PassportSearchableMultiSelect/PassportSearchableMultiSelect.types.js +1 -0
  25. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.d.ts +3 -0
  26. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.d.ts.map +1 -0
  27. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.js +100 -0
  28. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.stories.d.ts +31 -0
  29. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.stories.d.ts.map +1 -0
  30. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.types.d.ts +19 -0
  31. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.types.d.ts.map +1 -0
  32. package/dist/components/PassportSearchableMultiSelectDetailed/PassportSearchableMultiSelectDetailed.types.js +1 -0
  33. package/dist/components/PassportTreeSelect/PassportTreeSelect.d.ts +3 -0
  34. package/dist/components/PassportTreeSelect/PassportTreeSelect.d.ts.map +1 -0
  35. package/dist/components/PassportTreeSelect/PassportTreeSelect.js +4641 -0
  36. package/dist/components/PassportTreeSelect/PassportTreeSelect.stories.d.ts +33 -0
  37. package/dist/components/PassportTreeSelect/PassportTreeSelect.stories.d.ts.map +1 -0
  38. package/dist/components/PassportTreeSelect/PassportTreeSelect.types.d.ts +20 -0
  39. package/dist/components/PassportTreeSelect/PassportTreeSelect.types.d.ts.map +1 -0
  40. package/dist/components/PassportTreeSelect/PassportTreeSelect.types.js +1 -0
  41. package/dist/components/index.d.ts +3 -0
  42. package/dist/components/index.d.ts.map +1 -1
  43. package/dist/components/index.js +42 -36
  44. package/dist/{createSvgIcon-B-eIQ7rU.js → createSvgIcon-DQP4Lgl5.js} +1 -1
  45. package/dist/extendSxProp-kvzSbCJ3.js +36 -0
  46. package/dist/integerPropType-BihGt2aU.js +31 -0
  47. package/dist/main.js +57 -51
  48. package/dist/useFormControl-DUby-fW8.js +498 -0
  49. package/dist/{useMobilePicker-hk2kq6ev.js → useMobilePicker-CDuVVUzY.js} +3001 -3479
  50. package/dist/useSlot-Bvdicoh5.js +160 -0
  51. package/dist/useTheme-BHcsKB53.js +18 -0
  52. package/package.json +2 -1
  53. package/dist/extendSxProp-QNe1Nf_s.js +0 -51
  54. package/dist/useSlot-CXnK24LX.js +0 -189
@@ -0,0 +1,4641 @@
1
+ import { jsx as v, jsxs as Y, Fragment as mn } from "react/jsx-runtime";
2
+ import * as M from "react";
3
+ import $e, { useState as We, useRef as gt, useMemo as Ke, useEffect as bt, useCallback as St } from "react";
4
+ import { FormControl as In, InputLabel as gn, OutlinedInput as bn, InputAdornment as yt, IconButton as Sn, Box as fe, Chip as xt, Collapse as yn, Paper as xn, TextField as En, Typography as Ue, Checkbox as Cn } from "@mui/material";
5
+ import { S as vn } from "../../Search-BxOqluZm.js";
6
+ import { c as ge } from "../../createSvgIcon-DQP4Lgl5.js";
7
+ import { C as wn } from "../../Clear-BzF0WMi7.js";
8
+ import { _ as Be, a as S, e as Tn, u as kn, f as On, B as Mn, r as Pn } from "../../ButtonBase-Cj889DO9.js";
9
+ import { g as Ce, a as ve, P as i, s as G, e as we, u as Kt, t as Rn, c as Q, m as Ut, b as xe, l as Ht, p as st, q as Se } from "../../DefaultPropsProvider-8An9vBcT.js";
10
+ import { u as Ln, b as te, T as Dn, c as _n, g as Et, d as An, m as Nn, a as Fn } from "../../useFormControl-DUby-fW8.js";
11
+ import { a as Vn, b as Ie, u as zn, e as re, r as Ct } from "../../useSlot-Bvdicoh5.js";
12
+ import { c as vt } from "../../createSimplePaletteValueFilter-Bz8RuRaa.js";
13
+ import { C as jn } from "../../CircularProgress-BjeN7Xv-.js";
14
+ const $n = ge(/* @__PURE__ */ v("path", {
15
+ d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
16
+ }), "ExpandMore"), wt = {};
17
+ function it(t, e) {
18
+ const n = M.useRef(wt);
19
+ return n.current === wt && (n.current = t(e)), n;
20
+ }
21
+ function Ne(t, e, n, o) {
22
+ const r = it(Bn).current;
23
+ return Wn(r, t, e, n, o) && Kn(r, [t, e, n, o]), r.callback;
24
+ }
25
+ function Bn() {
26
+ return {
27
+ callback: null,
28
+ cleanup: null,
29
+ refs: []
30
+ };
31
+ }
32
+ function Wn(t, e, n, o, r) {
33
+ return t.refs[0] !== e || t.refs[1] !== n || t.refs[2] !== o || t.refs[3] !== r;
34
+ }
35
+ function Kn(t, e) {
36
+ if (t.refs = e, e.every((n) => n == null)) {
37
+ t.callback = null;
38
+ return;
39
+ }
40
+ t.callback = (n) => {
41
+ if (t.cleanup && (t.cleanup(), t.cleanup = null), n != null) {
42
+ const o = Array(e.length).fill(null);
43
+ for (let r = 0; r < e.length; r += 1) {
44
+ const s = e[r];
45
+ if (s != null)
46
+ switch (typeof s) {
47
+ case "function": {
48
+ const l = s(n);
49
+ typeof l == "function" && (o[r] = l);
50
+ break;
51
+ }
52
+ case "object": {
53
+ s.current = n;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ t.cleanup = () => {
59
+ for (let r = 0; r < e.length; r += 1) {
60
+ const s = e[r];
61
+ if (s != null)
62
+ switch (typeof s) {
63
+ case "function": {
64
+ const l = o[r];
65
+ typeof l == "function" ? l() : s(null);
66
+ break;
67
+ }
68
+ case "object": {
69
+ s.current = null;
70
+ break;
71
+ }
72
+ }
73
+ }
74
+ };
75
+ }
76
+ };
77
+ }
78
+ const Tt = /* @__PURE__ */ new Set();
79
+ function et(t, e = "warning") {
80
+ if (process.env.NODE_ENV === "production")
81
+ return;
82
+ const n = Array.isArray(t) ? t.join(`
83
+ `) : t;
84
+ Tt.has(n) || (Tt.add(n), e === "error" ? console.error(n) : console.warn(n));
85
+ }
86
+ function qt(t) {
87
+ return Ln;
88
+ }
89
+ function Un(t) {
90
+ return Ce("MuiSimpleTreeView", t);
91
+ }
92
+ ve("MuiSimpleTreeView", ["root", "item", "itemContent", "itemGroupTransition", "itemIconContainer", "itemLabel", "itemCheckbox"]);
93
+ const tt = Object.freeze([]), ye = Object.freeze({}), lt = /* @__PURE__ */ M.createContext(null);
94
+ process.env.NODE_ENV !== "production" && (lt.displayName = "TreeViewContext");
95
+ const be = () => {
96
+ const t = M.useContext(lt);
97
+ if (t == null)
98
+ throw new Error(["MUI X: Could not find the Tree View context.", "It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.", "This can also happen if you are bundling multiple versions of the Tree View."].join(`
99
+ `));
100
+ return t;
101
+ }, at = /* @__PURE__ */ M.createContext({
102
+ classes: {},
103
+ slots: {},
104
+ slotProps: {}
105
+ });
106
+ process.env.NODE_ENV !== "production" && (at.displayName = "TreeViewStyleContext");
107
+ const Gt = () => M.useContext(at), Hn = (t) => {
108
+ const {
109
+ store: e,
110
+ apiRef: n,
111
+ rootRef: o
112
+ } = t, r = it(() => e.buildPublicAPI()).current;
113
+ qn(r, n);
114
+ const s = M.useCallback((a) => {
115
+ let h = null, d = null;
116
+ const c = [], p = {};
117
+ e.itemPluginManager.listPlugins().forEach((m) => {
118
+ const I = m({
119
+ props: a,
120
+ rootRef: h,
121
+ contentRef: d
122
+ });
123
+ I?.rootRef && (h = I.rootRef), I?.contentRef && (d = I.contentRef), I?.propsEnhancers && (c.push(I.propsEnhancers), Object.keys(I.propsEnhancers).forEach((b) => {
124
+ p[b] = !0;
125
+ }));
126
+ });
127
+ const f = (m) => (I) => {
128
+ const b = {};
129
+ return c.forEach((x) => {
130
+ const w = x[m];
131
+ w != null && Object.assign(b, w(I));
132
+ }), b;
133
+ }, u = Object.fromEntries(Object.keys(p).map((m) => [m, f(m)]));
134
+ return {
135
+ contentRef: d,
136
+ rootRef: h,
137
+ propsEnhancers: u
138
+ };
139
+ }, [e]), l = M.useCallback(({
140
+ itemId: a,
141
+ children: h,
142
+ idAttribute: d
143
+ }) => {
144
+ let c = h;
145
+ const p = e.itemPluginManager.listWrappers();
146
+ for (let f = p.length - 1; f >= 0; f -= 1) {
147
+ const u = p[f];
148
+ c = u({
149
+ store: e,
150
+ itemId: a,
151
+ children: c,
152
+ idAttribute: d
153
+ });
154
+ }
155
+ return c;
156
+ }, [e]);
157
+ return M.useMemo(() => ({
158
+ runItemPlugins: s,
159
+ wrapItem: l,
160
+ publicAPI: r,
161
+ store: e,
162
+ rootRef: o
163
+ }), [s, l, r, e, o]);
164
+ };
165
+ function qn(t, e) {
166
+ e != null && e.current == null && (e.current = t);
167
+ }
168
+ function Gn(t) {
169
+ const {
170
+ store: e,
171
+ apiRef: n,
172
+ rootRef: o,
173
+ classes: r = ye,
174
+ slots: s = ye,
175
+ slotProps: l = ye,
176
+ children: a
177
+ } = t, h = Hn({
178
+ store: e,
179
+ apiRef: n,
180
+ rootRef: o
181
+ }), d = M.useMemo(() => ({
182
+ classes: r,
183
+ slots: {
184
+ collapseIcon: s.collapseIcon,
185
+ expandIcon: s.expandIcon,
186
+ endIcon: s.endIcon
187
+ },
188
+ slotProps: {
189
+ collapseIcon: l.collapseIcon,
190
+ expandIcon: l.expandIcon,
191
+ endIcon: l.endIcon
192
+ }
193
+ }), [r, s.collapseIcon, s.expandIcon, s.endIcon, l.collapseIcon, l.expandIcon, l.endIcon]);
194
+ return /* @__PURE__ */ v(lt.Provider, {
195
+ value: h,
196
+ children: /* @__PURE__ */ v(at.Provider, {
197
+ value: d,
198
+ children: a
199
+ })
200
+ });
201
+ }
202
+ const Xn = ["apiRef", "slots", "slotProps", "disabledItemsFocusable", "onItemClick", "itemChildrenIndentation", "id", "expandedItems", "defaultExpandedItems", "onExpandedItemsChange", "onItemExpansionToggle", "expansionTrigger", "disableSelection", "selectedItems", "defaultSelectedItems", "multiSelect", "checkboxSelection", "selectionPropagation", "onSelectedItemsChange", "onItemSelectionToggle", "onItemFocus"];
203
+ function Jn(t) {
204
+ const {
205
+ // Props for Provider
206
+ apiRef: e,
207
+ slots: n,
208
+ slotProps: o,
209
+ // Shared parameters
210
+ disabledItemsFocusable: r,
211
+ onItemClick: s,
212
+ itemChildrenIndentation: l,
213
+ id: a,
214
+ expandedItems: h,
215
+ defaultExpandedItems: d,
216
+ onExpandedItemsChange: c,
217
+ onItemExpansionToggle: p,
218
+ expansionTrigger: f,
219
+ disableSelection: u,
220
+ selectedItems: m,
221
+ defaultSelectedItems: I,
222
+ multiSelect: b,
223
+ checkboxSelection: x,
224
+ selectionPropagation: w,
225
+ onSelectedItemsChange: _,
226
+ onItemSelectionToggle: R,
227
+ onItemFocus: F
228
+ // SimpleTreeViewStore parameters
229
+ // Forwarded props
230
+ } = t, C = Be(t, Xn), D = M.useMemo(() => ({
231
+ // Shared parameters
232
+ disabledItemsFocusable: r,
233
+ onItemClick: s,
234
+ itemChildrenIndentation: l,
235
+ id: a,
236
+ expandedItems: h,
237
+ defaultExpandedItems: d,
238
+ onExpandedItemsChange: c,
239
+ onItemExpansionToggle: p,
240
+ expansionTrigger: f,
241
+ disableSelection: u,
242
+ selectedItems: m,
243
+ defaultSelectedItems: I,
244
+ multiSelect: b,
245
+ checkboxSelection: x,
246
+ selectionPropagation: w,
247
+ onSelectedItemsChange: _,
248
+ onItemSelectionToggle: R,
249
+ onItemFocus: F
250
+ // SimpleTreeViewStore parameters
251
+ }), [
252
+ // Shared parameters
253
+ r,
254
+ s,
255
+ l,
256
+ a,
257
+ h,
258
+ d,
259
+ c,
260
+ p,
261
+ f,
262
+ u,
263
+ m,
264
+ I,
265
+ b,
266
+ x,
267
+ w,
268
+ _,
269
+ R,
270
+ F
271
+ // SimpleTreeViewStore parameters
272
+ ]);
273
+ return {
274
+ apiRef: e,
275
+ slots: n,
276
+ slotProps: o,
277
+ parameters: D,
278
+ forwardedProps: C
279
+ };
280
+ }
281
+ var Qn = (t, e, n) => {
282
+ if (e.length === 1 && e[0] === n) {
283
+ let o = !1;
284
+ try {
285
+ const r = {};
286
+ t(r) === r && (o = !0);
287
+ } catch {
288
+ }
289
+ if (o) {
290
+ let r;
291
+ try {
292
+ throw new Error();
293
+ } catch (s) {
294
+ ({ stack: r } = s);
295
+ }
296
+ console.warn(
297
+ `The result function returned its own inputs without modification. e.g
298
+ \`createSelector([state => state.todos], todos => todos)\`
299
+ This could lead to inefficient memoization and unnecessary re-renders.
300
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
301
+ { stack: r }
302
+ );
303
+ }
304
+ }
305
+ }, Yn = (t, e, n) => {
306
+ const { memoize: o, memoizeOptions: r } = e, { inputSelectorResults: s, inputSelectorResultsCopy: l } = t, a = o(() => ({}), ...r);
307
+ if (!(a.apply(null, s) === a.apply(null, l))) {
308
+ let d;
309
+ try {
310
+ throw new Error();
311
+ } catch (c) {
312
+ ({ stack: d } = c);
313
+ }
314
+ console.warn(
315
+ `An input selector returned a different result when passed same arguments.
316
+ This means your output selector will likely run more frequently than intended.
317
+ Avoid returning a new reference inside your input selector, e.g.
318
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
319
+ {
320
+ arguments: n,
321
+ firstInputs: s,
322
+ secondInputs: l,
323
+ stack: d
324
+ }
325
+ );
326
+ }
327
+ }, Zn = {
328
+ inputStabilityCheck: "once",
329
+ identityFunctionCheck: "once"
330
+ }, Fe = /* @__PURE__ */ Symbol("NOT_FOUND");
331
+ function eo(t, e = `expected a function, instead received ${typeof t}`) {
332
+ if (typeof t != "function")
333
+ throw new TypeError(e);
334
+ }
335
+ function to(t, e = `expected an object, instead received ${typeof t}`) {
336
+ if (typeof t != "object")
337
+ throw new TypeError(e);
338
+ }
339
+ function no(t, e = "expected all items to be functions, instead received the following types: ") {
340
+ if (!t.every((n) => typeof n == "function")) {
341
+ const n = t.map(
342
+ (o) => typeof o == "function" ? `function ${o.name || "unnamed"}()` : typeof o
343
+ ).join(", ");
344
+ throw new TypeError(`${e}[${n}]`);
345
+ }
346
+ }
347
+ var kt = (t) => Array.isArray(t) ? t : [t];
348
+ function oo(t) {
349
+ const e = Array.isArray(t[0]) ? t[0] : t;
350
+ return no(
351
+ e,
352
+ "createSelector expects all input-selectors to be functions, but received the following types: "
353
+ ), e;
354
+ }
355
+ function Ot(t, e) {
356
+ const n = [], { length: o } = t;
357
+ for (let r = 0; r < o; r++)
358
+ n.push(t[r].apply(null, e));
359
+ return n;
360
+ }
361
+ var ro = (t, e) => {
362
+ const { identityFunctionCheck: n, inputStabilityCheck: o } = {
363
+ ...Zn,
364
+ ...e
365
+ };
366
+ return {
367
+ identityFunctionCheck: {
368
+ shouldRun: n === "always" || n === "once" && t,
369
+ run: Qn
370
+ },
371
+ inputStabilityCheck: {
372
+ shouldRun: o === "always" || o === "once" && t,
373
+ run: Yn
374
+ }
375
+ };
376
+ };
377
+ function so(t) {
378
+ let e;
379
+ return {
380
+ get(n) {
381
+ return e && t(e.key, n) ? e.value : Fe;
382
+ },
383
+ put(n, o) {
384
+ e = { key: n, value: o };
385
+ },
386
+ getEntries() {
387
+ return e ? [e] : [];
388
+ },
389
+ clear() {
390
+ e = void 0;
391
+ }
392
+ };
393
+ }
394
+ function io(t, e) {
395
+ let n = [];
396
+ function o(a) {
397
+ const h = n.findIndex((d) => e(a, d.key));
398
+ if (h > -1) {
399
+ const d = n[h];
400
+ return h > 0 && (n.splice(h, 1), n.unshift(d)), d.value;
401
+ }
402
+ return Fe;
403
+ }
404
+ function r(a, h) {
405
+ o(a) === Fe && (n.unshift({ key: a, value: h }), n.length > t && n.pop());
406
+ }
407
+ function s() {
408
+ return n;
409
+ }
410
+ function l() {
411
+ n = [];
412
+ }
413
+ return { get: o, put: r, getEntries: s, clear: l };
414
+ }
415
+ var lo = (t, e) => t === e;
416
+ function ao(t) {
417
+ return function(n, o) {
418
+ if (n === null || o === null || n.length !== o.length)
419
+ return !1;
420
+ const { length: r } = n;
421
+ for (let s = 0; s < r; s++)
422
+ if (!t(n[s], o[s]))
423
+ return !1;
424
+ return !0;
425
+ };
426
+ }
427
+ function co(t, e) {
428
+ const n = typeof e == "object" ? e : { equalityCheck: e }, {
429
+ equalityCheck: o = lo,
430
+ maxSize: r = 1,
431
+ resultEqualityCheck: s
432
+ } = n, l = ao(o);
433
+ let a = 0;
434
+ const h = r <= 1 ? so(l) : io(r, l);
435
+ function d() {
436
+ let c = h.get(arguments);
437
+ if (c === Fe) {
438
+ if (c = t.apply(null, arguments), a++, s) {
439
+ const f = h.getEntries().find(
440
+ (u) => s(u.value, c)
441
+ );
442
+ f && (c = f.value, a !== 0 && a--);
443
+ }
444
+ h.put(arguments, c);
445
+ }
446
+ return c;
447
+ }
448
+ return d.clearCache = () => {
449
+ h.clear(), d.resetResultsCount();
450
+ }, d.resultsCount = () => a, d.resetResultsCount = () => {
451
+ a = 0;
452
+ }, d;
453
+ }
454
+ var uo = class {
455
+ constructor(t) {
456
+ this.value = t;
457
+ }
458
+ deref() {
459
+ return this.value;
460
+ }
461
+ }, po = typeof WeakRef < "u" ? WeakRef : uo, fo = 0, Mt = 1;
462
+ function Pe() {
463
+ return {
464
+ s: fo,
465
+ v: void 0,
466
+ o: null,
467
+ p: null
468
+ };
469
+ }
470
+ function Xt(t, e = {}) {
471
+ let n = Pe();
472
+ const { resultEqualityCheck: o } = e;
473
+ let r, s = 0;
474
+ function l() {
475
+ let a = n;
476
+ const { length: h } = arguments;
477
+ for (let p = 0, f = h; p < f; p++) {
478
+ const u = arguments[p];
479
+ if (typeof u == "function" || typeof u == "object" && u !== null) {
480
+ let m = a.o;
481
+ m === null && (a.o = m = /* @__PURE__ */ new WeakMap());
482
+ const I = m.get(u);
483
+ I === void 0 ? (a = Pe(), m.set(u, a)) : a = I;
484
+ } else {
485
+ let m = a.p;
486
+ m === null && (a.p = m = /* @__PURE__ */ new Map());
487
+ const I = m.get(u);
488
+ I === void 0 ? (a = Pe(), m.set(u, a)) : a = I;
489
+ }
490
+ }
491
+ const d = a;
492
+ let c;
493
+ if (a.s === Mt)
494
+ c = a.v;
495
+ else if (c = t.apply(null, arguments), s++, o) {
496
+ const p = r?.deref?.() ?? r;
497
+ p != null && o(p, c) && (c = p, s !== 0 && s--), r = typeof c == "object" && c !== null || typeof c == "function" ? new po(c) : c;
498
+ }
499
+ return d.s = Mt, d.v = c, c;
500
+ }
501
+ return l.clearCache = () => {
502
+ n = Pe(), l.resetResultsCount();
503
+ }, l.resultsCount = () => s, l.resetResultsCount = () => {
504
+ s = 0;
505
+ }, l;
506
+ }
507
+ function Jt(t, ...e) {
508
+ const n = typeof t == "function" ? {
509
+ memoize: t,
510
+ memoizeOptions: e
511
+ } : t, o = (...r) => {
512
+ let s = 0, l = 0, a, h = {}, d = r.pop();
513
+ typeof d == "object" && (h = d, d = r.pop()), eo(
514
+ d,
515
+ `createSelector expects an output function after the inputs, but received: [${typeof d}]`
516
+ );
517
+ const c = {
518
+ ...n,
519
+ ...h
520
+ }, {
521
+ memoize: p,
522
+ memoizeOptions: f = [],
523
+ argsMemoize: u = Xt,
524
+ argsMemoizeOptions: m = [],
525
+ devModeChecks: I = {}
526
+ } = c, b = kt(f), x = kt(m), w = oo(r), _ = p(function() {
527
+ return s++, d.apply(
528
+ null,
529
+ arguments
530
+ );
531
+ }, ...b);
532
+ let R = !0;
533
+ const F = u(function() {
534
+ l++;
535
+ const D = Ot(
536
+ w,
537
+ arguments
538
+ );
539
+ if (a = _.apply(null, D), process.env.NODE_ENV !== "production") {
540
+ const { identityFunctionCheck: V, inputStabilityCheck: j } = ro(R, I);
541
+ if (V.shouldRun && V.run(
542
+ d,
543
+ D,
544
+ a
545
+ ), j.shouldRun) {
546
+ const E = Ot(
547
+ w,
548
+ arguments
549
+ );
550
+ j.run(
551
+ { inputSelectorResults: D, inputSelectorResultsCopy: E },
552
+ { memoize: p, memoizeOptions: b },
553
+ arguments
554
+ );
555
+ }
556
+ R && (R = !1);
557
+ }
558
+ return a;
559
+ }, ...x);
560
+ return Object.assign(F, {
561
+ resultFunc: d,
562
+ memoizedResultFunc: _,
563
+ dependencies: w,
564
+ dependencyRecomputations: () => l,
565
+ resetDependencyRecomputations: () => {
566
+ l = 0;
567
+ },
568
+ lastResult: () => a,
569
+ recomputations: () => s,
570
+ resetRecomputations: () => {
571
+ s = 0;
572
+ },
573
+ memoize: p,
574
+ argsMemoize: u
575
+ });
576
+ };
577
+ return Object.assign(o, {
578
+ withTypes: () => o
579
+ }), o;
580
+ }
581
+ var ho = /* @__PURE__ */ Jt(Xt), mo = Object.assign(
582
+ (t, e = ho) => {
583
+ to(
584
+ t,
585
+ `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`
586
+ );
587
+ const n = Object.keys(t), o = n.map(
588
+ (s) => t[s]
589
+ );
590
+ return e(
591
+ o,
592
+ (...s) => s.reduce((l, a, h) => (l[n[h]] = a, l), {})
593
+ );
594
+ },
595
+ { withTypes: () => mo }
596
+ );
597
+ const Io = Jt({
598
+ memoize: co,
599
+ memoizeOptions: {
600
+ maxSize: 1,
601
+ equalityCheck: Object.is
602
+ }
603
+ }), P = (t, e, n, o, r, s, l, a, ...h) => {
604
+ if (h.length > 0)
605
+ throw new Error("Unsupported number of selectors");
606
+ let d;
607
+ if (t && e && n && o && r && s && l && a)
608
+ d = (c, p, f, u) => {
609
+ const m = t(c, p, f, u), I = e(c, p, f, u), b = n(c, p, f, u), x = o(c, p, f, u), w = r(c, p, f, u), _ = s(c, p, f, u), R = l(c, p, f, u);
610
+ return a(m, I, b, x, w, _, R, p, f, u);
611
+ };
612
+ else if (t && e && n && o && r && s && l)
613
+ d = (c, p, f, u) => {
614
+ const m = t(c, p, f, u), I = e(c, p, f, u), b = n(c, p, f, u), x = o(c, p, f, u), w = r(c, p, f, u), _ = s(c, p, f, u);
615
+ return l(m, I, b, x, w, _, p, f, u);
616
+ };
617
+ else if (t && e && n && o && r && s)
618
+ d = (c, p, f, u) => {
619
+ const m = t(c, p, f, u), I = e(c, p, f, u), b = n(c, p, f, u), x = o(c, p, f, u), w = r(c, p, f, u);
620
+ return s(m, I, b, x, w, p, f, u);
621
+ };
622
+ else if (t && e && n && o && r)
623
+ d = (c, p, f, u) => {
624
+ const m = t(c, p, f, u), I = e(c, p, f, u), b = n(c, p, f, u), x = o(c, p, f, u);
625
+ return r(m, I, b, x, p, f, u);
626
+ };
627
+ else if (t && e && n && o)
628
+ d = (c, p, f, u) => {
629
+ const m = t(c, p, f, u), I = e(c, p, f, u), b = n(c, p, f, u);
630
+ return o(m, I, b, p, f, u);
631
+ };
632
+ else if (t && e && n)
633
+ d = (c, p, f, u) => {
634
+ const m = t(c, p, f, u), I = e(c, p, f, u);
635
+ return n(m, I, p, f, u);
636
+ };
637
+ else if (t && e)
638
+ d = (c, p, f, u) => {
639
+ const m = t(c, p, f, u);
640
+ return e(m, p, f, u);
641
+ };
642
+ else if (t)
643
+ d = t;
644
+ else
645
+ throw new Error("Missing arguments");
646
+ return d;
647
+ }, go = (t) => (...e) => {
648
+ const n = /* @__PURE__ */ new WeakMap();
649
+ let o = 1;
650
+ const r = e[e.length - 1], s = e.length - 1 || 1, l = Math.max(r.length - s, 0);
651
+ if (l > 3)
652
+ throw new Error("Unsupported number of arguments");
653
+ return (h, d, c, p) => {
654
+ let f = h.__cacheKey__;
655
+ f || (f = {
656
+ id: o
657
+ }, h.__cacheKey__ = f, o += 1);
658
+ let u = n.get(f);
659
+ if (!u) {
660
+ const m = e.length === 1 ? [(x) => x, r] : e;
661
+ let I = e;
662
+ const b = [void 0, void 0, void 0];
663
+ switch (l) {
664
+ case 0:
665
+ break;
666
+ case 1: {
667
+ I = [...m.slice(0, -1), () => b[0], r];
668
+ break;
669
+ }
670
+ case 2: {
671
+ I = [...m.slice(0, -1), () => b[0], () => b[1], r];
672
+ break;
673
+ }
674
+ case 3: {
675
+ I = [...m.slice(0, -1), () => b[0], () => b[1], () => b[2], r];
676
+ break;
677
+ }
678
+ default:
679
+ throw new Error("Unsupported number of arguments");
680
+ }
681
+ u = Io(...I), u.selectorArgs = b, n.set(f, u);
682
+ }
683
+ switch (l) {
684
+ case 3:
685
+ u.selectorArgs[2] = p;
686
+ case 2:
687
+ u.selectorArgs[1] = c;
688
+ case 1:
689
+ u.selectorArgs[0] = d;
690
+ }
691
+ switch (l) {
692
+ case 0:
693
+ return u(h);
694
+ case 1:
695
+ return u(h, d);
696
+ case 2:
697
+ return u(h, d, c);
698
+ case 3:
699
+ return u(h, d, c, p);
700
+ default:
701
+ throw new Error("unreachable");
702
+ }
703
+ };
704
+ }, Te = go();
705
+ var Re = { exports: {} }, He = {};
706
+ var Pt;
707
+ function bo() {
708
+ if (Pt) return He;
709
+ Pt = 1;
710
+ var t = $e;
711
+ function e(p, f) {
712
+ return p === f && (p !== 0 || 1 / p === 1 / f) || p !== p && f !== f;
713
+ }
714
+ var n = typeof Object.is == "function" ? Object.is : e, o = t.useState, r = t.useEffect, s = t.useLayoutEffect, l = t.useDebugValue;
715
+ function a(p, f) {
716
+ var u = f(), m = o({ inst: { value: u, getSnapshot: f } }), I = m[0].inst, b = m[1];
717
+ return s(
718
+ function() {
719
+ I.value = u, I.getSnapshot = f, h(I) && b({ inst: I });
720
+ },
721
+ [p, u, f]
722
+ ), r(
723
+ function() {
724
+ return h(I) && b({ inst: I }), p(function() {
725
+ h(I) && b({ inst: I });
726
+ });
727
+ },
728
+ [p]
729
+ ), l(u), u;
730
+ }
731
+ function h(p) {
732
+ var f = p.getSnapshot;
733
+ p = p.value;
734
+ try {
735
+ var u = f();
736
+ return !n(p, u);
737
+ } catch {
738
+ return !0;
739
+ }
740
+ }
741
+ function d(p, f) {
742
+ return f();
743
+ }
744
+ var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : a;
745
+ return He.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : c, He;
746
+ }
747
+ var qe = {};
748
+ var Rt;
749
+ function So() {
750
+ return Rt || (Rt = 1, process.env.NODE_ENV !== "production" && (function() {
751
+ function t(u, m) {
752
+ return u === m && (u !== 0 || 1 / u === 1 / m) || u !== u && m !== m;
753
+ }
754
+ function e(u, m) {
755
+ c || r.startTransition === void 0 || (c = !0, console.error(
756
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
757
+ ));
758
+ var I = m();
759
+ if (!p) {
760
+ var b = m();
761
+ s(I, b) || (console.error(
762
+ "The result of getSnapshot should be cached to avoid an infinite loop"
763
+ ), p = !0);
764
+ }
765
+ b = l({
766
+ inst: { value: I, getSnapshot: m }
767
+ });
768
+ var x = b[0].inst, w = b[1];
769
+ return h(
770
+ function() {
771
+ x.value = I, x.getSnapshot = m, n(x) && w({ inst: x });
772
+ },
773
+ [u, I, m]
774
+ ), a(
775
+ function() {
776
+ return n(x) && w({ inst: x }), u(function() {
777
+ n(x) && w({ inst: x });
778
+ });
779
+ },
780
+ [u]
781
+ ), d(I), I;
782
+ }
783
+ function n(u) {
784
+ var m = u.getSnapshot;
785
+ u = u.value;
786
+ try {
787
+ var I = m();
788
+ return !s(u, I);
789
+ } catch {
790
+ return !0;
791
+ }
792
+ }
793
+ function o(u, m) {
794
+ return m();
795
+ }
796
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
797
+ var r = $e, s = typeof Object.is == "function" ? Object.is : t, l = r.useState, a = r.useEffect, h = r.useLayoutEffect, d = r.useDebugValue, c = !1, p = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : e;
798
+ qe.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
799
+ })()), qe;
800
+ }
801
+ var Lt;
802
+ function ct() {
803
+ return Lt || (Lt = 1, process.env.NODE_ENV === "production" ? Re.exports = bo() : Re.exports = So()), Re.exports;
804
+ }
805
+ var yo = ct(), Le = { exports: {} }, Ge = {};
806
+ var Dt;
807
+ function xo() {
808
+ if (Dt) return Ge;
809
+ Dt = 1;
810
+ var t = $e, e = ct();
811
+ function n(d, c) {
812
+ return d === c && (d !== 0 || 1 / d === 1 / c) || d !== d && c !== c;
813
+ }
814
+ var o = typeof Object.is == "function" ? Object.is : n, r = e.useSyncExternalStore, s = t.useRef, l = t.useEffect, a = t.useMemo, h = t.useDebugValue;
815
+ return Ge.useSyncExternalStoreWithSelector = function(d, c, p, f, u) {
816
+ var m = s(null);
817
+ if (m.current === null) {
818
+ var I = { hasValue: !1, value: null };
819
+ m.current = I;
820
+ } else I = m.current;
821
+ m = a(
822
+ function() {
823
+ function x(C) {
824
+ if (!w) {
825
+ if (w = !0, _ = C, C = f(C), u !== void 0 && I.hasValue) {
826
+ var D = I.value;
827
+ if (u(D, C))
828
+ return R = D;
829
+ }
830
+ return R = C;
831
+ }
832
+ if (D = R, o(_, C)) return D;
833
+ var V = f(C);
834
+ return u !== void 0 && u(D, V) ? (_ = C, D) : (_ = C, R = V);
835
+ }
836
+ var w = !1, _, R, F = p === void 0 ? null : p;
837
+ return [
838
+ function() {
839
+ return x(c());
840
+ },
841
+ F === null ? void 0 : function() {
842
+ return x(F());
843
+ }
844
+ ];
845
+ },
846
+ [c, p, f, u]
847
+ );
848
+ var b = r(d, m[0], m[1]);
849
+ return l(
850
+ function() {
851
+ I.hasValue = !0, I.value = b;
852
+ },
853
+ [b]
854
+ ), h(b), b;
855
+ }, Ge;
856
+ }
857
+ var Xe = {};
858
+ var _t;
859
+ function Eo() {
860
+ return _t || (_t = 1, process.env.NODE_ENV !== "production" && (function() {
861
+ function t(d, c) {
862
+ return d === c && (d !== 0 || 1 / d === 1 / c) || d !== d && c !== c;
863
+ }
864
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
865
+ var e = $e, n = ct(), o = typeof Object.is == "function" ? Object.is : t, r = n.useSyncExternalStore, s = e.useRef, l = e.useEffect, a = e.useMemo, h = e.useDebugValue;
866
+ Xe.useSyncExternalStoreWithSelector = function(d, c, p, f, u) {
867
+ var m = s(null);
868
+ if (m.current === null) {
869
+ var I = { hasValue: !1, value: null };
870
+ m.current = I;
871
+ } else I = m.current;
872
+ m = a(
873
+ function() {
874
+ function x(C) {
875
+ if (!w) {
876
+ if (w = !0, _ = C, C = f(C), u !== void 0 && I.hasValue) {
877
+ var D = I.value;
878
+ if (u(D, C))
879
+ return R = D;
880
+ }
881
+ return R = C;
882
+ }
883
+ if (D = R, o(_, C))
884
+ return D;
885
+ var V = f(C);
886
+ return u !== void 0 && u(D, V) ? (_ = C, D) : (_ = C, R = V);
887
+ }
888
+ var w = !1, _, R, F = p === void 0 ? null : p;
889
+ return [
890
+ function() {
891
+ return x(c());
892
+ },
893
+ F === null ? void 0 : function() {
894
+ return x(F());
895
+ }
896
+ ];
897
+ },
898
+ [c, p, f, u]
899
+ );
900
+ var b = r(d, m[0], m[1]);
901
+ return l(
902
+ function() {
903
+ I.hasValue = !0, I.value = b;
904
+ },
905
+ [b]
906
+ ), h(b), b;
907
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
908
+ })()), Xe;
909
+ }
910
+ var At;
911
+ function Co() {
912
+ return At || (At = 1, process.env.NODE_ENV === "production" ? Le.exports = xo() : Le.exports = Eo()), Le.exports;
913
+ }
914
+ var vo = Co();
915
+ const wo = parseInt(M.version, 10), To = wo >= 19, ko = To ? Oo : Mo;
916
+ function W(t, e, n, o, r) {
917
+ return ko(t, e, n, o, r);
918
+ }
919
+ function Oo(t, e, n, o, r) {
920
+ const s = M.useCallback(() => e(t.getSnapshot(), n, o, r), [t, e, n, o, r]);
921
+ return yo.useSyncExternalStore(t.subscribe, s, s);
922
+ }
923
+ function Mo(t, e, n, o, r) {
924
+ return vo.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getSnapshot, (s) => e(s, n, o, r));
925
+ }
926
+ class dt {
927
+ // HACK: `any` fixes adding listeners that accept partial state.
928
+ // Internal state to handle recursive `setState()` calls
929
+ static create(e) {
930
+ return new dt(e);
931
+ }
932
+ constructor(e) {
933
+ this.state = e, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
934
+ }
935
+ subscribe = (e) => (this.listeners.add(e), () => {
936
+ this.listeners.delete(e);
937
+ });
938
+ /**
939
+ * Returns the current state snapshot. Meant for usage with `useSyncExternalStore`.
940
+ * If you want to access the state, use the `state` property instead.
941
+ */
942
+ getSnapshot = () => this.state;
943
+ setState(e) {
944
+ this.state = e, this.updateTick += 1;
945
+ const n = this.updateTick, o = this.listeners.values();
946
+ let r;
947
+ for (; r = o.next(), !r.done; ) {
948
+ if (n !== this.updateTick)
949
+ return;
950
+ const s = r.value;
951
+ s(e);
952
+ }
953
+ }
954
+ update(e) {
955
+ for (const n in e)
956
+ if (!Object.is(this.state[n], e[n])) {
957
+ this.setState(S({}, this.state, e));
958
+ return;
959
+ }
960
+ }
961
+ set(e, n) {
962
+ Object.is(this.state[e], n) || this.setState(S({}, this.state, {
963
+ [e]: n
964
+ }));
965
+ }
966
+ use = (e, n, o, r) => W(this, e, n, o, r);
967
+ }
968
+ const Nt = P((t) => t.providedTreeId ?? t.treeId), ke = {
969
+ /**
970
+ * Get the id attribute of the tree view.
971
+ */
972
+ treeId: Nt,
973
+ /**
974
+ * Generate the id attribute (i.e.: the `id` attribute passed to the DOM element) of a Tree Item.
975
+ * If the user explicitly defined an id attribute, it will be returned.
976
+ * Otherwise, the method creates a unique id for the item based on the Tree View id attribute and the item `itemId`
977
+ */
978
+ treeItemIdAttribute: P(Nt, (t, e, n) => n ?? `${t ?? ""}-${e}`)
979
+ }, se = "__TREE_VIEW_ROOT_PARENT_ID__", Qt = (t) => {
980
+ const e = {};
981
+ return t.forEach((n, o) => {
982
+ e[n] = o;
983
+ }), e;
984
+ }, Ve = (t, e) => {
985
+ if (e == null)
986
+ return !1;
987
+ let n = t[e];
988
+ if (!n)
989
+ return !1;
990
+ if (n.disabled)
991
+ return !0;
992
+ for (; n.parentId != null; ) {
993
+ if (n = t[n.parentId], !n)
994
+ return !1;
995
+ if (n.disabled)
996
+ return !0;
997
+ }
998
+ return !1;
999
+ };
1000
+ function Ft(t) {
1001
+ const {
1002
+ storeParameters: e,
1003
+ items: n,
1004
+ parentId: o,
1005
+ depth: r,
1006
+ isItemExpandable: s,
1007
+ otherItemsMetaLookup: l
1008
+ } = t, a = {}, h = {}, d = [], c = [], p = (f) => {
1009
+ const u = e.getItemId ? e.getItemId(f) : f.id;
1010
+ Po({
1011
+ id: u,
1012
+ parentId: o,
1013
+ item: f,
1014
+ itemMetaLookup: l,
1015
+ siblingsMetaLookup: a
1016
+ });
1017
+ const m = e.getItemLabel ? e.getItemLabel(f) : f.label;
1018
+ if (m == null)
1019
+ throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.", "An item was provided without label in the `items` prop:", JSON.stringify(f)].join(`
1020
+ `));
1021
+ const I = (e.getItemChildren ? e.getItemChildren(f) : f.children) || [];
1022
+ c.push({
1023
+ id: u,
1024
+ children: I
1025
+ }), h[u] = f, a[u] = {
1026
+ id: u,
1027
+ label: m,
1028
+ parentId: o,
1029
+ idAttribute: void 0,
1030
+ expandable: s(f, I),
1031
+ disabled: e.isItemDisabled ? e.isItemDisabled(f) : !1,
1032
+ selectable: e.isItemSelectionDisabled ? !e.isItemSelectionDisabled(f) : !0,
1033
+ depth: r
1034
+ }, d.push(u);
1035
+ };
1036
+ for (const f of n)
1037
+ p(f);
1038
+ return {
1039
+ metaLookup: a,
1040
+ modelLookup: h,
1041
+ orderedChildrenIds: d,
1042
+ childrenIndexes: Qt(d),
1043
+ itemsChildren: c
1044
+ };
1045
+ }
1046
+ function Po({
1047
+ id: t,
1048
+ parentId: e,
1049
+ item: n,
1050
+ itemMetaLookup: o,
1051
+ siblingsMetaLookup: r
1052
+ }) {
1053
+ if (t == null)
1054
+ throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", "An item was provided without id in the `items` prop:", JSON.stringify(n)].join(`
1055
+ `));
1056
+ if (r[t] != null || // Ignore items with the same parent id, because it's the same item from the previous generation.
1057
+ o[t] != null && o[t].parentId !== e)
1058
+ throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${t}"`].join(`
1059
+ `));
1060
+ }
1061
+ const Ro = [], y = {
1062
+ /**
1063
+ * Gets the DOM structure of the Tree View.
1064
+ */
1065
+ domStructure: P((t) => t.domStructure),
1066
+ /**
1067
+ * Checks whether the disabled items are focusable.
1068
+ */
1069
+ disabledItemFocusable: P((t) => t.disabledItemsFocusable),
1070
+ /**
1071
+ * Gets the meta-information of all items.
1072
+ */
1073
+ itemMetaLookup: P((t) => t.itemMetaLookup),
1074
+ /**
1075
+ * Gets the ordered children ids of all items.
1076
+ */
1077
+ itemOrderedChildrenIdsLookup: P((t) => t.itemOrderedChildrenIdsLookup),
1078
+ /**
1079
+ * Gets the meta-information of an item.
1080
+ */
1081
+ itemMeta: P((t, e) => t.itemMetaLookup[e ?? se] ?? null),
1082
+ /**
1083
+ * Gets the ordered children ids of an item.
1084
+ */
1085
+ itemOrderedChildrenIds: P((t, e) => t.itemOrderedChildrenIdsLookup[e ?? se] ?? Ro),
1086
+ /**
1087
+ * Gets the model of an item.
1088
+ */
1089
+ itemModel: P((t, e) => t.itemModelLookup[e]),
1090
+ /**
1091
+ * Checks whether an item is disabled.
1092
+ */
1093
+ isItemDisabled: P((t, e) => Ve(t.itemMetaLookup, e)),
1094
+ /**
1095
+ * Gets the index of an item in its parent's children.
1096
+ */
1097
+ itemIndex: P((t, e) => {
1098
+ const n = t.itemMetaLookup[e];
1099
+ return n == null ? -1 : t.itemChildrenIndexesLookup[n.parentId ?? se][n.id];
1100
+ }),
1101
+ /**
1102
+ * Gets the id of an item's parent.
1103
+ */
1104
+ itemParentId: P((t, e) => t.itemMetaLookup[e]?.parentId ?? null),
1105
+ /**
1106
+ * Gets the depth of an item (items at the root level have a depth of 0).
1107
+ */
1108
+ itemDepth: P((t, e) => t.itemMetaLookup[e]?.depth ?? 0),
1109
+ /**
1110
+ * Checks whether an item can be focused.
1111
+ */
1112
+ canItemBeFocused: P((t, e) => t.disabledItemsFocusable || !Ve(t.itemMetaLookup, e)),
1113
+ /**
1114
+ * Gets the identation between an item and its children.
1115
+ */
1116
+ itemChildrenIndentation: P((t) => t.itemChildrenIndentation)
1117
+ };
1118
+ class De {
1119
+ // We can't type `store`, otherwise we get the following TS error:
1120
+ // 'items' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
1121
+ constructor(e) {
1122
+ this.store = e;
1123
+ }
1124
+ /**
1125
+ * Determines if the items state should be rebuilt based on the new and previous parameters.
1126
+ */
1127
+ static shouldRebuildItemsState = (e, n) => ["items", "isItemDisabled", "isItemSelectionDisabled", "getItemId", "getItemLabel", "getItemChildren"].some((o) => {
1128
+ const r = o;
1129
+ return e[r] !== n[r];
1130
+ });
1131
+ /**
1132
+ * Builds the state properties derived from the `items` prop.
1133
+ */
1134
+ static buildItemsStateIfNeeded = (e) => {
1135
+ const n = {}, o = {}, r = {}, s = {};
1136
+ function l(a, h, d) {
1137
+ const c = h ?? se, {
1138
+ metaLookup: p,
1139
+ modelLookup: f,
1140
+ orderedChildrenIds: u,
1141
+ childrenIndexes: m,
1142
+ itemsChildren: I
1143
+ } = Ft({
1144
+ storeParameters: e,
1145
+ items: a,
1146
+ parentId: h,
1147
+ depth: d,
1148
+ isItemExpandable: (b, x) => !!x && x.length > 0,
1149
+ otherItemsMetaLookup: n
1150
+ });
1151
+ Object.assign(n, p), Object.assign(o, f), r[c] = u, s[c] = m;
1152
+ for (const b of I)
1153
+ l(b.children || [], b.id, d + 1);
1154
+ }
1155
+ return l(e.items, null, 0), {
1156
+ itemMetaLookup: n,
1157
+ itemModelLookup: o,
1158
+ itemOrderedChildrenIdsLookup: r,
1159
+ itemChildrenIndexesLookup: s
1160
+ };
1161
+ };
1162
+ /**
1163
+ * Get the item with the given id.
1164
+ * When used in the Simple Tree View, it returns an object with the `id` and `label` properties.
1165
+ * @param {TreeViewItemId} itemId The id of the item to retrieve.
1166
+ * @returns {R} The item with the given id.
1167
+ */
1168
+ getItem = (e) => y.itemModel(this.store.state, e);
1169
+ /**
1170
+ * Get all the items in the same format as provided by `props.items`.
1171
+ * @returns {R[]} The items in the tree.
1172
+ */
1173
+ getItemTree = () => {
1174
+ const e = (n) => {
1175
+ const o = y.itemModel(this.store.state, n), r = S({}, o), s = y.itemOrderedChildrenIds(this.store.state, n);
1176
+ return s.length > 0 ? r.children = s.map(e) : delete r.children, r;
1177
+ };
1178
+ return y.itemOrderedChildrenIds(this.store.state, null).map(e);
1179
+ };
1180
+ /**
1181
+ * Get the ids of a given item's children.
1182
+ * Those ids are returned in the order they should be rendered.
1183
+ * To get the root items, pass `null` as the `itemId`.
1184
+ * @param {TreeViewItemId | null} itemId The id of the item to get the children of.
1185
+ * @returns {TreeViewItemId[]} The ids of the item's children.
1186
+ */
1187
+ getItemOrderedChildrenIds = (e) => y.itemOrderedChildrenIds(this.store.state, e);
1188
+ /** * Get the id of the parent item.
1189
+ * @param {TreeViewItemId} itemId The id of the item to whose parentId we want to retrieve.
1190
+ * @returns {TreeViewItemId | null} The id of the parent item.
1191
+ */
1192
+ getParentId = (e) => y.itemMeta(this.store.state, e)?.parentId || null;
1193
+ /**
1194
+ * Toggle the disabled state of the item with the given id.
1195
+ * @param {object} parameters The params of the method.
1196
+ * @param {TreeViewItemId } parameters.itemId The id of the item to get the children of.
1197
+ * @param {boolean } parameters.shouldBeDisabled true if the item should be disabled.
1198
+ */
1199
+ setIsItemDisabled = ({
1200
+ itemId: e,
1201
+ shouldBeDisabled: n
1202
+ }) => {
1203
+ if (!this.store.state.itemMetaLookup[e])
1204
+ return;
1205
+ const o = S({}, this.store.state.itemMetaLookup);
1206
+ o[e] = S({}, o[e], {
1207
+ disabled: n ?? !o[e].disabled
1208
+ }), this.store.set("itemMetaLookup", o);
1209
+ };
1210
+ buildPublicAPI = () => ({
1211
+ getItem: this.getItem,
1212
+ getItemDOMElement: this.getItemDOMElement,
1213
+ getItemOrderedChildrenIds: this.getItemOrderedChildrenIds,
1214
+ getItemTree: this.getItemTree,
1215
+ getParentId: this.getParentId,
1216
+ setIsItemDisabled: this.setIsItemDisabled
1217
+ });
1218
+ /**
1219
+ * Get the DOM element of the item with the given id.
1220
+ * @param {TreeViewItemId} itemId The id of the item to get the DOM element of.
1221
+ * @returns {HTMLElement | null} The DOM element of the item with the given id.
1222
+ */
1223
+ getItemDOMElement = (e) => {
1224
+ const n = y.itemMeta(this.store.state, e);
1225
+ if (n == null)
1226
+ return null;
1227
+ const o = ke.treeItemIdAttribute(this.store.state, e, n.idAttribute);
1228
+ return document.getElementById(o);
1229
+ };
1230
+ /**
1231
+ * Add an array of items to the tree.
1232
+ * @param {SetItemChildrenParameters<R>} args The items to add to the tree and information about their ancestors.
1233
+ */
1234
+ setItemChildren = ({
1235
+ items: e,
1236
+ parentId: n,
1237
+ getChildrenCount: o
1238
+ }) => {
1239
+ const r = n ?? se, s = n == null ? -1 : y.itemDepth(this.store.state, n), {
1240
+ metaLookup: l,
1241
+ modelLookup: a,
1242
+ orderedChildrenIds: h,
1243
+ childrenIndexes: d
1244
+ } = Ft({
1245
+ storeParameters: this.store.parameters,
1246
+ items: e,
1247
+ parentId: n,
1248
+ depth: s + 1,
1249
+ isItemExpandable: o ? (c) => o(c) !== 0 : () => !1,
1250
+ otherItemsMetaLookup: y.itemMetaLookup(this.store.state)
1251
+ });
1252
+ this.store.update({
1253
+ itemModelLookup: S({}, this.store.state.itemModelLookup, a),
1254
+ itemMetaLookup: S({}, this.store.state.itemMetaLookup, l),
1255
+ itemOrderedChildrenIdsLookup: S({}, this.store.state.itemOrderedChildrenIdsLookup, {
1256
+ [r]: h
1257
+ }),
1258
+ itemChildrenIndexesLookup: S({}, this.store.state.itemChildrenIndexesLookup, {
1259
+ [r]: d
1260
+ })
1261
+ });
1262
+ };
1263
+ /**
1264
+ * Remove the children of an item.
1265
+ * @param {TreeViewItemId | null} parentId The id of the item to remove the children of.
1266
+ */
1267
+ removeChildren = (e) => {
1268
+ const n = this.store.state.itemMetaLookup, o = Object.keys(n).reduce((a, h) => {
1269
+ const d = n[h];
1270
+ return d.parentId === e ? a : S({}, a, {
1271
+ [d.id]: d
1272
+ });
1273
+ }, {}), r = S({}, this.store.state.itemOrderedChildrenIdsLookup), s = S({}, this.store.state.itemChildrenIndexesLookup), l = e ?? se;
1274
+ delete s[l], delete r[l], this.store.update({
1275
+ itemMetaLookup: o,
1276
+ itemOrderedChildrenIdsLookup: r,
1277
+ itemChildrenIndexesLookup: s
1278
+ });
1279
+ };
1280
+ /**
1281
+ * Callback fired when the `content` slot of a given Tree Item is clicked.
1282
+ * @param {React.MouseEvent} event The DOM event that triggered the change.
1283
+ * @param {TreeViewItemId} itemId The id of the item being clicked.
1284
+ */
1285
+ handleItemClick = (e, n) => {
1286
+ this.store.parameters.onItemClick?.(e, n);
1287
+ };
1288
+ }
1289
+ const Yt = Te((t) => t.selectedItems, (t) => Array.isArray(t) ? t : t != null ? [t] : []), Vt = Te(Yt, (t) => {
1290
+ const e = /* @__PURE__ */ new Map();
1291
+ return t.forEach((n) => {
1292
+ e.set(n, !0);
1293
+ }), e;
1294
+ }), Je = P((t, e) => t.itemMetaLookup[e]?.selectable ?? !0), N = {
1295
+ /**
1296
+ * Gets the selected items as provided to the component.
1297
+ */
1298
+ selectedItemsRaw: P((t) => t.selectedItems),
1299
+ /**
1300
+ * Gets the selected items as an array.
1301
+ */
1302
+ selectedItems: Yt,
1303
+ /**
1304
+ * Gets the selected items as a Map.
1305
+ */
1306
+ selectedItemsMap: Vt,
1307
+ /**
1308
+ * Checks whether selection is enabled.
1309
+ */
1310
+ enabled: P((t) => !t.disableSelection),
1311
+ /**
1312
+ * Checks whether multi selection is enabled.
1313
+ */
1314
+ isMultiSelectEnabled: P((t) => t.multiSelect),
1315
+ /**
1316
+ * Checks whether checkbox selection is enabled.
1317
+ */
1318
+ isCheckboxSelectionEnabled: P((t) => t.checkboxSelection),
1319
+ /**
1320
+ * Gets the selection propagation rules.
1321
+ */
1322
+ propagationRules: P((t) => t.selectionPropagation),
1323
+ /**
1324
+ * Checks whether an item is selected.
1325
+ */
1326
+ isItemSelected: P(Vt, (t, e) => t.has(e)),
1327
+ /**
1328
+ * Checks whether the selection feature is enabled for an item.
1329
+ * Returns `true` when selection is enabled on the Tree View and the item is selectable (even if the item is disabled).
1330
+ */
1331
+ isFeatureEnabledForItem: P(Je, (t) => !t.disableSelection, (t, e, n) => e && t),
1332
+ /**
1333
+ * Checks whether an item can be selected (if selection is enabled, if the item is not disabled, and if the item is selectable).
1334
+ */
1335
+ canItemBeSelected: P(y.isItemDisabled, Je, (t) => !t.disableSelection, (t, e, n, o) => n && !t && e),
1336
+ /**
1337
+ * Checks whether an item is selectable based on the `isItemSelectionDisabled` prop.
1338
+ */
1339
+ isItemSelectable: Je
1340
+ }, Lo = P((t, e) => {
1341
+ if (N.isItemSelected(t, e))
1342
+ return "checked";
1343
+ let n = !1, o = !1;
1344
+ const r = (l) => {
1345
+ l !== e && (N.isItemSelected(t, l) ? n = !0 : o = !0), y.itemOrderedChildrenIds(t, l).forEach(r);
1346
+ };
1347
+ return r(e), N.propagationRules(t).parents ? n && o ? "indeterminate" : n && !o ? "checked" : "empty" : n ? "indeterminate" : "empty";
1348
+ }), Do = ({
1349
+ props: t
1350
+ }) => {
1351
+ const {
1352
+ itemId: e
1353
+ } = t, {
1354
+ store: n
1355
+ } = be(), o = W(n, N.isCheckboxSelectionEnabled), r = W(n, N.isFeatureEnabledForItem, e), s = W(n, N.canItemBeSelected, e), l = W(n, Lo, e);
1356
+ return {
1357
+ propsEnhancers: {
1358
+ root: () => {
1359
+ let a;
1360
+ return l === "checked" ? a = !0 : l === "indeterminate" ? a = "mixed" : s ? a = !1 : a = void 0, {
1361
+ "aria-checked": a
1362
+ };
1363
+ },
1364
+ checkbox: ({
1365
+ externalEventHandlers: a,
1366
+ interactions: h
1367
+ }) => ({
1368
+ tabIndex: -1,
1369
+ onChange: (c) => {
1370
+ a.onChange?.(c), !c.defaultMuiPrevented && N.canItemBeSelected(n.state, e) && h.handleCheckboxSelection(c);
1371
+ },
1372
+ visible: o && r,
1373
+ disabled: !s,
1374
+ checked: l === "checked",
1375
+ indeterminate: l === "indeterminate"
1376
+ })
1377
+ }
1378
+ };
1379
+ }, Qe = Te((t) => t.expandedItems, (t) => {
1380
+ const e = /* @__PURE__ */ new Map();
1381
+ return t.forEach((n) => {
1382
+ e.set(n, !0);
1383
+ }), e;
1384
+ }), H = {
1385
+ /**
1386
+ * Gets the expanded items as provided to the component.
1387
+ */
1388
+ expandedItemsRaw: P((t) => t.expandedItems),
1389
+ /**
1390
+ * Gets the expanded items as a Map.
1391
+ */
1392
+ expandedItemsMap: Qe,
1393
+ /**
1394
+ * Gets the items to render as a flat list (the descendants of an expanded item are listed as siblings of the item).
1395
+ */
1396
+ flatList: Te(y.itemOrderedChildrenIdsLookup, Qe, (t, e) => {
1397
+ function n(o) {
1398
+ if (!e.has(o))
1399
+ return [o];
1400
+ const r = [o], s = t[o] || [];
1401
+ for (const l of s)
1402
+ r.push(...n(l));
1403
+ return r;
1404
+ }
1405
+ return (t[se] ?? []).flatMap(n);
1406
+ }),
1407
+ /**
1408
+ * Gets the slot that triggers the item's expansion when clicked.
1409
+ */
1410
+ triggerSlot: P((t) => t.expansionTrigger),
1411
+ /**
1412
+ * Checks whether an item is expanded.
1413
+ */
1414
+ isItemExpanded: P(Qe, (t, e) => t.has(e)),
1415
+ /**
1416
+ * Checks whether an item is expandable.
1417
+ */
1418
+ isItemExpandable: P(y.itemMeta, (t, e) => t?.expandable ?? !1)
1419
+ }, nt = (t, e) => {
1420
+ let n = e.length - 1;
1421
+ for (; n >= 0 && !y.canItemBeFocused(t, e[n]); )
1422
+ n -= 1;
1423
+ if (n !== -1)
1424
+ return e[n];
1425
+ }, Zt = (t, e) => {
1426
+ const n = y.itemMeta(t, e);
1427
+ if (!n)
1428
+ return null;
1429
+ const o = y.itemOrderedChildrenIds(t, n.parentId), r = y.itemIndex(t, e);
1430
+ if (r === 0)
1431
+ return n.parentId;
1432
+ let s = r - 1;
1433
+ for (; !y.canItemBeFocused(t, o[s]) && s >= 0; )
1434
+ s -= 1;
1435
+ if (s === -1)
1436
+ return n.parentId == null ? null : Zt(t, n.parentId);
1437
+ let l = o[s], a = nt(t, y.itemOrderedChildrenIds(t, l));
1438
+ for (; H.isItemExpanded(t, l) && a != null; )
1439
+ l = a, a = nt(t, y.itemOrderedChildrenIds(t, l));
1440
+ return l;
1441
+ }, _e = (t, e) => {
1442
+ if (H.isItemExpanded(t, e)) {
1443
+ const o = y.itemOrderedChildrenIds(t, e).find((r) => y.canItemBeFocused(t, r));
1444
+ if (o != null)
1445
+ return o;
1446
+ }
1447
+ let n = y.itemMeta(t, e);
1448
+ for (; n != null; ) {
1449
+ const o = y.itemOrderedChildrenIds(t, n.parentId), r = y.itemIndex(t, n.id);
1450
+ if (r < o.length - 1) {
1451
+ let s = r + 1;
1452
+ for (; !y.canItemBeFocused(t, o[s]) && s < o.length - 1; )
1453
+ s += 1;
1454
+ if (y.canItemBeFocused(t, o[s]))
1455
+ return o[s];
1456
+ }
1457
+ n = y.itemMeta(t, n.parentId);
1458
+ }
1459
+ return null;
1460
+ }, en = (t) => {
1461
+ let e = null;
1462
+ for (; e == null || H.isItemExpanded(t, e); ) {
1463
+ const n = y.itemOrderedChildrenIds(t, e), o = nt(t, n);
1464
+ if (o == null)
1465
+ return e;
1466
+ e = o;
1467
+ }
1468
+ return e;
1469
+ }, ze = (t) => y.itemOrderedChildrenIds(t, null).find((e) => y.canItemBeFocused(t, e)), tn = (t, e, n) => {
1470
+ if (e === n)
1471
+ return [e, n];
1472
+ const o = y.itemMeta(t, e), r = y.itemMeta(t, n);
1473
+ if (!o || !r)
1474
+ return [e, n];
1475
+ if (o.parentId === r.id || r.parentId === o.id)
1476
+ return r.parentId === o.id ? [o.id, r.id] : [r.id, o.id];
1477
+ const s = [o.id], l = [r.id];
1478
+ let a = o.parentId, h = r.parentId, d = l.indexOf(a) !== -1, c = s.indexOf(h) !== -1, p = !0, f = !0;
1479
+ for (; !c && !d; )
1480
+ p && (s.push(a), d = l.indexOf(a) !== -1, p = a !== null, !d && p && (a = y.itemParentId(t, a))), f && !d && (l.push(h), c = s.indexOf(h) !== -1, f = h !== null, !c && f && (h = y.itemParentId(t, h)));
1481
+ const u = d ? a : h, m = y.itemOrderedChildrenIds(t, u), I = s[s.indexOf(u) - 1], b = l[l.indexOf(u) - 1];
1482
+ return m.indexOf(I) < m.indexOf(b) ? [e, n] : [n, e];
1483
+ }, _o = (t, e, n) => {
1484
+ const o = (h) => {
1485
+ if (H.isItemExpandable(t, h) && H.isItemExpanded(t, h))
1486
+ return y.itemOrderedChildrenIds(t, h)[0];
1487
+ let d = y.itemMeta(t, h);
1488
+ for (; d != null; ) {
1489
+ const c = y.itemOrderedChildrenIds(t, d.parentId), p = y.itemIndex(t, d.id);
1490
+ if (p < c.length - 1)
1491
+ return c[p + 1];
1492
+ d = d.parentId ? y.itemMeta(t, d.parentId) : null;
1493
+ }
1494
+ throw new Error("Invalid range");
1495
+ }, [r, s] = tn(t, e, n), l = [r];
1496
+ let a = r;
1497
+ for (; a !== s; )
1498
+ a = o(a), y.isItemDisabled(t, a) || l.push(a);
1499
+ return l;
1500
+ }, Ao = (t) => {
1501
+ let e = ze(t);
1502
+ const n = [];
1503
+ for (; e != null; )
1504
+ n.push(e), e = _e(t, e);
1505
+ return n;
1506
+ }, ot = (t, e) => e !== t.closest('*[role="treeitem"]');
1507
+ class No {
1508
+ lastSelectedItem = null;
1509
+ lastSelectedRange = {};
1510
+ // We can't type `store`, otherwise we get the following TS error:
1511
+ // 'selection' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
1512
+ constructor(e) {
1513
+ this.store = e, e.itemPluginManager.register(Do, null);
1514
+ }
1515
+ setSelectedItems = (e, n, o) => {
1516
+ const {
1517
+ selectionPropagation: r = ye,
1518
+ selectedItems: s,
1519
+ onItemSelectionToggle: l,
1520
+ onSelectedItemsChange: a
1521
+ } = this.store.parameters, h = N.selectedItemsRaw(this.store.state);
1522
+ let d;
1523
+ const c = N.isMultiSelectEnabled(this.store.state);
1524
+ if (c && (r.descendants || r.parents) ? d = Fo({
1525
+ store: this.store,
1526
+ selectionPropagation: r,
1527
+ newModel: n,
1528
+ oldModel: h,
1529
+ additionalItemsToPropagate: o
1530
+ }) : d = n, l)
1531
+ if (c) {
1532
+ const p = nn({
1533
+ store: this.store,
1534
+ newModel: d,
1535
+ oldModel: h
1536
+ });
1537
+ l && (p.added.forEach((f) => {
1538
+ l(e, f, !0);
1539
+ }), p.removed.forEach((f) => {
1540
+ l(e, f, !1);
1541
+ }));
1542
+ } else d !== h && (h != null && l(e, h, !1), d != null && l(e, d, !0));
1543
+ s === void 0 && this.store.set("selectedItems", d), a?.(e, d);
1544
+ };
1545
+ selectRange = (e, [n, o]) => {
1546
+ if (!N.isMultiSelectEnabled(this.store.state))
1547
+ return;
1548
+ let s = N.selectedItems(this.store.state).slice();
1549
+ Object.keys(this.lastSelectedRange).length > 0 && (s = s.filter((d) => !this.lastSelectedRange[d]));
1550
+ const l = Ae(s), a = _o(this.store.state, n, o).filter((d) => N.isItemSelectable(this.store.state, d)), h = a.filter((d) => !l[d]);
1551
+ s = s.concat(h), this.setSelectedItems(e, s), this.lastSelectedRange = Ae(a);
1552
+ };
1553
+ buildPublicAPI = () => ({
1554
+ setItemSelection: this.setItemSelection
1555
+ });
1556
+ /**
1557
+ * Select or deselect an item.
1558
+ * @param {object} parameters The parameters of the method.
1559
+ * @param {TreeViewItemId} parameters.itemId The id of the item to select or deselect.
1560
+ * @param {React.SyntheticEvent} parameters.event The DOM event that triggered the change.
1561
+ * @param {boolean} parameters.keepExistingSelection If `true`, the other already selected items will remain selected, otherwise, they will be deselected. This parameter is only relevant when `multiSelect` is `true`
1562
+ * @param {boolean | undefined} parameters.shouldBeSelected If `true` the item will be selected. If `false` the item will be deselected. If not defined, the item's selection status will be toggled.
1563
+ */
1564
+ setItemSelection = ({
1565
+ itemId: e,
1566
+ event: n = null,
1567
+ keepExistingSelection: o = !1,
1568
+ shouldBeSelected: r
1569
+ }) => {
1570
+ if (!N.enabled(this.store.state))
1571
+ return;
1572
+ let s;
1573
+ const l = N.isMultiSelectEnabled(this.store.state);
1574
+ if (o) {
1575
+ const a = N.selectedItems(this.store.state), h = N.isItemSelected(this.store.state, e);
1576
+ h && (r === !1 || r == null) ? s = a.filter((d) => d !== e) : !h && (r === !0 || r == null) ? s = [e].concat(a) : s = a;
1577
+ } else
1578
+ r === !1 || r == null && N.isItemSelected(this.store.state, e) ? s = l ? [] : null : s = l ? [e] : e;
1579
+ this.setSelectedItems(
1580
+ n,
1581
+ s,
1582
+ // If shouldBeSelected === selectionSelectors.isItemSelected(store, itemId), we still want to propagate the select.
1583
+ // This is useful when the element is in an indeterminate state.
1584
+ [e]
1585
+ ), this.lastSelectedItem = e, this.lastSelectedRange = {};
1586
+ };
1587
+ /**
1588
+ * Select all the navigable items in the tree.
1589
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1590
+ */
1591
+ selectAllNavigableItems = (e) => {
1592
+ if (!N.isMultiSelectEnabled(this.store.state))
1593
+ return;
1594
+ const o = Ao(this.store.state);
1595
+ this.setSelectedItems(e, o), this.lastSelectedRange = Ae(o);
1596
+ };
1597
+ /**
1598
+ * Expand the current selection range up to the given item.
1599
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1600
+ * @param {TreeViewItemId} itemId The id of the item to expand the selection to.
1601
+ */
1602
+ expandSelectionRange = (e, n) => {
1603
+ if (this.lastSelectedItem != null) {
1604
+ const [o, r] = tn(this.store.state, n, this.lastSelectedItem);
1605
+ this.selectRange(e, [o, r]);
1606
+ }
1607
+ };
1608
+ /**
1609
+ * Expand the current selection range from the first navigable item to the given item.
1610
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1611
+ * @param {TreeViewItemId} itemId The id of the item up to which the selection range should be expanded.
1612
+ */
1613
+ selectRangeFromStartToItem = (e, n) => {
1614
+ this.selectRange(e, [ze(this.store.state), n]);
1615
+ };
1616
+ /**
1617
+ * Expand the current selection range from the given item to the last navigable item.
1618
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1619
+ * @param {TreeViewItemId} itemId The id of the item from which the selection range should be expanded.
1620
+ */
1621
+ selectRangeFromItemToEnd = (e, n) => {
1622
+ this.selectRange(e, [n, en(this.store.state)]);
1623
+ };
1624
+ /**
1625
+ * Update the selection when navigating with ArrowUp / ArrowDown keys.
1626
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1627
+ * @param {TreeViewItemId} currentItemId The id of the active item before the keyboard navigation.
1628
+ * @param {TreeViewItemId} nextItemId The id of the active item after the keyboard navigation.
1629
+ */
1630
+ selectItemFromArrowNavigation = (e, n, o) => {
1631
+ if (!N.isMultiSelectEnabled(this.store.state))
1632
+ return;
1633
+ let s = N.selectedItems(this.store.state).slice();
1634
+ Object.keys(this.lastSelectedRange).length === 0 ? (s.push(o), this.lastSelectedRange = {
1635
+ [n]: !0,
1636
+ [o]: !0
1637
+ }) : (this.lastSelectedRange[n] || (this.lastSelectedRange = {}), this.lastSelectedRange[o] ? (s = s.filter((l) => l !== n), delete this.lastSelectedRange[n]) : (s.push(o), this.lastSelectedRange[o] = !0)), this.setSelectedItems(e, s);
1638
+ };
1639
+ }
1640
+ function Fo({
1641
+ store: t,
1642
+ selectionPropagation: e,
1643
+ newModel: n,
1644
+ oldModel: o,
1645
+ additionalItemsToPropagate: r
1646
+ }) {
1647
+ if (!e.descendants && !e.parents)
1648
+ return n;
1649
+ let s = !1;
1650
+ const l = Ae(n), a = nn({
1651
+ store: t,
1652
+ newModel: n,
1653
+ oldModel: o
1654
+ });
1655
+ return r?.forEach((h) => {
1656
+ l[h] ? a.added.includes(h) || a.added.push(h) : a.removed.includes(h) || a.removed.push(h);
1657
+ }), a.added.forEach((h) => {
1658
+ if (e.descendants) {
1659
+ const d = (c) => {
1660
+ c !== h && (s = !0, l[c] = !0), y.itemOrderedChildrenIds(t.state, c).forEach(d);
1661
+ };
1662
+ d(h);
1663
+ }
1664
+ if (e.parents) {
1665
+ const d = (p) => l[p] ? y.itemOrderedChildrenIds(t.state, p).every(d) : !1, c = (p) => {
1666
+ const f = y.itemParentId(t.state, p);
1667
+ if (f == null)
1668
+ return;
1669
+ y.itemOrderedChildrenIds(t.state, f).every(d) && (s = !0, l[f] = !0, c(f));
1670
+ };
1671
+ c(h);
1672
+ }
1673
+ }), a.removed.forEach((h) => {
1674
+ if (e.parents) {
1675
+ let d = y.itemParentId(t.state, h);
1676
+ for (; d != null; )
1677
+ l[d] && (s = !0, delete l[d]), d = y.itemParentId(t.state, d);
1678
+ }
1679
+ if (e.descendants) {
1680
+ const d = (c) => {
1681
+ c !== h && (s = !0, delete l[c]), y.itemOrderedChildrenIds(t.state, c).forEach(d);
1682
+ };
1683
+ d(h);
1684
+ }
1685
+ }), s ? Object.keys(l) : n;
1686
+ }
1687
+ function nn({
1688
+ store: t,
1689
+ oldModel: e,
1690
+ newModel: n
1691
+ }) {
1692
+ const o = /* @__PURE__ */ new Map();
1693
+ return n.forEach((r) => {
1694
+ o.set(r, !0);
1695
+ }), {
1696
+ added: n.filter((r) => !N.isItemSelected(t.state, r)),
1697
+ removed: e.filter((r) => !o.has(r))
1698
+ };
1699
+ }
1700
+ function Ae(t) {
1701
+ const e = {};
1702
+ return t.forEach((n) => {
1703
+ e[n] = !0;
1704
+ }), e;
1705
+ }
1706
+ function Vo(t, e, n) {
1707
+ const o = W(t, ke.treeId), r = W(t, y.itemChildrenIndentation), s = W(t, N.isMultiSelectEnabled);
1708
+ return (l) => S({
1709
+ ref: n,
1710
+ role: "tree",
1711
+ id: o,
1712
+ "aria-multiselectable": s
1713
+ }, e, l, {
1714
+ style: S({}, e.style, {
1715
+ "--TreeView-itemChildrenIndentation": typeof r == "number" ? `${r}px` : r
1716
+ }),
1717
+ onFocus: (a) => {
1718
+ l.onFocus?.(a), t.focus.handleRootFocus(a);
1719
+ },
1720
+ onBlur: (a) => {
1721
+ l.onBlur?.(a), t.focus.handleRootBlur(a);
1722
+ }
1723
+ });
1724
+ }
1725
+ function zo(t) {
1726
+ return t.replace(/["\\]/g, "\\$&");
1727
+ }
1728
+ const ut = /* @__PURE__ */ M.createContext(null);
1729
+ process.env.NODE_ENV !== "production" && (ut.displayName = "TreeViewChildrenItemContext");
1730
+ function pt(t) {
1731
+ const {
1732
+ children: e,
1733
+ itemId: n = null,
1734
+ idAttribute: o
1735
+ } = t, {
1736
+ store: r,
1737
+ rootRef: s
1738
+ } = be(), l = M.useRef(/* @__PURE__ */ new Map());
1739
+ M.useEffect(() => {
1740
+ if (!s.current)
1741
+ return;
1742
+ const h = y.itemOrderedChildrenIds(r.state, n ?? null) ?? [], d = zo(o ?? s.current.id);
1743
+ if (n != null) {
1744
+ const u = s.current.querySelector(`*[id="${d}"][role="treeitem"]`);
1745
+ if (u && u.getAttribute("aria-expanded") === "false")
1746
+ return;
1747
+ }
1748
+ const c = s.current.querySelectorAll(`${n == null ? "" : `*[id="${d}"] `}[role="treeitem"]:not(*[id="${d}"] [role="treeitem"] [role="treeitem"])`), p = Array.from(c).map((u) => l.current.get(u.id));
1749
+ (p.length !== h.length || p.some((u, m) => u !== h[m])) && r.jsxItems.setJSXItemsOrderedChildrenIds(n ?? null, p);
1750
+ });
1751
+ const a = M.useMemo(() => ({
1752
+ registerChild: (h, d) => l.current.set(h, d),
1753
+ unregisterChild: (h) => l.current.delete(h),
1754
+ parentId: n
1755
+ }), [n]);
1756
+ return /* @__PURE__ */ v(ut.Provider, {
1757
+ value: a,
1758
+ children: e
1759
+ });
1760
+ }
1761
+ process.env.NODE_ENV !== "production" && (pt.propTypes = {
1762
+ children: i.node,
1763
+ id: i.string
1764
+ });
1765
+ const Ee = /* @__PURE__ */ M.createContext(() => -1);
1766
+ process.env.NODE_ENV !== "production" && (Ee.displayName = "TreeViewItemDepthContext");
1767
+ const jo = () => {
1768
+ }, rt = typeof document < "u" ? M.useLayoutEffect : jo, $o = [];
1769
+ function Bo(t) {
1770
+ M.useEffect(t, $o);
1771
+ }
1772
+ function Wo(t, e) {
1773
+ const n = Vn(), o = it(() => new t(S({}, e, {
1774
+ isRtl: n
1775
+ }))).current;
1776
+ return rt(() => o.updateStateFromParameters(S({}, e, {
1777
+ isRtl: n
1778
+ })), [o, n, e]), Bo(o.disposeEffect), o;
1779
+ }
1780
+ class Ko {
1781
+ maxListeners = 20;
1782
+ warnOnce = !1;
1783
+ events = {};
1784
+ on(e, n, o = {}) {
1785
+ let r = this.events[e];
1786
+ if (r || (r = {
1787
+ highPriority: /* @__PURE__ */ new Map(),
1788
+ regular: /* @__PURE__ */ new Map()
1789
+ }, this.events[e] = r), o.isFirst ? r.highPriority.set(n, !0) : r.regular.set(n, !0), process.env.NODE_ENV !== "production") {
1790
+ const s = r.highPriority.size + r.regular.size;
1791
+ s > this.maxListeners && !this.warnOnce && (this.warnOnce = !0, console.warn([`Possible EventEmitter memory leak detected. ${s} ${e} listeners added.`].join(`
1792
+ `)));
1793
+ }
1794
+ }
1795
+ removeListener(e, n) {
1796
+ this.events[e] && (this.events[e].regular.delete(n), this.events[e].highPriority.delete(n));
1797
+ }
1798
+ removeAllListeners() {
1799
+ this.events = {};
1800
+ }
1801
+ emit(e, ...n) {
1802
+ const o = this.events[e];
1803
+ if (!o)
1804
+ return;
1805
+ const r = Array.from(o.highPriority.keys()), s = Array.from(o.regular.keys());
1806
+ for (let l = r.length - 1; l >= 0; l -= 1) {
1807
+ const a = r[l];
1808
+ o.highPriority.has(a) && a.apply(this, n);
1809
+ }
1810
+ for (let l = 0; l < s.length; l += 1) {
1811
+ const a = s[l];
1812
+ o.regular.has(a) && a.apply(this, n);
1813
+ }
1814
+ }
1815
+ once(e, n) {
1816
+ const o = this;
1817
+ this.on(e, function r(...s) {
1818
+ o.removeListener(e, r), n.apply(o, s);
1819
+ });
1820
+ }
1821
+ }
1822
+ const Uo = ({
1823
+ isItemEditable: t,
1824
+ expansionTrigger: e
1825
+ }) => e || (t ? "iconContainer" : "content");
1826
+ function on(t) {
1827
+ return {
1828
+ disabledItemsFocusable: t.disabledItemsFocusable ?? !1,
1829
+ domStructure: "nested",
1830
+ itemChildrenIndentation: t.itemChildrenIndentation ?? "12px",
1831
+ providedTreeId: t.id,
1832
+ // TODO: Fix
1833
+ expansionTrigger: Uo({
1834
+ isItemEditable: t.isItemEditable,
1835
+ expansionTrigger: t.expansionTrigger
1836
+ }),
1837
+ disableSelection: t.disableSelection ?? !1,
1838
+ multiSelect: t.multiSelect ?? !1,
1839
+ checkboxSelection: t.checkboxSelection ?? !1,
1840
+ selectionPropagation: t.selectionPropagation ?? ye
1841
+ };
1842
+ }
1843
+ function zt(t, e, n) {
1844
+ return t !== void 0 ? t : e !== void 0 ? e : n;
1845
+ }
1846
+ function Ho(t) {
1847
+ return S({
1848
+ treeId: void 0,
1849
+ focusedItemId: null
1850
+ }, on(t), De.buildItemsStateIfNeeded(t), {
1851
+ expandedItems: zt(t.expandedItems, t.defaultExpandedItems, []),
1852
+ selectedItems: zt(t.selectedItems, t.defaultSelectedItems, t.multiSelect ? tt : null)
1853
+ });
1854
+ }
1855
+ let jt = 0;
1856
+ const qo = () => (jt += 1, `mui-tree-view-${jt}`);
1857
+ class Go {
1858
+ timeoutIds = /* @__PURE__ */ new Map();
1859
+ intervalIds = /* @__PURE__ */ new Map();
1860
+ startTimeout = (e, n, o) => {
1861
+ this.clearTimeout(e);
1862
+ const r = setTimeout(() => {
1863
+ this.timeoutIds.delete(e), o();
1864
+ }, n);
1865
+ this.timeoutIds.set(e, r);
1866
+ };
1867
+ startInterval = (e, n, o) => {
1868
+ this.clearTimeout(e);
1869
+ const r = setInterval(o, n);
1870
+ this.intervalIds.set(e, r);
1871
+ };
1872
+ clearTimeout = (e) => {
1873
+ const n = this.timeoutIds.get(e);
1874
+ n != null && (clearTimeout(n), this.timeoutIds.delete(e));
1875
+ };
1876
+ clearInterval = (e) => {
1877
+ const n = this.intervalIds.get(e);
1878
+ n != null && (clearInterval(n), this.intervalIds.delete(e));
1879
+ };
1880
+ clearAll = () => {
1881
+ this.timeoutIds.forEach(clearTimeout), this.timeoutIds.clear(), this.intervalIds.forEach(clearInterval), this.intervalIds.clear();
1882
+ };
1883
+ }
1884
+ class Xo {
1885
+ // We can't type `store`, otherwise we get the following TS error:
1886
+ // 'expansion' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
1887
+ constructor(e) {
1888
+ this.store = e;
1889
+ }
1890
+ setExpandedItems = (e, n) => {
1891
+ this.store.parameters.expandedItems === void 0 && this.store.set("expandedItems", n), this.store.parameters.onExpandedItemsChange?.(e, n);
1892
+ };
1893
+ /**
1894
+ * Check if an item is expanded.
1895
+ * @param {TreeViewItemId} itemId The id of the item to check.
1896
+ * @returns {boolean} `true` if the item is expanded, `false` otherwise.
1897
+ */
1898
+ isItemExpanded = (e) => H.isItemExpanded(this.store.state, e);
1899
+ buildPublicAPI = () => ({
1900
+ isItemExpanded: this.isItemExpanded,
1901
+ setItemExpansion: this.setItemExpansion
1902
+ });
1903
+ /**
1904
+ * Change the expansion status of a given item.
1905
+ * @param {object} parameters The parameters of the method.
1906
+ * @param {TreeViewItemId} parameters.itemId The id of the item to expand of collapse.
1907
+ * @param {React.SyntheticEvent} parameters.event The DOM event that triggered the change.
1908
+ * @param {boolean} parameters.shouldBeExpanded If `true` the item will be expanded. If `false` the item will be collapsed. If not defined, the item's expansion status will be the toggled.
1909
+ */
1910
+ setItemExpansion = ({
1911
+ itemId: e,
1912
+ event: n = null,
1913
+ shouldBeExpanded: o
1914
+ }) => {
1915
+ const r = H.isItemExpanded(this.store.state, e), s = o ?? !r;
1916
+ if (r === s)
1917
+ return;
1918
+ const l = {
1919
+ isExpansionPrevented: !1,
1920
+ shouldBeExpanded: s,
1921
+ itemId: e
1922
+ };
1923
+ this.store.publishEvent("beforeItemToggleExpansion", l, n), !l.isExpansionPrevented && this.applyItemExpansion({
1924
+ itemId: e,
1925
+ event: n,
1926
+ shouldBeExpanded: s
1927
+ });
1928
+ };
1929
+ /**
1930
+ * Apply the new expansion status of a given item.
1931
+ * Is used by the `setItemExpansion` method and by the `useTreeViewLazyLoading` plugin.
1932
+ * Unlike `setItemExpansion`, this method does not trigger the lazy loading.
1933
+ * @param {object} parameters The parameters of the method.
1934
+ * @param {TreeViewItemId} parameters.itemId The id of the item to expand of collapse.
1935
+ * @param {React.SyntheticEvent | null} parameters.event The DOM event that triggered the change.
1936
+ * @param {boolean} parameters.shouldBeExpanded If `true` the item will be expanded. If `false` the item will be collapsed.
1937
+ */
1938
+ applyItemExpansion = ({
1939
+ itemId: e,
1940
+ event: n,
1941
+ shouldBeExpanded: o
1942
+ }) => {
1943
+ const r = H.expandedItemsRaw(this.store.state);
1944
+ let s;
1945
+ o ? s = [e].concat(r) : s = r.filter((l) => l !== e), this.store.parameters.onItemExpansionToggle?.(n, e, o), this.setExpandedItems(n, s);
1946
+ };
1947
+ /**
1948
+ * Expand all the siblings (i.e.: the items that have the same parent) of a given item.
1949
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change.
1950
+ * @param {TreeViewItemId} itemId The id of the item whose siblings will be expanded.
1951
+ */
1952
+ expandAllSiblings = (e, n) => {
1953
+ const o = y.itemMeta(this.store.state, n);
1954
+ if (o == null)
1955
+ return;
1956
+ const s = y.itemOrderedChildrenIds(this.store.state, o.parentId).filter((a) => H.isItemExpandable(this.store.state, a) && !H.isItemExpanded(this.store.state, a)), l = H.expandedItemsRaw(this.store.state).concat(s);
1957
+ s.length > 0 && (this.store.parameters.onItemExpansionToggle && s.forEach((a) => {
1958
+ this.store.parameters.onItemExpansionToggle(e, a, !0);
1959
+ }), this.setExpandedItems(e, l));
1960
+ };
1961
+ /**
1962
+ * Mark a list of items as expandable.
1963
+ * @param {TreeViewItemId[]} items The ids of the items to mark as expandable.
1964
+ */
1965
+ addExpandableItems = (e) => {
1966
+ const n = S({}, this.store.state.itemMetaLookup);
1967
+ for (const o of e)
1968
+ n[o] = S({}, n[o], {
1969
+ expandable: !0
1970
+ });
1971
+ this.store.set("itemMetaLookup", n);
1972
+ };
1973
+ }
1974
+ const me = {
1975
+ /**
1976
+ * Checks whether an item is editable.
1977
+ */
1978
+ isItemEditable: P((t) => t.isItemEditable, y.itemModel, (t, e, n) => !e || t == null ? !1 : typeof t == "boolean" ? t : t(e)),
1979
+ /**
1980
+ * Checks whether an item is being edited.
1981
+ */
1982
+ isItemBeingEdited: P((t, e) => e == null ? !1 : t.editedItemId === e),
1983
+ /**
1984
+ * Checks whether any item is being edited.
1985
+ */
1986
+ isAnyItemBeingEdited: P((t) => !!t.editedItemId)
1987
+ }, Jo = 500;
1988
+ class Qo {
1989
+ typeaheadQuery = "";
1990
+ // We can't type `store`, otherwise we get the following TS error:
1991
+ // 'keyboardNavigation' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
1992
+ constructor(e) {
1993
+ this.store = e, this.labelMap = $t(y.itemMetaLookup(this.store.state)), this.store.registerStoreEffect(y.itemMetaLookup, (n, o) => {
1994
+ this.store.shouldIgnoreItemsStateUpdate() || (this.labelMap = $t(o));
1995
+ });
1996
+ }
1997
+ canToggleItemSelection = (e) => N.canItemBeSelected(this.store.state, e);
1998
+ canToggleItemExpansion = (e) => !y.isItemDisabled(this.store.state, e) && H.isItemExpandable(this.store.state, e);
1999
+ getFirstItemMatchingTypeaheadQuery = (e, n) => {
2000
+ const o = (d) => {
2001
+ const c = _e(this.store.state, d);
2002
+ return c === null ? ze(this.store.state) : c;
2003
+ }, r = (d) => {
2004
+ let c = null;
2005
+ const p = {};
2006
+ let f = d.length > 1 ? e : o(e);
2007
+ for (; c == null && !p[f]; )
2008
+ this.labelMap[f]?.startsWith(d) ? c = f : (p[f] = !0, f = o(f));
2009
+ return c;
2010
+ }, s = n.toLowerCase(), l = `${this.typeaheadQuery}${s}`, a = r(l);
2011
+ if (a != null)
2012
+ return this.typeaheadQuery = l, a;
2013
+ const h = r(s);
2014
+ return h != null ? (this.typeaheadQuery = s, h) : (this.typeaheadQuery = "", null);
2015
+ };
2016
+ /**
2017
+ * Updates the `labelMap` to add/remove the first character of some item's labels.
2018
+ * This map is used to navigate the tree using type-ahead search.
2019
+ * This method is only used by the `useTreeViewJSXItems` plugin, otherwise the updates are handled internally.
2020
+ * @param {(map: TreeViewLabelMap) => TreeViewLabelMap} updater The function to update the map.
2021
+ */
2022
+ updateLabelMap = (e) => {
2023
+ this.labelMap = e(this.labelMap);
2024
+ };
2025
+ // ARIA specification: https://www.w3.org/WAI/ARIA/apg/patterns/treeview/#keyboardinteraction
2026
+ /**
2027
+ * Callback fired when a key is pressed on an item.
2028
+ * Handles all the keyboard navigation logic.
2029
+ * @param {React.KeyboardEvent<HTMLElement> & TreeViewCancellableEvent} event The keyboard event that triggered the callback.
2030
+ * @param {TreeViewItemId} itemId The id of the item that the event was triggered on.
2031
+ */
2032
+ handleItemKeyDown = async (e, n) => {
2033
+ if (e.defaultMuiPrevented || e.altKey || ot(e.target, e.currentTarget))
2034
+ return;
2035
+ const o = e.ctrlKey || e.metaKey, r = e.key, s = N.isMultiSelectEnabled(this.store.state);
2036
+ switch (!0) {
2037
+ // Select the item when pressing "Space"
2038
+ case (r === " " && this.canToggleItemSelection(n)): {
2039
+ e.preventDefault(), s && e.shiftKey ? this.store.selection.expandSelectionRange(e, n) : this.store.selection.setItemSelection({
2040
+ event: e,
2041
+ itemId: n,
2042
+ keepExistingSelection: s,
2043
+ shouldBeSelected: void 0
2044
+ });
2045
+ break;
2046
+ }
2047
+ // If the focused item has children, we expand it.
2048
+ // If the focused item has no children, we select it.
2049
+ case r === "Enter": {
2050
+ this.store.labelEditing?.setEditedItem && me.isItemEditable(this.store.state, n) && !me.isItemBeingEdited(this.store.state, n) ? this.store.labelEditing.setEditedItem(n) : this.canToggleItemExpansion(n) ? (this.store.expansion.setItemExpansion({
2051
+ event: e,
2052
+ itemId: n
2053
+ }), e.preventDefault()) : this.canToggleItemSelection(n) && (s ? (e.preventDefault(), this.store.selection.setItemSelection({
2054
+ event: e,
2055
+ itemId: n,
2056
+ keepExistingSelection: !0
2057
+ })) : N.isItemSelected(this.store.state, n) || (this.store.selection.setItemSelection({
2058
+ event: e,
2059
+ itemId: n
2060
+ }), e.preventDefault()));
2061
+ break;
2062
+ }
2063
+ // Focus the next focusable item
2064
+ case r === "ArrowDown": {
2065
+ const l = _e(this.store.state, n);
2066
+ l && (e.preventDefault(), this.store.focus.focusItem(e, l), s && e.shiftKey && this.canToggleItemSelection(l) && this.store.selection.selectItemFromArrowNavigation(e, n, l));
2067
+ break;
2068
+ }
2069
+ // Focuses the previous focusable item
2070
+ case r === "ArrowUp": {
2071
+ const l = Zt(this.store.state, n);
2072
+ l && (e.preventDefault(), this.store.focus.focusItem(e, l), s && e.shiftKey && this.canToggleItemSelection(l) && this.store.selection.selectItemFromArrowNavigation(e, n, l));
2073
+ break;
2074
+ }
2075
+ // If the focused item is expanded, we move the focus to its first child
2076
+ // If the focused item is collapsed and has children, we expand it
2077
+ case (r === "ArrowRight" && !this.store.parameters.isRtl || r === "ArrowLeft" && this.store.parameters.isRtl): {
2078
+ if (o)
2079
+ return;
2080
+ if (H.isItemExpanded(this.store.state, n)) {
2081
+ const l = _e(this.store.state, n);
2082
+ l && (this.store.focus.focusItem(e, l), e.preventDefault());
2083
+ } else this.canToggleItemExpansion(n) && (this.store.expansion.setItemExpansion({
2084
+ event: e,
2085
+ itemId: n
2086
+ }), e.preventDefault());
2087
+ break;
2088
+ }
2089
+ // If the focused item is expanded, we collapse it
2090
+ // If the focused item is collapsed and has a parent, we move the focus to this parent
2091
+ case (r === "ArrowLeft" && !this.store.parameters.isRtl || r === "ArrowRight" && this.store.parameters.isRtl): {
2092
+ if (o)
2093
+ return;
2094
+ if (this.canToggleItemExpansion(n) && H.isItemExpanded(this.store.state, n))
2095
+ this.store.expansion.setItemExpansion({
2096
+ event: e,
2097
+ itemId: n
2098
+ }), e.preventDefault();
2099
+ else {
2100
+ const l = y.itemParentId(this.store.state, n);
2101
+ l && (this.store.focus.focusItem(e, l), e.preventDefault());
2102
+ }
2103
+ break;
2104
+ }
2105
+ // Focuses the first item in the tree
2106
+ case r === "Home": {
2107
+ this.canToggleItemSelection(n) && s && o && e.shiftKey ? this.store.selection.selectRangeFromStartToItem(e, n) : this.store.focus.focusItem(e, ze(this.store.state)), e.preventDefault();
2108
+ break;
2109
+ }
2110
+ // Focuses the last item in the tree
2111
+ case r === "End": {
2112
+ this.canToggleItemSelection(n) && s && o && e.shiftKey ? this.store.selection.selectRangeFromItemToEnd(e, n) : this.store.focus.focusItem(e, en(this.store.state)), e.preventDefault();
2113
+ break;
2114
+ }
2115
+ // Expand all siblings that are at the same level as the focused item
2116
+ case r === "*": {
2117
+ this.store.expansion.expandAllSiblings(e, n), e.preventDefault();
2118
+ break;
2119
+ }
2120
+ // Multi select behavior when pressing Ctrl + a
2121
+ // Selects all the items
2122
+ case (String.fromCharCode(e.keyCode) === "A" && o && s && N.enabled(this.store.state)): {
2123
+ this.store.selection.selectAllNavigableItems(e), e.preventDefault();
2124
+ break;
2125
+ }
2126
+ // Type-ahead
2127
+ case (!o && !e.shiftKey && Yo(r)): {
2128
+ this.store.timeoutManager.clearTimeout("typeahead");
2129
+ const l = this.getFirstItemMatchingTypeaheadQuery(n, r);
2130
+ l != null ? (this.store.focus.focusItem(e, l), e.preventDefault()) : this.typeaheadQuery = "", this.store.timeoutManager.startTimeout("typeahead", Jo, () => {
2131
+ this.typeaheadQuery = "";
2132
+ });
2133
+ break;
2134
+ }
2135
+ }
2136
+ };
2137
+ }
2138
+ function Yo(t) {
2139
+ return !!t && t.length === 1 && !!t.match(/\S/);
2140
+ }
2141
+ function $t(t) {
2142
+ const e = {}, n = (o) => {
2143
+ e[o.id] = o.label.toLowerCase();
2144
+ };
2145
+ return Object.values(t).forEach(n), e;
2146
+ }
2147
+ const Bt = Te(N.selectedItems, H.expandedItemsMap, y.itemMetaLookup, y.disabledItemFocusable, (t) => y.itemOrderedChildrenIds(t, null), (t, e, n, o, r) => {
2148
+ const s = t.find((a) => {
2149
+ if (!o && Ve(n, a))
2150
+ return !1;
2151
+ const h = n[a];
2152
+ return h && (h.parentId == null || e.has(h.parentId));
2153
+ });
2154
+ if (s != null)
2155
+ return s;
2156
+ const l = r.find((a) => o || !Ve(n, a));
2157
+ return l ?? null;
2158
+ }), de = {
2159
+ /**
2160
+ * Gets the item that should be sequentially focusable (usually with the Tab key).
2161
+ * At any point in time, there is a single item that can be sequentially focused in the Tree View.
2162
+ * This item is the first selected item (that is both visible and navigable), if any, or the first navigable item if no item is selected.
2163
+ */
2164
+ defaultFocusableItemId: Bt,
2165
+ /**
2166
+ * Checks whether an item is the default focusable item.
2167
+ */
2168
+ isItemTheDefaultFocusableItem: P(Bt, (t, e) => t === e),
2169
+ /**
2170
+ * Gets the id of the item that is currently focused.
2171
+ */
2172
+ focusedItemId: P((t) => t.focusedItemId),
2173
+ /**
2174
+ * Checks whether an item is focused.
2175
+ */
2176
+ isItemFocused: P((t, e) => t.focusedItemId === e)
2177
+ };
2178
+ class Zo {
2179
+ // We can't type `store`, otherwise we get the following TS error:
2180
+ // 'focus' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
2181
+ constructor(e) {
2182
+ this.store = e, this.store.registerStoreEffect(y.itemMetaLookup, () => {
2183
+ const n = de.focusedItemId(e.state);
2184
+ if (n == null || !!y.itemMeta(e.state, n))
2185
+ return;
2186
+ const r = de.defaultFocusableItemId(e.state);
2187
+ if (r == null) {
2188
+ this.setFocusedItemId(null);
2189
+ return;
2190
+ }
2191
+ this.applyItemFocus(null, r);
2192
+ });
2193
+ }
2194
+ setFocusedItemId = (e) => {
2195
+ de.focusedItemId(this.store.state) !== e && this.store.set("focusedItemId", e);
2196
+ };
2197
+ applyItemFocus = (e, n) => {
2198
+ this.store.items.getItemDOMElement(n)?.focus(), this.setFocusedItemId(n), this.store.parameters.onItemFocus?.(e, n);
2199
+ };
2200
+ buildPublicAPI = () => ({
2201
+ focusItem: this.focusItem
2202
+ });
2203
+ /**
2204
+ * Focus the item with the given id.
2205
+ *
2206
+ * If the item is the child of a collapsed item, then this method will do nothing.
2207
+ * Make sure to expand the ancestors of the item before calling this method if needed.
2208
+ * @param {React.SyntheticEvent | null} event The DOM event that triggered the change.
2209
+ * @param {TreeViewItemId} itemId The id of the item to focus.
2210
+ */
2211
+ focusItem = (e, n) => {
2212
+ const o = y.itemMeta(this.store.state, n);
2213
+ o && (o.parentId == null || H.isItemExpanded(this.store.state, o.parentId)) && this.applyItemFocus(e, n);
2214
+ };
2215
+ /**
2216
+ * Remove the focus from the currently focused item (both from the internal state and the DOM).
2217
+ */
2218
+ removeFocusedItem = () => {
2219
+ const e = de.focusedItemId(this.store.state);
2220
+ if (e == null)
2221
+ return;
2222
+ if (y.itemMeta(this.store.state, e)) {
2223
+ const o = this.store.items.getItemDOMElement(e);
2224
+ o && o.blur();
2225
+ }
2226
+ this.setFocusedItemId(null);
2227
+ };
2228
+ /**
2229
+ * Event handler to fire when the `root` slot of the Tree View is focused.
2230
+ * @param {React.MouseEvent} event The DOM event that triggered the change.
2231
+ */
2232
+ handleRootFocus = (e) => {
2233
+ if (e.defaultMuiPrevented)
2234
+ return;
2235
+ const n = de.defaultFocusableItemId(this.store.state);
2236
+ e.target === e.currentTarget && n != null && this.applyItemFocus(e, n);
2237
+ };
2238
+ /**
2239
+ * Event handler to fire when the `root` slot of the Tree View is blurred.
2240
+ * @param {React.MouseEvent} event The DOM event that triggered the change.
2241
+ */
2242
+ handleRootBlur = (e) => {
2243
+ e.defaultMuiPrevented || this.setFocusedItemId(null);
2244
+ };
2245
+ }
2246
+ class er {
2247
+ itemPlugins = [];
2248
+ itemWrappers = [];
2249
+ register = (e, n) => {
2250
+ this.itemPlugins.push(e), n && this.itemWrappers.push(n);
2251
+ };
2252
+ listPlugins = () => this.itemPlugins;
2253
+ listWrappers = () => this.itemWrappers;
2254
+ }
2255
+ class tr extends dt {
2256
+ initialParameters = null;
2257
+ eventManager = new Ko();
2258
+ timeoutManager = new Go();
2259
+ itemPluginManager = new er();
2260
+ constructor(e, n, o) {
2261
+ const r = Ho(e), s = o.getInitialState(r, e);
2262
+ super(s), this.parameters = e, this.instanceName = n, this.mapper = o, this.items = new De(this), this.focus = new Zo(this), this.expansion = new Xo(this), this.selection = new No(this), this.keyboardNavigation = new Qo(this), process.env.NODE_ENV !== "production" && (this.initialParameters = e);
2263
+ }
2264
+ /**
2265
+ * Builds an object containing the method that should be exposed publicly by the Tree View components.
2266
+ */
2267
+ buildPublicAPI() {
2268
+ return S({}, this.items.buildPublicAPI(), this.focus.buildPublicAPI(), this.expansion.buildPublicAPI(), this.selection.buildPublicAPI());
2269
+ }
2270
+ /**
2271
+ * Updates the state of the Tree View based on the new parameters provided to the root component.
2272
+ */
2273
+ updateStateFromParameters(e) {
2274
+ const n = (s, l, a) => {
2275
+ if (e[l] !== void 0 && (s[l] = e[l]), process.env.NODE_ENV !== "production") {
2276
+ const h = e[a], d = e[l] !== void 0, c = this.initialParameters?.[a], p = this.initialParameters?.[l] !== void 0;
2277
+ p !== d ? et([`MUI X Tree View: A component is changing the ${p ? "" : "un"}controlled ${l} state of ${this.instanceName} to be ${p ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${l} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"], "error") : JSON.stringify(c) !== JSON.stringify(h) && et([`MUI X Tree View: A component is changing the default ${l} state of an uncontrolled ${this.instanceName} after being initialized. `, `To suppress this warning opt to use a controlled ${this.instanceName}.`], "error");
2278
+ }
2279
+ }, o = on(e);
2280
+ n(o, "expandedItems", "defaultExpandedItems"), n(o, "selectedItems", "defaultSelectedItems"), (this.state.providedTreeId !== e.id || this.state.treeId === void 0) && (o.treeId = qo()), !this.mapper.shouldIgnoreItemsStateUpdate(e) && De.shouldRebuildItemsState(e, this.parameters) && Object.assign(o, De.buildItemsStateIfNeeded(e));
2281
+ const r = this.mapper.updateStateFromParameters(o, e, n);
2282
+ this.update(r), this.parameters = e;
2283
+ }
2284
+ /**
2285
+ * Returns a cleanup function that need to be called when the store is destroyed.
2286
+ */
2287
+ disposeEffect = () => this.timeoutManager.clearAll;
2288
+ /**
2289
+ * Whether updates based on `props.items` change should be ignored.
2290
+ */
2291
+ shouldIgnoreItemsStateUpdate = () => this.mapper.shouldIgnoreItemsStateUpdate(this.parameters);
2292
+ /**
2293
+ * Registers an effect to be run when the value returned by the selector changes.
2294
+ */
2295
+ registerStoreEffect = (e, n) => {
2296
+ let o = e(this.state);
2297
+ this.subscribe((r) => {
2298
+ const s = e(r);
2299
+ s !== o && (n(o, s), o = s);
2300
+ });
2301
+ };
2302
+ /**
2303
+ * Publishes an event to all its subscribers.
2304
+ */
2305
+ publishEvent = (e, n, o) => {
2306
+ nr(o) && o.isPropagationStopped() || this.eventManager.emit(e, n, o);
2307
+ };
2308
+ /**
2309
+ * Subscribe to an event emitted by the store.
2310
+ * For now, the subscription is only removed when the store is destroyed.
2311
+ */
2312
+ subscribeEvent = (e, n) => {
2313
+ this.eventManager.on(e, n);
2314
+ };
2315
+ }
2316
+ function nr(t) {
2317
+ return t.isPropagationStopped !== void 0;
2318
+ }
2319
+ const Wt = {
2320
+ /**
2321
+ * Checks if the lazy loaded state is empty.
2322
+ */
2323
+ isEmpty: P((t) => t.lazyLoadedItems == null ? !0 : Object.keys(t.lazyLoadedItems.loading).length === 0 && Object.keys(t.lazyLoadedItems.errors).length === 0),
2324
+ /**
2325
+ * Checks whether an item is loading.
2326
+ */
2327
+ isItemLoading: P((t, e) => t.lazyLoadedItems?.loading[e ?? se] ?? !1),
2328
+ /**
2329
+ * Checks whether an item has errors.
2330
+ */
2331
+ itemHasError: P((t, e) => !!t.lazyLoadedItems?.errors[e ?? se]),
2332
+ /**
2333
+ * Get an item error.
2334
+ */
2335
+ itemError: P((t, e) => t.lazyLoadedItems?.errors[e ?? se])
2336
+ }, ft = (t) => Array.isArray(t) ? t.length > 0 && t.some(ft) : !!t, or = ({
2337
+ itemId: t,
2338
+ children: e
2339
+ }) => {
2340
+ const {
2341
+ store: n,
2342
+ publicAPI: o
2343
+ } = be(), r = W(n, H.isItemExpandable, t), s = W(n, Wt.isItemLoading, t), l = W(n, Wt.itemHasError, t), a = ft(e) || r, h = W(n, H.isItemExpanded, t), d = W(n, de.isItemFocused, t), c = W(n, N.isItemSelected, t), p = W(n, y.isItemDisabled, t), f = W(n, me.isItemBeingEdited, t), u = W(n, me.isItemEditable, t), m = {
2344
+ expandable: a,
2345
+ expanded: h,
2346
+ focused: d,
2347
+ selected: c,
2348
+ disabled: p,
2349
+ editing: f,
2350
+ editable: u,
2351
+ loading: s,
2352
+ error: l
2353
+ }, I = (C) => {
2354
+ if (m.disabled)
2355
+ return;
2356
+ m.focused || n.focus.focusItem(C, t);
2357
+ const D = N.isMultiSelectEnabled(n.state) && (C.shiftKey || C.ctrlKey || C.metaKey);
2358
+ m.expandable && !(D && H.isItemExpanded(n.state, t)) && n.expansion.setItemExpansion({
2359
+ event: C,
2360
+ itemId: t
2361
+ });
2362
+ }, b = (C) => {
2363
+ if (!N.canItemBeSelected(n.state, t))
2364
+ return;
2365
+ !m.focused && !m.editing && n.focus.focusItem(C, t), N.isMultiSelectEnabled(n.state) && (C.shiftKey || C.ctrlKey || C.metaKey) ? C.shiftKey ? n.selection.expandSelectionRange(C, t) : n.selection.setItemSelection({
2366
+ event: C,
2367
+ itemId: t,
2368
+ keepExistingSelection: !0
2369
+ }) : n.selection.setItemSelection({
2370
+ event: C,
2371
+ itemId: t,
2372
+ shouldBeSelected: !0
2373
+ });
2374
+ }, x = (C) => {
2375
+ const D = C.nativeEvent.shiftKey, V = N.isMultiSelectEnabled(n.state);
2376
+ V && D ? n.selection.expandSelectionRange(C, t) : n.selection.setItemSelection({
2377
+ event: C,
2378
+ itemId: t,
2379
+ keepExistingSelection: V,
2380
+ shouldBeSelected: C.target.checked
2381
+ });
2382
+ }, w = () => {
2383
+ n.labelEditing && (f ? n.labelEditing.setEditedItem(null) : n.labelEditing.setEditedItem(t));
2384
+ };
2385
+ return {
2386
+ interactions: {
2387
+ handleExpansion: I,
2388
+ handleSelection: b,
2389
+ handleCheckboxSelection: x,
2390
+ toggleItemEditing: w,
2391
+ handleSaveItemLabel: (C, D) => {
2392
+ n.labelEditing && me.isItemBeingEdited(n.state, t) && (n.labelEditing.updateItemLabel(t, D), w(), n.focus.focusItem(C, t));
2393
+ },
2394
+ handleCancelItemLabelEditing: (C) => {
2395
+ n.labelEditing && me.isItemBeingEdited(n.state, t) && (w(), n.focus.focusItem(C, t));
2396
+ }
2397
+ },
2398
+ status: m,
2399
+ publicAPI: o
2400
+ };
2401
+ }, rr = ({
2402
+ props: t,
2403
+ rootRef: e,
2404
+ contentRef: n
2405
+ }) => {
2406
+ const {
2407
+ store: o
2408
+ } = be(), {
2409
+ children: r,
2410
+ disabled: s = !1,
2411
+ disableSelection: l = !1,
2412
+ label: a,
2413
+ itemId: h,
2414
+ id: d
2415
+ } = t, c = M.useContext(ut);
2416
+ if (c == null)
2417
+ throw new Error(["MUI X: Could not find the Tree View Children Item context.", "It looks like you rendered your component outside of a SimpleTreeView parent component.", "This can also happen if you are bundling multiple versions of the Tree View."].join(`
2418
+ `));
2419
+ const {
2420
+ registerChild: p,
2421
+ unregisterChild: f,
2422
+ parentId: u
2423
+ } = c, m = ft(r), I = M.useRef(null), b = Ne(I, n), x = W(o, ke.treeItemIdAttribute, h, d);
2424
+ return rt(() => (p(x, h), () => {
2425
+ f(x), f(x);
2426
+ }), [o, p, f, x, h]), rt(() => o.jsxItems.insertJSXItem({
2427
+ id: h,
2428
+ idAttribute: d,
2429
+ parentId: u,
2430
+ expandable: m,
2431
+ disabled: s,
2432
+ selectable: !l
2433
+ }), [o, u, h, m, s, l, d]), M.useEffect(() => {
2434
+ if (a)
2435
+ return o.jsxItems.mapLabelFromJSX(h, (I.current?.textContent ?? "").toLowerCase());
2436
+ }, [o, h, a]), {
2437
+ contentRef: b,
2438
+ rootRef: e
2439
+ };
2440
+ }, rn = ({
2441
+ children: t,
2442
+ itemId: e,
2443
+ idAttribute: n
2444
+ }) => {
2445
+ const o = M.useContext(Ee);
2446
+ return /* @__PURE__ */ v(pt, {
2447
+ itemId: e,
2448
+ idAttribute: n,
2449
+ children: /* @__PURE__ */ v(Ee.Provider, {
2450
+ value: o + 1,
2451
+ children: t
2452
+ })
2453
+ });
2454
+ };
2455
+ process.env.NODE_ENV !== "production" && (rn.displayName = "jsxItemsitemWrapper");
2456
+ class sr {
2457
+ constructor(e) {
2458
+ this.store = e, e.itemPluginManager.register(rr, rn);
2459
+ }
2460
+ /**
2461
+ * Insert a new item in the state from a Tree Item component.
2462
+ * @param {TreeViewItemMeta} item The meta-information of the item to insert.
2463
+ * @returns {() => void} A function to remove the item from the state.
2464
+ */
2465
+ insertJSXItem = (e) => {
2466
+ if (this.store.state.itemMetaLookup[e.id] != null)
2467
+ throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${e.id}"`].join(`
2468
+ `));
2469
+ return this.store.update({
2470
+ itemMetaLookup: S({}, this.store.state.itemMetaLookup, {
2471
+ [e.id]: e
2472
+ }),
2473
+ // For Simple Tree View, we don't have a proper `item` object, so we create a very basic one.
2474
+ itemModelLookup: S({}, this.store.state.itemModelLookup, {
2475
+ [e.id]: {
2476
+ id: e.id,
2477
+ label: e.label ?? ""
2478
+ }
2479
+ })
2480
+ }), () => {
2481
+ const n = S({}, this.store.state.itemMetaLookup), o = S({}, this.store.state.itemModelLookup);
2482
+ delete n[e.id], delete o[e.id], this.store.update({
2483
+ itemMetaLookup: n,
2484
+ itemModelLookup: o
2485
+ });
2486
+ };
2487
+ };
2488
+ /**
2489
+ * Updates the `labelMap` to register the first character of the given item's label.
2490
+ * This map is used to navigate the tree using type-ahead search.
2491
+ * @param {TreeViewItemId} itemId The id of the item to map the label of.
2492
+ * @param {string} label The item's label.
2493
+ * @returns {() => void} A function to remove the item from the `labelMap`.
2494
+ */
2495
+ mapLabelFromJSX = (e, n) => (this.store.keyboardNavigation.updateLabelMap((o) => (o[e] = n, o)), () => {
2496
+ this.store.keyboardNavigation.updateLabelMap((o) => {
2497
+ const r = S({}, o);
2498
+ return delete r[e], r;
2499
+ });
2500
+ });
2501
+ /**
2502
+ * Store the ids of a given item's children in the state.
2503
+ * Those ids must be passed in the order they should be rendered.
2504
+ * @param {TreeViewItemId | null} parentId The id of the item to store the children of.
2505
+ * @param {TreeViewItemId[]} orderedChildrenIds The ids of the item's children.
2506
+ */
2507
+ setJSXItemsOrderedChildrenIds = (e, n) => {
2508
+ const o = e ?? se;
2509
+ this.store.update({
2510
+ itemOrderedChildrenIdsLookup: S({}, this.store.state.itemOrderedChildrenIdsLookup, {
2511
+ [o]: n
2512
+ }),
2513
+ itemChildrenIndexesLookup: S({}, this.store.state.itemChildrenIndexesLookup, {
2514
+ [o]: Qt(n)
2515
+ })
2516
+ });
2517
+ };
2518
+ }
2519
+ const ir = {
2520
+ getInitialState: (t) => t,
2521
+ updateStateFromParameters: (t) => t,
2522
+ shouldIgnoreItemsStateUpdate: () => !0
2523
+ };
2524
+ class lr extends tr {
2525
+ jsxItems = new sr(this);
2526
+ constructor(e) {
2527
+ super(S({}, e, {
2528
+ items: tt
2529
+ }), "SimpleTreeView", ir);
2530
+ }
2531
+ updateStateFromParameters(e) {
2532
+ super.updateStateFromParameters(S({}, e, {
2533
+ items: tt
2534
+ }));
2535
+ }
2536
+ }
2537
+ const ar = qt(), cr = (t) => {
2538
+ const {
2539
+ classes: e
2540
+ } = t;
2541
+ return M.useMemo(() => we({
2542
+ root: ["root"],
2543
+ item: ["item"],
2544
+ itemContent: ["itemContent"],
2545
+ itemGroupTransition: ["itemGroupTransition"],
2546
+ itemIconContainer: ["itemIconContainer"],
2547
+ itemLabel: ["itemLabel"],
2548
+ // itemLabelInput: ['itemLabelInput'], => feature not available on this component
2549
+ itemCheckbox: ["itemCheckbox"]
2550
+ // itemDragAndDropOverlay: ['itemDragAndDropOverlay'], => feature not available on this component
2551
+ // itemErrorIcon: ['itemErrorIcon'], => feature not available on this component
2552
+ }, Un, e), [e]);
2553
+ }, dr = G("ul", {
2554
+ name: "MuiSimpleTreeView",
2555
+ slot: "Root"
2556
+ })({
2557
+ padding: 0,
2558
+ margin: 0,
2559
+ listStyle: "none",
2560
+ outline: 0,
2561
+ position: "relative"
2562
+ }), ht = /* @__PURE__ */ M.forwardRef(function(e, n) {
2563
+ const o = ar({
2564
+ props: e,
2565
+ name: "MuiSimpleTreeView"
2566
+ });
2567
+ process.env.NODE_ENV !== "production" && o.items != null && et(["MUI X: The Simple Tree View component does not support the `items` prop.", "If you want to add items, you need to pass them as JSX children.", "Check the documentation for more details: https://mui.com/x/react-tree-view/simple-tree-view/items/."]);
2568
+ const {
2569
+ slots: r,
2570
+ slotProps: s,
2571
+ apiRef: l,
2572
+ parameters: a,
2573
+ forwardedProps: h
2574
+ } = Jn(o), d = Wo(lr, a), c = M.useRef(null), p = Ne(n, c), f = Vo(d, h, p), u = cr(o), m = r?.root ?? dr, I = te({
2575
+ elementType: m,
2576
+ externalSlotProps: s?.root,
2577
+ className: u.root,
2578
+ getSlotProps: f,
2579
+ ownerState: o
2580
+ });
2581
+ return /* @__PURE__ */ v(Gn, {
2582
+ store: d,
2583
+ classes: u,
2584
+ slots: r,
2585
+ slotProps: s,
2586
+ apiRef: l,
2587
+ rootRef: c,
2588
+ children: /* @__PURE__ */ v(pt, {
2589
+ itemId: null,
2590
+ idAttribute: null,
2591
+ children: /* @__PURE__ */ v(Ee.Provider, {
2592
+ value: 0,
2593
+ children: /* @__PURE__ */ v(m, S({}, I))
2594
+ })
2595
+ })
2596
+ });
2597
+ });
2598
+ process.env.NODE_ENV !== "production" && (ht.displayName = "SimpleTreeView");
2599
+ process.env.NODE_ENV !== "production" && (ht.propTypes = {
2600
+ // ----------------------------- Warning --------------------------------
2601
+ // | These PropTypes are generated from the TypeScript type definitions |
2602
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
2603
+ // ----------------------------------------------------------------------
2604
+ /**
2605
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useSimpleTreeViewApiRef()`.
2606
+ */
2607
+ apiRef: i.shape({
2608
+ current: i.shape({
2609
+ focusItem: i.func,
2610
+ getItem: i.func,
2611
+ getItemDOMElement: i.func,
2612
+ getItemOrderedChildrenIds: i.func,
2613
+ getItemTree: i.func,
2614
+ getParentId: i.func,
2615
+ isItemExpanded: i.func,
2616
+ setIsItemDisabled: i.func,
2617
+ setItemExpansion: i.func,
2618
+ setItemSelection: i.func
2619
+ })
2620
+ }),
2621
+ /**
2622
+ * Whether the Tree View renders a checkbox at the left of its label that allows selecting it.
2623
+ * @default false
2624
+ */
2625
+ checkboxSelection: i.bool,
2626
+ /**
2627
+ * The content of the component.
2628
+ */
2629
+ children: i.node,
2630
+ /**
2631
+ * Override or extend the styles applied to the component.
2632
+ */
2633
+ classes: i.object,
2634
+ className: i.string,
2635
+ /**
2636
+ * Expanded item ids.
2637
+ * Used when the item's expansion is not controlled.
2638
+ * @default []
2639
+ */
2640
+ defaultExpandedItems: i.arrayOf(i.string),
2641
+ /**
2642
+ * Selected item ids. (Uncontrolled)
2643
+ * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2644
+ * @default []
2645
+ */
2646
+ defaultSelectedItems: i.any,
2647
+ /**
2648
+ * Whether the items should be focusable when disabled.
2649
+ * @default false
2650
+ */
2651
+ disabledItemsFocusable: i.bool,
2652
+ /**
2653
+ * Whether selection is disabled.
2654
+ * @default false
2655
+ */
2656
+ disableSelection: i.bool,
2657
+ /**
2658
+ * Expanded item ids.
2659
+ * Used when the item's expansion is controlled.
2660
+ */
2661
+ expandedItems: i.arrayOf(i.string),
2662
+ /**
2663
+ * The slot that triggers the item's expansion when clicked.
2664
+ * @default 'content'
2665
+ */
2666
+ expansionTrigger: i.oneOf(["content", "iconContainer"]),
2667
+ /**
2668
+ * This prop is used to help implement the accessibility logic.
2669
+ * If you don't provide this prop. It falls back to a randomly generated id.
2670
+ */
2671
+ id: i.string,
2672
+ /**
2673
+ * Horizontal indentation between an item and its children.
2674
+ * Examples: 24, "24px", "2rem", "2em".
2675
+ * @default 12px
2676
+ */
2677
+ itemChildrenIndentation: i.oneOfType([i.number, i.string]),
2678
+ /**
2679
+ * Whether multiple items can be selected.
2680
+ * @default false
2681
+ */
2682
+ multiSelect: i.bool,
2683
+ /**
2684
+ * Callback fired when Tree Items are expanded/collapsed.
2685
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemExpansion()` method.
2686
+ * @param {TreeViewItemId[]} itemIds The ids of the expanded items.
2687
+ */
2688
+ onExpandedItemsChange: i.func,
2689
+ /**
2690
+ * Callback fired when the `content` slot of a given Tree Item is clicked.
2691
+ * @param {React.MouseEvent} event The DOM event that triggered the change.
2692
+ * @param {TreeViewItemId} itemId The id of the focused item.
2693
+ */
2694
+ onItemClick: i.func,
2695
+ /**
2696
+ * Callback fired when a Tree Item is expanded or collapsed.
2697
+ * @param {React.SyntheticEvent | null} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemExpansion()` method.
2698
+ * @param {TreeViewItemId} itemId The itemId of the modified item.
2699
+ * @param {boolean} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
2700
+ */
2701
+ onItemExpansionToggle: i.func,
2702
+ /**
2703
+ * Callback fired when a given Tree Item is focused.
2704
+ * @param {React.SyntheticEvent | null} event The DOM event that triggered the change. **Warning**: This is a generic event not a focus event.
2705
+ * @param {TreeViewItemId} itemId The id of the focused item.
2706
+ */
2707
+ onItemFocus: i.func,
2708
+ /**
2709
+ * Callback fired when a Tree Item is selected or deselected.
2710
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
2711
+ * @param {TreeViewItemId} itemId The itemId of the modified item.
2712
+ * @param {boolean} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
2713
+ */
2714
+ onItemSelectionToggle: i.func,
2715
+ /**
2716
+ * Callback fired when Tree Items are selected/deselected.
2717
+ * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
2718
+ * @param {TreeViewItemId[] | TreeViewItemId} itemIds The ids of the selected items.
2719
+ * When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
2720
+ */
2721
+ onSelectedItemsChange: i.func,
2722
+ /**
2723
+ * Selected item ids. (Controlled)
2724
+ * When `multiSelect` is true this takes an array of strings; when false (default) a string.
2725
+ */
2726
+ selectedItems: i.any,
2727
+ /**
2728
+ * When `selectionPropagation.descendants` is set to `true`.
2729
+ *
2730
+ * - Selecting a parent selects all its descendants automatically.
2731
+ * - Deselecting a parent deselects all its descendants automatically.
2732
+ *
2733
+ * When `selectionPropagation.parents` is set to `true`.
2734
+ *
2735
+ * - Selecting all the descendants of a parent selects the parent automatically.
2736
+ * - Deselecting a descendant of a selected parent deselects the parent automatically.
2737
+ *
2738
+ * Only works when `multiSelect` is `true`.
2739
+ * On the <SimpleTreeView />, only the expanded items are considered (since the collapsed item are not passed to the Tree View component at all)
2740
+ *
2741
+ * @default { parents: false, descendants: false }
2742
+ */
2743
+ selectionPropagation: i.shape({
2744
+ descendants: i.bool,
2745
+ parents: i.bool
2746
+ }),
2747
+ /**
2748
+ * The props used for each component slot.
2749
+ */
2750
+ slotProps: i.object,
2751
+ /**
2752
+ * Overridable component slots.
2753
+ */
2754
+ slots: i.object,
2755
+ /**
2756
+ * The system prop that allows defining system overrides as well as additional CSS styles.
2757
+ */
2758
+ sx: i.oneOfType([i.arrayOf(i.oneOfType([i.func, i.object, i.bool])), i.func, i.object])
2759
+ });
2760
+ function ur(t) {
2761
+ return Ce("MuiCollapse", t);
2762
+ }
2763
+ ve("MuiCollapse", ["root", "horizontal", "vertical", "entered", "hidden", "wrapper", "wrapperInner"]);
2764
+ const pr = (t) => {
2765
+ const {
2766
+ orientation: e,
2767
+ classes: n
2768
+ } = t, o = {
2769
+ root: ["root", `${e}`],
2770
+ entered: ["entered"],
2771
+ hidden: ["hidden"],
2772
+ wrapper: ["wrapper", `${e}`],
2773
+ wrapperInner: ["wrapperInner", `${e}`]
2774
+ };
2775
+ return we(o, ur, n);
2776
+ }, fr = G("div", {
2777
+ name: "MuiCollapse",
2778
+ slot: "Root",
2779
+ overridesResolver: (t, e) => {
2780
+ const {
2781
+ ownerState: n
2782
+ } = t;
2783
+ return [e.root, e[n.orientation], n.state === "entered" && e.entered, n.state === "exited" && !n.in && n.collapsedSize === "0px" && e.hidden];
2784
+ }
2785
+ })(Ut(({
2786
+ theme: t
2787
+ }) => ({
2788
+ height: 0,
2789
+ overflow: "hidden",
2790
+ transition: t.transitions.create("height"),
2791
+ variants: [{
2792
+ props: {
2793
+ orientation: "horizontal"
2794
+ },
2795
+ style: {
2796
+ height: "auto",
2797
+ width: 0,
2798
+ transition: t.transitions.create("width")
2799
+ }
2800
+ }, {
2801
+ props: {
2802
+ state: "entered"
2803
+ },
2804
+ style: {
2805
+ height: "auto",
2806
+ overflow: "visible"
2807
+ }
2808
+ }, {
2809
+ props: {
2810
+ state: "entered",
2811
+ orientation: "horizontal"
2812
+ },
2813
+ style: {
2814
+ width: "auto"
2815
+ }
2816
+ }, {
2817
+ props: ({
2818
+ ownerState: e
2819
+ }) => e.state === "exited" && !e.in && e.collapsedSize === "0px",
2820
+ style: {
2821
+ visibility: "hidden"
2822
+ }
2823
+ }]
2824
+ }))), hr = G("div", {
2825
+ name: "MuiCollapse",
2826
+ slot: "Wrapper"
2827
+ })({
2828
+ // Hack to get children with a negative margin to not falsify the height computation.
2829
+ display: "flex",
2830
+ width: "100%",
2831
+ variants: [{
2832
+ props: {
2833
+ orientation: "horizontal"
2834
+ },
2835
+ style: {
2836
+ width: "auto",
2837
+ height: "100%"
2838
+ }
2839
+ }]
2840
+ }), mr = G("div", {
2841
+ name: "MuiCollapse",
2842
+ slot: "WrapperInner"
2843
+ })({
2844
+ width: "100%",
2845
+ variants: [{
2846
+ props: {
2847
+ orientation: "horizontal"
2848
+ },
2849
+ style: {
2850
+ width: "auto",
2851
+ height: "100%"
2852
+ }
2853
+ }]
2854
+ }), je = /* @__PURE__ */ M.forwardRef(function(e, n) {
2855
+ const o = Kt({
2856
+ props: e,
2857
+ name: "MuiCollapse"
2858
+ }), {
2859
+ addEndListener: r,
2860
+ children: s,
2861
+ className: l,
2862
+ collapsedSize: a = "0px",
2863
+ component: h,
2864
+ easing: d,
2865
+ in: c,
2866
+ onEnter: p,
2867
+ onEntered: f,
2868
+ onEntering: u,
2869
+ onExit: m,
2870
+ onExited: I,
2871
+ onExiting: b,
2872
+ orientation: x = "vertical",
2873
+ slots: w = {},
2874
+ slotProps: _ = {},
2875
+ style: R,
2876
+ timeout: F = Rn.standard,
2877
+ // eslint-disable-next-line react/prop-types
2878
+ TransitionComponent: C = Dn,
2879
+ ...D
2880
+ } = o, V = {
2881
+ ...o,
2882
+ orientation: x,
2883
+ collapsedSize: a
2884
+ }, j = pr(V), E = _n(), k = Tn(), O = M.useRef(null), A = M.useRef(), L = typeof a == "number" ? `${a}px` : a, $ = x === "horizontal", B = $ ? "width" : "height", J = M.useRef(null), Z = kn(n, J), q = (z) => (ne) => {
2885
+ if (z) {
2886
+ const oe = J.current;
2887
+ ne === void 0 ? z(oe) : z(oe, ne);
2888
+ }
2889
+ }, ie = () => O.current ? O.current[$ ? "clientWidth" : "clientHeight"] : 0, ae = q((z, ne) => {
2890
+ O.current && $ && (O.current.style.position = "absolute"), z.style[B] = L, p && p(z, ne);
2891
+ }), ue = q((z, ne) => {
2892
+ const oe = ie();
2893
+ O.current && $ && (O.current.style.position = "");
2894
+ const {
2895
+ duration: le,
2896
+ easing: Me
2897
+ } = Et({
2898
+ style: R,
2899
+ timeout: F,
2900
+ easing: d
2901
+ }, {
2902
+ mode: "enter"
2903
+ });
2904
+ if (F === "auto") {
2905
+ const It = E.transitions.getAutoHeightDuration(oe);
2906
+ z.style.transitionDuration = `${It}ms`, A.current = It;
2907
+ } else
2908
+ z.style.transitionDuration = typeof le == "string" ? le : `${le}ms`;
2909
+ z.style[B] = `${oe}px`, z.style.transitionTimingFunction = Me, u && u(z, ne);
2910
+ }), ce = q((z, ne) => {
2911
+ z.style[B] = "auto", f && f(z, ne);
2912
+ }), pe = q((z) => {
2913
+ z.style[B] = `${ie()}px`, m && m(z);
2914
+ }), K = q(I), X = q((z) => {
2915
+ const ne = ie(), {
2916
+ duration: oe,
2917
+ easing: le
2918
+ } = Et({
2919
+ style: R,
2920
+ timeout: F,
2921
+ easing: d
2922
+ }, {
2923
+ mode: "exit"
2924
+ });
2925
+ if (F === "auto") {
2926
+ const Me = E.transitions.getAutoHeightDuration(ne);
2927
+ z.style.transitionDuration = `${Me}ms`, A.current = Me;
2928
+ } else
2929
+ z.style.transitionDuration = typeof oe == "string" ? oe : `${oe}ms`;
2930
+ z.style[B] = L, z.style.transitionTimingFunction = le, b && b(z);
2931
+ }), T = (z) => {
2932
+ F === "auto" && k.start(A.current || 0, z), r && r(J.current, z);
2933
+ }, g = {
2934
+ slots: w,
2935
+ slotProps: _,
2936
+ component: h
2937
+ }, [U, ee] = Ie("root", {
2938
+ ref: Z,
2939
+ className: Q(j.root, l),
2940
+ elementType: fr,
2941
+ externalForwardedProps: g,
2942
+ ownerState: V,
2943
+ additionalProps: {
2944
+ style: {
2945
+ [$ ? "minWidth" : "minHeight"]: L,
2946
+ ...R
2947
+ }
2948
+ }
2949
+ }), [Oe, pn] = Ie("wrapper", {
2950
+ ref: O,
2951
+ className: j.wrapper,
2952
+ elementType: hr,
2953
+ externalForwardedProps: g,
2954
+ ownerState: V
2955
+ }), [fn, hn] = Ie("wrapperInner", {
2956
+ className: j.wrapperInner,
2957
+ elementType: mr,
2958
+ externalForwardedProps: g,
2959
+ ownerState: V
2960
+ });
2961
+ return /* @__PURE__ */ v(C, {
2962
+ in: c,
2963
+ onEnter: ae,
2964
+ onEntered: ce,
2965
+ onEntering: ue,
2966
+ onExit: pe,
2967
+ onExited: K,
2968
+ onExiting: X,
2969
+ addEndListener: T,
2970
+ nodeRef: J,
2971
+ timeout: F === "auto" ? null : F,
2972
+ ...D,
2973
+ children: (z, {
2974
+ ownerState: ne,
2975
+ ...oe
2976
+ }) => {
2977
+ const le = {
2978
+ ...V,
2979
+ state: z
2980
+ };
2981
+ return /* @__PURE__ */ v(U, {
2982
+ ...ee,
2983
+ className: Q(ee.className, {
2984
+ entered: j.entered,
2985
+ exited: !c && L === "0px" && j.hidden
2986
+ }[z]),
2987
+ ownerState: le,
2988
+ ...oe,
2989
+ children: /* @__PURE__ */ v(Oe, {
2990
+ ...pn,
2991
+ ownerState: le,
2992
+ children: /* @__PURE__ */ v(fn, {
2993
+ ...hn,
2994
+ ownerState: le,
2995
+ children: s
2996
+ })
2997
+ })
2998
+ });
2999
+ }
3000
+ });
3001
+ });
3002
+ process.env.NODE_ENV !== "production" && (je.propTypes = {
3003
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
3004
+ // │ These PropTypes are generated from the TypeScript type definitions. │
3005
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
3006
+ // └─────────────────────────────────────────────────────────────────────┘
3007
+ /**
3008
+ * Add a custom transition end trigger. Called with the transitioning DOM
3009
+ * node and a done callback. Allows for more fine grained transition end
3010
+ * logic. Note: Timeouts are still used as a fallback if provided.
3011
+ */
3012
+ addEndListener: i.func,
3013
+ /**
3014
+ * The content node to be collapsed.
3015
+ */
3016
+ children: i.node,
3017
+ /**
3018
+ * Override or extend the styles applied to the component.
3019
+ */
3020
+ classes: i.object,
3021
+ /**
3022
+ * @ignore
3023
+ */
3024
+ className: i.string,
3025
+ /**
3026
+ * The width (horizontal) or height (vertical) of the container when collapsed.
3027
+ * @default '0px'
3028
+ */
3029
+ collapsedSize: i.oneOfType([i.number, i.string]),
3030
+ /**
3031
+ * The component used for the root node.
3032
+ * Either a string to use a HTML element or a component.
3033
+ */
3034
+ component: On,
3035
+ /**
3036
+ * The transition timing function.
3037
+ * You may specify a single easing or a object containing enter and exit values.
3038
+ */
3039
+ easing: i.oneOfType([i.shape({
3040
+ enter: i.string,
3041
+ exit: i.string
3042
+ }), i.string]),
3043
+ /**
3044
+ * If `true`, the component will transition in.
3045
+ */
3046
+ in: i.bool,
3047
+ /**
3048
+ * @ignore
3049
+ */
3050
+ onEnter: i.func,
3051
+ /**
3052
+ * @ignore
3053
+ */
3054
+ onEntered: i.func,
3055
+ /**
3056
+ * @ignore
3057
+ */
3058
+ onEntering: i.func,
3059
+ /**
3060
+ * @ignore
3061
+ */
3062
+ onExit: i.func,
3063
+ /**
3064
+ * @ignore
3065
+ */
3066
+ onExited: i.func,
3067
+ /**
3068
+ * @ignore
3069
+ */
3070
+ onExiting: i.func,
3071
+ /**
3072
+ * The transition orientation.
3073
+ * @default 'vertical'
3074
+ */
3075
+ orientation: i.oneOf(["horizontal", "vertical"]),
3076
+ /**
3077
+ * The props used for each slot inside.
3078
+ * @default {}
3079
+ */
3080
+ slotProps: i.shape({
3081
+ root: i.oneOfType([i.func, i.object]),
3082
+ wrapper: i.oneOfType([i.func, i.object]),
3083
+ wrapperInner: i.oneOfType([i.func, i.object])
3084
+ }),
3085
+ /**
3086
+ * The components used for each slot inside.
3087
+ * @default {}
3088
+ */
3089
+ slots: i.shape({
3090
+ root: i.elementType,
3091
+ wrapper: i.elementType,
3092
+ wrapperInner: i.elementType
3093
+ }),
3094
+ /**
3095
+ * @ignore
3096
+ */
3097
+ style: i.object,
3098
+ /**
3099
+ * The system prop that allows defining system overrides as well as additional CSS styles.
3100
+ */
3101
+ sx: i.oneOfType([i.arrayOf(i.oneOfType([i.func, i.object, i.bool])), i.func, i.object]),
3102
+ /**
3103
+ * The duration for the transition, in milliseconds.
3104
+ * You may specify a single timeout for all transitions, or individually with an object.
3105
+ *
3106
+ * Set to 'auto' to automatically calculate transition time based on height.
3107
+ * @default duration.standard
3108
+ */
3109
+ timeout: i.oneOfType([i.oneOf(["auto"]), i.number, i.shape({
3110
+ appear: i.number,
3111
+ enter: i.number,
3112
+ exit: i.number
3113
+ })])
3114
+ });
3115
+ je && (je.muiSupportAuto = !0);
3116
+ function Ir(t) {
3117
+ return Ce("PrivateSwitchBase", t);
3118
+ }
3119
+ ve("PrivateSwitchBase", ["root", "checked", "disabled", "input", "edgeStart", "edgeEnd"]);
3120
+ const gr = (t) => {
3121
+ const {
3122
+ classes: e,
3123
+ checked: n,
3124
+ disabled: o,
3125
+ edge: r
3126
+ } = t, s = {
3127
+ root: ["root", n && "checked", o && "disabled", r && `edge${xe(r)}`],
3128
+ input: ["input"]
3129
+ };
3130
+ return we(s, Ir, e);
3131
+ }, br = G(Mn, {
3132
+ name: "MuiSwitchBase"
3133
+ })({
3134
+ padding: 9,
3135
+ borderRadius: "50%",
3136
+ variants: [{
3137
+ props: {
3138
+ edge: "start",
3139
+ size: "small"
3140
+ },
3141
+ style: {
3142
+ marginLeft: -3
3143
+ }
3144
+ }, {
3145
+ props: ({
3146
+ edge: t,
3147
+ ownerState: e
3148
+ }) => t === "start" && e.size !== "small",
3149
+ style: {
3150
+ marginLeft: -12
3151
+ }
3152
+ }, {
3153
+ props: {
3154
+ edge: "end",
3155
+ size: "small"
3156
+ },
3157
+ style: {
3158
+ marginRight: -3
3159
+ }
3160
+ }, {
3161
+ props: ({
3162
+ edge: t,
3163
+ ownerState: e
3164
+ }) => t === "end" && e.size !== "small",
3165
+ style: {
3166
+ marginRight: -12
3167
+ }
3168
+ }]
3169
+ }), Sr = G("input", {
3170
+ name: "MuiSwitchBase",
3171
+ shouldForwardProp: Ht
3172
+ })({
3173
+ cursor: "inherit",
3174
+ position: "absolute",
3175
+ opacity: 0,
3176
+ width: "100%",
3177
+ height: "100%",
3178
+ top: 0,
3179
+ left: 0,
3180
+ margin: 0,
3181
+ padding: 0,
3182
+ zIndex: 1
3183
+ }), sn = /* @__PURE__ */ M.forwardRef(function(e, n) {
3184
+ const {
3185
+ autoFocus: o,
3186
+ checked: r,
3187
+ checkedIcon: s,
3188
+ defaultChecked: l,
3189
+ disabled: a,
3190
+ disableFocusRipple: h = !1,
3191
+ edge: d = !1,
3192
+ icon: c,
3193
+ id: p,
3194
+ inputProps: f,
3195
+ inputRef: u,
3196
+ name: m,
3197
+ onBlur: I,
3198
+ onChange: b,
3199
+ onFocus: x,
3200
+ readOnly: w,
3201
+ required: _ = !1,
3202
+ tabIndex: R,
3203
+ type: F,
3204
+ value: C,
3205
+ slots: D = {},
3206
+ slotProps: V = {},
3207
+ ...j
3208
+ } = e, [E, k] = zn({
3209
+ controlled: r,
3210
+ default: !!l,
3211
+ name: "SwitchBase",
3212
+ state: "checked"
3213
+ }), O = An(), A = (K) => {
3214
+ x && x(K), O && O.onFocus && O.onFocus(K);
3215
+ }, L = (K) => {
3216
+ I && I(K), O && O.onBlur && O.onBlur(K);
3217
+ }, $ = (K) => {
3218
+ if (K.nativeEvent.defaultPrevented || w)
3219
+ return;
3220
+ const X = K.target.checked;
3221
+ k(X), b && b(K, X);
3222
+ };
3223
+ let B = a;
3224
+ O && typeof B > "u" && (B = O.disabled);
3225
+ const J = F === "checkbox" || F === "radio", Z = {
3226
+ ...e,
3227
+ checked: E,
3228
+ disabled: B,
3229
+ disableFocusRipple: h,
3230
+ edge: d
3231
+ }, q = gr(Z), ie = {
3232
+ slots: D,
3233
+ slotProps: {
3234
+ input: f,
3235
+ ...V
3236
+ }
3237
+ }, [ae, ue] = Ie("root", {
3238
+ ref: n,
3239
+ elementType: br,
3240
+ className: q.root,
3241
+ shouldForwardComponentProp: !0,
3242
+ externalForwardedProps: {
3243
+ ...ie,
3244
+ component: "span",
3245
+ ...j
3246
+ },
3247
+ getSlotProps: (K) => ({
3248
+ ...K,
3249
+ onFocus: (X) => {
3250
+ K.onFocus?.(X), A(X);
3251
+ },
3252
+ onBlur: (X) => {
3253
+ K.onBlur?.(X), L(X);
3254
+ }
3255
+ }),
3256
+ ownerState: Z,
3257
+ additionalProps: {
3258
+ centerRipple: !0,
3259
+ focusRipple: !h,
3260
+ disabled: B,
3261
+ role: void 0,
3262
+ tabIndex: null
3263
+ }
3264
+ }), [ce, pe] = Ie("input", {
3265
+ ref: u,
3266
+ elementType: Sr,
3267
+ className: q.input,
3268
+ externalForwardedProps: ie,
3269
+ getSlotProps: (K) => ({
3270
+ ...K,
3271
+ onChange: (X) => {
3272
+ K.onChange?.(X), $(X);
3273
+ }
3274
+ }),
3275
+ ownerState: Z,
3276
+ additionalProps: {
3277
+ autoFocus: o,
3278
+ checked: r,
3279
+ defaultChecked: l,
3280
+ disabled: B,
3281
+ id: J ? p : void 0,
3282
+ name: m,
3283
+ readOnly: w,
3284
+ required: _,
3285
+ tabIndex: R,
3286
+ type: F,
3287
+ ...F === "checkbox" && C === void 0 ? {} : {
3288
+ value: C
3289
+ }
3290
+ }
3291
+ });
3292
+ return /* @__PURE__ */ Y(ae, {
3293
+ ...ue,
3294
+ children: [/* @__PURE__ */ v(ce, {
3295
+ ...pe
3296
+ }), E ? s : c]
3297
+ });
3298
+ });
3299
+ process.env.NODE_ENV !== "production" && (sn.propTypes = {
3300
+ /**
3301
+ * If `true`, the `input` element is focused during the first mount.
3302
+ */
3303
+ autoFocus: i.bool,
3304
+ /**
3305
+ * If `true`, the component is checked.
3306
+ */
3307
+ checked: i.bool,
3308
+ /**
3309
+ * The icon to display when the component is checked.
3310
+ */
3311
+ checkedIcon: i.node.isRequired,
3312
+ /**
3313
+ * Override or extend the styles applied to the component.
3314
+ */
3315
+ classes: i.object,
3316
+ /**
3317
+ * @ignore
3318
+ */
3319
+ className: i.string,
3320
+ /**
3321
+ * @ignore
3322
+ */
3323
+ defaultChecked: i.bool,
3324
+ /**
3325
+ * If `true`, the component is disabled.
3326
+ */
3327
+ disabled: i.bool,
3328
+ /**
3329
+ * If `true`, the keyboard focus ripple is disabled.
3330
+ * @default false
3331
+ */
3332
+ disableFocusRipple: i.bool,
3333
+ /**
3334
+ * If given, uses a negative margin to counteract the padding on one
3335
+ * side (this is often helpful for aligning the left or right
3336
+ * side of the icon with content above or below, without ruining the border
3337
+ * size and shape).
3338
+ * @default false
3339
+ */
3340
+ edge: i.oneOf(["end", "start", !1]),
3341
+ /**
3342
+ * The icon to display when the component is unchecked.
3343
+ */
3344
+ icon: i.node.isRequired,
3345
+ /**
3346
+ * The id of the `input` element.
3347
+ */
3348
+ id: i.string,
3349
+ /**
3350
+ * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
3351
+ */
3352
+ inputProps: i.object,
3353
+ /**
3354
+ * Pass a ref to the `input` element.
3355
+ */
3356
+ inputRef: Pn,
3357
+ /*
3358
+ * @ignore
3359
+ */
3360
+ name: i.string,
3361
+ /**
3362
+ * @ignore
3363
+ */
3364
+ onBlur: i.func,
3365
+ /**
3366
+ * Callback fired when the state is changed.
3367
+ *
3368
+ * @param {object} event The event source of the callback.
3369
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
3370
+ */
3371
+ onChange: i.func,
3372
+ /**
3373
+ * @ignore
3374
+ */
3375
+ onFocus: i.func,
3376
+ /**
3377
+ * It prevents the user from changing the value of the field
3378
+ * (not from interacting with the field).
3379
+ */
3380
+ readOnly: i.bool,
3381
+ /**
3382
+ * If `true`, the `input` element is required.
3383
+ */
3384
+ required: i.bool,
3385
+ /**
3386
+ * The props used for each slot inside.
3387
+ * @default {}
3388
+ */
3389
+ slotProps: i.shape({
3390
+ input: i.oneOfType([i.func, i.object]),
3391
+ root: i.oneOfType([i.func, i.object])
3392
+ }),
3393
+ /**
3394
+ * The components used for each slot inside.
3395
+ * @default {}
3396
+ */
3397
+ slots: i.shape({
3398
+ input: i.elementType,
3399
+ root: i.elementType
3400
+ }),
3401
+ /**
3402
+ * The system prop that allows defining system overrides as well as additional CSS styles.
3403
+ */
3404
+ sx: i.object,
3405
+ /**
3406
+ * @ignore
3407
+ */
3408
+ tabIndex: i.oneOfType([i.number, i.string]),
3409
+ /**
3410
+ * The input component prop `type`.
3411
+ */
3412
+ type: i.string.isRequired,
3413
+ /**
3414
+ * The value of the component.
3415
+ */
3416
+ value: i.any
3417
+ });
3418
+ const yr = ge(/* @__PURE__ */ v("path", {
3419
+ d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
3420
+ }), "CheckBoxOutlineBlank"), xr = ge(/* @__PURE__ */ v("path", {
3421
+ d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
3422
+ }), "CheckBox"), Er = ge(/* @__PURE__ */ v("path", {
3423
+ d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
3424
+ }), "IndeterminateCheckBox");
3425
+ function Cr(t) {
3426
+ return Ce("MuiCheckbox", t);
3427
+ }
3428
+ const Ye = ve("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]), vr = (t) => {
3429
+ const {
3430
+ classes: e,
3431
+ indeterminate: n,
3432
+ color: o,
3433
+ size: r
3434
+ } = t, s = {
3435
+ root: ["root", n && "indeterminate", `color${xe(o)}`, `size${xe(r)}`]
3436
+ }, l = we(s, Cr, e);
3437
+ return {
3438
+ ...e,
3439
+ // forward the disabled and checked classes to the SwitchBase
3440
+ ...l
3441
+ };
3442
+ }, wr = G(sn, {
3443
+ shouldForwardProp: (t) => Ht(t) || t === "classes",
3444
+ name: "MuiCheckbox",
3445
+ slot: "Root",
3446
+ overridesResolver: (t, e) => {
3447
+ const {
3448
+ ownerState: n
3449
+ } = t;
3450
+ return [e.root, n.indeterminate && e.indeterminate, e[`size${xe(n.size)}`], n.color !== "default" && e[`color${xe(n.color)}`]];
3451
+ }
3452
+ })(Ut(({
3453
+ theme: t
3454
+ }) => ({
3455
+ color: (t.vars || t).palette.text.secondary,
3456
+ variants: [{
3457
+ props: {
3458
+ color: "default",
3459
+ disableRipple: !1
3460
+ },
3461
+ style: {
3462
+ "&:hover": {
3463
+ backgroundColor: t.alpha((t.vars || t).palette.action.active, (t.vars || t).palette.action.hoverOpacity)
3464
+ }
3465
+ }
3466
+ }, ...Object.entries(t.palette).filter(vt()).map(([e]) => ({
3467
+ props: {
3468
+ color: e,
3469
+ disableRipple: !1
3470
+ },
3471
+ style: {
3472
+ "&:hover": {
3473
+ backgroundColor: t.alpha((t.vars || t).palette[e].main, (t.vars || t).palette.action.hoverOpacity)
3474
+ }
3475
+ }
3476
+ })), ...Object.entries(t.palette).filter(vt()).map(([e]) => ({
3477
+ props: {
3478
+ color: e
3479
+ },
3480
+ style: {
3481
+ [`&.${Ye.checked}, &.${Ye.indeterminate}`]: {
3482
+ color: (t.vars || t).palette[e].main
3483
+ },
3484
+ [`&.${Ye.disabled}`]: {
3485
+ color: (t.vars || t).palette.action.disabled
3486
+ }
3487
+ }
3488
+ })), {
3489
+ // Should be last to override other colors
3490
+ props: {
3491
+ disableRipple: !1
3492
+ },
3493
+ style: {
3494
+ // Reset on touch devices, it doesn't add specificity
3495
+ "&:hover": {
3496
+ "@media (hover: none)": {
3497
+ backgroundColor: "transparent"
3498
+ }
3499
+ }
3500
+ }
3501
+ }]
3502
+ }))), Tr = /* @__PURE__ */ v(xr, {}), kr = /* @__PURE__ */ v(yr, {}), Or = /* @__PURE__ */ v(Er, {}), ln = /* @__PURE__ */ M.forwardRef(function(e, n) {
3503
+ const o = Kt({
3504
+ props: e,
3505
+ name: "MuiCheckbox"
3506
+ }), {
3507
+ checkedIcon: r = Tr,
3508
+ color: s = "primary",
3509
+ icon: l = kr,
3510
+ indeterminate: a = !1,
3511
+ indeterminateIcon: h = Or,
3512
+ inputProps: d,
3513
+ size: c = "medium",
3514
+ disableRipple: p = !1,
3515
+ className: f,
3516
+ slots: u = {},
3517
+ slotProps: m = {},
3518
+ ...I
3519
+ } = o, b = a ? h : l, x = a ? h : r, w = {
3520
+ ...o,
3521
+ disableRipple: p,
3522
+ color: s,
3523
+ indeterminate: a,
3524
+ size: c
3525
+ }, _ = vr(w), R = m.input ?? d, [F, C] = Ie("root", {
3526
+ ref: n,
3527
+ elementType: wr,
3528
+ className: Q(_.root, f),
3529
+ shouldForwardComponentProp: !0,
3530
+ externalForwardedProps: {
3531
+ slots: u,
3532
+ slotProps: m,
3533
+ ...I
3534
+ },
3535
+ ownerState: w,
3536
+ additionalProps: {
3537
+ type: "checkbox",
3538
+ icon: /* @__PURE__ */ M.cloneElement(b, {
3539
+ fontSize: b.props.fontSize ?? c
3540
+ }),
3541
+ checkedIcon: /* @__PURE__ */ M.cloneElement(x, {
3542
+ fontSize: x.props.fontSize ?? c
3543
+ }),
3544
+ disableRipple: p,
3545
+ slots: u,
3546
+ slotProps: {
3547
+ input: Nn(typeof R == "function" ? R(w) : R, {
3548
+ "data-indeterminate": a
3549
+ })
3550
+ }
3551
+ }
3552
+ });
3553
+ return /* @__PURE__ */ v(F, {
3554
+ ...C,
3555
+ classes: _
3556
+ });
3557
+ });
3558
+ process.env.NODE_ENV !== "production" && (ln.propTypes = {
3559
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
3560
+ // │ These PropTypes are generated from the TypeScript type definitions. │
3561
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
3562
+ // └─────────────────────────────────────────────────────────────────────┘
3563
+ /**
3564
+ * If `true`, the component is checked.
3565
+ */
3566
+ checked: i.bool,
3567
+ /**
3568
+ * The icon to display when the component is checked.
3569
+ * @default <CheckBoxIcon />
3570
+ */
3571
+ checkedIcon: i.node,
3572
+ /**
3573
+ * Override or extend the styles applied to the component.
3574
+ */
3575
+ classes: i.object,
3576
+ /**
3577
+ * @ignore
3578
+ */
3579
+ className: i.string,
3580
+ /**
3581
+ * The color of the component.
3582
+ * It supports both default and custom theme colors, which can be added as shown in the
3583
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
3584
+ * @default 'primary'
3585
+ */
3586
+ color: i.oneOfType([i.oneOf(["default", "primary", "secondary", "error", "info", "success", "warning"]), i.string]),
3587
+ /**
3588
+ * The default checked state. Use when the component is not controlled.
3589
+ */
3590
+ defaultChecked: i.bool,
3591
+ /**
3592
+ * If `true`, the component is disabled.
3593
+ * @default false
3594
+ */
3595
+ disabled: i.bool,
3596
+ /**
3597
+ * If `true`, the ripple effect is disabled.
3598
+ * @default false
3599
+ */
3600
+ disableRipple: i.bool,
3601
+ /**
3602
+ * The icon to display when the component is unchecked.
3603
+ * @default <CheckBoxOutlineBlankIcon />
3604
+ */
3605
+ icon: i.node,
3606
+ /**
3607
+ * The id of the `input` element.
3608
+ */
3609
+ id: i.string,
3610
+ /**
3611
+ * If `true`, the component appears indeterminate.
3612
+ * This does not set the native input element to indeterminate due
3613
+ * to inconsistent behavior across browsers.
3614
+ * However, we set a `data-indeterminate` attribute on the `input`.
3615
+ * @default false
3616
+ */
3617
+ indeterminate: i.bool,
3618
+ /**
3619
+ * The icon to display when the component is indeterminate.
3620
+ * @default <IndeterminateCheckBoxIcon />
3621
+ */
3622
+ indeterminateIcon: i.node,
3623
+ /**
3624
+ * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
3625
+ * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
3626
+ */
3627
+ inputProps: i.object,
3628
+ /**
3629
+ * Callback fired when the state is changed.
3630
+ *
3631
+ * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
3632
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
3633
+ */
3634
+ onChange: i.func,
3635
+ /**
3636
+ * If `true`, the `input` element is required.
3637
+ * @default false
3638
+ */
3639
+ required: i.bool,
3640
+ /**
3641
+ * The size of the component.
3642
+ * `small` is equivalent to the dense checkbox styling.
3643
+ * @default 'medium'
3644
+ */
3645
+ size: i.oneOfType([i.oneOf(["medium", "small"]), i.string]),
3646
+ /**
3647
+ * The props used for each slot inside.
3648
+ * @default {}
3649
+ */
3650
+ slotProps: i.shape({
3651
+ input: i.oneOfType([i.func, i.object]),
3652
+ root: i.oneOfType([i.func, i.object])
3653
+ }),
3654
+ /**
3655
+ * The components used for each slot inside.
3656
+ * @default {}
3657
+ */
3658
+ slots: i.shape({
3659
+ input: i.elementType,
3660
+ root: i.elementType
3661
+ }),
3662
+ /**
3663
+ * The system prop that allows defining system overrides as well as additional CSS styles.
3664
+ */
3665
+ sx: i.oneOfType([i.arrayOf(i.oneOfType([i.func, i.object, i.bool])), i.func, i.object]),
3666
+ /**
3667
+ * The value of the component. The DOM API casts this to a string.
3668
+ * The browser uses "on" as the default value.
3669
+ */
3670
+ value: i.any
3671
+ });
3672
+ const Mr = (t, e, n) => typeof n == "function" ? n(t, e) : n, Pr = (t) => {
3673
+ const {
3674
+ runItemPlugins: e,
3675
+ publicAPI: n,
3676
+ store: o
3677
+ } = be(), r = M.useContext(Ee), s = W(o, Mr, t.itemId, r), {
3678
+ id: l,
3679
+ itemId: a,
3680
+ label: h,
3681
+ children: d,
3682
+ rootRef: c
3683
+ } = t, {
3684
+ rootRef: p,
3685
+ contentRef: f,
3686
+ propsEnhancers: u
3687
+ } = e(t), {
3688
+ interactions: m,
3689
+ status: I
3690
+ } = or({
3691
+ itemId: a,
3692
+ children: d
3693
+ }), b = M.useRef(null), x = M.useRef(null), w = Ne(c, p, b), _ = Ne(f, x), R = M.useRef(null), F = W(o, N.isCheckboxSelectionEnabled), C = W(o, ke.treeItemIdAttribute, a, l), D = W(o, de.isItemTheDefaultFocusableItem, a), V = {
3694
+ rootRefObject: b,
3695
+ contentRefObject: x,
3696
+ interactions: m
3697
+ }, j = (T) => (g) => {
3698
+ T.onFocus?.(g), !g.defaultMuiPrevented && !I.focused && y.canItemBeFocused(o.state, a) && g.currentTarget === g.target && o.focus.focusItem(g, a);
3699
+ }, E = (T) => (g) => {
3700
+ if (T.onBlur?.(g), g.defaultMuiPrevented)
3701
+ return;
3702
+ const U = o.items.getItemDOMElement(a);
3703
+ I.editing || // we can exit the editing state by clicking outside the input (within the Tree Item) or by pressing Enter or Escape -> we don't want to remove the focused item from the state in these cases
3704
+ // we can also exit the editing state by clicking on the root itself -> want to remove the focused item from the state in this case
3705
+ g.relatedTarget && ot(g.relatedTarget, U) && (g.target && g.target?.dataset?.element === "labelInput" && ot(g.target, U) || g.relatedTarget?.dataset?.element === "labelInput") || o.focus.removeFocusedItem();
3706
+ }, k = (T) => (g) => {
3707
+ T.onKeyDown?.(g), !(g.defaultMuiPrevented || g.target?.dataset?.element === "labelInput") && o.keyboardNavigation.handleItemKeyDown(g, a);
3708
+ }, O = (T) => (g) => {
3709
+ T.onDoubleClick?.(g), !g.defaultMuiPrevented && m.toggleItemEditing();
3710
+ }, A = (T) => (g) => {
3711
+ T.onClick?.(g), o.items.handleItemClick(g, a), !(g.defaultMuiPrevented || R.current?.contains(g.target)) && (H.triggerSlot(o.state) === "content" && m.handleExpansion(g), F || m.handleSelection(g));
3712
+ }, L = (T) => (g) => {
3713
+ T.onMouseDown?.(g), !g.defaultMuiPrevented && (g.shiftKey || g.ctrlKey || g.metaKey || I.disabled) && g.preventDefault();
3714
+ }, $ = (T) => (g) => {
3715
+ T.onClick?.(g), !g.defaultMuiPrevented && H.triggerSlot(o.state) === "iconContainer" && m.handleExpansion(g);
3716
+ };
3717
+ return {
3718
+ getContextProviderProps: () => ({
3719
+ itemId: a,
3720
+ id: l
3721
+ }),
3722
+ getRootProps: (T = {}) => {
3723
+ const g = S({}, re(t), re(T)), U = S({}, g, {
3724
+ ref: w,
3725
+ role: "treeitem",
3726
+ tabIndex: D ? 0 : -1,
3727
+ id: C,
3728
+ "aria-expanded": I.expandable ? I.expanded : void 0,
3729
+ "aria-disabled": I.disabled || void 0
3730
+ }, T, {
3731
+ style: S({}, T.style ?? {}, {
3732
+ "--TreeView-itemDepth": s
3733
+ }),
3734
+ onFocus: j(g),
3735
+ onBlur: E(g),
3736
+ onKeyDown: k(g)
3737
+ }), ee = u.root?.(S({}, V, {
3738
+ externalEventHandlers: g
3739
+ })) ?? {};
3740
+ return S({}, U, ee);
3741
+ },
3742
+ getContentProps: (T = {}) => {
3743
+ const g = re(T), U = S({}, g, T, {
3744
+ ref: _,
3745
+ onClick: A(g),
3746
+ onMouseDown: L(g),
3747
+ status: I
3748
+ });
3749
+ ["expanded", "selected", "focused", "disabled", "editing", "editable"].forEach((Oe) => {
3750
+ I[Oe] && (U[`data-${Oe}`] = "");
3751
+ });
3752
+ const ee = u.content?.(S({}, V, {
3753
+ externalEventHandlers: g
3754
+ })) ?? {};
3755
+ return S({}, U, ee);
3756
+ },
3757
+ getGroupTransitionProps: (T = {}) => {
3758
+ const g = re(T);
3759
+ return S({}, g, {
3760
+ unmountOnExit: !0,
3761
+ component: "ul",
3762
+ role: "group",
3763
+ in: I.expanded,
3764
+ children: d
3765
+ }, T);
3766
+ },
3767
+ getIconContainerProps: (T = {}) => {
3768
+ const g = re(T);
3769
+ return S({}, g, T, {
3770
+ onClick: $(g)
3771
+ });
3772
+ },
3773
+ getCheckboxProps: (T = {}) => {
3774
+ const g = re(T), U = S({}, g, {
3775
+ ref: R,
3776
+ "aria-hidden": !0
3777
+ }, T), ee = u.checkbox?.(S({}, V, {
3778
+ externalEventHandlers: g
3779
+ })) ?? {};
3780
+ return S({}, U, ee);
3781
+ },
3782
+ getLabelProps: (T = {}) => {
3783
+ const g = S({}, re(T)), U = S({}, g, {
3784
+ children: h
3785
+ }, T, {
3786
+ onDoubleClick: O(g)
3787
+ }), ee = u.label?.(S({}, V, {
3788
+ externalEventHandlers: g
3789
+ })) ?? {};
3790
+ return S({}, ee, U);
3791
+ },
3792
+ getLabelInputProps: (T = {}) => {
3793
+ const g = re(T), U = u.labelInput?.(S({}, V, {
3794
+ externalEventHandlers: g
3795
+ })) ?? {};
3796
+ return S({}, T, U);
3797
+ },
3798
+ getDragAndDropOverlayProps: (T = {}) => {
3799
+ const g = re(T), U = u.dragAndDropOverlay?.(S({}, V, {
3800
+ externalEventHandlers: g
3801
+ })) ?? {};
3802
+ return S({}, T, U);
3803
+ },
3804
+ getErrorContainerProps: (T = {}) => {
3805
+ const g = re(T);
3806
+ return S({}, g, T);
3807
+ },
3808
+ getLoadingContainerProps: (T = {}) => {
3809
+ const g = re(T);
3810
+ return S({
3811
+ size: "12px",
3812
+ thickness: 6
3813
+ }, g, T);
3814
+ },
3815
+ rootRef: w,
3816
+ status: I,
3817
+ publicAPI: n
3818
+ };
3819
+ };
3820
+ function Rr(t) {
3821
+ return Ce("MuiTreeItem", t);
3822
+ }
3823
+ ve("MuiTreeItem", [
3824
+ "root",
3825
+ "content",
3826
+ "groupTransition",
3827
+ "iconContainer",
3828
+ "label",
3829
+ "checkbox",
3830
+ "labelInput",
3831
+ "dragAndDropOverlay",
3832
+ "errorIcon",
3833
+ "loadingIcon",
3834
+ // State classes, will be replaced by data-attrs in the next major
3835
+ "expanded",
3836
+ "selected",
3837
+ "focused",
3838
+ "disabled",
3839
+ "editable",
3840
+ "editing"
3841
+ ]);
3842
+ const Lr = ge(/* @__PURE__ */ v("path", {
3843
+ d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
3844
+ }), "TreeViewExpandIcon"), Dr = ge(/* @__PURE__ */ v("path", {
3845
+ d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
3846
+ }), "TreeViewCollapseIcon"), _r = ["ownerState"];
3847
+ function Ze(t, e, n) {
3848
+ return t !== void 0 ? t : e !== void 0 ? e : n;
3849
+ }
3850
+ function an(t) {
3851
+ const {
3852
+ slots: e,
3853
+ slotProps: n,
3854
+ status: o
3855
+ } = t, {
3856
+ slots: r,
3857
+ slotProps: s
3858
+ } = Gt(), l = {
3859
+ collapseIcon: Ze(e?.collapseIcon, r.collapseIcon, Dr),
3860
+ expandIcon: Ze(e?.expandIcon, r.expandIcon, Lr),
3861
+ endIcon: Ze(e?.endIcon, r.endIcon),
3862
+ icon: e?.icon
3863
+ };
3864
+ let a;
3865
+ l?.icon ? a = "icon" : o.expandable ? o.expanded ? a = "collapseIcon" : a = "expandIcon" : a = "endIcon";
3866
+ const h = l[a], d = te({
3867
+ elementType: h,
3868
+ externalSlotProps: (p) => S({}, Ct(s[a], p), Ct(n?.[a], p)),
3869
+ // TODO: Add proper ownerState
3870
+ ownerState: {}
3871
+ }), c = Be(d, _r);
3872
+ return h ? /* @__PURE__ */ v(h, S({}, c)) : null;
3873
+ }
3874
+ process.env.NODE_ENV !== "production" && (an.propTypes = {
3875
+ // ----------------------------- Warning --------------------------------
3876
+ // | These PropTypes are generated from the TypeScript type definitions |
3877
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
3878
+ // ----------------------------------------------------------------------
3879
+ /**
3880
+ * The props used for each component slot.
3881
+ * @default {}
3882
+ */
3883
+ slotProps: i.object,
3884
+ /**
3885
+ * Overridable component slots.
3886
+ * @default {}
3887
+ */
3888
+ slots: i.object,
3889
+ status: i.shape({
3890
+ disabled: i.bool.isRequired,
3891
+ editable: i.bool.isRequired,
3892
+ editing: i.bool.isRequired,
3893
+ error: i.bool.isRequired,
3894
+ expandable: i.bool.isRequired,
3895
+ expanded: i.bool.isRequired,
3896
+ focused: i.bool.isRequired,
3897
+ loading: i.bool.isRequired,
3898
+ selected: i.bool.isRequired
3899
+ }).isRequired
3900
+ });
3901
+ const Ar = G("div", {
3902
+ name: "MuiTreeItemDragAndDropOverlay",
3903
+ slot: "Root",
3904
+ shouldForwardProp: (t) => st(t) && t !== "action"
3905
+ })(({
3906
+ theme: t
3907
+ }) => ({
3908
+ position: "absolute",
3909
+ left: 0,
3910
+ display: "flex",
3911
+ top: 0,
3912
+ bottom: 0,
3913
+ right: 0,
3914
+ pointerEvents: "none",
3915
+ variants: [{
3916
+ props: {
3917
+ action: "make-child"
3918
+ },
3919
+ style: {
3920
+ marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
3921
+ borderRadius: t.shape.borderRadius,
3922
+ backgroundColor: t.vars ? `rgba(${t.vars.palette.primary.darkChannel} / ${t.vars.palette.action.focusOpacity})` : Se(t.palette.primary.dark, t.palette.action.focusOpacity)
3923
+ }
3924
+ }, {
3925
+ props: {
3926
+ action: "reorder-above"
3927
+ },
3928
+ style: {
3929
+ marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
3930
+ borderTop: `1px solid ${(t.vars || t).palette.action.active}`
3931
+ }
3932
+ }, {
3933
+ props: {
3934
+ action: "reorder-below"
3935
+ },
3936
+ style: {
3937
+ marginLeft: "calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",
3938
+ borderBottom: `1px solid ${(t.vars || t).palette.action.active}`
3939
+ }
3940
+ }, {
3941
+ props: {
3942
+ action: "move-to-parent"
3943
+ },
3944
+ style: {
3945
+ marginLeft: "calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",
3946
+ borderBottom: `1px solid ${(t.vars || t).palette.action.active}`
3947
+ }
3948
+ }]
3949
+ }));
3950
+ function cn(t) {
3951
+ return t.action == null ? null : /* @__PURE__ */ v(Ar, S({}, t));
3952
+ }
3953
+ process.env.NODE_ENV !== "production" && (cn.propTypes = {
3954
+ // ----------------------------- Warning --------------------------------
3955
+ // | These PropTypes are generated from the TypeScript type definitions |
3956
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
3957
+ // ----------------------------------------------------------------------
3958
+ action: i.oneOf(["make-child", "move-to-parent", "reorder-above", "reorder-below"]),
3959
+ style: i.object
3960
+ });
3961
+ function dn(t) {
3962
+ const {
3963
+ children: e,
3964
+ itemId: n,
3965
+ id: o
3966
+ } = t, {
3967
+ wrapItem: r,
3968
+ store: s
3969
+ } = be(), l = W(s, ke.treeItemIdAttribute, n, o);
3970
+ return /* @__PURE__ */ v(M.Fragment, {
3971
+ children: r({
3972
+ children: e,
3973
+ itemId: n,
3974
+ store: s,
3975
+ idAttribute: l
3976
+ })
3977
+ });
3978
+ }
3979
+ process.env.NODE_ENV !== "production" && (dn.propTypes = {
3980
+ // ----------------------------- Warning --------------------------------
3981
+ // | These PropTypes are generated from the TypeScript type definitions |
3982
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
3983
+ // ----------------------------------------------------------------------
3984
+ children: i.node,
3985
+ id: i.string,
3986
+ itemId: i.string.isRequired
3987
+ });
3988
+ const Nr = G("input", {
3989
+ name: "MuiTreeItem",
3990
+ slot: "LabelInput"
3991
+ })(({
3992
+ theme: t
3993
+ }) => S({}, t.typography.body1, {
3994
+ width: "100%",
3995
+ backgroundColor: (t.vars || t).palette.background.paper,
3996
+ borderRadius: t.shape.borderRadius,
3997
+ border: "none",
3998
+ padding: "0 2px",
3999
+ boxSizing: "border-box",
4000
+ "&:focus": {
4001
+ outline: `1px solid ${(t.vars || t).palette.primary.main}`
4002
+ }
4003
+ })), Fr = ["visible"], Vr = ["id", "itemId", "label", "disabled", "disableSelection", "children", "slots", "slotProps", "classes"], zr = qt(), jr = G("li", {
4004
+ name: "MuiTreeItem",
4005
+ slot: "Root"
4006
+ })({
4007
+ listStyle: "none",
4008
+ margin: 0,
4009
+ padding: 0,
4010
+ outline: 0
4011
+ }), $r = G("div", {
4012
+ name: "MuiTreeItem",
4013
+ slot: "Content",
4014
+ shouldForwardProp: (t) => st(t) && t !== "status"
4015
+ })(({
4016
+ theme: t
4017
+ }) => ({
4018
+ padding: t.spacing(0.5, 1),
4019
+ paddingLeft: `calc(${t.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,
4020
+ borderRadius: t.shape.borderRadius,
4021
+ width: "100%",
4022
+ boxSizing: "border-box",
4023
+ // prevent width + padding to overflow
4024
+ position: "relative",
4025
+ display: "flex",
4026
+ alignItems: "center",
4027
+ gap: t.spacing(1),
4028
+ cursor: "pointer",
4029
+ WebkitTapHighlightColor: "transparent",
4030
+ "&:hover": {
4031
+ backgroundColor: (t.vars || t).palette.action.hover,
4032
+ // Reset on touch devices, it doesn't add specificity
4033
+ "@media (hover: none)": {
4034
+ backgroundColor: "transparent"
4035
+ }
4036
+ },
4037
+ "&[data-disabled]": {
4038
+ opacity: (t.vars || t).palette.action.disabledOpacity,
4039
+ backgroundColor: "transparent",
4040
+ cursor: "auto"
4041
+ },
4042
+ "&[data-focused]": {
4043
+ backgroundColor: (t.vars || t).palette.action.focus
4044
+ },
4045
+ "&[data-selected]": {
4046
+ backgroundColor: t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})` : Se(t.palette.primary.main, t.palette.action.selectedOpacity),
4047
+ "&:hover": {
4048
+ backgroundColor: t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))` : Se(t.palette.primary.main, t.palette.action.selectedOpacity + t.palette.action.hoverOpacity),
4049
+ // Reset on touch devices, it doesn't add specificity
4050
+ "@media (hover: none)": {
4051
+ backgroundColor: t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${t.vars.palette.action.selectedOpacity})` : Se(t.palette.primary.main, t.palette.action.selectedOpacity)
4052
+ }
4053
+ }
4054
+ },
4055
+ "&[data-selected][data-focused]": {
4056
+ backgroundColor: t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.focusOpacity}))` : Se(t.palette.primary.main, t.palette.action.selectedOpacity + t.palette.action.focusOpacity)
4057
+ }
4058
+ })), Br = G("div", {
4059
+ name: "MuiTreeItem",
4060
+ slot: "Label",
4061
+ shouldForwardProp: (t) => st(t) && t !== "editable"
4062
+ })(({
4063
+ theme: t
4064
+ }) => S({
4065
+ width: "100%",
4066
+ boxSizing: "border-box",
4067
+ // prevent width + padding to overflow
4068
+ // fixes overflow - see https://github.com/mui/material-ui/issues/27372
4069
+ minWidth: 0,
4070
+ position: "relative",
4071
+ overflow: "hidden"
4072
+ }, t.typography.body1, {
4073
+ variants: [{
4074
+ props: ({
4075
+ editable: e
4076
+ }) => e,
4077
+ style: {
4078
+ paddingLeft: "2px"
4079
+ }
4080
+ }]
4081
+ })), Wr = G("div", {
4082
+ name: "MuiTreeItem",
4083
+ slot: "IconContainer"
4084
+ })({
4085
+ width: 16,
4086
+ display: "flex",
4087
+ flexShrink: 0,
4088
+ justifyContent: "center",
4089
+ position: "relative",
4090
+ cursor: "inherit",
4091
+ "& svg": {
4092
+ fontSize: 18
4093
+ }
4094
+ }), Kr = G(je, {
4095
+ name: "MuiTreeItem",
4096
+ slot: "GroupTransition",
4097
+ overridesResolver: (t, e) => e.groupTransition
4098
+ })({
4099
+ margin: 0,
4100
+ padding: 0
4101
+ }), Ur = G("div", {
4102
+ name: "MuiTreeItem",
4103
+ slot: "ErrorIcon"
4104
+ })({
4105
+ position: "absolute",
4106
+ right: -3,
4107
+ width: 7,
4108
+ height: 7,
4109
+ borderRadius: "50%",
4110
+ backgroundColor: "red"
4111
+ }), Hr = G(jn, {
4112
+ name: "MuiTreeItem",
4113
+ slot: "LoadingIcon"
4114
+ })({
4115
+ color: "text.primary"
4116
+ }), un = G(/* @__PURE__ */ M.forwardRef((t, e) => {
4117
+ const {
4118
+ visible: n
4119
+ } = t, o = Be(t, Fr);
4120
+ return n ? /* @__PURE__ */ v(ln, S({}, o, {
4121
+ ref: e
4122
+ })) : null;
4123
+ }), {
4124
+ name: "MuiTreeItem",
4125
+ slot: "Checkbox"
4126
+ })({
4127
+ padding: 0
4128
+ });
4129
+ process.env.NODE_ENV !== "production" && (un.displayName = "TreeItemCheckbox");
4130
+ const qr = (t) => {
4131
+ const {
4132
+ classes: e
4133
+ } = Gt(), n = S({}, t, {
4134
+ root: Q(t?.root, e.root),
4135
+ content: Q(t?.content, e.itemContent),
4136
+ iconContainer: Q(t?.iconContainer, e.itemIconContainer),
4137
+ checkbox: Q(t?.checkbox, e.itemCheckbox),
4138
+ label: Q(t?.label, e.itemLabel),
4139
+ groupTransition: Q(t?.groupTransition, e.itemGroupTransition),
4140
+ labelInput: Q(t?.labelInput, e.itemLabelInput),
4141
+ dragAndDropOverlay: Q(t?.dragAndDropOverlay, e.itemDragAndDropOverlay),
4142
+ errorIcon: Q(t?.errorIcon, e.itemErrorIcon),
4143
+ loadingIcon: Q(t?.loadingIcon, e.itemLoadingIcon)
4144
+ });
4145
+ return we({
4146
+ root: ["root"],
4147
+ content: ["content"],
4148
+ iconContainer: ["iconContainer"],
4149
+ checkbox: ["checkbox"],
4150
+ label: ["label"],
4151
+ groupTransition: ["groupTransition"],
4152
+ labelInput: ["labelInput"],
4153
+ dragAndDropOverlay: ["dragAndDropOverlay"],
4154
+ errorIcon: ["errorIcon"],
4155
+ loadingIcon: ["loadingIcon"],
4156
+ expanded: ["expanded"],
4157
+ editing: ["editing"],
4158
+ editable: ["editable"],
4159
+ selected: ["selected"],
4160
+ focused: ["focused"],
4161
+ disabled: ["disabled"]
4162
+ }, Rr, n);
4163
+ }, mt = /* @__PURE__ */ M.forwardRef(function(e, n) {
4164
+ const o = zr({
4165
+ props: e,
4166
+ name: "MuiTreeItem"
4167
+ }), {
4168
+ id: r,
4169
+ itemId: s,
4170
+ label: l,
4171
+ disabled: a,
4172
+ disableSelection: h,
4173
+ children: d,
4174
+ slots: c = {},
4175
+ slotProps: p = {},
4176
+ classes: f
4177
+ } = o, u = Be(o, Vr), {
4178
+ getContextProviderProps: m,
4179
+ getRootProps: I,
4180
+ getContentProps: b,
4181
+ getIconContainerProps: x,
4182
+ getCheckboxProps: w,
4183
+ getLabelProps: _,
4184
+ getGroupTransitionProps: R,
4185
+ getLabelInputProps: F,
4186
+ getDragAndDropOverlayProps: C,
4187
+ getErrorContainerProps: D,
4188
+ getLoadingContainerProps: V,
4189
+ status: j
4190
+ } = Pr({
4191
+ id: r,
4192
+ itemId: s,
4193
+ children: d,
4194
+ label: l,
4195
+ disabled: a,
4196
+ disableSelection: h
4197
+ }), E = qr(f), k = c.root ?? jr, O = te({
4198
+ elementType: k,
4199
+ getSlotProps: I,
4200
+ externalForwardedProps: u,
4201
+ externalSlotProps: p.root,
4202
+ additionalProps: {
4203
+ ref: n
4204
+ },
4205
+ ownerState: {},
4206
+ className: E.root
4207
+ }), A = c.content ?? $r, L = te({
4208
+ elementType: A,
4209
+ getSlotProps: b,
4210
+ externalSlotProps: p.content,
4211
+ ownerState: {},
4212
+ className: Q(E.content, j.expanded && E.expanded, j.selected && E.selected, j.focused && E.focused, j.disabled && E.disabled, j.editing && E.editing, j.editable && E.editable)
4213
+ }), $ = c.iconContainer ?? Wr, B = te({
4214
+ elementType: $,
4215
+ getSlotProps: x,
4216
+ externalSlotProps: p.iconContainer,
4217
+ ownerState: {},
4218
+ className: E.iconContainer
4219
+ }), J = c.label ?? Br, Z = te({
4220
+ elementType: J,
4221
+ getSlotProps: _,
4222
+ externalSlotProps: p.label,
4223
+ ownerState: {},
4224
+ className: E.label
4225
+ }), q = c.checkbox ?? un, ie = te({
4226
+ elementType: q,
4227
+ getSlotProps: w,
4228
+ externalSlotProps: p.checkbox,
4229
+ ownerState: {},
4230
+ className: E.checkbox
4231
+ }), ae = c.groupTransition ?? void 0, ue = te({
4232
+ elementType: ae,
4233
+ getSlotProps: R,
4234
+ externalSlotProps: p.groupTransition,
4235
+ ownerState: {},
4236
+ className: E.groupTransition
4237
+ }), ce = c.labelInput ?? Nr, pe = te({
4238
+ elementType: ce,
4239
+ getSlotProps: F,
4240
+ externalSlotProps: p.labelInput,
4241
+ ownerState: {},
4242
+ className: E.labelInput
4243
+ }), K = c.dragAndDropOverlay ?? cn, X = te({
4244
+ elementType: K,
4245
+ getSlotProps: C,
4246
+ externalSlotProps: p.dragAndDropOverlay,
4247
+ ownerState: {},
4248
+ className: E.dragAndDropOverlay
4249
+ }), T = c.errorIcon ?? Ur, g = te({
4250
+ elementType: T,
4251
+ getSlotProps: D,
4252
+ externalSlotProps: p.errorIcon,
4253
+ ownerState: {},
4254
+ className: E.errorIcon
4255
+ }), U = c.loadingIcon ?? Hr, ee = te({
4256
+ elementType: U,
4257
+ getSlotProps: V,
4258
+ externalSlotProps: p.loadingIcon,
4259
+ ownerState: {},
4260
+ className: E.loadingIcon
4261
+ });
4262
+ return /* @__PURE__ */ v(dn, S({}, m(), {
4263
+ children: /* @__PURE__ */ Y(k, S({}, O, {
4264
+ children: [/* @__PURE__ */ Y(A, S({}, L, {
4265
+ children: [/* @__PURE__ */ Y($, S({}, B, {
4266
+ children: [j.error && /* @__PURE__ */ v(T, S({}, g)), j.loading ? /* @__PURE__ */ v(U, S({}, ee)) : /* @__PURE__ */ v(an, {
4267
+ status: j,
4268
+ slots: c,
4269
+ slotProps: p
4270
+ })]
4271
+ })), /* @__PURE__ */ v(q, S({}, ie)), j.editing ? /* @__PURE__ */ v(ce, S({}, pe)) : /* @__PURE__ */ v(J, S({}, Z)), /* @__PURE__ */ v(K, S({}, X))]
4272
+ })), d && /* @__PURE__ */ v(Kr, S({
4273
+ as: ae
4274
+ }, ue))]
4275
+ }))
4276
+ }));
4277
+ });
4278
+ process.env.NODE_ENV !== "production" && (mt.displayName = "TreeItem");
4279
+ process.env.NODE_ENV !== "production" && (mt.propTypes = {
4280
+ // ----------------------------- Warning --------------------------------
4281
+ // | These PropTypes are generated from the TypeScript type definitions |
4282
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
4283
+ // ----------------------------------------------------------------------
4284
+ /**
4285
+ * The content of the component.
4286
+ */
4287
+ children: i.any,
4288
+ /**
4289
+ * Override or extend the styles applied to the component.
4290
+ */
4291
+ classes: i.object,
4292
+ className: i.string,
4293
+ /**
4294
+ * If `true`, the item is disabled.
4295
+ * @default false
4296
+ */
4297
+ disabled: i.bool,
4298
+ /**
4299
+ * If `true`, the item cannot be selected.
4300
+ * @default false
4301
+ */
4302
+ disableSelection: i.bool,
4303
+ /**
4304
+ * The id attribute of the item. If not provided, it will be generated.
4305
+ */
4306
+ id: i.string,
4307
+ /**
4308
+ * The id of the item.
4309
+ * Must be unique.
4310
+ */
4311
+ itemId: i.string.isRequired,
4312
+ /**
4313
+ * The label of the item.
4314
+ */
4315
+ label: i.node,
4316
+ /**
4317
+ * Callback fired when the item root is blurred.
4318
+ */
4319
+ onBlur: i.func,
4320
+ /**
4321
+ * This prop isn't supported.
4322
+ * Use the `onItemFocus` callback on the tree if you need to monitor an item's focus.
4323
+ */
4324
+ onFocus: Fn,
4325
+ /**
4326
+ * Callback fired when a key is pressed on the keyboard and the tree is in focus.
4327
+ */
4328
+ onKeyDown: i.func,
4329
+ /**
4330
+ * The props used for each component slot.
4331
+ * @default {}
4332
+ */
4333
+ slotProps: i.object,
4334
+ /**
4335
+ * Overridable component slots.
4336
+ * @default {}
4337
+ */
4338
+ slots: i.object,
4339
+ /**
4340
+ * The system prop that allows defining system overrides as well as additional CSS styles.
4341
+ */
4342
+ sx: i.oneOfType([i.arrayOf(i.oneOfType([i.func, i.object, i.bool])), i.func, i.object])
4343
+ });
4344
+ const he = (t, e) => {
4345
+ for (const n of t) {
4346
+ if (n.value === e) return n;
4347
+ if (n.children) {
4348
+ const o = he(n.children, e);
4349
+ if (o) return o;
4350
+ }
4351
+ }
4352
+ };
4353
+ function is({
4354
+ label: t,
4355
+ data: e,
4356
+ handleChange: n,
4357
+ fullWidth: o = !1,
4358
+ values: r = [],
4359
+ disabled: s = !1,
4360
+ isRtl: l = !1,
4361
+ width: a = 300,
4362
+ placeholder: h = "Search...",
4363
+ maxHeight: d = 300
4364
+ }) {
4365
+ const [c, p] = We(""), [f, u] = We(!1), [m, I] = We(5), b = gt(null), x = gt(null), w = Ke(() => {
4366
+ if (!e || r.length === 0) return [];
4367
+ const E = new Set(r), k = [], O = (A) => {
4368
+ for (const L of A)
4369
+ L.children && L.children.length > 0 ? O(L.children) : E.has(L.value) && k.push(L.label);
4370
+ };
4371
+ return O(e), k;
4372
+ }, [e, r]);
4373
+ bt(() => {
4374
+ const E = (k) => {
4375
+ b.current && !b.current.contains(k.target) && u(!1);
4376
+ };
4377
+ return f && document.addEventListener("mousedown", E), () => {
4378
+ document.removeEventListener("mousedown", E);
4379
+ };
4380
+ }, [f]), bt(() => {
4381
+ const E = () => {
4382
+ if (!x.current || w.length === 0) {
4383
+ I(5);
4384
+ return;
4385
+ }
4386
+ const O = x.current.offsetWidth, A = 60, L = 110, $ = 45, B = 4, J = O - $ - B, Z = (A + L) / 2, q = Math.max(1, Math.floor(J / (Z + B)));
4387
+ I(Math.min(q, w.length));
4388
+ };
4389
+ E();
4390
+ const k = new ResizeObserver(E);
4391
+ return x.current && k.observe(x.current), () => k.disconnect();
4392
+ }, [w.length]);
4393
+ const _ = Ke(() => {
4394
+ if (!e) return [];
4395
+ if (!c.trim()) return e;
4396
+ const E = c.toLowerCase(), k = (O) => {
4397
+ const A = [];
4398
+ for (const L of O) {
4399
+ const $ = L.label.toLowerCase().includes(E) || String(L.id).toLowerCase().includes(E) || L.externalId && String(L.externalId).toLowerCase().includes(E), B = L.children ? k(L.children) : [];
4400
+ ($ || B.length > 0) && A.push({
4401
+ ...L,
4402
+ children: B.length > 0 ? B : L.children
4403
+ });
4404
+ }
4405
+ return A;
4406
+ };
4407
+ return k(e);
4408
+ }, [e, c]), R = St((E) => !E.children || E.children.length === 0 ? [E.value] : E.children.flatMap((k) => {
4409
+ const O = he(e || [], k.value) || k;
4410
+ return R(O);
4411
+ }), [e]), F = St(
4412
+ (E) => {
4413
+ const k = he(e || [], E.value) || E, O = R(k);
4414
+ if (k.children && k.children.length > 0)
4415
+ if (O.every(($) => r.includes($))) {
4416
+ const $ = new Set(O);
4417
+ n(r.filter((B) => !$.has(B)));
4418
+ } else {
4419
+ const $ = /* @__PURE__ */ new Set([...r, ...O]);
4420
+ n(Array.from($));
4421
+ }
4422
+ else {
4423
+ const L = r.includes(E.value);
4424
+ n(L ? r.filter(($) => $ !== E.value) : [...r, E.value]);
4425
+ }
4426
+ },
4427
+ [e, r, n, R]
4428
+ ), C = (E) => {
4429
+ E.stopPropagation(), n([]);
4430
+ }, { areAllChildrenSelected: D, areSomeChildrenSelected: V } = Ke(() => {
4431
+ const E = (O) => {
4432
+ const A = he(e || [], O);
4433
+ return !A || !A.children || A.children.length === 0 ? r.includes(O) : A.children.every((L) => E(L.value));
4434
+ }, k = (O) => {
4435
+ const A = he(e || [], O);
4436
+ return !A || !A.children || A.children.length === 0 ? r.includes(O) : A.children.some((L) => k(L.value));
4437
+ };
4438
+ return {
4439
+ areAllChildrenSelected: E,
4440
+ areSomeChildrenSelected: k
4441
+ };
4442
+ }, [e, r]), j = (E) => E.map((k) => {
4443
+ const O = he(e || [], k.value), A = O?.children && O.children.length > 0, L = !A, $ = L && r.includes(k.value), B = A && D(k.value), J = A && V(k.value), Z = A && J && !B;
4444
+ return /* @__PURE__ */ v(
4445
+ mt,
4446
+ {
4447
+ itemId: k.value,
4448
+ label: /* @__PURE__ */ Y(
4449
+ fe,
4450
+ {
4451
+ sx: {
4452
+ display: "flex",
4453
+ alignItems: "flex-start",
4454
+ py: 0.5
4455
+ },
4456
+ onClick: (q) => {
4457
+ q.stopPropagation(), F(k);
4458
+ },
4459
+ children: [
4460
+ /* @__PURE__ */ v(
4461
+ Cn,
4462
+ {
4463
+ checked: L ? $ : B,
4464
+ indeterminate: Z,
4465
+ size: "small",
4466
+ sx: { p: 0, mr: 1 }
4467
+ }
4468
+ ),
4469
+ /* @__PURE__ */ Y(fe, { sx: { display: "flex", flexDirection: "column" }, children: [
4470
+ /* @__PURE__ */ v(
4471
+ Ue,
4472
+ {
4473
+ component: "span",
4474
+ sx: { fontWeight: 600, fontSize: "0.875rem" },
4475
+ children: k.label
4476
+ }
4477
+ ),
4478
+ /* @__PURE__ */ Y(
4479
+ Ue,
4480
+ {
4481
+ component: "span",
4482
+ sx: { fontSize: "0.75rem", color: "text.secondary" },
4483
+ children: [
4484
+ "Id: ",
4485
+ k.id,
4486
+ k.externalId !== void 0 && k.externalId !== "" && /* @__PURE__ */ Y("span", { style: { marginLeft: 8 }, children: [
4487
+ "External ID: ",
4488
+ k.externalId
4489
+ ] })
4490
+ ]
4491
+ }
4492
+ )
4493
+ ] })
4494
+ ]
4495
+ }
4496
+ ),
4497
+ children: k.children && j(k.children)
4498
+ },
4499
+ k.value
4500
+ );
4501
+ });
4502
+ return /* @__PURE__ */ Y(
4503
+ In,
4504
+ {
4505
+ ref: b,
4506
+ size: "small",
4507
+ sx: {
4508
+ width: o ? "100%" : a,
4509
+ marginRight: l ? "10px" : "0px"
4510
+ },
4511
+ disabled: s,
4512
+ children: [
4513
+ /* @__PURE__ */ v(gn, { shrink: f || r.length > 0, children: t }),
4514
+ /* @__PURE__ */ v(
4515
+ bn,
4516
+ {
4517
+ label: t,
4518
+ notched: f || r.length > 0,
4519
+ readOnly: !0,
4520
+ onClick: () => !s && u(!f),
4521
+ sx: {
4522
+ borderRadius: "8px",
4523
+ bgcolor: "var(--color-background)",
4524
+ cursor: s ? "default" : "pointer",
4525
+ minHeight: 40,
4526
+ display: "flex",
4527
+ flexWrap: "nowrap",
4528
+ "& .MuiOutlinedInput-notchedOutline": {
4529
+ border: "1px solid var(--color-gray)"
4530
+ },
4531
+ "& .MuiOutlinedInput-input": {
4532
+ display: "none"
4533
+ }
4534
+ },
4535
+ value: "",
4536
+ startAdornment: /* @__PURE__ */ v(
4537
+ fe,
4538
+ {
4539
+ ref: x,
4540
+ sx: {
4541
+ display: "flex",
4542
+ flexWrap: "nowrap",
4543
+ gap: 0.5,
4544
+ flex: 1,
4545
+ overflow: "hidden",
4546
+ alignItems: "center",
4547
+ py: 0.5,
4548
+ pl: 1
4549
+ },
4550
+ children: w.length > 0 ? /* @__PURE__ */ Y(mn, { children: [
4551
+ w.slice(0, m).map((E) => /* @__PURE__ */ v(
4552
+ xt,
4553
+ {
4554
+ label: E,
4555
+ size: "small",
4556
+ sx: {
4557
+ height: 24,
4558
+ flexShrink: 0,
4559
+ "& .MuiChip-label": {
4560
+ px: 1,
4561
+ maxWidth: 100,
4562
+ overflow: "hidden",
4563
+ textOverflow: "ellipsis",
4564
+ whiteSpace: "nowrap"
4565
+ }
4566
+ }
4567
+ },
4568
+ E
4569
+ )),
4570
+ w.length > m && /* @__PURE__ */ v(
4571
+ xt,
4572
+ {
4573
+ label: `+${w.length - m}`,
4574
+ size: "small",
4575
+ sx: { height: 24, flexShrink: 0 }
4576
+ }
4577
+ )
4578
+ ] }) : null
4579
+ }
4580
+ ),
4581
+ endAdornment: /* @__PURE__ */ Y(yt, { position: "end", sx: { flexShrink: 0 }, children: [
4582
+ r.length > 0 && !s && /* @__PURE__ */ v(Sn, { size: "small", onClick: C, children: /* @__PURE__ */ v(wn, { fontSize: "small" }) }),
4583
+ /* @__PURE__ */ v(
4584
+ $n,
4585
+ {
4586
+ sx: {
4587
+ transform: f ? "rotate(180deg)" : "rotate(0deg)",
4588
+ transition: "transform 0.2s"
4589
+ }
4590
+ }
4591
+ )
4592
+ ] })
4593
+ }
4594
+ ),
4595
+ /* @__PURE__ */ v(yn, { in: f && !s, children: /* @__PURE__ */ Y(
4596
+ xn,
4597
+ {
4598
+ elevation: 3,
4599
+ sx: {
4600
+ position: "absolute",
4601
+ zIndex: 1300,
4602
+ width: "100%",
4603
+ mt: 0.5,
4604
+ borderRadius: "8px",
4605
+ overflow: "hidden"
4606
+ },
4607
+ children: [
4608
+ /* @__PURE__ */ v(fe, { sx: { p: 1 }, children: /* @__PURE__ */ v(
4609
+ En,
4610
+ {
4611
+ fullWidth: !0,
4612
+ size: "small",
4613
+ placeholder: h,
4614
+ value: c,
4615
+ onChange: (E) => p(E.target.value),
4616
+ slotProps: {
4617
+ input: {
4618
+ startAdornment: /* @__PURE__ */ v(yt, { position: "start", children: /* @__PURE__ */ v(vn, { fontSize: "small" }) })
4619
+ }
4620
+ },
4621
+ sx: {
4622
+ "& fieldset": {
4623
+ borderRadius: "8px"
4624
+ }
4625
+ }
4626
+ }
4627
+ ) }),
4628
+ /* @__PURE__ */ Y(fe, { sx: { maxHeight: d, overflow: "auto" }, children: [
4629
+ /* @__PURE__ */ v(ht, { children: j(_) }),
4630
+ _.length === 0 && /* @__PURE__ */ v(fe, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ v(Ue, { color: "text.secondary", variant: "body2", children: "No options found" }) })
4631
+ ] })
4632
+ ]
4633
+ }
4634
+ ) })
4635
+ ]
4636
+ }
4637
+ );
4638
+ }
4639
+ export {
4640
+ is as PassportTreeSelect
4641
+ };