@arudovwen/form-builder-react 1.8.4 → 1.8.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.
@@ -76,21 +76,21 @@ const pe = xn(void 0), Pi = {
76
76
  if (c.length === 0) return;
77
77
  const O = c[c.length - 1], B = c.slice(0, c.length - 1);
78
78
  h(B), f([r, ...p]), m(O), a == null || a("UNDO", null);
79
- }, [c, p, r, a]), N = le.useCallback(() => {
79
+ }, [c, p, r, a]), A = le.useCallback(() => {
80
80
  if (p.length === 0) return;
81
81
  const O = p[0], B = p.slice(1);
82
82
  f(B), h([...c, r]), m(O), a == null || a("REDO", null);
83
- }, [c, p, r, a]), S = r, k = c.length > 0, x = p.length > 0, [C, w] = I(!1), [T, A] = I(null), [M, R] = I([
83
+ }, [c, p, r, a]), S = r, C = c.length > 0, x = p.length > 0, [k, w] = I(!1), [T, N] = I(null), [M, R] = I([
84
84
  0
85
85
  ]), [E, V] = I(""), [Y, ee] = I(0), ae = le.useCallback(() => {
86
86
  }, []), oe = le.useCallback(() => {
87
87
  const O = ge();
88
- y((B) => [...B, { ...Pi, id: O }]), A(O), R([S.length]), a == null || a("ADD_SECTION", { sectionId: O });
88
+ y((B) => [...B, { ...Pi, id: O }]), N(O), R([S.length]), a == null || a("ADD_SECTION", { sectionId: O });
89
89
  }, [S, a, y]), $ = le.useCallback(
90
90
  (O) => {
91
91
  y(
92
92
  (B) => B.filter((K) => K.id !== O)
93
- ), A(null), a == null || a("REMOVE_SECTION", { sectionId: O });
93
+ ), N(null), a == null || a("REMOVE_SECTION", { sectionId: O });
94
94
  },
95
95
  [a, y]
96
96
  ), j = le.useCallback(
@@ -330,10 +330,10 @@ const pe = xn(void 0), Pi = {
330
330
  addSection: oe,
331
331
  removeSection: $,
332
332
  updateSection: Me,
333
- isDragging: C,
333
+ isDragging: k,
334
334
  setIsDragging: w,
335
335
  selectedSection: T,
336
- setSelectedSection: A,
336
+ setSelectedSection: N,
337
337
  activeSections: M,
338
338
  setActiveSections: R,
339
339
  updateGridElement: be,
@@ -348,8 +348,8 @@ const pe = xn(void 0), Pi = {
348
348
  showPreview: s,
349
349
  setShowPreview: o,
350
350
  undo: v,
351
- redo: N,
352
- canUndo: k,
351
+ redo: A,
352
+ canUndo: C,
353
353
  canRedo: x
354
354
  }),
355
355
  [
@@ -364,7 +364,7 @@ const pe = xn(void 0), Pi = {
364
364
  oe,
365
365
  $,
366
366
  Me,
367
- C,
367
+ k,
368
368
  T,
369
369
  M,
370
370
  be,
@@ -375,8 +375,8 @@ const pe = xn(void 0), Pi = {
375
375
  Be,
376
376
  s,
377
377
  v,
378
- N,
379
- k,
378
+ A,
379
+ C,
380
380
  x
381
381
  ]
382
382
  );
@@ -901,22 +901,22 @@ function $n(e, n) {
901
901
  };
902
902
  let l = a.body;
903
903
  [a, s].forEach((g) => {
904
- const y = [], v = g.hFlip, N = g.vFlip;
904
+ const y = [], v = g.hFlip, A = g.vFlip;
905
905
  let S = g.rotate;
906
- v ? N ? S += 2 : (y.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), y.push("scale(-1 1)"), o.top = o.left = 0) : N && (y.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), y.push("scale(1 -1)"), o.top = o.left = 0);
907
- let k;
906
+ v ? A ? S += 2 : (y.push("translate(" + (o.width + o.left).toString() + " " + (0 - o.top).toString() + ")"), y.push("scale(-1 1)"), o.top = o.left = 0) : A && (y.push("translate(" + (0 - o.left).toString() + " " + (o.height + o.top).toString() + ")"), y.push("scale(1 -1)"), o.top = o.left = 0);
907
+ let C;
908
908
  switch (S < 0 && (S -= Math.floor(S / 4) * 4), S = S % 4, S) {
909
909
  case 1:
910
- k = o.height / 2 + o.top, y.unshift("rotate(90 " + k.toString() + " " + k.toString() + ")");
910
+ C = o.height / 2 + o.top, y.unshift("rotate(90 " + C.toString() + " " + C.toString() + ")");
911
911
  break;
912
912
  case 2:
913
913
  y.unshift("rotate(180 " + (o.width / 2 + o.left).toString() + " " + (o.height / 2 + o.top).toString() + ")");
914
914
  break;
915
915
  case 3:
916
- k = o.width / 2 + o.left, y.unshift("rotate(-90 " + k.toString() + " " + k.toString() + ")");
916
+ C = o.width / 2 + o.left, y.unshift("rotate(-90 " + C.toString() + " " + C.toString() + ")");
917
917
  break;
918
918
  }
919
- S % 2 === 1 && (o.left !== o.top && (k = o.left, o.left = o.top, o.top = k), o.width !== o.height && (k = o.width, o.width = o.height, o.height = k)), y.length && (l = Yn(l, '<g transform="' + y.join(" ") + '">', "</g>"));
919
+ S % 2 === 1 && (o.left !== o.top && (C = o.left, o.left = o.top, o.top = C), o.width !== o.height && (C = o.width, o.width = o.height, o.height = C)), y.length && (l = Yn(l, '<g transform="' + y.join(" ") + '">', "</g>"));
920
920
  });
921
921
  const d = s.width, u = s.height, t = o.width, r = o.height;
922
922
  let m, c;
