@chaibuilder/sdk 2.2.22 → 2.2.24

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
@@ -799,10 +799,10 @@ const undoRedoStateAtom = atom({
799
799
  return {
800
800
  moveBlocks: (x, y, b) => {
801
801
  const v = map(x, (w) => {
802
- const _ = r.find((N) => N._id === w)._parent || null, B = r.filter((N) => _ ? N._parent === _ : !N._parent).map((N) => N._id).indexOf(w);
803
- return { _id: w, oldParent: _, oldPosition: B };
804
- }), A = v.find(({ _id: w }) => w === x[0]);
805
- A && A.oldParent === y && A.oldPosition === b || (i(x, y, b), o({
802
+ const _ = r.find((N) => N._id === w)._parent || null, A = r.filter((N) => _ ? N._parent === _ : !N._parent).map((N) => N._id).indexOf(w);
803
+ return { _id: w, oldParent: _, oldPosition: A };
804
+ }), B = v.find(({ _id: w }) => w === x[0]);
805
+ B && B.oldParent === y && B.oldPosition === b || (i(x, y, b), o({
806
806
  undo: () => each(v, ({ _id: w, oldParent: E, oldPosition: _ }) => {
807
807
  i([w], E, _);
808
808
  }),
@@ -816,8 +816,8 @@ const undoRedoStateAtom = atom({
816
816
  });
817
817
  },
818
818
  removeBlocks: (x) => {
819
- var A;
820
- const y = (A = first(x)) == null ? void 0 : A._parent, v = r.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
819
+ var B;
820
+ const y = (B = first(x)) == null ? void 0 : B._parent, v = r.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
821
821
  l(map(x, "_id")), o({
822
822
  undo: () => a(x, y, v),
823
823
  redo: () => l(map(x, "_id"))
@@ -826,17 +826,17 @@ const undoRedoStateAtom = atom({
826
826
  updateBlocks: (x, y, b) => {
827
827
  let v = [];
828
828
  if (b)
829
- v = map(x, (A) => ({ _id: A, ...b }));
829
+ v = map(x, (B) => ({ _id: B, ...b }));
830
830
  else {
831
- const A = keys(y);
831
+ const B = keys(y);
832
832
  v = map(x, (w) => {
833
833
  const E = r.find((S) => S._id === w), _ = { _id: w };
834
- return each(A, (S) => _[S] = E[S]), _;
834
+ return each(B, (S) => _[S] = E[S]), _;
835
835
  });
836
836
  }
837
- c(map(x, (A) => ({ _id: A, ...y }))), o({
837
+ c(map(x, (B) => ({ _id: B, ...y }))), o({
838
838
  undo: () => c(v),
839
- redo: () => c(map(x, (A) => ({ _id: A, ...y })))
839
+ redo: () => c(map(x, (B) => ({ _id: B, ...y })))
840
840
  });
841
841
  },
842
842
  updateBlocksRuntime: (x, y) => {
@@ -851,8 +851,8 @@ const undoRedoStateAtom = atom({
851
851
  updateMultipleBlocksProps: (x) => {
852
852
  let y = [];
853
853
  y = map(x, (b) => {
854
- const v = keys(b), A = r.find((E) => E._id === b._id), w = {};
855
- return each(v, (E) => w[E] = A[E]), w;
854
+ const v = keys(b), B = r.find((E) => E._id === b._id), w = {};
855
+ return each(v, (E) => w[E] = B[E]), w;
856
856
  }), c(x), o({
857
857
  undo: () => c(y),
858
858
  redo: () => c(x)
@@ -2341,8 +2341,8 @@ const getBlockWithChildren = (o, r) => {
2341
2341
  for (const y in x) {
2342
2342
  const b = x[y];
2343
2343
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2344
- const { baseClasses: v, classes: A } = getSplitChaiClasses(b);
2345
- x[y] = compact(flattenDeep([v, A])).join(" ");
2344
+ const { baseClasses: v, classes: B } = getSplitChaiClasses(b);
2345
+ x[y] = compact(flattenDeep([v, B])).join(" ");
2346
2346
  } else
2347
2347
  y !== "_id" && delete x[y];
2348
2348
  }
@@ -2354,21 +2354,21 @@ const getBlockWithChildren = (o, r) => {
2354
2354
  if (l) {
2355
2355
  r(!0), a(null);
2356
2356
  try {
2357
- const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)], A = await l(h, addLangToPrompt(x, m, h), v, b), { blocks: w, error: E } = A;
2357
+ const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [g(f, d)], B = await l(h, addLangToPrompt(x, m, h), v, b), { blocks: w, error: E } = B;
2358
2358
  if (E) {
2359
2359
  a(E);
2360
2360
  return;
2361
2361
  }
2362
2362
  if (h === "styles") {
2363
2363
  const _ = w.map((S) => {
2364
- for (const B in S)
2365
- B !== "_id" && (S[B] = `${STYLES_KEY},${S[B]}`);
2364
+ for (const A in S)
2365
+ A !== "_id" && (S[A] = `${STYLES_KEY},${S[A]}`);
2366
2366
  return S;
2367
2367
  });
2368
2368
  c(_);
2369
2369
  } else
2370
2370
  i(w);
2371
- y && y(A);
2371
+ y && y(B);
2372
2372
  } catch (b) {
2373
2373
  a(b);
2374
2374
  } finally {
@@ -3213,7 +3213,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3213
3213
  return /* @__PURE__ */ jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3214
3214
  }, MayBeAsyncPropsWrapper = ({ children: o, block: r }) => {
3215
3215
  const n = useMemo(() => getRegisteredChaiBlock(r._type), [r._type]), a = has(n, "dataProviderDependencies"), l = get(n, "dataProvider"), i = useAsyncProps(
3216
- a ? r : void 0,
3216
+ a || l ? r : void 0,
3217
3217
  get(n, "dataProviderDependencies"),
3218
3218
  l ?? void 0
3219
3219
  );
@@ -3493,16 +3493,16 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3493
3493
  var C;
3494
3494
  const _ = o._type;
3495
3495
  let S = o[n];
3496
- const B = getRegisteredChaiBlock(o._type);
3497
- return g && ((C = B == null ? void 0 : B.i18nProps) == null ? void 0 : C.includes(n)) && has(o, `${n}-${g}`) && (S = get(o, `${n}-${g}`)), { blockContent: S, blockType: _ };
3496
+ const A = getRegisteredChaiBlock(o._type);
3497
+ return g && ((C = A == null ? void 0 : A.i18nProps) == null ? void 0 : C.includes(n)) && has(o, `${n}-${g}`) && (S = get(o, `${n}-${g}`)), { blockContent: S, blockType: _ };
3498
3498
  }, [o, g]), v = useCallback(
3499
3499
  (_) => {
3500
- var B;
3501
- const S = _ || ((B = p.current) == null ? void 0 : B.innerText);
3500
+ var A;
3501
+ const S = _ || ((A = p.current) == null ? void 0 : A.innerText);
3502
3502
  m([x], { [n]: S }), d(null), i(null), h([]);
3503
3503
  },
3504
3504
  [x, m, i, h, g]
3505
- ), A = useDebouncedCallback(
3505
+ ), B = useDebouncedCallback(
3506
3506
  (_) => {
3507
3507
  m([x], { [n]: _ });
3508
3508
  },
@@ -3528,7 +3528,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3528
3528
  {
3529
3529
  blockContent: y,
3530
3530
  editingElement: c,
3531
- onChange: A,
3531
+ onChange: B,
3532
3532
  onClose: v,
3533
3533
  onEscape: w
3534
3534
  }
@@ -3539,7 +3539,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3539
3539
  blockContent: y,
3540
3540
  editingElement: c,
3541
3541
  onClose: v,
3542
- onChange: A,
3542
+ onChange: B,
3543
3543
  onEscape: w
3544
3544
  }
3545
3545
  )) : null, [c, x, b, y, v, g]);
@@ -3586,7 +3586,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3586
3586
  ), b = useMemo(() => getBlockTagAttributes(l), [l, getBlockTagAttributes]), v = useMemo(
3587
3587
  () => p(l._id, getBlockRuntimeProps(l._type)),
3588
3588
  [l._id, l._type, p, getBlockRuntimeProps]
3589
- ), A = useMemo(
3589
+ ), B = useMemo(
3590
3590
  () => ({
3591
3591
  blockProps: { "data-block-id": l._id, "data-block-type": l._type },
3592
3592
  inBuilder: !0,
@@ -3609,7 +3609,7 @@ const ChaiFrame = React__default.forwardRef((o, r) => /* @__PURE__ */ jsx(Frame,
3609
3609
  ), w = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]);
3610
3610
  if (isNull(h) || m.includes(l._id)) return null;
3611
3611
  let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
3612
- ...A,
3612
+ ...B,
3613
3613
  children: n({
3614
3614
  _id: l._id,
3615
3615
  _type: l._type,
@@ -4057,11 +4057,11 @@ const DataBindingSelector = ({
4057
4057
  r(`{{${m}}}`, {}, n);
4058
4058
  return;
4059
4059
  }
4060
- const h = (b) => /[.,!?;:]/.test(b), f = (b, v, A) => {
4060
+ const h = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4061
4061
  let w = "", E = "";
4062
4062
  const _ = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
4063
4063
  return v > 0 && (_ === "." || !h(_) && _ !== " ") && (w = " "), v < b.length && !h(S) && S !== " " && (E = " "), {
4064
- text: w + A + E,
4064
+ text: w + B + E,
4065
4065
  prefixLength: w.length,
4066
4066
  suffixLength: E.length
4067
4067
  };
@@ -4073,13 +4073,13 @@ const DataBindingSelector = ({
4073
4073
  if (b) {
4074
4074
  const v = `{{${m}}}`;
4075
4075
  b.commands.focus();
4076
- const { from: A, to: w } = b.state.selection;
4077
- if (A !== w)
4076
+ const { from: B, to: w } = b.state.selection;
4077
+ if (B !== w)
4078
4078
  b.chain().deleteSelection().insertContent(v).run();
4079
4079
  else {
4080
- const { state: _ } = b, S = _.selection.from, B = _.doc.textBetween(Math.max(0, S - 1), S), N = _.doc.textBetween(S, Math.min(S + 1, _.doc.content.size));
4080
+ const { state: _ } = b, S = _.selection.from, A = _.doc.textBetween(Math.max(0, S - 1), S), N = _.doc.textBetween(S, Math.min(S + 1, _.doc.content.size));
4081
4081
  let C = "";
4082
- S > 0 && B !== " " && !h(B) && (C = " ");
4082
+ S > 0 && A !== " " && !h(A) && (C = " ");
4083
4083
  let k = "";
4084
4084
  N && N !== " " && !h(N) && (k = " "), b.chain().insertContent(C + v + k).run();
4085
4085
  }
@@ -4087,14 +4087,14 @@ const DataBindingSelector = ({
4087
4087
  return;
4088
4088
  }
4089
4089
  } else {
4090
- const b = x, v = b.selectionStart || 0, A = b.value || "", w = b.selectionEnd || v;
4090
+ const b = x, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
4091
4091
  if (w > v) {
4092
- const N = `{{${m}}}`, { text: C } = f(A, v, N), k = A.slice(0, v) + C + A.slice(w);
4092
+ const N = `{{${m}}}`, { text: C } = f(B, v, N), k = B.slice(0, v) + C + B.slice(w);
4093
4093
  r(k, {}, n);
4094
4094
  return;
4095
4095
  }
4096
- const _ = `{{${m}}}`, { text: S } = f(A, v, _), B = A.slice(0, v) + S + A.slice(v);
4097
- r(B, {}, n);
4096
+ const _ = `{{${m}}}`, { text: S } = f(B, v, _), A = B.slice(0, v) + S + B.slice(v);
4097
+ r(A, {}, n);
4098
4098
  }
4099
4099
  },
4100
4100
  [n, r, a, c == null ? void 0 : c._id, d]
@@ -4116,7 +4116,7 @@ const DataBindingSelector = ({
4116
4116
  onChange: n
4117
4117
  }) => {
4118
4118
  var N;
4119
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [g, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), A = (N = r == null ? void 0 : r.find((C) => C.key === u)) == null ? void 0 : N.name;
4119
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, m] = useState("page"), [g, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = r == null ? void 0 : r.find((C) => C.key === u)) == null ? void 0 : N.name;
4120
4120
  useEffect(() => {
4121
4121
  if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4122
4122
  const C = split(o, ":"), k = get(C, 1, "page") || "page";
@@ -4165,7 +4165,7 @@ const DataBindingSelector = ({
4165
4165
  }, [y]);
4166
4166
  const S = () => {
4167
4167
  h(""), x([]), b(-1), p(!1), n("");
4168
- }, B = (C) => {
4168
+ }, A = (C) => {
4169
4169
  h(C), p(!isEmpty(C)), c(!0), w(C);
4170
4170
  };
4171
4171
  return /* @__PURE__ */ jsxs("div", { children: [
@@ -4176,9 +4176,9 @@ const DataBindingSelector = ({
4176
4176
  {
4177
4177
  type: "text",
4178
4178
  value: g,
4179
- onChange: (C) => B(C.target.value),
4179
+ onChange: (C) => A(C.target.value),
4180
4180
  onKeyDown: _,
4181
- placeholder: a(`Search ${A ?? ""}`),
4181
+ placeholder: a(`Search ${B ?? ""}`),
4182
4182
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4183
4183
  }
4184
4184
  ),
@@ -4511,9 +4511,9 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4511
4511
  if (f !== x)
4512
4512
  u.chain().deleteSelection().insertContent(h).run();
4513
4513
  else {
4514
- const { state: b } = u, v = b.selection.from, A = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
4514
+ const { state: b } = u, v = b.selection.from, B = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
4515
4515
  let E = "";
4516
- v > 0 && A !== " " && !/[.,!?;:]/.test(A) && (E = " ");
4516
+ v > 0 && B !== " " && !/[.,!?;:]/.test(B) && (E = " ");
4517
4517
  let _ = "";
4518
4518
  w && w !== " " && !/[.,!?;:]/.test(w) && (_ = " "), u.chain().insertContent(E + h + _).run();
4519
4519
  }
@@ -4816,9 +4816,9 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4816
4816
  const { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
4817
4817
  () => isEmpty(x) ? "" : isEmpty(h) ? f : h,
4818
4818
  [x, h, f]
4819
- ), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), A = useSelectedBlock(), w = useRegisteredChaiBlocks(), E = useMemo(
4820
- () => get(w, [A == null ? void 0 : A._type, "i18nProps"], []),
4821
- [w, A == null ? void 0 : A._type]
4819
+ ), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), E = useMemo(
4820
+ () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4821
+ [w, B == null ? void 0 : B._type]
4822
4822
  ), [_, S] = useState(null);
4823
4823
  if (d)
4824
4824
  return null;
@@ -4940,31 +4940,36 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4940
4940
  }), a;
4941
4941
  };
4942
4942
  function BlockSettings() {
4943
- const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), m = useWrapperBlock(), g = getRegisteredChaiBlock(m == null ? void 0 : m._type), h = formDataWithSelectedLang(m, o, g), f = ({ formData: _ }, S, B) => {
4944
- S && (c == null ? void 0 : c._id) === r._id && a([r._id], { [S]: get(_, S) }, B);
4943
+ const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), m = useWrapperBlock(), g = getRegisteredChaiBlock(m == null ? void 0 : m._type), h = formDataWithSelectedLang(m, o, g), f = ({ formData: _ }, S, A) => {
4944
+ S && (c == null ? void 0 : c._id) === r._id && a([r._id], { [S]: get(_, S) }, A);
4945
4945
  }, x = useCallback(
4946
- debounce(({ formData: _ }, S, B) => {
4947
- f({ formData: _ }, S, B), d(_);
4946
+ debounce(({ formData: _ }, S, A) => {
4947
+ f({ formData: _ }, S, A), d(_);
4948
4948
  }, 1500),
4949
4949
  [r == null ? void 0 : r._id, o]
4950
4950
  ), y = ({ formData: _ }, S) => {
4951
4951
  S && (n([r._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(c, S) }));
4952
4952
  }, b = ({ formData: _ }, S) => {
4953
4953
  S && (n([m._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(c, S) }));
4954
- }, { schema: v, uiSchema: A } = useMemo(() => {
4954
+ }, { schema: v, uiSchema: B } = useMemo(() => {
4955
4955
  const _ = r == null ? void 0 : r._type;
4956
4956
  if (!_)
4957
4957
  return { schema: {}, uiSchema: {} };
4958
4958
  try {
4959
- return getBlockFormSchemas(_);
4959
+ const { schema: S, uiSchema: A } = getBlockFormSchemas(_);
4960
+ if (_ === "Repeater") {
4961
+ const N = get(r, "repeaterItems", "");
4962
+ startsWith(N, `{{${COLLECTION_PREFIX}`) ? (set(A, "filter", { "ui:widget": "collectionSelect" }), set(A, "sort", { "ui:widget": "collectionSelect" })) : (set(A, "filter", { "ui:widget": "hidden" }), set(A, "sort", { "ui:widget": "hidden" }));
4963
+ }
4964
+ return { schema: S, uiSchema: A };
4960
4965
  } catch {
4961
4966
  return { schema: {}, uiSchema: {} };
4962
4967
  }
4963
4968
  }, [r]), { wrapperSchema: w, wrapperUiSchema: E } = useMemo(() => {
4964
4969
  if (!m || !(m != null && m._type))
4965
4970
  return { wrapperSchema: {}, wrapperUiSchema: {} };
4966
- const _ = m == null ? void 0 : m._type, { schema: S = {}, uiSchema: B = {} } = getBlockFormSchemas(_);
4967
- return { wrapperSchema: S, wrapperUiSchema: B };
4971
+ const _ = m == null ? void 0 : m._type, { schema: S = {}, uiSchema: A = {} } = getBlockFormSchemas(_);
4972
+ return { wrapperSchema: S, wrapperUiSchema: A };
4968
4973
  }, [m]);
4969
4974
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
4970
4975
  !isEmpty(m) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
@@ -5004,7 +5009,7 @@ function BlockSettings() {
5004
5009
  onChange: y,
5005
5010
  formData: i,
5006
5011
  schema: v,
5007
- uiSchema: A
5012
+ uiSchema: B
5008
5013
  }
5009
5014
  )
5010
5015
  ] });
@@ -5181,7 +5186,7 @@ const BlockStylingProps = () => {
5181
5186
  },
5182
5187
  a
5183
5188
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5184
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [g, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, A] = useState(!1), [w, E] = useState(!1);
5189
+ const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: m } = o, [g, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, E] = useState(!1);
5185
5190
  useEffect(() => {
5186
5191
  const { value: C, unit: k } = getClassValueAndUnit(i);
5187
5192
  if (k === "") {
@@ -5190,7 +5195,7 @@ const BlockStylingProps = () => {
5190
5195
  }
5191
5196
  h(k), l(k === "class" || isEmpty(C) ? "" : C);
5192
5197
  }, [i, p, u]);
5193
- const _ = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), B = useCallback(
5198
+ const _ = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), A = useCallback(
5194
5199
  (C = !1) => {
5195
5200
  const k = getUserInputValues(`${a}`, u);
5196
5201
  if (get(k, "error", !1)) {
@@ -5246,7 +5251,7 @@ const BlockStylingProps = () => {
5246
5251
  {
5247
5252
  readOnly: g === "class",
5248
5253
  onKeyPress: (C) => {
5249
- C.key === "Enter" && B();
5254
+ C.key === "Enter" && A();
5250
5255
  },
5251
5256
  onKeyDown: (C) => {
5252
5257
  if (C.keyCode !== 38 && C.keyCode !== 40)
@@ -5261,7 +5266,7 @@ const BlockStylingProps = () => {
5261
5266
  onKeyUp: (C) => {
5262
5267
  w && (C.preventDefault(), E(!1));
5263
5268
  },
5264
- onBlur: () => B(),
5269
+ onBlur: () => A(),
5265
5270
  onChange: (C) => {
5266
5271
  x(!1), l(C.target.value);
5267
5272
  },
@@ -5304,9 +5309,9 @@ const BlockStylingProps = () => {
5304
5309
  ["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsx(
5305
5310
  DragStyleButton,
5306
5311
  {
5307
- onDragStart: () => A(!0),
5312
+ onDragStart: () => B(!0),
5308
5313
  onDragEnd: (C) => {
5309
- if (b(() => ""), A(!1), isEmpty(C))
5314
+ if (b(() => ""), B(!1), isEmpty(C))
5310
5315
  return;
5311
5316
  const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${g === "-" ? "" : g}]`;
5312
5317
  _(T);
@@ -5780,19 +5785,19 @@ const COLOR_PROP = {
5780
5785
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5781
5786
  const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
5782
5787
  }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, m] = useScreenSizeWidth(), g = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(g, "fullCls", ""), [g]), b = useCallback(
5783
- (S, B = !0) => {
5788
+ (S, A = !0) => {
5784
5789
  const N = { dark: p, mq: m, mod: u, cls: S, property: l, fullCls: "" };
5785
5790
  (p || u !== "") && (N.mq = "xs");
5786
5791
  const C = generateFullClsName(N);
5787
- h(x, [C], B);
5792
+ h(x, [C], A);
5788
5793
  },
5789
5794
  [x, p, m, u, l, h]
5790
5795
  ), v = useCallback(() => {
5791
5796
  f(x, [y], !0);
5792
- }, [x, y, f]), A = useMemo(() => canChangeClass(g, m), [g, m]);
5797
+ }, [x, y, f]), B = useMemo(() => canChangeClass(g, m), [g, m]);
5793
5798
  useEffect(() => {
5794
- i(A, g);
5795
- }, [A, i, g]);
5799
+ i(B, g);
5800
+ }, [B, i, g]);
5796
5801
  const [, , w] = useScreenSizeWidth(), E = useCallback(
5797
5802
  (S) => {
5798
5803
  w({
@@ -5806,7 +5811,7 @@ const COLOR_PROP = {
5806
5811
  },
5807
5812
  [w]
5808
5813
  ), _ = get(g, "dark", null) === p && get(g, "mod", null) === u && get(g, "mq", null) === m;
5809
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: A, canReset: g && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5814
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: g && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5810
5815
  /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: r(a) }) }),
5811
5816
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
5812
5817
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
@@ -5826,7 +5831,7 @@ const COLOR_PROP = {
5826
5831
  n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
5827
5832
  n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
5828
5833
  ] }),
5829
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : A && g ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5834
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && g ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5830
5835
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5831
5836
  "button",
5832
5837
  {
@@ -6227,7 +6232,7 @@ const AskAIStyles = ({ blockId: o }) => {
6227
6232
  };
6228
6233
  function ManualClasses() {
6229
6234
  var T;
6230
- const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((I) => !isEmpty(I)), A = () => {
6235
+ const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [g] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((I) => !isEmpty(I)), B = () => {
6231
6236
  const I = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6232
6237
  u(g, I, !0), x("");
6233
6238
  }, [w, E] = useState([]), _ = ({ value: I }) => {
@@ -6244,7 +6249,7 @@ function ManualClasses() {
6244
6249
  return E(map(D, "item"));
6245
6250
  }, S = () => {
6246
6251
  E([]);
6247
- }, B = (I) => I.name, N = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), C = useMemo(
6252
+ }, A = (I) => I.name, N = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), C = useMemo(
6248
6253
  () => ({
6249
6254
  ref: o,
6250
6255
  autoComplete: "off",
@@ -6259,7 +6264,7 @@ function ManualClasses() {
6259
6264
  }, 0);
6260
6265
  },
6261
6266
  onKeyDown: (I) => {
6262
- I.key === "Enter" && f.trim() !== "" && A();
6267
+ I.key === "Enter" && f.trim() !== "" && B();
6263
6268
  },
6264
6269
  onChange: (I, { newValue: P }) => x(P),
6265
6270
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
@@ -6300,7 +6305,7 @@ function ManualClasses() {
6300
6305
  suggestions: w,
6301
6306
  onSuggestionsFetchRequested: _,
6302
6307
  onSuggestionsClearRequested: S,
6303
- getSuggestionValue: B,
6308
+ getSuggestionValue: A,
6304
6309
  renderSuggestion: N,
6305
6310
  inputProps: C,
6306
6311
  containerProps: {
@@ -6318,7 +6323,7 @@ function ManualClasses() {
6318
6323
  {
6319
6324
  variant: "outline",
6320
6325
  className: "h-6 border-border",
6321
- onClick: A,
6326
+ onClick: B,
6322
6327
  disabled: f.trim() === "",
6323
6328
  size: "sm",
6324
6329
  children: /* @__PURE__ */ jsx(PlusIcon, {})
@@ -6743,7 +6748,7 @@ const CoreBlock = ({
6743
6748
  }
6744
6749
  }
6745
6750
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
6746
- var g, h, f, x, y, b, v, A;
6751
+ var g, h, f, x, y, b, v, B;
6747
6752
  if (n.type === "comment") return [];
6748
6753
  console.log("node ===>", n);
6749
6754
  let a = { _id: generateUUID() };
@@ -6806,8 +6811,8 @@ const CoreBlock = ({
6806
6811
  const _ = find(E.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg");
6807
6812
  if (_) {
6808
6813
  a.icon = stringify([_]);
6809
- const { height: S, width: B } = getSvgDimensions(_, "16px", "16px");
6810
- a.iconHeight = S, a.iconWidth = B;
6814
+ const { height: S, width: A } = getSvgDimensions(_, "16px", "16px");
6815
+ a.iconHeight = S, a.iconWidth = A;
6811
6816
  }
6812
6817
  }
6813
6818
  return [a];
@@ -6819,9 +6824,9 @@ const CoreBlock = ({
6819
6824
  const w = stringify([n]);
6820
6825
  return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
6821
6826
  } else if (n.tagName === "svg") {
6822
- const w = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", B = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
6823
- return a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${_}`, B)}`.trim(), n.attributes = filter(n.attributes, (N) => !includes(["style", "width", "height", "class"], N.key)), a.icon = stringify([n]), [a];
6824
- } else if (n.tagName == "option" && r && ((A = r.block) == null ? void 0 : A._type) === "Select")
6827
+ const w = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", A = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
6828
+ return a.styles = `${STYLES_KEY}, ${cn$2(`w-${S} h-${_}`, A)}`.trim(), n.attributes = filter(n.attributes, (N) => !includes(["style", "width", "height", "class"], N.key)), a.icon = stringify([n]), [a];
6829
+ } else if (n.tagName == "option" && r && ((B = r.block) == null ? void 0 : B._type) === "Select")
6825
6830
  return r.block.options.push({
6826
6831
  label: getTextContent(n.children),
6827
6832
  ...getAttrs(n)
@@ -6925,12 +6930,12 @@ const BlockCard = ({
6925
6930
  parentId: n = void 0,
6926
6931
  position: a = -1
6927
6932
  }) => {
6928
- const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (A) => {
6929
- const w = has(A, "styles_attrs.data-page-section");
6930
- return A._type === "Box" && w;
6933
+ const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (B) => {
6934
+ const w = has(B, "styles_attrs.data-page-section");
6935
+ return B._type === "Box" && w;
6931
6936
  }, b = useCallback(
6932
- async (A) => {
6933
- if (A.stopPropagation(), has(o, "component")) {
6937
+ async (B) => {
6938
+ if (B.stopPropagation(), has(o, "component")) {
6934
6939
  d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6935
6940
  return;
6936
6941
  }
@@ -6947,18 +6952,18 @@ const BlockCard = ({
6947
6952
  onClick: l ? () => {
6948
6953
  } : b,
6949
6954
  draggable: f ? "true" : "false",
6950
- onDragStart: async (A) => {
6955
+ onDragStart: async (B) => {
6951
6956
  const w = await c(r, o);
6952
6957
  let E = n;
6953
6958
  if (y(first(w)) && (E = null), !isEmpty(w)) {
6954
6959
  const _ = { blocks: w, uiLibrary: !0, parent: E };
6955
- if (A.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
6960
+ if (B.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
6956
6961
  const S = new Image();
6957
6962
  S.src = o.preview, S.onload = () => {
6958
- A.dataTransfer.setDragImage(S, 0, 0);
6963
+ B.dataTransfer.setDragImage(S, 0, 0);
6959
6964
  };
6960
6965
  } else
6961
- A.dataTransfer.setDragImage(new Image(), 0, 0);
6966
+ B.dataTransfer.setDragImage(new Image(), 0, 0);
6962
6967
  x(_), setTimeout(() => {
6963
6968
  u([]), m(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6964
6969
  }, 200);
@@ -7011,13 +7016,13 @@ const BlockCard = ({
7011
7016
  return;
7012
7017
  }
7013
7018
  }, [y, b]);
7014
- const A = get(y, b, []), w = useRef(null), { t: E } = useTranslation(), _ = (k) => {
7019
+ const B = get(y, b, []), w = useRef(null), { t: E } = useTranslation(), _ = (k) => {
7015
7020
  w.current && (clearTimeout(w.current), w.current = null), w.current = setTimeout(() => {
7016
7021
  w.current && v(k);
7017
7022
  }, 400);
7018
7023
  }, S = () => {
7019
7024
  i != null && i.id && p(i.id);
7020
- }, B = () => {
7025
+ }, A = () => {
7021
7026
  m("");
7022
7027
  };
7023
7028
  if (d)
@@ -7025,7 +7030,7 @@ const BlockCard = ({
7025
7030
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
7026
7031
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
7027
7032
  ] });
7028
- const N = filter(A, (k, j) => j % 2 === 0), C = filter(A, (k, j) => j % 2 === 1);
7033
+ const N = filter(B, (k, j) => j % 2 === 0), C = filter(B, (k, j) => j % 2 === 1);
7029
7034
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
7030
7035
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
7031
7036
  /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
@@ -7041,7 +7046,7 @@ const BlockCard = ({
7041
7046
  u && /* @__PURE__ */ jsx(
7042
7047
  "button",
7043
7048
  {
7044
- onClick: B,
7049
+ onClick: A,
7045
7050
  className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
7046
7051
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
7047
7052
  }
@@ -7085,7 +7090,7 @@ const BlockCard = ({
7085
7090
  onMouseEnter: () => w.current ? clearTimeout(w.current) : null,
7086
7091
  className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
7087
7092
  children: [
7088
- isEmpty(A) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: E("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
7093
+ isEmpty(B) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: E("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
7089
7094
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: N.map((k, j) => /* @__PURE__ */ jsx(
7090
7095
  BlockCard,
7091
7096
  {
@@ -7141,14 +7146,14 @@ const BlockCard = ({
7141
7146
  }), m(!0);
7142
7147
  else if (!l && Object.keys(a || {}).length > 0) {
7143
7148
  const h = Object.entries(a).map(([x, y]) => {
7144
- const b = y, v = b.type || "partial", A = formatReadableName(v);
7149
+ const b = y, v = b.type || "partial", B = formatReadableName(v);
7145
7150
  return {
7146
7151
  type: "PartialBlock",
7147
7152
  // Set the type to PartialBlock
7148
7153
  label: formatReadableName(b.name || x),
7149
7154
  description: b.description || "",
7150
7155
  icon: Globe,
7151
- group: A,
7156
+ group: B,
7152
7157
  // Use formatted type as group
7153
7158
  category: "partial",
7154
7159
  partialBlockId: x,
@@ -7220,7 +7225,7 @@ const BlockCard = ({
7220
7225
  }), []);
7221
7226
  const v = useCallback((k) => {
7222
7227
  y(k), b.current && b.current(k);
7223
- }, []), A = useCallback(() => {
7228
+ }, []), B = useCallback(() => {
7224
7229
  y(null), b.current && b.current.cancel();
7225
7230
  }, []), w = useCallback((k) => {
7226
7231
  b.current && b.current.cancel(), f(k), y(null);
@@ -7240,7 +7245,7 @@ const BlockCard = ({
7240
7245
  ), S = useMemo(
7241
7246
  () => sortBy(_, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
7242
7247
  [_]
7243
- ), B = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
7248
+ ), A = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
7244
7249
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7245
7250
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7246
7251
  Input$1,
@@ -7260,7 +7265,7 @@ const BlockCard = ({
7260
7265
  {
7261
7266
  onClick: () => w("all"),
7262
7267
  onMouseEnter: () => v("all"),
7263
- onMouseLeave: A,
7268
+ onMouseLeave: B,
7264
7269
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7265
7270
  children: i("All")
7266
7271
  },
@@ -7271,7 +7276,7 @@ const BlockCard = ({
7271
7276
  {
7272
7277
  onClick: () => w(k),
7273
7278
  onMouseEnter: () => v(k),
7274
- onMouseLeave: A,
7279
+ onMouseLeave: B,
7275
7280
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7276
7281
  children: capitalize(i(k.toLowerCase()))
7277
7282
  },
@@ -7286,7 +7291,7 @@ const BlockCard = ({
7286
7291
  ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: N.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7287
7292
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
7288
7293
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7289
- h === "all" ? filter(values(B), { group: k }) : values(B),
7294
+ h === "all" ? filter(values(A), { group: k }) : values(A),
7290
7295
  { hidden: !0 }
7291
7296
  ).map((j) => /* @__PURE__ */ jsx(
7292
7297
  CoreBlock,
@@ -7648,19 +7653,19 @@ const Input = ({ node: o }) => {
7648
7653
  var P;
7649
7654
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7650
7655
  let p = null;
7651
- const u = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: A } = o, w = (L) => {
7656
+ const u = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (L) => {
7652
7657
  L.stopPropagation(), !l.includes(h) && o.toggle();
7653
7658
  }, E = (L) => {
7654
7659
  L.isInternal && (p = L.isOpen, L.isOpen && L.close());
7655
7660
  }, _ = (L) => {
7656
7661
  L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
7657
- }, [S, B] = useAtom$1(currentAddSelection), N = () => {
7662
+ }, [S, A] = useAtom$1(currentAddSelection), N = () => {
7658
7663
  var L;
7659
- C(), o.parent.isSelected || B((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
7664
+ C(), o.parent.isSelected || A((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
7660
7665
  }, C = () => {
7661
- B(null);
7666
+ A(null);
7662
7667
  }, k = (L) => {
7663
- C(), L.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), A(L);
7668
+ C(), L.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(L);
7664
7669
  };
7665
7670
  useEffect(() => {
7666
7671
  const L = setTimeout(() => {
@@ -8070,19 +8075,19 @@ const Input = ({ node: o }) => {
8070
8075
  const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: m } = useTranslation(), g = (v) => {
8071
8076
  a(v);
8072
8077
  }, h = () => {
8073
- const v = l.find((A) => Object.keys(A)[0] === n);
8078
+ const v = l.find((B) => Object.keys(B)[0] === n);
8074
8079
  if (v) {
8075
- const A = Object.values(v)[0];
8076
- A && typeof A == "object" && "fontFamily" in A && "borderRadius" in A && "colors" in A ? p(A) : console.error("Invalid preset structure:", A);
8080
+ const B = Object.values(v)[0];
8081
+ B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
8077
8082
  } else
8078
8083
  console.error("Preset not found:", n);
8079
8084
  }, f = useDebouncedCallback(
8080
- (v, A) => {
8085
+ (v, B) => {
8081
8086
  p(() => ({
8082
8087
  ...d,
8083
8088
  fontFamily: {
8084
8089
  ...d.fontFamily,
8085
- [v.replace(/font-/g, "")]: A
8090
+ [v.replace(/font-/g, "")]: B
8086
8091
  }
8087
8092
  }));
8088
8093
  },
@@ -8098,10 +8103,10 @@ const Input = ({ node: o }) => {
8098
8103
  [d],
8099
8104
  200
8100
8105
  ), y = useDebouncedCallback(
8101
- (v, A) => {
8106
+ (v, B) => {
8102
8107
  p(() => {
8103
8108
  const w = get(d, `colors.${v}`);
8104
- return r ? set(w, 1, A) : set(w, 0, A), {
8109
+ return r ? set(w, 1, B) : set(w, 0, B), {
8105
8110
  ...d,
8106
8111
  colors: {
8107
8112
  ...d.colors,
@@ -8112,18 +8117,18 @@ const Input = ({ node: o }) => {
8112
8117
  },
8113
8118
  [d],
8114
8119
  200
8115
- ), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([A]) => {
8116
- const w = get(d, `colors.${A}.${r ? 1 : 0}`);
8120
+ ), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([B]) => {
8121
+ const w = get(d, `colors.${B}.${r ? 1 : 0}`);
8117
8122
  return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
8118
8123
  /* @__PURE__ */ jsx(
8119
8124
  ColorPickerInput,
8120
8125
  {
8121
8126
  value: w,
8122
- onChange: (E) => y(A, E)
8127
+ onChange: (E) => y(B, E)
8123
8128
  }
8124
8129
  ),
8125
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: A.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!A.toLowerCase().includes("foreground") && !A.toLowerCase().includes("border") && !A.toLowerCase().includes("input") && !A.toLowerCase().includes("ring") && !A.toLowerCase().includes("background") ? " Background" : "") })
8126
- ] }, A);
8130
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: B.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!B.toLowerCase().includes("foreground") && !B.toLowerCase().includes("border") && !B.toLowerCase().includes("input") && !B.toLowerCase().includes("ring") && !B.toLowerCase().includes("background") ? " Background" : "") })
8131
+ ] }, B);
8127
8132
  }) });
8128
8133
  return c("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
8129
8134
  /* @__PURE__ */ jsxs("div", { className: cn$2("no-scrollbar h-full w-full overflow-y-auto", o), children: [
@@ -8155,11 +8160,11 @@ const Input = ({ node: o }) => {
8155
8160
  ) })
8156
8161
  ] }),
8157
8162
  /* @__PURE__ */ jsxs("div", { className: cn$2("space-y-2", o), children: [
8158
- (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v, A]) => /* @__PURE__ */ jsx(
8163
+ (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v, B]) => /* @__PURE__ */ jsx(
8159
8164
  FontSelector,
8160
8165
  {
8161
8166
  label: v,
8162
- value: d.fontFamily[v.replace(/font-/g, "")] || A[Object.keys(A)[0]],
8167
+ value: d.fontFamily[v.replace(/font-/g, "")] || B[Object.keys(B)[0]],
8163
8168
  onChange: (w) => f(v, w)
8164
8169
  },
8165
8170
  v
@@ -8879,13 +8884,13 @@ function AIChatPanel() {
8879
8884
  content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
8880
8885
  timestamp: /* @__PURE__ */ new Date()
8881
8886
  };
8882
- r((A) => [...A, v]), i(!1), d(null);
8887
+ r((B) => [...B, v]), i(!1), d(null);
8883
8888
  }, 1500);
8884
8889
  }, h = (b) => {
8885
8890
  b.key === "Enter" && !b.shiftKey && (b.preventDefault(), g());
8886
8891
  }, f = (b) => {
8887
- var A;
8888
- const v = (A = b.target.files) == null ? void 0 : A[0];
8892
+ var B;
8893
+ const v = (B = b.target.files) == null ? void 0 : B[0];
8889
8894
  if (v) {
8890
8895
  const w = new FileReader();
8891
8896
  w.onload = (E) => {
@@ -9099,9 +9104,9 @@ const AiAssistant = () => {
9099
9104
  n(S), l(a), c(""), p(""), h("");
9100
9105
  }
9101
9106
  }, v = (S) => {
9102
- const B = a.filter((N, C) => C !== S);
9103
- n(B), l(B);
9104
- }, A = (S) => {
9107
+ const A = a.filter((N, C) => C !== S);
9108
+ n(A), l(A);
9109
+ }, B = (S) => {
9105
9110
  m(S), c(a[S].key), p(a[S].value);
9106
9111
  }, w = () => {
9107
9112
  if (i.startsWith("@")) {
@@ -9115,10 +9120,10 @@ const AiAssistant = () => {
9115
9120
  }, E = (S) => {
9116
9121
  S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
9117
9122
  }, _ = useCallback((S) => {
9118
- const B = (k) => /[.,!?;:]/.test(k), N = (k, j, T) => {
9123
+ const A = (k) => /[.,!?;:]/.test(k), N = (k, j, T) => {
9119
9124
  let I = "", P = "";
9120
9125
  const L = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
9121
- return j > 0 && (L === "." || !B(L) && L !== " ") && (I = " "), j < k.length && !B(D) && D !== " " && (P = " "), {
9126
+ return j > 0 && (L === "." || !A(L) && L !== " ") && (I = " "), j < k.length && !A(D) && D !== " " && (P = " "), {
9122
9127
  text: I + T + P,
9123
9128
  prefixLength: I.length,
9124
9129
  suffixLength: P.length
@@ -9190,16 +9195,16 @@ const AiAssistant = () => {
9190
9195
  ]
9191
9196
  }
9192
9197
  ),
9193
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, B) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9198
+ /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9194
9199
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
9195
9200
  /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
9196
9201
  /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
9197
9202
  ] }),
9198
9203
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
9199
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(B), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9200
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(B), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9204
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9205
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9201
9206
  ] })
9202
- ] }, B)) })
9207
+ ] }, A)) })
9203
9208
  ] });
9204
9209
  }), BlockAttributesEditor = React.memo(() => {
9205
9210
  const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -9328,7 +9333,7 @@ const RootLayout = () => {
9328
9333
  S && get(S, "view", "standard") === "standard" && (a.current = r, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
9329
9334
  }
9330
9335
  }, [r, x]);
9331
- const A = useMemo(() => {
9336
+ const B = useMemo(() => {
9332
9337
  if (r === null) return 0;
9333
9338
  const S = find(x, { id: r });
9334
9339
  return get(S, "view", "standard") === "standard" ? v : l;
@@ -9356,7 +9361,7 @@ const RootLayout = () => {
9356
9361
  /* @__PURE__ */ jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
9357
9362
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
9358
9363
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
9359
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: x.map((S, B) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9364
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: x.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9360
9365
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
9361
9366
  position: "top",
9362
9367
  panelId: S.id,
@@ -9364,9 +9369,9 @@ const RootLayout = () => {
9364
9369
  show: () => _(S.id)
9365
9370
  }) }),
9366
9371
  /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
9367
- ] }, "button-top-" + B)) }),
9372
+ ] }, "button-top-" + A)) }),
9368
9373
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9369
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: u == null ? void 0 : u.map((S, B) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9374
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: u == null ? void 0 : u.map((S, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9370
9375
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
9371
9376
  position: "bottom",
9372
9377
  panelId: S.id,
@@ -9374,15 +9379,15 @@ const RootLayout = () => {
9374
9379
  show: () => _(S.id)
9375
9380
  }) }),
9376
9381
  /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(S.label) }) })
9377
- ] }, "button-bottom-" + B)) })
9382
+ ] }, "button-bottom-" + A)) })
9378
9383
  ] }),
9379
9384
  /* @__PURE__ */ jsx(
9380
9385
  motion.div,
9381
9386
  {
9382
9387
  id: "left-panel",
9383
9388
  className: "h-full max-h-full border-r border-border",
9384
- initial: { width: A },
9385
- animate: { width: A },
9389
+ initial: { width: B },
9390
+ animate: { width: B },
9386
9391
  transition: { duration: 0.3, ease: "easeInOut" },
9387
9392
  children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
9388
9393
  /* @__PURE__ */ jsx(
@@ -9586,16 +9591,16 @@ const FEATURE_TOGGLES = {
9586
9591
  var x;
9587
9592
  return (x = h.onMount) == null ? void 0 : x.call(h, f);
9588
9593
  }, ...g) => {
9589
- const h = g[0] || ((B) => {
9590
- let N = o.get(B);
9591
- return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(B, N), u == null || u(B, S)), N;
9594
+ const h = g[0] || ((A) => {
9595
+ let N = o.get(A);
9596
+ return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
9592
9597
  }), f = g[1] || (() => {
9593
- let B, N;
9598
+ let A, N;
9594
9599
  const C = (k) => {
9595
9600
  try {
9596
9601
  k();
9597
9602
  } catch (j) {
9598
- B || (B = !0, N = j);
9603
+ A || (A = !0, N = j);
9599
9604
  }
9600
9605
  };
9601
9606
  do {
@@ -9606,10 +9611,10 @@ const FEATURE_TOGGLES = {
9606
9611
  return (I = r.get(T)) == null ? void 0 : I.l.forEach(j);
9607
9612
  }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
9608
9613
  } while (a.size || i.size || l.size);
9609
- if (B)
9614
+ if (A)
9610
9615
  throw N;
9611
9616
  }), x = g[2] || (() => {
9612
- const B = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
9617
+ const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
9613
9618
  for (; k.length; ) {
9614
9619
  const j = k[k.length - 1], T = h(j);
9615
9620
  if (C.has(j)) {
@@ -9617,27 +9622,27 @@ const FEATURE_TOGGLES = {
9617
9622
  continue;
9618
9623
  }
9619
9624
  if (N.has(j)) {
9620
- n.get(j) === T.n && B.push([j, T]), C.add(j), k.pop();
9625
+ n.get(j) === T.n && A.push([j, T]), C.add(j), k.pop();
9621
9626
  continue;
9622
9627
  }
9623
9628
  N.add(j);
9624
9629
  for (const I of getMountedOrPendingDependents(j, T, r))
9625
9630
  N.has(I) || k.push(I);
9626
9631
  }
9627
- for (let j = B.length - 1; j >= 0; --j) {
9628
- const [T, I] = B[j];
9632
+ for (let j = A.length - 1; j >= 0; --j) {
9633
+ const [T, I] = A[j];
9629
9634
  let P = !1;
9630
9635
  for (const L of I.d.keys())
9631
9636
  if (L !== T && a.has(L)) {
9632
9637
  P = !0;
9633
9638
  break;
9634
9639
  }
9635
- P && (y(T), A(T)), n.delete(T);
9640
+ P && (y(T), B(T)), n.delete(T);
9636
9641
  }
9637
- }), y = g[3] || ((B) => {
9642
+ }), y = g[3] || ((A) => {
9638
9643
  var N, C;
9639
- const k = h(B);
9640
- if (isAtomStateInitialized(k) && (r.has(B) && n.get(B) !== k.n || Array.from(k.d).every(
9644
+ const k = h(A);
9645
+ if (isAtomStateInitialized(k) && (r.has(A) && n.get(A) !== k.n || Array.from(k.d).every(
9641
9646
  ([R, $]) => (
9642
9647
  // Recursively, read the atom state of the dependency, and
9643
9648
  // check if the atom epoch number is unchanged
@@ -9648,10 +9653,10 @@ const FEATURE_TOGGLES = {
9648
9653
  k.d.clear();
9649
9654
  let j = !0;
9650
9655
  const T = () => {
9651
- r.has(B) && (A(B), x(), f());
9656
+ r.has(A) && (B(A), x(), f());
9652
9657
  }, I = (R) => {
9653
9658
  var $;
9654
- if (isSelfAtom(B, R)) {
9659
+ if (isSelfAtom(A, R)) {
9655
9660
  const H = h(R);
9656
9661
  if (!isAtomStateInitialized(H))
9657
9662
  if (hasInitialValue(R))
@@ -9664,7 +9669,7 @@ const FEATURE_TOGGLES = {
9664
9669
  try {
9665
9670
  return returnAtomValue(M);
9666
9671
  } finally {
9667
- k.d.set(R, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(B, k.v, M), ($ = r.get(R)) == null || $.t.add(B), j || T();
9672
+ k.d.set(R, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(A, k.v, M), ($ = r.get(R)) == null || $.t.add(A), j || T();
9668
9673
  }
9669
9674
  };
9670
9675
  let P, L;
@@ -9673,10 +9678,10 @@ const FEATURE_TOGGLES = {
9673
9678
  return P || (P = new AbortController()), P.signal;
9674
9679
  },
9675
9680
  get setSelf() {
9676
- return !L && isActuallyWritableAtom(B) && (L = (...R) => {
9681
+ return !L && isActuallyWritableAtom(A) && (L = (...R) => {
9677
9682
  if (!j)
9678
9683
  try {
9679
- return v(B, ...R);
9684
+ return v(A, ...R);
9680
9685
  } finally {
9681
9686
  x(), f();
9682
9687
  }
@@ -9684,18 +9689,18 @@ const FEATURE_TOGGLES = {
9684
9689
  }
9685
9690
  }, O = k.n;
9686
9691
  try {
9687
- const R = d(B, I, D);
9688
- return setAtomStateValueOrPromise(B, R, h), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
9692
+ const R = d(A, I, D);
9693
+ return setAtomStateValueOrPromise(A, R, h), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
9689
9694
  T,
9690
9695
  T
9691
9696
  )), k;
9692
9697
  } catch (R) {
9693
9698
  return delete k.v, k.e = R, ++k.n, k;
9694
9699
  } finally {
9695
- j = !1, O !== k.n && n.get(B) === O && (n.set(B, k.n), a.add(B), (C = c.c) == null || C.call(c, B));
9700
+ j = !1, O !== k.n && n.get(A) === O && (n.set(A, k.n), a.add(A), (C = c.c) == null || C.call(c, A));
9696
9701
  }
9697
- }), b = g[4] || ((B) => {
9698
- const N = [B];
9702
+ }), b = g[4] || ((A) => {
9703
+ const N = [A];
9699
9704
  for (; N.length; ) {
9700
9705
  const C = N.pop(), k = h(C);
9701
9706
  for (const j of getMountedOrPendingDependents(C, k, r)) {
@@ -9703,17 +9708,17 @@ const FEATURE_TOGGLES = {
9703
9708
  n.set(j, T.n), N.push(j);
9704
9709
  }
9705
9710
  }
9706
- }), v = g[5] || ((B, ...N) => {
9711
+ }), v = g[5] || ((A, ...N) => {
9707
9712
  let C = !0;
9708
9713
  const k = (T) => returnAtomValue(y(T)), j = (T, ...I) => {
9709
9714
  var P;
9710
9715
  const L = h(T);
9711
9716
  try {
9712
- if (isSelfAtom(B, T)) {
9717
+ if (isSelfAtom(A, T)) {
9713
9718
  if (!hasInitialValue(T))
9714
9719
  throw new Error("atom not writable");
9715
9720
  const D = L.n, O = I[0];
9716
- setAtomStateValueOrPromise(T, O, h), A(T), D !== L.n && (a.add(T), (P = c.c) == null || P.call(c, T), b(T));
9721
+ setAtomStateValueOrPromise(T, O, h), B(T), D !== L.n && (a.add(T), (P = c.c) == null || P.call(c, T), b(T));
9717
9722
  return;
9718
9723
  } else
9719
9724
  return v(T, ...I);
@@ -9722,50 +9727,50 @@ const FEATURE_TOGGLES = {
9722
9727
  }
9723
9728
  };
9724
9729
  try {
9725
- return p(B, k, j, ...N);
9730
+ return p(A, k, j, ...N);
9726
9731
  } finally {
9727
9732
  C = !1;
9728
9733
  }
9729
- }), A = g[6] || ((B) => {
9734
+ }), B = g[6] || ((A) => {
9730
9735
  var N;
9731
- const C = h(B), k = r.get(B);
9736
+ const C = h(A), k = r.get(A);
9732
9737
  if (k && !isPendingPromise(C.v)) {
9733
9738
  for (const [j, T] of C.d)
9734
9739
  if (!k.d.has(j)) {
9735
9740
  const I = h(j);
9736
- w(j).t.add(B), k.d.add(j), T !== I.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
9741
+ w(j).t.add(A), k.d.add(j), T !== I.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
9737
9742
  }
9738
9743
  for (const j of k.d || [])
9739
9744
  if (!C.d.has(j)) {
9740
9745
  k.d.delete(j);
9741
9746
  const T = E(j);
9742
- T == null || T.t.delete(B);
9747
+ T == null || T.t.delete(A);
9743
9748
  }
9744
9749
  }
9745
- }), w = g[7] || ((B) => {
9750
+ }), w = g[7] || ((A) => {
9746
9751
  var N;
9747
- const C = h(B);
9748
- let k = r.get(B);
9752
+ const C = h(A);
9753
+ let k = r.get(A);
9749
9754
  if (!k) {
9750
- y(B);
9755
+ y(A);
9751
9756
  for (const j of C.d.keys())
9752
- w(j).t.add(B);
9757
+ w(j).t.add(A);
9753
9758
  if (k = {
9754
9759
  l: /* @__PURE__ */ new Set(),
9755
9760
  d: new Set(C.d.keys()),
9756
9761
  t: /* @__PURE__ */ new Set()
9757
- }, r.set(B, k), (N = c.m) == null || N.call(c, B), isActuallyWritableAtom(B)) {
9762
+ }, r.set(A, k), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
9758
9763
  const j = () => {
9759
9764
  let T = !0;
9760
9765
  const I = (...P) => {
9761
9766
  try {
9762
- return v(B, ...P);
9767
+ return v(A, ...P);
9763
9768
  } finally {
9764
9769
  T || (x(), f());
9765
9770
  }
9766
9771
  };
9767
9772
  try {
9768
- const P = m(B, I);
9773
+ const P = m(A, I);
9769
9774
  P && (k.u = () => {
9770
9775
  T = !0;
9771
9776
  try {
@@ -9782,18 +9787,18 @@ const FEATURE_TOGGLES = {
9782
9787
  }
9783
9788
  }
9784
9789
  return k;
9785
- }), E = g[8] || ((B) => {
9790
+ }), E = g[8] || ((A) => {
9786
9791
  var N;
9787
- const C = h(B);
9788
- let k = r.get(B);
9792
+ const C = h(A);
9793
+ let k = r.get(A);
9789
9794
  if (k && !k.l.size && !Array.from(k.t).some((j) => {
9790
9795
  var T;
9791
- return (T = r.get(j)) == null ? void 0 : T.d.has(B);
9796
+ return (T = r.get(j)) == null ? void 0 : T.d.has(A);
9792
9797
  })) {
9793
- k.u && i.add(k.u), k = void 0, r.delete(B), (N = c.u) == null || N.call(c, B);
9798
+ k.u && i.add(k.u), k = void 0, r.delete(A), (N = c.u) == null || N.call(c, A);
9794
9799
  for (const j of C.d.keys()) {
9795
9800
  const T = E(j);
9796
- T == null || T.t.delete(B);
9801
+ T == null || T.t.delete(A);
9797
9802
  }
9798
9803
  return;
9799
9804
  }
@@ -9819,22 +9824,22 @@ const FEATURE_TOGGLES = {
9819
9824
  y,
9820
9825
  b,
9821
9826
  v,
9822
- A,
9827
+ B,
9823
9828
  w,
9824
9829
  E
9825
9830
  ], S = {
9826
- get: (B) => returnAtomValue(y(B)),
9827
- set: (B, ...N) => {
9831
+ get: (A) => returnAtomValue(y(A)),
9832
+ set: (A, ...N) => {
9828
9833
  try {
9829
- return v(B, ...N);
9834
+ return v(A, ...N);
9830
9835
  } finally {
9831
9836
  x(), f();
9832
9837
  }
9833
9838
  },
9834
- sub: (B, N) => {
9835
- const k = w(B).l;
9839
+ sub: (A, N) => {
9840
+ const k = w(A).l;
9836
9841
  return k.add(N), f(), () => {
9837
- k.delete(N), E(B), f();
9842
+ k.delete(N), E(A), f();
9838
9843
  };
9839
9844
  }
9840
9845
  };