@overmap-ai/forms 1.0.3-form-improvements.5 → 1.0.3-form-improvements.7

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
@@ -2,11 +2,11 @@ var Nt = Object.defineProperty;
2
2
  var Bt = (s, i, e) => i in s ? Nt(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
3
  var m = (s, i, e) => (Bt(s, typeof i != "symbol" ? i + "" : i, e), e);
4
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";
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
6
  import { useField as Ye, useFormikContext as me, useFormik as Qe, FormikProvider as Xe } from "formik";
7
- import bi, { useMemo as w, memo as T, useCallback as S, useState as ce, useEffect as ve, useRef as yi, forwardRef as we, useReducer as vi } from "react";
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
8
  import { DragDropContext as yt, Droppable as Je, Draggable as Ze } from "@hello-pangea/dnd";
9
- import { slugify as wi, useAppSelector as $, selectFormRevision as vt, useSDK as wt, 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";
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
10
  import de from "lodash.get";
11
11
  import tt from "lodash.set";
12
12
  class Ct {
@@ -90,8 +90,8 @@ class M extends Ct {
90
90
  }
91
91
  }
92
92
  m(M, "fieldTypeName"), m(M, "fieldTypeDescription");
93
- const Pi = "_description_17zed_1", $e = {
94
- description: Pi
93
+ const Li = "_description_17zed_1", _e = {
94
+ description: Li
95
95
  }, W = (s) => {
96
96
  const { label: i, children: e, severity: t, inputId: n, labelId: o, flexProps: l } = s;
97
97
  return /* @__PURE__ */ r(y, { direction: "column", gap: "1", asChild: !0, ...l, children: /* @__PURE__ */ b("label", { htmlFor: n, children: [
@@ -102,14 +102,14 @@ const Pi = "_description_17zed_1", $e = {
102
102
  const { helpText: i, children: e, severity: t } = s;
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(D, { size: "1", severity: t, className: _e.description, children: i }) })
106
106
  ] });
107
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`, p = `${u}-label`, h = e.required ? `${e.label} *` : e.label, g = w(() => ({
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
109
  ...o,
110
110
  onChange: (F) => {
111
- const v = e.getValueFromChangeEvent(F);
112
- c.setValue(v, !1).then(), (a || !e.onlyValidateAfterTouched) && c.setError(e.getError(v));
111
+ const w = e.getValueFromChangeEvent(F);
112
+ c.setValue(w, !1).then(), (a || !e.onlyValidateAfterTouched) && c.setError(e.getError(w));
113
113
  },
114
114
  onBlur: (F) => {
115
115
  c.setTouched(!0, !1).then(), c.setError(e.getError(e.getValueFromChangeEvent(F)));
@@ -120,16 +120,16 @@ const Pi = "_description_17zed_1", $e = {
120
120
  helpText: f,
121
121
  severity: d,
122
122
  inputId: u,
123
- labelId: p,
124
- label: h,
123
+ labelId: h,
124
+ label: p,
125
125
  fieldProps: g,
126
126
  helpers: c,
127
127
  field: e
128
128
  },
129
- { ...n, "aria-labelledby": p }
129
+ { ...n, "aria-labelledby": h }
130
130
  ];
131
- }, Li = [!0, "true"], Vi = T(function(i) {
132
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = Li.includes(c.value);
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
133
  return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(
134
134
  W,
135
135
  {
@@ -180,7 +180,7 @@ const Pi = "_description_17zed_1", $e = {
180
180
  };
181
181
  m(J, "fieldTypeName", "Checkbox"), m(J, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), m(J, "Icon", Wt);
182
182
  let ue = J;
183
- const ki = T(function(i) {
183
+ const ki = S(function(i) {
184
184
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
185
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
186
  le.Input,
@@ -270,8 +270,8 @@ const ki = T(function(i) {
270
270
  }
271
271
  };
272
272
  m(B, "fieldTypeName", "Number"), m(B, "fieldTypeDescription", "Allows specifying a number within a given range."), m(B, "Icon", jt), m(B, "_validateMin", (e, t) => typeof t.maximum == "number" && typeof e == "number" && t.maximum < e ? "Minimum cannot be greater than minimum." : null), m(B, "_validateMax", (e, t) => typeof t.minimum == "number" && typeof e == "number" && t.minimum > e ? "Maximum cannot be less than minimum." : null);
273
- let Q = B;
274
- const Di = T(function(i) {
273
+ let Y = B;
274
+ const Di = S(function(i) {
275
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
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
277
  }), Z = class Z extends M {
@@ -307,7 +307,7 @@ class Ce extends M {
307
307
  static getFieldCreationSchema() {
308
308
  return [
309
309
  // min, max
310
- new Q({
310
+ new Y({
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 Q({
320
+ new Y({
321
321
  label: "Maximum length",
322
322
  description: "Maximum number of characters",
323
323
  required: !1,
@@ -365,7 +365,7 @@ m(Ce, "_validateMax", (e, t) => {
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 = T(function(i) {
368
+ const $i = S(function(i) {
369
369
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), d = fe(n);
370
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
371
  }), ee = class ee extends Ce {
@@ -385,12 +385,12 @@ const _i = T(function(i) {
385
385
  return new ee({ ...l, maxLength: t, minLength: n, inputType: o });
386
386
  }
387
387
  getInput(e) {
388
- return /* @__PURE__ */ r(_i, { field: this, ...e });
388
+ return /* @__PURE__ */ r($i, { field: this, ...e });
389
389
  }
390
390
  };
391
391
  m(ee, "fieldTypeName", "Short Text"), m(ee, "fieldTypeDescription", "Short text fields can hold up to 500 characters on a single line."), m(ee, "Icon", Ut);
392
392
  let ge = ee;
393
- const $i = T(function(i) {
393
+ const _i = S(function(i) {
394
394
  const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i);
395
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
396
  }), te = class te extends Ce {
@@ -408,16 +408,16 @@ const $i = T(function(i) {
408
408
  return new te({ ...n, maxLength: e, minLength: t });
409
409
  }
410
410
  getInput(i) {
411
- return /* @__PURE__ */ r($i, { field: this, ...i });
411
+ return /* @__PURE__ */ r(_i, { field: this, ...i });
412
412
  }
413
413
  };
414
414
  m(te, "fieldTypeName", "Paragraph"), m(te, "fieldTypeDescription", "Paragraph fields can hold up to 5000 characters and can have multiple lines."), m(te, "Icon", Kt);
415
415
  let be = te;
416
- const Mi = T(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, p = w(
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
418
  () => a.options.map((g) => ({ value: g.value, itemContent: g.label })),
419
419
  [a.options]
420
- ), h = S(
420
+ ), p = T(
421
421
  (g) => {
422
422
  d(g), u(g);
423
423
  },
@@ -426,9 +426,9 @@ const Mi = T(function(i) {
426
426
  return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
427
427
  ht,
428
428
  {
429
- items: p,
429
+ items: h,
430
430
  ...c,
431
- onValueChange: h,
431
+ onValueChange: p,
432
432
  placeholder: "Select one...",
433
433
  id: e,
434
434
  severity: n,
@@ -474,7 +474,7 @@ const St = (s, i) => {
474
474
  if (typeof s == "string" && s.length > 0)
475
475
  return s;
476
476
  const e = /* @__PURE__ */ new Date();
477
- return `${wi(i)}-${e.getTime()}`;
477
+ return `${vi(i)}-${e.getTime()}`;
478
478
  }, zt = (s, i) => {
479
479
  if (!i)
480
480
  return null;
@@ -493,35 +493,35 @@ const St = (s, i) => {
493
493
  for (; i.includes(t); )
494
494
  t = `${s} (${++e})`;
495
495
  return t;
496
- }, Ni = T(function(i) {
497
- const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c }, a] = H(i), f = fe(n), d = w(() => Array.isArray(c.value) ? c.value : [], [c.value]), { onChange: u, onBlur: p } = c, h = `${e}-droppable`, { disabled: g } = a, [x, z] = ce(""), [F, v] = ce(""), P = F || o, L = F ? "red" : f, I = S(
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
498
  (A) => {
499
- u(A), p(A);
499
+ u(A), h(A);
500
500
  },
501
- [u, p]
502
- ), V = S(
501
+ [u, h]
502
+ ), V = T(
503
503
  (A) => {
504
- d.findIndex((R) => R.value === A.target.value.trim()) >= 0 ? v("All options must be unique") : A.target.value ? v("") : v("Option cannot be empty"), z(A.target.value);
504
+ d.findIndex((R) => R.value === A.target.value.trim()) >= 0 ? w("All options must be unique") : A.target.value ? w("") : w("Option cannot be empty"), z(A.target.value);
505
505
  },
506
506
  [z, d]
507
- ), O = S(() => {
507
+ ), O = T(() => {
508
508
  if (F)
509
509
  return;
510
510
  if (!x.trim())
511
- return v("Option cannot be empty");
511
+ return w("Option cannot be empty");
512
512
  const A = x.trim();
513
513
  I([...d, { value: A, label: A }]), z("");
514
- }, [x, F, I, d]), Y = S(
514
+ }, [x, F, I, d]), K = T(
515
515
  (A) => {
516
516
  A.key === "Enter" && (A.preventDefault(), O());
517
517
  },
518
518
  [O]
519
- ), q = S(
519
+ ), q = T(
520
520
  (A) => {
521
521
  I(Se(d, A));
522
522
  },
523
523
  [d, I]
524
- ), U = S(
524
+ ), U = T(
525
525
  (A) => {
526
526
  if (!A.destination)
527
527
  return;
@@ -531,7 +531,7 @@ const St = (s, i) => {
531
531
  [I, d]
532
532
  );
533
533
  return /* @__PURE__ */ r(yt, { onDragEnd: U, children: /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
534
- /* @__PURE__ */ r(j, { helpText: P, 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: [
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
535
  /* @__PURE__ */ r(he, { grow: "1", children: /* @__PURE__ */ r(
536
536
  le.Input,
537
537
  {
@@ -540,9 +540,9 @@ const St = (s, i) => {
540
540
  ...c,
541
541
  value: x,
542
542
  onChange: V,
543
- onKeyDown: Y,
543
+ onKeyDown: K,
544
544
  id: e,
545
- color: L,
545
+ color: P,
546
546
  onBlur: void 0
547
547
  }
548
548
  ) }),
@@ -557,17 +557,17 @@ const St = (s, i) => {
557
557
  }
558
558
  )
559
559
  ] }) }) }),
560
- /* @__PURE__ */ r(Je, { droppableId: h, children: (A) => /* @__PURE__ */ b(y, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
560
+ /* @__PURE__ */ r(Je, { droppableId: p, children: (A) => /* @__PURE__ */ b(y, { ...A.droppableProps, ref: A.innerRef, direction: "column", children: [
561
561
  d.map((R, C) => /* @__PURE__ */ r(
562
562
  Ze,
563
563
  {
564
564
  draggableId: `${R.value}-draggable`,
565
565
  index: C,
566
566
  isDragDisabled: g,
567
- children: ({ draggableProps: E, dragHandleProps: _, innerRef: k }) => /* @__PURE__ */ r(
567
+ children: ({ draggableProps: E, dragHandleProps: $, innerRef: k }) => /* @__PURE__ */ r(
568
568
  y,
569
569
  {
570
- ..._,
570
+ ...$,
571
571
  ...E,
572
572
  ref: k,
573
573
  gap: "2",
@@ -691,8 +691,8 @@ const ne = class ne extends At {
691
691
  };
692
692
  m(ne, "fieldTypeName", "Dropdown"), m(ne, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), m(ne, "Icon", Qt);
693
693
  let Ee = ne;
694
- const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(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, p = w(() => Bi(c.value), [c.value]), h = S(
694
+ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = S(function(i) {
695
+ const [{ inputId: e, labelId: t, severity: n, helpText: o, label: l, fieldProps: c, field: a }, f] = H(i), { onChange: d, onBlur: u } = c, h = v(() => Bi(c.value), [c.value]), p = T(
696
696
  (g) => {
697
697
  d(g), u(g);
698
698
  },
@@ -701,8 +701,8 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(function(i) {
701
701
  return /* @__PURE__ */ r(j, { helpText: o, severity: n, children: /* @__PURE__ */ r(W, { severity: n, inputId: e, labelId: t, label: l, children: /* @__PURE__ */ r(
702
702
  Xt,
703
703
  {
704
- value: p,
705
- onValueChange: h,
704
+ value: h,
705
+ onValueChange: p,
706
706
  options: a.options,
707
707
  name: c.name,
708
708
  placeholder: "Select one or more...",
@@ -737,14 +737,14 @@ const Bi = (s) => s ? Array.isArray(s) ? s : [s] : [], qi = T(function(i) {
737
737
  };
738
738
  m(re, "fieldTypeName", "Multi-select"), m(re, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), m(re, "Icon", Jt);
739
739
  let Ae = re;
740
- const Wi = T(function({ field: i, ...e }) {
741
- const [{ value: t }] = Ye(i.options.clonedFieldIdentifier), n = w(() => {
740
+ const Wi = S(function({ field: i, ...e }) {
741
+ const [{ value: t }] = Ye(i.options.clonedFieldIdentifier), n = v(() => {
742
742
  const o = i.options.getFieldToClone(t);
743
743
  return o ? Me(o) : null;
744
744
  }, [i.options, t]);
745
- return Le(n, e);
745
+ return Pe(n, e);
746
746
  });
747
- class Pe extends M {
747
+ class Le extends M {
748
748
  constructor(e, t) {
749
749
  super({ ...e, type: "custom" });
750
750
  m(this, "Component");
@@ -760,27 +760,27 @@ class Pe extends M {
760
760
  return /* @__PURE__ */ r(t, { field: this, ...e });
761
761
  }
762
762
  }
763
- m(Pe, "fieldTypeName", "Custom"), m(Pe, "fieldTypeDescription", "Allows re-rendering of field already in the form");
764
- class ji extends Pe {
763
+ m(Le, "fieldTypeName", "Custom"), m(Le, "fieldTypeDescription", "Allows re-rendering of field already in the form");
764
+ class ji extends Le {
765
765
  constructor(i) {
766
766
  super(i, Wi);
767
767
  }
768
768
  }
769
- const Hi = T(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 = w(() => Vt(c, d), [c, d]);
771
- ve(() => {
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
772
  if (!u)
773
- for (const h of l)
774
- f(h.getId(), "").then();
773
+ for (const p of l)
774
+ f(p.getId(), "").then();
775
775
  }, [u, l, f]);
776
- const p = kt(l, t);
776
+ const h = kt(l, t);
777
777
  return u ? n ? /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
778
778
  /* @__PURE__ */ b(y, { direction: "column", children: [
779
779
  /* @__PURE__ */ r(De, { as: "h3", size: "3", children: n }),
780
- /* @__PURE__ */ r(D, { className: $e.description, children: o })
780
+ /* @__PURE__ */ r(D, { className: _e.description, children: o })
781
781
  ] }),
782
- p
783
- ] }) }) : p : null;
782
+ h
783
+ ] }) }) : h : null;
784
784
  }), oe = class oe extends Ct {
785
785
  constructor(e) {
786
786
  const { label: t = null, fields: n, condition: o = null, conditional: l, ...c } = e;
@@ -855,7 +855,7 @@ const Hi = T(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(Pt)) ?? [];
858
+ const t = ((n = e.fields) == null ? void 0 : n.map(Lt)) ?? [];
859
859
  return new oe({ ...e, fields: t });
860
860
  }
861
861
  conditional() {
@@ -883,7 +883,7 @@ const Hi = T(function(i) {
883
883
  }
884
884
  };
885
885
  m(oe, "fieldTypeName", "Section"), m(oe, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
886
- let K = oe;
886
+ let Q = oe;
887
887
  const Ui = "_previewImage_1ig84_1", Gi = {
888
888
  previewImage: Ui
889
889
  }, it = (s) => {
@@ -892,33 +892,33 @@ const Ui = "_previewImage_1ig84_1", Gi = {
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 = T(function(i) {
896
- var L;
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), p = yi(null), { value: h } = c, g = w(() => o || (a.maxFileSize ? `Maximum file size: ${it(a.maxFileSize)}` : null), [a.maxFileSize, o]), x = S(() => {
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
898
  var I;
899
- (I = p.current) == null || I.click();
900
- }, []), z = S(
899
+ (I = h.current) == null || I.click();
900
+ }, []), z = T(
901
901
  (I) => {
902
- const V = [...h];
902
+ const V = [...p];
903
903
  V.splice(I, 1), d({ target: { files: V } });
904
904
  },
905
- [h, d]
906
- ), F = h ? "Select new files" : "Select files", v = h ? "Select new file" : "Select a file", P = a.maxFiles > 1 ? F : v;
905
+ [p, d]
906
+ ), F = p ? "Select new files" : "Select files", w = p ? "Select new file" : "Select a file", L = a.maxFiles > 1 ? F : w;
907
907
  return /* @__PURE__ */ b(y, { direction: "column", gap: "2", children: [
908
908
  /* @__PURE__ */ r(j, { helpText: g, severity: n, children: /* @__PURE__ */ b(W, { severity: n, inputId: e, labelId: t, label: l, children: [
909
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
910
  /* @__PURE__ */ r(bt, {}),
911
911
  " ",
912
- P
912
+ L
913
913
  ] }) }) }),
914
914
  /* @__PURE__ */ r(
915
915
  "input",
916
916
  {
917
917
  ...f,
918
918
  type: "file",
919
- ref: p,
919
+ ref: h,
920
920
  id: e,
921
- accept: (L = a.extensions) == null ? void 0 : L.join(","),
921
+ accept: (P = a.extensions) == null ? void 0 : P.join(","),
922
922
  multiple: a.maxFiles > 1,
923
923
  color: u,
924
924
  style: { display: "none" },
@@ -927,7 +927,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
927
927
  }
928
928
  )
929
929
  ] }) }),
930
- Array.isArray(h) && h.length > 0 && /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: h.map((I, V) => /* @__PURE__ */ r(
930
+ Array.isArray(p) && p.length > 0 && /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: p.map((I, V) => /* @__PURE__ */ r(
931
931
  Yi,
932
932
  {
933
933
  field: a,
@@ -938,12 +938,12 @@ const Ui = "_previewImage_1ig84_1", Gi = {
938
938
  V
939
939
  )) })
940
940
  ] });
941
- }), Yi = T(function({ file: i, field: e, onRemove: t, disabled: n }) {
942
- const [o, l] = ce(null), c = w(() => o && e.getError([o]), [e, o]), { url: a, name: f, size: d } = w(() => {
943
- let u = null, p, h;
944
- return o != null && o.type.startsWith("image/") && (u = URL.createObjectURL(o)), o ? (p = o.name, h = it(o.size)) : (p = "Downloading...", h = "..."), { url: u, name: p, size: h };
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
945
  }, [o]);
946
- return ve(() => {
946
+ return we(() => {
947
947
  i instanceof Promise ? i.then(l) : l(i);
948
948
  }, [i]), /* @__PURE__ */ r(ye, { 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: [
@@ -984,7 +984,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
984
984
  }
985
985
  static getFieldCreationSchema() {
986
986
  return [
987
- new Q({
987
+ new Y({
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,7 +992,7 @@ const Ui = "_previewImage_1ig84_1", Gi = {
992
992
  maximum: 10,
993
993
  identifier: "maximum_files"
994
994
  }),
995
- new Q({
995
+ new Y({
996
996
  label: "What is the maximum size of each file?",
997
997
  description: "Maximum file size in bytes.",
998
998
  required: !1,
@@ -1062,21 +1062,21 @@ m(se, "fieldTypeName", "Upload"), m(se, "fieldTypeDescription", "Allows a file t
1062
1062
  let Ue = se;
1063
1063
  const nt = {
1064
1064
  date: We,
1065
- number: Q,
1065
+ number: Y,
1066
1066
  boolean: ue,
1067
1067
  select: Ee,
1068
1068
  string: ge,
1069
1069
  text: be,
1070
- custom: Pe,
1070
+ custom: Le,
1071
1071
  upload: Ue,
1072
1072
  // TODO: Underscore
1073
1073
  "multi-string": ze,
1074
1074
  "multi-select": Ae
1075
- }, Pt = (s) => {
1075
+ }, Lt = (s) => {
1076
1076
  const i = s.type;
1077
1077
  return nt[i].deserialize(s);
1078
- }, Me = (s) => s.type === "section" ? K.deserialize(s) : Pt(s);
1079
- function Lt(s, i = {}) {
1078
+ }, Me = (s) => s.type === "section" ? Q.deserialize(s) : Lt(s);
1079
+ function Pt(s, i = {}) {
1080
1080
  const { readonly: e = !1 } = i;
1081
1081
  return {
1082
1082
  title: s.title,
@@ -1102,13 +1102,13 @@ function Vt(s, i) {
1102
1102
  }
1103
1103
  return t === i;
1104
1104
  }
1105
- const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s, i) => {
1106
- const e = w(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
1105
+ const Pe = (s, i) => v(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s, i) => {
1106
+ const e = v(() => s.map((t) => /* @__PURE__ */ r("div", { children: t.getInput(i) }, t.getId())), [s, i]);
1107
1107
  return /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: e });
1108
1108
  }, Ve = (s) => Object.keys(s).length > 0, Dt = async (s, i) => {
1109
1109
  const e = {};
1110
1110
  for (const t of s.fields)
1111
- if (t instanceof K) {
1111
+ if (t instanceof Q) {
1112
1112
  if (t.condition) {
1113
1113
  const { identifier: n } = t.condition;
1114
1114
  if (!Vt(t.condition, de(i, n)))
@@ -1123,10 +1123,10 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1123
1123
  }
1124
1124
  if (Ve(e))
1125
1125
  return e;
1126
- }, Qi = [null, void 0], rt = (s, i) => s.reduce((e, t) => t instanceof K ? { ...e, ...rt(t.fields, i) } : (Qi.includes(de(e, t.getId())) && tt(e, t.getId(), ""), e), i), Xi = () => {
1126
+ }, Qi = [null, void 0], rt = (s, i) => s.reduce((e, t) => t instanceof Q ? { ...e, ...rt(t.fields, i) } : (Qi.includes(de(e, t.getId())) && tt(e, t.getId(), ""), e), i), Xi = () => {
1127
1127
  throw new Error("onSubmit must be provided if form is not readonly.");
1128
- }, ot = T(
1129
- we((s, i) => {
1128
+ }, ot = S(
1129
+ ve((s, i) => {
1130
1130
  const {
1131
1131
  schema: e,
1132
1132
  values: t = {},
@@ -1139,50 +1139,50 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1139
1139
  hideTitle: f = !e.title,
1140
1140
  hideDescription: d,
1141
1141
  className: u
1142
- } = s, { readonly: p } = e.meta, h = w(() => crypto.randomUUID(), []), g = Qe({
1142
+ } = s, { readonly: h } = e.meta, p = v(() => crypto.randomUUID(), []), g = Qe({
1143
1143
  initialValues: rt(e.fields, t),
1144
1144
  onSubmit: n,
1145
- validate: (P) => Dt(e, P),
1145
+ validate: (L) => Dt(e, L),
1146
1146
  // only validate the entire form on submit
1147
1147
  validateOnBlur: !1,
1148
1148
  validateOnChange: !1
1149
- }), { dirty: x } = g, z = w(
1149
+ }), { dirty: x } = g, z = v(
1150
1150
  () => typeof e.title == "string" ? /* @__PURE__ */ r(De, { children: e.title }) : e.title,
1151
1151
  [e.title]
1152
- ), F = w(
1153
- () => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: $e.description, children: e.description }) : e.description,
1152
+ ), F = v(
1153
+ () => typeof e.description == "string" ? /* @__PURE__ */ r(D, { className: _e.description, children: e.description }) : e.description,
1154
1154
  [e.description]
1155
- ), v = kt(e.fields, { formId: h, disabled: p });
1156
- return ve(() => {
1155
+ ), w = kt(e.fields, { formId: p, disabled: h });
1156
+ return we(() => {
1157
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: h, onSubmit: g.handleSubmit, children: [
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
1159
  !f && /* @__PURE__ */ r(ye, { children: /* @__PURE__ */ b(y, { direction: "column", gap: "1", children: [
1160
1160
  z,
1161
1161
  !d && F
1162
1162
  ] }) }),
1163
- v,
1164
- !p && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
1163
+ w,
1164
+ !h && /* @__PURE__ */ b(y, { justify: "end", gap: "2", children: [
1165
1165
  l && /* @__PURE__ */ r(G, { type: "button", variant: "soft", onClick: c, children: l }),
1166
1166
  /* @__PURE__ */ r(G, { type: "submit", disabled: !g.isValid, children: o })
1167
1167
  ] })
1168
1168
  ] }) }) });
1169
1169
  })
1170
- ), Ln = T(
1171
- we((s, i) => {
1172
- const { submission: e, showFormDescription: t = !1, showFormTitle: n = !0 } = s, o = $(vt(e.form_revision)), { sdk: l } = wt();
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
1173
  if (!o)
1174
1174
  throw new Error(
1175
1175
  `Could not find revision ${e.form_revision} for submission ${e.offline_id}.`
1176
1176
  );
1177
- const c = w(() => Lt(o, { readonly: !0 }), [o]), a = w(() => {
1177
+ const c = v(() => Pt(o, { readonly: !0 }), [o]), a = v(() => {
1178
1178
  const f = xi(e.offline_id)(l.store.getState()) ?? [], d = {};
1179
1179
  for (const u of f) {
1180
- const p = l.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
1180
+ const h = l.files.fetchFileFromUrl(u.file, u.file_sha1, u.file_name).then((g) => {
1181
1181
  if (!g.success)
1182
1182
  throw new Error(`Failed to download attachment ${u.file_name}.`);
1183
1183
  return g.body;
1184
- }), h = d[u.field_identifier];
1185
- h ? h.push(p) : d[u.field_identifier] = [p];
1184
+ }), p = d[u.field_identifier];
1185
+ p ? p.push(h) : d[u.field_identifier] = [h];
1186
1186
  }
1187
1187
  return { ...e.values, ...d };
1188
1188
  }, [l.files, l.store, e.offline_id, e.values]);
@@ -1200,35 +1200,35 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1200
1200
  ), Ji = "_favoriteIcon_1bixi_1", Zi = "_regularIcon_1bixi_9", ct = {
1201
1201
  favoriteIcon: Ji,
1202
1202
  regularIcon: Zi
1203
- }, Ne = "organization:", Be = "user:", Vn = T(
1204
- we((s, i) => {
1205
- const { maxResults: e = 20, ...t } = s, [n, o] = ce(""), [l, c] = ce(""), { sdk: a } = wt(), f = w(() => {
1206
- const v = { maxResults: e, searchTerm: n };
1207
- return l && (l.startsWith(Ne) ? v.owner_organization = parseInt(l.slice(Ne.length)) : l.startsWith(Be) && (v.owner_user = parseInt(l.slice(Be.length)))), v;
1208
- }, [n, e, l]), d = $(Ii(f)) ?? [], u = $(Fi), p = S(
1209
- (v) => {
1210
- v.favorite ? a.userForms.unfavorite(v.offline_id).then() : a.userForms.favorite(v.offline_id).then();
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(() => {
1206
+ const w = { maxResults: e, searchTerm: n };
1207
+ return l && (l.startsWith(Ne) ? w.owner_organization = parseInt(l.slice(Ne.length)) : l.startsWith(Be) && (w.owner_user = parseInt(l.slice(Be.length)))), w;
1208
+ }, [n, e, l]), d = _(Ii(f)) ?? [], u = _(Fi), h = T(
1209
+ (w) => {
1210
+ w.favorite ? a.userForms.unfavorite(w.offline_id).then() : a.userForms.favorite(w.offline_id).then();
1211
1211
  },
1212
1212
  [a]
1213
- ), h = w(() => {
1214
- const v = a.store.getState(), P = {};
1215
- for (const L of Object.values(u)) {
1216
- const I = xt(L.owner_organization || -1)(v);
1217
- I && (P[`${Ne}${I.id}`] = I.name);
1218
- const V = et(L.owner_user || -1)(v);
1219
- V && (P[`${Be}${V.id}`] = V.username);
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);
1220
1220
  }
1221
- return Object.entries(P).map(([L, I]) => ({ itemContent: I, value: L }));
1222
- }, [u, a.store]), g = S((v) => {
1223
- o(v.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(L).map(([P, I]) => ({ itemContent: I, value: P }));
1222
+ }, [u, a.store]), g = T((w) => {
1223
+ o(w.currentTarget.value);
1224
+ }, []), z = (_(Ci) || 0) - d.length, F = d.length == e && z > 0 ? `Only the first ${e} results are shown (${z} hidden)` : z > 0 && `${z} hidden forms`;
1225
1225
  return /* @__PURE__ */ b(y, { ref: i, direction: "column", gap: "2", children: [
1226
1226
  /* @__PURE__ */ b(y, { gap: "2", grow: "1", children: [
1227
1227
  /* @__PURE__ */ r(he, { grow: "1", asChild: !0, children: /* @__PURE__ */ r(le.Root, { size: "3", children: /* @__PURE__ */ r(le.Input, { placeholder: "Filter", value: n, onChange: g }) }) }),
1228
1228
  /* @__PURE__ */ r(
1229
1229
  ht,
1230
1230
  {
1231
- items: h,
1231
+ items: p,
1232
1232
  value: l,
1233
1233
  onValueChange: c,
1234
1234
  placeholder: "Owner",
@@ -1236,26 +1236,26 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1236
1236
  }
1237
1237
  )
1238
1238
  ] }),
1239
- d.length > 0 && /* @__PURE__ */ r(_e.Root, { children: d.map((v) => /* @__PURE__ */ r(
1239
+ d.length > 0 && /* @__PURE__ */ r($e.Root, { children: d.map((w) => /* @__PURE__ */ r(
1240
1240
  en,
1241
1241
  {
1242
1242
  ...t,
1243
- form: v,
1244
- handleToggleFavorite: () => p(v)
1243
+ form: w,
1244
+ handleToggleFavorite: () => h(w)
1245
1245
  },
1246
- v.offline_id
1246
+ w.offline_id
1247
1247
  )) }),
1248
1248
  /* @__PURE__ */ r(he, { px: "3", children: /* @__PURE__ */ r(D, { size: "2", severity: "info", children: F }) })
1249
1249
  ] });
1250
1250
  })
1251
1251
  ), en = (s) => {
1252
- var p;
1253
- const { form: i, onSelectForm: e, isFavoriteEditable: t, handleToggleFavorite: n } = s, o = (p = $(xt(i.owner_organization || -1))) == null ? void 0 : p.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 = S(
1254
- (h) => {
1255
- h.stopPropagation(), n();
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();
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
+ ), u = /* @__PURE__ */ r($e.Item, { onClick: () => e(i), asChild: !0, children: /* @__PURE__ */ b(y, { justify: "between", gap: "2", py: "2", px: "3", ...Zt, children: [
1259
1259
  /* @__PURE__ */ b(y, { grow: "1", align: "center", gap: "2", children: [
1260
1260
  /* @__PURE__ */ r(
1261
1261
  ae,
@@ -1278,29 +1278,29 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1278
1278
  ] })
1279
1279
  ] }) });
1280
1280
  return i.latestRevision.description ? /* @__PURE__ */ r(ri, { content: i.latestRevision.description, children: u }, i.offline_id) : u;
1281
- }, tn = "_submissionsContainer_9iirt_1", nn = "_stopHorizontalOverflow_9iirt_6", _t = {
1281
+ }, tn = "_submissionsContainer_9iirt_1", nn = "_stopHorizontalOverflow_9iirt_6", $t = {
1282
1282
  submissionsContainer: tn,
1283
1283
  stopHorizontalOverflow: nn
1284
- }, rn = T(function(i) {
1285
- var v;
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([], {
1284
+ }, rn = S(function(i) {
1285
+ var w;
1286
+ const { submission: e, onSubmissionClick: t, compact: n, labelType: o, rowDecorator: l } = i, c = _(It), a = _(et("created_by" in e ? e.created_by : c.id)), f = Ke(e), d = Ti(f) ? f.toLocaleTimeString([], {
1287
1287
  hour: "2-digit",
1288
1288
  minute: "2-digit"
1289
- }) : Si(f), u = $(vt(e.form_revision));
1289
+ }) : Si(f), u = _(wt(e.form_revision));
1290
1290
  if (!u)
1291
1291
  throw new Error(`Could not find revision ${e.form_revision} for submission ${e.offline_id}.`);
1292
- const p = (v = $(zi(u.form))) == null ? void 0 : v.revision, h = Ei({
1292
+ const h = (w = _(zi(u.form))) == null ? void 0 : w.revision, p = Ei({
1293
1293
  file: (a == null ? void 0 : a.profile.file) ?? null,
1294
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 === p, z = bi.useCallback(() => {
1295
+ }), g = (a == null ? void 0 : a.username.charAt(0).toUpperCase()) ?? "?", x = u.revision === h, z = bi.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: h, size: "1", fallback: g }),
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
1300
  /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: o === "creator" ? (a || c).username : u.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}` }) : !!p && /* @__PURE__ */ r(qe, { children: "Original" })),
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
1304
  /* @__PURE__ */ r(D, { size: "2", noWrap: !0, children: d })
1305
1305
  ] })
