@addsign/moje-agenda-shared-lib 1.0.60 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/Dialog-DZMfjbGC.js +421 -0
  2. package/dist/Dialog-DZMfjbGC.js.map +1 -0
  3. package/dist/assets/style.css +4369 -0
  4. package/dist/assets/tailwind.css +1365 -1193
  5. package/dist/check-B7dJm08z.js +12 -0
  6. package/dist/check-B7dJm08z.js.map +1 -0
  7. package/dist/components/Button.js +1 -1
  8. package/dist/components/datatable/DataTable.js +6 -2
  9. package/dist/components/datatable/DataTable.js.map +1 -1
  10. package/dist/components/datatable/DataTableServer.js +6 -2
  11. package/dist/components/datatable/DataTableServer.js.map +1 -1
  12. package/dist/components/form/AutocompleteSearchBar.js +6 -2
  13. package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
  14. package/dist/components/form/AutocompleteSearchBarServer.js +6 -2
  15. package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
  16. package/dist/components/form/FileInput.js +7 -3
  17. package/dist/components/form/FileInput.js.map +1 -1
  18. package/dist/components/form/FileInputMultiple.js +7 -3
  19. package/dist/components/form/FileInputMultiple.js.map +1 -1
  20. package/dist/components/form/FormField.js +6 -2
  21. package/dist/components/form/FormField.js.map +1 -1
  22. package/dist/components/form/PositionsSelectorSingle.js +6 -2
  23. package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
  24. package/dist/components/form/SelectField.js +6 -2
  25. package/dist/components/form/SelectField.js.map +1 -1
  26. package/dist/components/profiles/ProfileOverview.js +6 -2
  27. package/dist/components/profiles/ProfileOverview.js.map +1 -1
  28. package/dist/components/ui/Combobox.d.ts +1 -0
  29. package/dist/components/ui/Combobox.js +138 -0
  30. package/dist/components/ui/Combobox.js.map +1 -0
  31. package/dist/components/ui/DateTimePicker.js +19 -5
  32. package/dist/components/ui/DateTimePicker.js.map +1 -1
  33. package/dist/components/ui/Dialog.js +15 -413
  34. package/dist/components/ui/Dialog.js.map +1 -1
  35. package/dist/components/ui/ScrollArea.js +2 -1
  36. package/dist/components/ui/ScrollArea.js.map +1 -1
  37. package/dist/components/ui/command.d.ts +80 -0
  38. package/dist/components/ui/command.js +643 -0
  39. package/dist/components/ui/command.js.map +1 -0
  40. package/dist/components/ui/datepicker.js +14 -1
  41. package/dist/components/ui/datepicker.js.map +1 -1
  42. package/dist/components/ui/popover.js +3 -2
  43. package/dist/components/ui/popover.js.map +1 -1
  44. package/dist/components/ui/radioGroup.d.ts +5 -0
  45. package/dist/components/ui/radioGroup.js +586 -0
  46. package/dist/components/ui/radioGroup.js.map +1 -0
  47. package/dist/components/ui/select.js +9 -144
  48. package/dist/components/ui/select.js.map +1 -1
  49. package/dist/index-BXrwe-_7.js +1395 -0
  50. package/dist/index-BXrwe-_7.js.map +1 -0
  51. package/dist/index-Bk8dRTPE.js +11 -0
  52. package/dist/index-Bk8dRTPE.js.map +1 -0
  53. package/dist/index-BlzC-wss.js +140 -0
  54. package/dist/index-BlzC-wss.js.map +1 -0
  55. package/dist/index-Bp9GiUkg.js +2266 -0
  56. package/dist/index-Bp9GiUkg.js.map +1 -0
  57. package/dist/index-BzVVosDl.js +57 -0
  58. package/dist/index-BzVVosDl.js.map +1 -0
  59. package/dist/index-CbAQSs_C.js +40 -0
  60. package/dist/index-CbAQSs_C.js.map +1 -0
  61. package/dist/index-Dz_fWpFA.js +2203 -0
  62. package/dist/index-Dz_fWpFA.js.map +1 -0
  63. package/dist/index-IXOTxK3N.js +7 -0
  64. package/dist/index-IXOTxK3N.js.map +1 -0
  65. package/dist/main.d.ts +3 -0
  66. package/dist/main.js +29 -12
  67. package/dist/main.js.map +1 -1
  68. package/dist/parse-D2yb8751.js +1727 -0
  69. package/dist/parse-D2yb8751.js.map +1 -0
  70. package/dist/tailwind-l0sNRNKZ.js +2 -0
  71. package/dist/tailwind-l0sNRNKZ.js.map +1 -0
  72. package/lib/components/Button.tsx +57 -0
  73. package/lib/components/Calendar.tsx +242 -0
  74. package/lib/components/ConfirmationModalDialog.tsx +115 -0
  75. package/lib/components/Modal.tsx +73 -0
  76. package/lib/components/ModalDialog.tsx +63 -0
  77. package/lib/components/Spinner.tsx +25 -0
  78. package/lib/components/SpinnerIcon.tsx +12 -0
  79. package/lib/components/datatable/DataTable.tsx +442 -0
  80. package/lib/components/datatable/DataTableServer.tsx +939 -0
  81. package/lib/components/datatable/DatatableSettings.tsx +48 -0
  82. package/lib/components/datatable/Resizable.tsx +99 -0
  83. package/lib/components/datatable/types.ts +33 -0
  84. package/lib/components/form/AutocompleteSearchBar.tsx +424 -0
  85. package/lib/components/form/AutocompleteSearchBarServer.tsx +257 -0
  86. package/lib/components/form/DateField.tsx +124 -0
  87. package/lib/components/form/DateRangeField.tsx +116 -0
  88. package/lib/components/form/FileInput.tsx +188 -0
  89. package/lib/components/form/FileInputMultiple.tsx +186 -0
  90. package/lib/components/form/FormField.tsx +371 -0
  91. package/lib/components/form/InputField.tsx +230 -0
  92. package/lib/components/form/PositionsSelectorSingle.tsx +266 -0
  93. package/lib/components/form/RadioGroup.tsx +64 -0
  94. package/lib/components/form/SelectField.tsx +267 -0
  95. package/lib/components/layout/IconInCircle.tsx +29 -0
  96. package/lib/components/layout/PageTitle.tsx +19 -0
  97. package/lib/components/layout/SectionTitle.tsx +22 -0
  98. package/lib/components/profiles/ProfileOverview.tsx +212 -0
  99. package/lib/components/ui/Calendar.tsx +68 -0
  100. package/lib/components/ui/Combobox.tsx +122 -0
  101. package/lib/components/ui/DatePicker.tsx +124 -0
  102. package/lib/components/ui/DateTimePicker.tsx +187 -0
  103. package/lib/components/ui/Dialog.tsx +118 -0
  104. package/lib/components/ui/ScrollArea.tsx +45 -0
  105. package/lib/components/ui/button.tsx +56 -0
  106. package/lib/components/ui/command.tsx +153 -0
  107. package/lib/components/ui/form.tsx +177 -0
  108. package/lib/components/ui/input.tsx +22 -0
  109. package/lib/components/ui/label.tsx +24 -0
  110. package/lib/components/ui/popover.tsx +31 -0
  111. package/lib/components/ui/radioGroup.tsx +44 -0
  112. package/lib/components/ui/select.tsx +158 -0
  113. package/lib/contexts/FederationContext.tsx +28 -0
  114. package/lib/contexts/useFederationContext.ts +4 -0
  115. package/lib/css/tailwind.css +10 -0
  116. package/lib/fonts/arial.ts +3 -0
  117. package/lib/fonts/arialBold.ts +4 -0
  118. package/lib/main.ts +64 -0
  119. package/lib/types.ts +492 -0
  120. package/lib/utils/PdfManager.ts +224 -0
  121. package/lib/utils/getFullName.tsx +83 -0
  122. package/lib/utils/getIntersectingDays.ts +28 -0
  123. package/lib/utils/handleErrors.ts +28 -0
  124. package/lib/utils/hasRightInModule.ts +17 -0
  125. package/lib/utils/hasRole.ts +12 -0
  126. package/lib/utils/utils.ts +6 -0
  127. package/lib/vite-env.d.ts +1 -0
  128. package/package.json +5 -2
