dorkos 0.115.0 → 0.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/bin/cli.js +130 -69
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-Cz8ijNrK.js → AboutPage-KW-6Y7Wm.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-BzmfwxSZ.js → ActivityErrorState-C5xbcrFo.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BK7T3OiI.js → ActivityPage-DIeicP6l.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-Ig5atv15.js → ActivityRow-Drxrnyea.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-BXPv5J8h.js → AdapterIcon-BEuzKbC6.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-BEziztL3.js → AdapterSetupWizard-z_agWfDl.js} +2 -2
  10. package/dist/client/assets/{AgentOptionRow-BqFQvFeN.js → AgentOptionRow-DEwQwnKr.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-dCfEIsU-.js → AgentPicker-CmyF25Oi.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-BAhfGJxx.js → AgentRequestCard-BWtE34Nr.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-7qHhFeEv.js → AppearancePage-BJO-Q3a4.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-jqOFh0d1.js → ApplyToOverridesDialog-CsmbPbTh.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-3CgglXkd.js → AttentionSignalRow-2-aDCEdR.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMKtHI0D.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CL7e4dO8.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DSBxRyzA.js → BindingDialog-CirNTa_m.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-CyRuqAJV.js → BlintzCanvas-bfmQpoVE.js} +1 -1
  19. package/dist/client/assets/{CanvasCsvContent-Bd1c6TGx.js → CanvasCsvContent-x86ueAZo.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-DelYwSH8.js → CanvasFileContent-DIQbKII9.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-BExIu4RY.js → CanvasModel3dContent-DTAWG8IS.js} +2 -2
  22. package/dist/client/assets/{ChatAppsOff-SWemSaUp.js → ChatAppsOff-BQiTfHe3.js} +1 -1
  23. package/dist/client/assets/{CodeMirrorDiff-0WF4ITRZ.js → CodeMirrorDiff-DhNTAsQl.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorEditor-Bg7wC_Q8.js → CodeMirrorEditor-BpIF0kLM.js} +1 -1
  25. package/dist/client/assets/{CommitmentList-CTvEGUV3.js → CommitmentList-B-B3E6yN.js} +1 -1
  26. package/dist/client/assets/{CommitmentsPage-C68etoLe.js → CommitmentsPage-BNoKIW7z.js} +1 -1
  27. package/dist/client/assets/ComputerResourceView-NMA65a8a.js +6 -0
  28. package/dist/client/assets/ComputerViewer-BjU1hfpc.js +1 -0
  29. package/dist/client/assets/{ConnectionAccessLists-9oeVn_GK.js → ConnectionAccessLists-Iy_T25Rw.js} +1 -1
  30. package/dist/client/assets/{ConnectionsPage-CJOY4-kp.js → ConnectionsPage-DPfoPshS.js} +2 -2
  31. package/dist/client/assets/{ConventionPage-DD-f5o6y.js → ConventionPage-CoLB6WVs.js} +1 -1
  32. package/dist/client/assets/{ExtensionPageRoute-C6fW17AG.js → ExtensionPageRoute-Y_Na63mr.js} +2 -2
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-Zccd0fv6.js → FloatingTanStackRouterDevtools-CqogiFob-DCj2Id-d.js} +1 -1
  34. package/dist/client/assets/HandlePage-WyPrFOtj.js +1 -0
  35. package/dist/client/assets/{HeartbeatPage-cJM6NuTD.js → HeartbeatPage-zzL8W_zA.js} +1 -1
  36. package/dist/client/assets/{KeyEntry-K5k_3TfU.js → KeyEntry-DCATqdIG.js} +2 -2
  37. package/dist/client/assets/{LexicalField-DB5V20zv.js → LexicalField-B7d9UWFk.js} +1 -1
  38. package/dist/client/assets/{ManagesPage-Cj0-hwfr.js → ManagesPage-CKTb1w3G.js} +1 -1
  39. package/dist/client/assets/{Marketplace-eWEtLmd9.js → Marketplace-Deq-aTM6.js} +2 -2
  40. package/dist/client/assets/{MarketplaceSourcesView-B1h70C20.js → MarketplaceSourcesView-B2qLtCVG.js} +1 -1
  41. package/dist/client/assets/{McpAppFrame-BaJ_r-QR.js → McpAppFrame-BKgYSUH-.js} +1 -1
  42. package/dist/client/assets/{McpSigninBody-Coaq5Fkf.js → McpSigninBody-Begd1UNn.js} +1 -1
  43. package/dist/client/assets/{Model3dViewer-cKa-Jnbl.js → Model3dViewer-CK6siI6q.js} +1 -1
  44. package/dist/client/assets/NamePage-DxDcIFAo.js +1 -0
  45. package/dist/client/assets/{NewDirectMessageMenu-C4zNIv9x.js → NewDirectMessageMenu-D4ORE1Lo.js} +1 -1
  46. package/dist/client/assets/{NotificationsPage-gKNClvNU.js → NotificationsPage-CjRyxKXv.js} +1 -1
  47. package/dist/client/assets/{OpenMeshSwitch-RzB2u6-Q.js → OpenMeshSwitch-C0C-f-dF.js} +2 -2
  48. package/dist/client/assets/{OperatorIdentityForm-B_78Vqh8.js → OperatorIdentityForm-I9zvI2go.js} +1 -1
  49. package/dist/client/assets/{PermissionHistory-DrtlA4YM.js → PermissionHistory-C9vTiyw5.js} +1 -1
  50. package/dist/client/assets/{PermissionsPage-O7kUVaQv.js → PermissionsPage-BR9LM1Bo.js} +1 -1
  51. package/dist/client/assets/{PersonalityPopover-DiNuuoWu.js → PersonalityPopover-BhFUSfRe.js} +1 -1
  52. package/dist/client/assets/PhotoPage-C4OhoBR2.js +1 -0
  53. package/dist/client/assets/{PresetPicker-BUFwg8RS.js → PresetPicker-CpTnkeZt.js} +3 -3
  54. package/dist/client/assets/{PreviewRefusedNotice-DXZp669C.js → PreviewRefusedNotice-R5LB9PuV.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-BCfMzNcT.js → ProfileFields-8fFud5gT.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-BzC2MGdi.js → ProfilePanelContainer-BJFOrUov.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-f0FKXLtu.js → ProfileRolePicker-C8hpW08c.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-EgeMFibt.js → PromptSuggestionChips-1su17rvx.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-CQ4Xxslu.js → ReportsToPopover-7H3_8Brz.js} +1 -1
  60. package/dist/client/assets/{RoomSurface-oDbc6jnO.js → RoomSurface-BkoesTVz.js} +5 -5
  61. package/dist/client/assets/{RoomsPage-D_EbiSZ3.js → RoomsPage-BrMOJQpt.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-LtmmbIsD.js → RunsOnPopover-BB7T1Zln.js} +1 -1
  63. package/dist/client/assets/{RuntimeConnectFlow-Kv2ytk2m.js → RuntimeConnectFlow-oHwqp_fn.js} +1 -1
  64. package/dist/client/assets/{RuntimeSetupDialog-CiWxlcPc.js → RuntimeSetupDialog-BTT2-FM8.js} +1 -1
  65. package/dist/client/assets/{SessionsPage-1rDO0SGV.js → SessionsPage-PpKG9Phd.js} +1 -1
  66. package/dist/client/assets/{SettingsDialog-_ctp2AfE.js → SettingsDialog-Dxtq0E9R.js} +4 -4
  67. package/dist/client/assets/{SkillsPage-gPuQHKps.js → SkillsPage-CzzuhGH2.js} +1 -1
  68. package/dist/client/assets/{TaskDialogWrapper-BPFpCgsN.js → TaskDialogWrapper-DWVo-1P7.js} +1 -1
  69. package/dist/client/assets/{TasksEmptyState-D0Jlzmed.js → TasksEmptyState-DfR9p54p.js} +2 -2
  70. package/dist/client/assets/{TasksPage-DvGfg5Bk.js → TasksPage-5_XngIV9.js} +1 -1
  71. package/dist/client/assets/TeamComputerEntry-BE_gamkp.js +1 -0
  72. package/dist/client/assets/{ToolsPage-B0qZ85pR.js → ToolsPage-CefworrO.js} +2 -2
  73. package/dist/client/assets/{TopologyGraph-q1ammgpG.js → TopologyGraph-C1DaL02H.js} +2 -2
  74. package/dist/client/assets/{TourHost-Dc8qw1Ef.js → TourHost-pT1tIPF7.js} +1 -1
  75. package/dist/client/assets/{UnlinkDialog-DXdrLsGV.js → UnlinkDialog-oMOr8e6G.js} +1 -1
  76. package/dist/client/assets/{WidgetErrorCard-ChDNC060.js → WidgetErrorCard-CBFo1SMe.js} +7 -7
  77. package/dist/client/assets/_shell-BiAMGu0F.js +90 -0
  78. package/dist/client/assets/{_shell._home-DjGunhLV.js → _shell._home-Cx7ZsoQO.js} +1 -1
  79. package/dist/client/assets/{_shell._home.activity-B014dET1.js → _shell._home.activity-C3fnNXgc.js} +1 -1
  80. package/dist/client/assets/{_shell._home.index-DEmtTHZg.js → _shell._home.index-CixksaeD.js} +2 -2
  81. package/dist/client/assets/{_shell._home.tasks-CnDEbUOd.js → _shell._home.tasks-DZWUHfK_.js} +1 -1
  82. package/dist/client/assets/{_shell._home.workspaces-AQtMUWuu.js → _shell._home.workspaces-y-DAPB_X.js} +1 -1
  83. package/dist/client/assets/{_shell.channels-C8NOhmJd.js → _shell.channels-DEErD0f0.js} +4 -4
  84. package/dist/client/assets/{_shell.connections-Bxe0wxOB.js → _shell.connections-B36f6FWi.js} +1 -1
  85. package/dist/client/assets/{_shell.feedback-requests-C6ku9F5_.js → _shell.feedback-requests-B0QiSuDC.js} +2 -2
  86. package/dist/client/assets/_shell.marketplace-CardBSA_.js +1 -0
  87. package/dist/client/assets/_shell.marketplace_.sources-CVK8YKDA.js +1 -0
  88. package/dist/client/assets/{_shell.session-Dn0C0mEZ.js → _shell.session-Cl7qfi1Z.js} +3 -3
  89. package/dist/client/assets/_shell.team-DIdgc_vn.js +28 -0
  90. package/dist/client/assets/_shell.x._extensionId-BEPW8hvh.js +1 -0
  91. package/dist/client/assets/_shell.x._extensionId_._-BEPW8hvh.js +1 -0
  92. package/dist/client/assets/{access-copy-CBGtcTk0.js → access-copy-CE5oc1d9.js} +1 -1
  93. package/dist/client/assets/{agent-browser-DbcLtsAx.js → agent-browser-DV76U8Ny.js} +1 -1
  94. package/dist/client/assets/{banner-rPsz3suJ.js → banner-DIVQNO0O.js} +1 -1
  95. package/dist/client/assets/{card-BqN3lfJn.js → card-DVdPY08b.js} +1 -1
  96. package/dist/client/assets/{command-ZTLTCj0l.js → command-BhZ8sKG4.js} +1 -1
  97. package/dist/client/assets/{cpu-D70xMHl2.js → cpu-CtmIFRqs.js} +1 -1
  98. package/dist/client/assets/{empty-state-yl1dLwLN.js → empty-state-DHuumxZB.js} +1 -1
  99. package/dist/client/assets/{execution-config-BbBEe6FO.js → execution-config-JdnxoV1P.js} +1 -1
  100. package/dist/client/assets/{file-CGg2M6ED.js → file-Bc34j1rj.js} +1 -1
  101. package/dist/client/assets/{file-exclamation-point-DZrVsShR.js → file-exclamation-point-dxJUSR3k.js} +1 -1
  102. package/dist/client/assets/{file-text-BYq_4IAt.js → file-text-BNSVr0Hh.js} +1 -1
  103. package/dist/client/assets/{find-latest-widget-fence-CWs9nr10.js → find-latest-widget-fence-oI6Sl7rV.js} +1 -1
  104. package/dist/client/assets/{form-vPuXuaYT.js → form-FbjLEM3I.js} +1 -1
  105. package/dist/client/assets/{format-cron-D02Tnupo.js → format-cron-BaE7qyNN.js} +1 -1
  106. package/dist/client/assets/{git-branch-DbjXDO_F.js → git-branch-BBKObhlk.js} +1 -1
  107. package/dist/client/assets/{heart-Dblp_miM.js → heart-BdbxexAy.js} +1 -1
  108. package/dist/client/assets/{highlighted-body-KPVGNVTW-CaMXMak-.js → highlighted-body-KPVGNVTW-R3x8mG02.js} +1 -1
  109. package/dist/client/assets/{index-vRc1D4KI.js → index-0AgY877T.js} +1 -1
  110. package/dist/client/assets/{index-D16KF-iC.js → index-1-RB7sXm.js} +3 -3
  111. package/dist/client/assets/{index-BW98owO8.js → index-4irOzx9Q.js} +1 -1
  112. package/dist/client/assets/{index-P5j6zmcN.js → index-6ZmBCm_d.js} +1 -1
  113. package/dist/client/assets/{index-DzeYt-GT.js → index-7xf1fyHe.js} +1 -1
  114. package/dist/client/assets/{index-BxqUb-n7.js → index-BCT0tkN4.js} +1 -1
  115. package/dist/client/assets/{index-BKuzoeSn.js → index-BFh_VGhh.js} +1 -1
  116. package/dist/client/assets/{index-B-WvQ24u.js → index-BKnIV8YQ.js} +6 -6
  117. package/dist/client/assets/{index-D6m2SWHr.js → index-BQgJVNUB.js} +1 -1
  118. package/dist/client/assets/{index-BiIbMZ6d.js → index-BV0RP90y.js} +1 -1
  119. package/dist/client/assets/{index-BV0tZnYg.js → index-BWHsw5Qn.js} +1 -1
  120. package/dist/client/assets/{index-CMWMhbec.js → index-BbUZazTt.js} +1 -1
  121. package/dist/client/assets/{index-CWNsRK97.js → index-BcPMhqQ_.js} +1 -1
  122. package/dist/client/assets/{index-DwUdUliR.js → index-BeKz0Z7i.js} +1 -1
  123. package/dist/client/assets/index-C481yCZ2.js +1 -0
  124. package/dist/client/assets/{index-Db2EOzA3.js → index-C4vL5hUU.js} +1 -1
  125. package/dist/client/assets/{index-DDYi817r.js → index-C5n3OkTH.js} +1 -1
  126. package/dist/client/assets/{index-Z8YcKwIB.js → index-C76UofV4.js} +1 -1
  127. package/dist/client/assets/index-CB-aY4BF.js +1 -0
  128. package/dist/client/assets/{index-CN9fywRC.js → index-CDx26Vyr.js} +1 -1
  129. package/dist/client/assets/{index-Dg_bax15.js → index-CJW9tZhq.js} +5 -5
  130. package/dist/client/assets/{index-BPwUl0Bz.js → index-CJw16oEF.js} +1 -1
  131. package/dist/client/assets/{index-CaLw69VE.js → index-C_Pquyu-.js} +1 -1
  132. package/dist/client/assets/{index-Gq3gqBhY.js → index-CpAdYUxX.js} +1 -1
  133. package/dist/client/assets/{index-XE46wAj9.js → index-D1bAoT3D.js} +1 -1
  134. package/dist/client/assets/{index-Bd23EYYT.js → index-D7MytHQN.js} +2 -2
  135. package/dist/client/assets/index-DKubbEZd.css +1 -0
  136. package/dist/client/assets/{index-BOL391En.js → index-DShpGK7T.js} +1 -1
  137. package/dist/client/assets/{index-C88NZagl.js → index-DlWFe9SD.js} +1 -1
  138. package/dist/client/assets/{index-oWLYcpm4.js → index-DluIa1Dv.js} +1 -1
  139. package/dist/client/assets/index-Dm1Ngy2r.js +38 -0
  140. package/dist/client/assets/{index-CdKpQ1hI.js → index-DxTOTFWT.js} +280 -280
  141. package/dist/client/assets/{index-lNMJBFB0.js → index-DzRQN8yx.js} +1 -1
  142. package/dist/client/assets/index-Fl8NxGfN.js +119 -0
  143. package/dist/client/assets/{index-CrK4rKAq.js → index-fe27h49h.js} +1 -1
  144. package/dist/client/assets/{index-DdbHrvr0.js → index-hIJdyL6m.js} +1 -1
  145. package/dist/client/assets/{index-BPqkuMIa.js → index-hLWqos0I.js} +1 -1
  146. package/dist/client/assets/{index-CRZXSh_q.js → index-pKhRsSRA.js} +1 -1
  147. package/dist/client/assets/{index-CHvi6xUU.js → index-sRPmoNhi.js} +1 -1
  148. package/dist/client/assets/{index-BdVOtoFr.js → index-tPf4Bia7.js} +1 -1
  149. package/dist/client/assets/{index-Bi7Um5RU.js → index-vHt--4jg.js} +1 -1
  150. package/dist/client/assets/{inline-code-Cvn43Gqu.js → inline-code-CrAiSiKW.js} +1 -1
  151. package/dist/client/assets/{layers-Bmz62WF4.js → layers-QYiauDIw.js} +1 -1
  152. package/dist/client/assets/{lightbulb-CAd6slmc.js → lightbulb-Dc3wEED9.js} +1 -1
  153. package/dist/client/assets/{link-2-C0mn8T24.js → link-2-BUnfBMCd.js} +1 -1
  154. package/dist/client/assets/{list-runtime-types-DxwGcKLx.js → list-runtime-types-H-N7VUS4.js} +1 -1
  155. package/dist/client/assets/{markdown-content-1-B7PdbY.js → markdown-content-fIydDTfa.js} +1 -1
  156. package/dist/client/assets/{mention-pill-D_-KXznh.js → mention-pill-CONiQ9Xs.js} +1 -1
  157. package/dist/client/assets/{message-square-off-Di7kQvfe.js → message-square-off-BMD4bxOr.js} +1 -1
  158. package/dist/client/assets/{more-details-C6UGVeDE.js → more-details-DMD6Pqb5.js} +1 -1
  159. package/dist/client/assets/{owner-notice-CudDDBX4.js → owner-notice-BRcpYvJk.js} +1 -1
  160. package/dist/client/assets/{package-D2eMoFCI.js → package-CGgpgsfC.js} +1 -1
  161. package/dist/client/assets/{page-container-CDHAACRA.js → page-container-uyGtbP6Z.js} +1 -1
  162. package/dist/client/assets/{paperclip-p0W24D54.js → paperclip-CUxIVlMU.js} +1 -1
  163. package/dist/client/assets/{path-input-j04LMj9z.js → path-input-CeMu6ytc.js} +1 -1
  164. package/dist/client/assets/{primer-trigger-DkCcHf2Q.js → primer-trigger-x8IfRd6U.js} +2 -2
  165. package/dist/client/assets/{profile-errors-CqflLCzu.js → profile-errors-DyrpY2ry.js} +1 -1
  166. package/dist/client/assets/{progress-BcuH4Eod.js → progress-2cuTo9I-.js} +1 -1
  167. package/dist/client/assets/{query-error-state-CEZs7dhg.js → query-error-state-Cq1O4FGq.js} +1 -1
  168. package/dist/client/assets/{radio-DGWfQ5Rf.js → radio-H5ktIFzD.js} +1 -1
  169. package/dist/client/assets/registry-DNRE0Em-.js +1 -0
  170. package/dist/client/assets/{relay-trace-schemas-y0nd8fzi.js → relay-trace-schemas-Crc4Iceb.js} +2 -2
  171. package/dist/client/assets/{room-files-source-C1TCg4W_.js → room-files-source-thCvGi0E.js} +2 -2
  172. package/dist/client/assets/{rotate-ccw-clock-DcBojy-0.js → rotate-ccw-clock-DKP7zbQr.js} +1 -1
  173. package/dist/client/assets/{rotate-cw-D0vUyeR2.js → rotate-cw-Cwv_uaU3.js} +1 -1
  174. package/dist/client/assets/{scroll-area-CQ9lO56h.js → scroll-area-CaJ1TwhG.js} +1 -1
  175. package/dist/client/assets/{search-x-EJGj73JB.js → search-x-D-Un20jR.js} +2 -2
  176. package/dist/client/assets/{shield-check-Bp58y9u7.js → shield-check-CMhrOu-d.js} +1 -1
  177. package/dist/client/assets/{shield-x-jF_NCCvp.js → shield-x-DlaUufPM.js} +1 -1
  178. package/dist/client/assets/{soul-file-Cag2i87x.js → soul-file-C5-nKCwV.js} +1 -1
  179. package/dist/client/assets/{table-D89CWVJX.js → table-C7pi-jkJ.js} +1 -1
  180. package/dist/client/assets/{terminal-BUhNMZAt.js → terminal-IYkyS2eR.js} +1 -1
  181. package/dist/client/assets/{trust-posture-15DMDZTA.js → trust-posture-BxFTuKAo.js} +1 -1
  182. package/dist/client/assets/{unplug-opnrSXAi.js → unplug-Bv5BESa4.js} +1 -1
  183. package/dist/client/assets/{unverified-catalog-notice-DHM5Coia.js → unverified-catalog-notice-B9dzvyVq.js} +1 -1
  184. package/dist/client/assets/{use-adapter-catalog-ClMqVelU.js → use-adapter-catalog-DDD8zCQo.js} +1 -1
  185. package/dist/client/assets/{use-bindings-Ch6UUBvz.js → use-bindings-BXHWfTB2.js} +1 -1
  186. package/dist/client/assets/{use-composer-prefs-Qn7KRpYe.js → use-composer-prefs-DG8dQD3D.js} +1 -1
  187. package/dist/client/assets/{use-connector-management-dX_4x0d3.js → use-connector-management-l6Ii6UIU.js} +1 -1
  188. package/dist/client/assets/{use-deep-link-scroll-BV2fY4gy.js → use-deep-link-scroll-CPgyWLMM.js} +1 -1
  189. package/dist/client/assets/{use-delete-binding-BklxjB_c.js → use-delete-binding-NPl-TzUw.js} +1 -1
  190. package/dist/client/assets/{use-dev-links-D4Bqam6F.js → use-dev-links-DYaUSRn0.js} +1 -1
  191. package/dist/client/assets/{use-external-adapter-catalog-nHiD8BKZ.js → use-external-adapter-catalog-BrmKSNvG.js} +1 -1
  192. package/dist/client/assets/{use-full-activity-feed-vYU7wQWT.js → use-full-activity-feed-CEvmRK6d.js} +1 -1
  193. package/dist/client/assets/use-is-below-desktop-Cx2BL1BK.js +1 -0
  194. package/dist/client/assets/{use-jump-back-in-BVunjzyr.js → use-jump-back-in-BMgpYhK-.js} +2 -2
  195. package/dist/client/assets/{use-mesh-topology-NaUKSKol.js → use-mesh-topology-D82_pOi9.js} +1 -1
  196. package/dist/client/assets/{use-mounted-ref-BWpQ8f91.js → use-mounted-ref-Bs5osknq.js} +1 -1
  197. package/dist/client/assets/{use-notification-prefs-qO1zRRFN.js → use-notification-prefs-Bpzt57w3.js} +1 -1
  198. package/dist/client/assets/{use-panel-tab-placements-Db6p2vLD.js → use-panel-tab-placements-COBgt4Uh.js} +1 -1
  199. package/dist/client/assets/use-pending-read-DpJbidPK.js +1 -0
  200. package/dist/client/assets/{use-personality-commit-DUEKxHt_.js → use-personality-commit-D8Fqsrzc.js} +1 -1
  201. package/dist/client/assets/{use-promo-activation-CnGaw39P.js → use-promo-activation-sHnkQjl-.js} +2 -2
  202. package/dist/client/assets/{use-promo-dismissals-bkSHhGhj.js → use-promo-dismissals-BW_429t4.js} +1 -1
  203. package/dist/client/assets/{use-pulse-freshness-Oc_1gs-Y.js → use-pulse-freshness-BkYMwuUb.js} +1 -1
  204. package/dist/client/assets/{use-relay-config-Ba-S4wxY.js → use-relay-config-CsB8Q0cK.js} +1 -1
  205. package/dist/client/assets/{use-room-follow-claim-DqE5b95Z.js → use-room-follow-claim-DqvqzwBA.js} +1 -1
  206. package/dist/client/assets/{use-roving-tab-list-DnMqliqf.js → use-roving-tab-list-iDj1p8tT.js} +1 -1
  207. package/dist/client/assets/{use-session-canvas-OdljtBE8.js → use-session-canvas-DrKA7UHs.js} +4 -4
  208. package/dist/client/assets/{use-session-diagnostics-CtjxsM8_.js → use-session-diagnostics-D6wJVzUG.js} +2 -2
  209. package/dist/client/assets/{use-unclaimed-chats-5RCD5wIp.js → use-unclaimed-chats-bLDQhIiU.js} +1 -1
  210. package/dist/client/assets/use-update-config-Dk0MthxZ.js +1 -0
  211. package/dist/client/assets/{useMutationState-Mjr_y4xX.js → useMutationState-eZMPCch6.js} +1 -1
  212. package/dist/client/index.html +2 -2
  213. package/dist/server/extension-child.cjs +772 -36
  214. package/dist/server/index.js +5533 -4697
  215. package/dist/server/index.js.map +2 -2
  216. package/package.json +6 -5
  217. package/dist/client/assets/HandlePage-DOxlquWl.js +0 -1
  218. package/dist/client/assets/NamePage-W7Frb1yy.js +0 -1
  219. package/dist/client/assets/PhotoPage-DdBke3yj.js +0 -1
  220. package/dist/client/assets/_shell-BxPza3Lx.js +0 -88
  221. package/dist/client/assets/_shell.marketplace-CEnzWFmI.js +0 -1
  222. package/dist/client/assets/_shell.marketplace_.sources-BZq1d2ih.js +0 -1
  223. package/dist/client/assets/_shell.team-DoLdOMoC.js +0 -28
  224. package/dist/client/assets/_shell.x._extensionId-DhE3OYMF.js +0 -1
  225. package/dist/client/assets/_shell.x._extensionId_._-DhE3OYMF.js +0 -1
  226. package/dist/client/assets/index-BzczIyv5.js +0 -119
  227. package/dist/client/assets/index-C6NUjpzQ.js +0 -38
  228. package/dist/client/assets/index-O_HMols_.js +0 -1
  229. package/dist/client/assets/index-kktlr1TJ.css +0 -1
  230. package/dist/client/assets/registry-ChxwU0f4.js +0 -1
  231. package/dist/client/assets/use-is-below-desktop-G-mTu2Ga.js +0 -1
  232. package/dist/client/assets/use-pending-read-DUqJZUza.js +0 -1
  233. package/dist/client/assets/use-update-config-xkznZMHr.js +0 -1
