zudoku 0.6.2-dev.4 → 0.6.2-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/cli/dev/handler.js +5 -1
  2. package/dist/cli/dev/handler.js.map +1 -1
  3. package/dist/config/validators/InputSidebarSchema.d.ts +9 -0
  4. package/dist/config/validators/InputSidebarSchema.js +2 -0
  5. package/dist/config/validators/InputSidebarSchema.js.map +1 -1
  6. package/dist/config/validators/SidebarSchema.d.ts +9 -3
  7. package/dist/config/validators/SidebarSchema.js +7 -3
  8. package/dist/config/validators/SidebarSchema.js.map +1 -1
  9. package/dist/config/validators/validate.d.ts +26 -0
  10. package/dist/config/validators/validate.js +6 -0
  11. package/dist/config/validators/validate.js.map +1 -1
  12. package/dist/lib/components/navigation/SidebarCategory.js +5 -3
  13. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  14. package/dist/lib/components/navigation/SidebarItem.js +2 -2
  15. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  16. package/dist/lib/icons.d.ts +1 -0
  17. package/dist/lib/icons.js +2 -0
  18. package/dist/lib/icons.js.map +1 -0
  19. package/dist/lib/ui/Button.d.ts +2 -2
  20. package/dist/vite/plugin-icons.d.ts +3 -0
  21. package/dist/vite/plugin-icons.js +47 -0
  22. package/dist/vite/plugin-icons.js.map +1 -0
  23. package/dist/vite/plugin-sidebar.js +10 -1
  24. package/dist/vite/plugin-sidebar.js.map +1 -1
  25. package/dist/vite/plugin.js +2 -0
  26. package/dist/vite/plugin.js.map +1 -1
  27. package/dist/vite/prerender.js +23 -0
  28. package/dist/vite/prerender.js.map +1 -1
  29. package/lib/AuthenticationPlugin-BMjOjKqE.js +54 -0
  30. package/lib/{AuthenticationPlugin-DYnkydqa.js.map → AuthenticationPlugin-BMjOjKqE.js.map} +1 -1
  31. package/lib/CategoryHeading-BE8e6QdS.js +9 -0
  32. package/lib/{CategoryHeading-w2EW676o.js.map → CategoryHeading-BE8e6QdS.js.map} +1 -1
  33. package/lib/DeveloperHint-Bl9gIdNI.js +12 -0
  34. package/lib/{DeveloperHint-D87KcpDW.js.map → DeveloperHint-Bl9gIdNI.js.map} +1 -1
  35. package/lib/ErrorPage-CPR1XVKW.js +12 -0
  36. package/lib/{ErrorPage-BdHAg3Rg.js.map → ErrorPage-CPR1XVKW.js.map} +1 -1
  37. package/lib/Input-BBlyeDuG.js +2192 -0
  38. package/lib/Input-BBlyeDuG.js.map +1 -0
  39. package/lib/{Markdown-BZUoEvL7.js → Markdown-CCNihH_N.js} +3189 -3354
  40. package/lib/Markdown-CCNihH_N.js.map +1 -0
  41. package/lib/MdxPage-BavkYqzi.js +140 -0
  42. package/lib/MdxPage-BavkYqzi.js.map +1 -0
  43. package/lib/OperationList-C6Ps2keZ.js +460 -0
  44. package/lib/OperationList-C6Ps2keZ.js.map +1 -0
  45. package/lib/Route-xRJ9mJgH.js +13 -0
  46. package/lib/{Route-5sI-urRK.js.map → Route-xRJ9mJgH.js.map} +1 -1
  47. package/lib/{SidebarBadge-6EEz-Bwe.js → SidebarBadge-2JcxswKF.js} +47 -47
  48. package/lib/{SidebarBadge-6EEz-Bwe.js.map → SidebarBadge-2JcxswKF.js.map} +1 -1
  49. package/lib/SlotletProvider-CuB3Ts8r.js +213 -0
  50. package/lib/SlotletProvider-CuB3Ts8r.js.map +1 -0
  51. package/lib/Spinner-BlxzaFFF.js +6 -0
  52. package/lib/Spinner-BlxzaFFF.js.map +1 -0
  53. package/lib/{ZudokuContext-BHNQL3XO.js → ZudokuContext-JoyeA9dT.js} +78 -79
  54. package/lib/{ZudokuContext-BHNQL3XO.js.map → ZudokuContext-JoyeA9dT.js.map} +1 -1
  55. package/lib/{_commonjsHelpers-BVfed4GL.js → _commonjsHelpers-BkfeUUK-.js} +3 -3
  56. package/lib/_commonjsHelpers-BkfeUUK-.js.map +1 -0
  57. package/lib/{index-DdUotMOQ.js → index-BF4cn28H.js} +1953 -2196
  58. package/lib/index-BF4cn28H.js.map +1 -0
  59. package/lib/{index-BGY8VjAV.js → index-BLvMkqjO.js} +26 -26
  60. package/lib/{index-BGY8VjAV.js.map → index-BLvMkqjO.js.map} +1 -1
  61. package/lib/{index-CbJpF8Yf.js → index-G1-TGLO1.js} +8 -8
  62. package/lib/{index-CbJpF8Yf.js.map → index-G1-TGLO1.js.map} +1 -1
  63. package/lib/jsx-runtime-lNnQYwFN.js +2403 -0
  64. package/lib/jsx-runtime-lNnQYwFN.js.map +1 -0
  65. package/lib/{router-BiRCp01d.js → router-D2p7Olpn.js} +22 -22
  66. package/lib/{router-BiRCp01d.js.map → router-D2p7Olpn.js.map} +1 -1
  67. package/lib/{slugify-CiPVjteN.js → slugify-DbLhpSPt.js} +2 -2
  68. package/lib/{slugify-CiPVjteN.js.map → slugify-DbLhpSPt.js.map} +1 -1
  69. package/lib/{state-DsXXkBLH.js → state-lIwt9isb.js} +15 -15
  70. package/lib/{state-DsXXkBLH.js.map → state-lIwt9isb.js.map} +1 -1
  71. package/lib/{utils-BPHLKjns.js → utils-B8R4grFM.js} +152 -153
  72. package/lib/{utils-BPHLKjns.js.map → utils-B8R4grFM.js.map} +1 -1
  73. package/lib/zudoku.auth-auth0.js +16 -21
  74. package/lib/zudoku.auth-auth0.js.map +1 -1
  75. package/lib/zudoku.auth-clerk.js +32 -37
  76. package/lib/zudoku.auth-clerk.js.map +1 -1
  77. package/lib/zudoku.auth-openid.js +485 -505
  78. package/lib/zudoku.auth-openid.js.map +1 -1
  79. package/lib/zudoku.components.js +1574 -1782
  80. package/lib/zudoku.components.js.map +1 -1
  81. package/lib/zudoku.icons.js +2 -0
  82. package/lib/zudoku.icons.js.map +1 -0
  83. package/lib/zudoku.openapi-worker.js +2 -2
  84. package/lib/zudoku.plugin-api-keys.js +153 -268
  85. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  86. package/lib/zudoku.plugin-custom-page.js +5 -6
  87. package/lib/zudoku.plugin-custom-page.js.map +1 -1
  88. package/lib/zudoku.plugin-markdown.js +12 -13
  89. package/lib/zudoku.plugin-markdown.js.map +1 -1
  90. package/lib/zudoku.plugin-openapi.js +8 -8
  91. package/lib/zudoku.plugin-redirect.js +3 -3
  92. package/lib/zudoku.plugin-search-inkeep.js +20 -21
  93. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  94. package/package.json +7 -3
  95. package/src/lib/components/navigation/SidebarCategory.tsx +43 -31
  96. package/src/lib/components/navigation/SidebarItem.tsx +2 -1
  97. package/src/lib/icons.ts +1 -0
  98. package/lib/AuthenticationPlugin-DYnkydqa.js +0 -55
  99. package/lib/CategoryHeading-w2EW676o.js +0 -10
  100. package/lib/DeveloperHint-D87KcpDW.js +0 -16
  101. package/lib/ErrorPage-BdHAg3Rg.js +0 -18
  102. package/lib/Input-BmwltPfA.js +0 -2214
  103. package/lib/Input-BmwltPfA.js.map +0 -1
  104. package/lib/Markdown-BZUoEvL7.js.map +0 -1
  105. package/lib/MdxPage-E4NFxzHQ.js +0 -183
  106. package/lib/MdxPage-E4NFxzHQ.js.map +0 -1
  107. package/lib/OperationList-DVIuzHN7.js +0 -628
  108. package/lib/OperationList-DVIuzHN7.js.map +0 -1
  109. package/lib/Route-5sI-urRK.js +0 -14
  110. package/lib/SlotletProvider-CNyl5wU0.js +0 -262
  111. package/lib/SlotletProvider-CNyl5wU0.js.map +0 -1
  112. package/lib/Spinner-B9eFggre.js +0 -15
  113. package/lib/Spinner-B9eFggre.js.map +0 -1
  114. package/lib/_commonjsHelpers-BVfed4GL.js.map +0 -1
  115. package/lib/index-ChhUJhLT.js +0 -1771
  116. package/lib/index-ChhUJhLT.js.map +0 -1
  117. package/lib/index-DdUotMOQ.js.map +0 -1
  118. package/lib/jsx-runtime-B6kdoens.js +0 -635
  119. package/lib/jsx-runtime-B6kdoens.js.map +0 -1