@@ -0,0 +1,643 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import React__default from "react";
4
+ import { R as Root, P as Portal, O as Overlay, C as Content, D as Dialog, e as DialogContent } from "../../Dialog-DZMfjbGC.js";
5
+ import { P as Primitive } from "../../index-DvR8HKPa.js";
6
+ import { a as useId } from "../../index-BzVVosDl.js";
7
+ import { cn } from "../../utils/utils.js";
8
+ import { c as createLucideIcon } from "../../createLucideIcon-KSoQd4Wi.js";
9
+ /**
10
+ * @license lucide-react v0.456.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */
15
+ const Search = createLucideIcon("Search", [
16
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
17
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
18
+ ]);
19
+ var U = 1, Y$1 = 0.9, H = 0.8, J = 0.17, p = 0.1, u = 0.999, $ = 0.9999;
20
+ var k$1 = 0.99, m = /[\\\/_+.#"@\[\(\{&]/, B = /[\\\/_+.#"@\[\(\{&]/g, K$1 = /[\s-]/, X = /[\s-]/g;
21
+ function G$1(_, C, h, P, A, f, O) {
22
+ if (f === C.length)
23
+ return A === _.length ? U : k$1;
24
+ var T2 = `${A},${f}`;
25
+ if (O[T2] !== void 0)
26
+ return O[T2];
27
+ for (var L = P.charAt(f), c = h.indexOf(L, A), S = 0, E, N2, R, M2; c >= 0; )
28
+ E = G$1(_, C, h, P, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B), R && A > 0 && (E *= Math.pow(u, R.length))) : K$1.test(_.charAt(c - 1)) ? (E *= Y$1, M2 = _.slice(A, c - 1).match(X), M2 && A > 0 && (E *= Math.pow(u, M2.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P.charAt(f + 1) || P.charAt(f + 1) === P.charAt(f) && h.charAt(c - 1) !== P.charAt(f)) && (N2 = G$1(_, C, h, P, c + 1, f + 2, O), N2 * p > E && (E = N2 * p)), E > S && (S = E), c = h.indexOf(L, c + 1);
29
+ return O[T2] = S, S;
30
+ }
31
+ function D(_) {
32
+ return _.toLowerCase().replace(X, " ");
33
+ }
34
+ function W(_, C, h) {
35
+ return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G$1(_, C, D(_), D(C), 0, 0, {});
36
+ }
37
+ var shim = { exports: {} };
38
+ var useSyncExternalStoreShim_production_min = {};
39
+ /**
40
+ * @license React
41
+ * use-sync-external-store-shim.production.min.js
42
+ *
43
+ * Copyright (c) Facebook, Inc. and its affiliates.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE file in the root directory of this source tree.
47
+ */
48
+ var hasRequiredUseSyncExternalStoreShim_production_min;
49
+ function requireUseSyncExternalStoreShim_production_min() {
50
+ if (hasRequiredUseSyncExternalStoreShim_production_min)
51
+ return useSyncExternalStoreShim_production_min;
52
+ hasRequiredUseSyncExternalStoreShim_production_min = 1;
53
+ var e = React__default;
54
+ function h(a, b) {
55
+ return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
56
+ }
57
+ var k2 = "function" === typeof Object.is ? Object.is : h, l = e.useState, m2 = e.useEffect, n = e.useLayoutEffect, p2 = e.useDebugValue;
58
+ function q(a, b) {
59
+ var d = b(), f = l({ inst: { value: d, getSnapshot: b } }), c = f[0].inst, g = f[1];
60
+ n(function() {
61
+ c.value = d;
62
+ c.getSnapshot = b;
63
+ r(c) && g({ inst: c });
64
+ }, [a, d, b]);
65
+ m2(function() {
66
+ r(c) && g({ inst: c });
67
+ return a(function() {
68
+ r(c) && g({ inst: c });
69
+ });
70
+ }, [a]);
71
+ p2(d);
72
+ return d;
73
+ }
74
+ function r(a) {
75
+ var b = a.getSnapshot;
76
+ a = a.value;
77
+ try {
78
+ var d = b();
79
+ return !k2(a, d);
80
+ } catch (f) {
81
+ return true;
82
+ }
83
+ }
84
+ function t(a, b) {
85
+ return b();
86
+ }
87
+ var u2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t : q;
88
+ useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u2;
89
+ return useSyncExternalStoreShim_production_min;
90
+ }
91
+ var useSyncExternalStoreShim_development = {};
92
+ /**
93
+ * @license React
94
+ * use-sync-external-store-shim.development.js
95
+ *
96
+ * Copyright (c) Facebook, Inc. and its affiliates.
97
+ *
98
+ * This source code is licensed under the MIT license found in the
99
+ * LICENSE file in the root directory of this source tree.
100
+ */
101
+ var hasRequiredUseSyncExternalStoreShim_development;
102
+ function requireUseSyncExternalStoreShim_development() {
103
+ if (hasRequiredUseSyncExternalStoreShim_development)
104
+ return useSyncExternalStoreShim_development;
105
+ hasRequiredUseSyncExternalStoreShim_development = 1;
106
+ if (process.env.NODE_ENV !== "production") {
107
+ (function() {
108
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
109
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
110
+ }
111
+ var React2 = React__default;
112
+ var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
113
+ function error(format) {
114
+ {
115
+ {
116
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
117
+ args[_key2 - 1] = arguments[_key2];
118
+ }
119
+ printWarning("error", format, args);
120
+ }
121
+ }
122
+ }
123
+ function printWarning(level, format, args) {
124
+ {
125
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
126
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
127
+ if (stack !== "") {
128
+ format += "%s";
129
+ args = args.concat([stack]);
130
+ }
131
+ var argsWithFormat = args.map(function(item) {
132
+ return String(item);
133
+ });
134
+ argsWithFormat.unshift("Warning: " + format);
135
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
136
+ }
137
+ }
138
+ function is(x, y) {
139
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
140
+ }
141
+ var objectIs = typeof Object.is === "function" ? Object.is : is;
142
+ var useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
143
+ var didWarnOld18Alpha = false;
144
+ var didWarnUncachedGetSnapshot = false;
145
+ function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
146
+ {
147
+ if (!didWarnOld18Alpha) {
148
+ if (React2.startTransition !== void 0) {
149
+ didWarnOld18Alpha = true;
150
+ error("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.");
151
+ }
152
+ }
153
+ }
154
+ var value = getSnapshot();
155
+ {
156
+ if (!didWarnUncachedGetSnapshot) {
157
+ var cachedValue = getSnapshot();
158
+ if (!objectIs(value, cachedValue)) {
159
+ error("The result of getSnapshot should be cached to avoid an infinite loop");
160
+ didWarnUncachedGetSnapshot = true;
161
+ }
162
+ }
163
+ }
164
+ var _useState = useState({
165
+ inst: {
166
+ value,
167
+ getSnapshot
168
+ }
169
+ }), inst = _useState[0].inst, forceUpdate = _useState[1];
170
+ useLayoutEffect(function() {
171
+ inst.value = value;
172
+ inst.getSnapshot = getSnapshot;
173
+ if (checkIfSnapshotChanged(inst)) {
174
+ forceUpdate({
175
+ inst
176
+ });
177
+ }
178
+ }, [subscribe, value, getSnapshot]);
179
+ useEffect(function() {
180
+ if (checkIfSnapshotChanged(inst)) {
181
+ forceUpdate({
182
+ inst
183
+ });
184
+ }
185
+ var handleStoreChange = function() {
186
+ if (checkIfSnapshotChanged(inst)) {
187
+ forceUpdate({
188
+ inst
189
+ });
190
+ }
191
+ };
192
+ return subscribe(handleStoreChange);
193
+ }, [subscribe]);
194
+ useDebugValue(value);
195
+ return value;
196
+ }
197
+ function checkIfSnapshotChanged(inst) {
198
+ var latestGetSnapshot = inst.getSnapshot;
199
+ var prevValue = inst.value;
200
+ try {
201
+ var nextValue = latestGetSnapshot();
202
+ return !objectIs(prevValue, nextValue);
203
+ } catch (error2) {
204
+ return true;
205
+ }
206
+ }
207
+ function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
208
+ return getSnapshot();
209
+ }
210
+ var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
211
+ var isServerEnvironment = !canUseDOM;
212
+ var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
213
+ var useSyncExternalStore$2 = React2.useSyncExternalStore !== void 0 ? React2.useSyncExternalStore : shim2;
214
+ useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
215
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
216
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
217
+ }
218
+ })();
219
+ }
220
+ return useSyncExternalStoreShim_development;
221
+ }
222
+ if (process.env.NODE_ENV === "production") {
223
+ shim.exports = requireUseSyncExternalStoreShim_production_min();
224
+ } else {
225
+ shim.exports = requireUseSyncExternalStoreShim_development();
226
+ }
227
+ var shimExports = shim.exports;
228
+ var N = '[cmdk-group=""]', Q = '[cmdk-group-items=""]', be = '[cmdk-group-heading=""]', Z = '[cmdk-item=""]', le = `${Z}:not([aria-disabled="true"])`, Y = "cmdk-item-select", I = "data-value", he = (r, o, t) => W(r, o, t), ue = React.createContext(void 0), K = () => React.useContext(ue), de = React.createContext(void 0), ee = () => React.useContext(de), fe = React.createContext(void 0);
229
+ var me = React.forwardRef((r, o) => {
230
+ let t = k(() => {
231
+ var e, s;
232
+ return { search: "", value: (s = (e = r.value) != null ? e : r.defaultValue) != null ? s : "", filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
233
+ }), u2 = k(() => /* @__PURE__ */ new Set()), c = k(() => /* @__PURE__ */ new Map()), d = k(() => /* @__PURE__ */ new Map()), f = k(() => /* @__PURE__ */ new Set()), p2 = pe(r), { label: v, children: b, value: l, onValueChange: y, filter: E, shouldFilter: C, loop: H2, disablePointerSelection: ge = false, vimBindings: $2 = true, ...O } = r, te = useId(), B2 = useId(), F = useId(), x = React.useRef(null), R = Te();
234
+ M(() => {
235
+ if (l !== void 0) {
236
+ let e = l.trim();
237
+ t.current.value = e, h.emit();
238
+ }
239
+ }, [l]), M(() => {
240
+ R(6, re);
241
+ }, []);
242
+ let h = React.useMemo(() => ({ subscribe: (e) => (f.current.add(e), () => f.current.delete(e)), snapshot: () => t.current, setState: (e, s, i) => {
243
+ var a, m2, g;
244
+ if (!Object.is(t.current[e], s)) {
245
+ if (t.current[e] = s, e === "search")
246
+ W2(), U2(), R(1, z);
247
+ else if (e === "value" && (i || R(5, re), ((a = p2.current) == null ? void 0 : a.value) !== void 0)) {
248
+ let S = s != null ? s : "";
249
+ (g = (m2 = p2.current).onValueChange) == null || g.call(m2, S);
250
+ return;
251
+ }
252
+ h.emit();
253
+ }
254
+ }, emit: () => {
255
+ f.current.forEach((e) => e());
256
+ } }), []), q = React.useMemo(() => ({ value: (e, s, i) => {
257
+ var a;
258
+ s !== ((a = d.current.get(e)) == null ? void 0 : a.value) && (d.current.set(e, { value: s, keywords: i }), t.current.filtered.items.set(e, ne(s, i)), R(2, () => {
259
+ U2(), h.emit();
260
+ }));
261
+ }, item: (e, s) => (u2.current.add(e), s && (c.current.has(s) ? c.current.get(s).add(e) : c.current.set(s, /* @__PURE__ */ new Set([e]))), R(3, () => {
262
+ W2(), U2(), t.current.value || z(), h.emit();
263
+ }), () => {
264
+ d.current.delete(e), u2.current.delete(e), t.current.filtered.items.delete(e);
265
+ let i = A();
266
+ R(4, () => {
267
+ W2(), (i == null ? void 0 : i.getAttribute("id")) === e && z(), h.emit();
268
+ });
269
+ }), group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
270
+ d.current.delete(e), c.current.delete(e);
271
+ }), filter: () => p2.current.shouldFilter, label: v || r["aria-label"], getDisablePointerSelection: () => p2.current.disablePointerSelection, listId: te, inputId: F, labelId: B2, listInnerRef: x }), []);
272
+ function ne(e, s) {
273
+ var a, m2;
274
+ let i = (m2 = (a = p2.current) == null ? void 0 : a.filter) != null ? m2 : he;
275
+ return e ? i(e, t.current.search, s) : 0;
276
+ }
277
+ function U2() {
278
+ if (!t.current.search || p2.current.shouldFilter === false)
279
+ return;
280
+ let e = t.current.filtered.items, s = [];
281
+ t.current.filtered.groups.forEach((a) => {
282
+ let m2 = c.current.get(a), g = 0;
283
+ m2.forEach((S) => {
284
+ let P = e.get(S);
285
+ g = Math.max(P, g);
286
+ }), s.push([a, g]);
287
+ });
288
+ let i = x.current;
289
+ _().sort((a, m2) => {
290
+ var P, V;
291
+ let g = a.getAttribute("id"), S = m2.getAttribute("id");
292
+ return ((P = e.get(S)) != null ? P : 0) - ((V = e.get(g)) != null ? V : 0);
293
+ }).forEach((a) => {
294
+ let m2 = a.closest(Q);
295
+ m2 ? m2.appendChild(a.parentElement === m2 ? a : a.closest(`${Q} > *`)) : i.appendChild(a.parentElement === i ? a : a.closest(`${Q} > *`));
296
+ }), s.sort((a, m2) => m2[1] - a[1]).forEach((a) => {
297
+ var g;
298
+ let m2 = (g = x.current) == null ? void 0 : g.querySelector(`${N}[${I}="${encodeURIComponent(a[0])}"]`);
299
+ m2 == null || m2.parentElement.appendChild(m2);
300
+ });
301
+ }
302
+ function z() {
303
+ let e = _().find((i) => i.getAttribute("aria-disabled") !== "true"), s = e == null ? void 0 : e.getAttribute(I);
304
+ h.setState("value", s || void 0);
305
+ }
306
+ function W2() {
307
+ var s, i, a, m2;
308
+ if (!t.current.search || p2.current.shouldFilter === false) {
309
+ t.current.filtered.count = u2.current.size;
310
+ return;
311
+ }
312
+ t.current.filtered.groups = /* @__PURE__ */ new Set();
313
+ let e = 0;
314
+ for (let g of u2.current) {
315
+ let S = (i = (s = d.current.get(g)) == null ? void 0 : s.value) != null ? i : "", P = (m2 = (a = d.current.get(g)) == null ? void 0 : a.keywords) != null ? m2 : [], V = ne(S, P);
316
+ t.current.filtered.items.set(g, V), V > 0 && e++;
317
+ }
318
+ for (let [g, S] of c.current)
319
+ for (let P of S)
320
+ if (t.current.filtered.items.get(P) > 0) {
321
+ t.current.filtered.groups.add(g);
322
+ break;
323
+ }
324
+ t.current.filtered.count = e;
325
+ }
326
+ function re() {
327
+ var s, i, a;
328
+ let e = A();
329
+ e && (((s = e.parentElement) == null ? void 0 : s.firstChild) === e && ((a = (i = e.closest(N)) == null ? void 0 : i.querySelector(be)) == null || a.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
330
+ }
331
+ function A() {
332
+ var e;
333
+ return (e = x.current) == null ? void 0 : e.querySelector(`${Z}[aria-selected="true"]`);
334
+ }
335
+ function _() {
336
+ var e;
337
+ return Array.from(((e = x.current) == null ? void 0 : e.querySelectorAll(le)) || []);
338
+ }
339
+ function J2(e) {
340
+ let i = _()[e];
341
+ i && h.setState("value", i.getAttribute(I));
342
+ }
343
+ function X2(e) {
344
+ var g;
345
+ let s = A(), i = _(), a = i.findIndex((S) => S === s), m2 = i[a + e];
346
+ (g = p2.current) != null && g.loop && (m2 = a + e < 0 ? i[i.length - 1] : a + e === i.length ? i[0] : i[a + e]), m2 && h.setState("value", m2.getAttribute(I));
347
+ }
348
+ function oe(e) {
349
+ let s = A(), i = s == null ? void 0 : s.closest(N), a;
350
+ for (; i && !a; )
351
+ i = e > 0 ? Ie(i, N) : Me(i, N), a = i == null ? void 0 : i.querySelector(le);
352
+ a ? h.setState("value", a.getAttribute(I)) : X2(e);
353
+ }
354
+ let ie = () => J2(_().length - 1), ae = (e) => {
355
+ e.preventDefault(), e.metaKey ? ie() : e.altKey ? oe(1) : X2(1);
356
+ }, se = (e) => {
357
+ e.preventDefault(), e.metaKey ? J2(0) : e.altKey ? oe(-1) : X2(-1);
358
+ };
359
+ return React.createElement(Primitive.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
360
+ var s;
361
+ if ((s = O.onKeyDown) == null || s.call(O, e), !e.defaultPrevented)
362
+ switch (e.key) {
363
+ case "n":
364
+ case "j": {
365
+ $2 && e.ctrlKey && ae(e);
366
+ break;
367
+ }
368
+ case "ArrowDown": {
369
+ ae(e);
370
+ break;
371
+ }
372
+ case "p":
373
+ case "k": {
374
+ $2 && e.ctrlKey && se(e);
375
+ break;
376
+ }
377
+ case "ArrowUp": {
378
+ se(e);
379
+ break;
380
+ }
381
+ case "Home": {
382
+ e.preventDefault(), J2(0);
383
+ break;
384
+ }
385
+ case "End": {
386
+ e.preventDefault(), ie();
387
+ break;
388
+ }
389
+ case "Enter":
390
+ if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
391
+ e.preventDefault();
392
+ let i = A();
393
+ if (i) {
394
+ let a = new Event(Y);
395
+ i.dispatchEvent(a);
396
+ }
397
+ }
398
+ }
399
+ } }, React.createElement("label", { "cmdk-label": "", htmlFor: q.inputId, id: q.labelId, style: Le }, v), j(r, (e) => React.createElement(de.Provider, { value: h }, React.createElement(ue.Provider, { value: q }, e))));
400
+ }), ye = React.forwardRef((r, o) => {
401
+ var F, x;
402
+ let t = useId(), u2 = React.useRef(null), c = React.useContext(fe), d = K(), f = pe(r), p2 = (x = (F = f.current) == null ? void 0 : F.forceMount) != null ? x : c == null ? void 0 : c.forceMount;
403
+ M(() => {
404
+ if (!p2)
405
+ return d.item(t, c == null ? void 0 : c.id);
406
+ }, [p2]);
407
+ let v = ve(t, u2, [r.value, r.children, u2], r.keywords), b = ee(), l = T((R) => R.value && R.value === v.current), y = T((R) => p2 || d.filter() === false ? true : R.search ? R.filtered.items.get(t) > 0 : true);
408
+ React.useEffect(() => {
409
+ let R = u2.current;
410
+ if (!(!R || r.disabled))
411
+ return R.addEventListener(Y, E), () => R.removeEventListener(Y, E);
412
+ }, [y, r.onSelect, r.disabled]);
413
+ function E() {
414
+ var R, h;
415
+ C(), (h = (R = f.current).onSelect) == null || h.call(R, v.current);
416
+ }
417
+ function C() {
418
+ b.setState("value", v.current, true);
419
+ }
420
+ if (!y)
421
+ return null;
422
+ let { disabled: H2, value: ge, onSelect: $2, forceMount: O, keywords: te, ...B2 } = r;
423
+ return React.createElement(Primitive.div, { ref: G([u2, o]), ...B2, id: t, "cmdk-item": "", role: "option", "aria-disabled": !!H2, "aria-selected": !!l, "data-disabled": !!H2, "data-selected": !!l, onPointerMove: H2 || d.getDisablePointerSelection() ? void 0 : C, onClick: H2 ? void 0 : E }, r.children);
424
+ }), Se = React.forwardRef((r, o) => {
425
+ let { heading: t, children: u2, forceMount: c, ...d } = r, f = useId(), p2 = React.useRef(null), v = React.useRef(null), b = useId(), l = K(), y = T((C) => c || l.filter() === false ? true : C.search ? C.filtered.groups.has(f) : true);
426
+ M(() => l.group(f), []), ve(f, p2, [r.value, r.heading, v]);
427
+ let E = React.useMemo(() => ({ id: f, forceMount: c }), [c]);
428
+ return React.createElement(Primitive.div, { ref: G([p2, o]), ...d, "cmdk-group": "", role: "presentation", hidden: y ? void 0 : true }, t && React.createElement("div", { ref: v, "cmdk-group-heading": "", "aria-hidden": true, id: b }, t), j(r, (C) => React.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? b : void 0 }, React.createElement(fe.Provider, { value: E }, C))));
429
+ }), Ee = React.forwardRef((r, o) => {
430
+ let { alwaysRender: t, ...u2 } = r, c = React.useRef(null), d = T((f) => !f.search);
431
+ return !t && !d ? null : React.createElement(Primitive.div, { ref: G([c, o]), ...u2, "cmdk-separator": "", role: "separator" });
432
+ }), Ce = React.forwardRef((r, o) => {
433
+ let { onValueChange: t, ...u2 } = r, c = r.value != null, d = ee(), f = T((l) => l.search), p2 = T((l) => l.value), v = K(), b = React.useMemo(() => {
434
+ var y;
435
+ let l = (y = v.listInnerRef.current) == null ? void 0 : y.querySelector(`${Z}[${I}="${encodeURIComponent(p2)}"]`);
436
+ return l == null ? void 0 : l.getAttribute("id");
437
+ }, []);
438
+ return React.useEffect(() => {
439
+ r.value != null && d.setState("search", r.value);
440
+ }, [r.value]), React.createElement(Primitive.input, { ref: o, ...u2, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-autocomplete": "list", role: "combobox", "aria-expanded": true, "aria-controls": v.listId, "aria-labelledby": v.labelId, "aria-activedescendant": b, id: v.inputId, type: "text", value: c ? r.value : f, onChange: (l) => {
441
+ c || d.setState("search", l.target.value), t == null || t(l.target.value);
442
+ } });
443
+ }), xe = React.forwardRef((r, o) => {
444
+ let { children: t, label: u2 = "Suggestions", ...c } = r, d = React.useRef(null), f = React.useRef(null), p2 = K();
445
+ return React.useEffect(() => {
446
+ if (f.current && d.current) {
447
+ let v = f.current, b = d.current, l, y = new ResizeObserver(() => {
448
+ l = requestAnimationFrame(() => {
449
+ let E = v.offsetHeight;
450
+ b.style.setProperty("--cmdk-list-height", E.toFixed(1) + "px");
451
+ });
452
+ });
453
+ return y.observe(v), () => {
454
+ cancelAnimationFrame(l), y.unobserve(v);
455
+ };
456
+ }
457
+ }, []), React.createElement(Primitive.div, { ref: G([d, o]), ...c, "cmdk-list": "", role: "listbox", "aria-label": u2, id: p2.listId }, j(r, (v) => React.createElement("div", { ref: G([f, p2.listInnerRef]), "cmdk-list-sizer": "" }, v)));
458
+ }), Pe = React.forwardRef((r, o) => {
459
+ let { open: t, onOpenChange: u2, overlayClassName: c, contentClassName: d, container: f, ...p2 } = r;
460
+ return React.createElement(Root, { open: t, onOpenChange: u2 }, React.createElement(Portal, { container: f }, React.createElement(Overlay, { "cmdk-overlay": "", className: c }), React.createElement(Content, { "aria-label": r.label, "cmdk-dialog": "", className: d }, React.createElement(me, { ref: o, ...p2 }))));
461
+ }), we = React.forwardRef((r, o) => T((u2) => u2.filtered.count === 0) ? React.createElement(Primitive.div, { ref: o, ...r, "cmdk-empty": "", role: "presentation" }) : null), De = React.forwardRef((r, o) => {
462
+ let { progress: t, children: u2, label: c = "Loading...", ...d } = r;
463
+ return React.createElement(Primitive.div, { ref: o, ...d, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": c }, j(r, (f) => React.createElement("div", { "aria-hidden": true }, f)));
464
+ }), Ve = Object.assign(me, { List: xe, Item: ye, Input: Ce, Group: Se, Separator: Ee, Dialog: Pe, Empty: we, Loading: De });
465
+ function Ie(r, o) {
466
+ let t = r.nextElementSibling;
467
+ for (; t; ) {
468
+ if (t.matches(o))
469
+ return t;
470
+ t = t.nextElementSibling;
471
+ }
472
+ }
473
+ function Me(r, o) {
474
+ let t = r.previousElementSibling;
475
+ for (; t; ) {
476
+ if (t.matches(o))
477
+ return t;
478
+ t = t.previousElementSibling;
479
+ }
480
+ }
481
+ function pe(r) {
482
+ let o = React.useRef(r);
483
+ return M(() => {
484
+ o.current = r;
485
+ }), o;
486
+ }
487
+ var M = typeof window == "undefined" ? React.useEffect : React.useLayoutEffect;
488
+ function k(r) {
489
+ let o = React.useRef();
490
+ return o.current === void 0 && (o.current = r()), o;
491
+ }
492
+ function G(r) {
493
+ return (o) => {
494
+ r.forEach((t) => {
495
+ typeof t == "function" ? t(o) : t != null && (t.current = o);
496
+ });
497
+ };
498
+ }
499
+ function T(r) {
500
+ let o = ee(), t = () => r(o.snapshot());
501
+ return shimExports.useSyncExternalStore(o.subscribe, t, t);
502
+ }
503
+ function ve(r, o, t, u2 = []) {
504
+ let c = React.useRef(), d = K();
505
+ return M(() => {
506
+ var v;
507
+ let f = (() => {
508
+ var b;
509
+ for (let l of t) {
510
+ if (typeof l == "string")
511
+ return l.trim();
512
+ if (typeof l == "object" && "current" in l)
513
+ return l.current ? (b = l.current.textContent) == null ? void 0 : b.trim() : c.current;
514
+ }
515
+ })(), p2 = u2.map((b) => b.trim());
516
+ d.value(r, f, p2), (v = o.current) == null || v.setAttribute(I, f), c.current = f;
517
+ }), c;
518
+ }
519
+ var Te = () => {
520
+ let [r, o] = React.useState(), t = k(() => /* @__PURE__ */ new Map());
521
+ return M(() => {
522
+ t.current.forEach((u2) => u2()), t.current = /* @__PURE__ */ new Map();
523
+ }, [r]), (u2, c) => {
524
+ t.current.set(u2, c), o({});
525
+ };
526
+ };
527
+ function ke(r) {
528
+ let o = r.type;
529
+ return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
530
+ }
531
+ function j({ asChild: r, children: o }, t) {
532
+ return r && React.isValidElement(o) ? React.cloneElement(ke(o), { ref: o.ref }, t(o.props.children)) : t(o);
533
+ }
534
+ var Le = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
535
+ const Command = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
536
+ Ve,
537
+ {
538
+ ref,
539
+ className: cn(
540
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
541
+ className
542
+ ),
543
+ ...props
544
+ }
545
+ ));
546
+ Command.displayName = Ve.displayName;
547
+ const CommandDialog = ({ children, ...props }) => {
548
+ return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ jsx(Command, { className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children }) }) });
549
+ };
550
+ const CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
551
+ /* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
552
+ /* @__PURE__ */ jsx(
553
+ Ve.Input,
554
+ {
555
+ ref,
556
+ className: cn(
557
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
558
+ className
559
+ ),
560
+ ...props
561
+ }
562
+ )
563
+ ] }));
564
+ CommandInput.displayName = Ve.Input.displayName;
565
+ const CommandList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
566
+ Ve.List,
567
+ {
568
+ ref,
569
+ className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
570
+ ...props
571
+ }
572
+ ));
573
+ CommandList.displayName = Ve.List.displayName;
574
+ const CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(
575
+ Ve.Empty,
576
+ {
577
+ ref,
578
+ className: "py-6 text-center text-sm",
579
+ ...props
580
+ }
581
+ ));
582
+ CommandEmpty.displayName = Ve.Empty.displayName;
583
+ const CommandGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
584
+ Ve.Group,
585
+ {
586
+ ref,
587
+ className: cn(
588
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
589
+ className
590
+ ),
591
+ ...props
592
+ }
593
+ ));
594
+ CommandGroup.displayName = Ve.Group.displayName;
595
+ const CommandSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
596
+ Ve.Separator,
597
+ {
598
+ ref,
599
+ className: cn("-mx-1 h-px bg-border", className),
600
+ ...props
601
+ }
602
+ ));
603
+ CommandSeparator.displayName = Ve.Separator.displayName;
604
+ const CommandItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
605
+ Ve.Item,
606
+ {
607
+ ref,
608
+ className: cn(
609
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
610
+ className
611
+ ),
612
+ ...props
613
+ }
614
+ ));
615
+ CommandItem.displayName = Ve.Item.displayName;
616
+ const CommandShortcut = ({
617
+ className,
618
+ ...props
619
+ }) => {
620
+ return /* @__PURE__ */ jsx(
621
+ "span",
622
+ {
623
+ className: cn(
624
+ "ml-auto text-xs tracking-widest text-muted-foreground",
625
+ className
626
+ ),
627
+ ...props
628
+ }
629
+ );
630
+ };
631
+ CommandShortcut.displayName = "CommandShortcut";
632
+ export {
633
+ Command,
634
+ CommandDialog,
635
+ CommandEmpty,
636
+ CommandGroup,
637
+ CommandInput,
638
+ CommandItem,
639
+ CommandList,
640
+ CommandSeparator,
641
+ CommandShortcut
642
+ };
643
+ //# sourceMappingURL=command.js.map