@gears-frontx/ui-kit 0.4.3 → 0.4.5

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 (205) hide show
  1. package/README.md +4 -1
  2. package/dist/chunks/data-grid.DYrZEU-F.css +1 -0
  3. package/dist/chunks/debounce.js +17 -0
  4. package/dist/chunks/debounce.js.map +1 -0
  5. package/dist/chunks/dialog.CIR9bQoU.css +1 -0
  6. package/dist/chunks/dropdown-menu.DT1_JLqL.css +1 -0
  7. package/dist/chunks/empty.Cfg5lE0n.css +1 -0
  8. package/dist/chunks/filters.DcFdZpNG.css +1 -0
  9. package/dist/chunks/hooked.js +52 -0
  10. package/dist/chunks/hooked.js.map +1 -0
  11. package/dist/chunks/messages.js +18 -3
  12. package/dist/chunks/messages.js.map +1 -1
  13. package/dist/chunks/pagination.DPVITj_D.css +1 -0
  14. package/dist/chunks/{select.BFwI5rhI.css → select.C3sLDoZI.css} +1 -1
  15. package/dist/chunks/sidebar.Dw_e0Jqw.css +1 -0
  16. package/dist/chunks/tabs.BqhiMRUP.css +1 -0
  17. package/dist/components/data-grid/components/filter-chip.d.ts +21 -0
  18. package/dist/components/data-grid/components/filter-chip.d.ts.map +1 -0
  19. package/dist/components/data-grid/components/filter-control-area.d.ts +9 -0
  20. package/dist/components/data-grid/components/filter-control-area.d.ts.map +1 -0
  21. package/dist/components/data-grid/components/filter-options-search-input.d.ts +11 -0
  22. package/dist/components/data-grid/components/filter-options-search-input.d.ts.map +1 -0
  23. package/dist/components/data-grid/components/filter-popover-content.d.ts +8 -0
  24. package/dist/components/data-grid/components/filter-popover-content.d.ts.map +1 -0
  25. package/dist/components/data-grid/components/filter-reset-button.d.ts +8 -0
  26. package/dist/components/data-grid/components/filter-reset-button.d.ts.map +1 -0
  27. package/dist/components/data-grid/components/filter-scrollable-wrapper.d.ts +8 -0
  28. package/dist/components/data-grid/components/filter-scrollable-wrapper.d.ts.map +1 -0
  29. package/dist/components/data-grid/messages.d.ts +15 -0
  30. package/dist/components/data-grid/messages.d.ts.map +1 -1
  31. package/dist/components/data-grid/plugins/filters/components/adaptive-popover.d.ts +20 -0
  32. package/dist/components/data-grid/plugins/filters/components/adaptive-popover.d.ts.map +1 -0
  33. package/dist/components/data-grid/plugins/filters/components/all-filters-button.d.ts +3 -0
  34. package/dist/components/data-grid/plugins/filters/components/all-filters-button.d.ts.map +1 -0
  35. package/dist/components/data-grid/plugins/filters/components/all-filters-dialog.d.ts +7 -0
  36. package/dist/components/data-grid/plugins/filters/components/all-filters-dialog.d.ts.map +1 -0
  37. package/dist/components/data-grid/plugins/filters/components/dialog-filter-item.d.ts +9 -0
  38. package/dist/components/data-grid/plugins/filters/components/dialog-filter-item.d.ts.map +1 -0
  39. package/dist/components/data-grid/plugins/filters/components/filter-label.d.ts +7 -0
  40. package/dist/components/data-grid/plugins/filters/components/filter-label.d.ts.map +1 -0
  41. package/dist/components/data-grid/plugins/filters/components/filter-popover.d.ts +9 -0
  42. package/dist/components/data-grid/plugins/filters/components/filter-popover.d.ts.map +1 -0
  43. package/dist/components/data-grid/plugins/filters/components/filter-single.d.ts +7 -0
  44. package/dist/components/data-grid/plugins/filters/components/filter-single.d.ts.map +1 -0
  45. package/dist/components/data-grid/plugins/filters/components/filters-bar.d.ts +3 -0
  46. package/dist/components/data-grid/plugins/filters/components/filters-bar.d.ts.map +1 -0
  47. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-dialog-filter.d.ts +7 -0
  48. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-dialog-filter.d.ts.map +1 -0
  49. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-list.d.ts +12 -0
  50. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-list.d.ts.map +1 -0
  51. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-quick-filter.d.ts +7 -0
  52. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/checkbox-group-quick-filter.d.ts.map +1 -0
  53. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/filter-checkbox-group.d.ts +20 -0
  54. package/dist/components/data-grid/plugins/filters/entities/checkbox-group/filter-checkbox-group.d.ts.map +1 -0
  55. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-calendar.d.ts +17 -0
  56. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-calendar.d.ts.map +1 -0
  57. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-dialog-filter.d.ts +7 -0
  58. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-dialog-filter.d.ts.map +1 -0
  59. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-quick-filter.d.ts +7 -0
  60. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-quick-filter.d.ts.map +1 -0
  61. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-selection.d.ts +16 -0
  62. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-selection.d.ts.map +1 -0
  63. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-value.d.ts +19 -0
  64. package/dist/components/data-grid/plugins/filters/entities/date-range/date-range-value.d.ts.map +1 -0
  65. package/dist/components/data-grid/plugins/filters/entities/date-range/filter-date-range.d.ts +16 -0
  66. package/dist/components/data-grid/plugins/filters/entities/date-range/filter-date-range.d.ts.map +1 -0
  67. package/dist/components/data-grid/plugins/filters/entities/entities.d.ts +7 -0
  68. package/dist/components/data-grid/plugins/filters/entities/entities.d.ts.map +1 -0
  69. package/dist/components/data-grid/plugins/filters/entities/search/filter-search.d.ts +10 -0
  70. package/dist/components/data-grid/plugins/filters/entities/search/filter-search.d.ts.map +1 -0
  71. package/dist/components/data-grid/plugins/filters/entities/search/search-quick-filter.d.ts +7 -0
  72. package/dist/components/data-grid/plugins/filters/entities/search/search-quick-filter.d.ts.map +1 -0
  73. package/dist/components/data-grid/plugins/filters/entities/tag-group/filter-tag-group.d.ts +14 -0
  74. package/dist/components/data-grid/plugins/filters/entities/tag-group/filter-tag-group.d.ts.map +1 -0
  75. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-dialog-filter.d.ts +7 -0
  76. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-dialog-filter.d.ts.map +1 -0
  77. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-list.d.ts +11 -0
  78. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-list.d.ts.map +1 -0
  79. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-quick-filter.d.ts +7 -0
  80. package/dist/components/data-grid/plugins/filters/entities/tag-group/tag-group-quick-filter.d.ts.map +1 -0
  81. package/dist/components/data-grid/plugins/filters/entities/toggle/filter-toggle.d.ts +10 -0
  82. package/dist/components/data-grid/plugins/filters/entities/toggle/filter-toggle.d.ts.map +1 -0
  83. package/dist/components/data-grid/plugins/filters/entities/toggle/toggle-quick-filter.d.ts +7 -0
  84. package/dist/components/data-grid/plugins/filters/entities/toggle/toggle-quick-filter.d.ts.map +1 -0
  85. package/dist/components/data-grid/plugins/filters/entities/tree/filter-tree.d.ts +20 -0
  86. package/dist/components/data-grid/plugins/filters/entities/tree/filter-tree.d.ts.map +1 -0
  87. package/dist/components/data-grid/plugins/filters/entities/tree/resolve-filter-tree-value.d.ts +8 -0
  88. package/dist/components/data-grid/plugins/filters/entities/tree/resolve-filter-tree-value.d.ts.map +1 -0
  89. package/dist/components/data-grid/plugins/filters/entities/tree/tree-dialog-filter.d.ts +7 -0
  90. package/dist/components/data-grid/plugins/filters/entities/tree/tree-dialog-filter.d.ts.map +1 -0
  91. package/dist/components/data-grid/plugins/filters/entities/tree/tree-list.d.ts +12 -0
  92. package/dist/components/data-grid/plugins/filters/entities/tree/tree-list.d.ts.map +1 -0
  93. package/dist/components/data-grid/plugins/filters/entities/tree/tree-quick-filter.d.ts +7 -0
  94. package/dist/components/data-grid/plugins/filters/entities/tree/tree-quick-filter.d.ts.map +1 -0
  95. package/dist/components/data-grid/plugins/filters/entities/tree/tree-radio-select-plugin.d.ts +13 -0
  96. package/dist/components/data-grid/plugins/filters/entities/tree/tree-radio-select-plugin.d.ts.map +1 -0
  97. package/dist/components/data-grid/plugins/filters/entities/tree/use-tree-search.d.ts +8 -0
  98. package/dist/components/data-grid/plugins/filters/entities/tree/use-tree-search.d.ts.map +1 -0
  99. package/dist/components/data-grid/plugins/filters/filters-plugin.d.ts +3 -0
  100. package/dist/components/data-grid/plugins/filters/filters-plugin.d.ts.map +1 -0
  101. package/dist/components/data-grid/plugins/filters/filters-types.d.ts +141 -0
  102. package/dist/components/data-grid/plugins/filters/filters-types.d.ts.map +1 -0
  103. package/dist/components/data-grid/plugins/filters/public.d.ts +11 -0
  104. package/dist/components/data-grid/plugins/filters/public.d.ts.map +1 -0
  105. package/dist/components/data-grid/plugins/filters/services/read-option-values.d.ts +7 -0
  106. package/dist/components/data-grid/plugins/filters/services/read-option-values.d.ts.map +1 -0
  107. package/dist/components/data-grid/plugins/filters/services/use-async-filter-search.d.ts +20 -0
  108. package/dist/components/data-grid/plugins/filters/services/use-async-filter-search.d.ts.map +1 -0
  109. package/dist/components/data-grid/plugins/filters/services/use-filter-search.d.ts +12 -0
  110. package/dist/components/data-grid/plugins/filters/services/use-filter-search.d.ts.map +1 -0
  111. package/dist/components/data-grid/tree/components/tree-actions.d.ts +7 -0
  112. package/dist/components/data-grid/tree/components/tree-actions.d.ts.map +1 -0
  113. package/dist/components/data-grid/tree/components/tree-content.d.ts +3 -0
  114. package/dist/components/data-grid/tree/components/tree-content.d.ts.map +1 -0
  115. package/dist/components/data-grid/tree/components/tree-layout-slot.d.ts +9 -0
  116. package/dist/components/data-grid/tree/components/tree-layout-slot.d.ts.map +1 -0
  117. package/dist/components/data-grid/tree/components/tree-left-slot.d.ts +7 -0
  118. package/dist/components/data-grid/tree/components/tree-left-slot.d.ts.map +1 -0
  119. package/dist/components/data-grid/tree/components/tree-list-item.d.ts +10 -0
  120. package/dist/components/data-grid/tree/components/tree-list-item.d.ts.map +1 -0
  121. package/dist/components/data-grid/tree/components/tree-main.d.ts +3 -0
  122. package/dist/components/data-grid/tree/components/tree-main.d.ts.map +1 -0
  123. package/dist/components/data-grid/tree/components/tree-node-content.d.ts +7 -0
  124. package/dist/components/data-grid/tree/components/tree-node-content.d.ts.map +1 -0
  125. package/dist/components/data-grid/tree/components/tree-node-directory-item.d.ts +7 -0
  126. package/dist/components/data-grid/tree/components/tree-node-directory-item.d.ts.map +1 -0
  127. package/dist/components/data-grid/tree/components/tree-node-leaf.d.ts +7 -0
  128. package/dist/components/data-grid/tree/components/tree-node-leaf.d.ts.map +1 -0
  129. package/dist/components/data-grid/tree/components/tree-nodes.d.ts +7 -0
  130. package/dist/components/data-grid/tree/components/tree-nodes.d.ts.map +1 -0
  131. package/dist/components/data-grid/tree/components/tree-placeholder.d.ts +6 -0
  132. package/dist/components/data-grid/tree/components/tree-placeholder.d.ts.map +1 -0
  133. package/dist/components/data-grid/tree/create-tree.d.ts +5 -0
  134. package/dist/components/data-grid/tree/create-tree.d.ts.map +1 -0
  135. package/dist/components/data-grid/tree/services/core/tree-context.d.ts +21 -0
  136. package/dist/components/data-grid/tree/services/core/tree-context.d.ts.map +1 -0
  137. package/dist/components/data-grid/tree/services/focus/focus-service.d.ts +5 -0
  138. package/dist/components/data-grid/tree/services/focus/focus-service.d.ts.map +1 -0
  139. package/dist/components/data-grid/tree/services/focus/focus-types.d.ts +25 -0
  140. package/dist/components/data-grid/tree/services/focus/focus-types.d.ts.map +1 -0
  141. package/dist/components/data-grid/tree/services/focus/navigation-helpers.d.ts +27 -0
  142. package/dist/components/data-grid/tree/services/focus/navigation-helpers.d.ts.map +1 -0
  143. package/dist/components/data-grid/tree/services/hooked/hooked-types.d.ts +8 -0
  144. package/dist/components/data-grid/tree/services/hooked/hooked-types.d.ts.map +1 -0
  145. package/dist/components/data-grid/tree/services/hooked/hooked.d.ts +3 -0
  146. package/dist/components/data-grid/tree/services/hooked/hooked.d.ts.map +1 -0
  147. package/dist/components/data-grid/tree/services/internal/internal-helpers.d.ts +2 -0
  148. package/dist/components/data-grid/tree/services/internal/internal-helpers.d.ts.map +1 -0
  149. package/dist/components/data-grid/tree/services/layout/layout-service.d.ts +5 -0
  150. package/dist/components/data-grid/tree/services/layout/layout-service.d.ts.map +1 -0
  151. package/dist/components/data-grid/tree/services/layout/layout-types.d.ts +124 -0
  152. package/dist/components/data-grid/tree/services/layout/layout-types.d.ts.map +1 -0
  153. package/dist/components/data-grid/tree/services/plugins/plugins-helpers.d.ts +50 -0
  154. package/dist/components/data-grid/tree/services/plugins/plugins-helpers.d.ts.map +1 -0
  155. package/dist/components/data-grid/tree/services/plugins/plugins-service.d.ts +5 -0
  156. package/dist/components/data-grid/tree/services/plugins/plugins-service.d.ts.map +1 -0
  157. package/dist/components/data-grid/tree/services/plugins/plugins-types.d.ts +43 -0
  158. package/dist/components/data-grid/tree/services/plugins/plugins-types.d.ts.map +1 -0
  159. package/dist/components/data-grid/tree/services/settings/settings-service.d.ts +5 -0
  160. package/dist/components/data-grid/tree/services/settings/settings-service.d.ts.map +1 -0
  161. package/dist/components/data-grid/tree/services/settings/settings-types.d.ts +73 -0
  162. package/dist/components/data-grid/tree/services/settings/settings-types.d.ts.map +1 -0
  163. package/dist/components/data-grid/tree/tree-types.d.ts +44 -0
  164. package/dist/components/data-grid/tree/tree-types.d.ts.map +1 -0
  165. package/dist/components/data-grid/tree/tree.d.ts +4 -0
  166. package/dist/components/data-grid/tree/tree.d.ts.map +1 -0
  167. package/dist/components/data-grid/tree-structure/tree-structure-types.d.ts +89 -0
  168. package/dist/components/data-grid/tree-structure/tree-structure-types.d.ts.map +1 -0
  169. package/dist/components/data-grid/tree-structure/tree-structure.d.ts +19 -0
  170. package/dist/components/data-grid/tree-structure/tree-structure.d.ts.map +1 -0
  171. package/dist/components/data-grid/utils/components-stack.d.ts +12 -0
  172. package/dist/components/data-grid/utils/components-stack.d.ts.map +1 -0
  173. package/dist/components/data-grid/utils/use-is-tablet-up.d.ts +3 -0
  174. package/dist/components/data-grid/utils/use-is-tablet-up.d.ts.map +1 -0
  175. package/dist/data-grid/filters.d.ts +1 -0
  176. package/dist/data-grid/filters.js +1633 -0
  177. package/dist/data-grid/filters.js.map +1 -0
  178. package/dist/data-grid/pagination.js +39 -38
  179. package/dist/data-grid/pagination.js.map +1 -1
  180. package/dist/data-grid/text-search.js +55 -67
  181. package/dist/data-grid/text-search.js.map +1 -1
  182. package/dist/data-grid.js +578 -618
  183. package/dist/data-grid.js.map +1 -1
  184. package/dist/dialog.js +38 -38
  185. package/dist/docs/data-grid.md +172 -4
  186. package/dist/docs/drawer.md +1 -1
  187. package/dist/docs/questionnaire.md +1 -1
  188. package/dist/dropdown-menu.js +56 -56
  189. package/dist/empty.js +34 -34
  190. package/dist/index.d.ts +1 -0
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +392 -382
  193. package/dist/index.js.map +1 -1
  194. package/dist/select.js +45 -45
  195. package/dist/sidebar.js +112 -112
  196. package/dist/tabs.js +14 -14
  197. package/llms.txt +2 -2
  198. package/package.json +1 -4
  199. package/dist/chunks/data-grid.DIkpRRaf.css +0 -1
  200. package/dist/chunks/dialog.Cpo8vChK.css +0 -1
  201. package/dist/chunks/dropdown-menu.TU3FHXbJ.css +0 -1
  202. package/dist/chunks/empty.DWqLrSfF.css +0 -1
  203. package/dist/chunks/pagination.Cn8tIWMX.css +0 -1
  204. package/dist/chunks/sidebar.CIuN--7U.css +0 -1
  205. package/dist/chunks/tabs.DFa0OYMo.css +0 -1
