@chaibuilder/sdk 2.1.0 → 2.1.2

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/core.js CHANGED
@@ -105,7 +105,7 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
105
105
  return D || (D = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, a.set(E, D), g == null || g(E, B)), D;
106
106
  }), v = y[1] || (() => {
107
107
  let E, D;
108
- const j = (_) => {
108
+ const T = (_) => {
109
109
  try {
110
110
  _();
111
111
  } catch (P) {
@@ -113,25 +113,25 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
113
113
  }
114
114
  };
115
115
  do {
116
- m.f && j(m.f);
116
+ m.f && T(m.f);
117
117
  const _ = /* @__PURE__ */ new Set(), P = _.add.bind(_);
118
118
  d.forEach((L) => {
119
119
  var R;
120
120
  return (R = l.get(L)) == null ? void 0 : R.l.forEach(P);
121
- }), d.clear(), p.forEach(P), p.clear(), u.forEach(P), u.clear(), _.forEach(j), d.size && k();
121
+ }), d.clear(), p.forEach(P), p.clear(), u.forEach(P), u.clear(), _.forEach(T), d.size && k();
122
122
  } while (d.size || p.size || u.size);
123
123
  if (E)
124
124
  throw D;
125
125
  }), k = y[2] || (() => {
126
- const E = [], D = /* @__PURE__ */ new WeakSet(), j = /* @__PURE__ */ new WeakSet(), _ = Array.from(d);
126
+ const E = [], D = /* @__PURE__ */ new WeakSet(), T = /* @__PURE__ */ new WeakSet(), _ = Array.from(d);
127
127
  for (; _.length; ) {
128
128
  const P = _[_.length - 1], L = b(P);
129
- if (j.has(P)) {
129
+ if (T.has(P)) {
130
130
  _.pop();
131
131
  continue;
132
132
  }
133
133
  if (D.has(P)) {
134
- c.get(P) === L.n && E.push([P, L]), j.add(P), _.pop();
134
+ c.get(P) === L.n && E.push([P, L]), T.add(P), _.pop();
135
135
  continue;
136
136
  }
137
137
  D.add(P);
@@ -149,7 +149,7 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
149
149
  M && (S(L), w(L)), c.delete(L);
150
150
  }
151
151
  }), S = y[3] || ((E) => {
152
- var D, j;
152
+ var D, T;
153
153
  const _ = b(E);
154
154
  if (isAtomStateInitialized(_) && (l.has(E) && c.get(E) !== _.n || Array.from(_.d).every(
155
155
  ([$, F]) => (
@@ -206,19 +206,19 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
206
206
  } catch ($) {
207
207
  return delete _.v, _.e = $, ++_.n, _;
208
208
  } finally {
209
- P = !1, V !== _.n && c.get(E) === V && (c.set(E, _.n), d.add(E), (j = m.c) == null || j.call(m, E));
209
+ P = !1, V !== _.n && c.get(E) === V && (c.set(E, _.n), d.add(E), (T = m.c) == null || T.call(m, E));
210
210
  }
211
211
  }), C = y[4] || ((E) => {
212
212
  const D = [E];
213
213
  for (; D.length; ) {
214
- const j = D.pop(), _ = b(j);
215
- for (const P of getMountedOrPendingDependents(j, _, l)) {
214
+ const T = D.pop(), _ = b(T);
215
+ for (const P of getMountedOrPendingDependents(T, _, l)) {
216
216
  const L = b(P);
217
217
  c.set(P, L.n), D.push(P);
218
218
  }
219
219
  }
220
220
  }), A = y[5] || ((E, ...D) => {
221
- let j = !0;
221
+ let T = !0;
222
222
  const _ = (L) => returnAtomValue(S(L)), P = (L, ...R) => {
223
223
  var M;
224
224
  const O = b(L);
@@ -232,41 +232,41 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
232
232
  } else
233
233
  return A(L, ...R);
234
234
  } finally {
235
- j || (k(), v());
235
+ T || (k(), v());
236
236
  }
237
237
  };
238
238
  try {
239
239
  return f(E, _, P, ...D);
240
240
  } finally {
241
- j = !1;
241
+ T = !1;
242
242
  }
243
243
  }), w = y[6] || ((E) => {
244
244
  var D;
245
- const j = b(E), _ = l.get(E);
246
- if (_ && !isPendingPromise(j.v)) {
247
- for (const [P, L] of j.d)
245
+ const T = b(E), _ = l.get(E);
246
+ if (_ && !isPendingPromise(T.v)) {
247
+ for (const [P, L] of T.d)
248
248
  if (!_.d.has(P)) {
249
249
  const R = b(P);
250
250
  I(P).t.add(E), _.d.add(P), L !== R.n && (d.add(P), (D = m.c) == null || D.call(m, P), C(P));
251
251
  }
252
252
  for (const P of _.d || [])
253
- if (!j.d.has(P)) {
253
+ if (!T.d.has(P)) {
254
254
  _.d.delete(P);
255
- const L = T(P);
255
+ const L = N(P);
256
256
  L == null || L.t.delete(E);
257
257
  }
258
258
  }
259
259
  }), I = y[7] || ((E) => {
260
260
  var D;
261
- const j = b(E);
261
+ const T = b(E);
262
262
  let _ = l.get(E);
263
263
  if (!_) {
264
264
  S(E);
265
- for (const P of j.d.keys())
265
+ for (const P of T.d.keys())
266
266
  I(P).t.add(E);
267
267
  if (_ = {
268
268
  l: /* @__PURE__ */ new Set(),
269
- d: new Set(j.d.keys()),
269
+ d: new Set(T.d.keys()),
270
270
  t: /* @__PURE__ */ new Set()
271
271
  }, l.set(E, _), (D = m.m) == null || D.call(m, E), isActuallyWritableAtom(E)) {
272
272
  const P = () => {
@@ -296,23 +296,23 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
296
296
  }
297
297
  }
298
298
  return _;
299
- }), T = y[8] || ((E) => {
299
+ }), N = y[8] || ((E) => {
300
300
  var D;
301
- const j = b(E);
301
+ const T = b(E);
302
302
  let _ = l.get(E);
303
303
  if (_ && !_.l.size && !Array.from(_.t).some((P) => {
304
304
  var L;
305
305
  return (L = l.get(P)) == null ? void 0 : L.d.has(E);
306
306
  })) {
307
307
  _.u && p.add(_.u), _ = void 0, l.delete(E), (D = m.u) == null || D.call(m, E);
308
- for (const P of j.d.keys()) {
309
- const L = T(P);
308
+ for (const P of T.d.keys()) {
309
+ const L = N(P);
310
310
  L == null || L.t.delete(E);
311
311
  }
312
312
  return;
313
313
  }
314
314
  return _;
315
- }), N = [
315
+ }), j = [
316
316
  // store state
317
317
  a,
318
318
  l,
@@ -335,7 +335,7 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
335
335
  A,
336
336
  w,
337
337
  I,
338
- T
338
+ N
339
339
  ], B = {
340
340
  get: (E) => returnAtomValue(S(E)),
341
341
  set: (E, ...D) => {
@@ -348,11 +348,11 @@ const isSelfAtom = (a, l) => a.unstable_is ? a.unstable_is(l) : l === a, hasInit
348
348
  sub: (E, D) => {
349
349
  const _ = I(E).l;
350
350
  return _.add(D), v(), () => {
351
- _.delete(D), T(E), v();
351
+ _.delete(D), N(E), v();
352
352
  };
353
353
  }
354
354
  };
355
- return Object.defineProperty(B, BUILDING_BLOCKS, { value: N }), B;
355
+ return Object.defineProperty(B, BUILDING_BLOCKS, { value: j }), B;
356
356
  }, INTERNAL_buildStoreRev1 = buildStore;
357
357
  let keyCount = 0;
358
358
  function atom(a, l) {
@@ -397,22 +397,22 @@ function splitAtom(a, l) {
397
397
  return;
398
398
  }
399
399
  const C = (w) => {
400
- const I = w(u), T = w(a), B = d(T, I == null ? void 0 : I.arr).keyList.indexOf(k);
401
- if (B < 0 || B >= T.length) {
400
+ const I = w(u), N = w(a), B = d(N, I == null ? void 0 : I.arr).keyList.indexOf(k);
401
+ if (B < 0 || B >= N.length) {
402
402
  const E = m[d(m).keyList.indexOf(k)];
403
403
  if (E)
404
404
  return E;
405
405
  throw new Error("splitAtom: index out of bounds for read");
406
406
  }
407
- return T[B];
408
- }, A = (w, I, T) => {
409
- const N = w(u), B = w(a), D = d(B, N == null ? void 0 : N.arr).keyList.indexOf(k);
407
+ return N[B];
408
+ }, A = (w, I, N) => {
409
+ const j = w(u), B = w(a), D = d(B, j == null ? void 0 : j.arr).keyList.indexOf(k);
410
410
  if (D < 0 || D >= B.length)
411
411
  throw new Error("splitAtom: index out of bounds for write");
412
- const j = isFunction(T) ? T(B[D]) : T;
413
- Object.is(B[D], j) || I(a, [
412
+ const T = isFunction(N) ? N(B[D]) : N;
413
+ Object.is(B[D], T) || I(a, [
414
414
  ...B.slice(0, D),
415
- j,
415
+ T,
416
416
  ...B.slice(D + 1)
417
417
  ]);
418
418
  };
@@ -1399,12 +1399,12 @@ const useUndoManager = () => {
1399
1399
  return {
1400
1400
  moveBlocks: (k, S, C) => {
1401
1401
  const A = map(k, (I) => {
1402
- const N = l.find((D) => D._id === I)._parent || null, E = l.filter((D) => N ? D._parent === N : !D._parent).map((D) => D._id).indexOf(I);
1403
- return { _id: I, oldParent: N, oldPosition: E };
1402
+ const j = l.find((D) => D._id === I)._parent || null, E = l.filter((D) => j ? D._parent === j : !D._parent).map((D) => D._id).indexOf(I);
1403
+ return { _id: I, oldParent: j, oldPosition: E };
1404
1404
  }), w = A.find(({ _id: I }) => I === k[0]);
1405
1405
  w && w.oldParent === S && w.oldPosition === C || (p(k, S, C), a({
1406
- undo: () => each(A, ({ _id: I, oldParent: T, oldPosition: N }) => {
1407
- p([I], T, N);
1406
+ undo: () => each(A, ({ _id: I, oldParent: N, oldPosition: j }) => {
1407
+ p([I], N, j);
1408
1408
  }),
1409
1409
  redo: () => p(k, S, C)
1410
1410
  }));
@@ -1430,8 +1430,8 @@ const useUndoManager = () => {
1430
1430
  else {
1431
1431
  const w = keys(S);
1432
1432
  A = map(k, (I) => {
1433
- const T = l.find((B) => B._id === I), N = { _id: I };
1434
- return each(w, (B) => N[B] = T[B]), N;
1433
+ const N = l.find((B) => B._id === I), j = { _id: I };
1434
+ return each(w, (B) => j[B] = N[B]), j;
1435
1435
  });
1436
1436
  }
1437
1437
  m(map(k, (w) => ({ _id: w, ...S }))), a({
@@ -1451,8 +1451,8 @@ const useUndoManager = () => {
1451
1451
  updateMultipleBlocksProps: (k) => {
1452
1452
  let S = [];
1453
1453
  S = map(k, (C) => {
1454
- const A = keys(C), w = l.find((T) => T._id === C._id), I = {};
1455
- return each(A, (T) => I[T] = w[T]), I;
1454
+ const A = keys(C), w = l.find((N) => N._id === C._id), I = {};
1455
+ return each(A, (N) => I[N] = w[N]), I;
1456
1456
  }), m(k), a({
1457
1457
  undo: () => m(S),
1458
1458
  redo: () => m(k)
@@ -2999,18 +2999,18 @@ const getBlockWithChildren = (a, l) => {
2999
2999
  if (u) {
3000
3000
  l(!0), d(null);
3001
3001
  try {
3002
- const C = f === g ? "" : f, A = b === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(v, h)), f) : [y(v, h)], w = await u(b, addLangToPrompt(k, x, b), A, C), { blocks: I, error: T } = w;
3003
- if (T) {
3004
- d(T);
3002
+ const C = f === g ? "" : f, A = b === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(v, h)), f) : [y(v, h)], w = await u(b, addLangToPrompt(k, x, b), A, C), { blocks: I, error: N } = w;
3003
+ if (N) {
3004
+ d(N);
3005
3005
  return;
3006
3006
  }
3007
3007
  if (b === "styles") {
3008
- const N = I.map((B) => {
3008
+ const j = I.map((B) => {
3009
3009
  for (const E in B)
3010
3010
  E !== "_id" && (B[E] = `${STYLES_KEY},${B[E]}`);
3011
3011
  return B;
3012
3012
  });
3013
- m(N);
3013
+ m(j);
3014
3014
  } else
3015
3015
  p(I);
3016
3016
  S && S(w);
@@ -3665,8 +3665,8 @@ const useDnd = () => {
3665
3665
  b.preventDefault(), b.stopPropagation(), throttledDragOver(b);
3666
3666
  },
3667
3667
  onDrop: (b) => {
3668
- var T;
3669
- const v = dropTarget, S = getOrientation(v) === "vertical" ? b.clientY + ((T = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : T.scrollY) : b.clientX;
3668
+ var N;
3669
+ const v = dropTarget, S = getOrientation(v) === "vertical" ? b.clientY + ((N = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : N.scrollY) : b.clientX;
3670
3670
  dropIndex = calculateDropIndex(S, possiblePositions);
3671
3671
  const C = h, A = v.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3672
3672
  if ((C == null ? void 0 : C._id) === A || !w) {
@@ -3851,7 +3851,7 @@ const useHandleCanvasDblClick = (a, l) => {
3851
3851
  heading: get(a, "fontFamily.heading"),
3852
3852
  body: get(a, "fontFamily.body")
3853
3853
  };
3854
- return v.filter((T) => T.family === w || T.family === I);
3854
+ return v.filter((N) => N.family === w || N.family === I);
3855
3855
  }, [a == null ? void 0 : a.fontFamily, v]), C = useMemo(() => getThemeFontsLinkMarkup(filter(S, (w) => has(w, "url"))), [S]), A = useMemo(
3856
3856
  () => getThemeCustomFontFace(filter(S, (w) => has(w, "src"))),
3857
3857
  [S]
@@ -4016,37 +4016,37 @@ const getBlockRuntimeProps = memoize((a) => {
4016
4016
  m();
4017
4017
  }, [l, a, c, m]), u;
4018
4018
  }, getElementByStyleId = (a, l) => a.querySelector(`[data-style-id="${l}"]`), StaticCanvas = () => {
4019
- const [a] = useAtom$1(networkModeAtom), [l] = useCanvasDisplayWidth(), [, c] = useSelectedBlockIds(), d = useSelectedBlock(), [, u] = useHighlightBlockId(), p = useRef(null), m = useRef(null), [h, f] = useState({ width: 0, height: 0 }), g = useCanvasScale(h), [x, y] = useState([]), [, b] = useState([]), [, v] = useAtom$1(canvasIframeAtom), [k, S] = useSelectedStylingBlocks(), C = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), w = (N) => {
4020
- f((B) => ({ ...B, width: N }));
4019
+ const [a] = useAtom$1(networkModeAtom), [l] = useCanvasDisplayWidth(), [, c] = useSelectedBlockIds(), d = useSelectedBlock(), [, u] = useHighlightBlockId(), p = useRef(null), m = useRef(null), [h, f] = useState({ width: 0, height: 0 }), g = useCanvasScale(h), [x, y] = useState([]), [, b] = useState([]), [, v] = useAtom$1(canvasIframeAtom), [k, S] = useSelectedStylingBlocks(), C = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), w = (j) => {
4020
+ f((B) => ({ ...B, width: j }));
4021
4021
  };
4022
4022
  useEffect(() => {
4023
4023
  if (!m.current) return;
4024
- const { clientWidth: N, clientHeight: B } = m.current;
4025
- f({ width: N, height: B });
4024
+ const { clientWidth: j, clientHeight: B } = m.current;
4025
+ f({ width: j, height: B });
4026
4026
  }, [m, l]);
4027
- const I = (N, B = 0) => {
4028
- const { top: E } = N.getBoundingClientRect();
4027
+ const I = (j, B = 0) => {
4028
+ const { top: E } = j.getBoundingClientRect();
4029
4029
  return E + B >= 0 && E - B <= window.innerHeight;
4030
4030
  };
4031
4031
  useEffect(() => {
4032
- var N, B;
4032
+ var j, B;
4033
4033
  if (d && d.type !== "Multiple" && p.current) {
4034
4034
  const E = getElementByDataBlockId(p.current.contentDocument, d._id);
4035
- E && (I(E) || (B = (N = p.current) == null ? void 0 : N.contentWindow) == null || B.scrollTo({ top: E.offsetTop, behavior: "smooth" }), y([E]));
4035
+ E && (I(E) || (B = (j = p.current) == null ? void 0 : j.contentWindow) == null || B.scrollTo({ top: E.offsetTop, behavior: "smooth" }), y([E]));
4036
4036
  }
4037
4037
  }, [d]), useEffect(() => {
4038
4038
  if (!isEmpty(k) && p.current) {
4039
- const N = getElementByStyleId(
4039
+ const j = getElementByStyleId(
4040
4040
  p.current.contentDocument,
4041
4041
  first(k).id
4042
4042
  );
4043
- b(N ? [N] : [null]);
4043
+ b(j ? [j] : [null]);
4044
4044
  } else
4045
4045
  b([null]);
4046
4046
  }, [k]);
4047
- const T = useMemo(() => {
4048
- let N = IframeInitialContent;
4049
- return N = N.replace("__HTML_DIR__", A), a === "offline" && (N = N.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), N;
4047
+ const N = useMemo(() => {
4048
+ let j = IframeInitialContent;
4049
+ return j = j.replace("__HTML_DIR__", A), a === "offline" && (j = j.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), j;
4050
4050
  }, [a, A]);
4051
4051
  return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsx(
4052
4052
  "div",
@@ -4065,7 +4065,7 @@ const getBlockRuntimeProps = memoize((a) => {
4065
4065
  id: "canvas-iframe",
4066
4066
  style: { ...g, ...isEmpty(g) ? { width: `${l}px` } : {} },
4067
4067
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
4068
- initialContent: T,
4068
+ initialContent: N,
4069
4069
  children: [
4070
4070
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
4071
4071
  /* @__PURE__ */ jsx(
@@ -4569,10 +4569,10 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
4569
4569
  g.chain().deleteSelection().insertContent(b).run();
4570
4570
  else {
4571
4571
  const { state: C } = g, A = C.selection.from, w = C.doc.textBetween(Math.max(0, A - 1), A), I = C.doc.textBetween(A, Math.min(A + 1, C.doc.content.size));
4572
- let T = "";
4573
- A > 0 && w !== " " && !/[.,!?;:]/.test(w) && (T = " ");
4574
4572
  let N = "";
4575
- I && I !== " " && !/[.,!?;:]/.test(I) && (N = " "), g.chain().insertContent(T + b + N).run();
4573
+ A > 0 && w !== " " && !/[.,!?;:]/.test(w) && (N = " ");
4574
+ let j = "";
4575
+ I && I !== " " && !/[.,!?;:]/.test(I) && (j = " "), g.chain().insertContent(N + b + j).run();
4576
4576
  }
4577
4577
  };
4578
4578
  return /* @__PURE__ */ jsx(Dialog, { open: a, onOpenChange: (y) => !y && l(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
@@ -4654,68 +4654,68 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
4654
4654
  onChange: c
4655
4655
  }) => {
4656
4656
  var D;
4657
- const { t: d } = useTranslation(), u = useBuilderProp("searchPageTypeItems", (j, _) => []), [p, m] = useState(!1), [h, f] = useState(!1), [g, x] = useState("page"), [y, b] = useState(""), [v, k] = useState([]), [S, C] = useState(-1), A = useRef(null), w = (D = l == null ? void 0 : l.find((j) => j.key === g)) == null ? void 0 : D.name;
4657
+ const { t: d } = useTranslation(), u = useBuilderProp("searchPageTypeItems", (T, _) => []), [p, m] = useState(!1), [h, f] = useState(!1), [g, x] = useState("page"), [y, b] = useState(""), [v, k] = useState([]), [S, C] = useState(-1), A = useRef(null), w = (D = l == null ? void 0 : l.find((T) => T.key === g)) == null ? void 0 : D.name;
4658
4658
  useEffect(() => {
4659
4659
  if (b(""), k([]), C(-1), f(!1), !a || p || !startsWith(a, "pageType:")) return;
4660
- const j = split(a, ":"), _ = get(j, 1, "page") || "page";
4660
+ const T = split(a, ":"), _ = get(T, 1, "page") || "page";
4661
4661
  x(_), (async () => {
4662
- const P = await u(_, [get(j, 2, "page")]);
4662
+ const P = await u(_, [get(T, 2, "page")]);
4663
4663
  P && Array.isArray(P) && b(get(P, [0, "name"], ""));
4664
4664
  })();
4665
4665
  }, [a]);
4666
4666
  const I = useDebouncedCallback(
4667
- async (j) => {
4668
- if (isEmpty(j))
4667
+ async (T) => {
4668
+ if (isEmpty(T))
4669
4669
  k([]);
4670
4670
  else {
4671
- const _ = await u(g, j);
4671
+ const _ = await u(g, T);
4672
4672
  k(_);
4673
4673
  }
4674
4674
  m(!1), C(-1);
4675
4675
  },
4676
4676
  [g],
4677
4677
  300
4678
- ), T = (j) => {
4679
- const _ = ["pageType", g, j.id];
4680
- _[1] && (c(_.join(":")), b(j.name), f(!1), k([]), C(-1));
4681
- }, N = (j) => {
4682
- switch (j.key) {
4678
+ ), N = (T) => {
4679
+ const _ = ["pageType", g, T.id];
4680
+ _[1] && (c(_.join(":")), b(T.name), f(!1), k([]), C(-1));
4681
+ }, j = (T) => {
4682
+ switch (T.key) {
4683
4683
  case "ArrowDown":
4684
- j.preventDefault(), C((_) => _ < v.length - 1 ? _ + 1 : _);
4684
+ T.preventDefault(), C((_) => _ < v.length - 1 ? _ + 1 : _);
4685
4685
  break;
4686
4686
  case "ArrowUp":
4687
- j.preventDefault(), C((_) => _ > 0 ? _ - 1 : _);
4687
+ T.preventDefault(), C((_) => _ > 0 ? _ - 1 : _);
4688
4688
  break;
4689
4689
  case "Enter":
4690
- if (j.preventDefault(), v.length === 0) return;
4691
- S >= 0 && T(v[S]);
4690
+ if (T.preventDefault(), v.length === 0) return;
4691
+ S >= 0 && N(v[S]);
4692
4692
  break;
4693
4693
  case "Escape":
4694
- j.preventDefault(), B();
4694
+ T.preventDefault(), B();
4695
4695
  break;
4696
4696
  }
4697
4697
  };
4698
4698
  useEffect(() => {
4699
4699
  if (S >= 0 && A.current) {
4700
- const j = A.current.children[S];
4701
- j == null || j.scrollIntoView({ block: "nearest" });
4700
+ const T = A.current.children[S];
4701
+ T == null || T.scrollIntoView({ block: "nearest" });
4702
4702
  }
4703
4703
  }, [S]);
4704
4704
  const B = () => {
4705
4705
  b(""), k([]), C(-1), f(!1), c("");
4706
- }, E = (j) => {
4707
- b(j), f(!isEmpty(j)), m(!0), I(j);
4706
+ }, E = (T) => {
4707
+ b(T), f(!isEmpty(T)), m(!0), I(T);
4708
4708
  };
4709
4709
  return /* @__PURE__ */ jsxs("div", { children: [
4710
- /* @__PURE__ */ jsx("select", { name: "pageType", value: g, onChange: (j) => x(j.target.value), children: map(l, (j) => /* @__PURE__ */ jsx("option", { value: j.key, children: j.name }, j.key)) }),
4710
+ /* @__PURE__ */ jsx("select", { name: "pageType", value: g, onChange: (T) => x(T.target.value), children: map(l, (T) => /* @__PURE__ */ jsx("option", { value: T.key, children: T.name }, T.key)) }),
4711
4711
  g && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
4712
4712
  /* @__PURE__ */ jsx(
4713
4713
  "input",
4714
4714
  {
4715
4715
  type: "text",
4716
4716
  value: y,
4717
- onChange: (j) => E(j.target.value),
4718
- onKeyDown: N,
4717
+ onChange: (T) => E(T.target.value),
4718
+ onKeyDown: j,
4719
4719
  placeholder: d(`Search ${w ?? ""}`),
4720
4720
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4721
4721
  }
@@ -4730,22 +4730,22 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
4730
4730
  ' "',
4731
4731
  y,
4732
4732
  '"'
4733
- ] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(v == null ? void 0 : v.slice(0, 20), (j, _) => /* @__PURE__ */ jsxs(
4733
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(v == null ? void 0 : v.slice(0, 20), (T, _) => /* @__PURE__ */ jsxs(
4734
4734
  "li",
4735
4735
  {
4736
- onClick: () => T(j),
4737
- className: `cursor-pointer p-2 text-xs ${a != null && a.includes(j.id) ? "bg-blue-200" : _ === S ? "bg-gray-100" : "hover:bg-gray-100"}`,
4736
+ onClick: () => N(T),
4737
+ className: `cursor-pointer p-2 text-xs ${a != null && a.includes(T.id) ? "bg-blue-200" : _ === S ? "bg-gray-100" : "hover:bg-gray-100"}`,
4738
4738
  children: [
4739
- j.name,
4739
+ T.name,
4740
4740
  " ",
4741
- j.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
4741
+ T.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
4742
4742
  "( ",
4743
- j.slug,
4743
+ T.slug,
4744
4744
  " )"
4745
4745
  ] })
4746
4746
  ]
4747
4747
  },
4748
- j.id
4748
+ T.id
4749
4749
  )) }) })
4750
4750
  ] });
4751
4751
  }, LinkField = ({ schema: a, formData: l, onChange: c }) => {
@@ -4965,7 +4965,7 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
4965
4965
  formData: x,
4966
4966
  onChange: y
4967
4967
  }) => {
4968
- const { selectedLang: b, fallbackLang: v, languages: k } = useLanguages(), S = isEmpty(k) ? "" : isEmpty(b) ? v : b, C = get(LANGUAGES, S, S), A = usePageExternalData(), w = useSelectedBlock(), I = useRegisteredChaiBlocks(), T = get(I, [w == null ? void 0 : w._type, "i18nProps"], []) || [], [N, B] = useState(null), E = useCallback(
4968
+ const { selectedLang: b, fallbackLang: v, languages: k } = useLanguages(), S = isEmpty(k) ? "" : isEmpty(b) ? v : b, C = get(LANGUAGES, S, S), A = usePageExternalData(), w = useSelectedBlock(), I = useRegisteredChaiBlocks(), N = get(I, [w == null ? void 0 : w._type, "i18nProps"], []) || [], [j, B] = useState(null), E = useCallback(
4969
4969
  (_) => {
4970
4970
  const P = (O) => /[.,!?;:]/.test(O), L = (O, Z, V) => {
4971
4971
  let $ = "", F = "";
@@ -5012,9 +5012,9 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
5012
5012
  if (h)
5013
5013
  return null;
5014
5014
  if (g.type === "boolean") return /* @__PURE__ */ jsx("div", { className: l, children: d });
5015
- const j = T == null ? void 0 : T.includes(a.replace("root.", ""));
5015
+ const T = N == null ? void 0 : N.includes(a.replace("root.", ""));
5016
5016
  if (g.type === "array") {
5017
- const _ = N === a;
5017
+ const _ = j === a;
5018
5018
  return /* @__PURE__ */ jsxs("div", { className: `${l} relative`, children: [
5019
5019
  g.title && /* @__PURE__ */ jsxs(
5020
5020
  "label",
@@ -5044,7 +5044,7 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
5044
5044
  /* @__PURE__ */ jsxs("label", { htmlFor: a, className: g.type === "object" ? "pb-2" : "", children: [
5045
5045
  c,
5046
5046
  " ",
5047
- j && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5047
+ T && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5048
5048
  " ",
5049
5049
  C
5050
5050
  ] }),
@@ -5149,27 +5149,27 @@ const MenuBar = ({ editor: a, onExpand: l }) => {
5149
5149
  }), d;
5150
5150
  };
5151
5151
  function BlockSettings() {
5152
- const { selectedLang: a } = useLanguages(), l = useSelectedBlock(), c = useUpdateBlocksPropsRealtime(), d = useUpdateBlocksProps(), u = getRegisteredChaiBlock(l == null ? void 0 : l._type), p = formDataWithSelectedLang(l, a, u), [m, h] = useState(p), [f, g] = useState(!1), x = useWrapperBlock(), y = getRegisteredChaiBlock(x == null ? void 0 : x._type), b = formDataWithSelectedLang(x, a, y), v = ({ formData: N }, B, E) => {
5153
- B && (m == null ? void 0 : m._id) === l._id && d([l._id], { [B]: get(N, B) }, E);
5152
+ const { selectedLang: a } = useLanguages(), l = useSelectedBlock(), c = useUpdateBlocksPropsRealtime(), d = useUpdateBlocksProps(), u = getRegisteredChaiBlock(l == null ? void 0 : l._type), p = formDataWithSelectedLang(l, a, u), [m, h] = useState(p), [f, g] = useState(!1), x = useWrapperBlock(), y = getRegisteredChaiBlock(x == null ? void 0 : x._type), b = formDataWithSelectedLang(x, a, y), v = ({ formData: j }, B, E) => {
5153
+ B && (m == null ? void 0 : m._id) === l._id && d([l._id], { [B]: get(j, B) }, E);
5154
5154
  }, k = useCallback(
5155
- debounce(({ formData: N }, B, E) => {
5156
- v({ formData: N }, B, E), h(N);
5155
+ debounce(({ formData: j }, B, E) => {
5156
+ v({ formData: j }, B, E), h(j);
5157
5157
  }, 1500),
5158
5158
  [l == null ? void 0 : l._id, a]
5159
- ), S = ({ formData: N }, B) => {
5160
- B && (c([l._id], { [B]: get(N, B) }), k({ formData: N }, B, { [B]: get(m, B) }));
5161
- }, C = ({ formData: N }, B) => {
5162
- B && (c([x._id], { [B]: get(N, B) }), k({ formData: N }, B, { [B]: get(m, B) }));
5159
+ ), S = ({ formData: j }, B) => {
5160
+ B && (c([l._id], { [B]: get(j, B) }), k({ formData: j }, B, { [B]: get(m, B) }));
5161
+ }, C = ({ formData: j }, B) => {
5162
+ B && (c([x._id], { [B]: get(j, B) }), k({ formData: j }, B, { [B]: get(m, B) }));
5163
5163
  };
5164
5164
  keys(get(p, "_bindings", {}));
5165
5165
  const { schema: A, uiSchema: w } = useMemo(() => {
5166
- const N = l == null ? void 0 : l._type;
5167
- if (N)
5168
- return getBlockFormSchemas(N);
5169
- }, [l]), { wrapperSchema: I, wrapperUiSchema: T } = useMemo(() => {
5166
+ const j = l == null ? void 0 : l._type;
5167
+ if (j)
5168
+ return getBlockFormSchemas(j);
5169
+ }, [l]), { wrapperSchema: I, wrapperUiSchema: N } = useMemo(() => {
5170
5170
  if (!x || !(x != null && x._type))
5171
5171
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5172
- const N = x == null ? void 0 : x._type, { schema: B = {}, uiSchema: E = {} } = getBlockFormSchemas(N);
5172
+ const j = x == null ? void 0 : x._type, { schema: B = {}, uiSchema: E = {} } = getBlockFormSchemas(j);
5173
5173
  return { wrapperSchema: B, wrapperUiSchema: E };
5174
5174
  }, [x]);
5175
5175
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
@@ -5177,7 +5177,7 @@ function BlockSettings() {
5177
5177
  /* @__PURE__ */ jsxs(
5178
5178
  "div",
5179
5179
  {
5180
- onClick: () => g((N) => !N),
5180
+ onClick: () => g((j) => !j),
5181
5181
  className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
5182
5182
  children: [
5183
5183
  f ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 stroke-[3] text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 stroke-[3] text-slate-400" }),
@@ -5199,7 +5199,7 @@ function BlockSettings() {
5199
5199
  onChange: C,
5200
5200
  formData: b,
5201
5201
  schema: I,
5202
- uiSchema: T
5202
+ uiSchema: N
5203
5203
  }
5204
5204
  ) })
5205
5205
  ] }),
@@ -5499,7 +5499,7 @@ function ManualClasses() {
5499
5499
  const a = useRef(null), [l, c] = useState(""), [d, u] = useState(-1), p = useFuseSearch(), { t: m } = useTranslation(), [h] = useSelectedStylingBlocks(), f = useSelectedBlock(), g = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [y] = useSelectedBlockIds(), b = useBuilderProp("askAiCallBack", null), [v, k] = useState(""), S = (L = first(h)) == null ? void 0 : L.prop, { classes: C } = getSplitChaiClasses(get(f, S, "")), A = C.split(" ").filter((R) => !isEmpty(R)), w = () => {
5500
5500
  const R = v.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5501
5501
  g(y, R, !0), k("");
5502
- }, [I, T] = useState([]), N = ({ value: R }) => {
5502
+ }, [I, N] = useState([]), j = ({ value: R }) => {
5503
5503
  const M = R.trim().toLowerCase(), O = M.match(/.+:/g);
5504
5504
  let Z = [];
5505
5505
  if (O && O.length > 0) {
@@ -5510,10 +5510,10 @@ function ManualClasses() {
5510
5510
  }));
5511
5511
  } else
5512
5512
  Z = p.search(M);
5513
- return T(map(Z, "item"));
5513
+ return N(map(Z, "item"));
5514
5514
  }, B = () => {
5515
- T([]);
5516
- }, E = (R) => R.name, D = (R) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: R.name }), j = useMemo(
5515
+ N([]);
5516
+ }, E = (R) => R.name, D = (R) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: R.name }), T = useMemo(
5517
5517
  () => ({
5518
5518
  ref: a,
5519
5519
  autoComplete: "off",
@@ -5562,11 +5562,11 @@ function ManualClasses() {
5562
5562
  Autosuggest,
5563
5563
  {
5564
5564
  suggestions: I,
5565
- onSuggestionsFetchRequested: N,
5565
+ onSuggestionsFetchRequested: j,
5566
5566
  onSuggestionsClearRequested: B,
5567
5567
  getSuggestionValue: E,
5568
5568
  renderSuggestion: D,
5569
- inputProps: j,
5569
+ inputProps: T,
5570
5570
  containerProps: {
5571
5571
  className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
5572
5572
  },
@@ -6248,17 +6248,17 @@ const COLOR_PROP = {
6248
6248
  },
6249
6249
  d
6250
6250
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (a) => {
6251
- const [l, c] = useState(!1), [d, u] = useState(""), { currentClass: p, onChange: m, classPrefix: h, cssProperty: f, units: g, negative: x } = a, [y, b] = useState(f != null && f.toLowerCase().includes("width") ? "%" : g[0]), [v, k] = useState(!1), [S, C] = useState(""), [A, w] = useState(!1), [I, T] = useState(!1);
6251
+ const [l, c] = useState(!1), [d, u] = useState(""), { currentClass: p, onChange: m, classPrefix: h, cssProperty: f, units: g, negative: x } = a, [y, b] = useState(f != null && f.toLowerCase().includes("width") ? "%" : g[0]), [v, k] = useState(!1), [S, C] = useState(""), [A, w] = useState(!1), [I, N] = useState(!1);
6252
6252
  useEffect(() => {
6253
- const { value: j, unit: _ } = getClassValueAndUnit(p);
6253
+ const { value: T, unit: _ } = getClassValueAndUnit(p);
6254
6254
  if (_ === "") {
6255
- u(j), b(f != null && f.toLowerCase().includes("width") ? "%" : first(g));
6255
+ u(T), b(f != null && f.toLowerCase().includes("width") ? "%" : first(g));
6256
6256
  return;
6257
6257
  }
6258
- b(_), u(_ === "class" || isEmpty(j) ? "" : j);
6258
+ b(_), u(_ === "class" || isEmpty(T) ? "" : T);
6259
6259
  }, [p, f, g]);
6260
- const N = useThrottledCallback((j) => m(j), [m], THROTTLE_TIME), B = useThrottledCallback((j) => m(j, !1), [m], THROTTLE_TIME), E = useCallback(
6261
- (j = !1) => {
6260
+ const j = useThrottledCallback((T) => m(T), [m], THROTTLE_TIME), B = useThrottledCallback((T) => m(T, !1), [m], THROTTLE_TIME), E = useCallback(
6261
+ (T = !1) => {
6262
6262
  const _ = getUserInputValues(`${d}`, g);
6263
6263
  if (get(_, "error", !1)) {
6264
6264
  k(!0);
@@ -6266,32 +6266,32 @@ const COLOR_PROP = {
6266
6266
  }
6267
6267
  const P = get(_, "unit") !== "" ? get(_, "unit") : y;
6268
6268
  if (P === "auto" || P === "none") {
6269
- N(`${h}${P}`);
6269
+ j(`${h}${P}`);
6270
6270
  return;
6271
6271
  }
6272
6272
  if (get(_, "value") === "")
6273
6273
  return;
6274
6274
  const R = `${get(_, "value", "").startsWith("-") ? "-" : ""}${h}[${get(_, "value", "").replace("-", "")}${P === "-" ? "" : P}]`;
6275
- j ? B(R) : N(R);
6275
+ T ? B(R) : j(R);
6276
6276
  },
6277
- [N, B, d, y, h, g]
6277
+ [j, B, d, y, h, g]
6278
6278
  ), D = useCallback(
6279
- (j) => {
6279
+ (T) => {
6280
6280
  const _ = getUserInputValues(`${d}`, g);
6281
6281
  if (get(_, "error", !1)) {
6282
6282
  k(!0);
6283
6283
  return;
6284
6284
  }
6285
- if (j === "auto" || j === "none") {
6286
- N(`${h}${j}`);
6285
+ if (T === "auto" || T === "none") {
6286
+ j(`${h}${T}`);
6287
6287
  return;
6288
6288
  }
6289
6289
  if (get(_, "value") === "")
6290
6290
  return;
6291
- const P = get(_, "unit") !== "" ? get(_, "unit") : j, R = `${get(_, "value", "").startsWith("-") ? "-" : ""}${h}[${get(_, "value", "").replace("-", "")}${P === "-" ? "" : P}]`;
6292
- N(R);
6291
+ const P = get(_, "unit") !== "" ? get(_, "unit") : T, R = `${get(_, "value", "").startsWith("-") ? "-" : ""}${h}[${get(_, "value", "").replace("-", "")}${P === "-" ? "" : P}]`;
6292
+ j(R);
6293
6293
  },
6294
- [N, d, h, g]
6294
+ [j, d, h, g]
6295
6295
  );
6296
6296
  return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: y === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
6297
6297
  /* @__PURE__ */ jsx(
@@ -6312,29 +6312,29 @@ const COLOR_PROP = {
6312
6312
  "input",
6313
6313
  {
6314
6314
  readOnly: y === "class",
6315
- onKeyPress: (j) => {
6316
- j.key === "Enter" && E();
6315
+ onKeyPress: (T) => {
6316
+ T.key === "Enter" && E();
6317
6317
  },
6318
- onKeyDown: (j) => {
6319
- if (j.keyCode !== 38 && j.keyCode !== 40)
6318
+ onKeyDown: (T) => {
6319
+ if (T.keyCode !== 38 && T.keyCode !== 40)
6320
6320
  return;
6321
- j.preventDefault(), T(!0);
6322
- const _ = parseInt$1(j.target.value);
6321
+ T.preventDefault(), N(!0);
6322
+ const _ = parseInt$1(T.target.value);
6323
6323
  let P = isNaN$1(_) ? 0 : _;
6324
- j.keyCode === 38 && (P += 1), j.keyCode === 40 && (P -= 1);
6324
+ T.keyCode === 38 && (P += 1), T.keyCode === 40 && (P -= 1);
6325
6325
  const L = `${P}`, M = `${L.startsWith("-") ? "-" : ""}${h}[${L.replace("-", "")}${y === "-" ? "" : y}]`;
6326
6326
  B(M);
6327
6327
  },
6328
- onKeyUp: (j) => {
6329
- I && (j.preventDefault(), T(!1));
6328
+ onKeyUp: (T) => {
6329
+ I && (T.preventDefault(), N(!1));
6330
6330
  },
6331
6331
  onBlur: () => E(),
6332
- onChange: (j) => {
6333
- k(!1), u(j.target.value);
6332
+ onChange: (T) => {
6333
+ k(!1), u(T.target.value);
6334
6334
  },
6335
- onClick: (j) => {
6335
+ onClick: (T) => {
6336
6336
  var _;
6337
- (_ = j == null ? void 0 : j.target) == null || _.select(), c(!1);
6337
+ (_ = T == null ? void 0 : T.target) == null || _.select(), c(!1);
6338
6338
  },
6339
6339
  value: A ? S : d,
6340
6340
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
@@ -6361,8 +6361,8 @@ const COLOR_PROP = {
6361
6361
  {
6362
6362
  units: g,
6363
6363
  current: y,
6364
- onSelect: (j) => {
6365
- c(!1), b(j), D(j);
6364
+ onSelect: (T) => {
6365
+ c(!1), b(T), D(T);
6366
6366
  }
6367
6367
  }
6368
6368
  ) }) })
@@ -6372,17 +6372,17 @@ const COLOR_PROP = {
6372
6372
  DragStyleButton,
6373
6373
  {
6374
6374
  onDragStart: () => w(!0),
6375
- onDragEnd: (j) => {
6376
- if (C(() => ""), w(!1), isEmpty(j))
6375
+ onDragEnd: (T) => {
6376
+ if (C(() => ""), w(!1), isEmpty(T))
6377
6377
  return;
6378
- const _ = `${j}`, L = `${_.startsWith("-") ? "-" : ""}${h}[${_.replace("-", "")}${y === "-" ? "" : y}]`;
6379
- N(L);
6378
+ const _ = `${T}`, L = `${_.startsWith("-") ? "-" : ""}${h}[${_.replace("-", "")}${y === "-" ? "" : y}]`;
6379
+ j(L);
6380
6380
  },
6381
- onDrag: (j) => {
6382
- if (isEmpty(j))
6381
+ onDrag: (T) => {
6382
+ if (isEmpty(T))
6383
6383
  return;
6384
- C(j);
6385
- const _ = `${j}`, L = `${_.startsWith("-") ? "-" : ""}${h}[${_.replace("-", "")}${y === "-" ? "" : y}]`;
6384
+ C(T);
6385
+ const _ = `${T}`, L = `${_.startsWith("-") ? "-" : ""}${h}[${_.replace("-", "")}${y === "-" ? "" : y}]`;
6386
6386
  B(L);
6387
6387
  },
6388
6388
  currentValue: d,
@@ -6484,8 +6484,8 @@ const COLOR_PROP = {
6484
6484
  (B, E = !0) => {
6485
6485
  const D = { dark: f, mq: x, mod: g, cls: B, property: u, fullCls: "" };
6486
6486
  (f || g !== "") && (D.mq = "xs");
6487
- const j = generateFullClsName(D);
6488
- b(k, [j], E);
6487
+ const T = generateFullClsName(D);
6488
+ b(k, [T], E);
6489
6489
  },
6490
6490
  [k, f, x, g, u, b]
6491
6491
  ), A = useCallback(() => {
@@ -6494,7 +6494,7 @@ const COLOR_PROP = {
6494
6494
  useEffect(() => {
6495
6495
  p(w, y);
6496
6496
  }, [w, p, y]);
6497
- const [, , I] = useScreenSizeWidth(), T = useCallback(
6497
+ const [, , I] = useScreenSizeWidth(), N = useCallback(
6498
6498
  (B) => {
6499
6499
  I({
6500
6500
  xs: 400,
@@ -6506,9 +6506,9 @@ const COLOR_PROP = {
6506
6506
  }[B]);
6507
6507
  },
6508
6508
  [I]
6509
- ), N = get(y, "dark", null) === f && get(y, "mod", null) === g && get(y, "mq", null) === x;
6510
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: w, canReset: y && N, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6511
- /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${y && !N ? "text-foreground" : ""}`, children: l(d) }) }),
6509
+ ), j = get(y, "dark", null) === f && get(y, "mod", null) === g && get(y, "mq", null) === x;
6510
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: w, canReset: y && j, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6511
+ /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${y && !j ? "text-foreground" : ""}`, children: l(d) }) }),
6512
6512
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
6513
6513
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
6514
6514
  c === "arbitrary" ? /* @__PURE__ */ jsx(
@@ -6527,7 +6527,7 @@ const COLOR_PROP = {
6527
6527
  c === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: u, onChange: C }),
6528
6528
  c === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: d, property: u, onChange: C })
6529
6529
  ] }),
6530
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${S ? "visible" : "invisible"}`, children: N ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && y ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6530
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${S ? "visible" : "invisible"}`, children: j ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && y ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6531
6531
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
6532
6532
  "button",
6533
6533
  {
@@ -6547,7 +6547,7 @@ const COLOR_PROP = {
6547
6547
  "button",
6548
6548
  {
6549
6549
  type: "button",
6550
- onClick: () => T(get(y, "mq")),
6550
+ onClick: () => N(get(y, "mq")),
6551
6551
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6552
6552
  children: [
6553
6553
  "Switch to ",
@@ -6960,7 +6960,7 @@ const ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (a, l) => {
6960
6960
  ...getAttrs(c),
6961
6961
  ...getStyles(c)
6962
6962
  }, c.attributes) {
6963
- const I = c.attributes.find((T) => includes(NAME_ATTRIBUTES, T.key));
6963
+ const I = c.attributes.find((N) => includes(NAME_ATTRIBUTES, N.key));
6964
6964
  I && (d._name = I.value);
6965
6965
  }
6966
6966
  if (p)
@@ -6978,29 +6978,29 @@ const ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (a, l) => {
6978
6978
  ];
6979
6979
  d = {
6980
6980
  ...d,
6981
- href: ((y = u.find((T) => T.key === "href")) == null ? void 0 : y.value) || "",
6982
- hrefType: ((b = u.find((T) => T.key === "data-vbtype")) == null ? void 0 : b.value) || "video",
6983
- autoplay: ((v = u.find((T) => T.key === "data-autoplay")) == null ? void 0 : v.value) === "true" ? "true" : "false",
6984
- maxWidth: ((S = (k = u.find((T) => T.key === "data-maxwidth")) == null ? void 0 : k.value) == null ? void 0 : S.replace("px", "")) || "",
6985
- backdropColor: ((C = u.find((T) => T.key === "data-overlay")) == null ? void 0 : C.value) || "",
6986
- galleryName: ((A = u.find((T) => T.key === "data-gall")) == null ? void 0 : A.value) || ""
6987
- }, forEach(I, (T) => {
6988
- has(d, `styles_attrs.${T}`) && delete d.styles_attrs[T];
6981
+ href: ((y = u.find((N) => N.key === "href")) == null ? void 0 : y.value) || "",
6982
+ hrefType: ((b = u.find((N) => N.key === "data-vbtype")) == null ? void 0 : b.value) || "video",
6983
+ autoplay: ((v = u.find((N) => N.key === "data-autoplay")) == null ? void 0 : v.value) === "true" ? "true" : "false",
6984
+ maxWidth: ((S = (k = u.find((N) => N.key === "data-maxwidth")) == null ? void 0 : k.value) == null ? void 0 : S.replace("px", "")) || "",
6985
+ backdropColor: ((C = u.find((N) => N.key === "data-overlay")) == null ? void 0 : C.value) || "",
6986
+ galleryName: ((A = u.find((N) => N.key === "data-gall")) == null ? void 0 : A.value) || ""
6987
+ }, forEach(I, (N) => {
6988
+ has(d, `styles_attrs.${N}`) && delete d.styles_attrs[N];
6989
6989
  });
6990
6990
  }
6991
6991
  if (h && (delete d.styles_attrs, d.showDropdown = !1), g && delete d.styles_attrs, f) {
6992
6992
  delete d.styles_attrs;
6993
- const I = filter(c.children || [], (N) => (N == null ? void 0 : N.tagName) !== "span");
6993
+ const I = filter(c.children || [], (j) => (j == null ? void 0 : j.tagName) !== "span");
6994
6994
  d.content = getTextContent(I);
6995
- const T = find(
6995
+ const N = find(
6996
6996
  c.children || [],
6997
- (N) => (N == null ? void 0 : N.tagName) === "span" && some(N.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg")
6997
+ (j) => (j == null ? void 0 : j.tagName) === "span" && some(j.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg")
6998
6998
  );
6999
- if (T) {
7000
- const N = find(T.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg");
7001
- if (N) {
7002
- d.icon = stringify([N]);
7003
- const { height: B, width: E } = getSvgDimensions(N, "16px", "16px");
6999
+ if (N) {
7000
+ const j = find(N.children || [], (B) => (B == null ? void 0 : B.tagName) === "svg");
7001
+ if (j) {
7002
+ d.icon = stringify([j]);
7003
+ const { height: B, width: E } = getSvgDimensions(j, "16px", "16px");
7004
7004
  d.iconHeight = B, d.iconWidth = E;
7005
7005
  }
7006
7006
  }
@@ -7013,8 +7013,8 @@ const ADD_BLOCK_TABS = {}, registerChaiAddBlockTab = (a, l) => {
7013
7013
  const I = stringify([c]);
7014
7014
  return hasVideoEmbed(I) && (set(d, "_type", "Video"), set(d, "url", getVideoURLFromHTML(I)), set(d, "styles", `${STYLES_KEY},`), set(d, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), d.content = I, [d];
7015
7015
  } else if (c.tagName === "svg") {
7016
- const I = find(c.attributes, { key: "height" }), T = find(c.attributes, { key: "width" }), N = get(I, "value") ? `[${get(I, "value")}px]` : "24px", B = get(T, "value") ? `[${get(T, "value")}px]` : "24px", E = get(find(c.attributes, { key: "class" }), "value", "w-full h-full");
7017
- return d.styles = `${STYLES_KEY}, ${cn$1(`w-${B} h-${N}`, E)}`.trim(), c.attributes = filter(c.attributes, (D) => !includes(["style", "width", "height", "class"], D.key)), d.icon = stringify([c]), [d];
7016
+ const I = find(c.attributes, { key: "height" }), N = find(c.attributes, { key: "width" }), j = get(I, "value") ? `[${get(I, "value")}px]` : "24px", B = get(N, "value") ? `[${get(N, "value")}px]` : "24px", E = get(find(c.attributes, { key: "class" }), "value", "w-full h-full");
7017
+ return d.styles = `${STYLES_KEY}, ${cn$1(`w-${B} h-${j}`, E)}`.trim(), c.attributes = filter(c.attributes, (D) => !includes(["style", "width", "height", "class"], D.key)), d.icon = stringify([c]), [d];
7018
7018
  } else if (c.tagName == "option" && l && ((w = l.block) == null ? void 0 : w._type) === "Select")
7019
7019
  return l.block.options.push({
7020
7020
  label: getTextContent(c.children),
@@ -7230,15 +7230,15 @@ const BlockCard = ({
7230
7230
  const w = await m(l, a);
7231
7231
  let I = c;
7232
7232
  if (k(first(w)) && (I = null), !isEmpty(w)) {
7233
- const T = { blocks: w, uiLibrary: !0, parent: I };
7234
- if (A.dataTransfer.setData("text/plain", JSON.stringify(T)), a.preview) {
7235
- const N = new Image();
7236
- N.src = a.preview, N.onload = () => {
7237
- A.dataTransfer.setDragImage(N, 0, 0);
7233
+ const N = { blocks: w, uiLibrary: !0, parent: I };
7234
+ if (A.dataTransfer.setData("text/plain", JSON.stringify(N)), a.preview) {
7235
+ const j = new Image();
7236
+ j.src = a.preview, j.onload = () => {
7237
+ A.dataTransfer.setDragImage(j, 0, 0);
7238
7238
  };
7239
7239
  } else
7240
7240
  A.dataTransfer.setDragImage(new Image(), 0, 0);
7241
- v(T), setTimeout(() => {
7241
+ v(N), setTimeout(() => {
7242
7242
  g([]), x(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7243
7243
  }, 200);
7244
7244
  }
@@ -7334,8 +7334,8 @@ const BlockCard = ({
7334
7334
  )
7335
7335
  ] }) }) });
7336
7336
  }, UILibrariesPanel = ({ parentId: a, position: l }) => /* @__PURE__ */ jsx(UILibrarySection, { parentId: a, position: l }), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: a, blocks: l, parentId: c, position: d, gridCols: u = "grid-cols-4" }) => {
7337
- var j;
7338
- const { t: p } = useTranslation(), [m] = useBlocksStore(), [h, f] = useState(""), g = useRef(null), [x] = useAtom$1(addBlockTabAtom), y = (j = find(m, (_) => _._id === c)) == null ? void 0 : j._type, [b, v] = useState("all"), [k, S] = useState(null), C = useRef(null);
7337
+ var T;
7338
+ const { t: p } = useTranslation(), [m] = useBlocksStore(), [h, f] = useState(""), g = useRef(null), [x] = useAtom$1(addBlockTabAtom), y = (T = find(m, (_) => _._id === c)) == null ? void 0 : T._type, [b, v] = useState("all"), [k, S] = useState(null), C = useRef(null);
7339
7339
  useEffect(() => {
7340
7340
  const _ = setTimeout(() => {
7341
7341
  var P;
@@ -7355,7 +7355,7 @@ const BlockCard = ({
7355
7355
  S(null), C.current && C.current.cancel();
7356
7356
  }, []), I = useCallback((_) => {
7357
7357
  C.current && C.current.cancel(), v(_), S(null);
7358
- }, []), T = useMemo(
7358
+ }, []), N = useMemo(
7359
7359
  () => h ? values(l).filter(
7360
7360
  (_) => {
7361
7361
  var P, L;
@@ -7363,15 +7363,15 @@ const BlockCard = ({
7363
7363
  }
7364
7364
  ) : l,
7365
7365
  [l, h]
7366
- ), N = useMemo(
7366
+ ), j = useMemo(
7367
7367
  () => h ? a.filter(
7368
- (_) => reject(filter(values(T), { group: _ }), { hidden: !0 }).length > 0
7368
+ (_) => reject(filter(values(N), { group: _ }), { hidden: !0 }).length > 0
7369
7369
  ) : a.filter((_) => reject(filter(values(l), { group: _ }), { hidden: !0 }).length > 0),
7370
- [l, T, a, h]
7370
+ [l, N, a, h]
7371
7371
  ), B = useMemo(
7372
- () => sortBy(N, (_) => CORE_GROUPS.indexOf(_) === -1 ? 99 : CORE_GROUPS.indexOf(_)),
7373
- [N]
7374
- ), E = useMemo(() => b === "all" ? T : filter(values(T), { group: b }), [T, b]), D = useMemo(() => b === "all" ? B : [b], [B, b]);
7372
+ () => sortBy(j, (_) => CORE_GROUPS.indexOf(_) === -1 ? 99 : CORE_GROUPS.indexOf(_)),
7373
+ [j]
7374
+ ), E = useMemo(() => b === "all" ? N : filter(values(N), { group: b }), [N, b]), D = useMemo(() => b === "all" ? B : [b], [B, b]);
7375
7375
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7376
7376
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7377
7377
  Input$1,
@@ -7409,7 +7409,7 @@ const BlockCard = ({
7409
7409
  `sidebar-${_}`
7410
7410
  ))
7411
7411
  ] }) }) }),
7412
- /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: N.length === 0 && h ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7412
+ /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: j.length === 0 && h ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7413
7413
  p("No blocks found matching"),
7414
7414
  ' "',
7415
7415
  h,
@@ -7738,17 +7738,17 @@ const selectParent = (a, l) => {
7738
7738
  let f = null;
7739
7739
  const g = a.children.length > 0, { highlightBlock: x, clearHighlight: y } = useBlockHighlight(), { id: b, data: v, isSelected: k, willReceiveDrop: S, isDragging: C, isEditing: A, handleClick: w } = a, I = (Z) => {
7740
7740
  Z.stopPropagation(), !u.includes(b) && a.toggle();
7741
- }, T = (Z) => {
7742
- Z.isInternal && (f = Z.isOpen, Z.isOpen && Z.close());
7743
7741
  }, N = (Z) => {
7742
+ Z.isInternal && (f = Z.isOpen, Z.isOpen && Z.close());
7743
+ }, j = (Z) => {
7744
7744
  Z.isInternal && f !== null && (f ? Z.open() : Z.close(), f = null);
7745
7745
  }, [B, E] = useAtom$1(currentAddSelection), D = () => {
7746
7746
  var Z;
7747
- j(), a.parent.isSelected || E((Z = a == null ? void 0 : a.parent) == null ? void 0 : Z.id);
7748
- }, j = () => {
7747
+ T(), a.parent.isSelected || E((Z = a == null ? void 0 : a.parent) == null ? void 0 : Z.id);
7748
+ }, T = () => {
7749
7749
  E(null);
7750
7750
  }, _ = (Z) => {
7751
- j(), Z.stopPropagation(), !a.isOpen && !u.includes(b) && a.toggle(), w(Z);
7751
+ T(), Z.stopPropagation(), !a.isOpen && !u.includes(b) && a.toggle(), w(Z);
7752
7752
  };
7753
7753
  useEffect(() => {
7754
7754
  const Z = setTimeout(() => {
@@ -7770,7 +7770,7 @@ const selectParent = (a, l) => {
7770
7770
  const U = F.getBoundingClientRect(), H = m.getBoundingClientRect();
7771
7771
  U.top >= H.top && U.left >= H.left && U.bottom <= H.bottom && U.right <= H.right || ($.documentElement.scrollTop = F.offsetTop - H.top);
7772
7772
  }, R = (Z) => {
7773
- j();
7773
+ T();
7774
7774
  const V = get(a, "parent.id");
7775
7775
  V !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: V, position: Z }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: Z });
7776
7776
  };
@@ -7802,8 +7802,8 @@ const selectParent = (a, l) => {
7802
7802
  style: l,
7803
7803
  "data-node-id": b,
7804
7804
  ref: u.includes(b) ? null : c,
7805
- onDragStart: () => T(a),
7806
- onDragEnd: () => N(a),
7805
+ onDragStart: () => N(a),
7806
+ onDragEnd: () => j(a),
7807
7807
  onDragOver: (Z) => {
7808
7808
  Z.preventDefault(), L(b, "yes");
7809
7809
  },
@@ -7821,7 +7821,7 @@ const selectParent = (a, l) => {
7821
7821
  Z.stopPropagation(), R(a.childIndex);
7822
7822
  },
7823
7823
  onMouseEnter: D,
7824
- onMouseLeave: j,
7824
+ onMouseLeave: T,
7825
7825
  className: "absolute -top-0.5 h-1 w-[90%] rounded bg-purple-500 opacity-0 delay-200 duration-200 group-hover:opacity-100",
7826
7826
  children: /* @__PURE__ */ jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3 stroke-[4] text-white" }) })
7827
7827
  }
@@ -10979,17 +10979,17 @@ const saveToLibraryModalAtom = atom$1({
10979
10979
  } catch (R) {
10980
10980
  toast.error(c("Failed to save to library")), console.error("Error saving to library:", R);
10981
10981
  }
10982
- }, [w, I] = useState([]), [T, N] = useState(""), [B, E] = useState(!1), D = (L) => {
10982
+ }, [w, I] = useState([]), [N, j] = useState(""), [B, E] = useState(!1), D = (L) => {
10983
10983
  g.setValue("group", L);
10984
- }, j = () => {
10984
+ }, T = () => {
10985
10985
  E(!0);
10986
10986
  }, _ = () => {
10987
- if (T) {
10988
- const L = T.toLowerCase().replace(/\s+/g, "-");
10989
- I([...w, { id: L, name: T }]), g.setValue("group", L), N(""), E(!1);
10987
+ if (N) {
10988
+ const L = N.toLowerCase().replace(/\s+/g, "-");
10989
+ I([...w, { id: L, name: N }]), g.setValue("group", L), j(""), E(!1);
10990
10990
  }
10991
10991
  }, P = () => {
10992
- N(""), E(!1);
10992
+ j(""), E(!1);
10993
10993
  };
10994
10994
  return /* @__PURE__ */ jsx(Dialog, { open: a.isOpen, onOpenChange: (L) => !L && l({ isOpen: !1, blockId: null }), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-4 sm:max-w-[450px]", children: [
10995
10995
  /* @__PURE__ */ jsx(DialogHeader, { className: "pb-2", children: /* @__PURE__ */ jsx(DialogTitle, { children: c(h ? "Update Library Block" : "Save to Library") }) }),
@@ -11043,8 +11043,8 @@ const saveToLibraryModalAtom = atom$1({
11043
11043
  {
11044
11044
  className: "h-8",
11045
11045
  placeholder: c("Enter new group name"),
11046
- value: T,
11047
- onChange: (R) => N(R.target.value)
11046
+ value: N,
11047
+ onChange: (R) => j(R.target.value)
11048
11048
  }
11049
11049
  ),
11050
11050
  /* @__PURE__ */ jsx(
@@ -11052,7 +11052,7 @@ const saveToLibraryModalAtom = atom$1({
11052
11052
  {
11053
11053
  type: "button",
11054
11054
  onClick: _,
11055
- disabled: !T,
11055
+ disabled: !N,
11056
11056
  size: "sm",
11057
11057
  className: "h-8",
11058
11058
  children: c("Add")
@@ -11089,7 +11089,7 @@ const saveToLibraryModalAtom = atom$1({
11089
11089
  type: "button",
11090
11090
  variant: "outline",
11091
11091
  className: "h-8 whitespace-nowrap text-xs",
11092
- onClick: j,
11092
+ onClick: T,
11093
11093
  size: "sm",
11094
11094
  children: c("Create new")
11095
11095
  }
@@ -11459,10 +11459,10 @@ const saveToLibraryModalAtom = atom$1({
11459
11459
  ColorPickerInput,
11460
11460
  {
11461
11461
  value: I,
11462
- onChange: (T) => S(w, T)
11462
+ onChange: (N) => S(w, N)
11463
11463
  }
11464
11464
  ),
11465
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: w.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((T) => T.charAt(0).toUpperCase() + T.slice(1)).join(" ") + (!w.toLowerCase().includes("foreground") && !w.toLowerCase().includes("border") && !w.toLowerCase().includes("input") && !w.toLowerCase().includes("ring") && !w.toLowerCase().includes("background") ? " Background" : "") })
11465
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: w.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" ") + (!w.toLowerCase().includes("foreground") && !w.toLowerCase().includes("border") && !w.toLowerCase().includes("input") && !w.toLowerCase().includes("ring") && !w.toLowerCase().includes("background") ? " Background" : "") })
11466
11466
  ] }, w);
11467
11467
  }) });
11468
11468
  return m("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
@@ -12219,7 +12219,10 @@ const FEATURE_TOGGLES = {
12219
12219
  }, [a, l, c]);
12220
12220
  }, CHAI_BUILDER_PANELS = {}, registerChaiSidebarPanel = (a, l) => {
12221
12221
  has(CHAI_BUILDER_PANELS, a) && console.warn(`Panel ${a} already registered. Overriding...`), set(CHAI_BUILDER_PANELS, a, { id: a, ...l });
12222
- }, useChaiSidebarPanels = (a) => useMemo(() => filter(values(CHAI_BUILDER_PANELS), (l) => l.position === a), [a]), DefaultTopBar = () => /* @__PURE__ */ jsx("div", { children: "TopBar" }), TOP_BAR = {
12222
+ }, useChaiSidebarPanels = (a) => useMemo(
12223
+ () => filter(values(CHAI_BUILDER_PANELS), (l) => l.position === a),
12224
+ [a]
12225
+ ), DefaultTopBar = () => /* @__PURE__ */ jsx("div", { children: "TopBar" }), TOP_BAR = {
12223
12226
  component: DefaultTopBar
12224
12227
  }, registerChaiTopBar = (a) => {
12225
12228
  TOP_BAR.component = a;
@@ -12262,9 +12265,9 @@ function AIChatPanel() {
12262
12265
  const A = (w = C.target.files) == null ? void 0 : w[0];
12263
12266
  if (A) {
12264
12267
  const I = new FileReader();
12265
- I.onload = (T) => {
12266
- var N;
12267
- h((N = T.target) == null ? void 0 : N.result);
12268
+ I.onload = (N) => {
12269
+ var j;
12270
+ h((j = N.target) == null ? void 0 : j.result);
12268
12271
  }, I.readAsDataURL(A);
12269
12272
  }
12270
12273
  }, k = () => {
@@ -12473,7 +12476,7 @@ const AiAssistant = () => {
12473
12476
  c(B), u(d), m(""), f(""), b("");
12474
12477
  }
12475
12478
  }, A = (B) => {
12476
- const E = d.filter((D, j) => j !== B);
12479
+ const E = d.filter((D, T) => T !== B);
12477
12480
  c(E), u(E);
12478
12481
  }, w = (B) => {
12479
12482
  x(B), m(d[B].key), f(d[B].value);
@@ -12486,9 +12489,9 @@ const AiAssistant = () => {
12486
12489
  const B = [...d];
12487
12490
  B[g] = { key: p, value: h }, c(B), u(B), x(null), m(""), f(""), b("");
12488
12491
  }
12489
- }, T = (B) => {
12492
+ }, N = (B) => {
12490
12493
  B.key === "Enter" && !B.shiftKey && (B.preventDefault(), g !== null ? I() : C());
12491
- }, N = useCallback((B) => {
12494
+ }, j = useCallback((B) => {
12492
12495
  const E = (_) => /[.,!?;:]/.test(_), D = (_, P, L) => {
12493
12496
  let R = "", M = "";
12494
12497
  const O = P > 0 ? _[P - 1] : "", Z = P < _.length ? _[P] : "";
@@ -12497,9 +12500,9 @@ const AiAssistant = () => {
12497
12500
  prefixLength: R.length,
12498
12501
  suffixLength: M.length
12499
12502
  };
12500
- }, j = k.current;
12501
- if (j) {
12502
- const _ = j.selectionStart || 0, P = j.value || "", L = j.selectionEnd || _;
12503
+ }, T = k.current;
12504
+ if (T) {
12505
+ const _ = T.selectionStart || 0, P = T.value || "", L = T.selectionEnd || _;
12503
12506
  if (L > _) {
12504
12507
  const V = `{{${B}}}`, { text: $ } = D(P, _, V), F = P.slice(0, _) + $ + P.slice(L);
12505
12508
  f(F);
@@ -12539,7 +12542,7 @@ const AiAssistant = () => {
12539
12542
  /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
12540
12543
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
12541
12544
  /* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
12542
- !isEmpty(S) && /* @__PURE__ */ jsx(NestedPathSelector, { data: S, onSelect: N })
12545
+ !isEmpty(S) && /* @__PURE__ */ jsx(NestedPathSelector, { data: S, onSelect: j })
12543
12546
  ] }),
12544
12547
  /* @__PURE__ */ jsx(
12545
12548
  Textarea,
@@ -12552,7 +12555,7 @@ const AiAssistant = () => {
12552
12555
  ref: k,
12553
12556
  value: h,
12554
12557
  onChange: (B) => f(B.target.value),
12555
- onKeyDown: T,
12558
+ onKeyDown: N,
12556
12559
  placeholder: "Enter Value",
12557
12560
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
12558
12561
  }
@@ -12591,7 +12594,7 @@ const AiAssistant = () => {
12591
12594
  [a, u, p]
12592
12595
  );
12593
12596
  return /* @__PURE__ */ jsx("div", { className: "flex-col gap-y-2", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AttrsEditor, { preloadedAttributes: l, onAttributesChange: m }) }) }) });
12594
- });
12597
+ }), NoopComponent = () => null;
12595
12598
  function BlockAttributesToggle() {
12596
12599
  const { t: a } = useTranslation(), [l, c] = useState(!0), [d] = useSelectedStylingBlocks();
12597
12600
  return isEmpty(d) ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -12655,25 +12658,25 @@ const SettingsPanel = () => {
12655
12658
  }
12656
12659
  )
12657
12660
  ] }) });
12658
- }, DEFAULT_PANEL_WIDTH = 280;
12661
+ }, DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: a, show: l }) => /* @__PURE__ */ jsx(Button, { variant: a ? "default" : "ghost", size: "icon", onClick: l, children: /* @__PURE__ */ jsx(Layers, { size: 20 }) }), AiButton = ({ isActive: a, show: l }) => /* @__PURE__ */ jsx(Button, { variant: a ? "default" : "ghost", size: "icon", onClick: l, children: /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }) });
12659
12662
  function useSidebarMenuItems() {
12660
12663
  const a = useBuilderProp("askAiCallBack", null), l = useFeature("aiChat");
12661
12664
  return useMemo(() => {
12662
12665
  const c = [];
12663
12666
  return c.push({
12664
12667
  id: "outline",
12665
- icon: /* @__PURE__ */ jsx(Layers, { size: 20 }),
12666
12668
  label: "Outline",
12667
12669
  isInternal: !0,
12668
12670
  width: DEFAULT_PANEL_WIDTH,
12669
- component: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
12671
+ button: OutlineButton,
12672
+ panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
12670
12673
  }), a && l && c.unshift({
12671
12674
  id: "ai",
12672
- icon: /* @__PURE__ */ jsx(SparklesIcon, { size: 20 }),
12675
+ button: AiButton,
12673
12676
  label: "AI Assistant",
12674
12677
  isInternal: !0,
12675
12678
  width: 450,
12676
- component: () => /* @__PURE__ */ jsx("div", { className: "-mt-8 h-full max-h-full", children: /* @__PURE__ */ jsx(AIChatPanel, {}) })
12679
+ panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8 h-full max-h-full", children: /* @__PURE__ */ jsx(AIChatPanel, {}) })
12677
12680
  }), compact(c);
12678
12681
  }, [a, l]);
12679
12682
  }
@@ -12682,27 +12685,34 @@ const RootLayout = () => {
12682
12685
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
12683
12686
  c("outline");
12684
12687
  });
12685
- const f = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), x = (T) => {
12686
- T.preventDefault();
12687
- }, y = (T) => {
12688
- c(l === T ? null : T);
12688
+ const f = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), x = (j) => {
12689
+ j.preventDefault();
12690
+ }, y = (j) => {
12691
+ c(l === j ? null : j);
12689
12692
  }, b = useSidebarMenuItems(), { t: v } = useTranslation(), k = useMemo(() => [...b, ...f], [b, f]), S = useBuilderProp("htmlDir", "ltr"), C = find(k, { id: l }) ?? first(k), A = get(C, "width", DEFAULT_PANEL_WIDTH);
12690
12693
  useEffect(() => {
12691
12694
  if (l !== null) {
12692
- const T = find(k, { id: l });
12693
- T && get(T, "view", "standard") === "standard" && (d.current = l, p(get(T, "width", DEFAULT_PANEL_WIDTH)));
12695
+ const j = find(k, { id: l });
12696
+ j && get(j, "view", "standard") === "standard" && (d.current = l, p(get(j, "width", DEFAULT_PANEL_WIDTH)));
12694
12697
  }
12695
12698
  }, [l, k]);
12696
12699
  const w = useMemo(() => {
12697
12700
  if (l === null) return 0;
12698
- const T = find(k, { id: l });
12699
- return get(T, "view", "standard") === "standard" ? A : u;
12701
+ const j = find(k, { id: l });
12702
+ return get(j, "view", "standard") === "standard" ? A : u;
12700
12703
  }, [l, A, u, k]), I = () => {
12701
12704
  c(d.current);
12702
12705
  };
12703
- return useEffect(() => {
12706
+ useEffect(() => {
12704
12707
  find(k, { id: l }) || c("outline");
12705
- }, [l, k]), /* @__PURE__ */ jsx("div", { dir: S, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
12708
+ }, [l, k]);
12709
+ const N = useCallback(
12710
+ (j) => {
12711
+ y(j);
12712
+ },
12713
+ [y]
12714
+ );
12715
+ return /* @__PURE__ */ jsx("div", { dir: S, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
12706
12716
  /* @__PURE__ */ jsxs(
12707
12717
  "div",
12708
12718
  {
@@ -12712,33 +12722,25 @@ const RootLayout = () => {
12712
12722
  /* @__PURE__ */ jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(a, {}) }) }),
12713
12723
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
12714
12724
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
12715
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: k.map((T, N) => /* @__PURE__ */ jsxs(Tooltip, { children: [
12716
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
12717
- Button,
12718
- {
12719
- variant: l === T.id ? "default" : "ghost",
12720
- className: "mb-2 rounded-lg p-2 transition-colors",
12721
- onClick: () => y(T.id),
12722
- children: get(T, "icon", null)
12723
- },
12724
- N
12725
- ) }),
12726
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: v(T.label) }) })
12727
- ] }, "button-" + N)) }),
12725
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: k.map((j, B) => /* @__PURE__ */ jsxs(Tooltip, { children: [
12726
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(j, "button", NoopComponent), {
12727
+ position: "top",
12728
+ panelId: j.id,
12729
+ isActive: l === j.id,
12730
+ show: () => N(j.id)
12731
+ }) }),
12732
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: v(j.label) }) })
12733
+ ] }, "button-top-" + B)) }),
12728
12734
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
12729
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((T, N) => /* @__PURE__ */ jsxs(Tooltip, { children: [
12730
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
12731
- Button,
12732
- {
12733
- variant: l === T.id ? "default" : "ghost",
12734
- className: "mb-2 rounded-lg p-2 transition-colors",
12735
- onClick: () => y(T.id),
12736
- children: get(T, "icon", null)
12737
- },
12738
- N
12739
- ) }),
12740
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: v(T.label) }) })
12741
- ] }, "button-" + N)) })
12735
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((j, B) => /* @__PURE__ */ jsxs(Tooltip, { children: [
12736
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(j, "button", NoopComponent), {
12737
+ position: "bottom",
12738
+ panelId: j.id,
12739
+ isActive: l === j.id,
12740
+ show: () => N(j.id)
12741
+ }) }),
12742
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: v(j.label) }) })
12743
+ ] }, "button-bottom-" + B)) })
12742
12744
  ] }),
12743
12745
  /* @__PURE__ */ jsx(
12744
12746
  motion.div,
@@ -12749,17 +12751,14 @@ const RootLayout = () => {
12749
12751
  animate: { width: w },
12750
12752
  transition: { duration: 0.3, ease: "easeInOut" },
12751
12753
  children: l !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
12752
- /* @__PURE__ */ jsxs(
12754
+ /* @__PURE__ */ jsx(
12753
12755
  "div",
12754
12756
  {
12755
12757
  className: `absolute top-2 flex h-10 items-center space-x-1 bg-white py-2 text-base font-bold ${get(C, "isInternal", !1) ? "" : "w-64"}`,
12756
- children: [
12757
- /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
12758
- /* @__PURE__ */ jsx("span", { children: v(get(C, "label", "")) })
12759
- ]
12758
+ children: /* @__PURE__ */ jsx("span", { children: v(get(C, "label", "")) })
12760
12759
  }
12761
12760
  ),
12762
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "component", null), {}) }) })
12761
+ /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
12763
12762
  ] })
12764
12763
  }
12765
12764
  ),
