@rjsf/utils 6.8.0 → 6.10.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 (475) hide show
  1. package/dist/index.cjs +509 -419
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/utils.esm.js +508 -418
  4. package/dist/utils.esm.js.map +4 -4
  5. package/dist/utils.umd.js +567 -327
  6. package/lib/ErrorSchemaBuilder.d.ts +8 -7
  7. package/lib/ErrorSchemaBuilder.d.ts.map +1 -0
  8. package/lib/ErrorSchemaBuilder.js +29 -27
  9. package/lib/ErrorSchemaBuilder.js.map +1 -1
  10. package/lib/SelectedOptionDescription.d.ts +2 -1
  11. package/lib/SelectedOptionDescription.d.ts.map +1 -0
  12. package/lib/SelectedOptionDescription.js +6 -7
  13. package/lib/SelectedOptionDescription.js.map +1 -1
  14. package/lib/allowAdditionalItems.d.ts +2 -1
  15. package/lib/allowAdditionalItems.d.ts.map +1 -0
  16. package/lib/allowAdditionalItems.js +1 -1
  17. package/lib/allowAdditionalItems.js.map +1 -1
  18. package/lib/asNumber.d.ts +1 -0
  19. package/lib/asNumber.d.ts.map +1 -0
  20. package/lib/asNumber.js +1 -1
  21. package/lib/asNumber.js.map +1 -1
  22. package/lib/canExpand.d.ts +2 -1
  23. package/lib/canExpand.d.ts.map +1 -0
  24. package/lib/canExpand.js +1 -1
  25. package/lib/canExpand.js.map +1 -1
  26. package/lib/constIsAjvDataReference.d.ts +2 -1
  27. package/lib/constIsAjvDataReference.d.ts.map +1 -0
  28. package/lib/constIsAjvDataReference.js +2 -3
  29. package/lib/constIsAjvDataReference.js.map +1 -1
  30. package/lib/constants.d.ts +1 -0
  31. package/lib/constants.d.ts.map +1 -0
  32. package/lib/createErrorHandler.d.ts +2 -1
  33. package/lib/createErrorHandler.d.ts.map +1 -0
  34. package/lib/createErrorHandler.js +3 -4
  35. package/lib/createErrorHandler.js.map +1 -1
  36. package/lib/createSchemaUtils.d.ts +2 -1
  37. package/lib/createSchemaUtils.d.ts.map +1 -0
  38. package/lib/createSchemaUtils.js +10 -7
  39. package/lib/createSchemaUtils.js.map +1 -1
  40. package/lib/dataURItoBlob.d.ts +1 -0
  41. package/lib/dataURItoBlob.d.ts.map +1 -0
  42. package/lib/dataURItoBlob.js +1 -2
  43. package/lib/dataURItoBlob.js.map +1 -1
  44. package/lib/dateRangeOptions.d.ts +2 -1
  45. package/lib/dateRangeOptions.d.ts.map +1 -0
  46. package/lib/dateRangeOptions.js +1 -1
  47. package/lib/dateRangeOptions.js.map +1 -1
  48. package/lib/deepEquals.d.ts +1 -0
  49. package/lib/deepEquals.d.ts.map +1 -0
  50. package/lib/englishStringTranslator.d.ts +2 -1
  51. package/lib/englishStringTranslator.d.ts.map +1 -0
  52. package/lib/englishStringTranslator.js +1 -1
  53. package/lib/englishStringTranslator.js.map +1 -1
  54. package/lib/enumOptionSelectedValue.d.ts +2 -1
  55. package/lib/enumOptionSelectedValue.d.ts.map +1 -0
  56. package/lib/enumOptionSelectedValue.js +1 -1
  57. package/lib/enumOptionSelectedValue.js.map +1 -1
  58. package/lib/enumOptionValueDecoder.d.ts +2 -1
  59. package/lib/enumOptionValueDecoder.d.ts.map +1 -0
  60. package/lib/enumOptionValueDecoder.js +1 -1
  61. package/lib/enumOptionValueDecoder.js.map +1 -1
  62. package/lib/enumOptionValueEncoder.d.ts +2 -1
  63. package/lib/enumOptionValueEncoder.d.ts.map +1 -0
  64. package/lib/enumOptionValueEncoder.js +1 -2
  65. package/lib/enumOptionValueEncoder.js.map +1 -1
  66. package/lib/enumOptionsDeselectValue.d.ts +2 -1
  67. package/lib/enumOptionsDeselectValue.d.ts.map +1 -0
  68. package/lib/enumOptionsDeselectValue.js +2 -2
  69. package/lib/enumOptionsDeselectValue.js.map +1 -1
  70. package/lib/enumOptionsIndexForValue.d.ts +2 -1
  71. package/lib/enumOptionsIndexForValue.d.ts.map +1 -0
  72. package/lib/enumOptionsIndexForValue.js +1 -1
  73. package/lib/enumOptionsIndexForValue.js.map +1 -1
  74. package/lib/enumOptionsIsSelected.d.ts +2 -1
  75. package/lib/enumOptionsIsSelected.d.ts.map +1 -0
  76. package/lib/enumOptionsIsSelected.js +1 -1
  77. package/lib/enumOptionsIsSelected.js.map +1 -1
  78. package/lib/enumOptionsSelectValue.d.ts +2 -1
  79. package/lib/enumOptionsSelectValue.d.ts.map +1 -0
  80. package/lib/enumOptionsSelectValue.js +2 -3
  81. package/lib/enumOptionsSelectValue.js.map +1 -1
  82. package/lib/enumOptionsValueForIndex.d.ts +2 -1
  83. package/lib/enumOptionsValueForIndex.d.ts.map +1 -0
  84. package/lib/enums.d.ts +1 -0
  85. package/lib/enums.d.ts.map +1 -0
  86. package/lib/findSchemaDefinition.d.ts +2 -1
  87. package/lib/findSchemaDefinition.d.ts.map +1 -0
  88. package/lib/findSchemaDefinition.js +7 -11
  89. package/lib/findSchemaDefinition.js.map +1 -1
  90. package/lib/getChangedFields.d.ts +11 -2
  91. package/lib/getChangedFields.d.ts.map +1 -0
  92. package/lib/getChangedFields.js +57 -18
  93. package/lib/getChangedFields.js.map +1 -1
  94. package/lib/getDateElementProps.d.ts +2 -1
  95. package/lib/getDateElementProps.d.ts.map +1 -0
  96. package/lib/getDecimalSeparator.d.ts +1 -0
  97. package/lib/getDecimalSeparator.d.ts.map +1 -0
  98. package/lib/getDecimalSeparator.js +1 -2
  99. package/lib/getDecimalSeparator.js.map +1 -1
  100. package/lib/getDiscriminatorFieldFromSchema.d.ts +2 -1
  101. package/lib/getDiscriminatorFieldFromSchema.d.ts.map +1 -0
  102. package/lib/getDiscriminatorFieldFromSchema.js +4 -5
  103. package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
  104. package/lib/getInputProps.d.ts +2 -1
  105. package/lib/getInputProps.d.ts.map +1 -0
  106. package/lib/getInputProps.js +4 -1
  107. package/lib/getInputProps.js.map +1 -1
  108. package/lib/getOptionMatchingSimpleDiscriminator.d.ts +2 -1
  109. package/lib/getOptionMatchingSimpleDiscriminator.d.ts.map +1 -0
  110. package/lib/getOptionMatchingSimpleDiscriminator.js +6 -6
  111. package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
  112. package/lib/getOptionValueFormat.d.ts +2 -1
  113. package/lib/getOptionValueFormat.d.ts.map +1 -0
  114. package/lib/getOptionValueFormat.js +1 -2
  115. package/lib/getOptionValueFormat.js.map +1 -1
  116. package/lib/getPropertySchema.d.ts +12 -0
  117. package/lib/getPropertySchema.d.ts.map +1 -0
  118. package/lib/getPropertySchema.js +14 -0
  119. package/lib/getPropertySchema.js.map +1 -0
  120. package/lib/getSchemaType.d.ts +2 -1
  121. package/lib/getSchemaType.d.ts.map +1 -0
  122. package/lib/getSchemaType.js +1 -1
  123. package/lib/getSchemaType.js.map +1 -1
  124. package/lib/getSubmitButtonOptions.d.ts +2 -1
  125. package/lib/getSubmitButtonOptions.d.ts.map +1 -0
  126. package/lib/getSubmitButtonOptions.js +3 -3
  127. package/lib/getSubmitButtonOptions.js.map +1 -1
  128. package/lib/getTemplate.d.ts +2 -1
  129. package/lib/getTemplate.d.ts.map +1 -0
  130. package/lib/getTestIds.d.ts +2 -1
  131. package/lib/getTestIds.d.ts.map +1 -0
  132. package/lib/getTestIds.js +6 -5
  133. package/lib/getTestIds.js.map +1 -1
  134. package/lib/getUiOptions.d.ts +2 -1
  135. package/lib/getUiOptions.d.ts.map +1 -0
  136. package/lib/getUiOptions.js +2 -2
  137. package/lib/getUiOptions.js.map +1 -1
  138. package/lib/getWidget.d.ts +2 -1
  139. package/lib/getWidget.d.ts.map +1 -0
  140. package/lib/getWidget.js +6 -7
  141. package/lib/getWidget.js.map +1 -1
  142. package/lib/guessType.d.ts +2 -1
  143. package/lib/guessType.d.ts.map +1 -0
  144. package/lib/hasWidget.d.ts +2 -1
  145. package/lib/hasWidget.d.ts.map +1 -0
  146. package/lib/hasWidget.js +1 -1
  147. package/lib/hasWidget.js.map +1 -1
  148. package/lib/hashForSchema.d.ts +2 -1
  149. package/lib/hashForSchema.d.ts.map +1 -0
  150. package/lib/idGenerators.d.ts +2 -1
  151. package/lib/idGenerators.d.ts.map +1 -0
  152. package/lib/idGenerators.js +2 -3
  153. package/lib/idGenerators.js.map +1 -1
  154. package/lib/index.d.ts +93 -87
  155. package/lib/index.d.ts.map +1 -0
  156. package/lib/index.js +85 -81
  157. package/lib/index.js.map +1 -1
  158. package/lib/isConstant.d.ts +2 -1
  159. package/lib/isConstant.d.ts.map +1 -0
  160. package/lib/isConstant.js +1 -1
  161. package/lib/isConstant.js.map +1 -1
  162. package/lib/isCustomWidget.d.ts +2 -1
  163. package/lib/isCustomWidget.d.ts.map +1 -0
  164. package/lib/isCustomWidget.js +1 -1
  165. package/lib/isCustomWidget.js.map +1 -1
  166. package/lib/isFixedItems.d.ts +2 -1
  167. package/lib/isFixedItems.d.ts.map +1 -0
  168. package/lib/isFixedItems.js +1 -1
  169. package/lib/isFixedItems.js.map +1 -1
  170. package/lib/isFormDataAvailable.d.ts +1 -0
  171. package/lib/isFormDataAvailable.d.ts.map +1 -0
  172. package/lib/isFormDataAvailable.js +7 -4
  173. package/lib/isFormDataAvailable.js.map +1 -1
  174. package/lib/isObject.d.ts +3 -1
  175. package/lib/isObject.d.ts.map +1 -0
  176. package/lib/isObject.js +8 -2
  177. package/lib/isObject.js.map +1 -1
  178. package/lib/isPlainObject.d.ts +9 -0
  179. package/lib/isPlainObject.d.ts.map +1 -0
  180. package/lib/isPlainObject.js +15 -0
  181. package/lib/isPlainObject.js.map +1 -0
  182. package/lib/isRootSchema.d.ts +2 -1
  183. package/lib/isRootSchema.d.ts.map +1 -0
  184. package/lib/isRootSchema.js +2 -2
  185. package/lib/isRootSchema.js.map +1 -1
  186. package/lib/jsonSchemaAugmentation.d.ts +1 -0
  187. package/lib/jsonSchemaAugmentation.d.ts.map +1 -0
  188. package/lib/labelValue.d.ts +1 -0
  189. package/lib/labelValue.d.ts.map +1 -0
  190. package/lib/localToUTC.d.ts +1 -0
  191. package/lib/localToUTC.d.ts.map +1 -0
  192. package/lib/logUnsupportedDefaultForEnum.d.ts +2 -1
  193. package/lib/logUnsupportedDefaultForEnum.d.ts.map +1 -0
  194. package/lib/logUnsupportedDefaultForEnum.js +1 -1
  195. package/lib/logUnsupportedDefaultForEnum.js.map +1 -1
  196. package/lib/lookupFromFormContext.d.ts +3 -2
  197. package/lib/lookupFromFormContext.d.ts.map +1 -0
  198. package/lib/lookupFromFormContext.js +4 -5
  199. package/lib/lookupFromFormContext.js.map +1 -1
  200. package/lib/mergeDefaultsWithFormData.d.ts +1 -0
  201. package/lib/mergeDefaultsWithFormData.d.ts.map +1 -0
  202. package/lib/mergeDefaultsWithFormData.js +20 -16
  203. package/lib/mergeDefaultsWithFormData.js.map +1 -1
  204. package/lib/mergeObjects.d.ts +2 -1
  205. package/lib/mergeObjects.d.ts.map +1 -0
  206. package/lib/mergeObjects.js +1 -1
  207. package/lib/mergeObjects.js.map +1 -1
  208. package/lib/mergeSchemas.d.ts +2 -1
  209. package/lib/mergeSchemas.d.ts.map +1 -0
  210. package/lib/mergeSchemas.js +4 -5
  211. package/lib/mergeSchemas.js.map +1 -1
  212. package/lib/nameGenerators.d.ts +2 -1
  213. package/lib/nameGenerators.d.ts.map +1 -0
  214. package/lib/noop.d.ts +5 -0
  215. package/lib/noop.d.ts.map +1 -0
  216. package/lib/noop.js +5 -0
  217. package/lib/noop.js.map +1 -0
  218. package/lib/optionsList.d.ts +2 -1
  219. package/lib/optionsList.d.ts.map +1 -0
  220. package/lib/optionsList.js +15 -15
  221. package/lib/optionsList.js.map +1 -1
  222. package/lib/orderProperties.d.ts +1 -0
  223. package/lib/orderProperties.d.ts.map +1 -0
  224. package/lib/pad.d.ts +1 -0
  225. package/lib/pad.d.ts.map +1 -0
  226. package/lib/parseDateString.d.ts +2 -1
  227. package/lib/parseDateString.d.ts.map +1 -0
  228. package/lib/parser/ParserValidator.d.ts +2 -1
  229. package/lib/parser/ParserValidator.d.ts.map +1 -0
  230. package/lib/parser/ParserValidator.js +8 -7
  231. package/lib/parser/ParserValidator.js.map +1 -1
  232. package/lib/parser/index.d.ts +3 -2
  233. package/lib/parser/index.d.ts.map +1 -0
  234. package/lib/parser/index.js +1 -1
  235. package/lib/parser/index.js.map +1 -1
  236. package/lib/parser/schemaParser.d.ts +3 -2
  237. package/lib/parser/schemaParser.d.ts.map +1 -0
  238. package/lib/parser/schemaParser.js +6 -7
  239. package/lib/parser/schemaParser.js.map +1 -1
  240. package/lib/pathUtils.d.ts +77 -0
  241. package/lib/pathUtils.d.ts.map +1 -0
  242. package/lib/pathUtils.js +192 -0
  243. package/lib/pathUtils.js.map +1 -0
  244. package/lib/rangeSpec.d.ts +2 -1
  245. package/lib/rangeSpec.d.ts.map +1 -0
  246. package/lib/removeOptionalEmptyObjects.d.ts +2 -1
  247. package/lib/removeOptionalEmptyObjects.d.ts.map +1 -0
  248. package/lib/removeOptionalEmptyObjects.js +2 -2
  249. package/lib/removeOptionalEmptyObjects.js.map +1 -1
  250. package/lib/replaceStringParameters.d.ts +1 -0
  251. package/lib/replaceStringParameters.d.ts.map +1 -0
  252. package/lib/resolveUiSchema.d.ts +2 -1
  253. package/lib/resolveUiSchema.d.ts.map +1 -0
  254. package/lib/resolveUiSchema.js +6 -8
  255. package/lib/resolveUiSchema.js.map +1 -1
  256. package/lib/schema/findFieldInSchema.d.ts +2 -1
  257. package/lib/schema/findFieldInSchema.d.ts.map +1 -0
  258. package/lib/schema/findFieldInSchema.js +10 -11
  259. package/lib/schema/findFieldInSchema.js.map +1 -1
  260. package/lib/schema/findSelectedOptionInXxxOf.d.ts +2 -1
  261. package/lib/schema/findSelectedOptionInXxxOf.d.ts.map +1 -0
  262. package/lib/schema/findSelectedOptionInXxxOf.js +7 -7
  263. package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -1
  264. package/lib/schema/getClosestMatchingOption.d.ts +2 -1
  265. package/lib/schema/getClosestMatchingOption.d.ts.map +1 -0
  266. package/lib/schema/getClosestMatchingOption.js +18 -23
  267. package/lib/schema/getClosestMatchingOption.js.map +1 -1
  268. package/lib/schema/getDefaultFormState.d.ts +2 -1
  269. package/lib/schema/getDefaultFormState.d.ts.map +1 -0
  270. package/lib/schema/getDefaultFormState.js +78 -56
  271. package/lib/schema/getDefaultFormState.js.map +1 -1
  272. package/lib/schema/getDisplayLabel.d.ts +2 -1
  273. package/lib/schema/getDisplayLabel.d.ts.map +1 -0
  274. package/lib/schema/getDisplayLabel.js +7 -7
  275. package/lib/schema/getDisplayLabel.js.map +1 -1
  276. package/lib/schema/getFirstMatchingOption.d.ts +2 -1
  277. package/lib/schema/getFirstMatchingOption.d.ts.map +1 -0
  278. package/lib/schema/getFirstMatchingOption.js +9 -9
  279. package/lib/schema/getFirstMatchingOption.js.map +1 -1
  280. package/lib/schema/getFromSchema.d.ts +3 -2
  281. package/lib/schema/getFromSchema.d.ts.map +1 -0
  282. package/lib/schema/getFromSchema.js +10 -11
  283. package/lib/schema/getFromSchema.js.map +1 -1
  284. package/lib/schema/index.d.ts +15 -14
  285. package/lib/schema/index.d.ts.map +1 -0
  286. package/lib/schema/index.js +14 -14
  287. package/lib/schema/index.js.map +1 -1
  288. package/lib/schema/isFilesArray.d.ts +2 -1
  289. package/lib/schema/isFilesArray.d.ts.map +1 -0
  290. package/lib/schema/isFilesArray.js +2 -2
  291. package/lib/schema/isFilesArray.js.map +1 -1
  292. package/lib/schema/isMultiSelect.d.ts +2 -1
  293. package/lib/schema/isMultiSelect.d.ts.map +1 -0
  294. package/lib/schema/isMultiSelect.js +1 -1
  295. package/lib/schema/isMultiSelect.js.map +1 -1
  296. package/lib/schema/isSelect.d.ts +2 -1
  297. package/lib/schema/isSelect.d.ts.map +1 -0
  298. package/lib/schema/isSelect.js +2 -2
  299. package/lib/schema/isSelect.js.map +1 -1
  300. package/lib/schema/omitExtraData.d.ts +2 -1
  301. package/lib/schema/omitExtraData.d.ts.map +1 -0
  302. package/lib/schema/omitExtraData.js +100 -64
  303. package/lib/schema/omitExtraData.js.map +1 -1
  304. package/lib/schema/retrieveSchema.d.ts +2 -1
  305. package/lib/schema/retrieveSchema.d.ts.map +1 -0
  306. package/lib/schema/retrieveSchema.js +32 -40
  307. package/lib/schema/retrieveSchema.js.map +1 -1
  308. package/lib/schema/sanitizeDataForNewSchema.d.ts +4 -3
  309. package/lib/schema/sanitizeDataForNewSchema.d.ts.map +1 -0
  310. package/lib/schema/sanitizeDataForNewSchema.js +41 -39
  311. package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
  312. package/lib/schema/shallowAllOfMerge.d.ts +1 -0
  313. package/lib/schema/shallowAllOfMerge.d.ts.map +1 -0
  314. package/lib/schema/toPathSchema.d.ts +2 -1
  315. package/lib/schema/toPathSchema.d.ts.map +1 -0
  316. package/lib/schema/toPathSchema.js +14 -14
  317. package/lib/schema/toPathSchema.js.map +1 -1
  318. package/lib/schemaRequiresTrueValue.d.ts +2 -1
  319. package/lib/schemaRequiresTrueValue.d.ts.map +1 -0
  320. package/lib/schemaRequiresTrueValue.js +3 -4
  321. package/lib/schemaRequiresTrueValue.js.map +1 -1
  322. package/lib/shallowEquals.d.ts +1 -0
  323. package/lib/shallowEquals.d.ts.map +1 -0
  324. package/lib/shouldRender.d.ts +2 -1
  325. package/lib/shouldRender.d.ts.map +1 -0
  326. package/lib/shouldRender.js +2 -2
  327. package/lib/shouldRender.js.map +1 -1
  328. package/lib/shouldRenderOptionalField.d.ts +2 -1
  329. package/lib/shouldRenderOptionalField.d.ts.map +1 -0
  330. package/lib/shouldRenderOptionalField.js +11 -10
  331. package/lib/shouldRenderOptionalField.js.map +1 -1
  332. package/lib/toConstant.d.ts +2 -1
  333. package/lib/toConstant.d.ts.map +1 -0
  334. package/lib/toConstant.js +1 -1
  335. package/lib/toConstant.js.map +1 -1
  336. package/lib/toDateString.d.ts +2 -1
  337. package/lib/toDateString.d.ts.map +1 -0
  338. package/lib/toErrorList.d.ts +2 -1
  339. package/lib/toErrorList.d.ts.map +1 -0
  340. package/lib/toErrorList.js +20 -21
  341. package/lib/toErrorList.js.map +1 -1
  342. package/lib/toErrorSchema.d.ts +2 -1
  343. package/lib/toErrorSchema.d.ts.map +1 -0
  344. package/lib/toErrorSchema.js +4 -9
  345. package/lib/toErrorSchema.js.map +1 -1
  346. package/lib/toFieldPathId.d.ts +2 -1
  347. package/lib/toFieldPathId.d.ts.map +1 -0
  348. package/lib/toFieldPathId.js +2 -2
  349. package/lib/toFieldPathId.js.map +1 -1
  350. package/lib/types.d.ts +15 -5
  351. package/lib/types.d.ts.map +1 -0
  352. package/lib/types.js +1 -1
  353. package/lib/types.js.map +1 -1
  354. package/lib/unwrapErrorHandler.d.ts +2 -1
  355. package/lib/unwrapErrorHandler.d.ts.map +1 -0
  356. package/lib/unwrapErrorHandler.js +13 -4
  357. package/lib/unwrapErrorHandler.js.map +1 -1
  358. package/lib/useAltDateWidgetProps.d.ts +3 -2
  359. package/lib/useAltDateWidgetProps.d.ts.map +1 -0
  360. package/lib/useAltDateWidgetProps.js +5 -5
  361. package/lib/useAltDateWidgetProps.js.map +1 -1
  362. package/lib/useDeepCompareMemo.d.ts +1 -0
  363. package/lib/useDeepCompareMemo.d.ts.map +1 -0
  364. package/lib/useDeepCompareMemo.js +1 -1
  365. package/lib/useDeepCompareMemo.js.map +1 -1
  366. package/lib/useFileWidgetProps.d.ts +1 -0
  367. package/lib/useFileWidgetProps.d.ts.map +1 -0
  368. package/lib/useFileWidgetProps.js +3 -4
  369. package/lib/useFileWidgetProps.js.map +1 -1
  370. package/lib/utcToLocal.d.ts +1 -0
  371. package/lib/utcToLocal.d.ts.map +1 -0
  372. package/lib/utcToLocal.js +1 -1
  373. package/lib/utcToLocal.js.map +1 -1
  374. package/lib/validationDataMerge.d.ts +2 -1
  375. package/lib/validationDataMerge.d.ts.map +1 -0
  376. package/lib/validationDataMerge.js +3 -4
  377. package/lib/validationDataMerge.js.map +1 -1
  378. package/lib/withIdRefPrefix.d.ts +2 -1
  379. package/lib/withIdRefPrefix.d.ts.map +1 -0
  380. package/lib/withIdRefPrefix.js +2 -2
  381. package/lib/withIdRefPrefix.js.map +1 -1
  382. package/package.json +5 -6
  383. package/src/ErrorSchemaBuilder.ts +25 -24
  384. package/src/SelectedOptionDescription.tsx +5 -5
  385. package/src/allowAdditionalItems.ts +2 -2
  386. package/src/asNumber.ts +1 -1
  387. package/src/canExpand.ts +2 -2
  388. package/src/constIsAjvDataReference.ts +5 -4
  389. package/src/createErrorHandler.ts +5 -7
  390. package/src/createSchemaUtils.ts +8 -10
  391. package/src/dateRangeOptions.ts +2 -2
  392. package/src/englishStringTranslator.ts +2 -2
  393. package/src/enumOptionSelectedValue.ts +2 -2
  394. package/src/enumOptionValueDecoder.ts +2 -2
  395. package/src/enumOptionValueEncoder.ts +2 -4
  396. package/src/enumOptionsDeselectValue.ts +3 -3
  397. package/src/enumOptionsIndexForValue.ts +2 -2
  398. package/src/enumOptionsIsSelected.ts +2 -2
  399. package/src/enumOptionsSelectValue.ts +3 -5
  400. package/src/enumOptionsValueForIndex.ts +1 -1
  401. package/src/findSchemaDefinition.ts +8 -12
  402. package/src/getChangedFields.ts +57 -18
  403. package/src/getDateElementProps.ts +1 -1
  404. package/src/getDiscriminatorFieldFromSchema.ts +5 -7
  405. package/src/getInputProps.ts +6 -2
  406. package/src/getOptionMatchingSimpleDiscriminator.ts +7 -7
  407. package/src/getOptionValueFormat.ts +1 -1
  408. package/src/getPropertySchema.ts +18 -0
  409. package/src/getSchemaType.ts +2 -2
  410. package/src/getSubmitButtonOptions.ts +3 -3
  411. package/src/getTemplate.ts +1 -1
  412. package/src/getTestIds.ts +7 -6
  413. package/src/getUiOptions.ts +3 -3
  414. package/src/getWidget.tsx +6 -6
  415. package/src/hasWidget.ts +2 -2
  416. package/src/hashForSchema.ts +1 -1
  417. package/src/idGenerators.ts +3 -5
  418. package/src/index.ts +99 -85
  419. package/src/isConstant.ts +2 -2
  420. package/src/isCustomWidget.ts +2 -2
  421. package/src/isFixedItems.ts +2 -2
  422. package/src/isFormDataAvailable.ts +7 -5
  423. package/src/isObject.ts +15 -3
  424. package/src/isPlainObject.ts +14 -0
  425. package/src/isRootSchema.ts +3 -3
  426. package/src/logUnsupportedDefaultForEnum.ts +2 -2
  427. package/src/lookupFromFormContext.ts +7 -8
  428. package/src/mergeDefaultsWithFormData.ts +22 -18
  429. package/src/mergeObjects.ts +2 -2
  430. package/src/mergeSchemas.ts +5 -7
  431. package/src/nameGenerators.ts +1 -1
  432. package/src/noop.ts +4 -0
  433. package/src/optionsList.ts +9 -9
  434. package/src/orderProperties.ts +1 -1
  435. package/src/parseDateString.ts +1 -1
  436. package/src/parser/ParserValidator.ts +5 -7
  437. package/src/parser/index.ts +2 -2
  438. package/src/parser/schemaParser.ts +8 -10
  439. package/src/pathUtils.ts +203 -0
  440. package/src/rangeSpec.ts +1 -1
  441. package/src/removeOptionalEmptyObjects.ts +3 -3
  442. package/src/resolveUiSchema.ts +5 -7
  443. package/src/schema/findFieldInSchema.ts +11 -13
  444. package/src/schema/findSelectedOptionInXxxOf.ts +9 -10
  445. package/src/schema/getClosestMatchingOption.ts +73 -83
  446. package/src/schema/getDefaultFormState.ts +62 -34
  447. package/src/schema/getDisplayLabel.ts +7 -7
  448. package/src/schema/getFirstMatchingOption.ts +10 -11
  449. package/src/schema/getFromSchema.ts +12 -14
  450. package/src/schema/index.ts +14 -14
  451. package/src/schema/isFilesArray.ts +3 -3
  452. package/src/schema/isMultiSelect.ts +2 -2
  453. package/src/schema/isSelect.ts +3 -3
  454. package/src/schema/omitExtraData.ts +104 -68
  455. package/src/schema/retrieveSchema.ts +47 -60
  456. package/src/schema/sanitizeDataForNewSchema.ts +42 -41
  457. package/src/schema/toPathSchema.ts +14 -14
  458. package/src/schemaRequiresTrueValue.ts +1 -1
  459. package/src/shouldRender.ts +3 -3
  460. package/src/shouldRenderOptionalField.ts +14 -14
  461. package/src/toConstant.ts +2 -2
  462. package/src/toDateString.ts +1 -1
  463. package/src/toErrorList.ts +22 -25
  464. package/src/toErrorSchema.ts +5 -11
  465. package/src/toFieldPathId.ts +2 -2
  466. package/src/types.ts +14 -5
  467. package/src/unwrapErrorHandler.ts +15 -6
  468. package/src/useAltDateWidgetProps.tsx +7 -7
  469. package/src/useDeepCompareMemo.ts +1 -1
  470. package/src/useFileWidgetProps.ts +1 -1
  471. package/src/utcToLocal.ts +1 -1
  472. package/src/validationDataMerge.ts +4 -6
  473. package/src/withIdRefPrefix.ts +3 -4
  474. package/lib/tsconfig.tsbuildinfo +0 -1
  475. package/src/tsconfig.json +0 -9
