zudoku 0.7.2-dev.1 → 0.7.2-dev.11

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