@strapi/ui-primitives 1.7.10 → 1.8.1

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.
package/dist/index.js CHANGED
@@ -1,42 +1,89 @@
1
1
  import { jsx as f, jsxs as Ae, Fragment as _e } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
+ import { useComposedRefs as M } from "@radix-ui/react-compose-refs";
4
+ import { createContextScope as ot, createContext as nt } from "@radix-ui/react-context";
5
+ import { Slot as Te } from "@radix-ui/react-slot";
3
6
  import { composeEventHandlers as T } from "@radix-ui/primitive";
4
7
  import { composeEventHandlers as An } from "@radix-ui/primitive";
5
- import { useComposedRefs as A } from "@radix-ui/react-compose-refs";
6
- import { createContextScope as nt, createContext as rt } from "@radix-ui/react-context";
7
- import { DismissableLayer as lt } from "@radix-ui/react-dismissable-layer";
8
- import { useFocusGuards as st } from "@radix-ui/react-focus-guards";
9
- import { FocusScope as ct } from "@radix-ui/react-focus-scope";
10
- import { useId as ne } from "@radix-ui/react-id";
11
- import * as re from "@radix-ui/react-popper";
12
- import { createPopperScope as it } from "@radix-ui/react-popper";
13
- import { Portal as at } from "@radix-ui/react-portal";
8
+ import { DismissableLayer as rt } from "@radix-ui/react-dismissable-layer";
9
+ import { useFocusGuards as lt } from "@radix-ui/react-focus-guards";
10
+ import { FocusScope as st } from "@radix-ui/react-focus-scope";
11
+ import { useId as re } from "@radix-ui/react-id";
12
+ import * as le from "@radix-ui/react-popper";
13
+ import { createPopperScope as ct } from "@radix-ui/react-popper";
14
+ import { Portal as it } from "@radix-ui/react-portal";
14
15
  import { Primitive as N } from "@radix-ui/react-primitive";
15
16
  import { useControllableState as ie } from "@radix-ui/react-use-controllable-state";
16
- import { useLayoutEffect as F } from "@radix-ui/react-use-layout-effect";
17
- import { hideOthers as ut } from "aria-hidden";
18
- import * as xe from "react-dom";
19
- import { RemoveScroll as dt } from "react-remove-scroll";
20
- import { Slot as Te } from "@radix-ui/react-slot";
17
+ import { useLayoutEffect as L } from "@radix-ui/react-use-layout-effect";
18
+ import { hideOthers as at } from "aria-hidden";
19
+ import * as Ce from "react-dom";
20
+ import { RemoveScroll as ut } from "react-remove-scroll";
21
21
  import { clamp as Qe } from "@radix-ui/number";
22
- import { createCollection as At } from "@radix-ui/react-collection";
23
- import { useDirection as _t } from "@radix-ui/react-direction";
24
- import { useCallbackRef as Mt } from "@radix-ui/react-use-callback-ref";
22
+ import { createCollection as Nt } from "@radix-ui/react-collection";
23
+ import { useDirection as At } from "@radix-ui/react-direction";
24
+ import { usePrevious as _t } from "@radix-ui/react-use-previous";
25
+ import { VisuallyHidden as Mt } from "@radix-ui/react-visually-hidden";
26
+ import { useCallbackRef as Ot } from "@radix-ui/react-use-callback-ref";
25
27
  import { useCallbackRef as Mn } from "@radix-ui/react-use-callback-ref";
26
- import { usePrevious as Ot } from "@radix-ui/react-use-previous";
27
- import { VisuallyHidden as Dt } from "@radix-ui/react-visually-hidden";
28
+ function Dt(r) {
29
+ const c = `${r}CollectionProvider`, [e, t] = ot(c), [o, n] = e(c, {
30
+ collectionRef: { current: null },
31
+ itemMap: /* @__PURE__ */ new Map(),
32
+ listeners: /* @__PURE__ */ new Set()
33
+ }), i = (d) => {
34
+ const { scope: h, children: v } = d, C = l.useRef(null), b = l.useRef(/* @__PURE__ */ new Map()).current, g = l.useRef(/* @__PURE__ */ new Set()).current;
35
+ return /* @__PURE__ */ f(o, { scope: h, itemMap: b, collectionRef: C, listeners: g, children: v });
36
+ };
37
+ i.displayName = c;
38
+ const s = `${r}CollectionSlot`, a = l.forwardRef((d, h) => {
39
+ const { scope: v, children: C } = d, b = n(s, v), g = M(h, b.collectionRef);
40
+ return /* @__PURE__ */ f(Te, { ref: g, children: C });
41
+ });
42
+ a.displayName = s;
43
+ const m = `${r}CollectionItemSlot`, u = "data-radix-collection-item", x = l.forwardRef((d, h) => {
44
+ const { scope: v, children: C, ...b } = d, g = l.useRef(null), I = M(h, g), E = n(m, v);
45
+ return l.useEffect(() => {
46
+ const O = Array.from(E.itemMap.values());
47
+ return E.itemMap.set(g, { ref: g, ...b }), E.listeners.forEach((A) => A(Array.from(E.itemMap.values()), O)), () => {
48
+ const A = Array.from(E.itemMap.values());
49
+ E.itemMap.delete(g), E.listeners.forEach((_) => _(Array.from(E.itemMap.values()), A));
50
+ };
51
+ }), /* @__PURE__ */ f(Te, { [u]: "", ref: I, children: C });
52
+ });
53
+ x.displayName = m;
54
+ function p(d) {
55
+ const h = n(`${r}CollectionConsumer`, d), v = l.useCallback(() => {
56
+ const b = h.collectionRef.current;
57
+ if (!b)
58
+ return [];
59
+ const g = Array.from(b.querySelectorAll(`[${u}]`));
60
+ return Array.from(h.itemMap.values()).sort(
61
+ (O, A) => g.indexOf(O.ref.current) - g.indexOf(A.ref.current)
62
+ );
63
+ }, [h.collectionRef, h.itemMap]), C = l.useCallback(
64
+ (b) => (h.listeners.add(b), () => h.listeners.delete(b)),
65
+ [h.listeners]
66
+ );
67
+ return { getItems: v, subscribe: C };
68
+ }
69
+ return [
70
+ { Provider: i, Slot: a, ItemSlot: x },
71
+ p,
72
+ t
73
+ ];
74
+ }
28
75
  let ye = /* @__PURE__ */ new Map();
