@mieweb/forms-editor 0.1.4 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import E, { useState as xe, useRef as rr, useEffect as ee, useMemo as re, useCallback as be } from "react";
2
- import { useFormStore as q, useFieldsArray as Ie, useUIApi as H, EYECLOSED_ICON as Ar, EYEEDIT_ICON as Dr, PLUSSQUARE_ICON as Pr, DATALOG_ICON as Fr, X_ICON as $r, fieldTypes as le, useFormApi as tr, isVisible as Lr, getFieldComponent as Mr } from "@mieweb/forms-engine";
3
- import { AnimatePresence as Wr, motion as K } from "framer-motion";
4
- import qr from "js-yaml";
5
- import './index.css';var pe = { exports: {} }, se = {};
1
+ import k, { useState as ne, useRef as er, useEffect as se, useMemo as ue, useCallback as ge } from "react";
2
+ import { useFormStore as Y, useFieldsArray as rr, useUIApi as ee, adaptSchema as Ar, EYECLOSED_ICON as Dr, EYEEDIT_ICON as Pr, PLUSSQUARE_ICON as Fr, DATALOG_ICON as $r, X_ICON as Lr, fieldTypes as fe, useFormApi as tr, useVisibleFields as Mr, useUIStore as Ur, getFieldComponent as Wr } from "@mieweb/forms-engine";
3
+ import { AnimatePresence as qr, motion as Z } from "framer-motion";
4
+ import Yr from "js-yaml";
5
+ var ve = { exports: {} }, ce = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.min.js
@@ -12,21 +12,21 @@ import './index.css';var pe = { exports: {} }, se = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var ze;
16
- function Ur() {
17
- if (ze) return se;
18
- ze = 1;
19
- var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
20
- function b(c, f, g) {
21
- var m, p = {}, h = null, T = null;
22
- g !== void 0 && (h = "" + g), f.key !== void 0 && (h = "" + f.key), f.ref !== void 0 && (T = f.ref);
23
- for (m in f) i.call(f, m) && !u.hasOwnProperty(m) && (p[m] = f[m]);
24
- if (c && c.defaultProps) for (m in f = c.defaultProps, f) p[m] === void 0 && (p[m] = f[m]);
25
- return { $$typeof: n, type: c, key: h, ref: T, props: p, _owner: o.current };
15
+ var Je;
16
+ function Vr() {
17
+ if (Je) return ce;
18
+ Je = 1;
19
+ var t = k, n = Symbol.for("react.element"), a = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function m(o, d, w) {
21
+ var v, b = {}, x = null, C = null;
22
+ w !== void 0 && (x = "" + w), d.key !== void 0 && (x = "" + d.key), d.ref !== void 0 && (C = d.ref);
23
+ for (v in d) l.call(d, v) && !f.hasOwnProperty(v) && (b[v] = d[v]);
24
+ if (o && o.defaultProps) for (v in d = o.defaultProps, d) b[v] === void 0 && (b[v] = d[v]);
25
+ return { $$typeof: n, type: o, key: x, ref: C, props: b, _owner: c.current };
26
26
  }
27
- return se.Fragment = s, se.jsx = b, se.jsxs = b, se;
27
+ return ce.Fragment = a, ce.jsx = m, ce.jsxs = m, ce;
28
28
  }
29
- var ie = {};
29
+ var de = {};
30
30
  /**
31
31
  * @license React
32
32
  * react-jsx-runtime.development.js
@@ -36,91 +36,91 @@ var ie = {};
36
36
  * This source code is licensed under the MIT license found in the
37
37
  * LICENSE file in the root directory of this source tree.
38
38
  */
39
- var Ge;
40
- function Yr() {
41
- return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && (function() {
42
- var t = E, n = Symbol.for("react.element"), s = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), c = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), T = Symbol.for("react.offscreen"), v = Symbol.iterator, S = "@@iterator";
43
- function k(e) {
39
+ var ze;
40
+ function Br() {
41
+ return ze || (ze = 1, process.env.NODE_ENV !== "production" && (function() {
42
+ var t = k, n = Symbol.for("react.element"), a = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), o = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), C = Symbol.for("react.offscreen"), g = Symbol.iterator, O = "@@iterator";
43
+ function h(e) {
44
44
  if (e === null || typeof e != "object")
45
45
  return null;
46
- var a = v && e[v] || e[S];
47
- return typeof a == "function" ? a : null;
46
+ var s = g && e[g] || e[O];
47
+ return typeof s == "function" ? s : null;
48
48
  }
49
- var L = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
- function _(e) {
49
+ var F = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
+ function N(e) {
51
51
  {
52
- for (var a = arguments.length, l = new Array(a > 1 ? a - 1 : 0), x = 1; x < a; x++)
53
- l[x - 1] = arguments[x];
54
- F("error", e, l);
52
+ for (var s = arguments.length, i = new Array(s > 1 ? s - 1 : 0), p = 1; p < s; p++)
53
+ i[p - 1] = arguments[p];
54
+ T("error", e, i);
55
55
  }
56
56
  }
57
- function F(e, a, l) {
57
+ function T(e, s, i) {
58
58
  {
59
- var x = L.ReactDebugCurrentFrame, N = x.getStackAddendum();
60
- N !== "" && (a += "%s", l = l.concat([N]));
61
- var R = l.map(function(w) {
62
- return String(w);
59
+ var p = F.ReactDebugCurrentFrame, S = p.getStackAddendum();
60
+ S !== "" && (s += "%s", i = i.concat([S]));
61
+ var _ = i.map(function(E) {
62
+ return String(E);
63
63
  });
64
- R.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, R);
64
+ _.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, _);
65
65
  }
66
66
  }
67
- var O = !1, he = !1, ve = !1, ge = !1, X = !1, oe;
68
- oe = Symbol.for("react.module.reference");
69
- function J(e) {
70
- return !!(typeof e == "string" || typeof e == "function" || e === i || e === u || X || e === o || e === g || e === m || ge || e === T || O || he || ve || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === p || e.$$typeof === b || e.$$typeof === c || e.$$typeof === f || // This needs to include all possible module reference object
67
+ var R = !1, A = !1, X = !1, ae = !1, G = !1, K;
68
+ K = Symbol.for("react.module.reference");
69
+ function W(e) {
70
+ return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || G || e === c || e === w || e === v || ae || e === C || R || A || X || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === b || e.$$typeof === m || e.$$typeof === o || e.$$typeof === d || // This needs to include all possible module reference object
71
71
  // types supported by any Flight configuration anywhere since
72
72
  // we don't know which Flight build this will end up being used
73
73
  // with.
74
- e.$$typeof === oe || e.getModuleId !== void 0));
74
+ e.$$typeof === K || e.getModuleId !== void 0));
75
75
  }
76
- function ce(e, a, l) {
77
- var x = e.displayName;
78
- if (x)
79
- return x;
80
- var N = a.displayName || a.name || "";
81
- return N !== "" ? l + "(" + N + ")" : l;
76
+ function me(e, s, i) {
77
+ var p = e.displayName;
78
+ if (p)
79
+ return p;
80
+ var S = s.displayName || s.name || "";
81
+ return S !== "" ? i + "(" + S + ")" : i;
82
82
  }
83
- function te(e) {
83
+ function le(e) {
84
84
  return e.displayName || "Context";
85
85
  }
86
- function B(e) {
86
+ function z(e) {
87
87
  if (e == null)
88
88
  return null;
89
- if (typeof e.tag == "number" && _("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
89
+ if (typeof e.tag == "number" && N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
90
90
  return e.displayName || e.name || null;
91
91
  if (typeof e == "string")
92
92
  return e;
93
93
  switch (e) {
94
- case i:
94
+ case l:
95
95
  return "Fragment";
96
- case s:
96
+ case a:
97
97
  return "Portal";
98
- case u:
98
+ case f:
99
99
  return "Profiler";
100
- case o:
100
+ case c:
101
101
  return "StrictMode";
102
- case g:
102
+ case w:
103
103
  return "Suspense";
104
- case m:
104
+ case v:
105
105
  return "SuspenseList";
106
106
  }
107
107
  if (typeof e == "object")
108
108
  switch (e.$$typeof) {
109
- case c:
110
- var a = e;
111
- return te(a) + ".Consumer";
109
+ case o:
110
+ var s = e;
111
+ return le(s) + ".Consumer";
112
+ case m:
113
+ var i = e;
114
+ return le(i._context) + ".Provider";
115
+ case d:
116
+ return me(e, e.render, "ForwardRef");
112
117
  case b:
113
- var l = e;
114
- return te(l._context) + ".Provider";
115
- case f:
116
- return ce(e, e.render, "ForwardRef");
117
- case p:
118
- var x = e.displayName || null;
119
- return x !== null ? x : B(e.type) || "Memo";
120
- case h: {
121
- var N = e, R = N._payload, w = N._init;
118
+ var p = e.displayName || null;
119
+ return p !== null ? p : z(e.type) || "Memo";
120
+ case x: {
121
+ var S = e, _ = S._payload, E = S._init;
122
122
  try {
123
- return B(w(R));
123
+ return z(E(_));
124
124
  } catch {
125
125
  return null;
126
126
  }
@@ -128,14 +128,14 @@ function Yr() {
128
128
  }
129
129
  return null;
130
130
  }
131
- var d = Object.assign, C = 0, I, Y, A, U, y, z, ne;
131
+ var u = Object.assign, I = 0, D, B, P, V, y, H, ie;
132
132
  function ye() {
133
133
  }
134
134
  ye.__reactDisabledLog = !0;
135
135
  function je() {
136
136
  {
137
- if (C === 0) {
138
- I = console.log, Y = console.info, A = console.warn, U = console.error, y = console.group, z = console.groupCollapsed, ne = console.groupEnd;
137
+ if (I === 0) {
138
+ D = console.log, B = console.info, P = console.warn, V = console.error, y = console.group, H = console.groupCollapsed, ie = console.groupEnd;
139
139
  var e = {
140
140
  configurable: !0,
141
141
  enumerable: !0,
@@ -152,279 +152,279 @@ function Yr() {
152
152
  groupEnd: e
153
153
  });
154
154
  }
155
- C++;
155
+ I++;
156
156
  }
157
157
  }
158
- function lr() {
158
+ function ir() {
159
159
  {
160
- if (C--, C === 0) {
160
+ if (I--, I === 0) {
161
161
  var e = {
162
162
  configurable: !0,
163
163
  enumerable: !0,
164
164
  writable: !0
165
165
  };
166
166
  Object.defineProperties(console, {
167
- log: d({}, e, {
168
- value: I
167
+ log: u({}, e, {
168
+ value: D
169
169
  }),
170
- info: d({}, e, {
171
- value: Y
170
+ info: u({}, e, {
171
+ value: B
172
172
  }),
173
- warn: d({}, e, {
174
- value: A
173
+ warn: u({}, e, {
174
+ value: P
175
175
  }),
176
- error: d({}, e, {
177
- value: U
176
+ error: u({}, e, {
177
+ value: V
178
178
  }),
179
- group: d({}, e, {
179
+ group: u({}, e, {
180
180
  value: y
181
181
  }),
182
- groupCollapsed: d({}, e, {
183
- value: z
182
+ groupCollapsed: u({}, e, {
183
+ value: H
184
184
  }),
185
- groupEnd: d({}, e, {
186
- value: ne
185
+ groupEnd: u({}, e, {
186
+ value: ie
187
187
  })
188
188
  });
189
189
  }
190
- C < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
190
+ I < 0 && N("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
191
191
  }
192
192
  }
193
- var we = L.ReactCurrentDispatcher, Ee;
194
- function de(e, a, l) {
193
+ var we = F.ReactCurrentDispatcher, Ee;
194
+ function pe(e, s, i) {
195
195
  {
196
196
  if (Ee === void 0)
197
197
  try {
198
198
  throw Error();
199
- } catch (N) {
200
- var x = N.stack.trim().match(/\n( *(at )?)/);
201
- Ee = x && x[1] || "";
199
+ } catch (S) {
200
+ var p = S.stack.trim().match(/\n( *(at )?)/);
201
+ Ee = p && p[1] || "";
202
202
  }
203
203
  return `
204
204
  ` + Ee + e;
205
205
  }
206
206
  }
207
- var ke = !1, ue;
207
+ var Ne = !1, be;
208
208
  {
209
209
  var or = typeof WeakMap == "function" ? WeakMap : Map;
210
- ue = new or();
210
+ be = new or();
211
211
  }
212
- function Oe(e, a) {
213
- if (!e || ke)
212
+ function _e(e, s) {
213
+ if (!e || Ne)
214
214
  return "";
215
215
  {
216
- var l = ue.get(e);
217
- if (l !== void 0)
218
- return l;
216
+ var i = be.get(e);
217
+ if (i !== void 0)
218
+ return i;
219
219
  }
220
- var x;
221
- ke = !0;
222
- var N = Error.prepareStackTrace;
220
+ var p;
221
+ Ne = !0;
222
+ var S = Error.prepareStackTrace;
223
223
  Error.prepareStackTrace = void 0;
224
- var R;
225
- R = we.current, we.current = null, je();
224
+ var _;
225
+ _ = we.current, we.current = null, je();
226
226
  try {
227
- if (a) {
228
- var w = function() {
227
+ if (s) {
228
+ var E = function() {
229
229
  throw Error();
230
230
  };
231
- if (Object.defineProperty(w.prototype, "props", {
231
+ if (Object.defineProperty(E.prototype, "props", {
232
232
  set: function() {
233
233
  throw Error();
234
234
  }
235
235
  }), typeof Reflect == "object" && Reflect.construct) {
236
236
  try {
237
- Reflect.construct(w, []);
238
- } catch (W) {
239
- x = W;
237
+ Reflect.construct(E, []);
238
+ } catch (q) {
239
+ p = q;
240
240
  }
241
- Reflect.construct(e, [], w);
241
+ Reflect.construct(e, [], E);
242
242
  } else {
243
243
  try {
244
- w.call();
245
- } catch (W) {
246
- x = W;
244
+ E.call();
245
+ } catch (q) {
246
+ p = q;
247
247
  }
248
- e.call(w.prototype);
248
+ e.call(E.prototype);
249
249
  }
250
250
  } else {
251
251
  try {
252
252
  throw Error();
253
- } catch (W) {
254
- x = W;
253
+ } catch (q) {
254
+ p = q;
255
255
  }
256
256
  e();
257
257
  }
258
- } catch (W) {
259
- if (W && x && typeof W.stack == "string") {
260
- for (var j = W.stack.split(`
261
- `), M = x.stack.split(`
262
- `), D = j.length - 1, P = M.length - 1; D >= 1 && P >= 0 && j[D] !== M[P]; )
263
- P--;
264
- for (; D >= 1 && P >= 0; D--, P--)
265
- if (j[D] !== M[P]) {
266
- if (D !== 1 || P !== 1)
258
+ } catch (q) {
259
+ if (q && p && typeof q.stack == "string") {
260
+ for (var j = q.stack.split(`
261
+ `), U = p.stack.split(`
262
+ `), $ = j.length - 1, L = U.length - 1; $ >= 1 && L >= 0 && j[$] !== U[L]; )
263
+ L--;
264
+ for (; $ >= 1 && L >= 0; $--, L--)
265
+ if (j[$] !== U[L]) {
266
+ if ($ !== 1 || L !== 1)
267
267
  do
268
- if (D--, P--, P < 0 || j[D] !== M[P]) {
269
- var V = `
270
- ` + j[D].replace(" at new ", " at ");
271
- return e.displayName && V.includes("<anonymous>") && (V = V.replace("<anonymous>", e.displayName)), typeof e == "function" && ue.set(e, V), V;
268
+ if ($--, L--, L < 0 || j[$] !== U[L]) {
269
+ var J = `
270
+ ` + j[$].replace(" at new ", " at ");
271
+ return e.displayName && J.includes("<anonymous>") && (J = J.replace("<anonymous>", e.displayName)), typeof e == "function" && be.set(e, J), J;
272
272
  }
273
- while (D >= 1 && P >= 0);
273
+ while ($ >= 1 && L >= 0);
274
274
  break;
275
275
  }
276
276
  }
277
277
  } finally {
278
- ke = !1, we.current = R, lr(), Error.prepareStackTrace = N;
278
+ Ne = !1, we.current = _, ir(), Error.prepareStackTrace = S;
279
279
  }
280
- var Z = e ? e.displayName || e.name : "", G = Z ? de(Z) : "";
281
- return typeof e == "function" && ue.set(e, G), G;
280
+ var te = e ? e.displayName || e.name : "", Q = te ? pe(te) : "";
281
+ return typeof e == "function" && be.set(e, Q), Q;
282
282
  }
283
- function cr(e, a, l) {
284
- return Oe(e, !1);
283
+ function cr(e, s, i) {
284
+ return _e(e, !1);
285
285
  }
286
286
  function dr(e) {
287
- var a = e.prototype;
288
- return !!(a && a.isReactComponent);
287
+ var s = e.prototype;
288
+ return !!(s && s.isReactComponent);
289
289
  }
290
- function fe(e, a, l) {
290
+ function he(e, s, i) {
291
291
  if (e == null)
292
292
  return "";
293
293
  if (typeof e == "function")
294
- return Oe(e, dr(e));
294
+ return _e(e, dr(e));
295
295
  if (typeof e == "string")
296
- return de(e);
296
+ return pe(e);
297
297
  switch (e) {
298
- case g:
299
- return de("Suspense");
300
- case m:
301
- return de("SuspenseList");
298
+ case w:
299
+ return pe("Suspense");
300
+ case v:
301
+ return pe("SuspenseList");
302
302
  }
303
303
  if (typeof e == "object")
304
304
  switch (e.$$typeof) {
305
- case f:
305
+ case d:
306
306
  return cr(e.render);
307
- case p:
308
- return fe(e.type, a, l);
309
- case h: {
310
- var x = e, N = x._payload, R = x._init;
307
+ case b:
308
+ return he(e.type, s, i);
309
+ case x: {
310
+ var p = e, S = p._payload, _ = p._init;
311
311
  try {
312
- return fe(R(N), a, l);
312
+ return he(_(S), s, i);
313
313
  } catch {
314
314
  }
315
315
  }
316
316
  }
317
317
  return "";
318
318
  }
319
- var ae = Object.prototype.hasOwnProperty, Ae = {}, De = L.ReactDebugCurrentFrame;
320
- function me(e) {
319
+ var oe = Object.prototype.hasOwnProperty, Oe = {}, Ae = F.ReactDebugCurrentFrame;
320
+ function xe(e) {
321
321
  if (e) {
322
- var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
323
- De.setExtraStackFrame(l);
322
+ var s = e._owner, i = he(e.type, e._source, s ? s.type : null);
323
+ Ae.setExtraStackFrame(i);
324
324
  } else
325
- De.setExtraStackFrame(null);
325
+ Ae.setExtraStackFrame(null);
326
326
  }
327
- function ur(e, a, l, x, N) {
327
+ function ur(e, s, i, p, S) {
328
328
  {
329
- var R = Function.call.bind(ae);
330
- for (var w in e)
331
- if (R(e, w)) {
329
+ var _ = Function.call.bind(oe);
330
+ for (var E in e)
331
+ if (_(e, E)) {
332
332
  var j = void 0;
333
333
  try {
334
- if (typeof e[w] != "function") {
335
- var M = Error((x || "React class") + ": " + l + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
- throw M.name = "Invariant Violation", M;
334
+ if (typeof e[E] != "function") {
335
+ var U = Error((p || "React class") + ": " + i + " type `" + E + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[E] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
+ throw U.name = "Invariant Violation", U;
337
337
  }
338
- j = e[w](a, w, x, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
- } catch (D) {
340
- j = D;
338
+ j = e[E](s, E, p, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
+ } catch ($) {
340
+ j = $;
341
341
  }
342
- j && !(j instanceof Error) && (me(N), _("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", l, w, typeof j), me(null)), j instanceof Error && !(j.message in Ae) && (Ae[j.message] = !0, me(N), _("Failed %s type: %s", l, j.message), me(null));
342
+ j && !(j instanceof Error) && (xe(S), N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", p || "React class", i, E, typeof j), xe(null)), j instanceof Error && !(j.message in Oe) && (Oe[j.message] = !0, xe(S), N("Failed %s type: %s", i, j.message), xe(null));
343
343
  }
344
344
  }
345
345
  }
346
346
  var fr = Array.isArray;
347
- function Ne(e) {
347
+ function ke(e) {
348
348
  return fr(e);
349
349
  }
350
350
  function mr(e) {
351
351
  {
352
- var a = typeof Symbol == "function" && Symbol.toStringTag, l = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
- return l;
352
+ var s = typeof Symbol == "function" && Symbol.toStringTag, i = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
353
+ return i;
354
354
  }
355
355
  }
356
356
  function pr(e) {
357
357
  try {
358
- return Pe(e), !1;
358
+ return De(e), !1;
359
359
  } catch {
360
360
  return !0;
361
361
  }
362
362
  }
363
- function Pe(e) {
363
+ function De(e) {
364
364
  return "" + e;
365
365
  }
366
- function Fe(e) {
366
+ function Pe(e) {
367
367
  if (pr(e))
368
- return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mr(e)), Pe(e);
368
+ return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", mr(e)), De(e);
369
369
  }
370
- var $e = L.ReactCurrentOwner, br = {
370
+ var Fe = F.ReactCurrentOwner, br = {
371
371
  key: !0,
372
372
  ref: !0,
373
373
  __self: !0,
374
374
  __source: !0
375
- }, Le, Me;
376
- function xr(e) {
377
- if (ae.call(e, "ref")) {
378
- var a = Object.getOwnPropertyDescriptor(e, "ref").get;
379
- if (a && a.isReactWarning)
375
+ }, $e, Le;
376
+ function hr(e) {
377
+ if (oe.call(e, "ref")) {
378
+ var s = Object.getOwnPropertyDescriptor(e, "ref").get;
379
+ if (s && s.isReactWarning)
380
380
  return !1;
381
381
  }
382
382
  return e.ref !== void 0;
383
383
  }
384
- function hr(e) {
385
- if (ae.call(e, "key")) {
386
- var a = Object.getOwnPropertyDescriptor(e, "key").get;
387
- if (a && a.isReactWarning)
384
+ function xr(e) {
385
+ if (oe.call(e, "key")) {
386
+ var s = Object.getOwnPropertyDescriptor(e, "key").get;
387
+ if (s && s.isReactWarning)
388
388
  return !1;
389
389
  }
390
390
  return e.key !== void 0;
391
391
  }
392
- function vr(e, a) {
393
- typeof e.ref == "string" && $e.current;
392
+ function vr(e, s) {
393
+ typeof e.ref == "string" && Fe.current;
394
394
  }
395
- function gr(e, a) {
395
+ function gr(e, s) {
396
396
  {
397
- var l = function() {
398
- Le || (Le = !0, _("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
397
+ var i = function() {
398
+ $e || ($e = !0, N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
399
399
  };
400
- l.isReactWarning = !0, Object.defineProperty(e, "key", {
401
- get: l,
400
+ i.isReactWarning = !0, Object.defineProperty(e, "key", {
401
+ get: i,
402
402
  configurable: !0
403
403
  });
404
404
  }
405
405
  }
406
- function yr(e, a) {
406
+ function yr(e, s) {
407
407
  {
408
- var l = function() {
409
- Me || (Me = !0, _("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a));
408
+ var i = function() {
409
+ Le || (Le = !0, N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", s));
410
410
  };
411
- l.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
- get: l,
411
+ i.isReactWarning = !0, Object.defineProperty(e, "ref", {
412
+ get: i,
413
413
  configurable: !0
414
414
  });
415
415
  }
416
416
  }
417
- var jr = function(e, a, l, x, N, R, w) {
417
+ var jr = function(e, s, i, p, S, _, E) {
418
418
  var j = {
419
419
  // This tag allows us to uniquely identify this as a React Element
420
420
  $$typeof: n,
421
421
  // Built-in properties that belong on the element
422
422
  type: e,
423
- key: a,
424
- ref: l,
425
- props: w,
423
+ key: s,
424
+ ref: i,
425
+ props: E,
426
426
  // Record the component responsible for creating this element.
427
- _owner: R
427
+ _owner: _
428
428
  };
429
429
  return j._store = {}, Object.defineProperty(j._store, "validated", {
430
430
  configurable: !1,
@@ -435,49 +435,49 @@ function Yr() {
435
435
  configurable: !1,
436
436
  enumerable: !1,
437
437
  writable: !1,
438
- value: x
438
+ value: p
439
439
  }), Object.defineProperty(j, "_source", {
440
440
  configurable: !1,
441
441
  enumerable: !1,
442
442
  writable: !1,
443
- value: N
443
+ value: S
444
444
  }), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
445
445
  };
446
- function wr(e, a, l, x, N) {
446
+ function wr(e, s, i, p, S) {
447
447
  {
448
- var R, w = {}, j = null, M = null;
449
- l !== void 0 && (Fe(l), j = "" + l), hr(a) && (Fe(a.key), j = "" + a.key), xr(a) && (M = a.ref, vr(a, N));
450
- for (R in a)
451
- ae.call(a, R) && !br.hasOwnProperty(R) && (w[R] = a[R]);
448
+ var _, E = {}, j = null, U = null;
449
+ i !== void 0 && (Pe(i), j = "" + i), xr(s) && (Pe(s.key), j = "" + s.key), hr(s) && (U = s.ref, vr(s, S));
450
+ for (_ in s)
451
+ oe.call(s, _) && !br.hasOwnProperty(_) && (E[_] = s[_]);
452
452
  if (e && e.defaultProps) {
453
- var D = e.defaultProps;
454
- for (R in D)
455
- w[R] === void 0 && (w[R] = D[R]);
453
+ var $ = e.defaultProps;
454
+ for (_ in $)
455
+ E[_] === void 0 && (E[_] = $[_]);
456
456
  }
457
- if (j || M) {
458
- var P = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
- j && gr(w, P), M && yr(w, P);
457
+ if (j || U) {
458
+ var L = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ j && gr(E, L), U && yr(E, L);
460
460
  }
461
- return jr(e, j, M, N, x, $e.current, w);
461
+ return jr(e, j, U, S, p, Fe.current, E);
462
462
  }
463
463
  }
464
- var Ce = L.ReactCurrentOwner, We = L.ReactDebugCurrentFrame;
465
- function Q(e) {
464
+ var Ce = F.ReactCurrentOwner, Me = F.ReactDebugCurrentFrame;
465
+ function re(e) {
466
466
  if (e) {
467
- var a = e._owner, l = fe(e.type, e._source, a ? a.type : null);
468
- We.setExtraStackFrame(l);
467
+ var s = e._owner, i = he(e.type, e._source, s ? s.type : null);
468
+ Me.setExtraStackFrame(i);
469
469
  } else
470
- We.setExtraStackFrame(null);
470
+ Me.setExtraStackFrame(null);
471
471
  }
472
- var Re;
473
- Re = !1;
474
- function Te(e) {
472
+ var Se;
473
+ Se = !1;
474
+ function Re(e) {
475
475
  return typeof e == "object" && e !== null && e.$$typeof === n;
476
476
  }
477
- function qe() {
477
+ function Ue() {
478
478
  {
479
479
  if (Ce.current) {
480
- var e = B(Ce.current.type);
480
+ var e = z(Ce.current.type);
481
481
  if (e)
482
482
  return `
483
483
 
@@ -489,187 +489,187 @@ Check the render method of \`` + e + "`.";
489
489
  function Er(e) {
490
490
  return "";
491
491
  }
492
- var Ue = {};
493
- function kr(e) {
492
+ var We = {};
493
+ function Nr(e) {
494
494
  {
495
- var a = qe();
496
- if (!a) {
497
- var l = typeof e == "string" ? e : e.displayName || e.name;
498
- l && (a = `
495
+ var s = Ue();
496
+ if (!s) {
497
+ var i = typeof e == "string" ? e : e.displayName || e.name;
498
+ i && (s = `
499
499
 
500
- Check the top-level render call using <` + l + ">.");
500
+ Check the top-level render call using <` + i + ">.");
501
501
  }
502
- return a;
502
+ return s;
503
503
  }
504
504
  }
505
- function Ye(e, a) {
505
+ function qe(e, s) {
506
506
  {
507
507
  if (!e._store || e._store.validated || e.key != null)
508
508
  return;
509
509
  e._store.validated = !0;
510
- var l = kr(a);
511
- if (Ue[l])
510
+ var i = Nr(s);
511
+ if (We[i])
512
512
  return;
513
- Ue[l] = !0;
514
- var x = "";
515
- e && e._owner && e._owner !== Ce.current && (x = " It was passed a child from " + B(e._owner.type) + "."), Q(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, x), Q(null);
513
+ We[i] = !0;
514
+ var p = "";
515
+ e && e._owner && e._owner !== Ce.current && (p = " It was passed a child from " + z(e._owner.type) + "."), re(e), N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, p), re(null);
516
516
  }
517
517
  }
518
- function Ve(e, a) {
518
+ function Ye(e, s) {
519
519
  {
520
520
  if (typeof e != "object")
521
521
  return;
522
- if (Ne(e))
523
- for (var l = 0; l < e.length; l++) {
524
- var x = e[l];
525
- Te(x) && Ye(x, a);
522
+ if (ke(e))
523
+ for (var i = 0; i < e.length; i++) {
524
+ var p = e[i];
525
+ Re(p) && qe(p, s);
526
526
  }
527
- else if (Te(e))
527
+ else if (Re(e))
528
528
  e._store && (e._store.validated = !0);
529
529
  else if (e) {
530
- var N = k(e);
531
- if (typeof N == "function" && N !== e.entries)
532
- for (var R = N.call(e), w; !(w = R.next()).done; )
533
- Te(w.value) && Ye(w.value, a);
530
+ var S = h(e);
531
+ if (typeof S == "function" && S !== e.entries)
532
+ for (var _ = S.call(e), E; !(E = _.next()).done; )
533
+ Re(E.value) && qe(E.value, s);
534
534
  }
535
535
  }
536
536
  }
537
- function Nr(e) {
537
+ function kr(e) {
538
538
  {
539
- var a = e.type;
540
- if (a == null || typeof a == "string")
539
+ var s = e.type;
540
+ if (s == null || typeof s == "string")
541
541
  return;
542
- var l;
543
- if (typeof a == "function")
544
- l = a.propTypes;
545
- else if (typeof a == "object" && (a.$$typeof === f || // Note: Memo only checks outer props here.
542
+ var i;
543
+ if (typeof s == "function")
544
+ i = s.propTypes;
545
+ else if (typeof s == "object" && (s.$$typeof === d || // Note: Memo only checks outer props here.
546
546
  // Inner props are checked in the reconciler.
547
- a.$$typeof === p))
548
- l = a.propTypes;
547
+ s.$$typeof === b))
548
+ i = s.propTypes;
549
549
  else
550
550
  return;
551
- if (l) {
552
- var x = B(a);
553
- ur(l, e.props, "prop", x, e);
554
- } else if (a.PropTypes !== void 0 && !Re) {
555
- Re = !0;
556
- var N = B(a);
557
- _("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", N || "Unknown");
551
+ if (i) {
552
+ var p = z(s);
553
+ ur(i, e.props, "prop", p, e);
554
+ } else if (s.PropTypes !== void 0 && !Se) {
555
+ Se = !0;
556
+ var S = z(s);
557
+ N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
558
558
  }
559
- typeof a.getDefaultProps == "function" && !a.getDefaultProps.isReactClassApproved && _("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
559
+ typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
560
560
  }
561
561
  }
562
562
  function Cr(e) {
563
563
  {
564
- for (var a = Object.keys(e.props), l = 0; l < a.length; l++) {
565
- var x = a[l];
566
- if (x !== "children" && x !== "key") {
567
- Q(e), _("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), Q(null);
564
+ for (var s = Object.keys(e.props), i = 0; i < s.length; i++) {
565
+ var p = s[i];
566
+ if (p !== "children" && p !== "key") {
567
+ re(e), N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), re(null);
568
568
  break;
569
569
  }
570
570
  }
571
- e.ref !== null && (Q(e), _("Invalid attribute `ref` supplied to `React.Fragment`."), Q(null));
571
+ e.ref !== null && (re(e), N("Invalid attribute `ref` supplied to `React.Fragment`."), re(null));
572
572
  }
573
573
  }
574
- var Be = {};
575
- function Je(e, a, l, x, N, R) {
574
+ var Ve = {};
575
+ function Be(e, s, i, p, S, _) {
576
576
  {
577
- var w = J(e);
578
- if (!w) {
577
+ var E = W(e);
578
+ if (!E) {
579
579
  var j = "";
580
580
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
581
- var M = Er();
582
- M ? j += M : j += qe();
583
- var D;
584
- e === null ? D = "null" : Ne(e) ? D = "array" : e !== void 0 && e.$$typeof === n ? (D = "<" + (B(e.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : D = typeof e, _("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", D, j);
581
+ var U = Er();
582
+ U ? j += U : j += Ue();
583
+ var $;
584
+ e === null ? $ = "null" : ke(e) ? $ = "array" : e !== void 0 && e.$$typeof === n ? ($ = "<" + (z(e.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof e, N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, j);
585
585
  }
586
- var P = wr(e, a, l, N, R);
587
- if (P == null)
588
- return P;
589
- if (w) {
590
- var V = a.children;
591
- if (V !== void 0)
592
- if (x)
593
- if (Ne(V)) {
594
- for (var Z = 0; Z < V.length; Z++)
595
- Ve(V[Z], e);
596
- Object.freeze && Object.freeze(V);
586
+ var L = wr(e, s, i, S, _);
587
+ if (L == null)
588
+ return L;
589
+ if (E) {
590
+ var J = s.children;
591
+ if (J !== void 0)
592
+ if (p)
593
+ if (ke(J)) {
594
+ for (var te = 0; te < J.length; te++)
595
+ Ye(J[te], e);
596
+ Object.freeze && Object.freeze(J);
597
597
  } else
598
- _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
598
+ N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
599
599
  else
600
- Ve(V, e);
600
+ Ye(J, e);
601
601
  }
602
- if (ae.call(a, "key")) {
603
- var G = B(e), W = Object.keys(a).filter(function(Or) {
602
+ if (oe.call(s, "key")) {
603
+ var Q = z(e), q = Object.keys(s).filter(function(Or) {
604
604
  return Or !== "key";
605
- }), Se = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
606
- if (!Be[G + Se]) {
607
- var Ir = W.length > 0 ? "{" + W.join(": ..., ") + ": ...}" : "{}";
608
- _(`A props object containing a "key" prop is being spread into JSX:
605
+ }), Te = q.length > 0 ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}";
606
+ if (!Ve[Q + Te]) {
607
+ var _r = q.length > 0 ? "{" + q.join(": ..., ") + ": ...}" : "{}";
608
+ N(`A props object containing a "key" prop is being spread into JSX:
609
609
  let props = %s;
610
610
  <%s {...props} />
611
611
  React keys must be passed directly to JSX without using spread:
612
612
  let props = %s;
613
- <%s key={someKey} {...props} />`, Se, G, Ir, G), Be[G + Se] = !0;
613
+ <%s key={someKey} {...props} />`, Te, Q, _r, Q), Ve[Q + Te] = !0;
614
614
  }
615
615
  }
616
- return e === i ? Cr(P) : Nr(P), P;
616
+ return e === l ? Cr(L) : kr(L), L;
617
617
  }
618
618
  }
619
- function Rr(e, a, l) {
620
- return Je(e, a, l, !0);
619
+ function Sr(e, s, i) {
620
+ return Be(e, s, i, !0);
621
621
  }
622
- function Tr(e, a, l) {
623
- return Je(e, a, l, !1);
622
+ function Rr(e, s, i) {
623
+ return Be(e, s, i, !1);
624
624
  }
625
- var Sr = Tr, _r = Rr;
626
- ie.Fragment = i, ie.jsx = Sr, ie.jsxs = _r;
627
- })()), ie;
625
+ var Tr = Rr, Ir = Sr;
626
+ de.Fragment = l, de.jsx = Tr, de.jsxs = Ir;
627
+ })()), de;
628
628
  }
629
- var Ke;
630
- function Vr() {
631
- return Ke || (Ke = 1, process.env.NODE_ENV === "production" ? pe.exports = Ur() : pe.exports = Yr()), pe.exports;
629
+ var Ge;
630
+ function Jr() {
631
+ return Ge || (Ge = 1, process.env.NODE_ENV === "production" ? ve.exports = Vr() : ve.exports = Br()), ve.exports;
632
632
  }
633
- var r = Vr();
633
+ var r = Jr();
634
634
  function nr({
635
635
  open: t,
636
636
  onClose: n,
637
- data: s,
638
- title: i = "Data Viewer",
639
- placement: o = "center",
637
+ data: a,
638
+ title: l = "Data Viewer",
639
+ placement: c = "center",
640
640
  // "center" | "bottom"
641
- pretty: u = 2,
642
- defaultMode: b = "yaml",
641
+ pretty: f = 2,
642
+ defaultMode: m = "yaml",
643
643
  // "json" | "yaml"
644
- fileBaseName: c = "form-data",
645
- contentClassName: f = ""
644
+ fileBaseName: o = "form-data",
645
+ contentClassName: d = ""
646
646
  }) {
647
- const g = o === "center", [m, p] = E.useState(b === "yaml" ? "yaml" : "json"), h = E.useMemo(() => {
648
- const k = Math.max(2, u | 0);
647
+ const w = c === "center", [v, b] = k.useState(m === "yaml" ? "yaml" : "json"), x = k.useMemo(() => {
648
+ const h = Math.max(2, f | 0);
649
649
  try {
650
- return m === "yaml" ? qr.dump(s ?? {}, {
651
- indent: k,
650
+ return v === "yaml" ? Yr.dump(a ?? {}, {
651
+ indent: h,
652
652
  lineWidth: 80,
653
653
  noRefs: !0,
654
654
  forceQuotes: !0,
655
655
  skipInvalid: !0
656
- }) : JSON.stringify(s ?? {}, null, k);
656
+ }) : JSON.stringify(a ?? {}, null, h);
657
657
  } catch {
658
- return m === "yaml" ? "# Failed to render YAML" : String(s);
658
+ return v === "yaml" ? "# Failed to render YAML" : String(a);
659
659
  }
660
- }, [s, m, u]), T = (k) => k.stopPropagation(), v = (k) => {
661
- T(k);
662
- const L = m === "yaml", _ = new Blob([h], { type: L ? "text/yaml" : "application/json" }), F = URL.createObjectURL(_), O = document.createElement("a");
663
- O.href = F, O.download = `${c}.${L ? "yml" : "json"}`, O.click(), URL.revokeObjectURL(F);
664
- }, S = async (k) => {
665
- T(k);
660
+ }, [a, v, f]), C = (h) => h.stopPropagation(), g = (h) => {
661
+ C(h);
662
+ const F = v === "yaml", N = new Blob([x], { type: F ? "text/yaml" : "application/json" }), T = URL.createObjectURL(N), R = document.createElement("a");
663
+ R.href = T, R.download = `${o}.${F ? "yml" : "json"}`, R.click(), URL.revokeObjectURL(T);
664
+ }, O = async (h) => {
665
+ C(h);
666
666
  try {
667
- await navigator.clipboard.writeText(h);
667
+ await navigator.clipboard.writeText(x);
668
668
  } catch {
669
669
  }
670
670
  };
671
- return /* @__PURE__ */ r.jsx(Wr, { children: t && /* @__PURE__ */ r.jsx(
672
- K.div,
671
+ return /* @__PURE__ */ r.jsx(qr, { children: t && /* @__PURE__ */ r.jsx(
672
+ Z.div,
673
673
  {
674
674
  className: "fixed inset-0 z-[60] flex items-center justify-center",
675
675
  initial: { opacity: 0 },
@@ -679,20 +679,20 @@ function nr({
679
679
  "aria-modal": "true",
680
680
  role: "dialog",
681
681
  children: /* @__PURE__ */ r.jsx("div", { className: "w-full h-full flex items-end sm:items-center justify-center sm:max-w-4xl", children: /* @__PURE__ */ r.jsxs(
682
- K.div,
682
+ Z.div,
683
683
  {
684
- onMouseDown: T,
685
- initial: { y: g ? 20 : "100%", opacity: g ? 0 : 1, scale: g ? 0.98 : 1 },
684
+ onMouseDown: C,
685
+ initial: { y: w ? 20 : "100%", opacity: w ? 0 : 1, scale: w ? 0.98 : 1 },
686
686
  animate: { y: 0, opacity: 1, scale: 1 },
687
- exit: { y: g ? 20 : "100%", opacity: g ? 0 : 1, scale: g ? 0.98 : 1 },
687
+ exit: { y: w ? 20 : "100%", opacity: w ? 0 : 1, scale: w ? 0.98 : 1 },
688
688
  transition: { type: "spring", stiffness: 160, damping: 20 },
689
- className: g ? "w-full sm:max-w-2xl sm:rounded-2xl rounded-t-2xl bg-white shadow-lg border border-black/10 max-h-[80vh] overflow-hidden" : "w-full mx-auto bg-black/5 border border-black/15 px-6 py-4 rounded-2xl backdrop-blur-xl overflow-hidden",
689
+ className: w ? "w-full sm:max-w-2xl sm:rounded-2xl rounded-t-2xl bg-white shadow-lg border border-black/10 max-h-[80vh] overflow-hidden" : "w-full mx-auto bg-black/5 border border-black/15 px-6 py-4 rounded-2xl backdrop-blur-xl overflow-hidden",
690
690
  children: [
691
- /* @__PURE__ */ r.jsxs("div", { className: `flex items-center justify-between ${g ? "px-4 py-3 border-b border-black/10" : ""}`, children: [
691
+ /* @__PURE__ */ r.jsxs("div", { className: `flex items-center justify-between ${w ? "px-4 py-3 border-b border-black/10" : ""}`, children: [
692
692
  /* @__PURE__ */ r.jsxs("h3", { className: "font-semibold", children: [
693
- i,
693
+ l,
694
694
  " (",
695
- m.toUpperCase(),
695
+ v.toUpperCase(),
696
696
  ")"
697
697
  ] }),
698
698
  /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -700,10 +700,10 @@ function nr({
700
700
  /* @__PURE__ */ r.jsx(
701
701
  "button",
702
702
  {
703
- className: `px-3 py-1 text-sm ${m === "yaml" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
704
- "aria-pressed": m === "yaml",
705
- onClick: (k) => {
706
- T(k), p("yaml");
703
+ className: `px-3 py-1 text-sm ${v === "yaml" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
704
+ "aria-pressed": v === "yaml",
705
+ onClick: (h) => {
706
+ C(h), b("yaml");
707
707
  },
708
708
  children: "YAML"
709
709
  }
@@ -711,49 +711,82 @@ function nr({
711
711
  /* @__PURE__ */ r.jsx(
712
712
  "button",
713
713
  {
714
- className: `px-3 py-1 text-sm ${m === "json" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
715
- "aria-pressed": m === "json",
716
- onClick: (k) => {
717
- T(k), p("json");
714
+ className: `px-3 py-1 text-sm ${v === "json" ? "bg-black/6" : "bg-gray-200 hover:bg-black/5"}`,
715
+ "aria-pressed": v === "json",
716
+ onClick: (h) => {
717
+ C(h), b("json");
718
718
  },
719
719
  children: "JSON"
720
720
  }
721
721
  )
722
722
  ] }),
723
- /* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: S, children: "Copy" }),
724
- /* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: v, children: "Download" }),
723
+ /* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: O, children: "Copy" }),
724
+ /* @__PURE__ */ r.jsx("button", { className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm", onClick: g, children: "Download" }),
725
725
  /* @__PURE__ */ r.jsx(
726
726
  "button",
727
727
  {
728
728
  className: "px-3 py-1 rounded-lg border border-black/10 hover:bg-black/5 text-sm",
729
- onClick: (k) => {
730
- T(k), n == null || n();
729
+ onClick: (h) => {
730
+ C(h), n == null || n();
731
731
  },
732
732
  children: "Close"
733
733
  }
734
734
  )
735
735
  ] })
736
736
  ] }),
737
- /* @__PURE__ */ r.jsx("div", { className: g ? `p-4 overflow-auto max-h-[70vh] ${f}` : `mt-2 p-2 rounded-lg overflow-y-auto max-h-96 ${f}`, children: /* @__PURE__ */ r.jsx("pre", { className: "whitespace-pre-wrap break-words text-sm text-gray-700", children: h }) })
737
+ /* @__PURE__ */ r.jsx("div", { className: w ? `p-4 overflow-auto max-h-[70vh] ${d}` : `mt-2 p-2 rounded-lg overflow-y-auto max-h-96 ${d}`, children: /* @__PURE__ */ r.jsx("pre", { className: "whitespace-pre-wrap break-words text-sm text-gray-700", children: x }) })
738
738
  ]
739
739
  }
740
740
  ) })
741
741
  }
742
742
  ) });
743
743
  }
744
- function Br() {
745
- const [t, n] = xe(!1), s = q((g) => g.replaceAll), i = Ie(), o = H(), u = o.state.isPreview, b = (g) => {
744
+ function zr() {
745
+ const [t, n] = ne(!1), [a, l] = ne(!1), [c, f] = ne(null), m = Y((h) => h.replaceAll), o = rr(), d = ee(), w = d.state.isPreview, v = (h, F) => {
746
746
  try {
747
- const m = String(g).replace(/^\uFEFF/, "").trim(), p = JSON.parse(m), h = Array.isArray(p) ? p : p == null ? void 0 : p.fields;
748
- if (!Array.isArray(h)) throw new Error("Expected [] or { fields: [] }");
749
- s(h), o.selectedFieldId.clear(), o.preview.set(!1);
750
- } catch (m) {
751
- alert((m == null ? void 0 : m.message) || "Invalid JSON format");
747
+ const N = String(h).replace(/^\uFEFF/, "").trim(), T = JSON.parse(N);
748
+ let R, A = null;
749
+ if (F === "surveyjs") {
750
+ const X = Ar(T, "surveyjs");
751
+ if (R = X.fields || X, A = X.conversionReport, A) {
752
+ d.setConversionReport(A), console.log("[Editor] SurveyJS schema converted:", {
753
+ totalElements: A.totalElements,
754
+ convertedFields: A.convertedFields,
755
+ droppedFields: A.droppedFields.length,
756
+ warnings: A.warnings.length
757
+ });
758
+ const ae = [
759
+ `✅ Converted ${A.convertedFields} of ${A.totalElements} fields`,
760
+ A.droppedFields.length > 0 ? `⚠️ Dropped ${A.droppedFields.length} unsupported fields` : null,
761
+ A.warnings.length > 0 ? `⚠️ ${A.warnings.length} conversion warnings (check console)` : null
762
+ ].filter(Boolean).join(`
763
+ `);
764
+ if (alert(`SurveyJS Import Complete:
765
+
766
+ ${ae}`), A.warnings.length > 0) {
767
+ const G = A.warnings.filter((W) => W.impact === "high"), K = A.warnings.filter((W) => W.impact === "medium");
768
+ G.length > 0 && console.warn(`⚠️ HIGH IMPACT (${G.length}):`, G), K.length > 0 && console.warn(`⚠️ MEDIUM IMPACT (${K.length}):`, K);
769
+ }
770
+ A.droppedFields.length > 0 && console.error("❌ DROPPED FIELDS:", A.droppedFields);
771
+ }
772
+ } else
773
+ R = Array.isArray(T) ? T : T == null ? void 0 : T.fields;
774
+ if (!Array.isArray(R))
775
+ throw new Error("Expected array of fields or { fields: [] }");
776
+ m(R), d.selectedFieldId.clear(), d.preview.set(!1);
777
+ } catch (N) {
778
+ alert((N == null ? void 0 : N.message) || "Invalid JSON format");
752
779
  }
753
- }, c = () => {
754
- o.preview.set(!0), o.selectedFieldId.clear();
755
- }, f = () => {
756
- o.preview.set(!1);
780
+ }, b = (h) => {
781
+ f(h), l(!0);
782
+ }, x = (h) => {
783
+ c && v(c, h), l(!1), f(null);
784
+ }, C = () => {
785
+ l(!1), f(null);
786
+ }, g = () => {
787
+ d.preview.set(!0), d.selectedFieldId.clear();
788
+ }, O = () => {
789
+ d.preview.set(!1);
757
790
  };
758
791
  return /* @__PURE__ */ r.jsxs("header", { className: "sticky top-0 z-49 bg-transparent mx-auto", children: [
759
792
  /* @__PURE__ */ r.jsxs("div", { className: "py-6 text-center", children: [
@@ -765,16 +798,16 @@ function Br() {
765
798
  /* @__PURE__ */ r.jsx(
766
799
  "button",
767
800
  {
768
- className: `py-3 rounded-xl text-sm font-medium ${u ? "" : "bg-black/10"}`,
769
- onClick: f,
801
+ className: `py-3 rounded-xl text-sm font-medium ${w ? "" : "bg-black/10"}`,
802
+ onClick: O,
770
803
  children: "Builder"
771
804
  }
772
805
  ),
773
806
  /* @__PURE__ */ r.jsx(
774
807
  "button",
775
808
  {
776
- className: `py-3 rounded-xl text-sm font-medium ${u ? "bg-black/10" : ""}`,
777
- onClick: c,
809
+ className: `py-3 rounded-xl text-sm font-medium ${w ? "bg-black/10" : ""}`,
810
+ onClick: g,
778
811
  children: "Preview"
779
812
  }
780
813
  )
@@ -788,15 +821,15 @@ function Br() {
788
821
  className: "hidden",
789
822
  type: "file",
790
823
  accept: ".json,application/json",
791
- onChange: (g) => {
792
- var h;
793
- const m = (h = g.target.files) == null ? void 0 : h[0];
794
- if (!m) return;
795
- const p = new FileReader();
796
- p.onload = (T) => {
797
- var v;
798
- return b(((v = T.target) == null ? void 0 : v.result) ?? "");
799
- }, p.readAsText(m), g.target.value = "";
824
+ onChange: (h) => {
825
+ var T;
826
+ const F = (T = h.target.files) == null ? void 0 : T[0];
827
+ if (!F) return;
828
+ const N = new FileReader();
829
+ N.onload = (R) => {
830
+ var A;
831
+ return b(((A = R.target) == null ? void 0 : A.result) ?? "");
832
+ }, N.readAsText(F), h.target.value = "";
800
833
  }
801
834
  }
802
835
  )
@@ -816,77 +849,121 @@ function Br() {
816
849
  {
817
850
  open: t,
818
851
  onClose: () => n(!1),
819
- data: i,
852
+ data: o,
820
853
  title: "Form Data",
821
854
  placement: "bottom",
822
855
  contentClassName: "custom-scrollbar"
823
856
  }
824
- )
857
+ ),
858
+ a && /* @__PURE__ */ r.jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4", children: /* @__PURE__ */ r.jsxs("div", { className: "bg-white rounded-2xl shadow-2xl max-w-md w-full p-6", children: [
859
+ /* @__PURE__ */ r.jsxs("div", { className: "mb-6", children: [
860
+ /* @__PURE__ */ r.jsx("h3", { className: "text-xl font-semibold text-slate-900 mb-2", children: "Select Schema Type" }),
861
+ /* @__PURE__ */ r.jsx("p", { className: "text-sm text-slate-600", children: "Choose the format of the file you're importing" })
862
+ ] }),
863
+ /* @__PURE__ */ r.jsxs("div", { className: "space-y-3 mb-6", children: [
864
+ /* @__PURE__ */ r.jsx(
865
+ "button",
866
+ {
867
+ onClick: () => x("inhouse"),
868
+ className: "w-full text-left p-4 rounded-xl border-2 border-slate-200 hover:border-blue-500 hover:bg-blue-50 transition-all group",
869
+ children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-start gap-3", children: [
870
+ /* @__PURE__ */ r.jsx("div", { className: "w-5 h-5 rounded-full border-2 border-slate-300 group-hover:border-blue-500 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ r.jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-transparent group-hover:bg-blue-500" }) }),
871
+ /* @__PURE__ */ r.jsxs("div", { className: "flex-1", children: [
872
+ /* @__PURE__ */ r.jsx("div", { className: "font-semibold text-slate-900 mb-1", children: "Default Schema" }),
873
+ /* @__PURE__ */ r.jsx("div", { className: "text-sm text-slate-600", children: "Our internal questionnaire format" })
874
+ ] })
875
+ ] })
876
+ }
877
+ ),
878
+ /* @__PURE__ */ r.jsx(
879
+ "button",
880
+ {
881
+ onClick: () => x("surveyjs"),
882
+ className: "w-full text-left p-4 rounded-xl border-2 border-slate-200 hover:border-purple-500 hover:bg-purple-50 transition-all group",
883
+ children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-start gap-3", children: [
884
+ /* @__PURE__ */ r.jsx("div", { className: "w-5 h-5 rounded-full border-2 border-slate-300 group-hover:border-purple-500 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ r.jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-transparent group-hover:bg-purple-500" }) }),
885
+ /* @__PURE__ */ r.jsxs("div", { className: "flex-1", children: [
886
+ /* @__PURE__ */ r.jsx("div", { className: "font-semibold text-slate-900 mb-1", children: "SurveyJS Schema" }),
887
+ /* @__PURE__ */ r.jsx("div", { className: "text-sm text-slate-600", children: "Will be converted to our internal format" })
888
+ ] })
889
+ ] })
890
+ }
891
+ )
892
+ ] }),
893
+ /* @__PURE__ */ r.jsx(
894
+ "button",
895
+ {
896
+ onClick: C,
897
+ className: "w-full px-4 py-2.5 rounded-xl border border-slate-300 bg-white hover:bg-slate-50 text-slate-700 font-medium text-sm transition-colors",
898
+ children: "Cancel"
899
+ }
900
+ )
901
+ ] }) })
825
902
  ] });
826
903
  }
827
- function Jr() {
828
- const [t, n] = xe(!1), [s, i] = xe(!1), o = rr(null), u = q((h) => h.addField), b = Ie(), c = H(), f = c.state.isPreview, g = () => {
829
- n((h) => !h), i(!1);
830
- }, m = () => {
831
- i((h) => !h), n(!1);
832
- }, p = () => {
833
- c.preview.toggle(), n(!1), i(!1);
904
+ function Gr() {
905
+ const [t, n] = ne(!1), [a, l] = ne(!1), c = er(null), f = Y((x) => x.addField), m = rr(), o = ee(), d = o.state.isPreview, w = () => {
906
+ n((x) => !x), l(!1);
907
+ }, v = () => {
908
+ l((x) => !x), n(!1);
909
+ }, b = () => {
910
+ o.preview.toggle(), n(!1), l(!1);
834
911
  };
835
- return ee(() => {
836
- if (!t || s) return;
837
- const h = (T) => {
838
- const v = o.current;
839
- v && !v.contains(T.target) && (n(!1), i(!1));
912
+ return se(() => {
913
+ if (!t || a) return;
914
+ const x = (C) => {
915
+ const g = c.current;
916
+ g && !g.contains(C.target) && (n(!1), l(!1));
840
917
  };
841
- return document.addEventListener("pointerdown", h), () => document.removeEventListener("pointerdown", h);
842
- }, [t, s]), /* @__PURE__ */ r.jsxs("div", { className: "MobileToolBar fixed bottom-0 left-0 w-full text-stone-900 shadow-lg z-10", children: [
918
+ return document.addEventListener("pointerdown", x), () => document.removeEventListener("pointerdown", x);
919
+ }, [t, a]), /* @__PURE__ */ r.jsxs("div", { className: "MobileToolBar fixed bottom-0 left-0 w-full text-stone-900 shadow-lg z-10", children: [
843
920
  /* @__PURE__ */ r.jsxs(
844
- K.div,
921
+ Z.div,
845
922
  {
846
923
  initial: { y: "100%" },
847
924
  animate: { y: "0%" },
848
925
  transition: { duration: 0.8, ease: [0.25, 0.1, 0.25, 1] },
849
- className: `flex ${f ? "justify-center" : "justify-around"} pb-5 max-w-xl sm:max-w-4xl mx-auto`,
926
+ className: `flex ${d ? "justify-center" : "justify-around"} pb-5 max-w-xl sm:max-w-4xl mx-auto`,
850
927
  children: [
851
928
  /* @__PURE__ */ r.jsx(
852
- K.button,
929
+ Z.button,
853
930
  {
854
- onClick: p,
931
+ onClick: b,
855
932
  initial: { opacity: 1, scale: 1, x: "0%" },
856
933
  animate: {
857
- opacity: t || s ? 0 : 1,
858
- scale: t || s ? 0 : 1,
859
- x: f ? "120%" : "0%"
934
+ opacity: t || a ? 0 : 1,
935
+ scale: t || a ? 0 : 1,
936
+ x: d ? "120%" : "0%"
860
937
  },
861
- className: `relative cursor-pointer ${f ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
862
- children: f ? /* @__PURE__ */ r.jsx(Dr, { className: "h-12 w-12" }) : /* @__PURE__ */ r.jsx(Ar, { className: "h-12 w-12" })
938
+ className: `relative cursor-pointer ${d ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
939
+ children: d ? /* @__PURE__ */ r.jsx(Pr, { className: "h-12 w-12" }) : /* @__PURE__ */ r.jsx(Dr, { className: "h-12 w-12" })
863
940
  }
864
941
  ),
865
- !f && /* @__PURE__ */ r.jsx(
866
- K.button,
942
+ !d && /* @__PURE__ */ r.jsx(
943
+ Z.button,
867
944
  {
868
- onClick: g,
945
+ onClick: w,
869
946
  initial: { opacity: 1, scale: 1 },
870
947
  animate: {
871
- opacity: t || s ? 0 : 1,
872
- scale: t || s ? 0 : 1
948
+ opacity: t || a ? 0 : 1,
949
+ scale: t || a ? 0 : 1
873
950
  },
874
951
  className: "relative cursor-pointer bg-black/5 rounded-2xl p-3 backdrop-blur-xl",
875
- children: /* @__PURE__ */ r.jsx(Pr, { className: "h-12 w-12" })
952
+ children: /* @__PURE__ */ r.jsx(Fr, { className: "h-12 w-12" })
876
953
  }
877
954
  ),
878
955
  /* @__PURE__ */ r.jsx(
879
- K.button,
956
+ Z.button,
880
957
  {
881
- onClick: m,
958
+ onClick: v,
882
959
  initial: { opacity: 1, scale: 1, x: "0%" },
883
960
  animate: {
884
- opacity: s || t ? 0 : 1,
885
- scale: s || t ? 0 : 1,
886
- x: f ? "-120%" : "0%"
961
+ opacity: a || t ? 0 : 1,
962
+ scale: a || t ? 0 : 1,
963
+ x: d ? "-120%" : "0%"
887
964
  },
888
- className: `relative cursor-pointer ${f ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
889
- children: /* @__PURE__ */ r.jsx(Fr, { className: "h-12 w-12" })
965
+ className: `relative cursor-pointer ${d ? "mx-29" : ""} bg-black/5 rounded-2xl p-3 backdrop-blur-xl`,
966
+ children: /* @__PURE__ */ r.jsx($r, { className: "h-12 w-12" })
890
967
  }
891
968
  )
892
969
  ]
@@ -895,19 +972,19 @@ function Jr() {
895
972
  /* @__PURE__ */ r.jsx(
896
973
  nr,
897
974
  {
898
- open: s,
899
- onClose: () => i(!1),
900
- data: b,
975
+ open: a,
976
+ onClose: () => l(!1),
977
+ data: m,
901
978
  title: "Form Data",
902
979
  placement: "bottom",
903
980
  contentClassName: "custom-scrollbar"
904
981
  }
905
982
  ),
906
983
  /* @__PURE__ */ r.jsx(
907
- K.div,
984
+ Z.div,
908
985
  {
909
- ref: o,
910
- onPointerDown: (h) => h.stopPropagation(),
986
+ ref: c,
987
+ onPointerDown: (x) => x.stopPropagation(),
911
988
  initial: { opacity: 0, y: "100%", scale: 0 },
912
989
  animate: {
913
990
  opacity: t ? 1 : 0,
@@ -917,108 +994,108 @@ function Jr() {
917
994
  transition: { type: "spring", stiffness: 150, damping: 20 },
918
995
  className: "MobileToolBar-Modal fixed bottom-0 w-full mx-auto bg-black/5 border-black/15 border px-9 py-4 mb-2 rounded-2xl backdrop-blur-xl overflow-y-scroll",
919
996
  children: /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 gap-2", children: [
920
- /* @__PURE__ */ r.jsx("button", { className: "flex w-full justify-end", onClick: () => n(!1), children: /* @__PURE__ */ r.jsx($r, {}) }),
921
- Object.keys(le).map((h) => /* @__PURE__ */ r.jsxs(
997
+ /* @__PURE__ */ r.jsx("button", { className: "flex w-full justify-end", onClick: () => n(!1), children: /* @__PURE__ */ r.jsx(Lr, {}) }),
998
+ Object.keys(fe).map((x) => /* @__PURE__ */ r.jsxs(
922
999
  "button",
923
1000
  {
924
1001
  className: "px-4 pl-6 py-2 text-black text-left rounded hover:bg-slate-50",
925
1002
  onClick: () => {
926
- u(h), n(!1);
1003
+ f(x), n(!1);
927
1004
  },
928
1005
  children: [
929
1006
  "Add ",
930
- le[h].label
1007
+ fe[x].label
931
1008
  ]
932
1009
  },
933
- h
1010
+ x
934
1011
  ))
935
1012
  ] })
936
1013
  }
937
1014
  )
938
1015
  ] });
939
1016
  }
940
- const He = Object.entries(le).map(([t, n]) => ({
1017
+ const Ke = Object.entries(fe).map(([t, n]) => ({
941
1018
  type: t,
942
1019
  label: n.label
943
- })), zr = ({ isPreview: t = !1 }) => {
1020
+ })), Kr = ({ isPreview: t = !1 }) => {
944
1021
  if (t) return null;
945
- const n = q((i) => i.addField), s = re(() => {
946
- const i = {};
947
- for (const { type: o } of He) i[o] = () => n(o);
948
- return i;
1022
+ const n = Y((l) => l.addField), a = ue(() => {
1023
+ const l = {};
1024
+ for (const { type: c } of Ke) l[c] = () => n(c);
1025
+ return l;
949
1026
  }, [n]);
950
1027
  return /* @__PURE__ */ r.jsxs("div", { className: "p-4 bg-white border border-gray-200 rounded-lg shadow-sm", children: [
951
1028
  /* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Tools" }),
952
- /* @__PURE__ */ r.jsx("div", { className: "grid grid-cols-1 gap-2", children: He.map(({ type: i, label: o }) => /* @__PURE__ */ r.jsxs(
1029
+ /* @__PURE__ */ r.jsx("div", { className: "grid grid-cols-1 gap-2", children: Ke.map(({ type: l, label: c }) => /* @__PURE__ */ r.jsxs(
953
1030
  "button",
954
1031
  {
955
1032
  className: "px-3 py-2 text-left border border-black/10 rounded-md hover:bg-slate-50",
956
- onClick: s[i],
1033
+ onClick: a[l],
957
1034
  children: [
958
1035
  "Add ",
959
- o
1036
+ c
960
1037
  ]
961
1038
  },
962
- i
1039
+ l
963
1040
  )) })
964
1041
  ] });
965
- }, Gr = E.memo(zr, (t, n) => t.isPreview === n.isPreview);
966
- function ar({
1042
+ }, Hr = k.memo(Kr, (t, n) => t.isPreview === n.isPreview);
1043
+ function sr({
967
1044
  id: t = "",
968
1045
  label: n = "ID",
969
- onCommit: s,
970
- validate: i,
971
- placeholder: o = "Enter unique ID…",
972
- className: u = ""
1046
+ onCommit: a,
1047
+ validate: l,
1048
+ placeholder: c = "Enter unique ID…",
1049
+ className: f = ""
973
1050
  }) {
974
- const [b, c] = E.useState(t ?? ""), [f, g] = E.useState("");
975
- E.useEffect(() => {
976
- c(t ?? ""), g("");
1051
+ const [m, o] = k.useState(t ?? ""), [d, w] = k.useState("");
1052
+ k.useEffect(() => {
1053
+ o(t ?? ""), w("");
977
1054
  }, [t]);
978
- const m = E.useCallback(() => {
979
- const p = String(b ?? "").trim();
980
- if (!p) {
981
- g("ID cannot be empty."), c(t ?? "");
1055
+ const v = k.useCallback(() => {
1056
+ const b = String(m ?? "").trim();
1057
+ if (!b) {
1058
+ w("ID cannot be empty."), o(t ?? "");
982
1059
  return;
983
1060
  }
984
- if (p !== (t ?? "")) {
985
- if (typeof i == "function") {
986
- const h = i(p, t ?? "");
987
- if (h) {
988
- g(h);
1061
+ if (b !== (t ?? "")) {
1062
+ if (typeof l == "function") {
1063
+ const x = l(b, t ?? "");
1064
+ if (x) {
1065
+ w(x);
989
1066
  return;
990
1067
  }
991
1068
  }
992
- s == null || s(p);
1069
+ a == null || a(b);
993
1070
  }
994
- }, [b, t, s, i]);
995
- return /* @__PURE__ */ r.jsxs("div", { className: u, children: [
1071
+ }, [m, t, a, l]);
1072
+ return /* @__PURE__ */ r.jsxs("div", { className: f, children: [
996
1073
  /* @__PURE__ */ r.jsx("label", { className: "block text-sm mb-1", children: n }),
997
1074
  /* @__PURE__ */ r.jsx(
998
1075
  "input",
999
1076
  {
1000
1077
  className: "w-full px-3 py-2 border border-black/20 rounded",
1001
- value: b,
1002
- onChange: (p) => {
1003
- f && g(""), c(p.target.value);
1078
+ value: m,
1079
+ onChange: (b) => {
1080
+ d && w(""), o(b.target.value);
1004
1081
  },
1005
- onBlur: m,
1006
- onKeyDown: (p) => {
1007
- p.key === "Enter" && (p.preventDefault(), m());
1082
+ onBlur: v,
1083
+ onKeyDown: (b) => {
1084
+ b.key === "Enter" && (b.preventDefault(), v());
1008
1085
  },
1009
- placeholder: o
1086
+ placeholder: c
1010
1087
  }
1011
1088
  ),
1012
- f ? /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 mt-1", children: f }) : null
1089
+ d ? /* @__PURE__ */ r.jsx("p", { className: "text-xs text-red-600 mt-1", children: d }) : null
1013
1090
  ] });
1014
1091
  }
1015
- function sr({ f: t, onUpdateField: n }) {
1092
+ function ar({ f: t, onUpdateField: n }) {
1016
1093
  return /* @__PURE__ */ r.jsxs("div", { className: "space-y-3", children: [
1017
1094
  /* @__PURE__ */ r.jsx(
1018
- ar,
1095
+ sr,
1019
1096
  {
1020
1097
  id: t.id ?? "",
1021
- onCommit: (s) => n == null ? void 0 : n("id", s)
1098
+ onCommit: (a) => n == null ? void 0 : n("id", a)
1022
1099
  }
1023
1100
  ),
1024
1101
  /* @__PURE__ */ r.jsxs("div", { children: [
@@ -1028,7 +1105,7 @@ function sr({ f: t, onUpdateField: n }) {
1028
1105
  {
1029
1106
  className: "w-full px-3 py-2 border border-black/20 rounded",
1030
1107
  value: t.question || "",
1031
- onChange: (s) => n("question", s.target.value),
1108
+ onChange: (a) => n("question", a.target.value),
1032
1109
  placeholder: "Enter question text"
1033
1110
  }
1034
1111
  )
@@ -1039,7 +1116,7 @@ function sr({ f: t, onUpdateField: n }) {
1039
1116
  {
1040
1117
  type: "checkbox",
1041
1118
  checked: !!t.required,
1042
- onChange: (s) => n("required", s.target.checked)
1119
+ onChange: (a) => n("required", a.target.checked)
1043
1120
  }
1044
1121
  ),
1045
1122
  "Required"
@@ -1051,96 +1128,96 @@ function sr({ f: t, onUpdateField: n }) {
1051
1128
  {
1052
1129
  className: "w-full px-3 py-2 border border-black/20 rounded",
1053
1130
  value: t.sublabel || "",
1054
- onChange: (s) => n("sublabel", s.target.value),
1131
+ onChange: (a) => n("sublabel", a.target.value),
1055
1132
  placeholder: "Helper text / description"
1056
1133
  }
1057
1134
  )
1058
1135
  ] })
1059
1136
  ] });
1060
1137
  }
1061
- const $ = [];
1138
+ const M = [];
1062
1139
  for (let t = 0; t < 256; ++t)
1063
- $.push((t + 256).toString(16).slice(1));
1064
- function Kr(t, n = 0) {
1065
- return ($[t[n + 0]] + $[t[n + 1]] + $[t[n + 2]] + $[t[n + 3]] + "-" + $[t[n + 4]] + $[t[n + 5]] + "-" + $[t[n + 6]] + $[t[n + 7]] + "-" + $[t[n + 8]] + $[t[n + 9]] + "-" + $[t[n + 10]] + $[t[n + 11]] + $[t[n + 12]] + $[t[n + 13]] + $[t[n + 14]] + $[t[n + 15]]).toLowerCase();
1140
+ M.push((t + 256).toString(16).slice(1));
1141
+ function Xr(t, n = 0) {
1142
+ return (M[t[n + 0]] + M[t[n + 1]] + M[t[n + 2]] + M[t[n + 3]] + "-" + M[t[n + 4]] + M[t[n + 5]] + "-" + M[t[n + 6]] + M[t[n + 7]] + "-" + M[t[n + 8]] + M[t[n + 9]] + "-" + M[t[n + 10]] + M[t[n + 11]] + M[t[n + 12]] + M[t[n + 13]] + M[t[n + 14]] + M[t[n + 15]]).toLowerCase();
1066
1143
  }
1067
- let _e;
1068
- const Hr = new Uint8Array(16);
1069
- function Xr() {
1070
- if (!_e) {
1144
+ let Ie;
1145
+ const Qr = new Uint8Array(16);
1146
+ function Zr() {
1147
+ if (!Ie) {
1071
1148
  if (typeof crypto > "u" || !crypto.getRandomValues)
1072
1149
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1073
- _e = crypto.getRandomValues.bind(crypto);
1150
+ Ie = crypto.getRandomValues.bind(crypto);
1074
1151
  }
1075
- return _e(Hr);
1152
+ return Ie(Qr);
1076
1153
  }
1077
- const Qr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Xe = { randomUUID: Qr };
1078
- function Zr(t, n, s) {
1079
- var o;
1080
- if (Xe.randomUUID && !t)
1081
- return Xe.randomUUID();
1154
+ const et = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), He = { randomUUID: et };
1155
+ function rt(t, n, a) {
1156
+ var c;
1157
+ if (He.randomUUID && !t)
1158
+ return He.randomUUID();
1082
1159
  t = t || {};
1083
- const i = t.random ?? ((o = t.rng) == null ? void 0 : o.call(t)) ?? Xr();
1084
- if (i.length < 16)
1160
+ const l = t.random ?? ((c = t.rng) == null ? void 0 : c.call(t)) ?? Zr();
1161
+ if (l.length < 16)
1085
1162
  throw new Error("Random bytes length must be >= 16");
1086
- return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Kr(i);
1163
+ return l[6] = l[6] & 15 | 64, l[8] = l[8] & 63 | 128, Xr(l);
1087
1164
  }
1088
- function ir({ field: t, onUpdateField: n }) {
1089
- const s = t.options || [], i = () => {
1090
- n("options", [...s, { id: Zr(), value: "" }]);
1091
- }, o = (b, c) => {
1165
+ function lr({ field: t, onUpdateField: n }) {
1166
+ const a = t.options || [], l = () => {
1167
+ n("options", [...a, { id: rt(), value: "" }]);
1168
+ }, c = (m, o) => {
1092
1169
  n(
1093
1170
  "options",
1094
- s.map((f) => f.id === b ? { ...f, value: c } : f)
1171
+ a.map((d) => d.id === m ? { ...d, value: o } : d)
1095
1172
  );
1096
- }, u = (b) => {
1173
+ }, f = (m) => {
1097
1174
  n(
1098
1175
  "options",
1099
- s.filter((c) => c.id !== b)
1176
+ a.filter((o) => o.id !== m)
1100
1177
  );
1101
1178
  };
1102
1179
  return /* @__PURE__ */ r.jsxs("div", { className: "mt-3", children: [
1103
1180
  /* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Options" }),
1104
- s.map((b) => /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
1181
+ a.map((m) => /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
1105
1182
  /* @__PURE__ */ r.jsx(
1106
1183
  "input",
1107
1184
  {
1108
1185
  className: "flex-1 px-3 py-2 border border-black/20 rounded",
1109
- value: b.value,
1110
- onChange: (c) => o(b.id, c.target.value),
1186
+ value: m.value,
1187
+ onChange: (o) => c(m.id, o.target.value),
1111
1188
  placeholder: "Option text"
1112
1189
  }
1113
1190
  ),
1114
1191
  /* @__PURE__ */ r.jsx(
1115
1192
  "button",
1116
1193
  {
1117
- onClick: () => u(b.id),
1194
+ onClick: () => f(m.id),
1118
1195
  className: "px-2 py-1 text-sm border border-black/20 rounded hover:bg-slate-50",
1119
1196
  children: "Remove"
1120
1197
  }
1121
1198
  )
1122
- ] }, b.id)),
1199
+ ] }, m.id)),
1123
1200
  /* @__PURE__ */ r.jsx(
1124
1201
  "button",
1125
1202
  {
1126
- onClick: i,
1203
+ onClick: l,
1127
1204
  className: "mt-1 px-3 py-2 text-sm border border-black/20 rounded hover:bg-slate-50",
1128
1205
  children: "+ Add Option"
1129
1206
  }
1130
1207
  )
1131
1208
  ] });
1132
1209
  }
1133
- function et({ f: t }) {
1134
- const n = tr(t.id), s = be(
1135
- (o, u) => n.field.update(o, u),
1210
+ function tt({ f: t }) {
1211
+ const n = tr(t.id), a = ge(
1212
+ (c, f) => n.field.update(c, f),
1136
1213
  [n]
1137
- ), i = re(
1214
+ ), l = ue(
1138
1215
  () => ["radio", "check", "selection"].includes(t.fieldType),
1139
1216
  [t.fieldType]
1140
1217
  );
1141
1218
  return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1142
1219
  /* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Edit" }),
1143
- /* @__PURE__ */ r.jsx(sr, { f: t, onUpdateField: s }),
1220
+ /* @__PURE__ */ r.jsx(ar, { f: t, onUpdateField: a }),
1144
1221
  t.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
1145
1222
  /* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Default Answer" }),
1146
1223
  /* @__PURE__ */ r.jsx(
@@ -1148,74 +1225,74 @@ function et({ f: t }) {
1148
1225
  {
1149
1226
  className: "w-full px-3 py-2 border border-black/20 rounded",
1150
1227
  value: t.answer || "",
1151
- onChange: (o) => s("answer", o.target.value),
1228
+ onChange: (c) => a("answer", c.target.value),
1152
1229
  placeholder: "Default value"
1153
1230
  }
1154
1231
  )
1155
1232
  ] }),
1156
- i && /* @__PURE__ */ r.jsx(ir, { field: t, onUpdateField: s })
1233
+ l && /* @__PURE__ */ r.jsx(lr, { field: t, onUpdateField: a })
1157
1234
  ] });
1158
1235
  }
1159
- function rt({ section: t, onActiveChildChange: n }) {
1160
- var p, h, T;
1161
- const s = tr(t.id), i = Array.isArray(t.fields) ? t.fields : [], [o, u] = xe(((p = i[0]) == null ? void 0 : p.id) || null);
1162
- ee(() => {
1163
- var v;
1164
- u(((v = i[0]) == null ? void 0 : v.id) || null);
1165
- }, [t.id]), ee(() => {
1166
- if (!i.length) {
1167
- o !== null && u(null);
1236
+ function nt({ section: t, onActiveChildChange: n }) {
1237
+ var b, x, C;
1238
+ const a = tr(t.id), l = Array.isArray(t.fields) ? t.fields : [], [c, f] = ne(((b = l[0]) == null ? void 0 : b.id) || null);
1239
+ se(() => {
1240
+ var g;
1241
+ f(((g = l[0]) == null ? void 0 : g.id) || null);
1242
+ }, [t.id]), se(() => {
1243
+ if (!l.length) {
1244
+ c !== null && f(null);
1168
1245
  return;
1169
1246
  }
1170
- i.some((S) => S.id === o) || u(i[0].id);
1171
- }, [i, o]), ee(() => {
1172
- n == null || n(t.id, o || null);
1173
- }, [t.id, o, n]);
1174
- const b = be(
1175
- (v, S) => s.field.update(v, S),
1176
- [s]
1177
- ), c = re(
1178
- () => i.find((v) => v.id === o) || null,
1179
- [i, o]
1180
- ), f = be(
1181
- (v, S) => {
1182
- if (c) {
1183
- if (v === "id") {
1184
- const k = String(S ?? "").trim();
1185
- if (!k) return;
1186
- q.getState().updateField(
1187
- c.id,
1188
- { id: k },
1247
+ l.some((O) => O.id === c) || f(l[0].id);
1248
+ }, [l, c]), se(() => {
1249
+ n == null || n(t.id, c || null);
1250
+ }, [t.id, c, n]);
1251
+ const m = ge(
1252
+ (g, O) => a.field.update(g, O),
1253
+ [a]
1254
+ ), o = ue(
1255
+ () => l.find((g) => g.id === c) || null,
1256
+ [l, c]
1257
+ ), d = ge(
1258
+ (g, O) => {
1259
+ if (o) {
1260
+ if (g === "id") {
1261
+ const h = String(O ?? "").trim();
1262
+ if (!h) return;
1263
+ Y.getState().updateField(
1264
+ o.id,
1265
+ { id: h },
1189
1266
  {
1190
1267
  sectionId: t.id,
1191
- onIdChange: (L, _) => {
1192
- u((F) => F === _ ? L : F);
1268
+ onIdChange: (F, N) => {
1269
+ f((T) => T === N ? F : T);
1193
1270
  }
1194
1271
  }
1195
1272
  );
1196
1273
  return;
1197
1274
  }
1198
- q.getState().updateField(
1199
- c.id,
1200
- { [v]: S },
1275
+ Y.getState().updateField(
1276
+ o.id,
1277
+ { [g]: O },
1201
1278
  { sectionId: t.id }
1202
1279
  );
1203
1280
  }
1204
1281
  },
1205
- [c, t.id]
1206
- ), g = be(() => {
1207
- c && q.getState().deleteField(c.id, { sectionId: t.id });
1208
- }, [c, t.id]), m = re(
1209
- () => c && ["radio", "check", "selection"].includes(c.fieldType),
1210
- [c]
1282
+ [o, t.id]
1283
+ ), w = ge(() => {
1284
+ o && Y.getState().deleteField(o.id, { sectionId: t.id });
1285
+ }, [o, t.id]), v = ue(
1286
+ () => o && ["radio", "check", "selection"].includes(o.fieldType),
1287
+ [o]
1211
1288
  );
1212
1289
  return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1213
1290
  /* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-3", children: "Edit Section" }),
1214
1291
  /* @__PURE__ */ r.jsx(
1215
- ar,
1292
+ sr,
1216
1293
  {
1217
1294
  id: t.id,
1218
- onCommit: (v) => s.field.renameId(v)
1295
+ onCommit: (g) => a.field.renameId(g)
1219
1296
  }
1220
1297
  ),
1221
1298
  /* @__PURE__ */ r.jsxs("div", { className: "mt-3", children: [
@@ -1225,54 +1302,54 @@ function rt({ section: t, onActiveChildChange: n }) {
1225
1302
  {
1226
1303
  className: "w-full px-3 py-2 border border-black/20 rounded",
1227
1304
  value: t.title || "",
1228
- onChange: (v) => b("title", v.target.value),
1305
+ onChange: (g) => m("title", g.target.value),
1229
1306
  placeholder: "Section title"
1230
1307
  }
1231
1308
  )
1232
1309
  ] }),
1233
1310
  /* @__PURE__ */ r.jsxs("div", { className: "mt-6", children: [
1234
1311
  /* @__PURE__ */ r.jsx("div", { className: "text-sm font-semibold mb-2", children: "Fields in this section" }),
1235
- i.length === 0 ? /* @__PURE__ */ r.jsx("div", { className: "text-sm text-gray-500", children: "No fields yet. Use the section’s mini toolbar to add fields." }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1236
- /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: i.map((v) => {
1237
- var S, k;
1312
+ l.length === 0 ? /* @__PURE__ */ r.jsx("div", { className: "text-sm text-gray-500", children: "No fields yet. Use the section’s mini toolbar to add fields." }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1313
+ /* @__PURE__ */ r.jsx("div", { className: "flex flex-wrap gap-2 mb-3", children: l.map((g) => {
1314
+ var O, h;
1238
1315
  return /* @__PURE__ */ r.jsx(
1239
1316
  "button",
1240
1317
  {
1241
1318
  className: [
1242
1319
  "px-3 py-1.5 text-sm rounded border",
1243
- o === v.id ? "bg-black/5 border-black/20" : "bg-white border-black/10 hover:bg-slate-50"
1320
+ c === g.id ? "bg-black/5 border-black/20" : "bg-white border-black/10 hover:bg-slate-50"
1244
1321
  ].join(" "),
1245
- onClick: () => u(v.id),
1246
- title: v.question || v.fieldType,
1247
- children: ((S = v.question) == null ? void 0 : S.trim()) || ((k = le[v.fieldType]) == null ? void 0 : k.label) || "Field"
1322
+ onClick: () => f(g.id),
1323
+ title: g.question || g.fieldType,
1324
+ children: ((O = g.question) == null ? void 0 : O.trim()) || ((h = fe[g.fieldType]) == null ? void 0 : h.label) || "Field"
1248
1325
  },
1249
- v.id
1326
+ g.id
1250
1327
  );
1251
1328
  }) }),
1252
- c && /* @__PURE__ */ r.jsxs("div", { className: "mt-2", children: [
1329
+ o && /* @__PURE__ */ r.jsxs("div", { className: "mt-2", children: [
1253
1330
  /* @__PURE__ */ r.jsxs("div", { className: "text-sm font-semibold mb-2", children: [
1254
1331
  "Editing: ",
1255
- ((h = c.question) == null ? void 0 : h.trim()) || ((T = le[c.fieldType]) == null ? void 0 : T.label)
1332
+ ((x = o.question) == null ? void 0 : x.trim()) || ((C = fe[o.fieldType]) == null ? void 0 : C.label)
1256
1333
  ] }),
1257
- /* @__PURE__ */ r.jsx(sr, { f: c, onUpdateField: f }),
1258
- c.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
1334
+ /* @__PURE__ */ r.jsx(ar, { f: o, onUpdateField: d }),
1335
+ o.fieldType === "input" && /* @__PURE__ */ r.jsxs("div", { className: "mt-4", children: [
1259
1336
  /* @__PURE__ */ r.jsx("div", { className: "text-sm font-medium mb-1", children: "Default Answer" }),
1260
1337
  /* @__PURE__ */ r.jsx(
1261
1338
  "input",
1262
1339
  {
1263
1340
  className: "w-full px-3 py-2 border border-black/20 rounded",
1264
- value: c.answer || "",
1265
- onChange: (v) => f("answer", v.target.value),
1341
+ value: o.answer || "",
1342
+ onChange: (g) => d("answer", g.target.value),
1266
1343
  placeholder: "Default value"
1267
1344
  }
1268
1345
  )
1269
1346
  ] }),
1270
- m && /* @__PURE__ */ r.jsx(ir, { field: c, onUpdateField: f }),
1347
+ v && /* @__PURE__ */ r.jsx(lr, { field: o, onUpdateField: d }),
1271
1348
  /* @__PURE__ */ r.jsx(
1272
1349
  "button",
1273
1350
  {
1274
1351
  className: "mt-3 px-3 py-2 text-sm text-red-400 border rounded",
1275
- onClick: g,
1352
+ onClick: w,
1276
1353
  children: "Delete this field"
1277
1354
  }
1278
1355
  )
@@ -1281,7 +1358,7 @@ function rt({ section: t, onActiveChildChange: n }) {
1281
1358
  ] })
1282
1359
  ] });
1283
1360
  }
1284
- function Qe(t) {
1361
+ function Xe(t) {
1285
1362
  switch (t) {
1286
1363
  case "input":
1287
1364
  return ["equals", "contains"];
@@ -1294,110 +1371,110 @@ function Qe(t) {
1294
1371
  return ["equals"];
1295
1372
  }
1296
1373
  }
1297
- function Ze(t) {
1374
+ function Qe(t) {
1298
1375
  if (t && typeof t == "object") {
1299
- const s = t.id ?? String(t.value ?? ""), i = String(t.value ?? t.label ?? t.id ?? "");
1300
- return { id: s, value: i };
1376
+ const a = t.id ?? String(t.value ?? ""), l = String(t.value ?? t.label ?? t.id ?? "");
1377
+ return { id: a, value: l };
1301
1378
  }
1302
1379
  const n = String(t ?? "");
1303
1380
  return { id: n, value: n };
1304
1381
  }
1305
- function tt() {
1306
- var ce, te, B;
1307
- const t = H(), n = q((d) => d.byId), s = q((d) => d.setEnableWhen), i = q((d) => d.updateField), o = ((ce = t == null ? void 0 : t.selectedFieldId) == null ? void 0 : ce.value) ?? null;
1308
- (te = t == null ? void 0 : t.selectedChildId) == null || te.ParentId;
1309
- const u = ((B = t == null ? void 0 : t.selectedChildId) == null ? void 0 : B.ChildId) ?? null, b = o ? n[o] : null, c = (b == null ? void 0 : b.fieldType) === "section", f = E.useMemo(() => c ? Array.isArray(b == null ? void 0 : b.fields) ? b.fields : [] : [], [c, b]), g = E.useMemo(() => !c || !u ? !1 : f.some((d) => d.id === u), [c, u, f]), m = E.useMemo(() => c && g ? `child:${u}` : "", [c, g, u]), [p, h] = E.useState(m);
1310
- E.useEffect(() => {
1311
- h(m);
1312
- }, [m]), E.useEffect(() => {
1313
- if (c)
1314
- if (p && p.startsWith("child:")) {
1315
- const d = p.slice(6);
1316
- t.selectedChildId.set(o, d);
1382
+ function st() {
1383
+ var me, le, z;
1384
+ const t = ee(), n = Y((u) => u.byId), a = Y((u) => u.setEnableWhen), l = Y((u) => u.updateField), c = ((me = t == null ? void 0 : t.selectedFieldId) == null ? void 0 : me.value) ?? null;
1385
+ (le = t == null ? void 0 : t.selectedChildId) == null || le.ParentId;
1386
+ const f = ((z = t == null ? void 0 : t.selectedChildId) == null ? void 0 : z.ChildId) ?? null, m = c ? n[c] : null, o = (m == null ? void 0 : m.fieldType) === "section", d = k.useMemo(() => o ? Array.isArray(m == null ? void 0 : m.fields) ? m.fields : [] : [], [o, m]), w = k.useMemo(() => !o || !f ? !1 : d.some((u) => u.id === f), [o, f, d]), v = k.useMemo(() => o && w ? `child:${f}` : "", [o, w, f]), [b, x] = k.useState(v);
1387
+ k.useEffect(() => {
1388
+ x(v);
1389
+ }, [v]), k.useEffect(() => {
1390
+ if (o)
1391
+ if (b && b.startsWith("child:")) {
1392
+ const u = b.slice(6);
1393
+ t.selectedChildId.set(c, u);
1317
1394
  } else
1318
1395
  t.selectedChildId.set(null, null);
1319
- }, [c, p, o, t]);
1320
- const T = !!(c && p && p.startsWith("child:")), v = T ? p.slice(6) : null, S = T ? v : o, k = E.useMemo(() => S ? T ? f.find((d) => d.id === v) ?? null : n[S] ?? null : null, [n, S, T, v, f]), L = E.useMemo(() => {
1321
- var C, I, Y;
1322
- const d = [];
1323
- for (const A of Object.values(n))
1324
- if (A)
1325
- if (A.fieldType === "section" && Array.isArray(A.fields)) {
1326
- const U = ((C = A.title) == null ? void 0 : C.trim()) || "Section";
1327
- A.fields.forEach((y) => {
1328
- var z;
1329
- d.push({
1396
+ }, [o, b, c, t]);
1397
+ const C = !!(o && b && b.startsWith("child:")), g = C ? b.slice(6) : null, O = C ? g : c, h = k.useMemo(() => O ? C ? d.find((u) => u.id === g) ?? null : n[O] ?? null : null, [n, O, C, g, d]), F = k.useMemo(() => {
1398
+ var I, D, B;
1399
+ const u = [];
1400
+ for (const P of Object.values(n))
1401
+ if (P)
1402
+ if (P.fieldType === "section" && Array.isArray(P.fields)) {
1403
+ const V = ((I = P.title) == null ? void 0 : I.trim()) || "Section";
1404
+ P.fields.forEach((y) => {
1405
+ var H;
1406
+ u.push({
1330
1407
  id: y.id,
1331
- parentId: A.id,
1332
- label: `${U} › ${((z = y.question) == null ? void 0 : z.trim()) || y.id}`,
1408
+ parentId: P.id,
1409
+ label: `${V} › ${((H = y.question) == null ? void 0 : H.trim()) || y.id}`,
1333
1410
  fieldType: y.fieldType,
1334
1411
  options: Array.isArray(y.options) ? y.options : []
1335
1412
  });
1336
1413
  });
1337
1414
  } else
1338
- d.push({
1339
- id: A.id,
1415
+ u.push({
1416
+ id: P.id,
1340
1417
  parentId: null,
1341
- label: ((I = A.question) == null ? void 0 : I.trim()) || ((Y = A.title) == null ? void 0 : Y.trim()) || A.id,
1342
- fieldType: A.fieldType,
1343
- options: Array.isArray(A.options) ? A.options : []
1418
+ label: ((D = P.question) == null ? void 0 : D.trim()) || ((B = P.title) == null ? void 0 : B.trim()) || P.id,
1419
+ fieldType: P.fieldType,
1420
+ options: Array.isArray(P.options) ? P.options : []
1344
1421
  });
1345
- return d;
1346
- }, [n]), _ = E.useCallback(
1347
- (d) => L.find((C) => C.id === d) || null,
1348
- [L]
1349
- ), F = E.useCallback(
1350
- (d) => {
1351
- if (!S) return;
1352
- const C = d && Array.isArray(d.conditions) ? { logic: d.logic || "AND", conditions: d.conditions } : void 0;
1353
- T && o ? i(S, { enableWhen: C }, { sectionId: o }) : s(S, C);
1422
+ return u;
1423
+ }, [n]), N = k.useCallback(
1424
+ (u) => F.find((I) => I.id === u) || null,
1425
+ [F]
1426
+ ), T = k.useCallback(
1427
+ (u) => {
1428
+ if (!O) return;
1429
+ const I = u && Array.isArray(u.conditions) ? { logic: u.logic || "AND", conditions: u.conditions } : void 0;
1430
+ C && c ? l(O, { enableWhen: I }, { sectionId: c }) : a(O, I);
1354
1431
  },
1355
- [S, T, o, s, i]
1356
- ), O = E.useMemo(() => k != null && k.enableWhen && Array.isArray(k.enableWhen.conditions) ? { logic: k.enableWhen.logic || "AND", conditions: k.enableWhen.conditions } : { logic: "AND", conditions: [] }, [k]), he = E.useCallback(() => {
1357
- const d = {
1358
- logic: O.logic || "AND",
1432
+ [O, C, c, a, l]
1433
+ ), R = k.useMemo(() => h != null && h.enableWhen && Array.isArray(h.enableWhen.conditions) ? { logic: h.enableWhen.logic || "AND", conditions: h.enableWhen.conditions } : { logic: "AND", conditions: [] }, [h]), A = k.useCallback(() => {
1434
+ const u = {
1435
+ logic: R.logic || "AND",
1359
1436
  conditions: [
1360
- ...Array.isArray(O.conditions) ? O.conditions : [],
1437
+ ...Array.isArray(R.conditions) ? R.conditions : [],
1361
1438
  { targetId: "", operator: "equals", value: "" }
1362
1439
  ]
1363
1440
  };
1364
- F(d);
1365
- }, [O, F]), ve = E.useCallback(() => F(null), [F]), ge = E.useCallback(
1366
- (d) => {
1367
- const I = (Array.isArray(O.conditions) ? O.conditions : []).filter((Y, A) => A !== d);
1368
- F({ ...O, conditions: I });
1441
+ T(u);
1442
+ }, [R, T]), X = k.useCallback(() => T(null), [T]), ae = k.useCallback(
1443
+ (u) => {
1444
+ const D = (Array.isArray(R.conditions) ? R.conditions : []).filter((B, P) => P !== u);
1445
+ T({ ...R, conditions: D });
1369
1446
  },
1370
- [O, F]
1371
- ), X = E.useCallback(
1372
- (d, C) => {
1373
- const Y = [...Array.isArray(O.conditions) ? O.conditions : []], U = { ...Y[d] || { targetId: "", operator: "equals", value: "" }, ...C };
1374
- if ("targetId" in C) {
1375
- const y = _(U.targetId), z = Qe(y == null ? void 0 : y.fieldType);
1376
- z.includes(U.operator) || (U.operator = z[0] || "equals");
1377
- const ne = Array.isArray(y == null ? void 0 : y.options) ? y.options.map(Ze) : [];
1378
- ne.length > 0 && (new Set(ne.map((je) => je.id)).has(U.value) || (U.value = ""));
1447
+ [R, T]
1448
+ ), G = k.useCallback(
1449
+ (u, I) => {
1450
+ const B = [...Array.isArray(R.conditions) ? R.conditions : []], V = { ...B[u] || { targetId: "", operator: "equals", value: "" }, ...I };
1451
+ if ("targetId" in I) {
1452
+ const y = N(V.targetId), H = Xe(y == null ? void 0 : y.fieldType);
1453
+ H.includes(V.operator) || (V.operator = H[0] || "equals");
1454
+ const ie = Array.isArray(y == null ? void 0 : y.options) ? y.options.map(Qe) : [];
1455
+ ie.length > 0 && (new Set(ie.map((je) => je.id)).has(V.value) || (V.value = ""));
1379
1456
  }
1380
- Y[d] = U, F({ ...O, conditions: Y });
1457
+ B[u] = V, T({ ...R, conditions: B });
1381
1458
  },
1382
- [O, _, F]
1383
- ), oe = E.useMemo(
1384
- () => L.filter((d) => d.id !== S),
1385
- [L, S]
1386
- ), J = !k || !S;
1459
+ [R, N, T]
1460
+ ), K = k.useMemo(
1461
+ () => F.filter((u) => u.id !== O),
1462
+ [F, O]
1463
+ ), W = !h || !O;
1387
1464
  return /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
1388
- c && /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
1465
+ o && /* @__PURE__ */ r.jsxs("div", { className: "flex gap-2 items-center", children: [
1389
1466
  /* @__PURE__ */ r.jsx("label", { className: "text-sm", children: "Target:" }),
1390
1467
  /* @__PURE__ */ r.jsxs(
1391
1468
  "select",
1392
1469
  {
1393
1470
  className: "border p-1 rounded",
1394
- value: p,
1395
- onChange: (d) => h(d.target.value),
1471
+ value: b,
1472
+ onChange: (u) => x(u.target.value),
1396
1473
  children: [
1397
1474
  /* @__PURE__ */ r.jsx("option", { value: "", children: "Section (this)" }),
1398
- f.map((d) => {
1399
- var C, I;
1400
- return /* @__PURE__ */ r.jsx("option", { value: `child:${d.id}`, children: ((C = d.question) == null ? void 0 : C.trim()) || ((I = d.title) == null ? void 0 : I.trim()) || d.id }, d.id);
1475
+ d.map((u) => {
1476
+ var I, D;
1477
+ return /* @__PURE__ */ r.jsx("option", { value: `child:${u.id}`, children: ((I = u.question) == null ? void 0 : I.trim()) || ((D = u.title) == null ? void 0 : D.trim()) || u.id }, u.id);
1401
1478
  })
1402
1479
  ]
1403
1480
  }
@@ -1408,30 +1485,30 @@ function tt() {
1408
1485
  /* @__PURE__ */ r.jsxs(
1409
1486
  "select",
1410
1487
  {
1411
- value: O.logic || "AND",
1412
- onChange: (d) => F({ ...O, logic: d.target.value }),
1488
+ value: R.logic || "AND",
1489
+ onChange: (u) => T({ ...R, logic: u.target.value }),
1413
1490
  className: "border p-1 rounded",
1414
- disabled: J,
1491
+ disabled: W,
1415
1492
  children: [
1416
1493
  /* @__PURE__ */ r.jsx("option", { value: "AND", children: "AND" }),
1417
1494
  /* @__PURE__ */ r.jsx("option", { value: "OR", children: "OR" })
1418
1495
  ]
1419
1496
  }
1420
1497
  ),
1421
- /* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: he, disabled: J, children: "+ Condition" }),
1422
- /* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: ve, disabled: J, children: "Clear" })
1498
+ /* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: A, disabled: W, children: "+ Condition" }),
1499
+ /* @__PURE__ */ r.jsx("button", { type: "button", className: "px-2 py-1 border rounded", onClick: X, disabled: W, children: "Clear" })
1423
1500
  ] }),
1424
- (Array.isArray(O.conditions) ? O.conditions : []).map((d, C) => {
1425
- const I = _(d.targetId), Y = Qe(I == null ? void 0 : I.fieldType), A = Array.isArray(I == null ? void 0 : I.options) ? I.options.map(Ze) : [], U = A.length > 0;
1501
+ (Array.isArray(R.conditions) ? R.conditions : []).map((u, I) => {
1502
+ const D = N(u.targetId), B = Xe(D == null ? void 0 : D.fieldType), P = Array.isArray(D == null ? void 0 : D.options) ? D.options.map(Qe) : [], V = P.length > 0;
1426
1503
  return /* @__PURE__ */ r.jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-7 gap-2 items-center opacity-100", children: [
1427
1504
  /* @__PURE__ */ r.jsx(
1428
1505
  "button",
1429
1506
  {
1430
1507
  type: "button",
1431
- onClick: () => ge(C),
1508
+ onClick: () => ae(I),
1432
1509
  className: "px-2 py-1 border rounded sm:col-span-1",
1433
1510
  title: "Remove condition",
1434
- disabled: J,
1511
+ disabled: W,
1435
1512
  children: "✕"
1436
1513
  }
1437
1514
  ),
@@ -1439,12 +1516,12 @@ function tt() {
1439
1516
  "select",
1440
1517
  {
1441
1518
  className: "border p-1 rounded sm:col-span-3",
1442
- value: d.targetId,
1443
- onChange: (y) => X(C, { targetId: y.target.value }),
1444
- disabled: J,
1519
+ value: u.targetId,
1520
+ onChange: (y) => G(I, { targetId: y.target.value }),
1521
+ disabled: W,
1445
1522
  children: [
1446
1523
  /* @__PURE__ */ r.jsx("option", { value: "", children: "— Select field —" }),
1447
- oe.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.label }, y.id))
1524
+ K.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.label }, y.id))
1448
1525
  ]
1449
1526
  }
1450
1527
  ),
@@ -1452,22 +1529,22 @@ function tt() {
1452
1529
  "select",
1453
1530
  {
1454
1531
  className: "border p-1 rounded sm:col-span-1",
1455
- value: d.operator,
1456
- onChange: (y) => X(C, { operator: y.target.value }),
1457
- disabled: J || !I,
1458
- children: (I ? Y : ["equals"]).map((y) => /* @__PURE__ */ r.jsx("option", { value: y, children: y }, y))
1532
+ value: u.operator,
1533
+ onChange: (y) => G(I, { operator: y.target.value }),
1534
+ disabled: W || !D,
1535
+ children: (D ? B : ["equals"]).map((y) => /* @__PURE__ */ r.jsx("option", { value: y, children: y }, y))
1459
1536
  }
1460
1537
  ),
1461
- U ? /* @__PURE__ */ r.jsxs(
1538
+ V ? /* @__PURE__ */ r.jsxs(
1462
1539
  "select",
1463
1540
  {
1464
1541
  className: "border p-1 rounded sm:col-span-2",
1465
- value: d.value,
1466
- onChange: (y) => X(C, { value: y.target.value }),
1467
- disabled: J || !I,
1542
+ value: u.value,
1543
+ onChange: (y) => G(I, { value: y.target.value }),
1544
+ disabled: W || !D,
1468
1545
  children: [
1469
1546
  /* @__PURE__ */ r.jsx("option", { value: "", children: "— Select option —" }),
1470
- A.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.value }, y.id))
1547
+ P.map((y) => /* @__PURE__ */ r.jsx("option", { value: y.id, children: y.value }, y.id))
1471
1548
  ]
1472
1549
  }
1473
1550
  ) : /* @__PURE__ */ r.jsx(
@@ -1475,31 +1552,31 @@ function tt() {
1475
1552
  {
1476
1553
  className: "border p-1 rounded sm:col-span-2",
1477
1554
  placeholder: "Enter value",
1478
- value: d.value,
1479
- onChange: (y) => X(C, { value: y.target.value }),
1480
- disabled: J || !I
1555
+ value: u.value,
1556
+ onChange: (y) => G(I, { value: y.target.value }),
1557
+ disabled: W || !D
1481
1558
  }
1482
1559
  )
1483
- ] }, C);
1560
+ ] }, I);
1484
1561
  })
1485
1562
  ] });
1486
1563
  }
1487
- function er() {
1488
- const t = H(), n = q(
1489
- E.useCallback(
1490
- (c) => t.selectedFieldId.value ? c.byId[t.selectedFieldId.value] : null,
1564
+ function Ze() {
1565
+ const t = ee(), n = Y(
1566
+ k.useCallback(
1567
+ (o) => t.selectedFieldId.value ? o.byId[t.selectedFieldId.value] : null,
1491
1568
  [t.selectedFieldId.value]
1492
1569
  )
1493
- ), [s, i] = E.useState("EDIT"), o = E.useCallback(
1494
- (c, f) => {
1495
- t.selectedChildId.set(c, f);
1570
+ ), [a, l] = k.useState("EDIT"), c = k.useCallback(
1571
+ (o, d) => {
1572
+ t.selectedChildId.set(o, d);
1496
1573
  },
1497
1574
  [t.selectedChildId.set]
1498
1575
  );
1499
- if (E.useEffect(() => {
1500
- t.selectedChildId.set(null, null), i("EDIT");
1576
+ if (k.useEffect(() => {
1577
+ t.selectedChildId.set(null, null), l("EDIT");
1501
1578
  }, [t.selectedFieldId.value]), t.state.isPreview) return null;
1502
- const u = !n, b = (n == null ? void 0 : n.fieldType) === "section";
1579
+ const f = !n, m = (n == null ? void 0 : n.fieldType) === "section";
1503
1580
  return /* @__PURE__ */ r.jsxs(
1504
1581
  "div",
1505
1582
  {
@@ -1516,9 +1593,9 @@ function er() {
1516
1593
  "button",
1517
1594
  {
1518
1595
  type: "button",
1519
- onClick: () => i("EDIT"),
1520
- "aria-selected": s === "EDIT",
1521
- className: `px-3 py-1 text-sm ${s === "EDIT" ? "bg-gray-100 font-semibold" : "bg-white"}`,
1596
+ onClick: () => l("EDIT"),
1597
+ "aria-selected": a === "EDIT",
1598
+ className: `px-3 py-1 text-sm ${a === "EDIT" ? "bg-gray-100 font-semibold" : "bg-white"}`,
1522
1599
  children: "EDIT"
1523
1600
  }
1524
1601
  ),
@@ -1526,57 +1603,52 @@ function er() {
1526
1603
  "button",
1527
1604
  {
1528
1605
  type: "button",
1529
- onClick: () => i("LOGIC"),
1530
- "aria-selected": s === "LOGIC",
1531
- className: `px-3 py-1 text-sm border-l border-gray-200 ${s === "LOGIC" ? "bg-gray-100 font-semibold" : "bg-white"}`,
1606
+ onClick: () => l("LOGIC"),
1607
+ "aria-selected": a === "LOGIC",
1608
+ className: `px-3 py-1 text-sm border-l border-gray-200 ${a === "LOGIC" ? "bg-gray-100 font-semibold" : "bg-white"}`,
1532
1609
  children: "LOGIC"
1533
1610
  }
1534
1611
  )
1535
1612
  ]
1536
1613
  }
1537
1614
  ),
1538
- u && /* @__PURE__ */ r.jsxs("div", { className: "text-gray-600", children: [
1615
+ f && /* @__PURE__ */ r.jsxs("div", { className: "text-gray-600", children: [
1539
1616
  /* @__PURE__ */ r.jsx("h3", { className: "text-lg font-semibold mb-2", children: "Edit" }),
1540
1617
  /* @__PURE__ */ r.jsx("p", { children: "Select a field in the center panel to edit its properties." })
1541
1618
  ] }),
1542
- !u && s === "EDIT" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1543
- !b && /* @__PURE__ */ r.jsx(et, { f: n }),
1544
- b && /* @__PURE__ */ r.jsx(
1545
- rt,
1619
+ !f && a === "EDIT" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
1620
+ !m && /* @__PURE__ */ r.jsx(tt, { f: n }),
1621
+ m && /* @__PURE__ */ r.jsx(
1622
+ nt,
1546
1623
  {
1547
1624
  section: n,
1548
- onActiveChildChange: o
1625
+ onActiveChildChange: c
1549
1626
  }
1550
1627
  )
1551
1628
  ] }),
1552
- !u && s === "LOGIC" && /* @__PURE__ */ r.jsx(tt, {})
1629
+ !f && a === "LOGIC" && /* @__PURE__ */ r.jsx(st, {})
1553
1630
  ]
1554
1631
  }
1555
1632
  );
1556
1633
  }
1557
- function nt() {
1558
- const t = H(), n = Ie(), s = re(() => {
1559
- const o = [];
1560
- return (n || []).forEach((u) => {
1561
- o.push(u), (u == null ? void 0 : u.fieldType) === "section" && Array.isArray(u.fields) && o.push(...u.fields);
1562
- }), o;
1563
- }, [n]), i = re(() => (t.state.isPreview ? n.filter((u) => Lr(u, s)) : n).map((u) => u.id), [t.state.isPreview, n, s]);
1634
+ function at() {
1635
+ const t = ee(), { fields: n } = Mr(t.state.isPreview), a = Ur((c) => c.hideUnsupportedFields), l = ue(() => (a ? n.filter((f) => f.fieldType !== "unsupported") : n).map((f) => f.id), [n, a]);
1564
1636
  return /* @__PURE__ */ r.jsx(
1565
1637
  "div",
1566
1638
  {
1567
1639
  className: "w-full max-w-4xl mx-auto rounded-lg overflow-y-auto max-h-[calc(100svh-19rem)] lg:max-h-[calc(100dvh-15rem)] custom-scrollbar pr-2",
1568
1640
  onClick: () => !t.state.isPreview && t.selectedFieldId.clear(),
1569
- children: i.length === 0 ? /* @__PURE__ */ r.jsx(st, {}) : i.map((o) => /* @__PURE__ */ r.jsx(at, { id: o }, o))
1641
+ children: l.length === 0 ? /* @__PURE__ */ r.jsx(it, {}) : l.map((c) => /* @__PURE__ */ r.jsx(lt, { id: c }, c))
1570
1642
  }
1571
1643
  );
1572
1644
  }
1573
- const at = E.memo(function({ id: n }) {
1574
- const s = q(E.useCallback((o) => o.byId[n], [n]));
1575
- if (!s) return null;
1576
- const i = Mr(s.fieldType);
1577
- return i ? /* @__PURE__ */ r.jsx("div", { className: "mb-1.5", "data-field-type": s.fieldType, "data-field-id": s.id, children: /* @__PURE__ */ r.jsx(i, { field: s }) }) : null;
1645
+ const lt = k.memo(function({ id: n }) {
1646
+ const a = Y(k.useCallback((c) => c.byId[n], [n]));
1647
+ if (!a) return null;
1648
+ const l = Wr(a.fieldType);
1649
+ return l ? /* @__PURE__ */ r.jsx("div", { className: "mb-1.5", "data-field-type": a.fieldType, "data-field-id": a.id, children: /* @__PURE__ */ r.jsx(l, { field: a }) }) : null;
1578
1650
  });
1579
- function st() {
1651
+ function it() {
1580
1652
  return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col items-center justify-center h-72 bg-gradient-to-br from-gray-50 to-gray-100 border-2 border-dashed border-blue-200 rounded-xl shadow-md text-center px-8 py-10", children: [
1581
1653
  /* @__PURE__ */ r.jsx("div", { className: "text-xl font-semibold text-gray-700 mb-2", children: "Start building your questionnaire" }),
1582
1654
  /* @__PURE__ */ r.jsxs("div", { className: "text-base text-gray-500", children: [
@@ -1590,13 +1662,13 @@ function st() {
1590
1662
  ] })
1591
1663
  ] });
1592
1664
  }
1593
- function it({ selectedField: t }) {
1594
- const n = H(), s = n.state.isPreview, i = n.state.isEditModalOpen, o = n.state.panelResetKey, u = !s, b = u ? "lg:grid-cols-[280px_minmax(0,1fr)_320px]" : "lg:grid-cols-[minmax(0,1fr)]";
1595
- return /* @__PURE__ */ r.jsx("div", { className: "w-full max-w-6xl mx-auto px-4 h-fit rounded-lg mt-2", children: /* @__PURE__ */ r.jsxs("div", { className: `grid grid-cols-1 ${b} gap-3 h-full items-start`, children: [
1596
- u && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Gr, {}) }),
1597
- /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(nt, {}) }),
1598
- u && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(er, {}, o) }),
1599
- u && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: i && t && /* @__PURE__ */ r.jsx(
1665
+ function ot({ selectedField: t }) {
1666
+ const n = ee(), a = n.state.isPreview, l = n.state.isEditModalOpen, c = n.state.panelResetKey, f = !a, m = f ? "lg:grid-cols-[280px_minmax(0,1fr)_320px]" : "lg:grid-cols-[minmax(0,1fr)]";
1667
+ return /* @__PURE__ */ r.jsx("div", { className: "w-full max-w-6xl mx-auto px-4 h-fit rounded-lg mt-2", children: /* @__PURE__ */ r.jsxs("div", { className: `grid grid-cols-1 ${m} gap-3 h-full items-start`, children: [
1668
+ f && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Hr, {}) }),
1669
+ /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(at, {}) }),
1670
+ f && /* @__PURE__ */ r.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ r.jsx(Ze, {}, c) }),
1671
+ f && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: l && t && /* @__PURE__ */ r.jsx(
1600
1672
  "div",
1601
1673
  {
1602
1674
  className: "fixed inset-0 top-5 z-50 flex items-center justify-center bg-transparent/30 backdrop-blur-sm p-4",
@@ -1605,7 +1677,7 @@ function it({ selectedField: t }) {
1605
1677
  "div",
1606
1678
  {
1607
1679
  className: "w-full max-w-md mx-auto relative bg-white rounded-lg overflow-hidden",
1608
- onClick: (c) => c.stopPropagation(),
1680
+ onClick: (o) => o.stopPropagation(),
1609
1681
  children: [
1610
1682
  /* @__PURE__ */ r.jsx(
1611
1683
  "button",
@@ -1615,7 +1687,7 @@ function it({ selectedField: t }) {
1615
1687
  children: /* @__PURE__ */ r.jsx("span", { className: "text-3xl", children: "×" })
1616
1688
  }
1617
1689
  ),
1618
- /* @__PURE__ */ r.jsx(er, {}, o)
1690
+ /* @__PURE__ */ r.jsx(Ze, {}, c)
1619
1691
  ]
1620
1692
  }
1621
1693
  )
@@ -1623,34 +1695,37 @@ function it({ selectedField: t }) {
1623
1695
  ) })
1624
1696
  ] }) });
1625
1697
  }
1626
- function ut({
1698
+ function mt({
1627
1699
  initialFields: t,
1628
1700
  onChange: n,
1629
- className: s = "",
1630
- showHeader: i = !0,
1631
- showMobileToolbar: o = !0,
1632
- startInPreview: u = !1
1701
+ className: a = "",
1702
+ showHeader: l = !0,
1703
+ showMobileToolbar: c = !0,
1704
+ startInPreview: f = !1
1633
1705
  }) {
1634
- const b = H(), c = rr(!1);
1635
- ee(() => {
1636
- c.current || (Array.isArray(t) && t.length && q.getState().replaceAll(t), b.preview.set(!!u), c.current = !0);
1637
- }, [t, u, b.preview]), ee(() => n ? q.subscribe((m) => {
1638
- const p = m.flatArray ? m.flatArray() : Object.values(m.byId);
1639
- n(p);
1706
+ const m = ee(), o = er(!1);
1707
+ se(() => {
1708
+ o.current || (Array.isArray(t) && t.length && Y.getState().replaceAll(t), m.preview.set(!!f), o.current = !0);
1709
+ }, [t, f, m.preview]), se(() => n ? Y.subscribe((v) => {
1710
+ const b = [];
1711
+ v.order.forEach((x) => {
1712
+ const C = v.byId[x];
1713
+ C && (b.push(C), C.fieldType === "section" && Array.isArray(C.fields) && b.push(...C.fields));
1714
+ }), n(b);
1640
1715
  }) : void 0, [n]);
1641
- const f = q(
1642
- E.useCallback(
1643
- (g) => b.selectedFieldId.value ? g.byId[b.selectedFieldId.value] : null,
1644
- [b.selectedFieldId.value]
1716
+ const d = Y(
1717
+ k.useCallback(
1718
+ (w) => m.selectedFieldId.value ? w.byId[m.selectedFieldId.value] : null,
1719
+ [m.selectedFieldId.value]
1645
1720
  )
1646
1721
  );
1647
- return /* @__PURE__ */ r.jsxs("div", { className: `qb-editor-root min-h-screen bg-gray-100 font-titillium ${s}`, children: [
1648
- i && /* @__PURE__ */ r.jsx(Br, {}),
1649
- o && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ r.jsx(Jr, {}) }),
1650
- /* @__PURE__ */ r.jsx(it, { selectedField: f })
1722
+ return /* @__PURE__ */ r.jsxs("div", { className: `qb-editor-root min-h-screen bg-gray-100 font-titillium ${a}`, children: [
1723
+ l && /* @__PURE__ */ r.jsx(zr, {}),
1724
+ c && /* @__PURE__ */ r.jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ r.jsx(Gr, {}) }),
1725
+ /* @__PURE__ */ r.jsx(ot, { selectedField: d })
1651
1726
  ] });
1652
1727
  }
1653
1728
  export {
1654
- ut as QuestionnaireEditor
1729
+ mt as QuestionnaireEditor
1655
1730
  };
1656
1731
  //# sourceMappingURL=index.js.map