@@ -1 +1 @@
1
- import{z as t,_ as c,D as a,F as l,G as e,J as s,K as m}from"./index-CdKpQ1hI.js";function S(o){if(o.transport!=="stdio"||!o.args)return;const r=o.args;if(!r.some(i=>i.startsWith("@playwright/mcp")))return;const g=r.indexOf("--storage-state");if(g!==-1)return r[g+1];const n=r.find(i=>i.startsWith("--storage-state="));return n==null?void 0:n.slice(16)}const u=t({name:e(),value:e(),domain:e(),path:e(),expires:l(),httpOnly:a(),secure:a(),sameSite:c(["Strict","Lax","None"])}).passthrough(),h=t({origin:e(),localStorage:s(t({name:e(),value:e()}))}).passthrough();t({cookies:s(u),origins:s(h).default([])}).passthrough();const d=t({site:e(),cookies:l().int(),expiresAt:e().nullable(),expired:a(),pageStorage:a()});t({stateFile:e(),saved:a(),savedAt:e().nullable(),sites:s(d),loginCommand:e(),server:t({name:e(),connection:t({transport:m("stdio"),command:e(),args:s(e()),env:t({}).catchall(e())})})});export{S as a};
1
+ import{z as t,_ as c,D as a,F as l,G as e,J as s,K as m}from"./index-DxTOTFWT.js";function S(o){if(o.transport!=="stdio"||!o.args)return;const r=o.args;if(!r.some(i=>i.startsWith("@playwright/mcp")))return;const g=r.indexOf("--storage-state");if(g!==-1)return r[g+1];const n=r.find(i=>i.startsWith("--storage-state="));return n==null?void 0:n.slice(16)}const u=t({name:e(),value:e(),domain:e(),path:e(),expires:l(),httpOnly:a(),secure:a(),sameSite:c(["Strict","Lax","None"])}).passthrough(),h=t({origin:e(),localStorage:s(t({name:e(),value:e()}))}).passthrough();t({cookies:s(u),origins:s(h).default([])}).passthrough();const d=t({site:e(),cookies:l().int(),expiresAt:e().nullable(),expired:a(),pageStorage:a()});t({stateFile:e(),saved:a(),savedAt:e().nullable(),sites:s(d),loginCommand:e(),server:t({name:e(),connection:t({transport:m("stdio"),command:e(),args:s(e()),env:t({}).catchall(e())})})});export{S as a};
@@ -1,4 +1,4 @@
1
- import{a2 as b,j as a,aT as m,bE as h,a7 as p,X as v,bF as y,W as j,Q as w,a1 as N}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as b,j as a,aT as m,bE as h,a7 as p,X as v,bF as y,W as j,Q as w,a1 as N}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as r,Q as e,a1 as o}from"./index-CdKpQ1hI.js";const c=o("bg-card text-card-foreground shadow-soft flex flex-col border p-4",{variants:{variant:{static:"",interactive:"card-interactive"},radius:{md:"rounded-lg",lg:"rounded-xl"},gap:{none:"",sm:"gap-3",md:"gap-4"}},defaultVariants:{variant:"static",radius:"md",gap:"md"}});function l({className:a,variant:t,radius:s,gap:d,...n}){return r.jsx("div",{"data-slot":"card",className:e(c({variant:t,radius:s,gap:d}),a),...n})}function x({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:e("flex flex-col gap-1",a),...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-title",className:e("text-sm leading-none font-semibold",a),...t})}function f({className:a,...t}){return r.jsx("p",{"data-slot":"card-description",className:e("text-muted-foreground text-xs",a),...t})}function m({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:e("flex flex-col gap-3",a),...t})}function p({className:a,...t}){return r.jsx("div",{"data-slot":"card-footer",className:e("flex items-center gap-2 border-t pt-3",a),...t})}export{l as C,x as a,u as b,f as c,m as d,p as e};
1
+ import{j as r,Q as e,a1 as o}from"./index-DxTOTFWT.js";const c=o("bg-card text-card-foreground shadow-soft flex flex-col border p-4",{variants:{variant:{static:"",interactive:"card-interactive"},radius:{md:"rounded-lg",lg:"rounded-xl"},gap:{none:"",sm:"gap-3",md:"gap-4"}},defaultVariants:{variant:"static",radius:"md",gap:"md"}});function l({className:a,variant:t,radius:s,gap:d,...n}){return r.jsx("div",{"data-slot":"card",className:e(c({variant:t,radius:s,gap:d}),a),...n})}function x({className:a,...t}){return r.jsx("div",{"data-slot":"card-header",className:e("flex flex-col gap-1",a),...t})}function u({className:a,...t}){return r.jsx("div",{"data-slot":"card-title",className:e("text-sm leading-none font-semibold",a),...t})}function f({className:a,...t}){return r.jsx("p",{"data-slot":"card-description",className:e("text-muted-foreground text-xs",a),...t})}function m({className:a,...t}){return r.jsx("div",{"data-slot":"card-content",className:e("flex flex-col gap-3",a),...t})}function p({className:a,...t}){return r.jsx("div",{"data-slot":"card-footer",className:e("flex items-center gap-2 border-t pt-3",a),...t})}export{l as C,x as a,u as b,f as c,m as d,p as e};
@@ -1 +1 @@
1
- import{r as l,di as q,bw as A,dj as Ce,dk as Se,dl as Ie,dm as Re,dn as z,j as S,Q as $,dp as Ae}from"./index-CdKpQ1hI.js";var fe=1,je=.9,Me=.8,De=.17,ee=.1,te=.999,$e=.9999,Ne=.99,Fe=/[\\\/_+.#"@\[\(\{&]/,Ke=/[\\\/_+.#"@\[\(\{&]/g,Le=/[\s-]/,ge=/[\s-]/g;function ne(e,n,r,m,u,d,c){if(d===n.length)return u===e.length?fe:Ne;var f=`${u},${d}`;if(c[f]!==void 0)return c[f];for(var b=m.charAt(d),o=r.indexOf(b,u),v=0,g,C,w,I;o>=0;)g=ne(e,n,r,m,o+1,d+1,c),g>v&&(o===u?g*=fe:Fe.test(e.charAt(o-1))?(g*=Me,w=e.slice(u,o-1).match(Ke),w&&u>0&&(g*=Math.pow(te,w.length))):Le.test(e.charAt(o-1))?(g*=je,I=e.slice(u,o-1).match(ge),I&&u>0&&(g*=Math.pow(te,I.length))):(g*=De,u>0&&(g*=Math.pow(te,o-u))),e.charAt(o)!==n.charAt(d)&&(g*=$e)),(g<ee&&r.charAt(o-1)===m.charAt(d+1)||m.charAt(d+1)===m.charAt(d)&&r.charAt(o-1)!==m.charAt(d))&&(C=ne(e,n,r,m,o+1,d+2,c),C*ee>g&&(g=C*ee)),g>v&&(v=g),o=r.indexOf(b,o+1);return c[f]=v,v}function pe(e){return e.toLowerCase().replace(ge," ")}function qe(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,ne(e,n,pe(e),pe(n),0,0,{})}var V='[cmdk-group=""]',re='[cmdk-group-items=""]',Pe='[cmdk-group-heading=""]',he='[cmdk-item=""]',ve=`${he}:not([aria-disabled="true"])`,le="cmdk-item-select",K="data-value",Ve=(e,n,r)=>qe(e,n,r),be=l.createContext(void 0),O=()=>l.useContext(be),xe=l.createContext(void 0),ae=()=>l.useContext(xe),ye=l.createContext(void 0),we=l.forwardRef((e,n)=>{let r=L(()=>{var t,i;return{search:"",value:(i=(t=e.value)!=null?t:e.defaultValue)!=null?i:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),m=L(()=>new Set),u=L(()=>new Map),d=L(()=>new Map),c=L(()=>new Set),f=ke(e),{label:b,children:o,value:v,onValueChange:g,filter:C,shouldFilter:w,loop:I,disablePointerSelection:H=!1,vimBindings:j=!0,...B}=e,T=q(),ue=q(),W=q(),M=l.useRef(null),x=Qe();D(()=>{if(v!==void 0){let t=v.trim();r.current.value=t,k.emit()}},[v]),D(()=>{x(6,ie)},[]);let k=l.useMemo(()=>({subscribe:t=>(c.current.add(t),()=>c.current.delete(t)),snapshot:()=>r.current,setState:(t,i,s)=>{var a,p,h,E;if(!Object.is(r.current[t],i)){if(r.current[t]=i,t==="search")X(),J(),x(1,Q);else if(t==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(W);y?y.focus():(a=document.getElementById(T))==null||a.focus()}if(x(7,()=>{var y;r.current.selectedItemId=(y=F())==null?void 0:y.id,k.emit()}),s||x(5,ie),((p=f.current)==null?void 0:p.value)!==void 0){let y=i??"";(E=(h=f.current).onValueChange)==null||E.call(h,y);return}}k.emit()}},emit:()=>{c.current.forEach(t=>t())}}),[]),_=l.useMemo(()=>({value:(t,i,s)=>{var a;i!==((a=d.current.get(t))==null?void 0:a.value)&&(d.current.set(t,{value:i,keywords:s}),r.current.filtered.items.set(t,oe(i,s)),x(2,()=>{J(),k.emit()}))},item:(t,i)=>(m.current.add(t),i&&(u.current.has(i)?u.current.get(i).add(t):u.current.set(i,new Set([t]))),x(3,()=>{X(),J(),r.current.value||Q(),k.emit()}),()=>{d.current.delete(t),m.current.delete(t),r.current.filtered.items.delete(t);let s=F();x(4,()=>{X(),(s==null?void 0:s.getAttribute("id"))===t&&Q(),k.emit()})}),group:t=>(u.current.has(t)||u.current.set(t,new Set),()=>{d.current.delete(t),u.current.delete(t)}),filter:()=>f.current.shouldFilter,label:b||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:T,inputId:W,labelId:ue,listInnerRef:M}),[]);function oe(t,i){var s,a;let p=(a=(s=f.current)==null?void 0:s.filter)!=null?a:Ve;return t?p(t,r.current.search,i):0}function J(){if(!r.current.search||f.current.shouldFilter===!1)return;let t=r.current.filtered.items,i=[];r.current.filtered.groups.forEach(a=>{let p=u.current.get(a),h=0;p.forEach(E=>{let y=t.get(E);h=Math.max(y,h)}),i.push([a,h])});let s=M.current;P().sort((a,p)=>{var h,E;let y=a.getAttribute("id"),G=p.getAttribute("id");return((h=t.get(G))!=null?h:0)-((E=t.get(y))!=null?E:0)}).forEach(a=>{let p=a.closest(re);p?p.appendChild(a.parentElement===p?a:a.closest(`${re} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${re} > *`))}),i.sort((a,p)=>p[1]-a[1]).forEach(a=>{var p;let h=(p=M.current)==null?void 0:p.querySelector(`${V}[${K}="${encodeURIComponent(a[0])}"]`);h==null||h.parentElement.appendChild(h)})}function Q(){let t=P().find(s=>s.getAttribute("aria-disabled")!=="true"),i=t==null?void 0:t.getAttribute(K);k.setState("value",i||void 0)}function X(){var t,i,s,a;if(!r.current.search||f.current.shouldFilter===!1){r.current.filtered.count=m.current.size;return}r.current.filtered.groups=new Set;let p=0;for(let h of m.current){let E=(i=(t=d.current.get(h))==null?void 0:t.value)!=null?i:"",y=(a=(s=d.current.get(h))==null?void 0:s.keywords)!=null?a:[],G=oe(E,y);r.current.filtered.items.set(h,G),G>0&&p++}for(let[h,E]of u.current)for(let y of E)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(h);break}r.current.filtered.count=p}function ie(){var t,i,s;let a=F();a&&(((t=a.parentElement)==null?void 0:t.firstChild)===a&&((s=(i=a.closest(V))==null?void 0:i.querySelector(Pe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function F(){var t;return(t=M.current)==null?void 0:t.querySelector(`${he}[aria-selected="true"]`)}function P(){var t;return Array.from(((t=M.current)==null?void 0:t.querySelectorAll(ve))||[])}function Y(t){let i=P()[t];i&&k.setState("value",i.getAttribute(K))}function Z(t){var i;let s=F(),a=P(),p=a.findIndex(E=>E===s),h=a[p+t];(i=f.current)!=null&&i.loop&&(h=p+t<0?a[a.length-1]:p+t===a.length?a[0]:a[p+t]),h&&k.setState("value",h.getAttribute(K))}function de(t){let i=F(),s=i==null?void 0:i.closest(V),a;for(;s&&!a;)s=t>0?_e(s,V):Je(s,V),a=s==null?void 0:s.querySelector(ve);a?k.setState("value",a.getAttribute(K)):Z(t)}let ce=()=>Y(P().length-1),se=t=>{t.preventDefault(),t.metaKey?ce():t.altKey?de(1):Z(1)},me=t=>{t.preventDefault(),t.metaKey?Y(0):t.altKey?de(-1):Z(-1)};return l.createElement(A.div,{ref:n,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:t=>{var i;(i=B.onKeyDown)==null||i.call(B,t);let s=t.nativeEvent.isComposing||t.keyCode===229;if(!(t.defaultPrevented||s))switch(t.key){case"n":case"j":{j&&t.ctrlKey&&se(t);break}case"ArrowDown":{se(t);break}case"p":case"k":{j&&t.ctrlKey&&me(t);break}case"ArrowUp":{me(t);break}case"Home":{t.preventDefault(),Y(0);break}case"End":{t.preventDefault(),ce();break}case"Enter":{t.preventDefault();let a=F();if(a){let p=new Event(le);a.dispatchEvent(p)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:Ye},b),U(e,t=>l.createElement(xe.Provider,{value:k},l.createElement(be.Provider,{value:_},t))))}),ze=l.forwardRef((e,n)=>{var r,m;let u=q(),d=l.useRef(null),c=l.useContext(ye),f=O(),b=ke(e),o=(m=(r=b.current)==null?void 0:r.forceMount)!=null?m:c==null?void 0:c.forceMount;D(()=>{if(!o)return f.item(u,c==null?void 0:c.id)},[o]);let v=Ee(u,d,[e.value,e.children,d],e.keywords),g=ae(),C=R(x=>x.value&&x.value===v.current),w=R(x=>o||f.filter()===!1?!0:x.search?x.filtered.items.get(u)>0:!0);l.useEffect(()=>{let x=d.current;if(!(!x||e.disabled))return x.addEventListener(le,I),()=>x.removeEventListener(le,I)},[w,e.onSelect,e.disabled]);function I(){var x,k;H(),(k=(x=b.current).onSelect)==null||k.call(x,v.current)}function H(){g.setState("value",v.current,!0)}if(!w)return null;let{disabled:j,value:B,onSelect:T,forceMount:ue,keywords:W,...M}=e;return l.createElement(A.div,{ref:z(d,n),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!C,"data-disabled":!!j,"data-selected":!!C,onPointerMove:j||f.getDisablePointerSelection()?void 0:H,onClick:j?void 0:I},e.children)}),Oe=l.forwardRef((e,n)=>{let{heading:r,children:m,forceMount:u,...d}=e,c=q(),f=l.useRef(null),b=l.useRef(null),o=q(),v=O(),g=R(w=>u||v.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);D(()=>v.group(c),[]),Ee(c,f,[e.value,e.heading,b]);let C=l.useMemo(()=>({id:c,forceMount:u}),[u]);return l.createElement(A.div,{ref:z(f,n),...d,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&l.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:o},r),U(e,w=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?o:void 0},l.createElement(ye.Provider,{value:C},w))))}),Be=l.forwardRef((e,n)=>{let{alwaysRender:r,...m}=e,u=l.useRef(null),d=R(c=>!c.search);return!r&&!d?null:l.createElement(A.div,{ref:z(u,n),...m,"cmdk-separator":"",role:"separator"})}),Ge=l.forwardRef((e,n)=>{let{onValueChange:r,...m}=e,u=e.value!=null,d=ae(),c=R(o=>o.search),f=R(o=>o.selectedItemId),b=O();return l.useEffect(()=>{e.value!=null&&d.setState("search",e.value)},[e.value]),l.createElement(A.input,{ref:n,...m,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":f,id:b.inputId,type:"text",value:u?e.value:c,onChange:o=>{u||d.setState("search",o.target.value),r==null||r(o.target.value)}})}),Ue=l.forwardRef((e,n)=>{let{children:r,label:m="Suggestions",...u}=e,d=l.useRef(null),c=l.useRef(null),f=R(o=>o.selectedItemId),b=O();return l.useEffect(()=>{if(c.current&&d.current){let o=c.current,v=d.current,g,C=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=o.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return C.observe(o),()=>{cancelAnimationFrame(g),C.unobserve(o)}}},[]),l.createElement(A.div,{ref:z(d,n),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":m,id:b.listId},U(e,o=>l.createElement("div",{ref:z(c,b.listInnerRef),"cmdk-list-sizer":""},o)))}),He=l.forwardRef((e,n)=>{let{open:r,onOpenChange:m,overlayClassName:u,contentClassName:d,container:c,...f}=e;return l.createElement(Ce,{open:r,onOpenChange:m},l.createElement(Se,{container:c},l.createElement(Ie,{"cmdk-overlay":"",className:u}),l.createElement(Re,{"aria-label":e.label,"cmdk-dialog":"",className:d},l.createElement(we,{ref:n,...f}))))}),Te=l.forwardRef((e,n)=>R(r=>r.filtered.count===0)?l.createElement(A.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),We=l.forwardRef((e,n)=>{let{progress:r,children:m,label:u="Loading...",...d}=e;return l.createElement(A.div,{ref:n,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(e,c=>l.createElement("div",{"aria-hidden":!0},c)))}),N=Object.assign(we,{List:Ue,Item:ze,Input:Ge,Group:Oe,Separator:Be,Dialog:He,Empty:Te,Loading:We});function _e(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function Je(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function ke(e){let n=l.useRef(e);return D(()=>{n.current=e}),n}var D=typeof window>"u"?l.useEffect:l.useLayoutEffect;function L(e){let n=l.useRef();return n.current===void 0&&(n.current=e()),n}function R(e){let n=ae(),r=()=>e(n.snapshot());return l.useSyncExternalStore(n.subscribe,r,r)}function Ee(e,n,r,m=[]){let u=l.useRef(),d=O();return D(()=>{var c;let f=(()=>{var o;for(let v of r){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(o=v.current.textContent)==null?void 0:o.trim():u.current}})(),b=m.map(o=>o.trim());d.value(e,f,b),(c=n.current)==null||c.setAttribute(K,f),u.current=f}),u}var Qe=()=>{let[e,n]=l.useState(),r=L(()=>new Map);return D(()=>{r.current.forEach(m=>m()),r.current=new Map},[e]),(m,u)=>{r.current.set(m,u),n({})}};function Xe(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function U({asChild:e,children:n},r){return e&&l.isValidElement(n)?l.cloneElement(Xe(n),{ref:n.ref},r(n.props.children)):r(n)}var Ye={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function et({className:e,...n}){return S.jsx(N,{"data-slot":"command",className:$("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...n})}function tt({className:e,leading:n,...r}){return S.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[S.jsx(Ae,{className:"size-4 shrink-0 opacity-50"}),n,S.jsx(N.Input,{"data-slot":"command-input",className:$("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function rt({className:e,...n}){return S.jsx(N.List,{"data-slot":"command-list",className:$("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function nt({...e}){return S.jsx(N.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function lt({className:e,...n}){return S.jsx(N.Group,{"data-slot":"command-group",className:$("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...n})}function at({className:e,...n}){return S.jsx(N.Separator,{"data-slot":"command-separator",className:$("bg-border -mx-1 h-px",e),...n})}function ut({className:e,...n}){return S.jsx(N.Item,{"data-slot":"command-item",className:$("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors duration-150 select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function ot({className:e,...n}){return S.jsx("span",{"data-slot":"command-shortcut",className:$("text-muted-foreground ml-auto text-xs tracking-widest",e),...n})}export{et as C,tt as a,rt as b,nt as c,lt as d,ut as e,ot as f,at as g};
1
+ import{r as l,dk as L,bw as A,dl as Ce,dm as Se,dn as Ie,dp as Re,dq as z,j as S,Q as $,dr as Ae}from"./index-DxTOTFWT.js";var fe=1,je=.9,Me=.8,De=.17,ee=.1,te=.999,$e=.9999,Ne=.99,Fe=/[\\\/_+.#"@\[\(\{&]/,Ke=/[\\\/_+.#"@\[\(\{&]/g,qe=/[\s-]/,ge=/[\s-]/g;function ne(e,n,r,m,u,d,c){if(d===n.length)return u===e.length?fe:Ne;var f=`${u},${d}`;if(c[f]!==void 0)return c[f];for(var b=m.charAt(d),o=r.indexOf(b,u),v=0,g,C,w,I;o>=0;)g=ne(e,n,r,m,o+1,d+1,c),g>v&&(o===u?g*=fe:Fe.test(e.charAt(o-1))?(g*=Me,w=e.slice(u,o-1).match(Ke),w&&u>0&&(g*=Math.pow(te,w.length))):qe.test(e.charAt(o-1))?(g*=je,I=e.slice(u,o-1).match(ge),I&&u>0&&(g*=Math.pow(te,I.length))):(g*=De,u>0&&(g*=Math.pow(te,o-u))),e.charAt(o)!==n.charAt(d)&&(g*=$e)),(g<ee&&r.charAt(o-1)===m.charAt(d+1)||m.charAt(d+1)===m.charAt(d)&&r.charAt(o-1)!==m.charAt(d))&&(C=ne(e,n,r,m,o+1,d+2,c),C*ee>g&&(g=C*ee)),g>v&&(v=g),o=r.indexOf(b,o+1);return c[f]=v,v}function pe(e){return e.toLowerCase().replace(ge," ")}function Le(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,ne(e,n,pe(e),pe(n),0,0,{})}var V='[cmdk-group=""]',re='[cmdk-group-items=""]',Pe='[cmdk-group-heading=""]',he='[cmdk-item=""]',ve=`${he}:not([aria-disabled="true"])`,le="cmdk-item-select",K="data-value",Ve=(e,n,r)=>Le(e,n,r),be=l.createContext(void 0),O=()=>l.useContext(be),xe=l.createContext(void 0),ae=()=>l.useContext(xe),ye=l.createContext(void 0),we=l.forwardRef((e,n)=>{let r=q(()=>{var t,i;return{search:"",value:(i=(t=e.value)!=null?t:e.defaultValue)!=null?i:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),m=q(()=>new Set),u=q(()=>new Map),d=q(()=>new Map),c=q(()=>new Set),f=ke(e),{label:b,children:o,value:v,onValueChange:g,filter:C,shouldFilter:w,loop:I,disablePointerSelection:H=!1,vimBindings:j=!0,...B}=e,T=L(),ue=L(),W=L(),M=l.useRef(null),x=Qe();D(()=>{if(v!==void 0){let t=v.trim();r.current.value=t,k.emit()}},[v]),D(()=>{x(6,ie)},[]);let k=l.useMemo(()=>({subscribe:t=>(c.current.add(t),()=>c.current.delete(t)),snapshot:()=>r.current,setState:(t,i,s)=>{var a,p,h,E;if(!Object.is(r.current[t],i)){if(r.current[t]=i,t==="search")X(),J(),x(1,Q);else if(t==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let y=document.getElementById(W);y?y.focus():(a=document.getElementById(T))==null||a.focus()}if(x(7,()=>{var y;r.current.selectedItemId=(y=F())==null?void 0:y.id,k.emit()}),s||x(5,ie),((p=f.current)==null?void 0:p.value)!==void 0){let y=i??"";(E=(h=f.current).onValueChange)==null||E.call(h,y);return}}k.emit()}},emit:()=>{c.current.forEach(t=>t())}}),[]),_=l.useMemo(()=>({value:(t,i,s)=>{var a;i!==((a=d.current.get(t))==null?void 0:a.value)&&(d.current.set(t,{value:i,keywords:s}),r.current.filtered.items.set(t,oe(i,s)),x(2,()=>{J(),k.emit()}))},item:(t,i)=>(m.current.add(t),i&&(u.current.has(i)?u.current.get(i).add(t):u.current.set(i,new Set([t]))),x(3,()=>{X(),J(),r.current.value||Q(),k.emit()}),()=>{d.current.delete(t),m.current.delete(t),r.current.filtered.items.delete(t);let s=F();x(4,()=>{X(),(s==null?void 0:s.getAttribute("id"))===t&&Q(),k.emit()})}),group:t=>(u.current.has(t)||u.current.set(t,new Set),()=>{d.current.delete(t),u.current.delete(t)}),filter:()=>f.current.shouldFilter,label:b||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:T,inputId:W,labelId:ue,listInnerRef:M}),[]);function oe(t,i){var s,a;let p=(a=(s=f.current)==null?void 0:s.filter)!=null?a:Ve;return t?p(t,r.current.search,i):0}function J(){if(!r.current.search||f.current.shouldFilter===!1)return;let t=r.current.filtered.items,i=[];r.current.filtered.groups.forEach(a=>{let p=u.current.get(a),h=0;p.forEach(E=>{let y=t.get(E);h=Math.max(y,h)}),i.push([a,h])});let s=M.current;P().sort((a,p)=>{var h,E;let y=a.getAttribute("id"),G=p.getAttribute("id");return((h=t.get(G))!=null?h:0)-((E=t.get(y))!=null?E:0)}).forEach(a=>{let p=a.closest(re);p?p.appendChild(a.parentElement===p?a:a.closest(`${re} > *`)):s.appendChild(a.parentElement===s?a:a.closest(`${re} > *`))}),i.sort((a,p)=>p[1]-a[1]).forEach(a=>{var p;let h=(p=M.current)==null?void 0:p.querySelector(`${V}[${K}="${encodeURIComponent(a[0])}"]`);h==null||h.parentElement.appendChild(h)})}function Q(){let t=P().find(s=>s.getAttribute("aria-disabled")!=="true"),i=t==null?void 0:t.getAttribute(K);k.setState("value",i||void 0)}function X(){var t,i,s,a;if(!r.current.search||f.current.shouldFilter===!1){r.current.filtered.count=m.current.size;return}r.current.filtered.groups=new Set;let p=0;for(let h of m.current){let E=(i=(t=d.current.get(h))==null?void 0:t.value)!=null?i:"",y=(a=(s=d.current.get(h))==null?void 0:s.keywords)!=null?a:[],G=oe(E,y);r.current.filtered.items.set(h,G),G>0&&p++}for(let[h,E]of u.current)for(let y of E)if(r.current.filtered.items.get(y)>0){r.current.filtered.groups.add(h);break}r.current.filtered.count=p}function ie(){var t,i,s;let a=F();a&&(((t=a.parentElement)==null?void 0:t.firstChild)===a&&((s=(i=a.closest(V))==null?void 0:i.querySelector(Pe))==null||s.scrollIntoView({block:"nearest"})),a.scrollIntoView({block:"nearest"}))}function F(){var t;return(t=M.current)==null?void 0:t.querySelector(`${he}[aria-selected="true"]`)}function P(){var t;return Array.from(((t=M.current)==null?void 0:t.querySelectorAll(ve))||[])}function Y(t){let i=P()[t];i&&k.setState("value",i.getAttribute(K))}function Z(t){var i;let s=F(),a=P(),p=a.findIndex(E=>E===s),h=a[p+t];(i=f.current)!=null&&i.loop&&(h=p+t<0?a[a.length-1]:p+t===a.length?a[0]:a[p+t]),h&&k.setState("value",h.getAttribute(K))}function de(t){let i=F(),s=i==null?void 0:i.closest(V),a;for(;s&&!a;)s=t>0?_e(s,V):Je(s,V),a=s==null?void 0:s.querySelector(ve);a?k.setState("value",a.getAttribute(K)):Z(t)}let ce=()=>Y(P().length-1),se=t=>{t.preventDefault(),t.metaKey?ce():t.altKey?de(1):Z(1)},me=t=>{t.preventDefault(),t.metaKey?Y(0):t.altKey?de(-1):Z(-1)};return l.createElement(A.div,{ref:n,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:t=>{var i;(i=B.onKeyDown)==null||i.call(B,t);let s=t.nativeEvent.isComposing||t.keyCode===229;if(!(t.defaultPrevented||s))switch(t.key){case"n":case"j":{j&&t.ctrlKey&&se(t);break}case"ArrowDown":{se(t);break}case"p":case"k":{j&&t.ctrlKey&&me(t);break}case"ArrowUp":{me(t);break}case"Home":{t.preventDefault(),Y(0);break}case"End":{t.preventDefault(),ce();break}case"Enter":{t.preventDefault();let a=F();if(a){let p=new Event(le);a.dispatchEvent(p)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:Ye},b),U(e,t=>l.createElement(xe.Provider,{value:k},l.createElement(be.Provider,{value:_},t))))}),ze=l.forwardRef((e,n)=>{var r,m;let u=L(),d=l.useRef(null),c=l.useContext(ye),f=O(),b=ke(e),o=(m=(r=b.current)==null?void 0:r.forceMount)!=null?m:c==null?void 0:c.forceMount;D(()=>{if(!o)return f.item(u,c==null?void 0:c.id)},[o]);let v=Ee(u,d,[e.value,e.children,d],e.keywords),g=ae(),C=R(x=>x.value&&x.value===v.current),w=R(x=>o||f.filter()===!1?!0:x.search?x.filtered.items.get(u)>0:!0);l.useEffect(()=>{let x=d.current;if(!(!x||e.disabled))return x.addEventListener(le,I),()=>x.removeEventListener(le,I)},[w,e.onSelect,e.disabled]);function I(){var x,k;H(),(k=(x=b.current).onSelect)==null||k.call(x,v.current)}function H(){g.setState("value",v.current,!0)}if(!w)return null;let{disabled:j,value:B,onSelect:T,forceMount:ue,keywords:W,...M}=e;return l.createElement(A.div,{ref:z(d,n),...M,id:u,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!C,"data-disabled":!!j,"data-selected":!!C,onPointerMove:j||f.getDisablePointerSelection()?void 0:H,onClick:j?void 0:I},e.children)}),Oe=l.forwardRef((e,n)=>{let{heading:r,children:m,forceMount:u,...d}=e,c=L(),f=l.useRef(null),b=l.useRef(null),o=L(),v=O(),g=R(w=>u||v.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);D(()=>v.group(c),[]),Ee(c,f,[e.value,e.heading,b]);let C=l.useMemo(()=>({id:c,forceMount:u}),[u]);return l.createElement(A.div,{ref:z(f,n),...d,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&l.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:o},r),U(e,w=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?o:void 0},l.createElement(ye.Provider,{value:C},w))))}),Be=l.forwardRef((e,n)=>{let{alwaysRender:r,...m}=e,u=l.useRef(null),d=R(c=>!c.search);return!r&&!d?null:l.createElement(A.div,{ref:z(u,n),...m,"cmdk-separator":"",role:"separator"})}),Ge=l.forwardRef((e,n)=>{let{onValueChange:r,...m}=e,u=e.value!=null,d=ae(),c=R(o=>o.search),f=R(o=>o.selectedItemId),b=O();return l.useEffect(()=>{e.value!=null&&d.setState("search",e.value)},[e.value]),l.createElement(A.input,{ref:n,...m,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":f,id:b.inputId,type:"text",value:u?e.value:c,onChange:o=>{u||d.setState("search",o.target.value),r==null||r(o.target.value)}})}),Ue=l.forwardRef((e,n)=>{let{children:r,label:m="Suggestions",...u}=e,d=l.useRef(null),c=l.useRef(null),f=R(o=>o.selectedItemId),b=O();return l.useEffect(()=>{if(c.current&&d.current){let o=c.current,v=d.current,g,C=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let w=o.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return C.observe(o),()=>{cancelAnimationFrame(g),C.unobserve(o)}}},[]),l.createElement(A.div,{ref:z(d,n),...u,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":m,id:b.listId},U(e,o=>l.createElement("div",{ref:z(c,b.listInnerRef),"cmdk-list-sizer":""},o)))}),He=l.forwardRef((e,n)=>{let{open:r,onOpenChange:m,overlayClassName:u,contentClassName:d,container:c,...f}=e;return l.createElement(Ce,{open:r,onOpenChange:m},l.createElement(Se,{container:c},l.createElement(Ie,{"cmdk-overlay":"",className:u}),l.createElement(Re,{"aria-label":e.label,"cmdk-dialog":"",className:d},l.createElement(we,{ref:n,...f}))))}),Te=l.forwardRef((e,n)=>R(r=>r.filtered.count===0)?l.createElement(A.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),We=l.forwardRef((e,n)=>{let{progress:r,children:m,label:u="Loading...",...d}=e;return l.createElement(A.div,{ref:n,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":u},U(e,c=>l.createElement("div",{"aria-hidden":!0},c)))}),N=Object.assign(we,{List:Ue,Item:ze,Input:Ge,Group:Oe,Separator:Be,Dialog:He,Empty:Te,Loading:We});function _e(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function Je(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function ke(e){let n=l.useRef(e);return D(()=>{n.current=e}),n}var D=typeof window>"u"?l.useEffect:l.useLayoutEffect;function q(e){let n=l.useRef();return n.current===void 0&&(n.current=e()),n}function R(e){let n=ae(),r=()=>e(n.snapshot());return l.useSyncExternalStore(n.subscribe,r,r)}function Ee(e,n,r,m=[]){let u=l.useRef(),d=O();return D(()=>{var c;let f=(()=>{var o;for(let v of r){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(o=v.current.textContent)==null?void 0:o.trim():u.current}})(),b=m.map(o=>o.trim());d.value(e,f,b),(c=n.current)==null||c.setAttribute(K,f),u.current=f}),u}var Qe=()=>{let[e,n]=l.useState(),r=q(()=>new Map);return D(()=>{r.current.forEach(m=>m()),r.current=new Map},[e]),(m,u)=>{r.current.set(m,u),n({})}};function Xe(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function U({asChild:e,children:n},r){return e&&l.isValidElement(n)?l.cloneElement(Xe(n),{ref:n.ref},r(n.props.children)):r(n)}var Ye={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function et({className:e,...n}){return S.jsx(N,{"data-slot":"command",className:$("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...n})}function tt({className:e,leading:n,...r}){return S.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[S.jsx(Ae,{className:"size-4 shrink-0 opacity-50"}),n,S.jsx(N.Input,{"data-slot":"command-input",className:$("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function rt({className:e,...n}){return S.jsx(N.List,{"data-slot":"command-list",className:$("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function nt({...e}){return S.jsx(N.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function lt({className:e,...n}){return S.jsx(N.Group,{"data-slot":"command-group",className:$("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...n})}function at({className:e,...n}){return S.jsx(N.Separator,{"data-slot":"command-separator",className:$("bg-border -mx-1 h-px",e),...n})}function ut({className:e,...n}){return S.jsx(N.Item,{"data-slot":"command-item",className:$("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors duration-150 select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function ot({className:e,...n}){return S.jsx("span",{"data-slot":"command-shortcut",className:$("text-muted-foreground ml-auto text-xs tracking-widest",e),...n})}export{et as C,tt as a,rt as b,nt as c,lt as d,ut as e,ot as f,at as g};
@@ -1,4 +1,4 @@
1
- import{a2 as e}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as e}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as e,B as c,x,Q as u,a1 as o}from"./index-CdKpQ1hI.js";const p=o("rounded-xl p-3",{variants:{tone:{muted:"bg-muted/50 text-muted-foreground",destructive:"bg-destructive/10 text-destructive"}},defaultVariants:{tone:"muted"}});function f({icon:n,headline:d,description:r,action:s,preview:t,tone:i,headingLevel:a,className:l}){const m=a?`h${a}`:"p";return e.jsxs("div",{"data-slot":"empty-state",className:u("flex flex-col items-center justify-center gap-3 p-12 text-center",l),children:[t&&e.jsx("div",{className:"pointer-events-none mb-4 w-full max-w-sm opacity-40 select-none",children:t}),e.jsx("div",{className:p({tone:i}),children:e.jsx(n,{className:"size-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{className:"text-sm font-medium",children:d}),e.jsx("p",{className:"text-muted-foreground max-w-[280px] text-xs",children:r})]}),s&&e.jsxs(c,{size:"sm",variant:s.variant,onClick:s.onClick,disabled:s.disabled||s.busy,className:"mt-1",children:[s.busy&&e.jsx(x,{size:"xs"}),s.label]})]})}export{f as E};
1
+ import{j as e,B as c,x,Q as u,a1 as o}from"./index-DxTOTFWT.js";const p=o("rounded-xl p-3",{variants:{tone:{muted:"bg-muted/50 text-muted-foreground",destructive:"bg-destructive/10 text-destructive"}},defaultVariants:{tone:"muted"}});function f({icon:n,headline:d,description:r,action:s,preview:t,tone:i,headingLevel:a,className:l}){const m=a?`h${a}`:"p";return e.jsxs("div",{"data-slot":"empty-state",className:u("flex flex-col items-center justify-center gap-3 p-12 text-center",l),children:[t&&e.jsx("div",{className:"pointer-events-none mb-4 w-full max-w-sm opacity-40 select-none",children:t}),e.jsx("div",{className:p({tone:i}),children:e.jsx(n,{className:"size-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{className:"text-sm font-medium",children:d}),e.jsx("p",{className:"text-muted-foreground max-w-[280px] text-xs",children:r})]}),s&&e.jsxs(c,{size:"sm",variant:s.variant,onClick:s.onClick,disabled:s.disabled||s.busy,className:"mt-1",children:[s.busy&&e.jsx(x,{size:"xs"}),s.label]})]})}export{f as E};
@@ -1 +1 @@
1
- import{af as v,ag as E}from"./index-CdKpQ1hI.js";const C={none:"None",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",max:"Max",xhigh:"Extra high"};function D(n){return n?C[n]:"Default"}function w(n){return n&&n.length>0?n.map(e=>e.value):void 0}function x(n,e){var o;const i=n.runtime??e.defaultRuntime;if(!e.runtimeDeclaresCredits(i))return!1;if(i!==m)return((o=e.runtimeDefaultsToCredits)==null?void 0:o.call(e,i))??!1;if(!e.credits)return!1;const a=n.account??null;return a===v?e.credits.allowedAgents.includes(n.id):a===null&&e.credits.isDefault}const m="claude-code";function R(n){const{agent:e,defaultRuntime:i,serverDefaultModel:a,knownRuntimes:o,knownModels:c,knownAccounts:r,accountsUnavailable:h,modelSupportsEffort:g,runtimeSupportsEffort:p,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,b=e.model??a??null,u=s===m&&h!==!0?e.account??null:null,d=u!==null?r==null?void 0:r.find(k=>k.id===u):void 0;return e.runtime!=null&&e.runtime!==i&&l.push({field:"runtime",label:f(e.runtime)}),e.model!=null&&l.push({field:"model",label:e.model}),e.effort!=null&&l.push({field:"effort",label:D(e.effort)}),u!==null&&l.push({field:"account",label:(d==null?void 0:d.label)??u}),o!==void 0&&!o.includes(s)?t.push({kind:"runtime-not-connected",message:`${f(s)} is not connected on this machine.`}):(e.model!=null&&c!==void 0&&!c.includes(e.model)&&t.push({kind:"model-unavailable",message:`${f(s)} no longer offers ${e.model}.`}),u!==null&&r!==void 0&&!d&&t.push({kind:"account-unregistered",message:`“${u}” isn’t on this computer. This agent runs on your default account.`})),e.effort!=null&&(p===!1?t.push({kind:"effort-unsupported-runtime",message:`${f(s)} has no effort setting. It’s ignored.`}):g===!1&&t.push({kind:"effort-unsupported-model",message:`${b??"This model"} does not take an effort setting.`})),{breakages:t,deviations:l,isException:t.length>0||l.length>0,isBroken:t.length>0}}export{x as a,R as d,D as e,w as k};
1
+ import{af as v,ag as E}from"./index-DxTOTFWT.js";const C={none:"None",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",max:"Max",xhigh:"Extra high"};function D(n){return n?C[n]:"Default"}function w(n){return n&&n.length>0?n.map(e=>e.value):void 0}function x(n,e){var o;const i=n.runtime??e.defaultRuntime;if(!e.runtimeDeclaresCredits(i))return!1;if(i!==m)return((o=e.runtimeDefaultsToCredits)==null?void 0:o.call(e,i))??!1;if(!e.credits)return!1;const a=n.account??null;return a===v?e.credits.allowedAgents.includes(n.id):a===null&&e.credits.isDefault}const m="claude-code";function R(n){const{agent:e,defaultRuntime:i,serverDefaultModel:a,knownRuntimes:o,knownModels:c,knownAccounts:r,accountsUnavailable:h,modelSupportsEffort:g,runtimeSupportsEffort:p,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,b=e.model??a??null,u=s===m&&h!==!0?e.account??null:null,d=u!==null?r==null?void 0:r.find(k=>k.id===u):void 0;return e.runtime!=null&&e.runtime!==i&&l.push({field:"runtime",label:f(e.runtime)}),e.model!=null&&l.push({field:"model",label:e.model}),e.effort!=null&&l.push({field:"effort",label:D(e.effort)}),u!==null&&l.push({field:"account",label:(d==null?void 0:d.label)??u}),o!==void 0&&!o.includes(s)?t.push({kind:"runtime-not-connected",message:`${f(s)} is not connected on this machine.`}):(e.model!=null&&c!==void 0&&!c.includes(e.model)&&t.push({kind:"model-unavailable",message:`${f(s)} no longer offers ${e.model}.`}),u!==null&&r!==void 0&&!d&&t.push({kind:"account-unregistered",message:`“${u}” isn’t on this computer. This agent runs on your default account.`})),e.effort!=null&&(p===!1?t.push({kind:"effort-unsupported-runtime",message:`${f(s)} has no effort setting. It’s ignored.`}):g===!1&&t.push({kind:"effort-unsupported-model",message:`${b??"This model"} does not take an effort setting.`})),{breakages:t,deviations:l,isException:t.length>0||l.length>0,isBroken:t.length>0}}export{x as a,R as d,D as e,w as k};
@@ -1,4 +1,4 @@
1
- import{a2 as e}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as e}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a2 as e}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as e}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a2 as a}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as a}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a2 as u,j as t,W as h,Q as y,fr as _,b0 as N}from"./index-CdKpQ1hI.js";import{u as b,p as j,W as k,a as v}from"./WidgetErrorCard-ChDNC060.js";import{C as E}from"./card-BqN3lfJn.js";/**
1
+ import{a2 as u,j as t,W as h,Q as y,ft as _,b0 as N}from"./index-DxTOTFWT.js";import{u as b,p as j,W as k,a as v}from"./WidgetErrorCard-CBFo1SMe.js";import{C as E}from"./card-DVdPY08b.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- var et=t=>{throw TypeError(t)};var tt=(t,n,e)=>n.has(t)||et("Cannot "+e);var y=(t,n,e)=>(tt(t,n,"read from private field"),e?e.call(t):n.get(t)),N=(t,n,e)=>n.has(t)?et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),k=(t,n,e,i)=>(tt(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e);var it=(t,n,e,i)=>({set _(r){k(t,n,r,e)},get _(){return y(t,n,i)}});import{r as C,j$ as St,j as p,k0 as pt,cZ as ce,c_ as he,I as yt,gD as fe,gU as me,gV as Vt,dW as At,dX as Et,dY as wt,dZ as It,d_ as Ct,a6 as Lt,g8 as Tt,e2 as xt,B as Dt}from"./index-CdKpQ1hI.js";function kt({update:t,notify:n,unwatched:e}){return{link:i,unlink:r,propagate:h,checkDirty:s,shallowPropagate:a};function i(l,d,o){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const m=f!==void 0?f.nextDep:d.deps;if(m!==void 0&&m.dep===l){m.version=o,d.depsTail=m;return}const c=l.subsTail;if(c!==void 0&&c.version===o&&c.sub===d)return;const g=d.depsTail=l.subsTail={version:o,dep:l,sub:d,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:d.deps=g,c!==void 0?c.nextSub=g:l.subs=g}function r(l,d=l.sub){const o=l.dep,f=l.prevDep,m=l.nextDep,c=l.nextSub,g=l.prevSub;return m!==void 0?m.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=m:d.deps=m,c!==void 0?c.prevSub=g:o.subsTail=g,g!==void 0?g.nextSub=c:(o.subs=c)===void 0&&e(o),m}function h(l){let d=l.nextSub,o;e:do{const f=l.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&u(l,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&n(f),m&1){const c=f.subs;if(c!==void 0){const g=(l=c).nextSub;g!==void 0&&(o={value:d,prev:o},d=g);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;o!==void 0;)if(l=o.value,o=o.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let o,f=0,m=!1;e:do{const c=l.dep,g=c.flags;if(d.flags&16)m=!0;else if((g&17)===17){if(t(c)){const v=c.subs;v.nextSub!==void 0&&a(v),m=!0}}else if((g&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(o={value:l,prev:o}),l=c.deps,d=c,++f;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;f--;){const v=d.subs,S=v.nextSub!==void 0;if(S?(l=o.value,o=o.prev):l=v,m){if(t(d)){S&&a(v),d=l.sub;continue}m=!1}else d.flags&=-33;d=l.sub;const F=l.nextDep;if(F!==void 0){l=F;continue e}}return m}while(!0)}function a(l){do{const d=l.sub,o=d.flags;(o&48)===32&&(d.flags=o|16,(o&6)===2&&n(d))}while((l=l.nextSub)!==void 0)}function u(l,d){let o=d.depsTail;for(;o!==void 0;){if(o===l)return!0;o=o.prevDep}return!1}}function Ye(t,n,e){var h,s,a;const i=typeof t=="object",r=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(r),error:(s=i?t.error:n)==null?void 0:s.bind(r),complete:(a=i?t.complete:e)==null?void 0:a.bind(r)}}const qe=[];let xe=0;const{link:st,unlink:Bt,propagate:jt,checkDirty:ft,shallowPropagate:rt}=kt({update(t){return t._update()},notify(t){qe[He++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,je(t))}});let Ce=0,He=0,z,Xe=0;function _(t){try{++Xe,t()}finally{--Xe||mt()}}function je(t){const n=t.depsTail;let e=n!==void 0?n.nextDep:t.deps;for(;e!==void 0;)e=Bt(e,t)}function mt(){if(!(Xe>0)){for(;Ce<He;){const t=qe[Ce];qe[Ce++]=void 0,t.notify()}Ce=0,He=0}}function gt(t,n){const e=typeof t=="function",i=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?0:1,get(){return z!==void 0&&st(r,z,xe),r._snapshot},subscribe(h){const s=Ye(h),a={current:!1},u=Pt(()=>{var l;r.get(),a.current?(l=s.next)==null||l.call(s,r._snapshot):a.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=r,++xe,r.depsTail=void 0;else if(h===void 0)return!1;e&&(r.flags=5);try{const u=r._snapshot,l=typeof h=="function"?h(u):h===void 0&&e?i(u):h;return u===void 0||!a(u,l)?(r._snapshot=l,!0):!1}finally{z=s,e&&(r.flags&=-5),je(r)}}};return e?(r.flags=17,r.get=function(){const h=r.flags;if(h&16||h&32&&ft(r.deps,r)){if(r._update()){const s=r.subs;s!==void 0&&rt(s)}}else h&32&&(r.flags=h&-33);return z!==void 0&&st(r,z,xe),r._snapshot}):r.set=function(h){if(r._update(h)){const s=r.subs;s!==void 0&&(jt(s),rt(s),mt())}},r}function Pt(t){const n=()=>{const i=z;z=e,++xe,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,je(e)}},e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const i=this.flags;i&16||i&32&&ft(this.deps,this)?n():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,je(this)}};return n(),e}var _t=class{constructor(t,n){this.atom=gt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}},Rt=class{constructor(t){this.atom=gt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}};function ie(t,n){return typeof t=="function"?new Rt(t):new _t(t)}var Nt=class{constructor(t,n){this.fn=t,this.options=n,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{const i=Date.now()-this.lastExecutionTime;if(this.options.leading&&i>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){const r=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},r)}},this.execute=(...e)=>{var i,r;this.fn(...e),(r=(i=this.options).onExecute)==null||r.call(i,e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Ot(t,n){return new Nt(t,n).maybeExecute}var ee,U,G,Ee,H,re,X,le,we,Re,te,ue,Z,Ie,de,Ne;class Gt{constructor({pluginId:n,debug:e=!1,enabled:i=!0,reconnectEveryMs:r=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,Ee);N(this,H);N(this,re);N(this,X);N(this,le);N(this,we,0);N(this,Re,5);N(this,te,!1);N(this,ue,!1);N(this,Z,null);N(this,Ie,()=>{this.debugLog("Connected to event bus"),k(this,re,!0),k(this,te,!1),this.debugLog("Emitting queued events",y(this,H)),y(this,H).forEach(n=>this.emitEventToBus(n)),k(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ie))});N(this,de,()=>{if(y(this,we)<y(this,Re)){it(this,we)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,de)),k(this,ue,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Ne,()=>{y(this,te)||(k(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ie)),y(this,de).call(this))});k(this,U,n),k(this,ee,i),k(this,G,this.getGlobalTarget),k(this,Ee,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),k(this,H,[]),k(this,re,!1),k(this,ue,!1),k(this,X,null),k(this,le,r)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,le)}ms)`),k(this,X,setInterval(y(this,de),y(this,le))))}stopConnectLoop(){k(this,te,!1),y(this,X)!==null&&(clearInterval(y(this,X)),k(this,X,null),k(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...n){y(this,Ee)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...n)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const n=typeof EventTarget<"u"?new EventTarget:void 0;return typeof n>"u"||typeof n.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),n)}getPluginId(){return y(this,U)}dispatchCustomEventShim(n,e){try{const i=new Event(n,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(n,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(n,{detail:e}))}catch{this.dispatchCustomEventShim(n,e)}}emitEventToBus(n){this.debugLog("Emitting event to client bus",n),this.dispatchCustomEvent("tanstack-dispatch-event",n)}createEventPayload(n,e){return{type:`${y(this,U)}:${n}`,payload:e,pluginId:y(this,U)}}emit(n,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",n,e);return}if(y(this,Z)&&(this.debugLog("Emitting event to internal event target",n,e),y(this,Z).dispatchEvent(new CustomEvent(`${y(this,U)}:${n}`,{detail:this.createEventPayload(n,e)}))),y(this,ue)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!y(this,re)){this.debugLog("Bus not available, will be pushed as soon as connected"),y(this,H).push(this.createEventPayload(n,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Ne).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(n,e))}on(n,e,i){const r=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${n}`;if(r&&(y(this,Z)||k(this,Z,new EventTarget),y(this,Z).addEventListener(h,a=>{e(a.detail)})),!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event",h),()=>{};const s=a=>{this.debugLog("Received event from bus",a.detail),e(a.detail)};return y(this,G).call(this).addEventListener(h,s),this.debugLog("Registered event to bus",h),()=>{var a;r&&((a=y(this,Z))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;y(this,U)&&r.pluginId!==y(this,U)||n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}}ee=new WeakMap,U=new WeakMap,G=new WeakMap,Ee=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,le=new WeakMap,we=new WeakMap,Re=new WeakMap,te=new WeakMap,ue=new WeakMap,Z=new WeakMap,Ie=new WeakMap,de=new WeakMap,Ne=new WeakMap;class $t extends Gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new $t;function ge(t,n){return typeof t=="function"?t(n):t}function oe(t,n){return Oe(n).reduce((i,r)=>{if(i===null)return null;if(typeof i<"u")return i[r]},t)}function be(t,n,e){const i=Oe(n);function r(h){if(!i.length)return ge(e,h);const s=i.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(h))return typeof h=="object"?(h===null&&(h={}),{...h,[s]:r(h[s])}):{[s]:r()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),r(h[s]),...h.slice(s+1)]}return[...new Array(s),r()]}return r(t)}function Wt(t,n){const e=Oe(n);function i(r){if(!r)return;if(e.length===1){const s=e[0];if(Array.isArray(r)&&typeof s=="number")return r.filter((l,d)=>d!==s);const{[s]:a,...u}=r;return u}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[h]:i(r[h])};if(typeof h=="number"&&Array.isArray(r)){if(h>=r.length)return r;const s=r.slice(0,h);return[...s.length?s:new Array(h),i(r[h]),...r.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const nt=46,Ge=91,$e=93,at=48,Ut=57;function Oe(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const n=t.length,e=[];let i=n>0&&t.charCodeAt(0)===Ge?1:0,r=!0,h=-1;for(let s=i;s<=n;s++){const a=s<n?t.charCodeAt(s):-1;if(s===n||a===nt||a===Ge||a===$e){const u=s-i;if(u>0){const l=r&&(u===1||t.charCodeAt(i)!==at),d=t.slice(i,s);if(l){const o=parseInt(d,10);u<=15||String(o)===d?e.push(o):e.push(d)}else e.push(d)}else h!==$e&&!(h===-1&&a===$e)&&!(h===a&&(a===nt||a===Ge))&&e.push("");i=s+1,r=!0}else(a<at||a>Ut)&&(r=!1);h=a}return e.length||e.push(""),e}function ot(t,n){return t.length===0?n:n.length===0?t:n.startsWith("[")||n.startsWith(".")?t+n:`${t}.${n}`}function Kt(t){return!(Array.isArray(t)&&t.length===0)}function pe(t,n){const e=i=>i.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!1},runValidation:e})}function ye(t,n){const{asyncDebounceMs:e}=n,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:h}=n.validators||{},s=e??0,a=u=>u.validators.filter(Boolean).map(l=>{const d=(l==null?void 0:l.cause)||t;let o=s;switch(d){case"change":o=r??s;break;case"blur":o=i??s;break;case"dynamic":o=h??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:l.fn,debounceMs:o}});return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!0},runValidation:a})}const De=t=>!!t&&typeof t=="object"&&"fields"in t;function Y(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Date&&n instanceof Date)return t.getTime()===n.getTime();if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[r,h]of t)if(!n.has(r)||!Object.is(h,n.get(r)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(n)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(n)!==Object.prototype))return!1;for(const r of e)if(!i.includes(r)||!Y(t[r],n[r]))return!1;return!0}const Ze=({newFormValidatorError:t,isPreviousErrorFromFormValidator:n,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:t,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,n){return t==null?n:{...t,...n}}let se=256;const ke=[];let Le;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function vt(){let t=0,n,e="";if(!Le||se+16>256){for(Le=new Array(256),t=256;t--;)Le[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)n=Le[se+t],t===6?e+=ke[n&15|64]:t===8?e+=ke[n&63|128]:e+=ke[n],t&1&&t>1&&t<11&&(e+="-");return se++,e}const zt=Ot(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function Se(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e[i]=Se(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,r)=>{e.set(r,Se(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(Se(i))}),e}const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Se(t[e]));return n}function ne(t,n){return n===t||n.startsWith(`${t}.`)||n.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const n=t.event.async,e=n?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:n?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},r={fn:n?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:n?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=n?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[e],form:t.form});case"submit":return t.runValidation({validators:[i,r,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[r,s],form:t.form});case"change":return t.runValidation({validators:[i,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function qt(t,n){const e=new Map;for(const i of t){const r=i.path??[];let h=n,s="";for(let a=0;a<r.length;a++){const u=r[a];if(u===void 0)continue;const l=typeof u=="object"?u.key:u,d=Number(l);Array.isArray(h)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(a>0?".":"")+String(l),typeof h=="object"&&h!==null?h=h[l]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const lt=(t,n)=>{const e=qt(t,n);return{form:e,fields:e}},ae={validate({value:t,validationSource:n},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return n==="field"?i.issues:lt(i.issues,t)},async validateAsync({value:t,validationSource:n},e){const i=await e["~standard"].validate(t);if(i.issues)return n==="field"?i.issues:lt(i.issues,t)}},Je=t=>!!t&&"~standard"in t,O={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Q(t){function n(o){const f=t.getFieldMeta(o)??O;t.setFieldMeta(o,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(o,f,m){n(o);const c=a(o,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(o,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(o,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);l(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(o,m))).forEach(F=>{const M=F.replace(s(o,m),s(o,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(o,f){n(o);const m=a(o,f,"remove");l(m,"up")}function r(o,f,m){n(o),a(o,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(o,f)))return;const v=g.toString().replace(s(o,f),s(o,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(o,f){n(o);const m=a(o,f,"insert");l(m,"down"),m.forEach(c=>{c.toString().startsWith(s(o,f))&&t.setFieldMeta(c,d())})}function s(o,f){return`${o}[${f}]`}function a(o,f,m,c){const g=[s(o,f)];switch(m){case"swap":g.push(s(o,c));break;case"move":{const[v,S]=[Math.min(f,c),Math.max(f,c)];for(let F=v;F<=S;F++)g.push(s(o,F));break}default:{const v=t.getFieldValue(o),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(o,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function u(o,f){return o.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function l(o,f){(f==="up"?o:[...o].reverse()).forEach(c=>{const g=u(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,d())})}const d=()=>O;return{bumpArrayVersion:n,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:h}}function We(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ut{constructor(n){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{zt(this)}),a=K.on("request-form-state",c=>{c.payload.id===this._formId&&K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),u=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),l=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),d=()=>{l(),u(),a(),s.unsubscribe(),K.emit("form-unmounted",{id:this._formId})};(m=(f=this.options.listeners)==null?void 0:f.onMount)==null||m.call(f,{formApi:this});const{onMount:o}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),d},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const u=s.defaultValues&&!Y(s.defaultValues,a.defaultValues)&&!this.state.isTouched,l=!Y(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!u&&!l)){if(_(()=>{this.baseStore.setState(()=>We(Object.assign({},this.state,l?s.defaultState:{},u?{values:s.defaultValues}:{})))}),u){const d=Q(this);for(const o of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(o))&&d.bumpArrayVersion(o)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:u}=this.state,l=this.resetFieldMeta(u);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var o;let d=s??this.options.defaultValues??((o=this.options.defaultState)==null?void 0:o.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(d=be(d,f.instance.name,f.instance.options.defaultValue))}),We({...this.options.defaultState,values:d,fieldMetaBase:l})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(l=>{if(!l.instance)return;const d=l.instance;a.push(Promise.resolve().then(()=>d.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),l.instance.store.state.meta.isTouched||l.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null,o=[`${s}[${a}]`];for(let g=a+1;g<=(d??0);g++)o.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>o.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,u)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var l,d;const u=(l=this.fieldInfo[s])==null?void 0:l.instance;if(!u){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?((d=this.getFieldMeta(s))==null?void 0:d.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return u.store.state.meta.isTouched||u.setMeta(o=>({...o,isTouched:!0})),u.validate(a)},this.validateSync=(s,a)=>{const u=pe(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let l=!1;const d={};return _(()=>{var m,c,g;for(const v of u){if(!v.validate)continue;const S=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:F,fieldErrors:M}=Be(S),V=Fe(v.cause);let w=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(M||{})]);a!=null&&a.filterFieldNames&&(w=new Set([...w].filter(a.filterFieldNames)));for(const b of w){if(this.baseStore.state.fieldMetaBase[b]===void 0&&!(M!=null&&M[b]))continue;const L=this.getFieldMeta(b)??O,{errorMap:E,errorSourceMap:A}=L,D=M==null?void 0:M[b],{newErrorValue:j,newSource:T}=Ze({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(d[b]={...d[b],[V]:D}),(E==null?void 0:E[V])!==j&&this.setFieldMeta(b,(I=O)=>({...I,errorMap:{...I.errorMap,[V]:j},errorSourceMap:{...I.errorSourceMap,[V]:T}}))}a!=null&&a.dontUpdateFormErrorMap||((m=this.state.errorMap)==null?void 0:m[V])!==F&&this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[V]:F}})),(F||M)&&(l=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const o=Fe("submit");(c=this.state.errorMap)!=null&&c[o]&&s!=="submit"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}));const f=Fe("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:l,fieldsErrorMap:d}},this.validateAsync=async(s,a)=>{const u=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});this.state.isFormValidating||this.baseStore.setState(m=>({...m,isFormValidating:!0}));const l=[];let d;for(const m of u){if(!m.validate)continue;const c=Fe(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},l.push(new Promise(async S=>{let F;try{F=await new Promise((E,A)=>{setTimeout(async()=>{if(v.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:m.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(D){A(D)}},m.debounceMs)})}catch(E){F=E}const{formError:M,fieldErrors:V}=Be(F);V&&(d=d?{...d,...V}:V);const w=Fe(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(d||{})]);let L=Array.from(b);a!=null&&a.filterFieldNames&&(L=L.filter(a.filterFieldNames));for(const E of L){if(this.baseStore.state.fieldMetaBase[E]===void 0&&!(d!=null&&d[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=d==null?void 0:d[E],{newErrorValue:I,newSource:P}=Ze({newFormValidatorError:T,isPreviousErrorFromFormValidator:(j==null?void 0:j[w])==="form",previousErrorValue:D==null?void 0:D[w]});(D==null?void 0:D[w])!==I&&this.setFieldMeta(E,(R=O)=>({...R,errorMap:{...R.errorMap,[w]:I},errorSourceMap:{...R.errorSourceMap,[w]:P}}))}a!=null&&a.dontUpdateFormErrorMap||this.baseStore.setState(E=>({...E,errorMap:{...E.errorMap,[w]:M}})),S(d?{fieldErrors:d,errorMapKey:w}:void 0)}))}let o=[];const f={};if(l.length){o=await Promise.all(l);for(const m of o)if(m!=null&&m.fieldErrors){const{errorMapKey:c}=m;for(const[g,v]of Object.entries(m.fieldErrors)){const F={...f[g]||{},[c]:v};f[g]=F}}}return this.baseStore.setState(m=>({...m,isFormValidating:!1})),f},this.validate=(s,a)=>{const{hasErrored:u,fieldsErrorMap:l}=this.validateSync(s,a);return u&&!this.options.asyncAlways?l:this.validateAsync(s,a)},this._handleSubmit=async s=>{var l,d,o,f,m,c,g,v,S,F;this.baseStore.setState(M=>({...M,isSubmitted:!1,submissionAttempts:M.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.fieldInfo).forEach(M=>{M.instance&&(M.instance.store.state.meta.isTouched||M.instance.setMeta(V=>({...V,isTouched:!0})))})});const a=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){(d=(l=this.options).onSubmitInvalid)==null||d.call(l,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const u=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){u(),(f=(o=this.options).onSubmitInvalid)==null||f.call(o,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(M=>M.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){u(),(c=(m=this.options).onSubmitInvalid)==null||c.call(m,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}_(()=>{Object.values(this.fieldInfo).forEach(M=>{var V;(V=M.instance)==null||V.triggerOnSubmitListener()})}),(v=(g=this.options.listeners)==null?void 0:g.onSubmit)==null||v.call(g,{formApi:this,meta:a});try{await((F=(S=this.options).onSubmit)==null?void 0:F.call(S,{value:this.state.values,formApi:this,meta:a})),_(()=>{this.baseStore.setState(M=>({...M,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),u()})}catch(M){throw this.baseStore.setState(V=>({...V,isSubmitSuccessful:!1})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:M}),u(),M}},this.getFieldValue=s=>oe(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFormGroupMeta=s=>this.formGroupMetaDerived.state[s],this.getFieldInfo=s=>{var a;return(a=this.fieldInfo)[s]||(a[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,a)=>{this.baseStore.setState(u=>({...u,fieldMetaBase:{...u.fieldMetaBase,[s]:ge(a,u.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,u)=>{const l=u;return a[l]=O,a},{}),this.setFieldValue=(s,a,u)=>{var f;const l=(u==null?void 0:u.dontUpdateMeta)??!1,d=(u==null?void 0:u.dontRunListeners)??!1,o=(u==null?void 0:u.dontValidate)??!1;_(()=>{l||this.setFieldMeta(s,m=>({...m,isTouched:!0,isDirty:!0,errorMap:{...m==null?void 0:m.errorMap,onMount:void 0}})),this.baseStore.setState(m=>({...m,values:be(m.values,s,a)}))}),d||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const u=[...Object.keys(this.fieldInfo).filter(l=>{const d=s.toString();return l.startsWith(`${d}.`)||l.startsWith(`${d}[`)}),s];this.baseStore.setState(l=>{const d={...l};return u.forEach(o=>{d.values=Wt(d.values,o),delete this.fieldInfo[o],delete d.fieldMetaBase[o]}),d})},this.pushFieldValue=(s,a,u)=>{this.setFieldValue(s,l=>[...Array.isArray(l)?l:[],a],u),Q(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>[...o.slice(0,a),u,...o.slice(a)],$(l,{dontValidate:!0}));const d=(l==null?void 0:l.dontValidate)??!1;d||await this.validateField(s,"change"),Q(this).handleArrayInsert(s,a),d||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>o.map((f,m)=>m===a?u:f),$(l,{dontValidate:!0})),Q(this).bumpArrayVersion(s),((l==null?void 0:l.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(u,{dontValidate:!0})),Q(this).handleArrayRemove(s,a),d!==null){const f=`${s}[${d}]`;this.deleteField(f)}((u==null?void 0:u.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=o[a],m=o[u];return be(be(o,`${a}`,m),`${u}`,f)},$(l,{dontValidate:!0})),Q(this).handleArraySwap(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.moveFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=[...o];return f.splice(u,0,f.splice(a,1)[0]),f},$(l,{dontValidate:!0})),Q(this).handleArrayMove(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.clearFieldValues=(s,a)=>{const u=this.getFieldValue(s),l=Array.isArray(u)?Math.max(u.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Q(this).bumpArrayVersion(s),l!==null)for(let o=0;o<=l;o++){const f=`${s}[${o}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var o;const u=(o=this.getFieldInfo(s).instance)==null?void 0:o.options.defaultValue,l=oe(this.options.defaultValues,s),d=u??l;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:d!==void 0?be(a.values,s,d):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,u])=>{const l=a;if(De(u)){const{formError:d,fieldErrors:o}=Be(u);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[l]:o==null?void 0:o[f]},errorSourceMap:{...c.errorSourceMap,[l]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[l]:d}}))}else this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[l]:u}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,u])=>(Object.keys(u).length&&u.errors.length&&(s[a]={errors:u.errors,errorMap:u.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(n==null?void 0:n.formId)??vt(),this._devtoolsSubmissionOverride=!1;let e=We({...n==null?void 0:n.defaultState,values:(n==null?void 0:n.defaultValues)??((h=n==null?void 0:n.defaultState)==null?void 0:h.values)});if(n!=null&&n.transform){e=n.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!De(a)))for(const u of Object.keys(a.fields)){const l=a.fields[u];if(l===void 0)continue;const d=e.fieldMetaBase[u];e.fieldMetaBase[u]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...d??{},errorSourceMap:{...(d==null?void 0:d.errorSourceMap)??{},onChange:"form"},errorMap:{...(d==null?void 0:d.errorMap)??{},[s]:l}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var d,o,f;const a=this.baseStore.get();let u=0;const l={};for(const m of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[m],g=i==null?void 0:i.fieldMetaBase[m],v=s==null?void 0:s[m],S=oe(a.values,m);let F=v==null?void 0:v.errors;if(!g||c.errorMap!==g.errorMap){F=Object.values(c.errorMap??{}).filter(L=>L!==void 0);const b=(d=this.getFieldInfo(m))==null?void 0:d.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!Kt(F),V=!c.isDirty,w=Y(S,((f=(o=this.getFieldInfo(m))==null?void 0:o.instance)==null?void 0:f.options.defaultValue)??oe(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){l[m]=v,u++;continue}l[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&u===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),l):l}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l={};for(const d of this.formGroupApis){const o=d.name,f=a.formGroupStateBase[o]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=u[o];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in u){if(W===o||!ne(o,W))continue;const B=u[W];B&&(B.isValidating&&(c=!0),B.isValid||(g=!1),B.isTouched&&(v=!0),B.isBlurred&&(S=!0),B.isDefaultValue||(F=!1),B.isDirty&&(M=!0))}const V=!M,w=!!c||f.isValidating,b=(m==null?void 0:m.errorMap)??{},L=(m==null?void 0:m.errorSourceMap)??{},E=!!(b.onMount||Object.entries(u).some(([W,B])=>B&&W!==o&&ne(o,W)&&B.errorMap.onMount)),A=s==null?void 0:s[o];let D=(A==null?void 0:A.errors)??[];(!A||A.__srcErrorMap!==b)&&(D=Object.values(b).reduce((W,B)=>{if(B===void 0)return W;if(B&&typeof B=="object"&&"fields"in B){const Qe=B.group;return Qe!==void 0&&W.push(Qe),W}return W.push(B),W},[]));const j=D.length===0,T=g&&j,I=d.options.canSubmitWhenInvalid??!1,P=f.submissionAttempts===0&&!v&&!E||!w&&!f.isSubmitting&&T||I;if(A&&A.errorMap===b&&A.errorSourceMap===L&&A.errors===D&&A.isFieldsValidating===c&&A.isFieldsValid===g&&A.isGroupValid===j&&A.isValid===T&&A.canSubmit===P&&A.isTouched===v&&A.isBlurred===S&&A.isPristine===V&&A.isDefaultValue===F&&A.isDirty===M&&A.isValidating===w&&A.isSubmitting===f.isSubmitting&&A.isSubmitted===f.isSubmitted&&A.submissionAttempts===f.submissionAttempts&&A.isSubmitSuccessful===f.isSubmitSuccessful){l[o]=A;continue}const R={...f,errorMap:b,errorSourceMap:L,_arrayVersion:(m==null?void 0:m._arrayVersion)??0,isTouched:v,isBlurred:S,isDirty:M,isPristine:V,isDefaultValue:F,isValid:T,errors:D,isValidating:w,isFieldsValidating:c,isFieldsValid:g,isGroupValid:j,canSubmit:P};Object.defineProperty(R,"__srcErrorMap",{value:b,enumerable:!1,configurable:!0}),l[o]=R}return l});let r;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l=Object.values(u).filter(Boolean),d=l.some(I=>I.isValidating),o=l.every(I=>I.isValid),f=l.some(I=>I.isTouched),m=l.some(I=>I.isBlurred),c=l.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=l.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||l.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!d;let V=(s==null?void 0:s.errors)??[];(!r||a.errorMap!==r.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&De(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=o&&w,L=this.options.canSubmitWhenInvalid??!1,E=a.submissionAttempts===0&&!f&&!F||!M&&!a.isSubmitting&&b||L;let A=a.errorMap;if(g&&(V=V.filter(I=>I!==a.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),s&&r&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===d&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&Y(r,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:d,isFieldsValid:o,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return r=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Be(t){if(t){if(De(t)){const n=Be(t.form).formError,e=t.fields;return{formError:n,fieldErrors:e}}return{formError:t}}return{formError:void 0}}function Fe(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ve{constructor(n){this.options={},this.mount=()=>{var r,h;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const e=this.getInfo();e.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const s=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(a=>({...a,errorMap:{...a==null?void 0:a.errorMap,onMount:s},errorSourceMap:{...a==null?void 0:a.errorSourceMap,onMount:"field"}}))}return(h=(r=this.options.listeners)==null?void 0:r.onMount)==null||h.call(r,{value:this.state.value,fieldApi:this}),()=>{var a,u,l,d;for(const[o,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var f,m,c;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...O,isTouched:((f=o.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=o.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=o.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(u=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||u.call(a,{value:this.state.value,fieldApi:this}),(d=(l=this.form.options.listeners)==null?void 0:l.onFieldUnmount)==null||d.call(l,{formApi:this.form,fieldApi:this})}}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,i)=>{this.form.pushFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,i,r)=>{this.form.insertFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,r)=>{this.form.replaceFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,i)=>{this.form.removeFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,i,r)=>{this.form.swapFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,r)=>{this.form.moveFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,$(e,{dontRunListeners:!0})),e!=null&&e.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const i=Object.values(this.form.fieldInfo),r=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ve))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&r.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&r.push(h.instance)}return r},this.validateSync=(e,i)=>{var l;const r=pe(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((d,o)=>{const f=pe(e,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||q});return f.forEach(m=>{m.field=o}),d.concat(f)},[]);let a=!1;_(()=>{const d=(o,f)=>{var F;const m=Me(f.cause),c=f.validate?dt(o.runValidator({validate:f.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=Pe({formLevelError:g,fieldLevelError:c});((F=o.state.meta.errorMap)==null?void 0:F[m])!==v&&o.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const o of r)d(this,o);for(const o of s)o.validate&&d(o.field,o)});const u=Me("submit");return(l=this.state.meta.errorMap)!=null&&l[u]&&e!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[u]:void 0},errorSourceMap:{...d.errorSourceMap,[u]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const r=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),h=await i,a=this.getLinkedFields(e).reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,fieldName:g.name,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),u=[],l=[],d=r.some(c=>c.validate),o=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{d&&this.startValidation();for(const c of o)c.startValidation()});const f=(c,g,v)=>{const S=Me(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V},v.push(new Promise(async w=>{var j;let b;try{b=await new Promise((T,I)=>{c.timeoutIds.validations[g.cause]&&(clearTimeout(c.timeoutIds.validations[g.cause]),c.endValidation()),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return T(void 0);try{T(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,fieldApi:c,signal:V.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){I(P)}},g.debounceMs)})}catch(T){b=T}if(V.signal.aborted)return w(void 0);const L=dt(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=Pe({formLevelError:E,fieldLevelError:L});if(c.getInfo().instance!==c)return w(void 0);c.setMeta(T=>({...T,errorMap:{...T==null?void 0:T.errorMap,[S]:A},errorSourceMap:{...T.errorSourceMap,[S]:D}})),w(A)}))};for(const c of r)c.validate&&f(this,c,u);for(const c of a)c.validate&&f(c.field,c,l);let m=[];return(u.length||l.length)&&(m=await Promise.all(u),await Promise.all(l)),_(()=>{d&&this.endValidation();for(const c of o)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const r=i!=null&&i.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(c=>this.name.startsWith(c.name));let s=(i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!(i!=null&&i.skipFormValidation))for(const c of r){if(c.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:g}=this.form.validateSync(e,{group:c,dontUpdateFormErrorMap:!0,filterFieldNames:v=>ne(c.name,v)});s={...s,...g[this.name]??{}}}const{hasErrored:a}=this.validateSync(e,s),u=new WeakMap;for(const c of r){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});u.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Me(e)])==null||f.lastAbortController.abort();const c=[];for(const g of r)(m=g.getInfo().validationMetaMap[Me(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const l=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),d=this.validateAsync(e,l),o=[];for(const c of r)u.get(c)&&!c.options.asyncAlways||o.push(c.validateAsync(e,l,{skipRelatedFieldValidation:!0}));return o.length===0?d:Promise.all([d,...o]).then(c=>c.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(i=>({...i,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(i=>({...i,errorMap:{...i.errorMap,...e}}))},this.parseValueWithSchema=e=>ae.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>ae.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnBlurListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onBlur)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChange)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this});for(const d of this.form.formGroupApis)ne(d.name,this.name)&&d.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,fieldApi:this})},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...n.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}})}get state(){return this.store.state}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}startValidation(){this.setMeta(n=>{const e=n._pendingValidationsCount+1;return{...n,_pendingValidationsCount:e,isValidating:e>0&&!n.isValidating?!0:n.isValidating}})}endValidation(){this.setMeta(n=>{const e=Math.max(0,n._pendingValidationsCount-1);return{...n,_pendingValidationsCount:e,isValidating:e===0&&n.isValidating?!1:n.isValidating}})}}function dt(t){if(t)return t}function Me(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Ue(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Ht(t){return{...O,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}class Ae{constructor(n){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const r=i.formGroupStateBase[this.name]??Ue({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(r)}}})},this._lastDistributedFieldNames={},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...O,...this.options.defaultMeta})},this.mount=()=>{var i,r;this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(h=>({...h,formGroupStateBase:{...h.formGroupStateBase,[this.name]:h.formGroupStateBase[this.name]??Ue({...this.options.defaultState})}}));const{onMount:e}=this.options.validators||{};if(e){const h=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let s=h,a;ze(h)&&(s=h.group,a=h.fields);const u=Ke(s);u&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,onMount:u},errorSourceMap:{...l.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(r=(i=this.options.listeners)==null?void 0:i.onMount)==null||r.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,u]of Object.entries(this.timeoutIds.validations))u&&(clearTimeout(u),this.timeoutIds.validations[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.listeners))u&&(clearTimeout(u),this.timeoutIds.listeners[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.formListeners))u&&(clearTimeout(u),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,u]of Object.entries(this.fieldInfo.validationMetaMap))u==null||u.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ue({})}})),this.fieldInfo.instance=null,(s=(h=this.options.listeners)==null?void 0:h.onUnmount)==null||s.call(h,{value:this.state.value,groupApi:this})}}},this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const e=Object.values(this.form.fieldInfo),i=[];for(const r of e)r.instance&&r.instance instanceof Ve&&r.instance.name.startsWith(this.name)&&i.push(r.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[r,h]of e)r!==this.name&&ne(this.name,r)&&i.push({...h,name:r});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const r=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[u,l]of Object.entries(i))l==null||l===!1||h.add(this.buildChildFieldName(u));const s=new Set([...r,...h]);let a=!1;for(const u of s){const l=u.startsWith(this.name+"[")?u.slice(this.name.length):u.slice(this.name.length+1),d=i==null?void 0:i[l],o=this.form.getFieldMeta(u);if(!o&&!d)continue;const f=o==null?void 0:o.errorMap[e],m=(o==null?void 0:o.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Ze({newFormValidatorError:d,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(o==null?void 0:o.errorSourceMap[e])===g)&&this.form.setFieldMeta(u,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,r={})=>{var d;const h=pe(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((o,f)=>{const m=pe(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),o.concat(m)},[]);let u=!1;_(()=>{const o=(f,m)=>{var L;const c=Te(m.cause),g=f===this;let v;m.validate&&(v=f.runValidator({validate:m.validate,value:{value:f.store.state.value,validationSource:g?"form":"field",...f instanceof Ae?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&ze(v)&&(S=v.group,F=v.fields);const M=Ke(S),V=i[c],{newErrorValue:w,newSource:b}=Pe({formLevelError:V,fieldLevelError:M});((L=f.state.meta.errorMap)==null?void 0:L[c])!==w&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[c]:w},errorSourceMap:{...E.errorSourceMap,[c]:b}})),w&&(u=!0),g&&this.distributeFieldErrors(c,F)&&(u=!0)};for(const f of h)o(this,f);for(const f of a)f.validate&&o(f.field,f)});const l=Te("submit");return(d=this.state.meta.errorMap)!=null&&d[l]&&e!=="submit"&&!u&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,[l]:void 0},errorSourceMap:{...o.errorSourceMap,[l]:void 0}})),{hasErrored:u}},this.validateAsync=async(e,i,r={})=>{const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),u=a.reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),l=[],d=[],o=h.some(c=>c.validate)||u.some(c=>c.validate);if(o){this.state.meta.isValidating||this.setMeta(c=>({...c,isValidating:!0}));for(const c of a)c.setMeta(g=>({...g,isValidating:!0}))}const f=(c,g,v)=>{const S=Te(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V};const w=c===this;v.push(new Promise(async b=>{var P;let L;try{L=await new Promise((R,W)=>{c.timeoutIds.validations[g.cause]&&clearTimeout(c.timeoutIds.validations[g.cause]),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,signal:V.signal,validationSource:w?"form":"field",...c instanceof Ae?{groupApi:c}:{fieldApi:c}},type:"validateAsync"}))}catch(B){W(B)}},g.debounceMs)})}catch(R){L=R}if(V.signal.aborted)return b(void 0);let E=L,A;w&&ze(L)&&(E=L.group,A=L.fields);const D=Ke(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=Pe({formLevelError:j,fieldLevelError:D});if(c.getInfo().instance!==c)return b(void 0);c.setMeta(R=>({...R,errorMap:{...R==null?void 0:R.errorMap,[S]:T},errorSourceMap:{...R.errorSourceMap,[S]:I}})),w&&this.distributeFieldErrors(S,A),b(T)}))};for(const c of h)c.validate&&f(this,c,l);for(const c of u)c.validate&&f(c.field,c,d);let m=[];if((l.length||d.length)&&(m=await Promise.all(l),await Promise.all(d)),o){this.setMeta(c=>({...c,isValidating:!1}));for(const c of a)c.setMeta(g=>({...g,isValidating:!1}))}return m.filter(Boolean)},this.validateAllFields=async e=>{const i=[];return _(()=>{Object.values(this.getRelatedFields()).forEach(h=>{i.push(Promise.resolve().then(()=>h.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),h.store.state.meta.isTouched||h.setMeta(s=>({...s,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=(e,i,r)=>this.form.validateArrayFieldsStartingFrom(e,i,r),this.validateField=(e,i)=>this.form.validateField(e,i),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(e,i),this.setFieldValue=(e,i)=>this.form.setFieldValue(e,i),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,i)=>this.form.pushFieldValue(e,i),this.insertFieldValue=(e,i,r)=>this.form.insertFieldValue(e,i,r),this.replaceFieldValue=(e,i,r)=>this.form.replaceFieldValue(e,i,r),this.swapFieldValues=(e,i,r)=>this.form.swapFieldValues(e,i,r),this.moveFieldValues=(e,i,r)=>this.form.moveFieldValues(e,i,r),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,i)=>this.form.removeFieldValue(e,i),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,i)=>{var a;const{fieldsErrorMap:r}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)}),{hasErrored:h}=this.validateSync(e,r[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[Te(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChangeGroup)==null||o.call(d,{formApi:this.form,groupApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChangeGroup)==null||s.call(h,{formApi:this.form,groupApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,groupApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{var h,s,a,u,l,d,o,f;this.setFormGroupState(m=>({...m,isSubmitted:!1,submissionAttempts:m.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{m.state.meta.isTouched||m.setMeta(c=>({...c,isTouched:!0}))})});const i=e??this.options.onSubmitMeta;this.setFormGroupState(m=>({...m,isSubmitting:!0}));const r=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){r(),(s=(h=this.options).onGroupSubmitInvalid)==null||s.call(h,{value:this.state.value,groupApi:this,meta:i});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){r(),(u=(a=this.options).onGroupSubmitInvalid)==null||u.call(a,{value:this.state.value,groupApi:this,meta:i});return}_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{var c,g;(g=(c=m.options.listeners)==null?void 0:c.onGroupSubmit)==null||g.call(c,{value:m.state.value,fieldApi:m})})}),(d=(l=this.options.listeners)==null?void 0:l.onSubmit)==null||d.call(l,{groupApi:this,value:this.state.value});try{await((f=(o=this.options).onGroupSubmit)==null?void 0:f.call(o,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),r(),m}},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=ie(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const i=this.form.getFormGroupMeta(this.name)??Ht(n.defaultMeta);let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(n){if(Je(n.validate)){const e=ae[n.type](n.value,n.validate);return n.type==="validate"?ct(e):e.then(ct)}return n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Ke(t){if(t)return t}function ze(t){return!!t&&typeof t=="object"&&"fields"in t}function ct(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:n,fields:e,...i}=t;return{...i,group:n,fields:e}}function Te(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class _e{constructor(n){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return ot(this.fieldsMap,e);const i=Oe(e)[0];if(typeof i!="string")return"";const r=e.slice(i.length),h=this.fieldsMap[i];return ot(h,r)},this.getFormFieldOptions=e=>{const i={...e},r=i.validators;if(i.name=this.getFormFieldName(e.name),r&&(r.onChangeListenTo||r.onBlurListenTo)){const h={...r},s=a=>{if(a)return a.map(u=>this.getFormFieldName(u))};h.onChangeListenTo=s(r.onChangeListenTo),h.onBlurListenTo=s(r.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,r),this.validateField=(e,i)=>this.form.validateField(this.getFormFieldName(e),i),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(this.getFormFieldName(e),i),this.setFieldValue=(e,i,r)=>this.form.setFieldValue(this.getFormFieldName(e),i,r),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,r)=>this.form.pushFieldValue(this.getFormFieldName(e),i,r),this.insertFieldValue=async(e,i,r,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,r,h),this.replaceFieldValue=async(e,i,r,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,r,h),this.removeFieldValue=async(e,i,r)=>this.form.removeFieldValue(this.getFormFieldName(e),i,r),this.swapFieldValues=(e,i,r,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,r,h),this.moveFieldValues=(e,i,r,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,r,h),this.clearFieldValues=(e,i)=>this.form.clearFieldValues(this.getFormFieldName(e),i),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),n.form instanceof _e){const e=n.form;if(this.form=e.form,typeof n.fields=="string")this.fieldsMap=e.getFormFieldName(n.fields);else{const i={...n.fields};for(const r in i)i[r]=e.getFormFieldName(i[r]);this.fieldsMap=i}}else this.form=n.form,this.fieldsMap=n.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=oe(e.values,this.fieldsMap);else{i={};const r=this.fieldsMap;for(const h in r)i[h]=oe(e.values,r[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}function Xt(t,n){if(!n)return;const e=Object.assign({},t,{state:Se(t.state)});n(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((h,s)=>(t.state[s]!==e.state[s]&&(h[s]=e.state[s]),h),{});return _(()=>{Object.keys(r).length&&t.baseStore.setState(h=>({...h,...r})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Zt(t,n){return t===n}function x(t,n=i=>i,e){const i=(e==null?void 0:e.compare)??Zt,r=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return St.useSyncExternalStoreWithSelector(r,h,h,n,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Yt(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ve({...t}));let h=i;(n.form!==t.form||n.name!==t.name)&&(h=new Ve({...t}),r(h),e({form:t.form,name:t.name}));const s=x(h.store,t.mode==="array"?c=>c.meta._arrayVersion||0:c=>c.value),a=x(h.store,c=>c.meta.isTouched),u=x(h.store,c=>c.meta.isBlurred),l=x(h.store,c=>c.meta.isDirty),d=x(h.store,c=>c.meta.errorMap),o=x(h.store,c=>c.meta.errorSourceMap),f=x(h.store,c=>c.meta.isValidating),m=C.useMemo(()=>({...h,get state(){return{value:t.mode==="array"?h.state.value:s,get meta(){return{...h.state.meta,isTouched:a,isBlurred:u,isDirty:l,errorMap:d,errorSourceMap:o,isValidating:f}}}}}),[h,t.mode,s,a,u,l,d,o,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const Jt=(({children:t,...n})=>{const e=Yt(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function Qt(){return C.useState(()=>vt())[0]}const ei=pt,ti=C.version.split(".")[0]==="17"?Qt:ei.useId;function ii(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ae({...t}));(n.form!==t.form||n.name!==t.name)&&(r(new Ae({...t})),e({form:t.form,name:t.name}));const h=x(i.store,b=>b.value),s=x(i.store,b=>b.meta.isTouched),a=x(i.store,b=>b.meta.isBlurred),u=x(i.store,b=>b.meta.isDirty),l=x(i.store,b=>b.meta.errorMap),d=x(i.store,b=>b.meta.errorSourceMap),o=x(i.store,b=>b.meta.isValidating),f=x(i.store,b=>b.meta.isSubmitting),m=x(i.store,b=>b.meta.isSubmitted),c=x(i.store,b=>b.meta.submissionAttempts),g=x(i.store,b=>b.meta.isSubmitSuccessful),v=x(i.store,b=>b.meta.canSubmit),S=x(i.store,b=>b.meta.isValid),F=x(i.store,b=>b.meta.isFieldsValid),M=x(i.store,b=>b.meta.isFieldsValidating),V=x(i.store,b=>b.meta.isGroupValid),w=C.useMemo(()=>({...i,handleSubmit:((...E)=>i._handleSubmit(...E)),get state(){return{...i.state,value:h,get meta(){return{...i.state.meta,isTouched:s,isBlurred:a,isDirty:u,errorMap:l,errorSourceMap:d,isValidating:o,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,u,l,d,o,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const si=(({children:t,...n})=>{const e=ii(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ri({form:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function ni(t){const n=ti(),[e,i]=C.useState(t==null?void 0:t.formId),[r,h]=C.useState(()=>new ut({...t,formId:(t==null?void 0:t.formId)??n}));if(e!==(t==null?void 0:t.formId)){const u=(t==null?void 0:t.formId)??n;h(new ut({...t,formId:u})),i(u)}const s=C.useMemo(()=>{const u={...r,handleSubmit:((...l)=>r._handleSubmit(...l)),get formId(){return r._formId},get state(){return r.store.state}};return u.Field=function(d){return p.jsx(Jt,{...d,form:r})},u.FormGroup=function(d){return p.jsx(si,{...d,form:r})},u.Subscribe=function(d){return p.jsx(ri,{form:r,selector:d.selector,children:d.children})},u},[r]);J(r.mount,[]),J(()=>{r.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Xt(r,t.transform)},[r,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function ai({lens:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function oi(t){const[n]=C.useState(()=>{const e=new _e(t),i=t.form instanceof _e?t.form.form:t.form,r=e;return r.AppForm=function(s){return p.jsx(i.AppForm,{...s})},r.AppField=function(s){return p.jsx(i.AppField,{...n.getFormFieldOptions(s)})},r.Field=function(s){return p.jsx(i.Field,{...n.getFormFieldOptions(s)})},r.Subscribe=function(s){return p.jsx(ai,{lens:n,selector:s.selector,children:s.children})},Object.assign(r,{...t.formComponents})});return J(n.mount,[n]),n}const ht=C.createContext(null),bt=C.createContext(null);function Ft(){const t=C.useContext(bt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function li(){function t(){const n=C.useContext(ht);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}return{fieldContext:ht,useFieldContext:t,useFormContext:Ft,formContext:bt}}function Mt({fieldComponents:t,fieldContext:n,formContext:e,formComponents:i}){function r(l){const d=ni(l),o=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:d,children:c}),[d]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(d.Field,{...v,children:S=>p.jsx(n.Provider,{value:S,children:g(Object.assign(S,t))})})),[d]);return C.useMemo(()=>Object.assign(d,{AppField:f,AppForm:o,...i}),[d,f,o])}function h({render:l,props:d}){return function(f){return l({...d,...f})}}function s({render:l,props:d,defaultValues:o}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:o,formComponents:i}),[m.form,m.fields]),g=oi(c);return l({...d,...m,group:g})}}function a(l){return Ft()}function u(l){return Mt({fieldContext:n,formContext:e,fieldComponents:{...t,...l.fieldComponents},formComponents:{...i,...l.formComponents}})}return{useAppForm:r,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:u}}const{fieldContext:ui,formContext:di,useFieldContext:ve,useFormContext:ci}=li();function hi({label:t,placeholder:n,type:e="text",description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(yt,{id:r.name,type:e,value:r.state.value,placeholder:n,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function fi({label:t,placeholder:n,description:e,rows:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(Vt,{id:r.name,value:r.state.value,placeholder:n,rows:i,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:a})]})}function mi({label:t,options:n,placeholder:e,description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsxs(At,{value:r.state.value,onValueChange:u=>r.handleChange(u),onOpenChange:u=>{u||r.handleBlur()},children:[p.jsx(Et,{id:r.name,children:p.jsx(wt,{placeholder:e})}),p.jsx(It,{children:n.map(u=>p.jsx(Ct,{value:u.value,children:u.label},u.value))})]}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function gi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(he,{htmlFor:e.name,children:t}),p.jsx(Lt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s)}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function vi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(Tt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s===!0)}),p.jsx(he,{htmlFor:e.name,children:t}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function bi({label:t,placeholder:n,description:e}){const i=ve(),{isTouched:r,errors:h}=i.state.meta,s=r?h.map(a=>({message:String(a)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:i.name,children:t}),p.jsx(xt,{id:i.name,value:i.state.value,placeholder:n,onBlur:i.handleBlur,onChange:a=>i.handleChange(a.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:s})]})}function Fi({label:t,pendingLabel:n="Saving…"}){const e=ci();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:r})=>p.jsx(Dt,{type:"submit",disabled:!i||r,children:r?n:t})})}const{useAppForm:pi}=Mt({fieldContext:ui,formContext:di,fieldComponents:{TextField:hi,TextareaField:fi,SelectField:mi,SwitchField:gi,CheckboxField:vi,PasswordField:bi},formComponents:{SubmitButton:Fi}});export{x as a,pi as u};
1
+ var et=t=>{throw TypeError(t)};var tt=(t,n,e)=>n.has(t)||et("Cannot "+e);var y=(t,n,e)=>(tt(t,n,"read from private field"),e?e.call(t):n.get(t)),N=(t,n,e)=>n.has(t)?et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),k=(t,n,e,i)=>(tt(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e);var it=(t,n,e,i)=>({set _(r){k(t,n,r,e)},get _(){return y(t,n,i)}});import{r as C,k2 as St,j as p,k3 as pt,c$ as ce,d0 as he,I as yt,gF as fe,gZ as me,g_ as Vt,dY as At,dZ as Et,d_ as wt,d$ as It,e0 as Ct,a6 as Lt,ga as Tt,e4 as xt,B as Dt}from"./index-DxTOTFWT.js";function kt({update:t,notify:n,unwatched:e}){return{link:i,unlink:r,propagate:h,checkDirty:s,shallowPropagate:a};function i(l,d,o){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const m=f!==void 0?f.nextDep:d.deps;if(m!==void 0&&m.dep===l){m.version=o,d.depsTail=m;return}const c=l.subsTail;if(c!==void 0&&c.version===o&&c.sub===d)return;const g=d.depsTail=l.subsTail={version:o,dep:l,sub:d,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:d.deps=g,c!==void 0?c.nextSub=g:l.subs=g}function r(l,d=l.sub){const o=l.dep,f=l.prevDep,m=l.nextDep,c=l.nextSub,g=l.prevSub;return m!==void 0?m.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=m:d.deps=m,c!==void 0?c.prevSub=g:o.subsTail=g,g!==void 0?g.nextSub=c:(o.subs=c)===void 0&&e(o),m}function h(l){let d=l.nextSub,o;e:do{const f=l.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&u(l,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&n(f),m&1){const c=f.subs;if(c!==void 0){const g=(l=c).nextSub;g!==void 0&&(o={value:d,prev:o},d=g);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;o!==void 0;)if(l=o.value,o=o.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let o,f=0,m=!1;e:do{const c=l.dep,g=c.flags;if(d.flags&16)m=!0;else if((g&17)===17){if(t(c)){const v=c.subs;v.nextSub!==void 0&&a(v),m=!0}}else if((g&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(o={value:l,prev:o}),l=c.deps,d=c,++f;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;f--;){const v=d.subs,S=v.nextSub!==void 0;if(S?(l=o.value,o=o.prev):l=v,m){if(t(d)){S&&a(v),d=l.sub;continue}m=!1}else d.flags&=-33;d=l.sub;const F=l.nextDep;if(F!==void 0){l=F;continue e}}return m}while(!0)}function a(l){do{const d=l.sub,o=d.flags;(o&48)===32&&(d.flags=o|16,(o&6)===2&&n(d))}while((l=l.nextSub)!==void 0)}function u(l,d){let o=d.depsTail;for(;o!==void 0;){if(o===l)return!0;o=o.prevDep}return!1}}function Ye(t,n,e){var h,s,a;const i=typeof t=="object",r=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(r),error:(s=i?t.error:n)==null?void 0:s.bind(r),complete:(a=i?t.complete:e)==null?void 0:a.bind(r)}}const qe=[];let xe=0;const{link:st,unlink:Bt,propagate:jt,checkDirty:ft,shallowPropagate:rt}=kt({update(t){return t._update()},notify(t){qe[He++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,je(t))}});let Ce=0,He=0,z,Ze=0;function _(t){try{++Ze,t()}finally{--Ze||mt()}}function je(t){const n=t.depsTail;let e=n!==void 0?n.nextDep:t.deps;for(;e!==void 0;)e=Bt(e,t)}function mt(){if(!(Ze>0)){for(;Ce<He;){const t=qe[Ce];qe[Ce++]=void 0,t.notify()}Ce=0,He=0}}function gt(t,n){const e=typeof t=="function",i=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?0:1,get(){return z!==void 0&&st(r,z,xe),r._snapshot},subscribe(h){const s=Ye(h),a={current:!1},u=Pt(()=>{var l;r.get(),a.current?(l=s.next)==null||l.call(s,r._snapshot):a.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=r,++xe,r.depsTail=void 0;else if(h===void 0)return!1;e&&(r.flags=5);try{const u=r._snapshot,l=typeof h=="function"?h(u):h===void 0&&e?i(u):h;return u===void 0||!a(u,l)?(r._snapshot=l,!0):!1}finally{z=s,e&&(r.flags&=-5),je(r)}}};return e?(r.flags=17,r.get=function(){const h=r.flags;if(h&16||h&32&&ft(r.deps,r)){if(r._update()){const s=r.subs;s!==void 0&&rt(s)}}else h&32&&(r.flags=h&-33);return z!==void 0&&st(r,z,xe),r._snapshot}):r.set=function(h){if(r._update(h)){const s=r.subs;s!==void 0&&(jt(s),rt(s),mt())}},r}function Pt(t){const n=()=>{const i=z;z=e,++xe,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,je(e)}},e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const i=this.flags;i&16||i&32&&ft(this.deps,this)?n():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,je(this)}};return n(),e}var _t=class{constructor(t,n){this.atom=gt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}},Rt=class{constructor(t){this.atom=gt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}};function ie(t,n){return typeof t=="function"?new Rt(t):new _t(t)}var Nt=class{constructor(t,n){this.fn=t,this.options=n,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{const i=Date.now()-this.lastExecutionTime;if(this.options.leading&&i>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){const r=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},r)}},this.execute=(...e)=>{var i,r;this.fn(...e),(r=(i=this.options).onExecute)==null||r.call(i,e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Ot(t,n){return new Nt(t,n).maybeExecute}var ee,U,G,Ee,H,re,Z,le,we,Re,te,ue,X,Ie,de,Ne;class Gt{constructor({pluginId:n,debug:e=!1,enabled:i=!0,reconnectEveryMs:r=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,Ee);N(this,H);N(this,re);N(this,Z);N(this,le);N(this,we,0);N(this,Re,5);N(this,te,!1);N(this,ue,!1);N(this,X,null);N(this,Ie,()=>{this.debugLog("Connected to event bus"),k(this,re,!0),k(this,te,!1),this.debugLog("Emitting queued events",y(this,H)),y(this,H).forEach(n=>this.emitEventToBus(n)),k(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ie))});N(this,de,()=>{if(y(this,we)<y(this,Re)){it(this,we)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,de)),k(this,ue,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Ne,()=>{y(this,te)||(k(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ie)),y(this,de).call(this))});k(this,U,n),k(this,ee,i),k(this,G,this.getGlobalTarget),k(this,Ee,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),k(this,H,[]),k(this,re,!1),k(this,ue,!1),k(this,Z,null),k(this,le,r)}startConnectLoop(){y(this,Z)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,le)}ms)`),k(this,Z,setInterval(y(this,de),y(this,le))))}stopConnectLoop(){k(this,te,!1),y(this,Z)!==null&&(clearInterval(y(this,Z)),k(this,Z,null),k(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...n){y(this,Ee)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...n)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const n=typeof EventTarget<"u"?new EventTarget:void 0;return typeof n>"u"||typeof n.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),n)}getPluginId(){return y(this,U)}dispatchCustomEventShim(n,e){try{const i=new Event(n,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(n,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(n,{detail:e}))}catch{this.dispatchCustomEventShim(n,e)}}emitEventToBus(n){this.debugLog("Emitting event to client bus",n),this.dispatchCustomEvent("tanstack-dispatch-event",n)}createEventPayload(n,e){return{type:`${y(this,U)}:${n}`,payload:e,pluginId:y(this,U)}}emit(n,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",n,e);return}if(y(this,X)&&(this.debugLog("Emitting event to internal event target",n,e),y(this,X).dispatchEvent(new CustomEvent(`${y(this,U)}:${n}`,{detail:this.createEventPayload(n,e)}))),y(this,ue)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!y(this,re)){this.debugLog("Bus not available, will be pushed as soon as connected"),y(this,H).push(this.createEventPayload(n,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Ne).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(n,e))}on(n,e,i){const r=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${n}`;if(r&&(y(this,X)||k(this,X,new EventTarget),y(this,X).addEventListener(h,a=>{e(a.detail)})),!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event",h),()=>{};const s=a=>{this.debugLog("Received event from bus",a.detail),e(a.detail)};return y(this,G).call(this).addEventListener(h,s),this.debugLog("Registered event to bus",h),()=>{var a;r&&((a=y(this,X))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;y(this,U)&&r.pluginId!==y(this,U)||n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}}ee=new WeakMap,U=new WeakMap,G=new WeakMap,Ee=new WeakMap,H=new WeakMap,re=new WeakMap,Z=new WeakMap,le=new WeakMap,we=new WeakMap,Re=new WeakMap,te=new WeakMap,ue=new WeakMap,X=new WeakMap,Ie=new WeakMap,de=new WeakMap,Ne=new WeakMap;class $t extends Gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new $t;function ge(t,n){return typeof t=="function"?t(n):t}function oe(t,n){return Oe(n).reduce((i,r)=>{if(i===null)return null;if(typeof i<"u")return i[r]},t)}function be(t,n,e){const i=Oe(n);function r(h){if(!i.length)return ge(e,h);const s=i.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(h))return typeof h=="object"?(h===null&&(h={}),{...h,[s]:r(h[s])}):{[s]:r()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),r(h[s]),...h.slice(s+1)]}return[...new Array(s),r()]}return r(t)}function Wt(t,n){const e=Oe(n);function i(r){if(!r)return;if(e.length===1){const s=e[0];if(Array.isArray(r)&&typeof s=="number")return r.filter((l,d)=>d!==s);const{[s]:a,...u}=r;return u}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[h]:i(r[h])};if(typeof h=="number"&&Array.isArray(r)){if(h>=r.length)return r;const s=r.slice(0,h);return[...s.length?s:new Array(h),i(r[h]),...r.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const nt=46,Ge=91,$e=93,at=48,Ut=57;function Oe(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const n=t.length,e=[];let i=n>0&&t.charCodeAt(0)===Ge?1:0,r=!0,h=-1;for(let s=i;s<=n;s++){const a=s<n?t.charCodeAt(s):-1;if(s===n||a===nt||a===Ge||a===$e){const u=s-i;if(u>0){const l=r&&(u===1||t.charCodeAt(i)!==at),d=t.slice(i,s);if(l){const o=parseInt(d,10);u<=15||String(o)===d?e.push(o):e.push(d)}else e.push(d)}else h!==$e&&!(h===-1&&a===$e)&&!(h===a&&(a===nt||a===Ge))&&e.push("");i=s+1,r=!0}else(a<at||a>Ut)&&(r=!1);h=a}return e.length||e.push(""),e}function ot(t,n){return t.length===0?n:n.length===0?t:n.startsWith("[")||n.startsWith(".")?t+n:`${t}.${n}`}function Kt(t){return!(Array.isArray(t)&&t.length===0)}function pe(t,n){const e=i=>i.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!1},runValidation:e})}function ye(t,n){const{asyncDebounceMs:e}=n,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:h}=n.validators||{},s=e??0,a=u=>u.validators.filter(Boolean).map(l=>{const d=(l==null?void 0:l.cause)||t;let o=s;switch(d){case"change":o=r??s;break;case"blur":o=i??s;break;case"dynamic":o=h??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:l.fn,debounceMs:o}});return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!0},runValidation:a})}const De=t=>!!t&&typeof t=="object"&&"fields"in t;function Y(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Date&&n instanceof Date)return t.getTime()===n.getTime();if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[r,h]of t)if(!n.has(r)||!Object.is(h,n.get(r)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(n)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(n)!==Object.prototype))return!1;for(const r of e)if(!i.includes(r)||!Y(t[r],n[r]))return!1;return!0}const Xe=({newFormValidatorError:t,isPreviousErrorFromFormValidator:n,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:t,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,n){return t==null?n:{...t,...n}}let se=256;const ke=[];let Le;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function vt(){let t=0,n,e="";if(!Le||se+16>256){for(Le=new Array(256),t=256;t--;)Le[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)n=Le[se+t],t===6?e+=ke[n&15|64]:t===8?e+=ke[n&63|128]:e+=ke[n],t&1&&t>1&&t<11&&(e+="-");return se++,e}const zt=Ot(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function Se(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e[i]=Se(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,r)=>{e.set(r,Se(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(Se(i))}),e}const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Se(t[e]));return n}function ne(t,n){return n===t||n.startsWith(`${t}.`)||n.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const n=t.event.async,e=n?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:n?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},r={fn:n?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:n?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=n?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[e],form:t.form});case"submit":return t.runValidation({validators:[i,r,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[r,s],form:t.form});case"change":return t.runValidation({validators:[i,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function qt(t,n){const e=new Map;for(const i of t){const r=i.path??[];let h=n,s="";for(let a=0;a<r.length;a++){const u=r[a];if(u===void 0)continue;const l=typeof u=="object"?u.key:u,d=Number(l);Array.isArray(h)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(a>0?".":"")+String(l),typeof h=="object"&&h!==null?h=h[l]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const lt=(t,n)=>{const e=qt(t,n);return{form:e,fields:e}},ae={validate({value:t,validationSource:n},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return n==="field"?i.issues:lt(i.issues,t)},async validateAsync({value:t,validationSource:n},e){const i=await e["~standard"].validate(t);if(i.issues)return n==="field"?i.issues:lt(i.issues,t)}},Je=t=>!!t&&"~standard"in t,O={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Q(t){function n(o){const f=t.getFieldMeta(o)??O;t.setFieldMeta(o,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(o,f,m){n(o);const c=a(o,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(o,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(o,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);l(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(o,m))).forEach(F=>{const M=F.replace(s(o,m),s(o,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(o,f){n(o);const m=a(o,f,"remove");l(m,"up")}function r(o,f,m){n(o),a(o,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(o,f)))return;const v=g.toString().replace(s(o,f),s(o,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(o,f){n(o);const m=a(o,f,"insert");l(m,"down"),m.forEach(c=>{c.toString().startsWith(s(o,f))&&t.setFieldMeta(c,d())})}function s(o,f){return`${o}[${f}]`}function a(o,f,m,c){const g=[s(o,f)];switch(m){case"swap":g.push(s(o,c));break;case"move":{const[v,S]=[Math.min(f,c),Math.max(f,c)];for(let F=v;F<=S;F++)g.push(s(o,F));break}default:{const v=t.getFieldValue(o),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(o,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function u(o,f){return o.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function l(o,f){(f==="up"?o:[...o].reverse()).forEach(c=>{const g=u(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,d())})}const d=()=>O;return{bumpArrayVersion:n,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:h}}function We(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ut{constructor(n){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{zt(this)}),a=K.on("request-form-state",c=>{c.payload.id===this._formId&&K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),u=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),l=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),d=()=>{l(),u(),a(),s.unsubscribe(),K.emit("form-unmounted",{id:this._formId})};(m=(f=this.options.listeners)==null?void 0:f.onMount)==null||m.call(f,{formApi:this});const{onMount:o}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),d},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const u=s.defaultValues&&!Y(s.defaultValues,a.defaultValues)&&!this.state.isTouched,l=!Y(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!u&&!l)){if(_(()=>{this.baseStore.setState(()=>We(Object.assign({},this.state,l?s.defaultState:{},u?{values:s.defaultValues}:{})))}),u){const d=Q(this);for(const o of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(o))&&d.bumpArrayVersion(o)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:u}=this.state,l=this.resetFieldMeta(u);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var o;let d=s??this.options.defaultValues??((o=this.options.defaultState)==null?void 0:o.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(d=be(d,f.instance.name,f.instance.options.defaultValue))}),We({...this.options.defaultState,values:d,fieldMetaBase:l})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(l=>{if(!l.instance)return;const d=l.instance;a.push(Promise.resolve().then(()=>d.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),l.instance.store.state.meta.isTouched||l.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null,o=[`${s}[${a}]`];for(let g=a+1;g<=(d??0);g++)o.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>o.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,u)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var l,d;const u=(l=this.fieldInfo[s])==null?void 0:l.instance;if(!u){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?((d=this.getFieldMeta(s))==null?void 0:d.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return u.store.state.meta.isTouched||u.setMeta(o=>({...o,isTouched:!0})),u.validate(a)},this.validateSync=(s,a)=>{const u=pe(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let l=!1;const d={};return _(()=>{var m,c,g;for(const v of u){if(!v.validate)continue;const S=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:F,fieldErrors:M}=Be(S),V=Fe(v.cause);let w=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(M||{})]);a!=null&&a.filterFieldNames&&(w=new Set([...w].filter(a.filterFieldNames)));for(const b of w){if(this.baseStore.state.fieldMetaBase[b]===void 0&&!(M!=null&&M[b]))continue;const L=this.getFieldMeta(b)??O,{errorMap:E,errorSourceMap:A}=L,D=M==null?void 0:M[b],{newErrorValue:j,newSource:T}=Xe({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(d[b]={...d[b],[V]:D}),(E==null?void 0:E[V])!==j&&this.setFieldMeta(b,(I=O)=>({...I,errorMap:{...I.errorMap,[V]:j},errorSourceMap:{...I.errorSourceMap,[V]:T}}))}a!=null&&a.dontUpdateFormErrorMap||((m=this.state.errorMap)==null?void 0:m[V])!==F&&this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[V]:F}})),(F||M)&&(l=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const o=Fe("submit");(c=this.state.errorMap)!=null&&c[o]&&s!=="submit"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}));const f=Fe("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:l,fieldsErrorMap:d}},this.validateAsync=async(s,a)=>{const u=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});this.state.isFormValidating||this.baseStore.setState(m=>({...m,isFormValidating:!0}));const l=[];let d;for(const m of u){if(!m.validate)continue;const c=Fe(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},l.push(new Promise(async S=>{let F;try{F=await new Promise((E,A)=>{setTimeout(async()=>{if(v.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:m.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(D){A(D)}},m.debounceMs)})}catch(E){F=E}const{formError:M,fieldErrors:V}=Be(F);V&&(d=d?{...d,...V}:V);const w=Fe(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(d||{})]);let L=Array.from(b);a!=null&&a.filterFieldNames&&(L=L.filter(a.filterFieldNames));for(const E of L){if(this.baseStore.state.fieldMetaBase[E]===void 0&&!(d!=null&&d[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=d==null?void 0:d[E],{newErrorValue:I,newSource:P}=Xe({newFormValidatorError:T,isPreviousErrorFromFormValidator:(j==null?void 0:j[w])==="form",previousErrorValue:D==null?void 0:D[w]});(D==null?void 0:D[w])!==I&&this.setFieldMeta(E,(R=O)=>({...R,errorMap:{...R.errorMap,[w]:I},errorSourceMap:{...R.errorSourceMap,[w]:P}}))}a!=null&&a.dontUpdateFormErrorMap||this.baseStore.setState(E=>({...E,errorMap:{...E.errorMap,[w]:M}})),S(d?{fieldErrors:d,errorMapKey:w}:void 0)}))}let o=[];const f={};if(l.length){o=await Promise.all(l);for(const m of o)if(m!=null&&m.fieldErrors){const{errorMapKey:c}=m;for(const[g,v]of Object.entries(m.fieldErrors)){const F={...f[g]||{},[c]:v};f[g]=F}}}return this.baseStore.setState(m=>({...m,isFormValidating:!1})),f},this.validate=(s,a)=>{const{hasErrored:u,fieldsErrorMap:l}=this.validateSync(s,a);return u&&!this.options.asyncAlways?l:this.validateAsync(s,a)},this._handleSubmit=async s=>{var l,d,o,f,m,c,g,v,S,F;this.baseStore.setState(M=>({...M,isSubmitted:!1,submissionAttempts:M.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.fieldInfo).forEach(M=>{M.instance&&(M.instance.store.state.meta.isTouched||M.instance.setMeta(V=>({...V,isTouched:!0})))})});const a=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){(d=(l=this.options).onSubmitInvalid)==null||d.call(l,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const u=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){u(),(f=(o=this.options).onSubmitInvalid)==null||f.call(o,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(M=>M.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){u(),(c=(m=this.options).onSubmitInvalid)==null||c.call(m,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}_(()=>{Object.values(this.fieldInfo).forEach(M=>{var V;(V=M.instance)==null||V.triggerOnSubmitListener()})}),(v=(g=this.options.listeners)==null?void 0:g.onSubmit)==null||v.call(g,{formApi:this,meta:a});try{await((F=(S=this.options).onSubmit)==null?void 0:F.call(S,{value:this.state.values,formApi:this,meta:a})),_(()=>{this.baseStore.setState(M=>({...M,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),u()})}catch(M){throw this.baseStore.setState(V=>({...V,isSubmitSuccessful:!1})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:M}),u(),M}},this.getFieldValue=s=>oe(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFormGroupMeta=s=>this.formGroupMetaDerived.state[s],this.getFieldInfo=s=>{var a;return(a=this.fieldInfo)[s]||(a[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,a)=>{this.baseStore.setState(u=>({...u,fieldMetaBase:{...u.fieldMetaBase,[s]:ge(a,u.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,u)=>{const l=u;return a[l]=O,a},{}),this.setFieldValue=(s,a,u)=>{var f;const l=(u==null?void 0:u.dontUpdateMeta)??!1,d=(u==null?void 0:u.dontRunListeners)??!1,o=(u==null?void 0:u.dontValidate)??!1;_(()=>{l||this.setFieldMeta(s,m=>({...m,isTouched:!0,isDirty:!0,errorMap:{...m==null?void 0:m.errorMap,onMount:void 0}})),this.baseStore.setState(m=>({...m,values:be(m.values,s,a)}))}),d||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const u=[...Object.keys(this.fieldInfo).filter(l=>{const d=s.toString();return l.startsWith(`${d}.`)||l.startsWith(`${d}[`)}),s];this.baseStore.setState(l=>{const d={...l};return u.forEach(o=>{d.values=Wt(d.values,o),delete this.fieldInfo[o],delete d.fieldMetaBase[o]}),d})},this.pushFieldValue=(s,a,u)=>{this.setFieldValue(s,l=>[...Array.isArray(l)?l:[],a],u),Q(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>[...o.slice(0,a),u,...o.slice(a)],$(l,{dontValidate:!0}));const d=(l==null?void 0:l.dontValidate)??!1;d||await this.validateField(s,"change"),Q(this).handleArrayInsert(s,a),d||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>o.map((f,m)=>m===a?u:f),$(l,{dontValidate:!0})),Q(this).bumpArrayVersion(s),((l==null?void 0:l.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(u,{dontValidate:!0})),Q(this).handleArrayRemove(s,a),d!==null){const f=`${s}[${d}]`;this.deleteField(f)}((u==null?void 0:u.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=o[a],m=o[u];return be(be(o,`${a}`,m),`${u}`,f)},$(l,{dontValidate:!0})),Q(this).handleArraySwap(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.moveFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=[...o];return f.splice(u,0,f.splice(a,1)[0]),f},$(l,{dontValidate:!0})),Q(this).handleArrayMove(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.clearFieldValues=(s,a)=>{const u=this.getFieldValue(s),l=Array.isArray(u)?Math.max(u.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Q(this).bumpArrayVersion(s),l!==null)for(let o=0;o<=l;o++){const f=`${s}[${o}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var o;const u=(o=this.getFieldInfo(s).instance)==null?void 0:o.options.defaultValue,l=oe(this.options.defaultValues,s),d=u??l;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:d!==void 0?be(a.values,s,d):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,u])=>{const l=a;if(De(u)){const{formError:d,fieldErrors:o}=Be(u);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[l]:o==null?void 0:o[f]},errorSourceMap:{...c.errorSourceMap,[l]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[l]:d}}))}else this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[l]:u}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,u])=>(Object.keys(u).length&&u.errors.length&&(s[a]={errors:u.errors,errorMap:u.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(n==null?void 0:n.formId)??vt(),this._devtoolsSubmissionOverride=!1;let e=We({...n==null?void 0:n.defaultState,values:(n==null?void 0:n.defaultValues)??((h=n==null?void 0:n.defaultState)==null?void 0:h.values)});if(n!=null&&n.transform){e=n.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!De(a)))for(const u of Object.keys(a.fields)){const l=a.fields[u];if(l===void 0)continue;const d=e.fieldMetaBase[u];e.fieldMetaBase[u]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...d??{},errorSourceMap:{...(d==null?void 0:d.errorSourceMap)??{},onChange:"form"},errorMap:{...(d==null?void 0:d.errorMap)??{},[s]:l}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var d,o,f;const a=this.baseStore.get();let u=0;const l={};for(const m of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[m],g=i==null?void 0:i.fieldMetaBase[m],v=s==null?void 0:s[m],S=oe(a.values,m);let F=v==null?void 0:v.errors;if(!g||c.errorMap!==g.errorMap){F=Object.values(c.errorMap??{}).filter(L=>L!==void 0);const b=(d=this.getFieldInfo(m))==null?void 0:d.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!Kt(F),V=!c.isDirty,w=Y(S,((f=(o=this.getFieldInfo(m))==null?void 0:o.instance)==null?void 0:f.options.defaultValue)??oe(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){l[m]=v,u++;continue}l[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&u===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),l):l}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l={};for(const d of this.formGroupApis){const o=d.name,f=a.formGroupStateBase[o]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=u[o];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in u){if(W===o||!ne(o,W))continue;const B=u[W];B&&(B.isValidating&&(c=!0),B.isValid||(g=!1),B.isTouched&&(v=!0),B.isBlurred&&(S=!0),B.isDefaultValue||(F=!1),B.isDirty&&(M=!0))}const V=!M,w=!!c||f.isValidating,b=(m==null?void 0:m.errorMap)??{},L=(m==null?void 0:m.errorSourceMap)??{},E=!!(b.onMount||Object.entries(u).some(([W,B])=>B&&W!==o&&ne(o,W)&&B.errorMap.onMount)),A=s==null?void 0:s[o];let D=(A==null?void 0:A.errors)??[];(!A||A.__srcErrorMap!==b)&&(D=Object.values(b).reduce((W,B)=>{if(B===void 0)return W;if(B&&typeof B=="object"&&"fields"in B){const Qe=B.group;return Qe!==void 0&&W.push(Qe),W}return W.push(B),W},[]));const j=D.length===0,T=g&&j,I=d.options.canSubmitWhenInvalid??!1,P=f.submissionAttempts===0&&!v&&!E||!w&&!f.isSubmitting&&T||I;if(A&&A.errorMap===b&&A.errorSourceMap===L&&A.errors===D&&A.isFieldsValidating===c&&A.isFieldsValid===g&&A.isGroupValid===j&&A.isValid===T&&A.canSubmit===P&&A.isTouched===v&&A.isBlurred===S&&A.isPristine===V&&A.isDefaultValue===F&&A.isDirty===M&&A.isValidating===w&&A.isSubmitting===f.isSubmitting&&A.isSubmitted===f.isSubmitted&&A.submissionAttempts===f.submissionAttempts&&A.isSubmitSuccessful===f.isSubmitSuccessful){l[o]=A;continue}const R={...f,errorMap:b,errorSourceMap:L,_arrayVersion:(m==null?void 0:m._arrayVersion)??0,isTouched:v,isBlurred:S,isDirty:M,isPristine:V,isDefaultValue:F,isValid:T,errors:D,isValidating:w,isFieldsValidating:c,isFieldsValid:g,isGroupValid:j,canSubmit:P};Object.defineProperty(R,"__srcErrorMap",{value:b,enumerable:!1,configurable:!0}),l[o]=R}return l});let r;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l=Object.values(u).filter(Boolean),d=l.some(I=>I.isValidating),o=l.every(I=>I.isValid),f=l.some(I=>I.isTouched),m=l.some(I=>I.isBlurred),c=l.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=l.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||l.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!d;let V=(s==null?void 0:s.errors)??[];(!r||a.errorMap!==r.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&De(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=o&&w,L=this.options.canSubmitWhenInvalid??!1,E=a.submissionAttempts===0&&!f&&!F||!M&&!a.isSubmitting&&b||L;let A=a.errorMap;if(g&&(V=V.filter(I=>I!==a.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),s&&r&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===d&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&Y(r,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:d,isFieldsValid:o,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return r=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Be(t){if(t){if(De(t)){const n=Be(t.form).formError,e=t.fields;return{formError:n,fieldErrors:e}}return{formError:t}}return{formError:void 0}}function Fe(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ve{constructor(n){this.options={},this.mount=()=>{var r,h;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const e=this.getInfo();e.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const s=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(a=>({...a,errorMap:{...a==null?void 0:a.errorMap,onMount:s},errorSourceMap:{...a==null?void 0:a.errorSourceMap,onMount:"field"}}))}return(h=(r=this.options.listeners)==null?void 0:r.onMount)==null||h.call(r,{value:this.state.value,fieldApi:this}),()=>{var a,u,l,d;for(const[o,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var f,m,c;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...O,isTouched:((f=o.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=o.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=o.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(u=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||u.call(a,{value:this.state.value,fieldApi:this}),(d=(l=this.form.options.listeners)==null?void 0:l.onFieldUnmount)==null||d.call(l,{formApi:this.form,fieldApi:this})}}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,i)=>{this.form.pushFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,i,r)=>{this.form.insertFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,r)=>{this.form.replaceFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,i)=>{this.form.removeFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,i,r)=>{this.form.swapFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,r)=>{this.form.moveFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,$(e,{dontRunListeners:!0})),e!=null&&e.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const i=Object.values(this.form.fieldInfo),r=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ve))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&r.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&r.push(h.instance)}return r},this.validateSync=(e,i)=>{var l;const r=pe(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((d,o)=>{const f=pe(e,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||q});return f.forEach(m=>{m.field=o}),d.concat(f)},[]);let a=!1;_(()=>{const d=(o,f)=>{var F;const m=Me(f.cause),c=f.validate?dt(o.runValidator({validate:f.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=Pe({formLevelError:g,fieldLevelError:c});((F=o.state.meta.errorMap)==null?void 0:F[m])!==v&&o.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const o of r)d(this,o);for(const o of s)o.validate&&d(o.field,o)});const u=Me("submit");return(l=this.state.meta.errorMap)!=null&&l[u]&&e!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[u]:void 0},errorSourceMap:{...d.errorSourceMap,[u]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const r=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),h=await i,a=this.getLinkedFields(e).reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,fieldName:g.name,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),u=[],l=[],d=r.some(c=>c.validate),o=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{d&&this.startValidation();for(const c of o)c.startValidation()});const f=(c,g,v)=>{const S=Me(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V},v.push(new Promise(async w=>{var j;let b;try{b=await new Promise((T,I)=>{c.timeoutIds.validations[g.cause]&&(clearTimeout(c.timeoutIds.validations[g.cause]),c.endValidation()),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return T(void 0);try{T(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,fieldApi:c,signal:V.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){I(P)}},g.debounceMs)})}catch(T){b=T}if(V.signal.aborted)return w(void 0);const L=dt(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=Pe({formLevelError:E,fieldLevelError:L});if(c.getInfo().instance!==c)return w(void 0);c.setMeta(T=>({...T,errorMap:{...T==null?void 0:T.errorMap,[S]:A},errorSourceMap:{...T.errorSourceMap,[S]:D}})),w(A)}))};for(const c of r)c.validate&&f(this,c,u);for(const c of a)c.validate&&f(c.field,c,l);let m=[];return(u.length||l.length)&&(m=await Promise.all(u),await Promise.all(l)),_(()=>{d&&this.endValidation();for(const c of o)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const r=i!=null&&i.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(c=>this.name.startsWith(c.name));let s=(i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!(i!=null&&i.skipFormValidation))for(const c of r){if(c.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:g}=this.form.validateSync(e,{group:c,dontUpdateFormErrorMap:!0,filterFieldNames:v=>ne(c.name,v)});s={...s,...g[this.name]??{}}}const{hasErrored:a}=this.validateSync(e,s),u=new WeakMap;for(const c of r){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});u.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Me(e)])==null||f.lastAbortController.abort();const c=[];for(const g of r)(m=g.getInfo().validationMetaMap[Me(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const l=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),d=this.validateAsync(e,l),o=[];for(const c of r)u.get(c)&&!c.options.asyncAlways||o.push(c.validateAsync(e,l,{skipRelatedFieldValidation:!0}));return o.length===0?d:Promise.all([d,...o]).then(c=>c.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(i=>({...i,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(i=>({...i,errorMap:{...i.errorMap,...e}}))},this.parseValueWithSchema=e=>ae.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>ae.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnBlurListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onBlur)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChange)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this});for(const d of this.form.formGroupApis)ne(d.name,this.name)&&d.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,fieldApi:this})},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...n.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}})}get state(){return this.store.state}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}startValidation(){this.setMeta(n=>{const e=n._pendingValidationsCount+1;return{...n,_pendingValidationsCount:e,isValidating:e>0&&!n.isValidating?!0:n.isValidating}})}endValidation(){this.setMeta(n=>{const e=Math.max(0,n._pendingValidationsCount-1);return{...n,_pendingValidationsCount:e,isValidating:e===0&&n.isValidating?!1:n.isValidating}})}}function dt(t){if(t)return t}function Me(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Ue(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Ht(t){return{...O,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}class Ae{constructor(n){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const r=i.formGroupStateBase[this.name]??Ue({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(r)}}})},this._lastDistributedFieldNames={},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...O,...this.options.defaultMeta})},this.mount=()=>{var i,r;this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(h=>({...h,formGroupStateBase:{...h.formGroupStateBase,[this.name]:h.formGroupStateBase[this.name]??Ue({...this.options.defaultState})}}));const{onMount:e}=this.options.validators||{};if(e){const h=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let s=h,a;ze(h)&&(s=h.group,a=h.fields);const u=Ke(s);u&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,onMount:u},errorSourceMap:{...l.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(r=(i=this.options.listeners)==null?void 0:i.onMount)==null||r.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,u]of Object.entries(this.timeoutIds.validations))u&&(clearTimeout(u),this.timeoutIds.validations[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.listeners))u&&(clearTimeout(u),this.timeoutIds.listeners[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.formListeners))u&&(clearTimeout(u),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,u]of Object.entries(this.fieldInfo.validationMetaMap))u==null||u.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ue({})}})),this.fieldInfo.instance=null,(s=(h=this.options.listeners)==null?void 0:h.onUnmount)==null||s.call(h,{value:this.state.value,groupApi:this})}}},this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const e=Object.values(this.form.fieldInfo),i=[];for(const r of e)r.instance&&r.instance instanceof Ve&&r.instance.name.startsWith(this.name)&&i.push(r.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[r,h]of e)r!==this.name&&ne(this.name,r)&&i.push({...h,name:r});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const r=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[u,l]of Object.entries(i))l==null||l===!1||h.add(this.buildChildFieldName(u));const s=new Set([...r,...h]);let a=!1;for(const u of s){const l=u.startsWith(this.name+"[")?u.slice(this.name.length):u.slice(this.name.length+1),d=i==null?void 0:i[l],o=this.form.getFieldMeta(u);if(!o&&!d)continue;const f=o==null?void 0:o.errorMap[e],m=(o==null?void 0:o.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Xe({newFormValidatorError:d,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(o==null?void 0:o.errorSourceMap[e])===g)&&this.form.setFieldMeta(u,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,r={})=>{var d;const h=pe(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((o,f)=>{const m=pe(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),o.concat(m)},[]);let u=!1;_(()=>{const o=(f,m)=>{var L;const c=Te(m.cause),g=f===this;let v;m.validate&&(v=f.runValidator({validate:m.validate,value:{value:f.store.state.value,validationSource:g?"form":"field",...f instanceof Ae?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&ze(v)&&(S=v.group,F=v.fields);const M=Ke(S),V=i[c],{newErrorValue:w,newSource:b}=Pe({formLevelError:V,fieldLevelError:M});((L=f.state.meta.errorMap)==null?void 0:L[c])!==w&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[c]:w},errorSourceMap:{...E.errorSourceMap,[c]:b}})),w&&(u=!0),g&&this.distributeFieldErrors(c,F)&&(u=!0)};for(const f of h)o(this,f);for(const f of a)f.validate&&o(f.field,f)});const l=Te("submit");return(d=this.state.meta.errorMap)!=null&&d[l]&&e!=="submit"&&!u&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,[l]:void 0},errorSourceMap:{...o.errorSourceMap,[l]:void 0}})),{hasErrored:u}},this.validateAsync=async(e,i,r={})=>{const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),u=a.reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),l=[],d=[],o=h.some(c=>c.validate)||u.some(c=>c.validate);if(o){this.state.meta.isValidating||this.setMeta(c=>({...c,isValidating:!0}));for(const c of a)c.setMeta(g=>({...g,isValidating:!0}))}const f=(c,g,v)=>{const S=Te(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V};const w=c===this;v.push(new Promise(async b=>{var P;let L;try{L=await new Promise((R,W)=>{c.timeoutIds.validations[g.cause]&&clearTimeout(c.timeoutIds.validations[g.cause]),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,signal:V.signal,validationSource:w?"form":"field",...c instanceof Ae?{groupApi:c}:{fieldApi:c}},type:"validateAsync"}))}catch(B){W(B)}},g.debounceMs)})}catch(R){L=R}if(V.signal.aborted)return b(void 0);let E=L,A;w&&ze(L)&&(E=L.group,A=L.fields);const D=Ke(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=Pe({formLevelError:j,fieldLevelError:D});if(c.getInfo().instance!==c)return b(void 0);c.setMeta(R=>({...R,errorMap:{...R==null?void 0:R.errorMap,[S]:T},errorSourceMap:{...R.errorSourceMap,[S]:I}})),w&&this.distributeFieldErrors(S,A),b(T)}))};for(const c of h)c.validate&&f(this,c,l);for(const c of u)c.validate&&f(c.field,c,d);let m=[];if((l.length||d.length)&&(m=await Promise.all(l),await Promise.all(d)),o){this.setMeta(c=>({...c,isValidating:!1}));for(const c of a)c.setMeta(g=>({...g,isValidating:!1}))}return m.filter(Boolean)},this.validateAllFields=async e=>{const i=[];return _(()=>{Object.values(this.getRelatedFields()).forEach(h=>{i.push(Promise.resolve().then(()=>h.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),h.store.state.meta.isTouched||h.setMeta(s=>({...s,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=(e,i,r)=>this.form.validateArrayFieldsStartingFrom(e,i,r),this.validateField=(e,i)=>this.form.validateField(e,i),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(e,i),this.setFieldValue=(e,i)=>this.form.setFieldValue(e,i),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,i)=>this.form.pushFieldValue(e,i),this.insertFieldValue=(e,i,r)=>this.form.insertFieldValue(e,i,r),this.replaceFieldValue=(e,i,r)=>this.form.replaceFieldValue(e,i,r),this.swapFieldValues=(e,i,r)=>this.form.swapFieldValues(e,i,r),this.moveFieldValues=(e,i,r)=>this.form.moveFieldValues(e,i,r),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,i)=>this.form.removeFieldValue(e,i),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,i)=>{var a;const{fieldsErrorMap:r}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)}),{hasErrored:h}=this.validateSync(e,r[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[Te(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChangeGroup)==null||o.call(d,{formApi:this.form,groupApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChangeGroup)==null||s.call(h,{formApi:this.form,groupApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,groupApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{var h,s,a,u,l,d,o,f;this.setFormGroupState(m=>({...m,isSubmitted:!1,submissionAttempts:m.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{m.state.meta.isTouched||m.setMeta(c=>({...c,isTouched:!0}))})});const i=e??this.options.onSubmitMeta;this.setFormGroupState(m=>({...m,isSubmitting:!0}));const r=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){r(),(s=(h=this.options).onGroupSubmitInvalid)==null||s.call(h,{value:this.state.value,groupApi:this,meta:i});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){r(),(u=(a=this.options).onGroupSubmitInvalid)==null||u.call(a,{value:this.state.value,groupApi:this,meta:i});return}_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{var c,g;(g=(c=m.options.listeners)==null?void 0:c.onGroupSubmit)==null||g.call(c,{value:m.state.value,fieldApi:m})})}),(d=(l=this.options.listeners)==null?void 0:l.onSubmit)==null||d.call(l,{groupApi:this,value:this.state.value});try{await((f=(o=this.options).onGroupSubmit)==null?void 0:f.call(o,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),r(),m}},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=ie(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const i=this.form.getFormGroupMeta(this.name)??Ht(n.defaultMeta);let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(n){if(Je(n.validate)){const e=ae[n.type](n.value,n.validate);return n.type==="validate"?ct(e):e.then(ct)}return n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Ke(t){if(t)return t}function ze(t){return!!t&&typeof t=="object"&&"fields"in t}function ct(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:n,fields:e,...i}=t;return{...i,group:n,fields:e}}function Te(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class _e{constructor(n){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return ot(this.fieldsMap,e);const i=Oe(e)[0];if(typeof i!="string")return"";const r=e.slice(i.length),h=this.fieldsMap[i];return ot(h,r)},this.getFormFieldOptions=e=>{const i={...e},r=i.validators;if(i.name=this.getFormFieldName(e.name),r&&(r.onChangeListenTo||r.onBlurListenTo)){const h={...r},s=a=>{if(a)return a.map(u=>this.getFormFieldName(u))};h.onChangeListenTo=s(r.onChangeListenTo),h.onBlurListenTo=s(r.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,r),this.validateField=(e,i)=>this.form.validateField(this.getFormFieldName(e),i),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(this.getFormFieldName(e),i),this.setFieldValue=(e,i,r)=>this.form.setFieldValue(this.getFormFieldName(e),i,r),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,r)=>this.form.pushFieldValue(this.getFormFieldName(e),i,r),this.insertFieldValue=async(e,i,r,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,r,h),this.replaceFieldValue=async(e,i,r,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,r,h),this.removeFieldValue=async(e,i,r)=>this.form.removeFieldValue(this.getFormFieldName(e),i,r),this.swapFieldValues=(e,i,r,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,r,h),this.moveFieldValues=(e,i,r,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,r,h),this.clearFieldValues=(e,i)=>this.form.clearFieldValues(this.getFormFieldName(e),i),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),n.form instanceof _e){const e=n.form;if(this.form=e.form,typeof n.fields=="string")this.fieldsMap=e.getFormFieldName(n.fields);else{const i={...n.fields};for(const r in i)i[r]=e.getFormFieldName(i[r]);this.fieldsMap=i}}else this.form=n.form,this.fieldsMap=n.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=oe(e.values,this.fieldsMap);else{i={};const r=this.fieldsMap;for(const h in r)i[h]=oe(e.values,r[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}function Zt(t,n){if(!n)return;const e=Object.assign({},t,{state:Se(t.state)});n(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((h,s)=>(t.state[s]!==e.state[s]&&(h[s]=e.state[s]),h),{});return _(()=>{Object.keys(r).length&&t.baseStore.setState(h=>({...h,...r})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Xt(t,n){return t===n}function x(t,n=i=>i,e){const i=(e==null?void 0:e.compare)??Xt,r=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return St.useSyncExternalStoreWithSelector(r,h,h,n,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Yt(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ve({...t}));let h=i;(n.form!==t.form||n.name!==t.name)&&(h=new Ve({...t}),r(h),e({form:t.form,name:t.name}));const s=x(h.store,t.mode==="array"?c=>c.meta._arrayVersion||0:c=>c.value),a=x(h.store,c=>c.meta.isTouched),u=x(h.store,c=>c.meta.isBlurred),l=x(h.store,c=>c.meta.isDirty),d=x(h.store,c=>c.meta.errorMap),o=x(h.store,c=>c.meta.errorSourceMap),f=x(h.store,c=>c.meta.isValidating),m=C.useMemo(()=>({...h,get state(){return{value:t.mode==="array"?h.state.value:s,get meta(){return{...h.state.meta,isTouched:a,isBlurred:u,isDirty:l,errorMap:d,errorSourceMap:o,isValidating:f}}}}}),[h,t.mode,s,a,u,l,d,o,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const Jt=(({children:t,...n})=>{const e=Yt(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function Qt(){return C.useState(()=>vt())[0]}const ei=pt,ti=C.version.split(".")[0]==="17"?Qt:ei.useId;function ii(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ae({...t}));(n.form!==t.form||n.name!==t.name)&&(r(new Ae({...t})),e({form:t.form,name:t.name}));const h=x(i.store,b=>b.value),s=x(i.store,b=>b.meta.isTouched),a=x(i.store,b=>b.meta.isBlurred),u=x(i.store,b=>b.meta.isDirty),l=x(i.store,b=>b.meta.errorMap),d=x(i.store,b=>b.meta.errorSourceMap),o=x(i.store,b=>b.meta.isValidating),f=x(i.store,b=>b.meta.isSubmitting),m=x(i.store,b=>b.meta.isSubmitted),c=x(i.store,b=>b.meta.submissionAttempts),g=x(i.store,b=>b.meta.isSubmitSuccessful),v=x(i.store,b=>b.meta.canSubmit),S=x(i.store,b=>b.meta.isValid),F=x(i.store,b=>b.meta.isFieldsValid),M=x(i.store,b=>b.meta.isFieldsValidating),V=x(i.store,b=>b.meta.isGroupValid),w=C.useMemo(()=>({...i,handleSubmit:((...E)=>i._handleSubmit(...E)),get state(){return{...i.state,value:h,get meta(){return{...i.state.meta,isTouched:s,isBlurred:a,isDirty:u,errorMap:l,errorSourceMap:d,isValidating:o,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,u,l,d,o,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const si=(({children:t,...n})=>{const e=ii(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ri({form:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function ni(t){const n=ti(),[e,i]=C.useState(t==null?void 0:t.formId),[r,h]=C.useState(()=>new ut({...t,formId:(t==null?void 0:t.formId)??n}));if(e!==(t==null?void 0:t.formId)){const u=(t==null?void 0:t.formId)??n;h(new ut({...t,formId:u})),i(u)}const s=C.useMemo(()=>{const u={...r,handleSubmit:((...l)=>r._handleSubmit(...l)),get formId(){return r._formId},get state(){return r.store.state}};return u.Field=function(d){return p.jsx(Jt,{...d,form:r})},u.FormGroup=function(d){return p.jsx(si,{...d,form:r})},u.Subscribe=function(d){return p.jsx(ri,{form:r,selector:d.selector,children:d.children})},u},[r]);J(r.mount,[]),J(()=>{r.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Zt(r,t.transform)},[r,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function ai({lens:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function oi(t){const[n]=C.useState(()=>{const e=new _e(t),i=t.form instanceof _e?t.form.form:t.form,r=e;return r.AppForm=function(s){return p.jsx(i.AppForm,{...s})},r.AppField=function(s){return p.jsx(i.AppField,{...n.getFormFieldOptions(s)})},r.Field=function(s){return p.jsx(i.Field,{...n.getFormFieldOptions(s)})},r.Subscribe=function(s){return p.jsx(ai,{lens:n,selector:s.selector,children:s.children})},Object.assign(r,{...t.formComponents})});return J(n.mount,[n]),n}const ht=C.createContext(null),bt=C.createContext(null);function Ft(){const t=C.useContext(bt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function li(){function t(){const n=C.useContext(ht);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}return{fieldContext:ht,useFieldContext:t,useFormContext:Ft,formContext:bt}}function Mt({fieldComponents:t,fieldContext:n,formContext:e,formComponents:i}){function r(l){const d=ni(l),o=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:d,children:c}),[d]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(d.Field,{...v,children:S=>p.jsx(n.Provider,{value:S,children:g(Object.assign(S,t))})})),[d]);return C.useMemo(()=>Object.assign(d,{AppField:f,AppForm:o,...i}),[d,f,o])}function h({render:l,props:d}){return function(f){return l({...d,...f})}}function s({render:l,props:d,defaultValues:o}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:o,formComponents:i}),[m.form,m.fields]),g=oi(c);return l({...d,...m,group:g})}}function a(l){return Ft()}function u(l){return Mt({fieldContext:n,formContext:e,fieldComponents:{...t,...l.fieldComponents},formComponents:{...i,...l.formComponents}})}return{useAppForm:r,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:u}}const{fieldContext:ui,formContext:di,useFieldContext:ve,useFormContext:ci}=li();function hi({label:t,placeholder:n,type:e="text",description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(yt,{id:r.name,type:e,value:r.state.value,placeholder:n,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function fi({label:t,placeholder:n,description:e,rows:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(Vt,{id:r.name,value:r.state.value,placeholder:n,rows:i,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:a})]})}function mi({label:t,options:n,placeholder:e,description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsxs(At,{value:r.state.value,onValueChange:u=>r.handleChange(u),onOpenChange:u=>{u||r.handleBlur()},children:[p.jsx(Et,{id:r.name,children:p.jsx(wt,{placeholder:e})}),p.jsx(It,{children:n.map(u=>p.jsx(Ct,{value:u.value,children:u.label},u.value))})]}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function gi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(he,{htmlFor:e.name,children:t}),p.jsx(Lt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s)}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function vi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(Tt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s===!0)}),p.jsx(he,{htmlFor:e.name,children:t}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function bi({label:t,placeholder:n,description:e}){const i=ve(),{isTouched:r,errors:h}=i.state.meta,s=r?h.map(a=>({message:String(a)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:i.name,children:t}),p.jsx(xt,{id:i.name,value:i.state.value,placeholder:n,onBlur:i.handleBlur,onChange:a=>i.handleChange(a.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:s})]})}function Fi({label:t,pendingLabel:n="Saving…"}){const e=ci();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:r})=>p.jsx(Dt,{type:"submit",disabled:!i||r,children:r?n:t})})}const{useAppForm:pi}=Mt({fieldContext:ui,formContext:di,fieldComponents:{TextField:hi,TextareaField:fi,SelectField:mi,SwitchField:gi,CheckboxField:vi,PasswordField:bi},formComponents:{SubmitButton:Fi}});export{x as a,pi as u};
@@ -1 +1 @@
1
- import{a8 as d,a9 as f}from"./index-CdKpQ1hI.js";function p(){const t=d();return f({queryKey:["tasks","templates"],queryFn:()=>t.getTaskTemplates()})}const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function c(t){const n=t.trim().split(/\s+/);if(n.length!==5)return null;const[r,e,a,i,u]=n;if(a!=="*"||i!=="*"||!s(e)||!s(r)||Number(e)>23||Number(r)>59)return null;if(u==="*")return`Every day at ${o(e,r)}`;if(u==="1-5")return`Every weekday at ${o(e,r)}`;if(s(u)){const y=m[Number(u)];return y?`Every ${y} at ${o(e,r)}`:null}return null}function s(t){return/^\d+$/.test(t)}function o(t,n){const r=Number(t),e=Number(n),a=r>=12?"PM":"AM";return`${r===0?12:r>12?r-12:r}:${String(e).padStart(2,"0")} ${a}`}function h(t){return c(t)??t}export{h as f,p as u};
1
+ import{a8 as d,a9 as f}from"./index-DxTOTFWT.js";function p(){const t=d();return f({queryKey:["tasks","templates"],queryFn:()=>t.getTaskTemplates()})}const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function c(t){const n=t.trim().split(/\s+/);if(n.length!==5)return null;const[r,e,a,i,u]=n;if(a!=="*"||i!=="*"||!s(e)||!s(r)||Number(e)>23||Number(r)>59)return null;if(u==="*")return`Every day at ${o(e,r)}`;if(u==="1-5")return`Every weekday at ${o(e,r)}`;if(s(u)){const y=m[Number(u)];return y?`Every ${y} at ${o(e,r)}`:null}return null}function s(t){return/^\d+$/.test(t)}function o(t,n){const r=Number(t),e=Number(n),a=r>=12?"PM":"AM";return`${r===0?12:r>12?r-12:r}:${String(e).padStart(2,"0")} ${a}`}function h(t){return c(t)??t}export{h as f,p as u};
@@ -1,4 +1,4 @@
1
- import{a2 as e}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as e}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a2 as e}from"./index-CdKpQ1hI.js";/**
1
+ import{a2 as e}from"./index-DxTOTFWT.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r,S as d,E as p,j as E,c as f}from"./index-CdKpQ1hI.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};
1
+ import{r,S as d,E as p,j as E,c as f}from"./index-DxTOTFWT.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};