29
- function kt(r, s) {
30
- let e = r + (s ? Object.entries(s).sort((o, n) => o[0] < n[0] ? -1 : 1).join() : "");
76
+ function kt(r, c) {
77
+ let e = r + (c ? Object.entries(c).sort((o, n) => o[0] < n[0] ? -1 : 1).join() : "");
31
78
  if (ye.has(e))
32
79
  return ye.get(e);
33
- let t = new Intl.Collator(r, s);
80
+ let t = new Intl.Collator(r, c);
34
81
  return ye.set(e, t), t;
35
82
  }
36
- function Me(r, s) {
83
+ function Me(r, c) {
37
84
  let e = kt(r, {
38
85
  usage: "search",
39
- ...s
86
+ ...c
40
87
  });
41
88
  return {
42
89
  startsWith(t, o) {
@@ -51,8 +98,8 @@ function Me(r, s) {
51
98
  t = t.normalize("NFC"), o = o.normalize("NFC");
52
99
  let n = 0, i = o.length;
53
100
  for (; n + i <= t.length; n++) {
54
- let c = t.slice(n, n + i);
55
- if (e.compare(o, c) === 0)
101
+ let s = t.slice(n, n + i);
102
+ if (e.compare(o, s) === 0)
56
103
  return !0;
57
104
  }
58
105
  return !1;
@@ -60,148 +107,102 @@ function Me(r, s) {
60
107
  };
61
108
  }
62
109
  const Ft = (r) => {
63
- const s = l.useRef();
110
+ const c = l.useRef();
64
111
  return l.useEffect(() => {
65
- s.current = r;
66
- }), s.current;
67
- };
68
- function Lt(r) {
69
- const s = `${r}CollectionProvider`, [e, t] = nt(s), [o, n] = e(s, {
70
- collectionRef: { current: null },
71
- itemMap: /* @__PURE__ */ new Map(),
72
- listeners: /* @__PURE__ */ new Set()
73
- }), i = (u) => {
74
- const { scope: x, children: v } = u, C = l.useRef(null), b = l.useRef(/* @__PURE__ */ new Map()).current, g = l.useRef(/* @__PURE__ */ new Set()).current;
75
- return /* @__PURE__ */ f(o, { scope: x, itemMap: b, collectionRef: C, listeners: g, children: v });
76
- };
77
- i.displayName = s;
78
- const c = `${r}CollectionSlot`, a = l.forwardRef((u, x) => {
79
- const { scope: v, children: C } = u, b = n(c, v), g = A(x, b.collectionRef);
80
- return /* @__PURE__ */ f(Te, { ref: g, children: C });
81
- });
82
- a.displayName = c;
83
- const p = `${r}CollectionItemSlot`, d = "data-radix-collection-item", m = l.forwardRef((u, x) => {
84
- const { scope: v, children: C, ...b } = u, g = l.useRef(null), w = A(x, g), _ = n(p, v);
85
- return l.useEffect(() => {
86
- const V = Array.from(_.itemMap.values());
87
- return _.itemMap.set(g, { ref: g, ...b }), _.listeners.forEach((D) => D(Array.from(_.itemMap.values()), V)), () => {
88
- const D = Array.from(_.itemMap.values());
89
- _.itemMap.delete(g), _.listeners.forEach((E) => E(Array.from(_.itemMap.values()), D));
90
- };
91
- }), /* @__PURE__ */ f(Te, { [d]: "", ref: w, children: C });
92
- });
93
- m.displayName = p;
94
- function h(u) {
95
- const x = n(`${r}CollectionConsumer`, u), v = l.useCallback(() => {
96
- const b = x.collectionRef.current;
97
- if (!b)
98
- return [];
99
- const g = Array.from(b.querySelectorAll(`[${d}]`));
100
- return Array.from(x.itemMap.values()).sort(
101
- (V, D) => g.indexOf(V.ref.current) - g.indexOf(D.ref.current)
102
- );
103
- }, [x.collectionRef, x.itemMap]), C = l.useCallback(
104
- (b) => (x.listeners.add(b), () => x.listeners.delete(b)),
105
- [x.listeners]
106
- );
107
- return { getItems: v, subscribe: C };
108
- }
109
- return [
110
- { Provider: i, Slot: a, ItemSlot: m },
111
- h,
112
- t
113
- ];
114
- }
115
- const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !!(r.length === 1 && r.match(/\S| /)), ft = "Combobox", [ae, Ce] = Lt(ft), [$t, z] = rt(ft), Ut = ({ children: r }) => /* @__PURE__ */ f(re.Root, { children: /* @__PURE__ */ f(ae.Provider, { scope: void 0, children: r }) }), Kt = (r) => {
112
+ c.current = r;
113
+ }), c.current;
114
+ }, Lt = [" ", "Enter", "ArrowUp", "ArrowDown"], Bt = ["Enter"], Ht = (r) => !!(r.length === 1 && r.match(/\S| /)), dt = "Combobox", [ae, me] = Dt(dt), [$t, K] = nt(dt), Ut = ({ children: r }) => /* @__PURE__ */ f(le.Root, { children: /* @__PURE__ */ f(ae.Provider, { scope: void 0, children: r }) }), Kt = (r) => {
116
115
  const {
117
- allowCustomValue: s = !1,
116
+ allowCustomValue: c = !1,
118
117
  autocomplete: e = "none",
119
118
  children: t,
120
119
  open: o,
121
120
  defaultOpen: n,
122
121
  onOpenChange: i,
123
- value: c,
122
+ value: s,
124
123
  defaultValue: a,
125
- onValueChange: p,
126
- disabled: d,
127
- required: m = !1,
128
- locale: h = "en-EN",
129
- onTextValueChange: u,
130
- textValue: x,
124
+ onValueChange: m,
125
+ disabled: u,
126
+ required: x = !1,
127
+ locale: p = "en-EN",
128
+ onTextValueChange: d,
129
+ textValue: h,
131
130
  defaultTextValue: v,
132
131
  filterValue: C,
133
132
  defaultFilterValue: b,
134
- onFilterValueChange: g
135
- } = r, [w, _] = l.useState(null), [V, D] = l.useState(null), [E, k] = l.useState(null), [H, G] = l.useState(null), [$ = !1, M] = ie({
133
+ onFilterValueChange: g,
134
+ isPrintableCharacter: I = Ht
135
+ } = r, [E, O] = l.useState(null), [A, _] = l.useState(null), [k, q] = l.useState(null), [W, B] = l.useState(null), [D = !1, H] = ie({
136
136
  prop: o,
137
137
  defaultProp: n,
138
138
  onChange: i
139
- }), [L, B] = ie({
140
- prop: c,
139
+ }), [F, z] = ie({
140
+ prop: s,
141
141
  defaultProp: a,
142
- onChange: p
143
- }), [U, K] = ie({
144
- prop: x,
145
- defaultProp: v,
146
- onChange: u
147
- }), [q, X] = ie({
142
+ onChange: m
143
+ }), [G, $] = ie({
144
+ prop: h,
145
+ defaultProp: c && !v ? s : v,
146
+ onChange: d
147
+ }), [X, U] = ie({
148
148
  prop: C,
149
149
  defaultProp: b,
150
150
  onChange: g
151
- }), W = ne(), de = l.useCallback(
152
- (le, se) => {
153
- const fe = se.map((I) => I.ref.current), [Z, ...ce] = fe, [Q] = ce.slice(-1), S = H;
154
- for (const I of le) {
155
- if (I === S)
151
+ }), de = re(), se = l.useCallback(
152
+ (fe, Q) => {
153
+ const Z = Q.map((y) => y.ref.current), [ce, ...ee] = Z, [S] = ee.slice(-1), V = W ?? Q.find((y) => y.value === F)?.ref.current;
154
+ for (const y of fe) {
155
+ if (y === V)
156
156
  return;
157
- if (I?.scrollIntoView({ block: "nearest" }), I === Z && V && (V.scrollTop = 0), I === Q && V && (V.scrollTop = V.scrollHeight), G(I), e === "both") {
158
- const O = se.find((y) => y.ref.current === I);
159
- O && K(O.textValue);
157
+ if (y?.scrollIntoView({ block: "nearest" }), y === ce && A && (A.scrollTop = 0), y === S && A && (A.scrollTop = A.scrollHeight), B(y), e === "both") {
158
+ const w = Q.find((P) => P.ref.current === y);
159
+ w && $(w.textValue);
160
160
  }
161
- if (I !== S)
161
+ if (y !== V)
162
162
  return;
163
163
  }
164
164
  },
165
- [e, K, V, H]
165
+ [e, $, A, W, F]
166
166
  );
167
167
  return l.useEffect(() => {
168
- e !== "both" && G(null);
169
- }, [U, e]), l.useEffect(() => {
170
- if (E && w)
171
- return ut([E, w]);
172
- }, [E, w]), /* @__PURE__ */ f(Ut, { children: /* @__PURE__ */ f(
168
+ e !== "both" && B(null);
169
+ }, [G, e]), l.useEffect(() => {
170
+ if (k && E)
171
+ return at([k, E]);
172
+ }, [k, E]), /* @__PURE__ */ f(Ut, { children: /* @__PURE__ */ f(
173
173
  $t,
174
174
  {
175
- allowCustomValue: s,
175
+ allowCustomValue: c,
176
176
  autocomplete: e,
177
- required: m,
178
- trigger: w,
179
- onTriggerChange: _,
180
- contentId: W,
181
- value: L,
182
- onValueChange: B,
183
- open: $,
184
- onOpenChange: M,
185
- disabled: d,
186
- locale: h,
187
- focusFirst: de,
188
- textValue: U,
189
- onTextValueChange: K,
190
- onViewportChange: D,
191
- onContentChange: k,
192
- visuallyFocussedItem: H,
193
- filterValue: q,
194
- onFilterValueChange: X,
195
- onVisuallyFocussedItemChange: G,
177
+ required: x,
178
+ trigger: E,
179
+ onTriggerChange: O,
180
+ contentId: de,
181
+ value: F,
182
+ onValueChange: z,
183
+ open: D,
184
+ onOpenChange: H,
185
+ disabled: u,
186
+ locale: p,
187
+ focusFirst: se,
188
+ textValue: G,
189
+ onTextValueChange: $,
190
+ onViewportChange: _,
191
+ onContentChange: q,
192
+ visuallyFocussedItem: W,
193
+ filterValue: X,
194
+ onFilterValueChange: U,
195
+ onVisuallyFocussedItemChange: B,
196
+ isPrintableCharacter: I,
196
197
  children: t
197
198
  }
198
199
  ) });
199
- }, Wt = "ComboboxTrigger", zt = l.forwardRef((r, s) => {
200
- const { ...e } = r, t = z(Wt), o = () => {
200
+ }, Wt = "ComboboxTrigger", zt = l.forwardRef((r, c) => {
201
+ const { ...e } = r, t = K(Wt), o = () => {
201
202
  t.disabled || t.onOpenChange(!0);
202
203
  };
203
- return /* @__PURE__ */ f(re.Anchor, { asChild: !0, children: /* @__PURE__ */ f(
204
- ct,
204
+ return /* @__PURE__ */ f(le.Anchor, { asChild: !0, children: /* @__PURE__ */ f(
205
+ st,
205
206
  {
206
207
  asChild: !0,
207
208
  trapped: t.open,
@@ -214,7 +215,7 @@ const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !
214
215
  children: /* @__PURE__ */ f(
215
216
  "div",
216
217
  {
217
- ref: s,
218
+ ref: c,
218
219
  "data-disabled": t.disabled ? "" : void 0,
219
220
  ...e,
220
221
  onClick: T(e.onClick, () => {
@@ -228,21 +229,21 @@ const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !
228
229
  )
229
230
  }
230
231
  ) });
231
- }), pt = "ComboboxInput", Gt = l.forwardRef((r, s) => {
232
- const e = z(pt), t = l.useRef(null), { getItems: o } = Ce(void 0), { startsWith: n } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, c = A(t, s, e.onTriggerChange), a = () => {
232
+ }), ft = "ComboboxInput", Gt = l.forwardRef((r, c) => {
233
+ const e = K(ft), t = l.useRef(null), { getItems: o } = me(void 0), { startsWith: n } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, s = M(t, c, e.onTriggerChange), a = () => {
233
234
  i || e.onOpenChange(!0);
234
- }, p = Ft(e.filterValue);
235
- return F(() => {
236
- const d = setTimeout(() => {
235
+ }, m = Ft(e.filterValue);
236
+ return L(() => {
237
+ const u = setTimeout(() => {
237
238
  if (e.textValue === "" || e.textValue === void 0 || e.filterValue === "" || e.filterValue === void 0)
238
239
  return;
239
- const m = o().find(
240
- (u) => u.type === "option" && n(u.textValue, e.textValue)
241
- ), h = So(p ?? "", e.filterValue);
242
- m && !e.visuallyFocussedItem && h === e.filterValue.length && t.current?.setSelectionRange(e.filterValue.length, e.textValue.length);
240
+ const x = o().find(
241
+ (d) => d.type === "option" && n(d.textValue, e.textValue)
242
+ ), p = So(m ?? "", e.filterValue);
243
+ x && !e.visuallyFocussedItem && p === e.filterValue.length && t.current?.setSelectionRange(e.filterValue.length, e.textValue.length);
243
244
  });
244
- return () => clearTimeout(d);
245
- }, [e.textValue, e.filterValue, n, e.visuallyFocussedItem, o, p]), /* @__PURE__ */ f(
245
+ return () => clearTimeout(u);
246
+ }, [e.textValue, e.filterValue, n, e.visuallyFocussedItem, o, m]), /* @__PURE__ */ f(
246
247
  "input",
247
248
  {
248
249
  type: "text",
@@ -259,67 +260,78 @@ const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !
259
260
  "data-placeholder": e.textValue === void 0 ? "" : void 0,
260
261
  value: e.textValue ?? "",
261
262
  ...r,
262
- ref: c,
263
- onKeyDown: T(r.onKeyDown, (d) => {
264
- if (["ArrowUp", "ArrowDown", "Home", "End"].includes(d.key))
263
+ ref: s,
264
+ onKeyDown: T(r.onKeyDown, (u) => {
265
+ if (["ArrowUp", "ArrowDown", "Home", "End"].includes(u.key))
265
266
  e.open || a(), setTimeout(() => {
266
- let h = o().filter((u) => !u.disabled && u.isVisible).map((u) => u.ref.current);
267
- if (["ArrowUp", "End"].includes(d.key) && (h = h.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(d.key)) {
268
- const u = e.visuallyFocussedItem ?? d.target;
269
- let x = h.indexOf(u);
270
- x === h.length - 1 && (x = -1), h = h.slice(x + 1);
267
+ let p = o().filter((d) => !d.disabled && d.isVisible).map((d) => d.ref.current);
268
+ if (["ArrowUp", "End"].includes(u.key) && (p = p.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(u.key)) {
269
+ const d = e.visuallyFocussedItem ?? o().find((h) => h.value === e.value)?.ref.current;
270
+ if (d) {
271
+ let h = p.indexOf(d);
272
+ h === p.length - 1 && (h = -1), p = p.slice(h + 1);
273
+ }
271
274
  }
272
- if (["ArrowDown"].includes(d.key) && e.autocomplete === "both" && h.length > 1) {
273
- const [u, ...x] = h, v = o().find((C) => C.ref.current === u).textValue;
274
- e.textValue === v && (h = x);
275
+ if (["ArrowDown"].includes(u.key) && e.autocomplete === "both" && p.length > 1) {
276
+ const [d, ...h] = p, v = o().find((C) => C.ref.current === d).textValue;
277
+ e.textValue === v && (p = h);
275
278
  }
276
- e.focusFirst(h, o());
277
- }), d.preventDefault();
278
- else if (["Tab"].includes(d.key) && e.open)
279
- d.preventDefault();
280
- else if (["Escape"].includes(d.key))
281
- e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), d.preventDefault();
282
- else if (Ht.includes(d.key)) {
279
+ e.focusFirst(p, o());
280
+ }), u.preventDefault();
281
+ else if (["Tab"].includes(u.key) && e.open)
282
+ u.preventDefault();
283
+ else if (["Escape"].includes(u.key))
284
+ e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), u.preventDefault();
285
+ else if (Bt.includes(u.key)) {
283
286
  if (e.visuallyFocussedItem) {
284
- const m = o().find((h) => h.ref.current === e.visuallyFocussedItem);
285
- m && (e.onValueChange(m.value), e.onTextValueChange(m.textValue), e.autocomplete === "both" && e.onFilterValueChange(m.textValue), m.ref.current?.click());
287
+ const x = o().find((p) => p.ref.current === e.visuallyFocussedItem);
288
+ x && (e.onValueChange(x.value), e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue), x.ref.current?.click());
286
289
  } else {
287
- const m = o().find(
288
- (h) => h.type === "option" && !h.disabled && h.textValue === e.textValue
290
+ const x = o().find(
291
+ (p) => p.type === "option" && !p.disabled && p.textValue === e.textValue
289
292
  );
290
- m && (e.onValueChange(m.value), e.onTextValueChange(m.textValue), e.autocomplete === "both" && e.onFilterValueChange(m.textValue), m.ref.current?.click());
293
+ x && (e.onValueChange(x.value), e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue), x.ref.current?.click());
291
294
  }
292
- e.onOpenChange(!1), d.preventDefault();
295
+ e.onOpenChange(!1), u.preventDefault();
293
296
  } else
294
297
  e.onVisuallyFocussedItemChange(null);
295
298
  }),
296
- onChange: T(r.onChange, (d) => {
297
- e.onTextValueChange(d.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(d.currentTarget.value);
299
+ onChange: T(r.onChange, (u) => {
300
+ e.onTextValueChange(u.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(u.currentTarget.value);
298
301
  }),
299
- onKeyUp: T(r.onKeyUp, (d) => {
300
- !e.open && (et(d.key) || ["Backspace"].includes(d.key)) && a(), setTimeout(() => {
301
- if (e.autocomplete === "both" && et(d.key) && e.filterValue !== void 0) {
302
- const m = e.filterValue, h = o().find((u) => n(u.textValue, m));
303
- h && e.onTextValueChange(h.textValue);
302
+ onKeyUp: T(r.onKeyUp, (u) => {
303
+ if (!e.open && (e.isPrintableCharacter(u.key) || ["Backspace"].includes(u.key)) && a(), setTimeout(() => {
304
+ if (e.autocomplete === "both" && e.isPrintableCharacter(u.key) && e.filterValue !== void 0) {
305
+ const x = e.filterValue, p = o().find((d) => n(d.textValue, x));
306
+ p && e.onTextValueChange(p.textValue);
304
307
  }
305
- });
308
+ }), e.autocomplete === "none" && e.isPrintableCharacter(u.key)) {
309
+ const x = e.textValue ?? "", p = o().find((d) => n(d.textValue, x));
310
+ p && (e.onVisuallyFocussedItemChange(p.ref.current), p.ref.current?.scrollIntoView());
311
+ }
306
312
  }),
307
313
  onBlur: T(r.onBlur, () => {
314
+ if (e.open)
315
+ return;
308
316
  e.onVisuallyFocussedItemChange(null);
309
- const [d] = o().filter(
310
- (h) => h.textValue === e.textValue && h.type === "option"
317
+ const [u] = o().filter(
318
+ (p) => p.textValue === e.textValue && p.type === "option"
311
319
  );
320
+ if (u) {
321
+ e.onValueChange(u.value), e.autocomplete === "both" && e.onFilterValueChange(u.textValue);
322
+ return;
323
+ }
312
324
  if (e.allowCustomValue) {
313
- d && (e.onValueChange(d.value), e.autocomplete === "both" && e.onFilterValueChange(d.textValue));
325
+ e.onValueChange(e.textValue), e.autocomplete === "both" && e.onFilterValueChange(e.textValue);
314
326
  return;
315
327
  }
316
- const [m] = o().filter((h) => h.value === e.value && h.type === "option");
317
- d ? e.onValueChange(d.value) : m && e.textValue !== "" ? (e.onTextValueChange(m.textValue), e.autocomplete === "both" && e.onFilterValueChange(m.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
328
+ const [x] = o().filter((p) => p.value === e.value && p.type === "option");
329
+ x && e.textValue !== "" ? (e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
318
330
  })
319
331
  }
320
332
  );
321
- }), jt = l.forwardRef((r, s) => {
322
- const { children: e, ...t } = r, o = z(pt), n = o.disabled, i = () => {
333
+ }), jt = l.forwardRef((r, c) => {
334
+ const { children: e, ...t } = r, o = K(ft), n = o.disabled, i = () => {
323
335
  n || (o.onOpenChange(!0), o.trigger?.focus());
324
336
  };
325
337
  return /* @__PURE__ */ f(
@@ -334,45 +346,49 @@ const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !
334
346
  "data-disabled": n ? "" : void 0,
335
347
  ...t,
336
348
  tabIndex: -1,
337
- ref: s,
349
+ ref: c,
338
350
  onClick: T(t.onClick, () => {
339
351
  o.trigger?.focus();
340
352
  }),
341
- onPointerDown: T(t.onPointerDown, (c) => {
342
- c.button === 0 && c.ctrlKey === !1 && (i(), c.preventDefault());
353
+ onPointerDown: T(t.onPointerDown, (s) => {
354
+ s.button === 0 && s.ctrlKey === !1 && (i(), s.preventDefault());
343
355
  }),
344
- onKeyDown: T(t.onKeyDown, (c) => {
345
- Bt.includes(c.key) && (i(), c.preventDefault());
356
+ onKeyDown: T(t.onKeyDown, (s) => {
357
+ Lt.includes(s.key) && (i(), s.preventDefault());
346
358
  }),
347
359
  children: e || "▼"
348
360
  }
349
361
  );
350
- }), Yt = "ComboboxPortal", mt = (r) => /* @__PURE__ */ f(at, { asChild: !0, ...r });
351
- mt.displayName = Yt;
352
- const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
353
- const e = z(ht), [t, o] = l.useState();
354
- if (F(() => {
355
- o(new DocumentFragment());
356
- }, []), !e.open) {
357
- const n = t;
358
- return n ? xe.createPortal(
362
+ }), Yt = "ComboboxPortal", pt = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
363
+ pt.displayName = Yt;
364
+ const mt = "ComboboxContent", qt = l.forwardRef((r, c) => {
365
+ const e = K(mt), { getItems: t } = me(void 0), [o, n] = l.useState();
366
+ if (L(() => {
367
+ n(new DocumentFragment());
368
+ }, []), L(() => {
369
+ e.open && e.autocomplete === "none" && setTimeout(() => {
370
+ t().find((s) => s.value === e.value)?.ref.current?.scrollIntoView({ block: "nearest" });
371
+ });
372
+ }, [t, e.autocomplete, e.value, e.open]), !e.open) {
373
+ const i = o;
374
+ return i ? Ce.createPortal(
359
375
  /* @__PURE__ */ f(ae.Slot, { scope: void 0, children: /* @__PURE__ */ f("div", { children: r.children }) }),
360
- n
376
+ i
361
377
  ) : null;
362
378
  }
363
- return /* @__PURE__ */ f(Zt, { ...r, ref: s });
379
+ return /* @__PURE__ */ f(Zt, { ...r, ref: c });
364
380
  }), Xt = 10, Zt = l.forwardRef(
365
- (r, s) => {
366
- const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = z(ht), i = A(s, (a) => n.onContentChange(a)), { onOpenChange: c } = n;
367
- return st(), l.useEffect(() => {
381
+ (r, c) => {
382
+ const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = K(mt), i = M(c, (a) => n.onContentChange(a)), { onOpenChange: s } = n;
383
+ return lt(), l.useEffect(() => {
368
384
  const a = () => {
369
- c(!1);
385
+ s(!1);
370
386
  };
371
387
  return window.addEventListener("blur", a), window.addEventListener("resize", a), () => {
372
388
  window.removeEventListener("blur", a), window.removeEventListener("resize", a);
373
389
  };
374
- }, [c]), /* @__PURE__ */ f(dt, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
375
- lt,
390
+ }, [s]), /* @__PURE__ */ f(ut, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
391
+ rt,
376
392
  {
377
393
  asChild: !0,
378
394
  onEscapeKeyDown: e,
@@ -406,13 +422,13 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
406
422
  ) });
407
423
  }
408
424
  ), Jt = l.forwardRef(
409
- (r, s) => {
425
+ (r, c) => {
410
426
  const { align: e = "start", collisionPadding: t = Xt, ...o } = r;
411
427
  return /* @__PURE__ */ f(
412
- re.Content,
428
+ le.Content,
413
429
  {
414
430
  ...o,
415
- ref: s,
431
+ ref: c,
416
432
  align: e,
417
433
  collisionPadding: t,
418
434
  style: {
@@ -428,8 +444,8 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
428
444
  }
429
445
  );
430
446
  }
431
- ), Qt = "ComboboxViewport", eo = l.forwardRef((r, s) => {
432
- const e = z(Qt), t = A(s, e.onViewportChange);
447
+ ), Qt = "ComboboxViewport", eo = l.forwardRef((r, c) => {
448
+ const e = K(Qt), t = M(c, e.onViewportChange);
433
449
  return /* @__PURE__ */ Ae(_e, { children: [
434
450
  /* @__PURE__ */ f(
435
451
  "style",
@@ -458,109 +474,109 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
458
474
  }
459
475
  ) })
460
476
  ] });
461
- }), Oe = "ComboboxItem", [tt, De] = rt(Oe), gt = l.forwardRef((r, s) => {
462
- const { value: e, disabled: t = !1, textValue: o } = r, [n, i] = l.useState();
463
- F(() => {
464
- i(new DocumentFragment());
477
+ }), Oe = "ComboboxItem", [et, De] = nt(Oe), ht = l.forwardRef((r, c) => {
478
+ const { value: e, disabled: t = !1, textValue: o, ...n } = r, [i, s] = l.useState();
479
+ L(() => {
480
+ s(new DocumentFragment());
465
481
  }, []);
466
- const { onTextValueChange: c, textValue: a, ...p } = z(Oe), d = ne(), [m, h] = l.useState(o ?? ""), u = p.value === e, { startsWith: x } = Me(p.locale, { sensitivity: "base" }), v = l.useCallback((C) => {
467
- h((b) => b || (C?.textContent ?? "").trim());
482
+ const { onTextValueChange: a, textValue: m, ...u } = K(Oe), x = re(), [p, d] = l.useState(o ?? ""), h = u.value === e, { startsWith: v } = Me(u.locale, { sensitivity: "base" }), C = l.useCallback((b) => {
483
+ d((g) => g || (b?.textContent ?? "").trim());
468
484
  }, []);
469
485
  return l.useEffect(() => {
470
- u && a === void 0 && m !== "" && c(m);
471
- }, [m, u, a, c]), p.autocomplete === "both" && m && p.filterValue && !x(m, p.filterValue) || p.autocomplete === "list" && m && a && !x(m, a) ? n ? xe.createPortal(
486
+ h && m === void 0 && p !== "" && a(p);
487
+ }, [p, h, m, a]), u.autocomplete === "both" && p && u.filterValue && !v(p, u.filterValue) || u.autocomplete === "list" && p && m && !v(p, m) ? i ? Ce.createPortal(
472
488
  /* @__PURE__ */ f(
473
- tt,
489
+ et,
474
490
  {
475
- textId: d,
476
- onTextValueChange: v,
477
- isSelected: u,
478
- textValue: m,
491
+ textId: x,
492
+ onTextValueChange: C,
493
+ isSelected: h,
494
+ textValue: p,
479
495
  children: /* @__PURE__ */ f(
480
496
  ae.ItemSlot,
481
497
  {
482
498
  scope: void 0,
483
499
  value: e,
484
- textValue: m,
500
+ textValue: p,
485
501
  disabled: t,
486
502
  type: "option",
487
503
  isVisible: !1,
488
- children: /* @__PURE__ */ f(ot, { ref: s, ...r })
504
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
489
505
  }
490
506
  )
491
507
  }
492
508
  ),
493
- n
509
+ i
494
510
  ) : null : /* @__PURE__ */ f(
495
- tt,
511
+ et,
496
512
  {
497
- textId: d,
498
- onTextValueChange: v,
499
- isSelected: u,
500
- textValue: m,
513
+ textId: x,
514
+ onTextValueChange: C,
515
+ isSelected: h,
516
+ textValue: p,
501
517
  children: /* @__PURE__ */ f(
502
518
  ae.ItemSlot,
503
519
  {
504
520
  scope: void 0,
505
521
  value: e,
506
- textValue: m,
522
+ textValue: p,
507
523
  disabled: t,
508
524
  type: "option",
509
525
  isVisible: !0,
510
- children: /* @__PURE__ */ f(ot, { ref: s, ...r })
526
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
511
527
  }
512
528
  )
513
529
  }
514
530
  );
515
- }), to = "ComboboxItemImpl", ot = l.forwardRef((r, s) => {
516
- const { value: e, disabled: t = !1, ...o } = r, n = l.useRef(null), i = A(s, n), { getItems: c } = Ce(void 0), { onTextValueChange: a, visuallyFocussedItem: p, ...d } = z(Oe), { isSelected: m, textValue: h, textId: u } = De(to), x = () => {
517
- t || (d.onValueChange(e), a(h), d.onOpenChange(!1), d.autocomplete === "both" && d.onFilterValueChange(h), d.trigger?.focus({ preventScroll: !0 }));
518
- }, v = l.useMemo(() => p === c().find((b) => b.ref.current === n.current)?.ref.current, [c, p]), C = ne();
531
+ }), to = "ComboboxItemImpl", tt = l.forwardRef((r, c) => {
532
+ const { value: e, disabled: t = !1, ...o } = r, n = l.useRef(null), i = M(c, n), { getItems: s } = me(void 0), { onTextValueChange: a, visuallyFocussedItem: m, ...u } = K(Oe), { isSelected: x, textValue: p, textId: d } = De(to), h = () => {
533
+ t || (u.onValueChange(e), a(p), u.onOpenChange(!1), u.autocomplete === "both" && u.onFilterValueChange(p), u.trigger?.focus({ preventScroll: !0 }));
534
+ }, v = l.useMemo(() => m === s().find((b) => b.ref.current === n.current)?.ref.current, [s, m]), C = re();
519
535
  return /* @__PURE__ */ f(
520
536
  N.div,
521
537
  {
522
538
  role: "option",
523
- "aria-labelledby": u,
539
+ "aria-labelledby": d,
524
540
  "data-highlighted": v ? "" : void 0,
525
- "aria-selected": m && v,
526
- "data-state": m ? "checked" : "unchecked",
541
+ "aria-selected": x && v,
542
+ "data-state": x ? "checked" : "unchecked",
527
543
  "aria-disabled": t || void 0,
528
544
  "data-disabled": t ? "" : void 0,
529
545
  tabIndex: t ? void 0 : -1,
530
546
  ...o,
531
547
  id: C,
532
548
  ref: i,
533
- onPointerUp: T(o.onPointerUp, x)
549
+ onPointerUp: T(o.onPointerUp, h)
534
550
  }
535
551
  );
536
- }), oo = "ComboboxItemText", no = l.forwardRef((r, s) => {
537
- const { className: e, style: t, ...o } = r, n = De(oo), i = A(s, n.onTextValueChange);
552
+ }), oo = "ComboboxItemText", no = l.forwardRef((r, c) => {
553
+ const { className: e, style: t, ...o } = r, n = De(oo), i = M(c, n.onTextValueChange);
538
554
  return /* @__PURE__ */ f(N.span, { id: n.textId, ...o, ref: i });
539
- }), ro = "ComboboxItemIndicator", lo = l.forwardRef((r, s) => {
555
+ }), ro = "ComboboxItemIndicator", lo = l.forwardRef((r, c) => {
540
556
  const { isSelected: e } = De(ro);
541
- return e ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...r, ref: s }) : null;
542
- }), xt = "ComboboxNoValueFound", so = l.forwardRef((r, s) => {
543
- const { textValue: e = "", filterValue: t = "", locale: o, autocomplete: n } = z(xt), [i, c] = l.useState([]), { subscribe: a } = Ce(void 0), { startsWith: p } = Me(o, { sensitivity: "base" });
557
+ return e ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...r, ref: c }) : null;
558
+ }), gt = "ComboboxNoValueFound", so = l.forwardRef((r, c) => {
559
+ const { textValue: e = "", filterValue: t = "", locale: o, autocomplete: n } = K(gt), [i, s] = l.useState([]), { subscribe: a } = me(void 0), { startsWith: m } = Me(o, { sensitivity: "base" });
544
560
  return l.useEffect(() => {
545
- const d = a((m) => {
546
- c(m);
561
+ const u = a((x) => {
562
+ s(x);
547
563
  });
548
564
  return () => {
549
- d();
565
+ u();
550
566
  };
551
- }, [a]), i.length === 0 || n === "list" && i.some((d) => p(d.textValue, e)) || n === "both" && i.some((d) => p(d.textValue, t)) ? null : /* @__PURE__ */ f(N.div, { ...r, ref: s });
552
- }), co = l.forwardRef((r, s) => {
553
- const { disabled: e = !1, ...t } = r, o = z(xt), { textValue: n, visuallyFocussedItem: i } = o, { getItems: c, subscribe: a } = Ce(void 0), p = l.useRef(null), [d, m] = l.useState(!1), h = A(s, p), u = l.useMemo(() => i === c().find((C) => C.ref.current === p.current)?.ref.current, [c, i]), x = ne(), v = () => {
567
+ }, [a]), i.length === 0 || n === "none" || n === "list" && i.some((u) => m(u.textValue, e)) || n === "both" && i.some((u) => m(u.textValue, t)) ? null : /* @__PURE__ */ f(N.div, { ...r, ref: c });
568
+ }), co = l.forwardRef((r, c) => {
569
+ const { disabled: e = !1, ...t } = r, o = K(gt), { textValue: n, visuallyFocussedItem: i } = o, { getItems: s, subscribe: a } = me(void 0), m = l.useRef(null), [u, x] = l.useState(!1), p = M(c, m), d = l.useMemo(() => i === s().find((C) => C.ref.current === m.current)?.ref.current, [s, i]), h = re(), v = () => {
554
570
  !e && n && (o.onValueChange(n), o.onTextValueChange(n), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(n), o.trigger?.focus({ preventScroll: !0 }));
555
571
  };
556
- return F(() => {
572
+ return L(() => {
557
573
  const C = a((b) => {
558
- m(!b.some((g) => g.textValue === n && g.type !== "create"));
574
+ x(!b.some((g) => g.textValue === n && g.type !== "create"));
559
575
  });
560
- return c().length === 0 && m(!0), () => {
576
+ return s().length === 0 && x(!0), () => {
561
577
  C();
562
578
  };
563
- }, [n, a, c]), !n || !d ? null : /* @__PURE__ */ f(
579
+ }, [n, a, s]), !n || !u ? null : /* @__PURE__ */ f(
564
580
  ae.ItemSlot,
565
581
  {
566
582
  scope: void 0,
@@ -576,26 +592,26 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
576
592
  tabIndex: e ? void 0 : -1,
577
593
  "aria-disabled": e || void 0,
578
594
  "data-disabled": e ? "" : void 0,
579
- "data-highlighted": u ? "" : void 0,
595
+ "data-highlighted": d ? "" : void 0,
580
596
  ...t,
581
- id: x,
582
- ref: h,
597
+ id: h,
598
+ ref: p,
583
599
  onPointerUp: T(t.onPointerUp, v)
584
600
  }
585
601
  )
586
602
  }
587
603
  );
588
- }), io = Kt, ao = zt, uo = Gt, fo = jt, po = mt, mo = qt, ho = eo, go = gt, xo = no, Co = lo, vo = so, bo = co;
589
- function So(r, s) {
590
- const e = Math.min(r.length, s.length);
604
+ }), io = Kt, ao = zt, uo = Gt, fo = jt, po = pt, mo = qt, ho = eo, go = ht, xo = no, Co = lo, vo = so, bo = co;
605
+ function So(r, c) {
606
+ const e = Math.min(r.length, c.length);
591
607
  for (let t = 0; t < e; t++)
592
- if (r[t] !== s[t])
608
+ if (r[t] !== c[t])
593
609
  return t;
594
610
  return e;
595
611
  }
596
612
  const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
597
613
  __proto__: null,
598
- ComboboxItem: gt,
614
+ ComboboxItem: ht,
599
615
  Content: mo,
600
616
  CreateItem: bo,
601
617
  Icon: fo,
@@ -608,67 +624,67 @@ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
608
624
  TextInput: uo,
609
625
  Trigger: ao,
610
626
  Viewport: ho
611
- }, Symbol.toStringTag, { value: "Module" })), wo = [" ", "Enter", "ArrowUp", "ArrowDown"], Io = [" ", "Enter"], me = "Select", [ve, he, yo] = At(me), [ue, To] = nt(me, [
627
+ }, Symbol.toStringTag, { value: "Module" })), Io = [" ", "Enter", "ArrowUp", "ArrowDown"], wo = [" ", "Enter"], he = "Select", [ve, ge, yo] = Nt(he), [ue, To] = ot(he, [
612
628
  yo,
613
- it
614
- ]), be = it(), [Vo, Y] = ue(me), [Po, Eo] = ue(me), ke = (r) => {
629
+ ct
630
+ ]), be = ct(), [Vo, Y] = ue(he), [Po, Eo] = ue(he), ke = (r) => {
615
631
  const {
616
- __scopeSelect: s,
632
+ __scopeSelect: c,
617
633
  children: e,
618
634
  open: t,
619
635
  defaultOpen: o,
620
636
  onOpenChange: n,
621
637
  value: i,
622
- defaultValue: c,
638
+ defaultValue: s,
623
639
  onValueChange: a,
624
- dir: p,
640
+ dir: m,
625
641
  // name,
626
642
  // autoComplete,
627
- disabled: d,
628
- required: m,
629
- multi: h = !1
630
- } = r, u = be(s), [x, v] = l.useState(null), [C, b] = l.useState(null), [g, w] = l.useState(!1), _ = _t(p), [V = !1, D] = ie({
643
+ disabled: u,
644
+ required: x,
645
+ multi: p = !1
646
+ } = r, d = be(c), [h, v] = l.useState(null), [C, b] = l.useState(null), [g, I] = l.useState(!1), E = At(m), [O = !1, A] = ie({
631
647
  prop: t,
632
648
  defaultProp: o,
633
649
  onChange: n
634
- }), [E, k] = ie({
650
+ }), [_, k] = ie({
635
651
  prop: i,
636
- defaultProp: c,
637
- onChange(M) {
638
- a && (Array.isArray(M), a(M));
652
+ defaultProp: s,
653
+ onChange(D) {
654
+ a && (Array.isArray(D), a(D));
639
655
  }
640
- }), H = l.useRef(null), [G, $] = l.useState(/* @__PURE__ */ new Set());
641
- return /* @__PURE__ */ f(re.Root, { ...u, children: /* @__PURE__ */ f(
656
+ }), q = l.useRef(null), [W, B] = l.useState(/* @__PURE__ */ new Set());
657
+ return /* @__PURE__ */ f(le.Root, { ...d, children: /* @__PURE__ */ f(
642
658
  Vo,
643
659
  {
644
- required: m,
645
- scope: s,
646
- trigger: x,
660
+ required: x,
661
+ scope: c,
662
+ trigger: h,
647
663
  onTriggerChange: v,
648
664
  valueNode: C,
649
665
  onValueNodeChange: b,
650
666
  valueNodeHasChildren: g,
651
- onValueNodeHasChildrenChange: w,
652
- contentId: ne(),
653
- value: E,
667
+ onValueNodeHasChildrenChange: I,
668
+ contentId: re(),
669
+ value: _,
654
670
  onValueChange: k,
655
- open: V,
656
- onOpenChange: D,
657
- dir: _,
658
- triggerPointerDownPosRef: H,
659
- disabled: d,
660
- multi: h,
661
- children: /* @__PURE__ */ f(ve.Provider, { scope: s, children: /* @__PURE__ */ f(
671
+ open: O,
672
+ onOpenChange: A,
673
+ dir: E,
674
+ triggerPointerDownPosRef: q,
675
+ disabled: u,
676
+ multi: p,
677
+ children: /* @__PURE__ */ f(ve.Provider, { scope: c, children: /* @__PURE__ */ f(
662
678
  Po,
663
679
  {
664
680
  scope: r.__scopeSelect,
665
- onNativeOptionAdd: l.useCallback((M) => {
666
- $((L) => new Set(L).add(M));
681
+ onNativeOptionAdd: l.useCallback((D) => {
682
+ B((H) => new Set(H).add(D));
667
683
  }, []),
668
- onNativeOptionRemove: l.useCallback((M) => {
669
- $((L) => {
670
- const B = new Set(L);
671
- return B.delete(M), B;
684
+ onNativeOptionRemove: l.useCallback((D) => {
685
+ B((H) => {
686
+ const F = new Set(H);
687
+ return F.delete(D), F;
672
688
  });
673
689
  }, []),
674
690
  children: e
@@ -677,19 +693,19 @@ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
677
693
  }
678
694
  ) });
679
695
  };
680
- ke.displayName = me;
681
- const Ct = "SelectTrigger", Fe = l.forwardRef(
682
- (r, s) => {
683
- const { __scopeSelect: e, ...t } = r, o = be(e), n = Y(Ct, e), i = n.disabled, c = A(s, n.onTriggerChange), a = he(e), [p, d, m] = Et((u) => {
684
- const x = a().filter((b) => !b.disabled), v = x.find((b) => b.value === n.value), C = Rt(x, u, v);
696
+ ke.displayName = he;
697
+ const xt = "SelectTrigger", Fe = l.forwardRef(
698
+ (r, c) => {
699
+ const { __scopeSelect: e, ...t } = r, o = be(e), n = Y(xt, e), i = n.disabled, s = M(c, n.onTriggerChange), a = ge(e), [m, u, x] = Pt((d) => {
700
+ const h = a().filter((b) => !b.disabled), v = h.find((b) => b.value === n.value), C = Et(h, d, v);
685
701
  if (C !== void 0 && !Array.isArray(C.value)) {
686
702
  const b = n.multi ? [C.value] : C.value;
687
703
  n.onValueChange(b);
688
704
  }
689
- }), h = () => {
690
- i || (n.onOpenChange(!0), m());
705
+ }), p = () => {
706
+ i || (n.onOpenChange(!0), x());
691
707
  };
692
- return /* @__PURE__ */ f(re.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ f(
708
+ return /* @__PURE__ */ f(le.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ f(
693
709
  N.div,
694
710
  {
695
711
  role: "combobox",
@@ -703,89 +719,89 @@ const Ct = "SelectTrigger", Fe = l.forwardRef(
703
719
  "data-placeholder": n.value === void 0 ? "" : void 0,
704
720
  tabIndex: i ? void 0 : 0,
705
721
  ...t,
706
- ref: c,
707
- onClick: T(t.onClick, (u) => {
708
- u.currentTarget.focus();
722
+ ref: s,
723
+ onClick: T(t.onClick, (d) => {
724
+ d.currentTarget.focus();
709
725
  }),
710
- onPointerDown: T(t.onPointerDown, (u) => {
711
- const x = u.target;
712
- x.hasPointerCapture(u.pointerId) && x.releasePointerCapture(u.pointerId), (x.closest("button") ?? x.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (h(), n.triggerPointerDownPosRef.current = {
713
- x: Math.round(u.pageX),
714
- y: Math.round(u.pageY)
715
- }, u.preventDefault());
726
+ onPointerDown: T(t.onPointerDown, (d) => {
727
+ const h = d.target;
728
+ h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), (h.closest("button") ?? h.closest("div")) === d.currentTarget && d.button === 0 && d.ctrlKey === !1 && (p(), n.triggerPointerDownPosRef.current = {
729
+ x: Math.round(d.pageX),
730
+ y: Math.round(d.pageY)
731
+ }, d.preventDefault());
716
732
  }),
717
- onKeyDown: T(t.onKeyDown, (u) => {
718
- const x = p.current !== "", v = u.ctrlKey || u.altKey || u.metaKey, C = u.target;
719
- (C.closest("button") ?? C.closest("div")) === u.currentTarget && (!v && u.key.length === 1 && d(u.key), !(x && u.key === " ") && wo.includes(u.key) && (h(), u.preventDefault()));
733
+ onKeyDown: T(t.onKeyDown, (d) => {
734
+ const h = m.current !== "", v = d.ctrlKey || d.altKey || d.metaKey, C = d.target;
735
+ (C.closest("button") ?? C.closest("div")) === d.currentTarget && (!v && d.key.length === 1 && u(d.key), !(h && d.key === " ") && Io.includes(d.key) && (p(), d.preventDefault()));
720
736
  })
721
737
  }
722
738
  ) });
723
739
  }
724
740
  );
725
- Fe.displayName = Ct;
726
- const vt = "SelectValue", Le = l.forwardRef(
727
- (r, s) => {
728
- const { __scopeSelect: e, children: t, placeholder: o, ...n } = r, i = Y(vt, e), { onValueNodeHasChildrenChange: c } = i, a = t !== void 0, p = A(s, i.onValueNodeChange), [d, m] = l.useState([]), h = he(e);
729
- F(() => {
730
- c(a);
731
- }, [c, a]), l.useLayoutEffect(() => {
732
- if (Array.isArray(i.value) && d.length !== i.value.length) {
733
- const x = setTimeout(() => {
734
- const v = h().filter(
741
+ Fe.displayName = xt;
742
+ const Ct = "SelectValue", Le = l.forwardRef(
743
+ (r, c) => {
744
+ const { __scopeSelect: e, children: t, placeholder: o, ...n } = r, i = Y(Ct, e), { onValueNodeHasChildrenChange: s } = i, a = t !== void 0, m = M(c, i.onValueNodeChange), [u, x] = l.useState([]), p = ge(e);
745
+ L(() => {
746
+ s(a);
747
+ }, [s, a]), l.useLayoutEffect(() => {
748
+ if (Array.isArray(i.value) && u.length !== i.value.length) {
749
+ const h = setTimeout(() => {
750
+ const v = p().filter(
735
751
  (C) => Array.isArray(C.value) ? !1 : i.value?.includes(C.value)
736
752
  );
737
- m(v);
753
+ x(v);
738
754
  });
739
755
  return () => {
740
- clearTimeout(x);
756
+ clearTimeout(h);
741
757
  };
742
758
  }
743
- }, [i.value, h, d]);
744
- let u;
759
+ }, [i.value, p, u]);
760
+ let d;
745
761
  if ((i.value === void 0 || i.value.length === 0) && o !== void 0)
746
- u = /* @__PURE__ */ f("span", { children: o });
762
+ d = /* @__PURE__ */ f("span", { children: o });
747
763
  else if (typeof t == "function")
748
764
  if (Array.isArray(i.value)) {
749
- const x = i.value.map((v) => {
750
- const C = d.find((b) => b.value === v);
765
+ const h = i.value.map((v) => {
766
+ const C = u.find((b) => b.value === v);
751
767
  return C ? t({ value: v, textValue: C?.textValue }) : null;
752
768
  });
753
- u = x.every((v) => v === null) ? o : x;
769
+ d = h.every((v) => v === null) ? o : h;
754
770
  } else
755
- u = t(i.value);
771
+ d = t(i.value);
756
772
  else
757
- u = t;
758
- return /* @__PURE__ */ f(N.span, { ...n, ref: p, children: u || null });
773
+ d = t;
774
+ return /* @__PURE__ */ f(N.span, { ...n, ref: m, children: d || null });
759
775
  }
760
776
  );
761
- Le.displayName = vt;
777
+ Le.displayName = Ct;
762
778
  const Ro = "SelectIcon", Be = l.forwardRef(
763
- (r, s) => {
779
+ (r, c) => {
764
780
  const { __scopeSelect: e, children: t, ...o } = r;
765
- return /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: s, children: t || "▼" });
781
+ return /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t || "▼" });
766
782
  }
767
783
  );
768
784
  Be.displayName = Ro;
769
- const No = "SelectPortal", He = (r) => /* @__PURE__ */ f(at, { asChild: !0, ...r });
785
+ const No = "SelectPortal", He = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
770
786
  He.displayName = No;
771
- const oe = "SelectContent", $e = l.forwardRef(
772
- (r, s) => {
773
- const e = Y(oe, r.__scopeSelect), [t, o] = l.useState();
774
- if (F(() => {
787
+ const ne = "SelectContent", $e = l.forwardRef(
788
+ (r, c) => {
789
+ const e = Y(ne, r.__scopeSelect), [t, o] = l.useState();
790
+ if (L(() => {
775
791
  o(new DocumentFragment());
776
792
  }, []), !e.open) {
777
793
  const n = t;
778
- return n ? xe.createPortal(
779
- /* @__PURE__ */ f(bt, { scope: r.__scopeSelect, children: /* @__PURE__ */ f(ve.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ f("div", { children: r.children }) }) }),
794
+ return n ? Ce.createPortal(
795
+ /* @__PURE__ */ f(vt, { scope: r.__scopeSelect, children: /* @__PURE__ */ f(ve.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ f("div", { children: r.children }) }) }),
780
796
  n
781
797
  ) : null;
782
798
  }
783
- return /* @__PURE__ */ f(St, { ...r, ref: s });
799
+ return /* @__PURE__ */ f(bt, { ...r, ref: c });
784
800
  }
785
801
  );
786
- $e.displayName = oe;
787
- const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
788
- (r, s) => {
802
+ $e.displayName = ne;
803
+ const j = 10, [vt, J] = ue(ne), Ao = "SelectContentImpl", bt = l.forwardRef(
804
+ (r, c) => {
789
805
  const {
790
806
  __scopeSelect: e,
791
807
  position: t = "item-aligned",
@@ -794,105 +810,105 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
794
810
  onPointerDownOutside: i,
795
811
  //
796
812
  // PopperContent props
797
- side: c,
813
+ side: s,
798
814
  sideOffset: a,
799
- align: p,
800
- alignOffset: d,
801
- arrowPadding: m,
802
- collisionBoundary: h,
803
- collisionPadding: u,
804
- sticky: x,
815
+ align: m,
816
+ alignOffset: u,
817
+ arrowPadding: x,
818
+ collisionBoundary: p,
819
+ collisionPadding: d,
820
+ sticky: h,
805
821
  hideWhenDetached: v,
806
822
  avoidCollisions: C,
807
823
  //
808
824
  ...b
809
- } = r, g = Y(oe, e), [w, _] = l.useState(null), [V, D] = l.useState(null), E = A(s, (S) => _(S)), [k, H] = l.useState(null), [G, $] = l.useState(null), M = he(e), [L, B] = l.useState(!1), U = l.useRef(!1);
825
+ } = r, g = Y(ne, e), [I, E] = l.useState(null), [O, A] = l.useState(null), _ = M(c, (S) => E(S)), [k, q] = l.useState(null), [W, B] = l.useState(null), D = ge(e), [H, F] = l.useState(!1), z = l.useRef(!1);
810
826
  l.useEffect(() => {
811
- if (w)
812
- return ut(w);
813
- }, [w]), st();
814
- const K = l.useCallback(
827
+ if (I)
828
+ return at(I);
829
+ }, [I]), lt();
830
+ const G = l.useCallback(
815
831
  (S) => {
816
- const [I, ...O] = M().map((R) => R.ref.current), [y] = O.slice(-1), P = document.activeElement;
832
+ const [V, ...y] = D().map((R) => R.ref.current), [w] = y.slice(-1), P = document.activeElement;
817
833
  for (const R of S)
818
- if (R === P || (R?.scrollIntoView({ block: "nearest" }), R === I && V && (V.scrollTop = 0), R === y && V && (V.scrollTop = V.scrollHeight), R?.focus(), document.activeElement !== P))
834
+ if (R === P || (R?.scrollIntoView({ block: "nearest" }), R === V && O && (O.scrollTop = 0), R === w && O && (O.scrollTop = O.scrollHeight), R?.focus(), document.activeElement !== P))
819
835
  return;
820
836
  },
821
- [M, V]
822
- ), q = l.useCallback(
823
- () => K([k, w]),
824
- [K, k, w]
837
+ [D, O]
838
+ ), $ = l.useCallback(
839
+ () => G([k, I]),
840
+ [G, k, I]
825
841
  );
826
842
  l.useEffect(() => {
827
- L && q();
828
- }, [L, q]);
829
- const { onOpenChange: X, triggerPointerDownPosRef: W } = g;
843
+ H && $();
844
+ }, [H, $]);
845
+ const { onOpenChange: X, triggerPointerDownPosRef: U } = g;
830
846
  l.useEffect(() => {
831
- if (w) {
847
+ if (I) {
832
848
  let S = { x: 0, y: 0 };
833
- const I = (y) => {
849
+ const V = (w) => {
834
850
  S = {
835
- x: Math.abs(Math.round(y.pageX) - (W.current?.x ?? 0)),
836
- y: Math.abs(Math.round(y.pageY) - (W.current?.y ?? 0))
851
+ x: Math.abs(Math.round(w.pageX) - (U.current?.x ?? 0)),
852
+ y: Math.abs(Math.round(w.pageY) - (U.current?.y ?? 0))
837
853
  };
838
- }, O = (y) => {
839
- S.x <= 10 && S.y <= 10 ? y.preventDefault() : w.contains(y.target) || X(!1), document.removeEventListener("pointermove", I), W.current = null;
854
+ }, y = (w) => {
855
+ S.x <= 10 && S.y <= 10 ? w.preventDefault() : I.contains(w.target) || X(!1), document.removeEventListener("pointermove", V), U.current = null;
840
856
  };
841
- return W.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", O, { capture: !0, once: !0 })), () => {
842
- document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", O, { capture: !0 });
857
+ return U.current !== null && (document.addEventListener("pointermove", V), document.addEventListener("pointerup", y, { capture: !0, once: !0 })), () => {
858
+ document.removeEventListener("pointermove", V), document.removeEventListener("pointerup", y, { capture: !0 });
843
859
  };
844
860
  }
845
- }, [w, X, W]), l.useEffect(() => {
861
+ }, [I, X, U]), l.useEffect(() => {
846
862
  const S = () => X(!1);
847
863
  return window.addEventListener("blur", S), window.addEventListener("resize", S), () => {
848
864
  window.removeEventListener("blur", S), window.removeEventListener("resize", S);
849
865
  };
850
866
  }, [X]);
851
- const [de, le] = Et((S) => {
852
- const I = M().filter((P) => !P.disabled), O = I.find((P) => P.ref.current === document.activeElement), y = Rt(I, S, O);
853
- y && setTimeout(() => y.ref.current.focus());
854
- }), se = l.useCallback(
855
- (S, I, O) => {
856
- const y = !U.current && !O;
857
- (g.value !== void 0 && g.value === I || y) && (H(S), y && (U.current = !0));
867
+ const [de, se] = Pt((S) => {
868
+ const V = D().filter((P) => !P.disabled), y = V.find((P) => P.ref.current === document.activeElement), w = Et(V, S, y);
869
+ w && setTimeout(() => w.ref.current.focus());
870
+ }), fe = l.useCallback(
871
+ (S, V, y) => {
872
+ const w = !z.current && !y;
873
+ (g.value !== void 0 && g.value === V || w) && (q(S), w && (z.current = !0));
858
874
  },
859
875
  [g.value]
860
- ), fe = l.useCallback(() => w?.focus(), [w]), Z = l.useCallback(
861
- (S, I, O) => {
862
- const y = !U.current && !O;
863
- (g.value !== void 0 && (Array.isArray(I) ? I.every((R) => g.value?.includes(R)) : g.value === I) || y) && $(S);
876
+ ), Q = l.useCallback(() => I?.focus(), [I]), Z = l.useCallback(
877
+ (S, V, y) => {
878
+ const w = !z.current && !y;
879
+ (g.value !== void 0 && (Array.isArray(V) ? V.every((R) => g.value?.includes(R)) : g.value === V) || w) && B(S);
864
880
  },
865
881
  [g.value]
866
- ), ce = t === "popper" ? Ve : wt, Q = ce === Ve ? {
867
- side: c,
882
+ ), ce = t === "popper" ? Ve : St, ee = ce === Ve ? {
883
+ side: s,
868
884
  sideOffset: a,
869
- align: p,
870
- alignOffset: d,
871
- arrowPadding: m,
872
- collisionBoundary: h,
873
- collisionPadding: u,
874
- sticky: x,
885
+ align: m,
886
+ alignOffset: u,
887
+ arrowPadding: x,
888
+ collisionBoundary: p,
889
+ collisionPadding: d,
890
+ sticky: h,
875
891
  hideWhenDetached: v,
876
892
  avoidCollisions: C
877
893
  } : {};
878
894
  return /* @__PURE__ */ f(
879
- bt,
895
+ vt,
880
896
  {
881
897
  scope: e,
882
- content: w,
883
- viewport: V,
884
- onViewportChange: D,
885
- itemRefCallback: se,
898
+ content: I,
899
+ viewport: O,
900
+ onViewportChange: A,
901
+ itemRefCallback: fe,
886
902
  selectedItem: k,
887
- onItemLeave: fe,
903
+ onItemLeave: Q,
888
904
  itemTextRefCallback: Z,
889
- focusSelectedItem: q,
890
- selectedItemText: G,
905
+ focusSelectedItem: $,
906
+ selectedItemText: W,
891
907
  position: t,
892
- isPositioned: L,
908
+ isPositioned: H,
893
909
  searchRef: de,
894
- children: /* @__PURE__ */ f(dt, { as: Te, allowPinchZoom: !0, children: /* @__PURE__ */ f(
895
- ct,
910
+ children: /* @__PURE__ */ f(ut, { as: Te, allowPinchZoom: !0, children: /* @__PURE__ */ f(
911
+ st,
896
912
  {
897
913
  asChild: !0,
898
914
  trapped: g.open,
@@ -903,7 +919,7 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
903
919
  g.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), S.preventDefault();
904
920
  }),
905
921
  children: /* @__PURE__ */ f(
906
- lt,
922
+ rt,
907
923
  {
908
924
  asChild: !0,
909
925
  disableOutsidePointerEvents: !0,
@@ -921,9 +937,9 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
921
937
  dir: g.dir,
922
938
  onContextMenu: (S) => S.preventDefault(),
923
939
  ...b,
924
- ...Q,
925
- onPlaced: () => B(!0),
926
- ref: E,
940
+ ...ee,
941
+ onPlaced: () => F(!0),
942
+ ref: _,
927
943
  style: {
928
944
  // flex layout so we can place the scroll buttons properly
929
945
  display: "flex",
@@ -933,14 +949,14 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
933
949
  ...b.style
934
950
  },
935
951
  onKeyDown: T(b.onKeyDown, (S) => {
936
- const I = S.ctrlKey || S.altKey || S.metaKey;
937
- if (S.key === "Tab" && S.preventDefault(), !I && S.key.length === 1 && le(S.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(S.key)) {
938
- let y = M().filter((P) => !P.disabled).map((P) => P.ref.current);
939
- if (["ArrowUp", "End"].includes(S.key) && (y = y.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
940
- const P = S.target, R = y.indexOf(P);
941
- y = y.slice(R + 1);
952
+ const V = S.ctrlKey || S.altKey || S.metaKey;
953
+ if (S.key === "Tab" && S.preventDefault(), !V && S.key.length === 1 && se(S.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(S.key)) {
954
+ let w = D().filter((P) => !P.disabled).map((P) => P.ref.current);
955
+ if (["ArrowUp", "End"].includes(S.key) && (w = w.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
956
+ const P = S.target, R = w.indexOf(P);
957
+ w = w.slice(R + 1);
942
958
  }
943
- setTimeout(() => K(y)), S.preventDefault();
959
+ setTimeout(() => G(w)), S.preventDefault();
944
960
  }
945
961
  })
946
962
  }
@@ -953,71 +969,71 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
953
969
  );
954
970
  }
955
971
  );
956
- St.displayName = Ao;
957
- const _o = "SelectItemAlignedPosition", wt = l.forwardRef(
958
- (r, s) => {
959
- const { __scopeSelect: e, onPlaced: t, ...o } = r, n = Y(oe, e), i = J(oe, e), [c, a] = l.useState(null), [p, d] = l.useState(null), m = A(s, (E) => d(E)), h = he(e), u = l.useRef(!1), x = l.useRef(!0), { viewport: v, selectedItem: C, selectedItemText: b, focusSelectedItem: g } = i, w = l.useCallback(() => {
960
- if (n.trigger && n.valueNode && c && p && v && C && b) {
961
- const E = n.trigger.getBoundingClientRect(), k = p.getBoundingClientRect(), H = n.valueNode.getBoundingClientRect(), G = b.getBoundingClientRect();
972
+ bt.displayName = Ao;
973
+ const _o = "SelectItemAlignedPosition", St = l.forwardRef(
974
+ (r, c) => {
975
+ const { __scopeSelect: e, onPlaced: t, ...o } = r, n = Y(ne, e), i = J(ne, e), [s, a] = l.useState(null), [m, u] = l.useState(null), x = M(c, (_) => u(_)), p = ge(e), d = l.useRef(!1), h = l.useRef(!0), { viewport: v, selectedItem: C, selectedItemText: b, focusSelectedItem: g } = i, I = l.useCallback(() => {
976
+ if (n.trigger && n.valueNode && s && m && v && C && b) {
977
+ const _ = n.trigger.getBoundingClientRect(), k = m.getBoundingClientRect(), q = n.valueNode.getBoundingClientRect(), W = b.getBoundingClientRect();
962
978
  if (n.dir !== "rtl") {
963
- const P = G.left - k.left, R = H.left - P, ee = E.left - R, te = E.width + ee, Se = Math.max(te, k.width), we = window.innerWidth - j, Ie = Qe(R, [j, we - Se]);
964
- c.style.minWidth = `${te}px`, c.style.left = `${Ie}px`;
979
+ const P = W.left - k.left, R = q.left - P, te = _.left - R, oe = _.width + te, Se = Math.max(oe, k.width), Ie = window.innerWidth - j, we = Qe(R, [j, Ie - Se]);
980
+ s.style.minWidth = `${oe}px`, s.style.left = `${we}px`;
965
981
  } else {
966
- const P = k.right - G.right, R = window.innerWidth - H.right - P, ee = window.innerWidth - E.right - R, te = E.width + ee, Se = Math.max(te, k.width), we = window.innerWidth - j, Ie = Qe(R, [j, we - Se]);
967
- c.style.minWidth = `${te}px`, c.style.right = `${Ie}px`;
982
+ const P = k.right - W.right, R = window.innerWidth - q.right - P, te = window.innerWidth - _.right - R, oe = _.width + te, Se = Math.max(oe, k.width), Ie = window.innerWidth - j, we = Qe(R, [j, Ie - Se]);
983
+ s.style.minWidth = `${oe}px`, s.style.right = `${we}px`;
968
984
  }
969
- const $ = h(), M = window.innerHeight - j * 2, L = v.scrollHeight, B = window.getComputedStyle(p), U = parseInt(B.borderTopWidth, 10), K = parseInt(B.paddingTop, 10), q = parseInt(B.borderBottomWidth, 10), X = parseInt(B.paddingBottom, 10), W = U + K + L + X + q, de = Math.min(C.offsetHeight * 5, W), le = window.getComputedStyle(v), se = parseInt(le.paddingTop, 10), fe = parseInt(le.paddingBottom, 10), Z = E.top + E.height / 2 - j, ce = M - Z, Q = C.offsetHeight / 2, S = C.offsetTop + Q, I = U + K + S, O = W - I;
970
- if (I <= Z) {
971
- const P = C === $[$.length - 1].ref.current;
972
- c.style.bottom = "0px";
973
- const R = p.clientHeight - v.offsetTop - v.offsetHeight, ee = Math.max(
985
+ const B = p(), D = window.innerHeight - j * 2, H = v.scrollHeight, F = window.getComputedStyle(m), z = parseInt(F.borderTopWidth, 10), G = parseInt(F.paddingTop, 10), $ = parseInt(F.borderBottomWidth, 10), X = parseInt(F.paddingBottom, 10), U = z + G + H + X + $, de = Math.min(C.offsetHeight * 5, U), se = window.getComputedStyle(v), fe = parseInt(se.paddingTop, 10), Q = parseInt(se.paddingBottom, 10), Z = _.top + _.height / 2 - j, ce = D - Z, ee = C.offsetHeight / 2, S = C.offsetTop + ee, V = z + G + S, y = U - V;
986
+ if (V <= Z) {
987
+ const P = C === B[B.length - 1].ref.current;
988
+ s.style.bottom = "0px";
989
+ const R = m.clientHeight - v.offsetTop - v.offsetHeight, te = Math.max(
974
990
  ce,
975
- Q + // viewport might have padding bottom, include it to avoid a scrollable viewport
976
- (P ? fe : 0) + R + q
977
- ), te = I + ee;
978
- c.style.height = `${te}px`;
991
+ ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
992
+ (P ? Q : 0) + R + $
993
+ ), oe = V + te;
994
+ s.style.height = `${oe}px`;
979
995
  } else {
980
- const P = C === $[0].ref.current;
981
- c.style.top = "0px";
982
- const ee = Math.max(
996
+ const P = C === B[0].ref.current;
997
+ s.style.top = "0px";
998
+ const te = Math.max(
983
999
  Z,
984
- U + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
985
- (P ? se : 0) + Q
986
- ) + O;
987
- c.style.height = `${ee}px`, v.scrollTop = I - Z + v.offsetTop;
1000
+ z + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1001
+ (P ? fe : 0) + ee
1002
+ ) + y;
1003
+ s.style.height = `${te}px`, v.scrollTop = V - Z + v.offsetTop;
988
1004
  }
989
- c.style.margin = `${j}px 0`, c.style.minHeight = `${de}px`, c.style.maxHeight = `${M}px`, t?.(), requestAnimationFrame(() => u.current = !0);
1005
+ s.style.margin = `${j}px 0`, s.style.minHeight = `${de}px`, s.style.maxHeight = `${D}px`, t?.(), requestAnimationFrame(() => d.current = !0);
990
1006
  }
991
1007
  }, [
992
- h,
1008
+ p,
993
1009
  n.trigger,
994
1010
  n.valueNode,
995
- c,
996
- p,
1011
+ s,
1012
+ m,
997
1013
  v,
998
1014
  C,
999
1015
  b,
1000
1016
  n.dir,
1001
1017
  t
1002
1018
  ]);
1003
- F(() => w(), [w]);
1004
- const [_, V] = l.useState();
1005
- F(() => {
1006
- p && V(window.getComputedStyle(p).zIndex);
1007
- }, [p]);
1008
- const D = l.useCallback(
1009
- (E) => {
1010
- E && x.current === !0 && (w(), g?.(), x.current = !1);
1019
+ L(() => I(), [I]);
1020
+ const [E, O] = l.useState();
1021
+ L(() => {
1022
+ m && O(window.getComputedStyle(m).zIndex);
1023
+ }, [m]);
1024
+ const A = l.useCallback(
1025
+ (_) => {
1026
+ _ && h.current === !0 && (I(), g?.(), h.current = !1);
1011
1027
  },
1012
- [w, g]
1028
+ [I, g]
1013
1029
  );
1014
1030
  return /* @__PURE__ */ f(
1015
1031
  Oo,
1016
1032
  {
1017
1033
  scope: e,
1018
- contentWrapper: c,
1019
- shouldExpandOnScrollRef: u,
1020
- onScrollButtonChange: D,
1034
+ contentWrapper: s,
1035
+ shouldExpandOnScrollRef: d,
1036
+ onScrollButtonChange: A,
1021
1037
  children: /* @__PURE__ */ f(
1022
1038
  "div",
1023
1039
  {
@@ -1026,13 +1042,13 @@ const _o = "SelectItemAlignedPosition", wt = l.forwardRef(
1026
1042
  display: "flex",
1027
1043
  flexDirection: "column",
1028
1044
  position: "fixed",
1029
- zIndex: _
1045
+ zIndex: E
1030
1046
  },
1031
1047
  children: /* @__PURE__ */ f(
1032
1048
  N.div,
1033
1049
  {
1034
1050
  ...o,
1035
- ref: m,
1051
+ ref: x,
1036
1052
  style: {
1037
1053
  // When we get the height of the content, it includes borders. If we were to set
1038
1054
  // the height without having `boxSizing: 'border-box'` it would be too big.
@@ -1049,16 +1065,16 @@ const _o = "SelectItemAlignedPosition", wt = l.forwardRef(
1049
1065
  );
1050
1066
  }
1051
1067
  );
1052
- wt.displayName = _o;
1068
+ St.displayName = _o;
1053
1069
  const Mo = "SelectPopperPosition", Ve = l.forwardRef(
1054
- (r, s) => {
1070
+ (r, c) => {
1055
1071
  const { __scopeSelect: e, align: t = "start", collisionPadding: o = j, ...n } = r, i = be(e);
1056
1072
  return /* @__PURE__ */ f(
1057
- re.Content,
1073
+ le.Content,
1058
1074
  {
1059
1075
  ...i,
1060
1076
  ...n,
1061
- ref: s,
1077
+ ref: c,
1062
1078
  align: t,
1063
1079
  collisionPadding: o,
1064
1080
  style: {
@@ -1077,11 +1093,11 @@ const Mo = "SelectPopperPosition", Ve = l.forwardRef(
1077
1093
  );
1078
1094
  Ve.displayName = Mo;
1079
1095
  const [Oo, Ue] = ue(
1080
- oe,
1096
+ ne,
1081
1097
  {}
1082
1098
  ), Pe = "SelectViewport", Ke = l.forwardRef(
1083
- (r, s) => {
1084
- const { __scopeSelect: e, ...t } = r, o = J(Pe, e), n = Ue(Pe, e), i = A(s, o.onViewportChange), c = l.useRef(0);
1099
+ (r, c) => {
1100
+ const { __scopeSelect: e, ...t } = r, o = J(Pe, e), n = Ue(Pe, e), i = M(c, o.onViewportChange), s = l.useRef(0);
1085
1101
  return /* @__PURE__ */ Ae(_e, { children: [
1086
1102
  /* @__PURE__ */ f(
1087
1103
  "style",
@@ -1108,18 +1124,18 @@ const [Oo, Ue] = ue(
1108
1124
  ...t.style
1109
1125
  },
1110
1126
  onScroll: T(t.onScroll, (a) => {
1111
- const p = a.currentTarget, { contentWrapper: d, shouldExpandOnScrollRef: m } = n;
1112
- if (m?.current && d) {
1113
- const h = Math.abs(c.current - p.scrollTop);
1114
- if (h > 0) {
1115
- const u = window.innerHeight - j * 2, x = parseFloat(d.style.minHeight), v = parseFloat(d.style.height), C = Math.max(x, v);
1116
- if (C < u) {
1117
- const b = C + h, g = Math.min(u, b), w = b - g;
1118
- d.style.height = `${g}px`, d.style.bottom === "0px" && (p.scrollTop = w > 0 ? w : 0, d.style.justifyContent = "flex-end");
1127
+ const m = a.currentTarget, { contentWrapper: u, shouldExpandOnScrollRef: x } = n;
1128
+ if (x?.current && u) {
1129
+ const p = Math.abs(s.current - m.scrollTop);
1130
+ if (p > 0) {
1131
+ const d = window.innerHeight - j * 2, h = parseFloat(u.style.minHeight), v = parseFloat(u.style.height), C = Math.max(h, v);
1132
+ if (C < d) {
1133
+ const b = C + p, g = Math.min(d, b), I = b - g;
1134
+ u.style.height = `${g}px`, u.style.bottom === "0px" && (m.scrollTop = I > 0 ? I : 0, u.style.justifyContent = "flex-end");
1119
1135
  }
1120
1136
  }
1121
1137
  }
1122
- c.current = p.scrollTop;
1138
+ s.current = m.scrollTop;
1123
1139
  })
1124
1140
  }
1125
1141
  ) })
@@ -1128,31 +1144,31 @@ const [Oo, Ue] = ue(
1128
1144
  );
1129
1145
  Ke.displayName = Pe;
1130
1146
  const It = "SelectGroup", [Do, ko] = ue(It), We = l.forwardRef(
1131
- (r, s) => {
1132
- const { __scopeSelect: e, ...t } = r, o = ne();
1133
- return /* @__PURE__ */ f(Do, { scope: e, id: o, children: /* @__PURE__ */ f(N.div, { role: "group", "aria-labelledby": o, ...t, ref: s }) });
1147
+ (r, c) => {
1148
+ const { __scopeSelect: e, ...t } = r, o = re();
1149
+ return /* @__PURE__ */ f(Do, { scope: e, id: o, children: /* @__PURE__ */ f(N.div, { role: "group", "aria-labelledby": o, ...t, ref: c }) });
1134
1150
  }
1135
1151
  );
1136
1152
  We.displayName = It;
1137
- const yt = "SelectLabel", ze = l.forwardRef(
1138
- (r, s) => {
1139
- const { __scopeSelect: e, ...t } = r, o = ko(yt, e);
1140
- return /* @__PURE__ */ f(N.div, { id: o.id, ...t, ref: s });
1153
+ const wt = "SelectLabel", ze = l.forwardRef(
1154
+ (r, c) => {
1155
+ const { __scopeSelect: e, ...t } = r, o = ko(wt, e);
1156
+ return /* @__PURE__ */ f(N.div, { id: o.id, ...t, ref: c });
1141
1157
  }
1142
1158
  );
1143
- ze.displayName = yt;
1144
- const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1145
- (r, s) => {
1146
- const { __scopeSelect: e, value: t, disabled: o = !1, textValue: n, ...i } = r, c = Y(ge, e), a = J(ge, e), p = typeof t == "string" ? Array.isArray(c.value) ? c.value.includes(t) : c.value === t : t.every((g) => c.value?.includes(g)), d = Array.isArray(c.value) && Array.isArray(t) && t.some((g) => c.value?.includes(g)), [m, h] = l.useState(n ?? ""), [u, x] = l.useState(!1), v = A(
1147
- s,
1159
+ ze.displayName = wt;
1160
+ const xe = "SelectItem", [Fo, yt] = ue(xe), Ge = l.forwardRef(
1161
+ (r, c) => {
1162
+ const { __scopeSelect: e, value: t, disabled: o = !1, textValue: n, ...i } = r, s = Y(xe, e), a = J(xe, e), m = typeof t == "string" ? Array.isArray(s.value) ? s.value.includes(t) : s.value === t : t.every((g) => s.value?.includes(g)), u = Array.isArray(s.value) && Array.isArray(t) && t.some((g) => s.value?.includes(g)), [x, p] = l.useState(n ?? ""), [d, h] = l.useState(!1), v = M(
1163
+ c,
1148
1164
  (g) => a.itemRefCallback?.(g, t, o)
1149
- ), C = ne(), b = () => {
1165
+ ), C = re(), b = () => {
1150
1166
  if (!o) {
1151
- let g = c.multi && typeof t == "string" ? [t] : t;
1152
- d && !p ? c.onValueChange(g) : Array.isArray(c.value) && (g = Nt(t, c.value)), c.onValueChange(g), c.multi || c.onOpenChange(!1);
1167
+ let g = s.multi && typeof t == "string" ? [t] : t;
1168
+ u && !m ? s.onValueChange(g) : Array.isArray(s.value) && (g = Rt(t, s.value)), s.onValueChange(g), s.multi || s.onOpenChange(!1);
1153
1169
  }
1154
1170
  };
1155
- if (!c.multi && Array.isArray(t))
1171
+ if (!s.multi && Array.isArray(t))
1156
1172
  throw new Error("You can only pass an array of values in multi selects");
1157
1173
  return /* @__PURE__ */ f(
1158
1174
  Fo,
@@ -1161,27 +1177,27 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1161
1177
  value: t,
1162
1178
  disabled: o,
1163
1179
  textId: C,
1164
- isSelected: p,
1165
- isIntermediate: d,
1180
+ isSelected: m,
1181
+ isIntermediate: u,
1166
1182
  onItemTextChange: l.useCallback((g) => {
1167
- h((w) => w || (g?.textContent ?? "").trim());
1183
+ p((I) => I || (g?.textContent ?? "").trim());
1168
1184
  }, []),
1169
- children: /* @__PURE__ */ f(ve.ItemSlot, { scope: e, value: t, disabled: o, textValue: m, children: /* @__PURE__ */ f(
1185
+ children: /* @__PURE__ */ f(ve.ItemSlot, { scope: e, value: t, disabled: o, textValue: x, children: /* @__PURE__ */ f(
1170
1186
  N.div,
1171
1187
  {
1172
1188
  role: "option",
1173
1189
  "aria-labelledby": C,
1174
- "data-highlighted": u ? "" : void 0,
1175
- "aria-selected": c.multi ? void 0 : p && u,
1176
- "aria-checked": c.multi ? p : void 0,
1177
- "data-state": p ? "checked" : "unchecked",
1190
+ "data-highlighted": d ? "" : void 0,
1191
+ "aria-selected": s.multi ? void 0 : m && d,
1192
+ "aria-checked": s.multi ? m : void 0,
1193
+ "data-state": m ? "checked" : "unchecked",
1178
1194
  "aria-disabled": o || void 0,
1179
1195
  "data-disabled": o ? "" : void 0,
1180
1196
  tabIndex: o ? void 0 : -1,
1181
1197
  ...i,
1182
1198
  ref: v,
1183
- onFocus: T(i.onFocus, () => x(!0)),
1184
- onBlur: T(i.onBlur, () => x(!1)),
1199
+ onFocus: T(i.onFocus, () => h(!0)),
1200
+ onBlur: T(i.onBlur, () => h(!1)),
1185
1201
  onPointerUp: T(i.onPointerUp, b),
1186
1202
  onPointerMove: T(i.onPointerMove, (g) => {
1187
1203
  o ? a.onItemLeave?.() : g.currentTarget.focus({ preventScroll: !0 });
@@ -1190,7 +1206,7 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1190
1206
  g.currentTarget === document.activeElement && a.onItemLeave?.();
1191
1207
  }),
1192
1208
  onKeyDown: T(i.onKeyDown, (g) => {
1193
- a.searchRef?.current !== "" && g.key === " " || (Io.includes(g.key) && b(), g.key === " " && g.preventDefault());
1209
+ a.searchRef?.current !== "" && g.key === " " || (wo.includes(g.key) && b(), g.key === " " && g.preventDefault());
1194
1210
  })
1195
1211
  }
1196
1212
  ) })
@@ -1198,62 +1214,62 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1198
1214
  );
1199
1215
  }
1200
1216
  );
1201
- Ge.displayName = ge;
1217
+ Ge.displayName = xe;
1202
1218
  const pe = "SelectItemText", je = l.forwardRef(
1203
- (r, s) => {
1204
- const { __scopeSelect: e, className: t, style: o, ...n } = r, i = Y(pe, e), c = J(pe, e), a = Tt(pe, e), p = Eo(pe, e), [d, m] = l.useState(null), h = A(
1205
- s,
1206
- (b) => m(b),
1219
+ (r, c) => {
1220
+ const { __scopeSelect: e, className: t, style: o, ...n } = r, i = Y(pe, e), s = J(pe, e), a = yt(pe, e), m = Eo(pe, e), [u, x] = l.useState(null), p = M(
1221
+ c,
1222
+ (b) => x(b),
1207
1223
  a.onItemTextChange,
1208
- (b) => c.itemTextRefCallback?.(b, a.value, a.disabled)
1209
- ), u = d?.textContent, x = l.useMemo(
1224
+ (b) => s.itemTextRefCallback?.(b, a.value, a.disabled)
1225
+ ), d = u?.textContent, h = l.useMemo(
1210
1226
  () => /* @__PURE__ */ f(
1211
1227
  "option",
1212
1228
  {
1213
1229
  value: a.value,
1214
1230
  disabled: a.disabled,
1215
- children: u
1231
+ children: d
1216
1232
  },
1217
1233
  Array.isArray(a.value) ? a.value.join(";") : a.value
1218
1234
  ),
1219
- [a.disabled, a.value, u]
1220
- ), { onNativeOptionAdd: v, onNativeOptionRemove: C } = p;
1221
- return F(() => (v(x), () => C(x)), [v, C, x]), /* @__PURE__ */ Ae(_e, { children: [
1222
- /* @__PURE__ */ f(N.span, { id: a.textId, ...n, ref: h }),
1223
- a.isSelected && i.valueNode && !i.valueNodeHasChildren ? xe.createPortal(n.children, i.valueNode) : null
1235
+ [a.disabled, a.value, d]
1236
+ ), { onNativeOptionAdd: v, onNativeOptionRemove: C } = m;
1237
+ return L(() => (v(h), () => C(h)), [v, C, h]), /* @__PURE__ */ Ae(_e, { children: [
1238
+ /* @__PURE__ */ f(N.span, { id: a.textId, ...n, ref: p }),
1239
+ a.isSelected && i.valueNode && !i.valueNodeHasChildren ? Ce.createPortal(n.children, i.valueNode) : null
1224
1240
  ] });
1225
1241
  }
1226
1242
  );
1227
1243
  je.displayName = pe;
1228
- const Vt = "SelectItemIndicator", Ye = l.forwardRef(
1229
- (r, s) => {
1230
- const { __scopeSelect: e, children: t, ...o } = r, n = Tt(Vt, e);
1231
- return typeof t == "function" ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: s, children: t({
1244
+ const Tt = "SelectItemIndicator", Ye = l.forwardRef(
1245
+ (r, c) => {
1246
+ const { __scopeSelect: e, children: t, ...o } = r, n = yt(Tt, e);
1247
+ return typeof t == "function" ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t({
1232
1248
  isSelected: n.isSelected,
1233
1249
  isIntermediate: n.isIntermediate
1234
- }) }) : n.isSelected ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
1250
+ }) }) : n.isSelected ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t }) : null;
1235
1251
  }
1236
1252
  );
1237
- Ye.displayName = Vt;
1253
+ Ye.displayName = Tt;
1238
1254
  const Ee = "SelectScrollUpButton", qe = l.forwardRef(
1239
- (r, s) => {
1240
- const e = J(Ee, r.__scopeSelect), t = Ue(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = A(s, t.onScrollButtonChange);
1241
- return F(() => {
1255
+ (r, c) => {
1256
+ const e = J(Ee, r.__scopeSelect), t = Ue(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1257
+ return L(() => {
1242
1258
  if (e.viewport && e.isPositioned) {
1243
- const c = e.viewport, a = () => {
1244
- const p = c.scrollTop > 0;
1245
- n(p);
1259
+ const s = e.viewport, a = () => {
1260
+ const m = s.scrollTop > 0;
1261
+ n(m);
1246
1262
  };
1247
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1263
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1248
1264
  }
1249
1265
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1250
- Pt,
1266
+ Vt,
1251
1267
  {
1252
1268
  ...r,
1253
1269
  ref: i,
1254
1270
  onAutoScroll: () => {
1255
- const { viewport: c, selectedItem: a } = e;
1256
- c && a && (c.scrollTop -= a.offsetHeight);
1271
+ const { viewport: s, selectedItem: a } = e;
1272
+ s && a && (s.scrollTop -= a.offsetHeight);
1257
1273
  }
1258
1274
  }
1259
1275
  ) : null;
@@ -1261,43 +1277,43 @@ const Ee = "SelectScrollUpButton", qe = l.forwardRef(
1261
1277
  );
1262
1278
  qe.displayName = Ee;
1263
1279
  const Re = "SelectScrollDownButton", Xe = l.forwardRef(
1264
- (r, s) => {
1265
- const e = J(Re, r.__scopeSelect), t = Ue(Re, r.__scopeSelect), [o, n] = l.useState(!1), i = A(s, t.onScrollButtonChange);
1266
- return F(() => {
1280
+ (r, c) => {
1281
+ const e = J(Re, r.__scopeSelect), t = Ue(Re, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1282
+ return L(() => {
1267
1283
  if (e.viewport && e.isPositioned) {
1268
- const c = e.viewport, a = () => {
1269
- const p = c.scrollHeight - c.clientHeight, d = Math.ceil(c.scrollTop) < p;
1270
- n(d);
1284
+ const s = e.viewport, a = () => {
1285
+ const m = s.scrollHeight - s.clientHeight, u = Math.ceil(s.scrollTop) < m;
1286
+ n(u);
1271
1287
  };
1272
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1288
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1273
1289
  }
1274
1290
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1275
- Pt,
1291
+ Vt,
1276
1292
  {
1277
1293
  ...r,
1278
1294
  ref: i,
1279
1295
  onAutoScroll: () => {
1280
- const { viewport: c, selectedItem: a } = e;
1281
- c && a && (c.scrollTop += a.offsetHeight);
1296
+ const { viewport: s, selectedItem: a } = e;
1297
+ s && a && (s.scrollTop += a.offsetHeight);
1282
1298
  }
1283
1299
  }
1284
1300
  ) : null;
1285
1301
  }
1286
1302
  );
1287
1303
  Xe.displayName = Re;
1288
- const Pt = l.forwardRef(
1289
- (r, s) => {
1290
- const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), c = he(e), a = l.useCallback(() => {
1304
+ const Vt = l.forwardRef(
1305
+ (r, c) => {
1306
+ const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), s = ge(e), a = l.useCallback(() => {
1291
1307
  i.current !== null && (window.clearInterval(i.current), i.current = null);
1292
1308
  }, []);
1293
- return l.useEffect(() => () => a(), [a]), F(() => {
1294
- c().find((d) => d.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1295
- }, [c]), /* @__PURE__ */ f(
1309
+ return l.useEffect(() => () => a(), [a]), L(() => {
1310
+ s().find((u) => u.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1311
+ }, [s]), /* @__PURE__ */ f(
1296
1312
  N.div,
1297
1313
  {
1298
1314
  "aria-hidden": !0,
1299
1315
  ...o,
1300
- ref: s,
1316
+ ref: c,
1301
1317
  style: { flexShrink: 0, ...o.style },
1302
1318
  onPointerMove: T(o.onPointerMove, () => {
1303
1319
  n.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
@@ -1309,35 +1325,35 @@ const Pt = l.forwardRef(
1309
1325
  );
1310
1326
  }
1311
1327
  ), Lo = "SelectSeparator", Ze = l.forwardRef(
1312
- (r, s) => {
1328
+ (r, c) => {
1313
1329
  const { __scopeSelect: e, ...t } = r;
1314
- return /* @__PURE__ */ f(N.div, { "aria-hidden": !0, ...t, ref: s });
1330
+ return /* @__PURE__ */ f(N.div, { "aria-hidden": !0, ...t, ref: c });
1315
1331
  }
1316
1332
  );
1317
1333
  Ze.displayName = Lo;
1318
1334
  const Ne = "SelectArrow", Je = l.forwardRef(
1319
- (r, s) => {
1335
+ (r, c) => {
1320
1336
  const { __scopeSelect: e, ...t } = r, o = be(e), n = Y(Ne, e), i = J(Ne, e);
1321
- return n.open && i.position === "popper" ? /* @__PURE__ */ f(re.Arrow, { ...o, ...t, ref: s }) : null;
1337
+ return n.open && i.position === "popper" ? /* @__PURE__ */ f(le.Arrow, { ...o, ...t, ref: c }) : null;
1322
1338
  }
1323
1339
  );
1324
1340
  Je.displayName = Ne;
1325
1341
  const Bo = "BubbleSelect", Ho = l.forwardRef(
1326
- (r, s) => {
1327
- const { value: e, ...t } = r, o = l.useRef(null), n = A(s, o), i = Ot(e), c = Y(Bo, void 0);
1342
+ (r, c) => {
1343
+ const { value: e, ...t } = r, o = l.useRef(null), n = M(c, o), i = _t(e), s = Y(Bo, void 0);
1328
1344
  l.useEffect(() => {
1329
- const p = o.current, d = window.HTMLSelectElement.prototype, h = Object.getOwnPropertyDescriptor(d, "value").set;
1330
- if (i !== e && h) {
1331
- const u = new Event("change", { bubbles: !0 });
1332
- h.call(p, e), p.dispatchEvent(u);
1345
+ const m = o.current, u = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(u, "value").set;
1346
+ if (i !== e && p) {
1347
+ const d = new Event("change", { bubbles: !0 });
1348
+ p.call(m, e), m.dispatchEvent(d);
1333
1349
  }
1334
1350
  }, [i, e]);
1335
1351
  let a = e;
1336
- return c.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(Dt, { asChild: !0, children: /* @__PURE__ */ f(
1352
+ return s.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(Mt, { asChild: !0, children: /* @__PURE__ */ f(
1337
1353
  "select",
1338
1354
  {
1339
1355
  ...t,
1340
- multiple: c.multi ? !0 : void 0,
1356
+ multiple: s.multi ? !0 : void 0,
1341
1357
  ref: n,
1342
1358
  defaultValue: a
1343
1359
  }
@@ -1345,35 +1361,35 @@ const Bo = "BubbleSelect", Ho = l.forwardRef(
1345
1361
  }
1346
1362
  );
1347
1363
  Ho.displayName = "BubbleSelect";
1348
- function Et(r) {
1349
- const s = Mt(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1364
+ function Pt(r) {
1365
+ const c = Ot(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1350
1366
  (i) => {
1351
- const c = e.current + i;
1352
- s(c), function a(p) {
1353
- e.current = p, window.clearTimeout(t.current), p !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
1354
- }(c);
1367
+ const s = e.current + i;
1368
+ c(s), function a(m) {
1369
+ e.current = m, window.clearTimeout(t.current), m !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
1370
+ }(s);
1355
1371
  },
1356
- [s]
1372
+ [c]
1357
1373
  ), n = l.useCallback(() => {
1358
1374
  e.current = "", window.clearTimeout(t.current);
1359
1375
  }, []);
1360
1376
  return l.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, n];
1361
1377
  }
1362
- function Rt(r, s, e) {
1363
- const o = s.length > 1 && Array.from(s).every((p) => p === s[0]) ? s[0] : s, n = e ? r.indexOf(e) : -1;
1378
+ function Et(r, c, e) {
1379
+ const o = c.length > 1 && Array.from(c).every((m) => m === c[0]) ? c[0] : c, n = e ? r.indexOf(e) : -1;
1364
1380
  let i = $o(r, Math.max(n, 0));
1365
- o.length === 1 && (i = i.filter((p) => p !== e));
1366
- const a = i.find((p) => p.textValue.toLowerCase().startsWith(o.toLowerCase()));
1381
+ o.length === 1 && (i = i.filter((m) => m !== e));
1382
+ const a = i.find((m) => m.textValue.toLowerCase().startsWith(o.toLowerCase()));
1367
1383
  return a !== e ? a : void 0;
1368
1384
  }
1369
- function $o(r, s) {
1370
- return r.map((e, t) => r[(s + t) % r.length]);
1385
+ function $o(r, c) {
1386
+ return r.map((e, t) => r[(c + t) % r.length]);
1371
1387
  }
1372
- const Nt = (r, s = []) => {
1388
+ const Rt = (r, c = []) => {
1373
1389
  if (Array.isArray(r))
1374
- return r.reduce((t, o) => Nt(o, t), s);
1375
- const e = s.indexOf(r);
1376
- return e === -1 ? [...s, r] : [...s.slice(0, e), ...s.slice(e + 1)];
1390
+ return r.reduce((t, o) => Rt(o, t), c);
1391
+ const e = c.indexOf(r);
1392
+ return e === -1 ? [...c, r] : [...c.slice(0, e), ...c.slice(e + 1)];
1377
1393
  }, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = He, jo = $e, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe, on = Ze, nn = Je, En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1378
1394
  __proto__: null,
1379
1395
  Arrow: nn,
@@ -1414,5 +1430,6 @@ export {
1414
1430
  Pn as Combobox,
1415
1431
  En as Select,
1416
1432
  An as composeEventHandlers,
1433
+ Dt as createCollection,
1417
1434
  Mn as useCallbackRef
1418
1435
  };