@chaibuilder/sdk 1.3.0-beta.4 → 1.3.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,10 +206,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
206
206
  }
207
207
  }, x = (k) => returnAtomValue(p(k)), m = (k) => {
208
208
  let A = n.get(k);
209
- return A || (A = C(k)), A;
209
+ return A || (A = R(k)), A;
210
210
  }, g = (k, A) => !A.l.size && (!A.t.size || A.t.size === 1 && A.t.has(k)), b = (k) => {
211
211
  const A = n.get(k);
212
- A && g(k, A) && R(k);
212
+ A && g(k, A) && C(k);
213
213
  }, j = (k) => {
214
214
  const A = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new WeakMap(), E = (S) => {
215
215
  const N = n.get(S);
@@ -257,20 +257,20 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
257
257
  }, v = (k, ...A) => {
258
258
  const B = f(k, ...A);
259
259
  return w(), B;
260
- }, C = (k, A) => {
260
+ }, R = (k, A) => {
261
261
  const B = {
262
262
  t: new Set(A && [A]),
263
263
  l: /* @__PURE__ */ new Set()
264
264
  };
265
265
  if (n.set(k, B), p(k).d.forEach((E, _) => {
266
266
  const S = n.get(_);
267
- S ? S.t.add(k) : _ !== k && C(_, k);
267
+ S ? S.t.add(k) : _ !== k && R(_, k);
268
268
  }), p(k), isActuallyWritableAtom(k) && k.onMount) {
269
269
  const E = k.onMount((..._) => v(k, ..._));
270
270
  E && (B.u = E);
271
271
  }
272
272
  return B;
273
- }, R = (k) => {
273
+ }, C = (k) => {
274
274
  var A;
275
275
  const B = (A = n.get(k)) == null ? void 0 : A.u;
276
276
  B && B(), n.delete(k);
@@ -278,7 +278,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
278
278
  E && (hasPromiseAtomValue(E) && cancelPromise(E.v), E.d.forEach((_, S) => {
279
279
  if (S !== k) {
280
280
  const N = n.get(S);
281
- N && (N.t.delete(k), g(S, N) && R(S));
281
+ N && (N.t.delete(k), g(S, N) && C(S));
282
282
  }
283
283
  }));
284
284
  }, I = (k, A, B) => {
@@ -289,10 +289,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
289
289
  return;
290
290
  }
291
291
  const N = n.get(S);
292
- N && (N.t.delete(k), g(S, N) && R(S));
292
+ N && (N.t.delete(k), g(S, N) && C(S));
293
293
  }), E.forEach((_) => {
294
294
  const S = n.get(_);
295
- S ? S.t.add(k) : n.has(k) && C(_, k);
295
+ S ? S.t.add(k) : n.has(k) && R(_, k);
296
296
  });
