@inkeep/cxkit-primitives 0.5.44 → 0.5.46

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.
@@ -1,15 +1,16 @@
1
- import { jsxs as ee, jsx as g } from "react/jsx-runtime";
1
+ import { jsxs as te, jsx as p } from "react/jsx-runtime";
2
2
  import * as K from "@radix-ui/react-dialog";
3
3
  import * as c from "react";
4
- import { useCallback as ae, useMemo as Ee } from "react";
4
+ import { useCallback as ue, useMemo as Ee } from "react";
5
5
  import { commandScore as Ce } from "./command-score.js";
6
- import { Primitive as k } from "@radix-ui/react-primitive";
7
- import { useId as F } from "@radix-ui/react-id";
6
+ import { Primitive as I } from "@radix-ui/react-primitive";
7
+ import { useId as T } from "@radix-ui/react-id";
8
8
  import { s as we } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
9
9
  import { ASK_AI_TRIGGER_VALUE as ye } from "../../constants/search.js";
10
- import { useShadow as Re } from "../shadow/context.js";
11
- const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-heading=""]', de = '[cmdk-item=""]', ue = `${de}:not([aria-disabled="true"])`, Z = "cmdk-item-select", M = "data-value", xe = (t, n, r) => Ce(t, n, r ?? []), fe = c.createContext(void 0), G = () => c.useContext(fe), me = c.createContext(void 0), te = () => c.useContext(me), ve = c.createContext(void 0), he = c.forwardRef((t, n) => {
12
- const r = P(() => /* @__PURE__ */ new Set()), i = P(() => /* @__PURE__ */ new Map()), u = P(() => /* @__PURE__ */ new Map()), f = P(() => /* @__PURE__ */ new Set()), s = ge(t), {
10
+ import { composeEventHandlers as Re } from "../../utils/compose-event-handlers.js";
11
+ import { useShadow as Ie } from "../shadow/context.js";
12
+ const D = '[cmdk-group=""]', Z = '[cmdk-group-items=""]', ke = '[cmdk-group-heading=""]', fe = '[cmdk-item=""]', de = `${fe}:not([aria-disabled="true"])`, ee = "cmdk-item-select", L = "data-value", xe = (t, n, r) => Ce(t, n, r ?? []), me = c.createContext(void 0), O = () => c.useContext(me), ve = c.createContext(void 0), re = () => c.useContext(ve), he = c.createContext(void 0), ge = c.forwardRef((t, n) => {
13
+ const r = M(() => /* @__PURE__ */ new Set()), i = M(() => /* @__PURE__ */ new Map()), u = M(() => /* @__PURE__ */ new Map()), f = M(() => /* @__PURE__ */ new Set()), s = pe(t), {
13
14
  label: v,
14
15
  children: d,
15
16
  value: S,
@@ -17,13 +18,13 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
17
18
  filter: y,
18
19
  shouldFilter: w,
19
20
  loop: R,
20
- disablePointerSelection: L = !1,
21
+ disablePointerSelection: _ = !1,
21
22
  vimBindings: N = !0,
22
- defaultSearch: re,
23
+ defaultSearch: ne,
23
24
  ...U
24
- } = t, h = P(() => ({
25
+ } = t, h = M(() => ({
25
26
  /** Value of the search query. */
26
- search: re ?? "",
27
+ search: ne ?? "",
27
28
  /** Currently selected item value. */
28
29
  value: t.value ?? t.defaultValue ?? "",
29
30
  /** Currently selected item id. */
@@ -36,29 +37,29 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
36
37
  /** Set of groups with at least one visible item. */
37
38
  groups: /* @__PURE__ */ new Set()
38
39
  }
39
- })), $ = F(), j = F(), b = F(), I = c.useRef(null), x = Oe();
40
- _(() => {
40
+ })), $ = T(), j = T(), q = T(), k = c.useRef(null), g = Ge();
41
+ A(() => {
41
42
  if (S !== void 0) {
42
43
  const e = S.trim();
43
44
  h.current.value = e, E.emit();
44
45
  }
45
- }, [S]), _(() => {
46
- x(6, oe);
46
+ }, [S]), A(() => {
47
+ g(6, ce);
47
48
  }, []);
48
- const be = Re(), E = c.useMemo(() => ({
49
+ const G = Ie(), E = c.useMemo(() => ({
49
50
  subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
50
51
  snapshot: () => h.current,
51
52
  setState: (e, l, o) => {
52
53
  if (!Object.is(h.current[e], l)) {
53
54
  if (h.current[e] = l, e === "search")
54
- W(), z(), x(1, H);
55
- else if (e === "value" && (be?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || x(1, () => {
56
- A()?.focus();
57
- }), x(7, () => {
58
- h.current.selectedItemId = A()?.id, E.emit();
59
- }), o || x(5, oe), s.current?.value !== void 0)) {
60
- const p = l ?? "";
61
- s.current.onValueChange?.(p);
55
+ J(), z(), g(1, W);
56
+ else if (e === "value" && (G?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input") || g(1, () => {
57
+ x()?.focus();
58
+ }), g(7, () => {
59
+ h.current.selectedItemId = x()?.id, E.emit();
60
+ }), o || g(5, ce), s.current?.value !== void 0)) {
61
+ const b = l ?? "";
62
+ s.current.onValueChange?.(b);
62
63
  return;
63
64
  }
64
65
  E.emit();
@@ -67,22 +68,22 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
67
68
  emit: () => {
68
69
  f.current.forEach((e) => e());
69
70
  }
70
- }), []), q = c.useMemo(
71
+ }), []), H = c.useMemo(
71
72
  () => ({
72
73
  // Keep id → {value, keywords} mapping up-to-date
73
74
  value: (e, l, o) => {
74
- l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e, ne(l, o)), x(2, () => {
75
+ l !== u.current.get(e)?.value && (u.current.set(e, { value: l, keywords: o }), h.current.filtered.items.set(e, oe(l, o)), g(2, () => {
75
76
  z(), E.emit();
76
77
  }));
77
78
  },
78
79
  // Track item lifecycle (mount, unmount)
79
- item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), x(3, () => {
80
- W(), z(), h.current.value || H(), E.emit();
80
+ item: (e, l) => (r.current.add(e), l && (i.current.has(l) ? i.current?.get(l)?.add(e) : i.current.set(l, /* @__PURE__ */ new Set([e]))), g(3, () => {
81
+ J(), z(), h.current.value || W(), E.emit();
81
82
  }), () => {
82
83
  u.current.delete(e), r.current.delete(e), h.current.filtered.items.delete(e);
83
- const o = A();
84
- x(4, () => {
85
- W(), o?.getAttribute("id") === e && H(), E.emit();
84
+ const o = x();
85
+ g(4, () => {
86
+ J(), o?.getAttribute("id") === e && W(), E.emit();
86
87
  });
87
88
  }),
88
89
  // Track group lifecycle (mount, unmount)
@@ -93,13 +94,13 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
93
94
  label: v || t["aria-label"] || "",
94
95
  getDisablePointerSelection: () => !!s.current.disablePointerSelection,
95
96
  listId: $,
96
- inputId: b,
97
+ inputId: q,
97
98
  labelId: j,
98
- listInnerRef: I
99
+ listInnerRef: k
99
100
  }),
100
101
  []
101
102
  );
102
- function ne(e, l) {
103
+ function oe(e, l) {
103
104
  const o = s.current?.filter ?? xe;
104
105
  return e ? o?.(e, h.current.search, l) : 0;
105
106
  }
@@ -110,39 +111,39 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
110
111
  const e = h.current.filtered.items, l = [];
111
112
  h.current.filtered.groups.forEach((a) => {
112
113
  const m = i.current.get(a);
113
- let p = 0;
114
- m.forEach((X) => {
115
- const Se = e.get(X);
116
- p = Math.max(Se, p);
117
- }), l.push([a, p]);
114
+ let b = 0;
115
+ m.forEach((Y) => {
116
+ const Se = e.get(Y);
117
+ b = Math.max(Se, b);
118
+ }), l.push([a, b]);
118
119
  });
119
- const o = I.current;
120
- D().sort((a, m) => {
121
- const p = a.getAttribute("id"), X = m.getAttribute("id");
122
- return (e.get(X) ?? 0) - (e.get(p) ?? 0);
120
+ const o = k.current;
121
+ V().sort((a, m) => {
122
+ const b = a.getAttribute("id"), Y = m.getAttribute("id");
123
+ return (e.get(Y) ?? 0) - (e.get(b) ?? 0);
123
124
  }).forEach((a) => {
124
- const m = a.closest(Y);
125
+ const m = a.closest(Z);
125
126
  if (m) {
126
- const p = a.parentElement === m ? a : a.closest(`${Y} > *`);
127
- p && m.appendChild(p);
127
+ const b = a.parentElement === m ? a : a.closest(`${Z} > *`);
128
+ b && m.appendChild(b);
128
129
  } else {
129
- const p = a.parentElement === o ? a : a.closest(`${Y} > *`);
130
- p && o?.appendChild(p);
130
+ const b = a.parentElement === o ? a : a.closest(`${Z} > *`);
131
+ b && o?.appendChild(b);
131
132
  }
132
133
  }), l.sort((a, m) => m[1] - a[1]).forEach((a) => {
133
- const m = I.current?.querySelector(
134
- `${T}[${M}="${encodeURIComponent(a[0])}"]`
134
+ const m = k.current?.querySelector(
135
+ `${D}[${L}="${encodeURIComponent(a[0])}"]`
135
136
  );
136
137
  m?.parentElement?.appendChild(m);
137
138
  });
138
139
  }
139
- function H() {
140
- const l = D().find(
140
+ function W() {
141
+ const l = V().find(
141
142
  (o) => o.getAttribute("aria-disabled") !== "true" && o.getAttribute("data-value") !== ye
142
- )?.getAttribute(M);
143
+ )?.getAttribute(L);
143
144
  E.setState("value", l || void 0);
144
145
  }
145
- function W() {
146
+ function J() {
146
147
  if (!h.current.search || // Explicitly false, because true | undefined is the default
147
148
  s.current.shouldFilter === !1) {
148
149
  h.current.filtered.count = r.current.size;
@@ -151,7 +152,7 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
151
152
  h.current.filtered.groups = /* @__PURE__ */ new Set();
152
153
  let e = 0;
153
154
  for (const l of r.current) {
154
- const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = ne(o, a);
155
+ const o = u.current.get(l)?.value ?? "", a = u.current.get(l)?.keywords ?? [], m = oe(o, a);
155
156
  h.current.filtered.items.set(l, m), m > 0 && e++;
156
157
  }
157
158
  for (const [l, o] of i.current)
@@ -164,38 +165,38 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
164
165
  }
165
166
  h.current.filtered.count = e;
166
167
  }
167
- function oe() {
168
- const e = A();
169
- e && (e.parentElement?.firstChild === e && e.closest(T)?.querySelector(Ie)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
170
- }
171
- function A() {
172
- return I.current?.querySelector(`${de}[aria-selected="true"]`);
168
+ function ce() {
169
+ const e = x();
170
+ e && (e.parentElement?.firstChild === e && e.closest(D)?.querySelector(ke)?.scrollIntoView({ block: "nearest" }), e.scrollIntoView({ block: "nearest" }));
173
171
  }
174
- function D() {
175
- return Array.from(I.current?.querySelectorAll(ue) || []);
172
+ function x() {
173
+ return k.current?.querySelector(`${fe}[aria-selected="true"]`);
176
174
  }
177
- function J(e) {
178
- const o = D()[e];
179
- o && E.setState("value", o.getAttribute(M));
175
+ function V() {
176
+ return Array.from(k.current?.querySelectorAll(de) || []);
180
177
  }
181
178
  function Q(e) {
182
- const l = A(), o = D(), a = o.findIndex((p) => p === l);
179
+ const o = V()[e];
180
+ o && E.setState("value", o.getAttribute(L));
181
+ }
182
+ function X(e) {
183
+ const l = x(), o = V(), a = o.findIndex((b) => b === l);
183
184
  let m = o[a + e];
184
- s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(M));
185
+ s.current?.loop && (m = a + e < 0 ? o[o.length - 1] : a + e === o.length ? o[0] : o[a + e]), m && E.setState("value", m.getAttribute(L));
185
186
  }
186
- function ce(e) {
187
- let o = A()?.closest(T), a;
187
+ function se(e) {
188
+ let o = x()?.closest(D), a;
188
189
  for (; o && !a; )
189
- o = e > 0 ? Te(o, T) : Fe(o, T), a = o?.querySelector(ue);
190
- a ? E.setState("value", a.getAttribute(M)) : Q(e);
190
+ o = e > 0 ? Fe(o, D) : Oe(o, D), a = o?.querySelector(de);
191
+ a ? E.setState("value", a.getAttribute(L)) : X(e);
191
192
  }
192
- const se = () => J(D().length - 1), ie = (e) => {
193
- e.preventDefault(), e.metaKey ? se() : e.altKey ? ce(1) : Q(1);
194
- }, le = (e) => {
195
- e.preventDefault(), e.metaKey ? J(0) : e.altKey ? ce(-1) : Q(-1);
193
+ const ie = () => Q(V().length - 1), le = (e) => {
194
+ e.preventDefault(), e.metaKey ? ie() : e.altKey ? se(1) : X(1);
195
+ }, ae = (e) => {
196
+ e.preventDefault(), e.metaKey ? Q(0) : e.altKey ? se(-1) : X(-1);
196
197
  };
197
- return /* @__PURE__ */ ee(
198
- k.div,
198
+ return /* @__PURE__ */ te(
199
+ I.div,
199
200
  {
200
201
  ref: n,
201
202
  tabIndex: -1,
@@ -206,36 +207,36 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
206
207
  switch (e.key) {
207
208
  case "n":
208
209
  case "j": {
209
- N && e.ctrlKey && ie(e);
210
+ N && e.ctrlKey && le(e);
210
211
  break;
211
212
  }
212
213
  case "ArrowDown": {
213
- ie(e);
214
+ le(e);
214
215
  break;
215
216
  }
216
217
  case "p":
217
218
  case "k": {
218
- N && e.ctrlKey && le(e);
219
+ N && e.ctrlKey && ae(e);
219
220
  break;
220
221
  }
221
222
  case "ArrowUp": {
222
- le(e);
223
+ ae(e);
223
224
  break;
224
225
  }
225
226
  case "Home": {
226
- e.preventDefault(), J(0);
227
+ e.preventDefault(), Q(0);
227
228
  break;
228
229
  }
229
230
  case "End": {
230
- e.preventDefault(), se();
231
+ e.preventDefault(), ie();
231
232
  break;
232
233
  }
233
234
  case "Enter":
234
235
  if (!e.nativeEvent.isComposing && e.keyCode !== 229) {
235
236
  e.preventDefault();
236
- const l = A();
237
+ const l = x();
237
238
  if (l) {
238
- const o = new Event(Z);
239
+ const o = new Event(ee);
239
240
  l.dispatchEvent(o);
240
241
  }
241
242
  }
@@ -245,103 +246,111 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
245
246
  display: "contents"
246
247
  },
247
248
  children: [
248
- /* @__PURE__ */ g(
249
+ /* @__PURE__ */ p(
249
250
  "label",
250
251
  {
251
252
  "cmdk-label": "",
252
- htmlFor: q.inputId,
253
- id: q.labelId,
254
- style: Ke,
253
+ htmlFor: H.inputId,
254
+ id: H.labelId,
255
+ style: Be,
255
256
  children: v
256
257
  }
257
258
  ),
258
- B(t, (e) => /* @__PURE__ */ g(me.Provider, { value: E, children: /* @__PURE__ */ g(fe.Provider, { value: q, children: e }) }))
259
+ B(t, (e) => /* @__PURE__ */ p(ve.Provider, { value: E, children: /* @__PURE__ */ p(me.Provider, { value: H, children: e }) }))
259
260
  ]
260
261
  }
261
262
  );
262
- }), ke = c.forwardRef((t, n) => {
263
- const { id: r } = t, i = c.useRef(null), u = c.useContext(ve), f = G(), s = ge(t), v = s.current?.forceMount ?? u?.forceMount;
264
- _(() => {
263
+ }), Ae = c.forwardRef((t, n) => {
264
+ const { id: r } = t, i = c.useRef(null), u = c.useContext(he), f = O(), s = pe(t), v = s.current?.forceMount ?? u?.forceMount;
265
+ A(() => {
265
266
  if (!v)
266
267
  return f.item(r, u?.id);
267
268
  }, [v]);
268
- const d = pe(r, i, [t.value, t.children, i], t.keywords), S = te(), C = V((b) => b.value && b.value === d.current), y = V(
269
- (b) => v || f.filter() === !1 ? !0 : b.search ? b.filtered.items.get(r) > 0 : !0
269
+ const d = be(r, i, [t.value, t.children, i], t.keywords), S = re(), C = P((g) => g.value && g.value === d.current), y = P(
270
+ (g) => v || f.filter() === !1 ? !0 : g.search ? g.filtered.items.get(r) > 0 : !0
270
271
  );
271
272
  c.useEffect(() => {
272
- const b = i.current;
273
- if (!b || t.disabled) return;
274
- const I = () => R("keyboard");
275
- return b.addEventListener(Z, I), () => b.removeEventListener(Z, I);
273
+ const g = i.current;
274
+ if (!g || t.disabled) return;
275
+ const G = () => R("keyboard");
276
+ return g.addEventListener(ee, G), () => g.removeEventListener(ee, G);
276
277
  }, [y, t.onSelect, t.disabled]);
277
- const w = ae(() => {
278
+ const w = ue(() => {
278
279
  S.setState("value", d.current, !0);
279
- }, [S, d]), R = ae(
280
- (b = "click") => {
281
- w(), s.current.onSelect?.({ value: d.current, trigger: b });
280
+ }, [S, d]), R = ue(
281
+ (g = "click") => {
282
+ w(), s.current.onSelect?.({ value: d.current, trigger: g });
282
283
  },
283
284
  [w, s, d]
284
285
  );
285
286
  if (!y) return null;
286
- const { disabled: L, value: N, onSelect: re, forceMount: U, keywords: h, ...$ } = t, j = Ee(() => O([i, n]), [i, n]);
287
- return /* @__PURE__ */ g(
288
- k.div,
287
+ const {
288
+ disabled: _,
289
+ value: N,
290
+ onSelect: ne,
291
+ forceMount: U,
292
+ keywords: h,
293
+ onClick: $,
294
+ ...j
295
+ } = t, q = Ee(() => F([i, n]), [i, n]), k = Re($, R);
296
+ return /* @__PURE__ */ p(
297
+ I.div,
289
298
  {
290
- ref: j,
291
- ...$,
299
+ ref: q,
300
+ ...j,
292
301
  id: r,
293
302
  "cmdk-item": "",
294
303
  role: "option",
295
- "aria-disabled": !!L,
304
+ "aria-disabled": !!_,
296
305
  "aria-selected": !!C,
297
- "data-disabled": !!L,
306
+ "data-disabled": !!_,
298
307
  "data-selected": !!C,
299
- onPointerMove: L || f.getDisablePointerSelection() ? void 0 : w,
300
- onClick: L ? void 0 : R,
301
- onFocus: L ? void 0 : w,
308
+ onPointerMove: _ || f.getDisablePointerSelection() ? void 0 : w,
309
+ onClick: _ ? void 0 : k,
310
+ onFocus: _ ? void 0 : w,
302
311
  children: t.children
303
312
  }
304
313
  );
305
- }), Ae = c.forwardRef((t, n) => {
306
- const { heading: r, children: i, forceMount: u, ...f } = t, s = F(), v = c.useRef(null), d = c.useRef(null), S = F(), C = G(), y = V(
314
+ }), _e = c.forwardRef((t, n) => {
315
+ const { heading: r, children: i, forceMount: u, ...f } = t, s = T(), v = c.useRef(null), d = c.useRef(null), S = T(), C = O(), y = P(
307
316
  (R) => u || C.filter() === !1 ? !0 : R.search ? R.filtered.groups.has(s) : !0
308
317
  );
309
- _(() => C.group(s), []), pe(s, v, [t.value, t.heading, d]);
318
+ A(() => C.group(s), []), be(s, v, [t.value, t.heading, d]);
310
319
  const w = c.useMemo(() => ({ id: s, forceMount: u }), [u]);
311
- return /* @__PURE__ */ ee(
312
- k.div,
320
+ return /* @__PURE__ */ te(
321
+ I.div,
313
322
  {
314
- ref: O([v, n]),
323
+ ref: F([v, n]),
315
324
  ...f,
316
325
  "cmdk-group": "",
317
326
  role: "presentation",
318
327
  hidden: y ? void 0 : !0,
319
328
  children: [
320
- r && /* @__PURE__ */ g("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
329
+ r && /* @__PURE__ */ p("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: S, children: r }),
321
330
  B(t, (R) => (
322
331
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
323
- /* @__PURE__ */ g("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ g(ve.Provider, { value: w, children: R }) })
332
+ /* @__PURE__ */ p("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": r ? S : void 0, children: /* @__PURE__ */ p(he.Provider, { value: w, children: R }) })
324
333
  ))
325
334
  ]
326
335
  }
327
336
  );
328
- }), _e = c.forwardRef((t, n) => {
329
- const { alwaysRender: r, ...i } = t, u = c.useRef(null), f = V((s) => !s.search);
330
- return !r && !f ? null : /* @__PURE__ */ g(
331
- k.div,
337
+ }), Le = c.forwardRef((t, n) => {
338
+ const { alwaysRender: r, ...i } = t, u = c.useRef(null), f = P((s) => !s.search);
339
+ return !r && !f ? null : /* @__PURE__ */ p(
340
+ I.div,
332
341
  {
333
- ref: O([u, n]),
342
+ ref: F([u, n]),
334
343
  ...i,
335
344
  "cmdk-separator": "",
336
345
  role: "separator"
337
346
  }
338
347
  );
339
- }), Le = c.forwardRef((t, n) => {
340
- const { onValueChange: r, ...i } = t, u = t.value != null, f = te(), s = V((d) => d.search), v = G();
348
+ }), Me = c.forwardRef((t, n) => {
349
+ const { onValueChange: r, ...i } = t, u = t.value != null, f = re(), s = P((d) => d.search), v = O();
341
350
  return c.useEffect(() => {
342
351
  t.value != null && f.setState("search", t.value);
343
- }, [t.value]), /* @__PURE__ */ g(
344
- k.input,
352
+ }, [t.value]), /* @__PURE__ */ p(
353
+ I.input,
345
354
  {
346
355
  ref: n,
347
356
  ...i,
@@ -362,8 +371,8 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
362
371
  }
363
372
  }
364
373
  );
365
- }), Me = c.forwardRef((t, n) => {
366
- const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v = G();
374
+ }), Pe = c.forwardRef((t, n) => {
375
+ const { children: r, label: i = "Suggestions", ...u } = t, f = c.useRef(null), s = c.useRef(null), v = O();
367
376
  return c.useEffect(() => {
368
377
  if (s.current && f.current) {
369
378
  const d = s.current, S = f.current;
@@ -378,28 +387,28 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
378
387
  cancelAnimationFrame(C), y.unobserve(d);
379
388
  };
380
389
  }
381
- }, []), /* @__PURE__ */ g(
382
- k.div,
390
+ }, []), /* @__PURE__ */ p(
391
+ I.div,
383
392
  {
384
- ref: O([f, n]),
393
+ ref: F([f, n]),
385
394
  ...u,
386
395
  "cmdk-list": "",
387
396
  tabIndex: -1,
388
397
  "aria-label": i,
389
398
  id: v.listId,
390
- children: B(t, (d) => /* @__PURE__ */ g("div", { ref: O([s, v.listInnerRef]), "cmdk-list-sizer": "", children: d }))
399
+ children: B(t, (d) => /* @__PURE__ */ p("div", { ref: F([s, v.listInnerRef]), "cmdk-list-sizer": "", children: d }))
391
400
  }
392
401
  );
393
- }), Pe = c.forwardRef((t, n) => {
402
+ }), Ve = c.forwardRef((t, n) => {
394
403
  const { open: r, onOpenChange: i, overlayClassName: u, contentClassName: f, container: s, ...v } = t;
395
- return /* @__PURE__ */ g(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ ee(K.Portal, { container: s, children: [
396
- /* @__PURE__ */ g(K.Overlay, { "cmdk-overlay": "", className: u }),
397
- /* @__PURE__ */ g(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ g(he, { ref: n, ...v }) })
404
+ return /* @__PURE__ */ p(K.Root, { open: r, onOpenChange: i, children: /* @__PURE__ */ te(K.Portal, { container: s, children: [
405
+ /* @__PURE__ */ p(K.Overlay, { "cmdk-overlay": "", className: u }),
406
+ /* @__PURE__ */ p(K.Content, { "aria-label": t.label, "cmdk-dialog": "", className: f, children: /* @__PURE__ */ p(ge, { ref: n, ...v }) })
398
407
  ] }) });
399
- }), Ve = c.forwardRef((t, n) => V((i) => i.filtered.count === 0) ? /* @__PURE__ */ g(k.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), De = c.forwardRef((t, n) => {
408
+ }), De = c.forwardRef((t, n) => P((i) => i.filtered.count === 0) ? /* @__PURE__ */ p(I.div, { ref: n, ...t, "cmdk-empty": "", role: "presentation" }) : null), Te = c.forwardRef((t, n) => {
400
409
  const { progress: r, children: i, label: u = "Loading...", ...f } = t;
401
- return /* @__PURE__ */ g(
402
- k.div,
410
+ return /* @__PURE__ */ p(
411
+ I.div,
403
412
  {
404
413
  ref: n,
405
414
  ...f,
@@ -409,58 +418,58 @@ const T = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', Ie = '[cmdk-group-head
409
418
  "aria-valuemin": 0,
410
419
  "aria-valuemax": 100,
411
420
  "aria-label": u,
412
- children: B(t, (s) => /* @__PURE__ */ g("div", { "aria-hidden": !0, children: s }))
421
+ children: B(t, (s) => /* @__PURE__ */ p("div", { "aria-hidden": !0, children: s }))
413
422
  }
414
423
  );
415
- }), We = Object.assign(he, {
416
- List: Me,
417
- Item: ke,
418
- Input: Le,
419
- Group: Ae,
420
- Separator: _e,
421
- Dialog: Pe,
422
- Empty: Ve,
423
- Loading: De
424
+ }), Qe = Object.assign(ge, {
425
+ List: Pe,
426
+ Item: Ae,
427
+ Input: Me,
428
+ Group: _e,
429
+ Separator: Le,
430
+ Dialog: Ve,
431
+ Empty: De,
432
+ Loading: Te
424
433
  });
425
- function Te(t, n) {
434
+ function Fe(t, n) {
426
435
  let r = t.nextElementSibling;
427
436
  for (; r; ) {
428
437
  if (r.matches(n)) return r;
429
438
  r = r.nextElementSibling;
430
439
  }
431
440
  }
432
- function Fe(t, n) {
441
+ function Oe(t, n) {
433
442
  let r = t.previousElementSibling;
434
443
  for (; r; ) {
435
444
  if (r.matches(n)) return r;
436
445
  r = r.previousElementSibling;
437
446
  }
438
447
  }
439
- function ge(t) {
448
+ function pe(t) {
440
449
  const n = c.useRef(t);
441
- return _(() => {
450
+ return A(() => {
442
451
  n.current = t;
443
452
  }), n;
444
453
  }
445
- const _ = typeof window > "u" ? c.useEffect : c.useLayoutEffect;
446
- function P(t) {
454
+ const A = typeof window > "u" ? c.useEffect : c.useLayoutEffect;
455
+ function M(t) {
447
456
  const n = c.useRef(void 0);
448
457
  return n.current === void 0 && (n.current = t()), n;
449
458
  }
450
- function O(t) {
459
+ function F(t) {
451
460
  return (n) => {
452
461
  t.forEach((r) => {
453
462
  typeof r == "function" ? r(n) : r != null && (r.current = n);
454
463
  });
455
464
  };
456
465
  }
457
- function V(t) {
458
- const n = te(), r = () => t(n.snapshot());
466
+ function P(t) {
467
+ const n = re(), r = () => t(n.snapshot());
459
468
  return we.useSyncExternalStore(n.subscribe, r, r);
460
469
  }
461
- function pe(t, n, r, i = []) {
462
- const u = c.useRef(void 0), f = G();
463
- return _(() => {
470
+ function be(t, n, r, i = []) {
471
+ const u = c.useRef(void 0), f = O();
472
+ return A(() => {
464
473
  const s = (() => {
465
474
  for (const d of r) {
466
475
  if (typeof d == "string")
@@ -469,30 +478,30 @@ function pe(t, n, r, i = []) {
469
478
  return d.current ? d.current.textContent?.trim() : u.current;
470
479
  }
471
480
  })(), v = i.map((d) => d.trim());
472
- f.value(t, s, v), n.current?.setAttribute(M, s), u.current = s;
481
+ f.value(t, s, v), n.current?.setAttribute(L, s), u.current = s;
473
482
  }), u;
474
483
  }
475
- const Oe = () => {
476
- const [t, n] = c.useState(), r = P(() => /* @__PURE__ */ new Map());
477
- return _(() => {
484
+ const Ge = () => {
485
+ const [t, n] = c.useState(), r = M(() => /* @__PURE__ */ new Map());
486
+ return A(() => {
478
487
  r.current.forEach((i) => i()), r.current = /* @__PURE__ */ new Map();
479
488
  }, [t]), (i, u) => {
480
489
  r.current.set(i, u), n({});
481
490
  };
482
491
  };
483
- function Ge(t) {
492
+ function Ke(t) {
484
493
  const n = t.type;
485
494
  return typeof n == "function" ? n(t.props) : "render" in n ? n.render(t.props) : t;
486
495
  }
487
496
  function B({ asChild: t, children: n }, r) {
488
497
  return t && c.isValidElement(n) ? c.cloneElement(
489
- Ge(n),
498
+ Ke(n),
490
499
  { ref: n.ref },
491
500
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
492
501
  r(n.props.children)
493
502
  ) : r(n);
494
503
  }
495
- const Ke = {
504
+ const Be = {
496
505
  position: "absolute",
497
506
  width: "1px",
498
507
  height: "1px",
@@ -504,16 +513,16 @@ const Ke = {
504
513
  borderWidth: "0"
505
514
  };
506
515
  export {
507
- We as Command,
508
- Pe as CommandDialog,
509
- Ve as CommandEmpty,
510
- Le as CommandInput,
511
- ke as CommandItem,
512
- Me as CommandList,
513
- De as CommandLoading,
514
- he as CommandRoot,
515
- _e as CommandSeparator,
516
+ Qe as Command,
517
+ Ve as CommandDialog,
518
+ De as CommandEmpty,
519
+ Me as CommandInput,
520
+ Ae as CommandItem,
521
+ Pe as CommandList,
522
+ Te as CommandLoading,
523
+ ge as CommandRoot,
524
+ Le as CommandSeparator,
516
525
  xe as defaultFilter,
517
- V as useCommandState,
518
- te as useCommandStore
526
+ P as useCommandState,
527
+ re as useCommandStore
519
528
  };