@@ -0,0 +1,2192 @@
1
+ var zt = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var St = (e, r, t) => r.has(e) || zt("Cannot " + t);
5
+ var G = (e, r, t) => (St(e, r, "read from private field"), t ? t.call(e) : r.get(e)), Ue = (e, r, t) => r.has(e) ? zt("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(e) : r.set(e, t), He = (e, r, t, s) => (St(e, r, "write to private field"), s ? s.call(e, t) : r.set(e, t), t), We = (e, r, t) => (St(e, r, "access private method"), t);
6
+ import * as f from "react";
7
+ import I from "react";
8
+ import { n as fs, f as ps, c as hs, o as or, d as xe, A as ms, P as he, b as oe, e as Ne, i as ys, j as gs, R as vs, S as xs, F as Ss, D as _s, C as bs, a as Bt, p as ws, V as As, h as Cs, l as Es, g as Vs, u as Yt, q as Fs } from "./index-BLvMkqjO.js";
9
+ import { S as Ts, s as Rs, h as Xt, n as ar, a as Is, d as Ns, e as Ds } from "./ZudokuContext-JoyeA9dT.js";
10
+ import * as ir from "react-dom";
11
+ import { j as E } from "./jsx-runtime-lNnQYwFN.js";
12
+ import { ChevronDown as lr, ChevronUp as Ps, Check as ks } from "lucide-react";
13
+ import { a as Ve } from "./Markdown-CCNihH_N.js";
14
+ var Te, Re, ie, Ce, Ee, ot, Nt, nr, Ms = (nr = class extends Ts {
15
+ constructor(r, t) {
16
+ super();
17
+ Ue(this, Ee);
18
+ Ue(this, Te);
19
+ Ue(this, Re);
20
+ Ue(this, ie);
21
+ Ue(this, Ce);
22
+ He(this, Te, r), this.setOptions(t), this.bindMethods(), We(this, Ee, ot).call(this);
23
+ }
24
+ bindMethods() {
25
+ this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
26
+ }
27
+ setOptions(r) {
28
+ var s;
29
+ const t = this.options;
30
+ this.options = G(this, Te).defaultMutationOptions(r), Rs(this.options, t) || G(this, Te).getMutationCache().notify({
31
+ type: "observerOptionsUpdated",
32
+ mutation: G(this, ie),
33
+ observer: this
34
+ }), t != null && t.mutationKey && this.options.mutationKey && Xt(t.mutationKey) !== Xt(this.options.mutationKey) ? this.reset() : ((s = G(this, ie)) == null ? void 0 : s.state.status) === "pending" && G(this, ie).setOptions(this.options);
35
+ }
36
+ onUnsubscribe() {
37
+ var r;
38
+ this.hasListeners() || (r = G(this, ie)) == null || r.removeObserver(this);
39
+ }
40
+ onMutationUpdate(r) {
41
+ We(this, Ee, ot).call(this), We(this, Ee, Nt).call(this, r);
42
+ }
43
+ getCurrentResult() {
44
+ return G(this, Re);
45
+ }
46
+ reset() {
47
+ var r;
48
+ (r = G(this, ie)) == null || r.removeObserver(this), He(this, ie, void 0), We(this, Ee, ot).call(this), We(this, Ee, Nt).call(this);
49
+ }
50
+ mutate(r, t) {
51
+ var s;
52
+ return He(this, Ce, t), (s = G(this, ie)) == null || s.removeObserver(this), He(this, ie, G(this, Te).getMutationCache().build(G(this, Te), this.options)), G(this, ie).addObserver(this), G(this, ie).execute(r);
53
+ }
54
+ }, Te = new WeakMap(), Re = new WeakMap(), ie = new WeakMap(), Ce = new WeakMap(), Ee = new WeakSet(), ot = function() {
55
+ var t;
56
+ const r = ((t = G(this, ie)) == null ? void 0 : t.state) ?? fs();
57
+ He(this, Re, {
58
+ ...r,
59
+ isPending: r.status === "pending",
60
+ isSuccess: r.status === "success",
61
+ isError: r.status === "error",
62
+ isIdle: r.status === "idle",
63
+ mutate: this.mutate,
64
+ reset: this.reset
65
+ });
66
+ }, Nt = function(r) {
67
+ ar.batch(() => {
68
+ var t, s, o, a, l, c, d, S;
69
+ if (G(this, Ce) && this.hasListeners()) {
70
+ const m = G(this, Re).variables, y = G(this, Re).context;
71
+ (r == null ? void 0 : r.type) === "success" ? ((s = (t = G(this, Ce)).onSuccess) == null || s.call(t, r.data, m, y), (a = (o = G(this, Ce)).onSettled) == null || a.call(o, r.data, null, m, y)) : (r == null ? void 0 : r.type) === "error" && ((c = (l = G(this, Ce)).onError) == null || c.call(l, r.error, m, y), (S = (d = G(this, Ce)).onSettled) == null || S.call(
72
+ d,
73
+ void 0,
74
+ r.error,
75
+ m,
76
+ y
77
+ ));
78
+ }
79
+ this.listeners.forEach((m) => {
80
+ m(G(this, Re));
81
+ });
82
+ });
83
+ }, nr);
84
+ function Bn(e, r) {
85
+ const t = Is(), [s] = f.useState(
86
+ () => new Ms(
87
+ t,
88
+ e
89
+ )
90
+ );
91
+ f.useEffect(() => {
92
+ s.setOptions(e);
93
+ }, [s, e]);
94
+ const o = f.useSyncExternalStore(
95
+ f.useCallback(
96
+ (l) => s.subscribe(ar.batchCalls(l)),
97
+ [s]
98
+ ),
99
+ () => s.getCurrentResult(),
100
+ () => s.getCurrentResult()
101
+ ), a = f.useCallback(
102
+ (l, c) => {
103
+ s.mutate(l, c).catch(Ns);
104
+ },
105
+ [s]
106
+ );
107
+ if (o.error && Ds(s.options.throwOnError, [o.error]))
108
+ throw o.error;
109
+ return { ...o, mutate: a, mutateAsync: o.mutate };
110
+ }
111
+ var Qe = (e) => e.type === "checkbox", $e = (e) => e instanceof Date, ne = (e) => e == null;
112
+ const cr = (e) => typeof e == "object";
113
+ var re = (e) => !ne(e) && !Array.isArray(e) && cr(e) && !$e(e), ur = (e) => re(e) && e.target ? Qe(e.target) ? e.target.checked : e.target.value : e, Os = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, dr = (e, r) => e.has(Os(r)), Ls = (e) => {
114
+ const r = e.constructor && e.constructor.prototype;
115
+ return re(r) && r.hasOwnProperty("isPrototypeOf");
116
+ }, Ut = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
117
+ function te(e) {
118
+ let r;
119
+ const t = Array.isArray(e);
120
+ if (e instanceof Date)
121
+ r = new Date(e);
122
+ else if (e instanceof Set)
123
+ r = new Set(e);
124
+ else if (!(Ut && (e instanceof Blob || e instanceof FileList)) && (t || re(e)))
125
+ if (r = t ? [] : {}, !t && !Ls(e))
126
+ r = e;
127
+ else
128
+ for (const s in e)
129
+ e.hasOwnProperty(s) && (r[s] = te(e[s]));
130
+ else
131
+ return e;
132
+ return r;
133
+ }
134
+ var Je = (e) => Array.isArray(e) ? e.filter(Boolean) : [], $ = (e) => e === void 0, h = (e, r, t) => {
135
+ if (!r || !re(e))
136
+ return t;
137
+ const s = Je(r.split(/[,[\].]+?/)).reduce((o, a) => ne(o) ? o : o[a], e);
138
+ return $(s) || s === e ? $(e[r]) ? t : e[r] : s;
139
+ }, ge = (e) => typeof e == "boolean", Ht = (e) => /^\w*$/.test(e), fr = (e) => Je(e.replace(/["|']|\]/g, "").split(/\.|\[/)), H = (e, r, t) => {
140
+ let s = -1;
141
+ const o = Ht(r) ? [r] : fr(r), a = o.length, l = a - 1;
142
+ for (; ++s < a; ) {
143
+ const c = o[s];
144
+ let d = t;
145
+ if (s !== l) {
146
+ const S = e[c];
147
+ d = re(S) || Array.isArray(S) ? S : isNaN(+o[s + 1]) ? {} : [];
148
+ }
149
+ if (c === "__proto__")
150
+ return;
151
+ e[c] = d, e = e[c];
152
+ }
153
+ return e;
154
+ };
155
+ const it = {
156
+ BLUR: "blur",
157
+ FOCUS_OUT: "focusout",
158
+ CHANGE: "change"
159
+ }, pe = {
160
+ onBlur: "onBlur",
161
+ onChange: "onChange",
162
+ onSubmit: "onSubmit",
163
+ onTouched: "onTouched",
164
+ all: "all"
165
+ }, we = {
166
+ max: "max",
167
+ min: "min",
168
+ maxLength: "maxLength",
169
+ minLength: "minLength",
170
+ pattern: "pattern",
171
+ required: "required",
172
+ validate: "validate"
173
+ }, pr = I.createContext(null), pt = () => I.useContext(pr), Un = (e) => {
174
+ const { children: r, ...t } = e;
175
+ return I.createElement(pr.Provider, { value: t }, r);
176
+ };
177
+ var hr = (e, r, t, s = !0) => {
178
+ const o = {
179
+ defaultValues: r._defaultValues
180
+ };
181
+ for (const a in e)
182
+ Object.defineProperty(o, a, {
183
+ get: () => {
184
+ const l = a;
185
+ return r._proxyFormState[l] !== pe.all && (r._proxyFormState[l] = !s || pe.all), t && (t[l] = !0), e[l];
186
+ }
187
+ });
188
+ return o;
189
+ }, le = (e) => re(e) && !Object.keys(e).length, mr = (e, r, t, s) => {
190
+ t(e);
191
+ const { name: o, ...a } = e;
192
+ return le(a) || Object.keys(a).length >= Object.keys(r).length || Object.keys(a).find((l) => r[l] === (!s || pe.all));
193
+ }, ce = (e) => Array.isArray(e) ? e : [e], yr = (e, r, t) => !e || !r || e === r || ce(e).some((s) => s && (t ? s === r : s.startsWith(r) || r.startsWith(s)));
194
+ function ht(e) {
195
+ const r = I.useRef(e);
196
+ r.current = e, I.useEffect(() => {
197
+ const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
198
+ next: r.current.next
199
+ });
200
+ return () => {
201
+ t && t.unsubscribe();
202
+ };
203
+ }, [e.disabled]);
204
+ }
205
+ function js(e) {
206
+ const r = pt(), { control: t = r.control, disabled: s, name: o, exact: a } = e || {}, [l, c] = I.useState(t._formState), d = I.useRef(!0), S = I.useRef({
207
+ isDirty: !1,
208
+ isLoading: !1,
209
+ dirtyFields: !1,
210
+ touchedFields: !1,
211
+ validatingFields: !1,
212
+ isValidating: !1,
213
+ isValid: !1,
214
+ errors: !1
215
+ }), m = I.useRef(o);
216
+ return m.current = o, ht({
217
+ disabled: s,
218
+ next: (y) => d.current && yr(m.current, y.name, a) && mr(y, S.current, t._updateFormState) && c({
219
+ ...t._formState,
220
+ ...y
221
+ }),
222
+ subject: t._subjects.state
223
+ }), I.useEffect(() => (d.current = !0, S.current.isValid && t._updateValid(!0), () => {
224
+ d.current = !1;
225
+ }), [t]), hr(l, t, S.current, !1);
226
+ }
227
+ var ve = (e) => typeof e == "string", gr = (e, r, t, s, o) => ve(e) ? (s && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((a) => (s && r.watch.add(a), h(t, a))) : (s && (r.watchAll = !0), t);
228
+ function Bs(e) {
229
+ const r = pt(), { control: t = r.control, name: s, defaultValue: o, disabled: a, exact: l } = e || {}, c = I.useRef(s);
230
+ c.current = s, ht({
231
+ disabled: a,
232
+ subject: t._subjects.values,
233
+ next: (m) => {
234
+ yr(c.current, m.name, l) && S(te(gr(c.current, t._names, m.values || t._formValues, !1, o)));
235
+ }
236
+ });
237
+ const [d, S] = I.useState(t._getWatch(s, o));
238
+ return I.useEffect(() => t._removeUnmounted()), d;
239
+ }
240
+ function Us(e) {
241
+ const r = pt(), { name: t, disabled: s, control: o = r.control, shouldUnregister: a } = e, l = dr(o._names.array, t), c = Bs({
242
+ control: o,
243
+ name: t,
244
+ defaultValue: h(o._formValues, t, h(o._defaultValues, t, e.defaultValue)),
245
+ exact: !0
246
+ }), d = js({
247
+ control: o,
248
+ name: t
249
+ }), S = I.useRef(o.register(t, {
250
+ ...e.rules,
251
+ value: c,
252
+ ...ge(e.disabled) ? { disabled: e.disabled } : {}
253
+ }));
254
+ return I.useEffect(() => {
255
+ const m = o._options.shouldUnregister || a, y = (V, O) => {
256
+ const b = h(o._fields, V);
257
+ b && b._f && (b._f.mount = O);
258
+ };
259
+ if (y(t, !0), m) {
260
+ const V = te(h(o._options.defaultValues, t));
261
+ H(o._defaultValues, t, V), $(h(o._formValues, t)) && H(o._formValues, t, V);
262
+ }
263
+ return () => {
264
+ (l ? m && !o._state.action : m) ? o.unregister(t) : y(t, !1);
265
+ };
266
+ }, [t, o, l, a]), I.useEffect(() => {
267
+ h(o._fields, t) && o._updateDisabledField({
268
+ disabled: s,
269
+ fields: o._fields,
270
+ name: t,
271
+ value: h(o._fields, t)._f.value
272
+ });
273
+ }, [s, t, o]), {
274
+ field: {
275
+ name: t,
276
+ value: c,
277
+ ...ge(s) || d.disabled ? { disabled: d.disabled || s } : {},
278
+ onChange: I.useCallback((m) => S.current.onChange({
279
+ target: {
280
+ value: ur(m),
281
+ name: t
282
+ },
283
+ type: it.CHANGE
284
+ }), [t]),
285
+ onBlur: I.useCallback(() => S.current.onBlur({
286
+ target: {
287
+ value: h(o._formValues, t),
288
+ name: t
289
+ },
290
+ type: it.BLUR
291
+ }), [t, o]),
292
+ ref: (m) => {
293
+ const y = h(o._fields, t);
294
+ y && m && (y._f.ref = {
295
+ focus: () => m.focus(),
296
+ select: () => m.select(),
297
+ setCustomValidity: (V) => m.setCustomValidity(V),
298
+ reportValidity: () => m.reportValidity()
299
+ });
300
+ }
301
+ },
302
+ formState: d,
303
+ fieldState: Object.defineProperties({}, {
304
+ invalid: {
305
+ enumerable: !0,
306
+ get: () => !!h(d.errors, t)
307
+ },
308
+ isDirty: {
309
+ enumerable: !0,
310
+ get: () => !!h(d.dirtyFields, t)
311
+ },
312
+ isTouched: {
313
+ enumerable: !0,
314
+ get: () => !!h(d.touchedFields, t)
315
+ },
316
+ isValidating: {
317
+ enumerable: !0,
318
+ get: () => !!h(d.validatingFields, t)
319
+ },
320
+ error: {
321
+ enumerable: !0,
322
+ get: () => h(d.errors, t)
323
+ }
324
+ })
325
+ };
326
+ }
327
+ const Hn = (e) => e.render(Us(e));
328
+ var Hs = (e, r, t, s, o) => r ? {
329
+ ...t[e],
330
+ types: {
331
+ ...t[e] && t[e].types ? t[e].types : {},
332
+ [s]: o || !0
333
+ }
334
+ } : {}, Fe = () => {
335
+ const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
336
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
337
+ const t = (Math.random() * 16 + e) % 16 | 0;
338
+ return (r == "x" ? t : t & 3 | 8).toString(16);
339
+ });
340
+ }, _t = (e, r, t = {}) => t.shouldFocus || $(t.shouldFocus) ? t.focusName || `${e}.${$(t.focusIndex) ? r : t.focusIndex}.` : "", Ze = (e) => ({
341
+ isOnSubmit: !e || e === pe.onSubmit,
342
+ isOnBlur: e === pe.onBlur,
343
+ isOnChange: e === pe.onChange,
344
+ isOnAll: e === pe.all,
345
+ isOnTouch: e === pe.onTouched
346
+ }), Dt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
347
+ const qe = (e, r, t, s) => {
348
+ for (const o of t || Object.keys(e)) {
349
+ const a = h(e, o);
350
+ if (a) {
351
+ const { _f: l, ...c } = a;
352
+ if (l) {
353
+ if (l.refs && l.refs[0] && r(l.refs[0], o) && !s)
354
+ break;
355
+ if (l.ref && r(l.ref, l.name) && !s)
356
+ break;
357
+ qe(c, r);
358
+ } else re(c) && qe(c, r);
359
+ }
360
+ }
361
+ };
362
+ var vr = (e, r, t) => {
363
+ const s = ce(h(e, t));
364
+ return H(s, "root", r[t]), H(e, t, s), e;
365
+ }, Wt = (e) => e.type === "file", Ie = (e) => typeof e == "function", lt = (e) => {
366
+ if (!Ut)
367
+ return !1;
368
+ const r = e ? e.ownerDocument : 0;
369
+ return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
370
+ }, at = (e) => ve(e), Kt = (e) => e.type === "radio", ct = (e) => e instanceof RegExp;
371
+ const Zt = {
372
+ value: !1,
373
+ isValid: !1
374
+ }, Qt = { value: !0, isValid: !0 };
375
+ var xr = (e) => {
376
+ if (Array.isArray(e)) {
377
+ if (e.length > 1) {
378
+ const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
379
+ return { value: r, isValid: !!r.length };
380
+ }
381
+ return e[0].checked && !e[0].disabled ? (
382
+ // @ts-expect-error expected to work in the browser
383
+ e[0].attributes && !$(e[0].attributes.value) ? $(e[0].value) || e[0].value === "" ? Qt : { value: e[0].value, isValid: !0 } : Qt
384
+ ) : Zt;
385
+ }
386
+ return Zt;
387
+ };
388
+ const Jt = {
389
+ isValid: !1,
390
+ value: null
391
+ };
392
+ var Sr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
393
+ isValid: !0,
394
+ value: t.value
395
+ } : r, Jt) : Jt;
396
+ function er(e, r, t = "validate") {
397
+ if (at(e) || Array.isArray(e) && e.every(at) || ge(e) && !e)
398
+ return {
399
+ type: t,
400
+ message: at(e) ? e : "",
401
+ ref: r
402
+ };
403
+ }
404
+ var Ke = (e) => re(e) && !ct(e) ? e : {
405
+ value: e,
406
+ message: ""
407
+ }, Pt = async (e, r, t, s, o) => {
408
+ const { ref: a, refs: l, required: c, maxLength: d, minLength: S, min: m, max: y, pattern: V, validate: O, name: b, valueAsNumber: P, mount: M, disabled: T } = e._f, g = h(r, b);
409
+ if (!M || T)
410
+ return {};
411
+ const D = l ? l[0] : a, Z = (F) => {
412
+ s && D.reportValidity && (D.setCustomValidity(ge(F) ? "" : F || ""), D.reportValidity());
413
+ }, v = {}, w = Kt(a), C = Qe(a), k = w || C, Q = (P || Wt(a)) && $(a.value) && $(g) || lt(a) && a.value === "" || g === "" || Array.isArray(g) && !g.length, z = Hs.bind(null, b, t, v), de = (F, N, B, L = we.maxLength, Y = we.minLength) => {
414
+ const X = F ? N : B;
415
+ v[b] = {
416
+ type: F ? L : Y,
417
+ message: X,
418
+ ref: a,
419
+ ...z(F ? L : Y, X)
420
+ };
421
+ };
422
+ if (o ? !Array.isArray(g) || !g.length : c && (!k && (Q || ne(g)) || ge(g) && !g || C && !xr(l).isValid || w && !Sr(l).isValid)) {
423
+ const { value: F, message: N } = at(c) ? { value: !!c, message: c } : Ke(c);
424
+ if (F && (v[b] = {
425
+ type: we.required,
426
+ message: N,
427
+ ref: D,
428
+ ...z(we.required, N)
429
+ }, !t))
430
+ return Z(N), v;
431
+ }
432
+ if (!Q && (!ne(m) || !ne(y))) {
433
+ let F, N;
434
+ const B = Ke(y), L = Ke(m);
435
+ if (!ne(g) && !isNaN(g)) {
436
+ const Y = a.valueAsNumber || g && +g;
437
+ ne(B.value) || (F = Y > B.value), ne(L.value) || (N = Y < L.value);
438
+ } else {
439
+ const Y = a.valueAsDate || new Date(g), X = (Se) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Se), fe = a.type == "time", ae = a.type == "week";
440
+ ve(B.value) && g && (F = fe ? X(g) > X(B.value) : ae ? g > B.value : Y > new Date(B.value)), ve(L.value) && g && (N = fe ? X(g) < X(L.value) : ae ? g < L.value : Y < new Date(L.value));
441
+ }
442
+ if ((F || N) && (de(!!F, B.message, L.message, we.max, we.min), !t))
443
+ return Z(v[b].message), v;
444
+ }
445
+ if ((d || S) && !Q && (ve(g) || o && Array.isArray(g))) {
446
+ const F = Ke(d), N = Ke(S), B = !ne(F.value) && g.length > +F.value, L = !ne(N.value) && g.length < +N.value;
447
+ if ((B || L) && (de(B, F.message, N.message), !t))
448
+ return Z(v[b].message), v;
449
+ }
450
+ if (V && !Q && ve(g)) {
451
+ const { value: F, message: N } = Ke(V);
452
+ if (ct(F) && !g.match(F) && (v[b] = {
453
+ type: we.pattern,
454
+ message: N,
455
+ ref: a,
456
+ ...z(we.pattern, N)
457
+ }, !t))
458
+ return Z(N), v;
459
+ }
460
+ if (O) {
461
+ if (Ie(O)) {
462
+ const F = await O(g, r), N = er(F, D);
463
+ if (N && (v[b] = {
464
+ ...N,
465
+ ...z(we.validate, N.message)
466
+ }, !t))
467
+ return Z(N.message), v;
468
+ } else if (re(O)) {
469
+ let F = {};
470
+ for (const N in O) {
471
+ if (!le(F) && !t)
472
+ break;
473
+ const B = er(await O[N](g, r), D, N);
474
+ B && (F = {
475
+ ...B,
476
+ ...z(N, B.message)
477
+ }, Z(B.message), t && (v[b] = F));
478
+ }
479
+ if (!le(F) && (v[b] = {
480
+ ref: D,
481
+ ...F
482
+ }, !t))
483
+ return v;
484
+ }
485
+ }
486
+ return Z(!0), v;
487
+ }, bt = (e, r) => [
488
+ ...e,
489
+ ...ce(r)
490
+ ], wt = (e) => Array.isArray(e) ? e.map(() => {
491
+ }) : void 0;
492
+ function At(e, r, t) {
493
+ return [
494
+ ...e.slice(0, r),
495
+ ...ce(t),
496
+ ...e.slice(r)
497
+ ];
498
+ }
499
+ var Ct = (e, r, t) => Array.isArray(e) ? ($(e[t]) && (e[t] = void 0), e.splice(t, 0, e.splice(r, 1)[0]), e) : [], Et = (e, r) => [
500
+ ...ce(r),
501
+ ...ce(e)
502
+ ];
503
+ function Ws(e, r) {
504
+ let t = 0;
505
+ const s = [...e];
506
+ for (const o of r)
507
+ s.splice(o - t, 1), t++;
508
+ return Je(s).length ? s : [];
509
+ }
510
+ var Vt = (e, r) => $(r) ? [] : Ws(e, ce(r).sort((t, s) => t - s)), Ft = (e, r, t) => {
511
+ [e[r], e[t]] = [e[t], e[r]];
512
+ };
513
+ function Ks(e, r) {
514
+ const t = r.slice(0, -1).length;
515
+ let s = 0;
516
+ for (; s < t; )
517
+ e = $(e) ? s++ : e[r[s++]];
518
+ return e;
519
+ }
520
+ function $s(e) {
521
+ for (const r in e)
522
+ if (e.hasOwnProperty(r) && !$(e[r]))
523
+ return !1;
524
+ return !0;
525
+ }
526
+ function ee(e, r) {
527
+ const t = Array.isArray(r) ? r : Ht(r) ? [r] : fr(r), s = t.length === 1 ? e : Ks(e, t), o = t.length - 1, a = t[o];
528
+ return s && delete s[a], o !== 0 && (re(s) && le(s) || Array.isArray(s) && $s(s)) && ee(e, t.slice(0, -1)), e;
529
+ }
530
+ var tr = (e, r, t) => (e[r] = t, e);
531
+ function Wn(e) {
532
+ const r = pt(), { control: t = r.control, name: s, keyName: o = "id", shouldUnregister: a } = e, [l, c] = I.useState(t._getFieldArray(s)), d = I.useRef(t._getFieldArray(s).map(Fe)), S = I.useRef(l), m = I.useRef(s), y = I.useRef(!1);
533
+ m.current = s, S.current = l, t._names.array.add(s), e.rules && t.register(s, e.rules), ht({
534
+ next: ({ values: v, name: w }) => {
535
+ if (w === m.current || !w) {
536
+ const C = h(v, m.current);
537
+ Array.isArray(C) && (c(C), d.current = C.map(Fe));
538
+ }
539
+ },
540
+ subject: t._subjects.array
541
+ });
542
+ const V = I.useCallback((v) => {
543
+ y.current = !0, t._updateFieldArray(s, v);
544
+ }, [t, s]), O = (v, w) => {
545
+ const C = ce(te(v)), k = bt(t._getFieldArray(s), C);
546
+ t._names.focus = _t(s, k.length - 1, w), d.current = bt(d.current, C.map(Fe)), V(k), c(k), t._updateFieldArray(s, k, bt, {
547
+ argA: wt(v)
548
+ });
549
+ }, b = (v, w) => {
550
+ const C = ce(te(v)), k = Et(t._getFieldArray(s), C);
551
+ t._names.focus = _t(s, 0, w), d.current = Et(d.current, C.map(Fe)), V(k), c(k), t._updateFieldArray(s, k, Et, {
552
+ argA: wt(v)
553
+ });
554
+ }, P = (v) => {
555
+ const w = Vt(t._getFieldArray(s), v);
556
+ d.current = Vt(d.current, v), V(w), c(w), t._updateFieldArray(s, w, Vt, {
557
+ argA: v
558
+ });
559
+ }, M = (v, w, C) => {
560
+ const k = ce(te(w)), Q = At(t._getFieldArray(s), v, k);
561
+ t._names.focus = _t(s, v, C), d.current = At(d.current, v, k.map(Fe)), V(Q), c(Q), t._updateFieldArray(s, Q, At, {
562
+ argA: v,
563
+ argB: wt(w)
564
+ });
565
+ }, T = (v, w) => {
566
+ const C = t._getFieldArray(s);
567
+ Ft(C, v, w), Ft(d.current, v, w), V(C), c(C), t._updateFieldArray(s, C, Ft, {
568
+ argA: v,
569
+ argB: w
570
+ }, !1);
571
+ }, g = (v, w) => {
572
+ const C = t._getFieldArray(s);
573
+ Ct(C, v, w), Ct(d.current, v, w), V(C), c(C), t._updateFieldArray(s, C, Ct, {
574
+ argA: v,
575
+ argB: w
576
+ }, !1);
577
+ }, D = (v, w) => {
578
+ const C = te(w), k = tr(t._getFieldArray(s), v, C);
579
+ d.current = [...k].map((Q, z) => !Q || z === v ? Fe() : d.current[z]), V(k), c([...k]), t._updateFieldArray(s, k, tr, {
580
+ argA: v,
581
+ argB: C
582
+ }, !0, !1);
583
+ }, Z = (v) => {
584
+ const w = ce(te(v));
585
+ d.current = w.map(Fe), V([...w]), c([...w]), t._updateFieldArray(s, [...w], (C) => C, {}, !0, !1);
586
+ };
587
+ return I.useEffect(() => {
588
+ if (t._state.action = !1, Dt(s, t._names) && t._subjects.state.next({
589
+ ...t._formState
590
+ }), y.current && (!Ze(t._options.mode).isOnSubmit || t._formState.isSubmitted))
591
+ if (t._options.resolver)
592
+ t._executeSchema([s]).then((v) => {
593
+ const w = h(v.errors, s), C = h(t._formState.errors, s);
594
+ (C ? !w && C.type || w && (C.type !== w.type || C.message !== w.message) : w && w.type) && (w ? H(t._formState.errors, s, w) : ee(t._formState.errors, s), t._subjects.state.next({
595
+ errors: t._formState.errors
596
+ }));
597
+ });
598
+ else {
599
+ const v = h(t._fields, s);
600
+ v && v._f && !(Ze(t._options.reValidateMode).isOnSubmit && Ze(t._options.mode).isOnSubmit) && Pt(v, t._formValues, t._options.criteriaMode === pe.all, t._options.shouldUseNativeValidation, !0).then((w) => !le(w) && t._subjects.state.next({
601
+ errors: vr(t._formState.errors, w, s)
602
+ }));
603
+ }
604
+ t._subjects.values.next({
605
+ name: s,
606
+ values: { ...t._formValues }
607
+ }), t._names.focus && qe(t._fields, (v, w) => {
608
+ if (t._names.focus && w.startsWith(t._names.focus) && v.focus)
609
+ return v.focus(), 1;
610
+ }), t._names.focus = "", t._updateValid(), y.current = !1;
611
+ }, [l, s, t]), I.useEffect(() => (!h(t._formValues, s) && t._updateFieldArray(s), () => {
612
+ (t._options.shouldUnregister || a) && t.unregister(s);
613
+ }), [s, t, o, a]), {
614
+ swap: I.useCallback(T, [V, s, t]),
615
+ move: I.useCallback(g, [V, s, t]),
616
+ prepend: I.useCallback(b, [V, s, t]),
617
+ append: I.useCallback(O, [V, s, t]),
618
+ remove: I.useCallback(P, [V, s, t]),
619
+ insert: I.useCallback(M, [V, s, t]),
620
+ update: I.useCallback(D, [V, s, t]),
621
+ replace: I.useCallback(Z, [V, s, t]),
622
+ fields: I.useMemo(() => l.map((v, w) => ({
623
+ ...v,
624
+ [o]: d.current[w] || Fe()
625
+ })), [l, o])
626
+ };
627
+ }
628
+ var Tt = () => {
629
+ let e = [];
630
+ return {
631
+ get observers() {
632
+ return e;
633
+ },
634
+ next: (o) => {
635
+ for (const a of e)
636
+ a.next && a.next(o);
637
+ },
638
+ subscribe: (o) => (e.push(o), {
639
+ unsubscribe: () => {
640
+ e = e.filter((a) => a !== o);
641
+ }
642
+ }),
643
+ unsubscribe: () => {
644
+ e = [];
645
+ }
646
+ };
647
+ }, ut = (e) => ne(e) || !cr(e);
648
+ function Me(e, r) {
649
+ if (ut(e) || ut(r))
650
+ return e === r;
651
+ if ($e(e) && $e(r))
652
+ return e.getTime() === r.getTime();
653
+ const t = Object.keys(e), s = Object.keys(r);
654
+ if (t.length !== s.length)
655
+ return !1;
656
+ for (const o of t) {
657
+ const a = e[o];
658
+ if (!s.includes(o))
659
+ return !1;
660
+ if (o !== "ref") {
661
+ const l = r[o];
662
+ if ($e(a) && $e(l) || re(a) && re(l) || Array.isArray(a) && Array.isArray(l) ? !Me(a, l) : a !== l)
663
+ return !1;
664
+ }
665
+ }
666
+ return !0;
667
+ }
668
+ var _r = (e) => e.type === "select-multiple", qs = (e) => Kt(e) || Qe(e), Rt = (e) => lt(e) && e.isConnected, br = (e) => {
669
+ for (const r in e)
670
+ if (Ie(e[r]))
671
+ return !0;
672
+ return !1;
673
+ };
674
+ function dt(e, r = {}) {
675
+ const t = Array.isArray(e);
676
+ if (re(e) || t)
677
+ for (const s in e)
678
+ Array.isArray(e[s]) || re(e[s]) && !br(e[s]) ? (r[s] = Array.isArray(e[s]) ? [] : {}, dt(e[s], r[s])) : ne(e[s]) || (r[s] = !0);
679
+ return r;
680
+ }
681
+ function wr(e, r, t) {
682
+ const s = Array.isArray(e);
683
+ if (re(e) || s)
684
+ for (const o in e)
685
+ Array.isArray(e[o]) || re(e[o]) && !br(e[o]) ? $(r) || ut(t[o]) ? t[o] = Array.isArray(e[o]) ? dt(e[o], []) : { ...dt(e[o]) } : wr(e[o], ne(r) ? {} : r[o], t[o]) : t[o] = !Me(e[o], r[o]);
686
+ return t;
687
+ }
688
+ var nt = (e, r) => wr(e, r, dt(r)), Ar = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: s }) => $(e) ? e : r ? e === "" ? NaN : e && +e : t && ve(e) ? new Date(e) : s ? s(e) : e;
689
+ function It(e) {
690
+ const r = e.ref;
691
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : r.disabled))
692
+ return Wt(r) ? r.files : Kt(r) ? Sr(e.refs).value : _r(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Qe(r) ? xr(e.refs).value : Ar($(r.value) ? e.ref.value : r.value, e);
693
+ }
694
+ var Gs = (e, r, t, s) => {
695
+ const o = {};
696
+ for (const a of e) {
697
+ const l = h(r, a);
698
+ l && H(o, a, l._f);
699
+ }
700
+ return {
701
+ criteriaMode: t,
702
+ names: [...e],
703
+ fields: o,
704
+ shouldUseNativeValidation: s
705
+ };
706
+ }, Ye = (e) => $(e) ? e : ct(e) ? e.source : re(e) ? ct(e.value) ? e.value.source : e.value : e, zs = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
707
+ function rr(e, r, t) {
708
+ const s = h(e, t);
709
+ if (s || Ht(t))
710
+ return {
711
+ error: s,
712
+ name: t
713
+ };
714
+ const o = t.split(".");
715
+ for (; o.length; ) {
716
+ const a = o.join("."), l = h(r, a), c = h(e, a);
717
+ if (l && !Array.isArray(l) && t !== a)
718
+ return { name: t };
719
+ if (c && c.type)
720
+ return {
721
+ name: a,
722
+ error: c
723
+ };
724
+ o.pop();
725
+ }
726
+ return {
727
+ name: t
728
+ };
729
+ }
730
+ var Ys = (e, r, t, s, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? s.isOnBlur : o.isOnBlur) ? !e : (t ? s.isOnChange : o.isOnChange) ? e : !0, Xs = (e, r) => !Je(h(e, r)).length && ee(e, r);
731
+ const Zs = {
732
+ mode: pe.onSubmit,
733
+ reValidateMode: pe.onChange,
734
+ shouldFocusError: !0
735
+ };
736
+ function Qs(e = {}) {
737
+ let r = {
738
+ ...Zs,
739
+ ...e
740
+ }, t = {
741
+ submitCount: 0,
742
+ isDirty: !1,
743
+ isLoading: Ie(r.defaultValues),
744
+ isValidating: !1,
745
+ isSubmitted: !1,
746
+ isSubmitting: !1,
747
+ isSubmitSuccessful: !1,
748
+ isValid: !1,
749
+ touchedFields: {},
750
+ dirtyFields: {},
751
+ validatingFields: {},
752
+ errors: r.errors || {},
753
+ disabled: r.disabled || !1
754
+ }, s = {}, o = re(r.defaultValues) || re(r.values) ? te(r.defaultValues || r.values) || {} : {}, a = r.shouldUnregister ? {} : te(o), l = {
755
+ action: !1,
756
+ mount: !1,
757
+ watch: !1
758
+ }, c = {
759
+ mount: /* @__PURE__ */ new Set(),
760
+ unMount: /* @__PURE__ */ new Set(),
761
+ array: /* @__PURE__ */ new Set(),
762
+ watch: /* @__PURE__ */ new Set()
763
+ }, d, S = 0;
764
+ const m = {
765
+ isDirty: !1,
766
+ dirtyFields: !1,
767
+ validatingFields: !1,
768
+ touchedFields: !1,
769
+ isValidating: !1,
770
+ isValid: !1,
771
+ errors: !1
772
+ }, y = {
773
+ values: Tt(),
774
+ array: Tt(),
775
+ state: Tt()
776
+ }, V = Ze(r.mode), O = Ze(r.reValidateMode), b = r.criteriaMode === pe.all, P = (n) => (i) => {
777
+ clearTimeout(S), S = setTimeout(n, i);
778
+ }, M = async (n) => {
779
+ if (m.isValid || n) {
780
+ const i = r.resolver ? le((await k()).errors) : await z(s, !0);
781
+ i !== t.isValid && y.state.next({
782
+ isValid: i
783
+ });
784
+ }
785
+ }, T = (n, i) => {
786
+ (m.isValidating || m.validatingFields) && ((n || Array.from(c.mount)).forEach((u) => {
787
+ u && (i ? H(t.validatingFields, u, i) : ee(t.validatingFields, u));
788
+ }), y.state.next({
789
+ validatingFields: t.validatingFields,
790
+ isValidating: !le(t.validatingFields)
791
+ }));
792
+ }, g = (n, i = [], u, _, x = !0, p = !0) => {
793
+ if (_ && u) {
794
+ if (l.action = !0, p && Array.isArray(h(s, n))) {
795
+ const A = u(h(s, n), _.argA, _.argB);
796
+ x && H(s, n, A);
797
+ }
798
+ if (p && Array.isArray(h(t.errors, n))) {
799
+ const A = u(h(t.errors, n), _.argA, _.argB);
800
+ x && H(t.errors, n, A), Xs(t.errors, n);
801
+ }
802
+ if (m.touchedFields && p && Array.isArray(h(t.touchedFields, n))) {
803
+ const A = u(h(t.touchedFields, n), _.argA, _.argB);
804
+ x && H(t.touchedFields, n, A);
805
+ }
806
+ m.dirtyFields && (t.dirtyFields = nt(o, a)), y.state.next({
807
+ name: n,
808
+ isDirty: F(n, i),
809
+ dirtyFields: t.dirtyFields,
810
+ errors: t.errors,
811
+ isValid: t.isValid
812
+ });
813
+ } else
814
+ H(a, n, i);
815
+ }, D = (n, i) => {
816
+ H(t.errors, n, i), y.state.next({
817
+ errors: t.errors
818
+ });
819
+ }, Z = (n) => {
820
+ t.errors = n, y.state.next({
821
+ errors: t.errors,
822
+ isValid: !1
823
+ });
824
+ }, v = (n, i, u, _) => {
825
+ const x = h(s, n);
826
+ if (x) {
827
+ const p = h(a, n, $(u) ? h(o, n) : u);
828
+ $(p) || _ && _.defaultChecked || i ? H(a, n, i ? p : It(x._f)) : L(n, p), l.mount && M();
829
+ }
830
+ }, w = (n, i, u, _, x) => {
831
+ let p = !1, A = !1;
832
+ const j = {
833
+ name: n
834
+ }, J = !!(h(s, n) && h(s, n)._f && h(s, n)._f.disabled);
835
+ if (!u || _) {
836
+ m.isDirty && (A = t.isDirty, t.isDirty = j.isDirty = F(), p = A !== j.isDirty);
837
+ const ue = J || Me(h(o, n), i);
838
+ A = !!(!J && h(t.dirtyFields, n)), ue || J ? ee(t.dirtyFields, n) : H(t.dirtyFields, n, !0), j.dirtyFields = t.dirtyFields, p = p || m.dirtyFields && A !== !ue;
839
+ }
840
+ if (u) {
841
+ const ue = h(t.touchedFields, n);
842
+ ue || (H(t.touchedFields, n, u), j.touchedFields = t.touchedFields, p = p || m.touchedFields && ue !== u);
843
+ }
844
+ return p && x && y.state.next(j), p ? j : {};
845
+ }, C = (n, i, u, _) => {
846
+ const x = h(t.errors, n), p = m.isValid && ge(i) && t.isValid !== i;
847
+ if (e.delayError && u ? (d = P(() => D(n, u)), d(e.delayError)) : (clearTimeout(S), d = null, u ? H(t.errors, n, u) : ee(t.errors, n)), (u ? !Me(x, u) : x) || !le(_) || p) {
848
+ const A = {
849
+ ..._,
850
+ ...p && ge(i) ? { isValid: i } : {},
851
+ errors: t.errors,
852
+ name: n
853
+ };
854
+ t = {
855
+ ...t,
856
+ ...A
857
+ }, y.state.next(A);
858
+ }
859
+ }, k = async (n) => {
860
+ T(n, !0);
861
+ const i = await r.resolver(a, r.context, Gs(n || c.mount, s, r.criteriaMode, r.shouldUseNativeValidation));
862
+ return T(n), i;
863
+ }, Q = async (n) => {
864
+ const { errors: i } = await k(n);
865
+ if (n)
866
+ for (const u of n) {
867
+ const _ = h(i, u);
868
+ _ ? H(t.errors, u, _) : ee(t.errors, u);
869
+ }
870
+ else
871
+ t.errors = i;
872
+ return i;
873
+ }, z = async (n, i, u = {
874
+ valid: !0
875
+ }) => {
876
+ for (const _ in n) {
877
+ const x = n[_];
878
+ if (x) {
879
+ const { _f: p, ...A } = x;
880
+ if (p) {
881
+ const j = c.array.has(p.name);
882
+ T([_], !0);
883
+ const J = await Pt(x, a, b, r.shouldUseNativeValidation && !i, j);
884
+ if (T([_]), J[p.name] && (u.valid = !1, i))
885
+ break;
886
+ !i && (h(J, p.name) ? j ? vr(t.errors, J, p.name) : H(t.errors, p.name, J[p.name]) : ee(t.errors, p.name));
887
+ }
888
+ A && await z(A, i, u);
889
+ }
890
+ }
891
+ return u.valid;
892
+ }, de = () => {
893
+ for (const n of c.unMount) {
894
+ const i = h(s, n);
895
+ i && (i._f.refs ? i._f.refs.every((u) => !Rt(u)) : !Rt(i._f.ref)) && be(n);
896
+ }
897
+ c.unMount = /* @__PURE__ */ new Set();
898
+ }, F = (n, i) => (n && i && H(a, n, i), !Me(ke(), o)), N = (n, i, u) => gr(n, c, {
899
+ ...l.mount ? a : $(i) ? o : ve(n) ? { [n]: i } : i
900
+ }, u, i), B = (n) => Je(h(l.mount ? a : o, n, e.shouldUnregister ? h(o, n, []) : [])), L = (n, i, u = {}) => {
901
+ const _ = h(s, n);
902
+ let x = i;
903
+ if (_) {
904
+ const p = _._f;
905
+ p && (!p.disabled && H(a, n, Ar(i, p)), x = lt(p.ref) && ne(i) ? "" : i, _r(p.ref) ? [...p.ref.options].forEach((A) => A.selected = x.includes(A.value)) : p.refs ? Qe(p.ref) ? p.refs.length > 1 ? p.refs.forEach((A) => (!A.defaultChecked || !A.disabled) && (A.checked = Array.isArray(x) ? !!x.find((j) => j === A.value) : x === A.value)) : p.refs[0] && (p.refs[0].checked = !!x) : p.refs.forEach((A) => A.checked = A.value === x) : Wt(p.ref) ? p.ref.value = "" : (p.ref.value = x, p.ref.type || y.values.next({
906
+ name: n,
907
+ values: { ...a }
908
+ })));
909
+ }
910
+ (u.shouldDirty || u.shouldTouch) && w(n, x, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && Se(n);
911
+ }, Y = (n, i, u) => {
912
+ for (const _ in i) {
913
+ const x = i[_], p = `${n}.${_}`, A = h(s, p);
914
+ (c.array.has(n) || !ut(x) || A && !A._f) && !$e(x) ? Y(p, x, u) : L(p, x, u);
915
+ }
916
+ }, X = (n, i, u = {}) => {
917
+ const _ = h(s, n), x = c.array.has(n), p = te(i);
918
+ H(a, n, p), x ? (y.array.next({
919
+ name: n,
920
+ values: { ...a }
921
+ }), (m.isDirty || m.dirtyFields) && u.shouldDirty && y.state.next({
922
+ name: n,
923
+ dirtyFields: nt(o, a),
924
+ isDirty: F(n, p)
925
+ })) : _ && !_._f && !ne(p) ? Y(n, p, u) : L(n, p, u), Dt(n, c) && y.state.next({ ...t }), y.values.next({
926
+ name: l.mount ? n : void 0,
927
+ values: { ...a }
928
+ });
929
+ }, fe = async (n) => {
930
+ l.mount = !0;
931
+ const i = n.target;
932
+ let u = i.name, _ = !0;
933
+ const x = h(s, u), p = () => i.type ? It(x._f) : ur(n), A = (j) => {
934
+ _ = Number.isNaN(j) || j === h(a, u, j);
935
+ };
936
+ if (x) {
937
+ let j, J;
938
+ const ue = p(), Be = n.type === it.BLUR || n.type === it.FOCUS_OUT, cs = !zs(x._f) && !r.resolver && !h(t.errors, u) && !x._f.deps || Ys(Be, h(t.touchedFields, u), t.isSubmitted, O, V), vt = Dt(u, c, Be);
939
+ H(a, u, ue), Be ? (x._f.onBlur && x._f.onBlur(n), d && d(0)) : x._f.onChange && x._f.onChange(n);
940
+ const xt = w(u, ue, Be, !1), us = !le(xt) || vt;
941
+ if (!Be && y.values.next({
942
+ name: u,
943
+ type: n.type,
944
+ values: { ...a }
945
+ }), cs)
946
+ return m.isValid && M(), us && y.state.next({ name: u, ...vt ? {} : xt });
947
+ if (!Be && vt && y.state.next({ ...t }), r.resolver) {
948
+ const { errors: qt } = await k([u]);
949
+ if (A(ue), _) {
950
+ const ds = rr(t.errors, s, u), Gt = rr(qt, s, ds.name || u);
951
+ j = Gt.error, u = Gt.name, J = le(qt);
952
+ }
953
+ } else
954
+ T([u], !0), j = (await Pt(x, a, b, r.shouldUseNativeValidation))[u], T([u]), A(ue), _ && (j ? J = !1 : m.isValid && (J = await z(s, !0)));
955
+ _ && (x._f.deps && Se(x._f.deps), C(u, J, j, xt));
956
+ }
957
+ }, ae = (n, i) => {
958
+ if (h(t.errors, i) && n.focus)
959
+ return n.focus(), 1;
960
+ }, Se = async (n, i = {}) => {
961
+ let u, _;
962
+ const x = ce(n);
963
+ if (r.resolver) {
964
+ const p = await Q($(n) ? n : x);
965
+ u = le(p), _ = n ? !x.some((A) => h(p, A)) : u;
966
+ } else n ? (_ = (await Promise.all(x.map(async (p) => {
967
+ const A = h(s, p);
968
+ return await z(A && A._f ? { [p]: A } : A);
969
+ }))).every(Boolean), !(!_ && !t.isValid) && M()) : _ = u = await z(s);
970
+ return y.state.next({
971
+ ...!ve(n) || m.isValid && u !== t.isValid ? {} : { name: n },
972
+ ...r.resolver || !n ? { isValid: u } : {},
973
+ errors: t.errors
974
+ }), i.shouldFocus && !_ && qe(s, ae, n ? x : c.mount), _;
975
+ }, ke = (n) => {
976
+ const i = {
977
+ ...l.mount ? a : o
978
+ };
979
+ return $(n) ? i : ve(n) ? h(i, n) : n.map((u) => h(i, u));
980
+ }, Le = (n, i) => ({
981
+ invalid: !!h((i || t).errors, n),
982
+ isDirty: !!h((i || t).dirtyFields, n),
983
+ error: h((i || t).errors, n),
984
+ isValidating: !!h(t.validatingFields, n),
985
+ isTouched: !!h((i || t).touchedFields, n)
986
+ }), ze = (n) => {
987
+ n && ce(n).forEach((i) => ee(t.errors, i)), y.state.next({
988
+ errors: n ? t.errors : {}
989
+ });
990
+ }, _e = (n, i, u) => {
991
+ const _ = (h(s, n, { _f: {} })._f || {}).ref, x = h(t.errors, n) || {}, { ref: p, message: A, type: j, ...J } = x;
992
+ H(t.errors, n, {
993
+ ...J,
994
+ ...i,
995
+ ref: _
996
+ }), y.state.next({
997
+ name: n,
998
+ errors: t.errors,
999
+ isValid: !1
1000
+ }), u && u.shouldFocus && _ && _.focus && _.focus();
1001
+ }, je = (n, i) => Ie(n) ? y.values.subscribe({
1002
+ next: (u) => n(N(void 0, i), u)
1003
+ }) : N(n, i, !0), be = (n, i = {}) => {
1004
+ for (const u of n ? ce(n) : c.mount)
1005
+ c.mount.delete(u), c.array.delete(u), i.keepValue || (ee(s, u), ee(a, u)), !i.keepError && ee(t.errors, u), !i.keepDirty && ee(t.dirtyFields, u), !i.keepTouched && ee(t.touchedFields, u), !i.keepIsValidating && ee(t.validatingFields, u), !r.shouldUnregister && !i.keepDefaultValue && ee(o, u);
1006
+ y.values.next({
1007
+ values: { ...a }
1008
+ }), y.state.next({
1009
+ ...t,
1010
+ ...i.keepDirty ? { isDirty: F() } : {}
1011
+ }), !i.keepIsValid && M();
1012
+ }, R = ({ disabled: n, name: i, field: u, fields: _, value: x }) => {
1013
+ if (ge(n) && l.mount || n) {
1014
+ const p = n ? void 0 : $(x) ? It(u ? u._f : h(_, i)._f) : x;
1015
+ H(a, i, p), w(i, p, !1, !1, !0);
1016
+ }
1017
+ }, K = (n, i = {}) => {
1018
+ let u = h(s, n);
1019
+ const _ = ge(i.disabled);
1020
+ return H(s, n, {
1021
+ ...u || {},
1022
+ _f: {
1023
+ ...u && u._f ? u._f : { ref: { name: n } },
1024
+ name: n,
1025
+ mount: !0,
1026
+ ...i
1027
+ }
1028
+ }), c.mount.add(n), u ? R({
1029
+ field: u,
1030
+ disabled: i.disabled,
1031
+ name: n,
1032
+ value: i.value
1033
+ }) : v(n, !0, i.value), {
1034
+ ..._ ? { disabled: i.disabled } : {},
1035
+ ...r.progressive ? {
1036
+ required: !!i.required,
1037
+ min: Ye(i.min),
1038
+ max: Ye(i.max),
1039
+ minLength: Ye(i.minLength),
1040
+ maxLength: Ye(i.maxLength),
1041
+ pattern: Ye(i.pattern)
1042
+ } : {},
1043
+ name: n,
1044
+ onChange: fe,
1045
+ onBlur: fe,
1046
+ ref: (x) => {
1047
+ if (x) {
1048
+ K(n, i), u = h(s, n);
1049
+ const p = $(x.value) && x.querySelectorAll && x.querySelectorAll("input,select,textarea")[0] || x, A = qs(p), j = u._f.refs || [];
1050
+ if (A ? j.find((J) => J === p) : p === u._f.ref)
1051
+ return;
1052
+ H(s, n, {
1053
+ _f: {
1054
+ ...u._f,
1055
+ ...A ? {
1056
+ refs: [
1057
+ ...j.filter(Rt),
1058
+ p,
1059
+ ...Array.isArray(h(o, n)) ? [{}] : []
1060
+ ],
1061
+ ref: { type: p.type, name: n }
1062
+ } : { ref: p }
1063
+ }
1064
+ }), v(n, !1, void 0, p);
1065
+ } else
1066
+ u = h(s, n, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || i.shouldUnregister) && !(dr(c.array, n) && l.action) && c.unMount.add(n);
1067
+ }
1068
+ };
1069
+ }, se = () => r.shouldFocusError && qe(s, ae, c.mount), q = (n) => {
1070
+ ge(n) && (y.state.next({ disabled: n }), qe(s, (i, u) => {
1071
+ const _ = h(s, u);
1072
+ _ && (i.disabled = _._f.disabled || n, Array.isArray(_._f.refs) && _._f.refs.forEach((x) => {
1073
+ x.disabled = _._f.disabled || n;
1074
+ }));
1075
+ }, 0, !1));
1076
+ }, U = (n, i) => async (u) => {
1077
+ let _;
1078
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1079
+ let x = te(a);
1080
+ if (y.state.next({
1081
+ isSubmitting: !0
1082
+ }), r.resolver) {
1083
+ const { errors: p, values: A } = await k();
1084
+ t.errors = p, x = A;
1085
+ } else
1086
+ await z(s);
1087
+ if (ee(t.errors, "root"), le(t.errors)) {
1088
+ y.state.next({
1089
+ errors: {}
1090
+ });
1091
+ try {
1092
+ await n(x, u);
1093
+ } catch (p) {
1094
+ _ = p;
1095
+ }
1096
+ } else
1097
+ i && await i({ ...t.errors }, u), se(), setTimeout(se);
1098
+ if (y.state.next({
1099
+ isSubmitted: !0,
1100
+ isSubmitting: !1,
1101
+ isSubmitSuccessful: le(t.errors) && !_,
1102
+ submitCount: t.submitCount + 1,
1103
+ errors: t.errors
1104
+ }), _)
1105
+ throw _;
1106
+ }, W = (n, i = {}) => {
1107
+ h(s, n) && ($(i.defaultValue) ? X(n, te(h(o, n))) : (X(n, i.defaultValue), H(o, n, te(i.defaultValue))), i.keepTouched || ee(t.touchedFields, n), i.keepDirty || (ee(t.dirtyFields, n), t.isDirty = i.defaultValue ? F(n, te(h(o, n))) : F()), i.keepError || (ee(t.errors, n), m.isValid && M()), y.state.next({ ...t }));
1108
+ }, me = (n, i = {}) => {
1109
+ const u = n ? te(n) : o, _ = te(u), x = le(n), p = x ? o : _;
1110
+ if (i.keepDefaultValues || (o = u), !i.keepValues) {
1111
+ if (i.keepDirtyValues)
1112
+ for (const A of c.mount)
1113
+ h(t.dirtyFields, A) ? H(p, A, h(a, A)) : X(A, h(p, A));
1114
+ else {
1115
+ if (Ut && $(n))
1116
+ for (const A of c.mount) {
1117
+ const j = h(s, A);
1118
+ if (j && j._f) {
1119
+ const J = Array.isArray(j._f.refs) ? j._f.refs[0] : j._f.ref;
1120
+ if (lt(J)) {
1121
+ const ue = J.closest("form");
1122
+ if (ue) {
1123
+ ue.reset();
1124
+ break;
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ s = {};
1130
+ }
1131
+ a = e.shouldUnregister ? i.keepDefaultValues ? te(o) : {} : te(p), y.array.next({
1132
+ values: { ...p }
1133
+ }), y.values.next({
1134
+ values: { ...p }
1135
+ });
1136
+ }
1137
+ c = {
1138
+ mount: i.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
1139
+ unMount: /* @__PURE__ */ new Set(),
1140
+ array: /* @__PURE__ */ new Set(),
1141
+ watch: /* @__PURE__ */ new Set(),
1142
+ watchAll: !1,
1143
+ focus: ""
1144
+ }, l.mount = !m.isValid || !!i.keepIsValid || !!i.keepDirtyValues, l.watch = !!e.shouldUnregister, y.state.next({
1145
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
1146
+ isDirty: x ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !Me(n, o)),
1147
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
1148
+ dirtyFields: x ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? nt(o, a) : t.dirtyFields : i.keepDefaultValues && n ? nt(o, n) : i.keepDirty ? t.dirtyFields : {},
1149
+ touchedFields: i.keepTouched ? t.touchedFields : {},
1150
+ errors: i.keepErrors ? t.errors : {},
1151
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1152
+ isSubmitting: !1
1153
+ });
1154
+ }, ye = (n, i) => me(Ie(n) ? n(a) : n, i);
1155
+ return {
1156
+ control: {
1157
+ register: K,
1158
+ unregister: be,
1159
+ getFieldState: Le,
1160
+ handleSubmit: U,
1161
+ setError: _e,
1162
+ _executeSchema: k,
1163
+ _getWatch: N,
1164
+ _getDirty: F,
1165
+ _updateValid: M,
1166
+ _removeUnmounted: de,
1167
+ _updateFieldArray: g,
1168
+ _updateDisabledField: R,
1169
+ _getFieldArray: B,
1170
+ _reset: me,
1171
+ _resetDefaultValues: () => Ie(r.defaultValues) && r.defaultValues().then((n) => {
1172
+ ye(n, r.resetOptions), y.state.next({
1173
+ isLoading: !1
1174
+ });
1175
+ }),
1176
+ _updateFormState: (n) => {
1177
+ t = {
1178
+ ...t,
1179
+ ...n
1180
+ };
1181
+ },
1182
+ _disableForm: q,
1183
+ _subjects: y,
1184
+ _proxyFormState: m,
1185
+ _setErrors: Z,
1186
+ get _fields() {
1187
+ return s;
1188
+ },
1189
+ get _formValues() {
1190
+ return a;
1191
+ },
1192
+ get _state() {
1193
+ return l;
1194
+ },
1195
+ set _state(n) {
1196
+ l = n;
1197
+ },
1198
+ get _defaultValues() {
1199
+ return o;
1200
+ },
1201
+ get _names() {
1202
+ return c;
1203
+ },
1204
+ set _names(n) {
1205
+ c = n;
1206
+ },
1207
+ get _formState() {
1208
+ return t;
1209
+ },
1210
+ set _formState(n) {
1211
+ t = n;
1212
+ },
1213
+ get _options() {
1214
+ return r;
1215
+ },
1216
+ set _options(n) {
1217
+ r = {
1218
+ ...r,
1219
+ ...n
1220
+ };
1221
+ }
1222
+ },
1223
+ trigger: Se,
1224
+ register: K,
1225
+ handleSubmit: U,
1226
+ watch: je,
1227
+ setValue: X,
1228
+ getValues: ke,
1229
+ reset: ye,
1230
+ resetField: W,
1231
+ clearErrors: ze,
1232
+ unregister: be,
1233
+ setError: _e,
1234
+ setFocus: (n, i = {}) => {
1235
+ const u = h(s, n), _ = u && u._f;
1236
+ if (_) {
1237
+ const x = _.refs ? _.refs[0] : _.ref;
1238
+ x.focus && (x.focus(), i.shouldSelect && x.select());
1239
+ }
1240
+ },
1241
+ getFieldState: Le
1242
+ };
1243
+ }
1244
+ function Kn(e = {}) {
1245
+ const r = I.useRef(), t = I.useRef(), [s, o] = I.useState({
1246
+ isDirty: !1,
1247
+ isValidating: !1,
1248
+ isLoading: Ie(e.defaultValues),
1249
+ isSubmitted: !1,
1250
+ isSubmitting: !1,
1251
+ isSubmitSuccessful: !1,
1252
+ isValid: !1,
1253
+ submitCount: 0,
1254
+ dirtyFields: {},
1255
+ touchedFields: {},
1256
+ validatingFields: {},
1257
+ errors: e.errors || {},
1258
+ disabled: e.disabled || !1,
1259
+ defaultValues: Ie(e.defaultValues) ? void 0 : e.defaultValues
1260
+ });
1261
+ r.current || (r.current = {
1262
+ ...Qs(e),
1263
+ formState: s
1264
+ });
1265
+ const a = r.current.control;
1266
+ return a._options = e, ht({
1267
+ subject: a._subjects.state,
1268
+ next: (l) => {
1269
+ mr(l, a._proxyFormState, a._updateFormState, !0) && o({ ...a._formState });
1270
+ }
1271
+ }), I.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), I.useEffect(() => {
1272
+ if (a._proxyFormState.isDirty) {
1273
+ const l = a._getDirty();
1274
+ l !== s.isDirty && a._subjects.state.next({
1275
+ isDirty: l
1276
+ });
1277
+ }
1278
+ }, [a, s.isDirty]), I.useEffect(() => {
1279
+ e.values && !Me(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, o((l) => ({ ...l }))) : a._resetDefaultValues();
1280
+ }, [e.values, a]), I.useEffect(() => {
1281
+ e.errors && a._setErrors(e.errors);
1282
+ }, [e.errors, a]), I.useEffect(() => {
1283
+ a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1284
+ }), I.useEffect(() => {
1285
+ e.shouldUnregister && a._subjects.values.next({
1286
+ values: a._getWatch()
1287
+ });
1288
+ }, [e.shouldUnregister, a]), r.current.formState = hr(s, a), r.current;
1289
+ }
1290
+ function sr(e, [r, t]) {
1291
+ return Math.min(t, Math.max(r, e));
1292
+ }
1293
+ function Js(e) {
1294
+ const r = f.useRef({ value: e, previous: e });
1295
+ return f.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
1296
+ }
1297
+ var en = [" ", "Enter", "ArrowUp", "ArrowDown"], tn = [" ", "Enter"], et = "Select", [mt, yt, rn] = ps(et), [Ge, $n] = hs(et, [
1298
+ rn,
1299
+ or
1300
+ ]), gt = or(), [sn, De] = Ge(et), [nn, on] = Ge(et), Cr = (e) => {
1301
+ const {
1302
+ __scopeSelect: r,
1303
+ children: t,
1304
+ open: s,
1305
+ defaultOpen: o,
1306
+ onOpenChange: a,
1307
+ value: l,
1308
+ defaultValue: c,
1309
+ onValueChange: d,
1310
+ dir: S,
1311
+ name: m,
1312
+ autoComplete: y,
1313
+ disabled: V,
1314
+ required: O
1315
+ } = e, b = gt(r), [P, M] = f.useState(null), [T, g] = f.useState(null), [D, Z] = f.useState(!1), v = Vs(S), [w = !1, C] = Yt({
1316
+ prop: s,
1317
+ defaultProp: o,
1318
+ onChange: a
1319
+ }), [k, Q] = Yt({
1320
+ prop: l,
1321
+ defaultProp: c,
1322
+ onChange: d
1323
+ }), z = f.useRef(null), de = P ? !!P.closest("form") : !0, [F, N] = f.useState(/* @__PURE__ */ new Set()), B = Array.from(F).map((L) => L.props.value).join(";");
1324
+ return /* @__PURE__ */ E.jsx(Fs, { ...b, children: /* @__PURE__ */ E.jsxs(
1325
+ sn,
1326
+ {
1327
+ required: O,
1328
+ scope: r,
1329
+ trigger: P,
1330
+ onTriggerChange: M,
1331
+ valueNode: T,
1332
+ onValueNodeChange: g,
1333
+ valueNodeHasChildren: D,
1334
+ onValueNodeHasChildrenChange: Z,
1335
+ contentId: Bt(),
1336
+ value: k,
1337
+ onValueChange: Q,
1338
+ open: w,
1339
+ onOpenChange: C,
1340
+ dir: v,
1341
+ triggerPointerDownPosRef: z,
1342
+ disabled: V,
1343
+ children: [
1344
+ /* @__PURE__ */ E.jsx(mt.Provider, { scope: r, children: /* @__PURE__ */ E.jsx(
1345
+ nn,
1346
+ {
1347
+ scope: e.__scopeSelect,
1348
+ onNativeOptionAdd: f.useCallback((L) => {
1349
+ N((Y) => new Set(Y).add(L));
1350
+ }, []),
1351
+ onNativeOptionRemove: f.useCallback((L) => {
1352
+ N((Y) => {
1353
+ const X = new Set(Y);
1354
+ return X.delete(L), X;
1355
+ });
1356
+ }, []),
1357
+ children: t
1358
+ }
1359
+ ) }),
1360
+ de ? /* @__PURE__ */ E.jsxs(
1361
+ Zr,
1362
+ {
1363
+ "aria-hidden": !0,
1364
+ required: O,
1365
+ tabIndex: -1,
1366
+ name: m,
1367
+ autoComplete: y,
1368
+ value: k,
1369
+ onChange: (L) => Q(L.target.value),
1370
+ disabled: V,
1371
+ children: [
1372
+ k === void 0 ? /* @__PURE__ */ E.jsx("option", { value: "" }) : null,
1373
+ Array.from(F)
1374
+ ]
1375
+ },
1376
+ B
1377
+ ) : null
1378
+ ]
1379
+ }
1380
+ ) });
1381
+ };
1382
+ Cr.displayName = et;
1383
+ var Er = "SelectTrigger", Vr = f.forwardRef(
1384
+ (e, r) => {
1385
+ const { __scopeSelect: t, disabled: s = !1, ...o } = e, a = gt(t), l = De(Er, t), c = l.disabled || s, d = xe(r, l.onTriggerChange), S = yt(t), [m, y, V] = Qr((b) => {
1386
+ const P = S().filter((g) => !g.disabled), M = P.find((g) => g.value === l.value), T = Jr(P, b, M);
1387
+ T !== void 0 && l.onValueChange(T.value);
1388
+ }), O = () => {
1389
+ c || (l.onOpenChange(!0), V());
1390
+ };
1391
+ return /* @__PURE__ */ E.jsx(ms, { asChild: !0, ...a, children: /* @__PURE__ */ E.jsx(
1392
+ he.button,
1393
+ {
1394
+ type: "button",
1395
+ role: "combobox",
1396
+ "aria-controls": l.contentId,
1397
+ "aria-expanded": l.open,
1398
+ "aria-required": l.required,
1399
+ "aria-autocomplete": "none",
1400
+ dir: l.dir,
1401
+ "data-state": l.open ? "open" : "closed",
1402
+ disabled: c,
1403
+ "data-disabled": c ? "" : void 0,
1404
+ "data-placeholder": Xr(l.value) ? "" : void 0,
1405
+ ...o,
1406
+ ref: d,
1407
+ onClick: oe(o.onClick, (b) => {
1408
+ b.currentTarget.focus();
1409
+ }),
1410
+ onPointerDown: oe(o.onPointerDown, (b) => {
1411
+ const P = b.target;
1412
+ P.hasPointerCapture(b.pointerId) && P.releasePointerCapture(b.pointerId), b.button === 0 && b.ctrlKey === !1 && (O(), l.triggerPointerDownPosRef.current = {
1413
+ x: Math.round(b.pageX),
1414
+ y: Math.round(b.pageY)
1415
+ }, b.preventDefault());
1416
+ }),
1417
+ onKeyDown: oe(o.onKeyDown, (b) => {
1418
+ const P = m.current !== "";
1419
+ !(b.ctrlKey || b.altKey || b.metaKey) && b.key.length === 1 && y(b.key), !(P && b.key === " ") && en.includes(b.key) && (O(), b.preventDefault());
1420
+ })
1421
+ }
1422
+ ) });
1423
+ }
1424
+ );
1425
+ Vr.displayName = Er;
1426
+ var Fr = "SelectValue", Tr = f.forwardRef(
1427
+ (e, r) => {
1428
+ const { __scopeSelect: t, className: s, style: o, children: a, placeholder: l = "", ...c } = e, d = De(Fr, t), { onValueNodeHasChildrenChange: S } = d, m = a !== void 0, y = xe(r, d.onValueNodeChange);
1429
+ return Ne(() => {
1430
+ S(m);
1431
+ }, [S, m]), /* @__PURE__ */ E.jsx(
1432
+ he.span,
1433
+ {
1434
+ ...c,
1435
+ ref: y,
1436
+ style: { pointerEvents: "none" },
1437
+ children: Xr(d.value) ? /* @__PURE__ */ E.jsx(E.Fragment, { children: l }) : a
1438
+ }
1439
+ );
1440
+ }
1441
+ );
1442
+ Tr.displayName = Fr;
1443
+ var an = "SelectIcon", Rr = f.forwardRef(
1444
+ (e, r) => {
1445
+ const { __scopeSelect: t, children: s, ...o } = e;
1446
+ return /* @__PURE__ */ E.jsx(he.span, { "aria-hidden": !0, ...o, ref: r, children: s || "▼" });
1447
+ }
1448
+ );
1449
+ Rr.displayName = an;
1450
+ var ln = "SelectPortal", Ir = (e) => /* @__PURE__ */ E.jsx(Es, { asChild: !0, ...e });
1451
+ Ir.displayName = ln;
1452
+ var Oe = "SelectContent", Nr = f.forwardRef(
1453
+ (e, r) => {
1454
+ const t = De(Oe, e.__scopeSelect), [s, o] = f.useState();
1455
+ if (Ne(() => {
1456
+ o(new DocumentFragment());
1457
+ }, []), !t.open) {
1458
+ const a = s;
1459
+ return a ? ir.createPortal(
1460
+ /* @__PURE__ */ E.jsx(Dr, { scope: e.__scopeSelect, children: /* @__PURE__ */ E.jsx(mt.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ E.jsx("div", { children: e.children }) }) }),
1461
+ a
1462
+ ) : null;
1463
+ }
1464
+ return /* @__PURE__ */ E.jsx(Pr, { ...e, ref: r });
1465
+ }
1466
+ );
1467
+ Nr.displayName = Oe;
1468
+ var Ae = 10, [Dr, Pe] = Ge(Oe), cn = "SelectContentImpl", Pr = f.forwardRef(
1469
+ (e, r) => {
1470
+ const {
1471
+ __scopeSelect: t,
1472
+ position: s = "item-aligned",
1473
+ onCloseAutoFocus: o,
1474
+ onEscapeKeyDown: a,
1475
+ onPointerDownOutside: l,
1476
+ //
1477
+ // PopperContent props
1478
+ side: c,
1479
+ sideOffset: d,
1480
+ align: S,
1481
+ alignOffset: m,
1482
+ arrowPadding: y,
1483
+ collisionBoundary: V,
1484
+ collisionPadding: O,
1485
+ sticky: b,
1486
+ hideWhenDetached: P,
1487
+ avoidCollisions: M,
1488
+ //
1489
+ ...T
1490
+ } = e, g = De(Oe, t), [D, Z] = f.useState(null), [v, w] = f.useState(null), C = xe(r, (R) => Z(R)), [k, Q] = f.useState(null), [z, de] = f.useState(
1491
+ null
1492
+ ), F = yt(t), [N, B] = f.useState(!1), L = f.useRef(!1);
1493
+ f.useEffect(() => {
1494
+ if (D) return ys(D);
1495
+ }, [D]), gs();
1496
+ const Y = f.useCallback(
1497
+ (R) => {
1498
+ const [K, ...se] = F().map((W) => W.ref.current), [q] = se.slice(-1), U = document.activeElement;
1499
+ for (const W of R)
1500
+ if (W === U || (W == null || W.scrollIntoView({ block: "nearest" }), W === K && v && (v.scrollTop = 0), W === q && v && (v.scrollTop = v.scrollHeight), W == null || W.focus(), document.activeElement !== U)) return;
1501
+ },
1502
+ [F, v]
1503
+ ), X = f.useCallback(
1504
+ () => Y([k, D]),
1505
+ [Y, k, D]
1506
+ );
1507
+ f.useEffect(() => {
1508
+ N && X();
1509
+ }, [N, X]);
1510
+ const { onOpenChange: fe, triggerPointerDownPosRef: ae } = g;
1511
+ f.useEffect(() => {
1512
+ if (D) {
1513
+ let R = { x: 0, y: 0 };
1514
+ const K = (q) => {
1515
+ var U, W;
1516
+ R = {
1517
+ x: Math.abs(Math.round(q.pageX) - (((U = ae.current) == null ? void 0 : U.x) ?? 0)),
1518
+ y: Math.abs(Math.round(q.pageY) - (((W = ae.current) == null ? void 0 : W.y) ?? 0))
1519
+ };
1520
+ }, se = (q) => {
1521
+ R.x <= 10 && R.y <= 10 ? q.preventDefault() : D.contains(q.target) || fe(!1), document.removeEventListener("pointermove", K), ae.current = null;
1522
+ };
1523
+ return ae.current !== null && (document.addEventListener("pointermove", K), document.addEventListener("pointerup", se, { capture: !0, once: !0 })), () => {
1524
+ document.removeEventListener("pointermove", K), document.removeEventListener("pointerup", se, { capture: !0 });
1525
+ };
1526
+ }
1527
+ }, [D, fe, ae]), f.useEffect(() => {
1528
+ const R = () => fe(!1);
1529
+ return window.addEventListener("blur", R), window.addEventListener("resize", R), () => {
1530
+ window.removeEventListener("blur", R), window.removeEventListener("resize", R);
1531
+ };
1532
+ }, [fe]);
1533
+ const [Se, ke] = Qr((R) => {
1534
+ const K = F().filter((U) => !U.disabled), se = K.find((U) => U.ref.current === document.activeElement), q = Jr(K, R, se);
1535
+ q && setTimeout(() => q.ref.current.focus());
1536
+ }), Le = f.useCallback(
1537
+ (R, K, se) => {
1538
+ const q = !L.current && !se;
1539
+ (g.value !== void 0 && g.value === K || q) && (Q(R), q && (L.current = !0));
1540
+ },
1541
+ [g.value]
1542
+ ), ze = f.useCallback(() => D == null ? void 0 : D.focus(), [D]), _e = f.useCallback(
1543
+ (R, K, se) => {
1544
+ const q = !L.current && !se;
1545
+ (g.value !== void 0 && g.value === K || q) && de(R);
1546
+ },
1547
+ [g.value]
1548
+ ), je = s === "popper" ? kt : kr, be = je === kt ? {
1549
+ side: c,
1550
+ sideOffset: d,
1551
+ align: S,
1552
+ alignOffset: m,
1553
+ arrowPadding: y,
1554
+ collisionBoundary: V,
1555
+ collisionPadding: O,
1556
+ sticky: b,
1557
+ hideWhenDetached: P,
1558
+ avoidCollisions: M
1559
+ } : {};
1560
+ return /* @__PURE__ */ E.jsx(
1561
+ Dr,
1562
+ {
1563
+ scope: t,
1564
+ content: D,
1565
+ viewport: v,
1566
+ onViewportChange: w,
1567
+ itemRefCallback: Le,
1568
+ selectedItem: k,
1569
+ onItemLeave: ze,
1570
+ itemTextRefCallback: _e,
1571
+ focusSelectedItem: X,
1572
+ selectedItemText: z,
1573
+ position: s,
1574
+ isPositioned: N,
1575
+ searchRef: Se,
1576
+ children: /* @__PURE__ */ E.jsx(vs, { as: xs, allowPinchZoom: !0, children: /* @__PURE__ */ E.jsx(
1577
+ Ss,
1578
+ {
1579
+ asChild: !0,
1580
+ trapped: g.open,
1581
+ onMountAutoFocus: (R) => {
1582
+ R.preventDefault();
1583
+ },
1584
+ onUnmountAutoFocus: oe(o, (R) => {
1585
+ var K;
1586
+ (K = g.trigger) == null || K.focus({ preventScroll: !0 }), R.preventDefault();
1587
+ }),
1588
+ children: /* @__PURE__ */ E.jsx(
1589
+ _s,
1590
+ {
1591
+ asChild: !0,
1592
+ disableOutsidePointerEvents: !0,
1593
+ onEscapeKeyDown: a,
1594
+ onPointerDownOutside: l,
1595
+ onFocusOutside: (R) => R.preventDefault(),
1596
+ onDismiss: () => g.onOpenChange(!1),
1597
+ children: /* @__PURE__ */ E.jsx(
1598
+ je,
1599
+ {
1600
+ role: "listbox",
1601
+ id: g.contentId,
1602
+ "data-state": g.open ? "open" : "closed",
1603
+ dir: g.dir,
1604
+ onContextMenu: (R) => R.preventDefault(),
1605
+ ...T,
1606
+ ...be,
1607
+ onPlaced: () => B(!0),
1608
+ ref: C,
1609
+ style: {
1610
+ // flex layout so we can place the scroll buttons properly
1611
+ display: "flex",
1612
+ flexDirection: "column",
1613
+ // reset the outline by default as the content MAY get focused
1614
+ outline: "none",
1615
+ ...T.style
1616
+ },
1617
+ onKeyDown: oe(T.onKeyDown, (R) => {
1618
+ const K = R.ctrlKey || R.altKey || R.metaKey;
1619
+ if (R.key === "Tab" && R.preventDefault(), !K && R.key.length === 1 && ke(R.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(R.key)) {
1620
+ let q = F().filter((U) => !U.disabled).map((U) => U.ref.current);
1621
+ if (["ArrowUp", "End"].includes(R.key) && (q = q.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(R.key)) {
1622
+ const U = R.target, W = q.indexOf(U);
1623
+ q = q.slice(W + 1);
1624
+ }
1625
+ setTimeout(() => Y(q)), R.preventDefault();
1626
+ }
1627
+ })
1628
+ }
1629
+ )
1630
+ }
1631
+ )
1632
+ }
1633
+ ) })
1634
+ }
1635
+ );
1636
+ }
1637
+ );
1638
+ Pr.displayName = cn;
1639
+ var un = "SelectItemAlignedPosition", kr = f.forwardRef((e, r) => {
1640
+ const { __scopeSelect: t, onPlaced: s, ...o } = e, a = De(Oe, t), l = Pe(Oe, t), [c, d] = f.useState(null), [S, m] = f.useState(null), y = xe(r, (C) => m(C)), V = yt(t), O = f.useRef(!1), b = f.useRef(!0), { viewport: P, selectedItem: M, selectedItemText: T, focusSelectedItem: g } = l, D = f.useCallback(() => {
1641
+ if (a.trigger && a.valueNode && c && S && P && M && T) {
1642
+ const C = a.trigger.getBoundingClientRect(), k = S.getBoundingClientRect(), Q = a.valueNode.getBoundingClientRect(), z = T.getBoundingClientRect();
1643
+ if (a.dir !== "rtl") {
1644
+ const U = z.left - k.left, W = Q.left - U, me = C.left - W, ye = C.width + me, tt = Math.max(ye, k.width), rt = window.innerWidth - Ae, st = sr(W, [Ae, rt - tt]);
1645
+ c.style.minWidth = ye + "px", c.style.left = st + "px";
1646
+ } else {
1647
+ const U = k.right - z.right, W = window.innerWidth - Q.right - U, me = window.innerWidth - C.right - W, ye = C.width + me, tt = Math.max(ye, k.width), rt = window.innerWidth - Ae, st = sr(W, [Ae, rt - tt]);
1648
+ c.style.minWidth = ye + "px", c.style.right = st + "px";
1649
+ }
1650
+ const de = V(), F = window.innerHeight - Ae * 2, N = P.scrollHeight, B = window.getComputedStyle(S), L = parseInt(B.borderTopWidth, 10), Y = parseInt(B.paddingTop, 10), X = parseInt(B.borderBottomWidth, 10), fe = parseInt(B.paddingBottom, 10), ae = L + Y + N + fe + X, Se = Math.min(M.offsetHeight * 5, ae), ke = window.getComputedStyle(P), Le = parseInt(ke.paddingTop, 10), ze = parseInt(ke.paddingBottom, 10), _e = C.top + C.height / 2 - Ae, je = F - _e, be = M.offsetHeight / 2, R = M.offsetTop + be, K = L + Y + R, se = ae - K;
1651
+ if (K <= _e) {
1652
+ const U = M === de[de.length - 1].ref.current;
1653
+ c.style.bottom = "0px";
1654
+ const W = S.clientHeight - P.offsetTop - P.offsetHeight, me = Math.max(
1655
+ je,
1656
+ be + // viewport might have padding bottom, include it to avoid a scrollable viewport
1657
+ (U ? ze : 0) + W + X
1658
+ ), ye = K + me;
1659
+ c.style.height = ye + "px";
1660
+ } else {
1661
+ const U = M === de[0].ref.current;
1662
+ c.style.top = "0px";
1663
+ const me = Math.max(
1664
+ _e,
1665
+ L + P.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1666
+ (U ? Le : 0) + be
1667
+ ) + se;
1668
+ c.style.height = me + "px", P.scrollTop = K - _e + P.offsetTop;
1669
+ }
1670
+ c.style.margin = `${Ae}px 0`, c.style.minHeight = Se + "px", c.style.maxHeight = F + "px", s == null || s(), requestAnimationFrame(() => O.current = !0);
1671
+ }
1672
+ }, [
1673
+ V,
1674
+ a.trigger,
1675
+ a.valueNode,
1676
+ c,
1677
+ S,
1678
+ P,
1679
+ M,
1680
+ T,
1681
+ a.dir,
1682
+ s
1683
+ ]);
1684
+ Ne(() => D(), [D]);
1685
+ const [Z, v] = f.useState();
1686
+ Ne(() => {
1687
+ S && v(window.getComputedStyle(S).zIndex);
1688
+ }, [S]);
1689
+ const w = f.useCallback(
1690
+ (C) => {
1691
+ C && b.current === !0 && (D(), g == null || g(), b.current = !1);
1692
+ },
1693
+ [D, g]
1694
+ );
1695
+ return /* @__PURE__ */ E.jsx(
1696
+ fn,
1697
+ {
1698
+ scope: t,
1699
+ contentWrapper: c,
1700
+ shouldExpandOnScrollRef: O,
1701
+ onScrollButtonChange: w,
1702
+ children: /* @__PURE__ */ E.jsx(
1703
+ "div",
1704
+ {
1705
+ ref: d,
1706
+ style: {
1707
+ display: "flex",
1708
+ flexDirection: "column",
1709
+ position: "fixed",
1710
+ zIndex: Z
1711
+ },
1712
+ children: /* @__PURE__ */ E.jsx(
1713
+ he.div,
1714
+ {
1715
+ ...o,
1716
+ ref: y,
1717
+ style: {
1718
+ // When we get the height of the content, it includes borders. If we were to set
1719
+ // the height without having `boxSizing: 'border-box'` it would be too big.
1720
+ boxSizing: "border-box",
1721
+ // We need to ensure the content doesn't get taller than the wrapper
1722
+ maxHeight: "100%",
1723
+ ...o.style
1724
+ }
1725
+ }
1726
+ )
1727
+ }
1728
+ )
1729
+ }
1730
+ );
1731
+ });
1732
+ kr.displayName = un;
1733
+ var dn = "SelectPopperPosition", kt = f.forwardRef((e, r) => {
1734
+ const {
1735
+ __scopeSelect: t,
1736
+ align: s = "start",
1737
+ collisionPadding: o = Ae,
1738
+ ...a
1739
+ } = e, l = gt(t);
1740
+ return /* @__PURE__ */ E.jsx(
1741
+ bs,
1742
+ {
1743
+ ...l,
1744
+ ...a,
1745
+ ref: r,
1746
+ align: s,
1747
+ collisionPadding: o,
1748
+ style: {
1749
+ // Ensure border-box for floating-ui calculations
1750
+ boxSizing: "border-box",
1751
+ ...a.style,
1752
+ "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1753
+ "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1754
+ "--radix-select-content-available-height": "var(--radix-popper-available-height)",
1755
+ "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
1756
+ "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
1757
+ }
1758
+ }
1759
+ );
1760
+ });
1761
+ kt.displayName = dn;
1762
+ var [fn, $t] = Ge(Oe, {}), Mt = "SelectViewport", Mr = f.forwardRef(
1763
+ (e, r) => {
1764
+ const { __scopeSelect: t, nonce: s, ...o } = e, a = Pe(Mt, t), l = $t(Mt, t), c = xe(r, a.onViewportChange), d = f.useRef(0);
1765
+ return /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
1766
+ /* @__PURE__ */ E.jsx(
1767
+ "style",
1768
+ {
1769
+ dangerouslySetInnerHTML: {
1770
+ __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
1771
+ },
1772
+ nonce: s
1773
+ }
1774
+ ),
1775
+ /* @__PURE__ */ E.jsx(mt.Slot, { scope: t, children: /* @__PURE__ */ E.jsx(
1776
+ he.div,
1777
+ {
1778
+ "data-radix-select-viewport": "",
1779
+ role: "presentation",
1780
+ ...o,
1781
+ ref: c,
1782
+ style: {
1783
+ // we use position: 'relative' here on the `viewport` so that when we call
1784
+ // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1785
+ // (independent of the scrollUpButton).
1786
+ position: "relative",
1787
+ flex: 1,
1788
+ overflow: "auto",
1789
+ ...o.style
1790
+ },
1791
+ onScroll: oe(o.onScroll, (S) => {
1792
+ const m = S.currentTarget, { contentWrapper: y, shouldExpandOnScrollRef: V } = l;
1793
+ if (V != null && V.current && y) {
1794
+ const O = Math.abs(d.current - m.scrollTop);
1795
+ if (O > 0) {
1796
+ const b = window.innerHeight - Ae * 2, P = parseFloat(y.style.minHeight), M = parseFloat(y.style.height), T = Math.max(P, M);
1797
+ if (T < b) {
1798
+ const g = T + O, D = Math.min(b, g), Z = g - D;
1799
+ y.style.height = D + "px", y.style.bottom === "0px" && (m.scrollTop = Z > 0 ? Z : 0, y.style.justifyContent = "flex-end");
1800
+ }
1801
+ }
1802
+ }
1803
+ d.current = m.scrollTop;
1804
+ })
1805
+ }
1806
+ ) })
1807
+ ] });
1808
+ }
1809
+ );
1810
+ Mr.displayName = Mt;
1811
+ var Or = "SelectGroup", [pn, hn] = Ge(Or), Lr = f.forwardRef(
1812
+ (e, r) => {
1813
+ const { __scopeSelect: t, ...s } = e, o = Bt();
1814
+ return /* @__PURE__ */ E.jsx(pn, { scope: t, id: o, children: /* @__PURE__ */ E.jsx(he.div, { role: "group", "aria-labelledby": o, ...s, ref: r }) });
1815
+ }
1816
+ );
1817
+ Lr.displayName = Or;
1818
+ var jr = "SelectLabel", Br = f.forwardRef(
1819
+ (e, r) => {
1820
+ const { __scopeSelect: t, ...s } = e, o = hn(jr, t);
1821
+ return /* @__PURE__ */ E.jsx(he.div, { id: o.id, ...s, ref: r });
1822
+ }
1823
+ );
1824
+ Br.displayName = jr;
1825
+ var ft = "SelectItem", [mn, Ur] = Ge(ft), Hr = f.forwardRef(
1826
+ (e, r) => {
1827
+ const {
1828
+ __scopeSelect: t,
1829
+ value: s,
1830
+ disabled: o = !1,
1831
+ textValue: a,
1832
+ ...l
1833
+ } = e, c = De(ft, t), d = Pe(ft, t), S = c.value === s, [m, y] = f.useState(a ?? ""), [V, O] = f.useState(!1), b = xe(
1834
+ r,
1835
+ (T) => {
1836
+ var g;
1837
+ return (g = d.itemRefCallback) == null ? void 0 : g.call(d, T, s, o);
1838
+ }
1839
+ ), P = Bt(), M = () => {
1840
+ o || (c.onValueChange(s), c.onOpenChange(!1));
1841
+ };
1842
+ if (s === "")
1843
+ throw new Error(
1844
+ "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
1845
+ );
1846
+ return /* @__PURE__ */ E.jsx(
1847
+ mn,
1848
+ {
1849
+ scope: t,
1850
+ value: s,
1851
+ disabled: o,
1852
+ textId: P,
1853
+ isSelected: S,
1854
+ onItemTextChange: f.useCallback((T) => {
1855
+ y((g) => g || ((T == null ? void 0 : T.textContent) ?? "").trim());
1856
+ }, []),
1857
+ children: /* @__PURE__ */ E.jsx(
1858
+ mt.ItemSlot,
1859
+ {
1860
+ scope: t,
1861
+ value: s,
1862
+ disabled: o,
1863
+ textValue: m,
1864
+ children: /* @__PURE__ */ E.jsx(
1865
+ he.div,
1866
+ {
1867
+ role: "option",
1868
+ "aria-labelledby": P,
1869
+ "data-highlighted": V ? "" : void 0,
1870
+ "aria-selected": S && V,
1871
+ "data-state": S ? "checked" : "unchecked",
1872
+ "aria-disabled": o || void 0,
1873
+ "data-disabled": o ? "" : void 0,
1874
+ tabIndex: o ? void 0 : -1,
1875
+ ...l,
1876
+ ref: b,
1877
+ onFocus: oe(l.onFocus, () => O(!0)),
1878
+ onBlur: oe(l.onBlur, () => O(!1)),
1879
+ onPointerUp: oe(l.onPointerUp, M),
1880
+ onPointerMove: oe(l.onPointerMove, (T) => {
1881
+ var g;
1882
+ o ? (g = d.onItemLeave) == null || g.call(d) : T.currentTarget.focus({ preventScroll: !0 });
1883
+ }),
1884
+ onPointerLeave: oe(l.onPointerLeave, (T) => {
1885
+ var g;
1886
+ T.currentTarget === document.activeElement && ((g = d.onItemLeave) == null || g.call(d));
1887
+ }),
1888
+ onKeyDown: oe(l.onKeyDown, (T) => {
1889
+ var D;
1890
+ ((D = d.searchRef) == null ? void 0 : D.current) !== "" && T.key === " " || (tn.includes(T.key) && M(), T.key === " " && T.preventDefault());
1891
+ })
1892
+ }
1893
+ )
1894
+ }
1895
+ )
1896
+ }
1897
+ );
1898
+ }
1899
+ );
1900
+ Hr.displayName = ft;
1901
+ var Xe = "SelectItemText", Wr = f.forwardRef(
1902
+ (e, r) => {
1903
+ const { __scopeSelect: t, className: s, style: o, ...a } = e, l = De(Xe, t), c = Pe(Xe, t), d = Ur(Xe, t), S = on(Xe, t), [m, y] = f.useState(null), V = xe(
1904
+ r,
1905
+ (T) => y(T),
1906
+ d.onItemTextChange,
1907
+ (T) => {
1908
+ var g;
1909
+ return (g = c.itemTextRefCallback) == null ? void 0 : g.call(c, T, d.value, d.disabled);
1910
+ }
1911
+ ), O = m == null ? void 0 : m.textContent, b = f.useMemo(
1912
+ () => /* @__PURE__ */ E.jsx("option", { value: d.value, disabled: d.disabled, children: O }, d.value),
1913
+ [d.disabled, d.value, O]
1914
+ ), { onNativeOptionAdd: P, onNativeOptionRemove: M } = S;
1915
+ return Ne(() => (P(b), () => M(b)), [P, M, b]), /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
1916
+ /* @__PURE__ */ E.jsx(he.span, { id: d.textId, ...a, ref: V }),
1917
+ d.isSelected && l.valueNode && !l.valueNodeHasChildren ? ir.createPortal(a.children, l.valueNode) : null
1918
+ ] });
1919
+ }
1920
+ );
1921
+ Wr.displayName = Xe;
1922
+ var Kr = "SelectItemIndicator", $r = f.forwardRef(
1923
+ (e, r) => {
1924
+ const { __scopeSelect: t, ...s } = e;
1925
+ return Ur(Kr, t).isSelected ? /* @__PURE__ */ E.jsx(he.span, { "aria-hidden": !0, ...s, ref: r }) : null;
1926
+ }
1927
+ );
1928
+ $r.displayName = Kr;
1929
+ var Ot = "SelectScrollUpButton", qr = f.forwardRef((e, r) => {
1930
+ const t = Pe(Ot, e.__scopeSelect), s = $t(Ot, e.__scopeSelect), [o, a] = f.useState(!1), l = xe(r, s.onScrollButtonChange);
1931
+ return Ne(() => {
1932
+ if (t.viewport && t.isPositioned) {
1933
+ let c = function() {
1934
+ const S = d.scrollTop > 0;
1935
+ a(S);
1936
+ };
1937
+ const d = t.viewport;
1938
+ return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
1939
+ }
1940
+ }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ E.jsx(
1941
+ zr,
1942
+ {
1943
+ ...e,
1944
+ ref: l,
1945
+ onAutoScroll: () => {
1946
+ const { viewport: c, selectedItem: d } = t;
1947
+ c && d && (c.scrollTop = c.scrollTop - d.offsetHeight);
1948
+ }
1949
+ }
1950
+ ) : null;
1951
+ });
1952
+ qr.displayName = Ot;
1953
+ var Lt = "SelectScrollDownButton", Gr = f.forwardRef((e, r) => {
1954
+ const t = Pe(Lt, e.__scopeSelect), s = $t(Lt, e.__scopeSelect), [o, a] = f.useState(!1), l = xe(r, s.onScrollButtonChange);
1955
+ return Ne(() => {
1956
+ if (t.viewport && t.isPositioned) {
1957
+ let c = function() {
1958
+ const S = d.scrollHeight - d.clientHeight, m = Math.ceil(d.scrollTop) < S;
1959
+ a(m);
1960
+ };
1961
+ const d = t.viewport;
1962
+ return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
1963
+ }
1964
+ }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ E.jsx(
1965
+ zr,
1966
+ {
1967
+ ...e,
1968
+ ref: l,
1969
+ onAutoScroll: () => {
1970
+ const { viewport: c, selectedItem: d } = t;
1971
+ c && d && (c.scrollTop = c.scrollTop + d.offsetHeight);
1972
+ }
1973
+ }
1974
+ ) : null;
1975
+ });
1976
+ Gr.displayName = Lt;
1977
+ var zr = f.forwardRef((e, r) => {
1978
+ const { __scopeSelect: t, onAutoScroll: s, ...o } = e, a = Pe("SelectScrollButton", t), l = f.useRef(null), c = yt(t), d = f.useCallback(() => {
1979
+ l.current !== null && (window.clearInterval(l.current), l.current = null);
1980
+ }, []);
1981
+ return f.useEffect(() => () => d(), [d]), Ne(() => {
1982
+ var m;
1983
+ const S = c().find((y) => y.ref.current === document.activeElement);
1984
+ (m = S == null ? void 0 : S.ref.current) == null || m.scrollIntoView({ block: "nearest" });
1985
+ }, [c]), /* @__PURE__ */ E.jsx(
1986
+ he.div,
1987
+ {
1988
+ "aria-hidden": !0,
1989
+ ...o,
1990
+ ref: r,
1991
+ style: { flexShrink: 0, ...o.style },
1992
+ onPointerDown: oe(o.onPointerDown, () => {
1993
+ l.current === null && (l.current = window.setInterval(s, 50));
1994
+ }),
1995
+ onPointerMove: oe(o.onPointerMove, () => {
1996
+ var S;
1997
+ (S = a.onItemLeave) == null || S.call(a), l.current === null && (l.current = window.setInterval(s, 50));
1998
+ }),
1999
+ onPointerLeave: oe(o.onPointerLeave, () => {
2000
+ d();
2001
+ })
2002
+ }
2003
+ );
2004
+ }), yn = "SelectSeparator", Yr = f.forwardRef(
2005
+ (e, r) => {
2006
+ const { __scopeSelect: t, ...s } = e;
2007
+ return /* @__PURE__ */ E.jsx(he.div, { "aria-hidden": !0, ...s, ref: r });
2008
+ }
2009
+ );
2010
+ Yr.displayName = yn;
2011
+ var jt = "SelectArrow", gn = f.forwardRef(
2012
+ (e, r) => {
2013
+ const { __scopeSelect: t, ...s } = e, o = gt(t), a = De(jt, t), l = Pe(jt, t);
2014
+ return a.open && l.position === "popper" ? /* @__PURE__ */ E.jsx(ws, { ...o, ...s, ref: r }) : null;
2015
+ }
2016
+ );
2017
+ gn.displayName = jt;
2018
+ function Xr(e) {
2019
+ return e === "" || e === void 0;
2020
+ }
2021
+ var Zr = f.forwardRef(
2022
+ (e, r) => {
2023
+ const { value: t, ...s } = e, o = f.useRef(null), a = xe(r, o), l = Js(t);
2024
+ return f.useEffect(() => {
2025
+ const c = o.current, d = window.HTMLSelectElement.prototype, m = Object.getOwnPropertyDescriptor(
2026
+ d,
2027
+ "value"
2028
+ ).set;
2029
+ if (l !== t && m) {
2030
+ const y = new Event("change", { bubbles: !0 });
2031
+ m.call(c, t), c.dispatchEvent(y);
2032
+ }
2033
+ }, [l, t]), /* @__PURE__ */ E.jsx(As, { asChild: !0, children: /* @__PURE__ */ E.jsx("select", { ...s, ref: a, defaultValue: t }) });
2034
+ }
2035
+ );
2036
+ Zr.displayName = "BubbleSelect";
2037
+ function Qr(e) {
2038
+ const r = Cs(e), t = f.useRef(""), s = f.useRef(0), o = f.useCallback(
2039
+ (l) => {
2040
+ const c = t.current + l;
2041
+ r(c), function d(S) {
2042
+ t.current = S, window.clearTimeout(s.current), S !== "" && (s.current = window.setTimeout(() => d(""), 1e3));
2043
+ }(c);
2044
+ },
2045
+ [r]
2046
+ ), a = f.useCallback(() => {
2047
+ t.current = "", window.clearTimeout(s.current);
2048
+ }, []);
2049
+ return f.useEffect(() => () => window.clearTimeout(s.current), []), [t, o, a];
2050
+ }
2051
+ function Jr(e, r, t) {
2052
+ const o = r.length > 1 && Array.from(r).every((S) => S === r[0]) ? r[0] : r, a = t ? e.indexOf(t) : -1;
2053
+ let l = vn(e, Math.max(a, 0));
2054
+ o.length === 1 && (l = l.filter((S) => S !== t));
2055
+ const d = l.find(
2056
+ (S) => S.textValue.toLowerCase().startsWith(o.toLowerCase())
2057
+ );
2058
+ return d !== t ? d : void 0;
2059
+ }
2060
+ function vn(e, r) {
2061
+ return e.map((t, s) => e[(r + s) % e.length]);
2062
+ }
2063
+ var xn = Cr, es = Vr, Sn = Tr, _n = Rr, bn = Ir, ts = Nr, wn = Mr, An = Lr, rs = Br, ss = Hr, Cn = Wr, En = $r, ns = qr, os = Gr, as = Yr;
2064
+ const qn = xn, Gn = An, zn = Sn, Vn = f.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ f.createElement(
2065
+ es,
2066
+ {
2067
+ ref: s,
2068
+ className: Ve(
2069
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
2070
+ e
2071
+ ),
2072
+ ...t
2073
+ },
2074
+ /* @__PURE__ */ f.createElement("span", { className: "truncate" }, r),
2075
+ /* @__PURE__ */ f.createElement(_n, { asChild: !0 }, /* @__PURE__ */ f.createElement(lr, { className: "flex-shrink-0 h-4 w-4 opacity-50" }))
2076
+ ));
2077
+ Vn.displayName = es.displayName;
2078
+ const is = f.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ f.createElement(
2079
+ ns,
2080
+ {
2081
+ ref: t,
2082
+ className: Ve(
2083
+ "flex cursor-default items-center justify-center py-1",
2084
+ e
2085
+ ),
2086
+ ...r
2087
+ },
2088
+ /* @__PURE__ */ f.createElement(Ps, { className: "h-4 w-4" })
2089
+ ));
2090
+ is.displayName = ns.displayName;
2091
+ const ls = f.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ f.createElement(
2092
+ os,
2093
+ {
2094
+ ref: t,
2095
+ className: Ve(
2096
+ "flex cursor-default items-center justify-center py-1",
2097
+ e
2098
+ ),
2099
+ ...r
2100
+ },
2101
+ /* @__PURE__ */ f.createElement(lr, { className: "h-4 w-4" })
2102
+ ));
2103
+ ls.displayName = os.displayName;
2104
+ const Fn = f.forwardRef(({ className: e, children: r, position: t = "popper", ...s }, o) => /* @__PURE__ */ f.createElement(bn, null, /* @__PURE__ */ f.createElement(
2105
+ ts,
2106
+ {
2107
+ ref: o,
2108
+ className: Ve(
2109
+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2110
+ t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
2111
+ e
2112
+ ),
2113
+ position: t,
2114
+ ...s
2115
+ },
2116
+ /* @__PURE__ */ f.createElement(is, null),
2117
+ /* @__PURE__ */ f.createElement(
2118
+ wn,
2119
+ {
2120
+ className: Ve(
2121
+ "p-1",
2122
+ t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
2123
+ )
2124
+ },
2125
+ r
2126
+ ),
2127
+ /* @__PURE__ */ f.createElement(ls, null)
2128
+ )));
2129
+ Fn.displayName = ts.displayName;
2130
+ const Tn = f.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ f.createElement(
2131
+ rs,
2132
+ {
2133
+ ref: t,
2134
+ className: Ve("py-1.5 pl-8 pr-2 text-sm font-semibold", e),
2135
+ ...r
2136
+ }
2137
+ ));
2138
+ Tn.displayName = rs.displayName;
2139
+ const Rn = f.forwardRef(({ className: e, children: r, ...t }, s) => /* @__PURE__ */ f.createElement(
2140
+ ss,
2141
+ {
2142
+ ref: s,
2143
+ className: Ve(
2144
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2145
+ e
2146
+ ),
2147
+ ...t
2148
+ },
2149
+ /* @__PURE__ */ f.createElement("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, /* @__PURE__ */ f.createElement(En, null, /* @__PURE__ */ f.createElement(ks, { className: "h-4 w-4" }))),
2150
+ /* @__PURE__ */ f.createElement(Cn, null, r)
2151
+ ));
2152
+ Rn.displayName = ss.displayName;
2153
+ const In = f.forwardRef(({ className: e, ...r }, t) => /* @__PURE__ */ f.createElement(
2154
+ as,
2155
+ {
2156
+ ref: t,
2157
+ className: Ve("-mx-1 my-1 h-px bg-muted", e),
2158
+ ...r
2159
+ }
2160
+ ));
2161
+ In.displayName = as.displayName;
2162
+ const Nn = f.forwardRef(
2163
+ ({ className: e, type: r, ...t }, s) => /* @__PURE__ */ f.createElement(
2164
+ "input",
2165
+ {
2166
+ type: r,
2167
+ className: Ve(
2168
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
2169
+ e
2170
+ ),
2171
+ ref: s,
2172
+ ...t
2173
+ }
2174
+ )
2175
+ );
2176
+ Nn.displayName = "Input";
2177
+ export {
2178
+ Hn as C,
2179
+ Un as F,
2180
+ Nn as I,
2181
+ qn as S,
2182
+ Bn as a,
2183
+ Vn as b,
2184
+ zn as c,
2185
+ Fn as d,
2186
+ Gn as e,
2187
+ Rn as f,
2188
+ Wn as g,
2189
+ pt as h,
2190
+ Kn as u
2191
+ };
2192
+ //# sourceMappingURL=Input-BBlyeDuG.js.map