1306
1306
  ] }) });
@@ -1308,7 +1308,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1308
1308
  }), Ke = (s) => {
1309
1309
  const i = "created_at" in s ? s.created_at : s.submitted_at;
1310
1310
  return new Date(i);
1311
- }, kn = T(function(i) {
1311
+ }, kn = S(function(i) {
1312
1312
  const {
1313
1313
  formId: e,
1314
1314
  submissions: t,
@@ -1320,16 +1320,16 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
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 = $(
1323
+ const f = _(
1324
1324
  t ? () => t : Ai(e)
1325
- ), d = w(
1326
- () => f == null ? void 0 : f.sort((u, p) => Ke(p).getTime() - Ke(u).getTime()),
1325
+ ), d = v(
1326
+ () => f == null ? void 0 : f.sort((u, h) => Ke(h).getTime() - Ke(u).getTime()),
1327
1327
  [f]
1328
1328
  );
1329
1329
  return /* @__PURE__ */ r(
1330
- _e.Root,
1330
+ $e.Root,
1331
1331
  {
1332
- className: Ft(_t.submissionsContainer, o),
1332
+ className: Ft($t.submissionsContainer, o),
1333
1333
  size: "small",
1334
1334
  variant: c,
1335
1335
  before: !n && /* @__PURE__ */ b(D, { severity: "info", children: [
@@ -1338,20 +1338,20 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1338
1338
  " submissions of this form."
1339
1339
  ] }),
1340
1340
  after: l,
1341
- children: d == null ? void 0 : d.map((u, p) => /* @__PURE__ */ r(
1341
+ children: d == null ? void 0 : d.map((u, h) => /* @__PURE__ */ r(
1342
1342
  rn,
1343
1343
  {
1344
1344
  submission: u,
1345
1345
  compact: n,
1346
1346
  ...a
1347
1347
  },
1348
- p
1348
+ h
1349
1349
  ))
1350
1350
  }
1351
1351
  );
1352
- }), Dn = T(function(i) {
1352
+ }), Dn = S(function(i) {
1353
1353
  const { name: e, render: t } = i, { submitForm: n } = me(), [o, l, c] = Ye(e);
1354
- return w(() => {
1354
+ return v(() => {
1355
1355
  const a = (f) => c.setValue(f, !1);
1356
1356
  return t({
1357
1357
  value: o.value,
@@ -1359,9 +1359,9 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1359
1359
  patchValue: n
1360
1360
  });
1361
1361
  }, [n, c, o.value, t]);
1362
- }), _n = T(
1363
- we((s, i) => {
1364
- const { children: e, schema: t, values: n, onPatch: o, onError: l, ...c } = s, a = w(() => rt(t.fields, n), [t.fields, n]), f = S(
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(
1365
1365
  (g) => {
1366
1366
  const x = {};
1367
1367
  for (const z in g) {
@@ -1371,7 +1371,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1371
1371
  Ve(x) && o(x);
1372
1372
  },
1373
1373
  [a, o]
1374
- ), d = S(
1374
+ ), d = T(
1375
1375
  async (g) => {
1376
1376
  const x = await Dt(t, g);
1377
1377
  return x && l(x), x;
@@ -1384,15 +1384,15 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1384
1384
  // only validate the entire form on submit
1385
1385
  validateOnBlur: !1,
1386
1386
  validateOnChange: !1
1387
- }), { errors: p, resetForm: h } = u;
1388
- return ve(() => {
1389
- Ve(p) && h({ values: a, errors: {} });
1390
- }, [p, a, h]), /* @__PURE__ */ r(Xe, { value: u, children: /* @__PURE__ */ r("form", { ...c, ref: i, onSubmit: u.handleSubmit, children: e }) });
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 }) });
1391
1391
  })
1392
- ), $t = {
1392
+ ), _t = {
1393
1393
  ...nt,
1394
- section: K
1395
- }, on = T(function(i) {
1394
+ section: Q
1395
+ }, on = S(function(i) {
1396
1396
  const { field: e, setFieldType: t } = i, n = e.fieldTypeName, o = e.fieldTypeDescription, l = e.Icon;
1397
1397
  return /* @__PURE__ */ b(y, { gap: "4", align: "center", children: [
1398
1398
  /* @__PURE__ */ r(G, { type: "button", variant: "surface", onClick: t, style: { width: "135px" }, children: /* @__PURE__ */ b(y, { gap: "3", align: "center", grow: "1", children: [
@@ -1405,7 +1405,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1405
1405
  ["string", "text"],
1406
1406
  ["select", "multi-select", "upload"],
1407
1407
  ["boolean", "date", "number", "multi-string"]
1408
- ], sn = Mt.length - 1, ln = T(function(i) {
1408
+ ], sn = Mt.length - 1, ln = S(function(i) {
1409
1409
  const { setFieldType: e } = i;
1410
1410
  return /* @__PURE__ */ r(y, { direction: "column", gap: "3", children: Mt.map((t, n) => /* @__PURE__ */ b(y, { direction: "column", gap: "3", children: [
1411
1411
  /* @__PURE__ */ r(y, { direction: "column", gap: "2", children: t.map((o) => /* @__PURE__ */ r(
@@ -1419,7 +1419,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1419
1419
  n < sn && /* @__PURE__ */ r(si, { size: "4" })
1420
1420
  ] }, n)) });
1421
1421
  }), an = (s) => (i) => {
1422
- if (console.log("in validate", s, i), !(!i || typeof i != "string") && s.includes(i.trim()))
1422
+ if (!(!i || typeof i != "string") && s.includes(i.trim()))
1423
1423
  return "This name is already taken.";
1424
1424
  }, cn = (s, i) => {
1425
1425
  const e = [
@@ -1441,19 +1441,17 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1441
1441
  ...e,
1442
1442
  new ue({ label: "Required", description: null, required: !1, identifier: "required" })
1443
1443
  ];
1444
- }, dn = T(function(i) {
1445
- const { fieldType: e, handleCancel: t, handleCreateField: n, defaultField: o, conditionalSourceFields: l } = i, c = $t[e];
1446
- console.log("default field", o);
1447
- const a = me(), f = w(() => {
1448
- const d = Et(a.values.fields).filter((p) => p !== (o == null ? void 0 : o.label));
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));
1449
1447
  let u = cn(d, e);
1450
- if (console.log("first set of errors", c, K, l), c === K) {
1448
+ if (c === Q) {
1451
1449
  if (l === void 0)
1452
1450
  throw new Error("Conditional source fields must be provided when changing sections.");
1453
1451
  u = u.concat(c.getFieldCreationSchema(l));
1454
1452
  } else {
1455
1453
  if (!(c.prototype instanceof M))
1456
- throw console.log("badinstance"), new Error(`Field must be an instance of BaseField. Got ${c}.`);
1454
+ throw new Error(`Field must be an instance of BaseField. Got ${c}.`);
1457
1455
  u = [...u, ...c.getFieldCreationSchema()];
1458
1456
  }
1459
1457
  return {
@@ -1473,51 +1471,51 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1473
1471
  onCancel: t
1474
1472
  }
1475
1473
  );
1476
- }), pe = T(function(i) {
1477
- 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: p, values: h } = me();
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();
1478
1476
  if (l && !o)
1479
1477
  throw new Error("Initial field must be provided if editing is true.");
1480
- 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 = S(() => f(void 0), []), v = S((I) => {
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) => {
1481
1479
  f(void 0), I();
1482
- }, []), P = S(
1480
+ }, []), L = T(
1483
1481
  (I, V) => {
1484
1482
  const { label: O } = I;
1485
1483
  if (!d)
1486
1484
  throw new Error("Field type must be selected before creating a field.");
1487
1485
  if (!O || typeof O != "string")
1488
1486
  throw new Error("Label must be provided before creating a field.");
1489
- const Y = Me({
1487
+ const K = Me({
1490
1488
  type: d,
1491
1489
  ...I,
1492
1490
  identifier: St(I.identifier, O)
1493
- }).serialize(), q = de(h, e);
1491
+ }).serialize(), q = de(p, e);
1494
1492
  if (q === void 0)
1495
1493
  throw new Error("Parent path must point to an existing field.");
1496
1494
  let U;
1497
1495
  if (!Array.isArray(q))
1498
1496
  throw new Error("Parent path must point to an array.");
1499
- l ? U = Ri(q, t, Y) : U = Tt(q, t, Y), p(e, U).then(), V();
1497
+ l ? U = Ri(q, t, K) : U = Tt(q, t, K), h(e, U).then(), V();
1500
1498
  },
1501
- [l, d, h, e, p, t]
1502
- ), L = S(
1499
+ [l, d, p, e, h, t]
1500
+ ), P = T(
1503
1501
  (I) => g ? /* @__PURE__ */ r(ln, { setFieldType: f }) : /* @__PURE__ */ r(
1504
1502
  dn,
1505
1503
  {
1506
1504
  conditionalSourceFields: c,
1507
1505
  handleCancel: F,
1508
- handleCreateField: (V) => P(V, I),
1506
+ handleCreateField: (V) => L(V, I),
1509
1507
  fieldType: d,
1510
1508
  defaultField: o
1511
1509
  }
1512
1510
  ),
1513
- [c, F, P, o, g, d]
1511
+ [c, F, L, o, g, d]
1514
1512
  );
1515
- return /* @__PURE__ */ r(li, { onCloseInterrupt: v, title: x, description: z, content: L, children: n });
1513
+ return /* @__PURE__ */ r(li, { onCloseInterrupt: w, title: x, description: z, content: P, children: n });
1516
1514
  }), dt = ({ children: s }) => /* @__PURE__ */ r(pt, { children: s }), ut = (s, i) => ({
1517
1515
  initial: s ? i : "none",
1518
1516
  sm: s ? "none" : i
1519
- }), Ot = T(function(i) {
1520
- const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o, duplicateProps: l } = i, c = w(
1517
+ }), Ot = S(function(i) {
1518
+ const { remove: e, dragHandleProps: t, editProps: n, insertAfterProps: o, duplicateProps: l } = i, c = v(
1521
1519
  () => [
1522
1520
  {
1523
1521
  Wrapper: pe,
@@ -1583,10 +1581,15 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1583
1581
  }
1584
1582
  ) })
1585
1583
  ] });
1586
- }), Oe = "form-builder", un = T(function(i) {
1587
- const { field: e, index: t, sectionIndex: n, takenLabels: o, remove: l } = i, c = w(() => Me(e), [e]), a = Le(c, { formId: Oe, disabled: !0 });
1588
- console.log(e, t, n, c);
1589
- const f = w(
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: "" };
1590
+ },
1591
+ [o]
1592
+ ), d = v(
1590
1593
  () => ({
1591
1594
  index: t,
1592
1595
  parentPath: `fields.${n}.fields`,
@@ -1594,14 +1597,14 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1594
1597
  editing: !0
1595
1598
  }),
1596
1599
  [e, t, n]
1597
- ), d = w(
1600
+ ), u = v(
1598
1601
  () => ({
1599
1602
  parentPath: `fields.${n}.fields`,
1600
1603
  index: t + 1,
1601
- initial: { ...e, label: He(e.label ?? "", o), identifier: "" }
1604
+ initial: f(e)
1602
1605
  }),
1603
- [e, t, n, o]
1604
- ), u = w(
1606
+ [f, e, t, n]
1607
+ ), h = v(
1605
1608
  () => ({
1606
1609
  parentPath: `fields.${n}.fields`,
1607
1610
  index: t + 1,
@@ -1622,47 +1625,45 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1622
1625
  Ot,
1623
1626
  {
1624
1627
  remove: l,
1625
- editProps: f,
1626
- duplicateProps: d,
1627
- insertAfterProps: u,
1628
+ editProps: d,
1629
+ duplicateProps: u,
1630
+ insertAfterProps: h,
1628
1631
  dragHandleProps: p.dragHandleProps
1629
1632
  }
1630
1633
  )
1631
1634
  ] })
1632
1635
  }
1633
1636
  ) });
1634
- }), fn = T(function(i) {
1635
- var V, O, Y, q, U, A, R;
1636
- 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);
1637
- console.log("field section", e, t, c);
1638
- const d = S(
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(
1639
1640
  (C, E) => {
1640
- for (const _ of C) {
1641
- const k = E.indexOf(_);
1641
+ for (const $ of C) {
1642
+ const k = E.indexOf($);
1642
1643
  l(`fields.${k}.condition`, null).then(), l(`fields.${k}.conditional`, !1).then();
1643
1644
  }
1644
1645
  },
1645
1646
  [l]
1646
- ), u = S(
1647
+ ), u = T(
1647
1648
  (C) => {
1648
1649
  var k;
1649
1650
  const E = e.fields[C];
1650
1651
  if (!E)
1651
1652
  throw new Error("Could not find field to remove.");
1652
- const _ = [];
1653
+ const $ = [];
1653
1654
  for (const N of c.fields)
1654
- ((k = N.condition) == null ? void 0 : k.identifier) === E.identifier && _.push(N);
1655
+ ((k = N.condition) == null ? void 0 : k.identifier) === E.identifier && $.push(N);
1655
1656
  return {
1656
1657
  removing: E,
1657
- affectedSections: _,
1658
+ affectedSections: $,
1658
1659
  action: () => l(`fields.${t}.fields`, Se(e.fields, C))
1659
1660
  };
1660
1661
  },
1661
1662
  [e.fields, c.fields, l, t]
1662
- ), p = S(
1663
+ ), h = T(
1663
1664
  (C) => {
1664
- const { affectedSections: E, action: _, removing: k } = u(C), N = () => {
1665
- _().then(), d(E, c.fields);
1665
+ const { affectedSections: E, action: $, removing: k } = u(C), N = () => {
1666
+ $().then(), d(E, c.fields);
1666
1667
  };
1667
1668
  if (E.length > 0) {
1668
1669
  const Re = E.map((xe) => xe.label).join(", ");
@@ -1677,11 +1678,11 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1677
1678
  N();
1678
1679
  },
1679
1680
  [u, d, c.fields, a]
1680
- ), h = S(() => {
1681
- 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);
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);
1682
1683
  if (E.length > 0)
1683
1684
  return a({
1684
- title: _,
1685
+ title: $,
1685
1686
  description: Re,
1686
1687
  severity: "danger",
1687
1688
  actionText: "Remove",
@@ -1700,9 +1701,11 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1700
1701
  l,
1701
1702
  a,
1702
1703
  d
1703
- ]), g = S(
1704
+ ]), g = T(
1704
1705
  (C) => {
1705
- const E = He(C.label ?? "", f), _ = C.fields.map((k) => {
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) => {
1706
1709
  const N = He(k.label, f);
1707
1710
  return {
1708
1711
  ...k,
@@ -1710,10 +1713,10 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1710
1713
  identifier: St(void 0, N)
1711
1714
  };
1712
1715
  });
1713
- return { ...C, label: E, fields: _, identifier: "" };
1716
+ return { ...C, label: E, fields: $, identifier: "" };
1714
1717
  },
1715
1718
  [f]
1716
- ), x = w(
1719
+ ), x = v(
1717
1720
  () => ({
1718
1721
  index: t,
1719
1722
  parentPath: "fields",
@@ -1722,7 +1725,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1722
1725
  conditionalSourceFields: Fe(c.fields, t)
1723
1726
  }),
1724
1727
  [e, t, c.fields]
1725
- ), z = w(
1728
+ ), z = v(
1726
1729
  () => ({
1727
1730
  index: t + 1,
1728
1731
  parentPath: "fields",
@@ -1730,14 +1733,14 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1730
1733
  conditionalSourceFields: Fe(c.fields, t + 1)
1731
1734
  }),
1732
1735
  [t, c.fields]
1733
- ), F = w(
1736
+ ), F = v(
1734
1737
  () => ({
1735
1738
  parentPath: `fields.${t}.fields`,
1736
1739
  index: e.fields.length,
1737
1740
  initial: void 0
1738
1741
  }),
1739
1742
  [e.fields.length, t]
1740
- ), v = w(
1743
+ ), w = v(
1741
1744
  () => ({
1742
1745
  index: t + 1,
1743
1746
  parentPath: "fields",
@@ -1745,13 +1748,13 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1745
1748
  conditionalSourceFields: Fe(c.fields, t + 1)
1746
1749
  }),
1747
1750
  [g, e, t, c.fields]
1748
- ), P = w(
1751
+ ), L = v(
1749
1752
  () => {
1750
1753
  var C, E;
1751
1754
  return (E = zt(c.fields, (C = e.condition) == null ? void 0 : C.identifier)) == null ? void 0 : E.label;
1752
1755
  },
1753
1756
  [(O = e.condition) == null ? void 0 : O.identifier, c.fields]
1754
- ), L = Array.isArray((Y = e.condition) == null ? void 0 : Y.value) ? "contains all of" : "equals";
1757
+ ), P = Array.isArray((K = e.condition) == null ? void 0 : K.value) ? "contains all of" : "equals";
1755
1758
  if (Ge((q = e.condition) == null ? void 0 : q.value))
1756
1759
  throw new Error("File values are not supported for conditions.");
1757
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();
@@ -1766,13 +1769,13 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1766
1769
  /* @__PURE__ */ b(y, { direction: "column", gap: "2", grow: "1", children: [
1767
1770
  /* @__PURE__ */ b(y, { direction: "column", children: [
1768
1771
  /* @__PURE__ */ r(De, { as: "h3", size: "3", children: e.label }),
1769
- /* @__PURE__ */ r(D, { className: $e.description, children: e.description })
1772
+ /* @__PURE__ */ r(D, { className: _e.description, children: e.description })
1770
1773
  ] }),
1771
1774
  e.condition && /* @__PURE__ */ r(D, { size: "1", children: /* @__PURE__ */ b(hi, { children: [
1772
1775
  "Display only if ",
1773
- /* @__PURE__ */ r(lt, { children: P }),
1776
+ /* @__PURE__ */ r(lt, { children: L }),
1774
1777
  " ",
1775
- L,
1778
+ P,
1776
1779
  " ",
1777
1780
  /* @__PURE__ */ r(lt, { children: I })
1778
1781
  ] }) }),
@@ -1784,16 +1787,16 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1784
1787
  direction: "column",
1785
1788
  gap: "0",
1786
1789
  children: [
1787
- e.fields.map((_, k) => /* @__PURE__ */ r(
1790
+ e.fields.map(($, k) => /* @__PURE__ */ r(
1788
1791
  un,
1789
1792
  {
1790
- field: _,
1793
+ field: $,
1791
1794
  index: k,
1792
1795
  sectionIndex: t,
1793
- remove: () => p(k),
1796
+ remove: () => h(k),
1794
1797
  takenLabels: f
1795
1798
  },
1796
- _.identifier
1799
+ $.identifier
1797
1800
  )),
1798
1801
  E.placeholder,
1799
1802
  /* @__PURE__ */ r(pe, { ...F, children: /* @__PURE__ */ b(G, { type: "button", variant: "outline", children: [
@@ -1807,11 +1810,11 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1807
1810
  /* @__PURE__ */ r(
1808
1811
  Ot,
1809
1812
  {
1810
- remove: h,
1813
+ remove: p,
1811
1814
  insertAfterProps: z,
1812
1815
  dragHandleProps: C.dragHandleProps,
1813
1816
  editProps: x,
1814
- duplicateProps: v
1817
+ duplicateProps: w
1815
1818
  }
1816
1819
  )
1817
1820
  ] })
@@ -1863,36 +1866,36 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1863
1866
  for (const [e, t] of Object.entries(s))
1864
1867
  if (t.identifier === i)
1865
1868
  return [t, e];
1866
- }, hn = T(function() {
1867
- const { values: i, setFieldValue: e } = me(), [t, n] = vi(mn, i.fields, ft), { showInfo: o } = gi();
1868
- ve(() => {
1869
+ }, hn = S(function() {
1870
+ const { values: i, setFieldValue: e } = me(), [t, n] = wi(mn, i.fields, ft), { showInfo: o } = gi();
1871
+ we(() => {
1869
1872
  n({ type: "update", state: ft(i.fields) });
1870
1873
  }, [n, i.fields]);
1871
- const l = S((f) => {
1874
+ const l = T((f) => {
1872
1875
  f.type === "SECTION" && n({ type: "hold", fieldId: f.draggableId });
1873
- }, []), c = S(
1876
+ }, []), c = T(
1874
1877
  (f) => {
1875
- const { source: d, destination: u, type: p, reason: h, draggableId: g } = f;
1876
- if (n({ type: "release" }), !u || h === "CANCEL")
1878
+ const { source: d, destination: u, type: h, reason: p, draggableId: g } = f;
1879
+ if (n({ type: "release" }), !u || p === "CANCEL")
1877
1880
  return;
1878
- if (p === "ROOT") {
1879
- const P = t[g];
1880
- if (!P)
1881
+ if (h === "ROOT") {
1882
+ const L = t[g];
1883
+ if (!L)
1881
1884
  throw new Error("Could not find section context.");
1882
- let L = typeof P.conditionIndex < "u" ? (
1885
+ let P = typeof L.conditionIndex < "u" ? (
1883
1886
  // cannot move a section with a condition before the condition's field
1884
- Math.max(P.conditionIndex + 1, u.index)
1887
+ Math.max(L.conditionIndex + 1, u.index)
1885
1888
  ) : u.index;
1886
1889
  for (const I of Object.values(t))
1887
- I.conditionIndex === d.index && (L = Math.min(L, I.index - 1));
1888
- return L != u.index && o({
1890
+ I.conditionIndex === d.index && (P = Math.min(P, I.index - 1));
1891
+ return P != u.index && o({
1889
1892
  title: "Reordered sections",
1890
1893
  description: "Sections with conditions must be below the fields they reference."
1891
- }), e("fields", je(i.fields, d.index, L));
1894
+ }), e("fields", je(i.fields, d.index, P));
1892
1895
  }
1893
- if (p !== "SECTION")
1896
+ if (h !== "SECTION")
1894
1897
  throw new Error("Unexpected droppable type.");
1895
- const [x, z] = mt(i.fields, d.droppableId) ?? [], [F, v] = mt(i.fields, u.droppableId) ?? [];
1898
+ const [x, z] = mt(i.fields, d.droppableId) ?? [], [F, w] = mt(i.fields, u.droppableId) ?? [];
1896
1899
  if (!(x != null && x.fields) || !F)
1897
1900
  throw new Error("Could not find section with fields.");
1898
1901
  if (x.identifier === F.identifier)
@@ -1901,17 +1904,17 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1901
1904
  je(x.fields, d.index, u.index)
1902
1905
  ).then();
1903
1906
  else {
1904
- const P = x.fields[d.index];
1905
- if (!P)
1907
+ const L = x.fields[d.index];
1908
+ if (!L)
1906
1909
  throw new Error("Could not find field to reorder.");
1907
1910
  e(`fields.${z}.fields`, Se(x.fields, d.index)).then(), e(
1908
- `fields.${v}.fields`,
1909
- Tt(F.fields, u.index, P)
1911
+ `fields.${w}.fields`,
1912
+ Tt(F.fields, u.index, L)
1910
1913
  ).then();
1911
1914
  }
1912
1915
  },
1913
1916
  [i.fields, e, t, o]
1914
- ), a = w(
1917
+ ), a = v(
1915
1918
  () => ({
1916
1919
  index: i.fields.length,
1917
1920
  parentPath: "fields",
@@ -1955,28 +1958,28 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1955
1958
  maxLength: 100,
1956
1959
  required: !0,
1957
1960
  identifier: "title"
1958
- }), yn = { formId: Oe, placeholder: "Give your form a title." }, vn = new be({
1961
+ }), yn = { formId: Oe, placeholder: "Give your form a title." }, wn = new be({
1959
1962
  label: "Description",
1960
1963
  minLength: 0,
1961
1964
  maxLength: 1e3,
1962
1965
  required: !1,
1963
1966
  identifier: "description"
1964
- }), wn = { formId: Oe, placeholder: "Explain the purpose of this form." }, xn = () => {
1967
+ }), vn = { formId: Oe, placeholder: "Explain the purpose of this form." }, xn = () => {
1965
1968
  alert("This is a form preview, your data will not be saved.");
1966
- }, $n = T(
1967
- we((s, i) => {
1968
- const { onCancel: e, onSave: t, revision: n } = s, o = n ? "Edit form" : "Create a new form", { heading: l = o } = s, c = S((h) => {
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) => {
1969
1972
  const g = {};
1970
- if (h.title || (g.title = "Title is required."), (!h.fields || h.fields.length === 0) && (g.fields = "At least one field is required."), Ve(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))
1971
1974
  return g;
1972
1975
  }, []), a = Qe({
1973
1976
  initialValues: Oi(n) ?? gn,
1974
1977
  validate: c,
1975
- onSubmit: (h) => t(h),
1978
+ onSubmit: (p) => t(p),
1976
1979
  // only validate the entire for on submit
1977
1980
  validateOnChange: !1,
1978
1981
  validateOnBlur: !1
1979
- }), f = w(() => Lt(a.values), [a.values]), d = Le(bn, yn), u = Le(vn, wn), p = w(
1982
+ }), f = v(() => Pt(a.values), [a.values]), d = Pe(bn, yn), u = Pe(wn, vn), h = v(
1980
1983
  () => typeof l == "object" ? l : /* @__PURE__ */ r(De, { children: l }),
1981
1984
  [l]
1982
1985
  );
@@ -1986,7 +1989,7 @@ const Le = (s, i) => w(() => !i || !s ? null : s.getInput(i), [s, i]), kt = (s,
1986
1989
  /* @__PURE__ */ r(X.Trigger, { value: "preview", children: "Preview" })
1987
1990
  ] }),
1988
1991
  /* @__PURE__ */ b(X.Content, { value: "edit", children: [
1989
- p,
1992
+ h,
1990
1993
  /* @__PURE__ */ b(D, { children: [
1991
1994
  "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",
1992
1995
  " ",
@@ -2017,31 +2020,31 @@ export {
2017
2020
  Vi as BooleanInput,
2018
2021
  We as DateField,
2019
2022
  Di as DateInput,
2020
- K as FieldSection,
2023
+ Q as FieldSection,
2021
2024
  Vn as FormBrowser,
2022
- $n as FormBuilder,
2025
+ _n as FormBuilder,
2023
2026
  ot as FormRenderer,
2024
2027
  kn as FormSubmissionBrowser,
2025
- Ln as FormSubmissionViewer,
2028
+ Pn as FormSubmissionViewer,
2026
2029
  Ae as MultiSelectField,
2027
2030
  qi as MultiSelectInput,
2028
2031
  ze as MultiStringField,
2029
2032
  Ni as MultiStringInput,
2030
- Q as NumberField,
2033
+ Y as NumberField,
2031
2034
  ki as NumberInput,
2032
2035
  Dn as PatchField,
2033
- _n as PatchFormProvider,
2036
+ $n as PatchFormProvider,
2034
2037
  Ee as SelectField,
2035
2038
  Mi as SelectInput,
2036
2039
  ge as StringField,
2037
- _i as StringInput,
2040
+ $i as StringInput,
2038
2041
  be as TextField,
2039
- $i as TextInput,
2042
+ _i as TextInput,
2040
2043
  Me as deserialize,
2041
- Pt as deserializeField,
2042
- Lt as formRevisionToSchema,
2044
+ Lt as deserializeField,
2045
+ Pt as formRevisionToSchema,
2043
2046
  Vt as isConditionMet,
2044
- Le as useFieldInput,
2047
+ Pe as useFieldInput,
2045
2048
  kt as useFieldInputs,
2046
2049
  Ge as valueIsFile
2047
2050
  };