mlform 0.1.23 → 0.1.24

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 (261) hide show
  1. package/README.md +98 -229
  2. package/dist/builtins-jvAitKUC.js +560 -0
  3. package/dist/{design-Dr7o4rR9.js → design-D8zce4Mh.js} +13 -12
  4. package/dist/mlform/builtins.mjs +2 -2
  5. package/dist/mlform/design.mjs +1 -1
  6. package/dist/mlform/kit.mjs +435 -275
  7. package/dist/mlform/primitives.mjs +2 -2
  8. package/dist/mlform/runtime.mjs +1 -1
  9. package/dist/mlform/schema.mjs +1 -1
  10. package/dist/{primitives-ljp3c5R8.js → primitives-ChLgMFl9.js} +452 -450
  11. package/dist/{runtime-BQsOz8iz.js → runtime-B_vnmwya.js} +9 -9
  12. package/dist/{schema-BI-Ia-h9.js → schema-C34LJ8aV.js} +5 -5
  13. package/dist/types/{src/builtins → builtins}/definitions/collections.d.ts +12 -12
  14. package/dist/types/{src/builtins → builtins}/definitions/fields/boolean.d.ts +1 -1
  15. package/dist/types/{src/builtins → builtins}/definitions/fields/category.d.ts +1 -1
  16. package/dist/types/{src/builtins → builtins}/definitions/fields/date.d.ts +1 -1
  17. package/dist/types/{src/builtins → builtins}/definitions/fields/long-text.d.ts +1 -1
  18. package/dist/types/{src/builtins → builtins}/definitions/fields/mapped-category.d.ts +1 -1
  19. package/dist/types/{src/builtins → builtins}/definitions/fields/multi-choice.d.ts +1 -1
  20. package/dist/types/{src/builtins → builtins}/definitions/fields/number.d.ts +1 -1
  21. package/dist/types/{src/builtins → builtins}/definitions/fields/onehot-category.d.ts +1 -1
  22. package/dist/types/{src/builtins → builtins}/definitions/fields/rating.d.ts +1 -1
  23. package/dist/types/{src/builtins → builtins}/definitions/fields/series-helpers.d.ts +4 -4
  24. package/dist/types/{src/builtins → builtins}/definitions/fields/single-choice.d.ts +1 -1
  25. package/dist/types/{src/builtins → builtins}/definitions/fields/text.d.ts +1 -1
  26. package/dist/types/{src/builtins → builtins}/definitions/reports/classifier.d.ts +1 -1
  27. package/dist/types/{src/builtins → builtins}/definitions/reports/regressor.d.ts +1 -1
  28. package/dist/types/{src/builtins → builtins}/definitions/shared.d.ts +3 -28
  29. package/dist/types/{src/builtins → builtins}/index.d.ts +2 -3
  30. package/dist/types/{src/builtins → builtins}/mapped-category-behavior.d.ts +1 -1
  31. package/dist/types/builtins/registry.d.ts +2 -0
  32. package/dist/types/kit/builtin-presenters.d.ts +2 -0
  33. package/dist/types/{src/kit → kit}/defaults.d.ts +3 -3
  34. package/dist/types/{src/kit → kit}/index.d.ts +3 -0
  35. package/dist/types/{src/kit → kit}/kinds/define-field-kind.d.ts +4 -3
  36. package/dist/types/{src/kit → kit}/kinds/define-report-kind.d.ts +4 -3
  37. package/dist/types/kit/kinds/register-kind.d.ts +6 -0
  38. package/dist/types/{src/kit → kit}/layout-helpers.d.ts +1 -1
  39. package/dist/types/{src/kit → kit}/layout-node-render.d.ts +1 -1
  40. package/dist/types/{src/kit → kit}/layout-root.d.ts +1 -1
  41. package/dist/types/{src/kit → kit}/layout-utils.d.ts +1 -1
  42. package/dist/types/{src/kit → kit}/layout.d.ts +1 -1
  43. package/dist/types/{src/kit → kit}/mount-types.d.ts +5 -3
  44. package/dist/types/kit/plugin.d.ts +19 -0
  45. package/dist/types/kit/registry-pack.d.ts +16 -0
  46. package/dist/types/{src/kit → kit}/tabs-root.d.ts +1 -1
  47. package/dist/types/{src/kit → kit}/view-core-types.d.ts +4 -2
  48. package/dist/types/{src/kit → kit}/view-navigation.d.ts +1 -1
  49. package/dist/types/{src/kit → kit}/view-snapshot-cache.d.ts +2 -2
  50. package/dist/types/{src/kit → kit}/view-snapshot.d.ts +2 -2
  51. package/dist/types/{src/kit → kit}/wizard-root.d.ts +1 -1
  52. package/dist/types/{src/primitives → primitives}/descriptors/registry.d.ts +2 -1
  53. package/dist/types/{src/primitives → primitives}/index.d.ts +1 -1
  54. package/dist/types/primitives/mount-form.d.ts +4 -0
  55. package/dist/types/{src/runtime → runtime}/errors.d.ts +1 -1
  56. package/dist/types/{src/runtime → runtime}/runtime-behaviors.d.ts +1 -1
  57. package/dist/types/{src/runtime → runtime}/submission/request.d.ts +1 -1
  58. package/dist/types/{src/runtime → runtime}/submission/types.d.ts +1 -1
  59. package/dist/types/{src/runtime → runtime}/types/behavior.d.ts +2 -2
  60. package/dist/types/{src/runtime → runtime}/types/field.d.ts +3 -3
  61. package/dist/types/{src/runtime → runtime}/types/form.d.ts +3 -2
  62. package/dist/types/{src/runtime → runtime}/types/index.d.ts +1 -0
  63. package/dist/types/{src/runtime → runtime}/types/registry.d.ts +1 -1
  64. package/dist/types/{src/runtime → runtime}/types/report.d.ts +5 -5
  65. package/dist/types/runtime/types/status.d.ts +1 -0
  66. package/dist/types/{src/runtime → runtime}/types/transport.d.ts +5 -5
  67. package/dist/types/{src/runtime → runtime}/validation/form.d.ts +1 -1
  68. package/dist/types/{src/schema → schema}/index.d.ts +1 -0
  69. package/dist/types/{src/schema → schema}/mapped-to.d.ts +2 -6
  70. package/dist/types/{src/schema → schema}/normalize.d.ts +2 -1
  71. package/dist/types/{src/schema → schema}/registry.d.ts +3 -1
  72. package/dist/types/{src/schema → schema}/types/field.d.ts +1 -1
  73. package/dist/types/schema/types/mapping.d.ts +6 -0
  74. package/dist/types/{src/schema → schema}/types/report.d.ts +1 -1
  75. package/dist/types/{src/schema → schema}/types/submit.d.ts +1 -1
  76. package/dist/types/{src/schema → schema}/validation.d.ts +2 -1
  77. package/dist/types/{src/transport → transport}/types.d.ts +1 -1
  78. package/package.json +27 -20
  79. package/dist/builtins-rkxD-h7K.js +0 -749
  80. package/dist/types/src/builtins/registry-pack.d.ts +0 -10
  81. package/dist/types/src/kit/kinds/register-kind.d.ts +0 -5
  82. package/dist/types/src/primitives/mount-form.d.ts +0 -4
  83. /package/dist/types/{src/builtins → builtins}/constants.d.ts +0 -0
  84. /package/dist/types/{src/builtins → builtins}/definitions/fields/series.d.ts +0 -0
  85. /package/dist/types/{src/builtins → builtins}/definitions/fields/value-helpers.d.ts +0 -0
  86. /package/dist/types/{src/builtins → builtins}/definitions/index.d.ts +0 -0
  87. /package/dist/types/{src/design → design}/constants.d.ts +0 -0
  88. /package/dist/types/{src/design → design}/contract/component-keys.d.ts +0 -0
  89. /package/dist/types/{src/design → design}/contract/component-tokens.d.ts +0 -0
  90. /package/dist/types/{src/design → design}/contract/global-tokens.d.ts +0 -0
  91. /package/dist/types/{src/design → design}/contract/index.d.ts +0 -0
  92. /package/dist/types/{src/design → design}/contract/token-keys.d.ts +0 -0
  93. /package/dist/types/{src/design → design}/index.d.ts +0 -0
  94. /package/dist/types/{src/design → design}/recipes/collections.d.ts +0 -0
  95. /package/dist/types/{src/design → design}/recipes/contrast.d.ts +0 -0
  96. /package/dist/types/{src/design → design}/recipes/default.d.ts +0 -0
  97. /package/dist/types/{src/design → design}/recipes/index.d.ts +0 -0
  98. /package/dist/types/{src/design → design}/recipes/minimal.d.ts +0 -0
  99. /package/dist/types/{src/design → design}/recipes/soft.d.ts +0 -0
  100. /package/dist/types/{src/design → design}/registry/builtins.d.ts +0 -0
  101. /package/dist/types/{src/design → design}/registry/create-registry.d.ts +0 -0
  102. /package/dist/types/{src/design → design}/registry/deep-freeze.d.ts +0 -0
  103. /package/dist/types/{src/design → design}/registry/define-recipe.d.ts +0 -0
  104. /package/dist/types/{src/design → design}/registry/define-theme.d.ts +0 -0
  105. /package/dist/types/{src/design → design}/registry/define-token-maps.d.ts +0 -0
  106. /package/dist/types/{src/design → design}/registry/index.d.ts +0 -0
  107. /package/dist/types/{src/design → design}/resolve/diagnostics.d.ts +0 -0
  108. /package/dist/types/{src/design → design}/resolve/index.d.ts +0 -0
  109. /package/dist/types/{src/design → design}/resolve/merge-config.d.ts +0 -0
  110. /package/dist/types/{src/design → design}/resolve/migrate-tokens.d.ts +0 -0
  111. /package/dist/types/{src/design → design}/resolve/resolve-design.d.ts +0 -0
  112. /package/dist/types/{src/design → design}/resolve/resolve-mode.d.ts +0 -0
  113. /package/dist/types/{src/design → design}/resolve/resolve-recipe.d.ts +0 -0
  114. /package/dist/types/{src/design → design}/resolve/resolve-theme.d.ts +0 -0
  115. /package/dist/types/{src/design → design}/resolve/resolve-tokens.d.ts +0 -0
  116. /package/dist/types/{src/design → design}/runtime/apply-tokens.d.ts +0 -0
  117. /package/dist/types/{src/design → design}/runtime/attach-design.d.ts +0 -0
  118. /package/dist/types/{src/design → design}/runtime/controller-helpers.d.ts +0 -0
  119. /package/dist/types/{src/design → design}/runtime/create-stylesheet.d.ts +0 -0
  120. /package/dist/types/{src/design → design}/runtime/declarations.d.ts +0 -0
  121. /package/dist/types/{src/design → design}/runtime/design-controller.d.ts +0 -0
  122. /package/dist/types/{src/design → design}/runtime/fingerprint.d.ts +0 -0
  123. /package/dist/types/{src/design → design}/runtime/host-observer.d.ts +0 -0
  124. /package/dist/types/{src/design → design}/runtime/host-state.d.ts +0 -0
  125. /package/dist/types/{src/design → design}/runtime/hydrate-design.d.ts +0 -0
  126. /package/dist/types/{src/design → design}/runtime/hydration-state.d.ts +0 -0
  127. /package/dist/types/{src/design → design}/runtime/index.d.ts +0 -0
  128. /package/dist/types/{src/design → design}/runtime/inherited-scheme.d.ts +0 -0
  129. /package/dist/types/{src/design → design}/runtime/media.d.ts +0 -0
  130. /package/dist/types/{src/design → design}/themes/airbnb.d.ts +0 -0
  131. /package/dist/types/{src/design → design}/themes/clickhouse.d.ts +0 -0
  132. /package/dist/types/{src/design → design}/themes/cobalt.d.ts +0 -0
  133. /package/dist/types/{src/design → design}/themes/collections.d.ts +0 -0
  134. /package/dist/types/{src/design → design}/themes/graphite.d.ts +0 -0
  135. /package/dist/types/{src/design → design}/themes/index.d.ts +0 -0
  136. /package/dist/types/{src/design → design}/themes/neutral.d.ts +0 -0
  137. /package/dist/types/{src/design → design}/themes/sage.d.ts +0 -0
  138. /package/dist/types/{src/design → design}/themes/sunset.d.ts +0 -0
  139. /package/dist/types/{src/design → design}/tokens/base.d.ts +0 -0
  140. /package/dist/types/{src/design → design}/tokens/contrast.d.ts +0 -0
  141. /package/dist/types/{src/design → design}/tokens/density.d.ts +0 -0
  142. /package/dist/types/{src/design → design}/tokens/forced-colors.d.ts +0 -0
  143. /package/dist/types/{src/design → design}/tokens/index.d.ts +0 -0
  144. /package/dist/types/{src/design → design}/tokens/motion.d.ts +0 -0
  145. /package/dist/types/{src/design → design}/types.d.ts +0 -0
  146. /package/dist/types/{src/kit → kit}/constants.d.ts +0 -0
  147. /package/dist/types/{src/kit → kit}/disclosure-root-styles.d.ts +0 -0
  148. /package/dist/types/{src/kit → kit}/error-navigation.d.ts +0 -0
  149. /package/dist/types/{src/kit → kit}/kinds/index.d.ts +0 -0
  150. /package/dist/types/{src/kit → kit}/layout-node-resolver.d.ts +0 -0
  151. /package/dist/types/{src/kit → kit}/layout-types.d.ts +0 -0
  152. /package/dist/types/{src/kit → kit}/mount-form.d.ts +0 -0
  153. /package/dist/types/{src/kit → kit}/panel-nav.d.ts +0 -0
  154. /package/dist/types/{src/kit → kit}/step-indicator.d.ts +0 -0
  155. /package/dist/types/{src/kit → kit}/tabs-root-styles.d.ts +0 -0
  156. /package/dist/types/{src/kit → kit}/types.d.ts +0 -0
  157. /package/dist/types/{src/kit → kit}/view-layout-state.d.ts +0 -0
  158. /package/dist/types/{src/kit → kit}/view-types.d.ts +0 -0
  159. /package/dist/types/{src/kit → kit}/view.d.ts +0 -0
  160. /package/dist/types/{src/kit → kit}/wizard-constants.d.ts +0 -0
  161. /package/dist/types/{src/kit → kit}/wizard-root-styles.d.ts +0 -0
  162. /package/dist/types/{src/primitives → primitives}/base-async-report-element.d.ts +0 -0
  163. /package/dist/types/{src/primitives → primitives}/base-field-element.d.ts +0 -0
  164. /package/dist/types/{src/primitives → primitives}/base-report-element.d.ts +0 -0
  165. /package/dist/types/{src/primitives → primitives}/components/declarative-field.d.ts +0 -0
  166. /package/dist/types/{src/primitives → primitives}/components/declarative-report.d.ts +0 -0
  167. /package/dist/types/{src/primitives → primitives}/components/descriptor-content.d.ts +0 -0
  168. /package/dist/types/{src/primitives → primitives}/components/error-focus.d.ts +0 -0
  169. /package/dist/types/{src/primitives → primitives}/components/field-frame-feedback.d.ts +0 -0
  170. /package/dist/types/{src/primitives → primitives}/components/field-frame-styles.d.ts +0 -0
  171. /package/dist/types/{src/primitives → primitives}/components/field-frame.d.ts +0 -0
  172. /package/dist/types/{src/primitives → primitives}/components/form-errors.d.ts +0 -0
  173. /package/dist/types/{src/primitives → primitives}/components/form-root-presenters.d.ts +0 -0
  174. /package/dist/types/{src/primitives → primitives}/components/form-root-split-styles.d.ts +0 -0
  175. /package/dist/types/{src/primitives → primitives}/components/form-root-state.d.ts +0 -0
  176. /package/dist/types/{src/primitives → primitives}/components/form-root-styles.d.ts +0 -0
  177. /package/dist/types/{src/primitives → primitives}/components/form-root-templates.d.ts +0 -0
  178. /package/dist/types/{src/primitives → primitives}/components/form-root.d.ts +0 -0
  179. /package/dist/types/{src/primitives → primitives}/components/mounted-report.d.ts +0 -0
  180. /package/dist/types/{src/primitives → primitives}/components/report-frame.d.ts +0 -0
  181. /package/dist/types/{src/primitives → primitives}/components/submit-button.d.ts +0 -0
  182. /package/dist/types/{src/primitives → primitives}/components/unsupported-component.d.ts +0 -0
  183. /package/dist/types/{src/primitives → primitives}/constants.d.ts +0 -0
  184. /package/dist/types/{src/primitives → primitives}/controller-binding.d.ts +0 -0
  185. /package/dist/types/{src/primitives → primitives}/controller-types.d.ts +0 -0
  186. /package/dist/types/{src/primitives → primitives}/descriptor-resolution.d.ts +0 -0
  187. /package/dist/types/{src/primitives → primitives}/descriptors/content.d.ts +0 -0
  188. /package/dist/types/{src/primitives → primitives}/descriptors/field.d.ts +0 -0
  189. /package/dist/types/{src/primitives → primitives}/descriptors/index.d.ts +0 -0
  190. /package/dist/types/{src/primitives → primitives}/descriptors/report.d.ts +0 -0
  191. /package/dist/types/{src/primitives → primitives}/fields/boolean-field.d.ts +0 -0
  192. /package/dist/types/{src/primitives → primitives}/fields/category-field.d.ts +0 -0
  193. /package/dist/types/{src/primitives → primitives}/fields/date-field.d.ts +0 -0
  194. /package/dist/types/{src/primitives → primitives}/fields/long-text-field.d.ts +0 -0
  195. /package/dist/types/{src/primitives → primitives}/fields/multi-choice-field.d.ts +0 -0
  196. /package/dist/types/{src/primitives → primitives}/fields/number-field.d.ts +0 -0
  197. /package/dist/types/{src/primitives → primitives}/fields/rating-field.d.ts +0 -0
  198. /package/dist/types/{src/primitives → primitives}/fields/series-field-helpers.d.ts +0 -0
  199. /package/dist/types/{src/primitives → primitives}/fields/series-field-renderers.d.ts +0 -0
  200. /package/dist/types/{src/primitives → primitives}/fields/series-field-styles.d.ts +0 -0
  201. /package/dist/types/{src/primitives → primitives}/fields/series-field.d.ts +0 -0
  202. /package/dist/types/{src/primitives → primitives}/fields/single-choice-field.d.ts +0 -0
  203. /package/dist/types/{src/primitives → primitives}/fields/text-field.d.ts +0 -0
  204. /package/dist/types/{src/primitives → primitives}/register.d.ts +0 -0
  205. /package/dist/types/{src/primitives → primitives}/registry.d.ts +0 -0
  206. /package/dist/types/{src/primitives → primitives}/reports/classifier-report.d.ts +0 -0
  207. /package/dist/types/{src/primitives → primitives}/reports/regressor-report.d.ts +0 -0
  208. /package/dist/types/{src/primitives → primitives}/request-runner.d.ts +0 -0
  209. /package/dist/types/{src/primitives → primitives}/types.d.ts +0 -0
  210. /package/dist/types/{src/primitives → primitives}/utils.d.ts +0 -0
  211. /package/dist/types/{src/runtime → runtime}/comparison.d.ts +0 -0
  212. /package/dist/types/{src/runtime → runtime}/create-runtime-helpers.d.ts +0 -0
  213. /package/dist/types/{src/runtime → runtime}/create-runtime.d.ts +0 -0
  214. /package/dist/types/{src/runtime → runtime}/equality.d.ts +0 -0
  215. /package/dist/types/{src/runtime → runtime}/fields/controller.d.ts +0 -0
  216. /package/dist/types/{src/runtime → runtime}/fields/index.d.ts +0 -0
  217. /package/dist/types/{src/runtime → runtime}/fields/state-calculations.d.ts +0 -0
  218. /package/dist/types/{src/runtime → runtime}/fields/state.d.ts +0 -0
  219. /package/dist/types/{src/runtime → runtime}/form.d.ts +0 -0
  220. /package/dist/types/{src/runtime → runtime}/index.d.ts +0 -0
  221. /package/dist/types/{src/runtime → runtime}/paths.d.ts +0 -0
  222. /package/dist/types/{src/runtime → runtime}/reports/controller.d.ts +0 -0
  223. /package/dist/types/{src/runtime → runtime}/reports/index.d.ts +0 -0
  224. /package/dist/types/{src/runtime → runtime}/runtime-controller.d.ts +0 -0
  225. /package/dist/types/{src/runtime → runtime}/runtime-refresh.d.ts +0 -0
  226. /package/dist/types/{src/runtime → runtime}/runtime-values.d.ts +0 -0
  227. /package/dist/types/{src/runtime → runtime}/state/engine.d.ts +0 -0
  228. /package/dist/types/{src/runtime → runtime}/state/index.d.ts +0 -0
  229. /package/dist/types/{src/runtime → runtime}/state/snapshots.d.ts +0 -0
  230. /package/dist/types/{src/runtime → runtime}/state/store.d.ts +0 -0
  231. /package/dist/types/{src/runtime → runtime}/submission/abort.d.ts +0 -0
  232. /package/dist/types/{src/runtime → runtime}/submission/create-submitter.d.ts +0 -0
  233. /package/dist/types/{src/runtime → runtime}/submission/error-flow.d.ts +0 -0
  234. /package/dist/types/{src/runtime → runtime}/submission/index.d.ts +0 -0
  235. /package/dist/types/{src/runtime → runtime}/submission/lifecycle.d.ts +0 -0
  236. /package/dist/types/{src/runtime → runtime}/submission/multi-backend.d.ts +0 -0
  237. /package/dist/types/{src/runtime → runtime}/submission/pipeline.d.ts +0 -0
  238. /package/dist/types/{src/runtime → runtime}/submission/report-fetches.d.ts +0 -0
  239. /package/dist/types/{src/runtime → runtime}/submission/reports.d.ts +0 -0
  240. /package/dist/types/{src/runtime → runtime}/submission/result.d.ts +0 -0
  241. /package/dist/types/{src/runtime → runtime}/submission/snapshot.d.ts +0 -0
  242. /package/dist/types/{src/runtime → runtime}/submission/submitter.d.ts +0 -0
  243. /package/dist/types/{src/runtime → runtime}/submission/transport-response.d.ts +0 -0
  244. /package/dist/types/{src/runtime → runtime}/types/pipeline.d.ts +0 -0
  245. /package/dist/types/{src/runtime → runtime}/utils.d.ts +0 -0
  246. /package/dist/types/{src/runtime → runtime}/validation/conditions.d.ts +0 -0
  247. /package/dist/types/{src/runtime → runtime}/validation/field-state.d.ts +0 -0
  248. /package/dist/types/{src/runtime → runtime}/validation/field-validator.d.ts +0 -0
  249. /package/dist/types/{src/runtime → runtime}/validation/field.d.ts +0 -0
  250. /package/dist/types/{src/runtime → runtime}/validation/index.d.ts +0 -0
  251. /package/dist/types/{src/runtime → runtime}/values.d.ts +0 -0
  252. /package/dist/types/{src/schema → schema}/ids.d.ts +0 -0
  253. /package/dist/types/{src/schema → schema}/onehot-display.d.ts +0 -0
  254. /package/dist/types/{src/schema → schema}/report-context.d.ts +0 -0
  255. /package/dist/types/{src/schema → schema}/report-fetch-request.d.ts +0 -0
  256. /package/dist/types/{src/schema → schema}/types/form.d.ts +0 -0
  257. /package/dist/types/{src/schema → schema}/types/registry.d.ts +0 -0
  258. /package/dist/types/{src/transport → transport}/errors.d.ts +0 -0
  259. /package/dist/types/{src/transport → transport}/fanout.d.ts +0 -0
  260. /package/dist/types/{src/transport → transport}/index.d.ts +0 -0
  261. /package/dist/types/{src/transport → transport}/request-runner.d.ts +0 -0
