@strapi/ui-primitives 1.7.10 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,76 @@ 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, () => {
308
314
  e.onVisuallyFocussedItemChange(null);
309
- const [d] = o().filter(
310
- (h) => h.textValue === e.textValue && h.type === "option"
315
+ const [u] = o().filter(
316
+ (p) => p.textValue === e.textValue && p.type === "option"
311
317
  );
318
+ if (u) {
319
+ e.onValueChange(u.value), e.autocomplete === "both" && e.onFilterValueChange(u.textValue);
320
+ return;
321
+ }
312
322
  if (e.allowCustomValue) {
313
- d && (e.onValueChange(d.value), e.autocomplete === "both" && e.onFilterValueChange(d.textValue));
323
+ e.onValueChange(e.textValue), e.autocomplete === "both" && e.onFilterValueChange(e.textValue);
314
324
  return;
315
325
  }
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(""));
326
+ const [x] = o().filter((p) => p.value === e.value && p.type === "option");
327
+ x && e.textValue !== "" ? (e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
318
328
  })
319
329
  }
320
330
  );
321
- }), jt = l.forwardRef((r, s) => {
322
- const { children: e, ...t } = r, o = z(pt), n = o.disabled, i = () => {
331
+ }), jt = l.forwardRef((r, c) => {
332
+ const { children: e, ...t } = r, o = K(ft), n = o.disabled, i = () => {
323
333
  n || (o.onOpenChange(!0), o.trigger?.focus());
324
334
  };
325
335
  return /* @__PURE__ */ f(
@@ -334,45 +344,49 @@ const Bt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ht = ["Enter"], et = (r) => !
334
344
  "data-disabled": n ? "" : void 0,
335
345
  ...t,
336
346
  tabIndex: -1,
337
- ref: s,
347
+ ref: c,
338
348
  onClick: T(t.onClick, () => {
339
349
  o.trigger?.focus();
340
350
  }),
341
- onPointerDown: T(t.onPointerDown, (c) => {
342
- c.button === 0 && c.ctrlKey === !1 && (i(), c.preventDefault());
351
+ onPointerDown: T(t.onPointerDown, (s) => {
352
+ s.button === 0 && s.ctrlKey === !1 && (i(), s.preventDefault());
343
353
  }),
344
- onKeyDown: T(t.onKeyDown, (c) => {
345
- Bt.includes(c.key) && (i(), c.preventDefault());
354
+ onKeyDown: T(t.onKeyDown, (s) => {
355
+ Lt.includes(s.key) && (i(), s.preventDefault());
346
356
  }),
347
357
  children: e || "▼"
348
358
  }
349
359
  );
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(
360
+ }), Yt = "ComboboxPortal", pt = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
361
+ pt.displayName = Yt;
362
+ const mt = "ComboboxContent", qt = l.forwardRef((r, c) => {
363
+ const e = K(mt), { getItems: t } = me(void 0), [o, n] = l.useState();
364
+ if (L(() => {
365
+ n(new DocumentFragment());
366
+ }, []), L(() => {
367
+ e.open && e.autocomplete === "none" && setTimeout(() => {
368
+ t().find((s) => s.value === e.value)?.ref.current?.scrollIntoView({ block: "nearest" });
369
+ });
370
+ }, [t, e.autocomplete, e.value, e.open]), !e.open) {
371
+ const i = o;
372
+ return i ? Ce.createPortal(
359
373
  /* @__PURE__ */ f(ae.Slot, { scope: void 0, children: /* @__PURE__ */ f("div", { children: r.children }) }),
360
- n
374
+ i
361
375
  ) : null;
362
376
  }
363
- return /* @__PURE__ */ f(Zt, { ...r, ref: s });
377
+ return /* @__PURE__ */ f(Zt, { ...r, ref: c });
364
378
  }), 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(() => {
379
+ (r, c) => {
380
+ const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = K(mt), i = M(c, (a) => n.onContentChange(a)), { onOpenChange: s } = n;
381
+ return lt(), l.useEffect(() => {
368
382
  const a = () => {
369
- c(!1);
383
+ s(!1);
370
384
  };
371
385
  return window.addEventListener("blur", a), window.addEventListener("resize", a), () => {
372
386
  window.removeEventListener("blur", a), window.removeEventListener("resize", a);
373
387
  };
374
- }, [c]), /* @__PURE__ */ f(dt, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
375
- lt,
388
+ }, [s]), /* @__PURE__ */ f(ut, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
389
+ rt,
376
390
  {
377
391
  asChild: !0,
378
392
  onEscapeKeyDown: e,
@@ -406,13 +420,13 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
406
420
  ) });
407
421
  }
408
422
  ), Jt = l.forwardRef(
409
- (r, s) => {
423
+ (r, c) => {
410
424
  const { align: e = "start", collisionPadding: t = Xt, ...o } = r;
411
425
  return /* @__PURE__ */ f(
412
- re.Content,
426
+ le.Content,
413
427
  {
414
428
  ...o,
415
- ref: s,
429
+ ref: c,
416
430
  align: e,
417
431
  collisionPadding: t,
418
432
  style: {
@@ -428,8 +442,8 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
428
442
  }
429
443
  );
430
444
  }
431
- ), Qt = "ComboboxViewport", eo = l.forwardRef((r, s) => {
432
- const e = z(Qt), t = A(s, e.onViewportChange);
445
+ ), Qt = "ComboboxViewport", eo = l.forwardRef((r, c) => {
446
+ const e = K(Qt), t = M(c, e.onViewportChange);
433
447
  return /* @__PURE__ */ Ae(_e, { children: [
434
448
  /* @__PURE__ */ f(
435
449
  "style",
@@ -458,109 +472,109 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
458
472
  }
459
473
  ) })
460
474
  ] });
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());
475
+ }), Oe = "ComboboxItem", [et, De] = nt(Oe), ht = l.forwardRef((r, c) => {
476
+ const { value: e, disabled: t = !1, textValue: o, ...n } = r, [i, s] = l.useState();
477
+ L(() => {
478
+ s(new DocumentFragment());
465
479
  }, []);
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());
480
+ 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) => {
481
+ d((g) => g || (b?.textContent ?? "").trim());
468
482
  }, []);
469
483
  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(
484
+ h && m === void 0 && p !== "" && a(p);
485
+ }, [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
486
  /* @__PURE__ */ f(
473
- tt,
487
+ et,
474
488
  {
475
- textId: d,
476
- onTextValueChange: v,
477
- isSelected: u,
478
- textValue: m,
489
+ textId: x,
490
+ onTextValueChange: C,
491
+ isSelected: h,
492
+ textValue: p,
479
493
  children: /* @__PURE__ */ f(
480
494
  ae.ItemSlot,
481
495
  {
482
496
  scope: void 0,
483
497
  value: e,
484
- textValue: m,
498
+ textValue: p,
485
499
  disabled: t,
486
500
  type: "option",
487
501
  isVisible: !1,
488
- children: /* @__PURE__ */ f(ot, { ref: s, ...r })
502
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
489
503
  }
490
504
  )
491
505
  }
492
506
  ),
493
- n
507
+ i
494
508
  ) : null : /* @__PURE__ */ f(
495
- tt,
509
+ et,
496
510
  {
497
- textId: d,
498
- onTextValueChange: v,
499
- isSelected: u,
500
- textValue: m,
511
+ textId: x,
512
+ onTextValueChange: C,
513
+ isSelected: h,
514
+ textValue: p,
501
515
  children: /* @__PURE__ */ f(
502
516
  ae.ItemSlot,
503
517
  {
504
518
  scope: void 0,
505
519
  value: e,
506
- textValue: m,
520
+ textValue: p,
507
521
  disabled: t,
508
522
  type: "option",
509
523
  isVisible: !0,
510
- children: /* @__PURE__ */ f(ot, { ref: s, ...r })
524
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
511
525
  }
512
526
  )
513
527
  }
514
528
  );
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();
529
+ }), to = "ComboboxItemImpl", tt = l.forwardRef((r, c) => {
530
+ 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 = () => {
531
+ t || (u.onValueChange(e), a(p), u.onOpenChange(!1), u.autocomplete === "both" && u.onFilterValueChange(p), u.trigger?.focus({ preventScroll: !0 }));
532
+ }, v = l.useMemo(() => m === s().find((b) => b.ref.current === n.current)?.ref.current, [s, m]), C = re();
519
533
  return /* @__PURE__ */ f(
520
534
  N.div,
521
535
  {
522
536
  role: "option",
523
- "aria-labelledby": u,
537
+ "aria-labelledby": d,
524
538
  "data-highlighted": v ? "" : void 0,
525
- "aria-selected": m && v,
526
- "data-state": m ? "checked" : "unchecked",
539
+ "aria-selected": x && v,
540
+ "data-state": x ? "checked" : "unchecked",
527
541
  "aria-disabled": t || void 0,
528
542
  "data-disabled": t ? "" : void 0,
529
543
  tabIndex: t ? void 0 : -1,
530
544
  ...o,
531
545
  id: C,
532
546
  ref: i,
533
- onPointerUp: T(o.onPointerUp, x)
547
+ onPointerUp: T(o.onPointerUp, h)
534
548
  }
535
549
  );
536
- }), oo = "ComboboxItemText", no = l.forwardRef((r, s) => {
537
- const { className: e, style: t, ...o } = r, n = De(oo), i = A(s, n.onTextValueChange);
550
+ }), oo = "ComboboxItemText", no = l.forwardRef((r, c) => {
551
+ const { className: e, style: t, ...o } = r, n = De(oo), i = M(c, n.onTextValueChange);
538
552
  return /* @__PURE__ */ f(N.span, { id: n.textId, ...o, ref: i });
539
- }), ro = "ComboboxItemIndicator", lo = l.forwardRef((r, s) => {
553
+ }), ro = "ComboboxItemIndicator", lo = l.forwardRef((r, c) => {
540
554
  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" });
555
+ return e ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...r, ref: c }) : null;
556
+ }), gt = "ComboboxNoValueFound", so = l.forwardRef((r, c) => {
557
+ 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
558
  return l.useEffect(() => {
545
- const d = a((m) => {
546
- c(m);
559
+ const u = a((x) => {
560
+ s(x);
547
561
  });
548
562
  return () => {
549
- d();
563
+ u();
550
564
  };
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 = () => {
565
+ }, [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 });
566
+ }), co = l.forwardRef((r, c) => {
567
+ 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
568
  !e && n && (o.onValueChange(n), o.onTextValueChange(n), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(n), o.trigger?.focus({ preventScroll: !0 }));
555
569
  };
556
- return F(() => {
570
+ return L(() => {
557
571
  const C = a((b) => {
558
- m(!b.some((g) => g.textValue === n && g.type !== "create"));
572
+ x(!b.some((g) => g.textValue === n && g.type !== "create"));
559
573
  });
560
- return c().length === 0 && m(!0), () => {
574
+ return s().length === 0 && x(!0), () => {
561
575
  C();
562
576
  };
563
- }, [n, a, c]), !n || !d ? null : /* @__PURE__ */ f(
577
+ }, [n, a, s]), !n || !u ? null : /* @__PURE__ */ f(
564
578
  ae.ItemSlot,
565
579
  {
566
580
  scope: void 0,
@@ -576,26 +590,26 @@ const ht = "ComboboxContent", qt = l.forwardRef((r, s) => {
576
590
  tabIndex: e ? void 0 : -1,
577
591
  "aria-disabled": e || void 0,
578
592
  "data-disabled": e ? "" : void 0,
579
- "data-highlighted": u ? "" : void 0,
593
+ "data-highlighted": d ? "" : void 0,
580
594
  ...t,
581
- id: x,
582
- ref: h,
595
+ id: h,
596
+ ref: p,
583
597
  onPointerUp: T(t.onPointerUp, v)
584
598
  }
585
599
  )
586
600
  }
587
601
  );
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);
602
+ }), io = Kt, ao = zt, uo = Gt, fo = jt, po = pt, mo = qt, ho = eo, go = ht, xo = no, Co = lo, vo = so, bo = co;
603
+ function So(r, c) {
604
+ const e = Math.min(r.length, c.length);
591
605
  for (let t = 0; t < e; t++)
592
- if (r[t] !== s[t])
606
+ if (r[t] !== c[t])
593
607
  return t;
594
608
  return e;
595
609
  }
596
610
  const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
597
611
  __proto__: null,
598
- ComboboxItem: gt,
612
+ ComboboxItem: ht,
599
613
  Content: mo,
600
614
  CreateItem: bo,
601
615
  Icon: fo,
@@ -608,67 +622,67 @@ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
608
622
  TextInput: uo,
609
623
  Trigger: ao,
610
624
  Viewport: ho
611
- }, Symbol.toStringTag, { value: "Module" })), wo = [" ", "Enter", "ArrowUp", "ArrowDown"], Io = [" ", "Enter"], me = "Select", [ve, he, yo] = At(me), [ue, To] = nt(me, [
625
+ }, Symbol.toStringTag, { value: "Module" })), Io = [" ", "Enter", "ArrowUp", "ArrowDown"], wo = [" ", "Enter"], he = "Select", [ve, ge, yo] = Nt(he), [ue, To] = ot(he, [
612
626
  yo,
613
- it
614
- ]), be = it(), [Vo, Y] = ue(me), [Po, Eo] = ue(me), ke = (r) => {
627
+ ct
628
+ ]), be = ct(), [Vo, Y] = ue(he), [Po, Eo] = ue(he), ke = (r) => {
615
629
  const {
616
- __scopeSelect: s,
630
+ __scopeSelect: c,
617
631
  children: e,
618
632
  open: t,
619
633
  defaultOpen: o,
620
634
  onOpenChange: n,
621
635
  value: i,
622
- defaultValue: c,
636
+ defaultValue: s,
623
637
  onValueChange: a,
624
- dir: p,
638
+ dir: m,
625
639
  // name,
626
640
  // 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({
641
+ disabled: u,
642
+ required: x,
643
+ multi: p = !1
644
+ } = 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
645
  prop: t,
632
646
  defaultProp: o,
633
647
  onChange: n
634
- }), [E, k] = ie({
648
+ }), [_, k] = ie({
635
649
  prop: i,
636
- defaultProp: c,
637
- onChange(M) {
638
- a && (Array.isArray(M), a(M));
650
+ defaultProp: s,
651
+ onChange(D) {
652
+ a && (Array.isArray(D), a(D));
639
653
  }
640
- }), H = l.useRef(null), [G, $] = l.useState(/* @__PURE__ */ new Set());
641
- return /* @__PURE__ */ f(re.Root, { ...u, children: /* @__PURE__ */ f(
654
+ }), q = l.useRef(null), [W, B] = l.useState(/* @__PURE__ */ new Set());
655
+ return /* @__PURE__ */ f(le.Root, { ...d, children: /* @__PURE__ */ f(
642
656
  Vo,
643
657
  {
644
- required: m,
645
- scope: s,
646
- trigger: x,
658
+ required: x,
659
+ scope: c,
660
+ trigger: h,
647
661
  onTriggerChange: v,
648
662
  valueNode: C,
649
663
  onValueNodeChange: b,
650
664
  valueNodeHasChildren: g,
651
- onValueNodeHasChildrenChange: w,
652
- contentId: ne(),
653
- value: E,
665
+ onValueNodeHasChildrenChange: I,
666
+ contentId: re(),
667
+ value: _,
654
668
  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(
669
+ open: O,
670
+ onOpenChange: A,
671
+ dir: E,
672
+ triggerPointerDownPosRef: q,
673
+ disabled: u,
674
+ multi: p,
675
+ children: /* @__PURE__ */ f(ve.Provider, { scope: c, children: /* @__PURE__ */ f(
662
676
  Po,
663
677
  {
664
678
  scope: r.__scopeSelect,
665
- onNativeOptionAdd: l.useCallback((M) => {
666
- $((L) => new Set(L).add(M));
679
+ onNativeOptionAdd: l.useCallback((D) => {
680
+ B((H) => new Set(H).add(D));
667
681
  }, []),
668
- onNativeOptionRemove: l.useCallback((M) => {
669
- $((L) => {
670
- const B = new Set(L);
671
- return B.delete(M), B;
682
+ onNativeOptionRemove: l.useCallback((D) => {
683
+ B((H) => {
684
+ const F = new Set(H);
685
+ return F.delete(D), F;
672
686
  });
673
687
  }, []),
674
688
  children: e
@@ -677,19 +691,19 @@ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
677
691
  }
678
692
  ) });
679
693
  };
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);
694
+ ke.displayName = he;
695
+ const xt = "SelectTrigger", Fe = l.forwardRef(
696
+ (r, c) => {
697
+ 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) => {
698
+ const h = a().filter((b) => !b.disabled), v = h.find((b) => b.value === n.value), C = Et(h, d, v);
685
699
  if (C !== void 0 && !Array.isArray(C.value)) {
686
700
  const b = n.multi ? [C.value] : C.value;
687
701
  n.onValueChange(b);
688
702
  }
689
- }), h = () => {
690
- i || (n.onOpenChange(!0), m());
703
+ }), p = () => {
704
+ i || (n.onOpenChange(!0), x());
691
705
  };
692
- return /* @__PURE__ */ f(re.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ f(
706
+ return /* @__PURE__ */ f(le.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ f(
693
707
  N.div,
694
708
  {
695
709
  role: "combobox",
@@ -703,89 +717,89 @@ const Ct = "SelectTrigger", Fe = l.forwardRef(
703
717
  "data-placeholder": n.value === void 0 ? "" : void 0,
704
718
  tabIndex: i ? void 0 : 0,
705
719
  ...t,
706
- ref: c,
707
- onClick: T(t.onClick, (u) => {
708
- u.currentTarget.focus();
720
+ ref: s,
721
+ onClick: T(t.onClick, (d) => {
722
+ d.currentTarget.focus();
709
723
  }),
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());
724
+ onPointerDown: T(t.onPointerDown, (d) => {
725
+ const h = d.target;
726
+ 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 = {
727
+ x: Math.round(d.pageX),
728
+ y: Math.round(d.pageY)
729
+ }, d.preventDefault());
716
730
  }),
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()));
731
+ onKeyDown: T(t.onKeyDown, (d) => {
732
+ const h = m.current !== "", v = d.ctrlKey || d.altKey || d.metaKey, C = d.target;
733
+ (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
734
  })
721
735
  }
722
736
  ) });
723
737
  }
724
738
  );
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(
739
+ Fe.displayName = xt;
740
+ const Ct = "SelectValue", Le = l.forwardRef(
741
+ (r, c) => {
742
+ 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);
743
+ L(() => {
744
+ s(a);
745
+ }, [s, a]), l.useLayoutEffect(() => {
746
+ if (Array.isArray(i.value) && u.length !== i.value.length) {
747
+ const h = setTimeout(() => {
748
+ const v = p().filter(
735
749
  (C) => Array.isArray(C.value) ? !1 : i.value?.includes(C.value)
736
750
  );
737
- m(v);
751
+ x(v);
738
752
  });
739
753
  return () => {
740
- clearTimeout(x);
754
+ clearTimeout(h);
741
755
  };
742
756
  }
743
- }, [i.value, h, d]);
744
- let u;
757
+ }, [i.value, p, u]);
758
+ let d;
745
759
  if ((i.value === void 0 || i.value.length === 0) && o !== void 0)
746
- u = /* @__PURE__ */ f("span", { children: o });
760
+ d = /* @__PURE__ */ f("span", { children: o });
747
761
  else if (typeof t == "function")
748
762
  if (Array.isArray(i.value)) {
749
- const x = i.value.map((v) => {
750
- const C = d.find((b) => b.value === v);
763
+ const h = i.value.map((v) => {
764
+ const C = u.find((b) => b.value === v);
751
765
  return C ? t({ value: v, textValue: C?.textValue }) : null;
752
766
  });
753
- u = x.every((v) => v === null) ? o : x;
767
+ d = h.every((v) => v === null) ? o : h;
754
768
  } else
755
- u = t(i.value);
769
+ d = t(i.value);
756
770
  else
757
- u = t;
758
- return /* @__PURE__ */ f(N.span, { ...n, ref: p, children: u || null });
771
+ d = t;
772
+ return /* @__PURE__ */ f(N.span, { ...n, ref: m, children: d || null });
759
773
  }
760
774
  );
761
- Le.displayName = vt;
775
+ Le.displayName = Ct;
762
776
  const Ro = "SelectIcon", Be = l.forwardRef(
763
- (r, s) => {
777
+ (r, c) => {
764
778
  const { __scopeSelect: e, children: t, ...o } = r;
765
- return /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: s, children: t || "▼" });
779
+ return /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t || "▼" });
766
780
  }
767
781
  );
768
782
  Be.displayName = Ro;
769
- const No = "SelectPortal", He = (r) => /* @__PURE__ */ f(at, { asChild: !0, ...r });
783
+ const No = "SelectPortal", He = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
770
784
  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(() => {
785
+ const ne = "SelectContent", $e = l.forwardRef(
786
+ (r, c) => {
787
+ const e = Y(ne, r.__scopeSelect), [t, o] = l.useState();
788
+ if (L(() => {
775
789
  o(new DocumentFragment());
776
790
  }, []), !e.open) {
777
791
  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 }) }) }),
792
+ return n ? Ce.createPortal(
793
+ /* @__PURE__ */ f(vt, { scope: r.__scopeSelect, children: /* @__PURE__ */ f(ve.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ f("div", { children: r.children }) }) }),
780
794
  n
781
795
  ) : null;
782
796
  }
783
- return /* @__PURE__ */ f(St, { ...r, ref: s });
797
+ return /* @__PURE__ */ f(bt, { ...r, ref: c });
784
798
  }
785
799
  );
786
- $e.displayName = oe;
787
- const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
788
- (r, s) => {
800
+ $e.displayName = ne;
801
+ const j = 10, [vt, J] = ue(ne), Ao = "SelectContentImpl", bt = l.forwardRef(
802
+ (r, c) => {
789
803
  const {
790
804
  __scopeSelect: e,
791
805
  position: t = "item-aligned",
@@ -794,105 +808,105 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
794
808
  onPointerDownOutside: i,
795
809
  //
796
810
  // PopperContent props
797
- side: c,
811
+ side: s,
798
812
  sideOffset: a,
799
- align: p,
800
- alignOffset: d,
801
- arrowPadding: m,
802
- collisionBoundary: h,
803
- collisionPadding: u,
804
- sticky: x,
813
+ align: m,
814
+ alignOffset: u,
815
+ arrowPadding: x,
816
+ collisionBoundary: p,
817
+ collisionPadding: d,
818
+ sticky: h,
805
819
  hideWhenDetached: v,
806
820
  avoidCollisions: C,
807
821
  //
808
822
  ...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);
823
+ } = 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
824
  l.useEffect(() => {
811
- if (w)
812
- return ut(w);
813
- }, [w]), st();
814
- const K = l.useCallback(
825
+ if (I)
826
+ return at(I);
827
+ }, [I]), lt();
828
+ const G = l.useCallback(
815
829
  (S) => {
816
- const [I, ...O] = M().map((R) => R.ref.current), [y] = O.slice(-1), P = document.activeElement;
830
+ const [V, ...y] = D().map((R) => R.ref.current), [w] = y.slice(-1), P = document.activeElement;
817
831
  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))
832
+ 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
833
  return;
820
834
  },
821
- [M, V]
822
- ), q = l.useCallback(
823
- () => K([k, w]),
824
- [K, k, w]
835
+ [D, O]
836
+ ), $ = l.useCallback(
837
+ () => G([k, I]),
838
+ [G, k, I]
825
839
  );