297
297
  }, w = () => {
298
298
  for (; r.size; ) {
@@ -343,8 +343,8 @@ function splitAtom(o, n) {
343
343
  x[b] = f;
344
344
  return;
345
345
  }
346
- const v = (R) => {
347
- const I = R(l), w = R(o), k = a(w, I == null ? void 0 : I.arr).keyList.indexOf(j);
346
+ const v = (C) => {
347
+ const I = C(l), w = C(o), k = a(w, I == null ? void 0 : I.arr).keyList.indexOf(j);
348
348
  if (k < 0 || k >= w.length) {
349
349
  const A = c[a(c).keyList.indexOf(j)];
350
350
  if (A)
@@ -352,8 +352,8 @@ function splitAtom(o, n) {
352
352
  throw new Error("splitAtom: index out of bounds for read");
353
353
  }
354
354
  return w[k];
355
- }, C = (R, I, w) => {
356
- const T = R(l), k = R(o), B = a(k, T == null ? void 0 : T.arr).keyList.indexOf(j);
355
+ }, R = (C, I, w) => {
356
+ const T = C(l), k = C(o), B = a(k, T == null ? void 0 : T.arr).keyList.indexOf(j);
357
357
  if (B < 0 || B >= k.length)
358
358
  throw new Error("splitAtom: index out of bounds for write");
359
359
  const E = isFunction(w) ? w(k[B]) : w;
@@ -363,7 +363,7 @@ function splitAtom(o, n) {
363
363
  ...k.slice(B + 1)
364
364
  ]);
365
365
  };
366
- x[b] = isWritable(o) ? atom(v, C) : atom(v);
366
+ x[b] = isWritable(o) ? atom(v, R) : atom(v);
367
367
  }), p && p.keyList.length === m.length && p.keyList.every((g, b) => g === m[b]) ? u = p : u = { arr: c, atomList: x, keyList: m }, r.set(c, u), u;
368
368
  }, l = atom((c) => {
369
369
  const d = c(l), u = c(o);
@@ -1152,12 +1152,12 @@ const useBlocksStoreManager = () => {
1152
1152
  } = useBlocksStoreManager();
1153
1153
  return {
1154
1154
  moveBlocks: (j, f, v) => {
1155
- const C = map(j, (I) => {
1155
+ const R = map(j, (I) => {
1156
1156
  const T = n.find((B) => B._id === I)._parent || null, A = n.filter((B) => T ? B._parent === T : !B._parent).map((B) => B._id).indexOf(I);
1157
1157
  return { _id: I, oldParent: T, oldPosition: A };
1158
- }), R = C.find(({ _id: I }) => I === j[0]);
1159
- R && R.oldParent === f && R.oldPosition === v || (i(j, f, v), o({
1160
- undo: () => each(C, ({ _id: I, oldParent: w, oldPosition: T }) => {
1158
+ }), C = R.find(({ _id: I }) => I === j[0]);
1159
+ C && C.oldParent === f && C.oldPosition === v || (i(j, f, v), o({
1160
+ undo: () => each(R, ({ _id: I, oldParent: w, oldPosition: T }) => {
1161
1161
  i([I], w, T);
1162
1162
  }),
1163
1163
  redo: () => i(j, f, v)
@@ -1170,27 +1170,27 @@ const useBlocksStoreManager = () => {
1170
1170
  });
1171
1171
  },
1172
1172
  removeBlocks: (j) => {
1173
- var R;
1174
- const f = (R = first(j)) == null ? void 0 : R._parent, C = n.filter((I) => f ? I._parent === f : !I._parent).indexOf(first(j));
1173
+ var C;
1174
+ const f = (C = first(j)) == null ? void 0 : C._parent, R = n.filter((I) => f ? I._parent === f : !I._parent).indexOf(first(j));
1175
1175
  l(map(j, "_id")), o({
1176
- undo: () => a(j, f, C),
1176
+ undo: () => a(j, f, R),
1177
1177
  redo: () => l(map(j, "_id"))
1178
1178
  });
1179
1179
  },
1180
1180
  updateBlocks: (j, f, v) => {
1181
- let C = [];
1181
+ let R = [];
1182
1182
  if (v)
1183
- C = map(j, (R) => ({ _id: R, ...v }));
1183
+ R = map(j, (C) => ({ _id: C, ...v }));
1184
1184
  else {
1185
- const R = keys(f);
1186
- C = map(j, (I) => {
1185
+ const C = keys(f);
1186
+ R = map(j, (I) => {
1187
1187
  const w = n.find((k) => k._id === I), T = { _id: I };
1188
- return each(R, (k) => T[k] = w[k]), T;
1188
+ return each(C, (k) => T[k] = w[k]), T;
1189
1189
  });
1190
1190
  }
1191
- c(map(j, (R) => ({ _id: R, ...f }))), o({
1192
- undo: () => c(C),
1193
- redo: () => c(map(j, (R) => ({ _id: R, ...f })))
1191
+ c(map(j, (C) => ({ _id: C, ...f }))), o({
1192
+ undo: () => c(R),
1193
+ redo: () => c(map(j, (C) => ({ _id: C, ...f })))
1194
1194
  });
1195
1195
  },
1196
1196
  updateBlocksRuntime: (j, f) => {
@@ -1205,8 +1205,8 @@ const useBlocksStoreManager = () => {
1205
1205
  updateMultipleBlocksProps: (j) => {
1206
1206
  let f = [];
1207
1207
  f = map(j, (v) => {
1208
- const C = keys(v), R = n.find((w) => w._id === v._id), I = {};
1209
- return each(C, (w) => I[w] = R[w]), I;
1208
+ const R = keys(v), C = n.find((w) => w._id === v._id), I = {};
1209
+ return each(R, (w) => I[w] = C[w]), I;
1210
1210
  }), c(j), o({
1211
1211
  undo: () => c(f),
1212
1212
  redo: () => c(j)
@@ -1237,16 +1237,16 @@ const useBlocksStoreManager = () => {
1237
1237
  return a(v, c, d);
1238
1238
  }
1239
1239
  const u = generateUUID(), p = getBlockDefaultProps(i.props), x = [];
1240
- forIn(p, (v, C) => {
1240
+ forIn(p, (v, R) => {
1241
1241
  if (startsWith(v, SLOT_KEY)) {
1242
- const R = v.replace(SLOT_KEY, "");
1242
+ const C = v.replace(SLOT_KEY, "");
1243
1243
  x.push({
1244
- _id: R,
1244
+ _id: C,
1245
1245
  _type: "Slot",
1246
1246
  _parent: u,
1247
- _name: i.props[C].name,
1248
- _styles: i.props[C].styles,
1249
- _emptyStyles: i.props[C].emptyStyles
1247
+ _name: i.props[R].name,
1248
+ _styles: i.props[R].styles,
1249
+ _emptyStyles: i.props[R].emptyStyles
1250
1250
  });
1251
1251
  }
1252
1252
  });
@@ -3068,8 +3068,8 @@ const useDnd = () => {
3068
3068
  }
3069
3069
  const g = dropTarget, j = getOrientation(g) === "vertical" ? m.clientY + ((I = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : I.scrollY) : m.clientX;
3070
3070
  dropIndex = calculateDropIndex(j, possiblePositions);
3071
- const f = d, v = g.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3072
- if ((f == null ? void 0 : f._id) === v || !C || !canDropInTarget(dropTarget, d)) {
3071
+ const f = d, v = g.getAttribute("data-block-id"), R = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3072
+ if ((f == null ? void 0 : f._id) === v || !R || !canDropInTarget(dropTarget, d)) {
3073
3073
  x();
3074
3074
  return;
3075
3075
  }
@@ -3077,8 +3077,8 @@ const useDnd = () => {
3077
3077
  a(f, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
3078
3078
  return;
3079
3079
  }
3080
- let R = g.getAttribute("data-block-id");
3081
- R === null && (R = m.target.parentElement.getAttribute("data-block-id")), c([f._id], R === "canvas" ? null : R, dropIndex), x(), setTimeout(removePlaceholder, 300);
3080
+ let C = g.getAttribute("data-block-id");
3081
+ C === null && (C = m.target.parentElement.getAttribute("data-block-id")), c([f._id], C === "canvas" ? null : C, dropIndex), x(), setTimeout(removePlaceholder, 300);
3082
3082
  },
3083
3083
  onDragEnter: (m) => {
3084
3084
  const g = m, b = g.target;
@@ -3291,7 +3291,53 @@ const useHandleCanvasDblClick = () => {
3291
3291
  ]
3292
3292
  }
3293
3293
  ) });
3294
- }, HeadTags = () => {
3294
+ }, googleFontsMap = {
3295
+ Montserrat: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3296
+ Roboto: [100, 300, 400, 500, 700, 900],
3297
+ "Open Sans": [300, 400, 600, 700, 800],
3298
+ Lato: [100, 300, 400, 700, 900],
3299
+ Poppins: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3300
+ Inter: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3301
+ Nunito: [200, 300, 400, 600, 700, 800, 900],
3302
+ Oswald: [200, 300, 400, 500, 600, 700],
3303
+ Raleway: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3304
+ Ubuntu: [300, 400, 500, 700],
3305
+ "Source Sans Pro": [200, 300, 400, 600, 700, 900],
3306
+ "Noto Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3307
+ "Work Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3308
+ "Playfair Display": [400, 500, 600, 700, 800, 900],
3309
+ "DM Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3310
+ Merriweather: [300, 400, 700, 900],
3311
+ Lora: [400, 500, 600, 700],
3312
+ "PT Serif": [400, 700],
3313
+ "Roboto Mono": [100, 200, 300, 400, 500, 600, 700],
3314
+ "Source Code Pro": [200, 300, 400, 500, 600, 700, 800, 900],
3315
+ Quicksand: [300, 400, 500, 600, 700],
3316
+ Manrope: [200, 300, 400, 500, 600, 700, 800],
3317
+ "Space Grotesk": [300, 400, 500, 600, 700],
3318
+ "Plus Jakarta Sans": [200, 300, 400, 500, 600, 700, 800],
3319
+ "Varela Round": [400],
3320
+ Comfortaa: [300, 400, 500, 600, 700],
3321
+ Barlow: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3322
+ Mulish: [200, 300, 400, 500, 600, 700, 800, 900],
3323
+ Rubik: [300, 400, 500, 600, 700, 800, 900],
3324
+ Outfit: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3325
+ "Fira Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3326
+ "Josefin Sans": [100, 200, 300, 400, 500, 600, 700],
3327
+ "Be Vietnam Pro": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3328
+ Urbanist: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3329
+ "IBM Plex Sans": [100, 200, 300, 400, 500, 600, 700],
3330
+ "Red Hat Display": [300, 400, 500, 600, 700, 800, 900],
3331
+ "Red Hat Text": [300, 400, 500, 600, 700],
3332
+ Sora: [100, 200, 300, 400, 500, 600, 700, 800],
3333
+ Karla: [200, 300, 400, 500, 600, 700, 800],
3334
+ "Albert Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3335
+ "Public Sans": [100, 200, 300, 400, 500, 600, 700, 800, 900],
3336
+ Figtree: [300, 400, 500, 600, 700, 800, 900],
3337
+ Cabin: [400, 500, 600, 700],
3338
+ Bitter: [100, 200, 300, 400, 500, 600, 700, 800, 900],
3339
+ Lexend: [100, 200, 300, 400, 500, 600, 700, 800, 900]
3340
+ }, getFontWeights = (o) => googleFontsMap[o] || [300, 400, 500, 600, 700, 800, 900], HeadTags = () => {
3295
3341
  const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), a = useAtomValue$1(arbitraryFontsAtom), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: u } = useFrame(), [p] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [x] = useState(
3296
3342
  d == null ? void 0 : d.getElementById("selected-block")
3297
3343
  ), [m] = useState(
@@ -3304,14 +3350,14 @@ const useHandleCanvasDblClick = () => {
3304
3350
  }, [r, d]);
3305
3351
  const b = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3306
3352
  return useEffect(() => {
3307
- const f = get(o, "primaryColor", "#000"), v = get(o, "secondaryColor", "#FFF"), C = get(o, "bodyBgLightColor", "#fff"), R = get(o, "bodyBgDarkColor", "#000"), I = get(o, "bodyTextDarkColor", "#000"), w = get(o, "bodyTextLightColor", "#fff"), T = s({
3353
+ const f = get(o, "primaryColor", "#000"), v = get(o, "secondaryColor", "#FFF"), R = get(o, "bodyBgLightColor", "#fff"), C = get(o, "bodyBgDarkColor", "#000"), I = get(o, "bodyTextDarkColor", "#000"), w = get(o, "bodyTextLightColor", "#fff"), T = s({
3308
3354
  colors: [f, v],
3309
3355
  names: ["primary", "secondary"]
3310
3356
  });
3311
3357
  set(T, "primary.DEFAULT", f), set(T, "secondary.DEFAULT", v);
3312
3358
  const k = {
3313
- "bg-light": C,
3314
- "bg-dark": R,
3359
+ "bg-light": R,
3360
+ "bg-dark": C,
3315
3361
  "text-dark": I,
3316
3362
  "text-light": w
3317
3363
  }, A = get(o, "roundedCorners", "0");
@@ -3384,7 +3430,10 @@ const useHandleCanvasDblClick = () => {
3384
3430
  "link",
3385
3431
  {
3386
3432
  rel: "stylesheet",
3387
- href: `https://fonts.googleapis.com/css2?${a.map((f) => f.replace(/_/g, "+")).map((f) => `family=${f}:wght@200..800`).join("&")}&display=swap`
3433
+ href: `https://fonts.googleapis.com/css2?${a.map((f) => f.replace(/_/g, "+")).map((f) => {
3434
+ const v = f.replace(/\+/g, " "), R = getFontWeights(v);
3435
+ return `family=${f}:wght@${R.join(";")}`;
3436
+ }).join("&")}&display=swap`
3388
3437
  }
3389
3438
  )
3390
3439
  ] });
@@ -3502,19 +3551,19 @@ function applyLanguage(o, n, r) {
3502
3551
  }
3503
3552
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3504
3553
  const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), m = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [b] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3505
- (f) => f.reduce((v, C) => {
3506
- const R = get(u, C, {});
3507
- return { ...v, ...R };
3554
+ (f) => f.reduce((v, R) => {
3555
+ const C = get(u, R, {});
3556
+ return { ...v, ...C };
3508
3557
  }, {}),
3509
3558
  [u]
3510
3559
  );
3511
3560
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3512
3561
  o.map((f, v) => {
3513
3562
  if (b === f._id || p.includes(f._id)) return null;
3514
- const C = {}, R = filter(n, { _parent: f._id });
3515
- if (C.children = R.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: R }) : null, f._type === "GlobalBlock") {
3563
+ const R = {}, C = filter(n, { _parent: f._id });
3564
+ if (R.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, f._type === "GlobalBlock") {
3516
3565
  const S = x(f);
3517
- C.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(S, (N) => !N._parent), allBlocks: S });
3566
+ R.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(S, (N) => !N._parent), allBlocks: S });
3518
3567
  }
3519
3568
  const I = getBlockComponent(f._type), w = get(I, "server", !1), T = w ? RSCBlock : get(I, "builderComponent", get(I, "component", null));
3520
3569
  if (isNull(T)) return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
@@ -3540,7 +3589,7 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3540
3589
  index: v,
3541
3590
  ...applyBindings(applyLanguage(f, r, I), g),
3542
3591
  ...omit(B, ["__isHidden"]),
3543
- ...C,
3592
+ ...R,
3544
3593
  inBuilder: !0,
3545
3594
  blockState: A
3546
3595
  }) });
@@ -3593,7 +3642,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3593
3642
  };
3594
3643
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3595
3644
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3596
- const [o] = useCanvasWidth(), [, n] = useSelectedBlockIds(), r = useSelectedBlock(), [, a] = useHighlightBlockId(), l = useRef(null), i = useRef(null), [c, d] = useState({ width: 0, height: 0 }), u = useCanvasScale(c), [p, x] = useState([]), [, m] = useState([]), [, g] = useAtom$1(canvasIframeAtom), [b, j] = useSelectedStylingBlocks(), f = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (w) => {
3645
+ const [o] = useCanvasWidth(), [, n] = useSelectedBlockIds(), r = useSelectedBlock(), [, a] = useHighlightBlockId(), l = useRef(null), i = useRef(null), [c, d] = useState({ width: 0, height: 0 }), u = useCanvasScale(c), [p, x] = useState([]), [, m] = useState([]), [, g] = useAtom$1(canvasIframeAtom), [b, j] = useSelectedStylingBlocks(), f = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), R = (w) => {
3597
3646
  d((T) => ({ ...T, width: w }));
3598
3647
  };
3599
3648
  useEffect(() => {
@@ -3601,7 +3650,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3601
3650
  const { clientWidth: w, clientHeight: T } = i.current;
3602
3651
  d({ width: w, height: T });
3603
3652
  }, [i, o]);
3604
- const R = (w, T = 0) => {
3653
+ const C = (w, T = 0) => {
3605
3654
  const { top: k } = w.getBoundingClientRect();
3606
3655
  return k + T >= 0 && k - T <= window.innerHeight;
3607
3656
  };
@@ -3609,7 +3658,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3609
3658
  var w, T;
3610
3659
  if (r && r.type !== "Multiple" && l.current) {
3611
3660
  const k = getElementByDataBlockId(l.current.contentDocument, r._id);
3612
- k && (R(k) || (T = (w = l.current) == null ? void 0 : w.contentWindow) == null || T.scrollTo({ top: k.offsetTop, behavior: "smooth" }), x([k]));
3661
+ k && (C(k) || (T = (w = l.current) == null ? void 0 : w.contentWindow) == null || T.scrollTo({ top: k.offsetTop, behavior: "smooth" }), x([k]));
3613
3662
  }
3614
3663
  }, [r]), useEffect(() => {
3615
3664
  if (!isEmpty(b) && l.current) {
@@ -3625,7 +3674,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3625
3674
  let w = IframeInitialContent;
3626
3675
  return w = w.replace("__HTML_DIR__", v), w;
3627
3676
  }, [v]);
3628
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3677
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: R, onResize: R, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3629
3678
  "div",
3630
3679
  {
3631
3680
  onClick: () => {
@@ -3764,7 +3813,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3764
3813
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3765
3814
  ] }, l))
3766
3815
  ] }) });
3767
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-DHJ_PVtc.js")), CanvasArea = () => {
3816
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-BTeBxM9t.js")), CanvasArea = () => {
3768
3817
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3769
3818
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3770
3819
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
@@ -3852,7 +3901,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3852
3901
  bodyBgLightColor: f,
3853
3902
  roundedCorners: v
3854
3903
  } = r;
3855
- let C = {
3904
+ let R = {
3856
3905
  headingFont: y({
3857
3906
  title: c("Theme Config.Heading Font"),
3858
3907
  default: p,
@@ -3870,8 +3919,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3870
3919
  primaryColor: h({ title: c("Theme Config.Primary"), default: x }),
3871
3920
  secondaryColor: h({ title: c("Theme Config.Secondary"), default: j })
3872
3921
  };
3873
- l || (C = {
3874
- ...C,
3922
+ l || (R = {
3923
+ ...R,
3875
3924
  bodyBgLightColor: h({
3876
3925
  title: c("Theme Config.Background"),
3877
3926
  default: f
@@ -3889,13 +3938,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3889
3938
  default: g
3890
3939
  })
3891
3940
  });
3892
- const R = {
3941
+ const C = {
3893
3942
  type: "object",
3894
3943
  properties: {}
3895
3944
  }, I = {};
3896
- return Object.keys(C).forEach((w) => {
3897
- const T = C[w];
3898
- return R.properties || (R.properties = {}), R.properties[w] = T.schema, I[w] = T.uiSchema, !0;
3945
+ return Object.keys(R).forEach((w) => {
3946
+ const T = R[w];
3947
+ return C.properties || (C.properties = {}), C.properties[w] = T.schema, I[w] = T.uiSchema, !0;
3899
3948
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3900
3949
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
3901
3950
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3908,7 +3957,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3908
3957
  liveOmit: !0,
3909
3958
  liveValidate: !0,
3910
3959
  uiSchema: I,
3911
- schema: R,
3960
+ schema: C,
3912
3961
  formData: r,
3913
3962
  validator,
3914
3963
  onChange: d
@@ -4115,14 +4164,14 @@ function BiExpandVertical(o) {
4115
4164
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4116
4165
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4117
4166
  let u = null;
4118
- const p = o.children.length > 0, { highlightBlock: x, clearHighlight: m } = useBlockHighlight(), { id: g, data: b, isSelected: j, willReceiveDrop: f, isDragging: v, isEditing: C, handleClick: R } = o, I = (E) => {
4167
+ const p = o.children.length > 0, { highlightBlock: x, clearHighlight: m } = useBlockHighlight(), { id: g, data: b, isSelected: j, willReceiveDrop: f, isDragging: v, isEditing: R, handleClick: C } = o, I = (E) => {
4119
4168
  E.stopPropagation(), !i.includes(g) && o.toggle();
4120
4169
  }, w = (E) => {
4121
4170
  E.isInternal && (u = E.isOpen, E.isOpen && E.close());
4122
4171
  }, T = (E) => {
4123
4172
  E.isInternal && u !== null && (u ? E.open() : E.close(), u = null);
4124
4173
  }, k = (E) => {
4125
- E.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), R(E);
4174
+ E.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), C(E);
4126
4175
  };
4127
4176
  useEffect(() => {
4128
4177
  const E = setTimeout(() => {
@@ -4192,7 +4241,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4192
4241
  ),
4193
4242
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4194
4243
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: b == null ? void 0 : b._type }) }),
4195
- C ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4244
+ R ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4196
4245
  "div",
4197
4246
  {
4198
4247
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
@@ -4592,7 +4641,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4592
4641
  ...getAttrs(r),
4593
4642
  ...getStyles(r)
4594
4643
  }, r.attributes) {
4595
- const v = r.attributes.find((C) => includes(NAME_ATTRIBUTES, C.key));
4644
+ const v = r.attributes.find((R) => includes(NAME_ATTRIBUTES, R.key));
4596
4645
  v && (a._name = v.value);
4597
4646
  }
4598
4647
  if (i)
@@ -4610,14 +4659,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4610
4659
  ];
4611
4660
  a = {
4612
4661
  ...a,
4613
- href: ((u = l.find((C) => C.key === "href")) == null ? void 0 : u.value) || "",
4614
- hrefType: ((p = l.find((C) => C.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4615
- autoplay: ((x = l.find((C) => C.key === "data-autoplay")) == null ? void 0 : x.value) === "true",
4616
- maxWidth: ((g = (m = l.find((C) => C.key === "data-maxwidth")) == null ? void 0 : m.value) == null ? void 0 : g.replace("px", "")) || "",
4617
- backdropColor: ((b = l.find((C) => C.key === "data-overlay")) == null ? void 0 : b.value) || "",
4618
- galleryName: ((j = l.find((C) => C.key === "data-gall")) == null ? void 0 : j.value) || ""
4619
- }, forEach(v, (C) => {
4620
- has(a, `styles_attrs.${C}`) && delete a.styles_attrs[C];
4662
+ href: ((u = l.find((R) => R.key === "href")) == null ? void 0 : u.value) || "",
4663
+ hrefType: ((p = l.find((R) => R.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4664
+ autoplay: ((x = l.find((R) => R.key === "data-autoplay")) == null ? void 0 : x.value) === "true",
4665
+ maxWidth: ((g = (m = l.find((R) => R.key === "data-maxwidth")) == null ? void 0 : m.value) == null ? void 0 : g.replace("px", "")) || "",
4666
+ backdropColor: ((b = l.find((R) => R.key === "data-overlay")) == null ? void 0 : b.value) || "",
4667
+ galleryName: ((j = l.find((R) => R.key === "data-gall")) == null ? void 0 : j.value) || ""
4668
+ }, forEach(v, (R) => {
4669
+ has(a, `styles_attrs.${R}`) && delete a.styles_attrs[R];
4621
4670
  });
4622
4671
  }
4623
4672
  if (a._type === "Input") {
@@ -4627,8 +4676,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4627
4676
  const v = stringify([r]);
4628
4677
  return hasVideoEmbed(v) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(v)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = v, [a];
4629
4678
  } else if (r.tagName === "svg") {
4630
- const v = find(r.attributes, { key: "height" }), C = find(r.attributes, { key: "width" }), R = get(v, "value") ? `[${get(v, "value")}px]` : "24px", I = get(C, "value") ? `[${get(C, "value")}px]` : "24px", w = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4631
- return a.styles = `${STYLES_KEY}, ${cn(`w-${I} h-${R}`, w)}`.trim(), r.attributes = filter(r.attributes, (T) => !includes(["style", "width", "height", "class"], T.key)), a.icon = stringify([r]), [a];
4679
+ const v = find(r.attributes, { key: "height" }), R = find(r.attributes, { key: "width" }), C = get(v, "value") ? `[${get(v, "value")}px]` : "24px", I = get(R, "value") ? `[${get(R, "value")}px]` : "24px", w = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4680
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${I} h-${C}`, w)}`.trim(), r.attributes = filter(r.attributes, (T) => !includes(["style", "width", "height", "class"], T.key)), a.icon = stringify([r]), [a];
4632
4681
  } else if (r.tagName == "option" && n && ((f = n.block) == null ? void 0 : f._type) === "Select")
4633
4682
  return n.block.options.push({
4634
4683
  label: getTextContent(r.children),
@@ -4695,7 +4744,7 @@ function ExpandableObject(o) {
4695
4744
  useEffect(() => {
4696
4745
  m.current ? j(p(d, r, n)) : m.current = !0;
4697
4746
  }, [p]);
4698
- const f = g ? u.collapseIcon : u.expandIcon, v = g ? "collapse JSON" : "expand JSON", C = useComponentId(), R = d + 1, I = a.length - 1, w = (T) => {
4747
+ const f = g ? u.collapseIcon : u.expandIcon, v = g ? "collapse JSON" : "expand JSON", R = useComponentId(), C = d + 1, I = a.length - 1, w = (T) => {
4699
4748
  T.key === " " && (T.preventDefault(), b());
4700
4749
  };
4701
4750
  return /* @__PURE__ */ createElement("div", {
@@ -4709,7 +4758,7 @@ function ExpandableObject(o) {
4709
4758
  tabIndex: 0,
4710
4759
  "aria-label": v,
4711
4760
  "aria-expanded": g,
4712
- "aria-controls": g ? C : void 0
4761
+ "aria-controls": g ? R : void 0
4713
4762
  }), n && (x ? /* @__PURE__ */ createElement("span", {
4714
4763
  className: u.clickableLabel,
4715
4764
  onClick: b,
@@ -4721,14 +4770,14 @@ function ExpandableObject(o) {
4721
4770
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4722
4771
  className: u.punctuation
4723
4772
  }, i), g ? /* @__PURE__ */ createElement("div", {
4724
- id: C
4773
+ id: R
4725
4774
  }, a.map((T, k) => /* @__PURE__ */ createElement(DataRender, {
4726
4775
  key: T[0] || k,
4727
4776
  field: T[0],
4728
4777
  value: T[1],
4729
4778
  style: u,
4730
4779
  lastElement: k === I,
4731
- level: R,
4780
+ level: C,
4732
4781
  shouldExpandNode: p,
4733
4782
  clickToExpandNode: x
4734
4783
  }))) : /* @__PURE__ */ createElement("span", {
@@ -5234,7 +5283,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5234
5283
  }
5235
5284
  )
5236
5285
  ] });
5237
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-BZhjCB3h.js")), UploadImages = React__default.lazy(() => import("./UploadImages-D0cYUTgM.js")), ImagesPanel = ({
5286
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-lnZxVhFX.js")), UploadImages = React__default.lazy(() => import("./UploadImages-ybTT38Hc.js")), ImagesPanel = ({
5238
5287
  isModalView: o = !1,
5239
5288
  onSelect: n = () => {
5240
5289
  }
@@ -5329,11 +5378,11 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5329
5378
  onChange: r
5330
5379
  }) => {
5331
5380
  var _;
5332
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (S, N) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, x] = useState(!1), [m, g] = useState("pages"), [b, j] = useState(""), [f, v] = useState([]), [C, R] = useState(-1), I = useRef(null), w = (_ = n == null ? void 0 : n.find((S) => S.key === m)) == null ? void 0 : _.name;
5381
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (S, N) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, x] = useState(!1), [m, g] = useState("pages"), [b, j] = useState(""), [f, v] = useState([]), [R, C] = useState(-1), I = useRef(null), w = (_ = n == null ? void 0 : n.find((S) => S.key === m)) == null ? void 0 : _.name;
5333
5382
  useEffect(() => {
5334
5383
  if (!o || d || !startsWith(o, "collection:") || i) return;
5335
5384
  const S = split(o, ":"), N = get(S, 1, "pages") || "pages";
5336
- g(N), j(""), v([]), R(-1), (async () => {
5385
+ g(N), j(""), v([]), C(-1), (async () => {
5337
5386
  u(!0);
5338
5387
  const L = await l(N, [get(S, 2, "pages")]);
5339
5388
  L && Array.isArray(L) && j(get(L, [0, "name"], "")), c(!0), u(!1);
@@ -5347,24 +5396,24 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5347
5396
  const N = await l(m, S);
5348
5397
  v(N);
5349
5398
  }
5350
- u(!1), R(-1);
5399
+ u(!1), C(-1);
5351
5400
  },
5352
5401
  [m],
5353
5402
  300
5354
5403
  ), k = (S) => {
5355
5404
  const N = ["collection", m, S.id];
5356
- N[1] && (r(N.join(":")), j(S.name), x(!1), v([]), R(-1));
5405
+ N[1] && (r(N.join(":")), j(S.name), x(!1), v([]), C(-1));
5357
5406
  }, A = (S) => {
5358
5407
  switch (S.key) {
5359
5408
  case "ArrowDown":
5360
- S.preventDefault(), R((N) => N < f.length - 1 ? N + 1 : N);
5409
+ S.preventDefault(), C((N) => N < f.length - 1 ? N + 1 : N);
5361
5410
  break;
5362
5411
  case "ArrowUp":
5363
- S.preventDefault(), R((N) => N > 0 ? N - 1 : N);
5412
+ S.preventDefault(), C((N) => N > 0 ? N - 1 : N);
5364
5413
  break;
5365
5414
  case "Enter":
5366
5415
  if (S.preventDefault(), f.length === 0) return;
5367
- C >= 0 && k(f[C]);
5416
+ R >= 0 && k(f[R]);
5368
5417
  break;
5369
5418
  case "Escape":
5370
5419
  S.preventDefault(), B();
@@ -5372,13 +5421,13 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5372
5421
  }
5373
5422
  };
5374
5423
  useEffect(() => {
5375
- if (C >= 0 && I.current) {
5376
- const S = I.current.children[C];
5424
+ if (R >= 0 && I.current) {
5425
+ const S = I.current.children[R];
5377
5426
  S == null || S.scrollIntoView({ block: "nearest" });
5378
5427
  }
5379
- }, [C]);
5428
+ }, [R]);
5380
5429
  const B = () => {
5381
- j(""), v([]), R(-1), x(!1), r("");
5430
+ j(""), v([]), C(-1), x(!1), r("");
5382
5431
  }, E = (S) => {
5383
5432
  j(S), x(!isEmpty(S)), u(!0), T(S);
5384
5433
  };
@@ -5410,7 +5459,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5410
5459
  "li",
5411
5460
  {
5412
5461
  onClick: () => k(S),
5413
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : N === C ? "bg-gray-100" : "hover:bg-gray-100"}`,
5462
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : N === R ? "bg-gray-100" : "hover:bg-gray-100"}`,
5414
5463
  children: [
5415
5464
  S.name,
5416
5465
  " ",
@@ -5602,28 +5651,28 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5602
5651
  }), a;
5603
5652
  };
5604
5653
  function BlockSettings() {
5605
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, v, C) => {
5654
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, v, R) => {
5606
5655
  if (v && (c == null ? void 0 : c._id) === n._id) {
5607
- const R = v.replace("root.", "");
5608
- a([n._id], { [R]: get(f, R) }, C);
5656
+ const C = v.replace("root.", "");
5657
+ a([n._id], { [C]: get(f, C) }, R);
5609
5658
  }
5610
5659
  }, x = useCallback(
5611
- debounce(({ formData: f }, v, C) => {
5612
- p({ formData: f }, v, C), d(f);
5660
+ debounce(({ formData: f }, v, R) => {
5661
+ p({ formData: f }, v, R), d(f);
5613
5662
  }, 1500),
5614
5663
  [n == null ? void 0 : n._id, o]
5615
5664
  ), m = ({ formData: f }, v) => {
5616
5665
  if (v) {
5617
- const C = v.replace("root.", "");
5666
+ const R = v.replace("root.", "");
5618
5667
  r(
5619
5668
  [n._id],
5620
- convertDotNotationToObject(C, get(f, C.split(".")))
5621
- ), x({ formData: f }, v, { [C]: get(c, C) });
5669
+ convertDotNotationToObject(R, get(f, R.split(".")))
5670
+ ), x({ formData: f }, v, { [R]: get(c, R) });
5622
5671
  }
5623
5672
  }, g = keys(get(i, "_bindings", {})), b = useMemo(() => {
5624
5673
  const f = cloneDeep(get(l, "props", {}));
5625
- return each(f, (v, C) => {
5626
- get(v, "hidden", !1) && delete f[C];
5674
+ return each(f, (v, R) => {
5675
+ get(v, "hidden", !1) && delete f[R];
5627
5676
  }), u && each(g, (v) => delete f[v]), f;
5628
5677
  }, [l, g, u]), j = get(l, "server", !1);
5629
5678
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
@@ -5714,12 +5763,12 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5714
5763
  try {
5715
5764
  const f = m === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((w) => w._id === g))];
5716
5765
  set(f, "0._parent", null);
5717
- const v = u === p ? "" : u, C = await l(m, promptWithLanguage(b, x, m), f, v), { blocks: R, error: I } = C;
5766
+ const v = u === p ? "" : u, R = await l(m, promptWithLanguage(b, x, m), f, v), { blocks: C, error: I } = R;
5718
5767
  if (I) {
5719
5768
  a(I);
5720
5769
  return;
5721
5770
  }
5722
- m === "styles" ? c(R) : i(R), j && j(C);
5771
+ m === "styles" ? c(C) : i(C), j && j(R);
5723
5772
  } catch (f) {
5724
5773
  a(f);
5725
5774
  } finally {
@@ -5891,7 +5940,7 @@ function ManualClasses() {
5891
5940
  return j(map(E, "item"));
5892
5941
  }, v = () => {
5893
5942
  j([]);
5894
- }, C = (k) => k.name, R = (k) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: k.name }), I = {
5943
+ }, R = (k) => k.name, C = (k) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: k.name }), I = {
5895
5944
  autoComplete: "off",
5896
5945
  autoCorrect: "off",
5897
5946
  autoCapitalize: "off",
@@ -5945,8 +5994,8 @@ function ManualClasses() {
5945
5994
  suggestions: b,
5946
5995
  onSuggestionsFetchRequested: f,
5947
5996
  onSuggestionsClearRequested: v,
5948
- getSuggestionValue: C,
5949
- renderSuggestion: R,
5997
+ getSuggestionValue: R,
5998
+ renderSuggestion: C,
5950
5999
  inputProps: I,
5951
6000
  containerProps: {
5952
6001
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
@@ -6588,7 +6637,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6588
6637
  },
6589
6638
  a
6590
6639
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6591
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: x } = o, [m, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [b, j] = useState(!1), [f, v] = useState(""), [C, R] = useState(!1), [I, w] = useState(!1);
6640
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: x } = o, [m, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [b, j] = useState(!1), [f, v] = useState(""), [R, C] = useState(!1), [I, w] = useState(!1);
6592
6641
  useEffect(() => {
6593
6642
  const { value: E, unit: _ } = getClassValueAndUnit(i);
6594
6643
  if (_ === "") {
@@ -6639,7 +6688,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6639
6688
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
6640
6689
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6641
6690
  ] })
6642
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${C ? "z-auto" : ""}`, children: [
6691
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${R ? "z-auto" : ""}`, children: [
6643
6692
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6644
6693
  ["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6645
6694
  "input",
@@ -6669,7 +6718,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6669
6718
  var _;
6670
6719
  (_ = E == null ? void 0 : E.target) == null || _.select(), r(!1);
6671
6720
  },
6672
- value: C ? f : a,
6721
+ value: R ? f : a,
6673
6722
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6674
6723
  " ",
6675
6724
  b ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6701,12 +6750,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6701
6750
  ) }) })
6702
6751
  ] })
6703
6752
  ] }),
6704
- ["none", "auto"].indexOf(m) !== -1 || C ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6753
+ ["none", "auto"].indexOf(m) !== -1 || R ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6705
6754
  DragStyleButton,
6706
6755
  {
6707
- onDragStart: () => R(!0),
6756
+ onDragStart: () => C(!0),
6708
6757
  onDragEnd: (E) => {
6709
- if (v(() => ""), R(!1), isEmpty(E))
6758
+ if (v(() => ""), C(!1), isEmpty(E))
6710
6759
  return;
6711
6760
  const _ = `${E}`, N = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${m === "-" ? "" : m}]`;
6712
6761
  T(N);
@@ -6821,12 +6870,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6821
6870
  g(j, [E], A);
6822
6871
  },
6823
6872
  [j, u, x, p, l, g]
6824
- ), C = useCallback(() => {
6873
+ ), R = useCallback(() => {
6825
6874
  b(j, [f]);
6826
- }, [j, f, b]), R = useMemo(() => canChangeClass(m, x), [m, x]);
6875
+ }, [j, f, b]), C = useMemo(() => canChangeClass(m, x), [m, x]);
6827
6876
  useEffect(() => {
6828
- i(R, m);
6829
- }, [R, i, m]);
6877
+ i(C, m);
6878
+ }, [C, i, m]);
6830
6879
  const [, , I] = useCanvasWidth(), w = useCallback(
6831
6880
  (k) => {
6832
6881
  I({
@@ -6840,7 +6889,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6840
6889
  },
6841
6890
  [I]
6842
6891
  ), T = get(m, "dark", null) === u && get(m, "mod", null) === p && get(m, "mq", null) === x;
6843
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: R, canReset: m && T, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6892
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: m && T, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6844
6893
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${m && !T ? "text-foreground" : ""}`, children: n(a) }) }),
6845
6894
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6846
6895
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
@@ -6860,7 +6909,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6860
6909
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6861
6910
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6862
6911
  ] }),
6863
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: T ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => C(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : R && m ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6912
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: T ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => R(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && m ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6864
6913
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6865
6914
  "button",
6866
6915
  {
@@ -7153,17 +7202,17 @@ const BlockCard = ({
7153
7202
  [o]
7154
7203
  ), j = async (f) => {
7155
7204
  const v = await i(n, o);
7156
- let C = r;
7157
- if (g(first(v)) && (C = null), !isEmpty(v)) {
7158
- const R = { blocks: v, uiLibrary: !0, parent: C };
7159
- if (f.dataTransfer.setData("text/plain", JSON.stringify(R)), o.preview) {
7205
+ let R = r;
7206
+ if (g(first(v)) && (R = null), !isEmpty(v)) {
7207
+ const C = { blocks: v, uiLibrary: !0, parent: R };
7208
+ if (f.dataTransfer.setData("text/plain", JSON.stringify(C)), o.preview) {
7160
7209
  const I = new Image();
7161
7210
  I.src = o.preview, I.onload = () => {
7162
7211
  f.dataTransfer.setDragImage(I, 0, 0);
7163
7212
  };
7164
7213
  } else
7165
7214
  f.dataTransfer.setDragImage(new Image(), 0, 0);
7166
- m(R), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7215
+ m(C), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7167
7216
  u([]), p();
7168
7217
  }, 200);
7169
7218
  }
@@ -7203,9 +7252,9 @@ const BlockCard = ({
7203
7252
  })();
7204
7253
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7205
7254
  }, UILibrarySection = ({ parentId: o }) => {
7206
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((R) => R.category === "custom"), c = a.find((R) => R.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [x, m] = useState("Hero"), g = get(p, x, []), b = useRef(null), { t: j } = useTranslation(), f = (R) => {
7255
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [x, m] = useState("Hero"), g = get(p, x, []), b = useRef(null), { t: j } = useTranslation(), f = (C) => {
7207
7256
  b.current && (clearTimeout(b.current), b.current = null), b.current = setTimeout(() => {
7208
- b.current && m(R);
7257
+ b.current && m(C);
7209
7258
  }, 300);
7210
7259
  };
7211
7260
  if (u)
@@ -7213,7 +7262,7 @@ const BlockCard = ({
7213
7262
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7214
7263
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7215
7264
  ] });
7216
- const v = filter(g, (R, I) => I % 2 === 0), C = filter(g, (R, I) => I % 2 === 1);
7265
+ const v = filter(g, (C, I) => I % 2 === 0), R = filter(g, (C, I) => I % 2 === 1);
7217
7266
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
7218
7267
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7219
7268
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7221,7 +7270,7 @@ const BlockCard = ({
7221
7270
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("Groups") }),
7222
7271
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7223
7272
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7224
- map(p, (R, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7273
+ map(p, (C, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7225
7274
  "div",
7226
7275
  {
7227
7276
  onMouseEnter: () => f(I),
@@ -7249,10 +7298,10 @@ const BlockCard = ({
7249
7298
  children: [
7250
7299
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7251
7300
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7252
- v.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
7301
+ v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7253
7302
  ) }),
7254
7303
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7255
- C.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
7304
+ R.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7256
7305
  ) })
7257
7306
  ] }),
7258
7307
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8372,9 +8421,9 @@ const AIUserPrompt = ({ blockId: o }) => {
8372
8421
  }, v = (w) => {
8373
8422
  const T = a.filter((k, A) => A !== w);
8374
8423
  r(T), l(T);
8375
- }, C = (w) => {
8424
+ }, R = (w) => {
8376
8425
  x(w), c(a[w].key), u(a[w].value);
8377
- }, R = () => {
8426
+ }, C = () => {
8378
8427
  if (i.startsWith("@")) {
8379
8428
  g("Attribute keys cannot start with '@'");
8380
8429
  return;
@@ -8384,14 +8433,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8384
8433
  w[p] = { key: i, value: d }, r(w), l(w), x(null), c(""), u(""), g("");
8385
8434
  }
8386
8435
  }, I = (w) => {
8387
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? R() : f());
8436
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? C() : f());
8388
8437
  };
8389
8438
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8390
8439
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8391
8440
  "form",
8392
8441
  {
8393
8442
  onSubmit: (w) => {
8394
- w.preventDefault(), p !== null ? R() : f();
8443
+ w.preventDefault(), p !== null ? C() : f();
8395
8444
  },
8396
8445
  className: "space-y-3",
8397
8446
  children: [
@@ -8444,7 +8493,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8444
8493
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
8445
8494
  ] }),
8446
8495
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8447
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(T), children: [
8496
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => R(T), children: [
8448
8497
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8449
8498
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8450
8499
  ] }),
@@ -8880,9 +8929,9 @@ const PageDataProviders = () => {
8880
8929
  (f) => !isNull(f)
8881
8930
  ), g = (f) => {
8882
8931
  const v = find(n, { providerKey: f });
8883
- c((C) => [...C, v]), a((C) => [...C, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8932
+ c((R) => [...R, v]), a((R) => [...R, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8884
8933
  }, b = (f) => {
8885
- c((v) => filter(v, (C) => C.providerKey !== f.providerKey)), a((v) => filter(v, (C) => C.providerKey !== f.providerKey)), l("UNSAVED");
8934
+ c((v) => filter(v, (R) => R.providerKey !== f.providerKey)), a((v) => filter(v, (R) => R.providerKey !== f.providerKey)), l("UNSAVED");
8886
8935
  }, j = (f) => x(f);
8887
8936
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8888
8937
  o("You have no data providers registered. Please add a data provider to your project."),
@@ -8979,7 +9028,7 @@ const PageDataProviders = () => {
8979
9028
  function AiFillDatabase(o) {
8980
9029
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
8981
9030
  }
8982
- const TopBar = lazy(() => import("./Topbar-B6Gzawa-.js"));
9031
+ const TopBar = lazy(() => import("./Topbar-9jcE7VnL.js"));
8983
9032
  function useSidebarMenuItems(o) {
8984
9033
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8985
9034
  return useMemo(() => {