@overmap-ai/forms 1.0.3 → 1.0.4-form-editor-revamp.0

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