@@ -0,0 +1,1633 @@
1
+ "use client";
2
+ import { create as z } from "zustand";
3
+ import { u as k, c as rt, b as ot } from "../chunks/plugins-helpers.js";
4
+ import { jsx as s, jsxs as w, Fragment as P } from "react/jsx-runtime";
5
+ import { FunnelIcon as st, RotateCwIcon as it, XIcon as lt, SearchIcon as ct, ChevronRightIcon as at } from "lucide-react";
6
+ import { useSyncExternalStore as ut, useState as T, useEffect as $, useMemo as Te, useRef as Pe, useId as dt, createContext as ft, useContext as pt, createElement as Ce, memo as ht } from "react";
7
+ import { cx as W } from "class-variance-authority";
8
+ import { m as O } from "../chunks/messages.js";
9
+ import { SheetHeader as mt, SheetTitle as gt, SheetFooter as St, Sheet as vt, SheetContent as Ct } from "../sheet.js";
10
+ import { Accordion as yt, AccordionItem as It, AccordionTrigger as bt, AccordionContent as _t } from "../accordion.js";
11
+ import { Button as ue } from "../button.js";
12
+ import { Badge as de } from "../badge.js";
13
+ import { d as Ke } from "../chunks/debounce.js";
14
+ import { Popover as Nt, PopoverTrigger as wt, PopoverContent as At } from "../popover.js";
15
+ import { Drawer as xt, DrawerTrigger as Ft, DrawerContent as Dt } from "../drawer.js";
16
+ import { a as Lt, c as kt, u as Tt } from "../chunks/hooked.js";
17
+ import { Input as Me } from "../input.js";
18
+ import { Spinner as Pt } from "../spinner.js";
19
+ import { Label as Oe } from "../label.js";
20
+ import { Checkbox as Kt } from "../checkbox.js";
21
+ import { DropdownMenu as Mt, DropdownMenuItem as ze } from "../dropdown-menu.js";
22
+ import { useShallow as U } from "zustand/react/shallow";
23
+ import { RadioGroup as Ot, RadioGroupItem as zt } from "../radio-group.js";
24
+ import { parse as $t, isValid as Rt, format as Gt, set as Vt, isBefore as Ht, startOfDay as ye } from "date-fns";
25
+ import { Calendar as Bt } from "../calendar.js";
26
+ import '../chunks/filters.DcFdZpNG.css';const jt = "_chip_1pstc_6", qt = "_hover_1pstc_43", Ut = "_active_1pstc_49", se = {
27
+ chip: jt,
28
+ hover: qt,
29
+ active: Ut
30
+ };
31
+ function $e({ active: e, hover: t, className: n }) {
32
+ return W(se.chip, e && se.active, t && se.hover, n);
33
+ }
34
+ function fe({
35
+ active: e,
36
+ hover: t,
37
+ className: n,
38
+ type: r = "button",
39
+ ...o
40
+ }) {
41
+ return /* @__PURE__ */ s("button", { type: r, className: $e({ active: e, hover: t, className: n }), ...o });
42
+ }
43
+ function Wt({ active: e, hover: t, className: n, ...r }) {
44
+ return /* @__PURE__ */ s("label", { className: $e({ active: e, hover: t, className: n }), ...r });
45
+ }
46
+ const Xt = 720;
47
+ function Qt(e) {
48
+ return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
49
+ }
50
+ function Et() {
51
+ return window.innerWidth >= Xt;
52
+ }
53
+ function Jt() {
54
+ return !1;
55
+ }
56
+ function Re() {
57
+ return ut(Qt, Et, Jt);
58
+ }
59
+ const Yt = "_panel_11w9a_6", Zt = {
60
+ panel: Yt
61
+ };
62
+ function en({ onApply: e }) {
63
+ const r = k().getPlugin("filters").useFilterEntities();
64
+ return /* @__PURE__ */ w(P, { children: [
65
+ /* @__PURE__ */ s(mt, { children: /* @__PURE__ */ s(gt, { children: O.filters.allFiltersTitle }) }),
66
+ /* @__PURE__ */ s(yt, { multiple: !0, children: r.map((o) => {
67
+ if (!o.dialogFilterComponent) return null;
68
+ const i = o.dialogFilterComponent;
69
+ return /* @__PURE__ */ s(i, { filterEntity: o }, o.id);
70
+ }) }),
71
+ /* @__PURE__ */ s(St, { children: /* @__PURE__ */ s(ue, { onClick: e, children: O.filters.apply }) })
72
+ ] });
73
+ }
74
+ function Ie() {
75
+ const t = k().getPlugin("filters"), [n, r] = T(!1), o = Re(), a = t.useFilterEntities().filter((A) => A.dialogFilterComponent).map((A) => A.filterKey), f = t.useActiveCount(a);
76
+ function h() {
77
+ t.resetDraftState(), r(!0);
78
+ }
79
+ function g() {
80
+ r(!1), t.resetDraftState();
81
+ }
82
+ function b() {
83
+ t.applyDraftState(), r(!1);
84
+ }
85
+ return /* @__PURE__ */ w(P, { children: [
86
+ /* @__PURE__ */ w(fe, { hover: n, onClick: h, children: [
87
+ /* @__PURE__ */ s(st, {}),
88
+ O.filters.allFilters,
89
+ f > 0 && /* @__PURE__ */ s(de, { size: "xs", children: f })
90
+ ] }),
91
+ /* @__PURE__ */ s(vt, { open: n, onOpenChange: (A) => !A && g(), children: /* @__PURE__ */ s(
92
+ Ct,
93
+ {
94
+ side: o ? "right" : "bottom",
95
+ closeLabel: O.filters.closeDialog,
96
+ className: Zt.panel,
97
+ children: /* @__PURE__ */ s(en, { onApply: b })
98
+ }
99
+ ) })
100
+ ] });
101
+ }
102
+ const tn = "_filterOptions_1pdo1_1", nn = "_tail_1pdo1_16", rn = "_chip_1pdo1_25", ie = {
103
+ filterOptions: tn,
104
+ tail: nn,
105
+ chip: rn
106
+ };
107
+ function on({ filterEntity: e }) {
108
+ if (!e.filterComponent) return null;
109
+ const t = e.filterComponent;
110
+ return /* @__PURE__ */ s(t, { filterEntity: e });
111
+ }
112
+ function sn() {
113
+ const t = k().getPlugin("filters"), n = t.useFilterEntities(), r = t.useIsAllFiltersOptionVisible(), o = n.some((a) => a.dialogFilterComponent), i = n.filter((a) => a.filterComponent), l = r && o;
114
+ return /* @__PURE__ */ w("div", { className: ie.filterOptions, children: [
115
+ i.map((a, f) => {
116
+ const h = f === i.length - 1;
117
+ return /* @__PURE__ */ w("div", { className: h ? ie.tail : ie.chip, children: [
118
+ /* @__PURE__ */ s(on, { filterEntity: a }),
119
+ h && l && /* @__PURE__ */ s(Ie, {})
120
+ ] }, a.id);
121
+ }),
122
+ i.length === 0 && l && /* @__PURE__ */ s(Ie, {})
123
+ ] });
124
+ }
125
+ const mo = rt("filters", (e) => {
126
+ const t = z(() => ({
127
+ entities: [],
128
+ isAllFiltersOptionVisible: !0
129
+ })), n = e.registerPersistentState(
130
+ "filters",
131
+ {
132
+ schema: {}
133
+ }
134
+ ), r = z(() => ({
135
+ filters: n.value ?? {}
136
+ })), o = z(() => ({ filters: {} }));
137
+ return p(r, o), e.registerSlot("top-start", {
138
+ id: "filters",
139
+ component: sn
140
+ }), e.hook("load:context", () => {
141
+ const u = m();
142
+ if (Object.keys(u).length !== 0)
143
+ return { filters: u };
144
+ }), e.hook("refresh", (u) => {
145
+ "resetFilters" in u && u.resetFilters && (r.setState({ filters: {} }), o.setState({ filters: {} }), n.setValue(void 0));
146
+ }), r.subscribe(() => {
147
+ const u = r.getState().filters;
148
+ n.setValue(Object.keys(u).length > 0 ? u : void 0);
149
+ }), {
150
+ useFilterEntities: () => t((u) => u.entities),
151
+ useIsAllFiltersOptionVisible: () => t((u) => u.isAllFiltersOptionVisible),
152
+ useState: a,
153
+ useActiveCount: f,
154
+ setState: h,
155
+ removeState: g,
156
+ useDraftState: b,
157
+ setDraftState: A,
158
+ applyDraftState: I,
159
+ resetDraftState: F,
160
+ isFilterValueActive: v,
161
+ onPropsChange: S
162
+ };
163
+ function a(u) {
164
+ return r((N) => N.filters[u]);
165
+ }
166
+ function f(u) {
167
+ return r(
168
+ (N) => u.filter((D) => {
169
+ var L;
170
+ return v((L = N.filters[D]) == null ? void 0 : L.value);
171
+ }).length
172
+ );
173
+ }
174
+ function h(u, N) {
175
+ C(r, u, N), e.refresh({ resetFilters: !1 }), p(r, o);
176
+ }
177
+ function g(u) {
178
+ r.setState((N) => {
179
+ const D = { ...N.filters };
180
+ return delete D[u], { filters: D };
181
+ }), e.refresh({ resetFilters: !1 }), p(r, o);
182
+ }
183
+ function b(u) {
184
+ return o((N) => N.filters[u]);
185
+ }
186
+ function A(u, N) {
187
+ C(o, u, N);
188
+ }
189
+ function I() {
190
+ const u = o.getState().filters;
191
+ r.setState({ filters: { ...u } }), e.refresh({ resetFilters: !1 });
192
+ }
193
+ function F() {
194
+ p(r, o);
195
+ }
196
+ function m() {
197
+ const { filters: u } = r.getState(), { entities: N } = t.getState(), D = {};
198
+ for (const [L, M] of Object.entries(u))
199
+ if (v(M == null ? void 0 : M.value)) {
200
+ const x = N.find((V) => V.filterKey === L);
201
+ D[L] = x != null && x.resolveLoadValue ? x.resolveLoadValue(M) : M;
202
+ }
203
+ return D;
204
+ }
205
+ function v(u) {
206
+ return u == null || u === "" ? !1 : typeof u == "boolean" ? !0 : Array.isArray(u) ? u.length > 0 : !0;
207
+ }
208
+ function C(u, N, D) {
209
+ u.setState((L) => ({
210
+ filters: { ...L.filters, [N]: D }
211
+ }));
212
+ }
213
+ function p(u, N) {
214
+ N.setState({ filters: { ...u.getState().filters } });
215
+ }
216
+ function S(u) {
217
+ const N = {};
218
+ u.entities !== void 0 && (N.entities = u.entities), u.isAllFiltersOptionVisible !== void 0 && (N.isAllFiltersOptionVisible = u.isAllFiltersOptionVisible), Object.keys(N).length > 0 && t.setState(N);
219
+ }
220
+ });
221
+ const ln = "_content_8lncy_1", cn = {
222
+ content: ln
223
+ };
224
+ function an({ children: e, maxInlineSize: t }) {
225
+ const n = t ? { maxInlineSize: t } : void 0;
226
+ return /* @__PURE__ */ s("div", { className: cn.content, style: n, children: e });
227
+ }
228
+ const un = "_divider_18abl_1", dn = "_resetButton_18abl_9", be = {
229
+ divider: un,
230
+ resetButton: dn
231
+ };
232
+ function fn({ disabled: e, onClick: t }) {
233
+ return /* @__PURE__ */ w(P, { children: [
234
+ /* @__PURE__ */ s("hr", { className: be.divider }),
235
+ /* @__PURE__ */ s("div", { className: be.resetButton, children: /* @__PURE__ */ s(
236
+ ue,
237
+ {
238
+ variant: "ghost",
239
+ size: "sm",
240
+ disabled: e,
241
+ onClick: t,
242
+ icon: /* @__PURE__ */ s(it, {}),
243
+ children: O.filters.reset
244
+ }
245
+ ) })
246
+ ] });
247
+ }
248
+ const pn = "_popover_bymr3_8", hn = {
249
+ popover: pn
250
+ };
251
+ function mn({
252
+ open: e,
253
+ onOpenChange: t,
254
+ trigger: n,
255
+ minInlineSize: r,
256
+ children: o
257
+ }) {
258
+ return Re() ? /* @__PURE__ */ w(Nt, { open: e, onOpenChange: t, children: [
259
+ /* @__PURE__ */ s(wt, { render: n }),
260
+ /* @__PURE__ */ s(At, { className: hn.popover, children: r != null ? /* @__PURE__ */ s("div", { style: { minInlineSize: r }, children: o }) : o })
261
+ ] }) : /* @__PURE__ */ w(xt, { open: e, onOpenChange: t, side: "bottom", children: [
262
+ /* @__PURE__ */ s(Ft, { render: n }),
263
+ /* @__PURE__ */ s(Dt, { children: o })
264
+ ] });
265
+ }
266
+ function pe({ filterEntity: e }) {
267
+ const n = ot().table.useConfigurationColumns();
268
+ if (e.label != null)
269
+ return /* @__PURE__ */ s(P, { children: e.label });
270
+ const o = gn(n).find((i) => i.id === e.id);
271
+ if (o == null)
272
+ throw new Error(
273
+ `Label for "${e.id}" is not defined. "id" should match a column id or filter entity should have a label.`
274
+ );
275
+ return /* @__PURE__ */ s(P, { children: o.label });
276
+ }
277
+ function gn(e) {
278
+ const t = [];
279
+ for (const n of e)
280
+ Lt(n) ? t.push(...n.columns) : t.push(n);
281
+ return t;
282
+ }
283
+ const Sn = "_dot_1cz9l_2", vn = {
284
+ dot: Sn
285
+ }, Cn = 140;
286
+ function X({ filterEntity: e, children: t }) {
287
+ var m;
288
+ const r = k().getPlugin("filters"), [o, i] = T(!1), l = r.useState(e.filterKey), a = l == null ? void 0 : l.value, f = !r.isFilterValueActive(a), h = Array.isArray(a) && a.length > 0 ? a.length : void 0, g = (m = e.params) == null ? void 0 : m.popover, b = `${(g == null ? void 0 : g.minInlineSize) ?? Cn}px`, A = (g == null ? void 0 : g.maxInlineSize) != null ? `${g.maxInlineSize}px` : void 0;
289
+ function I() {
290
+ r.removeState(e.filterKey);
291
+ }
292
+ const F = /* @__PURE__ */ w(fe, { hover: o, active: !f, children: [
293
+ /* @__PURE__ */ s(pe, { filterEntity: e }),
294
+ !f && (h != null ? /* @__PURE__ */ s(de, { size: "xs", children: h }) : /* @__PURE__ */ s("span", { className: vn.dot }))
295
+ ] });
296
+ return /* @__PURE__ */ s(
297
+ mn,
298
+ {
299
+ open: o,
300
+ onOpenChange: i,
301
+ minInlineSize: b,
302
+ trigger: F,
303
+ children: /* @__PURE__ */ w(an, { maxInlineSize: A, children: [
304
+ t,
305
+ /* @__PURE__ */ s(fn, { disabled: f, onClick: I })
306
+ ] })
307
+ }
308
+ );
309
+ }
310
+ function yn({ filterEntity: e }) {
311
+ var f;
312
+ const n = k().getPlugin("filters"), r = ((f = n.useState(e.filterKey)) == null ? void 0 : f.value) ?? "", [o, i] = T(r);
313
+ $(() => {
314
+ i(r);
315
+ }, [r]);
316
+ const l = Te(
317
+ () => Ke((h) => {
318
+ h ? n.setState(e.filterKey, { value: h }) : n.removeState(e.filterKey);
319
+ }, 1e3),
320
+ [e.filterKey, n]
321
+ );
322
+ $(() => () => l.cancel(), [l]);
323
+ function a(h) {
324
+ i(h), l(h);
325
+ }
326
+ return /* @__PURE__ */ s(X, { filterEntity: e, children: /* @__PURE__ */ s(Me, { value: o, onValueChange: a }) });
327
+ }
328
+ function go(e) {
329
+ return {
330
+ id: e.id,
331
+ filterKey: e.filterKey ?? e.id,
332
+ label: e.label,
333
+ filterComponent: yn
334
+ };
335
+ }
336
+ function In({ filterEntity: e }) {
337
+ const n = k().getPlugin("filters"), r = n.useState(e.filterKey), o = (r == null ? void 0 : r.value) === !0;
338
+ function i() {
339
+ o ? n.removeState(e.filterKey) : n.setState(e.filterKey, { value: !0 });
340
+ }
341
+ return /* @__PURE__ */ s(fe, { active: o, onClick: i, children: /* @__PURE__ */ s(pe, { filterEntity: e }) });
342
+ }
343
+ function So(e) {
344
+ return {
345
+ id: e.id,
346
+ filterKey: e.filterKey ?? e.id,
347
+ label: e.label,
348
+ filterComponent: In
349
+ };
350
+ }
351
+ const bn = "_header_1kn5i_1", _n = "_actions_1kn5i_10", Nn = "_titleWithActions_1kn5i_18", wn = "_tagClose_1kn5i_23", E = {
352
+ header: bn,
353
+ actions: _n,
354
+ titleWithActions: Nn,
355
+ tagClose: wn
356
+ };
357
+ function ee({ filterEntity: e, children: t }) {
358
+ const r = k().getPlugin("filters"), o = r.useDraftState(e.filterKey), i = An(o == null ? void 0 : o.value, r.isFilterValueActive);
359
+ function l() {
360
+ r.setDraftState(e.filterKey, { value: void 0 });
361
+ }
362
+ return /* @__PURE__ */ w(It, { children: [
363
+ /* @__PURE__ */ w("div", { className: E.header, children: [
364
+ /* @__PURE__ */ s(bt, { children: /* @__PURE__ */ s("span", { className: W(i > 0 && E.titleWithActions), children: /* @__PURE__ */ s(pe, { filterEntity: e }) }) }),
365
+ i > 0 && /* @__PURE__ */ s("span", { className: E.actions, children: /* @__PURE__ */ w(de, { children: [
366
+ i,
367
+ /* @__PURE__ */ s(
368
+ "button",
369
+ {
370
+ type: "button",
371
+ className: E.tagClose,
372
+ "aria-label": O.filters.close,
373
+ onClick: l,
374
+ children: /* @__PURE__ */ s(lt, {})
375
+ }
376
+ )
377
+ ] }) })
378
+ ] }),
379
+ /* @__PURE__ */ s(_t, { children: t })
380
+ ] });
381
+ }
382
+ function An(e, t) {
383
+ return Array.isArray(e) ? e.length : t(e) ? 1 : 0;
384
+ }
385
+ function te(e) {
386
+ return Array.isArray(e) ? e : [];
387
+ }
388
+ const xn = "_sizeXl_1h36k_8", _e = {
389
+ default: "_default_1h36k_1",
390
+ sizeXl: xn
391
+ }, Fn = {
392
+ m: _e.default,
393
+ xl: _e.sizeXl
394
+ };
395
+ function ne({ children: e, size: t = "m" }) {
396
+ return /* @__PURE__ */ s("div", { className: Fn[t], children: e });
397
+ }
398
+ function re({
399
+ value: e,
400
+ onValueChange: t,
401
+ placeholder: n,
402
+ autoFocus: r,
403
+ disabled: o
404
+ }) {
405
+ return /* @__PURE__ */ s(
406
+ Me,
407
+ {
408
+ value: e,
409
+ placeholder: n ?? O.filters.searchPlaceholder,
410
+ icon: /* @__PURE__ */ s(ct, {}),
411
+ onValueChange: t,
412
+ autoFocus: r,
413
+ disabled: o
414
+ }
415
+ );
416
+ }
417
+ const Dn = "_wrapper_1gwyh_1", Ln = {
418
+ wrapper: Dn
419
+ };
420
+ function oe({ children: e, role: t }) {
421
+ return /* @__PURE__ */ s("div", { className: Ln.wrapper, role: t, children: e });
422
+ }
423
+ const kn = 300;
424
+ function Tn(e, t = kn) {
425
+ const [n, r] = T(""), [o, i] = T([]), [l, a] = T(!0), f = Pe(0);
426
+ return $(() => {
427
+ const h = f.current + 1;
428
+ f.current = h, a(!0);
429
+ const g = setTimeout(() => {
430
+ e(n.trim()).then((b) => {
431
+ h === f.current && i(b);
432
+ }).catch(() => {
433
+ h === f.current && i([]);
434
+ }).finally(() => {
435
+ h === f.current && a(!1);
436
+ });
437
+ }, t);
438
+ return () => clearTimeout(g);
439
+ }, [n, e, t]), { searchTerm: n, setSearchTerm: r, options: o, isLoading: l };
440
+ }
441
+ function Pn(e) {
442
+ return typeof e == "string" ? e : typeof e == "number" ? String(e) : "";
443
+ }
444
+ function Kn(e, t) {
445
+ return typeof t == "function" ? t(e) : String(e[t] || "");
446
+ }
447
+ function Ge(e, t) {
448
+ const [n, r] = T("");
449
+ let o = e;
450
+ if (t && n.trim()) {
451
+ const i = n.toLowerCase();
452
+ o = e.filter((l) => Pn(l.label).toLowerCase().includes(i));
453
+ }
454
+ return {
455
+ searchTerm: n,
456
+ setSearchTerm: r,
457
+ filteredOptions: o
458
+ };
459
+ }
460
+ const Mn = "_list_1thlr_1", On = "_listItem_1thlr_13", zn = "_status_1thlr_18", Z = {
461
+ list: Mn,
462
+ listItem: On,
463
+ status: zn
464
+ };
465
+ function $n(e, t, n) {
466
+ return n ? [...e, t] : e.filter((r) => r !== t);
467
+ }
468
+ function Ve({
469
+ options: e,
470
+ value: t,
471
+ onChange: n
472
+ }) {
473
+ return /* @__PURE__ */ s("ul", { className: Z.list, children: e.map((r) => /* @__PURE__ */ s("li", { className: Z.listItem, children: /* @__PURE__ */ w(Oe, { children: [
474
+ /* @__PURE__ */ s(
475
+ Kt,
476
+ {
477
+ checked: t.includes(r.value),
478
+ onCheckedChange: (o) => n($n(t, r.value, o))
479
+ }
480
+ ),
481
+ r.component ? /* @__PURE__ */ s(r.component, { option: r }) : /* @__PURE__ */ s(P, { children: r.label })
482
+ ] }) }, r.value)) });
483
+ }
484
+ function Rn({
485
+ options: e,
486
+ showSearch: t,
487
+ value: n,
488
+ onChange: r,
489
+ searchSize: o
490
+ }) {
491
+ const { searchTerm: i, setSearchTerm: l, filteredOptions: a } = Ge(e, t);
492
+ return /* @__PURE__ */ w(P, { children: [
493
+ t && /* @__PURE__ */ s(ne, { size: o, children: /* @__PURE__ */ s(re, { value: i, onValueChange: l }) }),
494
+ /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(Ve, { options: a, value: n, onChange: r }) })
495
+ ] });
496
+ }
497
+ function Gn({
498
+ searchOptions: e,
499
+ searchDebounce: t,
500
+ value: n,
501
+ onChange: r,
502
+ searchSize: o
503
+ }) {
504
+ const { searchTerm: i, setSearchTerm: l, options: a, isLoading: f } = Tn(
505
+ e,
506
+ t
507
+ ), h = f && a.length === 0;
508
+ return /* @__PURE__ */ w(P, { children: [
509
+ /* @__PURE__ */ s(ne, { size: o, children: /* @__PURE__ */ s(re, { value: i, onValueChange: l }) }),
510
+ /* @__PURE__ */ s(oe, { children: h ? /* @__PURE__ */ s("div", { className: Z.status, children: /* @__PURE__ */ s(Pt, {}) }) : a.length > 0 ? /* @__PURE__ */ s(Ve, { options: a, value: n, onChange: r }) : /* @__PURE__ */ s("div", { className: Z.status, children: O.filters.noOptionsFound }) })
511
+ ] });
512
+ }
513
+ function He({ filterEntity: e, ...t }) {
514
+ const { options: n, search: r, searchDebounce: o } = e.params;
515
+ return typeof n == "function" ? /* @__PURE__ */ s(Gn, { searchOptions: n, searchDebounce: o, ...t }) : /* @__PURE__ */ s(Rn, { options: n, showSearch: r ?? !1, ...t });
516
+ }
517
+ function Vn({ filterEntity: e }) {
518
+ const n = k().getPlugin("filters"), r = n.useDraftState(e.filterKey), o = te(r == null ? void 0 : r.value);
519
+ function i(l) {
520
+ n.setDraftState(e.filterKey, { value: l });
521
+ }
522
+ return /* @__PURE__ */ s(ee, { filterEntity: e, children: /* @__PURE__ */ s(
523
+ He,
524
+ {
525
+ filterEntity: e,
526
+ value: o,
527
+ onChange: i,
528
+ searchSize: "xl"
529
+ }
530
+ ) });
531
+ }
532
+ function Hn({ filterEntity: e }) {
533
+ const n = k().getPlugin("filters"), r = n.useState(e.filterKey), o = te(r == null ? void 0 : r.value);
534
+ function i(l) {
535
+ l.length > 0 ? n.setState(e.filterKey, { value: l }) : n.removeState(e.filterKey);
536
+ }
537
+ return /* @__PURE__ */ s(X, { filterEntity: e, children: /* @__PURE__ */ s(
538
+ He,
539
+ {
540
+ filterEntity: e,
541
+ value: o,
542
+ onChange: i,
543
+ searchSize: "m"
544
+ }
545
+ ) });
546
+ }
547
+ function vo(e) {
548
+ const { options: t } = e;
549
+ return {
550
+ id: e.id,
551
+ filterKey: e.filterKey ?? e.id,
552
+ label: e.label,
553
+ filterComponent: Hn,
554
+ dialogFilterComponent: Vn,
555
+ params: {
556
+ options: t,
557
+ get search() {
558
+ return e.search ?? (typeof t == "function" || t.length > 5);
559
+ },
560
+ searchDebounce: e.searchDebounce,
561
+ popover: e.popover
562
+ }
563
+ };
564
+ }
565
+ const Bn = "_options_9wsap_1", jn = "_hiddenInput_9wsap_10", Ne = {
566
+ options: Bn,
567
+ hiddenInput: jn
568
+ };
569
+ function Be({ filterEntity: e, value: t, onChange: n, searchSize: r }) {
570
+ const o = dt(), { options: i, mode: l = "checkbox", search: a } = e.params, { searchTerm: f, setSearchTerm: h, filteredOptions: g } = Ge(
571
+ i,
572
+ a ?? !1
573
+ );
574
+ function b(I) {
575
+ return t.includes(I);
576
+ }
577
+ function A(I) {
578
+ l === "radio" ? n([I]) : b(I) ? n(t.filter((F) => F !== I)) : n([...t, I]);
579
+ }
580
+ return /* @__PURE__ */ w("div", { children: [
581
+ a && /* @__PURE__ */ s(ne, { size: r, children: /* @__PURE__ */ s(re, { value: f, onValueChange: h }) }),
582
+ /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s("div", { className: Ne.options, children: g.map((I) => /* @__PURE__ */ w(Wt, { active: b(I.value), children: [
583
+ I.component ? /* @__PURE__ */ s(I.component, { option: I }) : /* @__PURE__ */ s(P, { children: I.label }),
584
+ /* @__PURE__ */ s(
585
+ "input",
586
+ {
587
+ type: l === "radio" ? "radio" : "checkbox",
588
+ name: o,
589
+ value: String(I.value),
590
+ checked: b(I.value),
591
+ onChange: () => A(I.value),
592
+ className: Ne.hiddenInput
593
+ }
594
+ )
595
+ ] }, String(I.value))) }) })
596
+ ] });
597
+ }
598
+ function qn({ filterEntity: e }) {
599
+ const n = k().getPlugin("filters"), r = n.useDraftState(e.filterKey), o = te(r == null ? void 0 : r.value);
600
+ function i(l) {
601
+ n.setDraftState(e.filterKey, { value: l });
602
+ }
603
+ return /* @__PURE__ */ s(ee, { filterEntity: e, children: /* @__PURE__ */ s(
604
+ Be,
605
+ {
606
+ filterEntity: e,
607
+ value: o,
608
+ onChange: i,
609
+ searchSize: "xl"
610
+ }
611
+ ) });
612
+ }
613
+ function Un({ filterEntity: e }) {
614
+ const n = k().getPlugin("filters"), r = n.useState(e.filterKey), o = te(r == null ? void 0 : r.value);
615
+ function i(l) {
616
+ l.length > 0 ? n.setState(e.filterKey, { value: l }) : n.removeState(e.filterKey);
617
+ }
618
+ return /* @__PURE__ */ s(X, { filterEntity: e, children: /* @__PURE__ */ s(
619
+ Be,
620
+ {
621
+ filterEntity: e,
622
+ value: o,
623
+ onChange: i,
624
+ searchSize: "m"
625
+ }
626
+ ) });
627
+ }
628
+ function Co(e) {
629
+ return {
630
+ id: e.id,
631
+ filterKey: e.filterKey ?? e.id,
632
+ label: e.label,
633
+ filterComponent: Un,
634
+ dialogFilterComponent: qn,
635
+ params: {
636
+ options: e.options,
637
+ mode: e.mode ?? "checkbox",
638
+ get search() {
639
+ return e.search ?? e.options.length > 10;
640
+ },
641
+ popover: e.popover
642
+ }
643
+ };
644
+ }
645
+ function Wn(e, t, n) {
646
+ if (!n)
647
+ return t;
648
+ const r = e.getNode(t);
649
+ if (!r)
650
+ return t;
651
+ if (typeof n == "function")
652
+ return n(r.item);
653
+ const o = r.item[n];
654
+ return typeof o == "string" || typeof o == "number" ? o : t;
655
+ }
656
+ const he = Symbol("tree-internal-context"), je = ft(null), Xn = je.Provider;
657
+ function qe() {
658
+ const e = pt(je);
659
+ if (!e)
660
+ throw new Error("useTree must be used within TreeProvider");
661
+ return e;
662
+ }
663
+ function Qn() {
664
+ return K().plugins.pluginContext;
665
+ }
666
+ function K() {
667
+ return qe()[he];
668
+ }
669
+ function j({
670
+ name: e,
671
+ ...t
672
+ }) {
673
+ const { layout: n } = K(), r = n.useSlots(e);
674
+ return r.length === 0 ? null : /* @__PURE__ */ s(P, { children: r.map((o) => {
675
+ const i = o.component;
676
+ return /* @__PURE__ */ s(i, { ...t }, o.id);
677
+ }) });
678
+ }
679
+ const En = "_treeMain_ayh6i_8", Jn = {
680
+ treeMain: En
681
+ };
682
+ function Ue({
683
+ node: e
684
+ }) {
685
+ var a;
686
+ const { settings: t, layout: n } = K(), o = (a = n.useSlots("label")[0]) == null ? void 0 : a.component, i = l();
687
+ if (o)
688
+ return /* @__PURE__ */ s(o, { item: e.item, label: i });
689
+ function l() {
690
+ return t.label ? typeof t.label == "string" ? String(e.item[t.label]) : t.label(e.item) : String(e.item.id);
691
+ }
692
+ return /* @__PURE__ */ s("span", { children: i });
693
+ }
694
+ const Yn = "_icon_1r7q3_1", Zn = "_iconExpanded_1r7q3_6", we = {
695
+ icon: Yn,
696
+ iconExpanded: Zn
697
+ };
698
+ function er({
699
+ node: e
700
+ }) {
701
+ const { settings: t, layout: n } = K(), r = n.useComponent("directory"), o = n.useLayoutStore((m) => m.expandedIds.has(e.id)), l = n.useSlots("icon").length > 0, f = n.useSlots("left").length > 0, h = g();
702
+ function g() {
703
+ if (!f)
704
+ return !1;
705
+ const { showInlineStart: m } = t;
706
+ return !m || m === "leaf" ? !1 : m === "directory" ? !0 : m(e.item);
707
+ }
708
+ function b() {
709
+ n.toggleExpanded(e.id);
710
+ }
711
+ const A = o ? O.tree.collapse : O.tree.expand, I = l ? /* @__PURE__ */ s(j, { name: "icon", item: e.item, expanded: o }) : /* @__PURE__ */ s("span", { className: o ? we.iconExpanded : we.icon, children: /* @__PURE__ */ s(at, {}) }), F = /* @__PURE__ */ w(P, { children: [
712
+ /* @__PURE__ */ s(
713
+ ue,
714
+ {
715
+ variant: "ghost",
716
+ size: "sm",
717
+ render: /* @__PURE__ */ s("span", {}),
718
+ nativeButton: !1,
719
+ "data-tree-node-click-ignore": !0,
720
+ tabIndex: -1,
721
+ onClick: b,
722
+ "aria-expanded": o,
723
+ "aria-label": A,
724
+ icon: I
725
+ }
726
+ ),
727
+ h && /* @__PURE__ */ s(j, { name: "left", item: e.item, node: e })
728
+ ] });
729
+ return (
730
+ // eslint-disable-next-line react-hooks/static-components -- DirectoryComponent comes from the tree's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
731
+ /* @__PURE__ */ s(r, { node: e, leftSlot: F, children: /* @__PURE__ */ s(Ue, { node: e }) })
732
+ );
733
+ }
734
+ function tr({
735
+ node: e
736
+ }) {
737
+ const { settings: t, layout: n } = K(), r = n.useComponent("leaf"), i = n.useSlots("left").length > 0, l = a();
738
+ function a() {
739
+ const { showInlineStart: f } = t;
740
+ return !f || f === "leaf" ? !0 : f === "directory" ? !1 : f(e.item);
741
+ }
742
+ return (
743
+ // eslint-disable-next-line react-hooks/static-components -- LeafComponent comes from the tree's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
744
+ /* @__PURE__ */ s(
745
+ r,
746
+ {
747
+ node: e,
748
+ leftSlot: i && l ? /* @__PURE__ */ s(j, { name: "left", item: e.item, node: e }) : void 0,
749
+ children: /* @__PURE__ */ s(Ue, { node: e })
750
+ }
751
+ )
752
+ );
753
+ }
754
+ const nr = "_treeNodeDirectory_ugt7q_1", rr = "_treeNodeDirectoryChildren_ugt7q_10", Ae = {
755
+ treeNodeDirectory: nr,
756
+ treeNodeDirectoryChildren: rr
757
+ };
758
+ function We({
759
+ nodes: e
760
+ }) {
761
+ const { layout: t } = K(), n = t.useLayoutStore((o) => o.filter), r = n ? e.filter((o) => n(o.item)) : e;
762
+ return /* @__PURE__ */ s(P, { children: r.map((o) => /* @__PURE__ */ s(or, { node: o }, o.id)) });
763
+ }
764
+ function or({
765
+ node: e
766
+ }) {
767
+ return e.isLeaf ? /* @__PURE__ */ s(tr, { node: e }) : /* @__PURE__ */ s(sr, { node: e });
768
+ }
769
+ function sr({
770
+ node: e
771
+ }) {
772
+ const { settings: t, layout: n } = K(), r = n.useComponent("placeholder"), o = n.useLayoutStore((g) => g.expandedIds.has(e.id)), i = t.treeStructure.current.useChildren(e.id), l = f(), a = h();
773
+ function f() {
774
+ return {
775
+ node: e,
776
+ item: e.item
777
+ };
778
+ }
779
+ function h() {
780
+ var b;
781
+ const g = (b = t.showDirectoryBottom) == null ? void 0 : b.call(t, e.item, l);
782
+ return g === "when_expanded" ? o : g !== !1;
783
+ }
784
+ return /* @__PURE__ */ w("div", { className: Ae.treeNodeDirectory, children: [
785
+ /* @__PURE__ */ s(er, { node: e }),
786
+ o && /* @__PURE__ */ s("div", { className: Ae.treeNodeDirectoryChildren, children: i.length > 0 ? /* @__PURE__ */ s(We, { nodes: i }) : (
787
+ // eslint-disable-next-line react-hooks/static-components -- PlaceholderComponent comes from the tree's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
788
+ /* @__PURE__ */ s(r, { parent: e.item })
789
+ ) }),
790
+ a && /* @__PURE__ */ s(j, { name: "directory-bottom", node: e })
791
+ ] });
792
+ }
793
+ function ir() {
794
+ const { settings: e, layout: t, focus: n } = K(), r = e.treeStructure.current.useRootNodes(), o = t.useComponent("placeholder");
795
+ return /* @__PURE__ */ w(
796
+ "div",
797
+ {
798
+ className: Jn.treeMain,
799
+ role: "tree",
800
+ "aria-label": e.ariaLabel,
801
+ "aria-labelledby": e.ariaLabelledBy,
802
+ onKeyDown: n.handleKeyDown,
803
+ children: [
804
+ /* @__PURE__ */ s(Mt, { open: !0, modal: !1, children: r.length > 0 ? /* @__PURE__ */ s(We, { nodes: r }) : (
805
+ // eslint-disable-next-line react-hooks/static-components -- PlaceholderComponent comes from the tree's component registry (a store lookup), so it is the same component on every render; the rule cannot see through the lookup.
806
+ /* @__PURE__ */ s(o, { parent: null })
807
+ ) }),
808
+ /* @__PURE__ */ s(j, { name: "bottom" })
809
+ ]
810
+ }
811
+ );
812
+ }
813
+ function lr() {
814
+ const e = qe(), t = e.treeStructure.current;
815
+ return $(() => (e.init(), () => e.destroy()), [e]), t ? /* @__PURE__ */ s(ir, {}) : null;
816
+ }
817
+ function le(e, t) {
818
+ const n = [];
819
+ return r(e.getRootNodes()), n;
820
+ function r(o) {
821
+ for (const i of o)
822
+ n.push(i), !i.isLeaf && t.has(i.id) && r(i.children);
823
+ }
824
+ }
825
+ function cr(e, t) {
826
+ const n = e.findIndex((r) => r.id === t);
827
+ return n === -1 || n === e.length - 1 ? null : e[n + 1];
828
+ }
829
+ function ar(e, t) {
830
+ const n = e.findIndex((r) => r.id === t);
831
+ return n <= 0 ? null : e[n - 1];
832
+ }
833
+ function ur(e) {
834
+ const { layout: t, settings: n } = e, r = z()(() => ({
835
+ focusedNodeId: null
836
+ })), o = {
837
+ setFocusedNode: i,
838
+ focusNode: l
839
+ };
840
+ return e.plugins.registerPublicApi(o), {
841
+ ...o,
842
+ useFocusStore: r,
843
+ handleKeyDown: a
844
+ };
845
+ function i(v) {
846
+ r.setState({ focusedNodeId: v });
847
+ }
848
+ function l(v) {
849
+ i(v);
850
+ }
851
+ function a(v) {
852
+ const { focusedNodeId: C } = r.getState();
853
+ if (!C) return;
854
+ const { key: p } = v;
855
+ let S = !1;
856
+ p === "ArrowDown" ? S = f() : p === "ArrowUp" ? S = h() : p === "ArrowRight" ? S = g() : p === "ArrowLeft" ? S = b() : p === "Home" ? S = A() : p === "End" ? S = I() : p === "Enter" && (S = F()), S && v.preventDefault();
857
+ }
858
+ function f() {
859
+ const { treeStructure: v, expandedIds: C, focusedNodeId: p } = m();
860
+ if (!p) return !1;
861
+ const S = le(v, C), u = cr(S, p);
862
+ return u ? (i(u.id), !0) : !1;
863
+ }
864
+ function h() {
865
+ const { treeStructure: v, expandedIds: C, focusedNodeId: p } = m();
866
+ if (!p) return !1;
867
+ const S = le(v, C), u = ar(S, p);
868
+ return u ? (i(u.id), !0) : !1;
869
+ }
870
+ function g() {
871
+ const { treeStructure: v, expandedIds: C, focusedNodeId: p } = m();
872
+ if (!p) return !1;
873
+ const S = v.getNode(p);
874
+ if (!S || S.isLeaf)
875
+ return !1;
876
+ if (!C.has(p))
877
+ return t.toggleExpanded(p, !0), !0;
878
+ const u = S.children[0];
879
+ return u ? (i(u.id), !0) : !1;
880
+ }
881
+ function b() {
882
+ const { treeStructure: v, expandedIds: C, focusedNodeId: p } = m();
883
+ if (!p) return !1;
884
+ const S = v.getNode(p);
885
+ return S ? !S.isLeaf && C.has(p) ? (t.toggleExpanded(p, !1), !0) : S.parent ? (i(S.parent.id), !0) : !1 : !1;
886
+ }
887
+ function A() {
888
+ const { treeStructure: v } = m(), C = v.getRootNodes()[0];
889
+ return C ? (i(C.id), !0) : !1;
890
+ }
891
+ function I() {
892
+ const { treeStructure: v, expandedIds: C } = m(), p = le(v, C), S = p[p.length - 1];
893
+ return S ? (i(S.id), !0) : !1;
894
+ }
895
+ function F() {
896
+ const { treeStructure: v, focusedNodeId: C } = m();
897
+ if (!C) return !1;
898
+ const p = v.getNode(C);
899
+ return p ? n.click ? (n.click({ id: p.id, item: p.item }), !0) : p.isLeaf ? !1 : (t.toggleExpanded(C), !0) : !1;
900
+ }
901
+ function m() {
902
+ const v = n.treeStructure.current, { expandedIds: C } = t.useLayoutStore.getState(), { focusedNodeId: p } = r.getState();
903
+ return { treeStructure: v, expandedIds: C, focusedNodeId: p };
904
+ }
905
+ }
906
+ function dr() {
907
+ const e = kt();
908
+ return {
909
+ hook: e.hook,
910
+ callHook: e.callHook,
911
+ callHookParallel: e.callHookParallel,
912
+ callHookSync: e.callHookSync
913
+ };
914
+ }
915
+ function ce(e) {
916
+ const t = [];
917
+ let n;
918
+ return {
919
+ registerComponent: o,
920
+ getStackedComponent: r
921
+ };
922
+ function r() {
923
+ return n ?? (n = t.reduceRight((i, l) => (a) => Ce(l, a, Ce(i, a)), e)), n;
924
+ }
925
+ function o(i) {
926
+ t.unshift(i), n = void 0;
927
+ }
928
+ }
929
+ const fr = "_treeActions_m77gm_1", pr = "_treeActionsAlways_m77gm_6", hr = "_treeActionsHover_m77gm_12", ae = {
930
+ treeActions: fr,
931
+ treeActionsAlways: pr,
932
+ treeActionsHover: hr
933
+ };
934
+ function mr({
935
+ node: e
936
+ }) {
937
+ const { settings: t } = K(), n = o(), r = i();
938
+ if (r === !1)
939
+ return null;
940
+ function o() {
941
+ return {
942
+ node: e,
943
+ item: e.item
944
+ };
945
+ }
946
+ function i() {
947
+ var a;
948
+ return ((a = t.showActions) == null ? void 0 : a.call(t, e.item, n)) ?? "when_hover";
949
+ }
950
+ return /* @__PURE__ */ s(
951
+ "div",
952
+ {
953
+ className: W(
954
+ ae.treeActions,
955
+ r === !0 ? ae.treeActionsAlways : ae.treeActionsHover
956
+ ),
957
+ "data-tree-node-click-ignore": !0,
958
+ children: /* @__PURE__ */ s(j, { name: "actions", item: e.item })
959
+ }
960
+ );
961
+ }
962
+ const gr = "_treeLeftSlot_88822_1", Sr = {
963
+ treeLeftSlot: gr
964
+ };
965
+ function Xe({ children: e }) {
966
+ return /* @__PURE__ */ s("div", { className: Sr.treeLeftSlot, children: e });
967
+ }
968
+ const vr = "_treeListItem_euazv_9", Cr = "_leaf_euazv_23", yr = "_label_euazv_44", Ir = "_ellipsis_euazv_49", J = {
969
+ treeListItem: vr,
970
+ leaf: Cr,
971
+ label: yr,
972
+ ellipsis: Ir
973
+ };
974
+ function xe({
975
+ node: e,
976
+ children: t,
977
+ className: n,
978
+ leftSlot: r
979
+ }) {
980
+ var M;
981
+ const { settings: o, layout: i, focus: l } = K(), a = Pe(null), f = i.useLayoutStore((x) => x.activeIds.has(e.id)), h = i.useLayoutStore((x) => x.activeIds), g = l.useFocusStore((x) => x.focusedNodeId), b = i.useLayoutStore((x) => x.expandedIds.has(e.id)), A = i.useLayoutStore(
982
+ (x) => {
983
+ var V;
984
+ return (((V = x.slots.get("actions")) == null ? void 0 : V.length) ?? 0) > 0;
985
+ }
986
+ ), I = o.treeStructure.current, F = I.getLevel(e.id), m = I.getSiblingCount(e.id), v = I.getSiblingPosition(e.id), C = e.id === ((M = I.getRootNodes()[0]) == null ? void 0 : M.id), p = g === e.id, S = L(), u = o.ellipsis ?? !0;
987
+ $(() => {
988
+ p && a.current && document.activeElement !== a.current && a.current.focus();
989
+ }, [p]);
990
+ function N(x) {
991
+ o.click && (x.target instanceof Element && x.target.closest("[data-tree-node-click-ignore]") || o.click({ id: e.id, item: e.item }));
992
+ }
993
+ function D() {
994
+ l.setFocusedNode(e.id);
995
+ }
996
+ function L() {
997
+ if (g !== null)
998
+ return p ? 0 : -1;
999
+ if (o.initialFocusedNodeId !== void 0)
1000
+ return e.id === o.initialFocusedNodeId ? 0 : -1;
1001
+ if (h.size > 0) {
1002
+ const x = Array.from(h)[0];
1003
+ return e.id === x ? 0 : -1;
1004
+ }
1005
+ return C ? 0 : -1;
1006
+ }
1007
+ return /* @__PURE__ */ w(
1008
+ ze,
1009
+ {
1010
+ ref: a,
1011
+ role: "treeitem",
1012
+ tabIndex: S,
1013
+ onClick: o.click ? N : void 0,
1014
+ onFocus: D,
1015
+ "aria-selected": f,
1016
+ "aria-expanded": e.isLeaf ? void 0 : b,
1017
+ "aria-level": F,
1018
+ "aria-setsize": m,
1019
+ "aria-posinset": v,
1020
+ "data-active": f || void 0,
1021
+ className: W(J.treeListItem, e.isLeaf && J.leaf, n),
1022
+ children: [
1023
+ r && /* @__PURE__ */ s(Xe, { children: r }),
1024
+ /* @__PURE__ */ s("span", { className: W(J.label, u && J.ellipsis), children: t }),
1025
+ A && /* @__PURE__ */ s(mr, { node: e })
1026
+ ]
1027
+ }
1028
+ );
1029
+ }
1030
+ const br = "_treePlaceholder_13ekq_6", _r = {
1031
+ treePlaceholder: br
1032
+ };
1033
+ function Nr({
1034
+ parent: e
1035
+ }) {
1036
+ var o;
1037
+ const { layout: t } = K(), r = (o = t.useSlots("placeholder")[0]) == null ? void 0 : o.component;
1038
+ return /* @__PURE__ */ w(ze, { disabled: !0, className: _r.treePlaceholder, children: [
1039
+ /* @__PURE__ */ s(Xe, {}),
1040
+ r ? /* @__PURE__ */ s(r, { parent: e }) : O.tree.noItems
1041
+ ] });
1042
+ }
1043
+ function wr(e) {
1044
+ const t = [], n = z()(() => ({
1045
+ slots: /* @__PURE__ */ new Map(),
1046
+ expandedIds: /* @__PURE__ */ new Set(),
1047
+ activeIds: /* @__PURE__ */ new Set()
1048
+ })), r = z(() => ({
1049
+ leaf: ce(xe),
1050
+ directory: ce(xe),
1051
+ placeholder: ce(Nr)
1052
+ })), o = {
1053
+ registerSlot: f,
1054
+ registerComponent: F,
1055
+ toggleExpanded: g,
1056
+ toggleActive: b,
1057
+ clearActive: A,
1058
+ setFilter: I
1059
+ };
1060
+ return e.plugins.registerPublicApi(o), {
1061
+ ...o,
1062
+ useLayoutStore: n,
1063
+ useSlots: l,
1064
+ useComponent: a
1065
+ };
1066
+ function i(m) {
1067
+ return n.getState().slots.get(m) ?? t;
1068
+ }
1069
+ function l(m) {
1070
+ return n(
1071
+ U(
1072
+ (v) => v.slots.get(m) ?? t
1073
+ )
1074
+ );
1075
+ }
1076
+ function a(m) {
1077
+ return r(() => r.getState()[m].getStackedComponent());
1078
+ }
1079
+ function f(m, v) {
1080
+ const C = Math.random().toString(), p = i(m), S = (p.length + 1) * 10, u = { id: C, name: m, ...v, order: S }, N = [...p, u];
1081
+ return n.setState((D) => {
1082
+ const L = new Map(D.slots);
1083
+ return L.set(m, N), { slots: L };
1084
+ }), () => h(m, C);
1085
+ }
1086
+ function h(m, v) {
1087
+ const C = i(m);
1088
+ if (!C.length) return;
1089
+ const p = C.filter((S) => S.id !== v);
1090
+ n.setState((S) => {
1091
+ const u = new Map(S.slots);
1092
+ return p.length ? u.set(m, p) : u.delete(m), { slots: u };
1093
+ });
1094
+ }
1095
+ function g(m, v) {
1096
+ n.setState((C) => {
1097
+ const p = C.expandedIds.has(m), S = v ?? !p, u = new Set(C.expandedIds);
1098
+ return S !== p && (S ? u.add(m) : u.delete(m)), { expandedIds: u };
1099
+ });
1100
+ }
1101
+ function b(m, v) {
1102
+ n.setState((C) => {
1103
+ const p = C.activeIds.has(m), S = v ?? !p, u = new Set(C.activeIds);
1104
+ return S !== p && (S ? u.add(m) : u.delete(m)), { activeIds: u };
1105
+ });
1106
+ }
1107
+ function A() {
1108
+ n.setState({ activeIds: /* @__PURE__ */ new Set() });
1109
+ }
1110
+ function I(m) {
1111
+ n.setState({
1112
+ filter: m
1113
+ });
1114
+ }
1115
+ function F(m, v) {
1116
+ r.getState()[m].registerComponent(v);
1117
+ }
1118
+ }
1119
+ function Ar(e) {
1120
+ const t = /* @__PURE__ */ new Map(), n = {
1121
+ hook: e.hooked.hook,
1122
+ getPlugin: a
1123
+ }, r = { ...n };
1124
+ return {
1125
+ ...n,
1126
+ registerPlugin: i,
1127
+ registerPlugins: l,
1128
+ registerPublicApi: o,
1129
+ pluginContext: r
1130
+ };
1131
+ function o(f) {
1132
+ Object.assign(r, f);
1133
+ }
1134
+ function i(f) {
1135
+ if (t.has(f.name)) {
1136
+ console.warn(
1137
+ `[DataGridTree] Plugin "${f.name}" is already registered — skipping duplicate registration.`
1138
+ );
1139
+ return;
1140
+ }
1141
+ const h = f.setup(r);
1142
+ h !== void 0 && t.set(f.name, h);
1143
+ }
1144
+ function l(f) {
1145
+ f.forEach((h) => i(h));
1146
+ }
1147
+ function a(f) {
1148
+ return t.get(f);
1149
+ }
1150
+ }
1151
+ function xr(e, t) {
1152
+ const n = {
1153
+ ...t
1154
+ }, r = {
1155
+ settings: n,
1156
+ treeStructure: t.treeStructure
1157
+ };
1158
+ return e.plugins.registerPublicApi(r), n;
1159
+ }
1160
+ function Fr(e) {
1161
+ const t = dr(), n = {}, r = {
1162
+ hooked: t,
1163
+ get plugins() {
1164
+ return Y(n.plugins, "plugins");
1165
+ },
1166
+ get layout() {
1167
+ return Y(n.layout, "layout");
1168
+ },
1169
+ get settings() {
1170
+ return Y(n.settings, "settings");
1171
+ },
1172
+ get focus() {
1173
+ return Y(n.focus, "focus");
1174
+ }
1175
+ };
1176
+ return n.plugins = Ar(r), n.settings = xr(r, e), n.layout = wr(r), n.focus = ur(r), {
1177
+ init: i,
1178
+ destroy: o,
1179
+ ...r.plugins.pluginContext,
1180
+ [he]: r
1181
+ };
1182
+ function o() {
1183
+ t.callHookSync("destroy");
1184
+ }
1185
+ async function i() {
1186
+ await t.callHook("init");
1187
+ }
1188
+ }
1189
+ function Y(e, t) {
1190
+ if (e === void 0)
1191
+ throw new Error(`[DataGridTree] The ${t} service was used before it was created.`);
1192
+ return e;
1193
+ }
1194
+ function Dr({
1195
+ name: e,
1196
+ treeStructure: t,
1197
+ children: n,
1198
+ ...r
1199
+ }) {
1200
+ const o = Tt(t), [i] = T(
1201
+ () => Fr({
1202
+ ...r,
1203
+ name: e,
1204
+ treeStructure: o
1205
+ })
1206
+ );
1207
+ return $(() => {
1208
+ i[he].layout.setFilter(r.filter);
1209
+ }, [i, r.filter]), /* @__PURE__ */ w(Xn, { value: i, children: [
1210
+ n,
1211
+ /* @__PURE__ */ s(lr, {})
1212
+ ] });
1213
+ }
1214
+ function Lr(e, t, n) {
1215
+ return ht(function(o) {
1216
+ const i = K(), [l] = T(() => {
1217
+ const a = t(i.plugins.pluginContext);
1218
+ return i.plugins.registerPlugin({
1219
+ name: e,
1220
+ setup: () => a
1221
+ }), a;
1222
+ });
1223
+ return $(() => {
1224
+ var a;
1225
+ (a = l.onPropsChange) == null || a.call(l, o);
1226
+ }, [l, o]), null;
1227
+ }, n);
1228
+ }
1229
+ const kr = "_radioGroup_1l2s1_7", Tr = "_text_1l2s1_14", Fe = {
1230
+ radioGroup: kr,
1231
+ text: Tr
1232
+ }, De = "selected";
1233
+ function Pr({
1234
+ item: e,
1235
+ label: t
1236
+ }) {
1237
+ const r = Qn().getPlugin("radioSelect"), o = e.id, l = r.useSelectedId() === o;
1238
+ function a() {
1239
+ (typeof o == "string" || typeof o == "number") && r.select(o);
1240
+ }
1241
+ return /* @__PURE__ */ w(Oe, { children: [
1242
+ /* @__PURE__ */ s(
1243
+ Ot,
1244
+ {
1245
+ className: Fe.radioGroup,
1246
+ value: l ? De : "",
1247
+ onValueChange: a,
1248
+ children: /* @__PURE__ */ s(zt, { value: De, "data-tree-node-click-ignore": "" })
1249
+ }
1250
+ ),
1251
+ /* @__PURE__ */ s("span", { className: Fe.text, children: t })
1252
+ ] });
1253
+ }
1254
+ const Kr = Lr("radioSelect", (e) => {
1255
+ let t = {};
1256
+ const n = z(() => ({
1257
+ selectedId: void 0
1258
+ }));
1259
+ return e.registerSlot("label", {
1260
+ component: Pr
1261
+ }), {
1262
+ useSelectedId: () => n((l) => l.selectedId),
1263
+ select: i,
1264
+ onPropsChange: o
1265
+ };
1266
+ function o(l) {
1267
+ t = l, l.value !== void 0 && n.setState({ selectedId: l.value });
1268
+ }
1269
+ function i(l) {
1270
+ var a;
1271
+ n.setState({ selectedId: l }), (a = t.onChange) == null || a.call(t, l);
1272
+ }
1273
+ });
1274
+ function Mr(e, t) {
1275
+ const [n, r] = T(""), [o, i] = T(""), l = Te(
1276
+ () => Ke((h) => i(h), 300),
1277
+ []
1278
+ );
1279
+ $(() => (l(n), () => l.cancel()), [n, l]);
1280
+ let a = null;
1281
+ if (o.trim()) {
1282
+ const h = o.toLowerCase(), g = /* @__PURE__ */ new Set();
1283
+ e.forEach((b) => {
1284
+ t(b.item).toLowerCase().includes(h) && g.add(b.id);
1285
+ }), a = g;
1286
+ }
1287
+ function f(h) {
1288
+ if (!a) return !0;
1289
+ const g = h.id;
1290
+ if (typeof g != "string" && typeof g != "number") return !1;
1291
+ if (a.has(g)) return !0;
1292
+ for (const b of a)
1293
+ if (e.isDescendantOf(b, g) || e.isDescendantOf(g, b))
1294
+ return !0;
1295
+ return !1;
1296
+ }
1297
+ return {
1298
+ searchTerm: n,
1299
+ setSearchTerm: r,
1300
+ matchingItemIds: a,
1301
+ filter: f
1302
+ };
1303
+ }
1304
+ function Qe({ filterEntity: e, value: t, onChange: n, searchSize: r }) {
1305
+ const { tree: o, treeLabel: i, search: l } = e.params, a = (b) => Kn(b, i), { searchTerm: f, setSearchTerm: h, filter: g } = Mr(o, a);
1306
+ return /* @__PURE__ */ w(P, { children: [
1307
+ l && /* @__PURE__ */ s(ne, { size: r, children: /* @__PURE__ */ s(re, { value: f, onValueChange: h }) }),
1308
+ /* @__PURE__ */ s(oe, { children: /* @__PURE__ */ s(
1309
+ Dr,
1310
+ {
1311
+ name: `filter-tree-${e.filterKey}`,
1312
+ treeStructure: o,
1313
+ label: i,
1314
+ ellipsis: !1,
1315
+ filter: g,
1316
+ children: /* @__PURE__ */ s(Kr, { value: t, onChange: n, name: e.filterKey })
1317
+ }
1318
+ ) })
1319
+ ] });
1320
+ }
1321
+ function Or({ filterEntity: e }) {
1322
+ const n = k().getPlugin("filters"), r = n.useDraftState(e.filterKey), o = r == null ? void 0 : r.value;
1323
+ function i(l) {
1324
+ n.setDraftState(e.filterKey, { value: l });
1325
+ }
1326
+ return /* @__PURE__ */ s(ee, { filterEntity: e, children: /* @__PURE__ */ s(Qe, { filterEntity: e, value: o, onChange: i, searchSize: "xl" }) });
1327
+ }
1328
+ function zr({ filterEntity: e }) {
1329
+ const n = k().getPlugin("filters"), r = n.useState(e.filterKey), o = r == null ? void 0 : r.value;
1330
+ function i(l) {
1331
+ n.setState(e.filterKey, { value: l });
1332
+ }
1333
+ return /* @__PURE__ */ s(X, { filterEntity: e, children: /* @__PURE__ */ s(Qe, { filterEntity: e, value: o, onChange: i, searchSize: "m" }) });
1334
+ }
1335
+ function yo(e) {
1336
+ return {
1337
+ id: e.id,
1338
+ filterKey: e.filterKey ?? e.id,
1339
+ label: e.label,
1340
+ filterComponent: zr,
1341
+ dialogFilterComponent: Or,
1342
+ params: {
1343
+ tree: e.tree,
1344
+ treeLabel: e.treeLabel,
1345
+ get search() {
1346
+ return e.search ?? e.tree.getNodes().length > 5;
1347
+ },
1348
+ popover: e.popover
1349
+ },
1350
+ resolveLoadValue: e.filterValue ? (t) => ({
1351
+ value: Wn(e.tree, t.value, e.filterValue)
1352
+ }) : void 0
1353
+ };
1354
+ }
1355
+ const $r = "yyyy-MM-dd";
1356
+ function Ee(e) {
1357
+ return !e.from && !e.to;
1358
+ }
1359
+ function Le(e, t) {
1360
+ if (typeof e != "string" || e === "") return null;
1361
+ const n = $t(e, t, /* @__PURE__ */ new Date());
1362
+ return Rt(n) ? n : null;
1363
+ }
1364
+ function ke(e, t) {
1365
+ return Gt(Vt(e, { hours: 12, minutes: 0, seconds: 0 }), t);
1366
+ }
1367
+ function Rr({ from: e, to: t }, n) {
1368
+ return !e || t ? { from: n, to: null } : Ht(ye(n), ye(e)) ? { from: n, to: e } : { from: e, to: n };
1369
+ }
1370
+ const Gr = 1;
1371
+ function Je({ value: e, onChange: t, modelDateFormat: n }) {
1372
+ const r = n ?? $r, o = Le(e.from, r), i = Le(e.to, r), [l, a] = T(() => o ?? /* @__PURE__ */ new Date());
1373
+ function f(h) {
1374
+ const g = Rr({ from: o, to: i }, h);
1375
+ t({
1376
+ from: g.from ? ke(g.from, r) : void 0,
1377
+ to: g.to ? ke(g.to, r) : void 0
1378
+ });
1379
+ }
1380
+ return /* @__PURE__ */ s(
1381
+ Bt,
1382
+ {
1383
+ mode: "range",
1384
+ selected: o ? { from: o, to: i ?? void 0 } : void 0,
1385
+ month: l,
1386
+ onMonthChange: a,
1387
+ onSelect: (h, g) => f(g),
1388
+ weekStartsOn: Gr
1389
+ }
1390
+ );
1391
+ }
1392
+ function Vr({ filterEntity: e }) {
1393
+ const n = k().getPlugin("filters"), r = n.useDraftState(e.filterKey), o = (r == null ? void 0 : r.value) ?? {};
1394
+ function i(l) {
1395
+ n.setDraftState(e.filterKey, {
1396
+ value: Ee(l) ? void 0 : l
1397
+ });
1398
+ }
1399
+ return /* @__PURE__ */ s(ee, { filterEntity: e, children: /* @__PURE__ */ s(
1400
+ Je,
1401
+ {
1402
+ value: o,
1403
+ onChange: i,
1404
+ modelDateFormat: e.params.modelDateFormat
1405
+ }
1406
+ ) });
1407
+ }
1408
+ function Hr({ filterEntity: e }) {
1409
+ const n = k().getPlugin("filters"), r = n.useState(e.filterKey), o = (r == null ? void 0 : r.value) ?? {};
1410
+ function i(l) {
1411
+ Ee(l) ? n.removeState(e.filterKey) : n.setState(e.filterKey, { value: l });
1412
+ }
1413
+ return /* @__PURE__ */ s(X, { filterEntity: e, children: /* @__PURE__ */ s(
1414
+ Je,
1415
+ {
1416
+ value: o,
1417
+ onChange: i,
1418
+ modelDateFormat: e.params.modelDateFormat
1419
+ }
1420
+ ) });
1421
+ }
1422
+ function Io(e) {
1423
+ return {
1424
+ id: e.id,
1425
+ filterKey: e.filterKey ?? e.id,
1426
+ label: e.label,
1427
+ filterComponent: Hr,
1428
+ dialogFilterComponent: Vr,
1429
+ params: {
1430
+ modelDateFormat: e.modelDateFormat,
1431
+ // Passed straight through, like every sibling entity: the popover's
1432
+ // `min-inline-size` is a floor and the popup is shrink-to-fit, so the calendar's
1433
+ // own 272px minimum already sizes the popover.
1434
+ popover: e.popover
1435
+ }
1436
+ };
1437
+ }
1438
+ function Br(e) {
1439
+ const t = z(() => ({
1440
+ nodeMap: /* @__PURE__ */ new Map(),
1441
+ childrenMap: /* @__PURE__ */ new Map()
1442
+ }));
1443
+ return e.items && N(e.items), {
1444
+ setItems: N,
1445
+ move: u,
1446
+ forEach: tt,
1447
+ eachNode: ve,
1448
+ getNode: C,
1449
+ getChildren: H,
1450
+ getRootNodes: F,
1451
+ getNodes: m,
1452
+ getLevel: Se,
1453
+ getSiblingCount: Ze,
1454
+ getSiblingPosition: et,
1455
+ isDescendantOf: S,
1456
+ useRootNodes: () => t(U(() => F())),
1457
+ useNodes: () => t(U(() => m())),
1458
+ useNodesCount: () => t(() => v()),
1459
+ useNode: (c) => t(() => C(c)),
1460
+ useHasNode: (c) => t(() => me(c)),
1461
+ useChildren: (c) => t(U(() => H(c))),
1462
+ useNodePath: (c) => t(U(() => ge(c))),
1463
+ useNodeLevel: (c) => t(() => Se(c)),
1464
+ useNodeIndex: (c) => t(() => Ye(c)),
1465
+ useIsLeaf: (c) => t(() => p(c)),
1466
+ useIsDescendantOf: (c, d) => t(() => S(c, d))
1467
+ };
1468
+ function F() {
1469
+ return H(null);
1470
+ }
1471
+ function m() {
1472
+ const { nodeMap: c } = t.getState();
1473
+ return Array.from(c.values());
1474
+ }
1475
+ function v() {
1476
+ const { nodeMap: c } = t.getState();
1477
+ return c.size;
1478
+ }
1479
+ function C(c) {
1480
+ const { nodeMap: d } = t.getState();
1481
+ return d.get(c);
1482
+ }
1483
+ function p(c) {
1484
+ return q(c).isLeaf;
1485
+ }
1486
+ function S(c, d) {
1487
+ if (!me(c)) return !1;
1488
+ let y = q(c);
1489
+ for (; y.parentId !== null; ) {
1490
+ if (y.parentId === d)
1491
+ return !0;
1492
+ y = q(y.parentId);
1493
+ }
1494
+ return !1;
1495
+ }
1496
+ function u(c) {
1497
+ const d = t.getState(), y = d.nodeMap.get(c.id);
1498
+ if (!y)
1499
+ throw new Error(`Node with id "${c.id}" not found`);
1500
+ if (c.parentId !== null && (c.parentId === c.id || S(c.parentId, c.id)))
1501
+ throw new Error(`Node with id "${c.id}" cannot move under itself or its descendant "${c.parentId}"`);
1502
+ const _ = new Map(d.childrenMap), B = _.get(y.parentId);
1503
+ if (B) {
1504
+ const Q = B.filter((nt) => nt.id !== c.id);
1505
+ _.set(y.parentId, Q);
1506
+ }
1507
+ const R = [..._.get(c.parentId) ?? []], G = c.position ?? R.length;
1508
+ y.parentId = c.parentId, y.parent = c.parentId === null ? null : d.nodeMap.get(c.parentId) ?? null, R.splice(G, 0, y), _.set(c.parentId, R);
1509
+ for (const Q of d.nodeMap.values())
1510
+ Q.children = _.get(Q.id) ?? [];
1511
+ t.setState({
1512
+ nodeMap: new Map(d.nodeMap),
1513
+ childrenMap: _
1514
+ });
1515
+ }
1516
+ function N(c) {
1517
+ const d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
1518
+ if (e.childrenKey)
1519
+ for (const [_, B, R] of D(c)) {
1520
+ const G = L(_, B, R);
1521
+ d.set(G.id, G);
1522
+ }
1523
+ else
1524
+ for (const _ of c) {
1525
+ const B = M(_), R = V(_), G = L(B, R, _);
1526
+ d.set(G.id, G);
1527
+ }
1528
+ for (const _ of d.values())
1529
+ y.set(_.parentId, [...y.get(_.parentId) ?? [], _]);
1530
+ for (const _ of d.values())
1531
+ _.parent = _.parentId === null ? null : d.get(_.parentId) ?? null, _.children = y.get(_.id) ?? [];
1532
+ t.setState({
1533
+ nodeMap: d,
1534
+ childrenMap: y
1535
+ });
1536
+ }
1537
+ function* D(c, d = null) {
1538
+ for (const y of c) {
1539
+ const _ = M(y);
1540
+ yield [_, d, y], yield* D(x(y), _);
1541
+ }
1542
+ }
1543
+ function L(c, d, y) {
1544
+ return {
1545
+ id: c,
1546
+ item: y,
1547
+ parentId: d,
1548
+ isLeaf: e.isLeaf ? e.isLeaf(y) : !1,
1549
+ parent: null,
1550
+ // Will be set later
1551
+ children: []
1552
+ // Will be set later
1553
+ };
1554
+ }
1555
+ function M(c) {
1556
+ const { itemKey: d = "id" } = e;
1557
+ if (typeof d == "function")
1558
+ return d(c);
1559
+ if (!(d in c))
1560
+ throw new Error(`Key "${d}" not found in item ${JSON.stringify(c)}`);
1561
+ return c[d];
1562
+ }
1563
+ function x(c) {
1564
+ return e.childrenKey ? typeof e.childrenKey == "function" ? (e.childrenKey(c) ?? []).filter((d) => d != null) : (c[e.childrenKey] ?? []).filter((d) => d != null) : [];
1565
+ }
1566
+ function V(c) {
1567
+ const { parentKey: d = "parent_id" } = e;
1568
+ return typeof d == "function" ? d(c) ?? null : d == null ? null : c[d] ?? null;
1569
+ }
1570
+ function me(c) {
1571
+ const { nodeMap: d } = t.getState();
1572
+ return d.has(c);
1573
+ }
1574
+ function q(c) {
1575
+ const { nodeMap: d } = t.getState(), y = d.get(c);
1576
+ if (!y)
1577
+ throw new Error(`Node with id "${c}" not found`);
1578
+ return y;
1579
+ }
1580
+ function Ye(c) {
1581
+ const d = q(c);
1582
+ return H(d.parentId).findIndex((y) => y.id === c);
1583
+ }
1584
+ function ge(c) {
1585
+ const d = q(c), y = [];
1586
+ let _ = d;
1587
+ for (; _; )
1588
+ y.unshift(_), _ = _.parent;
1589
+ return y;
1590
+ }
1591
+ function Se(c) {
1592
+ return ge(c).length;
1593
+ }
1594
+ function Ze(c) {
1595
+ const d = C(c);
1596
+ return d ? H(d.parentId).length : 1;
1597
+ }
1598
+ function et(c) {
1599
+ const d = C(c);
1600
+ return d ? H(d.parentId).findIndex((y) => y.id === c) + 1 : 1;
1601
+ }
1602
+ function H(c) {
1603
+ const { childrenMap: d } = t.getState();
1604
+ return d.get(c) ?? [];
1605
+ }
1606
+ function tt(c) {
1607
+ for (const d of ve())
1608
+ c(d);
1609
+ }
1610
+ function* ve() {
1611
+ const c = [...F()].reverse();
1612
+ for (; c.length > 0; ) {
1613
+ const d = c.pop();
1614
+ yield d, c.push(...[...d.children].reverse());
1615
+ }
1616
+ }
1617
+ }
1618
+ function bo(e) {
1619
+ const [t] = T(() => Br(e));
1620
+ return t;
1621
+ }
1622
+ export {
1623
+ mo as DataGridFiltersPlugin,
1624
+ Br as createDataGridTreeStructure,
1625
+ vo as filterCheckboxGroup,
1626
+ Io as filterDateRange,
1627
+ go as filterSearch,
1628
+ Co as filterTagGroup,
1629
+ So as filterToggle,
1630
+ yo as filterTree,
1631
+ bo as useDataGridTreeStructure
1632
+ };
1633
+ //# sourceMappingURL=filters.js.map