@kgalexander/mcreate 0.0.12 → 0.0.14

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.
@@ -1,5 +1,5 @@
1
1
  // src/core/index.tsx
2
- import { useMemo as useMemo16, useState as useState15, useEffect as useEffect19, useCallback as useCallback16, useRef as useRef11 } from "react";
2
+ import { useMemo as useMemo17, useState as useState16, useEffect as useEffect20, useCallback as useCallback17, useRef as useRef11 } from "react";
3
3
  import { cloneDeep as cloneDeep2, isEqual, debounce } from "lodash";
4
4
 
5
5
  // src/core/utils/idx.ts
@@ -1114,7 +1114,6 @@ import lodashGet from "lodash/get";
1114
1114
  import lodashSet from "lodash/set";
1115
1115
  import cloneDeep from "lodash/cloneDeep";
1116
1116
  import { castDraft } from "immer";
1117
- import { toast } from "sonner";
1118
1117
 
1119
1118
  // src/core/editor/utils/generate-id.ts
1120
1119
  import { nanoid } from "nanoid";
@@ -1278,6 +1277,7 @@ function createSocialElement(payload) {
1278
1277
  "inner-padding": "4px 4px",
1279
1278
  "icon-padding": "0px 6px",
1280
1279
  "text-padding": "4px 4px",
1280
+ "line-height": "1.4",
1281
1281
  ...payload?.attributes
1282
1282
  },
1283
1283
  children: payload?.children || [
@@ -1312,6 +1312,7 @@ function createSocialItemElement(payload) {
1312
1312
  target: "_blank",
1313
1313
  src: payload?.attributes?.src || "https://cdn-images.mailchimp.com/icons/social-block-v3/block-icons-v3/facebook-icon-color-40.png",
1314
1314
  alt: payload?.attributes?.alt || "Facebook",
1315
+ align: "center",
1315
1316
  ...payload?.attributes
1316
1317
  }
1317
1318
  };
@@ -1870,7 +1871,6 @@ var defaultTemplate = {
1870
1871
  id: page.id || generateId()
1871
1872
  }))
1872
1873
  };
