react-animated-select 0.5.6 → 0.6.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.es.js CHANGED
@@ -1,150 +1,150 @@
1
- import Be, { createContext as Ze, memo as Ie, useRef as ue, useState as fe, useEffect as oe, useCallback as O, useLayoutEffect as Qe, useMemo as xe, useId as Ye, forwardRef as dr, useImperativeHandle as fr, isValidElement as gr, cloneElement as hr, useContext as Ge } from "react";
2
- import { CSSTransition as Ae, TransitionGroup as pr } from "react-transition-group";
3
- import { createPortal as xr } from "react-dom";
4
- import './index.css';var Ne = { exports: {} }, Se = {};
5
- var We;
6
- function br() {
7
- if (We) return Se;
8
- We = 1;
9
- var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.fragment");
10
- function o(i, c, n) {
11
- var w = null;
12
- if (n !== void 0 && (w = "" + n), c.key !== void 0 && (w = "" + c.key), "key" in c) {
13
- n = {};
14
- for (var S in c)
15
- S !== "key" && (n[S] = c[S]);
16
- } else n = c;
17
- return c = n.ref, {
1
+ import dr, { createContext as fr, forwardRef as hr, useRef as ne, useImperativeHandle as gr, useEffect as ue, memo as qe, useCallback as _, useLayoutEffect as Ve, Fragment as pr, useState as le, useMemo as Ne, useId as xr, isValidElement as vr, cloneElement as jr, useContext as Be } from "react";
2
+ import { CSSTransition as Xe, TransitionGroup as Sr } from "react-transition-group";
3
+ import { createPortal as $r } from "react-dom";
4
+ import './index.css';var Je = { exports: {} }, Ye = {};
5
+ var nr;
6
+ function Nr() {
7
+ if (nr) return Ye;
8
+ nr = 1;
9
+ var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
10
+ function o(s, c, g) {
11
+ var y = null;
12
+ if (g !== void 0 && (y = "" + g), c.key !== void 0 && (y = "" + c.key), "key" in c) {
13
+ g = {};
14
+ for (var d in c)
15
+ d !== "key" && (g[d] = c[d]);
16
+ } else g = c;
17
+ return c = g.ref, {
18
18
  $$typeof: e,
19
- type: i,
20
- key: w,
19
+ type: s,
20
+ key: y,
21
21
  ref: c !== void 0 ? c : null,
22
- props: n
22
+ props: g
23
23
  };
24
24
  }
25
- return Se.Fragment = s, Se.jsx = o, Se.jsxs = o, Se;
25
+ return Ye.Fragment = t, Ye.jsx = o, Ye.jsxs = o, Ye;
26
26
  }
27
- var $e = {};
28
- var Je;
29
- function yr() {
30
- return Je || (Je = 1, process.env.NODE_ENV !== "production" && (function() {
27
+ var ze = {};
28
+ var sr;
29
+ function kr() {
30
+ return sr || (sr = 1, process.env.NODE_ENV !== "production" && (function() {
31
31
  function e(r) {
32
32
  if (r == null) return null;
33
33
  if (typeof r == "function")
34
- return r.$$typeof === F ? null : r.displayName || r.name || null;
34
+ return r.$$typeof === re ? null : r.displayName || r.name || null;
35
35
  if (typeof r == "string") return r;
36
36
  switch (r) {
37
- case D:
37
+ case P:
38
38
  return "Fragment";
39
- case z:
39
+ case W:
40
40
  return "Profiler";
41
- case C:
41
+ case M:
42
42
  return "StrictMode";
43
- case ee:
43
+ case X:
44
44
  return "Suspense";
45
- case se:
45
+ case Y:
46
46
  return "SuspenseList";
47
- case d:
47
+ case ee:
48
48
  return "Activity";
49
49
  }
50
50
  if (typeof r == "object")
51
51
  switch (typeof r.tag == "number" && console.error(
52
52
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
53
53
  ), r.$$typeof) {
54
- case H:
54
+ case L:
55
55
  return "Portal";
56
- case M:
56
+ case z:
57
57
  return r.displayName || "Context";
58
- case A:
58
+ case C:
59
59
  return (r._context.displayName || "Context") + ".Consumer";
60
- case Z:
61
- var h = r.render;
62
- return r = r.displayName, r || (r = h.displayName || h.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
63
60
  case ie:
64
- return h = r.displayName || null, h !== null ? h : e(r.type) || "Memo";
65
- case q:
66
- h = r._payload, r = r._init;
61
+ var l = r.render;
62
+ return r = r.displayName, r || (r = l.displayName || l.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
63
+ case T:
64
+ return l = r.displayName || null, l !== null ? l : e(r.type) || "Memo";
65
+ case a:
66
+ l = r._payload, r = r._init;
67
67
  try {
68
- return e(r(h));
68
+ return e(r(l));
69
69
  } catch {
70
70
  }
71
71
  }
72
72
  return null;
73
73
  }
74
- function s(r) {
74
+ function t(r) {
75
75
  return "" + r;
76
76
  }
77
77
  function o(r) {
78
78
  try {
79
- s(r);
80
- var h = !1;
79
+ t(r);
80
+ var l = !1;
81
81
  } catch {
82
- h = !0;
82
+ l = !0;
83
83
  }
84
- if (h) {
85
- h = console;
86
- var j = h.error, P = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
87
- return j.call(
88
- h,
84
+ if (l) {
85
+ l = console;
86
+ var m = l.error, w = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
87
+ return m.call(
88
+ l,
89
89
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
90
- P
91
- ), s(r);
90
+ w
91
+ ), t(r);
92
92
  }
93
93
  }
94
- function i(r) {
95
- if (r === D) return "<>";
96
- if (typeof r == "object" && r !== null && r.$$typeof === q)
94
+ function s(r) {
95
+ if (r === P) return "<>";
96
+ if (typeof r == "object" && r !== null && r.$$typeof === a)
97
97
  return "<...>";
98
98
  try {
99
- var h = e(r);
100
- return h ? "<" + h + ">" : "<...>";
99
+ var l = e(r);
100
+ return l ? "<" + l + ">" : "<...>";
101
101
  } catch {
102
102
  return "<...>";
103
103
  }
104
104
  }
105
105
  function c() {
106
- var r = g.A;
106
+ var r = V.A;
107
107
  return r === null ? null : r.getOwner();
108
108
  }
109
- function n() {
109
+ function g() {
110
110
  return Error("react-stack-top-frame");
111
111
  }
112
- function w(r) {
113
- if (x.call(r, "key")) {
114
- var h = Object.getOwnPropertyDescriptor(r, "key").get;
115
- if (h && h.isReactWarning) return !1;
112
+ function y(r) {
113
+ if (K.call(r, "key")) {
114
+ var l = Object.getOwnPropertyDescriptor(r, "key").get;
115
+ if (l && l.isReactWarning) return !1;
116
116
  }
117
117
  return r.key !== void 0;
118
118
  }
119
- function S(r, h) {
120
- function j() {
121
- G || (G = !0, console.error(
119
+ function d(r, l) {
120
+ function m() {
121
+ A || (A = !0, console.error(
122
122
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
123
- h
123
+ l
124
124
  ));
125
125
  }
126
- j.isReactWarning = !0, Object.defineProperty(r, "key", {
127
- get: j,
126
+ m.isReactWarning = !0, Object.defineProperty(r, "key", {
127
+ get: m,
128
128
  configurable: !0
129
129
  });
130
130
  }
131
- function p() {
131
+ function i() {
132
132
  var r = e(this.type);
133
- return W[r] || (W[r] = !0, console.error(
133
+ return B[r] || (B[r] = !0, console.error(
134
134
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
135
135
  )), r = this.props.ref, r !== void 0 ? r : null;
136
136
  }
137
- function $(r, h, j, P, te, ne) {
138
- var t = j.ref;
137
+ function E(r, l, m, w, ge, ve) {
138
+ var n = m.ref;
139
139
  return r = {
140
- $$typeof: k,
140
+ $$typeof: F,
141
141
  type: r,
142
- key: h,
143
- props: j,
144
- _owner: P
145
- }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(r, "ref", {
142
+ key: l,
143
+ props: m,
144
+ _owner: w
145
+ }, (n !== void 0 ? n : null) !== null ? Object.defineProperty(r, "ref", {
146
146
  enumerable: !1,
147
- get: p
147
+ get: i
148
148
  }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
149
149
  configurable: !1,
150
150
  enumerable: !1,
@@ -159,109 +159,109 @@ function yr() {
159
159
  configurable: !1,
160
160
  enumerable: !1,
161
161
  writable: !0,
162
- value: te
162
+ value: ge
163
163
  }), Object.defineProperty(r, "_debugTask", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
166
166
  writable: !0,
167
- value: ne
167
+ value: ve
168
168
  }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
169
169
  }
170
- function R(r, h, j, P, te, ne) {
171
- var t = h.children;
172
- if (t !== void 0)
173
- if (P)
174
- if (y(t)) {
175
- for (P = 0; P < t.length; P++)
176
- E(t[P]);
177
- Object.freeze && Object.freeze(t);
170
+ function b(r, l, m, w, ge, ve) {
171
+ var n = l.children;
172
+ if (n !== void 0)
173
+ if (w)
174
+ if (de(n)) {
175
+ for (w = 0; w < n.length; w++)
176
+ k(n[w]);
177
+ Object.freeze && Object.freeze(n);
178
178
  } else
179
179
  console.error(
180
180
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
181
181
  );
182
- else E(t);
183
- if (x.call(h, "key")) {
184
- t = e(r);
185
- var f = Object.keys(h).filter(function(b) {
186
- return b !== "key";
182
+ else k(n);
183
+ if (K.call(l, "key")) {
184
+ n = e(r);
185
+ var p = Object.keys(l).filter(function(f) {
186
+ return f !== "key";
187
187
  });
188
- P = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", ae[t + P] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
188
+ w = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", x[n + w] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
189
189
  `A props object containing a "key" prop is being spread into JSX:
190
190
  let props = %s;
191
191
  <%s {...props} />
192
192
  React keys must be passed directly to JSX without using spread:
193
193
  let props = %s;
194
194
  <%s key={someKey} {...props} />`,
195
- P,
196
- t,
197
- f,
198
- t
199
- ), ae[t + P] = !0);
195
+ w,
196
+ n,
197
+ p,
198
+ n
199
+ ), x[n + w] = !0);
200
200
  }
201
- if (t = null, j !== void 0 && (o(j), t = "" + j), w(h) && (o(h.key), t = "" + h.key), "key" in h) {
202
- j = {};
203
- for (var a in h)
204
- a !== "key" && (j[a] = h[a]);
205
- } else j = h;
206
- return t && S(
207
- j,
201
+ if (n = null, m !== void 0 && (o(m), n = "" + m), y(l) && (o(l.key), n = "" + l.key), "key" in l) {
202
+ m = {};
203
+ for (var j in l)
204
+ j !== "key" && (m[j] = l[j]);
205
+ } else m = l;
206
+ return n && d(
207
+ m,
208
208
  typeof r == "function" ? r.displayName || r.name || "Unknown" : r
209
- ), $(
209
+ ), E(
210
210
  r,
211
- t,
212
- j,
211
+ n,
212
+ m,
213
213
  c(),
214
- te,
215
- ne
214
+ ge,
215
+ ve
216
216
  );
217
217
  }
218
- function E(r) {
219
- K(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === q && (r._payload.status === "fulfilled" ? K(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
218
+ function k(r) {
219
+ N(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === a && (r._payload.status === "fulfilled" ? N(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
220
220
  }
221
- function K(r) {
222
- return typeof r == "object" && r !== null && r.$$typeof === k;
221
+ function N(r) {
222
+ return typeof r == "object" && r !== null && r.$$typeof === F;
223
223
  }
224
- var U = Be, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), H = /* @__PURE__ */ Symbol.for("react.portal"), D = /* @__PURE__ */ Symbol.for("react.fragment"), C = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), A = /* @__PURE__ */ Symbol.for("react.consumer"), M = /* @__PURE__ */ Symbol.for("react.context"), Z = /* @__PURE__ */ Symbol.for("react.forward_ref"), ee = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), d = /* @__PURE__ */ Symbol.for("react.activity"), F = /* @__PURE__ */ Symbol.for("react.client.reference"), g = U.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, y = Array.isArray, v = console.createTask ? console.createTask : function() {
224
+ var R = dr, F = /* @__PURE__ */ Symbol.for("react.transitional.element"), L = /* @__PURE__ */ Symbol.for("react.portal"), P = /* @__PURE__ */ Symbol.for("react.fragment"), M = /* @__PURE__ */ Symbol.for("react.strict_mode"), W = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), z = /* @__PURE__ */ Symbol.for("react.context"), ie = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), Y = /* @__PURE__ */ Symbol.for("react.suspense_list"), T = /* @__PURE__ */ Symbol.for("react.memo"), a = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), re = /* @__PURE__ */ Symbol.for("react.client.reference"), V = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, de = Array.isArray, ae = console.createTask ? console.createTask : function() {
225
225
  return null;
226
226
  };
227
- U = {
227
+ R = {
228
228
  react_stack_bottom_frame: function(r) {
229
229
  return r();
230
230
  }
231
231
  };
232
- var G, W = {}, re = U.react_stack_bottom_frame.bind(
233
- U,
234
- n
235
- )(), de = v(i(n)), ae = {};
236
- $e.Fragment = D, $e.jsx = function(r, h, j) {
237
- var P = 1e4 > g.recentlyCreatedOwnerStacks++;
238
- return R(
232
+ var A, B = {}, se = R.react_stack_bottom_frame.bind(
233
+ R,
234
+ g
235
+ )(), v = ae(s(g)), x = {};
236
+ ze.Fragment = P, ze.jsx = function(r, l, m) {
237
+ var w = 1e4 > V.recentlyCreatedOwnerStacks++;
238
+ return b(
239
239
  r,
240
- h,
241
- j,
240
+ l,
241
+ m,
242
242
  !1,
243
- P ? Error("react-stack-top-frame") : re,
244
- P ? v(i(r)) : de
243
+ w ? Error("react-stack-top-frame") : se,
244
+ w ? ae(s(r)) : v
245
245
  );
246
- }, $e.jsxs = function(r, h, j) {
247
- var P = 1e4 > g.recentlyCreatedOwnerStacks++;
248
- return R(
246
+ }, ze.jsxs = function(r, l, m) {
247
+ var w = 1e4 > V.recentlyCreatedOwnerStacks++;
248
+ return b(
249
249
  r,
250
- h,
251
- j,
250
+ l,
251
+ m,
252
252
  !0,
253
- P ? Error("react-stack-top-frame") : re,
254
- P ? v(i(r)) : de
253
+ w ? Error("react-stack-top-frame") : se,
254
+ w ? ae(s(r)) : v
255
255
  );
256
256
  };
257
- })()), $e;
257
+ })()), ze;
258
258
  }
259
- var Ve;
260
- function mr() {
261
- return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? Ne.exports = br() : Ne.exports = yr()), Ne.exports;
259
+ var ir;
260
+ function Rr() {
261
+ return ir || (ir = 1, process.env.NODE_ENV === "production" ? Je.exports = Nr() : Je.exports = kr()), Je.exports;
262
262
  }
263
- var u = mr();
264
- const Ue = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
263
+ var u = Rr();
264
+ const or = ({ className: e = "", ...t }) => /* @__PURE__ */ u.jsx(
265
265
  "svg",
266
266
  {
267
267
  className: e,
@@ -272,10 +272,10 @@ const Ue = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
272
272
  width: "1em",
273
273
  height: "1em",
274
274
  fill: "currentColor",
275
- ...s,
275
+ ...t,
276
276
  children: /* @__PURE__ */ u.jsx("path", { d: "M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z" })
277
277
  }
278
- ), Er = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
278
+ ), _r = ({ className: e = "", ...t }) => /* @__PURE__ */ u.jsx(
279
279
  "svg",
280
280
  {
281
281
  className: e,
@@ -284,10 +284,10 @@ const Ue = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
284
284
  width: "1em",
285
285
  height: "1em",
286
286
  fill: "currentColor",
287
- ...s,
287
+ ...t,
288
288
  children: /* @__PURE__ */ u.jsx("path", { d: "M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z" })
289
289
  }
290
- ), Me = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
290
+ ), ar = ({ className: e = "", ...t }) => /* @__PURE__ */ u.jsx(
291
291
  "svg",
292
292
  {
293
293
  className: e,
@@ -296,1184 +296,1328 @@ const Ue = ({ className: e = "", ...s }) => /* @__PURE__ */ u.jsx(
296
296
  width: "1em",
297
297
  height: "1em",
298
298
  fill: "currentColor",
299
- ...s,
299
+ ...t,
300
300
  children: /* @__PURE__ */ u.jsx("path", { d: "M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z" })
301
301
  }
302
- ), qe = (e, s = "invalid-option", o = "") => {
303
- const i = o ? o.replace(/:/g, "") : "";
302
+ ), Ze = (e, t = "invalid-option", o = "") => {
303
+ const s = o ? o.replace(/:/g, "") : "";
304
304
  if (typeof e != "string" || !e.trim())
305
- return i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
305
+ return s ? `${t}-${s}` : `${t}-${Math.random().toString(36).slice(2, 8)}`;
306
306
  const c = e.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]+/gu, "").toLowerCase();
307
- return c ? c || `${s}-${Math.random().toString(36).slice(2, 8)}` : i ? `${s}-${i}` : `${s}-${Math.random().toString(36).slice(2, 8)}`;
308
- }, er = Ze(null);
309
- function wr({
310
- visibility: e,
311
- children: s,
312
- selectRef: o,
313
- onAnimationDone: i,
314
- unmount: c = !0,
315
- duration: n,
316
- easing: w,
317
- offset: S,
318
- animateOpacity: p,
319
- style: $,
320
- className: R
321
- }) {
322
- const E = ue(null), [K, U] = fe(0), [k, H] = fe({ top: 0, left: 0, width: 0 }), D = ue(k);
323
- oe(() => {
324
- D.current = k;
325
- }, [k]);
326
- const C = O(() => {
327
- if (o?.current) {
328
- const d = o.current.getBoundingClientRect(), F = window.innerHeight, g = E.current?.scrollHeight || 250, x = F - d.bottom, y = x < g && d.top > x;
329
- H({
330
- top: d.top,
331
- bottom: d.bottom,
332
- left: d.left,
333
- width: d.width,
334
- isUpward: y
335
- });
336
- }
337
- }, [o]);
338
- oe(() => {
339
- if (e)
340
- return C(), window.addEventListener("scroll", C, !0), window.addEventListener("resize", C), () => {
341
- window.removeEventListener("scroll", C, !0), window.removeEventListener("resize", C);
342
- };
343
- }, [e, C]);
344
- const z = `height var(--rac-duration) ${w}${p ? `, opacity var(--rac-duration) ${w}` : ""}`;
345
- Qe(() => {
346
- if (!o?.current) return;
347
- U(o.current.offsetHeight);
348
- const F = new ResizeObserver((g) => {
349
- for (let x of g)
350
- if (U(x.target.offsetHeight), e && E.current && o.current) {
351
- const y = o.current.getBoundingClientRect(), { isUpward: v } = D.current;
352
- E.current.style.width = `${y.width}px`, E.current.style.left = `${y.left}px`, v ? E.current.style.bottom = `${window.innerHeight - y.top + S}px` : E.current.style.top = `${y.bottom + S}px`;
353
- }
354
- });
355
- return F.observe(o.current), () => F.disconnect();
356
- }, [o, e, S]);
357
- const A = {
358
- position: "fixed",
359
- "--rac-duration": `${n}ms`,
360
- "--rac-easing": w,
361
- left: `${k.left}px`,
362
- width: `${k.width}px`,
363
- overflow: "hidden",
364
- zIndex: "2147483647",
365
- height: e ? "auto" : "0px",
366
- opacity: p ? e ? 1 : 0 : 1,
367
- pointerEvents: e ? "all" : "none",
368
- visibility: K ? "visible" : "hidden",
369
- boxSizing: "border-box",
370
- transformOrigin: k.isUpward ? "bottom" : "top",
371
- ...k.isUpward ? {
372
- bottom: `${window.innerHeight - k.top + S}px`,
373
- top: "auto"
374
- } : {
375
- top: `${k.bottom + S}px`,
376
- bottom: "auto"
377
- },
378
- ...Object.fromEntries(
379
- Object.entries($ || {}).map(([d, F]) => [
380
- d.startsWith("--") ? d : `--rac-${d.replace(/([A-Z])/g, "-$1").toLowerCase()}`,
381
- F
382
- ])
383
- )
384
- }, M = O(() => {
385
- const d = E.current;
386
- d && (d.style.height = "0px", p && (d.style.opacity = "0"), d.style.transition = "");
387
- }, [p]), Z = O(() => {
388
- const d = E.current;
389
- d && (d.style.transition = z, d.style.height = `${d.scrollHeight}px`, p && (d.style.opacity = "1"));
390
- }, [z, p]), ee = O(() => {
391
- const d = E.current;
392
- d && (d.style.height = "auto", d.style.transition = "", i && i());
393
- }, [i]), se = O(() => {
394
- const d = E.current;
395
- d && (d.style.height = `${d.scrollHeight}px`, p && (d.style.opacity = "1"), d.offsetHeight, d.style.transition = z);
396
- }, [z, p]), ie = O(() => {
397
- const d = E.current;
398
- d && (d.style.height = "0px", p && (d.style.opacity = "0"));
399
- }, [p]), q = O(() => {
400
- const d = E.current;
401
- d && (d.style.transition = "");
402
- }, []);
403
- return xr(
404
- /* @__PURE__ */ u.jsx(
405
- Ae,
406
- {
407
- in: e,
408
- timeout: n,
409
- classNames: "rac-options",
410
- unmountOnExit: c,
411
- nodeRef: E,
412
- onEnter: M,
413
- onEntering: Z,
414
- onEntered: ee,
415
- onExit: se,
416
- onExiting: ie,
417
- onExited: q,
418
- children: /* @__PURE__ */ u.jsx(
419
- "div",
420
- {
421
- ref: E,
422
- className: `rac-options ${R || ""}`,
423
- style: {
424
- ...A,
425
- "--rac-duration": `${n}ms`,
426
- "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
427
- "--rac-duration-base": "var(--rac-duration)",
428
- "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)"
429
- },
430
- onMouseDown: (d) => {
431
- d.preventDefault();
432
- },
433
- children: s
434
- }
435
- )
436
- }
437
- ),
438
- document.body
439
- );
440
- }
441
- const vr = Ie(wr, (e, s) => e.visibility === s.visibility && e.duration === s.duration && e.easing === s.easing && e.offset === s.offset && e.animateOpacity === s.animateOpacity && e.selectRef === s.selectRef && e.children === s.children && JSON.stringify(e.style) === JSON.stringify(s.style));
442
- function ke({
443
- visibility: e,
444
- children: s,
445
- duration: o = 300,
446
- unmount: i,
447
- style: c
448
- }) {
449
- const n = ue(null);
450
- return /* @__PURE__ */ u.jsx(
451
- Ae,
307
+ return c ? c || `${t}-${Math.random().toString(36).slice(2, 8)}` : s ? `${t}-${s}` : `${t}-${Math.random().toString(36).slice(2, 8)}`;
308
+ }, er = fr(null), Fe = hr(({ className: e = "", visibility: t, setLeaving: o, setSpacer: s, children: c, duration: g = 300, unmount: y, style: d, exit: i = !0 }, E) => {
309
+ const b = ne(null);
310
+ return gr(E, () => b.current), ue(() => {
311
+ !t && b.current && (b.current.style.width = "0px");
312
+ }, []), /* @__PURE__ */ u.jsx(
313
+ Xe,
452
314
  {
453
- in: e,
454
- timeout: o,
315
+ onEnter: () => {
316
+ b.current.style.transition = "none", b.current.style.width = "0px";
317
+ },
318
+ onEntering: () => {
319
+ requestAnimationFrame(() => {
320
+ requestAnimationFrame(() => {
321
+ b.current && (b.current.style.transition = `width ${g}ms, color ${g}ms, background-color ${g}ms`, b.current.style.width = b.current.scrollWidth + "px");
322
+ });
323
+ });
324
+ },
325
+ onEntered: () => {
326
+ b.current.style.width = "auto", s?.(!1);
327
+ },
328
+ onExit: () => {
329
+ b.current.style.width = b.current.scrollWidth + "px", b.current.offsetHeight, o?.(!0);
330
+ },
331
+ onExiting: () => b.current.style.width = "0px",
332
+ onExited: () => {
333
+ y?.(), o?.(!1), s?.(!1);
334
+ },
455
335
  classNames: "rac-slide-left",
456
- unmountOnExit: !0,
457
- nodeRef: n,
458
- onEnter: () => n.current.style.width = "0px",
459
- onEntering: () => n.current.style.width = n.current.scrollWidth + "px",
460
- onEntered: () => n.current.style.width = "auto",
461
- onExit: () => n.current.style.width = n.current.scrollWidth + "px",
462
- onExiting: () => n.current.style.width = "0px",
463
- onExited: () => i?.(),
336
+ unmountOnExit: i,
337
+ timeout: g,
338
+ nodeRef: b,
339
+ in: t,
464
340
  children: /* @__PURE__ */ u.jsx(
465
341
  "div",
466
342
  {
467
- ref: n,
343
+ className: e,
344
+ ref: b,
468
345
  style: {
469
- ...c,
346
+ transition: `width ${g}ms, color ${g}ms, background-color ${g}ms`,
347
+ willChange: "width",
470
348
  overflow: "hidden",
471
- transition: `width ${o}ms ease`
349
+ ...d
472
350
  },
473
- children: s
351
+ children: c
474
352
  }
475
353
  )
476
354
  }
477
355
  );
478
- }
479
- const Xe = ({ children: e, duration: s, widthMode: o = !1, ...i }) => {
480
- const c = ue(null);
356
+ }), Tr = qe(({ element: e, index: t, leaving: o, setLeaving: s, setSpacer: c, selectRef: g, spacer: y, delSpacer: d, setVisibility: i, setActiveHoverId: E, activeHoverId: b, swipedId: k, setSwipedId: N, deleteInline: R, remove: F, renderIcon: L, DelIcon: P, normalizedOptions: M, swiped: W, onSwipe: C, deleting: z, setDeleting: ie, onRender: X, duration: Y }) => {
357
+ const T = ne(null), a = ne(!1), ee = ne(!1), re = ne(0), V = ne(null), K = _((x) => {
358
+ re.current = x.touches[0].clientX, a.current = !1, T.current && clearTimeout(T.current), T.current = setTimeout(() => {
359
+ ie(!0), a.current = !0, g.current?.focus(), i(!1), window.navigator.vibrate && window.navigator.vibrate(50);
360
+ }, 600), x.preventDefault();
361
+ }, []), de = _((x) => {
362
+ T.current && clearTimeout(T.current);
363
+ const r = x.touches[0].clientX, l = re.current - r;
364
+ Math.abs(l) > 10 && (ee.current = !0, l > 30 && !W ? C(e.id) : l < -30 && W && C(null));
365
+ }, [e.id, W, C]), ae = _((x) => {
366
+ T.current && clearTimeout(T.current), a.current && x.preventDefault();
367
+ }, []);
368
+ let A = null;
369
+ if (e?.jsx)
370
+ A = e.jsx;
371
+ else if (e?.name)
372
+ A = e.name;
373
+ else if (e?.raw !== void 0) {
374
+ const x = M.find(
375
+ (r) => r.raw === e.raw || r.original === e.raw || r.userId === e.raw
376
+ );
377
+ x && (A = x.jsx ?? x.name);
378
+ }
379
+ A == null && (A = typeof e == "object" ? e.label ?? e.name ?? e.value ?? "Selected item" : String(e));
380
+ const B = _((x) => {
381
+ x.stopPropagation(), x.preventDefault();
382
+ }, []), se = _((x) => {
383
+ B(x), F(e.id), C(null);
384
+ }, [e.id, F, C]), v = _((x) => {
385
+ if (B(x), a.current) {
386
+ a.current = !1;
387
+ return;
388
+ }
389
+ if (z) {
390
+ se(x);
391
+ return;
392
+ }
393
+ }, [z, se]);
394
+ return Ve(() => {
395
+ if (V.current && X) {
396
+ const x = V.current.offsetWidth;
397
+ X(x);
398
+ }
399
+ }, [X, A]), /* @__PURE__ */ u.jsxs(pr, { children: [
400
+ /* @__PURE__ */ u.jsxs(
401
+ "div",
402
+ {
403
+ className: `rac-multiple-selected-option ${z ? "--deleting-shake" : ""}`,
404
+ onMouseEnter: () => E(e.id),
405
+ onMouseLeave: () => E(null),
406
+ onTouchStart: K,
407
+ onTouchMove: de,
408
+ onTouchEnd: ae,
409
+ onClick: v,
410
+ ref: V,
411
+ children: [
412
+ A,
413
+ /* @__PURE__ */ u.jsx(
414
+ Fe,
415
+ {
416
+ style: {
417
+ backgroundColor: z || R ? "transparent" : "--rac-multiple-del-bg",
418
+ position: z || R ? "relative" : "absolute"
419
+ },
420
+ visibility: b === e.id || k === e.id || z,
421
+ className: "rac-multiple-del",
422
+ setLeaving: s,
423
+ setSpacer: c,
424
+ duration: Y,
425
+ children: L(P, { onClick: se, onMouseDown: B })
426
+ }
427
+ )
428
+ ]
429
+ }
430
+ ),
431
+ /* @__PURE__ */ u.jsx(
432
+ Fe,
433
+ {
434
+ visibility: !o && !y?.state && !b && !k && !z && R && d,
435
+ className: "rac-multiple-option",
436
+ style: { visibility: "hidden" },
437
+ children: /* @__PURE__ */ u.jsx(
438
+ "div",
439
+ {
440
+ style: { padding: 0, marginRight: 0, marginLeft: 0 },
441
+ className: "rac-multiple-selected-option",
442
+ children: L(P)
443
+ }
444
+ )
445
+ }
446
+ )
447
+ ] });
448
+ }), mr = ({ children: e, setLeaving: t, duration: o, setSpacer: s, id: c = null, widthMode: g = !1, ...y }) => {
449
+ const d = ne(null);
481
450
  return /* @__PURE__ */ u.jsx(
482
- Ae,
451
+ Xe,
483
452
  {
484
- nodeRef: c,
485
- timeout: s,
486
453
  classNames: "rac-slide-left",
487
- ...i,
454
+ timeout: o,
455
+ nodeRef: d,
456
+ unmountOnExit: !0,
457
+ ...y,
488
458
  onEnter: () => {
489
- const n = c.current;
490
- o ? n.style.width = "0px" : (n.style.height = "0px", n.style.transform = "translateY(-10px)"), n.style.opacity = "0";
459
+ const i = d.current;
460
+ i && (g ? i.style.width = "0px" : (i.style.height = "0px", i.style.transform = "translateY(-10px)"), i.style.opacity = "0");
491
461
  },
492
462
  onEntering: () => {
493
- const n = c.current;
494
- n.offsetHeight, o ? n.style.width = n.scrollWidth + "px" : (n.style.height = n.scrollHeight + "px", n.style.transform = "translateY(0)"), n.style.opacity = "1";
463
+ const i = d.current;
464
+ i.offsetHeight, g ? i.style.width = i.scrollWidth + "px" : (i.style.height = i.scrollHeight + "px", i.style.transform = "translateY(0)"), i.style.opacity = "1";
495
465
  },
496
466
  onEntered: () => {
497
- const n = c.current;
498
- n.style.width = o ? "auto" : "", n.style.height = o ? "" : "auto", n.style.opacity = "1", n.style.transform = "";
467
+ const i = d.current;
468
+ i.style.width = g ? "auto" : "", i.style.height = g ? "" : "100%", i.style.opacity = "1", i.style.transform = "", s?.(!1);
499
469
  },
500
470
  onExit: () => {
501
- const n = c.current;
502
- o ? n.style.width = n.offsetWidth + "px" : (n.style.height = n.offsetHeight + "px", n.style.position = "absolute"), n.style.opacity = "1";
471
+ const i = d.current;
472
+ g ? i.style.width = i.offsetWidth + "px" : (i.style.height = i.offsetHeight + "px", i.style.position = "absolute"), i.style.opacity = "1", t?.(!0);
503
473
  },
504
474
  onExiting: () => {
505
- const n = c.current;
506
- o ? n.style.width = "0px" : (n.style.height = "0px", n.style.transform = "translateY(10px)"), n.style.opacity = "0";
475
+ const i = d.current;
476
+ g ? i.style.width = "0px" : (i.style.height = "0px", i.style.transform = "translateY(10px)"), i.style.opacity = "0";
477
+ },
478
+ onExited: () => {
479
+ s?.(!1), t?.(!1);
507
480
  },
508
481
  children: /* @__PURE__ */ u.jsx(
509
482
  "div",
510
483
  {
511
- ref: c,
484
+ ref: d,
485
+ id: c,
512
486
  style: {
513
- display: "flex",
487
+ transition: `all ${o}ms ease`,
514
488
  alignItems: "center",
515
- height: "100%",
516
- overflow: "hidden",
517
489
  whiteSpace: "nowrap",
518
- transition: `all ${s}ms ease`,
519
- top: 0,
520
- left: 0
490
+ overflow: "hidden",
491
+ display: "flex",
492
+ left: 0,
493
+ top: 0
521
494
  },
522
495
  children: e
523
496
  }
524
497
  )
525
498
  }
526
499
  );
527
- }, jr = Ie(({ element: e, index: s, remove: o, renderIcon: i, DelIcon: c, normalizedOptions: n }) => {
528
- let w = null;
529
- if (e?.jsx)
530
- w = e.jsx;
531
- else if (e?.name)
532
- w = e.name;
533
- else if (e?.raw !== void 0) {
534
- const $ = n.find(
535
- (R) => R.raw === e.raw || R.original === e.raw || R.userId === e.raw
536
- );
537
- $ && (w = $.jsx ?? $.name);
538
- }
539
- w == null && (w = typeof e == "object" ? e.label ?? e.name ?? e.value ?? "Selected item" : String(e));
540
- const S = O(($) => {
541
- $.stopPropagation(), $.preventDefault(), o(e.id);
542
- }, [e.id, o]), p = O(($) => {
543
- $.stopPropagation(), $.preventDefault();
544
- }, []);
545
- return /* @__PURE__ */ u.jsxs("div", { className: "rac-multiple-selected-option", children: [
546
- w,
547
- i(c, { onClick: S, onMouseDown: p })
548
- ] });
549
- }), Sr = Ie(({
550
- selectRef: e,
551
- selectId: s,
552
- removeOption: o,
553
- renderOptions: i,
554
- selected: c,
555
- selectedIDs: n,
556
- setSelectedIds: w,
557
- normalizedOptions: S,
558
- title: p,
559
- visibility: $,
560
- active: R,
561
- hasOptions: E,
562
- hasActualValue: K,
563
- optionsClassName: U,
564
- selectedText: k,
565
- disabled: H,
566
- loading: D,
567
- error: C,
568
- registerOption: z,
569
- unregisterOption: A,
570
- handleBlur: M,
571
- handleFocus: Z,
572
- handleToggle: ee,
573
- handleKeyDown: se,
574
- handleListScroll: ie,
575
- setAnimationFinished: q,
576
- clear: d,
577
- children: F,
578
- placeholder: g,
579
- className: x,
580
- style: y,
581
- duration: v,
582
- easing: G,
583
- offset: W,
584
- animateOpacity: re,
585
- unmount: de,
586
- ArrowIcon: ae,
587
- ClearIcon: r,
588
- DelIcon: h,
589
- renderIcon: j,
590
- hasMore: P,
591
- loadButton: te
592
- }) => {
593
- const ne = ue(null), [t, f] = fe(null), a = ue(null);
594
- Qe(() => {
595
- const N = a.current;
596
- if (!N) return;
597
- const Q = new ResizeObserver((J) => {
598
- window.requestAnimationFrame(() => {
599
- if (!Array.isArray(J) || !J.length) return;
600
- const pe = J[0].contentRect.height;
601
- f(pe);
602
- });
603
- });
604
- return Q.observe(N), () => {
605
- Q.disconnect();
606
- };
607
- }, []), oe(() => {
608
- e && (typeof e == "function" ? e(ne.current) : e.current = ne.current);
609
- }, [e]);
610
- const b = O((N) => {
611
- o ? o(N) : w((Q) => Q.filter((J) => J.id !== N));
612
- }, [o, w]), _ = n?.map((N, Q) => /* @__PURE__ */ u.jsx(
613
- Xe,
500
+ }, Ar = qe(({ element: e, index: t, leaving: o, setLeaving: s, selectRef: c, setVisibility: g, setActiveHoverId: y, delSpacer: d, swiped: i, swipedId: E, setSwipedId: b, onSwipe: k, activeHoverId: N, deleteInline: R, spacer: F, duration: L, normalizedOptions: P, setDeleting: M, renderIcon: W, deleting: C, DelIcon: z, remove: ie, registerItemWidth: X, setSpacer: Y, ...T }) => /* @__PURE__ */ u.jsxs(pr, { children: [
501
+ /* @__PURE__ */ u.jsx(
502
+ mr,
614
503
  {
615
- duration: v,
504
+ className: "rac-multiple-option",
505
+ onEnter: T.onEnter,
506
+ setLeaving: s,
507
+ setSpacer: Y,
508
+ onExit: T.onExit,
509
+ duration: L,
510
+ in: T.in,
511
+ id: e.id,
616
512
  widthMode: !0,
617
513
  children: /* @__PURE__ */ u.jsx(
618
- jr,
514
+ Tr,
619
515
  {
620
- element: N,
621
- index: Q,
622
- remove: b,
623
- renderIcon: j,
624
- DelIcon: h,
625
- normalizedOptions: S
516
+ onRender: (a) => X(e.id, a),
517
+ normalizedOptions: P,
518
+ setActiveHoverId: y,
519
+ activeHoverId: N,
520
+ setVisibility: g,
521
+ deleteInline: R,
522
+ setDeleting: M,
523
+ setSwipedId: b,
524
+ setLeaving: s,
525
+ renderIcon: W,
526
+ setSpacer: Y,
527
+ selectRef: c,
528
+ delSpacer: d,
529
+ duration: L,
530
+ deleting: C,
531
+ swipedId: E,
532
+ onSwipe: k,
533
+ element: e,
534
+ DelIcon: z,
535
+ leaving: o,
536
+ swiped: i,
537
+ remove: ie,
538
+ spacer: F,
539
+ index: t
626
540
  },
627
- N.id ?? Q
541
+ e.id ?? t
628
542
  )
629
- },
630
- N.id ?? Q
631
- ));
632
- return /* @__PURE__ */ u.jsxs(
633
- er.Provider,
543
+ }
544
+ ),
545
+ F.state && F.id === e.id && /* @__PURE__ */ u.jsx(
546
+ "div",
634
547
  {
635
- value: { registerOption: z, unregisterOption: A },
636
- children: [
637
- F,
638
- /* @__PURE__ */ u.jsxs(
548
+ style: { width: F.width - 2 },
549
+ className: "rac-spacer"
550
+ }
551
+ )
552
+ ] }));
553
+ function Or({ visibility: e, children: t, selectRef: o, onAnimationDone: s, unmount: c = !0, duration: g, easing: y, offset: d, animateOpacity: i, style: E, className: b, setBottomDirection: k = () => {
554
+ } }) {
555
+ const N = ne(null), [R, F] = le({ top: 0, left: 0, width: 0 }), L = ne(R);
556
+ ue(() => {
557
+ L.current = R;
558
+ }, [R]);
559
+ const P = _(() => {
560
+ if (o?.current) {
561
+ const a = o.current.getBoundingClientRect(), ee = window.innerHeight, re = N.current?.scrollHeight || 250, V = ee - a.bottom, K = V < re && a.top > V;
562
+ k(K), F({
563
+ top: a.top,
564
+ bottom: a.bottom,
565
+ left: a.left,
566
+ width: a.width,
567
+ isUpward: K
568
+ });
569
+ }
570
+ }, [o]);
571
+ ue(() => {
572
+ if (e)
573
+ return P(), window.addEventListener("scroll", P, !0), window.addEventListener("resize", P), () => {
574
+ window.removeEventListener("scroll", P, !0), window.removeEventListener("resize", P);
575
+ };
576
+ }, [e, P]);
577
+ const M = `height var(--rac-duration) ${y}${i ? `, opacity var(--rac-duration) ${y}` : ""}`;
578
+ Ve(() => {
579
+ if (!o?.current) return;
580
+ const a = new ResizeObserver((ee) => {
581
+ for (let re of ee)
582
+ if (e && N.current && o.current) {
583
+ const V = o.current.getBoundingClientRect(), { isUpward: K } = L.current;
584
+ N.current.style.width = `${V.width}px`, N.current.style.left = `${V.left}px`, K ? N.current.style.bottom = `${window.innerHeight - V.top + d}px` : N.current.style.top = `${V.bottom + d}px`;
585
+ }
586
+ });
587
+ return a.observe(o.current), () => a.disconnect();
588
+ }, [o, e, d]);
589
+ const W = {
590
+ position: "fixed",
591
+ "--rac-duration": `${g}ms`,
592
+ "--rac-easing": y,
593
+ left: `${R.left}px`,
594
+ width: `${R.width}px`,
595
+ overflow: "hidden",
596
+ zIndex: "2147483647",
597
+ height: e ? "auto" : "0px",
598
+ opacity: i ? e ? 1 : 0 : 1,
599
+ pointerEvents: e ? "all" : "none",
600
+ // visibility: visibility ? 'visible' : 'hidden',
601
+ boxSizing: "border-box",
602
+ transformOrigin: R.isUpward ? "bottom" : "top",
603
+ ...R.isUpward ? {
604
+ bottom: `${window.innerHeight - R.top + d}px`,
605
+ top: "auto"
606
+ } : {
607
+ top: `${R.bottom + d}px`,
608
+ bottom: "auto"
609
+ },
610
+ ...Object.fromEntries(
611
+ Object.entries(E || {}).map(([a, ee]) => [
612
+ a.startsWith("--") ? a : `--rac-${a.replace(/([A-Z])/g, "-$1").toLowerCase()}`,
613
+ ee
614
+ ])
615
+ )
616
+ }, C = _(() => {
617
+ const a = N.current;
618
+ a && (a.style.height = "0px", i && (a.style.opacity = "0"), a.style.transition = "");
619
+ }, [i]), z = _(() => {
620
+ const a = N.current;
621
+ a && (a.style.transition = M, a.style.height = `${a.scrollHeight}px`, i && (a.style.opacity = "1"));
622
+ }, [M, i]), ie = _(() => {
623
+ const a = N.current;
624
+ a && (a.style.height = "auto", a.style.transition = "", s && s());
625
+ }, [s]), X = _(() => {
626
+ const a = N.current;
627
+ a && (a.style.height = `${a.scrollHeight}px`, i && (a.style.opacity = "1"), a.offsetHeight, a.style.transition = M);
628
+ }, [M, i]), Y = _(() => {
629
+ const a = N.current;
630
+ a && (a.style.height = "0px", i && (a.style.opacity = "0"));
631
+ }, [i]), T = _(() => {
632
+ const a = N.current;
633
+ a && (a.style.transition = "");
634
+ }, []);
635
+ return $r(
636
+ /* @__PURE__ */ u.jsx(
637
+ Xe,
638
+ {
639
+ in: e,
640
+ timeout: g,
641
+ classNames: "rac-options",
642
+ unmountOnExit: c,
643
+ nodeRef: N,
644
+ onEnter: C,
645
+ onEntering: z,
646
+ onEntered: ie,
647
+ onExit: X,
648
+ onExiting: Y,
649
+ onExited: T,
650
+ children: /* @__PURE__ */ u.jsx(
639
651
  "div",
640
652
  {
641
- ref: ne,
653
+ ref: N,
654
+ className: `rac-options ${b || ""}`,
642
655
  style: {
643
- ...y,
644
- "--rac-duration": `${v}ms`,
656
+ ...W,
657
+ "--rac-duration": `${g}ms`,
645
658
  "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
646
659
  "--rac-duration-base": "var(--rac-duration)",
647
660
  "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)"
648
661
  },
649
- className: `rac-select
650
- ${x}
651
- ${!E || H ? "rac-disabled-style" : ""}
652
- ${D ? "rac-loading-style" : ""}
653
- ${C ? "rac-error-style" : ""}`,
654
- tabIndex: R ? 0 : -1,
655
- role: "combobox",
656
- "aria-haspopup": "listbox",
657
- "aria-expanded": $,
658
- "aria-controls": `${s}-listbox`,
659
- "aria-label": g,
660
- "aria-disabled": H || !E,
661
- ...R && {
662
- onBlur: M,
663
- onFocus: Z,
664
- onClick: ee,
665
- onKeyDown: se
666
- },
667
- children: [
668
- /* @__PURE__ */ u.jsx(
662
+ onMouseDown: (a) => a.preventDefault(),
663
+ children: t
664
+ }
665
+ )
666
+ }
667
+ ),
668
+ document.body
669
+ );
670
+ }
671
+ const Pr = qe(Or, (e, t) => e.visibility === t.visibility && e.duration === t.duration && e.easing === t.easing && e.offset === t.offset && e.animateOpacity === t.animateOpacity && e.selectRef === t.selectRef && e.children === t.children && JSON.stringify(e.style) === JSON.stringify(t.style)), cr = (e) => {
672
+ const t = window.getComputedStyle(e);
673
+ return parseFloat(t.marginLeft) + parseFloat(t.marginRight);
674
+ }, lr = (e) => e.reduce((t, o) => {
675
+ const s = o.offsetTop, c = o.getBoundingClientRect().width;
676
+ return t[s] = (t[s] || 0) + c, t;
677
+ }, {}), Cr = qe(({ deleteInline: e, selectRef: t, setVisibility: o, selectId: s, removeOption: c, renderOptions: g, selected: y, selectedIDs: d, setSelectedIds: i, normalizedOptions: E, title: b, visibility: k, active: N, hasOptions: R, hasActualValue: F, optionsClassName: L, selectedText: P, disabled: M, loading: W, error: C, registerOption: z, unregisterOption: ie, handleBlur: X, handleFocus: Y, toggleVisibility: T, handleKeyDown: a, handleListScroll: ee, setAnimationFinished: re, clear: V, children: K, placeholder: de, className: ae, style: A, duration: B, easing: se, offset: v, animateOpacity: x, unmount: r, ArrowIcon: l, ClearIcon: m, DelIcon: w, renderIcon: ge, hasMore: ve, loadButton: n, deleting: p, setDeleting: j }) => {
678
+ const [f, I] = le(!1), [D, fe] = le(null), [q, U] = le(!1), [ce, h] = le({}), [G, Q] = le(null), [pe, $] = le(null), [xe, me] = le(!1), we = ne(!0), Te = ne(null), oe = _((H) => {
679
+ c ? c(H) : i((J) => J.filter((te) => te.id !== H));
680
+ }, [c, i]), Pe = _((H) => {
681
+ if (p) {
682
+ H.stopPropagation(), H.preventDefault(), j(!1);
683
+ return;
684
+ }
685
+ T(H);
686
+ }, [p, T]), Ce = _((H, J) => {
687
+ h((te) => te[H] === J ? te : { ...te, [H]: J });
688
+ }, []);
689
+ Ve(() => {
690
+ const H = Te.current;
691
+ if (!H) return;
692
+ const J = new ResizeObserver((te) => {
693
+ window.requestAnimationFrame(() => {
694
+ if (!Array.isArray(te) || !te.length) return;
695
+ const Le = te[0].contentRect.height;
696
+ fe(Le);
697
+ });
698
+ });
699
+ return J.observe(H), () => J.disconnect();
700
+ }, []), ue(() => {
701
+ we.current = !1, t && (typeof t == "function" ? t(t.current) : t.current = t.current);
702
+ }, [t]), ue(() => {
703
+ p && k && T() && T?.()(p && d?.length === 0) && j(!1), $(null);
704
+ }, [d?.length, p]), Ve(() => {
705
+ const H = Te.current;
706
+ if (!H || !d?.length || p) {
707
+ d?.length || U({ state: !1, id: null, width: 0 });
708
+ return;
709
+ }
710
+ const J = Array.from(H.children).filter((ye) => ye.classList.contains("rac-multiple-option")), te = H.clientWidth;
711
+ if (J.length > d.length) {
712
+ const ye = new Set(d.map((O) => O.id)), je = J.findIndex((O) => !ye.has(O.id));
713
+ if (je === -1) return;
714
+ const Se = J[je], be = J[je - 1];
715
+ if (!(be && Se.offsetTop !== be.offsetTop)) {
716
+ U({ state: !1, id: null, width: 0 });
717
+ return;
718
+ }
719
+ const He = lr(J), Ee = Object.keys(He).map(Number).sort((O, Z) => O - Z), ke = Ee.indexOf(Se.offsetTop);
720
+ if (ke <= 0) {
721
+ U({ state: !1, id: null, width: 0 });
722
+ return;
723
+ }
724
+ const Re = Ee[ke - 1], Ae = He[Re], Me = te - Ae;
725
+ Le(be?.id || null, !0, Me);
726
+ } else if (J.length === d.length) {
727
+ const ye = J[J.length - 1], je = d[d.length - 1]?.id, Se = ce[je];
728
+ if (!Se) return;
729
+ const be = ye?.firstElementChild || ye, Ge = cr(be), He = cr(ye), Ee = J.slice(0, -1), ke = lr(Ee), Re = Object.keys(ke).map(Number).sort((Z, he) => Z - he);
730
+ let Ae = te;
731
+ if (Re.length > 0) {
732
+ const Z = Math.max(...Re);
733
+ Ae = te - (ke[Z] || 0);
734
+ }
735
+ const Me = Se + Ge + He > Ae, O = d[d.length - 2]?.id;
736
+ Le(O, Me, Ae);
737
+ }
738
+ function Le(ye, je, Se) {
739
+ U((be) => be.id === ye && be.state === je && be.width === Se ? be : { state: je, id: ye, width: Se });
740
+ }
741
+ }, [d, ce, p]);
742
+ const Ie = d?.map((H, J) => {
743
+ const te = J === d.length - 1;
744
+ return /* @__PURE__ */ u.jsx(
745
+ Ar,
746
+ {
747
+ normalizedOptions: E,
748
+ registerItemWidth: Ce,
749
+ setActiveHoverId: $,
750
+ swiped: G === H.id,
751
+ activeHoverId: pe,
752
+ setVisibility: o,
753
+ deleteInline: e,
754
+ setDeleting: j,
755
+ setSwipedId: Q,
756
+ setLeaving: me,
757
+ renderIcon: ge,
758
+ selectRef: t,
759
+ setSpacer: U,
760
+ onSwipe: Q,
761
+ delSpacer: te,
762
+ duration: B,
763
+ deleting: p,
764
+ swipedId: G,
765
+ leaving: xe,
766
+ element: H,
767
+ DelIcon: w,
768
+ spacer: q,
769
+ remove: oe,
770
+ index: J
771
+ },
772
+ H.id ?? J
773
+ );
774
+ });
775
+ return /* @__PURE__ */ u.jsxs(er.Provider, { value: { registerOption: z, unregisterOption: ie }, children: [
776
+ K,
777
+ /* @__PURE__ */ u.jsxs(
778
+ "div",
779
+ {
780
+ ref: t,
781
+ style: {
782
+ "--rac-duration-fast": "calc(var(--rac-duration) * 0.5)",
783
+ "--rac-duration-slow": "calc(var(--rac-duration) * 1.3)",
784
+ "--rac-duration-base": "var(--rac-duration)",
785
+ "--rac-duration": `${B}ms`,
786
+ ...A
787
+ },
788
+ className: `
789
+ ${!R || M ? "rac-disabled-style" : ""}
790
+ ${W ? "rac-loading-style" : ""}
791
+ ${C ? "rac-error-style" : ""}
792
+ ${ae}
793
+ rac-select
794
+ `,
795
+ ...N && {
796
+ onKeyDown: a,
797
+ onFocus: Y,
798
+ onClick: Pe,
799
+ onBlur: X
800
+ },
801
+ "aria-disabled": M || !R,
802
+ "aria-controls": `${s}-listbox`,
803
+ tabIndex: N ? 0 : -1,
804
+ "aria-expanded": k,
805
+ "aria-label": de,
806
+ "aria-haspopup": "listbox",
807
+ role: "combobox",
808
+ children: [
809
+ /* @__PURE__ */ u.jsx(
810
+ "div",
811
+ {
812
+ className: `rac-select-title-wrapper
813
+ ${!C && !W && y?.type === "boolean" ? y.raw ? "rac-true-option" : "rac-false-option" : ""}
814
+ `,
815
+ style: {
816
+ alignItems: d?.length && !P ? "flex-start" : "center",
817
+ height: D ? `${D}px` : "auto"
818
+ },
819
+ children: /* @__PURE__ */ u.jsx(
669
820
  "div",
670
821
  {
671
- className: `rac-select-title-wrapper
672
- ${!C && !D && c?.type === "boolean" ? c.raw ? "rac-true-option" : "rac-false-option" : ""}
673
- `,
674
822
  style: {
675
- height: t ? `${t}px` : "auto",
676
- boxSizing: "content-box",
677
- overflow: "hidden"
823
+ alignItems: d?.length && !P ? "flex-start" : "center",
824
+ height: W ? "100%" : "auto"
678
825
  },
826
+ className: "rac-select-title",
827
+ ref: Te,
679
828
  children: /* @__PURE__ */ u.jsx(
680
- "div",
829
+ Sr,
681
830
  {
682
- className: "rac-select-title",
683
- ref: a,
684
- children: /* @__PURE__ */ u.jsx(pr, { component: null, children: n?.length && !k ? _ : /* @__PURE__ */ u.jsxs(
685
- Xe,
831
+ enter: !we.current,
832
+ component: null,
833
+ appear: !1,
834
+ children: d?.length && !P && !W ? Ie : /* @__PURE__ */ u.jsxs(
835
+ mr,
686
836
  {
687
- duration: v,
837
+ className: "rac-title-container",
838
+ duration: B,
688
839
  widthMode: !0,
689
840
  children: [
690
- /* @__PURE__ */ u.jsx("span", { className: "rac-title-text", children: p }),
691
- /* @__PURE__ */ u.jsx(ke, { visibility: D && !C, duration: v, children: /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
692
- /* @__PURE__ */ u.jsx("i", {}),
693
- /* @__PURE__ */ u.jsx("i", {}),
694
- /* @__PURE__ */ u.jsx("i", {})
695
- ] }) })
841
+ /* @__PURE__ */ u.jsx("span", { className: "rac-title-text", children: b }),
842
+ /* @__PURE__ */ u.jsx(
843
+ Fe,
844
+ {
845
+ className: "rac-loading-container",
846
+ visibility: W && !C,
847
+ duration: B,
848
+ children: /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
849
+ /* @__PURE__ */ u.jsx("i", {}),
850
+ /* @__PURE__ */ u.jsx("i", {}),
851
+ /* @__PURE__ */ u.jsx("i", {})
852
+ ] })
853
+ }
854
+ )
696
855
  ]
697
856
  },
698
- p
699
- ) })
857
+ b
858
+ )
700
859
  }
701
860
  )
702
861
  }
703
- ),
704
- /* @__PURE__ */ u.jsxs("div", { className: "rac-select-buttons", children: [
705
- /* @__PURE__ */ u.jsx(
706
- ke,
707
- {
708
- visibility: K && E && !H && !D && !C,
709
- duration: v,
710
- style: { display: "grid" },
711
- children: j(r, {
712
- className: "rac-select-cancel",
713
- onMouseDown: (N) => {
714
- N.preventDefault(), N.stopPropagation();
715
- },
716
- onClick: d
717
- })
718
- }
719
- ),
720
- /* @__PURE__ */ u.jsx(
721
- ke,
722
- {
723
- visibility: R,
724
- duration: v,
725
- style: { display: "grid" },
726
- children: /* @__PURE__ */ u.jsx(
727
- "span",
862
+ )
863
+ }
864
+ ),
865
+ /* @__PURE__ */ u.jsxs("div", { className: "rac-select-buttons", children: [
866
+ /* @__PURE__ */ u.jsx(
867
+ Fe,
868
+ {
869
+ visibility: F && R && !M && !W && !C && !p,
870
+ style: { display: "grid" },
871
+ duration: B,
872
+ children: ge(m, {
873
+ className: "rac-select-cancel",
874
+ onMouseDown: (H) => {
875
+ H.preventDefault(), H.stopPropagation();
876
+ },
877
+ onClick: V
878
+ })
879
+ }
880
+ ),
881
+ /* @__PURE__ */ u.jsx(
882
+ Fe,
883
+ {
884
+ visibility: N && !p,
885
+ style: { display: "grid" },
886
+ duration: B,
887
+ children: /* @__PURE__ */ u.jsx("span", { className: `rac-select-arrow-wrapper ${k ? "--open" : ""}`, children: ge(l, { className: "rac-select-arrow-wrapper" }) })
888
+ }
889
+ )
890
+ ] }),
891
+ /* @__PURE__ */ u.jsx(
892
+ Pr,
893
+ {
894
+ style: { "--rac-duration": `${B}ms`, ...A },
895
+ onAnimationDone: () => re(!0),
896
+ setBottomDirection: I,
897
+ animateOpacity: x,
898
+ className: L,
899
+ visibility: k,
900
+ selectRef: t,
901
+ duration: B,
902
+ unmount: r,
903
+ easing: se,
904
+ offset: v,
905
+ children: /* @__PURE__ */ u.jsxs(
906
+ "div",
907
+ {
908
+ onScroll: ee,
909
+ className: "rac-select-list",
910
+ "aria-label": "Options",
911
+ role: "listbox",
912
+ tabIndex: "-1",
913
+ children: [
914
+ g,
915
+ !n && ve && /* @__PURE__ */ u.jsxs(
916
+ "div",
728
917
  {
729
- className: `rac-select-arrow-wrapper ${$ ? "--open" : ""}`,
730
- children: j(ae, {
731
- className: "rac-select-arrow-wrapper"
732
- })
918
+ className: "rac-select-option rac-disabled-option rac-loading-option",
919
+ onClick: (H) => H.stopPropagation(),
920
+ children: [
921
+ /* @__PURE__ */ u.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
922
+ /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
923
+ /* @__PURE__ */ u.jsx("i", {}),
924
+ /* @__PURE__ */ u.jsx("i", {}),
925
+ /* @__PURE__ */ u.jsx("i", {})
926
+ ] })
927
+ ]
733
928
  }
734
929
  )
735
- }
736
- )
737
- ] }),
738
- /* @__PURE__ */ u.jsx(
739
- vr,
740
- {
741
- className: U,
742
- visibility: $,
743
- selectRef: e,
744
- onAnimationDone: () => q(!0),
745
- unmount: de,
746
- duration: v,
747
- easing: G,
748
- offset: W,
749
- animateOpacity: re,
750
- style: {
751
- ...y,
752
- "--rac-duration": `${v}ms`
753
- },
754
- children: /* @__PURE__ */ u.jsxs(
755
- "div",
756
- {
757
- onScroll: ie,
758
- tabIndex: "-1",
759
- className: "rac-select-list",
760
- role: "listbox",
761
- "aria-label": "Options",
762
- children: [
763
- i,
764
- !te && P && /* @__PURE__ */ u.jsxs(
765
- "div",
766
- {
767
- className: "rac-select-option rac-disabled-option rac-loading-option",
768
- onClick: (N) => N.stopPropagation(),
769
- children: [
770
- /* @__PURE__ */ u.jsx("span", { className: "rac-loading-option-title", children: "Loading" }),
771
- /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
772
- /* @__PURE__ */ u.jsx("i", {}),
773
- /* @__PURE__ */ u.jsx("i", {}),
774
- /* @__PURE__ */ u.jsx("i", {})
775
- ] })
776
- ]
777
- }
778
- )
779
- ]
780
- }
781
- )
930
+ ]
782
931
  }
783
932
  )
784
- ]
785
- }
786
- )
787
- ]
788
- }
789
- );
790
- });
791
- function $r({
792
- disabled: e,
793
- open: s,
794
- setOpen: o,
795
- options: i = [],
796
- selectOption: c,
797
- selected: n,
798
- selectedIDs: w,
799
- multiple: S,
800
- hasMore: p,
801
- loadMore: $,
802
- loadButton: R,
803
- loadButtonText: E,
804
- setLoadingTitle: K,
805
- loadOffset: U,
806
- loadAhead: k,
807
- expandedGroups: H
808
- }) {
809
- const D = ue(!1), C = ue(0), z = ue(!1), [A, M] = fe(-1);
810
- oe(() => {
811
- z.current = !1, R && K(E);
812
- }, [i.length, p, R, E, K]);
813
- const Z = O(() => {
814
- !p || z.current || (z.current = !0, $());
815
- }, [p, $]), ee = O((g) => {
816
- if (R || !p || z.current) return;
817
- const { scrollTop: x, scrollHeight: y, clientHeight: v } = g.currentTarget;
818
- y - x <= v + U && Z();
819
- }, [R, p, U, Z]);
820
- oe(() => {
821
- !R && s && p && A >= i.length - k && Z();
822
- }, [A, s, p, i.length, k, R, Z]), oe(() => {
823
- const g = () => {
824
- C.current = Date.now();
825
- };
826
- return window.addEventListener("focus", g), () => window.removeEventListener("focus", g);
827
- }, []), oe(() => {
828
- if (!s) {
829
- M(-1);
830
- return;
831
- }
832
- if (A >= 0 && A < i.length && !(!i[A] || i[A].hidden || i[A].groupHeader))
833
- return;
834
- let g = -1;
835
- if (n && !S) {
836
- const x = S ? n[0] : n;
837
- x && (g = i.findIndex((y) => y.id === x.id && !y.disabled && !y.hidden && !y.groupHeader));
838
- }
839
- if (S && w.length) {
840
- const x = new Set(w.map((y) => y.id));
841
- g = i.findIndex(
842
- (y) => x.has(y.id) && !y.disabled && !y.hidden && !y.groupHeader
843
- );
844
- }
845
- g === -1 && (g = i.findIndex((x) => !x.disabled && !x.hidden && !x.groupHeader)), M(g);
846
- }, [s, i, n]);
847
- const se = O((g, x) => {
848
- const y = (W) => W && !W?.groupHeader && (!W?.group || H?.has(W?.group)) && !W?.disabled && !W?.loading, v = i.length;
849
- if (v === 0) return -1;
850
- let G = g;
851
- for (let W = 0; W < v; W++) {
852
- if (G = (G + x + v) % v, !R && p && (x > 0 && G === 0 || x < 0 && G === v - 1))
853
- return g;
854
- if (y(i[G])) return G;
855
- }
856
- return g;
857
- }, [i, p, R, H]), ie = O((g) => {
858
- const x = g.relatedTarget?.closest(".rac-options");
859
- !g.currentTarget.contains(g.relatedTarget) && !x && o(!1);
860
- }, [o]), q = O(() => {
861
- e || document.hidden || Date.now() - C.current < 100 || s || (o(!0), D.current = !0, setTimeout(() => {
862
- D.current = !1;
863
- }, 200));
864
- }, [e, s, o]), d = O((g) => {
865
- e || g.target.closest(".rac-select-cancel") || D.current || o(!s);
866
- }, [e, s, o]), F = O((g) => {
867
- if (!e)
868
- switch (g.key) {
869
- case "Enter":
870
- case " ":
871
- g.preventDefault(), s ? A !== -1 && i[A] && c(i[A], g) : o(!0);
872
- break;
873
- case "Escape":
874
- g.preventDefault(), o(!1);
875
- break;
876
- case "ArrowDown":
877
- g.preventDefault(), s ? M((x) => se(x, 1)) : o(!0);
878
- break;
879
- case "ArrowUp":
880
- g.preventDefault(), s ? M((x) => se(x, -1)) : o(!0);
881
- break;
882
- case "Tab":
883
- s && o(!1);
884
- break;
933
+ }
934
+ )
935
+ ]
885
936
  }
886
- }, [e, s, o, A, i, c, se]);
887
- return xe(() => ({
888
- handleBlur: ie,
889
- handleFocus: q,
890
- handleToggle: d,
891
- handleKeyDown: F,
892
- highlightedIndex: A,
893
- setHighlightedIndex: M,
894
- handleListScroll: ee
895
- }), [ie, q, d, F, A, ee]);
896
- }
897
- const _r = ["group", "disabled", "options", "items", "children"], Le = ["name", "label", "id", "value"], Ke = [], Re = (e, s = !1) => {
898
- if (s && typeof e.group == "string") return e.group;
899
- const o = Le.find((c) => e[c] != null && e[c] !== "");
937
+ )
938
+ ] });
939
+ }), Ir = ["group", "disabled", "options", "items", "children"], Ue = ["name", "label", "id", "value"], ur = [], De = (e, t = !1) => {
940
+ if (t && typeof e.group == "string") return e.group;
941
+ const o = Ue.find((c) => e[c] != null && e[c] !== "");
900
942
  if (o) return String(e[o]);
901
- const i = Object.entries(e).find(([c, n]) => !_r.includes(c) && n != null && n !== "");
902
- return i ? String(i[1]) : null;
943
+ const s = Object.entries(e).find(([c, g]) => !Ir.includes(c) && g != null && g !== "");
944
+ return s ? String(s[1]) : null;
903
945
  };
904
- function Nr({
905
- options: e = Ke,
906
- jsxOptions: s = Ke,
946
+ function Lr({
947
+ options: e = ur,
948
+ jsxOptions: t = ur,
907
949
  value: o,
908
- defaultValue: i,
950
+ defaultValue: s,
909
951
  onChange: c,
910
- disabled: n = !1,
911
- loading: w = !1,
912
- error: S = !1,
913
- multiple: p = !1,
914
- placeholder: $ = "Choose option",
915
- emptyText: R = "No options",
916
- disabledText: E = "Disabled",
917
- loadingText: K = "Loading",
918
- errorText: U = "Failed to load",
919
- disabledOption: k = "Disabled option",
920
- emptyOption: H = "Empty option",
921
- invalidOption: D = "Invalid option",
922
- setVisibility: C,
923
- hasMore: z,
924
- loadButton: A,
925
- setLoadingTitle: M,
926
- loadingTitle: Z,
927
- loadMoreText: ee,
928
- loadMore: se,
929
- childrenFirst: ie,
930
- groupsClosed: q
952
+ disabled: g = !1,
953
+ loading: y = !1,
954
+ error: d = !1,
955
+ multiple: i = !1,
956
+ placeholder: E = "Choose option",
957
+ emptyText: b = "No options",
958
+ disabledText: k = "Disabled",
959
+ loadingText: N = "Loading",
960
+ errorText: R = "Failed to load",
961
+ disabledOption: F = "Disabled option",
962
+ emptyOption: L = "Empty option",
963
+ invalidOption: P = "Invalid option",
964
+ setVisibility: M,
965
+ hasMore: W,
966
+ loadButton: C,
967
+ setLoadingTitle: z,
968
+ loadingTitle: ie,
969
+ loadMoreText: X,
970
+ loadMore: Y,
971
+ childrenFirst: T,
972
+ groupsClosed: a
931
973
  }) {
932
- const d = Ye(), F = o !== void 0, [g, x] = fe(null), [y, v] = fe([]), [G, W] = fe(/* @__PURE__ */ new Set()), re = ue(null), de = O((t) => {
933
- W((f) => {
934
- const a = new Set(f);
935
- return a.has(t) ? a.delete(t) : a.add(t), a;
974
+ const ee = o !== void 0, [re, V] = le(() => {
975
+ const n = /* @__PURE__ */ new Set();
976
+ if (a) return n;
977
+ const p = (j) => {
978
+ Array.isArray(j) && j.forEach((f) => {
979
+ if (f && typeof f == "object") {
980
+ if (("options" in f || "group" in f && !Ue.some((D) => D in f)) && !f.disabled) {
981
+ const D = De(f, !0) || "Empty group";
982
+ n.add(D);
983
+ }
984
+ f.options && p(f.options);
985
+ }
986
+ });
987
+ };
988
+ return p(e), n;
989
+ }), K = ne(null), de = _((n) => {
990
+ V((p) => {
991
+ const j = new Set(p);
992
+ return j.has(n) ? j.delete(n) : j.add(n), j;
936
993
  });
937
- }, []), ae = O((t, f, a = "n", b = null, _ = !1) => {
938
- const N = `${d}-${a}-${f}`;
939
- if (t == null || t === "")
940
- return { id: N, userId: null, name: H, raw: null, disabled: !0, type: "normal", group: b, groupDisabled: _ };
941
- if (typeof t == "function")
942
- return { id: N, userId: null, name: D, raw: t, disabled: !0, invalid: !0, type: "normal", group: b };
943
- if (typeof t == "object" && !Array.isArray(t)) {
944
- const Q = b || t.group || null, J = _ || t.disabled === !0, pe = t.id ?? t.value ?? t.name ?? t.label, L = t.value !== void 0 ? t.value : t.id !== void 0 ? t.id : t;
945
- let l = Re(t) || (J ? k : H);
994
+ }, []), ae = _((n, p, j = "n", f = null, I = !1) => {
995
+ const D = `${j}-${p}`;
996
+ if (n == null || n === "")
997
+ return { id: D, userId: null, name: L, raw: null, disabled: !0, type: "normal", group: f, groupDisabled: I };
998
+ if (typeof n == "function")
999
+ return { id: D, userId: null, name: P, raw: n, disabled: !0, invalid: !0, type: "normal", group: f };
1000
+ if (typeof n == "object" && !Array.isArray(n)) {
1001
+ const fe = f || n.group || null, q = I || n.disabled === !0, U = n.id ?? n.value ?? n.name ?? n.label, ce = n.value !== void 0 ? n.value : n.id !== void 0 ? n.id : n;
1002
+ let h = De(n) || (q ? F : L);
946
1003
  return {
947
- id: N,
948
- userId: pe,
949
- name: l,
950
- raw: L,
951
- original: t,
952
- disabled: J || l === H && !J,
953
- type: typeof L == "boolean" ? "boolean" : "normal",
954
- group: Q,
955
- groupDisabled: _
1004
+ id: D,
1005
+ userId: U,
1006
+ name: h,
1007
+ raw: ce,
1008
+ original: n,
1009
+ disabled: q || h === L && !q,
1010
+ type: typeof ce == "boolean" ? "boolean" : "normal",
1011
+ group: fe,
1012
+ groupDisabled: I
956
1013
  };
957
1014
  }
958
1015
  return {
959
- id: N,
960
- userId: t,
961
- name: String(t),
962
- raw: t,
963
- original: t,
964
- disabled: _,
965
- type: typeof t == "boolean" ? "boolean" : "normal",
966
- group: b
1016
+ id: D,
1017
+ userId: n,
1018
+ name: String(n),
1019
+ raw: n,
1020
+ original: n,
1021
+ disabled: I,
1022
+ type: typeof n == "boolean" ? "boolean" : "normal",
1023
+ group: f
967
1024
  };
968
- }, [d, H, D, k]), r = xe(() => {
969
- const t = /* @__PURE__ */ new Map(), f = [], a = s.map((l, T) => {
970
- if (l.isGroupMarker) return { ...l, type: "group-marker" };
971
- const V = !l.label && !l.userId && !l.value && (l.value === void 0 || l.value === null || l.value === "") && !l.hasJsx;
1025
+ }, [L, P, F]), A = Ne(() => {
1026
+ const n = /* @__PURE__ */ new Map(), p = [], j = t.map((h, G) => {
1027
+ if (h.isGroupMarker) return { ...h, type: "group-marker" };
1028
+ const Q = !h.label && !h.userId && !h.value && (h.value === void 0 || h.value === null || h.value === "") && !h.hasJsx;
972
1029
  return {
973
- ...l,
974
- id: `jsx-${l.id}`,
975
- index: T,
976
- userId: l.userId,
977
- raw: l.value,
978
- original: l.value,
979
- name: V ? H : l.label || l.userId || String(l.value || ""),
980
- disabled: !!l.disabled || V,
981
- type: typeof l.value == "boolean" ? "boolean" : "normal",
982
- group: l.group || null
1030
+ ...h,
1031
+ id: `jsx-${h.id}`,
1032
+ index: G,
1033
+ userId: h.userId,
1034
+ raw: h.value,
1035
+ original: h.value,
1036
+ name: Q ? L : h.label || h.userId || String(h.value || ""),
1037
+ disabled: !!h.disabled || Q,
1038
+ type: typeof h.value == "boolean" ? "boolean" : "normal",
1039
+ group: h.group || null
983
1040
  };
984
1041
  });
985
- let b = 0;
986
- const _ = (l, T = null, V = !1, le = "0") => {
987
- Array.isArray(l) || (l = [l]), l.forEach((Y, me) => {
988
- if (!Y) return;
989
- const be = `${le}-${me}`, ve = typeof Y == "object" && !Array.isArray(Y);
990
- if (ve && ("options" in Y || "group" in Y && !Le.some((X) => X in Y))) {
991
- const X = Re(Y, !0) || "Empty group";
992
- t.has(X) || t.set(X, { disabled: !!Y.disabled, closedByDefault: !!Y.disabled || q, items: [] }), Y.options ? _(Y.options, X, V || !!Y.disabled, be) : f.push({ id: `empty-${X}-${be}`, name: X, group: X, isPlaceholder: !0, type: "group-marker", index: b++ });
993
- } else if (ve && !Le.some((X) => X in Y) && !Y.group)
994
- Object.entries(Y).forEach(([X, Ee], Oe) => {
995
- const Pe = ae(Ee, `${be}-${Oe}`, "normal", T, V);
996
- f.push({ ...Pe, index: b++ });
1042
+ let f = 0;
1043
+ const I = (h, G = null, Q = !1, pe = "0") => {
1044
+ Array.isArray(h) || (h = [h]), h.forEach(($, xe) => {
1045
+ if (!$) return;
1046
+ const me = `${pe}-${xe}`, we = typeof $ == "object" && !Array.isArray($);
1047
+ if (we && ("options" in $ || "group" in $ && !Ue.some((oe) => oe in $))) {
1048
+ const oe = De($, !0) || "Empty group";
1049
+ n.has(oe) || n.set(oe, { disabled: !!$.disabled, closedByDefault: !!$.disabled || a, items: [] }), $.options ? I($.options, oe, Q || !!$.disabled, me) : p.push({ id: `empty-${oe}-${me}`, name: oe, group: oe, isPlaceholder: !0, type: "group-marker", index: f++ });
1050
+ } else if (we && !Ue.some((oe) => oe in $) && !$.group)
1051
+ Object.entries($).forEach(([oe, Pe], Ce) => {
1052
+ const Ie = ae(Pe, `${me}-${Ce}`, "default", G, Q);
1053
+ p.push({ ...Ie, index: f++ });
997
1054
  });
998
1055
  else {
999
- const X = ae(Y, be, "normal", T, V);
1000
- f.push({ ...X, index: b++ });
1056
+ const oe = ae($, me, "default", G, Q);
1057
+ p.push({ ...oe, index: f++ });
1001
1058
  }
1002
1059
  });
1003
1060
  };
1004
- _(e);
1005
- const N = ie ? [...a, ...f] : [...f, ...a];
1006
- if (!re.current)
1007
- re.current = new Map(N.map((l, T) => [l.id, T]));
1061
+ I(e);
1062
+ const D = T ? [...j, ...p] : [...p, ...j];
1063
+ if (!K.current)
1064
+ K.current = new Map(D.map((h, G) => [h.id, G]));
1008
1065
  else {
1009
- let l = !1;
1010
- if (N.forEach((T) => {
1011
- re.current.has(T.id) || (l = !0);
1012
- }), l) {
1013
- const T = /* @__PURE__ */ new Map();
1014
- N.forEach((V, le) => {
1015
- T.set(V.id, le);
1016
- }), re.current = T;
1066
+ let h = !1;
1067
+ if (D.forEach((G) => {
1068
+ K.current.has(G.id) || (h = !0);
1069
+ }), h) {
1070
+ const G = /* @__PURE__ */ new Map();
1071
+ D.forEach((Q, pe) => {
1072
+ G.set(Q.id, pe);
1073
+ }), K.current = G;
1017
1074
  }
1018
1075
  }
1019
- const Q = [...N].sort((l, T) => {
1020
- const V = re.current.get(l.id) ?? 999999, le = re.current.get(T.id) ?? 999999;
1021
- return V - le;
1022
- }), J = [], pe = /* @__PURE__ */ new Set();
1023
- Q.forEach((l) => {
1024
- if (!l.group)
1025
- J.push({ type: "item", data: l });
1026
- else if (pe.has(l.group) || (pe.add(l.group), J.push({ type: "group", name: l.group })), !l.isPlaceholder && !l.isGroupMarker) {
1027
- const T = t.get(l.group) || { items: [] };
1028
- t.has(l.group) || t.set(l.group, T), T.items.push(l);
1076
+ const fe = [...D].sort((h, G) => {
1077
+ const Q = K.current.get(h.id) ?? 999999, pe = K.current.get(G.id) ?? 999999;
1078
+ return Q - pe;
1079
+ }), q = [], U = /* @__PURE__ */ new Set();
1080
+ fe.forEach((h) => {
1081
+ if (!h.group)
1082
+ q.push({ type: "item", data: h });
1083
+ else if (U.has(h.group) || (U.add(h.group), q.push({ type: "group", name: h.group })), !h.isPlaceholder && !h.isGroupMarker) {
1084
+ const G = n.get(h.group) || { items: [] };
1085
+ n.has(h.group) || n.set(h.group, G), G.items.push(h);
1029
1086
  }
1030
1087
  });
1031
- const L = [];
1032
- return J.forEach((l) => {
1033
- if (l.type === "item")
1034
- L.push(l.data);
1088
+ const ce = [];
1089
+ return q.forEach((h) => {
1090
+ if (h.type === "item")
1091
+ ce.push(h.data);
1035
1092
  else {
1036
- const T = l.name, V = t.get(T), le = G.has(T);
1037
- L.push({
1038
- id: `group-header-${T}`,
1039
- name: T,
1040
- disabled: !!V?.disabled,
1093
+ const G = h.name, Q = n.get(G), pe = re.has(G);
1094
+ ce.push({
1095
+ id: `group-header-${G}`,
1096
+ name: G,
1097
+ disabled: !!Q?.disabled,
1041
1098
  groupHeader: !0,
1042
- expanded: le,
1099
+ expanded: pe,
1043
1100
  type: "group",
1044
1101
  hidden: !1
1045
- }), V?.items.forEach((Y) => {
1046
- const me = G.size > 0 ? !le : !!q;
1047
- L.push({ ...Y, hidden: me });
1102
+ }), Q?.items.forEach(($) => {
1103
+ const xe = re.size > 0 ? !pe : !!a;
1104
+ ce.push({ ...$, hidden: xe });
1048
1105
  });
1049
1106
  }
1050
- }), z && A && L.push({
1107
+ }), W && C && ce.push({
1051
1108
  id: "special-load-more-id",
1052
- name: Z,
1109
+ name: ie,
1053
1110
  loadMore: !0,
1054
- loading: Z === ee,
1111
+ loading: ie === X,
1055
1112
  type: "special"
1056
- }), L;
1057
- }, [e, s, d, ae, ie, z, A, Z, ee, q, G, H]);
1058
- oe(() => {
1059
- if (!r || r.length === 0 || G.size > 0 || q) return;
1060
- const t = /* @__PURE__ */ new Set();
1061
- r.forEach((f) => {
1062
- f.groupHeader && !f.disabled && t.add(f.name);
1063
- }), t.size > 0 && W(t);
1064
- }, [r, q]);
1065
- const h = O((t) => {
1066
- if (t == null) return null;
1067
- const f = r.find((a) => a.original === t);
1068
- if (f) return f.id;
1069
- if (typeof t == "object")
1070
- try {
1071
- const a = JSON.stringify(t);
1072
- return r.find(
1073
- (b) => b.original && typeof b.original == "object" && JSON.stringify(b.original) === a
1074
- )?.id ?? null;
1075
- } catch {
1076
- return null;
1077
- }
1078
- return null;
1079
- }, [r]);
1080
- oe(() => {
1081
- const t = F ? o : i;
1082
- if (t == null || Array.isArray(t) && t.length === 0) {
1083
- x(null), v([]);
1084
- return;
1085
- }
1086
- const f = (a) => {
1087
- const b = h(a), _ = r.find((Q) => Q.id === b);
1088
- if (_) return _;
1089
- const N = typeof a == "object" ? a.id || a.value || JSON.stringify(a) : String(a);
1090
- return typeof a == "object" && a !== null ? {
1091
- id: `virtual-${N}`,
1092
- name: Re(a) || String(a.id || "Selected Object"),
1093
- raw: a.value ?? a.id ?? a,
1094
- original: a,
1095
- userId: a.id ?? a.value ?? null,
1113
+ }), ce;
1114
+ }, [e, t, ae, T, W, C, ie, X, a, re, L]), B = _(() => {
1115
+ const n = ee ? o : s;
1116
+ if (n == null || Array.isArray(n) && n.length === 0)
1117
+ return { initialId: null, initialIDs: [] };
1118
+ const p = /* @__PURE__ */ new Set(), j = (f, I) => {
1119
+ let D = A.find((q) => q.original === f && !p.has(q.id));
1120
+ if (!D && typeof f == "object")
1121
+ try {
1122
+ const q = JSON.stringify(f);
1123
+ D = A.find(
1124
+ (U) => U.original && typeof U.original == "object" && JSON.stringify(U.original) === q && !p.has(U.id)
1125
+ );
1126
+ } catch {
1127
+ }
1128
+ if (D)
1129
+ return p.add(D.id), D;
1130
+ const fe = typeof f == "object" ? f.id || f.value || JSON.stringify(f) : String(f);
1131
+ return typeof f == "object" && f !== null ? {
1132
+ id: `virtual-${fe}-${I}`,
1133
+ name: De(f) || String(f.id || "Selected Object"),
1134
+ raw: f.value ?? f.id ?? f,
1135
+ original: f,
1136
+ userId: f.id ?? f.value ?? null,
1096
1137
  virtual: !0
1097
1138
  } : {
1098
- id: `virtual-${N}`,
1099
- name: String(a),
1100
- raw: a,
1101
- original: a,
1102
- userId: a,
1139
+ id: `virtual-${fe}-${I}`,
1140
+ name: String(f),
1141
+ raw: f,
1142
+ original: f,
1143
+ userId: f,
1103
1144
  virtual: !0
1104
1145
  };
1105
1146
  };
1106
- if (p) {
1107
- const b = (Array.isArray(t) ? t : [t]).map(f);
1108
- v(b);
1109
- } else {
1110
- const a = Array.isArray(t) ? t[0] : t, b = f(a);
1111
- x((_) => _ === b.id ? _ : b.id);
1147
+ if (i)
1148
+ return { initialId: null, initialIDs: (Array.isArray(n) ? n : [n]).map((D, fe) => j(D, fe)) };
1149
+ {
1150
+ const f = Array.isArray(n) ? n[0] : n;
1151
+ return { initialId: j(f, 0).id, initialIDs: [] };
1112
1152
  }
1113
- }, []);
1114
- const j = xe(() => {
1115
- const t = r.find((f) => f.id === g);
1116
- if (t) return t;
1117
- if (!p && g?.startsWith("virtual-")) {
1118
- const f = F ? o : i, a = Array.isArray(f) ? f[0] : f;
1119
- if (a)
1153
+ }, [ee, o, s, A, i]), [se, v] = le(() => B().initialId), [x, r] = le(() => B().initialIDs), l = Ne(() => {
1154
+ const n = A.find((p) => p.id === se);
1155
+ if (n) return n;
1156
+ if (!i && se?.startsWith("virtual-")) {
1157
+ const p = ee ? o : s, j = Array.isArray(p) ? p[0] : p;
1158
+ if (j)
1120
1159
  return {
1121
- id: g,
1122
- name: typeof a == "object" ? Re(a) : String(a),
1123
- original: a
1160
+ id: se,
1161
+ name: typeof j == "object" ? De(j) : String(j),
1162
+ original: j
1124
1163
  };
1125
1164
  }
1126
1165
  return null;
1127
- }, [g, r, p, F, o, i]), P = O((t, f) => {
1128
- if (t.groupHeader) {
1129
- f?.stopPropagation(), f?.preventDefault(), t.disabled || de(t.name);
1166
+ }, [se, A, i, ee, o, s]), m = _((n, p) => {
1167
+ if (n.groupHeader) {
1168
+ w(p), n.disabled || de(n.name);
1130
1169
  return;
1131
1170
  }
1132
- if (t.disabled || t.loadMore) {
1133
- f?.stopPropagation(), f?.preventDefault(), t.loadMore && !t.loading && (M(ee), se());
1171
+ if (n.disabled || n.loadMore) {
1172
+ w(p), n.loadMore && !n.loading && (z(X), Y());
1134
1173
  return;
1135
1174
  }
1136
- if (p) {
1137
- if (t.disabled || t.groupHeader || t.loadMore) {
1138
- f?.stopPropagation(), f?.preventDefault();
1175
+ if (i) {
1176
+ if (n.disabled || n.groupHeader || n.loadMore) {
1177
+ w(p);
1139
1178
  return;
1140
1179
  }
1141
- f?.stopPropagation(), f?.preventDefault();
1142
- const b = y?.some((_) => _.id === t.id) ? y.filter((_) => _.id !== t.id) : [...y, t];
1143
- v(b), c?.(b.map((_) => _.original), b.map((_) => _.userId));
1180
+ w(p);
1181
+ const f = x?.some((I) => I.id === n.id) ? x.filter((I) => I.id !== n.id) : [...x, n];
1182
+ r(f), c?.(f.map((I) => I.original), f.map((I) => I.userId));
1144
1183
  return;
1145
1184
  }
1146
- x(t.id), c?.(t.original, t.userId), C(!1);
1147
- }, [c, C, se, ee, M, de]), te = O(() => {
1148
- x(null), v([]), c?.(null, null);
1149
- }, [c]), ne = O((t) => {
1150
- const f = y.filter((a) => a.id !== t);
1151
- v(f), c?.(f.map((a) => a.original), f.map((a) => a.userId));
1152
- }, [y, c]);
1185
+ v(n.id), c?.(n.original, n.userId), M(!1);
1186
+ }, [c, M, Y, X, z, de, i, x]), w = _((n) => {
1187
+ n?.stopPropagation(), n?.preventDefault();
1188
+ }, []), ge = _(() => {
1189
+ c?.(null, null), v(null), r([]);
1190
+ }, [c]), ve = _((n) => {
1191
+ const p = x.filter((j) => j.id !== n);
1192
+ r(p), c?.(p.map((j) => j.original), p.map((j) => j.userId));
1193
+ }, [x, c]);
1153
1194
  return {
1154
- normalizedOptions: r,
1155
- selected: j,
1156
- selectOption: P,
1157
- clear: te,
1158
- removeOption: ne,
1159
- hasOptions: r.length > 0,
1160
- active: !S && !w && !n && r.length > 0,
1161
- selectedValue: o ?? i,
1162
- placeholder: $,
1163
- emptyText: R,
1164
- disabledText: E,
1165
- loadingText: K,
1166
- errorText: U,
1167
- disabledOption: k,
1168
- emptyOption: H,
1169
- invalidOption: D,
1170
- disabled: n,
1171
- loading: w,
1172
- error: S,
1173
- expandedGroups: G,
1195
+ normalizedOptions: A,
1196
+ selected: l,
1197
+ selectOption: m,
1198
+ clear: ge,
1199
+ removeOption: ve,
1200
+ hasOptions: A.length > 0,
1201
+ active: !d && !y && !g && A.length > 0,
1202
+ selectedValue: o ?? s,
1203
+ placeholder: E,
1204
+ emptyText: b,
1205
+ disabledText: k,
1206
+ loadingText: N,
1207
+ errorText: R,
1208
+ disabledOption: F,
1209
+ emptyOption: L,
1210
+ invalidOption: P,
1211
+ disabled: g,
1212
+ loading: y,
1213
+ error: d,
1214
+ expandedGroups: re,
1174
1215
  toggleGroup: de,
1175
- selectedIDs: y,
1176
- multiple: p,
1177
- setSelectedIds: v
1216
+ selectedIDs: x,
1217
+ multiple: i,
1218
+ setSelectedIds: r
1178
1219
  };
1179
1220
  }
1180
- function Rr({ visibility: e, children: s, duration: o = 300 }) {
1181
- const i = ue(null);
1221
+ function Hr({ disabled: e, open: t, setOpen: o, options: s = [], selectOption: c, setDeleting: g, selected: y, selectedIDs: d, multiple: i, hasMore: E, loadMore: b, loadButton: k, loadButtonText: N, setLoadingTitle: R, loadOffset: F, loadAhead: L, expandedGroups: P, onOpen: M, onClose: W, deleting: C }) {
1222
+ const z = ne(!1), ie = ne(0), X = ne(!1), [Y, T] = le(-1);
1223
+ ue(() => {
1224
+ X.current = !1, k && R(N);
1225
+ }, [s.length, E, k, N, R]);
1226
+ const a = _(() => {
1227
+ !E || X.current || (X.current = !0, b());
1228
+ }, [E, b]), ee = _((v) => {
1229
+ if (k || !E || X.current) return;
1230
+ const { scrollTop: x, scrollHeight: r, clientHeight: l } = v.currentTarget(r - x <= l + F) && a();
1231
+ }, [k, E, F, a]);
1232
+ ue(() => {
1233
+ !k && t && E && Y >= s.length - L && a();
1234
+ }, [Y, t, E, s.length, L, k, a]), ue(() => {
1235
+ const v = () => {
1236
+ ie.current = Date.now();
1237
+ };
1238
+ return window.addEventListener("focus", v), () => window.removeEventListener("focus", v);
1239
+ }, []), ue(() => {
1240
+ if (!t) {
1241
+ T(-1);
1242
+ return;
1243
+ }
1244
+ const v = s[Y], x = v && !v.hidden && !v.groupHeader;
1245
+ if (Y >= 0 && Y < s.length && x) return;
1246
+ let r = -1;
1247
+ if (y && !i) {
1248
+ const l = i ? y[0] : y;
1249
+ l && (r = s.findIndex((m) => m.id === l.id && !m.disabled && !m.hidden && !m.groupHeader));
1250
+ }
1251
+ if (i && d.length) {
1252
+ const l = new Set(d.map((m) => m.id));
1253
+ r = s.findIndex(
1254
+ (m) => l.has(m.id) && !m.disabled && !m.hidden && !m.groupHeader
1255
+ );
1256
+ }
1257
+ r === -1 && (r = s.findIndex((l) => !l.disabled && !l.hidden && !l.groupHeader)), T(r);
1258
+ }, [t, s, y]);
1259
+ const re = _((v, x) => {
1260
+ const r = (w) => w && !w?.groupHeader && (!w?.group || P?.has(w?.group)) && !w?.disabled && !w?.loading, l = s.length;
1261
+ if (l === 0) return -1;
1262
+ let m = v;
1263
+ for (let w = 0; w < l; w++) {
1264
+ if (m = (m + x + l) % l, !k && E && (x > 0 && m === 0 || x < 0 && m === l - 1))
1265
+ return v;
1266
+ if (r(s[m])) return m;
1267
+ }
1268
+ return v;
1269
+ }, [s, E, k, P]), V = _((v) => {
1270
+ const x = v.relatedTarget?.closest(".rac-options");
1271
+ !v.currentTarget.contains(v.relatedTarget) && !x && (o(!1), g(!1));
1272
+ }, [o]), K = _(() => {
1273
+ e || C || document.hidden || Date.now() - ie.current < 100 || t || (o(!0), z.current = !0, setTimeout(() => z.current = !1, 200));
1274
+ }, [e, t, o, C]), de = ne(t), ae = ne(M), A = ne(W);
1275
+ ue(() => {
1276
+ ae.current = M, A.current = W;
1277
+ }, [M, W]), ue(() => {
1278
+ de.current !== t && (t ? ae.current?.() : A.current?.(), de.current = t);
1279
+ }, [t]);
1280
+ const B = _((v) => {
1281
+ e || C || v?.target?.closest(".rac-select-cancel") || z.current || o(!t);
1282
+ }, [e, t, o, M, W, C]), se = _((v) => {
1283
+ if (!e)
1284
+ switch (v.key) {
1285
+ case "Enter":
1286
+ case " ":
1287
+ v.preventDefault(), t ? Y !== -1 && s[Y] && c(s[Y], v) : o(!0);
1288
+ break;
1289
+ case "Escape":
1290
+ v.preventDefault(), o(!1);
1291
+ break;
1292
+ case "ArrowDown":
1293
+ v.preventDefault(), t ? T((x) => re(x, 1)) : o(!0);
1294
+ break;
1295
+ case "ArrowUp":
1296
+ v.preventDefault(), t ? T((x) => re(x, -1)) : o(!0);
1297
+ break;
1298
+ case "Tab":
1299
+ t && o(!1);
1300
+ break;
1301
+ }
1302
+ }, [e, t, o, Y, s, c, re]);
1303
+ return Ne(() => ({ handleBlur: V, handleFocus: K, toggleVisibility: B, handleKeyDown: se, highlightedIndex: Y, setHighlightedIndex: T, handleListScroll: ee }), [V, K, B, se, Y, ee]);
1304
+ }
1305
+ function Fr({ visibility: e, children: t, duration: o = 300, className: s }) {
1306
+ const c = ne(null);
1182
1307
  return /* @__PURE__ */ u.jsx(
1183
- Ae,
1308
+ Xe,
1184
1309
  {
1310
+ onEntering: () => c.current.style.height = c.current.scrollHeight + "px",
1311
+ onExit: () => c.current.style.height = c.current.scrollHeight + "px",
1312
+ onEntered: () => c.current.style.height = "auto",
1313
+ onExiting: () => c.current.style.height = "0px",
1314
+ onEnter: () => c.current.style.height = "0px",
1315
+ classNames: "rac-slide-down",
1316
+ timeout: o,
1317
+ nodeRef: c,
1185
1318
  in: e,
1186
- timeout: 300,
1187
- classNames: "slideDown",
1188
1319
  unmountOnExit: !0,
1189
- nodeRef: i,
1190
- onEnter: () => i.current.style.height = "0px",
1191
- onEntering: () => i.current.style.height = i.current.scrollHeight + "px",
1192
- onEntered: () => i.current.style.height = "auto",
1193
- onExit: () => i.current.style.height = i.current.scrollHeight + "px",
1194
- onExiting: () => i.current.style.height = "0px",
1195
1320
  children: /* @__PURE__ */ u.jsx(
1196
1321
  "div",
1197
1322
  {
1198
- ref: i,
1199
1323
  style: {
1200
- overflow: "hidden",
1201
1324
  transition: `height ${o}ms ease`,
1202
- paddingLeft: "1em"
1325
+ overflow: "hidden"
1203
1326
  },
1204
- className: "slideDown-enter-done",
1327
+ className: `${s} rac-slide-down-enter-done`,
1328
+ ref: c,
1205
1329
  tabIndex: -1,
1206
- children: s
1330
+ children: t
1207
1331
  }
1208
1332
  )
1209
1333
  }
1210
1334
  );
1211
1335
  }
1212
- const He = (e, s) => {
1336
+ const Ke = (e, t) => {
1213
1337
  if (!e) return null;
1214
- if (typeof e == "string") return /* @__PURE__ */ u.jsx("img", { src: e, ...s, alt: "" });
1215
- if (gr(e)) return hr(e, s);
1338
+ const o = (s = {}) => ({
1339
+ ...t,
1340
+ ...s,
1341
+ style: {
1342
+ ...t?.style,
1343
+ ...s?.style
1344
+ }
1345
+ });
1346
+ if (typeof e == "string") return /* @__PURE__ */ u.jsx("img", { src: e, ...o(), alt: "" });
1347
+ if (vr(e)) return jr(e, o(e.props));
1216
1348
  if (typeof e == "function" || typeof e == "object" && e.$$typeof) {
1217
- const o = e;
1218
- return /* @__PURE__ */ u.jsx(o, { ...s });
1349
+ const s = e;
1350
+ return /* @__PURE__ */ u.jsx(s, { ...o() });
1219
1351
  }
1220
1352
  return null;
1221
- }, kr = (e, s, o, i, c, n, w, S) => {
1222
- const p = S?.some(($) => $.id === e.id);
1353
+ }, Mr = (e, t, o, s, c, g, y, d) => {
1354
+ const i = d?.some((E) => E.id === e.id);
1223
1355
  return e.groupHeader ? "rac-select-option rac-group-option" : [
1224
1356
  "rac-select-option",
1225
1357
  e.className,
1226
- (p || i === e.id) && "rac-selected",
1227
- s === o && "rac-highlighted",
1358
+ (i || s === e.id) && "rac-selected",
1359
+ t === o && "rac-highlighted",
1228
1360
  (e.disabled || e.loading) && "rac-disabled-option",
1229
- (e.invalid || e.name === w) && "rac-invalid-option",
1230
- e.loadMore && c === n && "rac-loading-option",
1361
+ (e.invalid || e.name === y) && "rac-invalid-option",
1362
+ e.loadMore && c === g && "rac-loading-option",
1231
1363
  typeof e.raw == "boolean" && (e.raw ? "rac-true-option" : "rac-false-option")
1232
1364
  ].filter(Boolean).join(" ");
1233
- }, Cr = dr(({
1365
+ }, Dr = hr(({
1234
1366
  unmount: e,
1235
- children: s,
1367
+ children: t,
1236
1368
  visibility: o,
1237
- ownBehavior: i = !1,
1369
+ ownBehavior: s = !1,
1238
1370
  alwaysOpen: c = !1,
1239
- duration: n = 300,
1240
- easing: w = "ease-out",
1241
- offset: S = 0,
1242
- animateOpacity: p = !0,
1243
- style: $ = {},
1244
- className: R = "",
1245
- ArrowIcon: E = Er,
1246
- ClearIcon: K = Ue,
1247
- DelIcon: U = Ue,
1248
- CheckIcon: k = Me,
1249
- hasMore: H = !1,
1250
- loadMore: D = () => {
1371
+ duration: g = 300,
1372
+ easing: y = "ease-out",
1373
+ offset: d = 1,
1374
+ animateOpacity: i = !0,
1375
+ style: E = {},
1376
+ className: b = "",
1377
+ ArrowIcon: k = _r,
1378
+ ClearIcon: N = or,
1379
+ DelIcon: R = or,
1380
+ CheckIcon: F = ar,
1381
+ hasMore: L = !1,
1382
+ loadMore: P = () => {
1251
1383
  console.warn("loadMore not implemented");
1252
1384
  },
1253
- loadButton: C = !1,
1254
- loadButtonText: z = "Load more",
1255
- loadMoreText: A = "Loading",
1256
- selectedText: M = void 0,
1257
- loadOffset: Z = 100,
1258
- loadAhead: ee = 3,
1259
- childrenFirst: se = !1,
1260
- groupsClosed: ie = !1,
1261
- optionsClassName: q = "",
1262
- ...d
1263
- }, F) => {
1264
- const g = Ye(), x = xe(() => g.replace(/:/g, ""), [g]), [y, v] = fe([]), [G, W] = fe(!1), [re, de] = fe(C ? z : A), [ae, r] = fe(!1), h = ue(null), j = O((I) => {
1265
- v((B) => {
1266
- const ce = B.findIndex((ge) => ge.id === I.id);
1267
- if (ce !== -1) {
1268
- const ge = B[ce];
1269
- if (ge.label === I.label && ge.value === I.value && ge.disabled === I.disabled && ge.group === I.group)
1270
- return B;
1271
- const je = [...B];
1272
- return je[ce] = I, je;
1385
+ loadButton: M = !1,
1386
+ loadButtonText: W = "Load more",
1387
+ loadMoreText: C = "Loading",
1388
+ selectedText: z = void 0,
1389
+ loadOffset: ie = 100,
1390
+ loadAhead: X = 3,
1391
+ childrenFirst: Y = !1,
1392
+ groupsClosed: T = !1,
1393
+ optionsClassName: a = "",
1394
+ onOpen: ee = () => {
1395
+ },
1396
+ onClose: re = () => {
1397
+ },
1398
+ deleteInline: V = !1,
1399
+ ...K
1400
+ }, de) => {
1401
+ const ae = xr(), A = Ne(() => ae.replace(/:/g, ""), [ae]), [B, se] = le([]), [v, x] = le(!1), [r, l] = le(M ? W : C), [m, w] = le(!1), ge = ne(null), [ve, n] = le(!1), p = _((O) => {
1402
+ se((Z) => {
1403
+ const he = Z.findIndex(($e) => $e.id === O.id);
1404
+ if (he !== -1) {
1405
+ const $e = Z[he];
1406
+ if ($e.label === O.label && $e.value === O.value && $e.disabled === O.disabled && $e.group === O.group)
1407
+ return Z;
1408
+ const We = [...Z];
1409
+ return We[he] = O, We;
1273
1410
  }
1274
- return [...B, I];
1411
+ return [...Z, O];
1275
1412
  });
1276
- }, []), P = O((I) => {
1277
- v((B) => {
1278
- const ce = B.filter((ge) => ge.id !== I);
1279
- return ce.length === B.length ? B : ce;
1413
+ }, []), j = _((O) => {
1414
+ se((Z) => {
1415
+ const he = Z.filter(($e) => $e.id !== O);
1416
+ return he.length === Z.length ? Z : he;
1280
1417
  });
1281
- }, []), te = c ? !0 : i ? !!o : G, ne = O((I) => {
1282
- c || i || W(I);
1283
- }, [c, i]), t = Nr({
1284
- ...d,
1285
- setVisibility: ne,
1286
- jsxOptions: y,
1287
- hasMore: H,
1288
- loadButton: C,
1289
- loadingTitle: re,
1290
- loadMore: D,
1291
- loadMoreText: A,
1292
- setLoadingTitle: de,
1293
- childrenFirst: se,
1294
- groupsClosed: ie
1295
- }), { multiple: f, normalizedOptions: a, selected: b, selectOption: _, clear: N, removeOption: Q, hasOptions: J, active: pe, selectedValue: L, disabled: l, loading: T, error: V, placeholder: le, invalidOption: Y, emptyText: me, disabledText: be, loadingText: ve, errorText: Te, expandedGroups: X, selectedIDs: Ee, setSelectedIds: Oe } = t, Pe = $r({ setLoadingTitle: de, loadButton: C, loadButtonText: z, hasMore: H, loadMore: D, disabled: l, multiple: f, open: te, setOpen: ne, options: a, selectOption: _, selected: b, loadOffset: Z, loadAhead: ee, expandedGroups: X, selectedIDs: Ee }), { handleListScroll: rr, handleBlur: tr, handleFocus: nr, handleToggle: sr, handleKeyDown: ir, highlightedIndex: we, setHighlightedIndex: Ce } = Pe;
1296
- fr(F, () => h.current), oe(() => {
1297
- te || r(!1);
1298
- }, [te]), oe(() => {
1299
- (V || l || T || !J) && ne(!1);
1300
- }, [V, l, T, J, ne]), oe(() => {
1301
- if (te && ae && we !== -1) {
1302
- const I = a[we];
1303
- I && document.getElementById(`opt-${x}-${qe(I.id)}`)?.scrollIntoView({ block: "nearest" });
1418
+ }, []), f = c ? !0 : s ? !!o : v, I = _((O) => {
1419
+ c || s || x(O);
1420
+ }, [c, s]), D = Lr({
1421
+ ...K,
1422
+ setVisibility: I,
1423
+ jsxOptions: B,
1424
+ hasMore: L,
1425
+ loadButton: M,
1426
+ loadingTitle: r,
1427
+ loadMore: P,
1428
+ loadMoreText: C,
1429
+ setLoadingTitle: l,
1430
+ childrenFirst: Y,
1431
+ groupsClosed: T
1432
+ }), { multiple: fe, normalizedOptions: q, selected: U, selectOption: ce, clear: h, removeOption: G, hasOptions: Q, active: pe, selectedValue: $, disabled: xe, loading: me, error: we, placeholder: Te, invalidOption: oe, emptyText: Pe, disabledText: Ce, loadingText: Ie, errorText: H, expandedGroups: J, selectedIDs: te, setSelectedIds: Le } = D, ye = Hr({ setDeleting: n, setLoadingTitle: l, loadButton: M, loadButtonText: W, hasMore: L, loadMore: P, disabled: xe, multiple: fe, open: f, setOpen: I, options: q, selectOption: ce, selected: U, loadOffset: ie, loadAhead: X, expandedGroups: J, selectedIDs: te, onOpen: ee, onClose: re, deleting: ve }), { handleListScroll: je, handleBlur: Se, handleFocus: be, toggleVisibility: Ge, handleKeyDown: He, highlightedIndex: Ee, setHighlightedIndex: ke } = ye;
1433
+ gr(de, () => ge.current), ue(() => {
1434
+ !f && w(!1);
1435
+ }, [f]), ue(() => {
1436
+ (we || xe || me || !Q) && I(!1);
1437
+ }, [we, xe, me, Q, I]), ue(() => {
1438
+ if (f && m && Ee !== -1) {
1439
+ const O = q[Ee];
1440
+ O && document.getElementById(`${A}-${Ze(O.id)}`)?.scrollIntoView({ block: "nearest" });
1304
1441
  }
1305
- }, [we, te, ae, a, x]);
1306
- const _e = xe(() => L != null && !(Array.isArray(L) && L.length === 0) && !(typeof L == "object" && Object.keys(L).length === 0), [L]), or = xe(() => {
1307
- if (V) return Te;
1308
- if (T) return ve;
1309
- if (l) return be;
1310
- if (_e && M) return M;
1311
- if (b) return b.jsx ?? b.name;
1312
- if (_e) {
1313
- const I = a.find((B) => B.raw === L);
1314
- return I ? I.name : typeof L == "object" && L !== null ? L.name ?? L.label ?? "Selected Object" : String(L);
1442
+ }, [Ee, f, m, q, A]);
1443
+ const Re = Ne(() => $ != null && !(Array.isArray($) && $.length === 0) && !(typeof $ == "object" && Object.keys($).length === 0), [$]), Ae = Ne(() => {
1444
+ if (we) return H;
1445
+ if (me) return Ie;
1446
+ if (xe) return Ce;
1447
+ if (Re && z) return z;
1448
+ if (U) return U.jsx ?? U.name;
1449
+ if (Re) {
1450
+ const O = q.find((Z) => Z.raw === $);
1451
+ return O ? O.name : typeof $ == "object" && $ !== null ? $.name ?? $.label ?? "Selected Object" : String($);
1315
1452
  }
1316
- return J ? le : me;
1317
- }, [l, T, V, J, b, L, le, Te, ve, be, me, _e, a]), ar = xe(() => {
1318
- const I = [];
1319
- let B = [], ce = null;
1320
- const ge = a.reduce((m, he) => (he.group && (m[he.group] = (m[he.group] || 0) + 1), m), {}), je = (m) => {
1321
- m === null || B.length === 0 || (I.push(
1453
+ return Q ? Te : Pe;
1454
+ }, [xe, me, we, Q, U, $, Te, H, Ie, Ce, Pe, Re, q]), Me = Ne(() => {
1455
+ const O = [];
1456
+ let Z = [], he = null;
1457
+ const $e = q.reduce((S, _e) => (_e.group && (S[_e.group] = (S[_e.group] || 0) + 1), S), {}), We = (S) => {
1458
+ S === null || Z.length === 0 || (O.push(
1322
1459
  /* @__PURE__ */ u.jsx(
1323
- Rr,
1460
+ Fr,
1324
1461
  {
1325
- visibility: X.has(m),
1326
- children: B
1462
+ visibility: J.has(S),
1463
+ className: "rac-group-container",
1464
+ children: Z
1327
1465
  },
1328
- `slide-${m}`
1466
+ `slide-${S}`
1329
1467
  )
1330
- ), B = []);
1331
- }, ze = (m, he) => /* @__PURE__ */ u.jsxs(
1468
+ ), Z = []);
1469
+ }, rr = (S, _e) => /* @__PURE__ */ u.jsxs(
1332
1470
  "div",
1333
1471
  {
1334
- id: `opt-${x}-${qe(m.id)}`,
1472
+ className: Mr(S, _e, Ee, U?.id, r, C, oe, te),
1473
+ onMouseEnter: () => !S.disabled && !S.loading && ke(_e),
1474
+ onClick: (Oe) => !S.loading && ce(S, Oe),
1475
+ "aria-disabled": S.disabled || S.loading,
1476
+ "aria-selected": U?.id === S.id,
1477
+ id: `${A}-${Ze(S.id)}`,
1335
1478
  role: "option",
1336
- "aria-selected": b?.id === m.id,
1337
- "aria-disabled": m.disabled || m.loading,
1338
- className: kr(m, he, we, b?.id, re, A, Y, Ee),
1339
- onClick: (ye) => !m.loading && _(m, ye),
1340
- onMouseEnter: () => !m.disabled && !m.loading && Ce(he),
1341
1479
  children: [
1342
- m.jsx ?? /* @__PURE__ */ u.jsx("span", { className: "rac-option-title", children: m.name }),
1343
- m.loading && /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
1480
+ S.jsx ?? /* @__PURE__ */ u.jsx("span", { className: "rac-option-title", children: S.name }),
1481
+ S.loading && /* @__PURE__ */ u.jsxs("span", { className: "rac-loading-dots", children: [
1344
1482
  /* @__PURE__ */ u.jsx("i", {}),
1345
1483
  /* @__PURE__ */ u.jsx("i", {}),
1346
1484
  /* @__PURE__ */ u.jsx("i", {})
1347
1485
  ] }),
1348
- f && !m.disabled ? /* @__PURE__ */ u.jsx("div", { className: "rac-checkbox", children: He(
1349
- Me,
1350
- {
1351
- className: `
1352
- rac-checkmark
1353
- ${Ee?.some((ye) => ye.id === m.id) ? "--checked" : ""}`
1354
- }
1355
- ) }) : null
1486
+ fe && !S.disabled && /* @__PURE__ */ u.jsx("div", { className: "rac-checkbox", children: Ke(ar, { className: `
1487
+ rac-checkmark
1488
+ ${te?.some((Oe) => Oe.id === S.id) ? "--checked" : ""}` }) })
1356
1489
  ]
1357
1490
  },
1358
- m.id
1491
+ S.id
1359
1492
  );
1360
- return a.forEach((m, he) => {
1361
- const ye = m.groupHeader, Fe = !!m.group;
1362
- if ((ye || !Fe && ce !== null) && (je(ce), ye || (ce = null)), ye) {
1363
- ce = m.name;
1364
- const lr = X.has(m.name), cr = ge[m.name] > 0;
1365
- I.push(
1493
+ return q.forEach((S, _e) => {
1494
+ const Oe = S.groupHeader, tr = !!S.group;
1495
+ if ((Oe || !tr && he !== null) && (We(he), Oe || (he = null)), Oe) {
1496
+ he = S.name;
1497
+ const br = J.has(S.name), wr = $e[S.name] > 0;
1498
+ O.push(
1366
1499
  /* @__PURE__ */ u.jsxs(
1367
1500
  "div",
1368
1501
  {
1502
+ id: S.id,
1369
1503
  className: [
1370
1504
  "rac-group-header",
1371
- m.disabled && "rac-disabled-group"
1505
+ S.disabled && "rac-disabled-group"
1372
1506
  ].filter(Boolean).join(" "),
1373
- onClick: (ur) => _(m, ur),
1507
+ onClick: (Er) => ce(S, Er),
1374
1508
  children: [
1375
- /* @__PURE__ */ u.jsx("span", { className: "rac-group-title-text", children: m.name }),
1509
+ /* @__PURE__ */ u.jsx("span", { className: "rac-group-title-text", children: S.name }),
1376
1510
  /* @__PURE__ */ u.jsx(
1377
- ke,
1511
+ Fe,
1378
1512
  {
1379
- visibility: cr && !m.disabled,
1380
- duration: n,
1381
- children: /* @__PURE__ */ u.jsx("span", { className: `rac-group-arrow-wrapper ${lr ? "--open" : ""}`, children: He(E, { className: "rac-select-arrow-wrapper" }) })
1513
+ visibility: wr && !S.disabled,
1514
+ style: { display: "grid" },
1515
+ duration: g,
1516
+ children: /* @__PURE__ */ u.jsx("span", { className: `rac-group-arrow-wrapper ${br ? "open" : ""}`, children: Ke(k, { className: "rac-select-arrow-wrapper" }) })
1382
1517
  }
1383
1518
  )
1384
1519
  ]
1385
1520
  },
1386
- m.id
1521
+ S.id
1387
1522
  )
1388
1523
  );
1389
- } else Fe ? B.push(ze(m, he)) : I.push(ze(m, he));
1390
- }), je(ce), I;
1391
- }, [
1392
- a,
1393
- _,
1394
- x,
1395
- b,
1396
- we,
1397
- re,
1398
- A,
1399
- Y,
1400
- Ce,
1401
- X,
1402
- E
1403
- ]);
1524
+ } else tr ? Z.push(rr(S, _e)) : O.push(rr(S, _e));
1525
+ }), We(he), O;
1526
+ }, [q, ce, A, U, Ee, r, C, oe, ke, J, k]);
1404
1527
  return /* @__PURE__ */ u.jsx(
1405
- Sr,
1528
+ Cr,
1406
1529
  {
1407
- selectedText: M,
1408
- selectRef: h,
1409
- selectId: x,
1410
- selectedIDs: Ee,
1411
- setSelectedIds: Oe,
1412
- multiple: f,
1413
- removeOption: Q,
1414
- optionsClassName: q,
1415
- renderIcon: He,
1416
- normalizedOptions: a,
1417
- renderOptions: ar,
1418
- selected: b,
1419
- title: or,
1420
- visibility: te,
1530
+ setDeleting: n,
1531
+ deleting: ve,
1532
+ selectedText: z,
1533
+ selectRef: ge,
1534
+ selectId: A,
1535
+ selectedIDs: te,
1536
+ setSelectedIds: Le,
1537
+ multiple: fe,
1538
+ removeOption: G,
1539
+ optionsClassName: a,
1540
+ renderIcon: Ke,
1541
+ normalizedOptions: q,
1542
+ renderOptions: Me,
1543
+ selected: U,
1544
+ title: Ae,
1545
+ visibility: f,
1421
1546
  active: pe,
1422
- hasOptions: J,
1423
- hasActualValue: _e,
1424
- highlightedIndex: we,
1425
- animationFinished: ae,
1426
- disabled: l,
1427
- loading: T,
1428
- error: V,
1429
- setVisibility: ne,
1430
- setHighlightedIndex: Ce,
1431
- setAnimationFinished: r,
1432
- handleBlur: tr,
1433
- handleFocus: nr,
1434
- handleToggle: sr,
1435
- handleKeyDown: ir,
1436
- handleListScroll: rr,
1437
- selectOption: _,
1438
- clear: N,
1439
- registerOption: j,
1440
- unregisterOption: P,
1441
- children: s,
1442
- placeholder: le,
1443
- className: R,
1444
- style: $,
1445
- duration: n,
1446
- easing: w,
1447
- offset: S,
1448
- animateOpacity: p,
1547
+ hasOptions: Q,
1548
+ hasActualValue: Re,
1549
+ highlightedIndex: Ee,
1550
+ animationFinished: m,
1551
+ disabled: xe,
1552
+ loading: me,
1553
+ error: we,
1554
+ setVisibility: I,
1555
+ setHighlightedIndex: ke,
1556
+ setAnimationFinished: w,
1557
+ handleBlur: Se,
1558
+ handleFocus: be,
1559
+ toggleVisibility: Ge,
1560
+ handleKeyDown: He,
1561
+ handleListScroll: je,
1562
+ selectOption: ce,
1563
+ clear: h,
1564
+ registerOption: p,
1565
+ unregisterOption: j,
1566
+ children: t,
1567
+ placeholder: Te,
1568
+ className: b,
1569
+ style: E,
1570
+ duration: g,
1571
+ easing: y,
1572
+ offset: d,
1573
+ animateOpacity: i,
1449
1574
  unmount: e,
1450
- ArrowIcon: E,
1451
- ClearIcon: K,
1452
- DelIcon: U,
1453
- hasMore: H,
1454
- loadButton: C
1575
+ ArrowIcon: k,
1576
+ ClearIcon: N,
1577
+ DelIcon: R,
1578
+ hasMore: L,
1579
+ loadButton: M,
1580
+ deleteInline: V
1455
1581
  }
1456
1582
  );
1457
- }), Ar = Ze(null), De = (e) => e ? typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(De).join(" ").replace(/\s+/g, " ").trim() : Be.isValidElement(e) ? De(e.props.children) : "" : "";
1458
- function Hr({ value: e, id: s, className: o, children: i, disabled: c, group: n }) {
1459
- const w = Ge(er), S = Ge(Ar), p = w?.registerOption, $ = w?.unregisterOption, R = Ye(), E = xe(() => s ? String(s) : R.replace(/:/g, ""), [s, R]);
1460
- return oe(() => {
1461
- if (!p) return;
1462
- const K = De(i), U = i != null;
1463
- let k = "";
1464
- return K ? k = K : s != null && s !== "" ? k = String(s) : e != null && e !== "" && (k = String(e)), p({
1465
- id: E,
1466
- value: e !== void 0 ? e : K,
1467
- label: k,
1468
- jsx: i,
1469
- hasJsx: U,
1583
+ }), yr = fr(null);
1584
+ function Gr({ children: e, name: t, label: o, value: s, id: c, emptyGroupText: g = "Empty group" }) {
1585
+ const y = Be(er), d = Ne(() => {
1586
+ const E = t ?? o ?? s ?? c;
1587
+ return E != null && E !== "" ? String(E) : g;
1588
+ }, [t, o, s, c, g]), i = Ne(() => `group-marker-${Ze(d)}`, [d]);
1589
+ return ue(() => {
1590
+ if (!y) return;
1591
+ const E = {
1592
+ id: i,
1593
+ group: d,
1594
+ isGroupMarker: !0,
1595
+ disabled: !0
1596
+ };
1597
+ return y.registerOption(E), () => y.unregisterOption(i);
1598
+ }, [y.registerOption, y.unregisterOption, i, d]), /* @__PURE__ */ u.jsx(yr.Provider, { value: d, children: e });
1599
+ }
1600
+ const Qe = (e) => e ? typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(Qe).join(" ").replace(/\s+/g, " ").trim() : dr.isValidElement(e) ? Qe(e.props.children) : "" : "";
1601
+ function Jr({ value: e, id: t, className: o, children: s, disabled: c, group: g }) {
1602
+ const y = Be(er), d = Be(yr), i = y?.registerOption, E = y?.unregisterOption, b = xr(), k = Ne(() => t ? String(t) : b.replace(/:/g, ""), [t, b]);
1603
+ return ue(() => {
1604
+ if (!i) return;
1605
+ const N = Qe(s), R = s != null;
1606
+ let F = "";
1607
+ return N ? F = N : t != null && t !== "" ? F = String(t) : e != null && e !== "" && (F = String(e)), i({
1608
+ id: k,
1609
+ value: e !== void 0 ? e : N,
1610
+ label: F,
1611
+ jsx: s,
1612
+ hasJsx: R,
1470
1613
  className: o,
1471
1614
  disabled: !!c,
1472
- group: n || S || null
1473
- }), () => $(E);
1474
- }, [E, e, i, o, c, n, S, p, $]), null;
1615
+ group: g || d || null
1616
+ }), () => E(k);
1617
+ }, [k, e, s, o, c, g, d, i, E]), null;
1475
1618
  }
1476
1619
  export {
1477
- Hr as Option,
1478
- Cr as Select
1620
+ Gr as OptGroup,
1621
+ Jr as Option,
1622
+ Dr as Select
1479
1623
  };