@jigowatts/jigowatts-ui 0.0.1-12

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 (199) hide show
  1. package/README.md +50 -0
  2. package/dist/AccordionSummary-B4zooGpd.js +831 -0
  3. package/dist/ButtonBase-pxtIu13Q.js +866 -0
  4. package/dist/DateTimePicker-DJSOr5wM.js +4653 -0
  5. package/dist/ListContext-DOVwHqy-.js +180 -0
  6. package/dist/MenuItem-yBaT3_db.js +470 -0
  7. package/dist/Paper-COvYqxZa.js +522 -0
  8. package/dist/Tabs-D3lJRumZ.js +1085 -0
  9. package/dist/_commonjsHelpers-CT_km90n.js +30 -0
  10. package/dist/assets/index.css +1 -0
  11. package/dist/assets/index10.css +1 -0
  12. package/dist/assets/index11.css +1 -0
  13. package/dist/assets/index12.css +1 -0
  14. package/dist/assets/index13.css +1 -0
  15. package/dist/assets/index14.css +1 -0
  16. package/dist/assets/index15.css +1 -0
  17. package/dist/assets/index16.css +1 -0
  18. package/dist/assets/index17.css +1 -0
  19. package/dist/assets/index18.css +1 -0
  20. package/dist/assets/index19.css +1 -0
  21. package/dist/assets/index2.css +1 -0
  22. package/dist/assets/index20.css +1 -0
  23. package/dist/assets/index21.css +1 -0
  24. package/dist/assets/index22.css +1 -0
  25. package/dist/assets/index23.css +1 -0
  26. package/dist/assets/index24.css +1 -0
  27. package/dist/assets/index25.css +1 -0
  28. package/dist/assets/index26.css +1 -0
  29. package/dist/assets/index27.css +1 -0
  30. package/dist/assets/index3.css +1 -0
  31. package/dist/assets/index4.css +1 -0
  32. package/dist/assets/index5.css +1 -0
  33. package/dist/assets/index6.css +1 -0
  34. package/dist/assets/index7.css +1 -0
  35. package/dist/assets/index8.css +1 -0
  36. package/dist/assets/index9.css +1 -0
  37. package/dist/browser-DxfwT6rn.js +656 -0
  38. package/dist/components/Button/index.d.ts +28 -0
  39. package/dist/components/Button/index.js +18 -0
  40. package/dist/components/Button/index.test.d.ts +1 -0
  41. package/dist/components/Button/index.test.js +23 -0
  42. package/dist/components/Card/index.d.ts +16 -0
  43. package/dist/components/Card/index.js +37 -0
  44. package/dist/components/Card/index.test.d.ts +1 -0
  45. package/dist/components/Card/index.test.js +35 -0
  46. package/dist/components/CustomLink/index.d.ts +11 -0
  47. package/dist/components/CustomLink/index.js +1670 -0
  48. package/dist/components/CustomLink/index.test.d.ts +1 -0
  49. package/dist/components/CustomLink/index.test.js +40 -0
  50. package/dist/components/DataTable/index.d.ts +28 -0
  51. package/dist/components/DataTable/index.js +137 -0
  52. package/dist/components/DataTable/index.test.d.ts +1 -0
  53. package/dist/components/DataTable/index.test.js +3010 -0
  54. package/dist/components/DatePickerController/index.d.ts +16 -0
  55. package/dist/components/DatePickerController/index.js +83 -0
  56. package/dist/components/DatePickerController/index.test.d.ts +1 -0
  57. package/dist/components/DatePickerController/index.test.js +24 -0
  58. package/dist/components/ErrorMessage/index.d.ts +5 -0
  59. package/dist/components/ErrorMessage/index.js +11 -0
  60. package/dist/components/ErrorMessage/index.test.d.ts +1 -0
  61. package/dist/components/ErrorMessage/index.test.js +17 -0
  62. package/dist/components/EvseStateLabel/index.d.ts +5 -0
  63. package/dist/components/EvseStateLabel/index.js +36 -0
  64. package/dist/components/FlexButtons/index.d.ts +9 -0
  65. package/dist/components/FlexButtons/index.js +13 -0
  66. package/dist/components/Form/index.d.ts +8 -0
  67. package/dist/components/Form/index.js +11 -0
  68. package/dist/components/Form/index.test.d.ts +1 -0
  69. package/dist/components/Form/index.test.js +25 -0
  70. package/dist/components/FormItem/index.d.ts +9 -0
  71. package/dist/components/FormItem/index.js +19 -0
  72. package/dist/components/FormItem/index.test.d.ts +1 -0
  73. package/dist/components/FormItem/index.test.js +15 -0
  74. package/dist/components/FormTitle/index.d.ts +5 -0
  75. package/dist/components/FormTitle/index.js +11 -0
  76. package/dist/components/FormTitle/index.test.d.ts +1 -0
  77. package/dist/components/FormTitle/index.test.js +15 -0
  78. package/dist/components/Input/index.d.ts +15 -0
  79. package/dist/components/Input/index.js +39 -0
  80. package/dist/components/Input/index.test.d.ts +1 -0
  81. package/dist/components/Input/index.test.js +39 -0
  82. package/dist/components/InputController/index.d.ts +20 -0
  83. package/dist/components/InputController/index.js +81 -0
  84. package/dist/components/InputController/index.test.d.ts +1 -0
  85. package/dist/components/InputController/index.test.js +56 -0
  86. package/dist/components/InputGroup/index.d.ts +7 -0
  87. package/dist/components/InputGroup/index.js +11 -0
  88. package/dist/components/InputGroup/index.test.d.ts +1 -0
  89. package/dist/components/InputGroup/index.test.js +15 -0
  90. package/dist/components/Label/index.d.ts +7 -0
  91. package/dist/components/Label/index.js +14 -0
  92. package/dist/components/Label/index.test.d.ts +1 -0
  93. package/dist/components/Label/index.test.js +25 -0
  94. package/dist/components/LabeledContent/index.d.ts +15 -0
  95. package/dist/components/LabeledContent/index.js +28 -0
  96. package/dist/components/LabeledContent/index.test.d.ts +1 -0
  97. package/dist/components/LabeledContent/index.test.js +19 -0
  98. package/dist/components/LoadingOverlay/index.d.ts +2 -0
  99. package/dist/components/LoadingOverlay/index.js +134 -0
  100. package/dist/components/LoadingOverlay/index.test.d.ts +1 -0
  101. package/dist/components/LoadingOverlay/index.test.js +12 -0
  102. package/dist/components/Map/index.d.ts +8 -0
  103. package/dist/components/Map/index.js +6575 -0
  104. package/dist/components/MaxWidthContainer/index.d.ts +13 -0
  105. package/dist/components/MaxWidthContainer/index.js +15 -0
  106. package/dist/components/MaxWidthContainer/index.test.d.ts +1 -0
  107. package/dist/components/MaxWidthContainer/index.test.js +24 -0
  108. package/dist/components/NumericFieldController/index.d.ts +53 -0
  109. package/dist/components/NumericFieldController/index.js +620 -0
  110. package/dist/components/NumericFieldController/index.test.d.ts +1 -0
  111. package/dist/components/NumericFieldController/index.test.js +24 -0
  112. package/dist/components/OfflineLabel/index.d.ts +5 -0
  113. package/dist/components/OfflineLabel/index.js +34 -0
  114. package/dist/components/PageSizeSelector/index.d.ts +15 -0
  115. package/dist/components/PageSizeSelector/index.js +43 -0
  116. package/dist/components/Pagination/index.d.ts +9 -0
  117. package/dist/components/Pagination/index.js +7 -0
  118. package/dist/components/Pagination/index.test.d.ts +1 -0
  119. package/dist/components/Pagination/index.test.js +34 -0
  120. package/dist/components/PasswordInputController/index.d.ts +17 -0
  121. package/dist/components/PasswordInputController/index.js +78 -0
  122. package/dist/components/PasswordInputController/index.test.d.ts +1 -0
  123. package/dist/components/PasswordInputController/index.test.js +37 -0
  124. package/dist/components/RadioButton/index.d.ts +13 -0
  125. package/dist/components/RadioButton/index.js +7 -0
  126. package/dist/components/RadioButton/index.test.d.ts +1 -0
  127. package/dist/components/RadioButton/index.test.js +38 -0
  128. package/dist/components/RadioGroupController/index.d.ts +15 -0
  129. package/dist/components/RadioGroupController/index.js +48 -0
  130. package/dist/components/RadioGroupController/index.test.d.ts +1 -0
  131. package/dist/components/RadioGroupController/index.test.js +48 -0
  132. package/dist/components/RangeDatePicker/index.d.ts +14 -0
  133. package/dist/components/RangeDatePicker/index.js +1594 -0
  134. package/dist/components/RangeDatePickerController/index.d.ts +21 -0
  135. package/dist/components/RangeDatePickerController/index.js +123 -0
  136. package/dist/components/RangeDatePickerController/index.test.d.ts +1 -0
  137. package/dist/components/RangeDatePickerController/index.test.js +24 -0
  138. package/dist/components/ReportCard/index.d.ts +12 -0
  139. package/dist/components/ReportCard/index.js +18 -0
  140. package/dist/components/ReportCard/index.test.d.ts +1 -0
  141. package/dist/components/ReportCard/index.test.js +27 -0
  142. package/dist/components/ReportChart/index.d.ts +22 -0
  143. package/dist/components/ReportChart/index.js +23101 -0
  144. package/dist/components/ScrollableDialog/index.d.ts +19 -0
  145. package/dist/components/ScrollableDialog/index.js +42 -0
  146. package/dist/components/ScrollableDialog/index.test.d.ts +1 -0
  147. package/dist/components/ScrollableDialog/index.test.js +59 -0
  148. package/dist/components/SearchForm/index.d.ts +13 -0
  149. package/dist/components/SearchForm/index.js +86 -0
  150. package/dist/components/SelectBox/index.d.ts +18 -0
  151. package/dist/components/SelectBox/index.js +7 -0
  152. package/dist/components/SelectBox/index.test.d.ts +1 -0
  153. package/dist/components/SelectBox/index.test.js +34 -0
  154. package/dist/components/SelectBoxController/index.d.ts +20 -0
  155. package/dist/components/SelectBoxController/index.js +87 -0
  156. package/dist/components/SelectBoxController/index.test.d.ts +1 -0
  157. package/dist/components/SelectBoxController/index.test.js +52 -0
  158. package/dist/components/SubMenu/index.d.ts +22 -0
  159. package/dist/components/SubMenu/index.js +278 -0
  160. package/dist/components/SubMenu/index.test.d.ts +1 -0
  161. package/dist/components/SubMenu/index.test.js +41 -0
  162. package/dist/components/Tabs/index.d.ts +21 -0
  163. package/dist/components/Tabs/index.js +100 -0
  164. package/dist/components/Tabs/index.test.d.ts +1 -0
  165. package/dist/components/Tabs/index.test.js +24 -0
  166. package/dist/components/Textarea/index.d.ts +18 -0
  167. package/dist/components/Textarea/index.js +34 -0
  168. package/dist/components/Textarea/index.test.d.ts +1 -0
  169. package/dist/components/Textarea/index.test.js +25 -0
  170. package/dist/components/ToggleButton/index.d.ts +16 -0
  171. package/dist/components/ToggleButton/index.js +39 -0
  172. package/dist/components/ToggleButton/index.test.d.ts +1 -0
  173. package/dist/components/ToggleButton/index.test.js +49 -0
  174. package/dist/constants/datetime.d.ts +2 -0
  175. package/dist/constants/datetime.js +5 -0
  176. package/dist/createSvgIcon-B53UOwxg.js +183 -0
  177. package/dist/createSvgIcon-Dj8zNxRS.js +72 -0
  178. package/dist/index-BLPOOjNr.js +184 -0
  179. package/dist/index-BOjtnFU5.js +34 -0
  180. package/dist/index-Bs3JCwgu.js +689 -0
  181. package/dist/index-CICI7n5Y.js +19688 -0
  182. package/dist/index-CQDJfJT1.js +50 -0
  183. package/dist/index-C_i0-R5C.js +393 -0
  184. package/dist/index-DWRHnq8_.js +42 -0
  185. package/dist/index-Di2gTfPF.js +25175 -0
  186. package/dist/index-VF82hRp0.js +2522 -0
  187. package/dist/index-kvi6aotO.js +39 -0
  188. package/dist/index.d.ts +38 -0
  189. package/dist/index.esm-ChwJSgnF.js +1052 -0
  190. package/dist/index.js +77 -0
  191. package/dist/isEqual-BBhdD79C.js +667 -0
  192. package/dist/mergeSlotProps-J197zKan.js +63 -0
  193. package/dist/react.esm-C8amP77L.js +11182 -0
  194. package/dist/styled-CWju4EfZ.js +2702 -0
  195. package/dist/unsupportedProp-DZaWZqWQ.js +30 -0
  196. package/dist/useControlled-BQCJRJNJ.js +64 -0
  197. package/dist/useIsFocusVisible-BxB-Hdhb.js +124 -0
  198. package/dist/useSlotProps-Bh7akxXV.js +33 -0
  199. package/package.json +360 -0