826
840
  l.useEffect(() => {
827
- L && q();
828
- }, [L, q]);
829
- const { onOpenChange: X, triggerPointerDownPosRef: W } = g;
841
+ H && $();
842
+ }, [H, $]);
843
+ const { onOpenChange: X, triggerPointerDownPosRef: U } = g;
830
844
  l.useEffect(() => {
831
- if (w) {
845
+ if (I) {
832
846
  let S = { x: 0, y: 0 };
833
- const I = (y) => {
847
+ const V = (w) => {
834
848
  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))
849
+ x: Math.abs(Math.round(w.pageX) - (U.current?.x ?? 0)),
850
+ y: Math.abs(Math.round(w.pageY) - (U.current?.y ?? 0))
837
851
  };
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;
852
+ }, y = (w) => {
853
+ S.x <= 10 && S.y <= 10 ? w.preventDefault() : I.contains(w.target) || X(!1), document.removeEventListener("pointermove", V), U.current = null;
840
854
  };
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 });
855
+ return U.current !== null && (document.addEventListener("pointermove", V), document.addEventListener("pointerup", y, { capture: !0, once: !0 })), () => {
856
+ document.removeEventListener("pointermove", V), document.removeEventListener("pointerup", y, { capture: !0 });
843
857
  };
844
858
  }
