cross-country 1.2.21 → 1.2.22

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 (259) hide show
  1. package/dist/Color-F6OSRLHC-BbLcUd-T.js +575 -0
  2. package/dist/{bolt-Bw4E_fgS.js → bolt-BLbYxvOV.js} +6 -5
  3. package/dist/bundle.css +36 -31
  4. package/dist/colour-util-Bzfca_cM.js +775 -0
  5. package/dist/components/atoms/circle/__tests__/circle.test.js +2 -2
  6. package/dist/components/atoms/column/__tests__/column.test.js +2 -2
  7. package/dist/components/atoms/index.js +1 -1
  8. package/dist/components/atoms/list/index.js +4 -0
  9. package/dist/components/atoms/list/list-item/index.js +4 -0
  10. package/dist/components/atoms/list/list-item/list-item.js +20 -0
  11. package/dist/components/atoms/list/list.js +33 -0
  12. package/dist/components/atoms/radio/index.js +2 -2
  13. package/dist/components/atoms/radio/radio.js +42 -3
  14. package/dist/components/atoms/text/animate-number/animate-number.js +1 -1
  15. package/dist/components/atoms/text/index.js +1 -1
  16. package/dist/components/atoms/text/input/__stories__/state-machine-fetch-dragons.js +3 -3
  17. package/dist/components/atoms/text/input/input-text-machine.js +3 -3
  18. package/dist/components/atoms/text/input/state-machine-text-input.js +1 -1
  19. package/dist/components/atoms/text/span/__stories__/span-story.js +6 -5
  20. package/dist/components/index.js +116 -116
  21. package/dist/components/molecules/autocomplete/autocomplete-machine.js +3 -3
  22. package/dist/components/molecules/autocomplete/autocomplete.js +1 -1
  23. package/dist/components/molecules/card/amazon/amazon-card.js +7 -6
  24. package/dist/components/molecules/card/builder/card-builder-machine/card-builder-machine.js +1 -1
  25. package/dist/components/molecules/card/builder/card-builder-machine/card-service-events.js +2 -2
  26. package/dist/components/molecules/card/builder/card-builder-machine/platform-states-amazon.js +1 -1
  27. package/dist/components/molecules/card/builder/card-builder-machine/platform-states-common.js +1 -1
  28. package/dist/components/molecules/card/builder/card-builder.js +1 -1
  29. package/dist/components/molecules/card/builder/card-editor.js +7 -6
  30. package/dist/components/molecules/card/card.js +6 -5
  31. package/dist/components/molecules/carousel/carousel.js +6 -5
  32. package/dist/components/molecules/day-number/day-number.js +6 -5
  33. package/dist/components/molecules/field/field.js +6 -5
  34. package/dist/components/molecules/gold-leaf/gold-leaf-view/__tests__/gold-leaf-view.test.js +3 -3
  35. package/dist/components/molecules/gold-leaf/gold-leaf-view/controls/gold-leaf-view-controls.js +8 -7
  36. package/dist/components/molecules/gold-leaf/gold-leaf-view/email/gold-leaf-email-view.js +7 -6
  37. package/dist/components/molecules/gold-leaf/gold-leaf-view/gold-leaf-view.js +7 -6
  38. package/dist/components/molecules/gold-leaf/gold-leaf-view/index.js +1 -1
  39. package/dist/components/molecules/gold-leaf/gold-leaf-view/title-image/gold-leaf-image.js +7 -6
  40. package/dist/components/molecules/gold-leaf/gold-leaf-view/title-image/gold-title-card.js +40 -0
  41. package/dist/components/molecules/gold-leaf/gold-leaf-view/title-image/gold-title-image-card.js +8 -7
  42. package/dist/components/molecules/gold-leaf/gold-leaf.js +1 -1
  43. package/dist/components/molecules/header/Header.js +10 -9
  44. package/dist/components/molecules/hero/hero.js +7 -6
  45. package/dist/components/molecules/icons/index.js +4 -3
  46. package/dist/components/molecules/icons/x/x.js +6 -5
  47. package/dist/components/molecules/index.js +8 -7
  48. package/dist/components/molecules/key-value-pairs/__tests__/key-value-pairs.js +1 -1
  49. package/dist/components/molecules/key-value-pairs/key-value-pairs.js +10 -9
  50. package/dist/components/molecules/keywords/keywords.js +6 -5
  51. package/dist/components/molecules/loading/__tests__/loading.test.js +1 -1
  52. package/dist/components/molecules/log-error-boundary/__stories__/log-error-boundary-story.js +1 -1
  53. package/dist/components/molecules/log-error-boundary/__tests__/log-error-boundary.test.js +2 -2
  54. package/dist/components/molecules/log-error-boundary/log-error-boundary.js +6 -5
  55. package/dist/components/molecules/modal/modal.js +6 -5
  56. package/dist/components/molecules/policies/index.js +4 -3
  57. package/dist/components/molecules/policies/privacy-policy.js +8 -7
  58. package/dist/components/molecules/policies/terms-of-use.js +8 -7
  59. package/dist/components/molecules/quote/quote.js +6 -5
  60. package/dist/components/molecules/radiogroup/__stories__/radio-group-form-story.js +12 -11
  61. package/dist/components/molecules/radiogroup/__stories__/radio-group-react-hook-form-story.js +15 -14
  62. package/dist/components/molecules/radiogroup/radiogroup.js +9 -9
  63. package/dist/components/molecules/related-articles/related-articles.js +15 -14
  64. package/dist/components/molecules/search/search.js +6 -5
  65. package/dist/components/molecules/stagger/stagger.js +6 -5
  66. package/dist/components/molecules/tile/corners.js +1 -1
  67. package/dist/components/molecules/tile/index.js +1 -1
  68. package/dist/components/molecules/tile/tile-interactive.js +5 -4
  69. package/dist/components/molecules/tile/tile.js +1 -1
  70. package/dist/components/molecules/time-progress/__tests__/progress.test.js +1 -1
  71. package/dist/components/molecules/time-progress/pilot/index.js +2 -3
  72. package/dist/components/molecules/time-progress/progress-over-year.js +6 -5
  73. package/dist/components/molecules/time-progress/progress.js +6 -5
  74. package/dist/components/molecules/user/anon-user.js +6 -5
  75. package/dist/components/molecules/user/user.js +7 -6
  76. package/dist/components/molecules/venn-diagram/__tests__/venn-diagram.tests.js +2 -2
  77. package/dist/components/molecules/venn-diagram/venn-diagram-circle.js +6 -5
  78. package/dist/components/molecules/venn-diagram/venn-diagram.js +6 -5
  79. package/dist/components/molecules/wallpaper/__tests__/wallpaper.tests.js +2 -2
  80. package/dist/components/molecules/wallpaper/wallpaper.js +1 -1
  81. package/dist/components/molecules/wrapper/__stories__/wrapper-children-story.js +6 -5
  82. package/dist/components/organisms/actors/actor/actor-builder-machine.js +2 -2
  83. package/dist/components/organisms/actors/actor/actor-builder.js +6 -5
  84. package/dist/components/organisms/actors/actor/actor.js +5 -4
  85. package/dist/components/organisms/actors/actor/index.js +1 -1
  86. package/dist/components/organisms/actors/animal/animal.js +1 -1
  87. package/dist/components/organisms/actors/monsters/troll/troll-machine.js +2 -2
  88. package/dist/components/organisms/actors/monsters/troll/troll.js +6 -5
  89. package/dist/components/organisms/actors/party/cleric/cleric.js +1 -1
  90. package/dist/components/organisms/actors/party/hunter/hunter.js +1 -1
  91. package/dist/components/organisms/actors/party/warrior/warrior.js +1 -1
  92. package/dist/components/organisms/actors/party/wizard/wizard.js +1 -1
  93. package/dist/components/organisms/actors/wisp/wisp.js +1 -1
  94. package/dist/components/organisms/ads/ad-card.js +6 -5
  95. package/dist/components/organisms/animation/animate-actor/animate-actor.js +6 -5
  96. package/dist/components/organisms/animation/one-day/one-day.js +15 -14
  97. package/dist/components/organisms/animation/reverse-text-animation/reverse-text-animation.js +6 -5
  98. package/dist/components/organisms/bento/layouts/five-by-four/bento-five-by-four.js +9 -8
  99. package/dist/components/organisms/bento/layouts/four-by-four/bento-four-by-four.js +6 -5
  100. package/dist/components/organisms/bento/layouts/three-by-three/bento-three-by-three.js +6 -5
  101. package/dist/components/organisms/bento/layouts/two-by-two/bento-two-by-two.js +6 -5
  102. package/dist/components/organisms/blog/__stories__/blog-story.js +9 -8
  103. package/dist/components/organisms/blog/blog-post/__stories__/blog-post-story.js +6 -5
  104. package/dist/components/organisms/blog/blog-post/blog-post-machine/build-listicle-machine.js +1 -1
  105. package/dist/components/organisms/blog/blog-post/blog-post-machine/delete-listicle-item.js +2 -2
  106. package/dist/components/organisms/blog/blog-post/blog-post-machine/load-listicle.js +2 -2
  107. package/dist/components/organisms/blog/blog-post/blog-post-machine/manage-listicle-items.js +1 -1
  108. package/dist/components/organisms/blog/blog-post/blog-post-machine/save-listicle-item.js +2 -2
  109. package/dist/components/organisms/blog/blog-post/blog-post-machine/save-listicle.js +2 -2
  110. package/dist/components/organisms/blog/blog-post/blog-post-machine/update-listice-item.js +2 -2
  111. package/dist/components/organisms/blog/blog-post/blog-post.js +6 -5
  112. package/dist/components/organisms/blog/blog-post-list.js +12 -11
  113. package/dist/components/organisms/blog/blog.js +6 -5
  114. package/dist/components/organisms/branch/branch.js +6 -5
  115. package/dist/components/organisms/branches/__tests__/branch-list.test.js +6 -4
  116. package/dist/components/organisms/branches/branch-list.js +61 -39
  117. package/dist/components/organisms/branches/branches.js +7 -6
  118. package/dist/components/organisms/calendar/calendar.js +6 -5
  119. package/dist/components/organisms/charts/chart/__stories__/data-set.js +1 -1
  120. package/dist/components/organisms/charts/chart/chart-gold-leaf/chart-gold-leaf.js +4 -3
  121. package/dist/components/organisms/clusters/cluster.js +6 -5
  122. package/dist/components/organisms/json-map-tile-grid/index.js +1 -1
  123. package/dist/components/organisms/json-map-tile-grid/json-map-tile-grid.js +6 -4
  124. package/dist/components/organisms/listicle/__stories__/andor-right-click-story.js +6 -5
  125. package/dist/components/organisms/listicle/__stories__/listicle-fb-v-canada-story.js +6 -5
  126. package/dist/components/organisms/listicle/__stories__/listicle-story.js +6 -5
  127. package/dist/components/organisms/listicle/build-listicle-machine/build-listicle-machine.js +1 -1
  128. package/dist/components/organisms/listicle/build-listicle-machine/delete-listicle-item.js +2 -2
  129. package/dist/components/organisms/listicle/build-listicle-machine/load-listicle.js +2 -2
  130. package/dist/components/organisms/listicle/build-listicle-machine/manage-listicle-items.js +1 -1
  131. package/dist/components/organisms/listicle/build-listicle-machine/save-listicle-item.js +2 -2
  132. package/dist/components/organisms/listicle/build-listicle-machine/save-listicle.js +2 -2
  133. package/dist/components/organisms/listicle/build-listicle-machine/update-listice-item.js +2 -2
  134. package/dist/components/organisms/listicle/edit-listicle/edit-listicle.js +13 -12
  135. package/dist/components/organisms/listicle/edit-listicle-item-list/edit-listicle-item-list.js +6 -5
  136. package/dist/components/organisms/listicle/edit-listicle-item-list/listicle-item-input.js +12 -11
  137. package/dist/components/organisms/listicle/edit-listicle-item-list/listicle-item.js +6 -5
  138. package/dist/components/organisms/listicle/listicle-builder.js +14 -13
  139. package/dist/components/organisms/listicle/listicle-item-list.js +12 -11
  140. package/dist/components/organisms/listicle/listicle.js +6 -5
  141. package/dist/components/organisms/listicle/post-link.js +7 -6
  142. package/dist/components/organisms/login/__stories__/login-story.js +6 -5
  143. package/dist/components/organisms/login/login-fetching-transition.js +6 -5
  144. package/dist/components/organisms/login/login-fields-transition.js +21 -20
  145. package/dist/components/organisms/login/login-response-transition.js +66 -11
  146. package/dist/components/organisms/login/login-submit-transition.js +6 -5
  147. package/dist/components/organisms/login/login-view.js +7 -6
  148. package/dist/components/organisms/metrics/metrics.js +6 -5
  149. package/dist/components/organisms/palettes/palettes.js +14 -12
  150. package/dist/components/organisms/player/player.js +6 -5
  151. package/dist/components/organisms/registration/password-strength-helper.js +11 -10
  152. package/dist/components/organisms/registration/post-registration.js +2 -2
  153. package/dist/components/organisms/registration/registration-form.js +6 -5
  154. package/dist/components/organisms/registration/registration-machine.js +2 -2
  155. package/dist/components/organisms/registration/registration-response.js +6 -5
  156. package/dist/components/organisms/registration/registration.js +7 -6
  157. package/dist/components/organisms/stage/stage.js +9 -8
  158. package/dist/components/organisms/survey/__stories__/build-form-story.js +6 -5
  159. package/dist/components/organisms/survey/build-form-machine.js +2 -2
  160. package/dist/components/organisms/survey/build-form.js +8 -7
  161. package/dist/components/organisms/survey/final-form.js +8 -7
  162. package/dist/components/organisms/survey/question/edit/__stories__/edit-question-story.js +6 -5
  163. package/dist/components/organisms/survey/question/edit/add-media.js +6 -5
  164. package/dist/components/organisms/survey/question/edit/add-question/__stories__/add-question-story.js +6 -5
  165. package/dist/components/organisms/survey/question/edit/add-question/add-question.js +30 -29
  166. package/dist/components/organisms/survey/question/edit/answer/answer-input.js +6 -5
  167. package/dist/components/organisms/survey/question/edit/answer-input.js +6 -5
  168. package/dist/components/organisms/survey/question/edit/edit-multiple-choice.js +6 -5
  169. package/dist/components/organisms/survey/question/edit/edit-option-list/edit-option-list-machine.js +2 -2
  170. package/dist/components/organisms/survey/question/edit/edit-option-list/edit-option-list.js +7 -6
  171. package/dist/components/organisms/survey/question/edit/edit-option-list/option-input.js +6 -5
  172. package/dist/components/organisms/survey/question/edit/edit-option-list/option.js +7 -6
  173. package/dist/components/organisms/survey/question/edit/question-answer-input.js +6 -5
  174. package/dist/components/organisms/survey/question/take/__stories__/multiple-choice-story.js +6 -5
  175. package/dist/components/organisms/survey/question/take/__stories__/take-answer-date-time-input-story.js +6 -5
  176. package/dist/components/organisms/survey/question/take/__stories__/take-answer-input-story.js +6 -5
  177. package/dist/components/organisms/survey/question/take/inputs/input-manager.js +6 -5
  178. package/dist/components/organisms/survey/question/take/multiple-choice.js +6 -5
  179. package/dist/components/organisms/survey/question/take/take-answer-input.js +12 -11
  180. package/dist/components/organisms/tile-grid/__tests__/tile-grid.tests.js +3 -3
  181. package/dist/components/organisms/tile-grid/grid-row.js +6 -5
  182. package/dist/components/organisms/tile-grid/index.js +1 -1
  183. package/dist/components/organisms/tile-grid/island-tile-grid.js +12 -11
  184. package/dist/components/organisms/tile-grid/tile-grid.js +6 -4
  185. package/dist/components/organisms/worlds/area-of-effect/__stories__/area-of-affect-story.js +6 -5
  186. package/dist/components/organisms/worlds/area-of-effect/area-of-affect.js +31 -29
  187. package/dist/components/organisms/worlds/island/__stories__/island-story.js +18 -16
  188. package/dist/components/organisms/worlds/island/__stories__/island-util.js +25 -23
  189. package/dist/components/pages/home/headwinds/header/headwinds-header.js +6 -5
  190. package/dist/components/pages/home/headwinds/headwinds-footer.js +6 -5
  191. package/dist/components/pages/home/headwinds/headwinds-hero.js +6 -5
  192. package/dist/components/pages/home/headwinds/headwinds-sidequest.js +35 -34
  193. package/dist/components/pages/home/headwinds/home.js +9 -8
  194. package/dist/components/pages/index.js +6 -5
  195. package/dist/components/pages/profile/headwinds/headwinds-profile.js +21 -20
  196. package/dist/components/pages/profile/index.js +4 -3
  197. package/dist/components/templates/articles/article/article.js +6 -5
  198. package/dist/components/templates/home/headwinds/headwinds-home-hero.js +6 -5
  199. package/dist/components/templates/home/headwinds/headwinds-home.js +6 -5
  200. package/dist/components/templates/home/home.js +10 -9
  201. package/dist/fp-util-DZLSTUg5.js +8 -0
  202. package/dist/gold-leaf-view-CgRraK2i.js +183 -0
  203. package/dist/gold-leaf-view.module-p3mWnO60.js +17 -0
  204. package/dist/headline-DzDFQZ3e.js +11 -0
  205. package/dist/image-find-util-DMX6BcO-.js +1036 -0
  206. package/dist/index-BTF1caLu.js +2529 -0
  207. package/dist/{index-COQaJqs5.js → index-OdyFkztm.js} +3670 -2660
  208. package/dist/{index-DsigmIMS.js → index-_cvPLH70.js} +1 -1
  209. package/dist/index.esm-DGm91C_6.js +944 -0
  210. package/dist/index.js +143 -140
  211. package/dist/lib/components/atoms/list/index.d.ts +2 -0
  212. package/dist/lib/components/atoms/list/list-item/index.d.ts +2 -0
  213. package/dist/lib/components/atoms/list/list-item/list-item.d.ts +10 -0
  214. package/dist/lib/components/atoms/list/list.d.ts +12 -0
  215. package/dist/lib/components/molecules/gold-leaf/gold-leaf-view/title-image/gold-title-card.d.ts +4 -0
  216. package/dist/lib/components/organisms/branch/branch.d.ts +3 -1
  217. package/dist/lib/components/organisms/branches/__stories__/branches.stories.d.ts +7 -0
  218. package/dist/lib/components/organisms/branches/branch-list.d.ts +4 -1
  219. package/dist/lib/models/TreeModel.d.ts +12 -0
  220. package/dist/lib/models/index.d.ts +1 -0
  221. package/dist/lib/utils/golds/feed-util.d.ts +17 -0
  222. package/dist/lib/utils/index.d.ts +5 -0
  223. package/dist/list.module-pjS_KHqp.js +10 -0
  224. package/dist/{log-2a4cc478.esm-HFv7vQ7j.js → log-2a4cc478.esm-BdzQp5f-.js} +15 -15
  225. package/dist/{log-error-boundary-story-BF8rmHhr.js → log-error-boundary-story-CcyM__Yt.js} +6541 -7185
  226. package/dist/{magic-string.es-VsGWiGpd.js → magic-string.es-QkQE39Zh.js} +11 -6
  227. package/dist/{radio-BTUtRmLM.js → mobile-detect-CWVWWCSg.js} +12 -51
  228. package/dist/models/TreeModel.js +12 -0
  229. package/dist/models/index.js +3 -2
  230. package/dist/{react-spring_web.modern-nSq5Xzxb.js → react-spring_web.modern-ClBJWBW2.js} +281 -273
  231. package/dist/{react.esm-BEaxtOYu.js → react.esm-BpVcViTQ.js} +2197 -2181
  232. package/dist/string-util-D7tmqJRS.js +35 -0
  233. package/dist/table-data-BnRZ5F7y.js +16 -0
  234. package/dist/utils/golds/feed-util.js +240 -0
  235. package/dist/utils/index.js +12 -0
  236. package/dist/{vi.YFlodzP_-CjWVzrI3.js → vi.YFlodzP_-C3qjkUdf.js} +2 -2
  237. package/dist/{xstate-actors.esm-Ba6reXm_.js → xstate-actors.esm-CcLF5JHw.js} +1 -1
  238. package/dist/{xstate-react.esm-Ct8KIFgA.js → xstate-react.esm-DWdE0_Ay.js} +1 -1
  239. package/dist/{xstate.esm-Bo02HSs2.js → xstate.esm-COAqQ2fq.js} +11 -11
  240. package/package.json +4 -2
  241. package/dist/Color-ERTF36HU-DRLqcX19.js +0 -358
  242. package/dist/_getTag-CqbPZ7Cl.js +0 -449
  243. package/dist/components/organisms/branches/__stories__/branches-story.js +0 -6
  244. package/dist/components/organisms/branches/branch-list.types.js +0 -1
  245. package/dist/feed-util-CZfVh6cR.js +0 -244
  246. package/dist/fp-util-4N0NK_eU.js +0 -8
  247. package/dist/gold-leaf-view-BAGw5McJ.js +0 -117
  248. package/dist/gold-leaf-view.module-BTNjKEeW.js +0 -17
  249. package/dist/headline-DuHL8hAt.js +0 -11
  250. package/dist/image-find-util-Cl2ZJHfC.js +0 -41
  251. package/dist/index-BsYJgl86.js +0 -3853
  252. package/dist/index-Cdg9lY68.js +0 -542
  253. package/dist/index.esm-BrPDxyfz.js +0 -933
  254. package/dist/lib/components/organisms/branches/__stories__/branches-story.d.ts +0 -2
  255. package/dist/lib/components/organisms/branches/branch-list.types.d.ts +0 -5
  256. package/dist/list-BkQjCFcb.js +0 -14
  257. package/dist/list-item-DyDjznkQ.js +0 -8
  258. package/dist/login-response-transition-Dws0eBbH.js +0 -123
  259. package/dist/table-data-PGM-_ef9.js +0 -16
