@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.umd.js CHANGED
@@ -1,18 +1,18 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/isPlainObject'), require('lodash/get'), require('fast-equals'), require('fast-uri'), require('jsonpointer'), require('lodash/isEmpty'), require('lodash/isObject'), require('lodash/omit'), require('lodash/has'), require('lodash/isString'), require('lodash/flattenDeep'), require('lodash/merge'), require('lodash/set'), require('lodash/times'), require('lodash/transform'), require('lodash/uniq'), require('lodash/union'), require('lodash/isNumber'), require('@x0k/json-schema-merge'), require('@x0k/json-schema-merge/lib/array'), require('lodash/reduce'), require('lodash/isNil'), require('lodash/pick'), require('lodash/cloneDeep'), require('lodash/setWith'), require('lodash/difference'), require('lodash/keys'), require('lodash/pickBy'), require('lodash/uniqueId'), require('react'), require('react-is'), require('react/jsx-runtime'), require('lodash/toPath'), require('lodash/forEach')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash/isPlainObject', 'lodash/get', 'fast-equals', 'fast-uri', 'jsonpointer', 'lodash/isEmpty', 'lodash/isObject', 'lodash/omit', 'lodash/has', 'lodash/isString', 'lodash/flattenDeep', 'lodash/merge', 'lodash/set', 'lodash/times', 'lodash/transform', 'lodash/uniq', 'lodash/union', 'lodash/isNumber', '@x0k/json-schema-merge', '@x0k/json-schema-merge/lib/array', 'lodash/reduce', 'lodash/isNil', 'lodash/pick', 'lodash/cloneDeep', 'lodash/setWith', 'lodash/difference', 'lodash/keys', 'lodash/pickBy', 'lodash/uniqueId', 'react', 'react-is', 'react/jsx-runtime', 'lodash/toPath', 'lodash/forEach'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.isPlainObject2, global.get14, global.fastEquals, global.UriResolver, global.jsonpointer, global.isEmpty4, global.isObject2, global.omit, global.has5, global.isString, global.flattenDeep, global.merge, global.set3, global.times, global.transform, global.uniq, global.union, global.isNumber, global.jsonSchemaMerge, global.array, global.reduce, global.isNil, global.pick, global.cloneDeep, global.setWith, global.difference, global.keys, global.pickBy, global.uniqueId, global.react, global.ReactIs, global.jsxRuntime, global.toPath, global.forEach));
5
- })(this, (function (exports, isPlainObject2, get14, fastEquals, UriResolver, jsonpointer, isEmpty4, isObject2, omit, has5, isString, flattenDeep, merge, set3, times, transform, uniq, union, isNumber, jsonSchemaMerge, array, reduce, isNil, pick, cloneDeep, setWith, difference, keys, pickBy, uniqueId, react, ReactIs, jsxRuntime, toPath, forEach) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fast-equals'), require('fast-uri'), require('jsonpointer'), require('@x0k/json-schema-merge'), require('@x0k/json-schema-merge/lib/array'), require('react'), require('react-is'), require('react/jsx-runtime')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'fast-equals', 'fast-uri', 'jsonpointer', '@x0k/json-schema-merge', '@x0k/json-schema-merge/lib/array', 'react', 'react-is', 'react/jsx-runtime'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/utils"] = {}, global.fastEquals, global.UriResolver, global.jsonpointer, global.jsonSchemaMerge, global.array, global.react, global.ReactIs, global.jsxRuntime));
5
+ })(this, (function (exports, fastEquals, UriResolver, jsonpointer, jsonSchemaMerge, array, react, ReactIs, jsxRuntime) { 'use strict';
6
6
 
7
7
  // src/isObject.ts
8
8
  function isObject(thing) {
9
9
  if (typeof thing !== "object" || thing === null) {
10
10
  return false;
11
11
  }
12
- if (typeof thing.lastModified === "number" && typeof File !== "undefined" && thing instanceof File) {
12
+ if ("lastModified" in thing && typeof thing.lastModified === "number" && typeof File !== "undefined" && thing instanceof File) {
13
13
  return false;
14
14
  }
15
- if (typeof thing.getMonth === "function" && typeof Date !== "undefined" && thing instanceof Date) {
15
+ if ("getMonth" in thing && typeof thing.getMonth === "function" && typeof Date !== "undefined" && thing instanceof Date) {
16
16
  return false;
17
17
  }
18
18
  return !Array.isArray(thing);
@@ -141,6 +141,17 @@
141
141
  }
142
142
  return true;
143
143
  }
144
+
145
+ // src/isPlainObject.ts
146
+ function isPlainObject(thing) {
147
+ if (typeof thing !== "object" || thing === null) {
148
+ return false;
149
+ }
150
+ const proto = Object.getPrototypeOf(thing);
151
+ return proto === null || proto === Object.prototype;
152
+ }
153
+
154
+ // src/createErrorHandler.ts
144
155
  function createErrorHandler(formData) {
145
156
  const handler = {
146
157
  // We store the list of errors for this node in a property named __errors
@@ -154,10 +165,9 @@
154
165
  if (Array.isArray(formData)) {
155
166
  return formData.reduce((acc, value, key) => ({ ...acc, [key]: createErrorHandler(value) }), handler);
156
167
  }
157
- if (isPlainObject2(formData)) {
158
- const formObject = formData;
159
- return Object.keys(formObject).reduce(
160
- (acc, key) => ({ ...acc, [key]: createErrorHandler(formObject[key]) }),
168
+ if (isPlainObject(formData)) {
169
+ return Object.keys(formData).reduce(
170
+ (acc, key) => ({ ...acc, [key]: createErrorHandler(formData[key]) }),
161
171
  handler
162
172
  );
163
173
  }
@@ -179,14 +189,14 @@
179
189
  for (const subSchema of Object.values(schema)) {
180
190
  if (Array.isArray(subSchema)) {
181
191
  for (const item of subSchema) {
182
- if (isObject2(item)) {
192
+ if (isObject(item)) {
183
193
  const result = findEmbeddedSchemaRecursive(item, ref);
184
194
  if (result !== void 0) {
185
195
  return result;
186
196
  }
187
197
  }
188
198
  }
189
- } else if (isObject2(subSchema)) {
199
+ } else if (isObject(subSchema)) {
190
200
  const result = findEmbeddedSchemaRecursive(subSchema, ref);
191
201
  if (result !== void 0) {
192
202
  return result;
@@ -196,7 +206,7 @@
196
206
  return void 0;
197
207
  }
198
208
  function makeAllReferencesAbsolute(schema, baseURI) {
199
- const currentURI = get14(schema, ID_KEY, baseURI);
209
+ const currentURI = schema[ID_KEY] ?? baseURI;
200
210
  let result = schema;
201
211
  if (REF_KEY in result) {
202
212
  result = { ...result, [REF_KEY]: UriResolver.resolve(currentURI, result[REF_KEY]) };
@@ -205,20 +215,19 @@
205
215
  if (Array.isArray(subSchema)) {
206
216
  result = {
207
217
  ...result,
208
- [key]: subSchema.map((item) => isObject2(item) ? makeAllReferencesAbsolute(item, currentURI) : item)
218
+ [key]: subSchema.map((item) => isObject(item) ? makeAllReferencesAbsolute(item, currentURI) : item)
209
219
  };
210
- } else if (isObject2(subSchema)) {
220
+ } else if (isObject(subSchema)) {
211
221
  result = { ...result, [key]: makeAllReferencesAbsolute(subSchema, currentURI) };
212
222
  }
213
223
  }
214
224
  return result;
215
225
  }
216
226
  function splitKeyElementFromObject(key, object) {
217
- const value = object[key];
218
- const remaining = omit(object, [key]);
227
+ const { [key]: value, ...remaining } = object;
219
228
  return [remaining, value];
220
229
  }
221
- function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = get14(rootSchema, [ID_KEY])) {
230
+ function findSchemaDefinitionRecursive($ref, rootSchema = {}, recurseList = [], baseURI = rootSchema[ID_KEY]) {
222
231
  const ref = $ref || "";
223
232
  let current = void 0;
224
233
  let currentBaseURI = baseURI;
@@ -238,7 +247,7 @@
238
247
  current = findEmbeddedSchemaRecursive(rootSchema, refId.replace(/\/$/, ""));
239
248
  if (current !== void 0) {
240
249
  currentBaseURI = current[ID_KEY];
241
- if (!isEmpty4(refAnchor)) {
250
+ if (refAnchor.length > 0) {
242
251
  current = jsonpointer.get(current, decodeURIComponent(refAnchor.join("#")));
243
252
  }
244
253
  }
@@ -268,14 +277,116 @@
268
277
  }
269
278
  return current;
270
279
  }
271
- function findSchemaDefinition($ref, rootSchema = {}, baseURI = get14(rootSchema, [ID_KEY])) {
280
+ function findSchemaDefinition($ref, rootSchema = {}, baseURI = rootSchema[ID_KEY]) {
272
281
  const recurseList = [];
273
282
  return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);
274
283
  }
284
+
285
+ // src/pathUtils.ts
286
+ var reIsIndex = /^(?:0|[1-9]\d*)$/;
287
+ function toPath(path) {
288
+ return path.split(/[.[\]]+/).filter(Boolean);
289
+ }
290
+ function normalizePath(path) {
291
+ return Array.isArray(path) ? path : [path];
292
+ }
293
+ function isUnsafeSegment(segment) {
294
+ return segment === "__proto__";
295
+ }
296
+ function isIndex(segment) {
297
+ return typeof segment === "number" ? Number.isInteger(segment) && segment >= 0 : reIsIndex.test(segment);
298
+ }
299
+ function isSettable(value) {
300
+ return value != null && (typeof value === "object" || typeof value === "function");
301
+ }
302
+ function getByPath(obj, path, defaultValue) {
303
+ let current;
304
+ if (!Array.isArray(path)) {
305
+ current = isSettable(obj) && Object.hasOwn(obj, path) ? obj[path] : void 0;
306
+ } else if (path.length === 0) {
307
+ current = void 0;
308
+ } else {
309
+ current = obj;
310
+ for (let i = 0; i < path.length; i++) {
311
+ const segment = path[i];
312
+ if (!isSettable(current) || !Object.hasOwn(current, segment)) {
313
+ current = void 0;
314
+ break;
315
+ }
316
+ current = current[segment];
317
+ }
318
+ }
319
+ return current === void 0 ? defaultValue : current;
320
+ }
321
+ function setByPath(obj, path, value, createIntermediateObjects = false) {
322
+ if (!isSettable(obj)) {
323
+ return obj;
324
+ }
325
+ if (!Array.isArray(path)) {
326
+ if (!isUnsafeSegment(path)) {
327
+ const target = obj;
328
+ target[path] = value;
329
+ }
330
+ return obj;
331
+ }
332
+ const segments = path;
333
+ if (segments.some(isUnsafeSegment)) {
334
+ return obj;
335
+ }
336
+ let current = obj;
337
+ for (let i = 0; i < segments.length; i++) {
338
+ const segment = segments[i];
339
+ if (i === segments.length - 1) {
340
+ current[segment] = value;
341
+ } else {
342
+ const existing = Object.hasOwn(current, segment) ? current[segment] : void 0;
343
+ if (isSettable(existing)) {
344
+ current = existing;
345
+ } else {
346
+ const next = createIntermediateObjects || !isIndex(segments[i + 1]) ? {} : [];
347
+ current[segment] = next;
348
+ if (isSettable(next)) {
349
+ current = next;
350
+ }
351
+ }
352
+ }
353
+ }
354
+ return obj;
355
+ }
356
+ function hasByPath(obj, path) {
357
+ if (!Array.isArray(path)) {
358
+ return isSettable(obj) && Object.hasOwn(obj, path);
359
+ }
360
+ let current = obj;
361
+ for (let i = 0; i < path.length; i++) {
362
+ if (!isSettable(current) || !Object.hasOwn(current, path[i])) {
363
+ return false;
364
+ }
365
+ current = current[path[i]];
366
+ }
367
+ return path.length > 0;
368
+ }
369
+ function unsetByPath(obj, path) {
370
+ const segments = normalizePath(path);
371
+ if (segments.length === 0) {
372
+ return true;
373
+ }
374
+ const parent = segments.length > 1 ? getByPath(obj, segments.slice(0, -1)) : obj;
375
+ if (parent == null) {
376
+ return true;
377
+ }
378
+ try {
379
+ return Reflect.deleteProperty(parent, segments[segments.length - 1]);
380
+ } catch {
381
+ return false;
382
+ }
383
+ }
384
+
385
+ // src/getDiscriminatorFieldFromSchema.ts
275
386
  function getDiscriminatorFieldFromSchema(schema) {
276
387
  let discriminator;
277
- const maybeString = get14(schema, DISCRIMINATOR_PATH);
278
- if (isString(maybeString)) {
388
+ const maybeString = getByPath(schema, DISCRIMINATOR_PATH);
389
+ if (typeof maybeString === "string") {
279
390
  discriminator = maybeString;
280
391
  } else if (maybeString !== void 0) {
281
392
  console.warn(`Expecting discriminator to be a string, got "${typeof maybeString}" instead`);
@@ -336,7 +447,7 @@
336
447
  if (obj1 && key in obj1 && isObject(right)) {
337
448
  accumulator[key] = mergeSchemas(left, right);
338
449
  } else if (obj1 && obj2 && (getSchemaType(obj1) === "object" || getSchemaType(obj2) === "object") && key === REQUIRED_KEY && Array.isArray(left) && Array.isArray(right)) {
339
- accumulator[key] = union(left, right);
450
+ accumulator[key] = [.../* @__PURE__ */ new Set([...left, ...right])];
340
451
  } else {
341
452
  accumulator[key] = right;
342
453
  }
@@ -347,20 +458,28 @@
347
458
  }
348
459
  return result;
349
460
  }
461
+
462
+ // src/getPropertySchema.ts
463
+ function getPropertySchema(schema, property) {
464
+ return schema?.[PROPERTIES_KEY]?.[property] ?? {};
465
+ }
466
+
467
+ // src/getOptionMatchingSimpleDiscriminator.ts
350
468
  function getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField) {
351
469
  if (formData && discriminatorField) {
352
- const value = get14(formData, discriminatorField);
470
+ const value = getByPath(formData, discriminatorField);
353
471
  if (value === void 0) {
354
472
  return void 0;
355
473
  }
356
474
  for (let i = 0; i < options.length; i += 1) {
357
475
  const option = options[i];
358
- const discriminator = get14(option, [PROPERTIES_KEY, discriminatorField], {});
476
+ const discriminator = getPropertySchema(option, discriminatorField);
359
477
  if (discriminator.type !== "object" && discriminator.type !== "array") {
360
478
  if (discriminator.const === value) {
361
479
  return i;
362
480
  }
363
- if (discriminator.enum?.includes(value)) {
481
+ const enumValues = discriminator.enum;
482
+ if (enumValues?.includes(value)) {
364
483
  return i;
365
484
  }
366
485
  }
@@ -375,14 +494,14 @@
375
494
  return 0;
376
495
  }
377
496
  const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);
378
- if (isNumber(simpleDiscriminatorMatch)) {
497
+ if (typeof simpleDiscriminatorMatch === "number") {
379
498
  return simpleDiscriminatorMatch;
380
499
  }
381
500
  for (let i = 0; i < options.length; i += 1) {
382
501
  const option = options[i];
383
- if (discriminatorField && has5(option, [PROPERTIES_KEY, discriminatorField])) {
384
- const value = get14(formData, discriminatorField);
385
- const discriminator = get14(option, [PROPERTIES_KEY, discriminatorField], {});
502
+ const discriminator = discriminatorField ? option[PROPERTIES_KEY]?.[discriminatorField] : void 0;
503
+ if (discriminatorField && discriminator !== void 0) {
504
+ const value = getByPath(formData, discriminatorField);
386
505
  if (validator.isValid(discriminator, value, rootSchema)) {
387
506
  return i;
388
507
  }
@@ -511,7 +630,7 @@
511
630
  const allPermutations = listOfLists.reduce(
512
631
  (permutations, list) => {
513
632
  if (list.length > 1) {
514
- return list.flatMap((element) => times(permutations.length, (i) => [...permutations[i]].concat(element)));
633
+ return list.flatMap((element) => permutations.map((permutation) => [...permutation, element]));
515
634
  }
516
635
  permutations.forEach((permutation) => permutation.push(list[0]));
517
636
  return permutations;
@@ -522,12 +641,9 @@
522
641
  return allPermutations;
523
642
  }
524
643
  function getMatchingPatternProperties(schema, key) {
525
- return Object.keys(schema.patternProperties).filter((pattern) => RegExp(pattern).test(key)).reduce(
526
- (obj, pattern) => {
527
- set3(obj, [pattern], schema.patternProperties[pattern]);
528
- return obj;
529
- },
530
- {}
644
+ const patternProperties = schema.patternProperties ?? {};
645
+ return Object.fromEntries(
646
+ Object.entries(patternProperties).filter(([pattern]) => RegExp(pattern).test(key))
531
647
  );
532
648
  }
533
649
  function resolveSchema(validator, schema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs) {
@@ -622,23 +738,24 @@
622
738
  }
623
739
  if (PROPERTIES_KEY in resolvedSchema) {
624
740
  const childrenLists = [];
625
- const updatedProps = transform(
626
- resolvedSchema[PROPERTIES_KEY],
627
- (acc, value, key) => {
628
- const childList = [...recurseList];
629
- acc[key] = resolveAllReferences(
630
- value,
631
- rootSchema,
632
- childList,
633
- currentBaseURI,
634
- resolveAnyOfOrOneOfRefs,
635
- !resolveAnyOfOrOneOfRefs
636
- );
637
- childrenLists.push(childList);
638
- },
639
- {}
640
- );
641
- merge(recurseList, uniq(flattenDeep(childrenLists)));
741
+ const updatedProps = {};
742
+ for (const [key, value] of Object.entries(resolvedSchema[PROPERTIES_KEY] ?? {})) {
743
+ const childList = [...recurseList];
744
+ updatedProps[key] = resolveAllReferences(
745
+ value,
746
+ rootSchema,
747
+ childList,
748
+ currentBaseURI,
749
+ resolveAnyOfOrOneOfRefs,
750
+ !resolveAnyOfOrOneOfRefs
751
+ );
752
+ childrenLists.push(childList);
753
+ }
754
+ for (const ref of new Set(childrenLists.flat())) {
755
+ if (!recurseList.includes(ref)) {
756
+ recurseList.push(ref);
757
+ }
758
+ }
642
759
  resolvedSchema = { ...resolvedSchema, [PROPERTIES_KEY]: updatedProps };
643
760
  }
644
761
  if (ITEMS_KEY in resolvedSchema && !Array.isArray(resolvedSchema.items) && typeof resolvedSchema.items !== "boolean") {
@@ -687,12 +804,12 @@
687
804
  }
688
805
  if (PATTERN_PROPERTIES_KEY in schema) {
689
806
  const matchingProperties = getMatchingPatternProperties(schema, key);
690
- if (!isEmpty4(matchingProperties)) {
807
+ if (Object.keys(matchingProperties).length > 0) {
691
808
  schema.properties[key] = retrieveSchema(
692
809
  validator,
693
810
  { [ALL_OF_KEY]: Object.values(matchingProperties) },
694
811
  rootSchema,
695
- get14(formData, [key]),
812
+ formData[key],
696
813
  experimental_customMergeAllOf
697
814
  );
698
815
  schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
@@ -705,9 +822,9 @@
705
822
  if (REF_KEY in schema.additionalProperties) {
706
823
  additionalProperties = retrieveSchema(
707
824
  validator,
708
- { [REF_KEY]: get14(schema.additionalProperties, [REF_KEY]) },
825
+ { [REF_KEY]: schema.additionalProperties[REF_KEY] },
709
826
  rootSchema,
710
- get14(formData, [key]),
827
+ formData[key],
711
828
  experimental_customMergeAllOf
712
829
  );
713
830
  } else if ("type" in schema.additionalProperties) {
@@ -718,10 +835,10 @@
718
835
  ...schema.additionalProperties
719
836
  };
720
837
  } else {
721
- additionalProperties = { type: guessType(get14(formData, [key])) };
838
+ additionalProperties = { type: guessType(formData[key]) };
722
839
  }
723
840
  } else {
724
- additionalProperties = { type: guessType(get14(formData, [key])) };
841
+ additionalProperties = { type: guessType(formData[key]) };
725
842
  }
726
843
  schema.properties[key] = additionalProperties;
727
844
  schema.properties[key][ADDITIONAL_PROPERTY_FLAG] = true;
@@ -803,12 +920,12 @@
803
920
  resolvedSchema = Object.keys(resolvedSchema.properties).reduce(
804
921
  (acc, key) => {
805
922
  const matchingProperties = getMatchingPatternProperties(acc, key);
806
- if (!isEmpty4(matchingProperties)) {
923
+ if (Object.keys(matchingProperties).length > 0) {
807
924
  acc.properties[key] = retrieveSchema(
808
925
  validator,
809
926
  { allOf: [acc.properties[key], ...Object.values(matchingProperties)] },
810
927
  rootSchema,
811
- get14(rawFormData, [key]),
928
+ getByPath(rawFormData, key),
812
929
  experimental_customMergeAllOf
813
930
  );
814
931
  }
@@ -889,7 +1006,7 @@
889
1006
  function processDependencies(validator, dependencies, resolvedSchema, rootSchema, expandAllBranches, recurseList, formData, experimental_customMergeAllOf) {
890
1007
  let schemas = [resolvedSchema];
891
1008
  for (const dependencyKey in dependencies) {
892
- if ((expandAllBranches || get14(formData, [dependencyKey]) !== void 0) && (!resolvedSchema.properties || dependencyKey in resolvedSchema.properties)) {
1009
+ if ((expandAllBranches || getByPath(formData, dependencyKey) !== void 0) && (!resolvedSchema.properties || dependencyKey in resolvedSchema.properties)) {
893
1010
  const [remainingDependencies, dependencyValue] = splitKeyElementFromObject(
894
1011
  dependencyKey,
895
1012
  dependencies
@@ -1016,14 +1133,14 @@
1016
1133
  const xxxOfs = schema[xxx].map(
1017
1134
  (xxxOf) => retrieveSchema(validator, xxxOf, rootSchema, formData, experimental_customMergeAllOf)
1018
1135
  );
1019
- const data = get14(formData, selectorField);
1136
+ const data = getByPath(formData, selectorField);
1020
1137
  if (data !== void 0) {
1021
1138
  return xxxOfs.find(
1022
1139
  (xxxOfOption) => deepEquals_default(
1023
- get14(
1140
+ getByPath(
1024
1141
  xxxOfOption,
1025
1142
  [PROPERTIES_KEY, selectorField, DEFAULT_KEY],
1026
- get14(xxxOfOption, [PROPERTIES_KEY, selectorField, CONST_KEY])
1143
+ getByPath(xxxOfOption, [PROPERTIES_KEY, selectorField, CONST_KEY])
1027
1144
  ),
1028
1145
  data
1029
1146
  )
@@ -1032,18 +1149,20 @@
1032
1149
  }
1033
1150
  return void 0;
1034
1151
  }
1152
+
1153
+ // src/schema/getFromSchema.ts
1035
1154
  function getFromSchemaInternal(validator, rootSchema, schema, path, experimental_customMergeAllOf) {
1036
1155
  let fieldSchema = schema;
1037
- if (has5(schema, REF_KEY)) {
1156
+ if (hasByPath(schema, REF_KEY)) {
1038
1157
  fieldSchema = retrieveSchema(validator, schema, rootSchema, void 0, experimental_customMergeAllOf);
1039
1158
  }
1040
- if (isEmpty4(path)) {
1159
+ if (path.length === 0) {
1041
1160
  return fieldSchema;
1042
1161
  }
1043
- const pathList = Array.isArray(path) ? [...path] : path.split(".");
1162
+ const pathList = Array.isArray(path) ? [...path] : toPath(path);
1044
1163
  const [part, ...nestedPath] = pathList;
1045
- if (part !== void 0 && part !== "" && has5(fieldSchema, part)) {
1046
- fieldSchema = get14(fieldSchema, part);
1164
+ if (part !== void 0 && part !== "" && hasByPath(fieldSchema, part)) {
1165
+ fieldSchema = getByPath(fieldSchema, part);
1047
1166
  return getFromSchemaInternal(
1048
1167
  validator,
1049
1168
  rootSchema,
@@ -1079,30 +1198,30 @@
1079
1198
  {},
1080
1199
  experimental_customMergeAllOf
1081
1200
  );
1082
- if (has5(parentField, ONE_OF_KEY)) {
1201
+ if (hasByPath(parentField, ONE_OF_KEY)) {
1083
1202
  parentField = findSelectedOptionInXxxOf(
1084
1203
  validator,
1085
1204
  rootSchema,
1086
1205
  parentField,
1087
1206
  fieldNameKey,
1088
1207
  ONE_OF_KEY,
1089
- get14(formData, subPath),
1208
+ getByPath(formData, subPath),
1090
1209
  experimental_customMergeAllOf
1091
1210
  );
1092
- } else if (has5(parentField, ANY_OF_KEY)) {
1211
+ } else if (hasByPath(parentField, ANY_OF_KEY)) {
1093
1212
  parentField = findSelectedOptionInXxxOf(
1094
1213
  validator,
1095
1214
  rootSchema,
1096
1215
  parentField,
1097
1216
  fieldNameKey,
1098
1217
  ANY_OF_KEY,
1099
- get14(formData, subPath),
1218
+ getByPath(formData, subPath),
1100
1219
  experimental_customMergeAllOf
1101
1220
  );
1102
1221
  }
1103
1222
  });
1104
1223
  }
1105
- if (has5(parentField, ONE_OF_KEY)) {
1224
+ if (hasByPath(parentField, ONE_OF_KEY)) {
1106
1225
  parentField = findSelectedOptionInXxxOf(
1107
1226
  validator,
1108
1227
  rootSchema,
@@ -1112,7 +1231,7 @@
1112
1231
  formData,
1113
1232
  experimental_customMergeAllOf
1114
1233
  );
1115
- } else if (has5(parentField, ANY_OF_KEY)) {
1234
+ } else if (hasByPath(parentField, ANY_OF_KEY)) {
1116
1235
  parentField = findSelectedOptionInXxxOf(
1117
1236
  validator,
1118
1237
  rootSchema,
@@ -1148,6 +1267,8 @@
1148
1267
  }
1149
1268
  return { field, isRequired };
1150
1269
  }
1270
+
1271
+ // src/schema/getClosestMatchingOption.ts
1151
1272
  var JUNK_OPTION = {
1152
1273
  type: "object",
1153
1274
  $id: JUNK_OPTION_ID,
@@ -1160,61 +1281,57 @@
1160
1281
  function calculateIndexScore(validator, rootSchema, schema, formData, experimental_customMergeAllOf) {
1161
1282
  let totalScore = 0;
1162
1283
  if (schema) {
1163
- if (isObject2(schema.properties)) {
1164
- totalScore += reduce(
1165
- schema.properties,
1166
- (score, value, key) => {
1167
- const formValue = get14(formData, key);
1168
- if (typeof value === "boolean") {
1169
- return score;
1170
- }
1171
- if (has5(value, REF_KEY)) {
1172
- const newSchema = retrieveSchema(
1173
- validator,
1174
- value,
1175
- rootSchema,
1176
- formValue,
1177
- experimental_customMergeAllOf
1178
- );
1179
- return score + calculateIndexScore(
1180
- validator,
1181
- rootSchema,
1182
- newSchema,
1183
- formValue || {},
1184
- experimental_customMergeAllOf
1185
- );
1186
- }
1187
- if ((has5(value, ONE_OF_KEY) || has5(value, ANY_OF_KEY)) && formValue) {
1188
- const xxxOfKey = has5(value, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1189
- const discriminator = getDiscriminatorFieldFromSchema(value);
1190
- return score + getClosestMatchingOption(
1191
- validator,
1192
- rootSchema,
1193
- formValue,
1194
- get14(value, xxxOfKey),
1195
- -1,
1196
- discriminator,
1197
- experimental_customMergeAllOf
1198
- );
1199
- }
1200
- if (value.type === "object") {
1201
- const structureBoost = isObject2(formValue) ? 1 : 0;
1202
- return score + structureBoost + calculateIndexScore(validator, rootSchema, value, formValue, experimental_customMergeAllOf);
1203
- }
1204
- if (value.type === guessType(formValue)) {
1205
- let newScore = score + 1;
1206
- if (value.default) {
1207
- newScore += formValue === value.default ? 1 : -1;
1208
- } else if (value.const) {
1209
- newScore += formValue === value.const ? 1 : -1;
1210
- }
1211
- return newScore;
1212
- }
1284
+ if (isObject(schema.properties)) {
1285
+ totalScore += Object.entries(schema.properties).reduce((score, [key, value]) => {
1286
+ const formValue = formData?.[key];
1287
+ if (typeof value === "boolean") {
1213
1288
  return score;
1214
- },
1215
- 0
1216
- );
1217
- } else if (isString(schema.type) && schema.type === guessType(formData)) {
1289
+ }
1290
+ if (hasByPath(value, REF_KEY)) {
1291
+ const newSchema = retrieveSchema(
1292
+ validator,
1293
+ value,
1294
+ rootSchema,
1295
+ formValue,
1296
+ experimental_customMergeAllOf
1297
+ );
1298
+ return score + calculateIndexScore(
1299
+ validator,
1300
+ rootSchema,
1301
+ newSchema,
1302
+ formValue || {},
1303
+ experimental_customMergeAllOf
1304
+ );
1305
+ }
1306
+ if ((hasByPath(value, ONE_OF_KEY) || hasByPath(value, ANY_OF_KEY)) && formValue) {
1307
+ const xxxOfKey = hasByPath(value, ONE_OF_KEY) ? ONE_OF_KEY : ANY_OF_KEY;
1308
+ const discriminator = getDiscriminatorFieldFromSchema(value);
1309
+ return score + getClosestMatchingOption(
1310
+ validator,
1311
+ rootSchema,
1312
+ formValue,
1313
+ getByPath(value, xxxOfKey),
1314
+ -1,
1315
+ discriminator,
1316
+ experimental_customMergeAllOf
1317
+ );
1318
+ }
1319
+ if (value.type === "object") {
1320
+ const structureBoost = typeof formValue === "object" && formValue !== null ? 1 : 0;
1321
+ return score + structureBoost + calculateIndexScore(validator, rootSchema, value, formValue, experimental_customMergeAllOf);
1322
+ }
1323
+ if (value.type === guessType(formValue)) {
1324
+ let newScore = score + 1;
1325
+ if (value.default) {
1326
+ newScore += formValue === value.default ? 1 : -1;
1327
+ } else if (value.const) {
1328
+ newScore += formValue === value.const ? 1 : -1;
1329
+ }
1330
+ return newScore;
1331
+ }
1332
+ return score;
1333
+ }, 0);
1334
+ } else if (typeof schema.type === "string" && schema.type === guessType(formData)) {
1218
1335
  totalScore += 1;
1219
1336
  }
1220
1337
  }
@@ -1223,7 +1340,7 @@
1223
1340
  function getClosestMatchingOption(validator, rootSchema, formData, options, selectedOption = -1, discriminatorField, experimental_customMergeAllOf) {
1224
1341
  const resolvedOptions = options.map((option) => resolveAllReferences(option, rootSchema, []));
1225
1342
  const simpleDiscriminatorMatch = getOptionMatchingSimpleDiscriminator(formData, options, discriminatorField);
1226
- if (isNumber(simpleDiscriminatorMatch)) {
1343
+ if (typeof simpleDiscriminatorMatch === "number") {
1227
1344
  return simpleDiscriminatorMatch;
1228
1345
  }
1229
1346
  const allValidIndexes = resolvedOptions.reduce((validList, option, index) => {
@@ -1238,7 +1355,7 @@
1238
1355
  return allValidIndexes[0];
1239
1356
  }
1240
1357
  if (!allValidIndexes.length) {
1241
- times(resolvedOptions.length, (i) => allValidIndexes.push(i));
1358
+ allValidIndexes.push(...resolvedOptions.keys());
1242
1359
  }
1243
1360
  const scoreCount = /* @__PURE__ */ new Set();
1244
1361
  const { bestIndex } = allValidIndexes.reduce(
@@ -1259,10 +1376,12 @@
1259
1376
  }
1260
1377
  return bestIndex;
1261
1378
  }
1379
+
1380
+ // src/constIsAjvDataReference.ts
1262
1381
  function constIsAjvDataReference(schema) {
1263
1382
  const schemaConst = schema[CONST_KEY];
1264
1383
  const schemaType = getSchemaType(schema);
1265
- return isObject(schemaConst) && isString(schemaConst?.$data) && schemaType !== "object" && schemaType !== "array";
1384
+ return isObject(schemaConst) && typeof schemaConst?.$data === "string" && schemaType !== "object" && schemaType !== "array";
1266
1385
  }
1267
1386
 
1268
1387
  // src/isConstant.ts
@@ -1274,6 +1393,8 @@
1274
1393
  function isFixedItems(schema) {
1275
1394
  return Array.isArray(schema.items) && schema.items.every((item) => isObject(item));
1276
1395
  }
1396
+
1397
+ // src/mergeDefaultsWithFormData.ts
1277
1398
  function mergeDefaultsWithFormData(defaults, formData, mergeExtraArrayDefaults = false, defaultSupercedesUndefined = false, overrideFormDataWithDefaults = false) {
1278
1399
  if (Array.isArray(formData)) {
1279
1400
  const defaultsArray = Array.isArray(defaults) ? defaults : [];
@@ -1298,23 +1419,25 @@
1298
1419
  }
1299
1420
  if (isObject(formData)) {
1300
1421
  const acc = Object.assign({}, defaults);
1301
- return Object.keys(formData).reduce((accumulator, key) => {
1302
- const keyValue = get14(formData, key);
1303
- const keyExistsInDefaults = isObject(defaults) && key in defaults;
1304
- const keyExistsInFormData = key in formData;
1305
- const keyDefault = get14(defaults, key) ?? {};
1306
- const defaultValueIsNestedObject = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v));
1307
- const keyDefaultIsObject = keyExistsInDefaults && isObject(get14(defaults, key));
1422
+ const formDataObj = formData;
1423
+ const defaultsObj = isObject(defaults) ? defaults : void 0;
1424
+ return Object.keys(formDataObj).reduce((accumulator, key) => {
1425
+ const keyValue = formDataObj[key];
1426
+ const keyExistsInDefaults = defaultsObj !== void 0 && key in defaultsObj;
1427
+ const keyExistsInFormData = key in formDataObj;
1428
+ const keyDefault = defaultsObj?.[key] ?? {};
1429
+ const defaultValueNeedsDeepMerge = keyExistsInDefaults && isObject(keyDefault) && Object.values(keyDefault).some((v) => isObject(v) || Array.isArray(v));
1430
+ const keyDefaultIsObject = keyExistsInDefaults && isObject(defaultsObj?.[key]);
1308
1431
  const keyHasFormDataObject = keyExistsInFormData && isObject(keyValue);
1309
- if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueIsNestedObject) {
1432
+ if (keyDefaultIsObject && keyHasFormDataObject && !defaultValueNeedsDeepMerge) {
1310
1433
  accumulator[key] = {
1311
- ...get14(defaults, key),
1434
+ ...defaultsObj?.[key],
1312
1435
  ...keyValue
1313
1436
  };
1314
1437
  return accumulator;
1315
1438
  }
1316
1439
  accumulator[key] = mergeDefaultsWithFormData(
1317
- get14(defaults, key),
1440
+ defaultsObj?.[key],
1318
1441
  keyValue,
1319
1442
  mergeExtraArrayDefaults,
1320
1443
  defaultSupercedesUndefined,
@@ -1325,7 +1448,7 @@
1325
1448
  return acc;
1326
1449
  }, acc);
1327
1450
  }
1328
- if (defaultSupercedesUndefined && (!(defaults === void 0) && isNil(formData) || typeof formData === "number" && Number.isNaN(formData)) || overrideFormDataWithDefaults && !isNil(formData)) {
1451
+ if (defaultSupercedesUndefined && (!(defaults === void 0) && formData == null || typeof formData === "number" && Number.isNaN(formData)) || overrideFormDataWithDefaults && formData != null) {
1329
1452
  return defaults;
1330
1453
  }
1331
1454
  return formData;
@@ -1420,8 +1543,8 @@
1420
1543
  let value;
1421
1544
  let label = title;
1422
1545
  if (selectorField) {
1423
- const innerSchema = get14(aSchema, [PROPERTIES_KEY, selectorField], {});
1424
- value = get14(innerSchema, DEFAULT_KEY, get14(innerSchema, CONST_KEY));
1546
+ const innerSchema = getPropertySchema(aSchema, selectorField);
1547
+ value = getByPath(innerSchema, DEFAULT_KEY, getByPath(innerSchema, CONST_KEY));
1425
1548
  label = label ?? innerSchema?.title ?? aSchema.title ?? String(value);
1426
1549
  } else {
1427
1550
  value = toConstant(aSchema);
@@ -1474,9 +1597,18 @@
1474
1597
  }
1475
1598
  return {};
1476
1599
  }
1600
+ function hasContent(value) {
1601
+ if (typeof value === "string" || Array.isArray(value)) {
1602
+ return value.length > 0;
1603
+ }
1604
+ if (typeof value === "object" && value !== null) {
1605
+ return Object.keys(value).length > 0;
1606
+ }
1607
+ return false;
1608
+ }
1477
1609
  function computeDefaultBasedOnSchemaTypeAndDefaults(schema, computedDefault) {
1478
1610
  const { default: schemaDefault, type } = schema;
1479
- const shouldReturnNullAsDefault = Array.isArray(type) && type.includes("null") && isEmpty4(computedDefault) && schemaDefault === null;
1611
+ const shouldReturnNullAsDefault = Array.isArray(type) && type.includes("null") && !hasContent(computedDefault) && schemaDefault === null;
1480
1612
  return shouldReturnNullAsDefault ? null : computedDefault;
1481
1613
  }
1482
1614
  function maybeAddDefaultToObject(acc, key, computedDefault, includeUndefinedValues, isParentRequired, requiredFields = [], experimental_defaultFormStateBehavior = {}, isConst = false, isNullType = false) {
@@ -1484,17 +1616,17 @@
1484
1616
  if (includeUndefinedValues === true || isConst) {
1485
1617
  acc[key] = computedDefault;
1486
1618
  } else if (includeUndefinedValues === "excludeObjectChildren") {
1487
- if (isNullType && computedDefault !== void 0 || !isObject(computedDefault) || !isEmpty4(computedDefault)) {
1619
+ if (isNullType && computedDefault !== void 0 || !isObject(computedDefault) || Object.keys(computedDefault).length > 0) {
1488
1620
  acc[key] = computedDefault;
1489
1621
  }
1490
1622
  } else if (emptyObjectFields !== "skipDefaults") {
1491
1623
  const isSelfOrParentRequired = isParentRequired === void 0 ? requiredFields.includes(key) : isParentRequired;
1492
1624
  if (isObject(computedDefault)) {
1493
1625
  if (emptyObjectFields === "skipEmptyDefaults") {
1494
- if (!isEmpty4(computedDefault)) {
1626
+ if (Object.keys(computedDefault).length > 0) {
1495
1627
  acc[key] = computedDefault;
1496
1628
  }
1497
- } else if ((!isEmpty4(computedDefault) || requiredFields.includes(key)) && (isSelfOrParentRequired || emptyObjectFields !== "populateRequiredDefaults")) {
1629
+ } else if ((Object.keys(computedDefault).length > 0 || requiredFields.includes(key)) && (isSelfOrParentRequired || emptyObjectFields !== "populateRequiredDefaults")) {
1498
1630
  acc[key] = computedDefault;
1499
1631
  }
1500
1632
  } else if (
@@ -1544,7 +1676,7 @@
1544
1676
  updatedRecurseList = _recurseList.concat(refName);
1545
1677
  schemaToCompute = findSchemaDefinition(refName, rootSchema);
1546
1678
  }
1547
- const hasNoExistingData = rawFormData === void 0 || isObject(rawFormData) && isEmpty4(rawFormData);
1679
+ const hasNoExistingData = rawFormData === void 0 || isObject(rawFormData) && Object.keys(rawFormData).length === 0;
1548
1680
  if (schemaToCompute && !defaults && hasNoExistingData) {
1549
1681
  defaults = schema.default;
1550
1682
  }
@@ -1677,13 +1809,13 @@
1677
1809
  } else if (isObject(validFormData) && isObject(schemaToMatch.properties)) {
1678
1810
  validFormData = Object.keys(schemaToMatch.properties).reduce(
1679
1811
  (acc, key) => {
1680
- const propertySchema = get14(schemaToMatch, [PROPERTIES_KEY, key], {});
1812
+ const propertySchema = getPropertySchema(schemaToMatch, key);
1681
1813
  if (key in acc && (shouldRetrieveAllOf || isObject(propertySchema) && ALL_OF_KEY in propertySchema)) {
1682
1814
  acc[key] = ensureFormDataMatchingSchema(
1683
1815
  validator,
1684
1816
  propertySchema,
1685
1817
  rootSchema,
1686
- get14(acc, key),
1818
+ acc[key],
1687
1819
  experimental_defaultFormStateBehavior,
1688
1820
  experimental_customMergeAllOf
1689
1821
  );
@@ -1714,7 +1846,7 @@
1714
1846
  const parentConst = retrievedSchema[CONST_KEY];
1715
1847
  const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(
1716
1848
  (acc, key) => {
1717
- const propertySchema = get14(retrievedSchema, [PROPERTIES_KEY, key], {});
1849
+ const propertySchema = getPropertySchema(retrievedSchema, key);
1718
1850
  const hasParentConst = isObject(parentConst) && parentConst[key] !== void 0;
1719
1851
  const hasConst = (isObject(propertySchema) && CONST_KEY in propertySchema || hasParentConst) && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(propertySchema);
1720
1852
  const computedDefault = computeDefaults(validator, propertySchema, {
@@ -1723,8 +1855,8 @@
1723
1855
  experimental_defaultFormStateBehavior,
1724
1856
  experimental_customMergeAllOf,
1725
1857
  includeUndefinedValues: includeUndefinedValues === true,
1726
- parentDefaults: get14(defaults, [key]),
1727
- rawFormData: get14(formData, [key]),
1858
+ parentDefaults: getByPath(defaults, key),
1859
+ rawFormData: getByPath(formData, key),
1728
1860
  required: retrievedSchema.required?.includes(key),
1729
1861
  shouldMergeDefaultsIntoFormData,
1730
1862
  initialDefaultsGenerated
@@ -1746,24 +1878,24 @@
1746
1878
  );
1747
1879
  if (retrievedSchema.additionalProperties && !initialDefaultsGenerated) {
1748
1880
  const additionalPropertiesSchema = isObject(retrievedSchema.additionalProperties) ? retrievedSchema.additionalProperties : {};
1749
- const keys2 = /* @__PURE__ */ new Set();
1881
+ const keys = /* @__PURE__ */ new Set();
1750
1882
  const formDataRequired = [];
1751
1883
  Object.keys(formData).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => {
1752
- keys2.add(key);
1884
+ keys.add(key);
1753
1885
  formDataRequired.push(key);
1754
1886
  });
1755
1887
  if (isObject(defaults) && formDataRequired.length === 0) {
1756
- Object.keys(defaults).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => keys2.add(key));
1888
+ Object.keys(defaults).filter((key) => !retrievedSchema.properties || !retrievedSchema.properties[key]).forEach((key) => keys.add(key));
1757
1889
  }
1758
- keys2.forEach((key) => {
1890
+ keys.forEach((key) => {
1759
1891
  const computedDefault = computeDefaults(validator, additionalPropertiesSchema, {
1760
1892
  rootSchema,
1761
1893
  _recurseList,
1762
1894
  experimental_defaultFormStateBehavior,
1763
1895
  experimental_customMergeAllOf,
1764
1896
  includeUndefinedValues: includeUndefinedValues === true,
1765
- parentDefaults: get14(defaults, [key]),
1766
- rawFormData: get14(formData, [key]),
1897
+ parentDefaults: getByPath(defaults, key),
1898
+ rawFormData: getByPath(formData, key),
1767
1899
  required: retrievedSchema.required?.includes(key),
1768
1900
  shouldMergeDefaultsIntoFormData,
1769
1901
  initialDefaultsGenerated
@@ -1831,7 +1963,7 @@
1831
1963
  experimental_defaultFormStateBehavior,
1832
1964
  experimental_customMergeAllOf,
1833
1965
  rawFormData: item,
1834
- parentDefaults: get14(defaults, [idx]),
1966
+ parentDefaults: getByPath(defaults, idx),
1835
1967
  required,
1836
1968
  shouldMergeDefaultsIntoFormData,
1837
1969
  initialDefaultsGenerated
@@ -1883,6 +2015,12 @@
1883
2015
  case "array": {
1884
2016
  return getArrayDefaults(validator, rawSchema, computeDefaultsProps, defaults);
1885
2017
  }
2018
+ case "boolean": {
2019
+ if (computeDefaultsProps.required && defaults === void 0) {
2020
+ return false;
2021
+ }
2022
+ return void 0;
2023
+ }
1886
2024
  default:
1887
2025
  return void 0;
1888
2026
  }
@@ -1983,18 +2121,32 @@
1983
2121
  }
1984
2122
  return displayLabel;
1985
2123
  }
2124
+
2125
+ // src/schema/omitExtraData.ts
1986
2126
  function getUsedFormData(formData, fields) {
1987
2127
  if (fields.length === 0 && typeof formData !== "object") {
1988
2128
  return formData;
1989
2129
  }
1990
- const data = pick(formData, fields);
2130
+ const data = {};
2131
+ fields.forEach((field) => {
2132
+ const path = Array.isArray(field) ? field : toPath(field);
2133
+ if (hasByPath(formData, path)) {
2134
+ setByPath(data, path, getByPath(formData, path));
2135
+ }
2136
+ });
1991
2137
  if (Array.isArray(formData)) {
1992
2138
  return Object.keys(data).map((key) => data[key]);
1993
2139
  }
1994
2140
  return data;
1995
2141
  }
1996
2142
  function getFieldNames(pathSchema, formData) {
1997
- const formValueHasData = (value, isLeaf) => typeof value !== "object" || isEmpty4(value) || isLeaf && !isEmpty4(value);
2143
+ const formValueHasData = (value, isLeaf) => {
2144
+ if (typeof value !== "object" || value === null) {
2145
+ return true;
2146
+ }
2147
+ const isEmptyValue = Array.isArray(value) ? value.length === 0 : Object.keys(value).length === 0;
2148
+ return isEmptyValue || isLeaf;
2149
+ };
1998
2150
  const getAllPaths = (_obj, acc = [], paths = [[]]) => {
1999
2151
  const objKeys = Object.keys(_obj);
2000
2152
  objKeys.forEach((key) => {
@@ -2008,7 +2160,7 @@
2008
2160
  }
2009
2161
  } else if (key === NAME_KEY && data !== "") {
2010
2162
  paths.forEach((path) => {
2011
- const formValue = get14(formData, path);
2163
+ const formValue = getByPath(formData, path);
2012
2164
  const isLeaf = objKeys.length === 1;
2013
2165
  if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
2014
2166
  acc.push(path);
@@ -2021,7 +2173,7 @@
2021
2173
  return getAllPaths(pathSchema);
2022
2174
  }
2023
2175
  function isValueEmpty(value) {
2024
- if (isNil(value) || value === "") {
2176
+ if (value == null || value === "") {
2025
2177
  return true;
2026
2178
  }
2027
2179
  if (Array.isArray(value)) {
@@ -2043,19 +2195,17 @@
2043
2195
  return isObject(schemaDef);
2044
2196
  }
2045
2197
  function handleObject(childSchema, source, target) {
2046
- const { properties, additionalProperties, patternProperties, propertyNames } = childSchema;
2198
+ const { properties, additionalProperties, patternProperties } = childSchema;
2047
2199
  const requiredSet = new Set(childSchema.required ?? []);
2048
2200
  function setProperty(key, schemaDef, value, required = false) {
2049
- const v = omit2(schemaDef, value, target[key]);
2201
+ const v = omit(schemaDef, value, target[key]);
2050
2202
  if (!required && isObject(v)) {
2051
2203
  let sd = isSchemaObj(schemaDef) ? schemaDef : {};
2052
2204
  if (sd.$ref !== void 0) {
2053
2205
  sd = findSchemaDefinition(sd.$ref, rootSchema);
2054
2206
  }
2055
2207
  const innerRequired = new Set(sd.required ?? []);
2056
- const shouldDrop = Object.entries(v).every(
2057
- ([k, val]) => !innerRequired.has(k) && isValueEmpty(val)
2058
- );
2208
+ const shouldDrop = Object.entries(v).every(([k, val]) => !innerRequired.has(k) && isValueEmpty(val));
2059
2209
  if (shouldDrop) {
2060
2210
  return;
2061
2211
  }
@@ -2103,31 +2253,29 @@
2103
2253
  }
2104
2254
  }
2105
2255
  }
2106
- if (propertyNames !== void 0) {
2107
- for (const [key, value] of Object.entries(source)) {
2108
- target[key] = value;
2109
- }
2110
- }
2111
2256
  return target;
2112
2257
  }
2113
2258
  function handleArray(childSchema, source, target) {
2114
2259
  const { items, additionalItems } = childSchema;
2115
- if (items !== void 0) {
2116
- if (Array.isArray(items)) {
2117
- for (let i = 0; i < items.length; i += 1) {
2118
- target.push(omit2(items[i], source[i]));
2119
- }
2120
- } else {
2121
- for (let i = 0; i < source.length; i += 1) {
2122
- target.push(omit2(items, source[i]));
2123
- }
2260
+ if (Array.isArray(items)) {
2261
+ const tupleLength = Math.min(items.length, source.length);
2262
+ let i = 0;
2263
+ for (; i < tupleLength; i += 1) {
2264
+ target[i] = omit(items[i], source[i]);
2124
2265
  }
2125
- }
2126
- if (additionalItems) {
2127
- for (let i = target.length; i < source.length; i += 1) {
2128
- target.push(omit2(additionalItems, source[i]));
2266
+ if (!additionalItems) {
2267
+ target.length = tupleLength;
2268
+ return target;
2269
+ }
2270
+ for (; i < source.length; i += 1) {
2271
+ target[i] = omit(additionalItems, source[i]);
2272
+ }
2273
+ } else {
2274
+ for (let i = 0; i < source.length; i += 1) {
2275
+ target[i] = omit(items, source[i]);
2129
2276
  }
2130
2277
  }
2278
+ target.length = source.length;
2131
2279
  return target;
2132
2280
  }
2133
2281
  function handleConditions(childSchema, source, target) {
@@ -2137,7 +2285,7 @@
2137
2285
  }
2138
2286
  const isThenBranch = isSchemaObj(condition) ? validator.isValid(condition, source, rootSchema) : condition;
2139
2287
  const branch = isThenBranch ? then : otherwise;
2140
- return branch === void 0 ? target : omit2(branch, source, target);
2288
+ return branch === void 0 ? target : omit(branch, source, target, false);
2141
2289
  }
2142
2290
  function handleOneOf(oneOf, childSchema, source, target) {
2143
2291
  if (!Array.isArray(oneOf) || isSelect(validator, childSchema, rootSchema, experimental_customMergeAllOf)) {
@@ -2155,7 +2303,7 @@
2155
2303
  );
2156
2304
  const winning = oneOf[bestIndex];
2157
2305
  const resolved = isObject(winning) ? resolveAllReferences(winning, rootSchema, []) : scoringOptions[bestIndex];
2158
- return omit2(resolved, source, target);
2306
+ return omit(resolved, source, target, false);
2159
2307
  }
2160
2308
  function handleAnyOf(childSchema, source, target) {
2161
2309
  const { anyOf } = childSchema;
@@ -2165,7 +2313,7 @@
2165
2313
  if (source === void 0 || Array.isArray(source) && source.length === 0 || isObject(source) && Object.keys(source).length === 0) {
2166
2314
  let result = target;
2167
2315
  for (const branch of anyOf) {
2168
- result = omit2(branch, source, result);
2316
+ result = omit(branch, source, result, false);
2169
2317
  }
2170
2318
  return result;
2171
2319
  }
@@ -2179,29 +2327,29 @@
2179
2327
  let result = target;
2180
2328
  for (const [key, deps] of Object.entries(dependencies)) {
2181
2329
  if (key in source && !Array.isArray(deps)) {
2182
- result = omit2(deps, source, result);
2330
+ result = omit(deps, source, result, false);
2183
2331
  }
2184
2332
  }
2185
2333
  return result;
2186
2334
  }
2187
- function omit2(schemaDef, source, target) {
2335
+ function omit(schemaDef, source, target, useSourceAsFallback = true) {
2188
2336
  if (source === void 0 || schemaDef === false) {
2189
2337
  return void 0;
2190
2338
  }
2191
- if (schemaDef === true || isEmpty4(schemaDef)) {
2192
- return source;
2339
+ if (schemaDef === true || !schemaDef || Object.keys(schemaDef).length === 0) {
2340
+ return target ?? (useSourceAsFallback ? source : void 0);
2193
2341
  }
2194
2342
  let localSchema = schemaDef;
2195
2343
  const { $ref: ref, allOf } = localSchema;
2196
2344
  if (ref !== void 0) {
2197
- return omit2(findSchemaDefinition(ref, rootSchema), source, target);
2345
+ return omit(findSchemaDefinition(ref, rootSchema), source, target, useSourceAsFallback);
2198
2346
  }
2199
2347
  if (allOf) {
2200
2348
  localSchema = doMergeAllOf(localSchema, experimental_customMergeAllOf);
2201
2349
  const remainingAllOf = localSchema.allOf;
2202
2350
  if (remainingAllOf) {
2203
2351
  for (let i = 0; i < remainingAllOf.length; i++) {
2204
- target = omit2(remainingAllOf[i], source, target);
2352
+ target = omit(remainingAllOf[i], source, target, false);
2205
2353
  }
2206
2354
  }
2207
2355
  }
@@ -2216,14 +2364,27 @@
2216
2364
  if (!Array.isArray(source)) {
2217
2365
  return void 0;
2218
2366
  }
2219
- filtered = handleArray(localSchema, source, Array.isArray(filtered) ? filtered : []);
2220
- } else if (filtered === void 0) {
2221
- filtered = source;
2367
+ if (localSchema.items !== void 0) {
2368
+ filtered = handleArray(localSchema, source, Array.isArray(filtered) ? filtered : []);
2369
+ }
2370
+ }
2371
+ const afterConditions = handleConditions(localSchema, source, filtered);
2372
+ if (localSchema.additionalProperties === false && isObjectValue(afterConditions)) {
2373
+ const knownKeys = new Set(Object.keys(localSchema.properties ?? {}));
2374
+ const patterns = localSchema.patternProperties ? Object.keys(localSchema.patternProperties).map((p) => new RegExp(p)) : [];
2375
+ for (const key of Object.keys(afterConditions)) {
2376
+ if (!knownKeys.has(key) && !patterns.some((re) => re.test(key))) {
2377
+ delete afterConditions[key];
2378
+ }
2379
+ }
2222
2380
  }
2223
- return handleDependencies(localSchema, source, handleConditions(localSchema, source, filtered));
2381
+ const result = handleDependencies(localSchema, source, afterConditions);
2382
+ return result ?? (useSourceAsFallback ? source : void 0);
2224
2383
  }
2225
- return omit2(schema, formData);
2384
+ return omit(schema, formData);
2226
2385
  }
2386
+
2387
+ // src/schema/sanitizeDataForNewSchema.ts
2227
2388
  var NO_VALUE = /* @__PURE__ */ Symbol("no Value");
2228
2389
  function enumValuesForSchema(schema) {
2229
2390
  if (Array.isArray(schema.enum)) {
@@ -2246,7 +2407,7 @@
2246
2407
  if (!enumValues || enumValues.some((value) => deepEquals_default(value, formValue))) {
2247
2408
  return NO_VALUE;
2248
2409
  }
2249
- const defaultValue = get14(schema, DEFAULT_KEY, NO_VALUE);
2410
+ const defaultValue = getByPath(schema, DEFAULT_KEY, NO_VALUE);
2250
2411
  if (defaultValue !== NO_VALUE && enumValues.some((value) => deepEquals_default(value, defaultValue))) {
2251
2412
  return defaultValue;
2252
2413
  }
@@ -2254,23 +2415,25 @@
2254
2415
  }
2255
2416
  function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, data = {}, experimental_customMergeAllOf) {
2256
2417
  let newFormData;
2257
- if (has5(newSchema, PROPERTIES_KEY)) {
2418
+ const newProperties = newSchema?.[PROPERTIES_KEY];
2419
+ if (newProperties) {
2258
2420
  const removeOldSchemaData = {};
2259
- if (has5(oldSchema, PROPERTIES_KEY)) {
2260
- const properties = get14(oldSchema, PROPERTIES_KEY, {});
2261
- Object.keys(properties).forEach((key) => {
2262
- if (has5(data, key)) {
2421
+ const oldProperties = oldSchema?.[PROPERTIES_KEY];
2422
+ if (oldProperties) {
2423
+ Object.keys(oldProperties).forEach((key) => {
2424
+ if (hasByPath(data, key)) {
2263
2425
  removeOldSchemaData[key] = void 0;
2264
2426
  }
2265
2427
  });
2266
2428
  }
2267
- const keys2 = Object.keys(get14(newSchema, PROPERTIES_KEY, {}));
2429
+ const keys = Object.keys(newProperties);
2268
2430
  const nestedData = {};
2269
- keys2.forEach((key) => {
2270
- const formValue = get14(data, key);
2271
- let oldKeyedSchema = get14(oldSchema, [PROPERTIES_KEY, key], {});
2272
- let newKeyedSchema = get14(newSchema, [PROPERTIES_KEY, key], {});
2273
- if (has5(oldKeyedSchema, REF_KEY)) {
2431
+ keys.forEach((key) => {
2432
+ const formValue = data?.[key];
2433
+ const isNewProperty = !hasByPath(oldSchema, [PROPERTIES_KEY, key]);
2434
+ let oldKeyedSchema = getPropertySchema(oldSchema, key);
2435
+ let newKeyedSchema = getPropertySchema(newSchema, key);
2436
+ if (hasByPath(oldKeyedSchema, REF_KEY)) {
2274
2437
  oldKeyedSchema = retrieveSchema(
2275
2438
  validator,
2276
2439
  oldKeyedSchema,
@@ -2279,7 +2442,7 @@
2279
2442
  experimental_customMergeAllOf
2280
2443
  );
2281
2444
  }
2282
- if (has5(newKeyedSchema, REF_KEY)) {
2445
+ if (hasByPath(newKeyedSchema, REF_KEY)) {
2283
2446
  newKeyedSchema = retrieveSchema(
2284
2447
  validator,
2285
2448
  newKeyedSchema,
@@ -2288,10 +2451,10 @@
2288
2451
  experimental_customMergeAllOf
2289
2452
  );
2290
2453
  }
2291
- const oldSchemaTypeForKey = get14(oldKeyedSchema, "type");
2292
- const newSchemaTypeForKey = get14(newKeyedSchema, "type");
2454
+ const oldSchemaTypeForKey = oldKeyedSchema.type;
2455
+ const newSchemaTypeForKey = newKeyedSchema.type;
2293
2456
  if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
2294
- if (has5(removeOldSchemaData, key)) {
2457
+ if (key in removeOldSchemaData) {
2295
2458
  delete removeOldSchemaData[key];
2296
2459
  }
2297
2460
  if (newSchemaTypeForKey === "object" || newSchemaTypeForKey === "array" && Array.isArray(formValue)) {
@@ -2299,7 +2462,7 @@
2299
2462
  validator,
2300
2463
  rootSchema,
2301
2464
  newKeyedSchema,
2302
- oldKeyedSchema,
2465
+ isNewProperty && newSchemaTypeForKey === "array" ? newKeyedSchema : oldKeyedSchema,
2303
2466
  formValue,
2304
2467
  experimental_customMergeAllOf
2305
2468
  );
@@ -2307,21 +2470,21 @@
2307
2470
  nestedData[key] = itemData;
2308
2471
  }
2309
2472
  } else {
2310
- const newOptionDefault = get14(newKeyedSchema, DEFAULT_KEY, NO_VALUE);
2311
- const oldOptionDefault = get14(oldKeyedSchema, DEFAULT_KEY, NO_VALUE);
2473
+ const newOptionDefault = getByPath(newKeyedSchema, DEFAULT_KEY, NO_VALUE);
2474
+ const oldOptionDefault = getByPath(oldKeyedSchema, DEFAULT_KEY, NO_VALUE);
2312
2475
  if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
2313
- if (oldOptionDefault === formValue) {
2476
+ if (isNewProperty && formValue === void 0 || oldOptionDefault === formValue) {
2314
2477
  removeOldSchemaData[key] = newOptionDefault;
2315
- } else if (get14(newKeyedSchema, "readOnly") === true) {
2478
+ } else if (newKeyedSchema.readOnly === true) {
2316
2479
  removeOldSchemaData[key] = void 0;
2317
2480
  }
2318
2481
  }
2319
- const newOptionConst = get14(newKeyedSchema, CONST_KEY, NO_VALUE);
2320
- const oldOptionConst = get14(oldKeyedSchema, CONST_KEY, NO_VALUE);
2482
+ const newOptionConst = getByPath(newKeyedSchema, CONST_KEY, NO_VALUE);
2483
+ const oldOptionConst = getByPath(oldKeyedSchema, CONST_KEY, NO_VALUE);
2321
2484
  if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
2322
2485
  removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
2323
2486
  }
2324
- if (has5(data, key)) {
2487
+ if (hasByPath(data, key)) {
2325
2488
  const enumReplacement = replacementForInvalidEnumValue(newKeyedSchema, formValue);
2326
2489
  if (enumReplacement !== NO_VALUE) {
2327
2490
  removeOldSchemaData[key] = enumReplacement;
@@ -2335,11 +2498,11 @@
2335
2498
  ...removeOldSchemaData,
2336
2499
  ...nestedData
2337
2500
  };
2338
- } else if (get14(oldSchema, "type") === "array" && get14(newSchema, "type") === "array" && Array.isArray(data)) {
2339
- let oldSchemaItems = get14(oldSchema, "items");
2340
- let newSchemaItems = get14(newSchema, "items");
2501
+ } else if (oldSchema?.type === "array" && newSchema?.type === "array" && Array.isArray(data)) {
2502
+ let oldSchemaItems = oldSchema.items;
2503
+ let newSchemaItems = newSchema.items;
2341
2504
  if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
2342
- if (has5(oldSchemaItems, REF_KEY)) {
2505
+ if (hasByPath(oldSchemaItems, REF_KEY)) {
2343
2506
  oldSchemaItems = retrieveSchema(
2344
2507
  validator,
2345
2508
  oldSchemaItems,
@@ -2348,7 +2511,7 @@
2348
2511
  experimental_customMergeAllOf
2349
2512
  );
2350
2513
  }
2351
- if (has5(newSchemaItems, REF_KEY)) {
2514
+ if (hasByPath(newSchemaItems, REF_KEY)) {
2352
2515
  newSchemaItems = retrieveSchema(
2353
2516
  validator,
2354
2517
  newSchemaItems,
@@ -2357,10 +2520,10 @@
2357
2520
  experimental_customMergeAllOf
2358
2521
  );
2359
2522
  }
2360
- const oldSchemaType = get14(oldSchemaItems, "type");
2361
- const newSchemaType = get14(newSchemaItems, "type");
2523
+ const oldSchemaType = getByPath(oldSchemaItems, "type");
2524
+ const newSchemaType = getByPath(newSchemaItems, "type");
2362
2525
  if (!oldSchemaType || oldSchemaType === newSchemaType) {
2363
- const maxItems = get14(newSchema, "maxItems", -1);
2526
+ const maxItems = newSchema.maxItems ?? -1;
2364
2527
  if (newSchemaType === "object") {
2365
2528
  newFormData = data.reduce((newValue, aValue) => {
2366
2529
  const itemValue = sanitizeDataForNewSchema(
@@ -2388,6 +2551,8 @@
2388
2551
  }
2389
2552
  return newFormData;
2390
2553
  }
2554
+
2555
+ // src/schema/toPathSchema.ts
2391
2556
  function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
2392
2557
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
2393
2558
  const innerSchema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
@@ -2434,9 +2599,9 @@
2434
2599
  };
2435
2600
  }
2436
2601
  if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
2437
- set3(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2438
- const additionalSchema = isObject2(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2439
- const definedProperties = get14(schema, PROPERTIES_KEY, {});
2602
+ setByPath(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
2603
+ const additionalSchema = isObject(schema[ADDITIONAL_PROPERTIES_KEY]) ? schema[ADDITIONAL_PROPERTIES_KEY] : {};
2604
+ const definedProperties = schema[PROPERTIES_KEY] ?? {};
2440
2605
  for (const key of Object.keys(formData ?? {})) {
2441
2606
  if (!(key in definedProperties)) {
2442
2607
  pathSchema[key] = toPathSchemaInternal(
@@ -2444,7 +2609,7 @@
2444
2609
  additionalSchema,
2445
2610
  `${name}.${key}`,
2446
2611
  rootSchema,
2447
- get14(formData, [key]),
2612
+ getByPath(formData, key),
2448
2613
  _recurseList,
2449
2614
  experimental_customMergeAllOf
2450
2615
  );
@@ -2494,7 +2659,7 @@
2494
2659
  }
2495
2660
  } else if (PROPERTIES_KEY in schema) {
2496
2661
  for (const property in schema.properties) {
2497
- const field = get14(schema, [PROPERTIES_KEY, property], {});
2662
+ const field = getPropertySchema(schema, property);
2498
2663
  pathSchema[property] = toPathSchemaInternal(
2499
2664
  validator,
2500
2665
  field,
@@ -2502,7 +2667,7 @@
2502
2667
  rootSchema,
2503
2668
  // It's possible that formData is not an object -- this can happen if an
2504
2669
  // array item has just been added, but not populated with data yet
2505
- get14(formData, [property]),
2670
+ getByPath(formData, property),
2506
2671
  _recurseList,
2507
2672
  experimental_customMergeAllOf
2508
2673
  );
@@ -2516,6 +2681,10 @@
2516
2681
 
2517
2682
  // src/createSchemaUtils.ts
2518
2683
  var SchemaUtils = class {
2684
+ rootSchema;
2685
+ validator;
2686
+ experimental_defaultFormStateBehavior;
2687
+ experimental_customMergeAllOf;
2519
2688
  /** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
2520
2689
  *
2521
2690
  * @param validator - An implementation of the `ValidatorType` interface that will be forwarded to all the APIs
@@ -2525,7 +2694,7 @@
2525
2694
  */
2526
2695
  constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
2527
2696
  if (rootSchema?.[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
2528
- this.rootSchema = makeAllReferencesAbsolute(rootSchema, get14(rootSchema, ID_KEY, "#"));
2697
+ this.rootSchema = makeAllReferencesAbsolute(rootSchema, rootSchema[ID_KEY] ?? "#");
2529
2698
  } else {
2530
2699
  this.rootSchema = rootSchema;
2531
2700
  }
@@ -2916,8 +3085,8 @@
2916
3085
 
2917
3086
  // src/enumOptionSelectedValue.ts
2918
3087
  function enumOptionSelectedValue(value, enumOptions, multiple, format = "indexed", emptyValue) {
2919
- const isEmpty9 = typeof value === "undefined" || multiple && Array.isArray(value) && value.length < 1 || !multiple && value === emptyValue;
2920
- if (isEmpty9) {
3088
+ const isEmpty = typeof value === "undefined" || multiple && Array.isArray(value) && value.length < 1 || !multiple && value === emptyValue;
3089
+ if (isEmpty) {
2921
3090
  return emptyValue;
2922
3091
  }
2923
3092
  if (format === "realValue") {
@@ -2926,9 +3095,11 @@
2926
3095
  const indexes = enumOptionsIndexForValue(value, enumOptions, multiple);
2927
3096
  return typeof indexes === "undefined" ? emptyValue : indexes;
2928
3097
  }
3098
+
3099
+ // src/enumOptionsSelectValue.ts
2929
3100
  function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
2930
3101
  const value = enumOptionsValueForIndex(valueIndex, allEnumOptions);
2931
- if (!isNil(value)) {
3102
+ if (value != null) {
2932
3103
  const index = allEnumOptions.findIndex((opt) => value === opt.value);
2933
3104
  const all = allEnumOptions.map(({ value: val }) => val);
2934
3105
  const updated = selected.slice(0, index).concat(value, selected.slice(index));
@@ -2961,11 +3132,13 @@
2961
3132
  }
2962
3133
  return decodeSingle(value, enumOptions, emptyValue);
2963
3134
  }
3135
+
3136
+ // src/enumOptionValueEncoder.ts
2964
3137
  function enumOptionValueEncoder(value, index, format = "indexed") {
2965
3138
  if (format !== "realValue") {
2966
3139
  return String(index);
2967
3140
  }
2968
- if (isNil(value)) {
3141
+ if (value == null) {
2969
3142
  return "";
2970
3143
  }
2971
3144
  if (typeof value === "object") {
@@ -2973,17 +3146,19 @@
2973
3146
  }
2974
3147
  return String(value);
2975
3148
  }
3149
+
3150
+ // src/ErrorSchemaBuilder.ts
2976
3151
  var ErrorSchemaBuilder = class {
3152
+ /** The error schema being built
3153
+ *
3154
+ * @private
3155
+ */
3156
+ errorSchema = {};
2977
3157
  /** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
2978
3158
  *
2979
3159
  * @param [initialSchema] - The optional set of initial errors, that will be cloned into the class
2980
3160
  */
2981
3161
  constructor(initialSchema) {
2982
- /** The error schema being built
2983
- *
2984
- * @private
2985
- */
2986
- this.errorSchema = {};
2987
3162
  this.resetAllErrors(initialSchema);
2988
3163
  }
2989
3164
  /** Returns the `ErrorSchema` that has been updated by the methods of the `ErrorSchemaBuilder`
@@ -2998,11 +3173,14 @@
2998
3173
  * @private
2999
3174
  */
3000
3175
  getOrCreateErrorBlock(pathOfError) {
3001
- const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
3002
- let errorBlock = hasPath ? get14(this.errorSchema, pathOfError) : this.errorSchema;
3003
- if (!errorBlock && pathOfError) {
3176
+ const path = typeof pathOfError === "string" ? toPath(pathOfError) : pathOfError ?? [];
3177
+ if (path.length === 0) {
3178
+ return this.errorSchema;
3179
+ }
3180
+ let errorBlock = getByPath(this.errorSchema, path);
3181
+ if (!errorBlock) {
3004
3182
  errorBlock = {};
3005
- setWith(this.errorSchema, pathOfError, errorBlock, Object);
3183
+ setByPath(this.errorSchema, path, errorBlock, true);
3006
3184
  }
3007
3185
  return errorBlock;
3008
3186
  }
@@ -3012,12 +3190,12 @@
3012
3190
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
3013
3191
  */
3014
3192
  resetAllErrors(initialSchema) {
3015
- this.errorSchema = initialSchema ? cloneDeep(initialSchema) : {};
3193
+ this.errorSchema = initialSchema ? structuredClone(initialSchema) : {};
3016
3194
  return this;
3017
3195
  }
3018
3196
  /** Adds the `errorOrList` to the list of errors in the `ErrorSchema` at either the root level or the location within
3019
- * the schema described by the `pathOfError`. For more information about how to specify the path see the
3020
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3197
+ * the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
3198
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3021
3199
  *
3022
3200
  * @param errorOrList - The error or list of errors to add into the `ErrorSchema`
3023
3201
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
@@ -3025,21 +3203,21 @@
3025
3203
  */
3026
3204
  addErrors(errorOrList, pathOfError) {
3027
3205
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3028
- let errorsList = get14(errorBlock, ERRORS_KEY);
3206
+ let errorsList = errorBlock[ERRORS_KEY];
3029
3207
  if (!Array.isArray(errorsList)) {
3030
3208
  errorsList = [];
3031
3209
  errorBlock[ERRORS_KEY] = errorsList;
3032
3210
  }
3033
3211
  if (Array.isArray(errorOrList)) {
3034
- set3(errorBlock, ERRORS_KEY, [.../* @__PURE__ */ new Set([...errorsList, ...errorOrList])]);
3212
+ errorBlock[ERRORS_KEY] = [.../* @__PURE__ */ new Set([...errorsList, ...errorOrList])];
3035
3213
  } else {
3036
- set3(errorBlock, ERRORS_KEY, [.../* @__PURE__ */ new Set([...errorsList, errorOrList])]);
3214
+ errorBlock[ERRORS_KEY] = [.../* @__PURE__ */ new Set([...errorsList, errorOrList])];
3037
3215
  }
3038
3216
  return this;
3039
3217
  }
3040
3218
  /** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location
3041
- * within the schema described by the `pathOfError`. For more information about how to specify the path see the
3042
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3219
+ * within the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
3220
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3043
3221
  *
3044
3222
  * @param errorOrList - The error or list of errors to set into the `ErrorSchema`
3045
3223
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)
@@ -3048,36 +3226,59 @@
3048
3226
  setErrors(errorOrList, pathOfError) {
3049
3227
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3050
3228
  const listToAdd = Array.isArray(errorOrList) ? [.../* @__PURE__ */ new Set([...errorOrList])] : [errorOrList];
3051
- set3(errorBlock, ERRORS_KEY, listToAdd);
3229
+ errorBlock[ERRORS_KEY] = listToAdd;
3052
3230
  return this;
3053
3231
  }
3054
3232
  /** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by
3055
- * the `pathOfError`. For more information about how to specify the path see the
3056
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
3233
+ * the `pathOfError`. The path is either a dotted string (with optional bracketed array
3234
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
3057
3235
  *
3058
3236
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)
3059
3237
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
3060
3238
  */
3061
3239
  clearErrors(pathOfError) {
3062
3240
  const errorBlock = this.getOrCreateErrorBlock(pathOfError);
3063
- set3(errorBlock, ERRORS_KEY, []);
3241
+ errorBlock[ERRORS_KEY] = [];
3064
3242
  return this;
3065
3243
  }
3066
3244
  };
3067
- function getChangedFields(a, b) {
3068
- const aIsPlainObject = isPlainObject2(a);
3069
- const bIsPlainObject = isPlainObject2(b);
3070
- if (a === b || !aIsPlainObject && !bIsPlainObject) {
3245
+
3246
+ // src/getChangedFields.ts
3247
+ function getChangedDescendants(a, b) {
3248
+ if (isPlainObject(a) && isPlainObject(b)) {
3249
+ return getChangedFields(a, b, true);
3250
+ }
3251
+ if (Array.isArray(a) && Array.isArray(b) && a.length === b.length) {
3252
+ return a.flatMap((value, index) => {
3253
+ if (deepEquals_default(value, b[index])) {
3254
+ return [];
3255
+ }
3256
+ const descendants = getChangedDescendants(value, b[index]);
3257
+ return descendants.length ? descendants.map((path) => `${index}.${path}`) : [String(index)];
3258
+ });
3259
+ }
3260
+ return [];
3261
+ }
3262
+ function getChangedFields(a, b, deep = false) {
3263
+ if (a === b) {
3071
3264
  return [];
3072
3265
  }
3073
- if (aIsPlainObject && !bIsPlainObject) {
3074
- return keys(a);
3266
+ if (!isPlainObject(a)) {
3267
+ return isPlainObject(b) ? Object.keys(b) : [];
3075
3268
  }
3076
- if (!aIsPlainObject && bIsPlainObject) {
3077
- return keys(b);
3269
+ if (!isPlainObject(b)) {
3270
+ return Object.keys(a);
3078
3271
  }
3079
- const unequalFields = keys(pickBy(a, (value, key) => !deepEquals_default(value, get14(b, key))));
3080
- const diffFields = difference(keys(b), keys(a));
3272
+ const aKeys = Object.keys(a);
3273
+ const aKeySet = new Set(aKeys);
3274
+ const unequalFields = aKeys.filter((key) => !deepEquals_default(a[key], getByPath(b, key))).flatMap((key) => {
3275
+ if (!deep) {
3276
+ return [key];
3277
+ }
3278
+ const descendants = getChangedDescendants(a[key], getByPath(b, key));
3279
+ return descendants.length ? descendants.map((path) => `${key}.${path}`) : [key];
3280
+ });
3281
+ const diffFields = Object.keys(b).filter((key) => !aKeySet.has(key));
3081
3282
  return [...unequalFields, ...diffFields];
3082
3283
  }
3083
3284
 
@@ -3156,6 +3357,9 @@
3156
3357
  if (options.autocomplete) {
3157
3358
  inputProps.autoComplete = options.autocomplete;
3158
3359
  }
3360
+ if (options.autocapitalize) {
3361
+ inputProps.autoCapitalize = options.autocapitalize;
3362
+ }
3159
3363
  if (options.accept) {
3160
3364
  inputProps.accept = options.accept;
3161
3365
  }
@@ -3200,8 +3404,11 @@
3200
3404
  uiOptions[name] || templates[name]
3201
3405
  );
3202
3406
  }
3407
+
3408
+ // src/getTestIds.ts
3409
+ var testIdCounter = 0;
3203
3410
  function getTestIds() {
3204
- if (get14(globalThis, "process.env.NODE_ENV") !== "test") {
3411
+ if (getByPath(globalThis, ["process", "env", "NODE_ENV"]) !== "test") {
3205
3412
  return {};
3206
3413
  }
3207
3414
  const ids = /* @__PURE__ */ new Map();
@@ -3210,7 +3417,8 @@
3210
3417
  {
3211
3418
  get(_obj, prop) {
3212
3419
  if (!ids.has(prop)) {
3213
- ids.set(prop, uniqueId("test-id-"));
3420
+ testIdCounter += 1;
3421
+ ids.set(prop, `test-id-${testIdCounter}`);
3214
3422
  }
3215
3423
  return ids.get(prop);
3216
3424
  }
@@ -3270,11 +3478,11 @@
3270
3478
  }
3271
3479
  };
3272
3480
  function mergeWidgetOptions(AWidget) {
3273
- let MergedWidget = get14(AWidget, "MergedWidget");
3481
+ let { MergedWidget } = AWidget;
3274
3482
  if (!MergedWidget) {
3275
3483
  const defaultOptions = AWidget.defaultProps?.options || {};
3276
3484
  MergedWidget = ({ options, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(AWidget, { options: { ...defaultOptions, ...options }, ...props });
3277
- set3(AWidget, "MergedWidget", MergedWidget);
3485
+ AWidget.MergedWidget = MergedWidget;
3278
3486
  }
3279
3487
  return MergedWidget;
3280
3488
  }
@@ -3346,8 +3554,10 @@
3346
3554
  throw e;
3347
3555
  }
3348
3556
  }
3557
+
3558
+ // src/idGenerators.ts
3349
3559
  function idGenerator(id, suffix) {
3350
- const theId = isString(id) ? id : id[ID_KEY];
3560
+ const theId = typeof id === "string" ? id : id[ID_KEY];
3351
3561
  return `${theId}__${suffix}`;
3352
3562
  }
3353
3563
  function descriptionId(id) {
@@ -3378,8 +3588,16 @@
3378
3588
  function optionalControlsId(id, element) {
3379
3589
  return idGenerator(id, `optional${element}`);
3380
3590
  }
3591
+
3592
+ // src/isFormDataAvailable.ts
3381
3593
  function isFormDataAvailable(formData) {
3382
- return !isNil(formData) && (!isObject2(formData) || Array.isArray(formData) || !isEmpty4(formData));
3594
+ if (formData === void 0 || formData === null) {
3595
+ return false;
3596
+ }
3597
+ if (typeof formData !== "object" || Array.isArray(formData)) {
3598
+ return true;
3599
+ }
3600
+ return Object.keys(formData).length > 0;
3383
3601
  }
3384
3602
 
3385
3603
  // src/isRootSchema.ts
@@ -3413,12 +3631,14 @@
3413
3631
  );
3414
3632
  }
3415
3633
  }
3634
+
3635
+ // src/lookupFromFormContext.ts
3416
3636
  function lookupFromFormContext(regOrFc, toLookup, fallback) {
3417
3637
  const lookupPath = [LOOKUP_MAP_NAME];
3418
- if (has5(regOrFc, FORM_CONTEXT_NAME)) {
3638
+ if (hasByPath(regOrFc, FORM_CONTEXT_NAME)) {
3419
3639
  lookupPath.unshift(FORM_CONTEXT_NAME);
3420
3640
  }
3421
- return get14(regOrFc, [...lookupPath, toLookup], fallback);
3641
+ return getByPath(regOrFc, [...lookupPath, toLookup], fallback);
3422
3642
  }
3423
3643
 
3424
3644
  // src/nameGenerators.ts
@@ -3441,6 +3661,10 @@
3441
3661
  return `${idPrefix}.${path.map(String).join(".")}`;
3442
3662
  };
3443
3663
 
3664
+ // src/noop.ts
3665
+ function noop() {
3666
+ }
3667
+
3444
3668
  // src/orderProperties.ts
3445
3669
  function orderProperties(properties, order) {
3446
3670
  if (!Array.isArray(order)) {
@@ -3553,6 +3777,8 @@
3553
3777
  }
3554
3778
  return result;
3555
3779
  }
3780
+
3781
+ // src/resolveUiSchema.ts
3556
3782
  function resolveUiSchema(schema, localUiSchema, registry) {
3557
3783
  const ref = schema[RJSF_REF_KEY] ?? schema[REF_KEY];
3558
3784
  const definitions = registry.uiSchemaDefinitions;
@@ -3560,7 +3786,7 @@
3560
3786
  let result;
3561
3787
  if (!definitionUiSchema) {
3562
3788
  result = localUiSchema || {};
3563
- } else if (!localUiSchema || isEmpty4(localUiSchema)) {
3789
+ } else if (!localUiSchema || Object.keys(localUiSchema).length === 0) {
3564
3790
  result = { ...definitionUiSchema };
3565
3791
  } else {
3566
3792
  result = mergeObjects(definitionUiSchema, localUiSchema);
@@ -3686,10 +3912,14 @@
3686
3912
  const { props, state } = component;
3687
3913
  return !deepEquals_default(props, nextProps) || !deepEquals_default(state, nextState);
3688
3914
  }
3915
+
3916
+ // src/shouldRenderOptionalField.ts
3689
3917
  function getSchemaTypesForXxxOf(schemas) {
3690
- const allTypes = uniq(
3691
- schemas.map((s) => isObject2(s) ? getSchemaType(s) : void 0).flat().filter((t) => t !== void 0)
3692
- );
3918
+ const allTypes = [
3919
+ ...new Set(
3920
+ schemas.map((s) => isObject(s) ? getSchemaType(s) : void 0).flat().filter((t) => t !== void 0)
3921
+ )
3922
+ ];
3693
3923
  return allTypes.length === 1 ? allTypes[0] : allTypes;
3694
3924
  }
3695
3925
  function shouldRenderOptionalField(registry, schema, required, uiSchema) {
@@ -3712,42 +3942,31 @@
3712
3942
  const datetime = new Date(utcTime).toJSON();
3713
3943
  return time ? datetime : datetime.slice(0, 10);
3714
3944
  }
3945
+
3946
+ // src/toErrorList.ts
3715
3947
  function toErrorList(errorSchema, fieldPath = []) {
3716
- if (!errorSchema) {
3717
- return [];
3718
- }
3719
- let errorList = [];
3720
- if (ERRORS_KEY in errorSchema) {
3721
- errorList = errorList.concat(
3722
- errorSchema[ERRORS_KEY].map((message) => {
3723
- const property = `.${fieldPath.join(".")}`;
3724
- return {
3725
- property,
3726
- message,
3727
- stack: `${property} ${message}`
3728
- };
3729
- })
3730
- );
3731
- }
3948
+ return errorSchema ? errorsFrom(errorSchema, fieldPath) : [];
3949
+ }
3950
+ function errorsFrom(errorSchema, fieldPath) {
3951
+ const errors = errorSchema[ERRORS_KEY];
3952
+ const property = `.${fieldPath.join(".")}`;
3953
+ const errorList = Array.isArray(errors) ? errors.map((message) => ({ property, message, stack: `${property} ${message}` })) : [];
3732
3954
  return Object.keys(errorSchema).reduce((currentList, key) => {
3733
- if (key !== ERRORS_KEY) {
3734
- const childSchema = errorSchema[key];
3735
- if (isPlainObject2(childSchema)) {
3736
- return currentList.concat(toErrorList(childSchema, [...fieldPath, key]));
3737
- }
3955
+ const childSchema = errorSchema[key];
3956
+ if (key !== ERRORS_KEY && isPlainObject(childSchema)) {
3957
+ return currentList.concat(errorsFrom(childSchema, [...fieldPath, key]));
3738
3958
  }
3739
3959
  return currentList;
3740
3960
  }, errorList);
3741
3961
  }
3962
+
3963
+ // src/toErrorSchema.ts
3742
3964
  function toErrorSchema(errors) {
3743
3965
  const builder = new ErrorSchemaBuilder();
3744
3966
  if (errors.length) {
3745
3967
  errors.forEach((error) => {
3746
3968
  const { property, message } = error;
3747
- const path = property === "." ? [] : toPath(property);
3748
- if (path.length > 0 && path[0] === "") {
3749
- path.splice(0, 1);
3750
- }
3969
+ const path = property ? toPath(property) : [];
3751
3970
  if (message) {
3752
3971
  builder.addErrors(message, path);
3753
3972
  }
@@ -3768,16 +3987,21 @@
3768
3987
  }
3769
3988
  return { path, [ID_KEY]: id, ...name !== void 0 && { name } };
3770
3989
  }
3990
+
3991
+ // src/unwrapErrorHandler.ts
3771
3992
  function unwrapErrorHandler(errorHandler) {
3772
- return Object.keys(errorHandler).reduce((acc, key) => {
3993
+ return unwrapErrors(errorHandler);
3994
+ }
3995
+ function unwrapErrors(errors) {
3996
+ return Object.keys(errors).reduce((acc, key) => {
3773
3997
  if (key === "addError") {
3774
3998
  return acc;
3775
3999
  }
3776
- const childSchema = errorHandler[key];
3777
- if (isPlainObject2(childSchema)) {
4000
+ const childSchema = errors[key];
4001
+ if (isPlainObject(childSchema)) {
3778
4002
  return {
3779
4003
  ...acc,
3780
- [key]: unwrapErrorHandler(childSchema)
4004
+ [key]: unwrapErrors(childSchema)
3781
4005
  };
3782
4006
  }
3783
4007
  return { ...acc, [key]: childSchema };
@@ -3990,6 +4214,8 @@
3990
4214
  const SSS = pad(date.getMilliseconds(), 3);
3991
4215
  return `${yyyy}-${MM}-${dd}T${hh}:${mm}:${ss}.${SSS}`;
3992
4216
  }
4217
+
4218
+ // src/validationDataMerge.ts
3993
4219
  function validationDataMerge(validationData, additionalErrorSchema, preventDuplicates = false) {
3994
4220
  if (!additionalErrorSchema) {
3995
4221
  return validationData;
@@ -3997,7 +4223,7 @@
3997
4223
  const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
3998
4224
  let errors = toErrorList(additionalErrorSchema);
3999
4225
  let errorSchema = additionalErrorSchema;
4000
- if (!isEmpty4(oldErrorSchema)) {
4226
+ if (oldErrorSchema && Object.keys(oldErrorSchema).length > 0) {
4001
4227
  errorSchema = mergeObjects(
4002
4228
  oldErrorSchema,
4003
4229
  additionalErrorSchema,
@@ -4007,6 +4233,8 @@
4007
4233
  }
4008
4234
  return { errorSchema, errors };
4009
4235
  }
4236
+
4237
+ // src/withIdRefPrefix.ts
4010
4238
  function withIdRefPrefixObject(node) {
4011
4239
  const realObj = node;
4012
4240
  for (const key in realObj) {
@@ -4028,7 +4256,7 @@
4028
4256
  if (Array.isArray(schemaNode)) {
4029
4257
  return withIdRefPrefixArray([...schemaNode]);
4030
4258
  }
4031
- if (isObject2(schemaNode)) {
4259
+ if (isObject(schemaNode)) {
4032
4260
  return withIdRefPrefixObject({ ...schemaNode });
4033
4261
  }
4034
4262
  return schemaNode;
@@ -4077,15 +4305,19 @@
4077
4305
  TranslatableString2["FilesInfo"] = "**%1** (%2, %3 bytes)";
4078
4306
  return TranslatableString2;
4079
4307
  })(TranslatableString || {});
4308
+
4309
+ // src/parser/ParserValidator.ts
4080
4310
  var ParserValidator = class {
4311
+ /** The rootSchema provided during construction of the class */
4312
+ rootSchema;
4313
+ /** The map of schemas encountered by the ParserValidator */
4314
+ schemaMap = {};
4081
4315
  /** Construct the ParserValidator for the given `rootSchema`. This `rootSchema` will be stashed in the `schemaMap`
4082
4316
  * first.
4083
4317
  *
4084
4318
  * @param rootSchema - The root schema against which this validator will be executed
4085
4319
  */
4086
4320
  constructor(rootSchema) {
4087
- /** The map of schemas encountered by the ParserValidator */
4088
- this.schemaMap = {};
4089
4321
  this.rootSchema = rootSchema;
4090
4322
  this.addSchema(rootSchema, hashForSchema(rootSchema));
4091
4323
  }
@@ -4102,7 +4334,7 @@
4102
4334
  * @param hash - The hash value at which to map the schema
4103
4335
  */
4104
4336
  addSchema(schema, hash) {
4105
- const key = get14(schema, ID_KEY, hash);
4337
+ const key = schema[ID_KEY] ?? hash;
4106
4338
  const identifiedSchema = { ...schema, [ID_KEY]: key };
4107
4339
  const existing = this.schemaMap[key];
4108
4340
  if (!existing) {
@@ -4175,9 +4407,9 @@
4175
4407
  const allOptions = resolveAnyOrOneOfSchemas(validator, localSchema, rootSchema, true);
4176
4408
  allOptions.forEach((s) => {
4177
4409
  if (PROPERTIES_KEY in s && s[PROPERTIES_KEY]) {
4178
- forEach(localSchema[PROPERTIES_KEY], (value) => {
4410
+ for (const value of Object.values(localSchema[PROPERTIES_KEY] ?? {})) {
4179
4411
  parseSchema(validator, recurseList, rootSchema, value);
4180
- });
4412
+ }
4181
4413
  }
4182
4414
  });
4183
4415
  if (ITEMS_KEY in localSchema && !Array.isArray(localSchema.items) && typeof localSchema.items !== "boolean") {
@@ -4264,6 +4496,7 @@
4264
4496
  exports.findFieldInSchema = findFieldInSchema;
4265
4497
  exports.findSchemaDefinition = findSchemaDefinition;
4266
4498
  exports.findSelectedOptionInXxxOf = findSelectedOptionInXxxOf;
4499
+ exports.getByPath = getByPath;
4267
4500
  exports.getChangedFields = getChangedFields;
4268
4501
  exports.getClosestMatchingOption = getClosestMatchingOption;
4269
4502
  exports.getDateElementProps = getDateElementProps;
@@ -4277,6 +4510,7 @@
4277
4510
  exports.getInputProps = getInputProps;
4278
4511
  exports.getOptionMatchingSimpleDiscriminator = getOptionMatchingSimpleDiscriminator;
4279
4512
  exports.getOptionValueFormat = getOptionValueFormat;
4513
+ exports.getPropertySchema = getPropertySchema;
4280
4514
  exports.getSchemaType = getSchemaType;
4281
4515
  exports.getSubmitButtonOptions = getSubmitButtonOptions;
4282
4516
  exports.getTemplate = getTemplate;
@@ -4285,6 +4519,7 @@
4285
4519
  exports.getUsedFormData = getUsedFormData;
4286
4520
  exports.getWidget = getWidget;
4287
4521
  exports.guessType = guessType;
4522
+ exports.hasByPath = hasByPath;
4288
4523
  exports.hasWidget = hasWidget;
4289
4524
  exports.hashForSchema = hashForSchema;
4290
4525
  exports.hashObject = hashObject;
@@ -4297,6 +4532,7 @@
4297
4532
  exports.isFormDataAvailable = isFormDataAvailable;
4298
4533
  exports.isMultiSelect = isMultiSelect;
4299
4534
  exports.isObject = isObject;
4535
+ exports.isPlainObject = isPlainObject;
4300
4536
  exports.isRootSchema = isRootSchema;
4301
4537
  exports.isSelect = isSelect;
4302
4538
  exports.isValueEmpty = isValueEmpty;
@@ -4307,6 +4543,7 @@
4307
4543
  exports.mergeDefaultsWithFormData = mergeDefaultsWithFormData;
4308
4544
  exports.mergeObjects = mergeObjects;
4309
4545
  exports.mergeSchemas = mergeSchemas;
4546
+ exports.noop = noop;
4310
4547
  exports.omitExtraData = omitExtraData;
4311
4548
  exports.optionId = optionId;
4312
4549
  exports.optionalControlsId = optionalControlsId;
@@ -4323,6 +4560,7 @@
4323
4560
  exports.sanitizeDataForNewSchema = sanitizeDataForNewSchema;
4324
4561
  exports.schemaParser = schemaParser;
4325
4562
  exports.schemaRequiresTrueValue = schemaRequiresTrueValue;
4563
+ exports.setByPath = setByPath;
4326
4564
  exports.shallowEquals = shallowEquals;
4327
4565
  exports.shouldRender = shouldRender;
4328
4566
  exports.shouldRenderOptionalField = shouldRenderOptionalField;
@@ -4333,7 +4571,9 @@
4333
4571
  exports.toErrorList = toErrorList;
4334
4572
  exports.toErrorSchema = toErrorSchema;
4335
4573
  exports.toFieldPathId = toFieldPathId;
4574
+ exports.toPath = toPath;
4336
4575
  exports.toPathSchema = toPathSchema;
4576
+ exports.unsetByPath = unsetByPath;
4337
4577
  exports.unwrapErrorHandler = unwrapErrorHandler;
4338
4578
  exports.useAltDateWidgetProps = useAltDateWidgetProps;
4339
4579
  exports.useDeepCompareMemo = useDeepCompareMemo;