845
- }, [w, X, W]), l.useEffect(() => {
859
+ }, [I, X, U]), l.useEffect(() => {
846
860
  const S = () => X(!1);
847
861
  return window.addEventListener("blur", S), window.addEventListener("resize", S), () => {
848
862
  window.removeEventListener("blur", S), window.removeEventListener("resize", S);
849
863
  };
850
864
  }, [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));
865
+ const [de, se] = Pt((S) => {
866
+ const V = D().filter((P) => !P.disabled), y = V.find((P) => P.ref.current === document.activeElement), w = Et(V, S, y);
867
+ w && setTimeout(() => w.ref.current.focus());
868
+ }), fe = l.useCallback(
869
+ (S, V, y) => {
870
+ const w = !z.current && !y;
871
+ (g.value !== void 0 && g.value === V || w) && (q(S), w && (z.current = !0));
858
872
  },
859
873
  [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);
874
+ ), Q = l.useCallback(() => I?.focus(), [I]), Z = l.useCallback(
875
+ (S, V, y) => {
876
+ const w = !z.current && !y;
877
+ (g.value !== void 0 && (Array.isArray(V) ? V.every((R) => g.value?.includes(R)) : g.value === V) || w) && B(S);
864
878
  },
865
879
  [g.value]
866
- ), ce = t === "popper" ? Ve : wt, Q = ce === Ve ? {
867
- side: c,
880
+ ), ce = t === "popper" ? Ve : St, ee = ce === Ve ? {
881
+ side: s,
868
882
  sideOffset: a,
869
- align: p,
870
- alignOffset: d,
871
- arrowPadding: m,
872
- collisionBoundary: h,
873
- collisionPadding: u,
874
- sticky: x,
883
+ align: m,
884
+ alignOffset: u,
885
+ arrowPadding: x,
886
+ collisionBoundary: p,
887
+ collisionPadding: d,
888
+ sticky: h,
875
889
  hideWhenDetached: v,
876
890
  avoidCollisions: C
877
891
  } : {};