@@ -1174,12 +1174,12 @@ function ga(e, n, a, s) {
1174
1174
  const o = e.resources.length, l = e.random ? Math.floor(Math.random() * o) : e.index;
1175
1175
  let d;
1176
1176
  if (e.random) {
1177
- let C = e.resources.slice(0);
1178
- for (d = []; C.length > 1; ) {
1179
- const w = Math.floor(Math.random() * C.length);
1180
- d.push(C[w]), C = C.slice(0, w).concat(C.slice(w + 1));
1177
+ let k = e.resources.slice(0);
1178
+ for (d = []; k.length > 1; ) {
1179
+ const w = Math.floor(Math.random() * k.length);
1180
+ d.push(k[w]), k = k.slice(0, w).concat(k.slice(w + 1));
1181
1181
  }
1182
- d = d.concat(C);
1182
+ d = d.concat(k);
1183
1183
  } else d = e.resources.slice(l).concat(e.resources.slice(0, l));
1184
1184
  const u = Date.now();
1185
1185
  let t = "pending", r = 0, m, c = null, h = [], p = [];
@@ -1188,12 +1188,12 @@ function ga(e, n, a, s) {
1188
1188
  c && (clearTimeout(c), c = null);
1189
1189
  }
1190
1190
  function g() {
1191
- t === "pending" && (t = "aborted"), f(), h.forEach((C) => {
1192
- C.status === "pending" && (C.status = "aborted");
1191
+ t === "pending" && (t = "aborted"), f(), h.forEach((k) => {
1192
+ k.status === "pending" && (k.status = "aborted");
1193
1193
  }), h = [];
1194
1194
  }
1195
- function y(C, w) {
1196
- w && (p = []), typeof C == "function" && p.push(C);
1195
+ function y(k, w) {
1196
+ w && (p = []), typeof k == "function" && p.push(k);
1197
1197
  }
1198
1198
  function v() {
1199
1199
  return {
@@ -1206,37 +1206,37 @@ function ga(e, n, a, s) {
1206
1206
  abort: g
1207
1207
  };
1208
1208
  }
1209
- function N() {
1210
- t = "failed", p.forEach((C) => {
1211
- C(void 0, m);
1209
+ function A() {
1210
+ t = "failed", p.forEach((k) => {
1211
+ k(void 0, m);
1212
1212
  });
1213
1213
  }
1214
1214
  function S() {
1215
- h.forEach((C) => {
1216
- C.status === "pending" && (C.status = "aborted");
1215
+ h.forEach((k) => {
1216
+ k.status === "pending" && (k.status = "aborted");
1217
1217
  }), h = [];
1218
1218
  }
1219
- function k(C, w, T) {
1220
- const A = w !== "success";
1221
- switch (h = h.filter((M) => M !== C), t) {
1219
+ function C(k, w, T) {
1220
+ const N = w !== "success";
1221
+ switch (h = h.filter((M) => M !== k), t) {
1222
1222
  case "pending":
1223
1223
  break;
1224
1224
  case "failed":
1225
- if (A || !e.dataAfterTimeout) return;
1225
+ if (N || !e.dataAfterTimeout) return;
1226
1226
  break;
1227
1227
  default:
1228
1228
  return;
1229
1229
  }
1230
1230
  if (w === "abort") {
1231
- m = T, N();
1231
+ m = T, A();
1232
1232
  return;
1233
1233
  }
1234
- if (A) {
1235
- m = T, h.length || (d.length ? x() : N());
1234
+ if (N) {
1235
+ m = T, h.length || (d.length ? x() : A());
1236
1236
  return;
1237
1237
  }
1238
1238
  if (f(), S(), !e.random) {
1239
- const M = e.resources.indexOf(C.resource);
1239
+ const M = e.resources.indexOf(k.resource);
1240
1240
  M !== -1 && M !== e.index && (e.index = M);
1241
1241
  }
1242
1242
  t = "completed", p.forEach((M) => {
@@ -1246,25 +1246,25 @@ function ga(e, n, a, s) {
1246
1246
  function x() {
1247
1247
  if (t !== "pending") return;
1248
1248
  f();
1249
- const C = d.shift();
1250
- if (C === void 0) {
1249
+ const k = d.shift();
1250
+ if (k === void 0) {
1251
1251
  if (h.length) {
1252
1252
  c = setTimeout(() => {
1253
- f(), t === "pending" && (S(), N());
1253
+ f(), t === "pending" && (S(), A());
1254
1254
  }, e.timeout);
1255
1255
  return;
1256
1256
  }
1257
- N();
1257
+ A();
1258
1258
  return;
1259
1259
  }
1260
1260
  const w = {
1261
1261
  status: "pending",
1262
- resource: C,
1263
- callback: (T, A) => {
1264
- k(w, T, A);
1262
+ resource: k,
1263
+ callback: (T, N) => {
1264
+ C(w, T, N);
1265
1265
  }
1266
1266
  };
1267
- h.push(w), r++, c = setTimeout(x, e.rotate), a(C, n, w.callback);
1267
+ h.push(w), r++, c = setTimeout(x, e.rotate), a(k, n, w.callback);
1268
1268
  }
1269
1269
  return setTimeout(x), v;
1270
1270
  }
@@ -1548,11 +1548,11 @@ const Oa = (e, n, a) => {
1548
1548
  if (a) {
1549
1549
  const y = Qe(a, !1, !0);
1550
1550
  if (y) {
1551
- const v = ["iconify"], N = [
1551
+ const v = ["iconify"], A = [
1552
1552
  "provider",
1553
1553
  "prefix"
1554
1554
  ];
1555
- for (const S of N)
1555
+ for (const S of A)
1556
1556
  y[S] && v.push("iconify--" + y[S]);
1557
1557
  t.className = v.join(" ");
1558
1558
  }
@@ -1856,8 +1856,8 @@ function pn({
1856
1856
  if (l === "pdf" && (e != null && e.startsWith("data:")))
1857
1857
  try {
1858
1858
  const p = atob(e.split(",")[1]), f = new ArrayBuffer(p.length), g = new Uint8Array(f);
1859
- for (let N = 0; N < p.length; N++)
1860
- g[N] = p.charCodeAt(N);
1859
+ for (let A = 0; A < p.length; A++)
1860
+ g[A] = p.charCodeAt(A);
1861
1861
  const y = new Blob([f], { type: "application/pdf" }), v = URL.createObjectURL(y);
1862
1862
  return t(v), () => URL.revokeObjectURL(v);
1863
1863
  } catch (p) {
@@ -1988,8 +1988,8 @@ function Va({
1988
1988
  [l]
1989
1989
  ), g = _(
1990
1990
  async (x) => {
1991
- var T, A;
1992
- const C = ue("token"), w = ((T = ue("orgData")) == null ? void 0 : T.id) || ue("organizationId");
1991
+ var T, N;
1992
+ const k = ue("token"), w = ((T = ue("orgData")) == null ? void 0 : T.id) || ue("organizationId");
1993
1993
  try {
1994
1994
  const { data: M } = await Pe.post(
1995
1995
  d,
@@ -2000,36 +2000,36 @@ function Va({
2000
2000
  },
2001
2001
  {
2002
2002
  headers: {
2003
- Authorization: `Bearer ${C}`
2003
+ Authorization: `Bearer ${k}`
2004
2004
  }
2005
2005
  }
2006
2006
  );
2007
- return (A = M == null ? void 0 : M.data) == null ? void 0 : A.url;
2007
+ return (N = M == null ? void 0 : M.data) == null ? void 0 : N.url;
2008
2008
  } catch (M) {
2009
2009
  throw console.error("File upload error:", M), new Error("Failed to upload file to server");
2010
2010
  }
2011
2011
  },
2012
2012
  [d]
2013
2013
  ), y = _(
2014
- (x) => new Promise((C, w) => {
2014
+ (x) => new Promise((k, w) => {
2015
2015
  const T = new FileReader();
2016
2016
  T.onloadend = async () => {
2017
2017
  try {
2018
- const A = T.result.replace(
2018
+ const N = T.result.replace(
2019
2019
  /^data:.*;base64,/,
2020
2020
  ""
2021
2021
  ), M = d ? await g({
2022
- base64: A,
2022
+ base64: N,
2023
2023
  ext: `.${x.name.split(".").pop()}`,
2024
2024
  fileName: x.name
2025
2025
  }) : T.result;
2026
- C({
2026
+ k({
2027
2027
  base64: M,
2028
2028
  type: x.type,
2029
2029
  name: x.name
2030
2030
  });
2031
- } catch (A) {
2032
- w(A);
2031
+ } catch (N) {
2032
+ w(N);
2033
2033
  }
2034
2034
  }, T.onerror = () => w(new Error("File read failed")), T.readAsDataURL(x);
2035
2035
  }),
@@ -2037,14 +2037,14 @@ function Va({
2037
2037
  ), v = _(
2038
2038
  (x) => {
2039
2039
  var w;
2040
- const C = p ? (w = p.split(",")) == null ? void 0 : w.map((T) => T.trim()) : [];
2040
+ const k = p ? (w = p.split(",")) == null ? void 0 : w.map((T) => T.trim()) : [];
2041
2041
  for (const T of x) {
2042
2042
  if (T.size > Fa)
2043
2043
  return Ae.error(
2044
2044
  `File "${T.name}" exceeds 5MB limit (${(T.size / 1024 / 1024).toFixed(2)}MB)`
2045
2045
  ), !1;
2046
- if (C.length && !C.some(
2047
- (A) => T.type === A || T.name.toLowerCase().endsWith(A.replace("*", ""))
2046
+ if (k.length && !k.some(
2047
+ (N) => T.type === N || T.name.toLowerCase().endsWith(N.replace("*", ""))
2048
2048
  ))
2049
2049
  return Ae.error(
2050
2050
  `File "${T.name}" is not an allowed type. Allowed: ${f || "any"}`
@@ -2053,18 +2053,18 @@ function Va({
2053
2053
  return !0;
2054
2054
  },
2055
2055
  [p, f]
2056
- ), N = _(
2056
+ ), A = _(
2057
2057
  async (x) => {
2058
- const C = Array.from(x.target.files || []);
2059
- if (!(!C.length || c)) {
2060
- if (!v(C)) {
2058
+ const k = Array.from(x.target.files || []);
2059
+ if (!(!k.length || c)) {
2060
+ if (!v(k)) {
2061
2061
  t.current && (t.current.value = "");
2062
2062
  return;
2063
2063
  }
2064
2064
  try {
2065
- h(!0), u == null || u((A) => A + 1);
2066
- const w = await Promise.all(C == null ? void 0 : C.map(y)), T = s && r ? [...r, ...w] : w;
2067
- m(T), e(T), Ae.success(`Successfully uploaded ${C.length} file(s)`);
2065
+ h(!0), u == null || u((N) => N + 1);
2066
+ const w = await Promise.all(k == null ? void 0 : k.map(y)), T = s && r ? [...r, ...w] : w;
2067
+ m(T), e(T), Ae.success(`Successfully uploaded ${k.length} file(s)`);
2068
2068
  } catch (w) {
2069
2069
  console.error("Upload error:", w), Ae.error("Failed to upload file(s). Please try again.");
2070
2070
  } finally {
@@ -2075,13 +2075,13 @@ function Va({
2075
2075
  [c, v, y, e, s, r, u]
2076
2076
  ), S = _(
2077
2077
  (x) => {
2078
- c || (t.current && (t.current.value = ""), m((C) => {
2079
- const w = x === void 0 ? null : (C == null ? void 0 : C.filter((T, A) => A !== x)) || null;
2078
+ c || (t.current && (t.current.value = ""), m((k) => {
2079
+ const w = x === void 0 ? null : (k == null ? void 0 : k.filter((T, N) => N !== x)) || null;
2080
2080
  return e(w), w;
2081
2081
  }), a == null || a());
2082
2082
  },
2083
2083
  [a, e, c]
2084
- ), k = r && r.length > 0;
2084
+ ), C = r && r.length > 0;
2085
2085
  return /* @__PURE__ */ b("div", { className: "flex flex-col items-start gap-2", children: [
2086
2086
  !n && /* @__PURE__ */ b("div", { className: "!flex field-control !py-0 !px-0 relative", children: [
2087
2087
  /* @__PURE__ */ i(
@@ -2089,7 +2089,7 @@ function Va({
2089
2089
  {
2090
2090
  ref: t,
2091
2091
  type: "file",
2092
- onChange: N,
2092
+ onChange: A,
2093
2093
  disabled: n || c,
2094
2094
  multiple: s,
2095
2095
  accept: p || "",
@@ -2100,7 +2100,7 @@ function Va({
2100
2100
  hover:file:bg-blue-100 disabled:opacity-50 disabled:cursor-not-allowed`
2101
2101
  }
2102
2102
  ),
2103
- k && /* @__PURE__ */ i(
2103
+ C && /* @__PURE__ */ i(
2104
2104
  "button",
2105
2105
  {
2106
2106
  type: "button",
@@ -2112,19 +2112,19 @@ function Va({
2112
2112
  }
2113
2113
  )
2114
2114
  ] }),
2115
- k && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2115
+ C && /* @__PURE__ */ b("div", { className: "relative grid gap-y-1 flex-1 w-full", children: [
2116
2116
  c && /* @__PURE__ */ i("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-white/60 rounded", children: /* @__PURE__ */ b("div", { className: "flex items-center gap-2 text-sm text-blue-600 font-medium", children: [
2117
2117
  /* @__PURE__ */ i("span", { className: "animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full" }),
2118
2118
  "Uploading..."
2119
2119
  ] }) }),
2120
- typeof r == "object" && (r == null ? void 0 : r.map((x, C) => /* @__PURE__ */ i(
2120
+ typeof r == "object" && (r == null ? void 0 : r.map((x, k) => /* @__PURE__ */ i(
2121
2121
  pn,
2122
2122
  {
2123
2123
  fileUrl: x.base64,
2124
2124
  fileName: x.name,
2125
- removeFile: () => S(C)
2125
+ removeFile: () => S(k)
2126
2126
  },
2127
- `${x.name}-${C}`
2127
+ `${x.name}-${k}`
2128
2128
  )))
2129
2129
  ] })
2130
2130
  ] });
@@ -2217,8 +2217,8 @@ const z = ({
2217
2217
  description: y,
2218
2218
  onChange: v
2219
2219
  }) => {
2220
- var S, k, x, C;
2221
- const N = a ? { ...a(n) } : {};
2220
+ var S, C, x, k;
2221
+ const A = a ? { ...a(n) } : {};
2222
2222
  if (l === "amount")
2223
2223
  return /* @__PURE__ */ b("div", { className: "space-y-1.5 relative", children: [
2224
2224
  /* @__PURE__ */ i(
@@ -2256,7 +2256,7 @@ const z = ({
2256
2256
  /* @__PURE__ */ i(
2257
2257
  "input",
2258
2258
  {
2259
- ...N,
2259
+ ...A,
2260
2260
  type: l,
2261
2261
  value: r || "",
2262
2262
  disabled: h,
@@ -2291,7 +2291,7 @@ const z = ({
2291
2291
  ]
2292
2292
  }
2293
2293
  ),
2294
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "ml-8 text-sm text-red-600", children: (k = s[n]) == null ? void 0 : k.message })
2294
+ (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "ml-8 text-sm text-red-600", children: (C = s[n]) == null ? void 0 : C.message })
2295
2295
  ] });
2296
2296
  }
2297
2297
  return l === "textarea" ? /* @__PURE__ */ b("div", { className: "space-y-1.5 relative", children: [
@@ -2305,10 +2305,10 @@ const z = ({
2305
2305
  /* @__PURE__ */ i(
2306
2306
  "textarea",
2307
2307
  {
2308
- ...N,
2308
+ ...A,
2309
2309
  onChange: (w) => {
2310
2310
  var T;
2311
- (T = N.onChange) == null || T.call(N, w), v == null || v(w);
2311
+ (T = A.onChange) == null || T.call(A, w), v == null || v(w);
2312
2312
  },
2313
2313
  className: `field-control ${s != null && s[n] ? "border-red-300" : "border-[#D0D5DD]"} ${o}`,
2314
2314
  placeholder: d,
@@ -2328,10 +2328,10 @@ const z = ({
2328
2328
  /* @__PURE__ */ i(
2329
2329
  "input",
2330
2330
  {
2331
- ...N,
2331
+ ...A,
2332
2332
  onChange: (w) => {
2333
2333
  var T;
2334
- (T = N.onChange) == null || T.call(N, w), v == null || v(w);
2334
+ (T = A.onChange) == null || T.call(A, w), v == null || v(w);
2335
2335
  },
2336
2336
  type: l,
2337
2337
  className: `field-control ${s != null && s[n] ? "border-red-300" : "border-[#D0D5DD]"} ${o}`,
@@ -2343,7 +2343,7 @@ const z = ({
2343
2343
  "data-1p-ignore": !0
2344
2344
  }
2345
2345
  ),
2346
- (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (C = s[n]) == null ? void 0 : C.message })
2346
+ (s == null ? void 0 : s[n]) && /* @__PURE__ */ i("p", { className: "mt-1 text-sm text-red-600", children: (k = s[n]) == null ? void 0 : k.message })
2347
2347
  ] });
2348
2348
  };
2349
2349
  function za({
@@ -2413,33 +2413,33 @@ const Ie = ({
2413
2413
  loading: p,
2414
2414
  disabled: f
2415
2415
  }) => {
2416
- const [g, y] = I(r ? [] : null), v = re(!1), N = X(() => !u || !e || e.length === 0 ? r ? [] : null : r ? Array.isArray(u) ? e.filter((x) => u.some(
2417
- (C) => {
2416
+ const [g, y] = I(r ? [] : null), v = re(!1), A = X(() => !u || !e || e.length === 0 ? r ? [] : null : r ? Array.isArray(u) ? e.filter((x) => u.some(
2417
+ (k) => {
2418
2418
  var w;
2419
- return typeof x.value == "object" ? ((w = x.value) == null ? void 0 : w.id) === (C == null ? void 0 : C.id) : x.value === C;
2419
+ return typeof x.value == "object" ? ((w = x.value) == null ? void 0 : w.id) === (k == null ? void 0 : k.id) : x.value === k;
2420
2420
  }
2421
2421
  )) : [] : e.find((x) => {
2422
- var C;
2423
- return typeof x.value == "string" && typeof u == "string" ? x.value.toLowerCase() === u.toLowerCase() : typeof x.value == "object" && typeof u == "object" ? ((C = x.value) == null ? void 0 : C.id) === (u == null ? void 0 : u.id) : x.value === u;
2422
+ var k;
2423
+ return typeof x.value == "string" && typeof u == "string" ? x.value.toLowerCase() === u.toLowerCase() : typeof x.value == "object" && typeof u == "object" ? ((k = x.value) == null ? void 0 : k.id) === (u == null ? void 0 : u.id) : x.value === u;
2424
2424
  }) || null, [u, e, r]);
2425
2425
  G(() => {
2426
2426
  if (v.current) {
2427
2427
  v.current = !1;
2428
2428
  return;
2429
2429
  }
2430
- if (r && Array.isArray(N) && Array.isArray(g)) {
2431
- const x = g == null ? void 0 : g.map((w) => w.value), C = N == null ? void 0 : N.map((w) => w.value);
2432
- JSON.stringify(x) !== JSON.stringify(C) && y(N);
2433
- } else (N == null ? void 0 : N.value) !== (g == null ? void 0 : g.value) && y(N);
2434
- }, [N, r]);
2430
+ if (r && Array.isArray(A) && Array.isArray(g)) {
2431
+ const x = g == null ? void 0 : g.map((w) => w.value), k = A == null ? void 0 : A.map((w) => w.value);
2432
+ JSON.stringify(x) !== JSON.stringify(k) && y(A);
2433
+ } else (A == null ? void 0 : A.value) !== (g == null ? void 0 : g.value) && y(A);
2434
+ }, [A, r]);
2435
2435
  const S = _((x) => {
2436
- var C;
2436
+ var k;
2437
2437
  if (v.current = !0, y(x), o) {
2438
- const w = r ? Array.isArray(x) ? x == null ? void 0 : x.map((T) => T.value) : [] : (C = x == null ? void 0 : x.value) != null ? C : null;
2438
+ const w = r ? Array.isArray(x) ? x == null ? void 0 : x.map((T) => T.value) : [] : (k = x == null ? void 0 : x.value) != null ? k : null;
2439
2439
  o(l, w), t == null || t(l);
2440
2440
  }
2441
2441
  s && !v.current && s(l);
2442
- }, [o, l, t, s, r]), k = X(() => p ? "Fetching data..." : g ? r && Array.isArray(g) ? g.length > 0 ? g == null ? void 0 : g.map((x) => x.label).join(", ") : n : (g == null ? void 0 : g.label) || n : n, [g, p, n, r]);
2442
+ }, [o, l, t, s, r]), C = X(() => p ? "Fetching data..." : g ? r && Array.isArray(g) ? g.length > 0 ? g == null ? void 0 : g.map((x) => x.label).join(", ") : n : (g == null ? void 0 : g.label) || n : n, [g, p, n, r]);
2443
2443
  return /* @__PURE__ */ b("div", { className: "relative", children: [
2444
2444
  !m && d && /* @__PURE__ */ i("label", { className: "block text-sm text-[#686878] darks:text-white/70 mb-2", children: d }),
2445
2445
  m && d && /* @__PURE__ */ i(
@@ -2467,7 +2467,7 @@ const Ie = ({
2467
2467
  className: q("block text-sm text-left truncate", {
2468
2468
  "opacity-60": !g || p
2469
2469
  }),
2470
- children: k
2470
+ children: C
2471
2471
  }
2472
2472
  ),
2473
2473
  /* @__PURE__ */ i("span", { className: "absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) })
@@ -2478,7 +2478,7 @@ const Ie = ({
2478
2478
  leave: "transition ease-in duration-100",
2479
2479
  leaveFrom: "opacity-100",
2480
2480
  leaveTo: "opacity-0",
2481
- children: /* @__PURE__ */ i(ne.Options, { anchor: "bottom start", className: "select-button-options", children: e.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No options available" }) : e == null ? void 0 : e.map((x, C) => {
2481
+ children: /* @__PURE__ */ i(ne.Options, { anchor: "bottom start", className: "select-button-options", children: e.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No options available" }) : e == null ? void 0 : e.map((x, k) => {
2482
2482
  var w;
2483
2483
  return /* @__PURE__ */ i(
2484
2484
  ne.Option,
@@ -2487,7 +2487,7 @@ const Ie = ({
2487
2487
  className: ({ active: T }) => q("select-option", { active: T }),
2488
2488
  children: ({ selected: T }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: T }), children: x.label })
2489
2489
  },
2490
- ((w = x.value) == null ? void 0 : w.id) || x.value || C
2490
+ ((w = x.value) == null ? void 0 : w.id) || x.value || k
2491
2491
  );
2492
2492
  }) })
2493
2493
  }
@@ -2512,13 +2512,13 @@ function Ue({
2512
2512
  const [t, r] = I(""), [m, c] = I([]), [h, p] = I(!1);
2513
2513
  G(() => {
2514
2514
  (async () => {
2515
- var x, C;
2515
+ var x, k;
2516
2516
  if (n) {
2517
2517
  p(!0);
2518
2518
  try {
2519
2519
  const w = ue("token"), T = w ? { headers: { Authorization: `Bearer ${w}` } } : {};
2520
2520
  let M = (await Pe.get(n, T)).data;
2521
- if (M && !Array.isArray(M) && (M.data && Array.isArray(M.data) ? M = M.data : (x = M.data) != null && x.data && Array.isArray(M.data.data) ? M = M.data.data : M.results && Array.isArray(M.results) ? M = M.results : (C = M.data) != null && C.results && Array.isArray(M.data.results) ? M = M.data.results : M.items && Array.isArray(M.items) && (M = M.items)), Array.isArray(M)) {
2521
+ if (M && !Array.isArray(M) && (M.data && Array.isArray(M.data) ? M = M.data : (x = M.data) != null && x.data && Array.isArray(M.data.data) ? M = M.data.data : M.results && Array.isArray(M.results) ? M = M.results : (k = M.data) != null && k.results && Array.isArray(M.data.results) ? M = M.data.results : M.items && Array.isArray(M.items) && (M = M.items)), Array.isArray(M)) {
2522
2522
  const R = M.map((E) => typeof E == "string" ? { label: E, value: E } : {
2523
2523
  label: E.label || E.name || String(E.id || E.value),
2524
2524
  value: String(E.value || E.id || E.name)
@@ -2534,26 +2534,26 @@ function Ue({
2534
2534
  })();
2535
2535
  }, [n]);
2536
2536
  const f = n ? m : e, g = X(() => {
2537
- const k = a != null ? a : s;
2538
- return k == null || k === "" ? null : f.find((x) => String(x.value) === String(k) || String(x.label) === String(k)) || null;
2537
+ const C = a != null ? a : s;
2538
+ return C == null || C === "" ? null : f.find((x) => String(x.value) === String(C) || String(x.label) === String(C)) || null;
2539
2539
  }, [a, s, f]), [y, v] = I(g);
2540
2540
  G(() => {
2541
2541
  if (a !== void 0)
2542
2542
  if (a === null || a === "")
2543
2543
  v(null);
2544
2544
  else {
2545
- const k = f.find((x) => String(x.value) === String(a) || String(x.label) === String(a)) || null;
2546
- v(k);
2545
+ const C = f.find((x) => String(x.value) === String(a) || String(x.label) === String(a)) || null;
2546
+ v(C);
2547
2547
  }
2548
2548
  }, [a, f]);
2549
- const N = X(() => {
2549
+ const A = X(() => {
2550
2550
  if (t === "") return f;
2551
- const k = t.toLowerCase();
2551
+ const C = t.toLowerCase();
2552
2552
  return f.filter(
2553
- (x) => x.label.toLowerCase().includes(k)
2553
+ (x) => x.label.toLowerCase().includes(C)
2554
2554
  );
2555
- }, [t, f]), S = _((k) => {
2556
- v(k), o(d, k);
2555
+ }, [t, f]), S = _((C) => {
2556
+ v(C), o(d, C);
2557
2557
  }, [d, o]);
2558
2558
  return /* @__PURE__ */ i("div", { className: "relative w-full", children: /* @__PURE__ */ b(
2559
2559
  De,
@@ -2567,8 +2567,8 @@ function Ue({
2567
2567
  Nn,
2568
2568
  {
2569
2569
  className: `field-control ${u}`,
2570
- displayValue: (k) => (k == null ? void 0 : k.label) || "",
2571
- onChange: (k) => r(k.target.value),
2570
+ displayValue: (C) => (C == null ? void 0 : C.label) || "",
2571
+ onChange: (C) => r(C.target.value),
2572
2572
  placeholder: h ? "Loading..." : l ? "" : "Select an option..."
2573
2573
  }
2574
2574
  ),
@@ -2577,14 +2577,14 @@ function Ue({
2577
2577
  /* @__PURE__ */ i("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
2578
2578
  ] }) : /* @__PURE__ */ i(J, { icon: "octicon:chevron-down-12" }) })
2579
2579
  ] }),
2580
- /* @__PURE__ */ i(kn, { anchor: "bottom start", className: "select-options__combo", children: h ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "Loading..." }) : N.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No results found." }) : N == null ? void 0 : N.map((k) => /* @__PURE__ */ i(
2580
+ /* @__PURE__ */ i(kn, { anchor: "bottom start", className: "select-options__combo", children: h ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "Loading..." }) : A.length === 0 ? /* @__PURE__ */ i("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No results found." }) : A == null ? void 0 : A.map((C) => /* @__PURE__ */ i(
2581
2581
  Mn,
2582
2582
  {
2583
- value: k,
2584
- className: ({ active: x, selected: C }) => q("select-option", { active: x, selected: C }),
2585
- children: ({ selected: x }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: x }), children: k.label })
2583
+ value: C,
2584
+ className: ({ active: x, selected: k }) => q("select-option", { active: x, selected: k }),
2585
+ children: ({ selected: x }) => /* @__PURE__ */ i("div", { className: q("option-text", { selected: x }), children: C.label })
2586
2586
  },
2587
- k.value
2587
+ C.value
2588
2588
  )) })
2589
2589
  ]
2590
2590
  }
@@ -3560,42 +3560,42 @@ function Ao({
3560
3560
  }) {
3561
3561
  const [o, l] = I(() => Ji(e)), [d, u] = I(null), [t, r] = I(!1), [m, c] = I(""), [h, p] = I(null), f = re(null), g = re(null), y = re(/* @__PURE__ */ new Map());
3562
3562
  G(() => {
3563
- const A = Ji(e);
3564
- l(A);
3563
+ const N = Ji(e);
3564
+ l(N);
3565
3565
  }, []);
3566
3566
  const v = _(
3567
- (A) => {
3568
- n(So(A));
3567
+ (N) => {
3568
+ n(So(N));
3569
3569
  },
3570
3570
  [n]
3571
- ), N = (A, M) => {
3571
+ ), A = (N, M) => {
3572
3572
  const R = [...o];
3573
- R[A] = { type: "operator", value: M }, l(R), v(R);
3574
- }, S = (A) => {
3575
- const M = o.filter((R, E) => E !== A);
3573
+ R[N] = { type: "operator", value: M }, l(R), v(R);
3574
+ }, S = (N) => {
3575
+ const M = o.filter((R, E) => E !== N);
3576
3576
  l(M), v(M);
3577
- }, k = (A) => {
3578
- p(A), c(""), r(!0);
3579
- }, x = (A, M) => {
3577
+ }, C = (N) => {
3578
+ p(N), c(""), r(!0);
3579
+ }, x = (N, M) => {
3580
3580
  const R = M !== void 0 ? M : h != null ? h : o.length, E = [...o], V = E.slice(0, R), Y = E.slice(R), ee = [
3581
3581
  ...V,
3582
- { type: "field", id: A.id, display: A.display },
3582
+ { type: "field", id: N.id, display: N.display },
3583
3583
  ...Y
3584
- ], ae = C(ee);
3584
+ ], ae = k(ee);
3585
3585
  l(ae), v(ae), r(!1), p(null);
3586
3586
  };
3587
- function C(A) {
3587
+ function k(N) {
3588
3588
  const M = [];
3589
- if (A.length === 0) return [{ type: "operator", value: "" }];
3590
- A[0].type === "field" && M.push({ type: "operator", value: "" });
3591
- for (let R = 0; R < A.length; R++)
3592
- M.push(A[R]), A[R].type === "field" && (R + 1 >= A.length || A[R + 1].type === "field") && M.push({ type: "operator", value: "" });
3589
+ if (N.length === 0) return [{ type: "operator", value: "" }];
3590
+ N[0].type === "field" && M.push({ type: "operator", value: "" });
3591
+ for (let R = 0; R < N.length; R++)
3592
+ M.push(N[R]), N[R].type === "field" && (R + 1 >= N.length || N[R + 1].type === "field") && M.push({ type: "operator", value: "" });
3593
3593
  return M;
3594
3594
  }
3595
3595
  const w = a.filter(
3596
- (A) => A.display.toLowerCase().includes(m.toLowerCase())
3596
+ (N) => N.display.toLowerCase().includes(m.toLowerCase())
3597
3597
  ), T = o.every(
3598
- (A) => A.type === "operator" && A.value.trim() === ""
3598
+ (N) => N.type === "operator" && N.value.trim() === ""
3599
3599
  );
3600
3600
  return /* @__PURE__ */ b("div", { className: "relative", ref: g, children: [
3601
3601
  /* @__PURE__ */ b(
@@ -3605,20 +3605,20 @@ function Ao({
3605
3605
  style: { padding: "6px 10px" },
3606
3606
  onClick: () => {
3607
3607
  var M;
3608
- const A = [...o].reverse().findIndex((R) => R.type === "operator");
3609
- if (A !== -1) {
3610
- const R = o.length - 1 - A;
3608
+ const N = [...o].reverse().findIndex((R) => R.type === "operator");
3609
+ if (N !== -1) {
3610
+ const R = o.length - 1 - N;
3611
3611
  (M = y.current.get(R)) == null || M.focus();
3612
3612
  }
3613
3613
  },
3614
3614
  children: [
3615
3615
  T && /* @__PURE__ */ i("span", { className: "text-gray-400 text-sm pointer-events-none select-none", children: s || "Build your formula..." }),
3616
- o.map((A, M) => A.type === "field" ? /* @__PURE__ */ b(
3616
+ o.map((N, M) => N.type === "field" ? /* @__PURE__ */ b(
3617
3617
  "span",
3618
3618
  {
3619
3619
  className: "inline-flex items-center gap-1 bg-blue-100 text-blue-800 text-sm px-2 py-0.5 rounded-full font-medium select-none",
3620
3620
  children: [
3621
- A.display,
3621
+ N.display,
3622
3622
  /* @__PURE__ */ i(
3623
3623
  "button",
3624
3624
  {
@@ -3627,7 +3627,7 @@ function Ao({
3627
3627
  R.preventDefault(), S(M);
3628
3628
  },
3629
3629
  className: "text-blue-400 hover:text-blue-700 leading-none ml-0.5",
3630
- "aria-label": `Remove ${A.display}`,
3630
+ "aria-label": `Remove ${N.display}`,
3631
3631
  children: "×"
3632
3632
  }
3633
3633
  )
@@ -3641,13 +3641,13 @@ function Ao({
3641
3641
  R ? y.current.set(M, R) : y.current.delete(M);
3642
3642
  },
3643
3643
  type: "text",
3644
- value: A.value,
3645
- onChange: (R) => N(M, R.target.value),
3644
+ value: N.value,
3645
+ onChange: (R) => A(M, R.target.value),
3646
3646
  onFocus: () => u(M),
3647
3647
  onBlur: () => u(null),
3648
3648
  className: "border-none outline-none bg-transparent text-sm font-mono p-0 m-0",
3649
3649
  style: {
3650
- width: `${Math.max(A.value.length * 9 + 8, d === M ? 40 : 14)}px`,
3650
+ width: `${Math.max(N.value.length * 9 + 8, d === M ? 40 : 14)}px`,
3651
3651
  minWidth: "14px",
3652
3652
  maxWidth: "200px"
3653
3653
  },
@@ -3660,8 +3660,8 @@ function Ao({
3660
3660
  "button",
3661
3661
  {
3662
3662
  type: "button",
3663
- onMouseDown: (A) => {
3664
- A.preventDefault(), k(o.length);
3663
+ onMouseDown: (N) => {
3664
+ N.preventDefault(), C(o.length);
3665
3665
  },
3666
3666
  className: "inline-flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800 hover:bg-blue-50 px-1.5 py-0.5 rounded transition-colors",
3667
3667
  title: "Insert a field",
@@ -3673,7 +3673,7 @@ function Ao({
3673
3673
  ),
3674
3674
  !T && /* @__PURE__ */ b("div", { className: "mt-2 text-xs bg-blue-50 text-blue-800 border border-blue-100 rounded px-2 py-1.5 font-mono break-words", children: [
3675
3675
  /* @__PURE__ */ i("span", { className: "font-sans font-semibold text-blue-500 uppercase tracking-wide mr-1", children: "Preview:" }),
3676
- o.map((A) => A.type === "field" ? `[${A.display}]` : A.value).join("")
3676
+ o.map((N) => N.type === "field" ? `[${N.display}]` : N.value).join("")
3677
3677
  ] }),
3678
3678
  t && /* @__PURE__ */ b(he, { children: [
3679
3679
  /* @__PURE__ */ i(
@@ -3697,51 +3697,51 @@ function Ao({
3697
3697
  type: "text",
3698
3698
  placeholder: "Search fields...",
3699
3699
  value: m,
3700
- onChange: (A) => c(A.target.value),
3700
+ onChange: (N) => c(N.target.value),
3701
3701
  className: "w-full text-sm px-2 py-1 border border-gray-200 rounded outline-none focus:border-blue-300",
3702
- onKeyDown: (A) => {
3703
- A.key === "Escape" && r(!1), A.key === "Enter" && w.length > 0 && x(w[0]);
3702
+ onKeyDown: (N) => {
3703
+ N.key === "Escape" && r(!1), N.key === "Enter" && w.length > 0 && x(w[0]);
3704
3704
  }
3705
3705
  }
3706
3706
  ) }),
3707
3707
  /* @__PURE__ */ b("div", { className: "max-h-48 overflow-y-auto", children: [
3708
3708
  w.length === 0 && /* @__PURE__ */ i("p", { className: "text-xs text-gray-400 text-center py-3", children: "No matching fields" }),
3709
- w.map((A) => /* @__PURE__ */ b(
3709
+ w.map((N) => /* @__PURE__ */ b(
3710
3710
  "div",
3711
3711
  {
3712
3712
  onMouseDown: (M) => {
3713
- M.preventDefault(), x(A);
3713
+ M.preventDefault(), x(N);
3714
3714
  },
3715
3715
  className: "px-3 py-2 text-sm cursor-pointer flex items-center justify-between hover:bg-blue-50 group",
3716
3716
  children: [
3717
- /* @__PURE__ */ i("span", { className: "font-medium text-gray-800", children: A.display }),
3717
+ /* @__PURE__ */ i("span", { className: "font-medium text-gray-800", children: N.display }),
3718
3718
  /* @__PURE__ */ b("span", { className: "text-xs text-gray-400 font-mono group-hover:text-blue-400", children: [
3719
- A.id.slice(0, 8),
3719
+ N.id.slice(0, 8),
3720
3720
  "..."
3721
3721
  ] })
3722
3722
  ]
3723
3723
  },
3724
- A.id
3724
+ N.id
3725
3725
  ))
3726
3726
  ] })
3727
3727
  ]
3728
3728
  }
3729
3729
  )
3730
3730
  ] }),
3731
- a.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: a.map((A) => /* @__PURE__ */ b(
3731
+ a.length > 0 && /* @__PURE__ */ i("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: a.map((N) => /* @__PURE__ */ b(
3732
3732
  "button",
3733
3733
  {
3734
3734
  type: "button",
3735
3735
  onMouseDown: (M) => {
3736
- M.preventDefault(), x(A, o.length);
3736
+ M.preventDefault(), x(N, o.length);
3737
3737
  },
3738
3738
  className: "text-xs bg-gray-100 hover:bg-blue-50 hover:text-blue-700 border text-gray-600 px-2 py-0.5 rounded-full transition-colors",
3739
3739
  children: [
3740
3740
  "+ ",
3741
- A.display
3741
+ N.display
3742
3742
  ]
3743
3743
  },
3744
- A.id
3744
+ N.id
3745
3745
  )) })
3746
3746
  ] });
3747
3747
  }
@@ -3842,10 +3842,10 @@ const No = D.object().shape({
3842
3842
  register: g,
3843
3843
  handleSubmit: y,
3844
3844
  control: v,
3845
- setValue: N,
3845
+ setValue: A,
3846
3846
  watch: S,
3847
- trigger: k,
3848
- formState: { errors: x, isSubmitting: C, isValid: w },
3847
+ trigger: C,
3848
+ formState: { errors: x, isSubmitting: k, isValid: w },
3849
3849
  reset: T
3850
3850
  } = Si({
3851
3851
  resolver: wi(No),
@@ -3853,7 +3853,7 @@ const No = D.object().shape({
3853
3853
  ...a,
3854
3854
  options: a.options || []
3855
3855
  }
3856
- }), A = S(), { fields: M, append: R, remove: E } = ni({
3856
+ }), N = S(), { fields: M, append: R, remove: E } = ni({
3857
3857
  control: v,
3858
3858
  name: "options"
3859
3859
  }), {
@@ -3882,13 +3882,13 @@ const No = D.object().shape({
3882
3882
  }
3883
3883
  }, Se = _(async () => {
3884
3884
  var B, K, P;
3885
- if (!A.apiUrl || !/^https?:\/\//.test(A.apiUrl)) {
3885
+ if (!N.apiUrl || !/^https?:\/\//.test(N.apiUrl)) {
3886
3886
  Ae.info("Please provide a valid API URL");
3887
3887
  return;
3888
3888
  }
3889
3889
  try {
3890
3890
  r(!0);
3891
- const { status: L, data: U } = await Pe.get(A.apiUrl, ye);
3891
+ const { status: L, data: U } = await Pe.get(N.apiUrl, ye);
3892
3892
  if (L !== 200 || !U) {
3893
3893
  Ae.error("Unexpected response from server.");
3894
3894
  return;
@@ -3898,14 +3898,14 @@ const No = D.object().shape({
3898
3898
  Ae.error("Expected an array in response (data, record, or result).");
3899
3899
  return;
3900
3900
  }
3901
- ((B = a.type) == null ? void 0 : B.toLowerCase()) === "datagrid" ? N("dataColumns", xi(Z)) : N("options", yi(Z));
3901
+ ((B = a.type) == null ? void 0 : B.toLowerCase()) === "datagrid" ? A("dataColumns", xi(Z)) : A("options", yi(Z));
3902
3902
  } catch (L) {
3903
3903
  const U = ((P = (K = L == null ? void 0 : L.response) == null ? void 0 : K.data) == null ? void 0 : P.message) || (L == null ? void 0 : L.message) || "Unable to load options";
3904
3904
  Ae.error(U);
3905
3905
  } finally {
3906
3906
  r(!1);
3907
3907
  }
3908
- }, [a.type, N, A.apiUrl]), ce = ["manual", "api", "sheet"];
3908
+ }, [a.type, A, N.apiUrl]), ce = ["manual", "api", "sheet"];
3909
3909
  function be() {
3910
3910
  m === "api" && Se();
3911
3911
  }
@@ -3963,7 +3963,7 @@ const No = D.object().shape({
3963
3963
  {
3964
3964
  type: a.type,
3965
3965
  label: "Load options form sheet (csv, xlsx)",
3966
- setValue: N,
3966
+ setValue: A,
3967
3967
  name: "options"
3968
3968
  }
3969
3969
  ) }),
@@ -3986,7 +3986,7 @@ const No = D.object().shape({
3986
3986
  placeholder: "Label",
3987
3987
  onChange: (U) => {
3988
3988
  const H = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
3989
- N(`options.${L}.value`, H, {
3989
+ A(`options.${L}.value`, H, {
3990
3990
  shouldValidate: !0,
3991
3991
  shouldDirty: !0
3992
3992
  });
@@ -4058,7 +4058,7 @@ const No = D.object().shape({
4058
4058
  placeholder: "Label",
4059
4059
  onChange: (U) => {
4060
4060
  const H = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4061
- N(`options1.${L}.value`, H, {
4061
+ A(`options1.${L}.value`, H, {
4062
4062
  shouldValidate: !0,
4063
4063
  shouldDirty: !0
4064
4064
  });
@@ -4174,7 +4174,7 @@ const No = D.object().shape({
4174
4174
  {
4175
4175
  type: a.type,
4176
4176
  label: "Load columns form sheet (csv, xlsx)",
4177
- setValue: N,
4177
+ setValue: A,
4178
4178
  name: "dataColumns"
4179
4179
  }
4180
4180
  ) }),
@@ -4210,9 +4210,9 @@ const No = D.object().shape({
4210
4210
  ],
4211
4211
  register: g,
4212
4212
  name: `dataColumns.${K}.type`,
4213
- setValue: N,
4214
- trigger: k,
4215
- value: A.dataColumns[K].type
4213
+ setValue: A,
4214
+ trigger: C,
4215
+ value: N.dataColumns[K].type
4216
4216
  }
4217
4217
  ) }),
4218
4218
  /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
@@ -4224,7 +4224,7 @@ const No = D.object().shape({
4224
4224
  register: g,
4225
4225
  onChange: (U) => {
4226
4226
  const H = U.target.value.toLowerCase().trim().replace(/[\s-]+/g, "_").replace(/[^a-z0-9_]/g, "");
4227
- N(`dataColumns.${K}.field`, H, {
4227
+ A(`dataColumns.${K}.field`, H, {
4228
4228
  shouldValidate: !0,
4229
4229
  shouldDirty: !0
4230
4230
  });
@@ -4258,7 +4258,7 @@ const No = D.object().shape({
4258
4258
  }
4259
4259
  )
4260
4260
  ] }),
4261
- ((L = (P = A.dataColumns) == null ? void 0 : P[K]) == null ? void 0 : L.type) === "select" && /* @__PURE__ */ i("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4261
+ ((L = (P = N.dataColumns) == null ? void 0 : P[K]) == null ? void 0 : L.type) === "select" && /* @__PURE__ */ i("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ i("div", { className: "flex-1", children: /* @__PURE__ */ i(
4262
4262
  z,
4263
4263
  {
4264
4264
  watch: S,
@@ -4298,16 +4298,16 @@ const No = D.object().shape({
4298
4298
  )
4299
4299
  ] })
4300
4300
  ] }), Me = _(async () => {
4301
- const B = ue("token"), { status: K, data: P } = await Pe.get(A.url, {
4301
+ const B = ue("token"), { status: K, data: P } = await Pe.get(N.url, {
4302
4302
  headers: {
4303
4303
  Authorization: `Bearer ${B}`
4304
4304
  }
4305
4305
  });
4306
- K === 200 && N("options", (P == null ? void 0 : P.data) || P);
4307
- }, [N, A.url]);
4306
+ K === 200 && A("options", (P == null ? void 0 : P.data) || P);
4307
+ }, [A, N.url]);
4308
4308
  G(() => {
4309
- a.type === "document" && A.url && Me();
4310
- }, [A.url, a.type, Me]);
4309
+ a.type === "document" && N.url && Me();
4310
+ }, [N.url, a.type, Me]);
4311
4311
  const Ee = /* @__PURE__ */ i(
4312
4312
  "div",
4313
4313
  {
@@ -4434,8 +4434,8 @@ const No = D.object().shape({
4434
4434
  ],
4435
4435
  register: g,
4436
4436
  name: "method",
4437
- setValue: N,
4438
- trigger: k,
4437
+ setValue: A,
4438
+ trigger: C,
4439
4439
  value: S("method")
4440
4440
  }
4441
4441
  ),
@@ -4455,8 +4455,8 @@ const No = D.object().shape({
4455
4455
  ],
4456
4456
  register: g,
4457
4457
  name: "responseType",
4458
- setValue: N,
4459
- trigger: k,
4458
+ setValue: A,
4459
+ trigger: C,
4460
4460
  value: S("responseType")
4461
4461
  }
4462
4462
  )
@@ -4465,7 +4465,7 @@ const No = D.object().shape({
4465
4465
  mo,
4466
4466
  {
4467
4467
  onChange: (B) => {
4468
- N("denominators", B);
4468
+ A("denominators", B);
4469
4469
  },
4470
4470
  value: S("denominators")
4471
4471
  }
@@ -4489,8 +4489,8 @@ const No = D.object().shape({
4489
4489
  options: no,
4490
4490
  register: g,
4491
4491
  name: "dateFormat",
4492
- setValue: N,
4493
- trigger: k,
4492
+ setValue: A,
4493
+ trigger: C,
4494
4494
  value: S("dateFormat")
4495
4495
  }
4496
4496
  ),
@@ -4504,16 +4504,16 @@ const No = D.object().shape({
4504
4504
  errors: x,
4505
4505
  element: a,
4506
4506
  type: "checkbox",
4507
- value: A.canHaveDateRange
4507
+ value: N.canHaveDateRange
4508
4508
  }
4509
4509
  ),
4510
- (A == null ? void 0 : A.canHaveDateRange) && /* @__PURE__ */ b("div", { className: "grid grid-cols-2 gap-4", children: [
4510
+ (N == null ? void 0 : N.canHaveDateRange) && /* @__PURE__ */ b("div", { className: "grid grid-cols-2 gap-4", children: [
4511
4511
  /* @__PURE__ */ i(
4512
4512
  vi,
4513
4513
  {
4514
4514
  name: "minDate",
4515
- value: A == null ? void 0 : A.minDate,
4516
- onGetValue: N,
4515
+ value: N == null ? void 0 : N.minDate,
4516
+ onGetValue: A,
4517
4517
  placeholder: "Select min date"
4518
4518
  }
4519
4519
  ),
@@ -4521,10 +4521,10 @@ const No = D.object().shape({
4521
4521
  vi,
4522
4522
  {
4523
4523
  name: "maxDate",
4524
- value: A == null ? void 0 : A.minDate,
4525
- onGetValue: N,
4524
+ value: N == null ? void 0 : N.minDate,
4525
+ onGetValue: A,
4526
4526
  placeholder: "Select max date",
4527
- minDate: A == null ? void 0 : A.minDate
4527
+ minDate: N == null ? void 0 : N.minDate
4528
4528
  }
4529
4529
  )
4530
4530
  ] }),
@@ -4538,7 +4538,7 @@ const No = D.object().shape({
4538
4538
  errors: x,
4539
4539
  element: a,
4540
4540
  type: "checkbox",
4541
- value: A.allowYearPicker
4541
+ value: N.allowYearPicker
4542
4542
  }
4543
4543
  )
4544
4544
  ] }),
@@ -4552,7 +4552,7 @@ const No = D.object().shape({
4552
4552
  errors: x,
4553
4553
  element: a,
4554
4554
  type: "checkbox",
4555
- value: A.showState
4555
+ value: N.showState
4556
4556
  }
4557
4557
  ),
4558
4558
  a.type.toLowerCase() === "selectfield" && /* @__PURE__ */ i(
@@ -4571,8 +4571,8 @@ const No = D.object().shape({
4571
4571
  ],
4572
4572
  register: g,
4573
4573
  name: "selectType",
4574
- setValue: N,
4575
- trigger: k,
4574
+ setValue: A,
4575
+ trigger: C,
4576
4576
  value: S("selectType")
4577
4577
  }
4578
4578
  ),
@@ -4643,7 +4643,7 @@ const No = D.object().shape({
4643
4643
  errors: x,
4644
4644
  element: a,
4645
4645
  type: "checkbox",
4646
- value: A.isMultiple
4646
+ value: N.isMultiple
4647
4647
  }
4648
4648
  ),
4649
4649
  /* @__PURE__ */ i(
@@ -4652,9 +4652,9 @@ const No = D.object().shape({
4652
4652
  element: {
4653
4653
  options: ro,
4654
4654
  id: "acceptedFiles",
4655
- value: A == null ? void 0 : A.acceptedFiles
4655
+ value: N == null ? void 0 : N.acceptedFiles
4656
4656
  },
4657
- validationData: { register: g, setValue: N, trigger: k, watch: S },
4657
+ validationData: { register: g, setValue: A, trigger: C, watch: S },
4658
4658
  placeholder: "Choose file types"
4659
4659
  }
4660
4660
  )
@@ -4671,16 +4671,16 @@ const No = D.object().shape({
4671
4671
  errors: x,
4672
4672
  element: a,
4673
4673
  type: "checkbox",
4674
- value: A.isHidden
4674
+ value: N.isHidden
4675
4675
  }
4676
4676
  ) }),
4677
4677
  " ",
4678
- A.isHidden && /* @__PURE__ */ i(
4678
+ N.isHidden && /* @__PURE__ */ i(
4679
4679
  xo,
4680
4680
  {
4681
4681
  register: g,
4682
- setValue: N,
4683
- trigger: k,
4682
+ setValue: A,
4683
+ trigger: C,
4684
4684
  watch: S,
4685
4685
  id: a == null ? void 0 : a.id
4686
4686
  }
@@ -4692,7 +4692,7 @@ const No = D.object().shape({
4692
4692
  Ao,
4693
4693
  {
4694
4694
  value: S("formula") || "",
4695
- onChange: (B) => N("formula", B, {
4695
+ onChange: (B) => A("formula", B, {
4696
4696
  shouldValidate: !0,
4697
4697
  shouldDirty: !0
4698
4698
  }),
@@ -4712,10 +4712,10 @@ const No = D.object().shape({
4712
4712
  errors: x,
4713
4713
  element: a,
4714
4714
  type: "checkbox",
4715
- value: A.fetchExternalResults
4715
+ value: N.fetchExternalResults
4716
4716
  }
4717
4717
  ),
4718
- A.fetchExternalResults && /* @__PURE__ */ i(
4718
+ N.fetchExternalResults && /* @__PURE__ */ i(
4719
4719
  z,
4720
4720
  {
4721
4721
  watch: S,
@@ -4741,7 +4741,7 @@ const No = D.object().shape({
4741
4741
  errors: x,
4742
4742
  element: a,
4743
4743
  type: "checkbox",
4744
- value: A.isRequired
4744
+ value: N.isRequired
4745
4745
  }
4746
4746
  ) }),
4747
4747
  " ",
@@ -4882,10 +4882,10 @@ const No = D.object().shape({
4882
4882
  "button",
4883
4883
  {
4884
4884
  type: "submit",
4885
- disabled: !w || C,
4885
+ disabled: !w || k,
4886
4886
  style: { background: (f == null ? void 0 : f.buttonColor) || "#333" },
4887
- className: `flex-1 px-4 py-2.5 ${!w || C ? "bg-[#F2F4F7]" : "bg-[#2563EB]"} ${!w || C ? "text-[#98A2B3]" : "text-white"} rounded-lg shadow-xs font-semibold font-onest disabled:opacity-50 editor_option__save`,
4888
- children: C ? "Saving..." : "Save"
4887
+ className: `flex-1 px-4 py-2.5 ${!w || k ? "bg-[#F2F4F7]" : "bg-[#2563EB]"} ${!w || k ? "text-[#98A2B3]" : "text-white"} rounded-lg shadow-xs font-semibold font-onest disabled:opacity-50 editor_option__save`,
4888
+ children: k ? "Saving..." : "Save"
4889
4889
  }
4890
4890
  )
4891
4891
  ] })
@@ -5109,7 +5109,7 @@ function Bo({
5109
5109
  element: e,
5110
5110
  validationData: n
5111
5111
  }) {
5112
- var C;
5112
+ var k;
5113
5113
  const { register: a = () => ({}), setValue: s, watch: o } = n || {}, [l, d] = I(), [u, t] = I(!1), [r, m] = I(!1), [c, h] = I(""), p = o && o(e == null ? void 0 : e.id);
5114
5114
  G(() => {
5115
5115
  d(p);
@@ -5118,25 +5118,25 @@ function Bo({
5118
5118
  G(() => {
5119
5119
  a(e.id);
5120
5120
  }, [e.id, a]);
5121
- const { url: y, method: v, responseType: N } = e || {}, k = {
5121
+ const { url: y, method: v, responseType: A } = e || {}, C = {
5122
5122
  headers: {
5123
5123
  Authorization: `Bearer ${ue("token")}`
5124
5124
  }
5125
5125
  }, x = _(
5126
5126
  async (w) => {
5127
- var T, A, M, R, E, V, Y, ee, ae, oe, $;
5127
+ var T, N, M, R, E, V, Y, ee, ae, oe, $;
5128
5128
  if (!(!y || !v)) {
5129
5129
  t(!0);
5130
5130
  try {
5131
5131
  let j;
5132
5132
  if (v.toLowerCase() === "get") {
5133
5133
  const me = `${y}?value=${w}`;
5134
- j = await Pe.get(me, k);
5134
+ j = await Pe.get(me, C);
5135
5135
  } else if (v.toLowerCase() === "post")
5136
- j = await Pe.post(y, { value: w }, k);
5136
+ j = await Pe.post(y, { value: w }, C);
5137
5137
  else
5138
5138
  throw new Error("Unsupported HTTP method");
5139
- j.status === 200 && ((((A = (T = j == null ? void 0 : j.data) == null ? void 0 : T.data) == null ? void 0 : A.status) || ((M = j == null ? void 0 : j.data) == null ? void 0 : M.status)) === !0 ? (m(!0), N === "string" ? h(
5139
+ j.status === 200 && ((((N = (T = j == null ? void 0 : j.data) == null ? void 0 : T.data) == null ? void 0 : N.status) || ((M = j == null ? void 0 : j.data) == null ? void 0 : M.status)) === !0 ? (m(!0), A === "string" ? h(
5140
5140
  ((E = (R = j == null ? void 0 : j.data) == null ? void 0 : R.data) == null ? void 0 : E.description) || ((V = j == null ? void 0 : j.data) == null ? void 0 : V.description) || "Validation successful"
5141
5141
  ) : g(
5142
5142
  ((ee = (Y = j == null ? void 0 : j.data) == null ? void 0 : Y.data) == null ? void 0 : ee.description) || ((ae = j == null ? void 0 : j.data) == null ? void 0 : ae.description) || {}
@@ -5150,7 +5150,7 @@ function Bo({
5150
5150
  }
5151
5151
  }
5152
5152
  },
5153
- [v, N, y]
5153
+ [v, A, y]
5154
5154
  );
5155
5155
  return G(() => {
5156
5156
  if (l) {
@@ -5211,14 +5211,14 @@ function Bo({
5211
5211
  r && !u && /* @__PURE__ */ i("span", { className: "block pr-3 text-lg text-green-600", children: /* @__PURE__ */ i(J, { icon: "gg:check-o" }) })
5212
5212
  ] })
5213
5213
  ] }),
5214
- c && N === "string" && /* @__PURE__ */ i(
5214
+ c && A === "string" && /* @__PURE__ */ i(
5215
5215
  "span",
5216
5216
  {
5217
5217
  className: `${r ? "text-green-600" : "text-red-600"} text-sm`,
5218
5218
  children: c
5219
5219
  }
5220
5220
  ),
5221
- N === "object" && /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-6 mt-2 text-sm text-gray-600", children: (C = Object.entries(f)) == null ? void 0 : C.map(([w, T]) => /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
5221
+ A === "object" && /* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-6 mt-2 text-sm text-gray-600", children: (k = Object.entries(f)) == null ? void 0 : k.map(([w, T]) => /* @__PURE__ */ b("div", { className: "flex items-center gap-x-2", children: [
5222
5222
  /* @__PURE__ */ b("span", { className: "font-semibold", children: [
5223
5223
  w,
5224
5224
  ":"
@@ -5600,13 +5600,13 @@ const qi = ({
5600
5600
  loading: f,
5601
5601
  disabled: g
5602
5602
  }) => {
5603
- const [y, v] = I(m ? [] : null), N = q("custom-select__control", e), S = X(() => n, [n]);
5603
+ const [y, v] = I(m ? [] : null), A = q("custom-select__control", e), S = X(() => n, [n]);
5604
5604
  return G(() => {
5605
- const k = n == null ? void 0 : n.find((x) => {
5606
- var C;
5607
- return typeof x.value == "string" && typeof t == "string" ? x.value.toLowerCase() === t.toLowerCase() : typeof x.value == "object" && typeof t == "object" ? ((C = x.value) == null ? void 0 : C.id) === (t == null ? void 0 : t.id) : x.value === t;
5605
+ const C = n == null ? void 0 : n.find((x) => {
5606
+ var k;
5607
+ return typeof x.value == "string" && typeof t == "string" ? x.value.toLowerCase() === t.toLowerCase() : typeof x.value == "object" && typeof t == "object" ? ((k = x.value) == null ? void 0 : k.id) === (t == null ? void 0 : t.id) : x.value === t;
5608
5608
  });
5609
- v(k || null);
5609
+ v(C || null);
5610
5610
  }, [t, n]), G(() => {
5611
5611
  y && l && o && (l(d, y == null ? void 0 : y.value), o(d), r == null || r(d));
5612
5612
  }, [d, y]), /* @__PURE__ */ b("div", { className: "custom-select", children: [
@@ -5620,7 +5620,7 @@ const qi = ({
5620
5620
  multiple: m,
5621
5621
  disabled: g,
5622
5622
  children: /* @__PURE__ */ b("div", { className: "custom-select__wrapper", children: [
5623
- /* @__PURE__ */ b(ne.Button, { className: N, disabled: g, children: [
5623
+ /* @__PURE__ */ b(ne.Button, { className: A, disabled: g, children: [
5624
5624
  f ? /* @__PURE__ */ i("span", { className: "custom-select__loading", children: "Fetching data..." }) : /* @__PURE__ */ i("span", { className: "custom-select__value", children: (y == null ? void 0 : y.label) || /* @__PURE__ */ i("span", { className: "custom-select__placeholder", children: a }) }),
5625
5625
  /* @__PURE__ */ i("span", { className: "custom-select__icon", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) })
5626
5626
  ] }),
@@ -5629,22 +5629,22 @@ const qi = ({
5629
5629
  {
5630
5630
  as: le.Fragment,
5631
5631
  leave: "custom-select__transition",
5632
- children: /* @__PURE__ */ i(ne.Options, { className: "custom-select__options", anchor: "bottom", children: S == null ? void 0 : S.map((k, x) => /* @__PURE__ */ i(
5632
+ children: /* @__PURE__ */ i(ne.Options, { className: "custom-select__options", anchor: "bottom", children: S == null ? void 0 : S.map((C, x) => /* @__PURE__ */ i(
5633
5633
  ne.Option,
5634
5634
  {
5635
- value: k,
5636
- className: ({ active: C }) => q(
5635
+ value: C,
5636
+ className: ({ active: k }) => q(
5637
5637
  "custom-select__option",
5638
- C && "custom-select__option--active"
5638
+ k && "custom-select__option--active"
5639
5639
  ),
5640
- children: ({ selected: C }) => /* @__PURE__ */ i(
5640
+ children: ({ selected: k }) => /* @__PURE__ */ i(
5641
5641
  "span",
5642
5642
  {
5643
5643
  className: q(
5644
5644
  "custom-select__option-label",
5645
- C && "custom-select__option--selected"
5645
+ k && "custom-select__option--selected"
5646
5646
  ),
5647
- children: k.label
5647
+ children: C.label
5648
5648
  }
5649
5649
  )
5650
5650
  },
@@ -5670,8 +5670,8 @@ const qi = ({
5670
5670
  watch: l,
5671
5671
  isReadOnly: d
5672
5672
  } = n || {}, u = (g = e == null ? void 0 : e.id) != null ? g : "cascadeValue", [t, r] = I(""), [m, c] = I(""), h = (y, v) => {
5673
- const N = y && v ? `${y}_${v}` : "";
5674
- o == null || o(u, N), s == null || s(u);
5673
+ const A = y && v ? `${y}_${v}` : "";
5674
+ o == null || o(u, A), s == null || s(u);
5675
5675
  }, p = (y, v) => {
5676
5676
  y === "first" ? (r(v), c(""), h(v, "")) : (c(v), h(t, v));
5677
5677
  };
@@ -5679,8 +5679,8 @@ const qi = ({
5679
5679
  if (l) {
5680
5680
  const y = l(u);
5681
5681
  if (y != null && y.includes("_")) {
5682
- const [v, N] = y.split("_");
5683
- r(v), c(N);
5682
+ const [v, A] = y.split("_");
5683
+ r(v), c(A);
5684
5684
  }
5685
5685
  }
5686
5686
  }, [l, u]);
@@ -5738,21 +5738,21 @@ const qi = ({
5738
5738
  G(() => {
5739
5739
  p == null && (m == null || m(d.id, e));
5740
5740
  }, []);
5741
- const y = (N) => {
5741
+ const y = (A) => {
5742
5742
  if (!a && !h) {
5743
- const S = N + 1;
5743
+ const S = A + 1;
5744
5744
  m == null || m(d.id, S), r == null || r(d.id), s == null || s(S);
5745
5745
  }
5746
5746
  };
5747
5747
  return /* @__PURE__ */ b("div", { className: `flex gap-1 ${l}`, children: [
5748
5748
  /* @__PURE__ */ i("input", { type: "hidden", ...t(d.id) }),
5749
- Array.from({ length: n }, (N, S) => {
5750
- const k = f !== null ? S <= f : S < p;
5749
+ Array.from({ length: n }, (A, S) => {
5750
+ const C = f !== null ? S <= f : S < p;
5751
5751
  return /* @__PURE__ */ i(
5752
5752
  vn,
5753
5753
  {
5754
- icon: k ? "mdi:star" : "mdi:star-outline",
5755
- className: `cursor-pointer transition-colors ${k ? "text-yellow-400" : "text-gray-300"}`,
5754
+ icon: C ? "mdi:star" : "mdi:star-outline",
5755
+ className: `cursor-pointer transition-colors ${C ? "text-yellow-400" : "text-gray-300"}`,
5756
5756
  width: o,
5757
5757
  height: o,
5758
5758
  onMouseEnter: () => !(a || h) && g(S),
@@ -5880,8 +5880,8 @@ function Uo({
5880
5880
  }, { data: v } = await Pe.get(
5881
5881
  `${o}/${l}`,
5882
5882
  y
5883
- ), N = !!((f = (p = v == null ? void 0 : v.data) == null ? void 0 : p.isSigned) != null ? f : v != null && v.isSigned);
5884
- return r(N), N;
5883
+ ), A = !!((f = (p = v == null ? void 0 : v.data) == null ? void 0 : p.isSigned) != null ? f : v != null && v.isSigned);
5884
+ return r(A), A;
5885
5885
  } catch (g) {
5886
5886
  console.error("Failed to check sign status", g);
5887
5887
  } finally {
@@ -6196,15 +6196,15 @@ function Wo({
6196
6196
  onChange: p,
6197
6197
  onError: f
6198
6198
  }) {
6199
- const [g, y] = I(""), [v, N] = I(null), [S, k] = I(""), x = X(
6199
+ const [g, y] = I(""), [v, A] = I(null), [S, C] = I(""), x = X(
6200
6200
  () => {
6201
6201
  var E;
6202
6202
  return (E = ui == null ? void 0 : ui.slice().sort((V, Y) => V.label.localeCompare(Y.label))) == null ? void 0 : E.map((V) => ({ ...V, phone: `+${V.phone}` }));
6203
6203
  },
6204
6204
  []
6205
- ), C = X(() => g ? x.filter(
6205
+ ), k = X(() => g ? x.filter(
6206
6206
  (E) => `${E.label} ${E.phone}`.toLowerCase().includes(g.toLowerCase())
6207
- ) : x, [g, x]), w = (v == null ? void 0 : v.min) || 10, T = (v == null ? void 0 : v.max) || 10, A = () => S ? `${(v == null ? void 0 : v.phone) || "+234"}-${S}` : "", M = (E) => {
6207
+ ) : x, [g, x]), w = (v == null ? void 0 : v.min) || 10, T = (v == null ? void 0 : v.max) || 10, N = () => S ? `${(v == null ? void 0 : v.phone) || "+234"}-${S}` : "", M = (E) => {
6208
6208
  if (!E) return { code: "+234", number: "" };
6209
6209
  const V = E.split(/[-\s]/);
6210
6210
  return { code: V[0], number: V.slice(1).join(" ") };
@@ -6212,9 +6212,9 @@ function Wo({
6212
6212
  G(() => {
6213
6213
  if (d) {
6214
6214
  const E = M(d);
6215
- N(
6215
+ A(
6216
6216
  x.find((V) => V.phone === E.code) || x[0]
6217
- ), k(E.number);
6217
+ ), C(E.number);
6218
6218
  }
6219
6219
  }, [d, x]);
6220
6220
  const R = X(() => {
@@ -6223,7 +6223,7 @@ function Wo({
6223
6223
  return s && E === 0 ? "Phone number is required" : E > 0 && !/^\d+$/.test(S) ? "Phone number must contain only digits" : E > 0 && E < w ? `Minimum length is ${w}` : E > T ? `Maximum length is ${T}` : "";
6224
6224
  }, [u, S, w, T, s]);
6225
6225
  return G(() => {
6226
- p == null || p(A()), f == null || f(R || null);
6226
+ p == null || p(N()), f == null || f(R || null);
6227
6227
  }, [S, v, R]), /* @__PURE__ */ b(
6228
6228
  "div",
6229
6229
  {
@@ -6244,7 +6244,7 @@ function Wo({
6244
6244
  ),
6245
6245
  /* @__PURE__ */ b("div", { className: "relative !flex items-center input-control text-[#667085] !py-0 field-control", children: [
6246
6246
  /* @__PURE__ */ i(J, { icon: "lucide:phone-call" }),
6247
- /* @__PURE__ */ i(De, { value: v, onChange: N, children: /* @__PURE__ */ b("div", { className: "relative", children: [
6247
+ /* @__PURE__ */ i(De, { value: v, onChange: A, children: /* @__PURE__ */ b("div", { className: "relative", children: [
6248
6248
  /* @__PURE__ */ i(
6249
6249
  De.Input,
6250
6250
  {
@@ -6255,7 +6255,7 @@ function Wo({
6255
6255
  }
6256
6256
  ),
6257
6257
  /* @__PURE__ */ i(De.Button, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ i(J, { icon: "lucide:chevron-down" }) }),
6258
- /* @__PURE__ */ i(De.Options, { className: "absolute z-10 w-[250px] left-0 bg-white border rounded-md shadow-lg max-h-[400px] overflow-y-auto", children: C == null ? void 0 : C.map((E, V) => /* @__PURE__ */ b(
6258
+ /* @__PURE__ */ i(De.Options, { className: "absolute z-10 w-[250px] left-0 bg-white border rounded-md shadow-lg max-h-[400px] overflow-y-auto", children: k == null ? void 0 : k.map((E, V) => /* @__PURE__ */ b(
6259
6259
  De.Option,
6260
6260
  {
6261
6261
  value: E,
@@ -6280,7 +6280,7 @@ function Wo({
6280
6280
  readOnly: r,
6281
6281
  onChange: (E) => {
6282
6282
  const V = E.target.value.replace(/\D/g, "");
6283
- k(V);
6283
+ C(V);
6284
6284
  },
6285
6285
  placeholder: n,
6286
6286
  className: "w-full px-3 outline-none",
@@ -6434,12 +6434,12 @@ function _o({
6434
6434
  const y = await fetch(e.externalApiUrl);
6435
6435
  if (!y.ok) return;
6436
6436
  const v = await y.json();
6437
- let N = {};
6438
- Array.isArray(v) ? v.forEach((k) => {
6439
- const x = k.value || k.id || k.option, C = k.count || k.votes || k.value || 0;
6440
- x && (N[x] = Number(C));
6441
- }) : typeof v == "object" && (N = v), u(N);
6442
- const S = Object.values(N).reduce((k, x) => k + Number(x), 0);
6437
+ let A = {};
6438
+ Array.isArray(v) ? v.forEach((C) => {
6439
+ const x = C.value || C.id || C.option, k = C.count || C.votes || C.value || 0;
6440
+ x && (A[x] = Number(k));
6441
+ }) : typeof v == "object" && (A = v), u(A);
6442
+ const S = Object.values(A).reduce((C, x) => C + Number(x), 0);
6443
6443
  r(S);
6444
6444
  } catch (y) {
6445
6445
  console.error("Failed to fetch polling results", y);
@@ -6607,50 +6607,50 @@ const fn = {
6607
6607
  [e.columns]
6608
6608
  ), [p, f] = I(null);
6609
6609
  G(() => {
6610
- const k = () => {
6610
+ const C = () => {
6611
6611
  f(null), t(!1);
6612
6612
  };
6613
- return document.addEventListener("dragend", k), () => document.removeEventListener("dragend", k);
6613
+ return document.addEventListener("dragend", C), () => document.removeEventListener("dragend", C);
6614
6614
  }, [t]);
6615
6615
  const g = _(
6616
- (k, x) => {
6617
- k.preventDefault(), k.stopPropagation(), k.dataTransfer.dropEffect = "move", f(x);
6616
+ (C, x) => {
6617
+ C.preventDefault(), C.stopPropagation(), C.dataTransfer.dropEffect = "move", f(x);
6618
6618
  },
6619
6619
  []
6620
6620
  ), y = _(
6621
- (k, x) => {
6622
- k.preventDefault(), k.stopPropagation(), f(x);
6621
+ (C, x) => {
6622
+ C.preventDefault(), C.stopPropagation(), f(x);
6623
6623
  },
6624
6624
  []
6625
6625
  ), v = _(
6626
- (k, x) => {
6627
- const C = k.relatedTarget;
6628
- C && k.currentTarget.contains(C) || f((w) => w === x ? null : w);
6626
+ (C, x) => {
6627
+ const k = C.relatedTarget;
6628
+ k && C.currentTarget.contains(k) || f((w) => w === x ? null : w);
6629
6629
  },
6630
6630
  []
6631
- ), N = _(
6632
- (k, x) => {
6631
+ ), A = _(
6632
+ (C, x) => {
6633
6633
  var T;
6634
- k.preventDefault(), k.stopPropagation(), t(!1), f(null);
6635
- const C = x + 1, w = k.dataTransfer.getData("elementId");
6634
+ C.preventDefault(), C.stopPropagation(), t(!1), f(null);
6635
+ const k = x + 1, w = C.dataTransfer.getData("elementId");
6636
6636
  if (w) {
6637
6637
  r({
6638
6638
  draggedId: w,
6639
6639
  sectionId: n,
6640
6640
  targetGridId: e.id,
6641
- targetCol: C
6641
+ targetCol: k
6642
6642
  });
6643
6643
  return;
6644
6644
  }
6645
6645
  try {
6646
- const A = k.dataTransfer.getData("properties");
6647
- if (!A) return;
6648
- const M = JSON.parse(A);
6646
+ const N = C.dataTransfer.getData("properties");
6647
+ if (!N) return;
6648
+ const M = JSON.parse(N);
6649
6649
  if ((M == null ? void 0 : M.type) === "grid") return;
6650
6650
  const R = d.find((Y) => Y.id === n), E = (T = R == null ? void 0 : R.questionData) == null ? void 0 : T.find(
6651
6651
  (Y) => {
6652
6652
  var ee;
6653
- return Y.gridId === e.id && ((ee = Y.gridPosition) == null ? void 0 : ee.col) === C;
6653
+ return Y.gridId === e.id && ((ee = Y.gridPosition) == null ? void 0 : ee.col) === k;
6654
6654
  }
6655
6655
  );
6656
6656
  E && c(E.id, n);
@@ -6659,28 +6659,28 @@ const fn = {
6659
6659
  id: ge(),
6660
6660
  sectionId: n,
6661
6661
  gridId: e.id,
6662
- gridPosition: { col: C }
6662
+ gridPosition: { col: k }
6663
6663
  };
6664
6664
  u(V, n);
6665
- } catch (A) {
6666
- console.error("Drop failed in grid:", A), t(!1);
6665
+ } catch (N) {
6666
+ console.error("Drop failed in grid:", N), t(!1);
6667
6667
  }
6668
6668
  },
6669
6669
  [u, e.id, d, n, t, r]
6670
- ), S = (k, x, C) => {
6670
+ ), S = (C, x, k) => {
6671
6671
  var ee, ae, oe;
6672
- const w = k + 1, T = (ae = (ee = d.find(($) => $.id === n)) == null ? void 0 : ee.questionData) == null ? void 0 : ae.find(
6672
+ const w = C + 1, T = (ae = (ee = d.find(($) => $.id === n)) == null ? void 0 : ee.questionData) == null ? void 0 : ae.find(
6673
6673
  ($) => {
6674
6674
  var j;
6675
6675
  return $.gridId === e.id && ((j = $.gridPosition) == null ? void 0 : j.col) === w;
6676
6676
  }
6677
- ), A = (oe = T == null ? void 0 : T.id) != null ? oe : null, M = Array.isArray(a) && a.find(($) => {
6677
+ ), N = (oe = T == null ? void 0 : T.id) != null ? oe : null, M = Array.isArray(a) && a.find(($) => {
6678
6678
  var j;
6679
6679
  return ((j = $ == null ? void 0 : $.props) == null ? void 0 : j.col) === w;
6680
- }), R = m && p === k, E = !!M, V = m && !!l, Y = E && A && C === "edit" ? {
6680
+ }), R = m && p === C, E = !!M, V = m && !!l, Y = E && N && k === "edit" ? {
6681
6681
  draggable: !0,
6682
6682
  onDragStart: ($) => {
6683
- $.stopPropagation(), $.dataTransfer.setData("elementId", A), $.dataTransfer.setData("properties", A), $.dataTransfer.effectAllowed = "move", t(!0);
6683
+ $.stopPropagation(), $.dataTransfer.setData("elementId", N), $.dataTransfer.setData("properties", N), $.dataTransfer.effectAllowed = "move", t(!0);
6684
6684
  },
6685
6685
  onDragEnd: () => {
6686
6686
  f(null), t(!1);
@@ -6689,18 +6689,18 @@ const fn = {
6689
6689
  return /* @__PURE__ */ i("div", { className: "min-w-0", children: /* @__PURE__ */ b(
6690
6690
  "div",
6691
6691
  {
6692
- id: `grid-cell-${e.id}-${k}`,
6692
+ id: `grid-cell-${e.id}-${C}`,
6693
6693
  ...Y,
6694
- onDrop: ($) => N($, k),
6695
- onDragEnter: ($) => y($, k),
6696
- onDragOver: ($) => g($, k),
6697
- onDragLeave: ($) => v($, k),
6694
+ onDrop: ($) => A($, C),
6695
+ onDragEnter: ($) => y($, C),
6696
+ onDragOver: ($) => g($, C),
6697
+ onDragLeave: ($) => v($, C),
6698
6698
  className: q(
6699
6699
  "relative border rounded-lg min-h-[110px] min-w-0",
6700
6700
  "flex items-center justify-center",
6701
6701
  "transition-all duration-200 ease-in-out",
6702
- C === "edit" ? "py-3 " : "",
6703
- E && C === "edit" && "cursor-grab active:cursor-grabbing border-none",
6702
+ k === "edit" ? "py-3 " : "",
6703
+ E && k === "edit" && "cursor-grab active:cursor-grabbing border-none",
6704
6704
  x,
6705
6705
  !V && !R && "bg-white border-gray-200 text-gray-300",
6706
6706
  V && !R && !E && "bg-blue-50 border-blue-200 border-dashed text-blue-300",
@@ -6709,7 +6709,7 @@ const fn = {
6709
6709
  R && E && "bg-orange-50 border-orange-400 border-dashed shadow-inner scale-[1.01] text-orange-500"
6710
6710
  ),
6711
6711
  children: [
6712
- E && C === "edit" && /* @__PURE__ */ i("div", { className: "absolute top-1 left-1/2 -translate-x-1/2 flex items-center gap-0.5 px-2 py-0.5 rounded-full bg-gray-100 hover:bg-blue-100 text-gray-400 hover:text-blue-500 cursor-grab active:cursor-grabbing transition-colors z-10 opacity-60 hover:opacity-100 pointer-events-none select-none", children: /* @__PURE__ */ i(J, { icon: "ph:dots-six-bold" }) }),
6712
+ E && k === "edit" && /* @__PURE__ */ i("div", { className: "absolute top-1 left-1/2 -translate-x-1/2 flex items-center gap-0.5 px-2 py-0.5 rounded-full bg-gray-100 hover:bg-blue-100 text-gray-400 hover:text-blue-500 cursor-grab active:cursor-grabbing transition-colors z-10 opacity-60 hover:opacity-100 pointer-events-none select-none", children: /* @__PURE__ */ i(J, { icon: "ph:dots-six-bold" }) }),
6713
6713
  R && !E && /* @__PURE__ */ b("span", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1 text-blue-400 text-xs font-medium pointer-events-none", children: [
6714
6714
  /* @__PURE__ */ i(J, { icon: "ph:plus-bold" }),
6715
6715
  "Drop here"
@@ -6722,12 +6722,12 @@ const fn = {
6722
6722
  "w-full select-none min-w-0",
6723
6723
  R && "opacity-50 pointer-events-none"
6724
6724
  ),
6725
- children: M || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: C === "edit" && /* @__PURE__ */ i(J, { icon: "ph:plus-bold" }) })
6725
+ children: M || /* @__PURE__ */ i("span", { className: "flex items-center justify-center text-gray-300", children: k === "edit" && /* @__PURE__ */ i(J, { icon: "ph:plus-bold" }) })
6726
6726
  }
6727
6727
  )
6728
6728
  ]
6729
6729
  }
6730
- ) }, k);
6730
+ ) }, C);
6731
6731
  };
6732
6732
  return /* @__PURE__ */ i("div", { className: "relative w-full", children: /* @__PURE__ */ i(
6733
6733
  "div",
@@ -6737,7 +6737,7 @@ const fn = {
6737
6737
  gridTemplateColumns: `repeat(${e.columns}, minmax(0, 1fr))`
6738
6738
  },
6739
6739
  children: h == null ? void 0 : h.map(
6740
- (k, x) => S(x, s, o)
6740
+ (C, x) => S(x, s, o)
6741
6741
  )
6742
6742
  }
6743
6743
  ) });
@@ -6788,12 +6788,12 @@ function Qo({ elementData: e, sectionId: n }) {
6788
6788
  } = xe(pe), [u, t] = I(null), r = X(
6789
6789
  () => {
6790
6790
  var v;
6791
- return ((v = a.find((N) => N.id === n)) == null ? void 0 : v.questionData) || [];
6791
+ return ((v = a.find((A) => A.id === n)) == null ? void 0 : v.questionData) || [];
6792
6792
  },
6793
6793
  [a, n]
6794
6794
  ), m = _(
6795
- (v, N) => {
6796
- v.dataTransfer.setData("elementId", N), v.dataTransfer.setData("properties", N), v.dataTransfer.effectAllowed = "move", t(N), o(!0);
6795
+ (v, A) => {
6796
+ v.dataTransfer.setData("elementId", A), v.dataTransfer.setData("properties", A), v.dataTransfer.effectAllowed = "move", t(A), o(!0);
6797
6797
  },
6798
6798
  [o]
6799
6799
  ), c = _(() => {
@@ -6805,46 +6805,46 @@ function Qo({ elementData: e, sectionId: n }) {
6805
6805
  const h = _(
6806
6806
  (v) => {
6807
6807
  v.preventDefault(), v.stopPropagation();
6808
- const N = v.dataTransfer.getData("elementId"), S = v.currentTarget.id;
6809
- if (!N || !S || N === S) {
6808
+ const A = v.dataTransfer.getData("elementId"), S = v.currentTarget.id;
6809
+ if (!A || !S || A === S) {
6810
6810
  c();
6811
6811
  return;
6812
6812
  }
6813
- const k = r.find((C) => C.id === N), x = r.findIndex(
6814
- (C) => C.id === S
6813
+ const C = r.find((k) => k.id === A), x = r.findIndex(
6814
+ (k) => k.id === S
6815
6815
  );
6816
- k != null && k.gridId && x !== -1 ? d({ draggedId: N, sectionId: n, targetIndex: x }) : d({ draggedId: N, sectionId: n, targetId: S }), t(null), o(!1);
6816
+ C != null && C.gridId && x !== -1 ? d({ draggedId: A, sectionId: n, targetIndex: x }) : d({ draggedId: A, sectionId: n, targetId: S }), t(null), o(!1);
6817
6817
  },
6818
6818
  [n, d, o, c, r]
6819
6819
  ), p = _(
6820
- (v, N) => {
6820
+ (v, A) => {
6821
6821
  v.preventDefault(), v.stopPropagation(), o(!1);
6822
6822
  const S = v.dataTransfer.getData("elementId");
6823
6823
  if (S) {
6824
- d({ draggedId: S, sectionId: n, targetIndex: N }), t(null);
6824
+ d({ draggedId: S, sectionId: n, targetIndex: A }), t(null);
6825
6825
  return;
6826
6826
  }
6827
6827
  try {
6828
- const k = JSON.parse(v.dataTransfer.getData("properties"));
6829
- if ((k == null ? void 0 : k.type) === "section") return;
6830
- const x = { ...k, id: ge(), sectionId: n };
6831
- l(x, n, N), t(null);
6832
- } catch (k) {
6833
- console.error("Drop error:", k);
6828
+ const C = JSON.parse(v.dataTransfer.getData("properties"));
6829
+ if ((C == null ? void 0 : C.type) === "section") return;
6830
+ const x = { ...C, id: ge(), sectionId: n };
6831
+ l(x, n, A), t(null);
6832
+ } catch (C) {
6833
+ console.error("Drop error:", C);
6834
6834
  }
6835
6835
  },
6836
6836
  [l, n, o, d]
6837
6837
  ), f = _(
6838
- (v, N = !1) => /* @__PURE__ */ i(
6838
+ (v, A = !1) => /* @__PURE__ */ i(
6839
6839
  "div",
6840
6840
  {
6841
6841
  id: v.id,
6842
6842
  draggable: !0,
6843
6843
  onDragStart: (S) => m(S, v.id),
6844
- onDragOver: N ? void 0 : (S) => {
6844
+ onDragOver: A ? void 0 : (S) => {
6845
6845
  S.preventDefault(), S.stopPropagation();
6846
6846
  },
6847
- onDrop: N ? void 0 : h,
6847
+ onDrop: A ? void 0 : h,
6848
6848
  onDragEnd: c,
6849
6849
  className: q(
6850
6850
  "cursor-grab active:cursor-grabbing border p-4 w-full rounded-lg",
@@ -6856,7 +6856,7 @@ function Qo({ elementData: e, sectionId: n }) {
6856
6856
  v.id
6857
6857
  ),
6858
6858
  [u, h, n, m, c]
6859
- ), g = X(() => (e == null ? void 0 : e.reduce((v, N) => (N.gridId && (v[N.gridId] = v[N.gridId] || [], v[N.gridId].push(N)), v), {})) || {}, [e]);
6859
+ ), g = X(() => (e == null ? void 0 : e.reduce((v, A) => (A.gridId && (v[A.gridId] = v[A.gridId] || [], v[A.gridId].push(A)), v), {})) || {}, [e]);
6860
6860
  if (!(e != null && e.length))
6861
6861
  return /* @__PURE__ */ i(
6862
6862
  "div",
@@ -6880,25 +6880,25 @@ function Qo({ elementData: e, sectionId: n }) {
6880
6880
  }
6881
6881
  ),
6882
6882
  y.map((v) => {
6883
- const N = r.findIndex((S) => S.id === v.id);
6883
+ const A = r.findIndex((S) => S.id === v.id);
6884
6884
  if (v.type === "grid") {
6885
- const S = g[v.id] || [], k = u === v.id, x = !!u && !k;
6885
+ const S = g[v.id] || [], C = u === v.id, x = !!u && !C;
6886
6886
  return /* @__PURE__ */ b("div", { className: "flex flex-col gap-0", children: [
6887
6887
  /* @__PURE__ */ i(
6888
6888
  "div",
6889
6889
  {
6890
6890
  id: v.id,
6891
6891
  draggable: !0,
6892
- onDragStart: (C) => m(C, v.id),
6893
- onDragOver: (C) => {
6894
- C.preventDefault(), C.stopPropagation();
6892
+ onDragStart: (k) => m(k, v.id),
6893
+ onDragOver: (k) => {
6894
+ k.preventDefault(), k.stopPropagation();
6895
6895
  },
6896
6896
  onDrop: h,
6897
6897
  onDragEnd: c,
6898
6898
  className: q(
6899
6899
  "w-full p-4 border rounded-lg cursor-grab active:cursor-grabbing",
6900
6900
  "transition-all duration-200 ease-in-out",
6901
- k ? "opacity-40 scale-[0.98] bg-gray-100 border-dashed border-blue-400 shadow-inner" : x ? "bg-white border-dashed border-blue-200" : "bg-white border-gray-200 shadow-sm hover:border-blue-300 hover:shadow-md"
6901
+ C ? "opacity-40 scale-[0.98] bg-gray-100 border-dashed border-blue-400 shadow-inner" : x ? "bg-white border-dashed border-blue-200" : "bg-white border-gray-200 shadow-sm hover:border-blue-300 hover:shadow-md"
6902
6902
  ),
6903
6903
  children: /* @__PURE__ */ i(Ti, { element: v, state: "edit", children: /* @__PURE__ */ i(
6904
6904
  ei,
@@ -6908,9 +6908,9 @@ function Qo({ elementData: e, sectionId: n }) {
6908
6908
  state: $o,
6909
6909
  draggedElementId: u,
6910
6910
  children: S == null ? void 0 : S.map(
6911
- (C) => {
6911
+ (k) => {
6912
6912
  var w;
6913
- return /* @__PURE__ */ i(Xe, { col: (w = C.gridPosition) == null ? void 0 : w.col, children: f(C, !0) }, C.id);
6913
+ return /* @__PURE__ */ i(Xe, { col: (w = k.gridPosition) == null ? void 0 : w.col, children: f(k, !0) }, k.id);
6914
6914
  }
6915
6915
  )
6916
6916
  }
@@ -6920,7 +6920,7 @@ function Qo({ elementData: e, sectionId: n }) {
6920
6920
  /* @__PURE__ */ i(
6921
6921
  ti,
6922
6922
  {
6923
- index: N + 1,
6923
+ index: A + 1,
6924
6924
  isDragging: s,
6925
6925
  onDrop: p,
6926
6926
  onDragEnd: c
@@ -6933,7 +6933,7 @@ function Qo({ elementData: e, sectionId: n }) {
6933
6933
  /* @__PURE__ */ i(
6934
6934
  ti,
6935
6935
  {
6936
- index: N + 1,
6936
+ index: A + 1,
6937
6937
  isDragging: s,
6938
6938
  onDrop: p,
6939
6939
  onDragEnd: c
@@ -7260,30 +7260,32 @@ const Xo = Ze(Qo), es = D.object({
7260
7260
  isDragging: c,
7261
7261
  onReorderSection: h
7262
7262
  }) => {
7263
- var g, y;
7264
- const p = re(null), f = re((g = e == null ? void 0 : e.questionData) == null ? void 0 : g.length);
7263
+ var y, v;
7264
+ const p = re(null), f = re((y = e == null ? void 0 : e.questionData) == null ? void 0 : y.length), g = re(c);
7265
7265
  return G(() => {
7266
- var v, N;
7267
- if (((v = e == null ? void 0 : e.questionData) == null ? void 0 : v.length) > f.current && !c) {
7268
- const S = document.getElementById("section-container");
7269
- S && requestAnimationFrame(() => {
7270
- S.scrollTo({
7271
- top: S.scrollHeight,
7266
+ var A, S;
7267
+ if (((A = e == null ? void 0 : e.questionData) == null ? void 0 : A.length) > f.current && !c && !g.current) {
7268
+ const C = document.getElementById("section-container");
7269
+ C && requestAnimationFrame(() => {
7270
+ C.scrollTo({
7271
+ top: C.scrollHeight,
7272
7272
  behavior: "smooth"
7273
7273
  });
7274
7274
  });
7275
7275
  }
7276
- f.current = (N = e == null ? void 0 : e.questionData) == null ? void 0 : N.length;
7277
- }, [(y = e == null ? void 0 : e.questionData) == null ? void 0 : y.length, c]), /* @__PURE__ */ i(
7276
+ f.current = (S = e == null ? void 0 : e.questionData) == null ? void 0 : S.length;
7277
+ }, [(v = e == null ? void 0 : e.questionData) == null ? void 0 : v.length, c]), G(() => {
7278
+ g.current = c;
7279
+ }, [c]), /* @__PURE__ */ i(
7278
7280
  "div",
7279
7281
  {
7280
7282
  ref: p,
7281
- onDragOver: (v) => {
7282
- v.dataTransfer.types.includes("sectionid") && v.preventDefault();
7283
+ onDragOver: (A) => {
7284
+ A.dataTransfer.types.includes("sectionid") && A.preventDefault();
7283
7285
  },
7284
- onDrop: (v) => {
7285
- const N = v.dataTransfer.getData("sectionid");
7286
- N && (v.preventDefault(), v.stopPropagation(), h && h(N, e.id));
7286
+ onDrop: (A) => {
7287
+ const S = A.dataTransfer.getData("sectionid");
7288
+ S && (A.preventDefault(), A.stopPropagation(), h && h(S, e.id));
7287
7289
  },
7288
7290
  className: "bg-white group cursor-pointer rounded-lg shadow-[rgba(149,157,165,0.2)_0px_2px_2px] transition-colors duration-200",
7289
7291
  children: /* @__PURE__ */ b(
@@ -7297,8 +7299,8 @@ const Xo = Ze(Qo), es = D.object({
7297
7299
  "div",
7298
7300
  {
7299
7301
  draggable: !0,
7300
- onDragStart: (v) => {
7301
- v.dataTransfer.setData("sectionid", e.id), v.dataTransfer.effectAllowed = "move", m(!0);
7302
+ onDragStart: (A) => {
7303
+ A.dataTransfer.setData("sectionid", e.id), A.dataTransfer.effectAllowed = "move", m(!0);
7302
7304
  },
7303
7305
  onDragEnd: () => m(!1),
7304
7306
  onClick: () => s(e.id),
@@ -7385,7 +7387,7 @@ const Xo = Ze(Qo), es = D.object({
7385
7387
  activeSections: g,
7386
7388
  setActiveSections: y,
7387
7389
  setFormData: v,
7388
- isDragging: N
7390
+ isDragging: A
7389
7391
  } = xe(pe), S = re((c == null ? void 0 : c.length) || 0);
7390
7392
  G(() => {
7391
7393
  var M;
@@ -7399,7 +7401,7 @@ const Xo = Ze(Qo), es = D.object({
7399
7401
  });
7400
7402
  }), S.current = (c == null ? void 0 : c.length) || 0;
7401
7403
  }, [c == null ? void 0 : c.length]);
7402
- const k = _((M) => {
7404
+ const C = _((M) => {
7403
7405
  M.preventDefault(), M.dataTransfer.dropEffect = "move";
7404
7406
  }, []), x = _((M, R) => {
7405
7407
  v((E) => {
@@ -7409,7 +7411,7 @@ const Xo = Ze(Qo), es = D.object({
7409
7411
  return ee.splice(Y, 0, ae), ee;
7410
7412
  });
7411
7413
  }, [v]);
7412
- function C(M) {
7414
+ function k(M) {
7413
7415
  g.includes(M) ? y(
7414
7416
  (R) => R.filter((E) => E !== M)
7415
7417
  ) : y((R) => [...R, M]);
@@ -7439,7 +7441,7 @@ const Xo = Ze(Qo), es = D.object({
7439
7441
  });
7440
7442
  c.length === 1 && c[0].title === "" && c[0].description === "" && (!((E = c[0]) != null && E.questionData) || ((Y = (V = c[0]) == null ? void 0 : V.questionData) == null ? void 0 : Y.length) === 0) ? (v(oe), oe.length > 0 && p((ee = oe[0]) == null ? void 0 : ee.id)) : v((j) => [...j, ...oe]);
7441
7443
  }
7442
- }, A = ue("config");
7444
+ }, N = ue("config");
7443
7445
  return /* @__PURE__ */ b(
7444
7446
  "div",
7445
7447
  {
@@ -7469,13 +7471,13 @@ const Xo = Ze(Qo), es = D.object({
7469
7471
  selectedSection: f,
7470
7472
  setSelectedSection: p,
7471
7473
  activeSections: g,
7472
- toggleSection: C,
7474
+ toggleSection: k,
7473
7475
  handleSectionEdit: w,
7474
7476
  removeSection: r,
7475
7477
  formDataLength: c.length,
7476
- onDragOver: k,
7478
+ onDragOver: C,
7477
7479
  setIsDragging: h,
7478
- isDragging: N,
7480
+ isDragging: A,
7479
7481
  onReorderSection: x
7480
7482
  },
7481
7483
  M.id
@@ -7487,7 +7489,7 @@ const Xo = Ze(Qo), es = D.object({
7487
7489
  {
7488
7490
  type: "button",
7489
7491
  onClick: () => m(),
7490
- style: { color: (A == null ? void 0 : A.buttonColor) || "#333" },
7492
+ style: { color: (N == null ? void 0 : N.buttonColor) || "#333" },
7491
7493
  className: "text-sm font-medium",
7492
7494
  children: [
7493
7495
  "+ Add section",
@@ -7502,7 +7504,7 @@ const Xo = Ze(Qo), es = D.object({
7502
7504
  onClick: () => {
7503
7505
  a != null && a.length ? d(!0) : e && e();
7504
7506
  },
7505
- style: { color: (A == null ? void 0 : A.buttonColor) || "#333" },
7507
+ style: { color: (N == null ? void 0 : N.buttonColor) || "#333" },
7506
7508
  className: "text-sm font-medium",
7507
7509
  children: "+ Add existing template"
7508
7510
  }
@@ -7569,7 +7571,7 @@ const Xo = Ze(Qo), es = D.object({
7569
7571
  const a = ue("config"), s = (a == null ? void 0 : a.loaderColor) || "#333";
7570
7572
  document.documentElement.style.setProperty("--loader-color", s);
7571
7573
  }, []), /* @__PURE__ */ i("div", { className: n, children: /* @__PURE__ */ i("span", { className: "loader" }) });
7572
- }, ds = le.lazy(() => import("./logic-flow-DG1M8dil.js"));
7574
+ }, ds = le.lazy(() => import("./logic-flow-Bl4k5PL3.js"));
7573
7575
  function us({
7574
7576
  questionData: e,
7575
7577
  uploadUrl: n,
@@ -7898,8 +7900,8 @@ function vs({
7898
7900
  redo: g,
7899
7901
  canUndo: y,
7900
7902
  canRedo: v
7901
- } = xe(pe), [N, S] = I(!1), [k, x] = I(!1), [C, w] = I(e || ""), T = ue("config");
7902
- function A() {
7903
+ } = xe(pe), [A, S] = I(!1), [C, x] = I(!1), [k, w] = I(e || ""), T = ue("config");
7904
+ function N() {
7903
7905
  try {
7904
7906
  localStorage.setItem("formData", JSON.stringify(c));
7905
7907
  } catch (E) {
@@ -7916,7 +7918,7 @@ function vs({
7916
7918
  s == null || s(c);
7917
7919
  }
7918
7920
  function R() {
7919
- x(!1), u && C !== e && u(C.trim());
7921
+ x(!1), u && k !== e && u(k.trim());
7920
7922
  }
7921
7923
  return /* @__PURE__ */ b("div", { className: "px-[30px] py-3 flex justify-between items-center bg-[#F9F9FB] top_bar border-b h-full", children: [
7922
7924
  /* @__PURE__ */ b("span", { className: "flex items-center gap-x-2", children: [
@@ -7931,11 +7933,11 @@ function vs({
7931
7933
  }
7932
7934
  ),
7933
7935
  " ",
7934
- k ? /* @__PURE__ */ i(
7936
+ C ? /* @__PURE__ */ i(
7935
7937
  "input",
7936
7938
  {
7937
7939
  type: "text",
7938
- value: C,
7940
+ value: k,
7939
7941
  onChange: (E) => w(E.target.value),
7940
7942
  onBlur: R,
7941
7943
  autoFocus: !0,
@@ -7947,14 +7949,14 @@ function vs({
7947
7949
  title: "Click to edit",
7948
7950
  className: "text-base font-semibold cursor-pointer form_title",
7949
7951
  onClick: () => x(!0),
7950
- children: C || "Untitled"
7952
+ children: k || "Untitled"
7951
7953
  }
7952
7954
  )
7953
7955
  ] }),
7954
- N && /* @__PURE__ */ i(
7956
+ A && /* @__PURE__ */ i(
7955
7957
  ms,
7956
7958
  {
7957
- isOpen: N,
7959
+ isOpen: A,
7958
7960
  onClose: () => S(!1),
7959
7961
  element: void 0
7960
7962
  }
@@ -8046,7 +8048,7 @@ function vs({
8046
8048
  /* @__PURE__ */ i(
8047
8049
  ke,
8048
8050
  {
8049
- onClick: A,
8051
+ onClick: N,
8050
8052
  text: "Save",
8051
8053
  btnClass: "px-2 bg-transparent font-medium text-sm form_save__btn",
8052
8054
  icon: "lets-icons:save-duotone",
@@ -8545,7 +8547,7 @@ const ks = ({
8545
8547
  } : H;
8546
8548
  }),
8547
8549
  [e]
8548
- ), N = (Be = v == null ? void 0 : v.length) != null ? Be : 0, S = ue("config"), k = _(
8550
+ ), A = (Be = v == null ? void 0 : v.length) != null ? Be : 0, S = ue("config"), C = _(
8549
8551
  async (H, F, W) => {
8550
8552
  const Q = xs({
8551
8553
  formData: v,
@@ -8557,14 +8559,14 @@ const ks = ({
8557
8559
  },
8558
8560
  [v, l]
8559
8561
  ), x = Si({
8560
- resolver: k,
8562
+ resolver: C,
8561
8563
  mode: "onSubmit",
8562
8564
  defaultValues: {}
8563
8565
  }), {
8564
- register: C,
8566
+ register: k,
8565
8567
  setValue: w,
8566
8568
  control: T,
8567
- handleSubmit: A,
8569
+ handleSubmit: N,
8568
8570
  reset: M,
8569
8571
  getValues: R,
8570
8572
  watch: E,
@@ -8655,7 +8657,7 @@ const ks = ({
8655
8657
  const Q = W.gridChildren ? W.gridChildren.map((de) => de.id) : [W.id];
8656
8658
  if (!await ee(Q)) return;
8657
8659
  }
8658
- g < me.length - 1 ? y((W) => W + 1) : A(Se)();
8660
+ g < me.length - 1 ? y((W) => W + 1) : N(Se)();
8659
8661
  return;
8660
8662
  }
8661
8663
  if (!a) {
@@ -8673,7 +8675,7 @@ const ks = ({
8673
8675
  a,
8674
8676
  ee,
8675
8677
  d,
8676
- A,
8678
+ N,
8677
8679
  Se
8678
8680
  ]), be = _(() => {
8679
8681
  if (d === "conversational") {
@@ -8683,7 +8685,7 @@ const ks = ({
8683
8685
  f((H) => H - 1);
8684
8686
  }, [d]), Ne = X(
8685
8687
  () => ({
8686
- register: C,
8688
+ register: k,
8687
8689
  setValue: w,
8688
8690
  watch: E,
8689
8691
  errors: V,
@@ -8696,7 +8698,7 @@ const ks = ({
8696
8698
  apiActivityCount: h
8697
8699
  }),
8698
8700
  [
8699
- C,
8701
+ k,
8700
8702
  w,
8701
8703
  E,
8702
8704
  V,
@@ -8714,7 +8716,7 @@ const ks = ({
8714
8716
  /* @__PURE__ */ b(
8715
8717
  "form",
8716
8718
  {
8717
- onSubmit: A(Se),
8719
+ onSubmit: N(Se),
8718
8720
  className: "container h-full mx-auto",
8719
8721
  children: [
8720
8722
  /* @__PURE__ */ i("div", { className: "relative flex flex-col w-full min-w-0 py-4 gap-y-12", children: /* @__PURE__ */ b(
@@ -8778,7 +8780,7 @@ const ks = ({
8778
8780
  }
8779
8781
  )
8780
8782
  ] }),
8781
- p < N - 1 && /* @__PURE__ */ i(
8783
+ p < A - 1 && /* @__PURE__ */ i(
8782
8784
  ke,
8783
8785
  {
8784
8786
  type: "button",
@@ -8789,7 +8791,7 @@ const ks = ({
8789
8791
  }
8790
8792
  )
8791
8793
  ] }),
8792
- (p === N - 1 || l) && !a && ((U = typeof u == "function" ? u({ isUploading: h > 0, isSubmitting: Y, hasErrors: Object.keys(V).length > 0 }) : u) != null ? U : /* @__PURE__ */ i(
8794
+ (p === A - 1 || l) && !a && ((U = typeof u == "function" ? u({ isUploading: h > 0, isSubmitting: Y, hasErrors: Object.keys(V).length > 0 }) : u) != null ? U : /* @__PURE__ */ i(
8793
8795
  ke,
8794
8796
  {
8795
8797
  isDisabled: Y || Object.keys(V).length > 0 || h > 0,