1873
- var MAX_PAID_LEVEL = 3;
1874
1874
  var useEditorStore = create()(
1875
1875
  devtools(
1876
1876
  immer((set) => ({
@@ -1878,6 +1878,8 @@ var useEditorStore = create()(
1878
1878
  template: defaultTemplate,
1879
1879
  templateId: null,
1880
1880
  onSave: null,
1881
+ onToast: null,
1882
+ onExit: null,
1881
1883
  previewMode: false,
1882
1884
  focusIdx: null,
1883
1885
  hoverIdx: null,
@@ -1901,13 +1903,20 @@ var useEditorStore = create()(
1901
1903
  isSaving: false,
1902
1904
  // Subscription level (0 = free, 1-3 = paid tiers)
1903
1905
  isPaidLevel: 0,
1906
+ // User data
1907
+ images: [],
1908
+ userData: null,
1904
1909
  // Initialize store with external template (for npm package usage)
1905
- initializeWithTemplate: (templateId, template, onSave, isPaidLevel) => {
1910
+ initializeWithTemplate: (templateId, template, onSave, onToast, data, onExit) => {
1906
1911
  set((state) => {
1907
1912
  state.templateId = templateId;
1908
1913
  state.template = template;
1909
1914
  state.onSave = onSave ?? null;
1910
- state.isPaidLevel = isPaidLevel ?? 0;
1915
+ state.onToast = onToast ?? null;
1916
+ state.onExit = onExit ?? null;
1917
+ state.isPaidLevel = data?.isPaidLevel ?? 0;
1918
+ state.images = data?.images ?? [];
1919
+ state.userData = data?.userData ?? null;
1911
1920
  state.templateSize = calculateTemplateSize(template);
1912
1921
  state.isAtSizeLimit = false;
1913
1922
  state.history = [cloneDeep(template)];
@@ -2053,7 +2062,7 @@ var useEditorStore = create()(
2053
2062
  }
2054
2063
  const elementSize = new Blob([JSON.stringify(newElement)]).size;
2055
2064
  if (state.templateSize + elementSize > MAX_TEMPLATE_SIZE) {
2056
- toast.error("Template size limit reached - element would exceed the limit");
2065
+ state.onToast?.({ type: "error", message: "Template size limit reached - element would exceed the limit" });
2057
2066
  return;
2058
2067
  }
2059
2068
  const children = parent.children;
@@ -2092,7 +2101,7 @@ var useEditorStore = create()(
2092
2101
  }
2093
2102
  const sectionSize = new Blob([JSON.stringify(newSection)]).size;
2094
2103
  if (state.templateSize + sectionSize > MAX_TEMPLATE_SIZE) {
2095
- toast.error("Template size limit reached");
2104
+ state.onToast?.({ type: "error", message: "Template size limit reached" });
2096
2105
  return;
2097
2106
  }
2098
2107
  const children = page.children;
@@ -2210,7 +2219,7 @@ var useEditorStore = create()(
2210
2219
  }
2211
2220
  ).length;
2212
2221
  if (regularSectionCount <= 1) {
2213
- toast.error("Cannot delete the last section");
2222
+ state.onToast?.({ type: "error", message: "Cannot delete the last section" });
2214
2223
  return;
2215
2224
  }
2216
2225
  }
@@ -2343,7 +2352,7 @@ var useEditorStore = create()(
2343
2352
  const clonedElement = cloneDeep(sourceElement);
2344
2353
  const elementSize = new Blob([JSON.stringify(clonedElement)]).size;
2345
2354
  if (state.templateSize + elementSize > MAX_TEMPLATE_SIZE) {
2346
- toast.error("Template size limit reached - duplicate would exceed limit");
2355
+ state.onToast?.({ type: "error", message: "Template size limit reached - duplicate would exceed limit" });
2347
2356
  return;
2348
2357
  }
2349
2358
  const parent = getElementAtIdx(state.template, parentIdx);
@@ -2447,13 +2456,14 @@ var useEditorStore = create()(
2447
2456
  if (tempDroppedElement) {
2448
2457
  const elementSize = new Blob([JSON.stringify(tempDroppedElement)]).size;
2449
2458
  if (state.templateSize + elementSize > MAX_TEMPLATE_SIZE) {
2450
- toast.error("Template size limit reached - this element would exceed the limit");
2459
+ state.onToast?.({ type: "error", message: "Template size limit reached - this element would exceed the limit" });
2451
2460
  return;
2452
2461
  }
2453
2462
  }
2454
2463
  }
2455
2464
  textElement.data.value.content = beforeContent;
2456
2465
  let droppedElement = null;
2466
+ let deletedSectionIndex = null;
2457
2467
  if (sourceIdx) {
2458
2468
  const sourceParentIdx = getParentIdx(sourceIdx);
2459
2469
  if (sourceParentIdx) {
@@ -2473,6 +2483,7 @@ var useEditorStore = create()(
2473
2483
  const sectionIndex = getIndexByIdx(sourceSectionIdx);
2474
2484
  const sourcePageChildren = sourcePage.children;
2475
2485
  sourcePageChildren.splice(sectionIndex, 1);
2486
+ deletedSectionIndex = sectionIndex;
2476
2487
  }
2477
2488
  } else if (action === "add-text") {
2478
2489
  const defaultText = createElementByType("text", { data: { value: { content: "" } } });
@@ -2498,7 +2509,20 @@ var useEditorStore = create()(
2498
2509
  console.error("Failed to create new text element");
2499
2510
  return;
2500
2511
  }
2501
- const parentIdx = getParentIdx(textElementIdx);
2512
+ let adjustedTextElementIdx = textElementIdx;
2513
+ if (deletedSectionIndex !== null) {
2514
+ const textSectionMatch = SECTION_INDEX_REGEX.exec(textElementIdx);
2515
+ if (textSectionMatch) {
2516
+ const textSectionIndex = Number(textSectionMatch[1]);
2517
+ if (deletedSectionIndex < textSectionIndex) {
2518
+ adjustedTextElementIdx = textElementIdx.replace(
2519
+ SECTION_INDEX_REGEX,
2520
+ `content.children.[${textSectionIndex - 1}]`
2521
+ );
2522
+ }
2523
+ }
2524
+ }
2525
+ const parentIdx = getParentIdx(adjustedTextElementIdx);
2502
2526
  if (!parentIdx) {
2503
2527
  console.error("Parent not found for text element");
2504
2528
  return;
@@ -2508,7 +2532,7 @@ var useEditorStore = create()(
2508
2532
  console.error("Parent is not a valid container");
2509
2533
  return;
2510
2534
  }
2511
- const currentIndex = getIndexByIdx(textElementIdx);
2535
+ const currentIndex = getIndexByIdx(adjustedTextElementIdx);
2512
2536
  const parentChildren = parent.children;
2513
2537
  let adjustedIndex = currentIndex;
2514
2538
  if (sourceIdx) {
@@ -2595,7 +2619,7 @@ var useEditorStore = create()(
2595
2619
  const elementSize = new Blob([JSON.stringify(sectionColumnElement)]).size;
2596
2620
  const approxNewSectionSize = 200;
2597
2621
  if (state.templateSize + elementSize + approxNewSectionSize > MAX_TEMPLATE_SIZE) {
2598
- toast.error("Template size limit reached");
2622
+ state.onToast?.({ type: "error", message: "Template size limit reached" });
2599
2623
  return;
2600
2624
  }
2601
2625
  }
@@ -2618,7 +2642,7 @@ var useEditorStore = create()(
2618
2642
  const pageChildren = page.children;
2619
2643
  let adjustedSectionIndex = sectionIndex;
2620
2644
  if (sourceIdx) {
2621
- const srcSectionMatch = sourceIdx.match(SECTION_INDEX_REGEX);
2645
+ const srcSectionMatch = SECTION_INDEX_REGEX.exec(sourceIdx);
2622
2646
  if (srcSectionMatch) {
2623
2647
  const srcSectionIndex = parseInt(srcSectionMatch[1], 10);
2624
2648
  if (srcSectionIndex < sectionIndex) {
@@ -2694,7 +2718,7 @@ var useEditorStore = create()(
2694
2718
  if (!sourceIdx) {
2695
2719
  const columnSize = new Blob([JSON.stringify(newColumn)]).size;
2696
2720
  if (state.templateSize + columnSize > MAX_TEMPLATE_SIZE) {
2697
- toast.error("Template size limit reached");
2721
+ state.onToast?.({ type: "error", message: "Template size limit reached" });
2698
2722
  return;
2699
2723
  }
2700
2724
  }
@@ -2787,7 +2811,7 @@ var useEditorStore = create()(
2787
2811
  if (!sourceIdx) {
2788
2812
  const columnSize = new Blob([JSON.stringify(newColumn)]).size;
2789
2813
  if (state.templateSize + columnSize > MAX_TEMPLATE_SIZE) {
2790
- toast.error("Template size limit reached");
2814
+ state.onToast?.({ type: "error", message: "Template size limit reached" });
2791
2815
  return;
2792
2816
  }
2793
2817
  }
@@ -3120,6 +3144,17 @@ var LINK_TYPES = [
3120
3144
  prefix: "tel:"
3121
3145
  }
3122
3146
  ];
3147
+ var LINK_PRESETS = {
3148
+ Phone: [
3149
+ { label: "Personal Phone", key: "personal_phone_number" },
3150
+ { label: "Office Phone", key: "office_phone_number" },
3151
+ { label: "Business Phone", key: "business_phone_number" }
3152
+ ],
3153
+ Website: [
3154
+ { label: "Team Website", key: "team_website" },
3155
+ { label: "Brokerage Website", key: "brokerage_website" }
3156
+ ]
3157
+ };
3123
3158
  var detectLinkType = (href) => {
3124
3159
  if (href.startsWith("mailto:")) return LINK_TYPES[0];
3125
3160
  if (href.startsWith("tel:")) return LINK_TYPES[2];
@@ -3146,10 +3181,20 @@ var MAX_LINE_HEIGHT = 3;
3146
3181
  var LINE_HEIGHT_STEP = 0.1;
3147
3182
  var HIDDEN_SELECTION_VISUAL_ELEMENTS = ["text", "divider", "column"];
3148
3183
  var NOT_DRAGGABLE_ELEMENTS = ["page", "social-item", "text", "property-card", "property-card-single-two", "property-card-triple", "property-card-triple-item"];
3149
- var IMAGE_SELECTION_VALID_TYPES = ["section", "section-column", "image", "section-property-km", "section-property-single-two", "section-property-triple", "property-card", "property-card-single-two", "property-card-triple", "property-card-triple-item"];
3184
+ var EDITOR_COLORS = {
3185
+ /** Purple — drag/drop state */
3186
+ drag: {
3187
+ solid: "rgb(59, 130, 246)",
3188
+ half: "rgba(59, 130, 246, 0.5)"
3189
+ },
3190
+ /** Blue — hover/selection state */
3191
+ hover: {
3192
+ solid: "rgb(59, 130, 246)",
3193
+ half: "rgba(59, 130, 246, 0.5)"
3194
+ }
3195
+ };
3150
3196
 
3151
3197
  // src/core/editor/components/ShadowDomRenderer.tsx
3152
- import { toast as toast2 } from "sonner";
3153
3198
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3154
3199
  var lastSizeLimitToastTime = 0;
3155
3200
  var cssCache = /* @__PURE__ */ new Map();
@@ -3175,32 +3220,32 @@ function getEditorStyles(isDragButtonHovered, textEditingIdx) {
3175
3220
 
3176
3221
  /* Hover state - uses CSS variable for dynamic color */
3177
3222
  .${EMAIL_BLOCK_CLASS_NAME}.is-hovered {
3178
- outline-color: var(--outline-color-hover, rgba(59, 130, 246, 0.5));
3223
+ outline-color: var(--outline-color-hover, ${EDITOR_COLORS.hover.half});
3179
3224
  }
3180
3225
 
3181
3226
  /* Selected state - uses CSS variable for dynamic color */
3182
3227
  .${EMAIL_BLOCK_CLASS_NAME}.is-selected {
3183
- outline-color: var(--outline-color, rgb(59, 130, 246));
3228
+ outline-color: var(--outline-color, ${EDITOR_COLORS.hover.solid});
3184
3229
  }
3185
3230
 
3186
3231
  /* Drop target state - highlight section being dropped into */
3187
3232
  .${EMAIL_BLOCK_CLASS_NAME}.is-drop-target {
3188
- outline-color: rgb(147, 51, 234) !important;
3233
+ outline-color: ${EDITOR_COLORS.drag.solid} !important;
3189
3234
  }
3190
3235
 
3191
3236
  /* Column selection in section-column - 50% opacity blue */
3192
3237
  .${EMAIL_BLOCK_CLASS_NAME}.is-column-selected {
3193
- outline-color: rgba(59, 130, 246, 0.5);
3238
+ outline-color: ${EDITOR_COLORS.hover.half};
3194
3239
  }
3195
3240
 
3196
3241
  /* Column hover when child element is hovered - 50% opacity blue */
3197
3242
  .${EMAIL_BLOCK_CLASS_NAME}.is-column-hover-parent {
3198
- outline-color: rgba(59, 130, 246, 0.5);
3243
+ outline-color: ${EDITOR_COLORS.hover.half};
3199
3244
  }
3200
3245
 
3201
3246
  /* Card selection in property-card-triple - 50% opacity blue */
3202
3247
  .${EMAIL_BLOCK_CLASS_NAME}.is-card-selected {
3203
- outline-color: rgba(59, 130, 246, 0.5);
3248
+ outline-color: ${EDITOR_COLORS.hover.half};
3204
3249
  }
3205
3250
 
3206
3251
  /* Hide selection visual for configured elements (unless drag button hovered) */
@@ -3220,12 +3265,12 @@ function getEditorStyles(isDragButtonHovered, textEditingIdx) {
3220
3265
  outline-color: transparent !important;
3221
3266
  }
3222
3267
  .node-type-button.is-selected > table {
3223
- outline: 2px solid var(--outline-color, rgb(59, 130, 246));
3268
+ outline: 2px solid var(--outline-color, ${EDITOR_COLORS.hover.solid});
3224
3269
  outline-offset: -2px;
3225
3270
  border-radius: 2px;
3226
3271
  }
3227
3272
  .node-type-button.is-hovered:not(.is-selected) > table {
3228
- outline: 2px solid var(--outline-color-hover, rgba(59, 130, 246, 0.5));
3273
+ outline: 2px solid var(--outline-color-hover, ${EDITOR_COLORS.hover.half});
3229
3274
  outline-offset: -2px;
3230
3275
  border-radius: 2px;
3231
3276
  }
@@ -3238,12 +3283,12 @@ function getEditorStyles(isDragButtonHovered, textEditingIdx) {
3238
3283
  outline-color: transparent !important;
3239
3284
  }
3240
3285
  .node-type-image.is-selected table td {
3241
- outline: 2px solid var(--outline-color, rgb(59, 130, 246));
3286
+ outline: 2px solid var(--outline-color, ${EDITOR_COLORS.hover.solid});
3242
3287
  outline-offset: -2px;
3243
3288
  border-radius: 2px;
3244
3289
  }
3245
3290
  .node-type-image.is-hovered:not(.is-selected) table td {
3246
- outline: 2px solid var(--outline-color-hover, rgba(59, 130, 246, 0.5));
3291
+ outline: 2px solid var(--outline-color-hover, ${EDITOR_COLORS.hover.half});
3247
3292
  outline-offset: -2px;
3248
3293
  border-radius: 2px;
3249
3294
  }
@@ -3261,7 +3306,7 @@ function getEditorStyles(isDragButtonHovered, textEditingIdx) {
3261
3306
  /* Drop indicator - uses CSS variable for dynamic color */
3262
3307
  .drop-indicator {
3263
3308
  position: absolute;
3264
- background-color: var(--outline-color, rgb(59, 130, 246));
3309
+ background-color: var(--outline-color, ${EDITOR_COLORS.hover.solid});
3265
3310
  pointer-events: none;
3266
3311
  z-index: 1000;
3267
3312
  }
@@ -3572,8 +3617,8 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
3572
3617
  contentWrapper.className = "shadow-content";
3573
3618
  contentWrapper.innerHTML = html;
3574
3619
  contentWrapper.style.setProperty("--company-footer-opacity", showCompanyFooter ? "1" : "0.25");
3575
- contentWrapper.style.setProperty("--outline-color", isDragging ? "rgb(147, 51, 234)" : "rgb(59, 130, 246)");
3576
- contentWrapper.style.setProperty("--outline-color-hover", isDragging ? "rgba(147, 51, 234, 0.5)" : "rgba(59, 130, 246, 0.5)");
3620
+ contentWrapper.style.setProperty("--outline-color", isDragging ? EDITOR_COLORS.drag.solid : EDITOR_COLORS.hover.solid);
3621
+ contentWrapper.style.setProperty("--outline-color-hover", isDragging ? EDITOR_COLORS.drag.half : EDITOR_COLORS.hover.half);
3577
3622
  const template = useEditorStore.getState().template;
3578
3623
  const linkColor2 = template?.content?.[0]?.data?.value?.linkColor || "#0000ff";
3579
3624
  contentWrapper.style.setProperty("--link-color", linkColor2);
@@ -3593,8 +3638,8 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
3593
3638
  if (!shadowRootRef.current) return;
3594
3639
  const contentWrapper = shadowRootRef.current.querySelector(".shadow-content");
3595
3640
  if (contentWrapper) {
3596
- contentWrapper.style.setProperty("--outline-color", isDragging ? "rgb(147, 51, 234)" : "rgb(59, 130, 246)");
3597
- contentWrapper.style.setProperty("--outline-color-hover", isDragging ? "rgba(147, 51, 234, 0.5)" : "rgba(59, 130, 246, 0.5)");
3641
+ contentWrapper.style.setProperty("--outline-color", isDragging ? EDITOR_COLORS.drag.solid : EDITOR_COLORS.hover.solid);
3642
+ contentWrapper.style.setProperty("--outline-color-hover", isDragging ? EDITOR_COLORS.drag.half : EDITOR_COLORS.hover.half);
3598
3643
  contentWrapper.style.setProperty("--company-footer-opacity", showCompanyFooter ? "1" : "0.25");
3599
3644
  const template = useEditorStore.getState().template;
3600
3645
  const linkColor2 = template?.content?.[0]?.data?.value?.linkColor || "#0000ff";
@@ -3918,7 +3963,7 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
3918
3963
  const now = Date.now();
3919
3964
  if (now - lastSizeLimitToastTime > 2e3) {
3920
3965
  lastSizeLimitToastTime = now;
3921
- toast2.error("Template size limit reached");
3966
+ useEditorStore.getState().onToast?.({ type: "error", message: "Template size limit reached" });
3922
3967
  }
3923
3968
  return;
3924
3969
  }
@@ -3980,7 +4025,7 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
3980
4025
  const now = Date.now();
3981
4026
  if (now - lastSizeLimitToastTime > 2e3) {
3982
4027
  lastSizeLimitToastTime = now;
3983
- toast2.error("Template size limit reached");
4028
+ useEditorStore.getState().onToast?.({ type: "error", message: "Template size limit reached" });
3984
4029
  }
3985
4030
  }
3986
4031
  };
@@ -4054,11 +4099,11 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
4054
4099
  width: 3,
4055
4100
  height: dropIndicator.height
4056
4101
  },
4057
- backgroundColor: isDragging ? "rgb(147, 51, 234)" : "#3b82f6",
4102
+ backgroundColor: isDragging ? EDITOR_COLORS.drag.solid : EDITOR_COLORS.hover.solid,
4058
4103
  borderRadius: 2,
4059
4104
  pointerEvents: "none",
4060
4105
  zIndex: 9999,
4061
- boxShadow: isDragging ? "0 0 4px rgba(147, 51, 234, 0.5)" : "0 0 4px rgba(59, 130, 246, 0.5)"
4106
+ boxShadow: isDragging ? `0 0 4px ${EDITOR_COLORS.drag.half}` : `0 0 4px ${EDITOR_COLORS.hover.half}`
4062
4107
  },
4063
4108
  children: (dropIndicator.isNewSection || dropIndicator.isSplitSection) && /* @__PURE__ */ jsx(
4064
4109
  "div",
@@ -4068,7 +4113,7 @@ var ShadowDomRenderer = memo(function ShadowDomRenderer2({
4068
4113
  top: "50%",
4069
4114
  left: "50%",
4070
4115
  transform: "translate(-50%, -50%)",
4071
- backgroundColor: "rgb(147, 51, 234)",
4116
+ backgroundColor: EDITOR_COLORS.drag.solid,
4072
4117
  color: "white",
4073
4118
  fontSize: 12,
4074
4119
  fontWeight: 600,
@@ -10998,9 +11043,6 @@ function checkElementPosition(template, elementIdx) {
10998
11043
  return { isFirstInFirstSection, isFirstInSectionColumn };
10999
11044
  }
11000
11045
 
11001
- // src/core/editor/components/tiptap-overlay.tsx
11002
- import { toast as toast3 } from "sonner";
11003
-
11004
11046
  // src/components/ui/tooltip.tsx
11005
11047
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
11006
11048
  import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -11666,7 +11708,7 @@ var TiptapOverlay = () => {
11666
11708
  if (!textEditing) return null;
11667
11709
  return /* @__PURE__ */ jsx21(TiptapOverlayContent, { ...textEditing }, textEditing.idx);
11668
11710
  };
11669
- var TiptapOverlayContent = ({ idx, getReferenceRect, initialWidth, initialHeight, clickX, clickY, content, styles, cursorPosition }) => {
11711
+ var TiptapOverlayContent = ({ idx, getReferenceRect, getShadowElement, initialWidth, initialHeight, clickX, clickY, content, styles, cursorPosition }) => {
11670
11712
  const containerRef = useRef4(null);
11671
11713
  const setTiptapEditor = useEditorStore((s) => s.setTiptapEditor);
11672
11714
  const linkColor = useEditorStore((s) => s.template?.content?.[0]?.data?.value?.linkColor) || "#0000ff";
@@ -11681,6 +11723,24 @@ var TiptapOverlayContent = ({ idx, getReferenceRect, initialWidth, initialHeight
11681
11723
  }
11682
11724
  };
11683
11725
  }, []);
11726
+ useEffect6(() => {
11727
+ const container = containerRef.current;
11728
+ if (!container) return;
11729
+ const observer = new ResizeObserver(() => {
11730
+ const shadowEl = getShadowElement();
11731
+ if (shadowEl) {
11732
+ shadowEl.style.height = `${container.offsetHeight}px`;
11733
+ }
11734
+ });
11735
+ observer.observe(container);
11736
+ return () => {
11737
+ observer.disconnect();
11738
+ const shadowEl = getShadowElement();
11739
+ if (shadowEl) {
11740
+ shadowEl.style.height = "";
11741
+ }
11742
+ };
11743
+ }, [getShadowElement]);
11684
11744
  const cleanedContent = useMemo3(() => {
11685
11745
  return content.replace(NBSP_P_CONTENT_REGEX, "<p$1></p>").replace(IS_EMPTY_P_CLASS_REGEX, "").replace(IS_EMPTY_HEADING_CLASS_REGEX, "");
11686
11746
  }, [content]);
@@ -11741,7 +11801,7 @@ var TiptapOverlayContent = ({ idx, getReferenceRect, initialWidth, initialHeight
11741
11801
  const now = Date.now();
11742
11802
  if (now - lastSizeLimitToastRef.current > 2e3) {
11743
11803
  lastSizeLimitToastRef.current = now;
11744
- toast3.error("Template size limit reached");
11804
+ useEditorStore.getState().onToast?.({ type: "error", message: "Template size limit reached" });
11745
11805
  }
11746
11806
  return true;
11747
11807
  }
@@ -11798,7 +11858,7 @@ var TiptapOverlayContent = ({ idx, getReferenceRect, initialWidth, initialHeight
11798
11858
  const now = Date.now();
11799
11859
  if (now - lastSizeLimitToastRef.current > 2e3) {
11800
11860
  lastSizeLimitToastRef.current = now;
11801
- toast3.error("Template size limit reached - paste would exceed the limit");
11861
+ useEditorStore.getState().onToast?.({ type: "error", message: "Template size limit reached - paste would exceed the limit" });
11802
11862
  }
11803
11863
  return true;
11804
11864
  }
@@ -12059,7 +12119,7 @@ var TiptapOverlayContent = ({ idx, getReferenceRect, initialWidth, initialHeight
12059
12119
  };
12060
12120
 
12061
12121
  // src/core/editor/components/element-float.tsx
12062
- import { useEffect as useEffect11, useMemo as useMemo10 } from "react";
12122
+ import { useEffect as useEffect12, useMemo as useMemo11 } from "react";
12063
12123
  import { useFloating as useFloating4, offset as offset4, shift as shift3, flip as flip2, autoUpdate as autoUpdate3 } from "@floating-ui/react";
12064
12124
 
12065
12125
  // src/core/editor/components/float-ui/actions/delete-button.tsx
@@ -12113,7 +12173,7 @@ var DuplicateButton = () => {
12113
12173
  };
12114
12174
 
12115
12175
  // src/core/editor/components/href-menu.tsx
12116
- import { useState as useState3, useEffect as useEffect7 } from "react";
12176
+ import { useState as useState3, useEffect as useEffect7, useCallback as useCallback4, useMemo as useMemo5 } from "react";
12117
12177
 
12118
12178
  // src/components/ui/dropdown-menu.tsx
12119
12179
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
@@ -12290,19 +12350,36 @@ var useHref = () => {
12290
12350
  import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
12291
12351
  var HrefMenu = () => {
12292
12352
  const { href, setHref, clearHref, copyHref, hasHref } = useHref();
12353
+ const userData = useEditorStore((s) => s.userData);
12293
12354
  const [isOpen, setIsOpen] = useState3(false);
12294
12355
  const [inputValue, setInputValue] = useState3("");
12295
12356
  const [showCopied, setShowCopied] = useState3(false);
12296
12357
  const [linkType, setLinkType] = useState3(LINK_TYPES[1]);
12297
12358
  const [isLinkTypeOpen, setIsLinkTypeOpen] = useState3(false);
12359
+ const [isPresetOpen, setIsPresetOpen] = useState3(false);
12360
+ console.log("userData", userData);
12361
+ const availablePresets = useMemo5(() => {
12362
+ const presetDefs = LINK_PRESETS[linkType.name] ?? [];
12363
+ if (!userData) return [];
12364
+ const all = presetDefs.filter((p) => userData[p.key]).map((p) => ({ ...p, value: String(userData[p.key]) }));
12365
+ if (!inputValue) return all;
12366
+ const query = inputValue.toLowerCase();
12367
+ return all.filter((p) => p.value.toLowerCase().includes(query));
12368
+ }, [linkType.name, userData, inputValue]);
12369
+ const handlePresetSelect = useCallback4((value) => {
12370
+ setInputValue(value);
12371
+ setIsPresetOpen(false);
12372
+ }, []);
12298
12373
  useEffect7(() => {
12299
12374
  if (isOpen) {
12300
12375
  setLinkType(detectLinkType(href));
12301
12376
  setInputValue(stripPrefix(href));
12377
+ setIsPresetOpen(true);
12302
12378
  }
12303
12379
  }, [isOpen, href]);
12304
12380
  const handleInputChange = (e) => {
12305
12381
  setInputValue(e.target.value);
12382
+ setIsPresetOpen(true);
12306
12383
  };
12307
12384
  const buildHref = (value) => {
12308
12385
  if (!value) return "";
@@ -12312,15 +12389,22 @@ var HrefMenu = () => {
12312
12389
  if (value.startsWith(linkType.prefix)) return value;
12313
12390
  return linkType.prefix + value;
12314
12391
  };
12392
+ const handleInputClick = () => {
12393
+ if (availablePresets.length > 0) {
12394
+ setIsPresetOpen(true);
12395
+ }
12396
+ };
12315
12397
  const handleInputBlur = () => {
12316
12398
  setHref(buildHref(inputValue));
12317
12399
  };
12318
12400
  const handleKeyDown = (e) => {
12319
12401
  if (e.key === "Enter") {
12320
12402
  setHref(buildHref(inputValue));
12403
+ setIsPresetOpen(false);
12321
12404
  setIsOpen(false);
12322
12405
  }
12323
12406
  if (e.key === "Escape") {
12407
+ setIsPresetOpen(false);
12324
12408
  setIsOpen(false);
12325
12409
  }
12326
12410
  };
@@ -12363,55 +12447,85 @@ var HrefMenu = () => {
12363
12447
  /* @__PURE__ */ jsxs12(DropdownMenuContent, { side: "bottom", className: "w-[250px] p-3 shadow-lg z-50001", children: [
12364
12448
  /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-2", children: [
12365
12449
  /* @__PURE__ */ jsx25(Label, { children: "Enter a link" }),
12366
- /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
12367
- /* @__PURE__ */ jsx25(
12368
- Input,
12369
- {
12370
- type: linkType.inputType,
12371
- placeholder: linkType.placeholder,
12372
- className: "w-full rounded-[12px] shadow-none pl-12 h-[44px]",
12373
- value: inputValue,
12374
- onChange: handleInputChange,
12375
- onBlur: handleInputBlur,
12376
- onKeyDown: handleKeyDown,
12377
- autoFocus: true
12378
- }
12379
- ),
12380
- /* @__PURE__ */ jsxs12(Popover, { open: isLinkTypeOpen, onOpenChange: setIsLinkTypeOpen, children: [
12381
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
12382
- /* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { size: "icon", variant: "ghost", className: "absolute shadow-none rounded-[12px] left-1.5 top-1/2 -translate-y-1/2 h-[34px] w-[34px] cursor-pointer", children: /* @__PURE__ */ jsx25(linkType.icon, {}) }) }) }),
12383
- /* @__PURE__ */ jsx25(TooltipContent, { side: "top", className: "z-50001", children: "Link Type" })
12384
- ] }),
12450
+ /* @__PURE__ */ jsxs12(Popover, { open: isPresetOpen && availablePresets.length > 0, onOpenChange: setIsPresetOpen, children: [
12451
+ /* @__PURE__ */ jsx25(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
12385
12452
  /* @__PURE__ */ jsx25(
12386
- PopoverContent,
12453
+ Input,
12387
12454
  {
12388
- side: "bottom",
12389
- align: "start",
12390
- className: "w-[160px] p-1 z-50001",
12391
- onPointerDownOutside: (e) => e.preventDefault(),
12392
- children: LINK_TYPES.map((type) => /* @__PURE__ */ jsxs12(
12393
- Button,
12394
- {
12395
- variant: "ghost",
12396
- className: "w-full justify-between shadow-none cursor-pointer",
12397
- onClick: (e) => {
12398
- e.stopPropagation();
12399
- setLinkType(type);
12400
- setIsLinkTypeOpen(false);
12455
+ type: linkType.inputType,
12456
+ placeholder: linkType.placeholder,
12457
+ className: "w-full rounded-[12px] shadow-none pl-12 h-[44px]",
12458
+ value: inputValue,
12459
+ onChange: handleInputChange,
12460
+ onClick: handleInputClick,
12461
+ onBlur: handleInputBlur,
12462
+ onKeyDown: handleKeyDown,
12463
+ autoFocus: true
12464
+ }
12465
+ ),
12466
+ /* @__PURE__ */ jsxs12(Popover, { open: isLinkTypeOpen, onOpenChange: setIsLinkTypeOpen, children: [
12467
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
12468
+ /* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { size: "icon", variant: "ghost", className: "absolute shadow-none rounded-[12px] left-1.5 top-1/2 -translate-y-1/2 h-[34px] w-[34px] cursor-pointer", children: /* @__PURE__ */ jsx25(linkType.icon, {}) }) }) }),
12469
+ /* @__PURE__ */ jsx25(TooltipContent, { side: "top", className: "z-50001", children: "Link Type" })
12470
+ ] }),
12471
+ /* @__PURE__ */ jsx25(
12472
+ PopoverContent,
12473
+ {
12474
+ side: "bottom",
12475
+ align: "start",
12476
+ className: "w-[160px] p-1 z-50001",
12477
+ onPointerDownOutside: (e) => e.preventDefault(),
12478
+ children: LINK_TYPES.map((type) => /* @__PURE__ */ jsxs12(
12479
+ Button,
12480
+ {
12481
+ variant: "ghost",
12482
+ className: "w-full justify-between shadow-none cursor-pointer",
12483
+ onClick: (e) => {
12484
+ e.stopPropagation();
12485
+ setLinkType(type);
12486
+ setIsLinkTypeOpen(false);
12487
+ },
12488
+ children: [
12489
+ /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2", children: [
12490
+ /* @__PURE__ */ jsx25(type.icon, { className: "size-4" }),
12491
+ type.name
12492
+ ] }),
12493
+ linkType.name === type.name && /* @__PURE__ */ jsx25(CheckIcon3, { className: "size-4" })
12494
+ ]
12401
12495
  },
12402
- children: [
12403
- /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2", children: [
12404
- /* @__PURE__ */ jsx25(type.icon, { className: "size-4" }),
12405
- type.name
12406
- ] }),
12407
- linkType.name === type.name && /* @__PURE__ */ jsx25(CheckIcon3, { className: "size-4" })
12408
- ]
12496
+ type.name
12497
+ ))
12498
+ }
12499
+ )
12500
+ ] })
12501
+ ] }) }),
12502
+ /* @__PURE__ */ jsx25(
12503
+ PopoverContent,
12504
+ {
12505
+ side: "bottom",
12506
+ align: "start",
12507
+ className: "w-[var(--radix-popover-trigger-width)] p-0 overflow-hidden z-50001",
12508
+ onOpenAutoFocus: (e) => e.preventDefault(),
12509
+ children: /* @__PURE__ */ jsx25("div", { className: "flex flex-col max-h-[200px] overflow-y-auto", children: availablePresets.map((preset) => /* @__PURE__ */ jsxs12(
12510
+ "button",
12511
+ {
12512
+ className: `flex items-center justify-between px-3 py-2 text-sm hover:bg-accent cursor-pointer ${inputValue === preset.value ? "bg-accent font-medium" : ""}`,
12513
+ onMouseDown: (e) => {
12514
+ e.preventDefault();
12515
+ handlePresetSelect(preset.value);
12409
12516
  },
12410
- type.name
12411
- ))
12412
- }
12413
- )
12414
- ] })
12517
+ children: [
12518
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-start gap-0.5", children: [
12519
+ /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: preset.label }),
12520
+ /* @__PURE__ */ jsx25("span", { className: "text-sm", children: preset.value })
12521
+ ] }),
12522
+ inputValue === preset.value && /* @__PURE__ */ jsx25(CheckIcon3, { className: "w-4 h-4 shrink-0" })
12523
+ ]
12524
+ },
12525
+ preset.key
12526
+ )) })
12527
+ }
12528
+ )
12415
12529
  ] })