@@ -0,0 +1,1052 @@
1
+ import D from "react";
2
+ var fe = (e) => e.type === "checkbox", ie = (e) => e instanceof Date, O = (e) => e == null;
3
+ const et = (e) => typeof e == "object";
4
+ var R = (e) => !O(e) && !Array.isArray(e) && et(e) && !ie(e), tt = (e) => R(e) && e.target ? fe(e.target) ? e.target.checked : e.target.value : e, At = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, rt = (e, s) => e.has(At(s)), xt = (e) => {
5
+ const s = e.constructor && e.constructor.prototype;
6
+ return R(s) && s.hasOwnProperty("isPrototypeOf");
7
+ }, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function p(e) {
9
+ let s;
10
+ const t = Array.isArray(e);
11
+ if (e instanceof Date)
12
+ s = new Date(e);
13
+ else if (e instanceof Set)
14
+ s = new Set(e);
15
+ else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (t || R(e)))
16
+ if (s = t ? [] : {}, !t && !xt(e))
17
+ s = e;
18
+ else
19
+ for (const u in e)
20
+ e.hasOwnProperty(u) && (s[u] = p(e[u]));
21
+ else
22
+ return e;
23
+ return s;
24
+ }
25
+ var ce = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, f = (e, s, t) => {
26
+ if (!s || !R(e))
27
+ return t;
28
+ const u = ce(s.split(/[,[\].]+?/)).reduce((n, a) => O(n) ? n : n[a], e);
29
+ return w(u) || u === e ? w(e[s]) ? t : e[s] : u;
30
+ }, W = (e) => typeof e == "boolean";
31
+ const _e = {
32
+ BLUR: "blur",
33
+ FOCUS_OUT: "focusout",
34
+ CHANGE: "change"
35
+ }, H = {
36
+ onBlur: "onBlur",
37
+ onChange: "onChange",
38
+ onSubmit: "onSubmit",
39
+ onTouched: "onTouched",
40
+ all: "all"
41
+ }, z = {
42
+ max: "max",
43
+ min: "min",
44
+ maxLength: "maxLength",
45
+ minLength: "minLength",
46
+ pattern: "pattern",
47
+ required: "required",
48
+ validate: "validate"
49
+ }, mt = D.createContext(null), Le = () => D.useContext(mt);
50
+ var st = (e, s, t, u = !0) => {
51
+ const n = {
52
+ defaultValues: s._defaultValues
53
+ };
54
+ for (const a in e)
55
+ Object.defineProperty(n, a, {
56
+ get: () => {
57
+ const y = a;
58
+ return s._proxyFormState[y] !== H.all && (s._proxyFormState[y] = !u || H.all), t && (t[y] = !0), e[y];
59
+ }
60
+ });
61
+ return n;
62
+ }, B = (e) => R(e) && !Object.keys(e).length, it = (e, s, t, u) => {
63
+ t(e);
64
+ const { name: n, ...a } = e;
65
+ return B(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === (!u || H.all));
66
+ }, he = (e) => Array.isArray(e) ? e : [e], ut = (e, s, t) => !e || !s || e === s || he(e).some((u) => u && (t ? u === s : u.startsWith(s) || s.startsWith(u)));
67
+ function Te(e) {
68
+ const s = D.useRef(e);
69
+ s.current = e, D.useEffect(() => {
70
+ const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
71
+ next: s.current.next
72
+ });
73
+ return () => {
74
+ t && t.unsubscribe();
75
+ };
76
+ }, [e.disabled]);
77
+ }
78
+ function Dt(e) {
79
+ const s = Le(), { control: t = s.control, disabled: u, name: n, exact: a } = e || {}, [y, h] = D.useState(t._formState), m = D.useRef(!0), S = D.useRef({
80
+ isDirty: !1,
81
+ isLoading: !1,
82
+ dirtyFields: !1,
83
+ touchedFields: !1,
84
+ validatingFields: !1,
85
+ isValidating: !1,
86
+ isValid: !1,
87
+ errors: !1
88
+ }), _ = D.useRef(n);
89
+ return _.current = n, Te({
90
+ disabled: u,
91
+ next: (v) => m.current && ut(_.current, v.name, a) && it(v, S.current, t._updateFormState) && h({
92
+ ...t._formState,
93
+ ...v
94
+ }),
95
+ subject: t._subjects.state
96
+ }), D.useEffect(() => (m.current = !0, S.current.isValid && t._updateValid(!0), () => {
97
+ m.current = !1;
98
+ }), [t]), st(y, t, S.current, !1);
99
+ }
100
+ var $ = (e) => typeof e == "string", lt = (e, s, t, u, n) => $(e) ? (u && s.watch.add(e), f(t, e, n)) : Array.isArray(e) ? e.map((a) => (u && s.watch.add(a), f(t, a))) : (u && (s.watchAll = !0), t);
101
+ function wt(e) {
102
+ const s = Le(), { control: t = s.control, name: u, defaultValue: n, disabled: a, exact: y } = e || {}, h = D.useRef(u);
103
+ h.current = u, Te({
104
+ disabled: a,
105
+ subject: t._subjects.values,
106
+ next: (_) => {
107
+ ut(h.current, _.name, y) && S(p(lt(h.current, t._names, _.values || t._formValues, !1, n)));
108
+ }
109
+ });
110
+ const [m, S] = D.useState(t._getWatch(u, n));
111
+ return D.useEffect(() => t._removeUnmounted()), m;
112
+ }
113
+ var Ue = (e) => /^\w*$/.test(e), at = (e) => ce(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, s, t) => {
114
+ let u = -1;
115
+ const n = Ue(s) ? [s] : at(s), a = n.length, y = a - 1;
116
+ for (; ++u < a; ) {
117
+ const h = n[u];
118
+ let m = t;
119
+ if (u !== y) {
120
+ const S = e[h];
121
+ m = R(S) || Array.isArray(S) ? S : isNaN(+n[u + 1]) ? {} : [];
122
+ }
123
+ e[h] = m, e = e[h];
124
+ }
125
+ return e;
126
+ };
127
+ function St(e) {
128
+ const s = Le(), { name: t, disabled: u, control: n = s.control, shouldUnregister: a } = e, y = rt(n._names.array, t), h = wt({
129
+ control: n,
130
+ name: t,
131
+ defaultValue: f(n._formValues, t, f(n._defaultValues, t, e.defaultValue)),
132
+ exact: !0
133
+ }), m = Dt({
134
+ control: n,
135
+ name: t
136
+ }), S = D.useRef(n.register(t, {
137
+ ...e.rules,
138
+ value: h,
139
+ ...W(e.disabled) ? { disabled: e.disabled } : {}
140
+ }));
141
+ return D.useEffect(() => {
142
+ const _ = n._options.shouldUnregister || a, v = (N, j) => {
143
+ const T = f(n._fields, N);
144
+ T && (T._f.mount = j);
145
+ };
146
+ if (v(t, !0), _) {
147
+ const N = p(f(n._options.defaultValues, t));
148
+ x(n._defaultValues, t, N), w(f(n._formValues, t)) && x(n._formValues, t, N);
149
+ }
150
+ return () => {
151
+ (y ? _ && !n._state.action : _) ? n.unregister(t) : v(t, !1);
152
+ };
153
+ }, [t, n, y, a]), D.useEffect(() => {
154
+ f(n._fields, t) && n._updateDisabledField({
155
+ disabled: u,
156
+ fields: n._fields,
157
+ name: t,
158
+ value: f(n._fields, t)._f.value
159
+ });
160
+ }, [u, t, n]), {
161
+ field: {
162
+ name: t,
163
+ value: h,
164
+ ...W(u) || m.disabled ? { disabled: m.disabled || u } : {},
165
+ onChange: D.useCallback((_) => S.current.onChange({
166
+ target: {
167
+ value: tt(_),
168
+ name: t
169
+ },
170
+ type: _e.CHANGE
171
+ }), [t]),
172
+ onBlur: D.useCallback(() => S.current.onBlur({
173
+ target: {
174
+ value: f(n._formValues, t),
175
+ name: t
176
+ },
177
+ type: _e.BLUR
178
+ }), [t, n]),
179
+ ref: (_) => {
180
+ const v = f(n._fields, t);
181
+ v && _ && (v._f.ref = {
182
+ focus: () => _.focus(),
183
+ select: () => _.select(),
184
+ setCustomValidity: (N) => _.setCustomValidity(N),
185
+ reportValidity: () => _.reportValidity()
186
+ });
187
+ }
188
+ },
189
+ formState: m,
190
+ fieldState: Object.defineProperties({}, {
191
+ invalid: {
192
+ enumerable: !0,
193
+ get: () => !!f(m.errors, t)
194
+ },
195
+ isDirty: {
196
+ enumerable: !0,
197
+ get: () => !!f(m.dirtyFields, t)
198
+ },
199
+ isTouched: {
200
+ enumerable: !0,
201
+ get: () => !!f(m.touchedFields, t)
202
+ },
203
+ isValidating: {
204
+ enumerable: !0,
205
+ get: () => !!f(m.validatingFields, t)
206
+ },
207
+ error: {
208
+ enumerable: !0,
209
+ get: () => f(m.errors, t)
210
+ }
211
+ })
212
+ };
213
+ }
214
+ const Wt = (e) => e.render(St(e));
215
+ var kt = (e, s, t, u, n) => s ? {
216
+ ...t[e],
217
+ types: {
218
+ ...t[e] && t[e].types ? t[e].types : {},
219
+ [u]: n || !0
220
+ }
221
+ } : {}, Ke = (e) => ({
222
+ isOnSubmit: !e || e === H.onSubmit,
223
+ isOnBlur: e === H.onBlur,
224
+ isOnChange: e === H.onChange,
225
+ isOnAll: e === H.all,
226
+ isOnTouch: e === H.onTouched
227
+ }), Ge = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((u) => e.startsWith(u) && /^\.\w+/.test(e.slice(u.length))));
228
+ const oe = (e, s, t, u) => {
229
+ for (const n of t || Object.keys(e)) {
230
+ const a = f(e, n);
231
+ if (a) {
232
+ const { _f: y, ...h } = a;
233
+ if (y) {
234
+ if (y.refs && y.refs[0] && s(y.refs[0], n) && !u)
235
+ break;
236
+ if (y.ref && s(y.ref, y.name) && !u)
237
+ break;
238
+ oe(h, s);
239
+ } else
240
+ R(h) && oe(h, s);
241
+ }
242
+ }
243
+ };
244
+ var Et = (e, s, t) => {
245
+ const u = ce(f(e, t));
246
+ return x(u, "root", s[t]), x(e, t, u), e;
247
+ }, Oe = (e) => e.type === "file", X = (e) => typeof e == "function", be = (e) => {
248
+ if (!Re)
249
+ return !1;
250
+ const s = e ? e.ownerDocument : 0;
251
+ return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
252
+ }, ve = (e) => $(e), pe = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
253
+ const ze = {
254
+ value: !1,
255
+ isValid: !1
256
+ }, Je = { value: !0, isValid: !0 };
257
+ var nt = (e) => {
258
+ if (Array.isArray(e)) {
259
+ if (e.length > 1) {
260
+ const s = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
261
+ return { value: s, isValid: !!s.length };
262
+ }
263
+ return e[0].checked && !e[0].disabled ? (
264
+ // @ts-expect-error expected to work in the browser
265
+ e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Je : { value: e[0].value, isValid: !0 } : Je
266
+ ) : ze;
267
+ }
268
+ return ze;
269
+ };
270
+ const Qe = {
271
+ isValid: !1,
272
+ value: null
273
+ };
274
+ var ot = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
275
+ isValid: !0,
276
+ value: t.value
277
+ } : s, Qe) : Qe;
278
+ function Xe(e, s, t = "validate") {
279
+ if (ve(e) || Array.isArray(e) && e.every(ve) || W(e) && !e)
280
+ return {
281
+ type: t,
282
+ message: ve(e) ? e : "",
283
+ ref: s
284
+ };
285
+ }
286
+ var se = (e) => R(e) && !Ve(e) ? e : {
287
+ value: e,
288
+ message: ""
289
+ }, Ye = async (e, s, t, u, n) => {
290
+ const { ref: a, refs: y, required: h, maxLength: m, minLength: S, min: _, max: v, pattern: N, validate: j, name: T, valueAsNumber: xe, mount: J, disabled: Q } = e._f, V = f(s, T);
291
+ if (!J || Q)
292
+ return {};
293
+ const K = y ? y[0] : a, G = (b) => {
294
+ u && K.reportValidity && (K.setCustomValidity(W(b) ? "" : b || ""), K.reportValidity());
295
+ }, k = {}, ee = pe(a), de = fe(a), Y = ee || de, te = (xe || Oe(a)) && w(a.value) && w(V) || be(a) && a.value === "" || V === "" || Array.isArray(V) && !V.length, P = kt.bind(null, T, t, k), ye = (b, F, E, U = z.maxLength, q = z.minLength) => {
296
+ const I = b ? F : E;
297
+ k[T] = {
298
+ type: b ? U : q,
299
+ message: I,
300
+ ref: a,
301
+ ...P(b ? U : q, I)
302
+ };
303
+ };
304
+ if (n ? !Array.isArray(V) || !V.length : h && (!Y && (te || O(V)) || W(V) && !V || de && !nt(y).isValid || ee && !ot(y).isValid)) {
305
+ const { value: b, message: F } = ve(h) ? { value: !!h, message: h } : se(h);
306
+ if (b && (k[T] = {
307
+ type: z.required,
308
+ message: F,
309
+ ref: K,
310
+ ...P(z.required, F)
311
+ }, !t))
312
+ return G(F), k;
313
+ }
314
+ if (!te && (!O(_) || !O(v))) {
315
+ let b, F;
316
+ const E = se(v), U = se(_);
317
+ if (!O(V) && !isNaN(V)) {
318
+ const q = a.valueAsNumber || V && +V;
319
+ O(E.value) || (b = q > E.value), O(U.value) || (F = q < U.value);
320
+ } else {
321
+ const q = a.valueAsDate || new Date(V), I = (ae) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ae), ue = a.type == "time", le = a.type == "week";
322
+ $(E.value) && V && (b = ue ? I(V) > I(E.value) : le ? V > E.value : q > new Date(E.value)), $(U.value) && V && (F = ue ? I(V) < I(U.value) : le ? V < U.value : q < new Date(U.value));
323
+ }
324
+ if ((b || F) && (ye(!!b, E.message, U.message, z.max, z.min), !t))
325
+ return G(k[T].message), k;
326
+ }
327
+ if ((m || S) && !te && ($(V) || n && Array.isArray(V))) {
328
+ const b = se(m), F = se(S), E = !O(b.value) && V.length > +b.value, U = !O(F.value) && V.length < +F.value;
329
+ if ((E || U) && (ye(E, b.message, F.message), !t))
330
+ return G(k[T].message), k;
331
+ }
332
+ if (N && !te && $(V)) {
333
+ const { value: b, message: F } = se(N);
334
+ if (Ve(b) && !V.match(b) && (k[T] = {
335
+ type: z.pattern,
336
+ message: F,
337
+ ref: a,
338
+ ...P(z.pattern, F)
339
+ }, !t))
340
+ return G(F), k;
341
+ }
342
+ if (j) {
343
+ if (X(j)) {
344
+ const b = await j(V, s), F = Xe(b, K);
345
+ if (F && (k[T] = {
346
+ ...F,
347
+ ...P(z.validate, F.message)
348
+ }, !t))
349
+ return G(F.message), k;
350
+ } else if (R(j)) {
351
+ let b = {};
352
+ for (const F in j) {
353
+ if (!B(b) && !t)
354
+ break;
355
+ const E = Xe(await j[F](V, s), K, F);
356
+ E && (b = {
357
+ ...E,
358
+ ...P(F, E.message)
359
+ }, G(E.message), t && (k[T] = b));
360
+ }
361
+ if (!B(b) && (k[T] = {
362
+ ref: K,
363
+ ...b
364
+ }, !t))
365
+ return k;
366
+ }
367
+ }
368
+ return G(!0), k;
369
+ };
370
+ function Ct(e, s) {
371
+ const t = s.slice(0, -1).length;
372
+ let u = 0;
373
+ for (; u < t; )
374
+ e = w(e) ? u++ : e[s[u++]];
375
+ return e;
376
+ }
377
+ function Rt(e) {
378
+ for (const s in e)
379
+ if (e.hasOwnProperty(s) && !w(e[s]))
380
+ return !1;
381
+ return !0;
382
+ }
383
+ function C(e, s) {
384
+ const t = Array.isArray(s) ? s : Ue(s) ? [s] : at(s), u = t.length === 1 ? e : Ct(e, t), n = t.length - 1, a = t[n];
385
+ return u && delete u[a], n !== 0 && (R(u) && B(u) || Array.isArray(u) && Rt(u)) && C(e, t.slice(0, -1)), e;
386
+ }
387
+ var ke = () => {
388
+ let e = [];
389
+ return {
390
+ get observers() {
391
+ return e;
392
+ },
393
+ next: (n) => {
394
+ for (const a of e)
395
+ a.next && a.next(n);
396
+ },
397
+ subscribe: (n) => (e.push(n), {
398
+ unsubscribe: () => {
399
+ e = e.filter((a) => a !== n);
400
+ }
401
+ }),
402
+ unsubscribe: () => {
403
+ e = [];
404
+ }
405
+ };
406
+ }, Fe = (e) => O(e) || !et(e);
407
+ function Z(e, s) {
408
+ if (Fe(e) || Fe(s))
409
+ return e === s;
410
+ if (ie(e) && ie(s))
411
+ return e.getTime() === s.getTime();
412
+ const t = Object.keys(e), u = Object.keys(s);
413
+ if (t.length !== u.length)
414
+ return !1;
415
+ for (const n of t) {
416
+ const a = e[n];
417
+ if (!u.includes(n))
418
+ return !1;
419
+ if (n !== "ref") {
420
+ const y = s[n];
421
+ if (ie(a) && ie(y) || R(a) && R(y) || Array.isArray(a) && Array.isArray(y) ? !Z(a, y) : a !== y)
422
+ return !1;
423
+ }
424
+ }
425
+ return !0;
426
+ }
427
+ var ft = (e) => e.type === "select-multiple", Lt = (e) => pe(e) || fe(e), Ee = (e) => be(e) && e.isConnected, ct = (e) => {
428
+ for (const s in e)
429
+ if (X(e[s]))
430
+ return !0;
431
+ return !1;
432
+ };
433
+ function Ae(e, s = {}) {
434
+ const t = Array.isArray(e);
435
+ if (R(e) || t)
436
+ for (const u in e)
437
+ Array.isArray(e[u]) || R(e[u]) && !ct(e[u]) ? (s[u] = Array.isArray(e[u]) ? [] : {}, Ae(e[u], s[u])) : O(e[u]) || (s[u] = !0);
438
+ return s;
439
+ }
440
+ function dt(e, s, t) {
441
+ const u = Array.isArray(e);
442
+ if (R(e) || u)
443
+ for (const n in e)
444
+ Array.isArray(e[n]) || R(e[n]) && !ct(e[n]) ? w(s) || Fe(t[n]) ? t[n] = Array.isArray(e[n]) ? Ae(e[n], []) : { ...Ae(e[n]) } : dt(e[n], O(s) ? {} : s[n], t[n]) : t[n] = !Z(e[n], s[n]);
445
+ return t;
446
+ }
447
+ var ge = (e, s) => dt(e, s, Ae(s)), yt = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: u }) => w(e) ? e : s ? e === "" ? NaN : e && +e : t && $(e) ? new Date(e) : u ? u(e) : e;
448
+ function Ce(e) {
449
+ const s = e.ref;
450
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
451
+ return Oe(s) ? s.files : pe(s) ? ot(e.refs).value : ft(s) ? [...s.selectedOptions].map(({ value: t }) => t) : fe(s) ? nt(e.refs).value : yt(w(s.value) ? e.ref.value : s.value, e);
452
+ }
453
+ var Tt = (e, s, t, u) => {
454
+ const n = {};
455
+ for (const a of e) {
456
+ const y = f(s, a);
457
+ y && x(n, a, y._f);
458
+ }
459
+ return {
460
+ criteriaMode: t,
461
+ names: [...e],
462
+ fields: n,
463
+ shouldUseNativeValidation: u
464
+ };
465
+ }, ne = (e) => w(e) ? e : Ve(e) ? e.source : R(e) ? Ve(e.value) ? e.value.source : e.value : e, Ut = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
466
+ function Ze(e, s, t) {
467
+ const u = f(e, t);
468
+ if (u || Ue(t))
469
+ return {
470
+ error: u,
471
+ name: t
472
+ };
473
+ const n = t.split(".");
474
+ for (; n.length; ) {
475
+ const a = n.join("."), y = f(s, a), h = f(e, a);
476
+ if (y && !Array.isArray(y) && t !== a)
477
+ return { name: t };
478
+ if (h && h.type)
479
+ return {
480
+ name: a,
481
+ error: h
482
+ };
483
+ n.pop();
484
+ }
485
+ return {
486
+ name: t
487
+ };
488
+ }
489
+ var Ot = (e, s, t, u, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(s || e) : (t ? u.isOnBlur : n.isOnBlur) ? !e : (t ? u.isOnChange : n.isOnChange) ? e : !0, pt = (e, s) => !ce(f(e, s)).length && C(e, s);
490
+ const Mt = {
491
+ mode: H.onSubmit,
492
+ reValidateMode: H.onChange,
493
+ shouldFocusError: !0
494
+ };
495
+ function Bt(e = {}) {
496
+ let s = {
497
+ ...Mt,
498
+ ...e
499
+ }, t = {
500
+ submitCount: 0,
501
+ isDirty: !1,
502
+ isLoading: X(s.defaultValues),
503
+ isValidating: !1,
504
+ isSubmitted: !1,
505
+ isSubmitting: !1,
506
+ isSubmitSuccessful: !1,
507
+ isValid: !1,
508
+ touchedFields: {},
509
+ dirtyFields: {},
510
+ validatingFields: {},
511
+ errors: s.errors || {},
512
+ disabled: s.disabled || !1
513
+ }, u = {}, n = R(s.defaultValues) || R(s.values) ? p(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : p(n), y = {
514
+ action: !1,
515
+ mount: !1,
516
+ watch: !1
517
+ }, h = {
518
+ mount: /* @__PURE__ */ new Set(),
519
+ unMount: /* @__PURE__ */ new Set(),
520
+ array: /* @__PURE__ */ new Set(),
521
+ watch: /* @__PURE__ */ new Set()
522
+ }, m, S = 0;
523
+ const _ = {
524
+ isDirty: !1,
525
+ dirtyFields: !1,
526
+ validatingFields: !1,
527
+ touchedFields: !1,
528
+ isValidating: !1,
529
+ isValid: !1,
530
+ errors: !1
531
+ }, v = {
532
+ values: ke(),
533
+ array: ke(),
534
+ state: ke()
535
+ }, N = Ke(s.mode), j = Ke(s.reValidateMode), T = s.criteriaMode === H.all, xe = (r) => (i) => {
536
+ clearTimeout(S), S = setTimeout(r, i);
537
+ }, J = async (r) => {
538
+ if (_.isValid || r) {
539
+ const i = s.resolver ? B((await Y()).errors) : await P(u, !0);
540
+ i !== t.isValid && v.state.next({
541
+ isValid: i
542
+ });
543
+ }
544
+ }, Q = (r, i) => {
545
+ (_.isValidating || _.validatingFields) && ((r || Array.from(h.mount)).forEach((l) => {
546
+ l && (i ? x(t.validatingFields, l, i) : C(t.validatingFields, l));
547
+ }), v.state.next({
548
+ validatingFields: t.validatingFields,
549
+ isValidating: !B(t.validatingFields)
550
+ }));
551
+ }, V = (r, i = [], l, d, c = !0, o = !0) => {
552
+ if (d && l) {
553
+ if (y.action = !0, o && Array.isArray(f(u, r))) {
554
+ const g = l(f(u, r), d.argA, d.argB);
555
+ c && x(u, r, g);
556
+ }
557
+ if (o && Array.isArray(f(t.errors, r))) {
558
+ const g = l(f(t.errors, r), d.argA, d.argB);
559
+ c && x(t.errors, r, g), pt(t.errors, r);
560
+ }
561
+ if (_.touchedFields && o && Array.isArray(f(t.touchedFields, r))) {
562
+ const g = l(f(t.touchedFields, r), d.argA, d.argB);
563
+ c && x(t.touchedFields, r, g);
564
+ }
565
+ _.dirtyFields && (t.dirtyFields = ge(n, a)), v.state.next({
566
+ name: r,
567
+ isDirty: b(r, i),
568
+ dirtyFields: t.dirtyFields,
569
+ errors: t.errors,
570
+ isValid: t.isValid
571
+ });
572
+ } else
573
+ x(a, r, i);
574
+ }, K = (r, i) => {
575
+ x(t.errors, r, i), v.state.next({
576
+ errors: t.errors
577
+ });
578
+ }, G = (r) => {
579
+ t.errors = r, v.state.next({
580
+ errors: t.errors,
581
+ isValid: !1
582
+ });
583
+ }, k = (r, i, l, d) => {
584
+ const c = f(u, r);
585
+ if (c) {
586
+ const o = f(a, r, w(l) ? f(n, r) : l);
587
+ w(o) || d && d.defaultChecked || i ? x(a, r, i ? o : Ce(c._f)) : U(r, o), y.mount && J();
588
+ }
589
+ }, ee = (r, i, l, d, c) => {
590
+ let o = !1, g = !1;
591
+ const A = {
592
+ name: r
593
+ }, L = !!(f(u, r) && f(u, r)._f.disabled);
594
+ if (!l || d) {
595
+ _.isDirty && (g = t.isDirty, t.isDirty = A.isDirty = b(), o = g !== A.isDirty);
596
+ const M = L || Z(f(n, r), i);
597
+ g = !!(!L && f(t.dirtyFields, r)), M || L ? C(t.dirtyFields, r) : x(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, o = o || _.dirtyFields && g !== !M;
598
+ }
599
+ if (l) {
600
+ const M = f(t.touchedFields, r);
601
+ M || (x(t.touchedFields, r, l), A.touchedFields = t.touchedFields, o = o || _.touchedFields && M !== l);
602
+ }
603
+ return o && c && v.state.next(A), o ? A : {};
604
+ }, de = (r, i, l, d) => {
605
+ const c = f(t.errors, r), o = _.isValid && W(i) && t.isValid !== i;
606
+ if (e.delayError && l ? (m = xe(() => K(r, l)), m(e.delayError)) : (clearTimeout(S), m = null, l ? x(t.errors, r, l) : C(t.errors, r)), (l ? !Z(c, l) : c) || !B(d) || o) {
607
+ const g = {
608
+ ...d,
609
+ ...o && W(i) ? { isValid: i } : {},
610
+ errors: t.errors,
611
+ name: r
612
+ };
613
+ t = {
614
+ ...t,
615
+ ...g
616
+ }, v.state.next(g);
617
+ }
618
+ }, Y = async (r) => {
619
+ Q(r, !0);
620
+ const i = await s.resolver(a, s.context, Tt(r || h.mount, u, s.criteriaMode, s.shouldUseNativeValidation));
621
+ return Q(r), i;
622
+ }, te = async (r) => {
623
+ const { errors: i } = await Y(r);
624
+ if (r)
625
+ for (const l of r) {
626
+ const d = f(i, l);
627
+ d ? x(t.errors, l, d) : C(t.errors, l);
628
+ }
629
+ else
630
+ t.errors = i;
631
+ return i;
632
+ }, P = async (r, i, l = {
633
+ valid: !0
634
+ }) => {
635
+ for (const d in r) {
636
+ const c = r[d];
637
+ if (c) {
638
+ const { _f: o, ...g } = c;
639
+ if (o) {
640
+ const A = h.array.has(o.name);
641
+ Q([d], !0);
642
+ const L = await Ye(c, a, T, s.shouldUseNativeValidation && !i, A);
643
+ if (Q([d]), L[o.name] && (l.valid = !1, i))
644
+ break;
645
+ !i && (f(L, o.name) ? A ? Et(t.errors, L, o.name) : x(t.errors, o.name, L[o.name]) : C(t.errors, o.name));
646
+ }
647
+ g && await P(g, i, l);
648
+ }
649
+ }
650
+ return l.valid;
651
+ }, ye = () => {
652
+ for (const r of h.unMount) {
653
+ const i = f(u, r);
654
+ i && (i._f.refs ? i._f.refs.every((l) => !Ee(l)) : !Ee(i._f.ref)) && me(r);
655
+ }
656
+ h.unMount = /* @__PURE__ */ new Set();
657
+ }, b = (r, i) => (r && i && x(a, r, i), !Z(Me(), n)), F = (r, i, l) => lt(r, h, {
658
+ ...y.mount ? a : w(i) ? n : $(r) ? { [r]: i } : i
659
+ }, l, i), E = (r) => ce(f(y.mount ? a : n, r, e.shouldUnregister ? f(n, r, []) : [])), U = (r, i, l = {}) => {
660
+ const d = f(u, r);
661
+ let c = i;
662
+ if (d) {
663
+ const o = d._f;
664
+ o && (!o.disabled && x(a, r, yt(i, o)), c = be(o.ref) && O(i) ? "" : i, ft(o.ref) ? [...o.ref.options].forEach((g) => g.selected = c.includes(g.value)) : o.refs ? fe(o.ref) ? o.refs.length > 1 ? o.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(c) ? !!c.find((A) => A === g.value) : c === g.value)) : o.refs[0] && (o.refs[0].checked = !!c) : o.refs.forEach((g) => g.checked = g.value === c) : Oe(o.ref) ? o.ref.value = "" : (o.ref.value = c, o.ref.type || v.values.next({
665
+ name: r,
666
+ values: { ...a }
667
+ })));
668
+ }
669
+ (l.shouldDirty || l.shouldTouch) && ee(r, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ae(r);
670
+ }, q = (r, i, l) => {
671
+ for (const d in i) {
672
+ const c = i[d], o = `${r}.${d}`, g = f(u, o);
673
+ (h.array.has(r) || !Fe(c) || g && !g._f) && !ie(c) ? q(o, c, l) : U(o, c, l);
674
+ }
675
+ }, I = (r, i, l = {}) => {
676
+ const d = f(u, r), c = h.array.has(r), o = p(i);
677
+ x(a, r, o), c ? (v.array.next({
678
+ name: r,
679
+ values: { ...a }
680
+ }), (_.isDirty || _.dirtyFields) && l.shouldDirty && v.state.next({
681
+ name: r,
682
+ dirtyFields: ge(n, a),
683
+ isDirty: b(r, o)
684
+ })) : d && !d._f && !O(o) ? q(r, o, l) : U(r, o, l), Ge(r, h) && v.state.next({ ...t }), v.values.next({
685
+ name: y.mount ? r : void 0,
686
+ values: { ...a }
687
+ });
688
+ }, ue = async (r) => {
689
+ y.mount = !0;
690
+ const i = r.target;
691
+ let l = i.name, d = !0;
692
+ const c = f(u, l), o = () => i.type ? Ce(c._f) : tt(r), g = (A) => {
693
+ d = Number.isNaN(A) || A === f(a, l, A);
694
+ };
695
+ if (c) {
696
+ let A, L;
697
+ const M = o(), re = r.type === _e.BLUR || r.type === _e.FOCUS_OUT, bt = !Ut(c._f) && !s.resolver && !f(t.errors, l) && !c._f.deps || Ot(re, f(t.touchedFields, l), t.isSubmitted, j, N), we = Ge(l, h, re);
698
+ x(a, l, M), re ? (c._f.onBlur && c._f.onBlur(r), m && m(0)) : c._f.onChange && c._f.onChange(r);
699
+ const Se = ee(l, M, re, !1), Vt = !B(Se) || we;
700
+ if (!re && v.values.next({
701
+ name: l,
702
+ type: r.type,
703
+ values: { ...a }
704
+ }), bt)
705
+ return _.isValid && J(), Vt && v.state.next({ name: l, ...we ? {} : Se });
706
+ if (!re && we && v.state.next({ ...t }), s.resolver) {
707
+ const { errors: je } = await Y([l]);
708
+ if (g(M), d) {
709
+ const Ft = Ze(t.errors, u, l), $e = Ze(je, u, Ft.name || l);
710
+ A = $e.error, l = $e.name, L = B(je);
711
+ }
712
+ } else
713
+ Q([l], !0), A = (await Ye(c, a, T, s.shouldUseNativeValidation))[l], Q([l]), g(M), d && (A ? L = !1 : _.isValid && (L = await P(u, !0)));
714
+ d && (c._f.deps && ae(c._f.deps), de(l, L, A, Se));
715
+ }
716
+ }, le = (r, i) => {
717
+ if (f(t.errors, i) && r.focus)
718
+ return r.focus(), 1;
719
+ }, ae = async (r, i = {}) => {
720
+ let l, d;
721
+ const c = he(r);
722
+ if (s.resolver) {
723
+ const o = await te(w(r) ? r : c);
724
+ l = B(o), d = r ? !c.some((g) => f(o, g)) : l;
725
+ } else
726
+ r ? (d = (await Promise.all(c.map(async (o) => {
727
+ const g = f(u, o);
728
+ return await P(g && g._f ? { [o]: g } : g);
729
+ }))).every(Boolean), !(!d && !t.isValid) && J()) : d = l = await P(u);
730
+ return v.state.next({
731
+ ...!$(r) || _.isValid && l !== t.isValid ? {} : { name: r },
732
+ ...s.resolver || !r ? { isValid: l } : {},
733
+ errors: t.errors
734
+ }), i.shouldFocus && !d && oe(u, le, r ? c : h.mount), d;
735
+ }, Me = (r) => {
736
+ const i = {
737
+ ...n,
738
+ ...y.mount ? a : {}
739
+ };
740
+ return w(r) ? i : $(r) ? f(i, r) : r.map((l) => f(i, l));
741
+ }, Be = (r, i) => ({
742
+ invalid: !!f((i || t).errors, r),
743
+ isDirty: !!f((i || t).dirtyFields, r),
744
+ isTouched: !!f((i || t).touchedFields, r),
745
+ isValidating: !!f((i || t).validatingFields, r),
746
+ error: f((i || t).errors, r)
747
+ }), gt = (r) => {
748
+ r && he(r).forEach((i) => C(t.errors, i)), v.state.next({
749
+ errors: r ? t.errors : {}
750
+ });
751
+ }, Pe = (r, i, l) => {
752
+ const d = (f(u, r, { _f: {} })._f || {}).ref;
753
+ x(t.errors, r, {
754
+ ...i,
755
+ ref: d
756
+ }), v.state.next({
757
+ name: r,
758
+ errors: t.errors,
759
+ isValid: !1
760
+ }), l && l.shouldFocus && d && d.focus && d.focus();
761
+ }, ht = (r, i) => X(r) ? v.values.subscribe({
762
+ next: (l) => r(F(void 0, i), l)
763
+ }) : F(r, i, !0), me = (r, i = {}) => {
764
+ for (const l of r ? he(r) : h.mount)
765
+ h.mount.delete(l), h.array.delete(l), i.keepValue || (C(u, l), C(a, l)), !i.keepError && C(t.errors, l), !i.keepDirty && C(t.dirtyFields, l), !i.keepTouched && C(t.touchedFields, l), !i.keepIsValidating && C(t.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && C(n, l);
766
+ v.values.next({
767
+ values: { ...a }
768
+ }), v.state.next({
769
+ ...t,
770
+ ...i.keepDirty ? { isDirty: b() } : {}
771
+ }), !i.keepIsValid && J();
772
+ }, Ie = ({ disabled: r, name: i, field: l, fields: d, value: c }) => {
773
+ if (W(r)) {
774
+ const o = r ? void 0 : w(c) ? Ce(l ? l._f : f(d, i)._f) : c;
775
+ x(a, i, o), ee(i, o, !1, !1, !0);
776
+ }
777
+ }, De = (r, i = {}) => {
778
+ let l = f(u, r);
779
+ const d = W(i.disabled);
780
+ return x(u, r, {
781
+ ...l || {},
782
+ _f: {
783
+ ...l && l._f ? l._f : { ref: { name: r } },
784
+ name: r,
785
+ mount: !0,
786
+ ...i
787
+ }
788
+ }), h.mount.add(r), l ? Ie({
789
+ field: l,
790
+ disabled: i.disabled,
791
+ name: r,
792
+ value: i.value
793
+ }) : k(r, !0, i.value), {
794
+ ...d ? { disabled: i.disabled } : {},
795
+ ...s.progressive ? {
796
+ required: !!i.required,
797
+ min: ne(i.min),
798
+ max: ne(i.max),
799
+ minLength: ne(i.minLength),
800
+ maxLength: ne(i.maxLength),
801
+ pattern: ne(i.pattern)
802
+ } : {},
803
+ name: r,
804
+ onChange: ue,
805
+ onBlur: ue,
806
+ ref: (c) => {
807
+ if (c) {
808
+ De(r, i), l = f(u, r);
809
+ const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, g = Lt(o), A = l._f.refs || [];
810
+ if (g ? A.find((L) => L === o) : o === l._f.ref)
811
+ return;
812
+ x(u, r, {
813
+ _f: {
814
+ ...l._f,
815
+ ...g ? {
816
+ refs: [
817
+ ...A.filter(Ee),
818
+ o,
819
+ ...Array.isArray(f(n, r)) ? [{}] : []
820
+ ],
821
+ ref: { type: o.type, name: r }
822
+ } : { ref: o }
823
+ }
824
+ }), k(r, !1, void 0, o);
825
+ } else
826
+ l = f(u, r, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(rt(h.array, r) && y.action) && h.unMount.add(r);
827
+ }
828
+ };
829
+ }, Ne = () => s.shouldFocusError && oe(u, le, h.mount), vt = (r) => {
830
+ W(r) && (v.state.next({ disabled: r }), oe(u, (i, l) => {
831
+ let d = r;
832
+ const c = f(u, l);
833
+ c && W(c._f.disabled) && (d || (d = c._f.disabled)), i.disabled = d;
834
+ }, 0, !1));
835
+ }, qe = (r, i) => async (l) => {
836
+ let d;
837
+ l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
838
+ let c = p(a);
839
+ if (v.state.next({
840
+ isSubmitting: !0
841
+ }), s.resolver) {
842
+ const { errors: o, values: g } = await Y();
843
+ t.errors = o, c = g;
844
+ } else
845
+ await P(u);
846
+ if (C(t.errors, "root"), B(t.errors)) {
847
+ v.state.next({
848
+ errors: {}
849
+ });
850
+ try {
851
+ await r(c, l);
852
+ } catch (o) {
853
+ d = o;
854
+ }
855
+ } else
856
+ i && await i({ ...t.errors }, l), Ne(), setTimeout(Ne);
857
+ if (v.state.next({
858
+ isSubmitted: !0,
859
+ isSubmitting: !1,
860
+ isSubmitSuccessful: B(t.errors) && !d,
861
+ submitCount: t.submitCount + 1,
862
+ errors: t.errors
863
+ }), d)
864
+ throw d;
865
+ }, _t = (r, i = {}) => {
866
+ f(u, r) && (w(i.defaultValue) ? I(r, p(f(n, r))) : (I(r, i.defaultValue), x(n, r, p(i.defaultValue))), i.keepTouched || C(t.touchedFields, r), i.keepDirty || (C(t.dirtyFields, r), t.isDirty = i.defaultValue ? b(r, p(f(n, r))) : b()), i.keepError || (C(t.errors, r), _.isValid && J()), v.state.next({ ...t }));
867
+ }, We = (r, i = {}) => {
868
+ const l = r ? p(r) : n, d = p(l), c = B(r), o = c ? n : d;
869
+ if (i.keepDefaultValues || (n = l), !i.keepValues) {
870
+ if (i.keepDirtyValues)
871
+ for (const g of h.mount)
872
+ f(t.dirtyFields, g) ? x(o, g, f(a, g)) : I(g, f(o, g));
873
+ else {
874
+ if (Re && w(r))
875
+ for (const g of h.mount) {
876
+ const A = f(u, g);
877
+ if (A && A._f) {
878
+ const L = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
879
+ if (be(L)) {
880
+ const M = L.closest("form");
881
+ if (M) {
882
+ M.reset();
883
+ break;
884
+ }
885
+ }
886
+ }
887
+ }
888
+ u = {};
889
+ }
890
+ a = e.shouldUnregister ? i.keepDefaultValues ? p(n) : {} : p(o), v.array.next({
891
+ values: { ...o }
892
+ }), v.values.next({
893
+ values: { ...o }
894
+ });
895
+ }
896
+ h = {
897
+ mount: i.keepDirtyValues ? h.mount : /* @__PURE__ */ new Set(),
898
+ unMount: /* @__PURE__ */ new Set(),
899
+ array: /* @__PURE__ */ new Set(),
900
+ watch: /* @__PURE__ */ new Set(),
901
+ watchAll: !1,
902
+ focus: ""
903
+ }, y.mount = !_.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, v.state.next({
904
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
905
+ isDirty: c ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !Z(r, n)),
906
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
907
+ dirtyFields: c ? [] : i.keepDirtyValues ? i.keepDefaultValues && a ? ge(n, a) : t.dirtyFields : i.keepDefaultValues && r ? ge(n, r) : {},
908
+ touchedFields: i.keepTouched ? t.touchedFields : {},
909
+ errors: i.keepErrors ? t.errors : {},
910
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
911
+ isSubmitting: !1
912
+ });
913
+ }, He = (r, i) => We(X(r) ? r(a) : r, i);
914
+ return {
915
+ control: {
916
+ register: De,
917
+ unregister: me,
918
+ getFieldState: Be,
919
+ handleSubmit: qe,
920
+ setError: Pe,
921
+ _executeSchema: Y,
922
+ _getWatch: F,
923
+ _getDirty: b,
924
+ _updateValid: J,
925
+ _removeUnmounted: ye,
926
+ _updateFieldArray: V,
927
+ _updateDisabledField: Ie,
928
+ _getFieldArray: E,
929
+ _reset: We,
930
+ _resetDefaultValues: () => X(s.defaultValues) && s.defaultValues().then((r) => {
931
+ He(r, s.resetOptions), v.state.next({
932
+ isLoading: !1
933
+ });
934
+ }),
935
+ _updateFormState: (r) => {
936
+ t = {
937
+ ...t,
938
+ ...r
939
+ };
940
+ },
941
+ _disableForm: vt,
942
+ _subjects: v,
943
+ _proxyFormState: _,
944
+ _setErrors: G,
945
+ get _fields() {
946
+ return u;
947
+ },
948
+ get _formValues() {
949
+ return a;
950
+ },
951
+ get _state() {
952
+ return y;
953
+ },
954
+ set _state(r) {
955
+ y = r;
956
+ },
957
+ get _defaultValues() {
958
+ return n;
959
+ },
960
+ get _names() {
961
+ return h;
962
+ },
963
+ set _names(r) {
964
+ h = r;
965
+ },
966
+ get _formState() {
967
+ return t;
968
+ },
969
+ set _formState(r) {
970
+ t = r;
971
+ },
972
+ get _options() {
973
+ return s;
974
+ },
975
+ set _options(r) {
976
+ s = {
977
+ ...s,
978
+ ...r
979
+ };
980
+ }
981
+ },
982
+ trigger: ae,
983
+ register: De,
984
+ handleSubmit: qe,
985
+ watch: ht,
986
+ setValue: I,
987
+ getValues: Me,
988
+ reset: He,
989
+ resetField: _t,
990
+ clearErrors: gt,
991
+ unregister: me,
992
+ setError: Pe,
993
+ setFocus: (r, i = {}) => {
994
+ const l = f(u, r), d = l && l._f;
995
+ if (d) {
996
+ const c = d.refs ? d.refs[0] : d.ref;
997
+ c.focus && (c.focus(), i.shouldSelect && c.select());
998
+ }
999
+ },
1000
+ getFieldState: Be
1001
+ };
1002
+ }
1003
+ function Ht(e = {}) {
1004
+ const s = D.useRef(), t = D.useRef(), [u, n] = D.useState({
1005
+ isDirty: !1,
1006
+ isValidating: !1,
1007
+ isLoading: X(e.defaultValues),
1008
+ isSubmitted: !1,
1009
+ isSubmitting: !1,
1010
+ isSubmitSuccessful: !1,
1011
+ isValid: !1,
1012
+ submitCount: 0,
1013
+ dirtyFields: {},
1014
+ touchedFields: {},
1015
+ validatingFields: {},
1016
+ errors: e.errors || {},
1017
+ disabled: e.disabled || !1,
1018
+ defaultValues: X(e.defaultValues) ? void 0 : e.defaultValues
1019
+ });
1020
+ s.current || (s.current = {
1021
+ ...Bt(e),
1022
+ formState: u
1023
+ });
1024
+ const a = s.current.control;
1025
+ return a._options = e, Te({
1026
+ subject: a._subjects.state,
1027
+ next: (y) => {
1028
+ it(y, a._proxyFormState, a._updateFormState, !0) && n({ ...a._formState });
1029
+ }
1030
+ }), D.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), D.useEffect(() => {
1031
+ if (a._proxyFormState.isDirty) {
1032
+ const y = a._getDirty();
1033
+ y !== u.isDirty && a._subjects.state.next({
1034
+ isDirty: y
1035
+ });
1036
+ }
1037
+ }, [a, u.isDirty]), D.useEffect(() => {
1038
+ e.values && !Z(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, n((y) => ({ ...y }))) : a._resetDefaultValues();
1039
+ }, [e.values, a]), D.useEffect(() => {
1040
+ e.errors && a._setErrors(e.errors);
1041
+ }, [e.errors, a]), D.useEffect(() => {
1042
+ a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1043
+ }), D.useEffect(() => {
1044
+ e.shouldUnregister && a._subjects.values.next({
1045
+ values: a._getWatch()
1046
+ });
1047
+ }, [e.shouldUnregister, a]), s.current.formState = st(u, a), s.current;
1048
+ }
1049
+ export {
1050
+ Wt as C,
1051
+ Ht as u
1052
+ };