@overmap-ai/forms 1.0.17-blur-updates.3 → 1.0.17-blur-updates.5

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
@@ -4,7 +4,7 @@ var I = (t, n, e) => cr(t, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { jsxs as x, jsx as s, Fragment as be } from "react/jsx-runtime";
5
5
  import { Popover as le, IconButton as V, RiIcon as F, Text as ge, Spinner as wt, ButtonGroup as xt, Tooltip as Ne, Separator as Xt, Checkbox as lt, Button as Q, DayPicker as dr, useToast as Ct, Input as pe, Badge as kt, Card as He, Menu as _, TextArea as Hn, Heading as Gn, HoverCard as Rt, useAlertDialog as ur, Tabs as Te, useSize as fr, IconToggleButton as mr } from "@overmap-ai/blocks";
6
6
  import * as p from "react";
7
- import { memo as O, useCallback as N, useMemo as P, forwardRef as Xe, createContext as hr, useContext as pr, useState as $, useRef as me, useEffect as K, Fragment as Xn, useLayoutEffect as Kt, useReducer as gr } from "react";
7
+ import { memo as O, useCallback as R, useMemo as P, forwardRef as Xe, createContext as hr, useContext as pr, useState as $, useRef as me, useEffect as K, Fragment as Xn, useLayoutEffect as Kt, useReducer as gr } from "react";
8
8
  import { useField as Qt, useFormikContext as Ie, useFormik as Yt, FormikProvider as Jt } from "formik";
9
9
  import * as vr from "react-dom";
10
10
  import yr from "react-dom";
@@ -17,7 +17,7 @@ import kr from "lodash.clonedeep";
17
17
  import { Colors as Qn, fileToBlob as Yn, hashFile as Rn, DeferredPromise as Mr } from "@overmap-ai/core";
18
18
  import { ReactSketchCanvas as zr } from "react-sketch-canvas";
19
19
  const Jn = O((t) => {
20
- const { selectedColor: n, allColors: e, onFinish: i, trigger: r } = t, o = N(
20
+ const { selectedColor: n, allColors: e, onFinish: i, trigger: r } = t, o = R(
21
21
  (a) => () => {
22
22
  i(a);
23
23
  },
@@ -204,7 +204,7 @@ class G extends ti {
204
204
  }
205
205
  I(G, "fieldTypeName"), I(G, "fieldTypeDescription");
206
206
  const Z = (t) => {
207
- const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: a, ...l } = t, [m, c, d] = Qt(e.getId()), { touched: u } = c, h = c.error ?? e.description, y = c.error ? "danger" : void 0, b = n ?? `${i}-${e.getId()}-input`, f = `${b}-label`, g = e.required ? `${e.label} *` : e.label, C = P(() => ({
207
+ const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: a, ...l } = t, [m, c, d] = Qt(e.getId()), { touched: u } = c, h = c.error ?? e.description, y = c.error ? "danger" : void 0, w = n ?? `${i}-${e.getId()}-input`, f = `${w}-label`, g = e.required ? `${e.label} *` : e.label, C = P(() => ({
208
208
  ...m,
209
209
  // name and value not being overridden
210
210
  onChange: (E) => {
@@ -219,7 +219,7 @@ const Z = (t) => {
219
219
  helpText: h,
220
220
  size: r,
221
221
  severity: y,
222
- inputId: b,
222
+ inputId: w,
223
223
  labelId: f,
224
224
  label: g,
225
225
  showInputOnly: o,
@@ -285,14 +285,14 @@ function jr(t, n = []) {
285
285
  e = [...e, a];
286
286
  const c = (u) => {
287
287
  var C;
288
- const { scope: h, children: y, ...b } = u, f = ((C = h == null ? void 0 : h[t]) == null ? void 0 : C[m]) || l, g = p.useMemo(() => b, Object.values(b));
288
+ const { scope: h, children: y, ...w } = u, f = ((C = h == null ? void 0 : h[t]) == null ? void 0 : C[m]) || l, g = p.useMemo(() => w, Object.values(w));
289
289
  return /* @__PURE__ */ s(f.Provider, { value: g, children: y });
290
290
  };
291
291
  c.displayName = o + "Provider";
292
292
  function d(u, h) {
293
293
  var f;
294
- const y = ((f = h == null ? void 0 : h[t]) == null ? void 0 : f[m]) || l, b = p.useContext(y);
295
- if (b) return b;
294
+ const y = ((f = h == null ? void 0 : h[t]) == null ? void 0 : f[m]) || l, w = p.useContext(y);
295
+ if (w) return w;
296
296
  if (a !== void 0) return a;
297
297
  throw new Error(`\`${u}\` must be used within \`${o}\``);
298
298
  }
@@ -464,15 +464,15 @@ var no = "DismissableLayer", zt = "dismissableLayer.update", io = "dismissableLa
464
464
  onInteractOutside: a,
465
465
  onDismiss: l,
466
466
  ...m
467
- } = t, c = p.useContext(ri), [d, u] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, y] = p.useState({}), b = Se(n, (R) => u(R)), f = Array.from(c.layers), [g] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), C = f.indexOf(g), w = d ? f.indexOf(d) : -1, v = c.layersWithOutsidePointerEventsDisabled.size > 0, E = w >= C, S = so((R) => {
468
- const T = R.target, D = [...c.branches].some((M) => M.contains(T));
469
- !E || D || (r == null || r(R), a == null || a(R), R.defaultPrevented || l == null || l());
470
- }, h), L = lo((R) => {
471
- const T = R.target;
472
- [...c.branches].some((M) => M.contains(T)) || (o == null || o(R), a == null || a(R), R.defaultPrevented || l == null || l());
467
+ } = t, c = p.useContext(ri), [d, u] = p.useState(null), h = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, y] = p.useState({}), w = Se(n, (T) => u(T)), f = Array.from(c.layers), [g] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), C = f.indexOf(g), b = d ? f.indexOf(d) : -1, v = c.layersWithOutsidePointerEventsDisabled.size > 0, E = b >= C, S = so((T) => {
468
+ const N = T.target, A = [...c.branches].some((M) => M.contains(N));
469
+ !E || A || (r == null || r(T), a == null || a(T), T.defaultPrevented || l == null || l());
470
+ }, h), L = lo((T) => {
471
+ const N = T.target;
472
+ [...c.branches].some((M) => M.contains(N)) || (o == null || o(T), a == null || a(T), T.defaultPrevented || l == null || l());
473
473
  }, h);
474
- return to((R) => {
475
- w === c.layers.size - 1 && (i == null || i(R), !R.defaultPrevented && l && (R.preventDefault(), l()));
474
+ return to((T) => {
475
+ b === c.layers.size - 1 && (i == null || i(T), !T.defaultPrevented && l && (T.preventDefault(), l()));
476
476
  }, h), p.useEffect(() => {
477
477
  if (d)
478
478
  return e && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (Tn = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(d)), c.layers.add(d), Ln(), () => {
@@ -481,13 +481,13 @@ var no = "DismissableLayer", zt = "dismissableLayer.update", io = "dismissableLa
481
481
  }, [d, h, e, c]), p.useEffect(() => () => {
482
482
  d && (c.layers.delete(d), c.layersWithOutsidePointerEventsDisabled.delete(d), Ln());
483
483
  }, [d, c]), p.useEffect(() => {
484
- const R = () => y({});
485
- return document.addEventListener(zt, R), () => document.removeEventListener(zt, R);
484
+ const T = () => y({});
485
+ return document.addEventListener(zt, T), () => document.removeEventListener(zt, T);
486
486
  }, []), /* @__PURE__ */ s(
487
487
  ce.div,
488
488
  {
489
489
  ...m,
490
- ref: b,
490
+ ref: w,
491
491
  style: {
492
492
  pointerEvents: v ? E ? "auto" : "none" : void 0,
493
493
  ...t.style
@@ -598,9 +598,9 @@ var Tt = "focusScope.autoFocusOnMount", Lt = "focusScope.autoFocusOnUnmount", Fn
598
598
  S.removedNodes.length > 0 && fe(l);
599
599
  };
600
600
  document.addEventListener("focusin", f), document.addEventListener("focusout", g);
601
- const w = new MutationObserver(C);
602
- return l && w.observe(l, { childList: !0, subtree: !0 }), () => {
603
- document.removeEventListener("focusin", f), document.removeEventListener("focusout", g), w.disconnect();
601
+ const b = new MutationObserver(C);
602
+ return l && b.observe(l, { childList: !0, subtree: !0 }), () => {
603
+ document.removeEventListener("focusin", f), document.removeEventListener("focusout", g), b.disconnect();
604
604
  };
605
605
  }
606
606
  }, [i, l, y.paused]), p.useEffect(() => {
@@ -619,18 +619,18 @@ var Tt = "focusScope.autoFocusOnMount", Lt = "focusScope.autoFocusOnUnmount", Fn
619
619
  };
620
620
  }
621
621
  }, [l, c, d, y]);
622
- const b = p.useCallback(
622
+ const w = p.useCallback(
623
623
  (f) => {
624
624
  if (!e && !i || y.paused) return;
625
625
  const g = f.key === "Tab" && !f.altKey && !f.ctrlKey && !f.metaKey, C = document.activeElement;
626
626
  if (g && C) {
627
- const w = f.currentTarget, [v, E] = fo(w);
628
- v && E ? !f.shiftKey && C === E ? (f.preventDefault(), e && fe(v, { select: !0 })) : f.shiftKey && C === v && (f.preventDefault(), e && fe(E, { select: !0 })) : C === w && f.preventDefault();
627
+ const b = f.currentTarget, [v, E] = fo(b);
628
+ v && E ? !f.shiftKey && C === E ? (f.preventDefault(), e && fe(v, { select: !0 })) : f.shiftKey && C === v && (f.preventDefault(), e && fe(E, { select: !0 })) : C === b && f.preventDefault();
629
629
  }
630
630
  },
631
631
  [e, i, y.paused]
632
632
  );
633
- return /* @__PURE__ */ s(ce.div, { tabIndex: -1, ...a, ref: h, onKeyDown: b });
633
+ return /* @__PURE__ */ s(ce.div, { tabIndex: -1, ...a, ref: h, onKeyDown: w });
634
634
  });
635
635
  si.displayName = co;
636
636
  function uo(t, { select: n = !1 } = {}) {
@@ -930,11 +930,11 @@ var fi = Fo(), Dt = function() {
930
930
  onScrollCapture: Dt,
931
931
  onWheelCapture: Dt,
932
932
  onTouchMoveCapture: Dt
933
- }), r = i[0], o = i[1], a = t.forwardProps, l = t.children, m = t.className, c = t.removeScrollBar, d = t.enabled, u = t.shards, h = t.sideCar, y = t.noIsolation, b = t.inert, f = t.allowPinchZoom, g = t.as, C = g === void 0 ? "div" : g, w = t.gapMode, v = di(t, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), E = h, S = No([e, n]), L = oe(oe({}, v), r);
933
+ }), r = i[0], o = i[1], a = t.forwardProps, l = t.children, m = t.className, c = t.removeScrollBar, d = t.enabled, u = t.shards, h = t.sideCar, y = t.noIsolation, w = t.inert, f = t.allowPinchZoom, g = t.as, C = g === void 0 ? "div" : g, b = t.gapMode, v = di(t, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), E = h, S = No([e, n]), L = oe(oe({}, v), r);
934
934
  return p.createElement(
935
935
  p.Fragment,
936
936
  null,
937
- d && p.createElement(E, { sideCar: fi, removeScrollBar: c, shards: u, noIsolation: y, inert: b, setCallbacks: o, allowPinchZoom: !!f, lockRef: e, gapMode: w }),
937
+ d && p.createElement(E, { sideCar: fi, removeScrollBar: c, shards: u, noIsolation: y, inert: w, setCallbacks: o, allowPinchZoom: !!f, lockRef: e, gapMode: b }),
938
938
  a ? p.cloneElement(p.Children.only(l), oe(oe({}, L), { ref: S })) : p.createElement(C, oe({}, L, { className: m, ref: S }), l)
939
939
  );
940
940
  });
@@ -1135,8 +1135,8 @@ var Le = _t ? { passive: !1 } : !1, qo = function(t) {
1135
1135
  }, Yo = function(t, n, e, i, r) {
1136
1136
  var o = Qo(t, window.getComputedStyle(n).direction), a = o * i, l = e.target, m = n.contains(l), c = !1, d = a > 0, u = 0, h = 0;
1137
1137
  do {
1138
- var y = gi(t, l), b = y[0], f = y[1], g = y[2], C = f - g - o * b;
1139
- (b || C) && pi(t, l) && (u += C, h += b), l instanceof ShadowRoot ? l = l.host : l = l.parentNode;
1138
+ var y = gi(t, l), w = y[0], f = y[1], g = y[2], C = f - g - o * w;
1139
+ (w || C) && pi(t, l) && (u += C, h += w), l instanceof ShadowRoot ? l = l.host : l = l.parentNode;
1140
1140
  } while (
1141
1141
  // portaled content
1142
1142
  !m && l !== document.body || // self content
@@ -1177,37 +1177,37 @@ function ta(t) {
1177
1177
  var l = p.useCallback(function(f, g) {
1178
1178
  if ("touches" in f && f.touches.length === 2 || f.type === "wheel" && f.ctrlKey)
1179
1179
  return !a.current.allowPinchZoom;
1180
- var C = Ye(f), w = e.current, v = "deltaX" in f ? f.deltaX : w[0] - C[0], E = "deltaY" in f ? f.deltaY : w[1] - C[1], S, L = f.target, R = Math.abs(v) > Math.abs(E) ? "h" : "v";
1181
- if ("touches" in f && R === "h" && L.type === "range")
1180
+ var C = Ye(f), b = e.current, v = "deltaX" in f ? f.deltaX : b[0] - C[0], E = "deltaY" in f ? f.deltaY : b[1] - C[1], S, L = f.target, T = Math.abs(v) > Math.abs(E) ? "h" : "v";
1181
+ if ("touches" in f && T === "h" && L.type === "range")
1182
1182
  return !1;
1183
- var T = zn(R, L);
1184
- if (!T)
1183
+ var N = zn(T, L);
1184
+ if (!N)
1185
1185
  return !0;
1186
- if (T ? S = R : (S = R === "v" ? "h" : "v", T = zn(R, L)), !T)
1186
+ if (N ? S = T : (S = T === "v" ? "h" : "v", N = zn(T, L)), !N)
1187
1187
  return !1;
1188
1188
  if (!i.current && "changedTouches" in f && (v || E) && (i.current = S), !S)
1189
1189
  return !0;
1190
- var D = i.current || S;
1191
- return Yo(D, g, f, D === "h" ? v : E);
1190
+ var A = i.current || S;
1191
+ return Yo(A, g, f, A === "h" ? v : E);
1192
1192
  }, []), m = p.useCallback(function(f) {
1193
1193
  var g = f;
1194
1194
  if (!(!Fe.length || Fe[Fe.length - 1] !== o)) {
1195
- var C = "deltaY" in g ? _n(g) : Ye(g), w = n.current.filter(function(S) {
1195
+ var C = "deltaY" in g ? _n(g) : Ye(g), b = n.current.filter(function(S) {
1196
1196
  return S.name === g.type && (S.target === g.target || g.target === S.shadowParent) && Jo(S.delta, C);
1197
1197
  })[0];
1198
- if (w && w.should) {
1198
+ if (b && b.should) {
1199
1199
  g.cancelable && g.preventDefault();
1200
1200
  return;
1201
1201
  }
1202
- if (!w) {
1202
+ if (!b) {
1203
1203
  var v = (a.current.shards || []).map(Bn).filter(Boolean).filter(function(S) {
1204
1204
  return S.contains(g.target);
1205
1205
  }), E = v.length > 0 ? l(g, v[0]) : !a.current.noIsolation;
1206
1206
  E && g.cancelable && g.preventDefault();
1207
1207
  }
1208
1208
  }
1209
- }, []), c = p.useCallback(function(f, g, C, w) {
1210
- var v = { name: f, delta: g, target: C, should: w, shadowParent: na(C) };
1209
+ }, []), c = p.useCallback(function(f, g, C, b) {
1210
+ var v = { name: f, delta: g, target: C, should: b, shadowParent: na(C) };
1211
1211
  n.current.push(v), setTimeout(function() {
1212
1212
  n.current = n.current.filter(function(E) {
1213
1213
  return E !== v;
@@ -1231,11 +1231,11 @@ function ta(t) {
1231
1231
  }), document.removeEventListener("wheel", m, Le), document.removeEventListener("touchmove", m, Le), document.removeEventListener("touchstart", d, Le);
1232
1232
  };
1233
1233
  }, []);
1234
- var y = t.removeScrollBar, b = t.inert;
1234
+ var y = t.removeScrollBar, w = t.inert;
1235
1235
  return p.createElement(
1236
1236
  p.Fragment,
1237
1237
  null,
1238
- b ? p.createElement(o, { styles: Zo(r) }) : null,
1238
+ w ? p.createElement(o, { styles: Zo(r) }) : null,
1239
1239
  y ? p.createElement(Wo, { gapMode: t.gapMode }) : null
1240
1240
  );
1241
1241
  }
@@ -1278,8 +1278,8 @@ var ra = function(t) {
1278
1278
  d(h);
1279
1279
  else
1280
1280
  try {
1281
- var y = h.getAttribute(i), b = y !== null && y !== "false", f = (Ae.get(h) || 0) + 1, g = (o.get(h) || 0) + 1;
1282
- Ae.set(h, f), o.set(h, g), a.push(h), f === 1 && b && Je.set(h, !0), g === 1 && h.setAttribute(e, "true"), b || h.setAttribute(i, "true");
1281
+ var y = h.getAttribute(i), w = y !== null && y !== "false", f = (Ae.get(h) || 0) + 1, g = (o.get(h) || 0) + 1;
1282
+ Ae.set(h, f), o.set(h, g), a.push(h), f === 1 && w && Je.set(h, !0), g === 1 && h.setAttribute(e, "true"), w || h.setAttribute(i, "true");
1283
1283
  } catch (C) {
1284
1284
  console.error("aria-hidden: cannot operate on ", h, C);
1285
1285
  }
@@ -1574,17 +1574,17 @@ function wa() {
1574
1574
  }
1575
1575
  } : function(c, d, u, h) {
1576
1576
  if (h = h || open("", "_blank"), h && (h.document.title = h.document.body.innerText = "downloading..."), typeof c == "string") return i(c, d, u);
1577
- var y = c.type === "application/octet-stream", b = /constructor/i.test(a.HTMLElement) || a.safari, f = /CriOS\/[\d]+/.test(navigator.userAgent);
1578
- if ((f || y && b || l) && typeof FileReader < "u") {
1577
+ var y = c.type === "application/octet-stream", w = /constructor/i.test(a.HTMLElement) || a.safari, f = /CriOS\/[\d]+/.test(navigator.userAgent);
1578
+ if ((f || y && w || l) && typeof FileReader < "u") {
1579
1579
  var g = new FileReader();
1580
1580
  g.onloadend = function() {
1581
1581
  var v = g.result;
1582
1582
  v = f ? v : v.replace(/^data:[^;]*;/, "data:attachment/file;"), h ? h.location.href = v : location = v, h = null;
1583
1583
  }, g.readAsDataURL(c);
1584
1584
  } else {
1585
- var C = a.URL || a.webkitURL, w = C.createObjectURL(c);
1586
- h ? h.location = w : location.href = w, h = null, setTimeout(function() {
1587
- C.revokeObjectURL(w);
1585
+ var C = a.URL || a.webkitURL, b = C.createObjectURL(c);
1586
+ h ? h.location = b : location.href = b, h = null, setTimeout(function() {
1587
+ C.revokeObjectURL(b);
1588
1588
  }, 4e4);
1589
1589
  }
1590
1590
  });
@@ -1594,14 +1594,14 @@ function wa() {
1594
1594
  }
1595
1595
  var hn = wa();
1596
1596
  const Pi = O((t) => {
1597
- const { file: n, onClose: e } = t, i = me(null), r = N(() => {
1597
+ const { file: n, onClose: e } = t, i = me(null), r = R(() => {
1598
1598
  var l;
1599
1599
  if (!i.current) return;
1600
1600
  const a = document.createElement("canvas");
1601
1601
  a.width = i.current.width, a.height = i.current.height, (l = a.getContext("2d")) == null || l.drawImage(i.current, 0, 0, i.current.width, i.current.height), a.toBlob((m) => {
1602
1602
  m && navigator.clipboard.write([new ClipboardItem({ "image/png": m })]);
1603
1603
  }, "image/png");
1604
- }, []), o = N(() => {
1604
+ }, []), o = R(() => {
1605
1605
  hn.saveAs(n, n.name);
1606
1606
  }, [n]);
1607
1607
  return /* @__PURE__ */ s(dn, { open: !0, onOpenChange: e, children: /* @__PURE__ */ s(un, { children: /* @__PURE__ */ s(
@@ -1653,14 +1653,14 @@ const Pi = O((t) => {
1653
1653
  });
1654
1654
  Pi.displayName = "ImageViewer";
1655
1655
  const xa = O((t) => {
1656
- const { children: n } = t, [e, i] = $(null), r = N(() => {
1656
+ const { children: n } = t, [e, i] = $(null), r = R(() => {
1657
1657
  i(null);
1658
- }, []), o = N(
1658
+ }, []), o = R(
1659
1659
  (m) => {
1660
1660
  i(m(r));
1661
1661
  },
1662
1662
  [r]
1663
- ), a = N(() => {
1663
+ ), a = R(() => {
1664
1664
  e && (e.onClose && e.onClose(), r());
1665
1665
  }, [r, e]), l = P(() => o, [o]);
1666
1666
  return /* @__PURE__ */ x(ni.Provider, { value: l, children: [
@@ -1674,7 +1674,7 @@ const ae = (t) => {
1674
1674
  K(() => {
1675
1675
  l instanceof Promise ? l.then(c).catch(console.error) : c(l);
1676
1676
  }, [l]);
1677
- const h = m ? URL.createObjectURL(m) : void 0, y = N(() => {
1677
+ const h = m ? URL.createObjectURL(m) : void 0, y = R(() => {
1678
1678
  m && d(() => ({
1679
1679
  file: m
1680
1680
  }));
@@ -1689,7 +1689,7 @@ const ae = (t) => {
1689
1689
  onClick: y
1690
1690
  }
1691
1691
  ),
1692
- /* @__PURE__ */ s("label", { className: qe(n, "flex flex-col gap-1 w-max"), htmlFor: o, children: /* @__PURE__ */ s(ge, { accentColor: u, size: "sm", id: a, weight: "medium", children: e }) }),
1692
+ /* @__PURE__ */ s("label", { className: qe(n, "flex flex-col gap-1 w-max max-w-full"), htmlFor: o, children: /* @__PURE__ */ s(ge, { accentColor: u, size: "sm", id: a, weight: "medium", className: "text-wrap", children: e }) }),
1693
1693
  i
1694
1694
  ] });
1695
1695
  }, ki = (t) => {
@@ -1702,10 +1702,10 @@ const ae = (t) => {
1702
1702
  const { children: n, ...e } = t;
1703
1703
  return /* @__PURE__ */ s(ki, { ...e, children: n });
1704
1704
  }, Ca = [!0, "true"], Mi = O((t) => {
1705
- const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onBlur: h, onChange: y } = c, b = o ? null : l, f = o ? "" : m, g = Ca.includes(c.value), C = N(() => {
1705
+ const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onBlur: h, onChange: y } = c, w = o ? null : l, f = o ? "" : m, g = Ca.includes(c.value), C = R(() => {
1706
1706
  h(g);
1707
1707
  }, [h, g]);
1708
- return /* @__PURE__ */ s(se, { helpText: b, severity: r, children: /* @__PURE__ */ s(
1708
+ return /* @__PURE__ */ s(se, { helpText: w, severity: r, children: /* @__PURE__ */ s(
1709
1709
  ae,
1710
1710
  {
1711
1711
  size: i,
@@ -1764,12 +1764,12 @@ const Ea = {
1764
1764
  I(De, "fieldTypeName", "Checkbox"), I(De, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), I(De, "Icon", br);
1765
1765
  let Ge = De;
1766
1766
  const zi = O((t) => {
1767
- const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y } = c, [b, f] = $(!1), g = o ? null : l, C = o ? "" : m, w = c.value ? new Date(c.value) : void 0, v = N(
1767
+ const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y } = c, [w, f] = $(!1), g = o ? null : l, C = o ? "" : m, b = c.value ? new Date(c.value) : void 0, v = R(
1768
1768
  (S) => {
1769
1769
  S && h(S.toISOString()), f(!1);
1770
1770
  },
1771
1771
  [h]
1772
- ), E = N(
1772
+ ), E = R(
1773
1773
  (S) => {
1774
1774
  f(S), S || y(c.value);
1775
1775
  },
@@ -1784,7 +1784,7 @@ const zi = O((t) => {
1784
1784
  labelId: e,
1785
1785
  label: C,
1786
1786
  image: o ? void 0 : a.image,
1787
- children: /* @__PURE__ */ x(le.Root, { open: b, onOpenChange: E, children: [
1787
+ children: /* @__PURE__ */ x(le.Root, { open: w, onOpenChange: E, children: [
1788
1788
  /* @__PURE__ */ s(le.Trigger, { asChild: !0, children: /* @__PURE__ */ x(
1789
1789
  Q,
1790
1790
  {
@@ -1797,7 +1797,7 @@ const zi = O((t) => {
1797
1797
  size: "sm",
1798
1798
  ...d,
1799
1799
  children: [
1800
- w ? w.toLocaleString(void 0, {
1800
+ b ? b.toLocaleString(void 0, {
1801
1801
  year: "numeric",
1802
1802
  month: "2-digit",
1803
1803
  day: "2-digit"
@@ -1812,7 +1812,7 @@ const zi = O((t) => {
1812
1812
  required: !1,
1813
1813
  mode: "single",
1814
1814
  variant: "solid",
1815
- selected: w,
1815
+ selected: b,
1816
1816
  onSelect: v
1817
1817
  }
1818
1818
  ) })
@@ -1962,7 +1962,7 @@ const pn = () => Aa(), $i = (t, n) => {
1962
1962
  };
1963
1963
  pt("fields", t, i, n, e);
1964
1964
  }, gn = () => {
1965
- const { showError: t } = Ct(), n = N(
1965
+ const { showError: t } = Ct(), n = R(
1966
1966
  (i, r, o, a, l, m) => {
1967
1967
  const c = i[r];
1968
1968
  if (!c) throw new Error("Could not find section context.");
@@ -1982,7 +1982,7 @@ const pn = () => Aa(), $i = (t, n) => {
1982
1982
  m("fields", Vt(l.fields, o, d));
1983
1983
  },
1984
1984
  [t]
1985
- ), e = N(
1985
+ ), e = R(
1986
1986
  (i, r, o, a, l, m, c) => {
1987
1987
  var d;
1988
1988
  if (!(i != null && i.fields) || !a) throw new Error("Could not find section with fields.");
@@ -2011,46 +2011,46 @@ const pn = () => Aa(), $i = (t, n) => {
2011
2011
  );
2012
2012
  return { reorderSection: n, reorderField: e };
2013
2013
  }, ji = O((t) => {
2014
- const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), u = o ? null : l, h = o ? "" : m, { name: y, onChange: b, onBlur: f } = c, g = P(() => Array.isArray(c.value) ? c.value : [], [c.value]), C = `${n}-droppable`, { disabled: w } = d, [v, E] = $(""), [S, L] = $(""), R = S || u, T = N(
2014
+ const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), u = o ? null : l, h = o ? "" : m, { name: y, onChange: w, onBlur: f } = c, g = P(() => Array.isArray(c.value) ? c.value : [], [c.value]), C = `${n}-droppable`, { disabled: b } = d, [v, E] = $(""), [S, L] = $(""), T = S || u, N = R(
2015
2015
  (k) => {
2016
- b(k), f(k);
2016
+ w(k), f(k);
2017
2017
  },
2018
- [b, f]
2019
- ), D = N(
2018
+ [w, f]
2019
+ ), A = R(
2020
2020
  (k) => {
2021
2021
  g.findIndex((q) => q === k.target.value.trim()) >= 0 ? L("All options must be unique") : k.target.value ? L("") : L("Option cannot be empty"), E(k.target.value);
2022
2022
  },
2023
2023
  [E, g]
2024
- ), M = N(() => {
2024
+ ), M = R(() => {
2025
2025
  if (S) return;
2026
2026
  if (!v.trim()) {
2027
2027
  L("Option cannot be empty");
2028
2028
  return;
2029
2029
  }
2030
2030
  const k = v.trim();
2031
- T([...g, k]), E("");
2032
- }, [v, S, T, g]), X = N(
2031
+ N([...g, k]), E("");
2032
+ }, [v, S, N, g]), X = R(
2033
2033
  (k) => {
2034
2034
  k.key === "Enter" && (k.preventDefault(), M());
2035
2035
  },
2036
2036
  [M]
2037
- ), ne = N(
2037
+ ), ne = R(
2038
2038
  (k) => {
2039
- T(ht(g, k));
2039
+ N(ht(g, k));
2040
2040
  },
2041
- [g, T]
2042
- ), B = N(
2041
+ [g, N]
2042
+ ), B = R(
2043
2043
  (k) => {
2044
2044
  if (!k.destination) return;
2045
2045
  const q = k.source.index, de = k.destination.index;
2046
- T(Vt(g, q, de));
2046
+ N(Vt(g, q, de));
2047
2047
  },
2048
- [T, g]
2049
- ), Y = N(() => {
2048
+ [N, g]
2049
+ ), Y = R(() => {
2050
2050
  f(g);
2051
2051
  }, [f, g]);
2052
2052
  return /* @__PURE__ */ s(Kn, { onDragEnd: B, children: /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
2053
- /* @__PURE__ */ s(se, { helpText: R, severity: r, children: /* @__PURE__ */ s(
2053
+ /* @__PURE__ */ s(se, { helpText: T, severity: r, children: /* @__PURE__ */ s(
2054
2054
  ae,
2055
2055
  {
2056
2056
  size: i,
@@ -2059,12 +2059,12 @@ const pn = () => Aa(), $i = (t, n) => {
2059
2059
  labelId: e,
2060
2060
  label: h,
2061
2061
  image: o ? void 0 : a.image,
2062
- children: (!w || g.length === 0) && /* @__PURE__ */ x("div", { className: "flex gap-2", children: [
2062
+ children: (!b || g.length === 0) && /* @__PURE__ */ x("div", { className: "flex gap-2", children: [
2063
2063
  /* @__PURE__ */ s(pe.Root, { className: "grow", accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ s(
2064
2064
  pe.Field,
2065
2065
  {
2066
2066
  value: v,
2067
- onChange: D,
2067
+ onChange: A,
2068
2068
  onKeyDown: X,
2069
2069
  id: n,
2070
2070
  placeholder: a.placeholder,
@@ -2081,7 +2081,7 @@ const pn = () => Aa(), $i = (t, n) => {
2081
2081
  variant: "soft",
2082
2082
  type: "button",
2083
2083
  "aria-label": "Add option",
2084
- disabled: !!S || w,
2084
+ disabled: !!S || b,
2085
2085
  onClick: M,
2086
2086
  children: /* @__PURE__ */ s(F, { icon: "RiAddLine" })
2087
2087
  }
@@ -2101,7 +2101,7 @@ const pn = () => Aa(), $i = (t, n) => {
2101
2101
  {
2102
2102
  draggableId: `${q}-draggable`,
2103
2103
  index: de,
2104
- isDragDisabled: w,
2104
+ isDragDisabled: b,
2105
2105
  children: ({ draggableProps: ie, dragHandleProps: ue, innerRef: Re }) => /* @__PURE__ */ x(
2106
2106
  kt,
2107
2107
  {
@@ -2125,7 +2125,7 @@ const pn = () => Aa(), $i = (t, n) => {
2125
2125
  type: "button",
2126
2126
  "aria-label": "Delete option",
2127
2127
  accentColor: "base",
2128
- disabled: w,
2128
+ disabled: b,
2129
2129
  onClick: () => {
2130
2130
  ne(de);
2131
2131
  },
@@ -2199,19 +2199,19 @@ const Wi = O((t) => {
2199
2199
  const [
2200
2200
  { inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c, touched: d, helpers: u },
2201
2201
  h
2202
- ] = Z(t), { name: y, onBlur: b, onChange: f, value: g } = c, C = o ? null : l, w = o ? "" : m, [v, E] = $("");
2202
+ ] = Z(t), { name: y, onBlur: w, onChange: f, value: g } = c, C = o ? null : l, b = o ? "" : m, [v, E] = $("");
2203
2203
  Kt(() => {
2204
2204
  E(g);
2205
2205
  }, [g]);
2206
- const S = N(
2207
- (R) => {
2208
- const T = Number.parseFloat(R.target.value), D = Number.isNaN(T) ? "" : T;
2209
- E(D), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(D));
2206
+ const S = R(
2207
+ (T) => {
2208
+ const N = Number.parseFloat(T.target.value), A = Number.isNaN(N) ? "" : N;
2209
+ E(A), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(A));
2210
2210
  },
2211
2211
  [a, u, d]
2212
- ), L = N(() => {
2213
- f(v), b(v);
2214
- }, [v, b, f]);
2212
+ ), L = R(() => {
2213
+ f(v), w(v);
2214
+ }, [v, w, f]);
2215
2215
  return /* @__PURE__ */ s(se, { helpText: C, severity: r, children: /* @__PURE__ */ s(
2216
2216
  ae,
2217
2217
  {
@@ -2219,7 +2219,7 @@ const Wi = O((t) => {
2219
2219
  severity: r,
2220
2220
  inputId: n,
2221
2221
  labelId: e,
2222
- label: w,
2222
+ label: b,
2223
2223
  image: o ? void 0 : a.image,
2224
2224
  children: /* @__PURE__ */ s(pe.Root, { accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ s(
2225
2225
  pe.Field,
@@ -2342,18 +2342,18 @@ I(re, "fieldTypeName", "Number"), I(re, "fieldTypeDescription", "Allows specifyi
2342
2342
  });
2343
2343
  let Ee = re;
2344
2344
  const qi = O((t) => {
2345
- const [{ inputId: n, labelId: e, label: i, helpText: r, size: o, severity: a, showInputOnly: l, field: m, fieldProps: c }, d] = Z(t), { name: u, onBlur: h, onChange: y, value: b } = c, [f, g] = $(!1), C = l ? null : r, w = l ? "" : i, v = N(
2345
+ const [{ inputId: n, labelId: e, label: i, helpText: r, size: o, severity: a, showInputOnly: l, field: m, fieldProps: c }, d] = Z(t), { name: u, onBlur: h, onChange: y, value: w } = c, [f, g] = $(!1), C = l ? null : r, b = l ? "" : i, v = R(
2346
2346
  (L) => {
2347
2347
  y(L), g(!1);
2348
2348
  },
2349
2349
  [y]
2350
- ), E = N(() => {
2350
+ ), E = R(() => {
2351
2351
  y("");
2352
- }, [y]), S = N(
2352
+ }, [y]), S = R(
2353
2353
  (L) => {
2354
- g(L), L || h(b);
2354
+ g(L), L || h(w);
2355
2355
  },
2356
- [h, b]
2356
+ [h, w]
2357
2357
  );
2358
2358
  return /* @__PURE__ */ s(se, { helpText: C, severity: a, children: /* @__PURE__ */ x(
2359
2359
  ae,
@@ -2362,7 +2362,7 @@ const qi = O((t) => {
2362
2362
  severity: a,
2363
2363
  inputId: n,
2364
2364
  labelId: e,
2365
- label: w,
2365
+ label: b,
2366
2366
  image: l ? void 0 : m.image,
2367
2367
  className: "flex-col items-start justify-start gap-2",
2368
2368
  children: [
@@ -2389,10 +2389,10 @@ const qi = O((t) => {
2389
2389
  /* @__PURE__ */ s(mn, { className: "fixed inset-0", children: /* @__PURE__ */ s(Hi, { onQrScan: v }) })
2390
2390
  ] })
2391
2391
  ] }),
2392
- b && /* @__PURE__ */ s(F, { icon: "RiCheckLine", className: "align-bottom text-(--primary-a11)" })
2392
+ w && /* @__PURE__ */ s(F, { icon: "RiCheckLine", className: "align-bottom text-(--primary-a11)" })
2393
2393
  ] }),
2394
- !!b && /* @__PURE__ */ s(He, { className: "max-w-full w-max", size: "sm", children: /* @__PURE__ */ x("div", { className: "max-w-full w-max flex justify-between gap-2", children: [
2395
- /* @__PURE__ */ s("code", { className: "bg-(--base-a3) truncate text-sm", children: b }),
2394
+ !!w && /* @__PURE__ */ s(He, { className: "max-w-full w-max", size: "sm", children: /* @__PURE__ */ x("div", { className: "max-w-full w-max flex justify-between gap-2", children: [
2395
+ /* @__PURE__ */ s("code", { className: "bg-(--base-a3) truncate text-sm", children: w }),
2396
2396
  /* @__PURE__ */ s(
2397
2397
  V,
2398
2398
  {
@@ -2497,18 +2497,18 @@ class Gi extends G {
2497
2497
  }
2498
2498
  }
2499
2499
  const za = (t) => t ? Array.isArray(t) ? t : [t] : [], Xi = O((t) => {
2500
- const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y } = c, b = o ? null : l, f = o ? "" : m, g = P(() => za(c.value), [c.value]), C = N(
2500
+ const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y } = c, w = o ? null : l, f = o ? "" : m, g = P(() => za(c.value), [c.value]), C = R(
2501
2501
  (v) => {
2502
2502
  h(v), y(v);
2503
2503
  },
2504
2504
  [y, h]
2505
- ), w = N(
2505
+ ), b = R(
2506
2506
  (v) => {
2507
2507
  v || y(g);
2508
2508
  },
2509
2509
  [g, y]
2510
2510
  );
2511
- return /* @__PURE__ */ s(se, { helpText: b, severity: r, children: /* @__PURE__ */ s(
2511
+ return /* @__PURE__ */ s(se, { helpText: w, severity: r, children: /* @__PURE__ */ s(
2512
2512
  ae,
2513
2513
  {
2514
2514
  size: i,
@@ -2517,7 +2517,7 @@ const za = (t) => t ? Array.isArray(t) ? t : [t] : [], Xi = O((t) => {
2517
2517
  labelId: e,
2518
2518
  label: f,
2519
2519
  image: o ? void 0 : a.image,
2520
- children: /* @__PURE__ */ x(_.Root, { onOpenChange: w, align: "start", children: [
2520
+ children: /* @__PURE__ */ x(_.Root, { onOpenChange: b, align: "start", children: [
2521
2521
  /* @__PURE__ */ s(_.ClickTrigger, { children: /* @__PURE__ */ x(
2522
2522
  Q,
2523
2523
  {
@@ -2580,12 +2580,12 @@ const _a = {
2580
2580
  I(Me, "fieldTypeName", "Multi-select"), I(Me, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options."), I(Me, "Icon", Ir);
2581
2581
  let vt = Me;
2582
2582
  const Ki = O((t) => {
2583
- const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y, value: b } = c, f = o ? null : l, g = o ? "" : m, C = N(
2583
+ const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c }, d] = Z(t), { name: u, onChange: h, onBlur: y, value: w } = c, f = o ? null : l, g = o ? "" : m, C = R(
2584
2584
  (v) => {
2585
2585
  v && (h(v), y(v));
2586
2586
  },
2587
2587
  [y, h]
2588
- ), w = P(() => a.options.find((v) => v.value === b), [a.options, b]);
2588
+ ), b = P(() => a.options.find((v) => v.value === w), [a.options, w]);
2589
2589
  return /* @__PURE__ */ s(se, { helpText: f, severity: r, children: /* @__PURE__ */ s(
2590
2590
  ae,
2591
2591
  {
@@ -2608,12 +2608,12 @@ const Ki = O((t) => {
2608
2608
  size: "sm",
2609
2609
  ...d,
2610
2610
  children: [
2611
- /* @__PURE__ */ s("span", { className: "truncate", children: w ? w.label : a.placeholder }),
2611
+ /* @__PURE__ */ s("span", { className: "truncate", children: b ? b.label : a.placeholder }),
2612
2612
  /* @__PURE__ */ s(F, { className: "shrink-0", icon: "RiArrowDownSLine" })
2613
2613
  ]
2614
2614
  }
2615
2615
  ) }),
2616
- /* @__PURE__ */ s(_.Content, { children: /* @__PURE__ */ s(_.Scroll, { children: /* @__PURE__ */ s(_.SelectGroup, { required: !0, value: b, onValueChange: C, children: a.options.map((v) => /* @__PURE__ */ x(_.SelectItem, { value: v.value, children: [
2616
+ /* @__PURE__ */ s(_.Content, { children: /* @__PURE__ */ s(_.Scroll, { children: /* @__PURE__ */ s(_.SelectGroup, { required: !0, value: w, onValueChange: C, children: a.options.map((v) => /* @__PURE__ */ x(_.SelectItem, { value: v.value, children: [
2617
2617
  /* @__PURE__ */ s(_.SelectedIndicator, { children: /* @__PURE__ */ s(F, { icon: "RiCheckLine" }) }),
2618
2618
  v.label
2619
2619
  ] }, v.value)) }) }) })
@@ -2734,18 +2734,18 @@ const Qi = O((t) => {
2734
2734
  const [
2735
2735
  { inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c, touched: d, helpers: u },
2736
2736
  h
2737
- ] = Z(t), { name: y, onBlur: b, onChange: f, value: g } = c, C = o ? null : l, w = o ? "" : m, [v, E] = $("");
2737
+ ] = Z(t), { name: y, onBlur: w, onChange: f, value: g } = c, C = o ? null : l, b = o ? "" : m, [v, E] = $("");
2738
2738
  Kt(() => {
2739
2739
  E(g);
2740
2740
  }, [g]);
2741
- const S = N(
2742
- (R) => {
2743
- E(R.target.value), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(R.target.value));
2741
+ const S = R(
2742
+ (T) => {
2743
+ E(T.target.value), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(T.target.value));
2744
2744
  },
2745
2745
  [a, u, d]
2746
- ), L = N(() => {
2747
- f(v), b(v);
2748
- }, [v, b, f]);
2746
+ ), L = R(() => {
2747
+ f(v), w(v);
2748
+ }, [v, w, f]);
2749
2749
  return /* @__PURE__ */ s(se, { helpText: C, severity: r, children: /* @__PURE__ */ s(
2750
2750
  ae,
2751
2751
  {
@@ -2753,12 +2753,13 @@ const Qi = O((t) => {
2753
2753
  severity: r,
2754
2754
  inputId: n,
2755
2755
  labelId: e,
2756
- label: w,
2756
+ label: b,
2757
2757
  image: o ? void 0 : a.image,
2758
2758
  children: /* @__PURE__ */ s(pe.Root, { accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ s(
2759
2759
  pe.Field,
2760
2760
  {
2761
2761
  id: n,
2762
+ className: "truncate",
2762
2763
  name: y,
2763
2764
  value: v,
2764
2765
  type: a.inputType,
@@ -2808,18 +2809,18 @@ const Yi = O((t) => {
2808
2809
  const [
2809
2810
  { inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: a, helpText: l, label: m, fieldProps: c, touched: d, helpers: u },
2810
2811
  h
2811
- ] = Z(t), { name: y, onBlur: b, onChange: f, value: g } = c, C = o ? null : l, w = o ? "" : m, [v, E] = $("");
2812
+ ] = Z(t), { name: y, onBlur: w, onChange: f, value: g } = c, C = o ? null : l, b = o ? "" : m, [v, E] = $("");
2812
2813
  Kt(() => {
2813
2814
  E(g);
2814
2815
  }, [g]);
2815
- const S = N(
2816
- (R) => {
2817
- E(R.target.value), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(R.target.value));
2816
+ const S = R(
2817
+ (T) => {
2818
+ E(T.target.value), (d || !a.onlyValidateAfterTouched) && u.setError(a.getError(T.target.value));
2818
2819
  },
2819
2820
  [a, u, d]
2820
- ), L = N(() => {
2821
- f(v), b(v);
2822
- }, [v, b, f]);
2821
+ ), L = R(() => {
2822
+ f(v), w(v);
2823
+ }, [v, w, f]);
2823
2824
  return /* @__PURE__ */ s(se, { helpText: C, severity: r, children: /* @__PURE__ */ s(
2824
2825
  ae,
2825
2826
  {
@@ -2827,7 +2828,7 @@ const Yi = O((t) => {
2827
2828
  severity: r,
2828
2829
  inputId: n,
2829
2830
  labelId: e,
2830
- label: w,
2831
+ label: b,
2831
2832
  image: o ? void 0 : a.image,
2832
2833
  children: /* @__PURE__ */ s(
2833
2834
  Hn,
@@ -2929,42 +2930,42 @@ const Ua = O(
2929
2930
  unit: n[i]
2930
2931
  }).format(e);
2931
2932
  }, Ji = O((t) => {
2932
- var R;
2933
+ var T;
2933
2934
  const [{ inputId: n, labelId: e, size: i, severity: r, helpText: o, showInputOnly: a, field: l, fieldProps: m }, c] = Z(t), { name: d, value: u, onChange: h, onBlur: y } = m;
2934
- let [{ label: b }] = Z(t);
2935
- b = a ? "" : b;
2936
- const f = me(null), g = P(() => a ? null : o || (l.maxFileSize ? `Maximum file size: ${l.maxFileSize}MB` : null), [l.maxFileSize, o, a]), C = N(() => {
2937
- var T;
2938
- (T = f.current) == null || T.click();
2939
- }, []), w = N(() => {
2935
+ let [{ label: w }] = Z(t);
2936
+ w = a ? "" : w;
2937
+ const f = me(null), g = P(() => a ? null : o || (l.maxFileSize ? `Maximum file size: ${l.maxFileSize}MB` : null), [l.maxFileSize, o, a]), C = R(() => {
2938
+ var N;
2939
+ (N = f.current) == null || N.click();
2940
+ }, []), b = R(() => {
2940
2941
  if (!f.current) return;
2941
- const T = f.current.files;
2942
- if (!T) {
2942
+ const N = f.current.files;
2943
+ if (!N) {
2943
2944
  y([]);
2944
2945
  return;
2945
2946
  }
2946
- const D = Array.from(T), M = [...u, ...D];
2947
+ const A = Array.from(N), M = [...u, ...A];
2947
2948
  h(M), y(M);
2948
- }, [y, h, u]), v = N(
2949
- (T) => {
2950
- const D = [...u];
2951
- D.splice(T, 1), h(D);
2949
+ }, [y, h, u]), v = R(
2950
+ (N) => {
2951
+ const A = [...u];
2952
+ A.splice(N, 1), h(A);
2952
2953
  },
2953
2954
  [u, h]
2954
2955
  );
2955
2956
  K(() => {
2956
2957
  if (!f.current) return;
2957
- const T = new AbortController();
2958
+ const N = new AbortController();
2958
2959
  return f.current.addEventListener(
2959
2960
  "cancel",
2960
2961
  () => {
2961
2962
  y([]);
2962
2963
  },
2963
2964
  {
2964
- signal: T.signal
2965
+ signal: N.signal
2965
2966
  }
2966
2967
  ), () => {
2967
- T.abort();
2968
+ N.abort();
2968
2969
  };
2969
2970
  }, [y, u]);
2970
2971
  const E = u ? "Select new files" : "Select files", S = u ? "Select new file" : "Select a file", L = l.maxFiles > 1 ? E : S;
@@ -2976,7 +2977,7 @@ const Ua = O(
2976
2977
  severity: r,
2977
2978
  inputId: n,
2978
2979
  labelId: e,
2979
- label: b,
2980
+ label: w,
2980
2981
  image: a ? void 0 : l.image,
2981
2982
  children: [
2982
2983
  /* @__PURE__ */ s("div", { className: "flex gap-2", children: /* @__PURE__ */ x(
@@ -3004,27 +3005,27 @@ const Ua = O(
3004
3005
  name: d,
3005
3006
  type: "file",
3006
3007
  ref: f,
3007
- accept: (R = l.extensions) == null ? void 0 : R.join(","),
3008
+ accept: (T = l.extensions) == null ? void 0 : T.join(","),
3008
3009
  multiple: l.maxFiles > 1,
3009
3010
  className: "hidden",
3010
- onChange: w,
3011
+ onChange: b,
3011
3012
  value: ""
3012
3013
  }
3013
3014
  )
3014
3015
  ]
3015
3016
  }
3016
3017
  ) }),
3017
- Array.isArray(u) && u.length > 0 && /* @__PURE__ */ s("div", { className: "flex h-max flex-col gap-2", children: u.map((T, D) => /* @__PURE__ */ s(
3018
+ Array.isArray(u) && u.length > 0 && /* @__PURE__ */ s("div", { className: "flex h-max flex-col gap-2", children: u.map((N, A) => /* @__PURE__ */ s(
3018
3019
  Zi,
3019
3020
  {
3020
3021
  field: l,
3021
- file: T,
3022
+ file: N,
3022
3023
  onRemove: () => {
3023
- v(D);
3024
+ v(A);
3024
3025
  },
3025
3026
  disabled: c.disabled
3026
3027
  },
3027
- D
3028
+ A
3028
3029
  )) })
3029
3030
  ] });
3030
3031
  });
@@ -3037,7 +3038,7 @@ const Zi = O((t) => {
3037
3038
  K(() => {
3038
3039
  n instanceof Promise ? n.then(a).catch(console.error) : a(n);
3039
3040
  }, [n]);
3040
- const u = N(
3041
+ const u = R(
3041
3042
  (f) => {
3042
3043
  if (f.stopPropagation(), !o)
3043
3044
  throw new Error("Cannot download a file that is not resolved.");
@@ -3045,19 +3046,19 @@ const Zi = O((t) => {
3045
3046
  hn.saveAs(g, d);
3046
3047
  },
3047
3048
  [d, o]
3048
- ), h = N(
3049
+ ), h = R(
3049
3050
  (f) => {
3050
3051
  f.stopPropagation(), i();
3051
3052
  },
3052
3053
  [i]
3053
- ), y = N(() => {
3054
+ ), y = R(() => {
3054
3055
  o && l((f) => ({
3055
3056
  file: o,
3056
3057
  onDelete: r ? void 0 : () => {
3057
3058
  i(), f();
3058
3059
  }
3059
3060
  }));
3060
- }, [r, i, l, o]), b = P(
3061
+ }, [r, i, l, o]), w = P(
3061
3062
  () => /* @__PURE__ */ x(xt, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
3062
3063
  /* @__PURE__ */ s(
3063
3064
  V,
@@ -3080,9 +3081,9 @@ const Zi = O((t) => {
3080
3081
  onClick: y,
3081
3082
  file: o,
3082
3083
  error: m ?? void 0,
3083
- rightSlot: b
3084
+ rightSlot: w
3084
3085
  }
3085
- ) : /* @__PURE__ */ s(ei, { file: o, error: m ?? void 0, rightSlot: b });
3086
+ ) : /* @__PURE__ */ s(ei, { file: o, error: m ?? void 0, rightSlot: w });
3086
3087
  });
3087
3088
  Zi.displayName = "DisplayFile";
3088
3089
  const Wa = {
@@ -3453,47 +3454,49 @@ const ye = (t) => Object.keys(t).length > 0, bn = (t, n) => {
3453
3454
  hideTitle: u = !e.title,
3454
3455
  hideDescription: h,
3455
3456
  className: y,
3456
- buttonProps: b
3457
- } = t, { readonly: f } = e.meta, g = P(() => crypto.randomUUID(), []), C = Yt({
3457
+ buttonProps: w,
3458
+ enableReinitialize: f = !1
3459
+ } = t, { readonly: g } = e.meta, C = P(() => crypto.randomUUID(), []), b = Yt({
3458
3460
  initialValues: wn(e.fields, i),
3459
3461
  onSubmit: o,
3460
- validate: (R) => bn(e, R),
3462
+ validate: (N) => bn(e, N),
3461
3463
  // only validate the entire form on submit
3462
3464
  validateOnBlur: !1,
3463
- validateOnChange: !1
3464
- }), { dirty: w } = C, v = P(
3465
+ validateOnChange: !1,
3466
+ enableReinitialize: f
3467
+ }), { dirty: v } = b, E = P(
3465
3468
  () => typeof e.title == "string" ? /* @__PURE__ */ s(Gn, { size: "md", children: e.title }) : e.title,
3466
3469
  [e.title]
3467
- ), E = P(
3470
+ ), S = P(
3468
3471
  () => typeof e.description == "string" ? /* @__PURE__ */ s(ge, { accentColor: "base", children: e.description }) : e.description,
3469
3472
  [e.description]
3470
- ), S = N(
3471
- (R, T) => {
3472
- r == null || r({ ...C.values, [R]: T }, { [R]: T });
3473
+ ), L = R(
3474
+ (N, A) => {
3475
+ r == null || r({ ...b.values, [N]: A }, { [N]: A });
3473
3476
  },
3474
- [C.values, r]
3475
- ), L = ft(e.fields, { formId: g, disabled: f, onValuesChange: S });
3477
+ [b.values, r]
3478
+ ), T = ft(e.fields, { formId: C, disabled: g, onValuesChange: L });
3476
3479
  return K(() => {
3477
- w && c && c(), d && d(w);
3478
- }, [w, c, d]), /* @__PURE__ */ s(Jt, { value: C, children: /* @__PURE__ */ x(
3480
+ v && c && c(), d && d(v);
3481
+ }, [v, c, d]), /* @__PURE__ */ s(Jt, { value: b, children: /* @__PURE__ */ x(
3479
3482
  "form",
3480
3483
  {
3481
- id: g,
3484
+ id: C,
3482
3485
  ref: n,
3483
3486
  className: qe(y, "flex flex-col gap-2"),
3484
- onSubmit: C.handleSubmit,
3487
+ onSubmit: b.handleSubmit,
3485
3488
  children: [
3486
3489
  !u && /* @__PURE__ */ s(He, { variant: "soft", children: /* @__PURE__ */ x("div", { className: "flex flex-col gap-1", children: [
3487
- v,
3488
- !h && E
3490
+ E,
3491
+ !h && S
3489
3492
  ] }) }),
3490
- L,
3491
- !f && /* @__PURE__ */ x("div", { className: "flex items-center justify-end gap-2", children: [
3493
+ T,
3494
+ !g && /* @__PURE__ */ x("div", { className: "flex items-center justify-end gap-2", children: [
3492
3495
  l && /* @__PURE__ */ x(
3493
3496
  Q,
3494
3497
  {
3495
3498
  accentColor: we.danger,
3496
- ...b,
3499
+ ...w,
3497
3500
  type: "button",
3498
3501
  onClick: m,
3499
3502
  children: [
@@ -3502,7 +3505,7 @@ const ye = (t) => Object.keys(t).length > 0, bn = (t, n) => {
3502
3505
  ]
3503
3506
  }
3504
3507
  ),
3505
- /* @__PURE__ */ x(Q, { ...b, type: "submit", disabled: !C.isValid, accentColor: "success", children: [
3508
+ /* @__PURE__ */ x(Q, { ...w, type: "submit", disabled: !b.isValid, accentColor: "success", children: [
3506
3509
  /* @__PURE__ */ s(F, { icon: "RiCheckLine" }),
3507
3510
  a
3508
3511
  ] })
@@ -3530,48 +3533,48 @@ const ye = (t) => Object.keys(t).length > 0, bn = (t, n) => {
3530
3533
  We.displayName = "PatchField";
3531
3534
  const Ss = O(
3532
3535
  Xe((t, n) => {
3533
- const { children: e, schema: i, values: r, onPatch: o, onError: a, requiresDiff: l = !0, onDirtyChange: m, ...c } = t, d = P(() => wn(i.fields, r), [i.fields, r]), u = N(
3534
- (w) => {
3536
+ const { children: e, schema: i, values: r, onPatch: o, onError: a, requiresDiff: l = !0, onDirtyChange: m, ...c } = t, d = P(() => wn(i.fields, r), [i.fields, r]), u = R(
3537
+ (b) => {
3535
3538
  const v = {};
3536
- for (const E in w) {
3537
- const S = w[E];
3539
+ for (const E in b) {
3540
+ const S = b[E];
3538
3541
  S !== d[E] && S !== void 0 && (v[E] = S);
3539
3542
  }
3540
3543
  return v;
3541
3544
  },
3542
3545
  [d]
3543
- ), h = N(
3544
- (w) => {
3545
- const v = u(w);
3546
+ ), h = R(
3547
+ (b) => {
3548
+ const v = u(b);
3546
3549
  l && !ye(v) || o(v);
3547
3550
  },
3548
3551
  [u, o, l]
3549
- ), y = N(
3550
- (w) => {
3551
- const v = bn(i, w);
3552
+ ), y = R(
3553
+ (b) => {
3554
+ const v = bn(i, b);
3552
3555
  if (v && a(v), m) {
3553
- const E = u(w);
3556
+ const E = u(b);
3554
3557
  m(ye(E));
3555
3558
  }
3556
3559
  return v;
3557
3560
  },
3558
3561
  [i, m, a, u]
3559
- ), b = Yt({
3562
+ ), w = Yt({
3560
3563
  initialValues: d,
3561
3564
  onSubmit: h,
3562
3565
  validate: y,
3563
3566
  // only validate the entire form on submit
3564
3567
  validateOnBlur: !1,
3565
3568
  validateOnChange: !1
3566
- }), f = N(() => {
3569
+ }), f = R(() => {
3567
3570
  if (m) {
3568
- const w = u(b.values);
3569
- ye(w) && m(!0);
3571
+ const b = u(w.values);
3572
+ ye(b) && m(!0);
3570
3573
  }
3571
- }, [b.values, u, m]), { errors: g, resetForm: C } = b;
3574
+ }, [w.values, u, m]), { errors: g, resetForm: C } = w;
3572
3575
  return K(() => {
3573
3576
  ye(g) && C({ values: d, errors: {} });
3574
- }, [g, d, C]), /* @__PURE__ */ s(Jt, { value: b, children: /* @__PURE__ */ s("form", { ...c, ref: n, onSubmit: b.handleSubmit, onChange: f, children: e }) });
3577
+ }, [g, d, C]), /* @__PURE__ */ s(Jt, { value: w, children: /* @__PURE__ */ s("form", { ...c, ref: n, onSubmit: w.handleSubmit, onChange: f, children: e }) });
3575
3578
  })
3576
3579
  ), st = "form-builder", Ja = [
3577
3580
  ["string", "text"],
@@ -3742,23 +3745,23 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3742
3745
  d.current && d.current.getBoundingClientRect().width >= u
3743
3746
  );
3744
3747
  K(() => {
3745
- const A = d.current;
3746
- if (A) {
3748
+ const D = d.current;
3749
+ if (D) {
3747
3750
  const z = new ResizeObserver((W) => {
3748
3751
  W[0] && y(W[0].contentRect.width >= u);
3749
3752
  });
3750
- return z.observe(A), () => {
3753
+ return z.observe(D), () => {
3751
3754
  z.disconnect();
3752
3755
  };
3753
3756
  }
3754
3757
  }, []);
3755
- const [b, f] = $(void 0);
3758
+ const [w, f] = $(void 0);
3756
3759
  K(() => {
3757
3760
  ve(i) ? f(void 0) : i.image instanceof Promise ? i.image.then(f).catch(console.error) : f(i.image);
3758
3761
  }, [i]);
3759
- const g = b ? URL.createObjectURL(b) : void 0, C = N(
3760
- (A) => {
3761
- A.stopPropagation();
3762
+ const g = w ? URL.createObjectURL(w) : void 0, C = R(
3763
+ (D) => {
3764
+ D.stopPropagation();
3762
3765
  const { image: z, ...W } = i;
3763
3766
  a(`${n}.${e}`, W).then();
3764
3767
  },
@@ -3767,10 +3770,10 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3767
3770
  K(() => {
3768
3771
  ve(i) && !i.conditional && a(`${n}.${e}.condition`, null).then();
3769
3772
  }, [e, i, n, a]);
3770
- const w = P(
3773
+ const b = P(
3771
3774
  () => {
3772
- var A, z;
3773
- return ve(i) ? (z = $i(o.fields, (A = i.condition) == null ? void 0 : A.identifier)) == null ? void 0 : z.label : void 0;
3775
+ var D, z;
3776
+ return ve(i) ? (z = $i(o.fields, (D = i.condition) == null ? void 0 : D.identifier)) == null ? void 0 : z.label : void 0;
3774
3777
  },
3775
3778
  [i, o.fields]
3776
3779
  ), v = ve(i) ? Array.isArray((Re = i.condition) == null ? void 0 : Re.value) ? "contains all of" : "equals" : void 0;
@@ -3778,61 +3781,61 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3778
3781
  if (ve(i)) {
3779
3782
  if (qt((St = i.condition) == null ? void 0 : St.value))
3780
3783
  throw new Error("File values are not supported for conditions.");
3781
- E = Array.isArray((En = i.condition) == null ? void 0 : En.value) ? i.condition.value.map((A) => typeof A == "string" ? A : A.label).join(", ") : (Sn = (In = i.condition) == null ? void 0 : In.value) == null ? void 0 : Sn.toString();
3784
+ E = Array.isArray((En = i.condition) == null ? void 0 : En.value) ? i.condition.value.map((D) => typeof D == "string" ? D : D.label).join(", ") : (Sn = (In = i.condition) == null ? void 0 : In.value) == null ? void 0 : Sn.toString();
3782
3785
  }
3783
- const S = N((A) => {
3784
- A.target.parentNode instanceof HTMLElement && (A.target.parentNode.dataset.replicatedValue = A.target.value);
3785
- }, []), L = N((A) => {
3786
- A.target.parentNode instanceof HTMLElement && (A.target.parentNode.dataset.replicatedValue = A.target.value);
3787
- }, []), R = i.type, T = Ht[R], [D, M] = P(() => {
3788
- let A = [], z = [];
3789
- if (T === H) {
3786
+ const S = R((D) => {
3787
+ D.target.parentNode instanceof HTMLElement && (D.target.parentNode.dataset.replicatedValue = D.target.value);
3788
+ }, []), L = R((D) => {
3789
+ D.target.parentNode instanceof HTMLElement && (D.target.parentNode.dataset.replicatedValue = D.target.value);
3790
+ }, []), T = i.type, N = Ht[T], [A, M] = P(() => {
3791
+ let D = [], z = [];
3792
+ if (N === H) {
3790
3793
  if (r === void 0)
3791
3794
  throw new Error("Conditional source fields must be provided when changing sections.");
3792
- const W = T.getFieldCreationSchema(r, `${n}.${e}`);
3793
- A = A.concat(
3795
+ const W = N.getFieldCreationSchema(r, `${n}.${e}`);
3796
+ D = D.concat(
3794
3797
  W.filter((U) => U.showDirectly).map((U) => U.field)
3795
3798
  ), z = z.concat(
3796
3799
  W.filter((U) => !U.showDirectly).map((U) => U.field)
3797
3800
  );
3798
3801
  } else {
3799
- if (!(T.prototype instanceof G))
3800
- throw new Error(`Field must be an instance of BaseField. Got ${T.toString()}.`);
3801
- const W = T.getFieldCreationSchema(
3802
+ if (!(N.prototype instanceof G))
3803
+ throw new Error(`Field must be an instance of BaseField. Got ${N.toString()}.`);
3804
+ const W = N.getFieldCreationSchema(
3802
3805
  `${n}.${e}`
3803
3806
  );
3804
- h ? (A = [
3805
- ...A,
3807
+ h ? (D = [
3808
+ ...D,
3806
3809
  ...W.filter((U) => U.showDirectly).map((U) => U.field)
3807
3810
  ], z = [
3808
3811
  ...z,
3809
3812
  ...W.filter((U) => !U.showDirectly).map((U) => U.field)
3810
3813
  ]) : z = [...z, ...W.map((U) => U.field)];
3811
3814
  }
3812
- return [A, z];
3813
- }, [T, r, n, e, h]), X = ft(D, {
3815
+ return [D, z];
3816
+ }, [N, r, n, e, h]), X = ft(A, {
3814
3817
  formId: st,
3815
3818
  disabled: !1,
3816
- ...T === H && { size: "sm" }
3819
+ ...N === H && { size: "sm" }
3817
3820
  }), ne = ft(M, {
3818
3821
  formId: st,
3819
3822
  disabled: !1
3820
3823
  });
3821
3824
  let B = M.length > 0;
3822
3825
  ve(i) && M.length > 0 && (B = i.conditional);
3823
- const Y = M.some((A) => {
3824
- const z = J(l, T === H ? `${n}.${e}.condition` : A.getId());
3826
+ const Y = M.some((D) => {
3827
+ const z = J(l, N === H ? `${n}.${e}.condition` : D.getId());
3825
3828
  return z && (typeof z != "object" || ye(z));
3826
3829
  }), k = Y ? we.danger : void 0, q = P(() => yn(i), [i]), de = Bi(q, { formId: st, showInputOnly: !1 }), ie = P(
3827
- () => m.flat().find((A) => A.value === R),
3828
- [m, R]
3829
- ), ue = N(() => {
3830
- b && c(() => ({
3831
- file: b
3830
+ () => m.flat().find((D) => D.value === T),
3831
+ [m, T]
3832
+ ), ue = R(() => {
3833
+ w && c(() => ({
3834
+ file: w
3832
3835
  }));
3833
- }, [c, b]);
3836
+ }, [c, w]);
3834
3837
  return /* @__PURE__ */ s("div", { className: "flex grow items-center w-full", ref: d, children: /* @__PURE__ */ x("div", { className: "flex w-full flex-col gap-2", children: [
3835
- T === H && (D.length > 0 || B) && /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
3838
+ N === H && (A.length > 0 || B) && /* @__PURE__ */ x("div", { className: "flex flex-col gap-2", children: [
3836
3839
  X,
3837
3840
  B && /* @__PURE__ */ x("div", { className: "flex items-center gap-4", children: [
3838
3841
  /* @__PURE__ */ s(
@@ -3845,7 +3848,7 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3845
3848
  ),
3846
3849
  ve(i) && i.conditional && /* @__PURE__ */ s("span", { className: "text-sm text-(--accent-a11)", "data-accent-color": k, children: /* @__PURE__ */ x("em", { children: [
3847
3850
  "Display only if ",
3848
- /* @__PURE__ */ s("strong", { children: w }),
3851
+ /* @__PURE__ */ s("strong", { children: b }),
3849
3852
  " ",
3850
3853
  v,
3851
3854
  " ",
@@ -3853,7 +3856,7 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3853
3856
  ] }) })
3854
3857
  ] })
3855
3858
  ] }),
3856
- T !== H && /* @__PURE__ */ x("div", { className: "flex gap-2 w-full justify-between", children: [
3859
+ N !== H && /* @__PURE__ */ x("div", { className: "flex gap-2 w-full justify-between", children: [
3857
3860
  /* @__PURE__ */ x("div", { className: "flex gap-2 items-center", children: [
3858
3861
  /* @__PURE__ */ x(kt, { accentColor: "base", variant: "soft", size: "sm", children: [
3859
3862
  ie == null ? void 0 : ie.icon,
@@ -3863,8 +3866,8 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3863
3866
  We,
3864
3867
  {
3865
3868
  name: `${n}.${e}.required`,
3866
- render: ({ setValue: A, value: z }) => /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
3867
- /* @__PURE__ */ s(lt.Root, { checked: z, onCheckedChange: A, size: "sm", children: /* @__PURE__ */ s(lt.Indicator, { children: /* @__PURE__ */ s(F, { icon: "RiCheckLine" }) }) }),
3869
+ render: ({ setValue: D, value: z }) => /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
3870
+ /* @__PURE__ */ s(lt.Root, { checked: z, onCheckedChange: D, size: "sm", children: /* @__PURE__ */ s(lt.Indicator, { children: /* @__PURE__ */ s(F, { icon: "RiCheckLine" }) }) }),
3868
3871
  /* @__PURE__ */ s(ge, { size: "sm", accentColor: "base", children: "Required" })
3869
3872
  ] })
3870
3873
  }
@@ -3879,13 +3882,13 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3879
3882
  }
3880
3883
  )
3881
3884
  ] }),
3882
- b && /* @__PURE__ */ x("div", { className: "group relative inline-block w-full min-w-[300px]", children: [
3885
+ w && /* @__PURE__ */ x("div", { className: "group relative inline-block w-full min-w-[300px]", children: [
3883
3886
  /* @__PURE__ */ s(
3884
3887
  "img",
3885
3888
  {
3886
3889
  className: "h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",
3887
3890
  src: g,
3888
- alt: b.name,
3891
+ alt: w.name,
3889
3892
  onClick: ue
3890
3893
  }
3891
3894
  ),
@@ -3906,14 +3909,14 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3906
3909
  We,
3907
3910
  {
3908
3911
  name: `${n}.${e}.label`,
3909
- render: ({ setValue: A, value: z }) => /* @__PURE__ */ s(
3912
+ render: ({ setValue: D, value: z }) => /* @__PURE__ */ s(
3910
3913
  "input",
3911
3914
  {
3912
3915
  className: "bg-transparent outline-none text-sm placeholder-(--base-a9)",
3913
- placeholder: R === "section" ? "Enter a section label (optional)" : "Enter your question",
3916
+ placeholder: T === "section" ? "Enter a section label (optional)" : "Enter your question",
3914
3917
  value: z,
3915
3918
  onChange: (W) => {
3916
- A(W.target.value);
3919
+ D(W.target.value);
3917
3920
  },
3918
3921
  onInput: S,
3919
3922
  maxLength: 200
@@ -3925,14 +3928,14 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3925
3928
  We,
3926
3929
  {
3927
3930
  name: `${n}.${e}.description`,
3928
- render: ({ setValue: A, value: z }) => /* @__PURE__ */ s(
3931
+ render: ({ setValue: D, value: z }) => /* @__PURE__ */ s(
3929
3932
  "textarea",
3930
3933
  {
3931
3934
  className: "bg-transparent outline-none text-sm field-sizing-content grow placeholder-(--base-a9)",
3932
- placeholder: `Enter a ${R === "section" ? "section" : "field"} description (optional)`,
3935
+ placeholder: `Enter a ${T === "section" ? "section" : "field"} description (optional)`,
3933
3936
  value: z,
3934
3937
  onChange: (W) => {
3935
- A(W.target.value);
3938
+ D(W.target.value);
3936
3939
  },
3937
3940
  onInput: L,
3938
3941
  maxLength: 1e3
@@ -3940,8 +3943,8 @@ const rr = (t = () => null) => P(() => Ja.map((n) => n.map((e) => {
3940
3943
  )
3941
3944
  }
3942
3945
  ),
3943
- T !== H && D.length > 0 && /* @__PURE__ */ s("div", { className: "w-full", children: X }),
3944
- T !== H && /* @__PURE__ */ x(He, { className: "flex gap-4 bg-(--accent-a2) items-center", children: [
3946
+ N !== H && A.length > 0 && /* @__PURE__ */ s("div", { className: "w-full", children: X }),
3947
+ N !== H && /* @__PURE__ */ x(He, { className: "flex gap-4 bg-(--accent-a2) items-center", children: [
3945
3948
  /* @__PURE__ */ x(Rt.Root, { children: [
3946
3949
  /* @__PURE__ */ s(Rt.Trigger, { asChild: !0, children: /* @__PURE__ */ s(kt, { icon: !0, size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ s(F, { icon: "RiEyeLine" }) }) }),
3947
3950
  /* @__PURE__ */ s(Rt.Content, { className: "w-[225px]", size: "sm", align: "start", children: "This is a preview of the field as it will be rendered in the form." })
@@ -3959,7 +3962,7 @@ const or = O((t) => {
3959
3962
  initial: n
3960
3963
  }),
3961
3964
  [n, e, d]
3962
- ), h = N(() => {
3965
+ ), h = R(() => {
3963
3966
  const f = n.label || "Unlabelled field", g = {
3964
3967
  ...n,
3965
3968
  label: f
@@ -3968,24 +3971,24 @@ const or = O((t) => {
3968
3971
  title: "Field duplicated",
3969
3972
  description: `The field "${f}" has been duplicated`
3970
3973
  });
3971
- }, [n, d, e, a, o, m]), y = N(
3974
+ }, [n, d, e, a, o, m]), y = R(
3972
3975
  (f) => {
3973
3976
  const g = i, C = a.fields[g];
3974
- let w = i, v = f === "up" ? e - 1 : e + 1;
3975
- f === "up" && e === 0 ? (w = i - 1, v = a.fields[w].fields.length) : f === "down" && e === C.fields.length - 1 && (w = i + 1, v = 0);
3976
- const E = a.fields[w];
3977
+ let b = i, v = f === "up" ? e - 1 : e + 1;
3978
+ f === "up" && e === 0 ? (b = i - 1, v = a.fields[b].fields.length) : f === "down" && e === C.fields.length - 1 && (b = i + 1, v = 0);
3979
+ const E = a.fields[b];
3977
3980
  l(
3978
3981
  C,
3979
3982
  g,
3980
3983
  e,
3981
3984
  E,
3982
- w,
3985
+ b,
3983
3986
  v,
3984
3987
  o
3985
3988
  );
3986
3989
  },
3987
3990
  [i, a.fields, e, l, o]
3988
- ), b = N(
3991
+ ), w = R(
3989
3992
  (f) => {
3990
3993
  const { files: g } = f.target;
3991
3994
  if (!g || g.length !== 1) return;
@@ -4024,7 +4027,7 @@ const or = O((t) => {
4024
4027
  remove: r,
4025
4028
  duplicate: h,
4026
4029
  move: y,
4027
- upload: b
4030
+ upload: w
4028
4031
  }
4029
4032
  )
4030
4033
  ] })
@@ -4034,52 +4037,52 @@ const or = O((t) => {
4034
4037
  or.displayName = "FieldWithActions";
4035
4038
  const ar = O((t) => {
4036
4039
  var E;
4037
- const { field: n, index: e, dropState: i, fieldsOnly: r } = t, o = (E = i[n.identifier]) == null ? void 0 : E.disabled, { setFieldValue: a, values: l } = Ie(), m = ur(), { reorderSection: c } = gn(), { showInfo: d } = Ct(), u = N(
4040
+ const { field: n, index: e, dropState: i, fieldsOnly: r } = t, o = (E = i[n.identifier]) == null ? void 0 : E.disabled, { setFieldValue: a, values: l } = Ie(), m = ur(), { reorderSection: c } = gn(), { showInfo: d } = Ct(), u = R(
4038
4041
  (S, L) => {
4039
- for (const R of S) {
4040
- const T = L.indexOf(R);
4041
- a(`fields.${T}.condition`, null).then(), a(`fields.${T}.conditional`, !1).then();
4042
+ for (const T of S) {
4043
+ const N = L.indexOf(T);
4044
+ a(`fields.${N}.condition`, null).then(), a(`fields.${N}.conditional`, !1).then();
4042
4045
  }
4043
4046
  },
4044
4047
  [a]
4045
- ), h = N(
4048
+ ), h = R(
4046
4049
  (S) => {
4047
- var T;
4050
+ var N;
4048
4051
  const L = n.fields[S];
4049
4052
  if (!L) throw new Error("Could not find field to remove.");
4050
- const R = [];
4051
- for (const D of l.fields)
4052
- ((T = D.condition) == null ? void 0 : T.identifier) === L.identifier && R.push(D);
4053
+ const T = [];
4054
+ for (const A of l.fields)
4055
+ ((N = A.condition) == null ? void 0 : N.identifier) === L.identifier && T.push(A);
4053
4056
  return {
4054
4057
  removing: L,
4055
- affectedSections: R,
4058
+ affectedSections: T,
4056
4059
  action: () => a(`fields.${e}.fields`, ht(n.fields, S))
4057
4060
  };
4058
4061
  },
4059
4062
  [n.fields, l.fields, a, e]
4060
- ), y = N(
4063
+ ), y = R(
4061
4064
  (S) => {
4062
- const { affectedSections: L, action: R, removing: T } = h(S), D = () => {
4063
- R().then(), u(L, l.fields);
4065
+ const { affectedSections: L, action: T, removing: N } = h(S), A = () => {
4066
+ T().then(), u(L, l.fields);
4064
4067
  };
4065
4068
  if (L.length > 0) {
4066
4069
  const M = L.map((X) => X.label).join(", ");
4067
4070
  m({
4068
4071
  title: "Remove condition?",
4069
- description: `${T.label} is being used as a condition, deleting it will remove the condition from the ${M} section(s).`,
4072
+ description: `${N.label} is being used as a condition, deleting it will remove the condition from the ${M} section(s).`,
4070
4073
  action: "Remove",
4071
- onAction: D
4074
+ onAction: A
4072
4075
  });
4073
4076
  return;
4074
4077
  }
4075
- D();
4078
+ A();
4076
4079
  },
4077
4080
  [h, u, l.fields, m]
4078
- ), b = N(() => {
4079
- const L = n.fields.map((B, Y) => h(Y)).flatMap((B) => B.affectedSections), R = L.length ? "Remove fields and conditions?" : "Remove fields?", T = n.fields.length, D = L.map((B) => B.label).join(", "), M = L.length ? `Deleting this section will remove the ${T} field(s) it contains and will remove the conditions from following sections: ${D}` : `Deleting this section will remove the ${T} field(s) it contains.`, X = ht(l.fields, e), ne = () => a("fields", X);
4081
+ ), w = R(() => {
4082
+ const L = n.fields.map((B, Y) => h(Y)).flatMap((B) => B.affectedSections), T = L.length ? "Remove fields and conditions?" : "Remove fields?", N = n.fields.length, A = L.map((B) => B.label).join(", "), M = L.length ? `Deleting this section will remove the ${N} field(s) it contains and will remove the conditions from following sections: ${A}` : `Deleting this section will remove the ${N} field(s) it contains.`, X = ht(l.fields, e), ne = () => a("fields", X);
4080
4083
  if (L.length > 0) {
4081
4084
  m({
4082
- title: R,
4085
+ title: T,
4083
4086
  description: M,
4084
4087
  action: "Remove",
4085
4088
  onAction: () => {
@@ -4099,7 +4102,7 @@ const ar = O((t) => {
4099
4102
  a,
4100
4103
  m,
4101
4104
  u
4102
- ]), f = N(
4105
+ ]), f = R(
4103
4106
  (S) => {
4104
4107
  const L = S === "up" ? e - 1 : e + 1;
4105
4108
  c(i, n.identifier, e, L, l, a);
@@ -4113,16 +4116,16 @@ const ar = O((t) => {
4113
4116
  conditionalSourceFields: Ui(l.fields, e)
4114
4117
  }),
4115
4118
  [n, e, l.fields]
4116
- ), C = N(() => {
4117
- const S = n.label || "Untitled section", L = n.fields.map((T) => ({
4118
- ...T,
4119
+ ), C = R(() => {
4120
+ const S = n.label || "Untitled section", L = n.fields.map((N) => ({
4121
+ ...N,
4119
4122
  identifier: pn()
4120
- })), R = { ...n, label: S, fields: L };
4121
- pt("fields", e + 1, R, l, a), d({
4123
+ })), T = { ...n, label: S, fields: L };
4124
+ pt("fields", e + 1, T, l, a), d({
4122
4125
  title: "Section duplicated",
4123
4126
  description: `The section "${S}" has been duplicated.`
4124
4127
  });
4125
- }, [n, e, l, a, d]), w = N(
4128
+ }, [n, e, l, a, d]), b = R(
4126
4129
  (S) => {
4127
4130
  pt(
4128
4131
  `fields.${e}.fields`,
@@ -4133,7 +4136,7 @@ const ar = O((t) => {
4133
4136
  );
4134
4137
  },
4135
4138
  [e, n.fields.length, l, a]
4136
- ), v = rr(w);
4139
+ ), v = rr(b);
4137
4140
  return /* @__PURE__ */ s(tn, { draggableId: n.identifier, index: e, children: (S) => /* @__PURE__ */ s(
4138
4141
  He,
4139
4142
  {
@@ -4158,17 +4161,17 @@ const ar = O((t) => {
4158
4161
  ref: L.innerRef,
4159
4162
  ...L.droppableProps,
4160
4163
  children: [
4161
- n.fields.map((R, T) => /* @__PURE__ */ s(
4164
+ n.fields.map((T, N) => /* @__PURE__ */ s(
4162
4165
  or,
4163
4166
  {
4164
- field: R,
4165
- index: T,
4167
+ field: T,
4168
+ index: N,
4166
4169
  sectionIndex: e,
4167
4170
  remove: () => {
4168
- y(T);
4171
+ y(N);
4169
4172
  }
4170
4173
  },
4171
- R.identifier
4174
+ T.identifier
4172
4175
  )),
4173
4176
  L.placeholder,
4174
4177
  /* @__PURE__ */ x(_.Root, { children: [
@@ -4176,10 +4179,10 @@ const ar = O((t) => {
4176
4179
  /* @__PURE__ */ s(F, { icon: "RiAddLine" }),
4177
4180
  " Add field"
4178
4181
  ] }) }),
4179
- /* @__PURE__ */ s(_.Content, { children: v.flat().map((R) => /* @__PURE__ */ x(_.Item, { onSelect: R.onSelect, children: [
4180
- R.icon,
4181
- R.children
4182
- ] }, R.value)) })
4182
+ /* @__PURE__ */ s(_.Content, { children: v.flat().map((T) => /* @__PURE__ */ x(_.Item, { onSelect: T.onSelect, children: [
4183
+ T.icon,
4184
+ T.children
4185
+ ] }, T.value)) })
4183
4186
  ] })
4184
4187
  ]
4185
4188
  }
@@ -4192,7 +4195,7 @@ const ar = O((t) => {
4192
4195
  {
4193
4196
  index: e,
4194
4197
  type: n.type,
4195
- remove: b,
4198
+ remove: w,
4196
4199
  duplicate: C,
4197
4200
  move: f
4198
4201
  }
@@ -4210,21 +4213,21 @@ const qn = (t, n) => {
4210
4213
  K(() => {
4211
4214
  o({ type: "update", state: Wn(e.fields) });
4212
4215
  }, [o, e.fields]);
4213
- const m = N((u) => {
4216
+ const m = R((u) => {
4214
4217
  u.type === "SECTION" && o({ type: "hold", fieldId: u.draggableId });
4215
- }, []), c = N(
4218
+ }, []), c = R(
4216
4219
  (u) => {
4217
- const { source: h, destination: y, type: b, reason: f, draggableId: g } = u;
4220
+ const { source: h, destination: y, type: w, reason: f, draggableId: g } = u;
4218
4221
  if (o({ type: "release" }), !y || f === "CANCEL") return;
4219
- if (b === "ROOT") {
4222
+ if (w === "ROOT") {
4220
4223
  a(r, g, h.index, y.index, e, i);
4221
4224
  return;
4222
4225
  }
4223
- if (b !== "SECTION") throw new Error("Unexpected droppable type.");
4224
- const [C, w] = qn(e.fields, h.droppableId) ?? [], [v, E] = qn(e.fields, y.droppableId) ?? [];
4226
+ if (w !== "SECTION") throw new Error("Unexpected droppable type.");
4227
+ const [C, b] = qn(e.fields, h.droppableId) ?? [], [v, E] = qn(e.fields, y.droppableId) ?? [];
4225
4228
  l(
4226
4229
  C,
4227
- w,
4230
+ b,
4228
4231
  h.index,
4229
4232
  v,
4230
4233
  E,
@@ -4233,7 +4236,7 @@ const qn = (t, n) => {
4233
4236
  );
4234
4237
  },
4235
4238
  [e, l, i, a, r]
4236
- ), d = N(
4239
+ ), d = R(
4237
4240
  (u) => {
4238
4241
  Oa(u + 1, e, i);
4239
4242
  },
@@ -4312,18 +4315,18 @@ const ts = () => {
4312
4315
  showTabs: c = !0,
4313
4316
  tabsListClassName: d,
4314
4317
  hydrateRevisionWithImages: u
4315
- } = t, { showError: h } = Ct(), y = N(
4316
- (w) => {
4318
+ } = t, { showError: h } = Ct(), y = R(
4319
+ (b) => {
4317
4320
  const v = {};
4318
- w.title || (v.title = "Title is required."), (!w.fields || w.fields.length === 0) && (v.fields = "At least one field is required.");
4321
+ b.title || (v.title = "Title is required."), (!b.fields || b.fields.length === 0) && (v.fields = "At least one field is required.");
4319
4322
  let E = [];
4320
- for (const [L, R] of w.fields.entries()) {
4321
- const D = Ht.section.getFieldCreationSchema(
4322
- Ui(w.fields, L),
4323
+ for (const [L, T] of b.fields.entries()) {
4324
+ const A = Ht.section.getFieldCreationSchema(
4325
+ Ui(b.fields, L),
4323
4326
  `fields.${L}`
4324
4327
  ).map((M) => M.field);
4325
- E = [...E, ...D];
4326
- for (const [M, X] of R.fields.entries()) {
4328
+ E = [...E, ...A];
4329
+ for (const [M, X] of T.fields.entries()) {
4327
4330
  const B = Ht[X.type].getFieldCreationSchema(`fields.${L}.fields.${M}`).map((Y) => Y.field);
4328
4331
  E = [...E, ...B];
4329
4332
  }
@@ -4332,7 +4335,7 @@ const ts = () => {
4332
4335
  {
4333
4336
  fields: E
4334
4337
  },
4335
- w
4338
+ b
4336
4339
  );
4337
4340
  if (S && (v.fields = S.fields), ye(v))
4338
4341
  return h({
@@ -4341,7 +4344,7 @@ const ts = () => {
4341
4344
  }), v;
4342
4345
  },
4343
4346
  [h]
4344
- ), b = P(
4347
+ ), w = P(
4345
4348
  () => ({
4346
4349
  title: o ?? "",
4347
4350
  description: "",
@@ -4349,7 +4352,7 @@ const ts = () => {
4349
4352
  }),
4350
4353
  [o]
4351
4354
  ), f = r ? u(r) : void 0, g = Yt({
4352
- initialValues: Da(f) ?? b,
4355
+ initialValues: Da(f) ?? w,
4353
4356
  validate: y,
4354
4357
  onSubmit: i,
4355
4358
  validateOnChange: !1,
@@ -4388,7 +4391,7 @@ const ts = () => {
4388
4391
  We,
4389
4392
  {
4390
4393
  name: "title",
4391
- render: ({ setValue: w, value: v, meta: E }) => /* @__PURE__ */ s(ki, { severity: "danger", helpText: E.error ?? null, children: /* @__PURE__ */ s(
4394
+ render: ({ setValue: b, value: v, meta: E }) => /* @__PURE__ */ s(ki, { severity: "danger", helpText: E.error ?? null, children: /* @__PURE__ */ s(
4392
4395
  pe.Root,
4393
4396
  {
4394
4397
  variant: "outline",
@@ -4400,7 +4403,7 @@ const ts = () => {
4400
4403
  placeholder: "Form title",
4401
4404
  value: v,
4402
4405
  onChange: (S) => {
4403
- w(S.target.value);
4406
+ b(S.target.value);
4404
4407
  },
4405
4408
  maxLength: 100
4406
4409
  }
@@ -4413,14 +4416,14 @@ const ts = () => {
4413
4416
  We,
4414
4417
  {
4415
4418
  name: "description",
4416
- render: ({ setValue: w, value: v }) => /* @__PURE__ */ s(
4419
+ render: ({ setValue: b, value: v }) => /* @__PURE__ */ s(
4417
4420
  Hn,
4418
4421
  {
4419
4422
  className: "field-sizing-content",
4420
4423
  placeholder: "Explain the purpose of this form",
4421
4424
  value: v,
4422
4425
  onChange: (E) => {
4423
- w(E.target.value);
4426
+ b(E.target.value);
4424
4427
  },
4425
4428
  resize: "vertical",
4426
4429
  maxLength: 1e3,
@@ -4463,16 +4466,16 @@ async function rs(t, n, e, i) {
4463
4466
  const os = O((t) => {
4464
4467
  const { file: n, onClose: e, onSave: i, onDelete: r, dirty: o, onDirty: a } = t;
4465
4468
  n.objectURL || (n.objectURL = URL.createObjectURL(n));
4466
- const l = me(null), m = me(null), [c, d] = $(Qn.red), [u, h] = $(null), [y, b] = $(!1), [f, g] = $(!1), C = me(null), w = fr(C);
4469
+ const l = me(null), m = me(null), [c, d] = $(Qn.red), [u, h] = $(null), [y, w] = $(!1), [f, g] = $(!1), C = me(null), b = fr(C);
4467
4470
  K(() => {
4468
4471
  const B = new Image();
4469
4472
  B.onload = function() {
4470
4473
  h({ width: B.naturalWidth, height: B.naturalHeight });
4471
4474
  }, B.src = URL.createObjectURL(n);
4472
4475
  }, [n]), K(() => {
4473
- !f && (w != null && w.width) && w.height && g(!0);
4474
- }, [w, f]);
4475
- const v = N(async () => {
4476
+ !f && (b != null && b.width) && b.height && g(!0);
4477
+ }, [b, f]);
4478
+ const v = R(async () => {
4476
4479
  o || e();
4477
4480
  const B = l.current;
4478
4481
  if (!B) return;
@@ -4483,25 +4486,25 @@ const os = O((t) => {
4483
4486
  const q = await Yn(Y), de = new File([q], n.name, { type: n.type }), ie = m.current, ue = await rs(ie, n, de, u);
4484
4487
  ue.objectURL = URL.createObjectURL(ue);
4485
4488
  const Re = await Rn(n);
4486
- await Rn(ue) !== Re && i(ue), b(!1), e();
4487
- }, b(!0), k.src = Y;
4488
- }, [o, n, e, i, u]), E = N(() => {
4489
+ await Rn(ue) !== Re && i(ue), w(!1), e();
4490
+ }, w(!0), k.src = Y;
4491
+ }, [o, n, e, i, u]), E = R(() => {
4489
4492
  r(n);
4490
- }, [n, r]), S = N(() => {
4493
+ }, [n, r]), S = R(() => {
4491
4494
  e();
4492
- }, [e]), L = N(() => {
4495
+ }, [e]), L = R(() => {
4493
4496
  a(!0);
4494
- }, [a]), R = N(() => {
4497
+ }, [a]), T = R(() => {
4495
4498
  l.current && l.current.redo();
4496
- }, []), T = N(() => {
4499
+ }, []), N = R(() => {
4497
4500
  l.current && l.current.undo();
4498
- }, []), D = N(() => {
4501
+ }, []), A = R(() => {
4499
4502
  l.current && (a(!1), l.current.clearCanvas());
4500
- }, [a]), M = N((B) => {
4503
+ }, [a]), M = R((B) => {
4501
4504
  l.current && l.current.eraseMode(B);
4502
- }, []), X = N(() => {
4505
+ }, []), X = R(() => {
4503
4506
  v();
4504
- }, [v]), ne = N(() => {
4507
+ }, [v]), ne = R(() => {
4505
4508
  hn.saveAs(n, n.name);
4506
4509
  }, [n]);
4507
4510
  return /* @__PURE__ */ s(dn, { open: !0, onOpenChange: e, children: /* @__PURE__ */ x(un, { children: [
@@ -4556,9 +4559,9 @@ const os = O((t) => {
4556
4559
  }
4557
4560
  ),
4558
4561
  /* @__PURE__ */ s(Xt, { orientation: "vertical", size: "full" }),
4559
- /* @__PURE__ */ s(V, { "aria-label": "undo", onClick: T, children: /* @__PURE__ */ s(F, { icon: "RiArrowGoBackLine" }) }),
4560
- /* @__PURE__ */ s(V, { "aria-label": "undo", onClick: R, children: /* @__PURE__ */ s(F, { icon: "RiArrowGoForwardLine" }) }),
4561
- /* @__PURE__ */ s(V, { "aria-label": "undo all", onClick: D, children: /* @__PURE__ */ s(F, { icon: "RiLoopLeftLine" }) })
4562
+ /* @__PURE__ */ s(V, { "aria-label": "undo", onClick: N, children: /* @__PURE__ */ s(F, { icon: "RiArrowGoBackLine" }) }),
4563
+ /* @__PURE__ */ s(V, { "aria-label": "undo", onClick: T, children: /* @__PURE__ */ s(F, { icon: "RiArrowGoForwardLine" }) }),
4564
+ /* @__PURE__ */ s(V, { "aria-label": "undo all", onClick: A, children: /* @__PURE__ */ s(F, { icon: "RiLoopLeftLine" }) })
4562
4565
  ] }),
4563
4566
  /* @__PURE__ */ x("div", { className: "flex justify-end gap-2", children: [
4564
4567
  /* @__PURE__ */ s(V, { "aria-label": "Save markup", accentColor: "primary", onClick: X, children: /* @__PURE__ */ s(F, { icon: "RiSaveLine" }) }),