@@ -12805,14 +12804,15 @@ const RootLayout = () => {
12805
12804
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
12806
12805
  /* @__PURE__ */ jsx("span", { children: v(get(C, "label", "")) })
12807
12806
  ] }) }),
12808
- /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "component", null), {}) }) })
12807
+ /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
12809
12808
  ] }) }),
12809
+ " ",
12810
12810
  l !== null && get(C, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => I(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${A}px` }, children: [
12811
12811
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
12812
12812
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(C, "icon", null) }),
12813
12813
  /* @__PURE__ */ jsx("span", { children: v(get(C, "label", "")) })
12814
12814
  ] }) }),
12815
- /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "component", null), {}) }) })
12815
+ /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
12816
12816
  ] }) }),
12817
12817
  l !== null && get(C, "view") === "overlay" && /* @__PURE__ */ jsx(
12818
12818
  motion.div,
@@ -12847,7 +12847,7 @@ const RootLayout = () => {
12847
12847
  }
12848
12848
  )
12849
12849
  ] }),
12850
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "component", null), {}) }) })
12850
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(C, "panel", NoopComponent), {}) }) })
12851
12851
  ]
12852
12852
  }
12853
12853
  ) })
@@ -12977,6 +12977,7 @@ export {
12977
12977
  useHighlightBlockId,
12978
12978
  useLanguages,
12979
12979
  useLibraryBlocks,
12980
+ useMediaManagerComponent,
12980
12981
  usePartailBlocksStore,
12981
12982
  usePartialBlocksList,
12982
12983
  usePasteBlocks,