12416
12530
  ] }),
12417
12531
  /* @__PURE__ */ jsx25(Separator, { className: "my-2" }),
@@ -12476,11 +12590,11 @@ var ButtonFloat = () => {
12476
12590
  import { ChevronsLeftRightIcon, ChevronsRightLeftIcon, MoreHorizontalIcon } from "lucide-react";
12477
12591
 
12478
12592
  // src/core/editor/hooks/use-full-width-toggle.ts
12479
- import { useCallback as useCallback4, useMemo as useMemo5 } from "react";
12593
+ import { useCallback as useCallback5, useMemo as useMemo6 } from "react";
12480
12594
  import { get as lodashGet3 } from "lodash";
12481
12595
  function useFullWidthToggle() {
12482
12596
  const { focusIdx, template, updateElement } = useEditorStore();
12483
- const { element, isFullWidth } = useMemo5(() => {
12597
+ const { element, isFullWidth } = useMemo6(() => {
12484
12598
  if (!focusIdx || !template) return { element: null, isFullWidth: false };
12485
12599
  const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
12486
12600
  const el = lodashGet3(template, path);
@@ -12489,7 +12603,7 @@ function useFullWidthToggle() {
12489
12603
  isFullWidth: el?.attributes?.["full-width"] === "full-width"
12490
12604
  };
12491
12605
  }, [focusIdx, template]);
12492
- const handleToggleFullWidth = useCallback4(() => {
12606
+ const handleToggleFullWidth = useCallback5(() => {
12493
12607
  if (!focusIdx || !element) return;
12494
12608
  const newAttributes = { ...element.attributes };
12495
12609
  if (isFullWidth) {
@@ -12526,11 +12640,11 @@ var SectionFloat = () => {
12526
12640
  import { CheckIcon as CheckIcon4, ChevronsLeftRightIcon as ChevronsLeftRightIcon2, ChevronsRightLeftIcon as ChevronsRightLeftIcon2, Layers2Icon, MoreHorizontalIcon as MoreHorizontalIcon2 } from "lucide-react";
12527
12641
 
12528
12642
  // src/core/editor/hooks/use-no-wrap.ts
12529
- import { useCallback as useCallback5, useMemo as useMemo6 } from "react";
12643
+ import { useCallback as useCallback6, useMemo as useMemo7 } from "react";
12530
12644
  import { get as lodashGet4 } from "lodash";
12531
12645
  function useNoWrap() {
12532
12646
  const { focusIdx, template, updateElement } = useEditorStore();
12533
- const { element, noWrap } = useMemo6(() => {
12647
+ const { element, noWrap } = useMemo7(() => {
12534
12648
  if (!focusIdx || !template) return { element: null, noWrap: false };
12535
12649
  const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
12536
12650
  const el = lodashGet4(template, path);
@@ -12539,7 +12653,7 @@ function useNoWrap() {
12539
12653
  noWrap: el?.data?.value?.noWrap === true
12540
12654
  };
12541
12655
  }, [focusIdx, template]);
12542
- const handleToggleNoWrap = useCallback5(() => {
12656
+ const handleToggleNoWrap = useCallback6(() => {
12543
12657
  if (!focusIdx || !element) return;
12544
12658
  updateElement(focusIdx, {
12545
12659
  data: {
@@ -12670,7 +12784,7 @@ import { Accessibility, MoreHorizontalIcon as MoreHorizontalIcon4, TrashIcon as
12670
12784
  import { useState as useState6, useEffect as useEffect9 } from "react";
12671
12785
 
12672
12786
  // src/core/editor/components/social-item-menu.tsx
12673
- import { useState as useState5, useEffect as useEffect8, useMemo as useMemo7, useCallback as useCallback6 } from "react";
12787
+ import { useState as useState5, useEffect as useEffect8, useMemo as useMemo8, useCallback as useCallback7 } from "react";
12674
12788
  import { PencilIcon as PencilIcon3, CheckIcon as CheckIcon5, CopyIcon as CopyIcon4 } from "lucide-react";
12675
12789
  import { get as lodashGet5 } from "lodash";
12676
12790
  import { jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -12681,7 +12795,7 @@ var SocialItemMenu = ({ hasHref }) => {
12681
12795
  const [contentInputValue, setContentInputValue] = useState5("");
12682
12796
  const { href, setHref, copyHref } = useHref();
12683
12797
  const { focusIdx, template, updateElement } = useEditorStore();
12684
- const element = useMemo7(() => {
12798
+ const element = useMemo8(() => {
12685
12799
  if (!focusIdx || !template) return null;
12686
12800
  const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.?\[(\d+)\]/g, "[$1]") : focusIdx;
12687
12801
  return lodashGet5(template, path);
@@ -12693,12 +12807,12 @@ var SocialItemMenu = ({ hasHref }) => {
12693
12807
  setContentInputValue(content);
12694
12808
  }
12695
12809
  }, [isOpen, href, content]);
12696
- const handleCopy = useCallback6(async () => {
12810
+ const handleCopy = useCallback7(async () => {
12697
12811
  await copyHref();
12698
12812
  setShowCopied(true);
12699
12813
  setTimeout(() => setShowCopied(false), 2e3);
12700
12814
  }, [copyHref]);
12701
- const handleDone = useCallback6(() => {
12815
+ const handleDone = useCallback7(() => {
12702
12816
  setHref(normalizeWebsiteUrl(hrefInputValue));
12703
12817
  if (focusIdx && element) {
12704
12818
  updateElement(focusIdx, {
@@ -12794,11 +12908,11 @@ var SocialItemMenu = ({ hasHref }) => {
12794
12908
  };
12795
12909
 
12796
12910
  // src/core/editor/hooks/use-alt.ts
12797
- import { useMemo as useMemo8, useCallback as useCallback7 } from "react";
12911
+ import { useMemo as useMemo9, useCallback as useCallback8 } from "react";
12798
12912
  import { get as lodashGet6 } from "lodash";
12799
12913
  var useAlt = () => {
12800
12914
  const { focusIdx, updateElement, template } = useEditorStore();
12801
- const { element, alt } = useMemo8(() => {
12915
+ const { element, alt } = useMemo9(() => {
12802
12916
  if (!focusIdx || !template) {
12803
12917
  return { element: null, alt: "" };
12804
12918
  }
@@ -12809,13 +12923,13 @@ var useAlt = () => {
12809
12923
  alt: el?.attributes?.alt || ""
12810
12924
  };
12811
12925
  }, [focusIdx, template]);
12812
- const setAlt = useCallback7((text2) => {
12926
+ const setAlt = useCallback8((text2) => {
12813
12927
  if (!focusIdx || !element) return;
12814
12928
  updateElement(focusIdx, {
12815
12929
  attributes: { ...element.attributes, alt: text2 }
12816
12930
  });
12817
12931
  }, [focusIdx, element, updateElement]);
12818
- const clearAlt = useCallback7(() => {
12932
+ const clearAlt = useCallback8(() => {
12819
12933
  if (!focusIdx || !element) return;
12820
12934
  updateElement(focusIdx, {
12821
12935
  attributes: { ...element.attributes, alt: "" }
@@ -12929,7 +13043,7 @@ var DividerFloat = () => {
12929
13043
  // src/core/editor/components/element-gear/image/float.tsx
12930
13044
  import { Accessibility as Accessibility2, CheckIcon as CheckIcon6, MoreHorizontalIcon as MoreHorizontalIcon5, Proportions } from "lucide-react";
12931
13045
  import lodashGet7 from "lodash/get";
12932
- import { useState as useState7, useEffect as useEffect10, useMemo as useMemo9, useCallback as useCallback8 } from "react";
13046
+ import { useState as useState7, useEffect as useEffect10, useMemo as useMemo10, useCallback as useCallback9 } from "react";
12933
13047
  import { Fragment as Fragment13, jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
12934
13048
  var ImageFloat = () => {
12935
13049
  const { href, hasHref } = useHref();
@@ -12938,7 +13052,7 @@ var ImageFloat = () => {
12938
13052
  const [showMoreView, setShowMoreView] = useState7(null);
12939
13053
  const [dropdownOpen, setDropdownOpen] = useState7(false);
12940
13054
  const [altInputValue, setAltInputValue] = useState7("");
12941
- const { element, isFluidOnMobile } = useMemo9(() => {
13055
+ const { element, isFluidOnMobile } = useMemo10(() => {
12942
13056
  if (!focusIdx || !template) return { element: null, isFluidOnMobile: false };
12943
13057
  const path = focusIdx.startsWith("content.") ? focusIdx.replace("content.", "content[0].").replace(/\.\[(\d+)\]/g, "[$1]") : focusIdx;
12944
13058
  const el = lodashGet7(template, path);
@@ -12947,7 +13061,7 @@ var ImageFloat = () => {
12947
13061
  isFluidOnMobile: el?.attributes?.["fluid-on-mobile"] === "true"
12948
13062
  };
12949
13063
  }, [focusIdx, template]);
12950
- const toggleFluidOnMobile = useCallback8(() => {
13064
+ const toggleFluidOnMobile = useCallback9(() => {
12951
13065
  if (!focusIdx || !element) return;
12952
13066
  const newAttributes = { ...element.attributes };
12953
13067
  if (isFluidOnMobile) {
@@ -13027,34 +13141,253 @@ var ImageFloat = () => {
13027
13141
  ] });
13028
13142
  };
13029
13143
 
13030
- // src/core/editor/components/element-gear/property/float.tsx
13144
+ // src/core/editor/components/mlsNumber-menu.tsx
13145
+ import { useState as useState8, useEffect as useEffect11 } from "react";
13146
+ import { HousePlusIcon, TrashIcon as TrashIcon5, XIcon as XIcon2, Loader2Icon } from "lucide-react";
13147
+
13148
+ // src/services/repliers/commands.ts
13149
+ async function getListingByMlsNumber(mlsNumber) {
13150
+ const response = await fetch(`/api/mcommends/repliers/getListingByMlsNumber/${mlsNumber}`, {
13151
+ method: "GET",
13152
+ headers: {
13153
+ "accept": "application/json"
13154
+ }
13155
+ });
13156
+ const data = await response.json();
13157
+ return data;
13158
+ }
13159
+
13160
+ // src/core/editor/components/mlsNumber-menu.tsx
13031
13161
  import { Fragment as Fragment14, jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
13162
+ var MlsNumberMenu = () => {
13163
+ const { focusIdx, template, updateElement, onToast } = useEditorStore();
13164
+ const [isOpen, setIsOpen] = useState8(false);
13165
+ const [inputValue, setInputValue] = useState8("");
13166
+ const [propertyData, setPropertyData] = useState8(null);
13167
+ const [isLoading, setIsLoading] = useState8(false);
13168
+ const propertyElement = focusIdx && template ? getValueByIdx(template, focusIdx) : null;
13169
+ const currentMlsNumber = propertyElement?.data?.value?.mlsNumber || "";
13170
+ useEffect11(() => {
13171
+ setInputValue(currentMlsNumber);
13172
+ setPropertyData(null);
13173
+ }, [focusIdx, currentMlsNumber]);
13174
+ const handleInputChange = (e) => {
13175
+ setInputValue(e.target.value);
13176
+ };
13177
+ const handleKeyDown = (e) => {
13178
+ if (e.key === "Enter") {
13179
+ handleDone();
13180
+ }
13181
+ if (e.key === "Escape") {
13182
+ setIsOpen(false);
13183
+ }
13184
+ };
13185
+ const handleClear = () => {
13186
+ setInputValue("");
13187
+ setPropertyData(null);
13188
+ };
13189
+ const handleClearPreview = () => {
13190
+ setPropertyData(null);
13191
+ };
13192
+ const handleApplyToCard = () => {
13193
+ if (!focusIdx || !propertyElement || !propertyData) return;
13194
+ console.log(propertyData);
13195
+ const imageUrl = propertyData.images?.[0] ? `https://cdn.repliers.io/${propertyData.images[0]}` : propertyElement.attributes?.["image-src"];
13196
+ updateElement(focusIdx, {
13197
+ data: {
13198
+ value: {
13199
+ ...propertyElement.data?.value,
13200
+ mlsNumber: propertyData.mlsNumber
13201
+ }
13202
+ },
13203
+ attributes: {
13204
+ ...propertyElement.attributes,
13205
+ "image-src": imageUrl,
13206
+ "price": String(propertyData.listPrice || 0),
13207
+ "address": `${propertyData.address?.streetNumber || ""} ${propertyData.address?.streetName || ""}`.trim(),
13208
+ "city": `${propertyData.address?.city || ""}, ${propertyData.address?.state || ""} ${propertyData.address?.zip || ""}`.trim(),
13209
+ "beds": String(propertyData.details?.numBedrooms || "--"),
13210
+ "baths": String(propertyData.details?.numBathrooms || "--"),
13211
+ "sqft": String(propertyData.details?.sqft || "--"),
13212
+ "status": propertyData.standardStatus || propertyData.status || "Active",
13213
+ "brokerage": propertyData.office?.brokerageName || ""
13214
+ }
13215
+ });
13216
+ setPropertyData(null);
13217
+ setIsOpen(false);
13218
+ };
13219
+ const handleDone = async () => {
13220
+ if (inputValue.trim()) {
13221
+ setIsLoading(true);
13222
+ try {
13223
+ const data = await getListingByMlsNumber(inputValue.trim());
13224
+ if (data.error) {
13225
+ onToast?.({ type: "error", message: data.error });
13226
+ return;
13227
+ }
13228
+ setPropertyData(data);
13229
+ } catch (error) {
13230
+ console.warn("Failed to fetch listing:", error);
13231
+ const message = error instanceof Error ? error.message : "Failed to fetch listing";
13232
+ onToast?.({ type: "error", message });
13233
+ } finally {
13234
+ setIsLoading(false);
13235
+ }
13236
+ }
13237
+ };
13238
+ return /* @__PURE__ */ jsxs22(DropdownMenu, { open: isOpen, onOpenChange: setIsOpen, children: [
13239
+ /* @__PURE__ */ jsxs22(Tooltip, { children: [
13240
+ /* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs22(
13241
+ Button,
13242
+ {
13243
+ variant: "ghost",
13244
+ className: "shadow-none transition-none cursor-pointer rounded-full outline-none h-[34px]",
13245
+ children: [
13246
+ /* @__PURE__ */ jsx37(HousePlusIcon, { className: "size-4" }),
13247
+ /* @__PURE__ */ jsx37("p", { children: "MLS" })
13248
+ ]
13249
+ }
13250
+ ) }) }),
13251
+ /* @__PURE__ */ jsx37(TooltipContent, { side: "bottom", children: "Enter MLS Number" })
13252
+ ] }),
13253
+ /* @__PURE__ */ jsxs22(DropdownMenuContent, { side: "bottom", className: "w-[250px] p-3 shadow-lg z-50001", children: [
13254
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-2", children: [
13255
+ /* @__PURE__ */ jsx37(Label, { children: "Enter MLS Number" }),
13256
+ /* @__PURE__ */ jsx37(
13257
+ Input,
13258
+ {
13259
+ type: "text",
13260
+ placeholder: "e.g., W1234567",
13261
+ className: "w-full rounded-[12px] shadow-none h-[44px]",
13262
+ value: inputValue,
13263
+ onChange: handleInputChange,
13264
+ onKeyDown: handleKeyDown,
13265
+ autoFocus: true
13266
+ }
13267
+ )
13268
+ ] }),
13269
+ /* @__PURE__ */ jsx37(Separator, { className: "my-2" }),
13270
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-row justify-between items-center", children: [
13271
+ /* @__PURE__ */ jsx37("div", { className: "flex flex-row", children: /* @__PURE__ */ jsxs22(Tooltip, { children: [
13272
+ /* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(
13273
+ Button,
13274
+ {
13275
+ variant: "ghost",
13276
+ size: "icon",
13277
+ className: "shadow-none transition-none cursor-pointer rounded-full outline-none",
13278
+ onClick: handleClear,
13279
+ disabled: !inputValue,
13280
+ children: /* @__PURE__ */ jsx37(TrashIcon5, {})
13281
+ }
13282
+ ) }),
13283
+ /* @__PURE__ */ jsx37(TooltipContent, { side: "bottom", className: "z-50001", children: "Clear" })
13284
+ ] }) }),
13285
+ /* @__PURE__ */ jsx37("div", { children: /* @__PURE__ */ jsx37(
13286
+ Button,
13287
+ {
13288
+ variant: "default",
13289
+ className: "shadow-none transition-none cursor-pointer rounded-[12px] outline-none",
13290
+ onClick: handleDone,
13291
+ disabled: isLoading || !inputValue.trim(),
13292
+ children: isLoading ? /* @__PURE__ */ jsx37(Loader2Icon, { className: "size-4 animate-spin" }) : "Done"
13293
+ }
13294
+ ) })
13295
+ ] }),
13296
+ propertyData && /* @__PURE__ */ jsxs22(Fragment14, { children: [
13297
+ /* @__PURE__ */ jsx37(Separator, { className: "my-2" }),
13298
+ /* @__PURE__ */ jsxs22("div", { className: "rounded-[12px] border overflow-hidden bg-card", children: [
13299
+ /* @__PURE__ */ jsxs22("div", { className: "relative", children: [
13300
+ /* @__PURE__ */ jsx37(
13301
+ "img",
13302
+ {
13303
+ src: `https://cdn.repliers.io/${propertyData.images?.[0]}`,
13304
+ alt: "Property",
13305
+ className: "w-full h-[120px] object-cover"
13306
+ }
13307
+ ),
13308
+ /* @__PURE__ */ jsx37(
13309
+ Button,
13310
+ {
13311
+ variant: "ghost",
13312
+ size: "icon",
13313
+ className: "absolute top-1 right-1 h-6 w-6 bg-black/50 hover:bg-black/70 rounded-full",
13314
+ onClick: handleClearPreview,
13315
+ children: /* @__PURE__ */ jsx37(XIcon2, { className: "size-3 text-white" })
13316
+ }
13317
+ )
13318
+ ] }),
13319
+ /* @__PURE__ */ jsxs22("div", { className: "p-2 flex flex-col gap-1", children: [
13320
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between", children: [
13321
+ /* @__PURE__ */ jsx37("span", { className: "font-semibold text-sm", children: formatPrice(String(propertyData.listPrice || 0)) }),
13322
+ /* @__PURE__ */ jsx37("span", { className: "text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-700", children: propertyData.standardStatus || propertyData.status })
13323
+ ] }),
13324
+ /* @__PURE__ */ jsxs22("div", { className: "text-sm", children: [
13325
+ propertyData.address?.streetNumber,
13326
+ " ",
13327
+ propertyData.address?.streetName
13328
+ ] }),
13329
+ /* @__PURE__ */ jsxs22("div", { className: "text-xs text-muted-foreground", children: [
13330
+ propertyData.address?.city,
13331
+ ", ",
13332
+ propertyData.address?.state,
13333
+ " ",
13334
+ propertyData.address?.zip
13335
+ ] }),
13336
+ /* @__PURE__ */ jsxs22("div", { className: "text-xs text-muted-foreground", children: [
13337
+ propertyData.details?.numBedrooms,
13338
+ " bd | ",
13339
+ propertyData.details?.numBathrooms,
13340
+ " ba | ",
13341
+ formatNumber(String(propertyData.details?.sqft || "--")),
13342
+ " sf"
13343
+ ] }),
13344
+ propertyData.office?.brokerageName && /* @__PURE__ */ jsx37("div", { className: "text-xs text-muted-foreground truncate", children: propertyData.office.brokerageName }),
13345
+ /* @__PURE__ */ jsx37(
13346
+ Button,
13347
+ {
13348
+ variant: "default",
13349
+ size: "sm",
13350
+ className: "w-full mt-2 rounded-[12px]",
13351
+ onClick: handleApplyToCard,
13352
+ children: "Apply to Card"
13353
+ }
13354
+ )
13355
+ ] })
13356
+ ] })
13357
+ ] })
13358
+ ] })
13359
+ ] });
13360
+ };
13361
+
13362
+ // src/core/editor/components/element-gear/property/float.tsx
13363
+ import { Fragment as Fragment15, jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
13032
13364
  function PropertyFloat() {
13033
13365
  const { href, hasHref } = useHref();
13034
- return /* @__PURE__ */ jsxs22(Fragment14, { children: [
13035
- hasHref && /* @__PURE__ */ jsx37(FloatLinkPreview, { href }),
13036
- /* @__PURE__ */ jsx37(HrefMenu, {})
13366
+ return /* @__PURE__ */ jsxs23(Fragment15, { children: [
13367
+ hasHref && /* @__PURE__ */ jsx38(FloatLinkPreview, { href }),
13368
+ /* @__PURE__ */ jsx38(HrefMenu, {}),
13369
+ /* @__PURE__ */ jsx38(MlsNumberMenu, {})
13037
13370
  ] });
13038
13371
  }
13039
13372
 
13040
13373
  // src/core/editor/components/element-gear/property/triple/float.tsx
13041
- import { Fragment as Fragment15, jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
13374
+ import { Fragment as Fragment16, jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
13042
13375
  var PropertyTripleItemFloat = () => {
13043
13376
  const { href, hasHref } = useHref();
13044
- return /* @__PURE__ */ jsxs23(Fragment15, { children: [
13045
- hasHref && /* @__PURE__ */ jsx38(FloatLinkPreview, { href }),
13046
- /* @__PURE__ */ jsx38(HrefMenu, {})
13377
+ return /* @__PURE__ */ jsxs24(Fragment16, { children: [
13378
+ hasHref && /* @__PURE__ */ jsx39(FloatLinkPreview, { href }),
13379
+ /* @__PURE__ */ jsx39(HrefMenu, {})
13047
13380
  ] });
13048
13381
  };
13049
13382
 
13050
13383
  // src/core/editor/components/float-ui/container.tsx
13051
- import { jsx as jsx39 } from "react/jsx-runtime";
13384
+ import { jsx as jsx40 } from "react/jsx-runtime";
13052
13385
  var FloatUIContainer = ({ ref, style, className, children }) => {
13053
- return /* @__PURE__ */ jsx39("div", { ref, style, className, children });
13386
+ return /* @__PURE__ */ jsx40("div", { ref, style, className, children });
13054
13387
  };
13055
13388
 
13056
13389
  // src/core/editor/components/element-float.tsx
13057
- import { jsx as jsx40 } from "react/jsx-runtime";
13390
+ import { jsx as jsx41 } from "react/jsx-runtime";
13058
13391
  var FLOAT_COMPONENTS = {
13059
13392
  "button": ButtonFloat,
13060
13393
  "section": SectionFloat,
@@ -13078,7 +13411,7 @@ var ElementFloat = ({ getReferenceRect, focusIdx, elementType }) => {
13078
13411
  if (!focusIdx || isDragging || textEditing) return null;
13079
13412
  const FloatComponent = FLOAT_COMPONENTS[elementType];
13080
13413
  if (!FloatComponent) return null;
13081
- return /* @__PURE__ */ jsx40(
13414
+ return /* @__PURE__ */ jsx41(
13082
13415
  ElementFloatContent,
13083
13416
  {
13084
13417
  getReferenceRect,
@@ -13087,7 +13420,7 @@ var ElementFloat = ({ getReferenceRect, focusIdx, elementType }) => {
13087
13420
  );
13088
13421
  };
13089
13422
  var ElementFloatContent = ({ getReferenceRect, FloatComponent }) => {
13090
- const virtualReference = useMemo10(() => ({
13423
+ const virtualReference = useMemo11(() => ({
13091
13424
  getBoundingClientRect: () => {
13092
13425
  const rect = getReferenceRect();
13093
13426
  if (!rect) {
@@ -13107,7 +13440,7 @@ var ElementFloatContent = ({ getReferenceRect, FloatComponent }) => {
13107
13440
  // Keep within viewport
13108
13441
  ]
13109
13442
  });
13110
- useEffect11(() => {
13443
+ useEffect12(() => {
13111
13444
  const rect = getReferenceRect();
13112
13445
  if (!rect || !refs.floating.current) return;
13113
13446
  refs.setPositionReference(virtualReference);
@@ -13122,18 +13455,18 @@ var ElementFloatContent = ({ getReferenceRect, FloatComponent }) => {
13122
13455
  );
13123
13456
  return cleanup;
13124
13457
  }, [getReferenceRect, refs, update, virtualReference]);
13125
- return /* @__PURE__ */ jsx40(FloatUIContainer, { ref: refs.setFloating, style: floatingStyles, className: "bg-white flex items-center justify-center border border-1 h-[36px] w-fit shadow-md rounded-full z-50", children: /* @__PURE__ */ jsx40(FloatComponent, {}) });
13458
+ return /* @__PURE__ */ jsx41(FloatUIContainer, { ref: refs.setFloating, style: floatingStyles, className: "bg-white flex items-center justify-center border border-1 h-[36px] w-fit shadow-md rounded-full z-50", children: /* @__PURE__ */ jsx41(FloatComponent, {}) });
13126
13459
  };
13127
13460
 
13128
13461
  // src/core/editor/components/scaling/divider-scale.tsx
13129
- import { useMemo as useMemo11, useEffect as useEffect12, useState as useState8, useRef as useRef5, useCallback as useCallback10 } from "react";
13462
+ import { useMemo as useMemo12, useEffect as useEffect13, useState as useState9, useRef as useRef5, useCallback as useCallback11 } from "react";
13130
13463
  import { useFloating as useFloating5, offset as offset5, autoUpdate as autoUpdate4 } from "@floating-ui/react";
13131
- import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
13464
+ import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
13132
13465
  var DividerScale = ({ getReferenceRect }) => {
13133
- const [dimensions, setDimensions] = useState8({ width: 0, height: 0 });
13134
- const [activeSide, setActiveSide] = useState8(null);
13466
+ const [dimensions, setDimensions] = useState9({ width: 0, height: 0 });
13467
+ const [activeSide, setActiveSide] = useState9(null);
13135
13468
  const { focusIdx, template, setIsScaling } = useEditorStore();
13136
- const { currentWidth, currentAlign } = useMemo11(() => {
13469
+ const { currentWidth, currentAlign } = useMemo12(() => {
13137
13470
  if (!focusIdx || !template) return { currentWidth: 100, currentAlign: "center" };
13138
13471
  const element = getValueByIdx(template, focusIdx);
13139
13472
  const rawWidth = element?.attributes?.width;
@@ -13143,12 +13476,12 @@ var DividerScale = ({ getReferenceRect }) => {
13143
13476
  return { currentWidth: width, currentAlign: align };
13144
13477
  }, [focusIdx, template]);
13145
13478
  const dragRef = useRef5(null);
13146
- const getContainerWidth = useCallback10(() => {
13479
+ const getContainerWidth = useCallback11(() => {
13147
13480
  const rect = getReferenceRect();
13148
13481
  if (!rect || currentWidth <= 0) return null;
13149
13482
  return rect.width / (currentWidth / 100);
13150
13483
  }, [getReferenceRect, currentWidth]);
13151
- const handlePointerDown = useCallback10((e, side) => {
13484
+ const handlePointerDown = useCallback11((e, side) => {
13152
13485
  e.preventDefault();
13153
13486
  e.stopPropagation();
13154
13487
  const containerWidth = getContainerWidth();
@@ -13166,7 +13499,7 @@ var DividerScale = ({ getReferenceRect }) => {
13166
13499
  document.addEventListener("pointermove", handlePointerMove);
13167
13500
  document.addEventListener("pointerup", handlePointerUp);
13168
13501
  }, [getContainerWidth, currentWidth, currentAlign, setIsScaling]);
13169
- const handlePointerMove = useCallback10((e) => {
13502
+ const handlePointerMove = useCallback11((e) => {
13170
13503
  if (!dragRef.current) return;
13171
13504
  const { startX, startWidth, containerWidth, side, align } = dragRef.current;
13172
13505
  const deltaX = e.clientX - startX;
@@ -13186,20 +13519,20 @@ var DividerScale = ({ getReferenceRect }) => {
13186
13519
  }
13187
13520
  });
13188
13521
  }, []);
13189
- const handlePointerUp = useCallback10(() => {
13522
+ const handlePointerUp = useCallback11(() => {
13190
13523
  setActiveSide(null);
13191
13524
  setIsScaling(false);
13192
13525
  dragRef.current = null;
13193
13526
  document.removeEventListener("pointermove", handlePointerMove);
13194
13527
  document.removeEventListener("pointerup", handlePointerUp);
13195
13528
  }, [handlePointerMove, setIsScaling]);
13196
- useEffect12(() => {
13529
+ useEffect13(() => {
13197
13530
  return () => {
13198
13531
  document.removeEventListener("pointermove", handlePointerMove);
13199
13532
  document.removeEventListener("pointerup", handlePointerUp);
13200
13533
  };
13201
13534
  }, [handlePointerMove, handlePointerUp]);
13202
- const virtualReference = useMemo11(() => ({
13535
+ const virtualReference = useMemo12(() => ({
13203
13536
  getBoundingClientRect: () => {
13204
13537
  const rect = getReferenceRect();
13205
13538
  if (!rect) {
@@ -13214,7 +13547,7 @@ var DividerScale = ({ getReferenceRect }) => {
13214
13547
  offset5(({ rects }) => -rects.reference.height)
13215
13548
  ]
13216
13549
  });
13217
- useEffect12(() => {
13550
+ useEffect13(() => {
13218
13551
  const rect = getReferenceRect();
13219
13552
  if (!rect || !refs.floating.current) return;
13220
13553
  refs.setPositionReference(virtualReference);
@@ -13241,7 +13574,7 @@ var DividerScale = ({ getReferenceRect }) => {
13241
13574
  }, [getReferenceRect, refs, update, virtualReference]);
13242
13575
  const showLeftHandle = currentAlign !== "left";
13243
13576
  const showRightHandle = currentAlign !== "right";
13244
- return /* @__PURE__ */ jsxs24(
13577
+ return /* @__PURE__ */ jsxs25(
13245
13578
  "div",
13246
13579
  {
13247
13580
  ref: refs.setFloating,
@@ -13253,14 +13586,14 @@ var DividerScale = ({ getReferenceRect }) => {
13253
13586
  },
13254
13587
  className: "relative flex flex-row items-center justify-between",
13255
13588
  children: [
13256
- showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx41(
13589
+ showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx42(
13257
13590
  "div",
13258
13591
  {
13259
13592
  onPointerDown: (e) => handlePointerDown(e, "left"),
13260
13593
  className: `w-[18px] h-[18px] cursor-ew-resize bg-background shadow-md border rounded-full absolute -left-[9px] top-1/2 -translate-y-1/2 touch-none select-none ${activeSide === "left" ? "bg-blue-400 border-blue-300" : "hover:bg-blue-400 hover:border-blue-300"}`
13261
13594
  }
13262
13595
  ),
13263
- showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx41(
13596
+ showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx42(
13264
13597
  "div",
13265
13598
  {
13266
13599
  onPointerDown: (e) => handlePointerDown(e, "right"),
@@ -13273,14 +13606,14 @@ var DividerScale = ({ getReferenceRect }) => {
13273
13606
  };
13274
13607
 
13275
13608
  // src/core/editor/components/scaling/button-scale.tsx
13276
- import { useMemo as useMemo12, useEffect as useEffect13, useState as useState9, useRef as useRef6, useCallback as useCallback11 } from "react";
13609
+ import { useMemo as useMemo13, useEffect as useEffect14, useState as useState10, useRef as useRef6, useCallback as useCallback12 } from "react";
13277
13610
  import { useFloating as useFloating6, offset as offset6, autoUpdate as autoUpdate5 } from "@floating-ui/react";
13278
- import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
13611
+ import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
13279
13612
  var ButtonScale = ({ getReferenceRect }) => {
13280
- const [dimensions, setDimensions] = useState9({ width: 0, height: 0 });
13281
- const [activeSide, setActiveSide] = useState9(null);
13613
+ const [dimensions, setDimensions] = useState10({ width: 0, height: 0 });
13614
+ const [activeSide, setActiveSide] = useState10(null);
13282
13615
  const { focusIdx, template, setIsScaling } = useEditorStore();
13283
- const { currentWidth, currentHeight, currentAlign } = useMemo12(() => {
13616
+ const { currentWidth, currentHeight, currentAlign } = useMemo13(() => {
13284
13617
  if (!focusIdx || !template) {
13285
13618
  return { currentWidth: 24, currentHeight: 44, currentAlign: "center" };
13286
13619
  }
@@ -13295,12 +13628,12 @@ var ButtonScale = ({ getReferenceRect }) => {
13295
13628
  return { currentWidth: width, currentHeight: height, currentAlign: align };
13296
13629
  }, [focusIdx, template]);
13297
13630
  const dragRef = useRef6(null);
13298
- const getContainerWidth = useCallback11(() => {
13631
+ const getContainerWidth = useCallback12(() => {
13299
13632
  const rect = getReferenceRect();
13300
13633
  if (!rect || currentWidth <= 0) return null;
13301
13634
  return rect.width / (currentWidth / 100);
13302
13635
  }, [getReferenceRect, currentWidth]);
13303
- const handlePointerDown = useCallback11((e, side) => {
13636
+ const handlePointerDown = useCallback12((e, side) => {
13304
13637
  e.preventDefault();
13305
13638
  e.stopPropagation();
13306
13639
  if (document.activeElement instanceof HTMLElement) {
@@ -13322,7 +13655,7 @@ var ButtonScale = ({ getReferenceRect }) => {
13322
13655
  document.addEventListener("pointermove", handlePointerMove);
13323
13656
  document.addEventListener("pointerup", handlePointerUp);
13324
13657
  }, [getContainerWidth, currentWidth, currentHeight, currentAlign, setIsScaling]);
13325
- const handlePointerMove = useCallback11((e) => {
13658
+ const handlePointerMove = useCallback12((e) => {
13326
13659
  if (!dragRef.current) return;
13327
13660
  const { startX, startY, startWidth, startHeight, containerWidth, side, align } = dragRef.current;
13328
13661
  const state = useEditorStore.getState();
@@ -13354,20 +13687,20 @@ var ButtonScale = ({ getReferenceRect }) => {
13354
13687
  });
13355
13688
  }
13356
13689
  }, []);
13357
- const handlePointerUp = useCallback11(() => {
13690
+ const handlePointerUp = useCallback12(() => {
13358
13691
  setActiveSide(null);
13359
13692
  setIsScaling(false);
13360
13693
  dragRef.current = null;
13361
13694
  document.removeEventListener("pointermove", handlePointerMove);
13362
13695
  document.removeEventListener("pointerup", handlePointerUp);
13363
13696
  }, [handlePointerMove, setIsScaling]);
13364
- useEffect13(() => {
13697
+ useEffect14(() => {
13365
13698
  return () => {
13366
13699
  document.removeEventListener("pointermove", handlePointerMove);
13367
13700
  document.removeEventListener("pointerup", handlePointerUp);
13368
13701
  };
13369
13702
  }, [handlePointerMove, handlePointerUp]);
13370
- const virtualReference = useMemo12(() => ({
13703
+ const virtualReference = useMemo13(() => ({
13371
13704
  getBoundingClientRect: () => {
13372
13705
  const rect = getReferenceRect();
13373
13706
  if (!rect) {
@@ -13382,7 +13715,7 @@ var ButtonScale = ({ getReferenceRect }) => {
13382
13715
  offset6(({ rects }) => -rects.reference.height)
13383
13716
  ]
13384
13717
  });
13385
- useEffect13(() => {
13718
+ useEffect14(() => {
13386
13719
  const rect = getReferenceRect();
13387
13720
  if (!rect || !refs.floating.current) return;
13388
13721
  refs.setPositionReference(virtualReference);
@@ -13411,7 +13744,7 @@ var ButtonScale = ({ getReferenceRect }) => {
13411
13744
  const showRightHandle = currentAlign !== "right";
13412
13745
  const handleBaseClass = "bg-background shadow-md border rounded-full absolute touch-none select-none pointer-events-auto";
13413
13746
  const getHandleActiveClass = (side) => activeSide === side ? "bg-blue-400 border-blue-300" : "hover:bg-blue-400 hover:border-blue-300";
13414
- return /* @__PURE__ */ jsxs25(
13747
+ return /* @__PURE__ */ jsxs26(
13415
13748
  "div",
13416
13749
  {
13417
13750
  ref: refs.setFloating,
@@ -13423,28 +13756,28 @@ var ButtonScale = ({ getReferenceRect }) => {
13423
13756
  },
13424
13757
  className: "relative pointer-events-none",
13425
13758
  children: [
13426
- (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx42(
13759
+ (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx43(
13427
13760
  "div",
13428
13761
  {
13429
13762
  onPointerDown: (e) => handlePointerDown(e, "top"),
13430
13763
  className: `w-[18px] h-[8px] cursor-ns-resize ${handleBaseClass} left-1/2 -translate-x-1/2 -top-[4px] ${getHandleActiveClass("top")}`
13431
13764
  }
13432
13765
  ),
13433
- showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx42(
13766
+ showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx43(
13434
13767
  "div",
13435
13768
  {
13436
13769
  onPointerDown: (e) => handlePointerDown(e, "right"),
13437
13770
  className: `w-[8px] h-[18px] cursor-ew-resize ${handleBaseClass} top-1/2 -translate-y-1/2 -right-[4px] ${getHandleActiveClass("right")}`
13438
13771
  }
13439
13772
  ),
13440
- (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx42(
13773
+ (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx43(
13441
13774
  "div",
13442
13775
  {
13443
13776
  onPointerDown: (e) => handlePointerDown(e, "bottom"),
13444
13777
  className: `w-[18px] h-[8px] cursor-ns-resize ${handleBaseClass} left-1/2 -translate-x-1/2 -bottom-[4px] ${getHandleActiveClass("bottom")}`
13445
13778
  }
13446
13779
  ),
13447
- showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx42(
13780
+ showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx43(
13448
13781
  "div",
13449
13782
  {
13450
13783
  onPointerDown: (e) => handlePointerDown(e, "left"),
@@ -13457,14 +13790,14 @@ var ButtonScale = ({ getReferenceRect }) => {
13457
13790
  };
13458
13791
 
13459
13792
  // src/core/editor/components/scaling/image-scale.tsx
13460
- import { useMemo as useMemo13, useEffect as useEffect14, useState as useState10, useRef as useRef7, useCallback as useCallback12 } from "react";
13793
+ import { useMemo as useMemo14, useEffect as useEffect15, useState as useState11, useRef as useRef7, useCallback as useCallback13 } from "react";
13461
13794
  import { useFloating as useFloating7, offset as offset7, autoUpdate as autoUpdate6 } from "@floating-ui/react";
13462
- import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
13795
+ import { jsx as jsx44, jsxs as jsxs27 } from "react/jsx-runtime";
13463
13796
  var ImageScale = ({ getReferenceRect }) => {
13464
- const [dimensions, setDimensions] = useState10({ width: 0, height: 0 });
13465
- const [activeSide, setActiveSide] = useState10(null);
13797
+ const [dimensions, setDimensions] = useState11({ width: 0, height: 0 });
13798
+ const [activeSide, setActiveSide] = useState11(null);
13466
13799
  const { focusIdx, template, setIsScaling } = useEditorStore();
13467
- const { currentWidth, currentHeight, currentAlign } = useMemo13(() => {
13800
+ const { currentWidth, currentHeight, currentAlign } = useMemo14(() => {
13468
13801
  if (!focusIdx || !template) {
13469
13802
  return { currentWidth: 0, currentHeight: 0, currentAlign: "center" };
13470
13803
  }
@@ -13479,7 +13812,7 @@ var ImageScale = ({ getReferenceRect }) => {
13479
13812
  return { currentWidth: width, currentHeight: height, currentAlign: align };
13480
13813
  }, [focusIdx, template]);
13481
13814
  const dragRef = useRef7(null);
13482
- const handlePointerDown = useCallback12((e, side) => {
13815
+ const handlePointerDown = useCallback13((e, side) => {
13483
13816
  e.preventDefault();
13484
13817
  e.stopPropagation();
13485
13818
  if (document.activeElement instanceof HTMLElement) {
@@ -13502,7 +13835,7 @@ var ImageScale = ({ getReferenceRect }) => {
13502
13835
  document.addEventListener("pointermove", handlePointerMove);
13503
13836
  document.addEventListener("pointerup", handlePointerUp);
13504
13837
  }, [getReferenceRect, currentWidth, currentHeight, currentAlign, setIsScaling]);
13505
- const handlePointerMove = useCallback12((e) => {
13838
+ const handlePointerMove = useCallback13((e) => {
13506
13839
  if (!dragRef.current) return;
13507
13840
  const { startX, startY, startWidth, startHeight, side, align } = dragRef.current;
13508
13841
  const state = useEditorStore.getState();
@@ -13533,20 +13866,20 @@ var ImageScale = ({ getReferenceRect }) => {
13533
13866
  });
13534
13867
  }
13535
13868
  }, []);
13536
- const handlePointerUp = useCallback12(() => {
13869
+ const handlePointerUp = useCallback13(() => {
13537
13870
  setActiveSide(null);
13538
13871
  setIsScaling(false);
13539
13872
  dragRef.current = null;
13540
13873
  document.removeEventListener("pointermove", handlePointerMove);
13541
13874
  document.removeEventListener("pointerup", handlePointerUp);
13542
13875
  }, [handlePointerMove, setIsScaling]);
13543
- useEffect14(() => {
13876
+ useEffect15(() => {
13544
13877
  return () => {
13545
13878
  document.removeEventListener("pointermove", handlePointerMove);
13546
13879
  document.removeEventListener("pointerup", handlePointerUp);
13547
13880
  };
13548
13881
  }, [handlePointerMove, handlePointerUp]);
13549
- const virtualReference = useMemo13(() => ({
13882
+ const virtualReference = useMemo14(() => ({
13550
13883
  getBoundingClientRect: () => {
13551
13884
  const rect = getReferenceRect();
13552
13885
  if (!rect) {
@@ -13561,7 +13894,7 @@ var ImageScale = ({ getReferenceRect }) => {
13561
13894
  offset7(({ rects }) => -rects.reference.height)
13562
13895
  ]
13563
13896
  });
13564
- useEffect14(() => {
13897
+ useEffect15(() => {
13565
13898
  const rect = getReferenceRect();
13566
13899
  if (!rect || !refs.floating.current) return;
13567
13900
  refs.setPositionReference(virtualReference);
@@ -13590,7 +13923,7 @@ var ImageScale = ({ getReferenceRect }) => {
13590
13923
  const showRightHandle = currentAlign !== "right";
13591
13924
  const handleBaseClass = "bg-background shadow-md border rounded-full absolute touch-none select-none pointer-events-auto";
13592
13925
  const getHandleActiveClass = (side) => activeSide === side ? "bg-blue-400 border-blue-300" : "hover:bg-blue-400 hover:border-blue-300";
13593
- return /* @__PURE__ */ jsxs26(
13926
+ return /* @__PURE__ */ jsxs27(
13594
13927
  "div",
13595
13928
  {
13596
13929
  ref: refs.setFloating,
@@ -13602,28 +13935,28 @@ var ImageScale = ({ getReferenceRect }) => {
13602
13935
  },
13603
13936
  className: "relative pointer-events-none",
13604
13937
  children: [
13605
- (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx43(
13938
+ (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx44(
13606
13939
  "div",
13607
13940
  {
13608
13941
  onPointerDown: (e) => handlePointerDown(e, "top"),
13609
13942
  className: `w-[18px] h-[8px] cursor-ns-resize ${handleBaseClass} left-1/2 -translate-x-1/2 -top-[4px] ${getHandleActiveClass("top")}`
13610
13943
  }
13611
13944
  ),
13612
- showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx43(
13945
+ showRightHandle && (activeSide === null || activeSide === "right") && /* @__PURE__ */ jsx44(
13613
13946
  "div",
13614
13947
  {
13615
13948
  onPointerDown: (e) => handlePointerDown(e, "right"),
13616
13949
  className: `w-[8px] h-[18px] cursor-ew-resize ${handleBaseClass} top-1/2 -translate-y-1/2 -right-[4px] ${getHandleActiveClass("right")}`
13617
13950
  }
13618
13951
  ),
13619
- (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx43(
13952
+ (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx44(
13620
13953
  "div",
13621
13954
  {
13622
13955
  onPointerDown: (e) => handlePointerDown(e, "bottom"),
13623
13956
  className: `w-[18px] h-[8px] cursor-ns-resize ${handleBaseClass} left-1/2 -translate-x-1/2 -bottom-[4px] ${getHandleActiveClass("bottom")}`
13624
13957
  }
13625
13958
  ),
13626
- showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx43(
13959
+ showLeftHandle && (activeSide === null || activeSide === "left") && /* @__PURE__ */ jsx44(
13627
13960
  "div",
13628
13961
  {
13629
13962
  onPointerDown: (e) => handlePointerDown(e, "left"),
@@ -13636,14 +13969,14 @@ var ImageScale = ({ getReferenceRect }) => {
13636
13969
  };
13637
13970
 
13638
13971
  // src/core/editor/components/scaling/spacer-scale.tsx
13639
- import { useMemo as useMemo14, useEffect as useEffect15, useState as useState11, useRef as useRef8, useCallback as useCallback13 } from "react";
13972
+ import { useMemo as useMemo15, useEffect as useEffect16, useState as useState12, useRef as useRef8, useCallback as useCallback14 } from "react";
13640
13973
  import { useFloating as useFloating8, offset as offset8, autoUpdate as autoUpdate7 } from "@floating-ui/react";
13641
- import { jsx as jsx44, jsxs as jsxs27 } from "react/jsx-runtime";
13974
+ import { jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
13642
13975
  var SpacerScale = ({ getReferenceRect }) => {
13643
- const [dimensions, setDimensions] = useState11({ width: 0, height: 0 });
13644
- const [activeSide, setActiveSide] = useState11(null);
13976
+ const [dimensions, setDimensions] = useState12({ width: 0, height: 0 });
13977
+ const [activeSide, setActiveSide] = useState12(null);
13645
13978
  const { focusIdx, template, setIsScaling } = useEditorStore();
13646
- const currentHeight = useMemo14(() => {
13979
+ const currentHeight = useMemo15(() => {
13647
13980
  if (!focusIdx || !template) return 12;
13648
13981
  const element = getValueByIdx(template, focusIdx);
13649
13982
  const rawHeight = element?.attributes?.height;
@@ -13651,7 +13984,7 @@ var SpacerScale = ({ getReferenceRect }) => {
13651
13984
  return isNaN(parsedHeight) ? 12 : Math.max(12, Math.min(200, parsedHeight));
13652
13985
  }, [focusIdx, template]);
13653
13986
  const dragRef = useRef8(null);
13654
- const handlePointerDown = useCallback13((e, side) => {
13987
+ const handlePointerDown = useCallback14((e, side) => {
13655
13988
  e.preventDefault();
13656
13989
  e.stopPropagation();
13657
13990
  if (document.activeElement instanceof HTMLElement) {
@@ -13667,7 +14000,7 @@ var SpacerScale = ({ getReferenceRect }) => {
13667
14000
  document.addEventListener("pointermove", handlePointerMove);
13668
14001
  document.addEventListener("pointerup", handlePointerUp);
13669
14002
  }, [currentHeight, setIsScaling]);
13670
- const handlePointerMove = useCallback13((e) => {
14003
+ const handlePointerMove = useCallback14((e) => {
13671
14004
  if (!dragRef.current) return;
13672
14005
  const { startY, startHeight, side } = dragRef.current;
13673
14006
  const state = useEditorStore.getState();
@@ -13685,20 +14018,20 @@ var SpacerScale = ({ getReferenceRect }) => {
13685
14018
  }
13686
14019
  });
13687
14020
  }, []);
13688
- const handlePointerUp = useCallback13(() => {
14021
+ const handlePointerUp = useCallback14(() => {
13689
14022
  setActiveSide(null);
13690
14023
  setIsScaling(false);
13691
14024
  dragRef.current = null;
13692
14025
  document.removeEventListener("pointermove", handlePointerMove);
13693
14026
  document.removeEventListener("pointerup", handlePointerUp);
13694
14027
  }, [handlePointerMove, setIsScaling]);
13695
- useEffect15(() => {
14028
+ useEffect16(() => {
13696
14029
  return () => {
13697
14030
  document.removeEventListener("pointermove", handlePointerMove);
13698
14031
  document.removeEventListener("pointerup", handlePointerUp);
13699
14032
  };
13700
14033
  }, [handlePointerMove, handlePointerUp]);
13701
- const virtualReference = useMemo14(() => ({
14034
+ const virtualReference = useMemo15(() => ({
13702
14035
  getBoundingClientRect: () => {
13703
14036
  const rect = getReferenceRect();
13704
14037
  if (!rect) {
@@ -13713,7 +14046,7 @@ var SpacerScale = ({ getReferenceRect }) => {
13713
14046
  offset8(({ rects }) => -rects.reference.height)
13714
14047
  ]
13715
14048
  });
13716
- useEffect15(() => {
14049
+ useEffect16(() => {
13717
14050
  const rect = getReferenceRect();
13718
14051
  if (!rect || !refs.floating.current) return;
13719
14052
  refs.setPositionReference(virtualReference);
@@ -13740,7 +14073,7 @@ var SpacerScale = ({ getReferenceRect }) => {
13740
14073
  }, [getReferenceRect, refs, update, virtualReference]);
13741
14074
  const handleBaseClass = "bg-background shadow-md border rounded-full absolute touch-none select-none pointer-events-auto";
13742
14075
  const getHandleActiveClass = (side) => activeSide === side ? "bg-blue-400 border-blue-300" : "hover:bg-blue-400 hover:border-blue-300";
13743
- return /* @__PURE__ */ jsxs27(
14076
+ return /* @__PURE__ */ jsxs28(
13744
14077
  "div",
13745
14078
  {
13746
14079
  ref: refs.setFloating,
@@ -13752,14 +14085,14 @@ var SpacerScale = ({ getReferenceRect }) => {
13752
14085
  },
13753
14086
  className: "relative pointer-events-none",
13754
14087
  children: [
13755
- (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx44(
14088
+ (activeSide === null || activeSide === "top") && /* @__PURE__ */ jsx45(
13756
14089
  "div",
13757
14090
  {
13758
14091
  onPointerDown: (e) => handlePointerDown(e, "top"),
13759
14092
  className: `w-[18px] h-[8px] cursor-ns-resize ${handleBaseClass} left-1/2 -translate-x-1/2 -top-[4px] ${getHandleActiveClass("top")}`
13760
14093
  }
13761
14094
  ),
13762
- (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx44(
14095
+ (activeSide === null || activeSide === "bottom") && /* @__PURE__ */ jsx45(
13763
14096
  "div",
13764
14097
  {
13765
14098
  onPointerDown: (e) => handlePointerDown(e, "bottom"),
@@ -13772,19 +14105,19 @@ var SpacerScale = ({ getReferenceRect }) => {
13772
14105
  };
13773
14106
 
13774
14107
  // src/core/editor/components/scaling/column-scale.tsx
13775
- import { useMemo as useMemo15, useEffect as useEffect16, useState as useState12, useRef as useRef9, useCallback as useCallback14 } from "react";
13776
- import { Fragment as Fragment16, jsx as jsx45 } from "react/jsx-runtime";
14108
+ import { useMemo as useMemo16, useEffect as useEffect17, useState as useState13, useRef as useRef9, useCallback as useCallback15 } from "react";
14109
+ import { Fragment as Fragment17, jsx as jsx46 } from "react/jsx-runtime";
13777
14110
  var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13778
- const [activeDivider, setActiveDivider] = useState12(null);
13779
- const [columnRects, setColumnRects] = useState12([]);
14111
+ const [activeDivider, setActiveDivider] = useState13(null);
14112
+ const [columnRects, setColumnRects] = useState13([]);
13780
14113
  const { template, setIsScaling, setFocusIdx, stopTextEditing } = useEditorStore();
13781
- const columnWidths = useMemo15(() => {
14114
+ const columnWidths = useMemo16(() => {
13782
14115
  if (!template) return [];
13783
14116
  const sectionColumn = getValueByIdx(template, sectionColumnIdx);
13784
14117
  return sectionColumn?.data?.value?.columnWidths || [];
13785
14118
  }, [template, sectionColumnIdx]);
13786
14119
  const dragRef = useRef9(null);
13787
- const updateColumnRects = useCallback14(() => {
14120
+ const updateColumnRects = useCallback15(() => {
13788
14121
  if (!shadowRoot) return;
13789
14122
  const allColumns = shadowRoot.querySelectorAll(".node-type-column");
13790
14123
  const matchingColumns = [];
@@ -13816,7 +14149,7 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13816
14149
  });
13817
14150
  setColumnRects(rects);
13818
14151
  }, [shadowRoot, sectionColumnIdx]);
13819
- useEffect16(() => {
14152
+ useEffect17(() => {
13820
14153
  updateColumnRects();
13821
14154
  let animationId;
13822
14155
  const updateLoop = () => {
@@ -13829,7 +14162,7 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13829
14162
  const parseWidth = (width) => {
13830
14163
  return parseFloat(width.replace("%", ""));
13831
14164
  };
13832
- const handlePointerDown = useCallback14((e, dividerIndex) => {
14165
+ const handlePointerDown = useCallback15((e, dividerIndex) => {
13833
14166
  e.preventDefault();
13834
14167
  e.stopPropagation();
13835
14168
  stopTextEditing();
@@ -13855,7 +14188,7 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13855
14188
  document.addEventListener("pointermove", handlePointerMove);
13856
14189
  document.addEventListener("pointerup", handlePointerUp);
13857
14190
  }, [columnRects, columnWidths, setIsScaling]);
13858
- const handlePointerMove = useCallback14((e) => {
14191
+ const handlePointerMove = useCallback15((e) => {
13859
14192
  if (!dragRef.current) return;
13860
14193
  const { startX, leftColIndex, rightColIndex, startLeftWidth, startRightWidth, sectionWidth, allWidths } = dragRef.current;
13861
14194
  const deltaX = e.clientX - startX;
@@ -13889,14 +14222,14 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13889
14222
  }
13890
14223
  });
13891
14224
  }, [sectionColumnIdx]);
13892
- const handlePointerUp = useCallback14(() => {
14225
+ const handlePointerUp = useCallback15(() => {
13893
14226
  setActiveDivider(null);
13894
14227
  setIsScaling(false);
13895
14228
  dragRef.current = null;
13896
14229
  document.removeEventListener("pointermove", handlePointerMove);
13897
14230
  document.removeEventListener("pointerup", handlePointerUp);
13898
14231
  }, [handlePointerMove, setIsScaling]);
13899
- useEffect16(() => {
14232
+ useEffect17(() => {
13900
14233
  return () => {
13901
14234
  document.removeEventListener("pointermove", handlePointerMove);
13902
14235
  document.removeEventListener("pointerup", handlePointerUp);
@@ -13907,7 +14240,7 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13907
14240
  }
13908
14241
  const handleBaseClass = "bg-background shadow-md border rounded-full touch-none select-none pointer-events-auto";
13909
14242
  const getHandleActiveClass = (index) => activeDivider === index ? "bg-blue-400 border-blue-300" : "hover:bg-blue-400 hover:border-blue-300";
13910
- return /* @__PURE__ */ jsx45(Fragment16, { children: columnRects.slice(0, -1).map((rect, index) => {
14243
+ return /* @__PURE__ */ jsx46(Fragment17, { children: columnRects.slice(0, -1).map((rect, index) => {
13911
14244
  const nextRect = columnRects[index + 1];
13912
14245
  const handleLeft = rect.right;
13913
14246
  const handleTop = Math.min(rect.top, nextRect.top);
@@ -13915,7 +14248,7 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13915
14248
  if (activeDivider !== null && activeDivider !== index) {
13916
14249
  return null;
13917
14250
  }
13918
- return /* @__PURE__ */ jsx45(
14251
+ return /* @__PURE__ */ jsx46(
13919
14252
  "div",
13920
14253
  {
13921
14254
  onPointerDown: (e) => handlePointerDown(e, index),
@@ -13935,9 +14268,9 @@ var ColumnScale = ({ sectionColumnIdx, shadowRoot }) => {
13935
14268
  };
13936
14269
 
13937
14270
  // src/core/editor/hooks/use-undo-redo-keyboard.ts
13938
- import { useEffect as useEffect17 } from "react";
14271
+ import { useEffect as useEffect18 } from "react";
13939
14272
  function useUndoRedoKeyboard() {
13940
- useEffect17(() => {
14273
+ useEffect18(() => {
13941
14274
  const handler = (e) => {
13942
14275
  const isMeta = e.metaKey || e.ctrlKey;
13943
14276
  if (!isMeta || e.key.toLowerCase() !== "z") return;
@@ -13958,11 +14291,11 @@ function useUndoRedoKeyboard() {
13958
14291
  }
13959
14292
 
13960
14293
  // src/components/ui/spinner.tsx
13961
- import { Loader2Icon } from "lucide-react";
13962
- import { jsx as jsx46 } from "react/jsx-runtime";
14294
+ import { Loader2Icon as Loader2Icon2 } from "lucide-react";
14295
+ import { jsx as jsx47 } from "react/jsx-runtime";
13963
14296
  function Spinner({ className, ...props }) {
13964
- return /* @__PURE__ */ jsx46(
13965
- Loader2Icon,
14297
+ return /* @__PURE__ */ jsx47(
14298
+ Loader2Icon2,
13966
14299
  {
13967
14300
  role: "status",
13968
14301
  "aria-label": "Loading",
@@ -13976,7 +14309,7 @@ function Spinner({ className, ...props }) {
13976
14309
  import { EyeIcon } from "lucide-react";
13977
14310
 
13978
14311
  // src/render/useMjmlCompiler.ts
13979
- import { useState as useState13, useCallback as useCallback15 } from "react";
14312
+ import { useState as useState14, useCallback as useCallback16 } from "react";
13980
14313
  async function compileMjml(mjml) {
13981
14314
  console.log("Compiling MJML", mjml);
13982
14315
  const response = await fetch("/api/mrender", {
@@ -13993,14 +14326,14 @@ async function compileMjml(mjml) {
13993
14326
  }
13994
14327
 
13995
14328
  // src/core/editor/components/preview.tsx
13996
- import { useEffect as useEffect18, useState as useState14, useRef as useRef10 } from "react";
13997
- import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
14329
+ import { useEffect as useEffect19, useState as useState15, useRef as useRef10 } from "react";
14330
+ import { jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
13998
14331
  function Preview() {
13999
14332
  const { template, setPreviewMode, previewMode, isPaidLevel } = useEditorStore();
14000
- const [html, setHtml] = useState14("");
14001
- const [isLoading, setIsLoading] = useState14(false);
14333
+ const [html, setHtml] = useState15("");
14334
+ const [isLoading, setIsLoading] = useState15(false);
14002
14335
  const lastTemplateRef = useRef10("");
14003
- useEffect18(() => {
14336
+ useEffect19(() => {
14004
14337
  if (typeof window === "undefined" || !previewMode) {
14005
14338
  if (!previewMode) {
14006
14339
  setHtml("");
@@ -14033,37 +14366,37 @@ function Preview() {
14033
14366
  };
14034
14367
  convertMjml();
14035
14368
  }, [template, previewMode]);
14036
- return /* @__PURE__ */ jsxs28(Dialog, { open: previewMode, onOpenChange: setPreviewMode, children: [
14037
- /* @__PURE__ */ jsxs28(Tooltip, { children: [
14038
- /* @__PURE__ */ jsx47(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
14369
+ return /* @__PURE__ */ jsxs29(Dialog, { open: previewMode, onOpenChange: setPreviewMode, children: [
14370
+ /* @__PURE__ */ jsxs29(Tooltip, { children: [
14371
+ /* @__PURE__ */ jsx48(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx48(
14039
14372
  Button,
14040
14373
  {
14041
14374
  variant: "ghost",
14042
14375
  className: "shadow-none transition-none cursor-pointer",
14043
14376
  size: "icon",
14044
14377
  onClick: () => setPreviewMode(true),
14045
- children: /* @__PURE__ */ jsx47(EyeIcon, {})
14378
+ children: /* @__PURE__ */ jsx48(EyeIcon, {})
14046
14379
  }
14047
14380
  ) }),
14048
- /* @__PURE__ */ jsx47(TooltipContent, { side: "bottom", className: "z-51", children: "Preview" })
14381
+ /* @__PURE__ */ jsx48(TooltipContent, { side: "bottom", className: "z-51", children: "Preview" })
14049
14382
  ] }),
14050
- /* @__PURE__ */ jsxs28(DialogContent, { className: "max-w-[1200px] sm:max-w-[1200px]", children: [
14051
- /* @__PURE__ */ jsx47(DialogTitle, { children: "Preview" }),
14052
- /* @__PURE__ */ jsx47("div", { className: "w-full h-full max-h-[600px]", children: isLoading ? /* @__PURE__ */ jsx47("div", { className: "flex items-center justify-center h-[600px]", children: /* @__PURE__ */ jsx47("p", { children: "Generating preview..." }) }) : /* @__PURE__ */ jsx47("iframe", { srcDoc: html, className: "w-full h-[600px]" }) })
14383
+ /* @__PURE__ */ jsxs29(DialogContent, { className: "max-w-[1200px] sm:max-w-[1200px]", children: [
14384
+ /* @__PURE__ */ jsx48(DialogTitle, { children: "Preview" }),
14385
+ /* @__PURE__ */ jsx48("div", { className: "w-full h-full max-h-[600px]", children: isLoading ? /* @__PURE__ */ jsx48("div", { className: "flex items-center justify-center h-[600px]", children: /* @__PURE__ */ jsx48("p", { children: "Generating preview..." }) }) : /* @__PURE__ */ jsx48("iframe", { srcDoc: html, className: "w-full h-[600px]" }) })
14053
14386
  ] })
14054
14387
  ] });
14055
14388
  }
14056
14389
 
14057
14390
  // src/core/editor/components/history.tsx
14058
14391
  import { Redo2Icon, Undo2Icon } from "lucide-react";
14059
- import { Fragment as Fragment17, jsx as jsx48, jsxs as jsxs29 } from "react/jsx-runtime";
14392
+ import { Fragment as Fragment18, jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
14060
14393
  var History = () => {
14061
14394
  const { undo, redo } = useEditorStore();
14062
14395
  const canUndo = useEditorStore((s) => s.historyIndex > 0);
14063
14396
  const canRedo = useEditorStore((s) => s.historyIndex < s.history.length - 1);
14064
- return /* @__PURE__ */ jsxs29(Fragment17, { children: [
14065
- /* @__PURE__ */ jsxs29(Tooltip, { children: [
14066
- /* @__PURE__ */ jsx48(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx48(
14397
+ return /* @__PURE__ */ jsxs30(Fragment18, { children: [
14398
+ /* @__PURE__ */ jsxs30(Tooltip, { children: [
14399
+ /* @__PURE__ */ jsx49(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx49(
14067
14400
  Button,
14068
14401
  {
14069
14402
  variant: "ghost",
@@ -14071,13 +14404,13 @@ var History = () => {
14071
14404
  size: "icon",
14072
14405
  disabled: !canUndo,
14073
14406
  onClick: undo,
14074
- children: /* @__PURE__ */ jsx48(Undo2Icon, {})
14407
+ children: /* @__PURE__ */ jsx49(Undo2Icon, {})
14075
14408
  }
14076
14409
  ) }),
14077
- /* @__PURE__ */ jsx48(TooltipContent, { side: "bottom", children: "Undo (Ctrl+Z)" })
14410
+ /* @__PURE__ */ jsx49(TooltipContent, { side: "bottom", children: "Undo (Ctrl+Z)" })
14078
14411
  ] }),
14079
- /* @__PURE__ */ jsxs29(Tooltip, { children: [
14080
- /* @__PURE__ */ jsx48(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx48(
14412
+ /* @__PURE__ */ jsxs30(Tooltip, { children: [
14413
+ /* @__PURE__ */ jsx49(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx49(
14081
14414
  Button,
14082
14415
  {
14083
14416
  variant: "ghost",
@@ -14085,16 +14418,16 @@ var History = () => {
14085
14418
  size: "icon",
14086
14419
  disabled: !canRedo,
14087
14420
  onClick: redo,
14088
- children: /* @__PURE__ */ jsx48(Redo2Icon, {})
14421
+ children: /* @__PURE__ */ jsx49(Redo2Icon, {})
14089
14422
  }
14090
14423
  ) }),
14091
- /* @__PURE__ */ jsx48(TooltipContent, { side: "bottom", children: "Redo (Ctrl+Shift+Z)" })
14424
+ /* @__PURE__ */ jsx49(TooltipContent, { side: "bottom", children: "Redo (Ctrl+Shift+Z)" })
14092
14425
  ] })
14093
14426
  ] });
14094
14427
  };
14095
14428
 
14096
14429
  // src/core/index.tsx
14097
- import { jsx as jsx49, jsxs as jsxs30 } from "react/jsx-runtime";
14430
+ import { jsx as jsx50, jsxs as jsxs31 } from "react/jsx-runtime";
14098
14431
  var MAILLOW_EMAIL_EDITOR_VERSION = "0.0.1";
14099
14432
  function getSectionColumnIdx(idx, template) {
14100
14433
  let current = idx;
@@ -14158,12 +14491,12 @@ function Editor({ setEditorLoading }) {
14158
14491
  const startTextEditing = useEditorStore((state) => state.startTextEditing);
14159
14492
  const pendingTextEditRequest = useEditorStore((state) => state.pendingTextEditRequest);
14160
14493
  const clearPendingTextEditRequest = useEditorStore((state) => state.clearPendingTextEditRequest);
14161
- const [renderData, setRenderData] = useState15(null);
14162
- const [isEditing, setIsEditing] = useState15(false);
14163
- const [dropIndicator, setDropIndicator] = useState15(null);
14164
- const [dropTargetIdx, setDropTargetIdx] = useState15(null);
14494
+ const [renderData, setRenderData] = useState16(null);
14495
+ const [isEditing, setIsEditing] = useState16(false);
14496
+ const [dropIndicator, setDropIndicator] = useState16(null);
14497
+ const [dropTargetIdx, setDropTargetIdx] = useState16(null);
14165
14498
  const shadowRootRef = useRef11(null);
14166
- const [hasSelectedElement, setHasSelectedElement] = useState15(false);
14499
+ const [hasSelectedElement, setHasSelectedElement] = useState16(false);
14167
14500
  const dragParentIdxRef = useRef11(null);
14168
14501
  const dragPositionIndexRef = useRef11(0);
14169
14502
  const createNewSectionRef = useRef11(false);
@@ -14178,8 +14511,13 @@ function Editor({ setEditorLoading }) {
14178
14511
  const sectionRectCacheRef = useRef11(/* @__PURE__ */ new Map());
14179
14512
  const companyFooterCacheRef = useRef11(void 0);
14180
14513
  const lastSyncedTemplateRef = useRef11(null);
14181
- useEffect19(() => {
14182
- if (!isEditing) {
14514
+ const prevTextEditingIdxRef = useRef11(null);
14515
+ useEffect20(() => {
14516
+ const currentIdx = textEditing?.idx ?? null;
14517
+ const prevIdx = prevTextEditingIdxRef.current;
14518
+ const switchedTarget = currentIdx !== null && prevIdx !== null && currentIdx !== prevIdx;
14519
+ prevTextEditingIdxRef.current = currentIdx;
14520
+ if (!isEditing && (!textEditing || switchedTarget)) {
14183
14521
  if (template === lastSyncedTemplateRef.current) {
14184
14522
  return;
14185
14523
  }
@@ -14188,13 +14526,13 @@ function Editor({ setEditorLoading }) {
14188
14526
  }
14189
14527
  lastSyncedTemplateRef.current = template;
14190
14528
  }
14191
- }, [template, renderData, isEditing]);
14192
- useEffect19(() => {
14529
+ }, [template, renderData, isEditing, textEditing]);
14530
+ useEffect20(() => {
14193
14531
  if (renderData && setEditorLoading) {
14194
14532
  setEditorLoading(false);
14195
14533
  }
14196
14534
  }, [renderData, setEditorLoading]);
14197
- useEffect19(() => {
14535
+ useEffect20(() => {
14198
14536
  if (!pendingTextEditRequest || !shadowRootRef.current) return;
14199
14537
  const { idx, cursorPosition } = pendingTextEditRequest;
14200
14538
  const blockNode = shadowRootRef.current.querySelector(`.node-idx-${CSS.escape(idx)}`);
@@ -14236,10 +14574,14 @@ function Editor({ setEditorLoading }) {
14236
14574
  const element = shadowRootRef.current.querySelector(`.node-idx-${CSS.escape(idx)}`);
14237
14575
  return element ? element.getBoundingClientRect() : null;
14238
14576
  };
14239
- startTextEditing({ idx, getReferenceRect: getReferenceRect2, initialWidth: blockRect.width, initialHeight: blockRect.height, clickX, clickY, content, styles, cursorPosition });
14577
+ const getShadowElement = () => {
14578
+ if (!shadowRootRef.current) return null;
14579
+ return shadowRootRef.current.querySelector(`.node-idx-${CSS.escape(idx)}`);
14580
+ };
14581
+ startTextEditing({ idx, getReferenceRect: getReferenceRect2, getShadowElement, initialWidth: blockRect.width, initialHeight: blockRect.height, clickX, clickY, content, styles, cursorPosition });
14240
14582
  clearPendingTextEditRequest();
14241
14583
  }, [pendingTextEditRequest, clearPendingTextEditRequest, startTextEditing]);
14242
- useEffect19(() => {
14584
+ useEffect20(() => {
14243
14585
  if (isDragging && dataTransfer) {
14244
14586
  const currentTemplate = useEditorStore.getState().template;
14245
14587
  templateCacheRef.current = currentTemplate;
@@ -14255,9 +14597,9 @@ function Editor({ setEditorLoading }) {
14255
14597
  sectionRectCacheRef.current.clear();
14256
14598
  }
14257
14599
  }, [isDragging, dataTransfer]);
14258
- const [html, setHtml] = useState15("");
14600
+ const [html, setHtml] = useState16("");
14259
14601
  const lastRenderDataRef = useRef11("");
14260
- useEffect19(() => {
14602
+ useEffect20(() => {
14261
14603
  if (typeof window === "undefined" || !renderData) {
14262
14604
  setHtml("");
14263
14605
  lastRenderDataRef.current = "";
@@ -14284,13 +14626,13 @@ function Editor({ setEditorLoading }) {
14284
14626
  };
14285
14627
  convertMjml();
14286
14628
  }, [renderData]);
14287
- const debouncedUpdateContent = useMemo16(
14629
+ const debouncedUpdateContent = useMemo17(
14288
14630
  () => debounce((contentIdx, content) => {
14289
14631
  updateElementContent(contentIdx, content);
14290
14632
  }, 200),
14291
14633
  [updateElementContent]
14292
14634
  );
14293
- const handleElementClick = useCallback16(
14635
+ const handleElementClick = useCallback17(
14294
14636
  (idx) => {
14295
14637
  if (isInsideCompanyFooter(idx, template)) {
14296
14638
  return;
@@ -14303,7 +14645,7 @@ function Editor({ setEditorLoading }) {
14303
14645
  },
14304
14646
  [setFocusIdx, template]
14305
14647
  );
14306
- const handleElementHover = useCallback16(
14648
+ const handleElementHover = useCallback17(
14307
14649
  (idx) => {
14308
14650
  if (!isDragging) {
14309
14651
  if (idx) {
@@ -14317,19 +14659,19 @@ function Editor({ setEditorLoading }) {
14317
14659
  },
14318
14660
  [isDragging, setHoverIdx, template]
14319
14661
  );
14320
- const handleContentInput = useCallback16(
14662
+ const handleContentInput = useCallback17(
14321
14663
  (contentIdx, content) => {
14322
14664
  debouncedUpdateContent(contentIdx, content);
14323
14665
  },
14324
14666
  [debouncedUpdateContent]
14325
14667
  );
14326
- const handleEditingStart = useCallback16(() => {
14668
+ const handleEditingStart = useCallback17(() => {
14327
14669
  setIsEditing(true);
14328
14670
  }, []);
14329
- const handleEditingEnd = useCallback16(() => {
14671
+ const handleEditingEnd = useCallback17(() => {
14330
14672
  setIsEditing(false);
14331
14673
  }, []);
14332
- const handleSlashCommand = useCallback16(
14674
+ const handleSlashCommand = useCallback17(
14333
14675
  (cursorRect) => {
14334
14676
  setSlashCommand({
14335
14677
  isActive: true,
@@ -14344,25 +14686,29 @@ function Editor({ setEditorLoading }) {
14344
14686
  },
14345
14687
  [setSlashCommand]
14346
14688
  );
14347
- const handleSlashCommandClose = useCallback16(() => {
14689
+ const handleSlashCommandClose = useCallback17(() => {
14348
14690
  clearSlashCommand();
14349
14691
  }, [clearSlashCommand]);
14350
- const handleTextEditStart = useCallback16(
14692
+ const handleTextEditStart = useCallback17(
14351
14693
  (idx, initialWidth, initialHeight, clickX, clickY, content, styles) => {
14352
14694
  const getReferenceRect2 = () => {
14353
14695
  if (!shadowRootRef.current) return null;
14354
14696
  const element = shadowRootRef.current.querySelector(`.node-idx-${CSS.escape(idx)}`);
14355
14697
  return element ? element.getBoundingClientRect() : null;
14356
14698
  };
14357
- startTextEditing({ idx, getReferenceRect: getReferenceRect2, initialWidth, initialHeight, clickX, clickY, content, styles });
14699
+ const getShadowElement = () => {
14700
+ if (!shadowRootRef.current) return null;
14701
+ return shadowRootRef.current.querySelector(`.node-idx-${CSS.escape(idx)}`);
14702
+ };
14703
+ startTextEditing({ idx, getReferenceRect: getReferenceRect2, getShadowElement, initialWidth, initialHeight, clickX, clickY, content, styles });
14358
14704
  },
14359
14705
  [startTextEditing]
14360
14706
  );
14361
- const findParentSectionIdx = useCallback16((idx) => {
14707
+ const findParentSectionIdx = useCallback17((idx) => {
14362
14708
  const match = /^(content\.children\.\[\d+\])/.exec(idx);
14363
14709
  return match ? match[1] : null;
14364
14710
  }, []);
14365
- const handleDragOver = useCallback16(
14711
+ const handleDragOver = useCallback17(
14366
14712
  (_e, dragInfo) => {
14367
14713
  const currentDataTransfer = useEditorStore.getState().dataTransfer;
14368
14714
  if (!currentDataTransfer) return;
@@ -14773,7 +15119,7 @@ function Editor({ setEditorLoading }) {
14773
15119
  [findParentSectionIdx]
14774
15120
  // Only dependency is the helper function
14775
15121
  );
14776
- const handleDrop = useCallback16(
15122
+ const handleDrop = useCallback17(
14777
15123
  (_e, _dragInfo) => {
14778
15124
  const currentDataTransfer = useEditorStore.getState().dataTransfer;
14779
15125
  if (!currentDataTransfer) return;
@@ -14912,7 +15258,7 @@ function Editor({ setEditorLoading }) {
14912
15258
  },
14913
15259
  [addElement, addElementInNewSection, moveElement, moveElementToNewSection, splitTextAndInsertElement, splitSectionAndInsertElement, setIsDragging, setIsDragButtonHovered, setDataTransfer, setHoverIdx]
14914
15260
  );
14915
- const handleDragLeave = useCallback16(() => {
15261
+ const handleDragLeave = useCallback17(() => {
14916
15262
  setDropIndicator(null);
14917
15263
  setDropTargetIdx(null);
14918
15264
  dragParentIdxRef.current = null;
@@ -14928,13 +15274,13 @@ function Editor({ setEditorLoading }) {
14928
15274
  sectionElementCacheRef.current.clear();
14929
15275
  sectionRectCacheRef.current.clear();
14930
15276
  }, []);
14931
- const handleShadowRootRef = useCallback16((shadowRoot) => {
15277
+ const handleShadowRootRef = useCallback17((shadowRoot) => {
14932
15278
  shadowRootRef.current = shadowRoot;
14933
15279
  }, []);
14934
- const handleSelectionRectChange = useCallback16((rect) => {
15280
+ const handleSelectionRectChange = useCallback17((rect) => {
14935
15281
  setHasSelectedElement(rect !== null);
14936
15282
  }, []);
14937
- const getReferenceRect = useCallback16(() => {
15283
+ const getReferenceRect = useCallback17(() => {
14938
15284
  if (!shadowRootRef.current || !focusIdx) return null;
14939
15285
  const selectedEl = shadowRootRef.current.querySelector(
14940
15286
  `.node-idx-${CSS.escape(focusIdx)}`
@@ -14962,14 +15308,14 @@ function Editor({ setEditorLoading }) {
14962
15308
  }, [focusIdx]);
14963
15309
  const selectedElement = focusIdx && renderData ? getValueByIdx(renderData, focusIdx) : null;
14964
15310
  const canDragSelectedElement = selectedElement && selectedElement.type !== "column" && !(focusIdx && renderData && isInsideCompanyFooter(focusIdx, renderData));
14965
- const showCompanyFooter = useMemo16(
15311
+ const showCompanyFooter = useMemo17(
14966
15312
  () => template.content[0]?.data?.value?.showCompanyFooter ?? true,
14967
15313
  [template.content[0]?.data?.value?.showCompanyFooter]
14968
15314
  );
14969
15315
  if (!html) {
14970
- return /* @__PURE__ */ jsx49("div", { className: "maillow-editor flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx49(Spinner, {}) });
15316
+ return /* @__PURE__ */ jsx50("div", { className: "maillow-editor flex items-center justify-center h-[500px]", children: /* @__PURE__ */ jsx50(Spinner, {}) });
14971
15317
  }
14972
- return /* @__PURE__ */ jsxs30(
15318
+ return /* @__PURE__ */ jsxs31(
14973
15319
  "div",
14974
15320
  {
14975
15321
  className: "maillow-editor relative ",
@@ -14980,7 +15326,7 @@ function Editor({ setEditorLoading }) {
14980
15326
  justifyContent: "center"
14981
15327
  },
14982
15328
  children: [
14983
- /* @__PURE__ */ jsx49(
15329
+ /* @__PURE__ */ jsx50(
14984
15330
  "div",
14985
15331
  {
14986
15332
  className: `editor-container rounded-b-[12px] border-t-1 border-t-accent max-w-[626px]`,
@@ -14990,7 +15336,7 @@ function Editor({ setEditorLoading }) {
14990
15336
  backgroundColor: "#f5f5f5",
14991
15337
  overflow: "auto"
14992
15338
  },
14993
- children: /* @__PURE__ */ jsx49(
15339
+ children: /* @__PURE__ */ jsx50(
14994
15340
  ShadowDomRenderer,
14995
15341
  {
14996
15342
  html,
@@ -15019,9 +15365,9 @@ function Editor({ setEditorLoading }) {
15019
15365
  )
15020
15366
  }
15021
15367
  ),
15022
- /* @__PURE__ */ jsx49(ElementsSuggestions, {}),
15023
- /* @__PURE__ */ jsx49(TiptapOverlay, {}),
15024
- !isDragging && !isScaling && hasSelectedElement && focusIdx && selectedElement?.type && /* @__PURE__ */ jsx49(
15368
+ /* @__PURE__ */ jsx50(ElementsSuggestions, {}),
15369
+ /* @__PURE__ */ jsx50(TiptapOverlay, {}),
15370
+ !isDragging && !isScaling && hasSelectedElement && focusIdx && selectedElement?.type && /* @__PURE__ */ jsx50(
15025
15371
  ElementFloat,
15026
15372
  {
15027
15373
  getReferenceRect,
@@ -15029,7 +15375,7 @@ function Editor({ setEditorLoading }) {
15029
15375
  elementType: selectedElement.type
15030
15376
  }
15031
15377
  ),
15032
- !isScaling && hasSelectedElement && focusIdx && canDragSelectedElement && !NOT_DRAGGABLE_ELEMENTS.includes(selectedElement.type) && /* @__PURE__ */ jsx49(
15378
+ !isScaling && hasSelectedElement && focusIdx && canDragSelectedElement && !NOT_DRAGGABLE_ELEMENTS.includes(selectedElement.type) && /* @__PURE__ */ jsx50(
15033
15379
  DragButton,
15034
15380
  {
15035
15381
  getReferenceRect,
@@ -15038,17 +15384,17 @@ function Editor({ setEditorLoading }) {
15038
15384
  isDragging
15039
15385
  }
15040
15386
  ),
15041
- !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "divider" && /* @__PURE__ */ jsx49(DividerScale, { getReferenceRect }),
15042
- !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "button" && /* @__PURE__ */ jsx49(ButtonScale, { getReferenceRect }),
15043
- !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "image" && /* @__PURE__ */ jsx49(ImageScale, { getReferenceRect }),
15044
- !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "space" && /* @__PURE__ */ jsx49(SpacerScale, { getReferenceRect }),
15387
+ !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "divider" && /* @__PURE__ */ jsx50(DividerScale, { getReferenceRect }),
15388
+ !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "button" && /* @__PURE__ */ jsx50(ButtonScale, { getReferenceRect }),
15389
+ !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "image" && /* @__PURE__ */ jsx50(ImageScale, { getReferenceRect }),
15390
+ !isDragging && hasSelectedElement && focusIdx && selectedElement?.type === "space" && /* @__PURE__ */ jsx50(SpacerScale, { getReferenceRect }),
15045
15391
  !isDragging && hasSelectedElement && focusIdx && renderData && (() => {
15046
15392
  const sectionColumnIdx = getSectionColumnIdx(focusIdx, renderData);
15047
15393
  if (!sectionColumnIdx) return null;
15048
15394
  const sectionColumn = getValueByIdx(renderData, sectionColumnIdx);
15049
15395
  if (!sectionColumn || sectionColumn.type !== "section-column") return null;
15050
15396
  if (!sectionColumn.children || sectionColumn.children.length < 2) return null;
15051
- return /* @__PURE__ */ jsx49(
15397
+ return /* @__PURE__ */ jsx50(
15052
15398
  ColumnScale,
15053
15399
  {
15054
15400
  sectionColumnIdx,
@@ -15072,7 +15418,6 @@ export {
15072
15418
  parsePrice,
15073
15419
  json2mjml,
15074
15420
  MAX_TEMPLATE_SIZE,
15075
- MAX_PAID_LEVEL,
15076
15421
  useEditorStore,
15077
15422
  BUTTON_ALIGNMENTS,
15078
15423
  ALIGNMENT_ICONS,
@@ -15091,7 +15436,6 @@ export {
15091
15436
  MIN_LINE_HEIGHT,
15092
15437
  MAX_LINE_HEIGHT,
15093
15438
  LINE_HEIGHT_STEP,
15094
- IMAGE_SELECTION_VALID_TYPES,
15095
15439
  setupDragImage,
15096
15440
  getElementDisplayName,
15097
15441
  cn,