package/dist/utils.esm.js CHANGED
@@ -3,10 +3,10 @@ function isObject(thing) {
3
3
  if (typeof thing !== "object" || thing === null) {
4
4
  return false;
5
5
  }
6
- if (typeof thing.lastModified === "number" && typeof File !== "undefined" && thing instanceof File) {
6
+ if ("lastModified" in thing && typeof thing.lastModified === "number" && typeof File !== "undefined" && thing instanceof File) {
7
7
  return false;
8
8
  }
9
- if (typeof thing.getMonth === "function" && typeof Date !== "undefined" && thing instanceof Date) {
9
+ if ("getMonth" in thing && typeof thing.getMonth === "function" && typeof Date !== "undefined" && thing instanceof Date) {
10
10
  return false;
11
11
  }
12
12
  return !Array.isArray(thing);
@@ -136,8 +136,16 @@ function canExpand(schema, uiSchema = {}, formData) {
136
136
  return true;
137
137
  }
138
138
 
139
+ // src/isPlainObject.ts
140
+ function isPlainObject(thing) {
141
+ if (typeof thing !== "object" || thing === null) {
142
+ return false;
143
+ }
144
+ const proto = Object.getPrototypeOf(thing);
145
+ return proto === null || proto === Object.prototype;
146
+ }
147
+
139
148
  // src/createErrorHandler.ts
140
- import isPlainObject from "lodash/isPlainObject";
141
149
  function createErrorHandler(formData) {
142
150
  const handler = {
143
151
  // We store the list of errors for this node in a property named __errors
@@ -152,18 +160,14 @@ function createErrorHandler(formData) {
152
160
  return formData.reduce((acc, value, key) => ({ ...acc, [key]: createErrorHandler(value) }), handler);
153
161
  }
154
162
  if (isPlainObject(formData)) {
155
- const formObject = formData;
156
- return Object.keys(formObject).reduce(
157
- (acc, key) => ({ ...acc, [key]: createErrorHandler(formObject[key]) }),
163
+ return Object.keys(formData).reduce(
164
+ (acc, key) => ({ ...acc, [key]: createErrorHandler(formData[key]) }),
158
165
  handler
159
166
  );
160
167
  }
161
168
  return handler;
162
169
  }
163
170
 
164
- // src/createSchemaUtils.ts
165
- import get16 from "lodash/get";
166
-
167
171
  // src/deepEquals.ts
168
172
  import { createCustomEqual } from "fast-equals";
169
173
  var deepEquals = createCustomEqual({
@@ -179,10 +183,6 @@ var deepEquals_default = deepEquals;
179
183
  // src/findSchemaDefinition.ts
180
184
  import UriResolver from "fast-uri";
181
185
  import jsonpointer from "jsonpointer";
182
- import get from "lodash/get";
183
- import isEmpty from "lodash/isEmpty";
184
- import isObject2 from "lodash/isObject";
185
- import omit from "lodash/omit";
186
186
  function findEmbeddedSchemaRecursive(schema, ref) {
187
187
  if (ID_KEY in schema && UriResolver.equal(schema[ID_KEY], ref)) {
188
188
  return schema;
@@ -190,14 +190,14 @@ function findEmbeddedSchemaRecursive(schema, ref) {
190
190
  for (const subSchema of Object.values(schema)) {
191
191
  if (Array.isArray(subSchema)) {
192
192
  for (const item of subSchema) {
193
- if (isObject2(item)) {
193
+ if (isObject(item)) {
194
194
  const result = findEmbeddedSchemaRecursive(item, ref);
195
195
  if (result !== void 0) {
196
196
  return result;
197
197
  }
198
198
  }
199
199
  }
200
- } else if (isObject2(subSchema)) {
200
+ } else if (isObject(subSchema)) {
201
201
  const result = findEmbeddedSchemaRecursive(subSchema, ref);
202
202
  if (result !== void 0) {
203
203
  return result;
@@ -207,7 +207,7 @@ function findEmbeddedSchemaRecursive(schema, ref) {
207
207
  return void 0;
208
208
  }
209
209
  function makeAllReferencesAbsolute(schema, baseURI) {
210
- const currentURI = get(schema, ID_KEY, baseURI);
210
+ const currentURI = schema[ID_KEY] ?? baseURI;
211
211
  let result = schema;
212
212
  if (REF_KEY in result) {
213
213
  result = { ...result, [REF_KEY]: UriResolver.resolve(currentURI, result[REF_KEY]) };
@@ -216,20 +216,19 @@ function makeAllReferencesAbsolute(schema, baseURI) {
216
216
  if (Array.isArray(subSchema)) {
217
217
  result = {
218
218
  ...result,
219
- [key]: subSchema.map((item) => isObject2(item) ? makeAllReferencesAbsolute(item, currentURI) : item)
219
+ [key]: subSchema.map((item) => isObject(item) ? makeAllReferencesAbsolute(item, currentURI) : item)
220
220
  };
221
- } else if (isObject2(subSchema)) {
221
+ } else if (isObject(subSchema)) {
222
222
  result = { ...result, [key]: makeAllReferencesAbsolute(subSchema, currentURI) };
223
223
  }
224
224
  }
225
225
  return result;
226
226
  }
227
227
  function splitKeyElementFromObject(key, object) {
228
- const value = object[key];
229
- const remaining = omit(object, [key]);
228
+ const { [key]: value, ...remaining } = object;
230
229
  return [remaining, value];
231
230
  }
232
- function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = get(rootSchema, [ID_KEY])) {
231
+ function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = rootSchema[ID_KEY]) {
233
232
  const ref = $ref || "";
234
233
  let current = void 0;
235
234
  let currentBaseURI = baseURI;
@@ -249,7 +248,7 @@ function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [],
249
248
  current = findEmbeddedSchemaRecursive(rootSchema, refId.replace(/\/$/, ""));
250
249
  if (current !== void 0) {
251
250
  currentBaseURI = current[ID_KEY];
252
- if (!isEmpty(refAnchor)) {
251
+ if (refAnchor.length > 0) {
253
252
  current = jsonpointer.get(current, decodeURIComponent(refAnchor.join("#")));
254
253
  }
255
254
  }
@@ -279,25 +278,116 @@ function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [],
279
278
  }
280
279
  return current;
281
280
  }
282
- function findSchemaDefinition($ref, rootSchema = {}, baseURI = get(rootSchema, [ID_KEY])) {
281
+ function findSchemaDefinition($ref, rootSchema = {}, baseURI = rootSchema[ID_KEY]) {
283
282
  const recurseList = [];
284
283
  return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);
285
284
  }
286
285
 
287
- // src/schema/findFieldInSchema.ts
288
- import get8 from "lodash/get";
289
- import has3 from "lodash/has";
290
-
291
- // src/schema/findSelectedOptionInXxxOf.ts
292
- import get6 from "lodash/get";
286
+ // src/pathUtils.ts
287
+ var reIsIndex = /^(?:0|[1-9]\d*)$/;
288
+ function toPath(path) {
289
+ return path.split(/[.[\]]+/).filter(Boolean);
290
+ }
291
+ function normalizePath(path) {
292
+ return Array.isArray(path) ? path : [path];
293
+ }
294
+ function isUnsafeSegment(segment) {
295
+ return segment === "__proto__";
296
+ }
297
+ function isIndex(segment) {
298
+ return typeof segment === "number" ? Number.isInteger(segment) && segment >= 0 : reIsIndex.test(segment);
299
+ }
300
+ function isSettable(value) {
301
+ return value != null && (typeof value === "object" || typeof value === "function");
302
+ }
303
+ function getByPath(obj, path, defaultValue) {
304
+ let current;
305
+ if (!Array.isArray(path)) {
306
+ current = isSettable(obj) && Object.hasOwn(obj, path) ? obj[path] : void 0;
307
+ } else if (path.length === 0) {
308
+ current = void 0;
309
+ } else {
310
+ current = obj;
311
+ for (let i = 0; i < path.length; i++) {
312
+ const segment = path[i];
313
+ if (!isSettable(current) || !Object.hasOwn(current, segment)) {
314
+ current = void 0;
315
+ break;
316
+ }
317
+ current = current[segment];
318
+ }
319
+ }
320
+ return current === void 0 ? defaultValue : current;
321
+ }
322
+ function setByPath(obj, path, value, createIntermediateObjects = false) {
323
+ if (!isSettable(obj)) {
324
+ return obj;
325
+ }
326
+ if (!Array.isArray(path)) {
327
+ if (!isUnsafeSegment(path)) {
328
+ const target = obj;
329
+ target[path] = value;
330
+ }
331
+ return obj;
332
+ }
333
+ const segments = path;
334
+ if (segments.some(isUnsafeSegment)) {
335
+ return obj;
336
+ }
337
+ let current = obj;
338
+ for (let i = 0; i < segments.length; i++) {
339
+ const segment = segments[i];
340
+ if (i === segments.length - 1) {
341
+ current[segment] = value;
342
+ } else {
343
+ const existing = Object.hasOwn(current, segment) ? current[segment] : void 0;
344
+ if (isSettable(existing)) {
345
+ current = existing;
346
+ } else {
347
+ const next = createIntermediateObjects || !isIndex(segments[i + 1]) ? {} : [];
348
+ current[segment] = next;
349
+ if (isSettable(next)) {
350
+ current = next;
351
+ }
352
+ }
353
+ }
354
+ }
355
+ return obj;
356
+ }
357
+ function hasByPath(obj, path) {
358
+ if (!Array.isArray(path)) {
359
+ return isSettable(obj) && Object.hasOwn(obj, path);
360
+ }
361
+ let current = obj;
362
+ for (let i = 0; i < path.length; i++) {
363
+ if (!isSettable(current) || !Object.hasOwn(current, path[i])) {
364
+ return false;
365
+ }
366
+ current = current[path[i]];
367
+ }
368
+ return path.length > 0;
369
+ }
370
+ function unsetByPath(obj, path) {
371
+ const segments = normalizePath(path);
372
+ if (segments.length === 0) {
373
+ return true;
374
+ }
375
+ const parent = segments.length > 1 ? getByPath(obj, segments.slice(0, -1)) : obj;
376
+ if (parent == null) {
377
+ return true;
378
+ }
379
+ try {
380
+ return Reflect.deleteProperty(parent, segments[segments.length - 1]);
381
+ } catch {
382
+ return false;
383
+ }
384
+ }
293
385
 
294
386
  // src/getDiscriminatorFieldFromSchema.ts
295
- import get2 from "lodash/get";
296
- import isString from "lodash/isString";
297
387
  function getDiscriminatorFieldFromSchema(schema) {
298
388
  let discriminator;
299
- const maybeString = get2(schema, DISCRIMINATOR_PATH);
300
- if (isString(maybeString)) {
389
+ const maybeString = getByPath(schema, DISCRIMINATOR_PATH);
390
+ if (typeof maybeString === "string") {
301
391
  discriminator = maybeString;
302
392
  } else if (maybeString !== void 0) {
303
393
  console.warn(`Expecting discriminator to be a string, got "${typeof maybeString}" instead`);
@@ -305,16 +395,6 @@ function getDiscriminatorFieldFromSchema(schema) {
305
395
  return discriminator;
306
396
  }
307
397
 
308
- // src/schema/retrieveSchema.ts
309
- import flattenDeep from "lodash/flattenDeep";
310
- import get5 from "lodash/get";
311
- import isEmpty2 from "lodash/isEmpty";
312
- import merge from "lodash/merge";
313
- import set from "lodash/set";
314
- import times from "lodash/times";
315
- import transform from "lodash/transform";
316
- import uniq from "lodash/uniq";
317
-
318
398
  // src/guessType.ts
319
399
  function guessType(value) {
320
400
  if (Array.isArray(value)) {
@@ -338,9 +418,6 @@ function guessType(value) {
338
418
  return "string";
339
419
  }
340
420
 
341
- // src/mergeSchemas.ts
342
- import union from "lodash/union";
343
-
344
421
  // src/getSchemaType.ts
345
422
  function getSchemaType(schema) {
346
423
  let { type } = schema;
@@ -371,7 +448,7 @@ function mergeSchemas(obj1, obj2) {
371
448
  if (obj1 && key in obj1 && isObject(right)) {
372
449
  accumulator[key] = mergeSchemas(left, right);
373
450
  } else if (obj1 && obj2 && (getSchemaType(obj1) === "object" || getSchemaType(obj2) === "object") && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
374
- accumulator[key] = union(left, right);
451
+ accumulator[key] = [.../* @__PURE__ */ new Set([...left, ...right])];
375
452
  } else {
376
453
  accumulator[key] = right;
377
454
  }
@@ -383,27 +460,27 @@ function mergeSchemas(obj1, obj2) {
383
460
  return result;
384
461
  }
385
462
 
386
- // src/schema/getFirstMatchingOption.ts
387
- import get4 from "lodash/get";
388
- import has from "lodash/has";
389
- import isNumber from "lodash/isNumber";
463
+ // src/getPropertySchema.ts
464
+ function getPropertySchema(schema, property) {
465
+ return schema?.[PROPERTIES_KEY]?.[property] ?? {};
466
+ }
390
467
 
391
468
  // src/getOptionMatchingSimpleDiscriminator.ts
392
- import get3 from "lodash/get";
393
469
  function getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField) {
394
470
  if (formData && discriminatorField) {
395
- const value = get3(formData, discriminatorField);
471
+ const value = getByPath(formData, discriminatorField);
396
472
  if (value === void 0) {
397
473
  return void 0;
398
474
  }
399
475
  for (let i = 0; i < options.length; i += 1) {
400
476
  const option = options[i];
401
- const discriminator = get3(option, [PROPERTIES_KEY, discriminatorField], {});
477
+ const discriminator = getPropertySchema(option, discriminatorField);
402
478
  if (discriminator.type !== "object" && discriminator.type !== "array") {
403
479
  if (discriminator.const === value) {
404
480
  return i;
405
481
  }
406
- if (discriminator.enum?.includes(value)) {
482
+ const enumValues = discriminator.enum;
483
+ if (enumValues?.includes(value)) {
407
484
  return i;
408
485
  }
409
486
  }
@@ -418,14 +495,14 @@ function getFirstMatchingOption(validator, formData, options, rootSchema, discri
418
495
  return 0;
419
496
  }
420
497
  const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);
421
- if (isNumber(simpleDiscriminatorMatch)) {
498
+ if (typeof simpleDiscriminatorMatch === "number") {
422
499
  return simpleDiscriminatorMatch;
423
500
  }
424
501
  for (let i = 0; i < options.length; i += 1) {
425
502
  const option = options[i];
426
- if (discriminatorField && has(option, [PROPERTIES_KEY, discriminatorField])) {
427
- const value = get4(formData, discriminatorField);
428
- const discriminator = get4(option, [PROPERTIES_KEY, discriminatorField], {});
503
+ const discriminator = discriminatorField ? option[PROPERTIES_KEY]?.[discriminatorField] : void 0;
504
+ if (discriminatorField && discriminator !== void 0) {
505
+ const value = getByPath(formData, discriminatorField);
429
506
  if (validator.isValid(discriminator, value, rootSchema)) {
430
507
  return i;
431
508
  }
@@ -558,7 +635,7 @@ function getAllPermutationsOfXxxOf(listOfLists) {
558
635
  const allPermutations = listOfLists.reduce(
559
636
  (permutations, list) => {
560
637
  if (list.length > 1) {
561
- return list.flatMap((element) => times(permutations.length, (i) => [...permutations[i]].concat(element)));
638
+ return list.flatMap((element) => permutations.map((permutation) => [...permutation, element]));
562
639
  }
563
640
  permutations.forEach((permutation) => permutation.push(list[0]));
564
641
  return permutations;
@@ -569,12 +646,9 @@ function getAllPermutationsOfXxxOf(listOfLists) {
569
646
  return allPermutations;
570
647
  }
571
648
  function getMatchingPatternProperties(schema, key) {
572
- return Object.keys(schema.patternProperties).filter((pattern) => RegExp(pattern).test(key)).reduce(
573
- (obj, pattern) => {
574
- set(obj, [pattern], schema.patternProperties[pattern]);
575
- return obj;
576
- },
577
- {}
649
+ const patternProperties = schema.patternProperties ?? {};
650
+ return Object.fromEntries(
651
+ Object.entries(patternProperties).filter(([pattern]) => RegExp(pattern).test(key))
578
652
  );
579
653
  }
580
654
  function resolveSchema(validator, schema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs) {
@@ -669,23 +743,24 @@ function resolveAllReferences(schema, rootSchema, recurseList, baseURI, resolveA
669
743
  }
670
744
  if (PROPERTIES_KEY in resolvedSchema) {
671
745
  const childrenLists = [];
672
- const updatedProps = transform(
673
- resolvedSchema[PROPERTIES_KEY],
674
- (acc, value, key) => {
675
- const childList = [...recurseList];
676
- acc[key] = resolveAllReferences(
677
- value,
678
- rootSchema,
679
- childList,
680
- currentBaseURI,
681
- resolveAnyOfOrOneOfRefs,
682
- !resolveAnyOfOrOneOfRefs
683
- );
684
- childrenLists.push(childList);
685
- },
686
- {}
687
- );
688
- merge(recurseList, uniq(flattenDeep(childrenLists)));
746
+ const updatedProps = {};
747
+ for (const [key, value] of Object.entries(resolvedSchema[PROPERTIES_KEY] ?? {})) {
748
+ const childList = [...recurseList];
749
+ updatedProps[key] = resolveAllReferences(
750
+ value,
751
+ rootSchema,
752
+ childList,
753
+ currentBaseURI,
754
+ resolveAnyOfOrOneOfRefs,
755
+ !resolveAnyOfOrOneOfRefs
756
+ );
757
+ childrenLists.push(childList);
758
+ }
759
+ for (const ref of new Set(childrenLists.flat())) {
760
+ if (!recurseList.includes(ref)) {
761
+ recurseList.push(ref);
762
+ }
763
+ }
689
764
  resolvedSchema = { ...resolvedSchema, [PROPERTIES_KEY]: updatedProps };
690
765
  }
691
766
  if (ITEMS_KEY in resolvedSchema && !Array.isArray(resolvedSchema.items) && typeof resolvedSchema.items !== "boolean") {
@@ -734,12 +809,12 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
734
809
  }
735
810
  if (PATTERN_PROPERTIES_KEY in schema) {
736
811
  const matchingProperties = getMatchingPatternProperties(schema, key);
737
- if (!isEmpty2(matchingProperties)) {
812
+ if (Object.keys(matchingProperties).length > 0) {
738
813
  schema.properties[key] = retrieveSchema(
739
814
  validator,
740
815
  { [ALL_OF_KEY]: Object.values(matchingProperties) },
741
816
  rootSchema,
742
- get5(formData, [key]),
817
+ formData[key],
743
818
  experimental_customMergeAllOf
744
819
  );
745
820
  schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
@@ -752,9 +827,9 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
752
827
  if (REF_KEY in schema.additionalProperties) {
753
828
  additionalProperties = retrieveSchema(
754
829
  validator,
755
- { [REF_KEY]: get5(schema.additionalProperties, [REF_KEY]) },
830
+ { [REF_KEY]: schema.additionalProperties[REF_KEY] },
756
831
  rootSchema,
757
- get5(formData, [key]),
832
+ formData[key],
758
833
  experimental_customMergeAllOf
759
834
  );
760
835
  } else if ("type" in schema.additionalProperties) {
@@ -765,10 +840,10 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
765
840
  ...schema.additionalProperties
766
841
  };
767
842
  } else {
768
- additionalProperties = { type: guessType(get5(formData, [key])) };
843
+ additionalProperties = { type: guessType(formData[key]) };
769
844
  }
770
845
  } else {
771
- additionalProperties = { type: guessType(get5(formData, [key])) };
846
+ additionalProperties = { type: guessType(formData[key]) };
772
847
  }
773
848
  schema.properties[key] = additionalProperties;
774
849
  schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
@@ -850,12 +925,12 @@ function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expa
850
925
  resolvedSchema = Object.keys(resolvedSchema.properties).reduce(
851
926
  (acc, key) => {
852
927
  const matchingProperties = getMatchingPatternProperties(acc, key);
853
- if (!isEmpty2(matchingProperties)) {
928
+ if (Object.keys(matchingProperties).length > 0) {
854
929
  acc.properties[key] = retrieveSchema(
855
930
  validator,
856
931
  { allOf: [acc.properties[key], ...Object.values(matchingProperties)] },
857
932
  rootSchema,
858
- get5(rawFormData, [key]),
933
+ getByPath(rawFormData, key),
859
934
  experimental_customMergeAllOf
860
935
  );
861
936
  }
@@ -936,7 +1011,7 @@ function resolveDependencies(validator, schema, rootSchema, expandAllBranches, r
936
1011
  function processDependencies(validator, dependencies, resolvedSchema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
937
1012
  let schemas = [resolvedSchema];
938
1013
  for (const dependencyKey in dependencies) {
939
- if ((expandAllBranches || get5(formData, [dependencyKey]) !== void 0) && (!resolvedSchema.properties || dependencyKey in resolvedSchema.properties)) {
1014
+ if ((expandAllBranches || getByPath(formData, dependencyKey) !== void 0) && (!resolvedSchema.properties || dependencyKey in resolvedSchema.properties)) {
940
1015
  const [remainingDependencies, dependencyValue] = splitKeyElementFromObject(
941
1016
  dependencyKey,
942
1017
  dependencies
@@ -1063,14 +1138,14 @@ function findSelectedOptionInXxxOf(validator, rootSchema, schema, fallbackField,
1063
1138
  const xxxOfs = schema[xxx].map(
1064
1139
  (xxxOf) => retrieveSchema(validator, xxxOf, rootSchema, formData, experimental_customMergeAllOf)
1065
1140
  );
1066
- const data = get6(formData, selectorField);
1141
+ const data = getByPath(formData, selectorField);
1067
1142
  if (data !== void 0) {
1068
1143
  return xxxOfs.find(
1069
1144
  (xxxOfOption) => deepEquals_default(
1070
- get6(
1145
+ getByPath(
1071
1146
  xxxOfOption,
1072
1147
  [PROPERTIES_KEY, selectorField, DEFAULT_KEY],
1073
- get6(xxxOfOption, [PROPERTIES_KEY, selectorField, CONST_KEY])
1148
+ getByPath(xxxOfOption, [PROPERTIES_KEY, selectorField, CONST_KEY])
1074
1149
  ),
1075
1150
  data
1076
1151
  )
@@ -1081,21 +1156,18 @@ function findSelectedOptionInXxxOf(validator, rootSchema, schema, fallbackField,
1081
1156
  }
1082
1157
 
1083
1158
  // src/schema/getFromSchema.ts
1084
- import get7 from "lodash/get";
1085
- import has2 from "lodash/has";
1086
- import isEmpty3 from "lodash/isEmpty";
1087
1159
  function getFromSchemaInternal(validator, rootSchema, schema, path, experimental_customMergeAllOf) {
1088
1160
  let fieldSchema = schema;
1089
- if (has2(schema, REF_KEY)) {
1161
+ if (hasByPath(schema, REF_KEY)) {
1090
1162
  fieldSchema = retrieveSchema(validator, schema, rootSchema, void 0, experimental_customMergeAllOf);
1091
1163
  }
1092
- if (isEmpty3(path)) {
1164
+ if (path.length === 0) {
1093
1165
  return fieldSchema;
1094
1166
  }
1095
- const pathList = Array.isArray(path) ? [...path] : path.split(".");
1167
+ const pathList = Array.isArray(path) ? [...path] : toPath(path);
1096
1168
  const [part, ...nestedPath] = pathList;
1097
- if (part !== void 0 && part !== "" && has2(fieldSchema, part)) {
1098
- fieldSchema = get7(fieldSchema, part);
1169
+ if (part !== void 0 && part !== "" && hasByPath(fieldSchema, part)) {
1170
+ fieldSchema = getByPath(fieldSchema, part);
1099
1171
  return getFromSchemaInternal(
1100
1172
  validator,
1101
1173
  rootSchema,
@@ -1131,30 +1203,30 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1131
1203
  {},
1132
1204
  experimental_customMergeAllOf
1133
1205
  );
1134
- if (has3(parentField, ONE_OF_KEY)) {
1206
+ if (hasByPath(parentField, ONE_OF_KEY)) {
1135
1207
  parentField = findSelectedOptionInXxxOf(
1136
1208
  validator,
1137
1209
  rootSchema,
1138
1210
  parentField,
1139
1211
  fieldNameKey,
1140
1212
  ONE_OF_KEY,
1141
- get8(formData, subPath),
1213
+ getByPath(formData, subPath),
1142
1214
  experimental_customMergeAllOf
1143
1215
  );
1144
- } else if (has3(parentField, ANY_OF_KEY)) {
1216
+ } else if (hasByPath(parentField, ANY_OF_KEY)) {
1145
1217
  parentField = findSelectedOptionInXxxOf(
1146
1218
  validator,
1147
1219
  rootSchema,
1148
1220
  parentField,
1149
1221
  fieldNameKey,
1150
1222
  ANY_OF_KEY,
1151
- get8(formData, subPath),
1223
+ getByPath(formData, subPath),
1152
1224
  experimental_customMergeAllOf
1153
1225
  );
1154
1226
  }
1155
1227
  });
1156
1228
  }
1157
- if (has3(parentField, ONE_OF_KEY)) {
1229
+ if (hasByPath(parentField, ONE_OF_KEY)) {
1158
1230
  parentField = findSelectedOptionInXxxOf(
1159
1231
  validator,
1160
1232
  rootSchema,
@@ -1164,7 +1236,7 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1164
1236
  formData,
1165
1237
  experimental_customMergeAllOf
1166
1238
  );
1167
- } else if (has3(parentField, ANY_OF_KEY)) {
1239
+ } else if (hasByPath(parentField, ANY_OF_KEY)) {
1168
1240
  parentField = findSelectedOptionInXxxOf(
1169
1241
  validator,
1170
1242
  rootSchema,
@@ -1202,13 +1274,6 @@ function findFieldInSchema(validator, rootSchema, schema, path, formData = {}, e
1202
1274
  }
1203
1275
 
1204
1276
  // src/schema/getClosestMatchingOption.ts
1205
- import get9 from "lodash/get";
1206
- import has4 from "lodash/has";
1207
- import isNumber2 from "lodash/isNumber";
1208
- import isObject3 from "lodash/isObject";
1209
- import isString2 from "lodash/isString";
1210
- import reduce from "lodash/reduce";
1211
- import times2 from "lodash/times";
1212
1277
  var JUNK_OPTION = {
1213
1278
  type: "object",
1214
1279
  $id: JUNK_OPTION_ID,
@@ -1221,61 +1286,57 @@ var JUNK_OPTION = {
1221
1286
  function calculateIndexScore(validator, rootSchema, schema, formData, experimental_customMergeAllOf) {
1222
1287
  let totalScore = 0;
1223
1288
  if (schema) {
1224
- if (isObject3(schema.properties)) {
1225
- totalScore += reduce(
1226
- schema.properties,
1227
- (score, value, key) => {
1228
- const formValue = get9(formData, key);
1229
- if (typeof value === "boolean") {
1230
- return score;
1231
- }
1232
- if (has4(value, REF_KEY)) {
1233
- const newSchema = retrieveSchema(
1234
- validator,
1235
- value,
1236
- rootSchema,
1237
- formValue,
1238
- experimental_customMergeAllOf
1239
- );
1240
- return score + calculateIndexScore(
1241
- validator,
1242
- rootSchema,
1243
- newSchema,
1244
- formValue || {},
1245
- experimental_customMergeAllOf
1246
- );
1247
- }
1248
- if ((has4(value, ONE_OF_KEY) || has4(value, ANY_OF_KEY)) && formValue) {
1249
- const xxxOfKey = has4(value, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1250
- const discriminator = getDiscriminatorFieldFromSchema(value);
1251
- return score + getClosestMatchingOption(
1252
- validator,
1253
- rootSchema,
1254
- formValue,
1255
- get9(value, xxxOfKey),
1256
- -1,
1257
- discriminator,
1258
- experimental_customMergeAllOf
1259
- );
1260
- }
1261
- if (value.type === "object") {
1262
- const structureBoost = isObject3(formValue) ? 1 : 0;
1263
- return score + structureBoost + calculateIndexScore(validator, rootSchema, value, formValue, experimental_customMergeAllOf);
1264
- }
1265
- if (value.type === guessType(formValue)) {
1266
- let newScore = score + 1;
1267
- if (value.default) {
1268
- newScore += formValue === value.default ? 1 : -1;
1269
- } else if (value.const) {
1270
- newScore += formValue === value.const ? 1 : -1;
1271
- }
1272
- return newScore;
1273
- }
1289
+ if (isObject(schema.properties)) {
1290
+ totalScore += Object.entries(schema.properties).reduce((score, [key, value]) => {
1291
+ const formValue = formData?.[key];
1292
+ if (typeof value === "boolean") {
1274
1293
  return score;
1275
- },
1276
- 0
1277
- );
1278
- } else if (isString2(schema.type) && schema.type === guessType(formData)) {
1294
+ }
1295
+ if (hasByPath(value, REF_KEY)) {
1296
+ const newSchema = retrieveSchema(
1297
+ validator,
1298
+ value,
1299
+ rootSchema,
1300
+ formValue,
1301
+ experimental_customMergeAllOf
1302
+ );
1303
+ return score + calculateIndexScore(
1304
+ validator,
1305
+ rootSchema,
1306
+ newSchema,
1307
+ formValue || {},
1308
+ experimental_customMergeAllOf
1309
+ );
1310
+ }
1311
+ if ((hasByPath(value, ONE_OF_KEY) || hasByPath(value, ANY_OF_KEY)) && formValue) {
1312
+ const xxxOfKey = hasByPath(value, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1313
+ const discriminator = getDiscriminatorFieldFromSchema(value);
1314
+ return score + getClosestMatchingOption(
1315
+ validator,
1316
+ rootSchema,
1317
+ formValue,
1318
+ getByPath(value, xxxOfKey),
1319
+ -1,
1320
+ discriminator,
1321
+ experimental_customMergeAllOf
1322
+ );
1323
+ }
1324
+ if (value.type === "object") {
1325
+ const structureBoost = typeof formValue === "object" && formValue !== null ? 1 : 0;
1326
+ return score + structureBoost + calculateIndexScore(validator, rootSchema, value, formValue, experimental_customMergeAllOf);
1327
+ }
1328
+ if (value.type === guessType(formValue)) {
1329
+ let newScore = score + 1;
1330
+ if (value.default) {
1331
+ newScore += formValue === value.default ? 1 : -1;
1332
+ } else if (value.const) {
1333
+ newScore += formValue === value.const ? 1 : -1;
1334
+ }
1335
+ return newScore;
1336
+ }
1337
+ return score;
1338
+ }, 0);
1339
+ } else if (typeof schema.type === "string" && schema.type === guessType(formData)) {
1279
1340
  totalScore += 1;
1280
1341
  }
1281
1342
  }
@@ -1284,7 +1345,7 @@ function calculateIndexScore(validator, rootSchema, schema, formData, experiment
1284
1345
  function getClosestMatchingOption(validator, rootSchema, formData, options, selectedOption = -1, discriminatorField, experimental_customMergeAllOf) {
1285
1346
  const resolvedOptions = options.map((option) => resolveAllReferences(option, rootSchema, []));
1286
1347
  const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);
1287
- if (isNumber2(simpleDiscriminatorMatch)) {
1348
+ if (typeof simpleDiscriminatorMatch === "number") {
1288
1349
  return simpleDiscriminatorMatch;
1289
1350
  }
1290
1351
  const allValidIndexes = resolvedOptions.reduce((validList, option, index) => {
@@ -1299,7 +1360,7 @@ function getClosestMatchingOption(validator, rootSchema, formData, options, sele
1299
1360
  return allValidIndexes[0];
1300
1361
  }
1301
1362
  if (!allValidIndexes.length) {
1302
- times2(resolvedOptions.length, (i) => allValidIndexes.push(i));
1363
+ allValidIndexes.push(...resolvedOptions.keys());
1303
1364
  }
1304
1365
  const scoreCount = /* @__PURE__ */ new Set();
1305
1366
  const { bestIndex } = allValidIndexes.reduce(
@@ -1321,16 +1382,11 @@ function getClosestMatchingOption(validator, rootSchema, formData, options, sele
1321
1382
  return bestIndex;
1322
1383
  }
1323
1384
 
1324
- // src/schema/getDefaultFormState.ts
1325
- import get12 from "lodash/get";
1326
- import isEmpty4 from "lodash/isEmpty";
1327
-
1328
1385
  // src/constIsAjvDataReference.ts
1329
- import isString3 from "lodash/isString";
1330
1386
  function constIsAjvDataReference(schema) {
1331
1387
  const schemaConst = schema[CONST_KEY];
1332
1388
  const schemaType = getSchemaType(schema);
1333
- return isObject(schemaConst) && isString3(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
1389
+ return isObject(schemaConst) && typeof schemaConst?.$data === "string" && schemaType !== "object" && schemaType !== "array";
1334
1390
  }
1335
1391
 
1336
1392
  // src/isConstant.ts
@@ -1344,8 +1400,6 @@ function isFixedItems(schema) {
1344
1400
  }
1345
1401
 
1346
1402
  // src/mergeDefaultsWithFormData.ts
1347
- import get10 from "lodash/get";
1348
- import isNil from "lodash/isNil";
1349
1403
  function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults = false, defaultSupercedesUndefined = false, overrideFormDataWithDefaults = false) {
1350
1404
  if (Array.isArray(formData)) {
1351
1405
  const defaultsArray = Array.isArray(defaults) ? defaults : [];
@@ -1370,23 +1424,25 @@ function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults =
1370
1424
  }
1371
1425
  if (isObject(formData)) {
1372
1426
  const acc = Object.assign({}, defaults);
1373
- return Object.keys(formData).reduce((accumulator, key) => {
1374
- const keyValue = get10(formData, key);
1375
- const keyExistsInDefaults = isObject(defaults) && key in defaults;
1376
- const keyExistsInFormData = key in formData;
1377
- const keyDefault = get10(defaults, key) ?? {};
1378
- const defaultValueIsNestedObject = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v));
1379
- const keyDefaultIsObject = keyExistsInDefaults && isObject(get10(defaults, key));
1427
+ const formDataObj = formData;
1428
+ const defaultsObj = isObject(defaults) ? defaults : void 0;
1429
+ return Object.keys(formDataObj).reduce((accumulator, key) => {
1430
+ const keyValue = formDataObj[key];
1431
+ const keyExistsInDefaults = defaultsObj !== void 0 && key in defaultsObj;
1432
+ const keyExistsInFormData = key in formDataObj;
1433
+ const keyDefault = defaultsObj?.[key] ?? {};
1434
+ const defaultValueNeedsDeepMerge = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v) || Array.isArray(v));
1435
+ const keyDefaultIsObject = keyExistsInDefaults && isObject(defaultsObj?.[key]);
1380
1436
  const keyHasFormDataObject = keyExistsInFormData && isObject(keyValue);
1381
- if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueIsNestedObject) {
1437
+ if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueNeedsDeepMerge) {
1382
1438
  accumulator[key] = {
1383
- ...get10(defaults, key),
1439
+ ...defaultsObj?.[key],
1384
1440
  ...keyValue
1385
1441
  };
1386
1442
  return accumulator;
1387
1443
  }
1388
1444
  accumulator[key] = mergeDefaultsWithFormData(
1389
- get10(defaults, key),
1445
+ defaultsObj?.[key],
1390
1446
  keyValue,
1391
1447
  mergeExtraArrayDefaults,
1392
1448
  defaultSupercedesUndefined,
@@ -1397,7 +1453,7 @@ function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults =
1397
1453
  return acc;
1398
1454
  }, acc);
1399
1455
  }
1400
- if (defaultSupercedesUndefined && (!(defaults === void 0) && isNil(formData) || typeof formData === "number" && Number.isNaN(formData)) || overrideFormDataWithDefaults && !isNil(formData)) {
1456
+ if (defaultSupercedesUndefined && (!(defaults === void 0) && formData == null || typeof formData === "number" && Number.isNaN(formData)) || overrideFormDataWithDefaults && formData != null) {
1401
1457
  return defaults;
1402
1458
  }
1403
1459
  return formData;
@@ -1430,9 +1486,6 @@ function mergeObjects(obj1, obj2, concatArrays = false) {
1430
1486
  );
1431
1487
  }
1432
1488
 
1433
- // src/optionsList.ts
1434
- import get11 from "lodash/get";
1435
-
1436
1489
  // src/toConstant.ts
1437
1490
  function toConstant(schema) {
1438
1491
  if (ENUM_KEY in schema && Array.isArray(schema.enum) && schema.enum.length === 1) {
@@ -1495,8 +1548,8 @@ function optionsList(schema, uiSchema) {
1495
1548
  let value;
1496
1549
  let label = title;
1497
1550
  if (selectorField) {
1498
- const innerSchema = get11(aSchema, [PROPERTIES_KEY, selectorField], {});
1499
- value = get11(innerSchema, DEFAULT_KEY, get11(innerSchema, CONST_KEY));
1551
+ const innerSchema = getPropertySchema(aSchema, selectorField);
1552
+ value = getByPath(innerSchema, DEFAULT_KEY, getByPath(innerSchema, CONST_KEY));
1500
1553
  label = label ?? innerSchema?.title ?? aSchema.title ?? String(value);
1501
1554
  } else {
1502
1555
  value = toConstant(aSchema);
@@ -1549,9 +1602,18 @@ function getInnerSchemaForArrayItem(schema, additionalItems = 0 /* Ignore */, id
1549
1602
  }
1550
1603
  return {};
1551
1604
  }
1605
+ function hasContent(value) {
1606
+ if (typeof value === "string" || Array.isArray(value)) {
1607
+ return value.length > 0;
1608
+ }
1609
+ if (typeof value === "object" && value !== null) {
1610
+ return Object.keys(value).length > 0;
1611
+ }
1612
+ return false;
1613
+ }
1552
1614
  function computeDefaultBasedOnSchemaTypeAndDefaults(schema, computedDefault) {
1553
1615
  const { default: schemaDefault, type } = schema;
1554
- const shouldReturnNullAsDefault = Array.isArray(type) && type.includes("null") && isEmpty4(computedDefault) && schemaDefault === null;
1616
+ const shouldReturnNullAsDefault = Array.isArray(type) && type.includes("null") && !hasContent(computedDefault) && schemaDefault === null;
1555
1617
  return shouldReturnNullAsDefault ? null : computedDefault;
1556
1618
  }
1557
1619
  function maybeAddDefaultToObject(acc, key, computedDefault, includeUndefinedValues, isParentRequired, requiredFields = [], experimental_defaultFormStateBehavior = {}, isConst = false, isNullType = false) {
@@ -1559,17 +1621,17 @@ function maybeAddDefaultToObject(acc, key, computedDefault, includeUndefinedValu
1559
1621
  if (includeUndefinedValues === true || isConst) {
1560
1622
  acc[key] = computedDefault;
1561
1623
  } else if (includeUndefinedValues === "excludeObjectChildren") {
1562
- if (isNullType && computedDefault !== void 0 || !isObject(computedDefault) || !isEmpty4(computedDefault)) {
1624
+ if (isNullType && computedDefault !== void 0 || !isObject(computedDefault) || Object.keys(computedDefault).length > 0) {
1563
1625
  acc[key] = computedDefault;
1564
1626
  }
1565
1627
  } else if (emptyObjectFields !== "skipDefaults") {
1566
1628
  const isSelfOrParentRequired = isParentRequired === void 0 ? requiredFields.includes(key) : isParentRequired;
1567
1629
  if (isObject(computedDefault)) {
1568
1630
  if (emptyObjectFields === "skipEmptyDefaults") {
1569
- if (!isEmpty4(computedDefault)) {
1631
+ if (Object.keys(computedDefault).length > 0) {
1570
1632
  acc[key] = computedDefault;
1571
1633
  }
1572
- } else if ((!isEmpty4(computedDefault) || requiredFields.includes(key)) && (isSelfOrParentRequired || emptyObjectFields !== "populateRequiredDefaults")) {
1634
+ } else if ((Object.keys(computedDefault).length > 0 || requiredFields.includes(key)) && (isSelfOrParentRequired || emptyObjectFields !== "populateRequiredDefaults")) {
1573
1635
  acc[key] = computedDefault;
1574
1636
  }
1575
1637
  } else if (
@@ -1619,7 +1681,7 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
1619
1681
  updatedRecurseList = _recurseList.concat(refName);
1620
1682
  schemaToCompute = findSchemaDefinition(refName, rootSchema);
1621
1683
  }
1622
- const hasNoExistingData = rawFormData === void 0 || isObject(rawFormData) && isEmpty4(rawFormData);
1684
+ const hasNoExistingData = rawFormData === void 0 || isObject(rawFormData) && Object.keys(rawFormData).length === 0;
1623
1685
  if (schemaToCompute && !defaults && hasNoExistingData) {
1624
1686
  defaults = schema.default;
1625
1687
  }
@@ -1752,13 +1814,13 @@ function ensureFormDataMatchingSchema(validator, schema, rootSchema, formData, e
1752
1814
  } else if (isObject(validFormData) && isObject(schemaToMatch.properties)) {
1753
1815
  validFormData = Object.keys(schemaToMatch.properties).reduce(
1754
1816
  (acc, key) => {
1755
- const propertySchema = get12(schemaToMatch, [PROPERTIES_KEY, key], {});
1817
+ const propertySchema = getPropertySchema(schemaToMatch, key);
1756
1818
  if (key in acc && (shouldRetrieveAllOf || isObject(propertySchema) && ALL_OF_KEY in propertySchema)) {
1757
1819
  acc[key] = ensureFormDataMatchingSchema(
1758
1820
  validator,
1759
1821
  propertySchema,
1760
1822
  rootSchema,
1761
- get12(acc, key),
1823
+ acc[key],
1762
1824
  experimental_defaultFormStateBehavior,
1763
1825
  experimental_customMergeAllOf
1764
1826
  );
@@ -1789,7 +1851,7 @@ function getObjectDefaults(validator, rawSchema, {
1789
1851
  const parentConst = retrievedSchema[CONST_KEY];
1790
1852
  const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(
1791
1853
  (acc, key) => {
1792
- const propertySchema = get12(retrievedSchema, [PROPERTIES_KEY, key], {});
1854
+ const propertySchema = getPropertySchema(retrievedSchema, key);
1793
1855
  const hasParentConst = isObject(parentConst) && parentConst[key] !== void 0;
1794
1856
  const hasConst = (isObject(propertySchema) && CONST_KEY in propertySchema || hasParentConst) && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(propertySchema);
1795
1857
  const computedDefault = computeDefaults(validator, propertySchema, {
@@ -1798,8 +1860,8 @@ function getObjectDefaults(validator, rawSchema, {
1798
1860
  experimental_defaultFormStateBehavior,
1799
1861
  experimental_customMergeAllOf,
1800
1862
  includeUndefinedValues: includeUndefinedValues === true,
1801
- parentDefaults: get12(defaults, [key]),
1802
- rawFormData: get12(formData, [key]),
1863
+ parentDefaults: getByPath(defaults, key),
1864
+ rawFormData: getByPath(formData, key),
1803
1865
  required: retrievedSchema.required?.includes(key),
1804
1866
  shouldMergeDefaultsIntoFormData,
1805
1867
  initialDefaultsGenerated
@@ -1821,24 +1883,24 @@ function getObjectDefaults(validator, rawSchema, {
1821
1883
  );
1822
1884
  if (retrievedSchema.additionalProperties && !initialDefaultsGenerated) {
1823
1885
  const additionalPropertiesSchema = isObject(retrievedSchema.additionalProperties) ? retrievedSchema.additionalProperties : {};
1824
- const keys2 = /* @__PURE__ */ new Set();
1886
+ const keys = /* @__PURE__ */ new Set();
1825
1887
  const formDataRequired = [];
1826
1888
  Object.keys(formData).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => {
1827
- keys2.add(key);
1889
+ keys.add(key);
1828
1890
  formDataRequired.push(key);
1829
1891
  });
1830
1892
  if (isObject(defaults) && formDataRequired.length === 0) {
1831
- Object.keys(defaults).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => keys2.add(key));
1893
+ Object.keys(defaults).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => keys.add(key));
1832
1894
  }
1833
- keys2.forEach((key) => {
1895
+ keys.forEach((key) => {
1834
1896
  const computedDefault = computeDefaults(validator, additionalPropertiesSchema, {
1835
1897
  rootSchema,
1836
1898
  _recurseList,
1837
1899
  experimental_defaultFormStateBehavior,
1838
1900
  experimental_customMergeAllOf,
1839
1901
  includeUndefinedValues: includeUndefinedValues === true,
1840
- parentDefaults: get12(defaults, [key]),
1841
- rawFormData: get12(formData, [key]),
1902
+ parentDefaults: getByPath(defaults, key),
1903
+ rawFormData: getByPath(formData, key),
1842
1904
  required: retrievedSchema.required?.includes(key),
1843
1905
  shouldMergeDefaultsIntoFormData,
1844
1906
  initialDefaultsGenerated
@@ -1906,7 +1968,7 @@ function getArrayDefaults(validator, rawSchema, {
1906
1968
  experimental_defaultFormStateBehavior,
1907
1969
  experimental_customMergeAllOf,
1908
1970
  rawFormData: item,
1909
- parentDefaults: get12(defaults, [idx]),
1971
+ parentDefaults: getByPath(defaults, idx),
1910
1972
  required,
1911
1973
  shouldMergeDefaultsIntoFormData,
1912
1974
  initialDefaultsGenerated
@@ -1958,6 +2020,12 @@ function getDefaultBasedOnSchemaType(validator, rawSchema, computeDefaultsProps
1958
2020
  case "array": {
1959
2021
  return getArrayDefaults(validator, rawSchema, computeDefaultsProps, defaults);
1960
2022
  }
2023
+ case "boolean": {
2024
+ if (computeDefaultsProps.required && defaults === void 0) {
2025
+ return false;
2026
+ }
2027
+ return void 0;
2028
+ }
1961
2029
  default:
1962
2030
  return void 0;
1963
2031
  }
@@ -2060,22 +2128,30 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
2060
2128
  }
2061
2129
 
2062
2130
  // src/schema/omitExtraData.ts
2063
- import get13 from "lodash/get";
2064
- import isEmpty5 from "lodash/isEmpty";
2065
- import isNil2 from "lodash/isNil";
2066
- import pick from "lodash/pick";
2067
2131
  function getUsedFormData(formData, fields) {
2068
2132
  if (fields.length === 0 && typeof formData !== "object") {
2069
2133
  return formData;
2070
2134
  }
2071
- const data = pick(formData, fields);
2135
+ const data = {};
2136
+ fields.forEach((field) => {
2137
+ const path = Array.isArray(field) ? field : toPath(field);
2138
+ if (hasByPath(formData, path)) {
2139
+ setByPath(data, path, getByPath(formData, path));
2140
+ }
2141
+ });
2072
2142
  if (Array.isArray(formData)) {
2073
2143
  return Object.keys(data).map((key) => data[key]);
2074
2144
  }
2075
2145
  return data;
2076
2146
  }
2077
2147
  function getFieldNames(pathSchema, formData) {
2078
- const formValueHasData = (value, isLeaf) => typeof value !== "object" || isEmpty5(value) || isLeaf && !isEmpty5(value);
2148
+ const formValueHasData = (value, isLeaf) => {
2149
+ if (typeof value !== "object" || value === null) {
2150
+ return true;
2151
+ }
2152
+ const isEmptyValue = Array.isArray(value) ? value.length === 0 : Object.keys(value).length === 0;
2153
+ return isEmptyValue || isLeaf;
2154
+ };
2079
2155
  const getAllPaths = (_obj, acc = [], paths = [[]]) => {
2080
2156
  const objKeys = Object.keys(_obj);
2081
2157
  objKeys.forEach((key) => {
@@ -2089,7 +2165,7 @@ function getFieldNames(pathSchema, formData) {
2089
2165
  }
2090
2166
  } else if (key === NAME_KEY && data !== "") {
2091
2167
  paths.forEach((path) => {
2092
- const formValue = get13(formData, path);
2168
+ const formValue = getByPath(formData, path);
2093
2169
  const isLeaf = objKeys.length === 1;
2094
2170
  if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
2095
2171
  acc.push(path);
@@ -2102,7 +2178,7 @@ function getFieldNames(pathSchema, formData) {
2102
2178
  return getAllPaths(pathSchema);
2103
2179
  }
2104
2180
  function isValueEmpty(value) {
2105
- if (isNil2(value) || value === "") {
2181
+ if (value == null || value === "") {
2106
2182
  return true;
2107
2183
  }
2108
2184
  if (Array.isArray(value)) {
@@ -2124,19 +2200,17 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2124
2200
  return isObject(schemaDef);
2125
2201
  }
2126
2202
  function handleObject(childSchema, source, target) {
2127
- const { properties, additionalProperties, patternProperties, propertyNames } = childSchema;
2203
+ const { properties, additionalProperties, patternProperties } = childSchema;
2128
2204
  const requiredSet = new Set(childSchema.required ?? []);
2129
2205
  function setProperty(key, schemaDef, value, required = false) {
2130
- const v = omit2(schemaDef, value, target[key]);
2206
+ const v = omit(schemaDef, value, target[key]);
2131
2207
  if (!required && isObject(v)) {
2132
2208
  let sd = isSchemaObj(schemaDef) ? schemaDef : {};
2133
2209
  if (sd.$ref !== void 0) {
2134
2210
  sd = findSchemaDefinition(sd.$ref, rootSchema);
2135
2211
  }
2136
2212
  const innerRequired = new Set(sd.required ?? []);
2137
- const shouldDrop = Object.entries(v).every(
2138
- ([k, val]) => !innerRequired.has(k) && isValueEmpty(val)
2139
- );
2213
+ const shouldDrop = Object.entries(v).every(([k, val]) => !innerRequired.has(k) && isValueEmpty(val));
2140
2214
  if (shouldDrop) {
2141
2215
  return;
2142
2216
  }
@@ -2184,31 +2258,29 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2184
2258
  }
2185
2259
  }
2186
2260
  }
2187
- if (propertyNames !== void 0) {
2188
- for (const [key, value] of Object.entries(source)) {
2189
- target[key] = value;
2190
- }
2191
- }
2192
2261
  return target;
2193
2262
  }
2194
2263
  function handleArray(childSchema, source, target) {
2195
2264
  const { items, additionalItems } = childSchema;
2196
- if (items !== void 0) {
2197
- if (Array.isArray(items)) {
2198
- for (let i = 0; i < items.length; i += 1) {
2199
- target.push(omit2(items[i], source[i]));
2200
- }
2201
- } else {
2202
- for (let i = 0; i < source.length; i += 1) {
2203
- target.push(omit2(items, source[i]));
2204
- }
2265
+ if (Array.isArray(items)) {
2266
+ const tupleLength = Math.min(items.length, source.length);
2267
+ let i = 0;
2268
+ for (; i < tupleLength; i += 1) {
2269
+ target[i] = omit(items[i], source[i]);
2205
2270
  }
2206
- }
2207
- if (additionalItems) {
2208
- for (let i = target.length; i < source.length; i += 1) {
2209
- target.push(omit2(additionalItems, source[i]));
2271
+ if (!additionalItems) {
2272
+ target.length = tupleLength;
2273
+ return target;
2274
+ }
2275
+ for (; i < source.length; i += 1) {
2276
+ target[i] = omit(additionalItems, source[i]);
2277
+ }
2278
+ } else {
2279
+ for (let i = 0; i < source.length; i += 1) {
2280
+ target[i] = omit(items, source[i]);
2210
2281
  }
2211
2282
  }
2283
+ target.length = source.length;
2212
2284
  return target;
2213
2285
  }
2214
2286
  function handleConditions(childSchema, source, target) {
@@ -2218,7 +2290,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2218
2290
  }
2219
2291
  const isThenBranch = isSchemaObj(condition) ? validator.isValid(condition, source, rootSchema) : condition;
2220
2292
  const branch = isThenBranch ? then : otherwise;
2221
- return branch === void 0 ? target : omit2(branch, source, target);
2293
+ return branch === void 0 ? target : omit(branch, source, target, false);
2222
2294
  }
2223
2295
  function handleOneOf(oneOf, childSchema, source, target) {
2224
2296
  if (!Array.isArray(oneOf) || isSelect(validator, childSchema, rootSchema, experimental_customMergeAllOf)) {
@@ -2236,7 +2308,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2236
2308
  );
2237
2309
  const winning = oneOf[bestIndex];
2238
2310
  const resolved = isObject(winning) ? resolveAllReferences(winning, rootSchema, []) : scoringOptions[bestIndex];
2239
- return omit2(resolved, source, target);
2311
+ return omit(resolved, source, target, false);
2240
2312
  }
2241
2313
  function handleAnyOf(childSchema, source, target) {
2242
2314
  const { anyOf } = childSchema;
@@ -2246,7 +2318,7 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2246
2318
  if (source === void 0 || Array.isArray(source) && source.length === 0 || isObject(source) && Object.keys(source).length === 0) {
2247
2319
  let result = target;
2248
2320
  for (const branch of anyOf) {
2249
- result = omit2(branch, source, result);
2321
+ result = omit(branch, source, result, false);
2250
2322
  }
2251
2323
  return result;
2252
2324
  }
@@ -2260,29 +2332,29 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2260
2332
  let result = target;
2261
2333
  for (const [key, deps] of Object.entries(dependencies)) {
2262
2334
  if (key in source && !Array.isArray(deps)) {
2263
- result = omit2(deps, source, result);
2335
+ result = omit(deps, source, result, false);
2264
2336
  }
2265
2337
  }
2266
2338
  return result;
2267
2339
  }
2268
- function omit2(schemaDef, source, target) {
2340
+ function omit(schemaDef, source, target, useSourceAsFallback = true) {
2269
2341
  if (source === void 0 || schemaDef === false) {
2270
2342
  return void 0;
2271
2343
  }
2272
- if (schemaDef === true || isEmpty5(schemaDef)) {
2273
- return source;
2344
+ if (schemaDef === true || !schemaDef || Object.keys(schemaDef).length === 0) {
2345
+ return target ?? (useSourceAsFallback ? source : void 0);
2274
2346
  }
2275
2347
  let localSchema = schemaDef;
2276
2348
  const { $ref: ref, allOf } = localSchema;
2277
2349
  if (ref !== void 0) {
2278
- return omit2(findSchemaDefinition(ref, rootSchema), source, target);
2350
+ return omit(findSchemaDefinition(ref, rootSchema), source, target, useSourceAsFallback);
2279
2351
  }
2280
2352
  if (allOf) {
2281
2353
  localSchema = doMergeAllOf(localSchema, experimental_customMergeAllOf);
2282
2354
  const remainingAllOf = localSchema.allOf;
2283
2355
  if (remainingAllOf) {
2284
2356
  for (let i = 0; i < remainingAllOf.length; i++) {
2285
- target = omit2(remainingAllOf[i], source, target);
2357
+ target = omit(remainingAllOf[i], source, target, false);
2286
2358
  }
2287
2359
  }
2288
2360
  }
@@ -2297,18 +2369,27 @@ function omitExtraData(validator, schema, rootSchema = {}, formData, experimenta
2297
2369
  if (!Array.isArray(source)) {
2298
2370
  return void 0;
2299
2371
  }
2300
- filtered = handleArray(localSchema, source, Array.isArray(filtered) ? filtered : []);
2301
- } else if (filtered === void 0) {
2302
- filtered = source;
2372
+ if (localSchema.items !== void 0) {
2373
+ filtered = handleArray(localSchema, source, Array.isArray(filtered) ? filtered : []);
2374
+ }
2303
2375
  }
2304
- return handleDependencies(localSchema, source, handleConditions(localSchema, source, filtered));
2376
+ const afterConditions = handleConditions(localSchema, source, filtered);
2377
+ if (localSchema.additionalProperties === false && isObjectValue(afterConditions)) {
2378
+ const knownKeys = new Set(Object.keys(localSchema.properties ?? {}));
2379
+ const patterns = localSchema.patternProperties ? Object.keys(localSchema.patternProperties).map((p) => new RegExp(p)) : [];
2380
+ for (const key of Object.keys(afterConditions)) {
2381
+ if (!knownKeys.has(key) && !patterns.some((re) => re.test(key))) {
2382
+ delete afterConditions[key];
2383
+ }
2384
+ }
2385
+ }
2386
+ const result = handleDependencies(localSchema, source, afterConditions);
2387
+ return result ?? (useSourceAsFallback ? source : void 0);
2305
2388
  }
2306
- return omit2(schema, formData);
2389
+ return omit(schema, formData);
2307
2390
  }
2308
2391
 
2309
2392
  // src/schema/sanitizeDataForNewSchema.ts
2310
- import get14 from "lodash/get";
2311
- import has5 from "lodash/has";
2312
2393
  var NO_VALUE = /* @__PURE__ */ Symbol("no Value");
2313
2394
  function enumValuesForSchema(schema) {
2314
2395
  if (Array.isArray(schema.enum)) {
@@ -2331,7 +2412,7 @@ function replacementForInvalidEnumValue(schema, formValue) {
2331
2412
  if (!enumValues || enumValues.some((value) => deepEquals_default(value, formValue))) {
2332
2413
  return NO_VALUE;
2333
2414
  }
2334
- const defaultValue = get14(schema, DEFAULT_KEY, NO_VALUE);
2415
+ const defaultValue = getByPath(schema, DEFAULT_KEY, NO_VALUE);
2335
2416
  if (defaultValue !== NO_VALUE && enumValues.some((value) => deepEquals_default(value, defaultValue))) {
2336
2417
  return defaultValue;
2337
2418
  }
@@ -2339,23 +2420,25 @@ function replacementForInvalidEnumValue(schema, formValue) {
2339
2420
  }
2340
2421
  function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, data = {}, experimental_customMergeAllOf) {
2341
2422
  let newFormData;
2342
- if (has5(newSchema, PROPERTIES_KEY)) {
2423
+ const newProperties = newSchema?.[PROPERTIES_KEY];
2424
+ if (newProperties) {
2343
2425
  const removeOldSchemaData = {};
2344
- if (has5(oldSchema, PROPERTIES_KEY)) {
2345
- const properties = get14(oldSchema, PROPERTIES_KEY, {});
2346
- Object.keys(properties).forEach((key) => {
2347
- if (has5(data, key)) {
2426
+ const oldProperties = oldSchema?.[PROPERTIES_KEY];
2427
+ if (oldProperties) {
2428
+ Object.keys(oldProperties).forEach((key) => {
2429
+ if (hasByPath(data, key)) {
2348
2430
  removeOldSchemaData[key] = void 0;
2349
2431
  }
2350
2432
  });
2351
2433
  }
2352
- const keys2 = Object.keys(get14(newSchema, PROPERTIES_KEY, {}));
2434
+ const keys = Object.keys(newProperties);
2353
2435
  const nestedData = {};
2354
- keys2.forEach((key) => {
2355
- const formValue = get14(data, key);
2356
- let oldKeyedSchema = get14(oldSchema, [PROPERTIES_KEY, key], {});
2357
- let newKeyedSchema = get14(newSchema, [PROPERTIES_KEY, key], {});
2358
- if (has5(oldKeyedSchema, REF_KEY)) {
2436
+ keys.forEach((key) => {
2437
+ const formValue = data?.[key];
2438
+ const isNewProperty = !hasByPath(oldSchema, [PROPERTIES_KEY, key]);
2439
+ let oldKeyedSchema = getPropertySchema(oldSchema, key);
2440
+ let newKeyedSchema = getPropertySchema(newSchema, key);
2441
+ if (hasByPath(oldKeyedSchema, REF_KEY)) {
2359
2442
  oldKeyedSchema = retrieveSchema(
2360
2443
  validator,
2361
2444
  oldKeyedSchema,
@@ -2364,7 +2447,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2364
2447
  experimental_customMergeAllOf
2365
2448
  );
2366
2449
  }
2367
- if (has5(newKeyedSchema, REF_KEY)) {
2450
+ if (hasByPath(newKeyedSchema, REF_KEY)) {
2368
2451
  newKeyedSchema = retrieveSchema(
2369
2452
  validator,
2370
2453
  newKeyedSchema,
@@ -2373,10 +2456,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2373
2456
  experimental_customMergeAllOf
2374
2457
  );
2375
2458
  }
2376
- const oldSchemaTypeForKey = get14(oldKeyedSchema, "type");
2377
- const newSchemaTypeForKey = get14(newKeyedSchema, "type");
2459
+ const oldSchemaTypeForKey = oldKeyedSchema.type;
2460
+ const newSchemaTypeForKey = newKeyedSchema.type;
2378
2461
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
2379
- if (has5(removeOldSchemaData, key)) {
2462
+ if (key in removeOldSchemaData) {
2380
2463
  delete removeOldSchemaData[key];
2381
2464
  }
2382
2465
  if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
@@ -2384,7 +2467,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2384
2467
  validator,
2385
2468
  rootSchema,
2386
2469
  newKeyedSchema,
2387
- oldKeyedSchema,
2470
+ isNewProperty && newSchemaTypeForKey === "array" ? newKeyedSchema : oldKeyedSchema,
2388
2471
  formValue,
2389
2472
  experimental_customMergeAllOf
2390
2473
  );
@@ -2392,21 +2475,21 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2392
2475
  nestedData[key] = itemData;
2393
2476
  }
2394
2477
  } else {
2395
- const newOptionDefault = get14(newKeyedSchema, DEFAULT_KEY, NO_VALUE);
2396
- const oldOptionDefault = get14(oldKeyedSchema, DEFAULT_KEY, NO_VALUE);
2478
+ const newOptionDefault = getByPath(newKeyedSchema, DEFAULT_KEY, NO_VALUE);
2479
+ const oldOptionDefault = getByPath(oldKeyedSchema, DEFAULT_KEY, NO_VALUE);
2397
2480
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
2398
- if (oldOptionDefault === formValue) {
2481
+ if (isNewProperty && formValue === void 0 || oldOptionDefault === formValue) {
2399
2482
  removeOldSchemaData[key] = newOptionDefault;
2400
- } else if (get14(newKeyedSchema, "readOnly") === true) {
2483
+ } else if (newKeyedSchema.readOnly === true) {
2401
2484
  removeOldSchemaData[key] = void 0;
2402
2485
  }
2403
2486
  }
2404
- const newOptionConst = get14(newKeyedSchema, CONST_KEY, NO_VALUE);
2405
- const oldOptionConst = get14(oldKeyedSchema, CONST_KEY, NO_VALUE);
2487
+ const newOptionConst = getByPath(newKeyedSchema, CONST_KEY, NO_VALUE);
2488
+ const oldOptionConst = getByPath(oldKeyedSchema, CONST_KEY, NO_VALUE);
2406
2489
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
2407
2490
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
2408
2491
  }
2409
- if (has5(data, key)) {
2492
+ if (hasByPath(data, key)) {
2410
2493
  const enumReplacement = replacementForInvalidEnumValue(newKeyedSchema, formValue);
2411
2494
  if (enumReplacement !== NO_VALUE) {
2412
2495
  removeOldSchemaData[key] = enumReplacement;
@@ -2420,11 +2503,11 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2420
2503
  ...removeOldSchemaData,
2421
2504
  ...nestedData
2422
2505
  };
2423
- } else if (get14(oldSchema, "type") === "array" && get14(newSchema, "type") === "array" && Array.isArray(data)) {
2424
- let oldSchemaItems = get14(oldSchema, "items");
2425
- let newSchemaItems = get14(newSchema, "items");
2506
+ } else if (oldSchema?.type === "array" && newSchema?.type === "array" && Array.isArray(data)) {
2507
+ let oldSchemaItems = oldSchema.items;
2508
+ let newSchemaItems = newSchema.items;
2426
2509
  if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
2427
- if (has5(oldSchemaItems, REF_KEY)) {
2510
+ if (hasByPath(oldSchemaItems, REF_KEY)) {
2428
2511
  oldSchemaItems = retrieveSchema(
2429
2512
  validator,
2430
2513
  oldSchemaItems,
@@ -2433,7 +2516,7 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2433
2516
  experimental_customMergeAllOf
2434
2517
  );
2435
2518
  }
2436
- if (has5(newSchemaItems, REF_KEY)) {
2519
+ if (hasByPath(newSchemaItems, REF_KEY)) {
2437
2520
  newSchemaItems = retrieveSchema(
2438
2521
  validator,
2439
2522
  newSchemaItems,
@@ -2442,10 +2525,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2442
2525
  experimental_customMergeAllOf
2443
2526
  );
2444
2527
  }
2445
- const oldSchemaType = get14(oldSchemaItems, "type");
2446
- const newSchemaType = get14(newSchemaItems, "type");
2528
+ const oldSchemaType = getByPath(oldSchemaItems, "type");
2529
+ const newSchemaType = getByPath(newSchemaItems, "type");
2447
2530
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
2448
- const maxItems = get14(newSchema, "maxItems", -1);
2531
+ const maxItems = newSchema.maxItems ?? -1;
2449
2532
  if (newSchemaType === "object") {
2450
2533
  newFormData = data.reduce((newValue, aValue) => {
2451
2534
  const itemValue = sanitizeDataForNewSchema(
@@ -2475,9 +2558,6 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
2475
2558
  }
2476
2559
 
2477
2560
  // src/schema/toPathSchema.ts
2478
- import get15 from "lodash/get";
2479
- import isObject4 from "lodash/isObject";
2480
- import set2 from "lodash/set";
2481
2561
  function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
2482
2562
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
2483
2563
  const innerSchema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
@@ -2524,9 +2604,9 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
2524
2604
  };
2525
2605
  }
2526
2606
  if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
2527
- set2(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2528
- const additionalSchema = isObject4(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2529
- const definedProperties = get15(schema, PROPERTIES_KEY, {});
2607
+ setByPath(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2608
+ const additionalSchema = isObject(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2609
+ const definedProperties = schema[PROPERTIES_KEY] ?? {};
2530
2610
  for (const key of Object.keys(formData ?? {})) {
2531
2611
  if (!(key in definedProperties)) {
2532
2612
  pathSchema[key] = toPathSchemaInternal(
@@ -2534,7 +2614,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
2534
2614
  additionalSchema,
2535
2615
  `${name}.${key}`,
2536
2616
  rootSchema,
2537
- get15(formData, [key]),
2617
+ getByPath(formData, key),
2538
2618
  _recurseList,
2539
2619
  experimental_customMergeAllOf
2540
2620
  );
@@ -2584,7 +2664,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
2584
2664
  }
2585
2665
  } else if (PROPERTIES_KEY in schema) {
2586
2666
  for (const property in schema.properties) {
2587
- const field = get15(schema, [PROPERTIES_KEY, property], {});
2667
+ const field = getPropertySchema(schema, property);
2588
2668
  pathSchema[property] = toPathSchemaInternal(
2589
2669
  validator,
2590
2670
  field,
@@ -2592,7 +2672,7 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
2592
2672
  rootSchema,
2593
2673
  // It's possible that formData is not an object -- this can happen if an
2594
2674
  // array item has just been added, but not populated with data yet
2595
- get15(formData, [property]),
2675
+ getByPath(formData, property),
2596
2676
  _recurseList,
2597
2677
  experimental_customMergeAllOf
2598
2678
  );
@@ -2606,6 +2686,10 @@ function toPathSchema(validator, schema, name = "", rootSchema, formData, experi
2606
2686
 
2607
2687
  // src/createSchemaUtils.ts
2608
2688
  var SchemaUtils = class {
2689
+ rootSchema;
2690
+ validator;
2691
+ experimental_defaultFormStateBehavior;
2692
+ experimental_customMergeAllOf;
2609
2693
  /** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
2610
2694
  *
2611
2695
  * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
@@ -2615,7 +2699,7 @@ var SchemaUtils = class {
2615
2699
  */
2616
2700
  constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
2617
2701
  if (rootSchema?.[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
2618
- this.rootSchema = makeAllReferencesAbsolute(rootSchema, get16(rootSchema, ID_KEY, "#"));
2702
+ this.rootSchema = makeAllReferencesAbsolute(rootSchema, rootSchema[ID_KEY] ?? "#");
2619
2703
  } else {
2620
2704
  this.rootSchema = rootSchema;
2621
2705
  }
@@ -3006,8 +3090,8 @@ function enumOptionsIndexForValue(value, allEnumOptions = [], multiple = false)
3006
3090
 
3007
3091
  // src/enumOptionSelectedValue.ts
3008
3092
  function enumOptionSelectedValue(value, enumOptions, multiple, format = "indexed", emptyValue) {
3009
- const isEmpty9 = typeof value === "undefined" || multiple && Array.isArray(value) && value.length < 1 || !multiple && value === emptyValue;
3010
- if (isEmpty9) {
3093
+ const isEmpty = typeof value === "undefined" || multiple && Array.isArray(value) && value.length < 1 || !multiple && value === emptyValue;
3094
+ if (isEmpty) {
3011
3095
  return emptyValue;
3012
3096
  }
3013
3097
  if (format === "realValue") {
@@ -3018,10 +3102,9 @@ function enumOptionSelectedValue(value, enumOptions, multiple, format = "indexed
3018
3102
  }
3019
3103
 
3020
3104
  // src/enumOptionsSelectValue.ts
3021
- import isNil3 from "lodash/isNil";
3022
3105
  function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
3023
3106
  const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
3024
- if (!isNil3(value)) {
3107
+ if (value != null) {
3025
3108
  const index = allEnumOptions.findIndex((opt) => value === opt.value);
3026
3109
  const all = allEnumOptions.map(({ value: val }) => val);
3027
3110
  const updated = selected.slice(0, index).concat(value, selected.slice(index));
@@ -3056,12 +3139,11 @@ function enumOptionValueDecoder(value, enumOptions, format = "indexed", emptyVal
3056
3139
  }
3057
3140
 
3058
3141
  // src/enumOptionValueEncoder.ts
3059
- import isNil4 from "lodash/isNil";
3060
3142
  function enumOptionValueEncoder(value, index, format = "indexed") {
3061
3143
  if (format !== "realValue") {
3062
3144
  return String(index);
3063
3145
  }
3064
- if (isNil4(value)) {
3146
+ if (value == null) {
3065
3147
  return "";
3066
3148
  }
3067
3149
  if (typeof value === "object") {
@@ -3071,21 +3153,17 @@ function enumOptionValueEncoder(value, index, format = "indexed") {
3071
3153
  }
3072
3154
 
3073
3155
  // src/ErrorSchemaBuilder.ts
3074
- import cloneDeep from "lodash/cloneDeep";
3075
- import get17 from "lodash/get";
3076
- import set3 from "lodash/set";
3077
- import setWith from "lodash/setWith";
3078
3156
  var ErrorSchemaBuilder = class {
3157
+ /** The error schema being built
3158
+ *
3159
+ * @private
3160
+ */
3161
+ errorSchema = {};
3079
3162
  /** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
3080
3163
  *
3081
3164
  * @param [initialSchema] - The optional set of initial errors, that will be cloned into the class
3082
3165
  */
3083
3166
  constructor(initialSchema) {
3084
- /** The error schema being built
3085
- *
3086
- * @private
3087
- */
3088
- this.errorSchema = {};
3089
3167
  this.resetAllErrors(initialSchema);
3090
3168
  }
3091
3169
  /** Returns the `ErrorSchema` that has been updated by the methods of the `ErrorSchemaBuilder`
@@ -3100,11 +3178,14 @@ var ErrorSchemaBuilder = class {
3100
3178
  * @private
3101
3179
  */
3102
3180
  getOrCreateErrorBlock(pathOfError) {
3103
- const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
3104
- let errorBlock = hasPath ? get17(this.errorSchema, pathOfError) : this.errorSchema;
3105
- if (!errorBlock && pathOfError) {
3181
+ const path = typeof pathOfError === "string" ? toPath(pathOfError) : pathOfError ?? [];
3182
+ if (path.length === 0) {
3183
+ return this.errorSchema;
3184
+ }
3185
+ let errorBlock = getByPath(this.errorSchema, path);
3186
+ if (!errorBlock) {
3106
3187
  errorBlock = {};
3107
- setWith(this.errorSchema, pathOfError, errorBlock, Object);
3188
+ setByPath(this.errorSchema, path, errorBlock, true);
3108
3189
  }
3109
3190
  return errorBlock;
3110
3191
  }
@@ -3114,12 +3195,12 @@ var ErrorSchemaBuilder = class {
3114
3195
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
3115
3196
  */
3116
3197
  resetAllErrors(initialSchema) {
3117
- this.errorSchema = initialSchema ? cloneDeep(initialSchema) : {};
3198
+ this.errorSchema = initialSchema ? structuredClone(initialSchema) : {};
3118
3199
  return this;
3119
3200
  }
3120
3201
  /** Adds the `errorOrList` to the list of errors in the `ErrorSchema` at either the root level or the location within
3121
- * the schema described by the `pathOfError`. For more information about how to specify the path see the
3122
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3202
+ * the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
3203
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3123
3204
  *
3124
3205
  * @param errorOrList - The error or list of errors to add into the `ErrorSchema`
3125
3206
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
@@ -3127,21 +3208,21 @@ var ErrorSchemaBuilder = class {
3127
3208
  */
3128
3209
  addErrors(errorOrList, pathOfError) {
3129
3210
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3130
- let errorsList = get17(errorBlock, ERRORS_KEY);
3211
+ let errorsList = errorBlock[ERRORS_KEY];
3131
3212
  if (!Array.isArray(errorsList)) {
3132
3213
  errorsList = [];
3133
3214
  errorBlock[ERRORS_KEY] = errorsList;
3134
3215
  }
3135
3216
  if (Array.isArray(errorOrList)) {
3136
- set3(errorBlock, ERRORS_KEY, [.../* @__PURE__ */ new Set([...errorsList, ...errorOrList])]);
3217
+ errorBlock[ERRORS_KEY] = [.../* @__PURE__ */ new Set([...errorsList, ...errorOrList])];
3137
3218
  } else {
3138
- set3(errorBlock, ERRORS_KEY, [.../* @__PURE__ */ new Set([...errorsList, errorOrList])]);
3219
+ errorBlock[ERRORS_KEY] = [.../* @__PURE__ */ new Set([...errorsList, errorOrList])];
3139
3220
  }
3140
3221
  return this;
3141
3222
  }
3142
3223
  /** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location
3143
- * within the schema described by the `pathOfError`. For more information about how to specify the path see the
3144
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3224
+ * within the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
3225
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3145
3226
  *
3146
3227
  * @param errorOrList - The error or list of errors to set into the `ErrorSchema`
3147
3228
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)
@@ -3150,43 +3231,59 @@ var ErrorSchemaBuilder = class {
3150
3231
  setErrors(errorOrList, pathOfError) {
3151
3232
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3152
3233
  const listToAdd = Array.isArray(errorOrList) ? [.../* @__PURE__ */ new Set([...errorOrList])] : [errorOrList];
3153
- set3(errorBlock, ERRORS_KEY, listToAdd);
3234
+ errorBlock[ERRORS_KEY] = listToAdd;
3154
3235
  return this;
3155
3236
  }
3156
3237
  /** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by
3157
- * the `pathOfError`. For more information about how to specify the path see the
3158
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3238
+ * the `pathOfError`. The path is either a dotted string (with optional bracketed array
3239
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3159
3240
  *
3160
3241
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)
3161
3242
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
3162
3243
  */
3163
3244
  clearErrors(pathOfError) {
3164
3245
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3165
- set3(errorBlock, ERRORS_KEY, []);
3246
+ errorBlock[ERRORS_KEY] = [];
3166
3247
  return this;
3167
3248
  }
3168
3249
  };
3169
3250
 
3170
3251
  // src/getChangedFields.ts
3171
- import difference from "lodash/difference";
3172
- import get18 from "lodash/get";
3173
- import isPlainObject2 from "lodash/isPlainObject";
3174
- import keys from "lodash/keys";
3175
- import pickBy from "lodash/pickBy";
3176
- function getChangedFields(a, b) {
3177
- const aIsPlainObject = isPlainObject2(a);
3178
- const bIsPlainObject = isPlainObject2(b);
3179
- if (a === b || !aIsPlainObject && !bIsPlainObject) {
3252
+ function getChangedDescendants(a, b) {
3253
+ if (isPlainObject(a) && isPlainObject(b)) {
3254
+ return getChangedFields(a, b, true);
3255
+ }
3256
+ if (Array.isArray(a) && Array.isArray(b) && a.length === b.length) {
3257
+ return a.flatMap((value, index) => {
3258
+ if (deepEquals_default(value, b[index])) {
3259
+ return [];
3260
+ }
3261
+ const descendants = getChangedDescendants(value, b[index]);
3262
+ return descendants.length ? descendants.map((path) => `${index}.${path}`) : [String(index)];
3263
+ });
3264
+ }
3265
+ return [];
3266
+ }
3267
+ function getChangedFields(a, b, deep = false) {
3268
+ if (a === b) {
3180
3269
  return [];
3181
3270
  }
3182
- if (aIsPlainObject && !bIsPlainObject) {
3183
- return keys(a);
3271
+ if (!isPlainObject(a)) {
3272
+ return isPlainObject(b) ? Object.keys(b) : [];
3184
3273
  }
3185
- if (!aIsPlainObject && bIsPlainObject) {
3186
- return keys(b);
3274
+ if (!isPlainObject(b)) {
3275
+ return Object.keys(a);
3187
3276
  }
3188
- const unequalFields = keys(pickBy(a, (value, key) => !deepEquals_default(value, get18(b, key))));
3189
- const diffFields = difference(keys(b), keys(a));
3277
+ const aKeys = Object.keys(a);
3278
+ const aKeySet = new Set(aKeys);
3279
+ const unequalFields = aKeys.filter((key) => !deepEquals_default(a[key], getByPath(b, key))).flatMap((key) => {
3280
+ if (!deep) {
3281
+ return [key];
3282
+ }
3283
+ const descendants = getChangedDescendants(a[key], getByPath(b, key));
3284
+ return descendants.length ? descendants.map((path) => `${key}.${path}`) : [key];
3285
+ });
3286
+ const diffFields = Object.keys(b).filter((key) => !aKeySet.has(key));
3190
3287
  return [...unequalFields, ...diffFields];
3191
3288
  }
3192
3289
 
@@ -3265,6 +3362,9 @@ function getInputProps(schema, defaultType, options = {}, autoDefaultStepAny = t
3265
3362
  if (options.autocomplete) {
3266
3363
  inputProps.autoComplete = options.autocomplete;
3267
3364
  }
3365
+ if (options.autocapitalize) {
3366
+ inputProps.autoCapitalize = options.autocapitalize;
3367
+ }
3268
3368
  if (options.accept) {
3269
3369
  inputProps.accept = options.accept;
3270
3370
  }
@@ -3311,10 +3411,9 @@ function getTemplate(name, registry, uiOptions = {}) {
3311
3411
  }
3312
3412
 
3313
3413
  // src/getTestIds.ts
3314
- import get19 from "lodash/get";
3315
- import uniqueId from "lodash/uniqueId";
3414
+ var testIdCounter = 0;
3316
3415
  function getTestIds() {
3317
- if (get19(globalThis, "process.env.NODE_ENV") !== "test") {
3416
+ if (getByPath(globalThis, ["process", "env", "NODE_ENV"]) !== "test") {
3318
3417
  return {};
3319
3418
  }
3320
3419
  const ids = /* @__PURE__ */ new Map();
@@ -3323,7 +3422,8 @@ function getTestIds() {
3323
3422
  {
3324
3423
  get(_obj, prop) {
3325
3424
  if (!ids.has(prop)) {
3326
- ids.set(prop, uniqueId("test-id-"));
3425
+ testIdCounter += 1;
3426
+ ids.set(prop, `test-id-${testIdCounter}`);
3327
3427
  }
3328
3428
  return ids.get(prop);
3329
3429
  }
@@ -3333,8 +3433,6 @@ function getTestIds() {
3333
3433
 
3334
3434
  // src/getWidget.tsx
3335
3435
  import { createElement } from "react";
3336
- import get20 from "lodash/get";
3337
- import set4 from "lodash/set";
3338
3436
  import ReactIs from "react-is";
3339
3437
  import { jsx } from "react/jsx-runtime";
3340
3438
  var widgetMap = {
@@ -3390,11 +3488,11 @@ var widgetMap = {
3390
3488
  }
3391
3489
  };
3392
3490
  function mergeWidgetOptions(AWidget) {
3393
- let MergedWidget = get20(AWidget, "MergedWidget");
3491
+ let { MergedWidget } = AWidget;
3394
3492
  if (!MergedWidget) {
3395
3493
  const defaultOptions = AWidget.defaultProps?.options || {};
3396
3494
  MergedWidget = ({ options, ...props }) => /* @__PURE__ */ jsx(AWidget, { options: { ...defaultOptions, ...options }, ...props });
3397
- set4(AWidget, "MergedWidget", MergedWidget);
3495
+ AWidget.MergedWidget = MergedWidget;
3398
3496
  }
3399
3497
  return MergedWidget;
3400
3498
  }
@@ -3468,9 +3566,8 @@ function hasWidget(schema, widget, registeredWidgets = {}) {
3468
3566
  }
3469
3567
 
3470
3568
  // src/idGenerators.ts
3471
- import isString4 from "lodash/isString";
3472
3569
  function idGenerator(id, suffix) {
3473
- const theId = isString4(id) ? id : id[ID_KEY];
3570
+ const theId = typeof id === "string" ? id : id[ID_KEY];
3474
3571
  return `${theId}__${suffix}`;
3475
3572
  }
3476
3573
  function descriptionId(id) {
@@ -3503,11 +3600,14 @@ function optionalControlsId(id, element) {
3503
3600
  }
3504
3601
 
3505
3602
  // src/isFormDataAvailable.ts
3506
- import isEmpty6 from "lodash/isEmpty";
3507
- import isNil5 from "lodash/isNil";
3508
- import isObject5 from "lodash/isObject";
3509
3603
  function isFormDataAvailable(formData) {
3510
- return !isNil5(formData) && (!isObject5(formData) || Array.isArray(formData) || !isEmpty6(formData));
3604
+ if (formData === void 0 || formData === null) {
3605
+ return false;
3606
+ }
3607
+ if (typeof formData !== "object" || Array.isArray(formData)) {
3608
+ return true;
3609
+ }
3610
+ return Object.keys(formData).length > 0;
3511
3611
  }
3512
3612
 
3513
3613
  // src/isRootSchema.ts
@@ -3543,14 +3643,12 @@ function logUnsupportedDefaultForEnum(id, schema, enumOptions, multiple = false)
3543
3643
  }
3544
3644
 
3545
3645
  // src/lookupFromFormContext.ts
3546
- import get21 from "lodash/get";
3547
- import has6 from "lodash/has";
3548
3646
  function lookupFromFormContext(regOrFc, toLookup, fallback) {
3549
3647
  const lookupPath = [LOOKUP_MAP_NAME];
3550
- if (has6(regOrFc, FORM_CONTEXT_NAME)) {
3648
+ if (hasByPath(regOrFc, FORM_CONTEXT_NAME)) {
3551
3649
  lookupPath.unshift(FORM_CONTEXT_NAME);
3552
3650
  }
3553
- return get21(regOrFc, [...lookupPath, toLookup], fallback);
3651
+ return getByPath(regOrFc, [...lookupPath, toLookup], fallback);
3554
3652
  }
3555
3653
 
3556
3654
  // src/nameGenerators.ts
@@ -3573,6 +3671,10 @@ var dotNotationNameGenerator = (path, idPrefix, _isMultiValue) => {
3573
3671
  return `${idPrefix}.${path.map(String).join(".")}`;
3574
3672
  };
3575
3673
 
3674
+ // src/noop.ts
3675
+ function noop() {
3676
+ }
3677
+
3576
3678
  // src/orderProperties.ts
3577
3679
  function orderProperties(properties, order) {
3578
3680
  if (!Array.isArray(order)) {
@@ -3687,7 +3789,6 @@ function removeOptionalEmptyObjects(validator, schema, rootSchema, formData) {
3687
3789
  }
3688
3790
 
3689
3791
  // src/resolveUiSchema.ts
3690
- import isEmpty7 from "lodash/isEmpty";
3691
3792
  function resolveUiSchema(schema, localUiSchema, registry) {
3692
3793
  const ref = schema[RJSF_REF_KEY] ?? schema[REF_KEY];
3693
3794
  const definitions = registry.uiSchemaDefinitions;
@@ -3695,7 +3796,7 @@ function resolveUiSchema(schema, localUiSchema, registry) {
3695
3796
  let result;
3696
3797
  if (!definitionUiSchema) {
3697
3798
  result = localUiSchema || {};
3698
- } else if (!localUiSchema || isEmpty7(localUiSchema)) {
3799
+ } else if (!localUiSchema || Object.keys(localUiSchema).length === 0) {
3699
3800
  result = { ...definitionUiSchema };
3700
3801
  } else {
3701
3802
  result = mergeObjects(definitionUiSchema, localUiSchema);
@@ -3826,12 +3927,12 @@ function shouldRender(component, nextProps, nextState, updateStrategy = "customD
3826
3927
  }
3827
3928
 
3828
3929
  // src/shouldRenderOptionalField.ts
3829
- import isObject6 from "lodash/isObject";
3830
- import uniq2 from "lodash/uniq";
3831
3930
  function getSchemaTypesForXxxOf(schemas) {
3832
- const allTypes = uniq2(
3833
- schemas.map((s) => isObject6(s) ? getSchemaType(s) : void 0).flat().filter((t) => t !== void 0)
3834
- );
3931
+ const allTypes = [
3932
+ ...new Set(
3933
+ schemas.map((s) => isObject(s) ? getSchemaType(s) : void 0).flat().filter((t) => t !== void 0)
3934
+ )
3935
+ ];
3835
3936
  return allTypes.length === 1 ? allTypes[0] : allTypes;
3836
3937
  }
3837
3938
  function shouldRenderOptionalField(registry, schema, required, uiSchema) {
@@ -3856,46 +3957,29 @@ function toDateString(dateObject, time = true) {
3856
3957
  }
3857
3958
 
3858
3959
  // src/toErrorList.ts
3859
- import isPlainObject3 from "lodash/isPlainObject";
3860
3960
  function toErrorList(errorSchema, fieldPath = []) {
3861
- if (!errorSchema) {
3862
- return [];
3863
- }
3864
- let errorList = [];
3865
- if (ERRORS_KEY in errorSchema) {
3866
- errorList = errorList.concat(
3867
- errorSchema[ERRORS_KEY].map((message) => {
3868
- const property = `.${fieldPath.join(".")}`;
3869
- return {
3870
- property,
3871
- message,
3872
- stack: `${property} ${message}`
3873
- };
3874
- })
3875
- );
3876
- }
3961
+ return errorSchema ? errorsFrom(errorSchema, fieldPath) : [];
3962
+ }
3963
+ function errorsFrom(errorSchema, fieldPath) {
3964
+ const errors = errorSchema[ERRORS_KEY];
3965
+ const property = `.${fieldPath.join(".")}`;
3966
+ const errorList = Array.isArray(errors) ? errors.map((message) => ({ property, message, stack: `${property} ${message}` })) : [];
3877
3967
  return Object.keys(errorSchema).reduce((currentList, key) => {
3878
- if (key !== ERRORS_KEY) {
3879
- const childSchema = errorSchema[key];
3880
- if (isPlainObject3(childSchema)) {
3881
- return currentList.concat(toErrorList(childSchema, [...fieldPath, key]));
3882
- }
3968
+ const childSchema = errorSchema[key];
3969
+ if (key !== ERRORS_KEY && isPlainObject(childSchema)) {
3970
+ return currentList.concat(errorsFrom(childSchema, [...fieldPath, key]));
3883
3971
  }
3884
3972
  return currentList;
3885
3973
  }, errorList);
3886
3974
  }
3887
3975
 
3888
3976
  // src/toErrorSchema.ts
3889
- import toPath from "lodash/toPath";
3890
3977
  function toErrorSchema(errors) {
3891
3978
  const builder = new ErrorSchemaBuilder();
3892
3979
  if (errors.length) {
3893
3980
  errors.forEach((error) => {
3894
3981
  const { property, message } = error;
3895
- const path = property === "." ? [] : toPath(property);
3896
- if (path.length > 0 && path[0] === "") {
3897
- path.splice(0, 1);
3898
- }
3982
+ const path = property ? toPath(property) : [];
3899
3983
  if (message) {
3900
3984
  builder.addErrors(message, path);
3901
3985
  }
@@ -3918,17 +4002,19 @@ function toFieldPathId(fieldPath, globalFormOptions, parentPath, isMultiValue) {
3918
4002
  }
3919
4003
 
3920
4004
  // src/unwrapErrorHandler.ts
3921
- import isPlainObject4 from "lodash/isPlainObject";
3922
4005
  function unwrapErrorHandler(errorHandler) {
3923
- return Object.keys(errorHandler).reduce((acc, key) => {
4006
+ return unwrapErrors(errorHandler);
4007
+ }
4008
+ function unwrapErrors(errors) {
4009
+ return Object.keys(errors).reduce((acc, key) => {
3924
4010
  if (key === "addError") {
3925
4011
  return acc;
3926
4012
  }
3927
- const childSchema = errorHandler[key];
3928
- if (isPlainObject4(childSchema)) {
4013
+ const childSchema = errors[key];
4014
+ if (isPlainObject(childSchema)) {
3929
4015
  return {
3930
4016
  ...acc,
3931
- [key]: unwrapErrorHandler(childSchema)
4017
+ [key]: unwrapErrors(childSchema)
3932
4018
  };
3933
4019
  }
3934
4020
  return { ...acc, [key]: childSchema };
@@ -4153,7 +4239,6 @@ function utcToLocal(jsonDate) {
4153
4239
  }
4154
4240
 
4155
4241
  // src/validationDataMerge.ts
4156
- import isEmpty8 from "lodash/isEmpty";
4157
4242
  function validationDataMerge(validationData, additionalErrorSchema, preventDuplicates = false) {
4158
4243
  if (!additionalErrorSchema) {
4159
4244
  return validationData;
@@ -4161,7 +4246,7 @@ function validationDataMerge(validationData, additionalErrorSchema, preventDupli
4161
4246
  const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
4162
4247
  let errors = toErrorList(additionalErrorSchema);
4163
4248
  let errorSchema = additionalErrorSchema;
4164
- if (!isEmpty8(oldErrorSchema)) {
4249
+ if (oldErrorSchema && Object.keys(oldErrorSchema).length > 0) {
4165
4250
  errorSchema = mergeObjects(
4166
4251
  oldErrorSchema,
4167
4252
  additionalErrorSchema,
@@ -4173,7 +4258,6 @@ function validationDataMerge(validationData, additionalErrorSchema, preventDupli
4173
4258
  }
4174
4259
 
4175
4260
  // src/withIdRefPrefix.ts
4176
- import isObject7 from "lodash/isObject";
4177
4261
  function withIdRefPrefixObject(node) {
4178
4262
  const realObj = node;
4179
4263
  for (const key in realObj) {
@@ -4195,7 +4279,7 @@ function withIdRefPrefix(schemaNode) {
4195
4279
  if (Array.isArray(schemaNode)) {
4196
4280
  return withIdRefPrefixArray([...schemaNode]);
4197
4281
  }
4198
- if (isObject7(schemaNode)) {
4282
+ if (isObject(schemaNode)) {
4199
4283
  return withIdRefPrefixObject({ ...schemaNode });
4200
4284
  }
4201
4285
  return schemaNode;
@@ -4245,20 +4329,18 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
4245
4329
  return TranslatableString2;
4246
4330
  })(TranslatableString || {});
4247
4331
 
4248
- // src/parser/schemaParser.ts
4249
- import forEach from "lodash/forEach";
4250
-
4251
4332
  // src/parser/ParserValidator.ts
4252
- import get22 from "lodash/get";
4253
4333
  var ParserValidator = class {
4334
+ /** The rootSchema provided during construction of the class */
4335
+ rootSchema;
4336
+ /** The map of schemas encountered by the ParserValidator */
4337
+ schemaMap = {};
4254
4338
  /** Construct the ParserValidator for the given `rootSchema`. This `rootSchema` will be stashed in the `schemaMap`
4255
4339
  * first.
4256
4340
  *
4257
4341
  * @param rootSchema - The root schema against which this validator will be executed
4258
4342
  */
4259
4343
  constructor(rootSchema) {
4260
- /** The map of schemas encountered by the ParserValidator */
4261
- this.schemaMap = {};
4262
4344
  this.rootSchema = rootSchema;
4263
4345
  this.addSchema(rootSchema, hashForSchema(rootSchema));
4264
4346
  }
@@ -4275,7 +4357,7 @@ var ParserValidator = class {
4275
4357
  * @param hash - The hash value at which to map the schema
4276
4358
  */
4277
4359
  addSchema(schema, hash) {
4278
- const key = get22(schema, ID_KEY, hash);
4360
+ const key = schema[ID_KEY] ?? hash;
4279
4361
  const identifiedSchema = { ...schema, [ID_KEY]: key };
4280
4362
  const existing = this.schemaMap[key];
4281
4363
  if (!existing) {
@@ -4348,9 +4430,9 @@ function parseSchema(validator, recurseList, rootSchema, schema) {
4348
4430
  const allOptions = resolveAnyOrOneOfSchemas(validator, localSchema, rootSchema, true);
4349
4431
  allOptions.forEach((s) => {
4350
4432
  if (PROPERTIES_KEY in s && s[PROPERTIES_KEY]) {
4351
- forEach(localSchema[PROPERTIES_KEY], (value) => {
4433
+ for (const value of Object.values(localSchema[PROPERTIES_KEY] ?? {})) {
4352
4434
  parseSchema(validator, recurseList, rootSchema, value);
4353
- });
4435
+ }
4354
4436
  }
4355
4437
  });
4356
4438
  if (ITEMS_KEY in localSchema && !Array.isArray(localSchema.items) && typeof localSchema.items !== "boolean") {
@@ -4437,6 +4519,7 @@ export {
4437
4519
  findFieldInSchema,
4438
4520
  findSchemaDefinition,
4439
4521
  findSelectedOptionInXxxOf,
4522
+ getByPath,
4440
4523
  getChangedFields,
4441
4524
  getClosestMatchingOption,
4442
4525
  getDateElementProps,
@@ -4450,6 +4533,7 @@ export {
4450
4533
  getInputProps,
4451
4534
  getOptionMatchingSimpleDiscriminator,
4452
4535
  getOptionValueFormat,
4536
+ getPropertySchema,
4453
4537
  getSchemaType,
4454
4538
  getSubmitButtonOptions,
4455
4539
  getTemplate,
@@ -4458,6 +4542,7 @@ export {
4458
4542
  getUsedFormData,
4459
4543
  getWidget,
4460
4544
  guessType,
4545
+ hasByPath,
4461
4546
  hasWidget,
4462
4547
  hashForSchema,
4463
4548
  hashObject,
@@ -4470,6 +4555,7 @@ export {
4470
4555
  isFormDataAvailable,
4471
4556
  isMultiSelect,
4472
4557
  isObject,
4558
+ isPlainObject,
4473
4559
  isRootSchema,
4474
4560
  isSelect,
4475
4561
  isValueEmpty,
@@ -4480,6 +4566,7 @@ export {
4480
4566
  mergeDefaultsWithFormData,
4481
4567
  mergeObjects,
4482
4568
  mergeSchemas,
4569
+ noop,
4483
4570
  omitExtraData,
4484
4571
  optionId,
4485
4572
  optionalControlsId,
@@ -4496,6 +4583,7 @@ export {
4496
4583
  sanitizeDataForNewSchema,
4497
4584
  schemaParser,
4498
4585
  schemaRequiresTrueValue,
4586
+ setByPath,
4499
4587
  shallowEquals,
4500
4588
  shouldRender,
4501
4589
  shouldRenderOptionalField,
@@ -4506,7 +4594,9 @@ export {
4506
4594
  toErrorList,
4507
4595
  toErrorSchema,
4508
4596
  toFieldPathId,
4597
+ toPath,
4509
4598
  toPathSchema,
4599
+ unsetByPath,
4510
4600
  unwrapErrorHandler,
4511
4601
  useAltDateWidgetProps,
4512
4602
  useDeepCompareMemo,