878
892
  return /* @__PURE__ */ f(
879
- bt,
893
+ vt,
880
894
  {
881
895
  scope: e,
882
- content: w,
883
- viewport: V,
884
- onViewportChange: D,
885
- itemRefCallback: se,
896
+ content: I,
897
+ viewport: O,
898
+ onViewportChange: A,
899
+ itemRefCallback: fe,
886
900
  selectedItem: k,
887
- onItemLeave: fe,
901
+ onItemLeave: Q,
888
902
  itemTextRefCallback: Z,
889
- focusSelectedItem: q,
890
- selectedItemText: G,
903
+ focusSelectedItem: $,
904
+ selectedItemText: W,
891
905
  position: t,
892
- isPositioned: L,
906
+ isPositioned: H,
893
907
  searchRef: de,
894
- children: /* @__PURE__ */ f(dt, { as: Te, allowPinchZoom: !0, children: /* @__PURE__ */ f(
895
- ct,
908
+ children: /* @__PURE__ */ f(ut, { as: Te, allowPinchZoom: !0, children: /* @__PURE__ */ f(
909
+ st,
896
910
  {
897
911
  asChild: !0,
898
912
  trapped: g.open,
@@ -903,7 +917,7 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
903
917
  g.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), S.preventDefault();
904
918
  }),
905
919
  children: /* @__PURE__ */ f(
906
- lt,
920
+ rt,
907
921
  {
908
922
  asChild: !0,
909
923
  disableOutsidePointerEvents: !0,
@@ -921,9 +935,9 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
921
935
  dir: g.dir,
922
936
  onContextMenu: (S) => S.preventDefault(),
923
937
  ...b,
924
- ...Q,
925
- onPlaced: () => B(!0),
926
- ref: E,
938
+ ...ee,
939
+ onPlaced: () => F(!0),
940
+ ref: _,
927
941
  style: {
928
942
  // flex layout so we can place the scroll buttons properly
929
943
  display: "flex",
@@ -933,14 +947,14 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
933
947
  ...b.style
934
948
  },
935
949
  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);
950
+ const V = S.ctrlKey || S.altKey || S.metaKey;
951
+ if (S.key === "Tab" && S.preventDefault(), !V && S.key.length === 1 && se(S.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(S.key)) {
952
+ let w = D().filter((P) => !P.disabled).map((P) => P.ref.current);
953
+ if (["ArrowUp", "End"].includes(S.key) && (w = w.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
954
+ const P = S.target, R = w.indexOf(P);
955
+ w = w.slice(R + 1);
942
956
  }
943
- setTimeout(() => K(y)), S.preventDefault();
957
+ setTimeout(() => G(w)), S.preventDefault();
944
958
  }
945
959
  })
946
960
  }
@@ -953,71 +967,71 @@ const j = 10, [bt, J] = ue(oe), Ao = "SelectContentImpl", St = l.forwardRef(
953
967
  );
954
968
  }
955
969
  );
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();
970
+ bt.displayName = Ao;
971
+ const _o = "SelectItemAlignedPosition", St = l.forwardRef(
972
+ (r, c) => {
973
+ 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(() => {
974
+ if (n.trigger && n.valueNode && s && m && v && C && b) {
975
+ const _ = n.trigger.getBoundingClientRect(), k = m.getBoundingClientRect(), q = n.valueNode.getBoundingClientRect(), W = b.getBoundingClientRect();
962
976
  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`;
977
+ 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]);
978
+ s.style.minWidth = `${oe}px`, s.style.left = `${we}px`;
965
979
  } 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`;
980
+ 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]);
981
+ s.style.minWidth = `${oe}px`, s.style.right = `${we}px`;
968
982
  }
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(
983
+ 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;
984
+ if (V <= Z) {
985
+ const P = C === B[B.length - 1].ref.current;
986
+ s.style.bottom = "0px";
987
+ const R = m.clientHeight - v.offsetTop - v.offsetHeight, te = Math.max(
974
988
  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`;
989
+ ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
990
+ (P ? Q : 0) + R + $
991
+ ), oe = V + te;
992
+ s.style.height = `${oe}px`;
979
993
  } else {
980
- const P = C === $[0].ref.current;
981
- c.style.top = "0px";
982
- const ee = Math.max(
994
+ const P = C === B[0].ref.current;
995
+ s.style.top = "0px";
996
+ const te = Math.max(
983
997
  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;
998
+ z + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
999
+ (P ? fe : 0) + ee
1000
+ ) + y;
1001
+ s.style.height = `${te}px`, v.scrollTop = V - Z + v.offsetTop;
988
1002
  }
989
- c.style.margin = `${j}px 0`, c.style.minHeight = `${de}px`, c.style.maxHeight = `${M}px`, t?.(), requestAnimationFrame(() => u.current = !0);
1003
+ s.style.margin = `${j}px 0`, s.style.minHeight = `${de}px`, s.style.maxHeight = `${D}px`, t?.(), requestAnimationFrame(() => d.current = !0);
990
1004
  }
991
1005
  }, [
992
- h,
1006
+ p,
993
1007
  n.trigger,
994
1008
  n.valueNode,
995
- c,
996
- p,
1009
+ s,
1010
+ m,
997
1011
  v,
998
1012
  C,
999
1013
  b,
1000
1014
  n.dir,
1001
1015
  t
1002
1016
  ]);
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);
1017
+ L(() => I(), [I]);
1018
+ const [E, O] = l.useState();
1019
+ L(() => {
1020
+ m && O(window.getComputedStyle(m).zIndex);
1021
+ }, [m]);
1022
+ const A = l.useCallback(
1023
+ (_) => {
1024
+ _ && h.current === !0 && (I(), g?.(), h.current = !1);
1011
1025
  },
1012
- [w, g]
1026
+ [I, g]
1013
1027
  );
1014
1028
  return /* @__PURE__ */ f(
1015
1029
  Oo,
1016
1030
  {
1017
1031
  scope: e,
1018
- contentWrapper: c,
1019
- shouldExpandOnScrollRef: u,
1020
- onScrollButtonChange: D,
1032
+ contentWrapper: s,
1033
+ shouldExpandOnScrollRef: d,
1034
+ onScrollButtonChange: A,
1021
1035
  children: /* @__PURE__ */ f(
1022
1036
  "div",
1023
1037
  {
@@ -1026,13 +1040,13 @@ const _o = "SelectItemAlignedPosition", wt = l.forwardRef(
1026
1040
  display: "flex",
1027
1041
  flexDirection: "column",
1028
1042
  position: "fixed",
1029
- zIndex: _
1043
+ zIndex: E
1030
1044
  },
1031
1045
  children: /* @__PURE__ */ f(
1032
1046
  N.div,
1033
1047
  {
1034
1048
  ...o,
1035
- ref: m,
1049
+ ref: x,
1036
1050
  style: {
1037
1051
  // When we get the height of the content, it includes borders. If we were to set
1038
1052
  // the height without having `boxSizing: 'border-box'` it would be too big.
@@ -1049,16 +1063,16 @@ const _o = "SelectItemAlignedPosition", wt = l.forwardRef(
1049
1063
  );
1050
1064
  }
1051
1065
  );
1052
- wt.displayName = _o;
1066
+ St.displayName = _o;
1053
1067
  const Mo = "SelectPopperPosition", Ve = l.forwardRef(
1054
- (r, s) => {
1068
+ (r, c) => {
1055
1069
  const { __scopeSelect: e, align: t = "start", collisionPadding: o = j, ...n } = r, i = be(e);
1056
1070
  return /* @__PURE__ */ f(
1057
- re.Content,
1071
+ le.Content,
1058
1072
  {
1059
1073
  ...i,
1060
1074
  ...n,
1061
- ref: s,
1075
+ ref: c,
1062
1076
  align: t,
1063
1077
  collisionPadding: o,
1064
1078
  style: {
@@ -1077,11 +1091,11 @@ const Mo = "SelectPopperPosition", Ve = l.forwardRef(
1077
1091
  );
1078
1092
  Ve.displayName = Mo;
1079
1093
  const [Oo, Ue] = ue(
1080
- oe,
1094
+ ne,
1081
1095
  {}
1082
1096
  ), 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);
1097
+ (r, c) => {
1098
+ const { __scopeSelect: e, ...t } = r, o = J(Pe, e), n = Ue(Pe, e), i = M(c, o.onViewportChange), s = l.useRef(0);
1085
1099
  return /* @__PURE__ */ Ae(_e, { children: [
1086
1100
  /* @__PURE__ */ f(
1087
1101
  "style",
@@ -1108,18 +1122,18 @@ const [Oo, Ue] = ue(
1108
1122
  ...t.style
1109
1123
  },
1110
1124
  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");
1125
+ const m = a.currentTarget, { contentWrapper: u, shouldExpandOnScrollRef: x } = n;
1126
+ if (x?.current && u) {
1127
+ const p = Math.abs(s.current - m.scrollTop);
1128
+ if (p > 0) {
1129
+ const d = window.innerHeight - j * 2, h = parseFloat(u.style.minHeight), v = parseFloat(u.style.height), C = Math.max(h, v);
1130
+ if (C < d) {
1131
+ const b = C + p, g = Math.min(d, b), I = b - g;
1132
+ u.style.height = `${g}px`, u.style.bottom === "0px" && (m.scrollTop = I > 0 ? I : 0, u.style.justifyContent = "flex-end");
1119
1133
  }
1120
1134
  }
1121
1135
  }
1122
- c.current = p.scrollTop;
1136
+ s.current = m.scrollTop;
1123
1137
  })
1124
1138
  }
1125
1139
  ) })
@@ -1128,31 +1142,31 @@ const [Oo, Ue] = ue(
1128
1142
  );
1129
1143
  Ke.displayName = Pe;
1130
1144
  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 }) });
1145
+ (r, c) => {
1146
+ const { __scopeSelect: e, ...t } = r, o = re();
1147
+ return /* @__PURE__ */ f(Do, { scope: e, id: o, children: /* @__PURE__ */ f(N.div, { role: "group", "aria-labelledby": o, ...t, ref: c }) });
1134
1148
  }
1135
1149
  );
1136
1150
  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 });
1151
+ const wt = "SelectLabel", ze = l.forwardRef(
1152
+ (r, c) => {
1153
+ const { __scopeSelect: e, ...t } = r, o = ko(wt, e);
1154
+ return /* @__PURE__ */ f(N.div, { id: o.id, ...t, ref: c });
1141
1155
  }
1142
1156
  );
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,
1157
+ ze.displayName = wt;
1158
+ const xe = "SelectItem", [Fo, yt] = ue(xe), Ge = l.forwardRef(
1159
+ (r, c) => {
1160
+ 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(
1161
+ c,
1148
1162
  (g) => a.itemRefCallback?.(g, t, o)
1149
- ), C = ne(), b = () => {
1163
+ ), C = re(), b = () => {
1150
1164
  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);
1165
+ let g = s.multi && typeof t == "string" ? [t] : t;
1166
+ u && !m ? s.onValueChange(g) : Array.isArray(s.value) && (g = Rt(t, s.value)), s.onValueChange(g), s.multi || s.onOpenChange(!1);
1153
1167
  }
1154
1168
  };
1155
- if (!c.multi && Array.isArray(t))
1169
+ if (!s.multi && Array.isArray(t))
1156
1170
  throw new Error("You can only pass an array of values in multi selects");
1157
1171
  return /* @__PURE__ */ f(
1158
1172
  Fo,
@@ -1161,27 +1175,27 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1161
1175
  value: t,
1162
1176
  disabled: o,
1163
1177
  textId: C,
1164
- isSelected: p,
1165
- isIntermediate: d,
1178
+ isSelected: m,
1179
+ isIntermediate: u,
1166
1180
  onItemTextChange: l.useCallback((g) => {
1167
- h((w) => w || (g?.textContent ?? "").trim());
1181
+ p((I) => I || (g?.textContent ?? "").trim());
1168
1182
  }, []),
1169
- children: /* @__PURE__ */ f(ve.ItemSlot, { scope: e, value: t, disabled: o, textValue: m, children: /* @__PURE__ */ f(
1183
+ children: /* @__PURE__ */ f(ve.ItemSlot, { scope: e, value: t, disabled: o, textValue: x, children: /* @__PURE__ */ f(
1170
1184
  N.div,
1171
1185
  {
1172
1186
  role: "option",
1173
1187
  "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",
1188
+ "data-highlighted": d ? "" : void 0,
1189
+ "aria-selected": s.multi ? void 0 : m && d,
1190
+ "aria-checked": s.multi ? m : void 0,
1191
+ "data-state": m ? "checked" : "unchecked",
1178
1192
  "aria-disabled": o || void 0,
1179
1193
  "data-disabled": o ? "" : void 0,
1180
1194
  tabIndex: o ? void 0 : -1,
1181
1195
  ...i,
1182
1196
  ref: v,
1183
- onFocus: T(i.onFocus, () => x(!0)),
1184
- onBlur: T(i.onBlur, () => x(!1)),
1197
+ onFocus: T(i.onFocus, () => h(!0)),
1198
+ onBlur: T(i.onBlur, () => h(!1)),
1185
1199
  onPointerUp: T(i.onPointerUp, b),
1186
1200
  onPointerMove: T(i.onPointerMove, (g) => {
1187
1201
  o ? a.onItemLeave?.() : g.currentTarget.focus({ preventScroll: !0 });
@@ -1190,7 +1204,7 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1190
1204
  g.currentTarget === document.activeElement && a.onItemLeave?.();
1191
1205
  }),
1192
1206
  onKeyDown: T(i.onKeyDown, (g) => {
1193
- a.searchRef?.current !== "" && g.key === " " || (Io.includes(g.key) && b(), g.key === " " && g.preventDefault());
1207
+ a.searchRef?.current !== "" && g.key === " " || (wo.includes(g.key) && b(), g.key === " " && g.preventDefault());
1194
1208
  })
1195
1209
  }
1196
1210
  ) })
@@ -1198,62 +1212,62 @@ const ge = "SelectItem", [Fo, Tt] = ue(ge), Ge = l.forwardRef(
1198
1212
  );
1199
1213
  }
1200
1214
  );
1201
- Ge.displayName = ge;
1215
+ Ge.displayName = xe;
1202
1216
  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),
1217
+ (r, c) => {
1218
+ 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(
1219
+ c,
1220
+ (b) => x(b),
1207
1221
  a.onItemTextChange,
1208
- (b) => c.itemTextRefCallback?.(b, a.value, a.disabled)
1209
- ), u = d?.textContent, x = l.useMemo(
1222
+ (b) => s.itemTextRefCallback?.(b, a.value, a.disabled)
1223
+ ), d = u?.textContent, h = l.useMemo(
1210
1224
  () => /* @__PURE__ */ f(
1211
1225
  "option",
1212
1226
  {
1213
1227
  value: a.value,
1214
1228
  disabled: a.disabled,
1215
- children: u
1229
+ children: d
1216
1230
  },
1217
1231
  Array.isArray(a.value) ? a.value.join(";") : a.value
1218
1232
  ),
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
1233
+ [a.disabled, a.value, d]
1234
+ ), { onNativeOptionAdd: v, onNativeOptionRemove: C } = m;
1235
+ return L(() => (v(h), () => C(h)), [v, C, h]), /* @__PURE__ */ Ae(_e, { children: [
1236
+ /* @__PURE__ */ f(N.span, { id: a.textId, ...n, ref: p }),
1237
+ a.isSelected && i.valueNode && !i.valueNodeHasChildren ? Ce.createPortal(n.children, i.valueNode) : null
1224
1238
  ] });
1225
1239
  }
1226
1240
  );
1227
1241
  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({
1242
+ const Tt = "SelectItemIndicator", Ye = l.forwardRef(
1243
+ (r, c) => {
1244
+ const { __scopeSelect: e, children: t, ...o } = r, n = yt(Tt, e);
1245
+ return typeof t == "function" ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t({
1232
1246
  isSelected: n.isSelected,
1233
1247
  isIntermediate: n.isIntermediate
1234
- }) }) : n.isSelected ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
1248
+ }) }) : n.isSelected ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t }) : null;
1235
1249
  }
1236
1250
  );
1237
- Ye.displayName = Vt;
1251
+ Ye.displayName = Tt;
1238
1252
  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(() => {
1253
+ (r, c) => {
1254
+ const e = J(Ee, r.__scopeSelect), t = Ue(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1255
+ return L(() => {
1242
1256
  if (e.viewport && e.isPositioned) {
1243
- const c = e.viewport, a = () => {
1244
- const p = c.scrollTop > 0;
1245
- n(p);
1257
+ const s = e.viewport, a = () => {
1258
+ const m = s.scrollTop > 0;
1259
+ n(m);
1246
1260
  };
1247
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1261
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1248
1262
  }
1249
1263
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1250
- Pt,
1264
+ Vt,
1251
1265
  {
1252
1266
  ...r,
1253
1267
  ref: i,
1254
1268
  onAutoScroll: () => {
1255
- const { viewport: c, selectedItem: a } = e;
1256
- c && a && (c.scrollTop -= a.offsetHeight);
1269
+ const { viewport: s, selectedItem: a } = e;
1270
+ s && a && (s.scrollTop -= a.offsetHeight);
1257
1271
  }
1258
1272
  }
1259
1273
  ) : null;
@@ -1261,43 +1275,43 @@ const Ee = "SelectScrollUpButton", qe = l.forwardRef(
1261
1275
  );
1262
1276
  qe.displayName = Ee;
1263
1277
  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(() => {
1278
+ (r, c) => {
1279
+ const e = J(Re, r.__scopeSelect), t = Ue(Re, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1280
+ return L(() => {
1267
1281
  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);
1282
+ const s = e.viewport, a = () => {
1283
+ const m = s.scrollHeight - s.clientHeight, u = Math.ceil(s.scrollTop) < m;
1284
+ n(u);
1271
1285
  };
1272
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1286
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1273
1287
  }
1274
1288
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1275
- Pt,
1289
+ Vt,
1276
1290
  {
1277
1291
  ...r,
1278
1292
  ref: i,
1279
1293
  onAutoScroll: () => {
1280
- const { viewport: c, selectedItem: a } = e;
1281
- c && a && (c.scrollTop += a.offsetHeight);
1294
+ const { viewport: s, selectedItem: a } = e;
1295
+ s && a && (s.scrollTop += a.offsetHeight);
1282
1296
  }
1283
1297
  }
1284
1298
  ) : null;
1285
1299
  }
1286
1300
  );
1287
1301
  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(() => {
1302
+ const Vt = l.forwardRef(
1303
+ (r, c) => {
1304
+ const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), s = ge(e), a = l.useCallback(() => {
1291
1305
  i.current !== null && (window.clearInterval(i.current), i.current = null);
1292
1306
  }, []);
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(
1307
+ return l.useEffect(() => () => a(), [a]), L(() => {
1308
+ s().find((u) => u.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1309
+ }, [s]), /* @__PURE__ */ f(
1296
1310
  N.div,
1297
1311
  {
1298
1312
  "aria-hidden": !0,
1299
1313
  ...o,
1300
- ref: s,
1314
+ ref: c,
1301
1315
  style: { flexShrink: 0, ...o.style },
1302
1316
  onPointerMove: T(o.onPointerMove, () => {
1303
1317
  n.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
@@ -1309,35 +1323,35 @@ const Pt = l.forwardRef(
1309
1323
  );
1310
1324
  }
1311
1325
  ), Lo = "SelectSeparator", Ze = l.forwardRef(
1312
- (r, s) => {
1326
+ (r, c) => {
1313
1327
  const { __scopeSelect: e, ...t } = r;
1314
- return /* @__PURE__ */ f(N.div, { "aria-hidden": !0, ...t, ref: s });
1328
+ return /* @__PURE__ */ f(N.div, { "aria-hidden": !0, ...t, ref: c });
1315
1329
  }
1316
1330
  );
1317
1331
  Ze.displayName = Lo;
1318
1332
  const Ne = "SelectArrow", Je = l.forwardRef(
1319
- (r, s) => {
1333
+ (r, c) => {
1320
1334
  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;
1335
+ return n.open && i.position === "popper" ? /* @__PURE__ */ f(le.Arrow, { ...o, ...t, ref: c }) : null;
1322
1336
  }
1323
1337
  );
1324
1338
  Je.displayName = Ne;
1325
1339
  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);
1340
+ (r, c) => {
1341
+ const { value: e, ...t } = r, o = l.useRef(null), n = M(c, o), i = _t(e), s = Y(Bo, void 0);
1328
1342
  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);
1343
+ const m = o.current, u = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(u, "value").set;
1344
+ if (i !== e && p) {
1345
+ const d = new Event("change", { bubbles: !0 });
1346
+ p.call(m, e), m.dispatchEvent(d);
1333
1347
  }
1334
1348
  }, [i, e]);
1335
1349
  let a = e;
1336
- return c.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(Dt, { asChild: !0, children: /* @__PURE__ */ f(
1350
+ return s.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(Mt, { asChild: !0, children: /* @__PURE__ */ f(
1337
1351
  "select",
1338
1352
  {
1339
1353
  ...t,
1340
- multiple: c.multi ? !0 : void 0,
1354
+ multiple: s.multi ? !0 : void 0,
1341
1355
  ref: n,
1342
1356
  defaultValue: a
1343
1357
  }
@@ -1345,35 +1359,35 @@ const Bo = "BubbleSelect", Ho = l.forwardRef(
1345
1359
  }
1346
1360
  );
1347
1361
  Ho.displayName = "BubbleSelect";
1348
- function Et(r) {
1349
- const s = Mt(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1362
+ function Pt(r) {
1363
+ const c = Ot(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1350
1364
  (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);
1365
+ const s = e.current + i;
1366
+ c(s), function a(m) {
1367
+ e.current = m, window.clearTimeout(t.current), m !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
1368
+ }(s);
1355
1369
  },
1356
- [s]
1370
+ [c]
1357
1371
  ), n = l.useCallback(() => {
1358
1372
  e.current = "", window.clearTimeout(t.current);
1359
1373
  }, []);
1360
1374
  return l.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, n];
1361
1375
  }
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;
1376
+ function Et(r, c, e) {
1377
+ const o = c.length > 1 && Array.from(c).every((m) => m === c[0]) ? c[0] : c, n = e ? r.indexOf(e) : -1;
1364
1378
  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()));
1379
+ o.length === 1 && (i = i.filter((m) => m !== e));
1380
+ const a = i.find((m) => m.textValue.toLowerCase().startsWith(o.toLowerCase()));
1367
1381
  return a !== e ? a : void 0;
1368
1382
  }
1369
- function $o(r, s) {
1370
- return r.map((e, t) => r[(s + t) % r.length]);
1383
+ function $o(r, c) {
1384
+ return r.map((e, t) => r[(c + t) % r.length]);
1371
1385
  }
1372
- const Nt = (r, s = []) => {
1386
+ const Rt = (r, c = []) => {
1373
1387
  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)];
1388
+ return r.reduce((t, o) => Rt(o, t), c);
1389
+ const e = c.indexOf(r);
1390
+ return e === -1 ? [...c, r] : [...c.slice(0, e), ...c.slice(e + 1)];
1377
1391
  }, 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
1392
  __proto__: null,
1379
1393
  Arrow: nn,
@@ -1414,5 +1428,6 @@ export {
1414
1428
  Pn as Combobox,
1415
1429
  En as Select,
1416
1430
  An as composeEventHandlers,
1431
+ Dt as createCollection,
1417
1432
  Mn as useCallbackRef
1418
1433
  };