@@ -1,749 +0,0 @@
1
- import { b as e, d as t, h as n } from "./schema-BI-Ia-h9.js";
2
- import { s as r } from "./primitives-ljp3c5R8.js";
3
- import * as i from "zod";
4
- //#region src/builtins/constants.ts
5
- var a = {
6
- classifier: "classifier",
7
- regressor: "regressor"
8
- }, o = {
9
- text: "text",
10
- number: "number",
11
- boolean: "boolean",
12
- category: "category",
13
- oneHotCategory: "onehot-category",
14
- date: "date",
15
- series: "series",
16
- longText: "long-text",
17
- singleChoice: "single-choice",
18
- multiChoice: "multi-choice",
19
- rating: "rating"
20
- }, s = {
21
- classifier: "Classifier report",
22
- regressor: "Regressor report"
23
- }, c = {
24
- unknownPrediction: "Unknown",
25
- classifierClassLabel: (e) => `Class ${e + 1}`
26
- }, l = {
27
- invalidNumber: "Value must be a valid number.",
28
- textPatternMismatch: "Value does not match the expected pattern.",
29
- categoryOptionMismatch: "Value must match one of the available options.",
30
- invalidTextLengthRange: "Minimum length cannot exceed maximum length.",
31
- invalidNumericRange: "Minimum value cannot exceed maximum value.",
32
- invalidDateRange: "Minimum date cannot be after maximum date.",
33
- invalidPointCountRange: "Minimum number of points cannot exceed maximum number of points.",
34
- minLength: (e) => `Minimum length is ${e} characters.`,
35
- maxLength: (e) => `Maximum length is ${e} characters.`,
36
- minValue: (e) => `Minimum value is ${e}.`,
37
- maxValue: (e) => `Maximum value is ${e}.`,
38
- stepValue: (e) => `Value must be a multiple of ${e}.`,
39
- dateOnOrAfter: (e) => `Date must be on or after ${e}.`,
40
- dateOnOrBefore: (e) => `Date must be on or before ${e}.`,
41
- stepDate: (e) => `Date must fall on a step of ${e} day(s) from the minimum date.`,
42
- minPoints: (e) => `Minimum number of points is ${e}.`,
43
- maxPoints: (e) => `Maximum number of points is ${e}.`,
44
- timestampsUnique: "Timestamps must be unique.",
45
- timestampsAscending: "Timestamps must be sorted in ascending order.",
46
- timestampsDescending: "Timestamps must be sorted in descending order."
47
- }, u = i.record(i.string(), i.unknown()).optional(), d = i.union([i.string().min(1), i.number().int().nonnegative()]), f = i.union([d, i.record(i.string().min(1), d.nullish())]).optional(), ee = i.custom((e) => typeof e == "function"), p = i.enum([
48
- "idle",
49
- "editing",
50
- "validating",
51
- "submitting",
52
- "success",
53
- "error"
54
- ]), m = i.lazy(() => i.union([
55
- i.object({
56
- kind: i.literal("field-value"),
57
- field: i.string().min(1),
58
- equals: i.unknown().optional(),
59
- notEquals: i.unknown().optional(),
60
- greaterThan: i.unknown().optional(),
61
- greaterThanOrEqual: i.unknown().optional(),
62
- lessThan: i.unknown().optional(),
63
- lessThanOrEqual: i.unknown().optional(),
64
- in: i.array(i.unknown()).optional(),
65
- notIn: i.array(i.unknown()).optional(),
66
- empty: i.boolean().optional(),
67
- notEmpty: i.boolean().optional(),
68
- truthy: i.boolean().optional(),
69
- falsy: i.boolean().optional()
70
- }),
71
- i.object({
72
- kind: i.literal("field-comparison"),
73
- field: i.string().min(1),
74
- otherField: i.string().min(1),
75
- operator: i.enum([
76
- "eq",
77
- "neq",
78
- "gt",
79
- "gte",
80
- "lt",
81
- "lte"
82
- ])
83
- }),
84
- i.object({
85
- kind: i.literal("form-status"),
86
- equals: i.union([p, i.array(p).min(1)])
87
- }),
88
- i.object({
89
- kind: i.literal("submit-count"),
90
- eq: i.number().int().nonnegative().optional(),
91
- gte: i.number().int().nonnegative().optional(),
92
- lte: i.number().int().nonnegative().optional()
93
- }),
94
- i.object({
95
- kind: i.literal("all"),
96
- conditions: i.array(m).min(1)
97
- }),
98
- i.object({
99
- kind: i.literal("any"),
100
- conditions: i.array(m).min(1)
101
- }),
102
- i.object({
103
- kind: i.literal("not"),
104
- condition: m
105
- })
106
- ])), h = i.union([ee, m]), g = {
107
- id: i.string().optional(),
108
- label: i.string().min(1),
109
- description: i.string().optional(),
110
- showDescriptionInline: i.boolean().optional().default(!1),
111
- required: i.boolean().optional().default(!1),
112
- disabled: i.boolean().optional().default(!1),
113
- hidden: i.boolean().optional().default(!1),
114
- readOnly: i.boolean().optional().default(!1),
115
- disabledWhen: h.optional(),
116
- hiddenWhen: h.optional(),
117
- readOnlyWhen: h.optional(),
118
- asyncValidationDebounceMs: i.number().int().nonnegative().optional(),
119
- inactiveFieldPolicy: i.enum([
120
- "include",
121
- "omit",
122
- "reset-on-hide"
123
- ]).optional(),
124
- includeInSubmission: i.boolean().optional(),
125
- displayKey: i.string().min(1).optional(),
126
- mappedTo: f,
127
- valuePath: i.union([i.string().min(1), i.array(i.string().min(1)).min(1)]).optional(),
128
- defaultValue: i.unknown().optional(),
129
- ui: u
130
- }, _ = {
131
- id: i.string().optional(),
132
- label: i.string().optional(),
133
- description: i.string().optional(),
134
- mappedTo: f,
135
- ui: u
136
- }, v = i.union([i.string(), i.object({
137
- label: i.string(),
138
- value: i.string()
139
- })]), y = (e, t, n) => ({
140
- component: e,
141
- props: {
142
- id: t.id,
143
- kind: t.kind,
144
- label: t.label,
145
- description: t.description ?? "",
146
- showDescriptionInline: !!t.showDescriptionInline,
147
- required: !!t.required,
148
- disabled: !!t.disabled,
149
- ...n,
150
- ...t.ui
151
- }
152
- }), b = {
153
- kind: "boolean",
154
- schema: i.object({
155
- kind: i.literal("boolean"),
156
- ...g,
157
- trueLabel: i.string().optional(),
158
- falseLabel: i.string().optional()
159
- }),
160
- getDefaultValue(e) {
161
- return typeof e.defaultValue == "boolean" ? e.defaultValue : null;
162
- },
163
- normalizeValue(e) {
164
- return e == null || e === "" ? null : e === !0 || e === "true" ? !0 : e === !1 || e === "false" ? !1 : !!e;
165
- },
166
- describe(e, t) {
167
- return y("boolean-field", e, {
168
- checked: t.state.value,
169
- trueLabel: e.trueLabel,
170
- falseLabel: e.falseLabel,
171
- state: t.state.status,
172
- errors: t.state.errors
173
- });
174
- }
175
- }, x = {
176
- kind: "category",
177
- schema: i.object({
178
- kind: i.literal("category"),
179
- ...g,
180
- options: i.array(v).min(1)
181
- }),
182
- getDefaultValue(e) {
183
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
184
- },
185
- normalizeValue(e) {
186
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
187
- },
188
- validate(e, t) {
189
- return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [l.categoryOptionMismatch];
190
- },
191
- describe(e, t) {
192
- return y("category-field", e, {
193
- value: t.state.value,
194
- options: e.options,
195
- state: t.state.status,
196
- errors: t.state.errors
197
- });
198
- }
199
- }, te = i.object({
200
- label: i.string(),
201
- value: i.string(),
202
- mapping: i.record(i.string(), i.unknown())
203
- }), S = {
204
- kind: "mapped-category",
205
- schema: i.object({
206
- kind: i.literal("mapped-category"),
207
- ...g,
208
- includeInSubmission: i.boolean().optional().default(!1),
209
- options: i.array(te).min(1)
210
- }),
211
- getDefaultValue(e) {
212
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
213
- },
214
- normalizeValue(e) {
215
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
216
- },
217
- validate(e, t) {
218
- return e === null || t.options.map((e) => e.value).includes(e) ? [] : [l.categoryOptionMismatch];
219
- },
220
- describe(e, t) {
221
- return y("category-field", e, {
222
- value: t.state.value,
223
- options: e.options.map((e) => ({
224
- label: e.label,
225
- value: e.value
226
- })),
227
- state: t.state.status,
228
- errors: t.state.errors
229
- });
230
- }
231
- }, C = i.object({
232
- label: i.string(),
233
- value: i.string(),
234
- mappedTo: f.unwrap()
235
- }), w = {
236
- kind: "onehot-category",
237
- schema: i.object({
238
- kind: i.literal("onehot-category"),
239
- ...g,
240
- includeInSubmission: i.boolean().optional().default(!0),
241
- options: i.array(C).min(1)
242
- }),
243
- getDefaultValue(e) {
244
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
245
- },
246
- normalizeValue(e) {
247
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
248
- },
249
- validate(e, t) {
250
- return e === null || t.options.some((t) => t.value === e) ? [] : [l.categoryOptionMismatch];
251
- },
252
- describe(e, t) {
253
- return y("category-field", e, {
254
- value: t.state.value,
255
- options: e.options.map((e) => ({
256
- label: e.label,
257
- value: e.value
258
- })),
259
- state: t.state.status,
260
- errors: t.state.errors
261
- });
262
- }
263
- }, T = (e) => typeof e == "object" && !!e && !Array.isArray(e), E = (e) => {
264
- if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
265
- if (typeof e == "string" || typeof e == "number") {
266
- let t = new Date(e);
267
- return Number.isNaN(t.getTime()) ? null : t;
268
- }
269
- return null;
270
- }, D = {
271
- kind: "date",
272
- schema: i.object({
273
- kind: i.literal("date"),
274
- ...g,
275
- min: i.string().optional(),
276
- max: i.string().optional(),
277
- step: i.number().positive().optional()
278
- }),
279
- getDefaultValue(e) {
280
- return E(e.defaultValue) ?? null;
281
- },
282
- normalizeValue(e) {
283
- return E(e);
284
- },
285
- serializeValue(e) {
286
- return e instanceof Date ? e.toISOString() : e;
287
- },
288
- validate(e, t) {
289
- let n = [], r = E(t.min), i = E(t.max);
290
- if (r && i && r.getTime() > i.getTime() && n.push(l.invalidDateRange), e === null) return n;
291
- if (r && e.getTime() < r.getTime() && n.push(l.dateOnOrAfter(String(t.min))), i && e.getTime() > i.getTime() && n.push(l.dateOnOrBefore(String(t.max))), t.step !== void 0) {
292
- let i = r ?? /* @__PURE__ */ new Date("1970-01-01T00:00:00Z");
293
- Math.round(Math.abs(e.getTime() - i.getTime()) / 864e5) % t.step !== 0 && n.push(l.stepDate(t.step));
294
- }
295
- return n;
296
- },
297
- describe(e, t) {
298
- return y("date-field", e, {
299
- value: t.state.value instanceof Date ? t.state.value.toISOString().slice(0, 10) : t.state.value,
300
- min: e.min,
301
- max: e.max,
302
- step: e.step,
303
- state: t.state.status,
304
- errors: t.state.errors
305
- });
306
- }
307
- }, O = {
308
- kind: "long-text",
309
- schema: i.object({
310
- kind: i.literal("long-text"),
311
- ...g,
312
- placeholder: i.string().optional(),
313
- minLength: i.number().int().nonnegative().optional(),
314
- maxLength: i.number().int().nonnegative().optional(),
315
- rows: i.number().int().positive().optional()
316
- }),
317
- getDefaultValue(e) {
318
- return typeof e.defaultValue == "string" ? e.defaultValue : "";
319
- },
320
- normalizeValue(e) {
321
- return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
322
- },
323
- validate(e, t) {
324
- let n = [];
325
- return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(l.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(l.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(l.maxLength(t.maxLength)), n);
326
- },
327
- describe(e, t) {
328
- return y("long-text-field", e, {
329
- value: t.state.value,
330
- placeholder: e.placeholder ?? "",
331
- minLength: e.minLength,
332
- maxLength: e.maxLength,
333
- rows: e.rows,
334
- state: t.state.status,
335
- errors: t.state.errors
336
- });
337
- }
338
- }, k = {
339
- kind: "multi-choice",
340
- schema: i.object({
341
- kind: i.literal("multi-choice"),
342
- ...g,
343
- options: i.array(v).min(1),
344
- layout: i.enum(["horizontal", "vertical"]).optional()
345
- }),
346
- getDefaultValue(e) {
347
- return Array.isArray(e.defaultValue) ? e.defaultValue.filter((e) => typeof e == "string").map(String) : [];
348
- },
349
- normalizeValue(e) {
350
- return Array.isArray(e) ? e.filter((e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint").map(String) : [];
351
- },
352
- cloneValue(e) {
353
- return [...e];
354
- },
355
- isEqual(e, t) {
356
- return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
357
- },
358
- validate(e, t) {
359
- if (e.length === 0) return [];
360
- let n = t.options.map((e) => typeof e == "string" ? e : e.value);
361
- return e.filter((e) => !n.includes(e)).length > 0 ? [l.categoryOptionMismatch] : [];
362
- },
363
- describe(e, t) {
364
- return y("multi-choice-field", e, {
365
- value: t.state.value,
366
- options: e.options,
367
- layout: e.layout ?? "vertical",
368
- state: t.state.status,
369
- errors: t.state.errors
370
- });
371
- }
372
- }, A = {
373
- kind: "number",
374
- schema: i.object({
375
- kind: i.literal("number"),
376
- ...g,
377
- min: i.number().optional(),
378
- max: i.number().optional(),
379
- step: i.number().positive().optional(),
380
- unit: i.string().optional(),
381
- placeholder: i.string().optional()
382
- }),
383
- getDefaultValue(e) {
384
- return typeof e.defaultValue == "number" ? e.defaultValue : null;
385
- },
386
- normalizeValue(e) {
387
- if (e == null || e === "") return null;
388
- if (typeof e == "number") return Number.isNaN(e) ? null : e;
389
- if (typeof e == "string") {
390
- let t = e.trim();
391
- if (t.length === 0) return null;
392
- let n = Number(t);
393
- return Number.isNaN(n) ? e : n;
394
- }
395
- let t = Number(e);
396
- return Number.isNaN(t) ? null : t;
397
- },
398
- validate(e, t) {
399
- let n = [];
400
- if (t.min !== void 0 && t.max !== void 0 && t.min > t.max && n.push(l.invalidNumericRange), e === null) return n;
401
- if (typeof e != "number") return n.push(l.invalidNumber), n;
402
- if (t.min !== void 0 && e < t.min && n.push(l.minValue(t.min)), t.max !== void 0 && e > t.max && n.push(l.maxValue(t.max)), t.step !== void 0) {
403
- let r = t.min ?? 0, i = Math.abs(e - r) % t.step, a = t.step * 1e-9;
404
- i > a && Math.abs(i - t.step) > a && n.push(l.stepValue(t.step));
405
- }
406
- return n;
407
- },
408
- describe(e, t) {
409
- let n = e.min !== void 0 && e.max !== void 0 && !e.required && t.state.value !== null;
410
- return y("number-field", e, {
411
- value: t.state.value,
412
- min: e.min,
413
- max: e.max,
414
- step: e.step,
415
- unit: e.unit,
416
- placeholder: e.placeholder ?? "",
417
- input: n ? "range" : "text",
418
- state: t.state.status,
419
- errors: t.state.errors
420
- });
421
- }
422
- }, j = {
423
- kind: "rating",
424
- schema: i.object({
425
- kind: i.literal("rating"),
426
- ...g,
427
- min: i.number().int().optional(),
428
- max: i.number().int().min(1),
429
- step: i.number().int().positive().optional()
430
- }),
431
- getDefaultValue(e) {
432
- return typeof e.defaultValue == "number" ? e.defaultValue : null;
433
- },
434
- normalizeValue(e) {
435
- if (e == null) return null;
436
- let t = typeof e == "number" ? e : Number(e);
437
- return Number.isNaN(t) ? null : t;
438
- },
439
- validate(e, t) {
440
- if (e === null) return [];
441
- let n = [], r = t.min ?? 1, i = t.max;
442
- return r > i ? (n.push(l.invalidNumericRange), n) : (e < r && n.push(l.minValue(r)), e > i && n.push(l.maxValue(i)), n);
443
- },
444
- describe(e, t) {
445
- return y("rating-field", e, {
446
- value: t.state.value,
447
- min: e.min ?? 1,
448
- max: e.max,
449
- step: e.step ?? 1,
450
- state: t.state.status,
451
- errors: t.state.errors
452
- });
453
- }
454
- }, M = {
455
- kind: "text",
456
- schema: i.object({
457
- kind: i.literal("text"),
458
- ...g,
459
- placeholder: i.string().optional(),
460
- minLength: i.number().int().nonnegative().optional(),
461
- maxLength: i.number().int().nonnegative().optional(),
462
- pattern: i.string().optional()
463
- }),
464
- getDefaultValue(e) {
465
- return typeof e.defaultValue == "string" ? e.defaultValue : "";
466
- },
467
- normalizeValue(e) {
468
- return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : "";
469
- },
470
- validate(e, t) {
471
- let n = [];
472
- return t.minLength !== void 0 && t.maxLength !== void 0 && t.minLength > t.maxLength && n.push(l.invalidTextLengthRange), e.length === 0 ? n : (t.minLength !== void 0 && e.length < t.minLength && n.push(l.minLength(t.minLength)), t.maxLength !== void 0 && e.length > t.maxLength && n.push(l.maxLength(t.maxLength)), t.pattern && !new RegExp(t.pattern).test(e) && n.push(l.textPatternMismatch), n);
473
- },
474
- describe(e, t) {
475
- return y("text-field", e, {
476
- value: t.state.value,
477
- placeholder: e.placeholder ?? "",
478
- minLength: e.minLength,
479
- maxLength: e.maxLength,
480
- pattern: e.pattern,
481
- state: t.state.status,
482
- errors: t.state.errors
483
- });
484
- }
485
- }, N = i.object({
486
- kind: i.string().min(1),
487
- label: i.string().min(1),
488
- required: i.boolean().optional()
489
- }).passthrough(), P = i.object({
490
- kind: i.literal("series"),
491
- ...g,
492
- field1: N,
493
- field2: N,
494
- minPoints: i.number().int().nonnegative().optional(),
495
- maxPoints: i.number().int().nonnegative().optional()
496
- }), F = "This field is required.", I = (e) => e.toISOString().slice(0, 10), L = {
497
- text: M,
498
- number: A,
499
- date: D,
500
- category: x
501
- }, R = (e) => L[e], ne = (e) => {
502
- if (e == null || e === "") return null;
503
- if (typeof e == "boolean") return e;
504
- if (typeof e == "string") {
505
- if (e === "true") return !0;
506
- if (e === "false") return !1;
507
- }
508
- return !!e;
509
- }, z = (e, t) => {
510
- if (e.kind === b.kind) return ne(t);
511
- let n = R(e.kind);
512
- return n?.normalizeValue ? n.normalizeValue(t, e) : t;
513
- }, B = (e, t) => {
514
- if (t == null) return null;
515
- if (e.kind === "date" && t instanceof Date) return I(t);
516
- let n = R(e.kind);
517
- return n?.serializeValue ? n.serializeValue(t, e) : t;
518
- }, re = (e, t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : e.kind === b.kind ? t == null : !1, V = (e, t) => {
519
- if (e.required && re(e, t)) return [F];
520
- if (e.kind === b.kind) {
521
- if (t === null) return [];
522
- let n = b.validate?.(t, e, {
523
- field: {
524
- ...e,
525
- id: e.label
526
- },
527
- values: {},
528
- submitCount: 0,
529
- validationVersion: 0,
530
- signal: void 0
531
- });
532
- return Array.isArray(n) ? n : [];
533
- }
534
- let n = R(e.kind);
535
- if (!n?.validate) return [];
536
- let r = n.validate(t, e, {
537
- field: {
538
- ...e,
539
- id: e.label
540
- },
541
- values: {},
542
- submitCount: 0,
543
- validationVersion: 0,
544
- signal: void 0
545
- });
546
- return Array.isArray(r) ? r : [];
547
- }, H = (e, t, n) => n.map((n) => `Row ${e + 1} (${t}): ${n}`), U = (e) => {
548
- if (Array.isArray(e)) return e.length >= 2 ? {
549
- field1: e[0],
550
- field2: e[1]
551
- } : null;
552
- if (!T(e)) return null;
553
- if ("field1" in e || "field2" in e) return {
554
- field1: e.field1,
555
- field2: e.field2
556
- };
557
- let t = Object.entries(e);
558
- return t.length < 2 ? null : {
559
- field1: t[0]?.[1],
560
- field2: t[1]?.[1]
561
- };
562
- }, W = (e, t) => {
563
- let n = U(e);
564
- return n ? {
565
- field1: z(t.field1, n.field1),
566
- field2: z(t.field2, n.field2)
567
- } : null;
568
- }, G = (e, t) => {
569
- let n = /* @__PURE__ */ new Set();
570
- return t.minPoints !== void 0 && t.maxPoints !== void 0 && t.minPoints > t.maxPoints && n.add(l.invalidPointCountRange), t.minPoints !== void 0 && e.length < t.minPoints && n.add(l.minPoints(t.minPoints)), t.maxPoints !== void 0 && e.length > t.maxPoints && n.add(l.maxPoints(t.maxPoints)), n;
571
- }, K = {
572
- kind: "series",
573
- schema: P,
574
- getDefaultValue(e) {
575
- return Array.isArray(e.defaultValue) ? e.defaultValue.map((t) => W(t, e)).filter((e) => e !== null) : [];
576
- },
577
- normalizeValue(e, t) {
578
- return Array.isArray(e) ? e.map((e) => W(e, t)).filter((e) => e !== null) : [];
579
- },
580
- serializeValue(e, t) {
581
- return e.map((e) => ({
582
- field1: B(t.field1, e.field1),
583
- field2: B(t.field2, e.field2)
584
- }));
585
- },
586
- validate(e, t) {
587
- let n = G(e, t);
588
- return e.forEach((e, r) => {
589
- for (let i of H(r, t.field1.label, V(t.field1, e.field1))) n.add(i);
590
- for (let i of H(r, t.field2.label, V(t.field2, e.field2))) n.add(i);
591
- }), [...n];
592
- },
593
- describe(e, t) {
594
- return y("series-field", e, {
595
- value: Array.isArray(t.state.value) ? t.state.value.map((t) => T(t) ? {
596
- field1: B(e.field1, t.field1),
597
- field2: B(e.field2, t.field2)
598
- } : t) : [],
599
- field1: e.field1,
600
- field2: e.field2,
601
- minPoints: e.minPoints,
602
- maxPoints: e.maxPoints,
603
- state: t.state.status,
604
- errors: t.state.errors
605
- });
606
- }
607
- }, q = {
608
- kind: "single-choice",
609
- schema: i.object({
610
- kind: i.literal("single-choice"),
611
- ...g,
612
- options: i.array(v).min(1),
613
- layout: i.enum(["horizontal", "vertical"]).optional()
614
- }),
615
- getDefaultValue(e) {
616
- return typeof e.defaultValue == "string" ? e.defaultValue : null;
617
- },
618
- normalizeValue(e) {
619
- return e == null || e === "" ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "bigint" ? `${e}` : null;
620
- },
621
- validate(e, t) {
622
- return e === null || t.options.map((e) => typeof e == "string" ? e : e.value).includes(e) ? [] : [l.categoryOptionMismatch];
623
- },
624
- describe(e, t) {
625
- return y("single-choice-field", e, {
626
- value: t.state.value,
627
- options: e.options,
628
- layout: e.layout ?? "vertical",
629
- state: t.state.status,
630
- errors: t.state.errors
631
- });
632
- }
633
- }, J = {
634
- kind: "classifier",
635
- schema: i.object({
636
- kind: i.literal("classifier"),
637
- ..._,
638
- labels: i.array(i.string()).optional(),
639
- showClassProbabilities: i.boolean().optional().default(!0)
640
- }),
641
- resolvePayload(e, t) {
642
- return n(t.report, t.result);
643
- },
644
- describe(e, t) {
645
- return t.state.status === "idle" && t.payload === void 0 ? null : {
646
- component: "classifier-report",
647
- props: {
648
- id: t.reportId,
649
- kind: e.kind,
650
- label: e.label ?? s.classifier,
651
- description: e.description ?? "",
652
- payload: t.payload,
653
- error: t.state.error,
654
- state: t.state.status,
655
- showClassProbabilities: e.showClassProbabilities,
656
- labels: e.labels,
657
- ...e.ui
658
- }
659
- };
660
- }
661
- }, Y = {
662
- kind: "regressor",
663
- schema: i.object({
664
- kind: i.literal("regressor"),
665
- ..._,
666
- unit: i.string().optional(),
667
- precision: i.number().int().nonnegative().optional().default(2)
668
- }),
669
- resolvePayload(e, t) {
670
- return n(t.report, t.result);
671
- },
672
- describe(e, t) {
673
- return t.state.status === "idle" && t.payload === void 0 ? null : {
674
- component: "regressor-report",
675
- props: {
676
- id: t.reportId,
677
- kind: e.kind,
678
- label: e.label ?? s.regressor,
679
- description: e.description ?? "",
680
- payload: t.payload,
681
- error: t.state.error,
682
- state: t.state.status,
683
- unit: e.unit,
684
- precision: e.precision,
685
- ...e.ui
686
- }
687
- };
688
- }
689
- }, X = (e) => e.kind === "mapped-category" ? e.config : null, Z = (t, n) => t.getField(n) ?? t.getField(e(n)), ie = async (e, t) => {
690
- let n = t.getField(e.fieldId);
691
- if (!n) return;
692
- let r = X(n);
693
- if (!r) return;
694
- let i = e.values[e.fieldId], a = r.options.find((e) => e.value === i);
695
- if (a?.mapping) {
696
- for (let [n, r] of Object.entries(a.mapping)) {
697
- let i = Z(t, n);
698
- if (!i) throw Error(`mapped-category "${e.fieldId}": target field "${n}" not found in schema.`);
699
- t.commitDerivedValue(i.id, r);
700
- }
701
- t.syncDerivedState();
702
- }
703
- }, Q = () => ({
704
- validate(e) {
705
- for (let t of e.fields) {
706
- let n = X(t);
707
- if (n) {
708
- for (let r of n.options) for (let n of Object.keys(r.mapping ?? {})) if (!Z(e, n)) throw Error(`mapped-category "${t.id}": mapping references unknown field "${n}".`);
709
- }
710
- }
711
- },
712
- async onValuesChanged(e, t) {
713
- await ie(e, t);
714
- }
715
- }), ae = [
716
- M,
717
- A,
718
- b,
719
- x,
720
- S,
721
- w,
722
- D,
723
- K,
724
- O,
725
- q,
726
- k,
727
- j
728
- ], oe = [J, Y], $ = (e, t) => {
729
- !t.describe || e.getField(t.kind) || e.registerField({
730
- kind: t.kind,
731
- describe: t.describe
732
- });
733
- }, se = (e, t) => {
734
- !t.describe || e.getReport(t.kind) || e.registerReport({
735
- kind: t.kind,
736
- describe: t.describe
737
- });
738
- }, ce = () => t().registerReport(J).registerReport(Y), le = () => {
739
- let e = t(), n = r();
740
- for (let t of ae) e.registerField(t), $(n, t);
741
- for (let t of oe) e.registerReport(t), se(n, t);
742
- return {
743
- registry: e,
744
- descriptorRegistry: n,
745
- behaviors: [Q()]
746
- };
747
- };
748
- //#endregion
749
- export { l as S, b as _, J as a, a as b, M as c, k as d, O as f, x as g, S as h, Y as i, j as l, w as m, le as n, q as o, D as p, Q as r, K as s, ce as t, A as u, o as v, s as x, c as y };