@@ -0,0 +1,944 @@
1
+ import B from "react";
2
+ var fe = (e) => e.type === "checkbox", ee = (e) => e instanceof Date, L = (e) => e == null;
3
+ const Ze = (e) => typeof e == "object";
4
+ var D = (e) => !L(e) && !Array.isArray(e) && Ze(e) && !ee(e), gr = (e) => D(e) && e.target ? fe(e.target) ? e.target.checked : e.target.value : e, hr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, vr = (e, s) => e.has(hr(s)), _r = (e) => {
5
+ const s = e.constructor && e.constructor.prototype;
6
+ return D(s) && s.hasOwnProperty("isPrototypeOf");
7
+ }, Te = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function M(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 (!(Te && (e instanceof Blob || e instanceof FileList)) && (t || D(e)))
16
+ if (s = t ? [] : {}, !t && !_r(e))
17
+ s = e;
18
+ else
19
+ for (const u in e)
20
+ e.hasOwnProperty(u) && (s[u] = M(e[u]));
21
+ else
22
+ return e;
23
+ return s;
24
+ }
25
+ var Fe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, d = (e, s, t) => {
26
+ if (!s || !D(e))
27
+ return t;
28
+ const u = Fe(s.split(/[,[\].]+?/)).reduce((n, l) => L(n) ? n : n[l], e);
29
+ return w(u) || u === e ? w(e[s]) ? t : e[s] : u;
30
+ }, W = (e) => typeof e == "boolean", Oe = (e) => /^\w*$/.test(e), er = (e) => Fe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, t) => {
31
+ let u = -1;
32
+ const n = Oe(s) ? [s] : er(s), l = n.length, y = l - 1;
33
+ for (; ++u < l; ) {
34
+ const h = n[u];
35
+ let P = t;
36
+ if (u !== y) {
37
+ const q = e[h];
38
+ P = D(q) || Array.isArray(q) ? q : isNaN(+n[u + 1]) ? {} : [];
39
+ }
40
+ if (h === "__proto__")
41
+ return;
42
+ e[h] = P, e = e[h];
43
+ }
44
+ return e;
45
+ };
46
+ const He = {
47
+ BLUR: "blur",
48
+ FOCUS_OUT: "focusout",
49
+ CHANGE: "change"
50
+ }, I = {
51
+ onBlur: "onBlur",
52
+ onChange: "onChange",
53
+ onSubmit: "onSubmit",
54
+ onTouched: "onTouched",
55
+ all: "all"
56
+ }, z = {
57
+ max: "max",
58
+ min: "min",
59
+ maxLength: "maxLength",
60
+ minLength: "minLength",
61
+ pattern: "pattern",
62
+ required: "required",
63
+ validate: "validate"
64
+ };
65
+ B.createContext(null);
66
+ var br = (e, s, t, u = !0) => {
67
+ const n = {
68
+ defaultValues: s._defaultValues
69
+ };
70
+ for (const l in e)
71
+ Object.defineProperty(n, l, {
72
+ get: () => {
73
+ const y = l;
74
+ return s._proxyFormState[y] !== I.all && (s._proxyFormState[y] = !u || I.all), e[y];
75
+ }
76
+ });
77
+ return n;
78
+ }, C = (e) => D(e) && !Object.keys(e).length, Fr = (e, s, t, u) => {
79
+ t(e);
80
+ const { name: n, ...l } = e;
81
+ return C(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((y) => s[y] === I.all);
82
+ }, ge = (e) => Array.isArray(e) ? e : [e];
83
+ function Ar(e) {
84
+ const s = B.useRef(e);
85
+ s.current = e, B.useEffect(() => {
86
+ const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
87
+ next: s.current.next
88
+ });
89
+ return () => {
90
+ t && t.unsubscribe();
91
+ };
92
+ }, [e.disabled]);
93
+ }
94
+ var $ = (e) => typeof e == "string", Vr = (e, s, t, u, n) => $(e) ? (u && s.watch.add(e), d(t, e, n)) : Array.isArray(e) ? e.map((l) => (u && s.watch.add(l), d(t, l))) : (u && (s.watchAll = !0), t), xr = (e, s, t, u, n) => s ? {
95
+ ...t[e],
96
+ types: {
97
+ ...t[e] && t[e].types ? t[e].types : {},
98
+ [u]: n || !0
99
+ }
100
+ } : {}, $e = (e) => ({
101
+ isOnSubmit: !e || e === I.onSubmit,
102
+ isOnBlur: e === I.onBlur,
103
+ isOnChange: e === I.onChange,
104
+ isOnAll: e === I.all,
105
+ isOnTouch: e === I.onTouched
106
+ }), je = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((u) => e.startsWith(u) && /^\.\w+/.test(e.slice(u.length))));
107
+ const oe = (e, s, t, u) => {
108
+ for (const n of t || Object.keys(e)) {
109
+ const l = d(e, n);
110
+ if (l) {
111
+ const { _f: y, ...h } = l;
112
+ if (y) {
113
+ if (y.refs && y.refs[0] && s(y.refs[0], n) && !u)
114
+ return !0;
115
+ if (y.ref && s(y.ref, y.name) && !u)
116
+ return !0;
117
+ if (oe(h, s))
118
+ break;
119
+ } else if (D(h) && oe(h, s))
120
+ break;
121
+ }
122
+ }
123
+ };
124
+ var wr = (e, s, t) => {
125
+ const u = ge(d(e, t));
126
+ return V(u, "root", s[t]), V(e, t, u), e;
127
+ }, Le = (e) => e.type === "file", H = (e) => typeof e == "function", ve = (e) => {
128
+ if (!Te)
129
+ return !1;
130
+ const s = e ? e.ownerDocument : 0;
131
+ return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
132
+ }, he = (e) => $(e), Ce = (e) => e.type === "radio", _e = (e) => e instanceof RegExp;
133
+ const Ke = {
134
+ value: !1,
135
+ isValid: !1
136
+ }, Ye = { value: !0, isValid: !0 };
137
+ var rr = (e) => {
138
+ if (Array.isArray(e)) {
139
+ if (e.length > 1) {
140
+ const s = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
141
+ return { value: s, isValid: !!s.length };
142
+ }
143
+ return e[0].checked && !e[0].disabled ? (
144
+ // @ts-expect-error expected to work in the browser
145
+ e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Ye : { value: e[0].value, isValid: !0 } : Ye
146
+ ) : Ke;
147
+ }
148
+ return Ke;
149
+ };
150
+ const ze = {
151
+ isValid: !1,
152
+ value: null
153
+ };
154
+ var tr = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
155
+ isValid: !0,
156
+ value: t.value
157
+ } : s, ze) : ze;
158
+ function Ge(e, s, t = "validate") {
159
+ if (he(e) || Array.isArray(e) && e.every(he) || W(e) && !e)
160
+ return {
161
+ type: t,
162
+ message: he(e) ? e : "",
163
+ ref: s
164
+ };
165
+ }
166
+ var se = (e) => D(e) && !_e(e) ? e : {
167
+ value: e,
168
+ message: ""
169
+ }, Je = async (e, s, t, u, n) => {
170
+ const { ref: l, refs: y, required: h, maxLength: P, minLength: q, min: x, max: b, pattern: ce, validate: G, name: N, valueAsNumber: Ae, mount: j, disabled: J } = e._f, F = d(s, N);
171
+ if (!j || J)
172
+ return {};
173
+ const K = y ? y[0] : l, Y = (_) => {
174
+ u && K.reportValidity && (K.setCustomValidity(W(_) ? "" : _ || ""), K.reportValidity());
175
+ }, m = {}, re = Ce(l), de = fe(l), X = re || de, te = (Ae || Le(l)) && w(l.value) && w(F) || ve(l) && l.value === "" || F === "" || Array.isArray(F) && !F.length, U = xr.bind(null, N, t, m), ye = (_, A, k, O = z.maxLength, p = z.minLength) => {
176
+ const R = _ ? A : k;
177
+ m[N] = {
178
+ type: _ ? O : p,
179
+ message: R,
180
+ ref: l,
181
+ ...U(_ ? O : p, R)
182
+ };
183
+ };
184
+ if (n ? !Array.isArray(F) || !F.length : h && (!X && (te || L(F)) || W(F) && !F || de && !rr(y).isValid || re && !tr(y).isValid)) {
185
+ const { value: _, message: A } = he(h) ? { value: !!h, message: h } : se(h);
186
+ if (_ && (m[N] = {
187
+ type: z.required,
188
+ message: A,
189
+ ref: K,
190
+ ...U(z.required, A)
191
+ }, !t))
192
+ return Y(A), m;
193
+ }
194
+ if (!te && (!L(x) || !L(b))) {
195
+ let _, A;
196
+ const k = se(b), O = se(x);
197
+ if (!L(F) && !isNaN(F)) {
198
+ const p = l.valueAsNumber || F && +F;
199
+ L(k.value) || (_ = p > k.value), L(O.value) || (A = p < O.value);
200
+ } else {
201
+ const p = l.valueAsDate || new Date(F), R = (le) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + le), ie = l.type == "time", ae = l.type == "week";
202
+ $(k.value) && F && (_ = ie ? R(F) > R(k.value) : ae ? F > k.value : p > new Date(k.value)), $(O.value) && F && (A = ie ? R(F) < R(O.value) : ae ? F < O.value : p < new Date(O.value));
203
+ }
204
+ if ((_ || A) && (ye(!!_, k.message, O.message, z.max, z.min), !t))
205
+ return Y(m[N].message), m;
206
+ }
207
+ if ((P || q) && !te && ($(F) || n && Array.isArray(F))) {
208
+ const _ = se(P), A = se(q), k = !L(_.value) && F.length > +_.value, O = !L(A.value) && F.length < +A.value;
209
+ if ((k || O) && (ye(k, _.message, A.message), !t))
210
+ return Y(m[N].message), m;
211
+ }
212
+ if (ce && !te && $(F)) {
213
+ const { value: _, message: A } = se(ce);
214
+ if (_e(_) && !F.match(_) && (m[N] = {
215
+ type: z.pattern,
216
+ message: A,
217
+ ref: l,
218
+ ...U(z.pattern, A)
219
+ }, !t))
220
+ return Y(A), m;
221
+ }
222
+ if (G) {
223
+ if (H(G)) {
224
+ const _ = await G(F, s), A = Ge(_, K);
225
+ if (A && (m[N] = {
226
+ ...A,
227
+ ...U(z.validate, A.message)
228
+ }, !t))
229
+ return Y(A.message), m;
230
+ } else if (D(G)) {
231
+ let _ = {};
232
+ for (const A in G) {
233
+ if (!C(_) && !t)
234
+ break;
235
+ const k = Ge(await G[A](F, s), K, A);
236
+ k && (_ = {
237
+ ...k,
238
+ ...U(A, k.message)
239
+ }, Y(k.message), t && (m[N] = _));
240
+ }
241
+ if (!C(_) && (m[N] = {
242
+ ref: K,
243
+ ..._
244
+ }, !t))
245
+ return m;
246
+ }
247
+ }
248
+ return Y(!0), m;
249
+ };
250
+ function Dr(e, s) {
251
+ const t = s.slice(0, -1).length;
252
+ let u = 0;
253
+ for (; u < t; )
254
+ e = w(e) ? u++ : e[s[u++]];
255
+ return e;
256
+ }
257
+ function mr(e) {
258
+ for (const s in e)
259
+ if (e.hasOwnProperty(s) && !w(e[s]))
260
+ return !1;
261
+ return !0;
262
+ }
263
+ function E(e, s) {
264
+ const t = Array.isArray(s) ? s : Oe(s) ? [s] : er(s), u = t.length === 1 ? e : Dr(e, t), n = t.length - 1, l = t[n];
265
+ return u && delete u[l], n !== 0 && (D(u) && C(u) || Array.isArray(u) && mr(u)) && E(e, t.slice(0, -1)), e;
266
+ }
267
+ var me = () => {
268
+ let e = [];
269
+ return {
270
+ get observers() {
271
+ return e;
272
+ },
273
+ next: (n) => {
274
+ for (const l of e)
275
+ l.next && l.next(n);
276
+ },
277
+ subscribe: (n) => (e.push(n), {
278
+ unsubscribe: () => {
279
+ e = e.filter((l) => l !== n);
280
+ }
281
+ }),
282
+ unsubscribe: () => {
283
+ e = [];
284
+ }
285
+ };
286
+ }, Se = (e) => L(e) || !Ze(e);
287
+ function Q(e, s) {
288
+ if (Se(e) || Se(s))
289
+ return e === s;
290
+ if (ee(e) && ee(s))
291
+ return e.getTime() === s.getTime();
292
+ const t = Object.keys(e), u = Object.keys(s);
293
+ if (t.length !== u.length)
294
+ return !1;
295
+ for (const n of t) {
296
+ const l = e[n];
297
+ if (!u.includes(n))
298
+ return !1;
299
+ if (n !== "ref") {
300
+ const y = s[n];
301
+ if (ee(l) && ee(y) || D(l) && D(y) || Array.isArray(l) && Array.isArray(y) ? !Q(l, y) : l !== y)
302
+ return !1;
303
+ }
304
+ }
305
+ return !0;
306
+ }
307
+ var sr = (e) => e.type === "select-multiple", kr = (e) => Ce(e) || fe(e), ke = (e) => ve(e) && e.isConnected, ir = (e) => {
308
+ for (const s in e)
309
+ if (H(e[s]))
310
+ return !0;
311
+ return !1;
312
+ };
313
+ function be(e, s = {}) {
314
+ const t = Array.isArray(e);
315
+ if (D(e) || t)
316
+ for (const u in e)
317
+ Array.isArray(e[u]) || D(e[u]) && !ir(e[u]) ? (s[u] = Array.isArray(e[u]) ? [] : {}, be(e[u], s[u])) : L(e[u]) || (s[u] = !0);
318
+ return s;
319
+ }
320
+ function ar(e, s, t) {
321
+ const u = Array.isArray(e);
322
+ if (D(e) || u)
323
+ for (const n in e)
324
+ Array.isArray(e[n]) || D(e[n]) && !ir(e[n]) ? w(s) || Se(t[n]) ? t[n] = Array.isArray(e[n]) ? be(e[n], []) : { ...be(e[n]) } : ar(e[n], L(s) ? {} : s[n], t[n]) : t[n] = !Q(e[n], s[n]);
325
+ return t;
326
+ }
327
+ var ue = (e, s) => ar(e, s, be(s)), lr = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: u }) => w(e) ? e : s ? e === "" ? NaN : e && +e : t && $(e) ? new Date(e) : u ? u(e) : e;
328
+ function Ee(e) {
329
+ const s = e.ref;
330
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
331
+ return Le(s) ? s.files : Ce(s) ? tr(e.refs).value : sr(s) ? [...s.selectedOptions].map(({ value: t }) => t) : fe(s) ? rr(e.refs).value : lr(w(s.value) ? e.ref.value : s.value, e);
332
+ }
333
+ var Er = (e, s, t, u) => {
334
+ const n = {};
335
+ for (const l of e) {
336
+ const y = d(s, l);
337
+ y && V(n, l, y._f);
338
+ }
339
+ return {
340
+ criteriaMode: t,
341
+ names: [...e],
342
+ fields: n,
343
+ shouldUseNativeValidation: u
344
+ };
345
+ }, ne = (e) => w(e) ? e : _e(e) ? e.source : D(e) ? _e(e.value) ? e.value.source : e.value : e;
346
+ const Qe = "AsyncFunction";
347
+ var Sr = (e) => (!e || !e.validate) && !!(H(e.validate) && e.validate.constructor.name === Qe || D(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === Qe)), Tr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
348
+ function Xe(e, s, t) {
349
+ const u = d(e, t);
350
+ if (u || Oe(t))
351
+ return {
352
+ error: u,
353
+ name: t
354
+ };
355
+ const n = t.split(".");
356
+ for (; n.length; ) {
357
+ const l = n.join("."), y = d(s, l), h = d(e, l);
358
+ if (y && !Array.isArray(y) && t !== l)
359
+ return { name: t };
360
+ if (h && h.type)
361
+ return {
362
+ name: l,
363
+ error: h
364
+ };
365
+ n.pop();
366
+ }
367
+ return {
368
+ name: t
369
+ };
370
+ }
371
+ var Or = (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, Lr = (e, s) => !Fe(d(e, s)).length && E(e, s);
372
+ const Cr = {
373
+ mode: I.onSubmit,
374
+ reValidateMode: I.onChange,
375
+ shouldFocusError: !0
376
+ };
377
+ function Nr(e = {}) {
378
+ let s = {
379
+ ...Cr,
380
+ ...e
381
+ }, t = {
382
+ submitCount: 0,
383
+ isDirty: !1,
384
+ isLoading: H(s.defaultValues),
385
+ isValidating: !1,
386
+ isSubmitted: !1,
387
+ isSubmitting: !1,
388
+ isSubmitSuccessful: !1,
389
+ isValid: !1,
390
+ touchedFields: {},
391
+ dirtyFields: {},
392
+ validatingFields: {},
393
+ errors: s.errors || {},
394
+ disabled: s.disabled || !1
395
+ }, u = {}, n = D(s.defaultValues) || D(s.values) ? M(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : M(n), y = {
396
+ action: !1,
397
+ mount: !1,
398
+ watch: !1
399
+ }, h = {
400
+ mount: /* @__PURE__ */ new Set(),
401
+ unMount: /* @__PURE__ */ new Set(),
402
+ array: /* @__PURE__ */ new Set(),
403
+ watch: /* @__PURE__ */ new Set()
404
+ }, P, q = 0;
405
+ const x = {
406
+ isDirty: !1,
407
+ dirtyFields: !1,
408
+ validatingFields: !1,
409
+ touchedFields: !1,
410
+ isValidating: !1,
411
+ isValid: !1,
412
+ errors: !1
413
+ }, b = {
414
+ values: me(),
415
+ array: me(),
416
+ state: me()
417
+ }, ce = $e(s.mode), G = $e(s.reValidateMode), N = s.criteriaMode === I.all, Ae = (r) => (i) => {
418
+ clearTimeout(q), q = setTimeout(r, i);
419
+ }, j = async (r) => {
420
+ if (!s.disabled && (x.isValid || r)) {
421
+ const i = s.resolver ? C((await X()).errors) : await U(u, !0);
422
+ i !== t.isValid && b.state.next({
423
+ isValid: i
424
+ });
425
+ }
426
+ }, J = (r, i) => {
427
+ !s.disabled && (x.isValidating || x.validatingFields) && ((r || Array.from(h.mount)).forEach((a) => {
428
+ a && (i ? V(t.validatingFields, a, i) : E(t.validatingFields, a));
429
+ }), b.state.next({
430
+ validatingFields: t.validatingFields,
431
+ isValidating: !C(t.validatingFields)
432
+ }));
433
+ }, F = (r, i = [], a, c, f = !0, o = !0) => {
434
+ if (c && a && !s.disabled) {
435
+ if (y.action = !0, o && Array.isArray(d(u, r))) {
436
+ const g = a(d(u, r), c.argA, c.argB);
437
+ f && V(u, r, g);
438
+ }
439
+ if (o && Array.isArray(d(t.errors, r))) {
440
+ const g = a(d(t.errors, r), c.argA, c.argB);
441
+ f && V(t.errors, r, g), Lr(t.errors, r);
442
+ }
443
+ if (x.touchedFields && o && Array.isArray(d(t.touchedFields, r))) {
444
+ const g = a(d(t.touchedFields, r), c.argA, c.argB);
445
+ f && V(t.touchedFields, r, g);
446
+ }
447
+ x.dirtyFields && (t.dirtyFields = ue(n, l)), b.state.next({
448
+ name: r,
449
+ isDirty: _(r, i),
450
+ dirtyFields: t.dirtyFields,
451
+ errors: t.errors,
452
+ isValid: t.isValid
453
+ });
454
+ } else
455
+ V(l, r, i);
456
+ }, K = (r, i) => {
457
+ V(t.errors, r, i), b.state.next({
458
+ errors: t.errors
459
+ });
460
+ }, Y = (r) => {
461
+ t.errors = r, b.state.next({
462
+ errors: t.errors,
463
+ isValid: !1
464
+ });
465
+ }, m = (r, i, a, c) => {
466
+ const f = d(u, r);
467
+ if (f) {
468
+ const o = d(l, r, w(a) ? d(n, r) : a);
469
+ w(o) || c && c.defaultChecked || i ? V(l, r, i ? o : Ee(f._f)) : O(r, o), y.mount && j();
470
+ }
471
+ }, re = (r, i, a, c, f) => {
472
+ let o = !1, g = !1;
473
+ const v = {
474
+ name: r
475
+ };
476
+ if (!s.disabled) {
477
+ const S = !!(d(u, r) && d(u, r)._f && d(u, r)._f.disabled);
478
+ if (!a || c) {
479
+ x.isDirty && (g = t.isDirty, t.isDirty = v.isDirty = _(), o = g !== v.isDirty);
480
+ const T = S || Q(d(n, r), i);
481
+ g = !!(!S && d(t.dirtyFields, r)), T || S ? E(t.dirtyFields, r) : V(t.dirtyFields, r, !0), v.dirtyFields = t.dirtyFields, o = o || x.dirtyFields && g !== !T;
482
+ }
483
+ if (a) {
484
+ const T = d(t.touchedFields, r);
485
+ T || (V(t.touchedFields, r, a), v.touchedFields = t.touchedFields, o = o || x.touchedFields && T !== a);
486
+ }
487
+ o && f && b.state.next(v);
488
+ }
489
+ return o ? v : {};
490
+ }, de = (r, i, a, c) => {
491
+ const f = d(t.errors, r), o = x.isValid && W(i) && t.isValid !== i;
492
+ if (e.delayError && a ? (P = Ae(() => K(r, a)), P(e.delayError)) : (clearTimeout(q), P = null, a ? V(t.errors, r, a) : E(t.errors, r)), (a ? !Q(f, a) : f) || !C(c) || o) {
493
+ const g = {
494
+ ...c,
495
+ ...o && W(i) ? { isValid: i } : {},
496
+ errors: t.errors,
497
+ name: r
498
+ };
499
+ t = {
500
+ ...t,
501
+ ...g
502
+ }, b.state.next(g);
503
+ }
504
+ }, X = async (r) => {
505
+ J(r, !0);
506
+ const i = await s.resolver(l, s.context, Er(r || h.mount, u, s.criteriaMode, s.shouldUseNativeValidation));
507
+ return J(r), i;
508
+ }, te = async (r) => {
509
+ const { errors: i } = await X(r);
510
+ if (r)
511
+ for (const a of r) {
512
+ const c = d(i, a);
513
+ c ? V(t.errors, a, c) : E(t.errors, a);
514
+ }
515
+ else
516
+ t.errors = i;
517
+ return i;
518
+ }, U = async (r, i, a = {
519
+ valid: !0
520
+ }) => {
521
+ for (const c in r) {
522
+ const f = r[c];
523
+ if (f) {
524
+ const { _f: o, ...g } = f;
525
+ if (o) {
526
+ const v = h.array.has(o.name), S = f._f && Sr(f._f);
527
+ S && x.validatingFields && J([c], !0);
528
+ const T = await Je(f, l, N, s.shouldUseNativeValidation && !i, v);
529
+ if (S && x.validatingFields && J([c]), T[o.name] && (a.valid = !1, i))
530
+ break;
531
+ !i && (d(T, o.name) ? v ? wr(t.errors, T, o.name) : V(t.errors, o.name, T[o.name]) : E(t.errors, o.name));
532
+ }
533
+ !C(g) && await U(g, i, a);
534
+ }
535
+ }
536
+ return a.valid;
537
+ }, ye = () => {
538
+ for (const r of h.unMount) {
539
+ const i = d(u, r);
540
+ i && (i._f.refs ? i._f.refs.every((a) => !ke(a)) : !ke(i._f.ref)) && Ve(r);
541
+ }
542
+ h.unMount = /* @__PURE__ */ new Set();
543
+ }, _ = (r, i) => !s.disabled && (r && i && V(l, r, i), !Q(Ne(), n)), A = (r, i, a) => Vr(r, h, {
544
+ ...y.mount ? l : w(i) ? n : $(r) ? { [r]: i } : i
545
+ }, a, i), k = (r) => Fe(d(y.mount ? l : n, r, e.shouldUnregister ? d(n, r, []) : [])), O = (r, i, a = {}) => {
546
+ const c = d(u, r);
547
+ let f = i;
548
+ if (c) {
549
+ const o = c._f;
550
+ o && (!o.disabled && V(l, r, lr(i, o)), f = ve(o.ref) && L(i) ? "" : i, sr(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? fe(o.ref) ? o.refs.length > 1 ? o.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(f) ? !!f.find((v) => v === g.value) : f === g.value)) : o.refs[0] && (o.refs[0].checked = !!f) : o.refs.forEach((g) => g.checked = g.value === f) : Le(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || b.values.next({
551
+ name: r,
552
+ values: { ...l }
553
+ })));
554
+ }
555
+ (a.shouldDirty || a.shouldTouch) && re(r, f, a.shouldTouch, a.shouldDirty, !0), a.shouldValidate && le(r);
556
+ }, p = (r, i, a) => {
557
+ for (const c in i) {
558
+ const f = i[c], o = `${r}.${c}`, g = d(u, o);
559
+ (h.array.has(r) || D(f) || g && !g._f) && !ee(f) ? p(o, f, a) : O(o, f, a);
560
+ }
561
+ }, R = (r, i, a = {}) => {
562
+ const c = d(u, r), f = h.array.has(r), o = M(i);
563
+ V(l, r, o), f ? (b.array.next({
564
+ name: r,
565
+ values: { ...l }
566
+ }), (x.isDirty || x.dirtyFields) && a.shouldDirty && b.state.next({
567
+ name: r,
568
+ dirtyFields: ue(n, l),
569
+ isDirty: _(r, o)
570
+ })) : c && !c._f && !L(o) ? p(r, o, a) : O(r, o, a), je(r, h) && b.state.next({ ...t }), b.values.next({
571
+ name: y.mount ? r : void 0,
572
+ values: { ...l }
573
+ });
574
+ }, ie = async (r) => {
575
+ y.mount = !0;
576
+ const i = r.target;
577
+ let a = i.name, c = !0;
578
+ const f = d(u, a), o = () => i.type ? Ee(f._f) : gr(r), g = (v) => {
579
+ c = Number.isNaN(v) || ee(v) && isNaN(v.getTime()) || Q(v, d(l, a, v));
580
+ };
581
+ if (f) {
582
+ let v, S;
583
+ const T = o(), Z = r.type === He.BLUR || r.type === He.FOCUS_OUT, cr = !Tr(f._f) && !s.resolver && !d(t.errors, a) && !f._f.deps || Or(Z, d(t.touchedFields, a), t.isSubmitted, G, ce), we = je(a, h, Z);
584
+ V(l, a, T), Z ? (f._f.onBlur && f._f.onBlur(r), P && P(0)) : f._f.onChange && f._f.onChange(r);
585
+ const De = re(a, T, Z, !1), dr = !C(De) || we;
586
+ if (!Z && b.values.next({
587
+ name: a,
588
+ type: r.type,
589
+ values: { ...l }
590
+ }), cr)
591
+ return x.isValid && (e.mode === "onBlur" ? Z && j() : j()), dr && b.state.next({ name: a, ...we ? {} : De });
592
+ if (!Z && we && b.state.next({ ...t }), s.resolver) {
593
+ const { errors: qe } = await X([a]);
594
+ if (g(T), c) {
595
+ const yr = Xe(t.errors, u, a), We = Xe(qe, u, yr.name || a);
596
+ v = We.error, a = We.name, S = C(qe);
597
+ }
598
+ } else
599
+ J([a], !0), v = (await Je(f, l, N, s.shouldUseNativeValidation))[a], J([a]), g(T), c && (v ? S = !1 : x.isValid && (S = await U(u, !0)));
600
+ c && (f._f.deps && le(f._f.deps), de(a, S, v, De));
601
+ }
602
+ }, ae = (r, i) => {
603
+ if (d(t.errors, i) && r.focus)
604
+ return r.focus(), 1;
605
+ }, le = async (r, i = {}) => {
606
+ let a, c;
607
+ const f = ge(r);
608
+ if (s.resolver) {
609
+ const o = await te(w(r) ? r : f);
610
+ a = C(o), c = r ? !f.some((g) => d(o, g)) : a;
611
+ } else r ? (c = (await Promise.all(f.map(async (o) => {
612
+ const g = d(u, o);
613
+ return await U(g && g._f ? { [o]: g } : g);
614
+ }))).every(Boolean), !(!c && !t.isValid) && j()) : c = a = await U(u);
615
+ return b.state.next({
616
+ ...!$(r) || x.isValid && a !== t.isValid ? {} : { name: r },
617
+ ...s.resolver || !r ? { isValid: a } : {},
618
+ errors: t.errors
619
+ }), i.shouldFocus && !c && oe(u, ae, r ? f : h.mount), c;
620
+ }, Ne = (r) => {
621
+ const i = {
622
+ ...y.mount ? l : n
623
+ };
624
+ return w(r) ? i : $(r) ? d(i, r) : r.map((a) => d(i, a));
625
+ }, Ue = (r, i) => ({
626
+ invalid: !!d((i || t).errors, r),
627
+ isDirty: !!d((i || t).dirtyFields, r),
628
+ error: d((i || t).errors, r),
629
+ isValidating: !!d(t.validatingFields, r),
630
+ isTouched: !!d((i || t).touchedFields, r)
631
+ }), ur = (r) => {
632
+ r && ge(r).forEach((i) => E(t.errors, i)), b.state.next({
633
+ errors: r ? t.errors : {}
634
+ });
635
+ }, Re = (r, i, a) => {
636
+ const c = (d(u, r, { _f: {} })._f || {}).ref, f = d(t.errors, r) || {}, { ref: o, message: g, type: v, ...S } = f;
637
+ V(t.errors, r, {
638
+ ...S,
639
+ ...i,
640
+ ref: c
641
+ }), b.state.next({
642
+ name: r,
643
+ errors: t.errors,
644
+ isValid: !1
645
+ }), a && a.shouldFocus && c && c.focus && c.focus();
646
+ }, nr = (r, i) => H(r) ? b.values.subscribe({
647
+ next: (a) => r(A(void 0, i), a)
648
+ }) : A(r, i, !0), Ve = (r, i = {}) => {
649
+ for (const a of r ? ge(r) : h.mount)
650
+ h.mount.delete(a), h.array.delete(a), i.keepValue || (E(u, a), E(l, a)), !i.keepError && E(t.errors, a), !i.keepDirty && E(t.dirtyFields, a), !i.keepTouched && E(t.touchedFields, a), !i.keepIsValidating && E(t.validatingFields, a), !s.shouldUnregister && !i.keepDefaultValue && E(n, a);
651
+ b.values.next({
652
+ values: { ...l }
653
+ }), b.state.next({
654
+ ...t,
655
+ ...i.keepDirty ? { isDirty: _() } : {}
656
+ }), !i.keepIsValid && j();
657
+ }, Me = ({ disabled: r, name: i, field: a, fields: c, value: f }) => {
658
+ if (W(r) && y.mount || r) {
659
+ const o = r ? void 0 : w(f) ? Ee(a ? a._f : d(c, i)._f) : f;
660
+ V(l, i, o), re(i, o, !1, !1, !0);
661
+ }
662
+ }, xe = (r, i = {}) => {
663
+ let a = d(u, r);
664
+ const c = W(i.disabled) || W(s.disabled);
665
+ return V(u, r, {
666
+ ...a || {},
667
+ _f: {
668
+ ...a && a._f ? a._f : { ref: { name: r } },
669
+ name: r,
670
+ mount: !0,
671
+ ...i
672
+ }
673
+ }), h.mount.add(r), a ? Me({
674
+ field: a,
675
+ disabled: W(i.disabled) ? i.disabled : s.disabled,
676
+ name: r,
677
+ value: i.value
678
+ }) : m(r, !0, i.value), {
679
+ ...c ? { disabled: i.disabled || s.disabled } : {},
680
+ ...s.progressive ? {
681
+ required: !!i.required,
682
+ min: ne(i.min),
683
+ max: ne(i.max),
684
+ minLength: ne(i.minLength),
685
+ maxLength: ne(i.maxLength),
686
+ pattern: ne(i.pattern)
687
+ } : {},
688
+ name: r,
689
+ onChange: ie,
690
+ onBlur: ie,
691
+ ref: (f) => {
692
+ if (f) {
693
+ xe(r, i), a = d(u, r);
694
+ const o = w(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = kr(o), v = a._f.refs || [];
695
+ if (g ? v.find((S) => S === o) : o === a._f.ref)
696
+ return;
697
+ V(u, r, {
698
+ _f: {
699
+ ...a._f,
700
+ ...g ? {
701
+ refs: [
702
+ ...v.filter(ke),
703
+ o,
704
+ ...Array.isArray(d(n, r)) ? [{}] : []
705
+ ],
706
+ ref: { type: o.type, name: r }
707
+ } : { ref: o }
708
+ }
709
+ }), m(r, !1, void 0, o);
710
+ } else
711
+ a = d(u, r, {}), a._f && (a._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(vr(h.array, r) && y.action) && h.unMount.add(r);
712
+ }
713
+ };
714
+ }, Be = () => s.shouldFocusError && oe(u, ae, h.mount), or = (r) => {
715
+ W(r) && (b.state.next({ disabled: r }), oe(u, (i, a) => {
716
+ const c = d(u, a);
717
+ c && (i.disabled = c._f.disabled || r, Array.isArray(c._f.refs) && c._f.refs.forEach((f) => {
718
+ f.disabled = c._f.disabled || r;
719
+ }));
720
+ }, 0, !1));
721
+ }, Pe = (r, i) => async (a) => {
722
+ let c;
723
+ if (a && (a.preventDefault && a.preventDefault(), a.persist && a.persist()), s.disabled) {
724
+ i && await i({ ...t.errors }, a);
725
+ return;
726
+ }
727
+ let f = M(l);
728
+ if (b.state.next({
729
+ isSubmitting: !0
730
+ }), s.resolver) {
731
+ const { errors: o, values: g } = await X();
732
+ t.errors = o, f = g;
733
+ } else
734
+ await U(u);
735
+ if (E(t.errors, "root"), C(t.errors)) {
736
+ b.state.next({
737
+ errors: {}
738
+ });
739
+ try {
740
+ await r(f, a);
741
+ } catch (o) {
742
+ c = o;
743
+ }
744
+ } else
745
+ i && await i({ ...t.errors }, a), Be(), setTimeout(Be);
746
+ if (b.state.next({
747
+ isSubmitted: !0,
748
+ isSubmitting: !1,
749
+ isSubmitSuccessful: C(t.errors) && !c,
750
+ submitCount: t.submitCount + 1,
751
+ errors: t.errors
752
+ }), c)
753
+ throw c;
754
+ }, fr = (r, i = {}) => {
755
+ d(u, r) && (w(i.defaultValue) ? R(r, M(d(n, r))) : (R(r, i.defaultValue), V(n, r, M(i.defaultValue))), i.keepTouched || E(t.touchedFields, r), i.keepDirty || (E(t.dirtyFields, r), t.isDirty = i.defaultValue ? _(r, M(d(n, r))) : _()), i.keepError || (E(t.errors, r), x.isValid && j()), b.state.next({ ...t }));
756
+ }, pe = (r, i = {}) => {
757
+ const a = r ? M(r) : n, c = M(a), f = C(r), o = f ? n : c;
758
+ if (i.keepDefaultValues || (n = a), !i.keepValues) {
759
+ if (i.keepDirtyValues) {
760
+ const g = /* @__PURE__ */ new Set([
761
+ ...h.mount,
762
+ ...Object.keys(ue(n, l))
763
+ ]);
764
+ for (const v of Array.from(g))
765
+ d(t.dirtyFields, v) ? V(o, v, d(l, v)) : R(v, d(o, v));
766
+ } else {
767
+ if (Te && w(r))
768
+ for (const g of h.mount) {
769
+ const v = d(u, g);
770
+ if (v && v._f) {
771
+ const S = Array.isArray(v._f.refs) ? v._f.refs[0] : v._f.ref;
772
+ if (ve(S)) {
773
+ const T = S.closest("form");
774
+ if (T) {
775
+ T.reset();
776
+ break;
777
+ }
778
+ }
779
+ }
780
+ }
781
+ u = {};
782
+ }
783
+ l = e.shouldUnregister ? i.keepDefaultValues ? M(n) : {} : M(o), b.array.next({
784
+ values: { ...o }
785
+ }), b.values.next({
786
+ values: { ...o }
787
+ });
788
+ }
789
+ h = {
790
+ mount: i.keepDirtyValues ? h.mount : /* @__PURE__ */ new Set(),
791
+ unMount: /* @__PURE__ */ new Set(),
792
+ array: /* @__PURE__ */ new Set(),
793
+ watch: /* @__PURE__ */ new Set(),
794
+ watchAll: !1,
795
+ focus: ""
796
+ }, y.mount = !x.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, b.state.next({
797
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
798
+ isDirty: f ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !Q(r, n)),
799
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
800
+ dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && l ? ue(n, l) : t.dirtyFields : i.keepDefaultValues && r ? ue(n, r) : i.keepDirty ? t.dirtyFields : {},
801
+ touchedFields: i.keepTouched ? t.touchedFields : {},
802
+ errors: i.keepErrors ? t.errors : {},
803
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
804
+ isSubmitting: !1
805
+ });
806
+ }, Ie = (r, i) => pe(H(r) ? r(l) : r, i);
807
+ return {
808
+ control: {
809
+ register: xe,
810
+ unregister: Ve,
811
+ getFieldState: Ue,
812
+ handleSubmit: Pe,
813
+ setError: Re,
814
+ _executeSchema: X,
815
+ _getWatch: A,
816
+ _getDirty: _,
817
+ _updateValid: j,
818
+ _removeUnmounted: ye,
819
+ _updateFieldArray: F,
820
+ _updateDisabledField: Me,
821
+ _getFieldArray: k,
822
+ _reset: pe,
823
+ _resetDefaultValues: () => H(s.defaultValues) && s.defaultValues().then((r) => {
824
+ Ie(r, s.resetOptions), b.state.next({
825
+ isLoading: !1
826
+ });
827
+ }),
828
+ _updateFormState: (r) => {
829
+ t = {
830
+ ...t,
831
+ ...r
832
+ };
833
+ },
834
+ _disableForm: or,
835
+ _subjects: b,
836
+ _proxyFormState: x,
837
+ _setErrors: Y,
838
+ get _fields() {
839
+ return u;
840
+ },
841
+ get _formValues() {
842
+ return l;
843
+ },
844
+ get _state() {
845
+ return y;
846
+ },
847
+ set _state(r) {
848
+ y = r;
849
+ },
850
+ get _defaultValues() {
851
+ return n;
852
+ },
853
+ get _names() {
854
+ return h;
855
+ },
856
+ set _names(r) {
857
+ h = r;
858
+ },
859
+ get _formState() {
860
+ return t;
861
+ },
862
+ set _formState(r) {
863
+ t = r;
864
+ },
865
+ get _options() {
866
+ return s;
867
+ },
868
+ set _options(r) {
869
+ s = {
870
+ ...s,
871
+ ...r
872
+ };
873
+ }
874
+ },
875
+ trigger: le,
876
+ register: xe,
877
+ handleSubmit: Pe,
878
+ watch: nr,
879
+ setValue: R,
880
+ getValues: Ne,
881
+ reset: Ie,
882
+ resetField: fr,
883
+ clearErrors: ur,
884
+ unregister: Ve,
885
+ setError: Re,
886
+ setFocus: (r, i = {}) => {
887
+ const a = d(u, r), c = a && a._f;
888
+ if (c) {
889
+ const f = c.refs ? c.refs[0] : c.ref;
890
+ f.focus && (f.focus(), i.shouldSelect && H(f.select) && f.select());
891
+ }
892
+ },
893
+ getFieldState: Ue
894
+ };
895
+ }
896
+ function Pr(e = {}) {
897
+ const s = B.useRef(), t = B.useRef(), [u, n] = B.useState({
898
+ isDirty: !1,
899
+ isValidating: !1,
900
+ isLoading: H(e.defaultValues),
901
+ isSubmitted: !1,
902
+ isSubmitting: !1,
903
+ isSubmitSuccessful: !1,
904
+ isValid: !1,
905
+ submitCount: 0,
906
+ dirtyFields: {},
907
+ touchedFields: {},
908
+ validatingFields: {},
909
+ errors: e.errors || {},
910
+ disabled: e.disabled || !1,
911
+ defaultValues: H(e.defaultValues) ? void 0 : e.defaultValues
912
+ });
913
+ s.current || (s.current = {
914
+ ...Nr(e),
915
+ formState: u
916
+ });
917
+ const l = s.current.control;
918
+ return l._options = e, Ar({
919
+ subject: l._subjects.state,
920
+ next: (y) => {
921
+ Fr(y, l._proxyFormState, l._updateFormState) && n({ ...l._formState });
922
+ }
923
+ }), B.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), B.useEffect(() => {
924
+ if (l._proxyFormState.isDirty) {
925
+ const y = l._getDirty();
926
+ y !== u.isDirty && l._subjects.state.next({
927
+ isDirty: y
928
+ });
929
+ }
930
+ }, [l, u.isDirty]), B.useEffect(() => {
931
+ e.values && !Q(e.values, t.current) ? (l._reset(e.values, l._options.resetOptions), t.current = e.values, n((y) => ({ ...y }))) : l._resetDefaultValues();
932
+ }, [e.values, l]), B.useEffect(() => {
933
+ e.errors && l._setErrors(e.errors);
934
+ }, [e.errors, l]), B.useEffect(() => {
935
+ l._state.mount || (l._updateValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
936
+ }), B.useEffect(() => {
937
+ e.shouldUnregister && l._subjects.values.next({
938
+ values: l._getWatch()
939
+ });
940
+ }, [e.shouldUnregister, l]), s.current.formState = br(u, l), s.current;
941
+ }
942
+ export {
943
+ Pr as u
944
+ };