@overmap-ai/forms 1.0.3 → 1.0.4-conditional-arrows.2

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.
package/dist/forms.js CHANGED
@@ -1,15 +1,15 @@
1
- var Nt = Object.defineProperty;
2
- var Bt = (s, i, e) => i in s ? Nt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
- var m = (s, i, e) => (Bt(s, typeof i != "symbol" ? i + "" : i, e), e);
4
- import { jsx as r, jsxs as b, Fragment as pt } from "react/jsx-runtime";
5
- import { Flex as y, Text as D, useSeverityColor as fe, Checkbox as qt, CheckCircledIcon as Wt, TextField as le, FontFamilyIcon as jt, CalendarIcon as Ht, InputIcon as Ut, TextArea as Gt, RowsIcon as Kt, Select as ht, Box as he, IconButton as ae, PlusIcon as ke, Badge as qe, Cross1Icon as gt, ListBulletIcon as Yt, DropdownMenuIcon as Qt, MultiSelect as Xt, CheckboxIcon as Jt, Card as ye, Heading as De, Button as G, UploadIcon as bt, ButtonList as $e, divButtonProps as Zt, StarFilledIcon as ei, StarIcon as ti, QuestionMarkCircledIcon as ii, PersonIcon as ni, Tooltip as ri, Avatar as oi, Separator as si, Dialog as li, Pencil1Icon as ai, TrashIcon as ci, CopyIcon as di, DragHandleDots2Icon as ui, DropdownMenu as fi, DotsVerticalIcon as mi, useAlertDialog as pi, Em as hi, Strong as lt, useToast as gi, Tabs as X } from "@overmap-ai/blocks";
6
- import { useField as Ye, useFormikContext as me, useFormik as Qe, FormikProvider as Xe } from "formik";
7
- import bi, { useMemo as v, memo as S, useCallback as T, useState as ce, useEffect as we, useRef as yi, forwardRef as ve, useReducer as wi } from "react";
8
- import { DragDropContext as yt, Droppable as Je, Draggable as Ze } from "@hello-pangea/dnd";
9
- import { slugify as vi, useAppSelector as _, selectFormRevision as wt, useSDK as vt, selectSubmissionAttachments as xi, selectFilteredUserForms as Ii, selectUserFormMapping as Fi, selectOrganization as xt, selectUser as et, selectNumberOfUserForms as Ci, selectCurrentUser as It, classNames as Ft, isToday as Ti, getLocalDateString as Si, selectLatestFormRevision as zi, useFileSrc as Ei, selectSubmissionsForForm as Ai } from "@overmap-ai/core";
10
- import de from "lodash.get";
11
- import tt from "lodash.set";
12
- class Ct {
1
+ var Wt = Object.defineProperty;
2
+ var jt = (s, i, e) => i in s ? Wt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
+ var m = (s, i, e) => (jt(s, typeof i != "symbol" ? i + "" : i, e), e);
4
+ import { jsx as o, jsxs as g, Fragment as gt } from "react/jsx-runtime";
5
+ import { Flex as y, Text as V, useSeverityColor as me, Checkbox as Ht, CheckCircledIcon as Ut, TextField as ae, FontFamilyIcon as Gt, CalendarIcon as Kt, InputIcon as Yt, TextArea as Qt, RowsIcon as Xt, Select as bt, Box as ge, IconButton as ce, PlusIcon as $e, Badge as je, Cross1Icon as yt, ListBulletIcon as Jt, DropdownMenuIcon as Zt, MultiSelect as ei, CheckboxIcon as ti, Card as xe, Heading as Me, Button as G, UploadIcon as xt, ButtonList as Oe, divButtonProps as ii, StarFilledIcon as ni, StarIcon as ri, QuestionMarkCircledIcon as oi, PersonIcon as si, Tooltip as li, Avatar as ai, Separator as ci, Dialog as di, Pencil1Icon as ui, TrashIcon as fi, CopyIcon as mi, DragHandleDots2Icon as hi, DropdownMenu as pi, DotsVerticalIcon as gi, useAlertDialog as bi, Em as yi, Strong as ct, useToast as xi, Tabs as J } from "@overmap-ai/blocks";
6
+ import { useField as Xe, useFormikContext as he, useFormik as Je, FormikProvider as Ze } from "formik";
7
+ import wi, { useMemo as w, memo as F, useCallback as T, useState as de, useEffect as we, useRef as wt, forwardRef as ve, useReducer as vi } from "react";
8
+ import { DragDropContext as vt, Droppable as et, Draggable as tt } from "@hello-pangea/dnd";
9
+ import { slugify as Ii, useAppSelector as $, selectFormRevision as It, useSDK as Ct, selectSubmissionAttachments as Ci, selectFilteredUserForms as Fi, selectUserFormMapping as Ti, selectOrganization as Ft, selectUser as it, selectNumberOfUserForms as Si, selectCurrentUser as Tt, classNames as St, isToday as zi, getLocalDateString as Ei, selectLatestFormRevision as Ai, useFileSrc as Li, selectSubmissionsForForm as Pi } from "@overmap-ai/core";
10
+ import ue from "lodash.get";
11
+ import nt from "lodash.set";
12
+ class zt {
13
13
  constructor(i) {
14
14
  m(this, "type");
15
15
  m(this, "identifier");
@@ -33,9 +33,9 @@ class Ct {
33
33
  };
34
34
  }
35
35
  }
36
- class M extends Ct {
36
+ class M extends zt {
37
37
  constructor(e) {
38
- const { label: t, required: n, fieldValidators: o = [], formValidators: l = [], ...c } = e;
38
+ const { label: t, required: n, fieldValidators: r = [], formValidators: a = [], ...c } = e;
39
39
  super(c);
40
40
  m(this, "required");
41
41
  m(this, "formValidators");
@@ -48,7 +48,7 @@ class M extends Ct {
48
48
  * which don't have a `onBlur` event (which is used to set the `touched` state).
49
49
  */
50
50
  m(this, "onlyValidateAfterTouched", !0);
51
- this.label = t, this.required = n, this.fieldValidators = o, this.formValidators = l;
51
+ this.label = t, this.required = n, this.fieldValidators = r, this.formValidators = a;
52
52
  }
53
53
  static getFieldCreationSchema() {
54
54
  return [];
@@ -63,15 +63,15 @@ class M extends Ct {
63
63
  if (this.required && this.isBlank(e))
64
64
  return "This field is required.";
65
65
  for (const n of this.getFieldValidators()) {
66
- const o = n(e);
67
- if (o)
68
- return o;
66
+ const r = n(e);
67
+ if (r)
68
+ return r;
69
69
  }
70
70
  if (t)
71
71
  for (const n of this.getFormValidators()) {
72
- const o = n(e, t);
73
- if (o)
74
- return o;
72
+ const r = n(e, t);
73
+ if (r)
74
+ return r;
75
75
  }
76
76
  }
77
77
  // TODO: We can probably combine _serialize and serialize.
@@ -90,58 +90,59 @@ class M extends Ct {
90
90
  }
91
91
  }
92
92
  m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
93
- const Li = "_description_17zed_1", _e = {
94
- description: Li
93
+ const ki = "_description_9dewt_1", Vi = "_fieldsContainer_9dewt_5", Ie = {
94
+ description: ki,
95
+ fieldsContainer: Vi
95
96
  }, W = (s) => {
96
- const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: l } = s;
97
- return /* @__PURE__ */ r(y, { direction: "column", gap: "1", asChild: !0, ...l, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
98
- /* @__PURE__ */ r(D, { severity: t, id: o, children: i }),
97
+ const { label: i, children: e, severity: t, inputId: n, labelId: r, flexProps: a } = s;
98
+ return /* @__PURE__ */ o(y, { direction: "column", gap: "1", asChild: !0, ...a, children: /* @__PURE__ */ g("label", { htmlFor: n, children: [
99
+ /* @__PURE__ */ o(V, { severity: t, id: r, children: i }),
99
100
  e
100
101
  ] }) });
101
102
  }, j = (s) => {
102
103
  const { helpText: i, children: e, severity: t } = s;
103
- return /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
104
+ return /* @__PURE__ */ g(y, { direction: "column", gap: "1", children: [
104
105
  e,
105
- /* @__PURE__ */ r(y, { direction: "column", children: /* @__PURE__ */ r(D, { size: "1", severity: t, className: _e.description, children: i }) })
106
+ /* @__PURE__ */ o(y, { direction: "column", children: /* @__PURE__ */ o(V, { size: "1", severity: t, className: Ie.description, children: i }) })
106
107
  ] });
107
108
  }, H = (s) => {
108
- const { id: i, field: e, formId: t, ...n } = s, [o, l, c] = Ye(e.getId()), { touched: a } = l, f = l.error ?? e.description, d = l.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, h = `${u}-label`, p = e.required ? `${e.label} *` : e.label, g = v(() => ({
109
- ...o,
110
- onChange: (F) => {
111
- const w = e.getValueFromChangeEvent(F);
112
- c.setValue(w, !1).then(), (a || !e.onlyValidateAfterTouched) && c.setError(e.getError(w));
109
+ const { id: i, field: e, formId: t, ...n } = s, [r, a, c] = Xe(e.getId()), { touched: l } = a, f = a.error ?? e.description, d = a.error ? "danger" : void 0, u = i ?? `${t}-${e.getId()}-input`, p = `${u}-label`, h = e.required ? `${e.label} *` : e.label, b = w(() => ({
110
+ ...r,
111
+ onChange: (C) => {
112
+ const x = e.getValueFromChangeEvent(C);
113
+ c.setValue(x, !1).then(), (l || !e.onlyValidateAfterTouched) && c.setError(e.getError(x));
113
114
  },
114
- onBlur: (F) => {
115
- c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(F)));
115
+ onBlur: (C) => {
116
+ c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(C)));
116
117
  }
117
- }), [e, o, c, a]);
118
+ }), [e, r, c, l]);
118
119
  return [
119
120
  {
120
121
  helpText: f,
121
122
  severity: d,
122
123
  inputId: u,
123
- labelId: h,
124
- label: p,
125
- fieldProps: g,
124
+ labelId: p,
125
+ label: h,
126
+ fieldProps: b,
126
127
  helpers: c,
127
128
  field: e
128
129
  },
129
- { ...n, "aria-labelledby": h }
130
+ { ...n, "aria-labelledby": p }
130
131
  ];
131
- }, Pi = [!0, "true"], Vi = S(function(i) {
132
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = Pi.includes(c.value);
133
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(
132
+ }, Di = [!0, "true"], _i = F(function(i) {
133
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c }, l] = H(i), f = me(n), d = Di.includes(c.value);
134
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(
134
135
  W,
135
136
  {
136
137
  severity: n,
137
138
  inputId: e,
138
139
  labelId: t,
139
- label: l,
140
+ label: a,
140
141
  flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
141
- children: /* @__PURE__ */ r(
142
- qt,
142
+ children: /* @__PURE__ */ o(
143
+ Ht,
143
144
  {
144
- ...a,
145
+ ...l,
145
146
  ...c,
146
147
  id: e,
147
148
  color: f,
@@ -154,7 +155,7 @@ const Li = "_description_17zed_1", _e = {
154
155
  )
155
156
  }
156
157
  ) });
157
- }), J = class J extends M {
158
+ }), Z = class Z extends M {
158
159
  constructor(e) {
159
160
  super({ ...e, type: "boolean" });
160
161
  m(this, "onlyValidateAfterTouched", !1);
@@ -172,26 +173,26 @@ const Li = "_description_17zed_1", _e = {
172
173
  static deserialize(e) {
173
174
  if (e.type !== "boolean")
174
175
  throw new Error("Type mismatch.");
175
- return new J(e);
176
+ return new Z(e);
176
177
  }
177
178
  getInput(e) {
178
- return /* @__PURE__ */ r(Vi, { ...e, field: this });
179
+ return /* @__PURE__ */ o(_i, { ...e, field: this });
179
180
  }
180
181
  };
181
- m(J, "fieldTypeName", "Checkbox"), m(J, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(J, "Icon", Wt);
182
- let ue = J;
183
- const ki = S(function(i) {
184
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
185
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
186
- le.Input,
182
+ m(Z, "fieldTypeName", "Checkbox"), m(Z, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(Z, "Icon", Ut);
183
+ let fe = Z;
184
+ const $i = F(function(i) {
185
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c, field: l }, f] = H(i), d = me(n);
186
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(
187
+ ae.Input,
187
188
  {
188
189
  ...f,
189
190
  ...c,
190
191
  type: "number",
191
192
  id: e,
192
- min: a.minimum,
193
- max: a.maximum,
194
- step: a.integers ? 1 : 0.1,
193
+ min: l.minimum,
194
+ max: l.maximum,
195
+ step: l.integers ? 1 : 0.1,
195
196
  color: d
196
197
  }
197
198
  ) }) });
@@ -200,14 +201,14 @@ const ki = S(function(i) {
200
201
  const {
201
202
  minimum: t = Number.MIN_SAFE_INTEGER,
202
203
  maximum: n = Number.MAX_SAFE_INTEGER,
203
- integers: o = !1,
204
- ...l
204
+ integers: r = !1,
205
+ ...a
205
206
  } = e;
206
- super({ ...l, type: "number" });
207
+ super({ ...a, type: "number" });
207
208
  m(this, "minimum");
208
209
  m(this, "maximum");
209
210
  m(this, "integers");
210
- this.minimum = t, this.maximum = n, this.integers = o;
211
+ this.minimum = t, this.maximum = n, this.integers = r;
211
212
  }
212
213
  getValueFromChangeEvent(e) {
213
214
  const t = Number.parseFloat(e.target.value);
@@ -231,7 +232,7 @@ const ki = S(function(i) {
231
232
  identifier: "maximum",
232
233
  formValidators: [this._validateMax]
233
234
  }),
234
- new ue({
235
+ new fe({
235
236
  label: "Integers",
236
237
  description: "Whole numbers only",
237
238
  required: !1,
@@ -241,14 +242,14 @@ const ki = S(function(i) {
241
242
  }
242
243
  getFieldValidators() {
243
244
  const e = super.getFieldValidators(), t = this.minimum, n = this.maximum;
244
- return typeof t == "number" && e.push((o) => {
245
- if (typeof o == "number" && o < t)
245
+ return typeof t == "number" && e.push((r) => {
246
+ if (typeof r == "number" && r < t)
246
247
  return `Must be at least ${this.minimum}.`;
247
- }), typeof n == "number" && e.push((o) => {
248
- if (typeof o == "number" && o > n)
248
+ }), typeof n == "number" && e.push((r) => {
249
+ if (typeof r == "number" && r > n)
249
250
  return `Must be at most ${this.maximum}.`;
250
- }), this.integers && e.push((o) => {
251
- if (typeof o == "number" && !Number.isInteger(o))
251
+ }), this.integers && e.push((r) => {
252
+ if (typeof r == "number" && !Number.isInteger(r))
252
253
  return "Must be a whole number.";
253
254
  }), e;
254
255
  }
@@ -266,15 +267,15 @@ const ki = S(function(i) {
266
267
  return new B(e);
267
268
  }
268
269
  getInput(e) {
269
- return /* @__PURE__ */ r(ki, { field: this, ...e });
270
+ return /* @__PURE__ */ o($i, { field: this, ...e });
270
271
  }
271
272
  };
272
- m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon", jt), m(B, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(B, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
273
- let Y = B;
274
- const Di = S(function(i) {
275
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = c.value ? c.value.split("T")[0] : "";
276
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(le.Input, { ...a, ...c, type: "date", id: e, color: f, value: d }) }) });
277
- }), Z = class Z extends M {
273
+ m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon", Gt), m(B, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(B, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
274
+ let Q = B;
275
+ const Mi = F(function(i) {
276
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c }, l] = H(i), f = me(n), d = c.value ? c.value.split("T")[0] : "";
277
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(ae.Input, { ...l, ...c, type: "date", id: e, color: f, value: d }) }) });
278
+ }), ee = class ee extends M {
278
279
  constructor(e) {
279
280
  super({ ...e, type: "date" });
280
281
  m(this, "onlyValidateAfterTouched", !1);
@@ -288,18 +289,18 @@ const Di = S(function(i) {
288
289
  static deserialize(e) {
289
290
  if (e.type !== "date")
290
291
  throw new Error("Type mismatch.");
291
- return new Z(e);
292
+ return new ee(e);
292
293
  }
293
294
  getInput(e) {
294
- return /* @__PURE__ */ r(Di, { field: this, ...e });
295
+ return /* @__PURE__ */ o(Mi, { field: this, ...e });
295
296
  }
296
297
  };
297
- m(Z, "fieldTypeName", "Date"), m(Z, "fieldTypeDescription", "Allows specifying a date."), m(Z, "Icon", Ht);
298
- let We = Z;
299
- class Ce extends M {
298
+ m(ee, "fieldTypeName", "Date"), m(ee, "fieldTypeDescription", "Allows specifying a date."), m(ee, "Icon", Kt);
299
+ let He = ee;
300
+ class ze extends M {
300
301
  constructor(e) {
301
- const { minLength: t, maxLength: n = 5e3, ...o } = e;
302
- super(o);
302
+ const { minLength: t, maxLength: n = 5e3, ...r } = e;
303
+ super(r);
303
304
  m(this, "minLength");
304
305
  m(this, "maxLength");
305
306
  this.minLength = t ? Math.max(t, 0) : void 0, this.maxLength = n ? Math.max(n, 0) : 5e3;
@@ -307,7 +308,7 @@ class Ce extends M {
307
308
  static getFieldCreationSchema() {
308
309
  return [
309
310
  // min, max
310
- new Y({
311
+ new Q({
311
312
  label: "Minimum length",
312
313
  description: "Minimum number of characters",
313
314
  required: !1,
@@ -317,7 +318,7 @@ class Ce extends M {
317
318
  formValidators: [this._validateMin],
318
319
  integers: !0
319
320
  }),
320
- new Y({
321
+ new Q({
321
322
  label: "Maximum length",
322
323
  description: "Maximum number of characters",
323
324
  required: !1,
@@ -355,23 +356,23 @@ class Ce extends M {
355
356
  * This function validates that the value given for "minimum length" (when creating a new field) is less than or
356
357
  * equal to the value given for "maximum length".
357
358
  */
358
- m(Ce, "_validateMin", (e, t) => typeof t.maximum_length == "number" && typeof e == "number" && t.maximum_length < e ? "Minimum cannot be greater than maximum." : null), /**
359
+ m(ze, "_validateMin", (e, t) => typeof t.maximum_length == "number" && typeof e == "number" && t.maximum_length < e ? "Minimum cannot be greater than maximum." : null), /**
359
360
  * This function validates that the value given for "maximum length" (when creating a new field) is greater than or
360
361
  * equal to the value given for "minimum length".
361
362
  */
362
- m(Ce, "_validateMax", (e, t) => {
363
+ m(ze, "_validateMax", (e, t) => {
363
364
  if (typeof e != "number")
364
365
  return null;
365
366
  const { minimum_length: n } = t;
366
367
  return typeof n != "number" ? null : n > e ? "Maximum cannot be less than minimum." : null;
367
368
  });
368
- const $i = S(function(i) {
369
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
370
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(le.Input, { ...f, ...c, type: a.inputType, id: e, color: d }) }) });
371
- }), ee = class ee extends Ce {
369
+ const Oi = F(function(i) {
370
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c, field: l }, f] = H(i), d = me(n);
371
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(ae.Input, { ...f, ...c, type: l.inputType, id: e, color: d }) }) });
372
+ }), te = class te extends ze {
372
373
  constructor(e) {
373
- const { inputType: t = "text", ...n } = e, o = e.maxLength ? Math.min(500, e.maxLength) : 500, l = e.minLength ? Math.min(e.minLength, o) : void 0;
374
- super({ ...n, maxLength: o, minLength: l, type: "string" });
374
+ const { inputType: t = "text", ...n } = e, r = e.maxLength ? Math.min(500, e.maxLength) : 500, a = e.minLength ? Math.min(e.minLength, r) : void 0;
375
+ super({ ...n, maxLength: r, minLength: a, type: "string" });
375
376
  m(this, "inputType");
376
377
  this.inputType = t;
377
378
  }
@@ -381,19 +382,19 @@ const $i = S(function(i) {
381
382
  static deserialize(e) {
382
383
  if (e.type !== "string")
383
384
  throw new Error("Type mismatch.");
384
- const { maximum_length: t, minimum_length: n, input_type: o, ...l } = e;
385
- return new ee({ ...l, maxLength: t, minLength: n, inputType: o });
385
+ const { maximum_length: t, minimum_length: n, input_type: r, ...a } = e;
386
+ return new te({ ...a, maxLength: t, minLength: n, inputType: r });
386
387
  }
387
388
  getInput(e) {
388
- return /* @__PURE__ */ r($i, { field: this, ...e });
389
+ return /* @__PURE__ */ o(Oi, { field: this, ...e });
389
390
  }
390
391
  };
391
- m(ee, "fieldTypeName", "Short Text"), m(ee, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ee, "Icon", Ut);
392
- let ge = ee;
393
- const _i = S(function(i) {
394
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i);
395
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(Gt, { ...a, ...c, resize: "vertical", id: e, severity: n }) }) });
396
- }), te = class te extends Ce {
392
+ m(te, "fieldTypeName", "Short Text"), m(te, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(te, "Icon", Yt);
393
+ let be = te;
394
+ const Ri = F(function(i) {
395
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c }, l] = H(i);
396
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(Qt, { ...l, ...c, resize: "vertical", id: e, severity: n }) }) });
397
+ }), ie = class ie extends ze {
397
398
  constructor(i) {
398
399
  const e = i.maxLength ? Math.min(5e3, i.maxLength) : 5e3, t = i.minLength ? Math.min(i.minLength, e) : void 0;
399
400
  super({ ...i, maxLength: e, minLength: t, type: "text" });
@@ -405,189 +406,189 @@ const _i = S(function(i) {
405
406
  if (i.type !== "text")
406
407
  throw new Error("Type mismatch.");
407
408
  const { maximum_length: e, minimum_length: t, ...n } = i;
408
- return new te({ ...n, maxLength: e, minLength: t });
409
+ return new ie({ ...n, maxLength: e, minLength: t });
409
410
  }
410
411
  getInput(i) {
411
- return /* @__PURE__ */ r(_i, { field: this, ...i });
412
+ return /* @__PURE__ */ o(Ri, { field: this, ...i });
412
413
  }
413
414
  };
414
- m(te, "fieldTypeName", "Paragraph"), m(te, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(te, "Icon", Kt);
415
- let be = te;
416
- const Mi = S(function(i) {
417
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d, onBlur: u } = c, h = v(
418
- () => a.options.map((g) => ({ value: g.value, itemContent: g.label })),
419
- [a.options]
420
- ), p = T(
421
- (g) => {
422
- d(g), u(g);
415
+ m(ie, "fieldTypeName", "Paragraph"), m(ie, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(ie, "Icon", Xt);
416
+ let ye = ie;
417
+ const Ni = F(function(i) {
418
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c, field: l }, f] = H(i), { onChange: d, onBlur: u } = c, p = w(
419
+ () => l.options.map((b) => ({ value: b.value, itemContent: b.label })),
420
+ [l.options]
421
+ ), h = T(
422
+ (b) => {
423
+ d(b), u(b);
423
424
  },
424
425
  [d, u]
425
426
  );
426
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
427
- ht,
427
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(
428
+ bt,
428
429
  {
429
- items: h,
430
+ items: p,
430
431
  ...c,
431
- onValueChange: p,
432
+ onValueChange: h,
432
433
  placeholder: "Select one...",
433
434
  id: e,
434
435
  severity: n,
435
436
  ...f
436
437
  }
437
438
  ) }) });
438
- }), Te = (s = "", i = []) => ({
439
+ }), Ee = (s = "", i = []) => ({
439
440
  type: "section",
440
441
  fields: i,
441
442
  identifier: s,
442
443
  label: null,
443
444
  condition: null,
444
445
  conditional: !1
445
- }), Oi = (s) => {
446
+ }), Bi = (s) => {
446
447
  if (!s)
447
448
  return;
448
449
  const i = s.fields;
449
450
  let e = [];
450
451
  const t = [];
451
452
  for (const n of i)
452
- n.type === "section" ? (e.length > 0 && (t.push(Te(`AUTO_section-${i.indexOf(n)}`, e)), e = []), t.push(n)) : e.push(n);
453
- return e.length > 0 && t.push(Te("AUTO_section-last", e)), { ...s, fields: t, description: s.description ?? "" };
453
+ n.type === "section" ? (e.length > 0 && (t.push(Ee(`AUTO_section-${i.indexOf(n)}`, e)), e = []), t.push(n)) : e.push(n);
454
+ return e.length > 0 && t.push(Ee("AUTO_section-last", e)), { ...s, fields: t, description: s.description ?? "" };
454
455
  };
455
- function je(s, i, e) {
456
+ function Ue(s, i, e) {
456
457
  const t = Array.from(s), [n] = t.splice(i, 1);
457
458
  if (!n)
458
459
  throw new Error("Could not find field to reorder.");
459
460
  return t.splice(e, 0, n), t;
460
461
  }
461
- function Ri(s, i, e) {
462
+ function qi(s, i, e) {
462
463
  const t = Array.from(s);
463
464
  return t[i] = e, t;
464
465
  }
465
- function Tt(s, i, e) {
466
+ function Et(s, i, e) {
466
467
  const t = Array.from(s ?? []);
467
468
  return t.splice(i, 0, e), t;
468
469
  }
469
- function Se(s, i) {
470
+ function Ae(s, i) {
470
471
  const e = Array.from(s);
471
472
  return e.splice(i, 1), e;
472
473
  }
473
- const St = (s, i) => {
474
+ const At = (s, i) => {
474
475
  if (typeof s == "string" && s.length > 0)
475
476
  return s;
476
477
  const e = /* @__PURE__ */ new Date();
477
- return `${vi(i)}-${e.getTime()}`;
478
- }, zt = (s, i) => {
478
+ return `${Ii(i)}-${e.getTime()}`;
479
+ }, Lt = (s, i) => {
479
480
  if (!i)
480
481
  return null;
481
482
  for (const e of s)
482
483
  if (e.type === "section") {
483
- const t = zt(e.fields, i);
484
+ const t = Lt(e.fields, i);
484
485
  if (t)
485
486
  return t;
486
487
  } else if (e.identifier === i)
487
488
  return e;
488
489
  return null;
489
- }, Fe = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Et = (s) => s.flatMap(
490
+ }, Se = (s, i) => s.filter((e, t) => t < i).flatMap((e) => e.fields), Pt = (s) => s.flatMap(
490
491
  (i) => i.type === "section" ? [...i.fields.map((e) => e.label), i.label] : i.label
491
- ).filter((i) => i !== null), He = (s, i) => {
492
+ ).filter((i) => i !== null), Ge = (s, i) => {
492
493
  let e = 1, t = `${s} (${e})`;
493
494
  for (; i.includes(t); )
494
495
  t = `${s} (${++e})`;
495
496
  return t;
496
- }, Ni = S(function(i) {
497
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = v(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: h } = c, p = `${e}-droppable`, { disabled: g } = a, [x, z] = ce(""), [F, w] = ce(""), L = F || o, P = F ? "red" : f, I = T(
497
+ }, Wi = F(function(i) {
498
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c }, l] = H(i), f = me(n), d = w(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: p } = c, h = `${e}-droppable`, { disabled: b } = l, [v, z] = de(""), [C, x] = de(""), L = C || r, P = C ? "red" : f, I = T(
498
499
  (A) => {
499
- u(A), h(A);
500
+ u(A), p(A);
500
501
  },
501
- [u, h]
502
- ), V = T(
502
+ [u, p]
503
+ ), k = T(
503
504
  (A) => {
504
- d.findIndex((R) => R.value === A.target.value.trim()) >= 0 ? w("All options must be unique") : A.target.value ? w("") : w("Option cannot be empty"), z(A.target.value);
505
+ d.findIndex((R) => R.value === A.target.value.trim()) >= 0 ? x("All options must be unique") : A.target.value ? x("") : x("Option cannot be empty"), z(A.target.value);
505
506
  },
506
507
  [z, d]
507
508
  ), O = T(() => {
508
- if (F)
509
+ if (C)
509
510
  return;
510
- if (!x.trim())
511
- return w("Option cannot be empty");
512
- const A = x.trim();
511
+ if (!v.trim())
512
+ return x("Option cannot be empty");
513
+ const A = v.trim();
513
514
  I([...d, { value: A, label: A }]), z("");
514
- }, [x, F, I, d]), K = T(
515
+ }, [v, C, I, d]), K = T(
515
516
  (A) => {
516
517
  A.key === "Enter" && (A.preventDefault(), O());
517
518
  },
518
519
  [O]
519
520
  ), q = T(
520
521
  (A) => {
521
- I(Se(d, A));
522
+ I(Ae(d, A));
522
523
  },
523
524
  [d, I]
524
525
  ), U = T(
525
526
  (A) => {
526
527
  if (!A.destination)
527
528
  return;
528
- const R = A.source.index, C = A.destination.index;
529
- I(je(d, R, C));
529
+ const R = A.source.index, Y = A.destination.index;
530
+ I(Ue(d, R, Y));
530
531
  },
531
532
  [I, d]
532
533
  );
533
- return /* @__PURE__ */ r(yt, { onDragEnd: U, children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
534
- /* @__PURE__ */ r(j, { helpText: L, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: (!g || d.length === 0) && /* @__PURE__ */ b(y, { gap: "2", children: [
535
- /* @__PURE__ */ r(he, { grow: "1", children: /* @__PURE__ */ r(
536
- le.Input,
534
+ return /* @__PURE__ */ o(vt, { onDragEnd: U, children: /* @__PURE__ */ g(y, { direction: "column", gap: "2", children: [
535
+ /* @__PURE__ */ o(j, { helpText: L, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: (!b || d.length === 0) && /* @__PURE__ */ g(y, { gap: "2", children: [
536
+ /* @__PURE__ */ o(ge, { grow: "1", children: /* @__PURE__ */ o(
537
+ ae.Input,
537
538
  {
538
539
  placeholder: "Press enter to add a new option",
539
- ...a,
540
+ ...l,
540
541
  ...c,
541
- value: x,
542
- onChange: V,
542
+ value: v,
543
+ onChange: k,
543
544
  onKeyDown: K,
544
545
  id: e,
545
546
  color: P,
546
547
  onBlur: void 0
547
548
  }
548
549
  ) }),
549
- /* @__PURE__ */ r(
550
- ae,
550
+ /* @__PURE__ */ o(
551
+ ce,
551
552
  {
552
553
  type: "button",
553
554
  "aria-label": "Add option",
554
- disabled: !!F || g,
555
+ disabled: !!C || b,
555
556
  onClick: O,
556
- children: /* @__PURE__ */ r(ke, {})
557
+ children: /* @__PURE__ */ o($e, {})
557
558
  }
558
559
  )
559
560
  ] }) }) }),
560
- /* @__PURE__ */ r(Je, { droppableId: p, children: (A) => /* @__PURE__ */ b(y, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
561
- d.map((R, C) => /* @__PURE__ */ r(
562
- Ze,
561
+ /* @__PURE__ */ o(et, { droppableId: h, children: (A) => /* @__PURE__ */ g(y, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
562
+ d.map((R, Y) => /* @__PURE__ */ o(
563
+ tt,
563
564
  {
564
565
  draggableId: `${R.value}-draggable`,
565
- index: C,
566
- isDragDisabled: g,
567
- children: ({ draggableProps: E, dragHandleProps: $, innerRef: k }) => /* @__PURE__ */ r(
566
+ index: Y,
567
+ isDragDisabled: b,
568
+ children: ({ draggableProps: Ce, dragHandleProps: S, innerRef: E }) => /* @__PURE__ */ o(
568
569
  y,
569
570
  {
570
- ...$,
571
- ...E,
572
- ref: k,
571
+ ...S,
572
+ ...Ce,
573
+ ref: E,
573
574
  gap: "2",
574
575
  align: "center",
575
576
  justify: "between",
576
577
  mb: "1",
577
578
  asChild: !0,
578
- children: /* @__PURE__ */ b(qe, { color: "gray", size: "2", children: [
579
- /* @__PURE__ */ r("span", { children: R.label }),
580
- /* @__PURE__ */ r(
581
- ae,
579
+ children: /* @__PURE__ */ g(je, { color: "gray", size: "2", children: [
580
+ /* @__PURE__ */ o("span", { children: R.label }),
581
+ /* @__PURE__ */ o(
582
+ ce,
582
583
  {
583
584
  size: "small",
584
585
  variant: "ghost",
585
586
  type: "button",
586
587
  "aria-label": "Delete option",
587
588
  severity: "info",
588
- disabled: g,
589
- onClick: () => q(C),
590
- children: /* @__PURE__ */ r(gt, {})
589
+ disabled: b,
590
+ onClick: () => q(Y),
591
+ children: /* @__PURE__ */ o(yt, {})
591
592
  }
592
593
  )
593
594
  ] })
@@ -599,10 +600,10 @@ const St = (s, i) => {
599
600
  A.placeholder
600
601
  ] }) })
601
602
  ] }) });
602
- }), ie = class ie extends M {
603
+ }), ne = class ne extends M {
603
604
  constructor(e) {
604
- const { minimum_length: t, maximum_length: n, ...o } = e;
605
- super({ ...o, type: "multi-string" });
605
+ const { minimum_length: t, maximum_length: n, ...r } = e;
606
+ super({ ...r, type: "multi-string" });
606
607
  m(this, "minLength");
607
608
  m(this, "maxLength");
608
609
  m(this, "onlyValidateAfterTouched", !1);
@@ -614,7 +615,7 @@ const St = (s, i) => {
614
615
  throw new Error("Expected an array.");
615
616
  }
616
617
  getInput(e) {
617
- return /* @__PURE__ */ r(Ni, { field: this, ...e });
618
+ return /* @__PURE__ */ o(Wi, { field: this, ...e });
618
619
  }
619
620
  serialize() {
620
621
  return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
@@ -635,12 +636,12 @@ const St = (s, i) => {
635
636
  static deserialize(e) {
636
637
  if (e.type !== "multi-string")
637
638
  throw new Error("Type mismatch.");
638
- return new ie(e);
639
+ return new ne(e);
639
640
  }
640
641
  };
641
- m(ie, "fieldTypeName", "Multi-string"), m(ie, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ie, "Icon", Yt);
642
- let ze = ie;
643
- class At extends M {
642
+ m(ne, "fieldTypeName", "Multi-string"), m(ne, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), m(ne, "Icon", Jt);
643
+ let Le = ne;
644
+ class kt extends M {
644
645
  constructor(e) {
645
646
  super(e);
646
647
  m(this, "options");
@@ -659,7 +660,7 @@ class At extends M {
659
660
  }
660
661
  static getFieldCreationSchema() {
661
662
  return [
662
- new ze({
663
+ new Le({
663
664
  label: "Options",
664
665
  description: "List possible options for the user to select from.",
665
666
  required: !0,
@@ -670,7 +671,7 @@ class At extends M {
670
671
  ];
671
672
  }
672
673
  }
673
- const ne = class ne extends At {
674
+ const re = class re extends kt {
674
675
  constructor(i) {
675
676
  super({ ...i, type: "select" });
676
677
  }
@@ -683,27 +684,27 @@ const ne = class ne extends At {
683
684
  static deserialize(i) {
684
685
  if (i.type !== "select")
685
686
  throw new Error("Type mismatch.");
686
- return new ne(i);
687
+ return new re(i);
687
688
  }
688
689
  getInput(i) {
689
- return /* @__PURE__ */ r(Mi, { field: this, ...i });
690
+ return /* @__PURE__ */ o(Ni, { field: this, ...i });
690
691
  }
691
692
  };
692
- m(ne, "fieldTypeName", "Dropdown"), m(ne, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(ne, "Icon", Qt);
693
- let Ee = ne;
694
- const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = S(function(i) {
695
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d, onBlur: u } = c, h = v(() => Bi(c.value), [c.value]), p = T(
696
- (g) => {
697
- d(g), u(g);
693
+ m(re, "fieldTypeName", "Dropdown"), m(re, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(re, "Icon", Zt);
694
+ let Pe = re;
695
+ const ji = (s) => s ? Array.isArray(s) ? s : [s] : [], Hi = F(function(i) {
696
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c, field: l }, f] = H(i), { onChange: d, onBlur: u } = c, p = w(() => ji(c.value), [c.value]), h = T(
697
+ (b) => {
698
+ d(b), u(b);
698
699
  },
699
700
  [d, u]
700
701
  );
701
- return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
702
- Xt,
702
+ return /* @__PURE__ */ o(j, { helpText: r, severity: n, children: /* @__PURE__ */ o(W, { severity: n, inputId: e, labelId: t, label: a, children: /* @__PURE__ */ o(
703
+ ei,
703
704
  {
704
- value: h,
705
- onValueChange: p,
706
- options: a.options,
705
+ value: p,
706
+ onValueChange: h,
707
+ options: l.options,
707
708
  name: c.name,
708
709
  placeholder: "Select one or more...",
709
710
  id: e,
@@ -711,7 +712,7 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = S(function(i) {
711
712
  ...f
712
713
  }
713
714
  ) }) });
714
- }), re = class re extends At {
715
+ }), oe = class oe extends kt {
715
716
  constructor(i) {
716
717
  super({ ...i, type: "multi-select" });
717
718
  }
@@ -729,22 +730,22 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = S(function(i) {
729
730
  static deserialize(i) {
730
731
  if (i.type !== "multi-select")
731
732
  throw new Error("Type mismatch.");
732
- return new re(i);
733
+ return new oe(i);
733
734
  }
734
735
  getInput(i) {
735
- return /* @__PURE__ */ r(qi, { field: this, ...i });
736
+ return /* @__PURE__ */ o(Hi, { field: this, ...i });
736
737
  }
737
738
  };
738
- m(re, "fieldTypeName", "Multi-select"), m(re, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(re, "Icon", Jt);
739
- let Ae = re;
740
- const Wi = S(function({ field: i, ...e }) {
741
- const [{ value: t }] = Ye(i.options.clonedFieldIdentifier), n = v(() => {
742
- const o = i.options.getFieldToClone(t);
743
- return o ? Me(o) : null;
739
+ m(oe, "fieldTypeName", "Multi-select"), m(oe, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(oe, "Icon", ti);
740
+ let ke = oe;
741
+ const Ui = F(function({ field: i, ...e }) {
742
+ const [{ value: t }] = Xe(i.options.clonedFieldIdentifier), n = w(() => {
743
+ const r = i.options.getFieldToClone(t);
744
+ return r ? Re(r) : null;
744
745
  }, [i.options, t]);
745
- return Pe(n, e);
746
+ return De(n, e);
746
747
  });
747
- class Le extends M {
748
+ class Ve extends M {
748
749
  constructor(e, t) {
749
750
  super({ ...e, type: "custom" });
750
751
  m(this, "Component");
@@ -757,49 +758,49 @@ class Le extends M {
757
758
  }
758
759
  getInput(e) {
759
760
  const t = this.Component;
760
- return /* @__PURE__ */ r(t, { field: this, ...e });
761
+ return /* @__PURE__ */ o(t, { field: this, ...e });
761
762
  }
762
763
  }
763
- m(Le, "fieldTypeName", "Custom"), m(Le, "fieldTypeDescription", "Allows re-rendering of field already in the form");
764
- class ji extends Le {
764
+ m(Ve, "fieldTypeName", "Custom"), m(Ve, "fieldTypeDescription", "Allows re-rendering of field already in the form");
765
+ class Gi extends Ve {
765
766
  constructor(i) {
766
- super(i, Wi);
767
+ super(i, Ui);
767
768
  }
768
769
  }
769
- const Hi = S(function(i) {
770
- const { field: e, ...t } = i, { label: n, description: o, fields: l, condition: c } = e, { values: a, setFieldValue: f } = me(), d = c != null && c.identifier ? de(a, c.identifier) : void 0, u = v(() => Vt(c, d), [c, d]);
770
+ const Ki = F(function(i) {
771
+ const { field: e, ...t } = i, { label: n, description: r, fields: a, condition: c } = e, { values: l, setFieldValue: f } = he(), d = c != null && c.identifier ? ue(l, c.identifier) : void 0, u = w(() => _t(c, d), [c, d]);
771
772
  we(() => {
772
773
  if (!u)
773
- for (const p of l)
774
- f(p.getId(), "").then();
775
- }, [u, l, f]);
776
- const h = kt(l, t);
777
- return u ? n ? /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
778
- /* @__PURE__ */ b(y, { direction: "column", children: [
779
- /* @__PURE__ */ r(De, { as: "h3", size: "3", children: n }),
780
- /* @__PURE__ */ r(D, { className: _e.description, children: o })
774
+ for (const h of a)
775
+ f(h.getId(), "").then();
776
+ }, [u, a, f]);
777
+ const p = $t(a, t);
778
+ return u ? n ? /* @__PURE__ */ o(xe, { children: /* @__PURE__ */ g(y, { direction: "column", gap: "3", children: [
779
+ /* @__PURE__ */ g(y, { direction: "column", children: [
780
+ /* @__PURE__ */ o(Me, { as: "h3", size: "3", children: n }),
781
+ /* @__PURE__ */ o(V, { className: Ie.description, children: r })
781
782
  ] }),
782
- h
783
- ] }) }) : h : null;
784
- }), oe = class oe extends Ct {
783
+ p
784
+ ] }) }) : p : null;
785
+ }), se = class se extends zt {
785
786
  constructor(e) {
786
- const { label: t = null, fields: n, condition: o = null, conditional: l, ...c } = e;
787
+ const { label: t = null, fields: n, condition: r = null, conditional: a, ...c } = e;
787
788
  super({ ...c, type: "section" });
788
789
  m(this, "label");
789
790
  m(this, "fields");
790
791
  m(this, "condition");
791
- this.fields = n, this.condition = o, this.label = t, l === !1 && (this.condition = null);
792
+ this.fields = n, this.condition = r, this.label = t, a === !1 && (this.condition = null);
792
793
  }
793
794
  static getFieldCreationSchema(e) {
794
795
  return e.length === 0 ? [] : [
795
- new ue({
796
+ new fe({
796
797
  label: "Conditional",
797
798
  description: "Conditionally show or hide this section.",
798
799
  identifier: "conditional",
799
800
  required: !1
800
801
  }),
801
802
  // Declare a section that will hold options for the condition (if any).
802
- new oe({
803
+ new se({
803
804
  label: "Conditional settings",
804
805
  identifier: "conditional-settings",
805
806
  // This section will only be rendered if the above "Conditional" field is checked.
@@ -811,7 +812,7 @@ const Hi = S(function(i) {
811
812
  fields: [
812
813
  // Declare a select field that will be used to select the field against which we will check the
813
814
  // condition. This must be selected before the next field is rendered.
814
- new Ee({
815
+ new Pe({
815
816
  label: "Field",
816
817
  description: "The field to use for the condition.",
817
818
  // The options (for the field against which we will check the condition) are all the labels of
@@ -828,7 +829,7 @@ const Hi = S(function(i) {
828
829
  // Declare a custom field that will be used to input a value for the condition. The value of the
829
830
  // conditional field selected in the previous step must be equal to the value the user inputs into
830
831
  // this field for the section to be rendered.
831
- new ji({
832
+ new Gi({
832
833
  label: "Value",
833
834
  identifier: "condition.value",
834
835
  required: !0,
@@ -836,7 +837,7 @@ const Hi = S(function(i) {
836
837
  getFieldToClone(t) {
837
838
  if (!t)
838
839
  return null;
839
- const n = e.find((o) => o.identifier === t);
840
+ const n = e.find((r) => r.identifier === t);
840
841
  return n ? {
841
842
  ...n,
842
843
  // Override some options to make it make sense in the context and to make it work with the framework.
@@ -855,8 +856,8 @@ const Hi = S(function(i) {
855
856
  var n;
856
857
  if (e.type !== "section")
857
858
  throw new Error("Invalid type");
858
- const t = ((n = e.fields) == null ? void 0 : n.map(Lt)) ?? [];
859
- return new oe({ ...e, fields: t });
859
+ const t = ((n = e.fields) == null ? void 0 : n.map(Vt)) ?? [];
860
+ return new se({ ...e, fields: t });
860
861
  }
861
862
  conditional() {
862
863
  return this.condition !== null;
@@ -873,53 +874,53 @@ const Hi = S(function(i) {
873
874
  getErrors(e) {
874
875
  const t = {};
875
876
  for (const n of this.fields) {
876
- const o = n.getId(), l = n.getError(de(e, o), e);
877
- l && tt(t, n.getId(), l);
877
+ const r = n.getId(), a = n.getError(ue(e, r), e);
878
+ a && nt(t, n.getId(), a);
878
879
  }
879
880
  return t;
880
881
  }
881
882
  getInput(e) {
882
- return /* @__PURE__ */ r(Hi, { field: this, ...e });
883
+ return /* @__PURE__ */ o(Ki, { field: this, ...e });
883
884
  }
884
885
  };
885
- m(oe, "fieldTypeName", "Section"), m(oe, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
886
- let Q = oe;
887
- const Ui = "_previewImage_1ig84_1", Gi = {
888
- previewImage: Ui
889
- }, it = (s) => {
886
+ m(se, "fieldTypeName", "Section"), m(se, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
887
+ let X = se;
888
+ const Yi = "_previewImage_1ig84_1", Qi = {
889
+ previewImage: Yi
890
+ }, rt = (s) => {
890
891
  const i = ["byte", "kilobyte", "megabyte"];
891
892
  let e = s, t = 0;
892
893
  for (; e > 1024 && t < i.length - 1; )
893
894
  e /= 1024, t++;
894
895
  return new Intl.NumberFormat([], { maximumFractionDigits: 2, style: "unit", unit: i[t] }).format(e);
895
- }, Ki = S(function(i) {
896
+ }, Xi = F(function(i) {
896
897
  var P;
897
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d } = c, u = fe(n), h = yi(null), { value: p } = c, g = v(() => o || (a.maxFileSize ? `Maximum file size: ${it(a.maxFileSize)}` : null), [a.maxFileSize, o]), x = T(() => {
898
+ const [{ inputId: e, labelId: t, severity: n, helpText: r, label: a, fieldProps: c, field: l }, f] = H(i), { onChange: d } = c, u = me(n), p = wt(null), { value: h } = c, b = w(() => r || (l.maxFileSize ? `Maximum file size: ${rt(l.maxFileSize)}` : null), [l.maxFileSize, r]), v = T(() => {
898
899
  var I;
899
- (I = h.current) == null || I.click();
900
+ (I = p.current) == null || I.click();
900
901
  }, []), z = T(
901
902
  (I) => {
902
- const V = [...p];
903
- V.splice(I, 1), d({ target: { files: V } });
903
+ const k = [...h];
904
+ k.splice(I, 1), d({ target: { files: k } });
904
905
  },
905
- [p, d]
906
- ), F = p ? "Select new files" : "Select files", w = p ? "Select new file" : "Select a file", L = a.maxFiles > 1 ? F : w;
907
- return /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
908
- /* @__PURE__ */ r(j, { helpText: g, severity: n, children: /* @__PURE__ */ b(W, { severity: n, inputId: e, labelId: t, label: l, children: [
909
- /* @__PURE__ */ r(y, { direction: "row", gap: "2", children: /* @__PURE__ */ r(he, { width: "max-content", asChild: !0, children: /* @__PURE__ */ b(G, { ...f, onClick: x, children: [
910
- /* @__PURE__ */ r(bt, {}),
906
+ [h, d]
907
+ ), C = h ? "Select new files" : "Select files", x = h ? "Select new file" : "Select a file", L = l.maxFiles > 1 ? C : x;
908
+ return /* @__PURE__ */ g(y, { direction: "column", gap: "2", children: [
909
+ /* @__PURE__ */ o(j, { helpText: b, severity: n, children: /* @__PURE__ */ g(W, { severity: n, inputId: e, labelId: t, label: a, children: [
910
+ /* @__PURE__ */ o(y, { direction: "row", gap: "2", children: /* @__PURE__ */ o(ge, { width: "max-content", asChild: !0, children: /* @__PURE__ */ g(G, { ...f, onClick: v, children: [
911
+ /* @__PURE__ */ o(xt, {}),
911
912
  " ",
912
913
  L
913
914
  ] }) }) }),
914
- /* @__PURE__ */ r(
915
+ /* @__PURE__ */ o(
915
916
  "input",
916
917
  {
917
918
  ...f,
918
919
  type: "file",
919
- ref: h,
920
+ ref: p,
920
921
  id: e,
921
- accept: (P = a.extensions) == null ? void 0 : P.join(","),
922
- multiple: a.maxFiles > 1,
922
+ accept: (P = l.extensions) == null ? void 0 : P.join(","),
923
+ multiple: l.maxFiles > 1,
923
924
  color: u,
924
925
  style: { display: "none" },
925
926
  ...c,
@@ -927,54 +928,54 @@ const Ui = "_previewImage_1ig84_1", Gi = {
927
928
  }
928
929
  )
929
930
  ] }) }),
930
- Array.isArray(p) && p.length > 0 && /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: p.map((I, V) => /* @__PURE__ */ r(
931
- Yi,
931
+ Array.isArray(h) && h.length > 0 && /* @__PURE__ */ o(y, { direction: "column", gap: "2", children: h.map((I, k) => /* @__PURE__ */ o(
932
+ Ji,
932
933
  {
933
- field: a,
934
+ field: l,
934
935
  file: I,
935
- onRemove: () => z(V),
936
+ onRemove: () => z(k),
936
937
  disabled: f.disabled
937
938
  },
938
- V
939
+ k
939
940
  )) })
940
941
  ] });
941
- }), Yi = S(function({ file: i, field: e, onRemove: t, disabled: n }) {
942
- const [o, l] = ce(null), c = v(() => o && e.getError([o]), [e, o]), { url: a, name: f, size: d } = v(() => {
943
- let u = null, h, p;
944
- return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (h = o.name, p = it(o.size)) : (h = "Downloading...", p = "..."), { url: u, name: h, size: p };
945
- }, [o]);
942
+ }), Ji = F(function({ file: i, field: e, onRemove: t, disabled: n }) {
943
+ const [r, a] = de(null), c = w(() => r && e.getError([r]), [e, r]), { url: l, name: f, size: d } = w(() => {
944
+ let u = null, p, h;
945
+ return r != null && r.type.startsWith("image/") && (u = URL.createObjectURL(r)), r ? (p = r.name, h = rt(r.size)) : (p = "Downloading...", h = "..."), { url: u, name: p, size: h };
946
+ }, [r]);
946
947
  return we(() => {
947
- i instanceof Promise ? i.then(l) : l(i);
948
- }, [i]), /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
949
- /* @__PURE__ */ b(y, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
950
- /* @__PURE__ */ r(
951
- ae,
948
+ i instanceof Promise ? i.then(a) : a(i);
949
+ }, [i]), /* @__PURE__ */ o(xe, { children: /* @__PURE__ */ g(y, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
950
+ /* @__PURE__ */ g(y, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
951
+ /* @__PURE__ */ o(
952
+ ce,
952
953
  {
953
954
  severity: "info",
954
955
  variant: "outline",
955
956
  "aria-label": `Remove ${f}`,
956
957
  disabled: n,
957
958
  onClick: t,
958
- children: /* @__PURE__ */ r(gt, {})
959
+ children: /* @__PURE__ */ o(yt, {})
959
960
  }
960
961
  ),
961
- /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
962
- /* @__PURE__ */ r(D, { children: f }),
963
- /* @__PURE__ */ r(D, { size: "1", children: d }),
964
- c && /* @__PURE__ */ r(D, { size: "1", severity: "danger", children: c })
962
+ /* @__PURE__ */ g(y, { direction: "column", gap: "1", children: [
963
+ /* @__PURE__ */ o(V, { children: f }),
964
+ /* @__PURE__ */ o(V, { size: "1", children: d }),
965
+ c && /* @__PURE__ */ o(V, { size: "1", severity: "danger", children: c })
965
966
  ] })
966
967
  ] }),
967
- a && /* @__PURE__ */ r("img", { className: Gi.previewImage, src: a, alt: f })
968
+ l && /* @__PURE__ */ o("img", { className: Qi.previewImage, src: l, alt: f })
968
969
  ] }) });
969
- }), at = 50 * 1024 * 1024, se = class se extends M {
970
+ }), dt = 50 * 1024 * 1024, le = class le extends M {
970
971
  constructor(e) {
971
- const { extensions: t, maximum_files: n, maximum_size: o, ...l } = e;
972
- super({ ...l, type: "upload" });
972
+ const { extensions: t, maximum_files: n, maximum_size: r, ...a } = e;
973
+ super({ ...a, type: "upload" });
973
974
  m(this, "extensions");
974
975
  m(this, "maxFileSize");
975
976
  m(this, "maxFiles");
976
977
  m(this, "onlyValidateAfterTouched", !1);
977
- this.maxFileSize = typeof o == "number" ? o : void 0, this.maxFiles = Math.max(typeof n == "number" ? n : 1, 1), this.extensions = t;
978
+ this.maxFileSize = typeof r == "number" ? r : void 0, this.maxFiles = Math.max(typeof n == "number" ? n : 1, 1), this.extensions = t;
978
979
  }
979
980
  getValueFromChangeEvent(e) {
980
981
  return Array.from(e.target.files || []);
@@ -984,7 +985,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
984
985
  }
985
986
  static getFieldCreationSchema() {
986
987
  return [
987
- new Y({
988
+ new Q({
988
989
  label: "How many files can be uploaded?",
989
990
  description: "By default, only one file can be uploaded.",
990
991
  required: !1,
@@ -992,16 +993,16 @@ const Ui = "_previewImage_1ig84_1", Gi = {
992
993
  maximum: 10,
993
994
  identifier: "maximum_files"
994
995
  }),
995
- new Y({
996
+ new Q({
996
997
  label: "What is the maximum size of each file?",
997
998
  description: "Maximum file size in bytes.",
998
999
  required: !1,
999
1000
  identifier: "maximum_size",
1000
1001
  minimum: 1,
1001
- maximum: at,
1002
+ maximum: dt,
1002
1003
  integers: !0
1003
1004
  }),
1004
- new Ae({
1005
+ new ke({
1005
1006
  label: "Accepted file types",
1006
1007
  description: "Types of allowed files to upload. If left blank, all files will be accepted.",
1007
1008
  required: !1,
@@ -1032,12 +1033,12 @@ const Ui = "_previewImage_1ig84_1", Gi = {
1032
1033
  ];
1033
1034
  }
1034
1035
  getFieldValidators() {
1035
- const e = super.getFieldValidators(), t = this.maxFileSize ?? at, n = this.maxFiles ?? 1;
1036
- return e.push((o) => {
1037
- if (o && o.some((l) => l.size > t))
1038
- return `Files must be at most ${it(t)}.`;
1039
- }), e.push((o) => {
1040
- if (o && o.length > n)
1036
+ const e = super.getFieldValidators(), t = this.maxFileSize ?? dt, n = this.maxFiles ?? 1;
1037
+ return e.push((r) => {
1038
+ if (r && r.some((a) => a.size > t))
1039
+ return `Files must be at most ${rt(t)}.`;
1040
+ }), e.push((r) => {
1041
+ if (r && r.length > n)
1041
1042
  return `You can only upload ${n} files.`;
1042
1043
  }), e;
1043
1044
  }
@@ -1052,46 +1053,46 @@ const Ui = "_previewImage_1ig84_1", Gi = {
1052
1053
  static deserialize(e) {
1053
1054
  if (e.type !== "upload")
1054
1055
  throw new Error("Type mismatch.");
1055
- return new se(e);
1056
+ return new le(e);
1056
1057
  }
1057
1058
  getInput(e) {
1058
- return /* @__PURE__ */ r(Ki, { field: this, ...e });
1059
+ return /* @__PURE__ */ o(Xi, { field: this, ...e });
1059
1060
  }
1060
1061
  };
1061
- m(se, "fieldTypeName", "Upload"), m(se, "fieldTypeDescription", "Allows a file to be uploaded."), m(se, "Icon", bt);
1062
- let Ue = se;
1063
- const nt = {
1064
- date: We,
1065
- number: Y,
1066
- boolean: ue,
1067
- select: Ee,
1068
- string: ge,
1069
- text: be,
1070
- custom: Le,
1071
- upload: Ue,
1062
+ m(le, "fieldTypeName", "Upload"), m(le, "fieldTypeDescription", "Allows a file to be uploaded."), m(le, "Icon", xt);
1063
+ let Ke = le;
1064
+ const ot = {
1065
+ date: He,
1066
+ number: Q,
1067
+ boolean: fe,
1068
+ select: Pe,
1069
+ string: be,
1070
+ text: ye,
1071
+ custom: Ve,
1072
+ upload: Ke,
1072
1073
  // TODO: Underscore
1073
- "multi-string": ze,
1074
- "multi-select": Ae
1075
- }, Lt = (s) => {
1074
+ "multi-string": Le,
1075
+ "multi-select": ke
1076
+ }, Vt = (s) => {
1076
1077
  const i = s.type;
1077
- return nt[i].deserialize(s);
1078
- }, Me = (s) => s.type === "section" ? Q.deserialize(s) : Lt(s);
1079
- function Pt(s, i = {}) {
1078
+ return ot[i].deserialize(s);
1079
+ }, Re = (s) => s.type === "section" ? X.deserialize(s) : Vt(s);
1080
+ function Dt(s, i = {}) {
1080
1081
  const { readonly: e = !1 } = i;
1081
1082
  return {
1082
1083
  title: s.title,
1083
1084
  description: s.description,
1084
- fields: s.fields.map((t) => Me(t)),
1085
+ fields: s.fields.map((t) => Re(t)),
1085
1086
  meta: { readonly: e }
1086
1087
  };
1087
1088
  }
1088
- function Ge(s) {
1089
+ function Ye(s) {
1089
1090
  return !!(Array.isArray(s) && s.some((i) => i instanceof File || i instanceof Promise));
1090
1091
  }
1091
- function Vt(s, i) {
1092
+ function _t(s, i) {
1092
1093
  if (!s)
1093
1094
  return !0;
1094
- if (Ge(i) || Ge(s.value))
1095
+ if (Ye(i) || Ye(s.value))
1095
1096
  throw new Error("Conditions do not support file uploads");
1096
1097
  const e = Array.isArray(i) ? i.map((n) => typeof n == "string" ? n : n.value) : i, t = Array.isArray(s.value) ? s.value.map((n) => typeof n == "string" ? n : n.value) : s.value;
1097
1098
  if (Array.isArray(t) && Array.isArray(e)) {
@@ -1102,335 +1103,335 @@ function Vt(s, i) {
1102
1103
  }
1103
1104
  return t === i;
1104
1105
  }
1105
- const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s, i) => {
1106
- const e = v(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
1107
- return /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: e });
1108
- }, Ve = (s) => Object.keys(s).length > 0, Dt = async (s, i) => {
1106
+ const De = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), $t = (s, i) => {
1107
+ const e = w(() => s.map((t) => /* @__PURE__ */ o("div", { children: t.getInput(i) }, t.getId())), [s, i]);
1108
+ return /* @__PURE__ */ o(y, { direction: "column", gap: "2", children: e });
1109
+ }, _e = (s) => Object.keys(s).length > 0, Mt = async (s, i) => {
1109
1110
  const e = {};
1110
1111
  for (const t of s.fields)
1111
- if (t instanceof Q) {
1112
+ if (t instanceof X) {
1112
1113
  if (t.condition) {
1113
1114
  const { identifier: n } = t.condition;
1114
- if (!Vt(t.condition, de(i, n)))
1115
+ if (!_t(t.condition, ue(i, n)))
1115
1116
  continue;
1116
1117
  }
1117
1118
  Object.assign(e, t.getErrors(i));
1118
1119
  } else {
1119
1120
  if (!(t instanceof M))
1120
1121
  throw new Error("Invalid field type");
1121
- const n = t.getId(), o = t.getError(de(i, n), i);
1122
- o && tt(e, n, o);
1122
+ const n = t.getId(), r = t.getError(ue(i, n), i);
1123
+ r && nt(e, n, r);
1123
1124
  }
1124
- if (Ve(e))
1125
+ if (_e(e))
1125
1126
  return e;
1126
- }, Qi = [null, void 0], rt = (s, i) => s.reduce((e, t) => t instanceof Q ? { ...e, ...rt(t.fields, i) } : (Qi.includes(de(e, t.getId())) && tt(e, t.getId(), ""), e), i), Xi = () => {
1127
+ }, Zi = [null, void 0], st = (s, i) => s.reduce((e, t) => t instanceof X ? { ...e, ...st(t.fields, i) } : (Zi.includes(ue(e, t.getId())) && nt(e, t.getId(), ""), e), i), en = () => {
1127
1128
  throw new Error("onSubmit must be provided if form is not readonly.");
1128
- }, ot = S(
1129
+ }, lt = F(
1129
1130
  ve((s, i) => {
1130
1131
  const {
1131
1132
  schema: e,
1132
1133
  values: t = {},
1133
- onSubmit: n = Xi,
1134
- submitText: o = "Submit",
1135
- cancelText: l,
1134
+ onSubmit: n = en,
1135
+ submitText: r = "Submit",
1136
+ cancelText: a,
1136
1137
  onCancel: c,
1137
- onDirty: a,
1138
+ onDirty: l,
1138
1139
  // if the title isn't provided, hide it by default
1139
1140
  hideTitle: f = !e.title,
1140
1141
  hideDescription: d,
1141
1142
  className: u
1142
- } = s, { readonly: h } = e.meta, p = v(() => crypto.randomUUID(), []), g = Qe({
1143
- initialValues: rt(e.fields, t),
1143
+ } = s, { readonly: p } = e.meta, h = w(() => crypto.randomUUID(), []), b = Je({
1144
+ initialValues: st(e.fields, t),
1144
1145
  onSubmit: n,
1145
- validate: (L) => Dt(e, L),
1146
+ validate: (L) => Mt(e, L),
1146
1147
  // only validate the entire form on submit
1147
1148
  validateOnBlur: !1,
1148
1149
  validateOnChange: !1
1149
- }), { dirty: x } = g, z = v(
1150
- () => typeof e.title == "string" ? /* @__PURE__ */ r(De, { children: e.title }) : e.title,
1150
+ }), { dirty: v } = b, z = w(
1151
+ () => typeof e.title == "string" ? /* @__PURE__ */ o(Me, { children: e.title }) : e.title,
1151
1152
  [e.title]
1152
- ), F = v(
1153
- () => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: _e.description, children: e.description }) : e.description,
1153
+ ), C = w(
1154
+ () => typeof e.description == "string" ? /* @__PURE__ */ o(V, { className: Ie.description, children: e.description }) : e.description,
1154
1155
  [e.description]
1155
- ), w = kt(e.fields, { formId: p, disabled: h });
1156
+ ), x = $t(e.fields, { formId: h, disabled: p });
1156
1157
  return we(() => {
1157
- x && a && a();
1158
- }, [x, a]), /* @__PURE__ */ r(Xe, { value: g, children: /* @__PURE__ */ r(y, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ b("form", { id: p, onSubmit: g.handleSubmit, children: [
1159
- !f && /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
1158
+ v && l && l();
1159
+ }, [v, l]), /* @__PURE__ */ o(Ze, { value: b, children: /* @__PURE__ */ o(y, { ref: i, direction: "column", gap: "2", className: u, asChild: !0, children: /* @__PURE__ */ g("form", { id: h, onSubmit: b.handleSubmit, children: [
1160
+ !f && /* @__PURE__ */ o(xe, { children: /* @__PURE__ */ g(y, { direction: "column", gap: "1", children: [
1160
1161
  z,
1161
- !d && F
1162
+ !d && C
1162
1163
  ] }) }),
1163
- w,
1164
- !h && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
1165
- l && /* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: c, children: l }),
1166
- /* @__PURE__ */ r(G, { type: "submit", disabled: !g.isValid, children: o })
1164
+ x,
1165
+ !p && /* @__PURE__ */ g(y, { justify: "end", gap: "2", children: [
1166
+ a && /* @__PURE__ */ o(G, { type: "button", variant: "soft", onClick: c, children: a }),
1167
+ /* @__PURE__ */ o(G, { type: "submit", disabled: !b.isValid, children: r })
1167
1168
  ] })
1168
1169
  ] }) }) });
1169
1170
  })
1170
- ), Pn = S(
1171
+ ), _n = F(
1171
1172
  ve((s, i) => {
1172
- const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = _(wt(e.form_revision)), { sdk: l } = vt();
1173
- if (!o)
1173
+ const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, r = $(It(e.form_revision)), { sdk: a } = Ct();
1174
+ if (!r)
1174
1175
  throw new Error(
1175
1176
  `Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
1176
1177
  );
1177
- const c = v(() => Pt(o, { readonly: !0 }), [o]), a = v(() => {
1178
- const f = xi(e.offline_id)(l.store.getState()) ?? [], d = {};
1178
+ const c = w(() => Dt(r, { readonly: !0 }), [r]), l = w(() => {
1179
+ const f = Ci(e.offline_id)(a.store.getState()) ?? [], d = {};
1179
1180
  for (const u of f) {
1180
- const h = l.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
1181
- if (!g.success)
1181
+ const p = a.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((b) => {
1182
+ if (!b.success)
1182
1183
  throw new Error(`Failed to download attachment ${u.file_name}.`);
1183
- return g.body;
1184
- }), p = d[u.field_identifier];
1185
- p ? p.push(h) : d[u.field_identifier] = [h];
1184
+ return b.body;
1185
+ }), h = d[u.field_identifier];
1186
+ h ? h.push(p) : d[u.field_identifier] = [p];
1186
1187
  }
1187
1188
  return { ...e.values, ...d };
1188
- }, [l.files, l.store, e.offline_id, e.values]);
1189
- return /* @__PURE__ */ r(
1190
- ot,
1189
+ }, [a.files, a.store, e.offline_id, e.values]);
1190
+ return /* @__PURE__ */ o(
1191
+ lt,
1191
1192
  {
1192
1193
  ref: i,
1193
1194
  schema: c,
1194
- values: a,
1195
+ values: l,
1195
1196
  hideDescription: !t,
1196
1197
  hideTitle: !n
1197
1198
  }
1198
1199
  );
1199
1200
  })
1200
- ), Ji = "_favoriteIcon_1bixi_1", Zi = "_regularIcon_1bixi_9", ct = {
1201
- favoriteIcon: Ji,
1202
- regularIcon: Zi
1203
- }, Ne = "organization:", Be = "user:", Vn = S(
1201
+ ), tn = "_favoriteIcon_1bixi_1", nn = "_regularIcon_1bixi_9", ut = {
1202
+ favoriteIcon: tn,
1203
+ regularIcon: nn
1204
+ }, qe = "organization:", We = "user:", $n = F(
1204
1205
  ve((s, i) => {
1205
- const { maxResults: e = 20, ...t } = s, [n, o] = ce(""), [l, c] = ce(""), { sdk: a } = vt(), f = v(() => {
1206
- const w = { maxResults: e, searchTerm: n };
1207
- return l && (l.startsWith(Ne) ? w.owner_organization = parseInt(l.slice(Ne.length)) : l.startsWith(Be) && (w.owner_user = parseInt(l.slice(Be.length)))), w;
1208
- }, [n, e, l]), d = _(Ii(f)) ?? [], u = _(Fi), h = T(
1209
- (w) => {
1210
- w.favorite ? a.userForms.unfavorite(w.offline_id).then() : a.userForms.favorite(w.offline_id).then();
1206
+ const { maxResults: e = 20, ...t } = s, [n, r] = de(""), [a, c] = de(""), { sdk: l } = Ct(), f = w(() => {
1207
+ const x = { maxResults: e, searchTerm: n };
1208
+ return a && (a.startsWith(qe) ? x.owner_organization = parseInt(a.slice(qe.length)) : a.startsWith(We) && (x.owner_user = parseInt(a.slice(We.length)))), x;
1209
+ }, [n, e, a]), d = $(Fi(f)) ?? [], u = $(Ti), p = T(
1210
+ (x) => {
1211
+ x.favorite ? l.userForms.unfavorite(x.offline_id).then() : l.userForms.favorite(x.offline_id).then();
1211
1212
  },
1212
- [a]
1213
- ), p = v(() => {
1214
- const w = a.store.getState(), L = {};
1213
+ [l]
1214
+ ), h = w(() => {
1215
+ const x = l.store.getState(), L = {};
1215
1216
  for (const P of Object.values(u)) {
1216
- const I = xt(P.owner_organization || -1)(w);
1217
- I && (L[`${Ne}${I.id}`] = I.name);
1218
- const V = et(P.owner_user || -1)(w);
1219
- V && (L[`${Be}${V.id}`] = V.username);
1217
+ const I = Ft(P.owner_organization || -1)(x);
1218
+ I && (L[`${qe}${I.id}`] = I.name);
1219
+ const k = it(P.owner_user || -1)(x);
1220
+ k && (L[`${We}${k.id}`] = k.username);
1220
1221
  }
1221
1222
  return Object.entries(L).map(([P, I]) => ({ itemContent: I, value: P }));
1222
- }, [u, a.store]), g = T((w) => {
1223
- o(w.currentTarget.value);
1224
- }, []), z = (_(Ci) || 0) - d.length, F = d.length == e && z > 0 ? `Only the first ${e} results are shown (${z} hidden)` : z > 0 && `${z} hidden forms`;
1225
- return /* @__PURE__ */ b(y, { ref: i, direction: "column", gap: "2", children: [
1226
- /* @__PURE__ */ b(y, { gap: "2", grow: "1", children: [
1227
- /* @__PURE__ */ r(he, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(le.Root, { size: "3", children: /* @__PURE__ */ r(le.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
1228
- /* @__PURE__ */ r(
1229
- ht,
1223
+ }, [u, l.store]), b = T((x) => {
1224
+ r(x.currentTarget.value);
1225
+ }, []), z = ($(Si) || 0) - d.length, C = d.length == e && z > 0 ? `Only the first ${e} results are shown (${z} hidden)` : z > 0 && `${z} hidden forms`;
1226
+ return /* @__PURE__ */ g(y, { ref: i, direction: "column", gap: "2", children: [
1227
+ /* @__PURE__ */ g(y, { gap: "2", grow: "1", children: [
1228
+ /* @__PURE__ */ o(ge, { grow: "1", asChild: !0, children: /* @__PURE__ */ o(ae.Root, { size: "3", children: /* @__PURE__ */ o(ae.Input, { placeholder: "Filter", value: n, onChange: b }) }) }),
1229
+ /* @__PURE__ */ o(
1230
+ bt,
1230
1231
  {
1231
- items: p,
1232
- value: l,
1232
+ items: h,
1233
+ value: a,
1233
1234
  onValueChange: c,
1234
1235
  placeholder: "Owner",
1235
1236
  size: "large"
1236
1237
  }
1237
1238
  )
1238
1239
  ] }),
1239
- d.length > 0 && /* @__PURE__ */ r($e.Root, { children: d.map((w) => /* @__PURE__ */ r(
1240
- en,
1240
+ d.length > 0 && /* @__PURE__ */ o(Oe.Root, { children: d.map((x) => /* @__PURE__ */ o(
1241
+ rn,
1241
1242
  {
1242
1243
  ...t,
1243
- form: w,
1244
- handleToggleFavorite: () => h(w)
1244
+ form: x,
1245
+ handleToggleFavorite: () => p(x)
1245
1246
  },
1246
- w.offline_id
1247
+ x.offline_id
1247
1248
  )) }),
1248
- /* @__PURE__ */ r(he, { px: "3", children: /* @__PURE__ */ r(D, { size: "2", severity: "info", children: F }) })
1249
+ /* @__PURE__ */ o(ge, { px: "3", children: /* @__PURE__ */ o(V, { size: "2", severity: "info", children: C }) })
1249
1250
  ] });
1250
1251
  })
1251
- ), en = (s) => {
1252
- var h;
1253
- const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (h = _(xt(i.owner_organization || -1))) == null ? void 0 : h.name, l = _(et(i.owner_user || -1)), c = _(It).id, a = !!l && l.id === c, f = o ?? (a ? "You" : l == null ? void 0 : l.username) ?? "Unknown", d = T(
1254
- (p) => {
1255
- p.stopPropagation(), n();
1252
+ ), rn = (s) => {
1253
+ var p;
1254
+ const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, r = (p = $(Ft(i.owner_organization || -1))) == null ? void 0 : p.name, a = $(it(i.owner_user || -1)), c = $(Tt).id, l = !!a && a.id === c, f = r ?? (l ? "You" : a == null ? void 0 : a.username) ?? "Unknown", d = T(
1255
+ (h) => {
1256
+ h.stopPropagation(), n();
1256
1257
  },
1257
1258
  [n]
1258
- ), u = /* @__PURE__ */ r($e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...Zt, children: [
1259
- /* @__PURE__ */ b(y, { grow: "1", align: "center", gap: "2", children: [
1260
- /* @__PURE__ */ r(
1261
- ae,
1259
+ ), u = /* @__PURE__ */ o(Oe.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ g(y, { justify: "between", gap: "2", py: "2", px: "3", ...ii, children: [
1260
+ /* @__PURE__ */ g(y, { grow: "1", align: "center", gap: "2", children: [
1261
+ /* @__PURE__ */ o(
1262
+ ce,
1262
1263
  {
1263
- className: Ft(i.favorite ? ct.favoriteIcon : ct.regularIcon),
1264
+ className: St(i.favorite ? ut.favoriteIcon : ut.regularIcon),
1264
1265
  variant: "ghost",
1265
1266
  onClick: d,
1266
1267
  "aria-label": i.favorite ? "Favorite form" : "Standard form",
1267
1268
  disabled: !t,
1268
- children: i.favorite ? /* @__PURE__ */ r(ei, {}) : /* @__PURE__ */ r(ti, {})
1269
+ children: i.favorite ? /* @__PURE__ */ o(ni, {}) : /* @__PURE__ */ o(ri, {})
1269
1270
  }
1270
1271
  ),
1271
- /* @__PURE__ */ r(D, { noWrap: !0, children: i.latestRevision.title }),
1272
- i.latestRevision.description && /* @__PURE__ */ r(ii, {})
1272
+ /* @__PURE__ */ o(V, { noWrap: !0, children: i.latestRevision.title }),
1273
+ i.latestRevision.description && /* @__PURE__ */ o(oi, {})
1273
1274
  ] }),
1274
- f && /* @__PURE__ */ b(y, { align: "center", gap: "2", children: [
1275
- /* @__PURE__ */ r(ni, {}),
1275
+ f && /* @__PURE__ */ g(y, { align: "center", gap: "2", children: [
1276
+ /* @__PURE__ */ o(si, {}),
1276
1277
  " ",
1277
1278
  f
1278
1279
  ] })
1279
1280
  ] }) });
1280
- return i.latestRevision.description ? /* @__PURE__ */ r(ri, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1281
- }, tn = "_submissionsContainer_9iirt_1", nn = "_stopHorizontalOverflow_9iirt_6", $t = {
1282
- submissionsContainer: tn,
1283
- stopHorizontalOverflow: nn
1284
- }, rn = S(function(i) {
1285
- var w;
1286
- const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: l } = i, c = _(It), a = _(et("created_by" in e ? e.created_by : c.id)), f = Ke(e), d = Ti(f) ? f.toLocaleTimeString([], {
1281
+ return i.latestRevision.description ? /* @__PURE__ */ o(li, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1282
+ }, on = "_submissionsContainer_9iirt_1", sn = "_stopHorizontalOverflow_9iirt_6", Ot = {
1283
+ submissionsContainer: on,
1284
+ stopHorizontalOverflow: sn
1285
+ }, ln = F(function(i) {
1286
+ var x;
1287
+ const { submission: e, onSubmissionClick: t, compact: n, labelType: r, rowDecorator: a } = i, c = $(Tt), l = $(it("created_by" in e ? e.created_by : c.id)), f = Qe(e), d = zi(f) ? f.toLocaleTimeString([], {
1287
1288
  hour: "2-digit",
1288
1289
  minute: "2-digit"
1289
- }) : Si(f), u = _(wt(e.form_revision));
1290
+ }) : Ei(f), u = $(It(e.form_revision));
1290
1291
  if (!u)
1291
1292
  throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
1292
- const h = (w = _(zi(u.form))) == null ? void 0 : w.revision, p = Ei({
1293
- file: (a == null ? void 0 : a.profile.file) ?? null,
1294
- fileSha1: (a == null ? void 0 : a.profile.file_sha1) ?? null
1295
- }), g = (a == null ? void 0 : a.username.charAt(0).toUpperCase()) ?? "?", x = u.revision === h, z = bi.useCallback(() => {
1293
+ const p = (x = $(Ai(u.form))) == null ? void 0 : x.revision, h = Li({
1294
+ file: (l == null ? void 0 : l.profile.file) ?? null,
1295
+ fileSha1: (l == null ? void 0 : l.profile.file_sha1) ?? null
1296
+ }), b = (l == null ? void 0 : l.username.charAt(0).toUpperCase()) ?? "?", v = u.revision === p, z = wi.useCallback(() => {
1296
1297
  t && t({ submission: e });
1297
- }, [e, t]), F = /* @__PURE__ */ r($e.Item, { onClick: z, asChild: !0, children: /* @__PURE__ */ b(y, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1298
- /* @__PURE__ */ b(y, { gap: "2", align: "center", className: $t.stopHorizontalOverflow, children: [
1299
- /* @__PURE__ */ r(oi, { src: p, size: "1", fallback: g }),
1300
- /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: o === "creator" ? (a || c).username : u.title })
1298
+ }, [e, t]), C = /* @__PURE__ */ o(Oe.Item, { onClick: z, asChild: !0, children: /* @__PURE__ */ g(y, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
1299
+ /* @__PURE__ */ g(y, { gap: "2", align: "center", className: Ot.stopHorizontalOverflow, children: [
1300
+ /* @__PURE__ */ o(ai, { src: h, size: "1", fallback: b }),
1301
+ /* @__PURE__ */ o(V, { size: "2", noWrap: !0, children: r === "creator" ? (l || c).username : u.title })
1301
1302
  ] }),
1302
- /* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
1303
- !n && (u.revision ? /* @__PURE__ */ r(qe, { variant: "soft", severity: x ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!h && /* @__PURE__ */ r(qe, { children: "Original" })),
1304
- /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: d })
1303
+ /* @__PURE__ */ g(y, { gap: "2", align: "center", children: [
1304
+ !n && (u.revision ? /* @__PURE__ */ o(je, { variant: "soft", severity: v ? "primary" : "info", children: n ? u.revision.toString() : `Revision #${u.revision}` }) : !!p && /* @__PURE__ */ o(je, { children: "Original" })),
1305
+ /* @__PURE__ */ o(V, { size: "2", noWrap: !0, children: d })
1305
1306
  ] })
1306
1307
  ] }) });
1307
- return l ? l(e, F) : F;
1308
- }), Ke = (s) => {
1308
+ return a ? a(e, C) : C;
1309
+ }), Qe = (s) => {
1309
1310
  const i = "created_at" in s ? s.created_at : s.submitted_at;
1310
1311
  return new Date(i);
1311
- }, kn = S(function(i) {
1312
+ }, Mn = F(function(i) {
1312
1313
  const {
1313
1314
  formId: e,
1314
1315
  submissions: t,
1315
1316
  compact: n = !1,
1316
- className: o,
1317
- after: l,
1317
+ className: r,
1318
+ after: a,
1318
1319
  variant: c = "outline",
1319
- ...a
1320
+ ...l
1320
1321
  } = i;
1321
1322
  if (!!e == !!t)
1322
1323
  throw new Error("Either formId or submissions must be provided, but not both.");
1323
- const f = _(
1324
- t ? () => t : Ai(e)
1325
- ), d = v(
1326
- () => f == null ? void 0 : f.sort((u, h) => Ke(h).getTime() - Ke(u).getTime()),
1324
+ const f = $(
1325
+ t ? () => t : Pi(e)
1326
+ ), d = w(
1327
+ () => f == null ? void 0 : f.sort((u, p) => Qe(p).getTime() - Qe(u).getTime()),
1327
1328
  [f]
1328
1329
  );
1329
- return /* @__PURE__ */ r(
1330
- $e.Root,
1330
+ return /* @__PURE__ */ o(
1331
+ Oe.Root,
1331
1332
  {
1332
- className: Ft($t.submissionsContainer, o),
1333
+ className: St(Ot.submissionsContainer, r),
1333
1334
  size: "small",
1334
1335
  variant: c,
1335
- before: !n && /* @__PURE__ */ b(D, { severity: "info", children: [
1336
+ before: !n && /* @__PURE__ */ g(V, { severity: "info", children: [
1336
1337
  "There are ",
1337
1338
  ((f == null ? void 0 : f.length) || 0).toString(),
1338
1339
  " submissions of this form."
1339
1340
  ] }),
1340
- after: l,
1341
- children: d == null ? void 0 : d.map((u, h) => /* @__PURE__ */ r(
1342
- rn,
1341
+ after: a,
1342
+ children: d == null ? void 0 : d.map((u, p) => /* @__PURE__ */ o(
1343
+ ln,
1343
1344
  {
1344
1345
  submission: u,
1345
1346
  compact: n,
1346
- ...a
1347
+ ...l
1347
1348
  },
1348
- h
1349
+ p
1349
1350
  ))
1350
1351
  }
1351
1352
  );
1352
- }), Dn = S(function(i) {
1353
- const { name: e, render: t } = i, { submitForm: n } = me(), [o, l, c] = Ye(e);
1354
- return v(() => {
1355
- const a = (f) => c.setValue(f, !1);
1353
+ }), On = F(function(i) {
1354
+ const { name: e, render: t } = i, { submitForm: n } = he(), [r, a, c] = Xe(e);
1355
+ return w(() => {
1356
+ const l = (f) => c.setValue(f, !1);
1356
1357
  return t({
1357
- value: o.value,
1358
- setValue: a,
1358
+ value: r.value,
1359
+ setValue: l,
1359
1360
  patchValue: n
1360
1361
  });
1361
- }, [n, c, o.value, t]);
1362
- }), $n = S(
1362
+ }, [n, c, r.value, t]);
1363
+ }), Rn = F(
1363
1364
  ve((s, i) => {
1364
- const { children: e, schema: t, values: n, onPatch: o, onError: l, ...c } = s, a = v(() => rt(t.fields, n), [t.fields, n]), f = T(
1365
- (g) => {
1366
- const x = {};
1367
- for (const z in g) {
1368
- const F = g[z];
1369
- F !== a[z] && F !== void 0 && (x[z] = F);
1365
+ const { children: e, schema: t, values: n, onPatch: r, onError: a, ...c } = s, l = w(() => st(t.fields, n), [t.fields, n]), f = T(
1366
+ (b) => {
1367
+ const v = {};
1368
+ for (const z in b) {
1369
+ const C = b[z];
1370
+ C !== l[z] && C !== void 0 && (v[z] = C);
1370
1371
  }
1371
- Ve(x) && o(x);
1372
+ _e(v) && r(v);
1372
1373
  },
1373
- [a, o]
1374
+ [l, r]
1374
1375
  ), d = T(
1375
- async (g) => {
1376
- const x = await Dt(t, g);
1377
- return x && l(x), x;
1376
+ async (b) => {
1377
+ const v = await Mt(t, b);
1378
+ return v && a(v), v;
1378
1379
  },
1379
- [t, l]
1380
- ), u = Qe({
1381
- initialValues: a,
1380
+ [t, a]
1381
+ ), u = Je({
1382
+ initialValues: l,
1382
1383
  onSubmit: f,
1383
1384
  validate: d,
1384
1385
  // only validate the entire form on submit
1385
1386
  validateOnBlur: !1,
1386
1387
  validateOnChange: !1
1387
- }), { errors: h, resetForm: p } = u;
1388
+ }), { errors: p, resetForm: h } = u;
1388
1389
  return we(() => {
1389
- Ve(h) && p({ values: a, errors: {} });
1390
- }, [h, a, p]), /* @__PURE__ */ r(Xe, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
1390
+ _e(p) && h({ values: l, errors: {} });
1391
+ }, [p, l, h]), /* @__PURE__ */ o(Ze, { value: u, children: /* @__PURE__ */ o("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
1391
1392
  })
1392
- ), _t = {
1393
- ...nt,
1394
- section: Q
1395
- }, on = S(function(i) {
1396
- const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, l = e.Icon;
1397
- return /* @__PURE__ */ b(y, { gap: "4", align: "center", children: [
1398
- /* @__PURE__ */ r(G, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(y, { gap: "3", align: "center", grow: "1", children: [
1399
- /* @__PURE__ */ r(l, {}),
1393
+ ), Rt = {
1394
+ ...ot,
1395
+ section: X
1396
+ }, an = F(function(i) {
1397
+ const { field: e, setFieldType: t } = i, n = e.fieldTypeName, r = e.fieldTypeDescription, a = e.Icon;
1398
+ return /* @__PURE__ */ g(y, { gap: "4", align: "center", children: [
1399
+ /* @__PURE__ */ o(G, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ g(y, { gap: "3", align: "center", grow: "1", children: [
1400
+ /* @__PURE__ */ o(a, {}),
1400
1401
  n
1401
1402
  ] }) }),
1402
- /* @__PURE__ */ r(D, { children: o })
1403
+ /* @__PURE__ */ o(V, { children: r })
1403
1404
  ] });
1404
- }), Mt = [
1405
+ }), Nt = [
1405
1406
  ["string", "text"],
1406
1407
  ["select", "multi-select", "upload"],
1407
1408
  ["boolean", "date", "number", "multi-string"]
1408
- ], sn = Mt.length - 1, ln = S(function(i) {
1409
+ ], cn = Nt.length - 1, dn = F(function(i) {
1409
1410
  const { setFieldType: e } = i;
1410
- return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children: Mt.map((t, n) => /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
1411
- /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
1412
- on,
1411
+ return /* @__PURE__ */ o(y, { direction: "column", gap: "3", children: Nt.map((t, n) => /* @__PURE__ */ g(y, { direction: "column", gap: "3", children: [
1412
+ /* @__PURE__ */ o(y, { direction: "column", gap: "2", children: t.map((r) => /* @__PURE__ */ o(
1413
+ an,
1413
1414
  {
1414
- field: nt[o],
1415
- setFieldType: () => e(o)
1415
+ field: ot[r],
1416
+ setFieldType: () => e(r)
1416
1417
  },
1417
- o
1418
+ r
1418
1419
  )) }),
1419
- n < sn && /* @__PURE__ */ r(si, { size: "4" })
1420
+ n < cn && /* @__PURE__ */ o(ci, { size: "4" })
1420
1421
  ] }, n)) });
1421
- }), an = (s) => (i) => {
1422
+ }), un = (s) => (i) => {
1422
1423
  if (!(!i || typeof i != "string") && s.includes(i.trim()))
1423
1424
  return "This name is already taken.";
1424
- }, cn = (s, i) => {
1425
+ }, fn = (s, i) => {
1425
1426
  const e = [
1426
- new ge({
1427
+ new be({
1427
1428
  label: "Label",
1428
1429
  required: !0,
1429
1430
  maxLength: 200,
1430
1431
  identifier: "label",
1431
- fieldValidators: [an(s)]
1432
+ fieldValidators: [un(s)]
1432
1433
  }),
1433
- new be({
1434
+ new ye({
1434
1435
  label: "Description",
1435
1436
  required: !1,
1436
1437
  maxLength: 1e3,
@@ -1439,16 +1440,16 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1439
1440
  ];
1440
1441
  return i === "section" ? e : [
1441
1442
  ...e,
1442
- new ue({ label: "Required", description: null, required: !1, identifier: "required" })
1443
+ new fe({ label: "Required", description: null, required: !1, identifier: "required" })
1443
1444
  ];
1444
- }, dn = S(function(i) {
1445
- const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: l } = i, c = _t[e], a = me(), f = v(() => {
1446
- const d = Et(a.values.fields).filter((h) => h !== (o == null ? void 0 : o.label));
1447
- let u = cn(d, e);
1448
- if (c === Q) {
1449
- if (l === void 0)
1445
+ }, mn = F(function(i) {
1446
+ const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: r, conditionalSourceFields: a } = i, c = Rt[e], l = he(), f = w(() => {
1447
+ const d = Pt(l.values.fields).filter((p) => p !== (r == null ? void 0 : r.label));
1448
+ let u = fn(d, e);
1449
+ if (c === X) {
1450
+ if (a === void 0)
1450
1451
  throw new Error("Conditional source fields must be provided when changing sections.");
1451
- u = u.concat(c.getFieldCreationSchema(l));
1452
+ u = u.concat(c.getFieldCreationSchema(a));
1452
1453
  } else {
1453
1454
  if (!(c.prototype instanceof M))
1454
1455
  throw new Error(`Field must be an instance of BaseField. Got ${c}.`);
@@ -1460,71 +1461,71 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1460
1461
  // using the dialog title as the form title
1461
1462
  title: null
1462
1463
  };
1463
- }, [a.values.fields, e, c, o == null ? void 0 : o.label, l]);
1464
- return /* @__PURE__ */ r(
1465
- ot,
1464
+ }, [l.values.fields, e, c, r == null ? void 0 : r.label, a]);
1465
+ return /* @__PURE__ */ o(
1466
+ lt,
1466
1467
  {
1467
1468
  schema: f,
1468
- values: o,
1469
+ values: r,
1469
1470
  onSubmit: n,
1470
- cancelText: o ? void 0 : "Back",
1471
+ cancelText: r ? void 0 : "Back",
1471
1472
  onCancel: t
1472
1473
  }
1473
1474
  );
1474
- }), pe = S(function(i) {
1475
- const { parentPath: e, index: t, children: n, initial: o, editing: l, conditionalSourceFields: c } = i, [a, f] = ce(), d = (o == null ? void 0 : o.type) ?? a, u = d ? _t[d].fieldTypeName : void 0, { setFieldValue: h, values: p } = me();
1476
- if (l && !o)
1475
+ }), pe = F(function(i) {
1476
+ const { parentPath: e, index: t, children: n, initial: r, editing: a, conditionalSourceFields: c } = i, [l, f] = de(), d = (r == null ? void 0 : r.type) ?? l, u = d ? Rt[d].fieldTypeName : void 0, { setFieldValue: p, values: h } = he();
1477
+ if (a && !r)
1477
1478
  throw new Error("Initial field must be provided if editing is true.");
1478
- const g = !d && !l && !o, x = g ? "Choose a field type" : `${u} settings`, z = g ? "Select a field type to add to this section." : (u == null ? void 0 : u.toLowerCase()) === "section" ? "Customize your section" : `Customize your ${u == null ? void 0 : u.toLowerCase()} field.`, F = T(() => f(void 0), []), w = T((I) => {
1479
+ const b = !d && !a && !r, v = b ? "Choose a field type" : `${u} settings`, z = b ? "Select a field type to add to this section." : (u == null ? void 0 : u.toLowerCase()) === "section" ? "Customize your section" : `Customize your ${u == null ? void 0 : u.toLowerCase()} field.`, C = T(() => f(void 0), []), x = T((I) => {
1479
1480
  f(void 0), I();
1480
1481
  }, []), L = T(
1481
- (I, V) => {
1482
+ (I, k) => {
1482
1483
  const { label: O } = I;
1483
1484
  if (!d)
1484
1485
  throw new Error("Field type must be selected before creating a field.");
1485
1486
  if (!O || typeof O != "string")
1486
1487
  throw new Error("Label must be provided before creating a field.");
1487
- const K = Me({
1488
+ const K = Re({
1488
1489
  type: d,
1489
1490
  ...I,
1490
- identifier: St(I.identifier, O)
1491
- }).serialize(), q = de(p, e);
1491
+ identifier: At(I.identifier, O)
1492
+ }).serialize(), q = ue(h, e);
1492
1493
  if (q === void 0)
1493
1494
  throw new Error("Parent path must point to an existing field.");
1494
1495
  let U;
1495
1496
  if (!Array.isArray(q))
1496
1497
  throw new Error("Parent path must point to an array.");
1497
- l ? U = Ri(q, t, K) : U = Tt(q, t, K), h(e, U).then(), V();
1498
+ a ? U = qi(q, t, K) : U = Et(q, t, K), p(e, U).then(), k();
1498
1499
  },
1499
- [l, d, p, e, h, t]
1500
+ [a, d, h, e, p, t]
1500
1501
  ), P = T(
1501
- (I) => g ? /* @__PURE__ */ r(ln, { setFieldType: f }) : /* @__PURE__ */ r(
1502
- dn,
1502
+ (I) => b ? /* @__PURE__ */ o(dn, { setFieldType: f }) : /* @__PURE__ */ o(
1503
+ mn,
1503
1504
  {
1504
1505
  conditionalSourceFields: c,
1505
- handleCancel: F,
1506
- handleCreateField: (V) => L(V, I),
1506
+ handleCancel: C,
1507
+ handleCreateField: (k) => L(k, I),
1507
1508
  fieldType: d,
1508
- defaultField: o
1509
+ defaultField: r
1509
1510
  }
1510
1511
  ),
1511
- [c, F, L, o, g, d]
1512
+ [c, C, L, r, b, d]
1512
1513
  );
1513
- return /* @__PURE__ */ r(li, { onCloseInterrupt: w, title: x, description: z, content: P, children: n });
1514
- }), dt = ({ children: s }) => /* @__PURE__ */ r(pt, { children: s }), ut = (s, i) => ({
1514
+ return /* @__PURE__ */ o(di, { onCloseInterrupt: x, title: v, description: z, content: P, children: n });
1515
+ }), ft = ({ children: s }) => /* @__PURE__ */ o(gt, { children: s }), mt = (s, i) => ({
1515
1516
  initial: s ? i : "none",
1516
1517
  sm: s ? "none" : i
1517
- }), Ot = S(function(i) {
1518
- const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o, duplicateProps: l } = i, c = v(
1518
+ }), Bt = F(function(i) {
1519
+ const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: r, duplicateProps: a } = i, c = w(
1519
1520
  () => [
1520
1521
  {
1521
1522
  Wrapper: pe,
1522
1523
  wrapperProps: n,
1523
- Icon: ai,
1524
+ Icon: ui,
1524
1525
  text: "Edit"
1525
1526
  },
1526
1527
  {
1527
- Icon: ci,
1528
+ Icon: fi,
1528
1529
  buttonProps: {
1529
1530
  onClick: e
1530
1531
  },
@@ -1532,64 +1533,64 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1532
1533
  },
1533
1534
  {
1534
1535
  Wrapper: pe,
1535
- wrapperProps: l,
1536
- Icon: di,
1536
+ wrapperProps: a,
1537
+ Icon: mi,
1537
1538
  text: "Duplicate"
1538
1539
  },
1539
1540
  {
1540
1541
  Wrapper: pe,
1541
- wrapperProps: o,
1542
- Icon: ke,
1542
+ wrapperProps: r,
1543
+ Icon: $e,
1543
1544
  text: "Add after"
1544
1545
  },
1545
1546
  {
1546
1547
  // Wrapping icon in a div so that the asChild turns the button into a div
1547
1548
  // so that the drag handle props are not applied to the icon
1548
1549
  // Note: b/c the <button> does not handle the space-press event correctly
1549
- Icon: (a) => /* @__PURE__ */ r("div", { ...a, children: /* @__PURE__ */ r(ui, {}) }),
1550
+ Icon: (l) => /* @__PURE__ */ o("div", { ...l, children: /* @__PURE__ */ o(hi, {}) }),
1550
1551
  text: "Reorder",
1551
1552
  disableOnMobile: !0,
1552
1553
  buttonProps: { ...t, asChild: !0 }
1553
1554
  }
1554
1555
  ],
1555
- [t, l, n, o, e]
1556
+ [t, a, n, r, e]
1556
1557
  );
1557
- return /* @__PURE__ */ b(pt, { children: [
1558
- /* @__PURE__ */ r(y, { gap: "4", display: ut(!1, "flex"), children: c.map((a) => {
1559
- const f = a.Wrapper ?? dt;
1560
- return /* @__PURE__ */ r(f, { ...a.wrapperProps, children: /* @__PURE__ */ r(ae, { type: "button", variant: "ghost", "aria-label": a.text, ...a.buttonProps, children: /* @__PURE__ */ r(a.Icon, {}) }) }, a.text);
1558
+ return /* @__PURE__ */ g(gt, { children: [
1559
+ /* @__PURE__ */ o(y, { gap: "4", display: mt(!1, "flex"), children: c.map((l) => {
1560
+ const f = l.Wrapper ?? ft;
1561
+ return /* @__PURE__ */ o(f, { ...l.wrapperProps, children: /* @__PURE__ */ o(ce, { type: "button", variant: "ghost", "aria-label": l.text, ...l.buttonProps, children: /* @__PURE__ */ o(l.Icon, {}) }) }, l.text);
1561
1562
  }) }),
1562
- /* @__PURE__ */ r(he, { display: ut(!0, "block"), children: /* @__PURE__ */ r(
1563
- fi,
1563
+ /* @__PURE__ */ o(ge, { display: mt(!0, "block"), children: /* @__PURE__ */ o(
1564
+ pi,
1564
1565
  {
1565
- trigger: /* @__PURE__ */ r(ae, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ r(mi, {}) }),
1566
+ trigger: /* @__PURE__ */ o(ce, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ o(gi, {}) }),
1566
1567
  closeOnSelect: !1,
1567
- items: c.map((a) => {
1568
+ items: c.map((l) => {
1568
1569
  var d;
1569
- if (a.disableOnMobile)
1570
+ if (l.disableOnMobile)
1570
1571
  return null;
1571
- const f = a.Wrapper ?? dt;
1572
+ const f = l.Wrapper ?? ft;
1572
1573
  return {
1573
- ...a.buttonProps,
1574
- onSelect: (d = a.buttonProps) == null ? void 0 : d.onClick,
1575
- content: /* @__PURE__ */ r(f, { ...a.wrapperProps, children: /* @__PURE__ */ b(y, { gap: "2", align: "center", children: [
1576
- /* @__PURE__ */ r(a.Icon, {}),
1577
- a.text
1574
+ ...l.buttonProps,
1575
+ onSelect: (d = l.buttonProps) == null ? void 0 : d.onClick,
1576
+ content: /* @__PURE__ */ o(f, { ...l.wrapperProps, children: /* @__PURE__ */ g(y, { gap: "2", align: "center", children: [
1577
+ /* @__PURE__ */ o(l.Icon, {}),
1578
+ l.text
1578
1579
  ] }) })
1579
1580
  };
1580
- }).filter((a) => a !== null)
1581
+ }).filter((l) => l !== null)
1581
1582
  }
1582
1583
  ) })
1583
1584
  ] });
1584
- }), Oe = "form-builder", un = S(function(i) {
1585
- const { field: e, index: t, sectionIndex: n, takenLabels: o, remove: l } = i, c = v(() => Me(e), [e]), a = Pe(c, { formId: Oe, disabled: !0 }), f = T(
1586
- (p) => {
1587
- if (p.label === null)
1588
- throw new Error(`Expected a label for field ${p.identifier}`);
1589
- return { ...p, label: He(p.label, o), identifier: "" };
1585
+ }), Ne = "form-builder", hn = F(function(i) {
1586
+ const { field: e, index: t, sectionIndex: n, takenLabels: r, remove: a } = i, c = w(() => Re(e), [e]), l = De(c, { formId: Ne, disabled: !0 }), f = T(
1587
+ (h) => {
1588
+ if (h.label === null)
1589
+ throw new Error(`Expected a label for field ${h.identifier}`);
1590
+ return { ...h, label: Ge(h.label, r), identifier: "" };
1590
1591
  },
1591
- [o]
1592
- ), d = v(
1592
+ [r]
1593
+ ), d = w(
1593
1594
  () => ({
1594
1595
  index: t,
1595
1596
  parentPath: `fields.${n}.fields`,
@@ -1597,14 +1598,14 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1597
1598
  editing: !0
1598
1599
  }),
1599
1600
  [e, t, n]
1600
- ), u = v(
1601
+ ), u = w(
1601
1602
  () => ({
1602
1603
  parentPath: `fields.${n}.fields`,
1603
1604
  index: t + 1,
1604
1605
  initial: f(e)
1605
1606
  }),
1606
1607
  [f, e, t, n]
1607
- ), h = v(
1608
+ ), p = w(
1608
1609
  () => ({
1609
1610
  parentPath: `fields.${n}.fields`,
1610
1611
  index: t + 1,
@@ -1612,64 +1613,115 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1612
1613
  }),
1613
1614
  [t, n]
1614
1615
  );
1615
- return /* @__PURE__ */ r(Ze, { draggableId: e.identifier, index: t, children: (p) => /* @__PURE__ */ r(
1616
- ye,
1616
+ return /* @__PURE__ */ o(tt, { draggableId: e.identifier, index: t, children: (h) => /* @__PURE__ */ o(
1617
+ xe,
1617
1618
  {
1618
- ref: p.innerRef,
1619
- ...p.draggableProps,
1620
- ...p.dragHandleProps,
1619
+ ref: h.innerRef,
1620
+ ...h.draggableProps,
1621
+ ...h.dragHandleProps,
1621
1622
  mb: "4",
1622
- children: /* @__PURE__ */ b(y, { gap: "4", justify: "between", align: "center", children: [
1623
- a,
1624
- /* @__PURE__ */ r(
1625
- Ot,
1623
+ children: /* @__PURE__ */ g(y, { gap: "4", justify: "between", align: "center", children: [
1624
+ l,
1625
+ /* @__PURE__ */ o(
1626
+ Bt,
1626
1627
  {
1627
- remove: l,
1628
+ remove: a,
1628
1629
  editProps: d,
1629
1630
  duplicateProps: u,
1630
- insertAfterProps: h,
1631
- dragHandleProps: p.dragHandleProps
1631
+ insertAfterProps: p,
1632
+ dragHandleProps: h.dragHandleProps
1632
1633
  }
1633
1634
  )
1634
1635
  ] })
1635
1636
  }
1636
1637
  ) });
1637
- }), fn = S(function(i) {
1638
- var V, O, K, q, U, A, R;
1639
- const { field: e, index: t, dropState: n } = i, o = (V = n[e.identifier]) == null ? void 0 : V.disabled, { setFieldValue: l, values: c } = me(), a = pi(), f = Et(c.fields), d = T(
1640
- (C, E) => {
1641
- for (const $ of C) {
1642
- const k = E.indexOf($);
1643
- l(`fields.${k}.condition`, null).then(), l(`fields.${k}.conditional`, !1).then();
1638
+ }), pn = F(function(i) {
1639
+ const { start: e, end: t } = i, n = 20, r = {
1640
+ x: Math.min(e.x, t.x),
1641
+ y: Math.min(e.y, t.y)
1642
+ }, a = Math.abs(t.x - e.x) + n * 2, c = Math.abs(t.y - e.y);
1643
+ return /* @__PURE__ */ g(
1644
+ "svg",
1645
+ {
1646
+ width: a,
1647
+ height: c,
1648
+ style: {
1649
+ backgroundColor: "#eee",
1650
+ transform: `translate(${r.x}px, ${r.y}px)`
1651
+ },
1652
+ children: [
1653
+ /* @__PURE__ */ o(
1654
+ "line",
1655
+ {
1656
+ stroke: "#aaa",
1657
+ strokeWidth: 1,
1658
+ x1: e.x - r.x - n,
1659
+ y1: t.y - r.y,
1660
+ x2: t.x - r.x,
1661
+ y2: t.y - r.y
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ o(
1665
+ "line",
1666
+ {
1667
+ stroke: "#aaa",
1668
+ strokeWidth: 1,
1669
+ x1: e.x - r.x - n,
1670
+ y1: e.y - r.y,
1671
+ x2: e.x - r.x - n,
1672
+ y2: t.y - r.y
1673
+ }
1674
+ ),
1675
+ /* @__PURE__ */ o(
1676
+ "line",
1677
+ {
1678
+ stroke: "#aaa",
1679
+ strokeWidth: 1,
1680
+ x1: e.x - r.x,
1681
+ y1: e.y - r.y,
1682
+ x2: t.x - r.x - n,
1683
+ y2: e.y - r.y
1684
+ }
1685
+ )
1686
+ ]
1687
+ }
1688
+ );
1689
+ }), gn = F(function(i) {
1690
+ var O, K, q, U, A, R, Y, Ce;
1691
+ const { field: e, index: t, dropState: n } = i, r = wt(null), a = (O = n[e.identifier]) == null ? void 0 : O.disabled, { setFieldValue: c, values: l } = he(), f = bi(), d = Pt(l.fields), u = T(
1692
+ (S, E) => {
1693
+ for (const _ of S) {
1694
+ const D = E.indexOf(_);
1695
+ c(`fields.${D}.condition`, null).then(), c(`fields.${D}.conditional`, !1).then();
1644
1696
  }
1645
1697
  },
1646
- [l]
1647
- ), u = T(
1648
- (C) => {
1649
- var k;
1650
- const E = e.fields[C];
1698
+ [c]
1699
+ ), p = T(
1700
+ (S) => {
1701
+ var D;
1702
+ const E = e.fields[S];
1651
1703
  if (!E)
1652
1704
  throw new Error("Could not find field to remove.");
1653
- const $ = [];
1654
- for (const N of c.fields)
1655
- ((k = N.condition) == null ? void 0 : k.identifier) === E.identifier && $.push(N);
1705
+ const _ = [];
1706
+ for (const N of l.fields)
1707
+ ((D = N.condition) == null ? void 0 : D.identifier) === E.identifier && _.push(N);
1656
1708
  return {
1657
1709
  removing: E,
1658
- affectedSections: $,
1659
- action: () => l(`fields.${t}.fields`, Se(e.fields, C))
1710
+ affectedSections: _,
1711
+ action: () => c(`fields.${t}.fields`, Ae(e.fields, S))
1660
1712
  };
1661
1713
  },
1662
- [e.fields, c.fields, l, t]
1714
+ [e.fields, l.fields, c, t]
1663
1715
  ), h = T(
1664
- (C) => {
1665
- const { affectedSections: E, action: $, removing: k } = u(C), N = () => {
1666
- $().then(), d(E, c.fields);
1716
+ (S) => {
1717
+ const { affectedSections: E, action: _, removing: D } = p(S), N = () => {
1718
+ _().then(), u(E, l.fields);
1667
1719
  };
1668
1720
  if (E.length > 0) {
1669
- const Re = E.map((xe) => xe.label).join(", ");
1670
- return a({
1721
+ const Be = E.map((Fe) => Fe.label).join(", ");
1722
+ return f({
1671
1723
  title: "Remove condition?",
1672
- description: `${k.label} is being used as a condition, deleting it will remove the condition from the ${Re} section(s).`,
1724
+ description: `${D.label} is being used as a condition, deleting it will remove the condition from the ${Be} section(s).`,
1673
1725
  severity: "danger",
1674
1726
  actionText: "Remove",
1675
1727
  onAction: N
@@ -1677,150 +1729,153 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1677
1729
  }
1678
1730
  N();
1679
1731
  },
1680
- [u, d, c.fields, a]
1681
- ), p = T(() => {
1682
- const E = e.fields.map((Ie, Rt) => u(Rt)).flatMap((Ie) => Ie.affectedSections), $ = E.length ? "Remove fields and conditions?" : "Remove fields?", k = e.fields.length, N = E.map((Ie) => Ie.label).join(", "), Re = E.length ? `Deleting this section will remove the ${k} field(s) it contains and will remove the conditions from following sections: ${N}` : `Deleting this section will remove the ${k} field(s) it contains.`, xe = Se(c.fields, t), st = () => l("fields", xe);
1732
+ [p, u, l.fields, f]
1733
+ ), b = T(() => {
1734
+ const E = e.fields.map((Te, qt) => p(qt)).flatMap((Te) => Te.affectedSections), _ = E.length ? "Remove fields and conditions?" : "Remove fields?", D = e.fields.length, N = E.map((Te) => Te.label).join(", "), Be = E.length ? `Deleting this section will remove the ${D} field(s) it contains and will remove the conditions from following sections: ${N}` : `Deleting this section will remove the ${D} field(s) it contains.`, Fe = Ae(l.fields, t), at = () => c("fields", Fe);
1683
1735
  if (E.length > 0)
1684
- return a({
1685
- title: $,
1686
- description: Re,
1736
+ return f({
1737
+ title: _,
1738
+ description: Be,
1687
1739
  severity: "danger",
1688
1740
  actionText: "Remove",
1689
1741
  onAction: () => {
1690
- st().then(() => {
1691
- d(E, xe);
1742
+ at().then(() => {
1743
+ u(E, Fe);
1692
1744
  });
1693
1745
  }
1694
1746
  });
1695
- st().then();
1747
+ at().then();
1696
1748
  }, [
1697
1749
  e.fields,
1698
- c.fields,
1750
+ l.fields,
1699
1751
  t,
1700
- u,
1701
- l,
1702
- a,
1703
- d
1704
- ]), g = T(
1705
- (C) => {
1706
- if (C.label === null)
1707
- throw new Error(`Expected a label for field ${C.identifier}`);
1708
- const E = He(C.label, f), $ = C.fields.map((k) => {
1709
- const N = He(k.label, f);
1752
+ p,
1753
+ c,
1754
+ f,
1755
+ u
1756
+ ]), v = T(
1757
+ (S) => {
1758
+ if (S.label === null)
1759
+ throw new Error(`Expected a label for field ${S.identifier}`);
1760
+ const E = Ge(S.label, d), _ = S.fields.map((D) => {
1761
+ const N = Ge(D.label, d);
1710
1762
  return {
1711
- ...k,
1763
+ ...D,
1712
1764
  label: N,
1713
- identifier: St(void 0, N)
1765
+ identifier: At(void 0, N)
1714
1766
  };
1715
1767
  });
1716
- return { ...C, label: E, fields: $, identifier: "" };
1768
+ return { ...S, label: E, fields: _, identifier: "" };
1717
1769
  },
1718
- [f]
1719
- ), x = v(
1770
+ [d]
1771
+ ), z = w(
1720
1772
  () => ({
1721
1773
  index: t,
1722
1774
  parentPath: "fields",
1723
1775
  initial: e,
1724
1776
  editing: !0,
1725
- conditionalSourceFields: Fe(c.fields, t)
1777
+ conditionalSourceFields: Se(l.fields, t)
1726
1778
  }),
1727
- [e, t, c.fields]
1728
- ), z = v(
1779
+ [e, t, l.fields]
1780
+ ), C = w(
1729
1781
  () => ({
1730
1782
  index: t + 1,
1731
1783
  parentPath: "fields",
1732
- initial: Te(),
1733
- conditionalSourceFields: Fe(c.fields, t + 1)
1784
+ initial: Ee(),
1785
+ conditionalSourceFields: Se(l.fields, t + 1)
1734
1786
  }),
1735
- [t, c.fields]
1736
- ), F = v(
1787
+ [t, l.fields]
1788
+ ), x = w(
1737
1789
  () => ({
1738
1790
  parentPath: `fields.${t}.fields`,
1739
1791
  index: e.fields.length,
1740
1792
  initial: void 0
1741
1793
  }),
1742
1794
  [e.fields.length, t]
1743
- ), w = v(
1795
+ ), L = w(
1744
1796
  () => ({
1745
1797
  index: t + 1,
1746
1798
  parentPath: "fields",
1747
- initial: g(e),
1748
- conditionalSourceFields: Fe(c.fields, t + 1)
1799
+ initial: v(e),
1800
+ conditionalSourceFields: Se(l.fields, t + 1)
1749
1801
  }),
1750
- [g, e, t, c.fields]
1751
- ), L = v(
1802
+ [v, e, t, l.fields]
1803
+ ), P = w(
1752
1804
  () => {
1753
- var C, E;
1754
- return (E = zt(c.fields, (C = e.condition) == null ? void 0 : C.identifier)) == null ? void 0 : E.label;
1805
+ var S, E;
1806
+ return (E = Lt(l.fields, (S = e.condition) == null ? void 0 : S.identifier)) == null ? void 0 : E.label;
1755
1807
  },
1756
- [(O = e.condition) == null ? void 0 : O.identifier, c.fields]
1757
- ), P = Array.isArray((K = e.condition) == null ? void 0 : K.value) ? "contains all of" : "equals";
1758
- if (Ge((q = e.condition) == null ? void 0 : q.value))
1808
+ [(K = e.condition) == null ? void 0 : K.identifier, l.fields]
1809
+ ), I = Array.isArray((q = e.condition) == null ? void 0 : q.value) ? "contains all of" : "equals";
1810
+ if (Ye((U = e.condition) == null ? void 0 : U.value))
1759
1811
  throw new Error("File values are not supported for conditions.");
1760
- const I = Array.isArray((U = e.condition) == null ? void 0 : U.value) ? (A = e.condition) == null ? void 0 : A.value.map((C) => typeof C == "string" ? C : C.label).join(", ") : (R = e.condition) == null ? void 0 : R.value.toString();
1761
- return /* @__PURE__ */ r(Ze, { draggableId: e.identifier, index: t, children: (C) => /* @__PURE__ */ r(
1762
- ye,
1812
+ const k = Array.isArray((A = e.condition) == null ? void 0 : A.value) ? (R = e.condition) == null ? void 0 : R.value.map((S) => typeof S == "string" ? S : S.label).join(", ") : (Y = e.condition) == null ? void 0 : Y.value.toString();
1813
+ return console.log(e), console.log(r.current, (Ce = r.current) == null ? void 0 : Ce.getBoundingClientRect()), /* @__PURE__ */ o(tt, { draggableId: e.identifier, index: t, children: (S) => /* @__PURE__ */ g(
1814
+ xe,
1763
1815
  {
1764
- ref: C.innerRef,
1765
- ...C.draggableProps,
1766
- ...C.dragHandleProps,
1816
+ ref: S.innerRef,
1817
+ ...S.draggableProps,
1818
+ ...S.dragHandleProps,
1767
1819
  mb: "4",
1768
- children: /* @__PURE__ */ b(y, { gap: "3", justify: "between", align: "center", children: [
1769
- /* @__PURE__ */ b(y, { direction: "column", gap: "2", grow: "1", children: [
1770
- /* @__PURE__ */ b(y, { direction: "column", children: [
1771
- /* @__PURE__ */ r(De, { as: "h3", size: "3", children: e.label }),
1772
- /* @__PURE__ */ r(D, { className: _e.description, children: e.description })
1820
+ children: [
1821
+ e.condition && /* @__PURE__ */ o(pn, { start: { x: 60, y: 70 }, end: { x: 65, y: 40 } }),
1822
+ /* @__PURE__ */ g(y, { ref: r, gap: "3", justify: "between", align: "center", children: [
1823
+ /* @__PURE__ */ g(y, { direction: "column", gap: "2", grow: "1", children: [
1824
+ /* @__PURE__ */ g(y, { direction: "column", children: [
1825
+ /* @__PURE__ */ o(Me, { as: "h3", size: "3", children: e.label }),
1826
+ /* @__PURE__ */ o(V, { className: Ie.description, children: e.description })
1827
+ ] }),
1828
+ e.condition && /* @__PURE__ */ o(V, { size: "1", children: /* @__PURE__ */ g(yi, { children: [
1829
+ "Display only if ",
1830
+ /* @__PURE__ */ o(ct, { children: P }),
1831
+ " ",
1832
+ I,
1833
+ " ",
1834
+ /* @__PURE__ */ o(ct, { children: k })
1835
+ ] }) }),
1836
+ /* @__PURE__ */ o(et, { droppableId: e.identifier, type: "SECTION", isDropDisabled: a, children: (E) => /* @__PURE__ */ g(
1837
+ y,
1838
+ {
1839
+ ref: E.innerRef,
1840
+ ...E.droppableProps,
1841
+ direction: "column",
1842
+ gap: "0",
1843
+ children: [
1844
+ e.fields.map((_, D) => /* @__PURE__ */ o(
1845
+ hn,
1846
+ {
1847
+ field: _,
1848
+ index: D,
1849
+ sectionIndex: t,
1850
+ remove: () => h(D),
1851
+ takenLabels: d
1852
+ },
1853
+ _.identifier
1854
+ )),
1855
+ E.placeholder,
1856
+ /* @__PURE__ */ o(pe, { ...x, children: /* @__PURE__ */ g(G, { type: "button", variant: "outline", children: [
1857
+ /* @__PURE__ */ o($e, {}),
1858
+ " Add a field"
1859
+ ] }) })
1860
+ ]
1861
+ }
1862
+ ) })
1773
1863
  ] }),
1774
- e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(hi, { children: [
1775
- "Display only if ",
1776
- /* @__PURE__ */ r(lt, { children: L }),
1777
- " ",
1778
- P,
1779
- " ",
1780
- /* @__PURE__ */ r(lt, { children: I })
1781
- ] }) }),
1782
- /* @__PURE__ */ r(Je, { droppableId: e.identifier, type: "SECTION", isDropDisabled: o, children: (E) => /* @__PURE__ */ b(
1783
- y,
1864
+ /* @__PURE__ */ o(
1865
+ Bt,
1784
1866
  {
1785
- ref: E.innerRef,
1786
- ...E.droppableProps,
1787
- direction: "column",
1788
- gap: "0",
1789
- children: [
1790
- e.fields.map(($, k) => /* @__PURE__ */ r(
1791
- un,
1792
- {
1793
- field: $,
1794
- index: k,
1795
- sectionIndex: t,
1796
- remove: () => h(k),
1797
- takenLabels: f
1798
- },
1799
- $.identifier
1800
- )),
1801
- E.placeholder,
1802
- /* @__PURE__ */ r(pe, { ...F, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
1803
- /* @__PURE__ */ r(ke, {}),
1804
- " Add a field"
1805
- ] }) })
1806
- ]
1867
+ remove: b,
1868
+ insertAfterProps: C,
1869
+ dragHandleProps: S.dragHandleProps,
1870
+ editProps: z,
1871
+ duplicateProps: L
1807
1872
  }
1808
- ) })
1809
- ] }),
1810
- /* @__PURE__ */ r(
1811
- Ot,
1812
- {
1813
- remove: p,
1814
- insertAfterProps: z,
1815
- dragHandleProps: C.dragHandleProps,
1816
- editProps: x,
1817
- duplicateProps: w
1818
- }
1819
- )
1820
- ] })
1873
+ )
1874
+ ] })
1875
+ ]
1821
1876
  }
1822
1877
  ) });
1823
- }), mn = (s, i) => {
1878
+ }), bn = (s, i) => {
1824
1879
  var t;
1825
1880
  const e = { ...s };
1826
1881
  switch (i.type) {
@@ -1835,7 +1890,7 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1835
1890
  case "update":
1836
1891
  return i.state;
1837
1892
  }
1838
- }, pn = (s, i) => {
1893
+ }, yn = (s, i) => {
1839
1894
  if (i)
1840
1895
  for (let e = 0; e < s.length; e++) {
1841
1896
  const t = s[e];
@@ -1845,41 +1900,41 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1845
1900
  return e;
1846
1901
  }
1847
1902
  }
1848
- }, ft = (s) => {
1903
+ }, ht = (s) => {
1849
1904
  var e, t, n;
1850
1905
  const i = {};
1851
- for (let o = 0; o < s.length; o++) {
1852
- const l = s[o];
1853
- if (!l)
1906
+ for (let r = 0; r < s.length; r++) {
1907
+ const a = s[r];
1908
+ if (!a)
1854
1909
  throw new Error("Field is undefined.");
1855
- const c = o > 0 ? (e = i[s[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, a = new Set(c);
1856
- (t = l.condition) != null && t.identifier && a.add(l.condition.identifier), i[l.identifier] = {
1910
+ const c = r > 0 ? (e = i[s[r - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, l = new Set(c);
1911
+ (t = a.condition) != null && t.identifier && l.add(a.condition.identifier), i[a.identifier] = {
1857
1912
  disabled: !1,
1858
- conditionFields: a,
1859
- conditionIndex: pn(s, (n = l.condition) == null ? void 0 : n.identifier),
1860
- index: o,
1861
- label: l.label
1913
+ conditionFields: l,
1914
+ conditionIndex: yn(s, (n = a.condition) == null ? void 0 : n.identifier),
1915
+ index: r,
1916
+ label: a.label
1862
1917
  };
1863
1918
  }
1864
1919
  return i;
1865
- }, mt = (s, i) => {
1920
+ }, pt = (s, i) => {
1866
1921
  for (const [e, t] of Object.entries(s))
1867
1922
  if (t.identifier === i)
1868
1923
  return [t, e];
1869
- }, hn = S(function() {
1870
- const { values: i, setFieldValue: e } = me(), [t, n] = wi(mn, i.fields, ft), { showInfo: o } = gi();
1924
+ }, xn = F(function() {
1925
+ const { values: i, setFieldValue: e } = he(), [t, n] = vi(bn, i.fields, ht), { showInfo: r } = xi();
1871
1926
  we(() => {
1872
- n({ type: "update", state: ft(i.fields) });
1927
+ n({ type: "update", state: ht(i.fields) });
1873
1928
  }, [n, i.fields]);
1874
- const l = T((f) => {
1929
+ const a = T((f) => {
1875
1930
  f.type === "SECTION" && n({ type: "hold", fieldId: f.draggableId });
1876
1931
  }, []), c = T(
1877
1932
  (f) => {
1878
- const { source: d, destination: u, type: h, reason: p, draggableId: g } = f;
1879
- if (n({ type: "release" }), !u || p === "CANCEL")
1933
+ const { source: d, destination: u, type: p, reason: h, draggableId: b } = f;
1934
+ if (n({ type: "release" }), !u || h === "CANCEL")
1880
1935
  return;
1881
- if (h === "ROOT") {
1882
- const L = t[g];
1936
+ if (p === "ROOT") {
1937
+ const L = t[b];
1883
1938
  if (!L)
1884
1939
  throw new Error("Could not find section context.");
1885
1940
  let P = typeof L.conditionIndex < "u" ? (
@@ -1888,51 +1943,52 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1888
1943
  ) : u.index;
1889
1944
  for (const I of Object.values(t))
1890
1945
  I.conditionIndex === d.index && (P = Math.min(P, I.index - 1));
1891
- return P != u.index && o({
1946
+ return P != u.index && r({
1892
1947
  title: "Reordered sections",
1893
1948
  description: "Sections with conditions must be below the fields they reference."
1894
- }), e("fields", je(i.fields, d.index, P));
1949
+ }), e("fields", Ue(i.fields, d.index, P));
1895
1950
  }
1896
- if (h !== "SECTION")
1951
+ if (p !== "SECTION")
1897
1952
  throw new Error("Unexpected droppable type.");
1898
- const [x, z] = mt(i.fields, d.droppableId) ?? [], [F, w] = mt(i.fields, u.droppableId) ?? [];
1899
- if (!(x != null && x.fields) || !F)
1953
+ const [v, z] = pt(i.fields, d.droppableId) ?? [], [C, x] = pt(i.fields, u.droppableId) ?? [];
1954
+ if (!(v != null && v.fields) || !C)
1900
1955
  throw new Error("Could not find section with fields.");
1901
- if (x.identifier === F.identifier)
1956
+ if (v.identifier === C.identifier)
1902
1957
  e(
1903
1958
  `fields.${z}.fields`,
1904
- je(x.fields, d.index, u.index)
1959
+ Ue(v.fields, d.index, u.index)
1905
1960
  ).then();
1906
1961
  else {
1907
- const L = x.fields[d.index];
1962
+ const L = v.fields[d.index];
1908
1963
  if (!L)
1909
1964
  throw new Error("Could not find field to reorder.");
1910
- e(`fields.${z}.fields`, Se(x.fields, d.index)).then(), e(
1911
- `fields.${w}.fields`,
1912
- Tt(F.fields, u.index, L)
1965
+ e(`fields.${z}.fields`, Ae(v.fields, d.index)).then(), e(
1966
+ `fields.${x}.fields`,
1967
+ Et(C.fields, u.index, L)
1913
1968
  ).then();
1914
1969
  }
1915
1970
  },
1916
- [i.fields, e, t, o]
1917
- ), a = v(
1971
+ [i.fields, e, t, r]
1972
+ ), l = w(
1918
1973
  () => ({
1919
1974
  index: i.fields.length,
1920
1975
  parentPath: "fields",
1921
- initial: Te(),
1922
- conditionalSourceFields: Fe(i.fields, i.fields.length)
1976
+ initial: Ee(),
1977
+ conditionalSourceFields: Se(i.fields, i.fields.length)
1923
1978
  }),
1924
1979
  [i.fields]
1925
1980
  );
1926
- return /* @__PURE__ */ r(yt, { onDragStart: l, onDragEnd: c, children: /* @__PURE__ */ r(Je, { droppableId: "droppable", type: "ROOT", children: (f) => /* @__PURE__ */ b(
1981
+ return /* @__PURE__ */ o(vt, { onDragStart: a, onDragEnd: c, children: /* @__PURE__ */ o(et, { droppableId: "droppable", type: "ROOT", children: (f) => /* @__PURE__ */ g(
1927
1982
  y,
1928
1983
  {
1929
1984
  ref: f.innerRef,
1930
1985
  ...f.droppableProps,
1986
+ className: Ie.fieldsContainer,
1931
1987
  direction: "column",
1932
1988
  gap: "0",
1933
1989
  children: [
1934
- i.fields.map((d, u) => /* @__PURE__ */ r(
1935
- fn,
1990
+ i.fields.map((d, u) => /* @__PURE__ */ o(
1991
+ gn,
1936
1992
  {
1937
1993
  field: d,
1938
1994
  index: u,
@@ -1941,110 +1997,110 @@ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1941
1997
  d.label
1942
1998
  )),
1943
1999
  f.placeholder,
1944
- /* @__PURE__ */ r(pe, { ...a, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
1945
- /* @__PURE__ */ r(ke, {}),
2000
+ /* @__PURE__ */ o(pe, { ...l, children: /* @__PURE__ */ g(G, { type: "button", variant: "outline", children: [
2001
+ /* @__PURE__ */ o($e, {}),
1946
2002
  " Add a section"
1947
2003
  ] }) })
1948
2004
  ]
1949
2005
  }
1950
2006
  ) }) });
1951
- }), gn = {
2007
+ }), wn = {
1952
2008
  title: "",
1953
2009
  description: "",
1954
2010
  fields: []
1955
- }, bn = new ge({
2011
+ }, vn = new be({
1956
2012
  label: "Title",
1957
2013
  minLength: 0,
1958
2014
  maxLength: 100,
1959
2015
  required: !0,
1960
2016
  identifier: "title"
1961
- }), yn = { formId: Oe, placeholder: "Give your form a title." }, wn = new be({
2017
+ }), In = { formId: Ne, placeholder: "Give your form a title." }, Cn = new ye({
1962
2018
  label: "Description",
1963
2019
  minLength: 0,
1964
2020
  maxLength: 1e3,
1965
2021
  required: !1,
1966
2022
  identifier: "description"
1967
- }), vn = { formId: Oe, placeholder: "Explain the purpose of this form." }, xn = () => {
2023
+ }), Fn = { formId: Ne, placeholder: "Explain the purpose of this form." }, Tn = () => {
1968
2024
  alert("This is a form preview, your data will not be saved.");
1969
- }, _n = S(
2025
+ }, Nn = F(
1970
2026
  ve((s, i) => {
1971
- const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: l = o } = s, c = T((p) => {
1972
- const g = {};
1973
- if (p.title || (g.title = "Title is required."), (!p.fields || p.fields.length === 0) && (g.fields = "At least one field is required."), Ve(g))
1974
- return g;
1975
- }, []), a = Qe({
1976
- initialValues: Oi(n) ?? gn,
2027
+ const { onCancel: e, onSave: t, revision: n } = s, r = n ? "Edit form" : "Create a new form", { heading: a = r } = s, c = T((h) => {
2028
+ const b = {};
2029
+ if (h.title || (b.title = "Title is required."), (!h.fields || h.fields.length === 0) && (b.fields = "At least one field is required."), _e(b))
2030
+ return b;
2031
+ }, []), l = Je({
2032
+ initialValues: Bi(n) ?? wn,
1977
2033
  validate: c,
1978
- onSubmit: (p) => t(p),
2034
+ onSubmit: (h) => t(h),
1979
2035
  // only validate the entire for on submit
1980
2036
  validateOnChange: !1,
1981
2037
  validateOnBlur: !1
1982
- }), f = v(() => Pt(a.values), [a.values]), d = Pe(bn, yn), u = Pe(wn, vn), h = v(
1983
- () => typeof l == "object" ? l : /* @__PURE__ */ r(De, { children: l }),
1984
- [l]
2038
+ }), f = w(() => Dt(l.values), [l.values]), d = De(vn, In), u = De(Cn, Fn), p = w(
2039
+ () => typeof a == "object" ? a : /* @__PURE__ */ o(Me, { children: a }),
2040
+ [a]
1985
2041
  );
1986
- return /* @__PURE__ */ r(X.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
1987
- /* @__PURE__ */ b(X.List, { children: [
1988
- /* @__PURE__ */ r(X.Trigger, { value: "edit", children: "Edit" }),
1989
- /* @__PURE__ */ r(X.Trigger, { value: "preview", children: "Preview" })
2042
+ return /* @__PURE__ */ o(J.Root, { ref: i, defaultValue: "edit", children: /* @__PURE__ */ g(y, { direction: "column", gap: "2", children: [
2043
+ /* @__PURE__ */ g(J.List, { children: [
2044
+ /* @__PURE__ */ o(J.Trigger, { value: "edit", children: "Edit" }),
2045
+ /* @__PURE__ */ o(J.Trigger, { value: "preview", children: "Preview" })
1990
2046
  ] }),
1991
- /* @__PURE__ */ b(X.Content, { value: "edit", children: [
1992
- h,
1993
- /* @__PURE__ */ b(D, { children: [
2047
+ /* @__PURE__ */ g(J.Content, { value: "edit", children: [
2048
+ p,
2049
+ /* @__PURE__ */ g(V, { children: [
1994
2050
  "Add a new form field by clicking a + button. Specify options for each field, then drag and drop to rearrange them. You can see what a submitted form might look like in the",
1995
2051
  " ",
1996
- /* @__PURE__ */ r("em", { children: "Preview" }),
2052
+ /* @__PURE__ */ o("em", { children: "Preview" }),
1997
2053
  " tab, but",
1998
2054
  " ",
1999
- /* @__PURE__ */ r("strong", { children: "field values entered on this page will not be saved." })
2055
+ /* @__PURE__ */ o("strong", { children: "field values entered on this page will not be saved." })
2000
2056
  ] }),
2001
- /* @__PURE__ */ r(y, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ b("form", { id: Oe, onSubmit: a.handleSubmit, children: [
2002
- /* @__PURE__ */ b(Xe, { value: a, children: [
2057
+ /* @__PURE__ */ o(y, { asChild: !0, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ g("form", { id: Ne, onSubmit: l.handleSubmit, children: [
2058
+ /* @__PURE__ */ g(Ze, { value: l, children: [
2003
2059
  d,
2004
2060
  u,
2005
- /* @__PURE__ */ r(hn, {}),
2006
- /* @__PURE__ */ r(D, { severity: "danger", size: "1", children: typeof a.errors.fields == "string" && a.errors.fields })
2061
+ /* @__PURE__ */ o(xn, {}),
2062
+ /* @__PURE__ */ o(V, { severity: "danger", size: "1", children: typeof l.errors.fields == "string" && l.errors.fields })
2007
2063
  ] }),
2008
- /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
2009
- /* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
2010
- /* @__PURE__ */ r(G, { type: "submit", disabled: !a.isValid, children: "Save" })
2064
+ /* @__PURE__ */ g(y, { justify: "end", gap: "2", children: [
2065
+ /* @__PURE__ */ o(G, { type: "button", variant: "soft", onClick: e, children: "Cancel" }),
2066
+ /* @__PURE__ */ o(G, { type: "submit", disabled: !l.isValid, children: "Save" })
2011
2067
  ] })
2012
2068
  ] }) })
2013
2069
  ] }),
2014
- /* @__PURE__ */ r(X.Content, { value: "preview", children: /* @__PURE__ */ r(ot, { schema: f, onSubmit: xn }) })
2070
+ /* @__PURE__ */ o(J.Content, { value: "preview", children: /* @__PURE__ */ o(lt, { schema: f, onSubmit: Tn }) })
2015
2071
  ] }) });
2016
2072
  })
2017
2073
  );
2018
2074
  export {
2019
- ue as BooleanField,
2020
- Vi as BooleanInput,
2021
- We as DateField,
2022
- Di as DateInput,
2023
- Q as FieldSection,
2024
- Vn as FormBrowser,
2025
- _n as FormBuilder,
2026
- ot as FormRenderer,
2027
- kn as FormSubmissionBrowser,
2028
- Pn as FormSubmissionViewer,
2029
- Ae as MultiSelectField,
2030
- qi as MultiSelectInput,
2031
- ze as MultiStringField,
2032
- Ni as MultiStringInput,
2033
- Y as NumberField,
2034
- ki as NumberInput,
2035
- Dn as PatchField,
2036
- $n as PatchFormProvider,
2037
- Ee as SelectField,
2038
- Mi as SelectInput,
2039
- ge as StringField,
2040
- $i as StringInput,
2041
- be as TextField,
2042
- _i as TextInput,
2043
- Me as deserialize,
2044
- Lt as deserializeField,
2045
- Pt as formRevisionToSchema,
2046
- Vt as isConditionMet,
2047
- Pe as useFieldInput,
2048
- kt as useFieldInputs,
2049
- Ge as valueIsFile
2075
+ fe as BooleanField,
2076
+ _i as BooleanInput,
2077
+ He as DateField,
2078
+ Mi as DateInput,
2079
+ X as FieldSection,
2080
+ $n as FormBrowser,
2081
+ Nn as FormBuilder,
2082
+ lt as FormRenderer,
2083
+ Mn as FormSubmissionBrowser,
2084
+ _n as FormSubmissionViewer,
2085
+ ke as MultiSelectField,
2086
+ Hi as MultiSelectInput,
2087
+ Le as MultiStringField,
2088
+ Wi as MultiStringInput,
2089
+ Q as NumberField,
2090
+ $i as NumberInput,
2091
+ On as PatchField,
2092
+ Rn as PatchFormProvider,
2093
+ Pe as SelectField,
2094
+ Ni as SelectInput,
2095
+ be as StringField,
2096
+ Oi as StringInput,
2097
+ ye as TextField,
2098
+ Ri as TextInput,
2099
+ Re as deserialize,
2100
+ Vt as deserializeField,
2101
+ Dt as formRevisionToSchema,
2102
+ _t as isConditionMet,
2103
+ De as useFieldInput,
2104
+ $t as useFieldInputs,
2105
+ Ye as valueIsFile
2050
2106
  };