@ohhwells/bridge 0.1.66-next.190 → 0.1.66-next.192

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -75,7 +75,7 @@ __export(index_exports, {
75
75
  module.exports = __toCommonJS(index_exports);
76
76
 
77
77
  // src/OhhwellsBridge.tsx
78
- var import_react16 = __toESM(require("react"), 1);
78
+ var import_react17 = __toESM(require("react"), 1);
79
79
  var import_client2 = require("react-dom/client");
80
80
  var import_react_dom3 = require("react-dom");
81
81
 
@@ -8130,6 +8130,58 @@ function AiSectionOverlay({
8130
8130
 
8131
8131
  // src/lib/section-instances.ts
8132
8132
  var SECTION_ORDER_KEY = "__ohw_section_order";
8133
+ function topLevelSections() {
8134
+ return Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
8135
+ (el) => !el.parentElement?.closest("[data-ohw-section]") && !isChromeSection(el)
8136
+ );
8137
+ }
8138
+ function instanceIdOf(el) {
8139
+ return el.dataset.ohwInstance ?? el.dataset.ohwSection ?? "";
8140
+ }
8141
+ function planSectionMove(instanceId, targetIndex, currentPath) {
8142
+ const sections = topLevelSections();
8143
+ const index = sections.findIndex((el) => instanceIdOf(el) === instanceId);
8144
+ if (index === -1) return null;
8145
+ const dragged = sections[index];
8146
+ const others = sections.filter((_, i) => i !== index);
8147
+ const clamped = Math.max(0, Math.min(targetIndex, others.length));
8148
+ const reordered = [...others.slice(0, clamped), dragged, ...others.slice(clamped)];
8149
+ return reordered.map((el, order) => ({
8150
+ instanceId: instanceIdOf(el),
8151
+ type: el.getAttribute("data-ohw-section") ?? "",
8152
+ order,
8153
+ pagePath: currentPath
8154
+ }));
8155
+ }
8156
+ function moveSectionInstance(instanceId, direction, currentPath) {
8157
+ const sections = topLevelSections();
8158
+ const index = sections.findIndex((el) => instanceIdOf(el) === instanceId);
8159
+ if (index === -1) return null;
8160
+ const siblingIndex = direction === "up" ? index - 1 : index + 1;
8161
+ if (siblingIndex < 0 || siblingIndex >= sections.length) return null;
8162
+ const entries = planSectionMove(instanceId, siblingIndex, currentPath);
8163
+ if (!entries) return null;
8164
+ applyPersistedOrder(entries);
8165
+ return entries;
8166
+ }
8167
+ function applyPersistedOrder(entries) {
8168
+ if (entries.length === 0) return;
8169
+ const sections = topLevelSections();
8170
+ if (sections.length === 0) return;
8171
+ const orderIndex = new Map(entries.map((e) => [e.instanceId, e.order]));
8172
+ const ordered = [...sections].sort((a, b) => {
8173
+ const aOrder = orderIndex.get(instanceIdOf(a));
8174
+ const bOrder = orderIndex.get(instanceIdOf(b));
8175
+ if (aOrder === void 0 && bOrder === void 0) return 0;
8176
+ if (aOrder === void 0) return 1;
8177
+ if (bOrder === void 0) return -1;
8178
+ return aOrder - bOrder;
8179
+ });
8180
+ const parent = sections[0].parentElement;
8181
+ if (!parent) return;
8182
+ const anchor = sections[sections.length - 1].nextSibling;
8183
+ ordered.forEach((el) => parent.insertBefore(el, anchor));
8184
+ }
8133
8185
  function getPageSectionOrderEntries(raw, currentPath) {
8134
8186
  if (!raw) return [];
8135
8187
  try {
@@ -8167,6 +8219,7 @@ function initSectionInstancesFromContent(content, currentPath) {
8167
8219
  rekeySectionSubtree(clone, entry.instanceId);
8168
8220
  original.insertAdjacentElement("afterend", clone);
8169
8221
  }
8222
+ applyPersistedOrder(entries);
8170
8223
  }
8171
8224
 
8172
8225
  // src/OhhwellsBridge.tsx
@@ -13275,6 +13328,333 @@ function useNavItemDrag({
13275
13328
  };
13276
13329
  }
13277
13330
 
13331
+ // src/useSectionDrag.ts
13332
+ var import_react15 = require("react");
13333
+
13334
+ // src/lib/section-dnd.ts
13335
+ function isFooterSection(el) {
13336
+ return el.dataset.ohwSection === "footer";
13337
+ }
13338
+ function buildSectionDropSlots(draggedInstanceId) {
13339
+ const sections = topLevelSections().filter(
13340
+ (el) => instanceIdOf(el) !== draggedInstanceId && !isFooterSection(el)
13341
+ );
13342
+ const slots = [];
13343
+ if (sections.length === 0) return slots;
13344
+ const left = 0;
13345
+ const width = document.documentElement.clientWidth;
13346
+ for (let i = 0; i <= sections.length; i++) {
13347
+ let y;
13348
+ if (i === 0) {
13349
+ y = sections[0].getBoundingClientRect().top;
13350
+ } else if (i === sections.length) {
13351
+ y = sections[sections.length - 1].getBoundingClientRect().bottom;
13352
+ } else {
13353
+ const prev = sections[i - 1].getBoundingClientRect();
13354
+ const next = sections[i].getBoundingClientRect();
13355
+ y = (prev.bottom + next.top) / 2;
13356
+ }
13357
+ slots.push({ insertIndex: i, y, left, width });
13358
+ }
13359
+ return slots;
13360
+ }
13361
+ function hitTestSectionDropSlot(y, slots) {
13362
+ let best = null;
13363
+ for (const slot of slots) {
13364
+ const dist = Math.abs(y - slot.y);
13365
+ if (!best || dist < best.dist) best = { slot, dist };
13366
+ }
13367
+ return best?.slot ?? null;
13368
+ }
13369
+
13370
+ // src/useSectionDrag.ts
13371
+ var PRESS_THRESHOLD = 10;
13372
+ var EDGE_ZONE = 60;
13373
+ var MAX_AUTO_SCROLL_SPEED = 18;
13374
+ var SECTION_DRAG_EXCLUDED_SELECTOR = [
13375
+ "[data-ohw-toolbar]",
13376
+ "[data-ohw-edit-chrome]",
13377
+ "[data-ohw-item-interaction]",
13378
+ "[data-ohw-drag-handle-container]",
13379
+ '[data-slot="drag-handle"]',
13380
+ "[data-ohw-item-toolbar-anchor]",
13381
+ "[data-ohw-item-drag-surface]",
13382
+ "[data-ohw-more-menu]",
13383
+ '[data-slot="dropdown-menu-content"]',
13384
+ '[data-slot="dropdown-menu-item"]',
13385
+ "[data-ohw-state-toggle]",
13386
+ "[data-ohw-max-badge]",
13387
+ "[data-ohw-floating-panel]",
13388
+ "[data-ohw-section-picker]",
13389
+ "[data-ohw-link-popover-root]",
13390
+ "[data-ohw-link-modal-root]",
13391
+ "[data-ohw-link-page-dropdown]",
13392
+ '[data-slot="popover-content"]',
13393
+ '[data-slot="dialog-content"]',
13394
+ '[data-slot="dialog-overlay"]',
13395
+ "[data-ohw-ai-review]",
13396
+ "[data-ohw-editable]",
13397
+ "[data-ohw-editable-state]",
13398
+ "[contenteditable]",
13399
+ "[data-ohw-href-key]",
13400
+ "[data-ohw-footer-col]",
13401
+ "[data-ohw-social-label]",
13402
+ "a",
13403
+ "button",
13404
+ '[role="button"]',
13405
+ '[data-ohw-role="navbar-button"]',
13406
+ '[data-ohw-role="button"]',
13407
+ "[data-ohw-carousel]",
13408
+ "[data-ohw-carousel-value]",
13409
+ "[data-ohw-carousel-slide]",
13410
+ "[data-ohw-carousel-overlay]",
13411
+ "[data-ohw-media-chrome]",
13412
+ "[data-ohw-media-overlay]",
13413
+ "[data-ohw-media-skeleton]"
13414
+ ].join(", ");
13415
+ function visibleClip(ps) {
13416
+ if (!ps) return null;
13417
+ const top = Math.max(0, ps.headerH - ps.iframeOffsetTop);
13418
+ const bottom = Math.min(window.innerHeight, ps.headerH + ps.canvasH - ps.iframeOffsetTop);
13419
+ return { top, bottom: Math.max(top, bottom) };
13420
+ }
13421
+ function useSectionDrag({
13422
+ isEditMode,
13423
+ editContentRef,
13424
+ postToParentRef,
13425
+ parentScrollRef,
13426
+ navDragRef,
13427
+ footerDragRef,
13428
+ suppressNextClickRef,
13429
+ suppressClickUntilRef
13430
+ }) {
13431
+ const sectionDragRef = (0, import_react15.useRef)(null);
13432
+ const [sectionDropSlots, setSectionDropSlots] = (0, import_react15.useState)([]);
13433
+ const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react15.useState)(null);
13434
+ const [isSectionDragging, setIsSectionDragging] = (0, import_react15.useState)(false);
13435
+ const sectionPointerDragRef = (0, import_react15.useRef)(null);
13436
+ const autoScrollRafRef = (0, import_react15.useRef)(null);
13437
+ const autoScrollDeltaRef = (0, import_react15.useRef)(0);
13438
+ const stopAutoScroll = (0, import_react15.useCallback)(() => {
13439
+ if (autoScrollRafRef.current != null) {
13440
+ cancelAnimationFrame(autoScrollRafRef.current);
13441
+ autoScrollRafRef.current = null;
13442
+ }
13443
+ autoScrollDeltaRef.current = 0;
13444
+ }, []);
13445
+ const tickAutoScroll = (0, import_react15.useCallback)(() => {
13446
+ if (!sectionDragRef.current) {
13447
+ stopAutoScroll();
13448
+ return;
13449
+ }
13450
+ if (autoScrollDeltaRef.current !== 0) {
13451
+ postToParentRef.current({ type: "ow:request-scroll", deltaY: autoScrollDeltaRef.current });
13452
+ }
13453
+ autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
13454
+ }, [postToParentRef, stopAutoScroll]);
13455
+ const updateAutoScroll = (0, import_react15.useCallback)(
13456
+ (clientY) => {
13457
+ const clip = visibleClip(parentScrollRef.current);
13458
+ let delta = 0;
13459
+ if (clip) {
13460
+ const distTop = clientY - clip.top;
13461
+ const distBottom = clip.bottom - clientY;
13462
+ if (distTop >= 0 && distTop < EDGE_ZONE) {
13463
+ delta = -MAX_AUTO_SCROLL_SPEED * (1 - distTop / EDGE_ZONE);
13464
+ } else if (distBottom >= 0 && distBottom < EDGE_ZONE) {
13465
+ delta = MAX_AUTO_SCROLL_SPEED * (1 - distBottom / EDGE_ZONE);
13466
+ }
13467
+ }
13468
+ autoScrollDeltaRef.current = delta;
13469
+ if (delta !== 0 && autoScrollRafRef.current == null) {
13470
+ autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
13471
+ } else if (delta === 0) {
13472
+ stopAutoScroll();
13473
+ }
13474
+ },
13475
+ [parentScrollRef, stopAutoScroll, tickAutoScroll]
13476
+ );
13477
+ const clearSectionDragVisuals = (0, import_react15.useCallback)(() => {
13478
+ sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
13479
+ sectionDragRef.current = null;
13480
+ setSectionDropSlots([]);
13481
+ setActiveSectionDropIndex(null);
13482
+ setIsSectionDragging(false);
13483
+ stopAutoScroll();
13484
+ document.documentElement.removeAttribute("data-ohw-section-dragging-root");
13485
+ unlockItemDragInteraction();
13486
+ }, [stopAutoScroll]);
13487
+ const refreshSectionDragVisuals = (0, import_react15.useCallback)(
13488
+ (session, clientX, clientY) => {
13489
+ session.lastClientX = clientX;
13490
+ session.lastClientY = clientY;
13491
+ const slots = buildSectionDropSlots(session.instanceId);
13492
+ const activeSlot = hitTestSectionDropSlot(clientY, slots);
13493
+ session.activeSlot = activeSlot;
13494
+ setSectionDropSlots(slots);
13495
+ const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
13496
+ setActiveSectionDropIndex(activeIdx >= 0 ? activeIdx : null);
13497
+ updateAutoScroll(clientY);
13498
+ },
13499
+ [updateAutoScroll]
13500
+ );
13501
+ const beginSectionDrag = (0, import_react15.useCallback)(
13502
+ (session) => {
13503
+ sectionDragRef.current = session;
13504
+ setIsSectionDragging(true);
13505
+ lockItemDuringDrag();
13506
+ document.documentElement.setAttribute("data-ohw-section-dragging-root", "");
13507
+ session.draggedEl.setAttribute("data-ohw-section-dragging", "");
13508
+ refreshSectionDragVisuals(session, session.lastClientX, session.lastClientY);
13509
+ },
13510
+ [refreshSectionDragVisuals]
13511
+ );
13512
+ const commitSectionDrag = (0, import_react15.useCallback)(() => {
13513
+ const session = sectionDragRef.current;
13514
+ if (!session) {
13515
+ clearSectionDragVisuals();
13516
+ return;
13517
+ }
13518
+ const slot = session.activeSlot ?? hitTestSectionDropSlot(session.lastClientY, buildSectionDropSlots(session.instanceId));
13519
+ const entries = slot ? planSectionMove(session.instanceId, slot.insertIndex, window.location.pathname) : null;
13520
+ if (!entries) {
13521
+ clearSectionDragVisuals();
13522
+ return;
13523
+ }
13524
+ const orderJson = JSON.stringify(entries);
13525
+ editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
13526
+ postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
13527
+ applyPersistedOrder(entries);
13528
+ clearSectionDragVisuals();
13529
+ requestAnimationFrame(() => {
13530
+ if (editContentRef.current[SECTION_ORDER_KEY] === orderJson) {
13531
+ applyPersistedOrder(entries);
13532
+ }
13533
+ requestAnimationFrame(() => {
13534
+ window.dispatchEvent(new Event("resize"));
13535
+ });
13536
+ });
13537
+ }, [clearSectionDragVisuals, editContentRef, postToParentRef]);
13538
+ const startSectionPressDrag = (0, import_react15.useCallback)(
13539
+ (el, clientX, clientY, pointerId) => {
13540
+ if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
13541
+ const instanceId = instanceIdOf(el);
13542
+ if (!instanceId) return false;
13543
+ sectionPointerDragRef.current = {
13544
+ el,
13545
+ instanceId,
13546
+ startX: clientX,
13547
+ startY: clientY,
13548
+ pointerId,
13549
+ started: false
13550
+ };
13551
+ return true;
13552
+ },
13553
+ [footerDragRef, navDragRef]
13554
+ );
13555
+ (0, import_react15.useEffect)(() => {
13556
+ if (!isEditMode) return;
13557
+ const onPointerDown = (e) => {
13558
+ if (e.button !== 0) return;
13559
+ if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return;
13560
+ if (sectionPointerDragRef.current) return;
13561
+ const target = e.target;
13562
+ if (!(target instanceof HTMLElement)) return;
13563
+ if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
13564
+ const sectionEl = target.closest("[data-ohw-section]");
13565
+ if (!sectionEl || isChromeSection(sectionEl) || sectionEl.dataset.ohwSection === "footer") return;
13566
+ if (!topLevelSections().includes(sectionEl)) return;
13567
+ startSectionPressDrag(sectionEl, e.clientX, e.clientY, e.pointerId);
13568
+ };
13569
+ const onPointerMove = (e) => {
13570
+ const pending = sectionPointerDragRef.current;
13571
+ if (!pending) return;
13572
+ if (pending.started) {
13573
+ e.preventDefault();
13574
+ clearTextSelection();
13575
+ const session = sectionDragRef.current;
13576
+ if (!session) return;
13577
+ refreshSectionDragVisuals(session, e.clientX, e.clientY);
13578
+ return;
13579
+ }
13580
+ const dx = e.clientX - pending.startX;
13581
+ const dy = e.clientY - pending.startY;
13582
+ if (dx * dx + dy * dy < PRESS_THRESHOLD * PRESS_THRESHOLD) return;
13583
+ e.preventDefault();
13584
+ pending.started = true;
13585
+ armItemPressDrag();
13586
+ clearTextSelection();
13587
+ try {
13588
+ document.body.setPointerCapture(pending.pointerId);
13589
+ } catch {
13590
+ }
13591
+ beginSectionDrag({
13592
+ instanceId: pending.instanceId,
13593
+ draggedEl: pending.el,
13594
+ lastClientX: e.clientX,
13595
+ lastClientY: e.clientY,
13596
+ activeSlot: null
13597
+ });
13598
+ };
13599
+ const endPointerDrag = (e) => {
13600
+ const pending = sectionPointerDragRef.current;
13601
+ sectionPointerDragRef.current = null;
13602
+ try {
13603
+ if (document.body.hasPointerCapture(e.pointerId)) {
13604
+ document.body.releasePointerCapture(e.pointerId);
13605
+ }
13606
+ } catch {
13607
+ }
13608
+ if (!pending) return;
13609
+ if (!pending.started) {
13610
+ unlockItemDragInteraction();
13611
+ return;
13612
+ }
13613
+ suppressNextClickRef.current = true;
13614
+ suppressClickUntilRef.current = Date.now() + 500;
13615
+ commitSectionDrag();
13616
+ };
13617
+ const onKeyDown = (e) => {
13618
+ if (e.key !== "Escape") return;
13619
+ if (!sectionDragRef.current && !sectionPointerDragRef.current) return;
13620
+ sectionPointerDragRef.current = null;
13621
+ clearSectionDragVisuals();
13622
+ };
13623
+ document.addEventListener("pointerdown", onPointerDown, true);
13624
+ document.addEventListener("pointermove", onPointerMove, true);
13625
+ document.addEventListener("pointerup", endPointerDrag, true);
13626
+ document.addEventListener("pointercancel", endPointerDrag, true);
13627
+ document.addEventListener("keydown", onKeyDown, true);
13628
+ return () => {
13629
+ document.removeEventListener("pointerdown", onPointerDown, true);
13630
+ document.removeEventListener("pointermove", onPointerMove, true);
13631
+ document.removeEventListener("pointerup", endPointerDrag, true);
13632
+ document.removeEventListener("pointercancel", endPointerDrag, true);
13633
+ document.removeEventListener("keydown", onKeyDown, true);
13634
+ unlockItemDragInteraction();
13635
+ stopAutoScroll();
13636
+ };
13637
+ }, [
13638
+ beginSectionDrag,
13639
+ clearSectionDragVisuals,
13640
+ commitSectionDrag,
13641
+ footerDragRef,
13642
+ isEditMode,
13643
+ navDragRef,
13644
+ refreshSectionDragVisuals,
13645
+ startSectionPressDrag,
13646
+ stopAutoScroll,
13647
+ suppressClickUntilRef,
13648
+ suppressNextClickRef
13649
+ ]);
13650
+ return {
13651
+ sectionDragRef,
13652
+ sectionDropSlots,
13653
+ activeSectionDropIndex,
13654
+ isSectionDragging
13655
+ };
13656
+ }
13657
+
13278
13658
  // src/ui/footer-container-chrome.tsx
13279
13659
  var import_lucide_react16 = require("lucide-react");
13280
13660
  var import_jsx_runtime30 = require("react/jsx-runtime");
@@ -13327,7 +13707,7 @@ function FooterContainerChrome({
13327
13707
  }
13328
13708
 
13329
13709
  // src/lib/carousel.ts
13330
- var import_react15 = require("react");
13710
+ var import_react16 = require("react");
13331
13711
  var CAROUSEL_ATTR = "data-ohw-carousel";
13332
13712
  var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
13333
13713
  var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
@@ -13389,8 +13769,8 @@ function applyCarouselNode(key, val) {
13389
13769
  return true;
13390
13770
  }
13391
13771
  function useOhwCarousel(key, initial) {
13392
- const [images, setImages] = (0, import_react15.useState)(initial);
13393
- (0, import_react15.useEffect)(() => {
13772
+ const [images, setImages] = (0, import_react16.useState)(initial);
13773
+ (0, import_react16.useEffect)(() => {
13394
13774
  const el = document.querySelector(
13395
13775
  `[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
13396
13776
  );
@@ -13468,7 +13848,7 @@ function collectEditableNodes(extraContent, root = document) {
13468
13848
  nodes.push({ key, type: "link", text: href });
13469
13849
  }
13470
13850
  if (extraContent) {
13471
- for (const key of [NAV_ORDER_KEY, FOOTER_ORDER_KEY, NAV_COUNT_KEY]) {
13851
+ for (const key of [NAV_ORDER_KEY, FOOTER_ORDER_KEY, NAV_COUNT_KEY, SECTION_ORDER_KEY]) {
13472
13852
  const text = extraContent[key];
13473
13853
  if (typeof text === "string" && text.length > 0) {
13474
13854
  nodes.push({ key, type: "meta", text });
@@ -14964,9 +15344,9 @@ function FloatingToolbar({
14964
15344
  showEditLink,
14965
15345
  onEditLink
14966
15346
  }) {
14967
- const localRef = import_react16.default.useRef(null);
14968
- const [measuredW, setMeasuredW] = import_react16.default.useState(330);
14969
- const setRefs = import_react16.default.useCallback(
15347
+ const localRef = import_react17.default.useRef(null);
15348
+ const [measuredW, setMeasuredW] = import_react17.default.useState(330);
15349
+ const setRefs = import_react17.default.useCallback(
14970
15350
  (node) => {
14971
15351
  localRef.current = node;
14972
15352
  if (typeof elRef === "function") elRef(node);
@@ -14978,7 +15358,7 @@ function FloatingToolbar({
14978
15358
  },
14979
15359
  [elRef]
14980
15360
  );
14981
- import_react16.default.useLayoutEffect(() => {
15361
+ import_react17.default.useLayoutEffect(() => {
14982
15362
  const node = localRef.current;
14983
15363
  if (!node) return;
14984
15364
  const update = () => {
@@ -15004,7 +15384,7 @@ function FloatingToolbar({
15004
15384
  pointerEvents: "auto"
15005
15385
  },
15006
15386
  children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(CustomToolbar, { children: [
15007
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react16.default.Fragment, { children: [
15387
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react17.default.Fragment, { children: [
15008
15388
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CustomToolbarDivider, {}),
15009
15389
  btns.map((btn) => {
15010
15390
  const isActive = activeCommands.has(btn.cmd);
@@ -15089,6 +15469,44 @@ function StateToggle({
15089
15469
  }
15090
15470
  var contentCache = /* @__PURE__ */ new Map();
15091
15471
  var fetchedContentPaths = /* @__PURE__ */ new Set();
15472
+ var OHW_LOADER_STYLE = {
15473
+ position: "fixed",
15474
+ inset: 0,
15475
+ background: "#fff",
15476
+ zIndex: 2147483646,
15477
+ display: "flex",
15478
+ alignItems: "center",
15479
+ justifyContent: "center"
15480
+ };
15481
+ function OhwLoaderSpinner() {
15482
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", "aria-hidden": true, children: [
15483
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "14", cy: "14", r: "11", stroke: "#E7E5E4", strokeWidth: "3" }),
15484
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15485
+ "circle",
15486
+ {
15487
+ cx: "14",
15488
+ cy: "14",
15489
+ r: "11",
15490
+ stroke: "#1C1917",
15491
+ strokeWidth: "3",
15492
+ strokeDasharray: "17 52",
15493
+ strokeLinecap: "round",
15494
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15495
+ "animateTransform",
15496
+ {
15497
+ attributeName: "transform",
15498
+ type: "rotate",
15499
+ from: "0 14 14",
15500
+ to: "360 14 14",
15501
+ dur: "0.7s",
15502
+ repeatCount: "indefinite"
15503
+ }
15504
+ )
15505
+ }
15506
+ )
15507
+ ] });
15508
+ }
15509
+ var OHW_LOADER_PREHYDRATE_SCRIPT = `(function(){try{var p=location.hostname.split(".");var fromHost=p.length>=3&&p[0]!=="www"?p[0]:"";var fromQuery=new URLSearchParams(location.search).get("subdomain")||"";if(!fromHost&&!fromQuery)return;var e=document.getElementById("ohw-loader");if(e)e.style.display="flex"}catch(e){}})();`;
15092
15510
  function resolveSubdomain(subdomainFromQuery) {
15093
15511
  if (subdomainFromQuery) return subdomainFromQuery;
15094
15512
  if (typeof window !== "undefined") {
@@ -15111,8 +15529,8 @@ function OhhwellsBridge() {
15111
15529
  const router = (0, import_navigation3.useRouter)();
15112
15530
  const searchParams = (0, import_navigation3.useSearchParams)();
15113
15531
  const isEditMode = isEditSessionActive();
15114
- const [bridgeRoot, setBridgeRoot] = (0, import_react16.useState)(null);
15115
- (0, import_react16.useEffect)(() => {
15532
+ const [bridgeRoot, setBridgeRoot] = (0, import_react17.useState)(null);
15533
+ (0, import_react17.useEffect)(() => {
15116
15534
  const figtreeFontId = "ohw-figtree-font";
15117
15535
  if (!document.getElementById(figtreeFontId)) {
15118
15536
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -15141,82 +15559,82 @@ function OhhwellsBridge() {
15141
15559
  const subdomain = resolveSubdomain(subdomainFromQuery);
15142
15560
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
15143
15561
  useSavedLinkNavigation(isEditMode);
15144
- const postToParent2 = (0, import_react16.useCallback)((data) => {
15562
+ const postToParent2 = (0, import_react17.useCallback)((data) => {
15145
15563
  if (typeof window !== "undefined" && window.parent !== window) {
15146
15564
  window.parent.postMessage(data, "*");
15147
15565
  }
15148
15566
  }, []);
15149
- const [fetchState, setFetchState] = (0, import_react16.useState)("idle");
15150
- const autoSaveTimers = (0, import_react16.useRef)(/* @__PURE__ */ new Map());
15151
- const activeElRef = (0, import_react16.useRef)(null);
15152
- const pointerHeldRef = (0, import_react16.useRef)(false);
15153
- const selectedElRef = (0, import_react16.useRef)(null);
15154
- const selectedHrefKeyRef = (0, import_react16.useRef)(null);
15155
- const selectedFooterColAttrRef = (0, import_react16.useRef)(null);
15156
- const originalContentRef = (0, import_react16.useRef)(null);
15157
- const activeStateElRef = (0, import_react16.useRef)(null);
15158
- const parentScrollRef = (0, import_react16.useRef)(null);
15159
- const visibleViewportRef = (0, import_react16.useRef)(null);
15160
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react16.useState)(null);
15161
- const attachVisibleViewport = (0, import_react16.useCallback)((node) => {
15567
+ const [fetchState, setFetchState] = (0, import_react17.useState)("idle");
15568
+ const autoSaveTimers = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
15569
+ const activeElRef = (0, import_react17.useRef)(null);
15570
+ const pointerHeldRef = (0, import_react17.useRef)(false);
15571
+ const selectedElRef = (0, import_react17.useRef)(null);
15572
+ const selectedHrefKeyRef = (0, import_react17.useRef)(null);
15573
+ const selectedFooterColAttrRef = (0, import_react17.useRef)(null);
15574
+ const originalContentRef = (0, import_react17.useRef)(null);
15575
+ const activeStateElRef = (0, import_react17.useRef)(null);
15576
+ const parentScrollRef = (0, import_react17.useRef)(null);
15577
+ const visibleViewportRef = (0, import_react17.useRef)(null);
15578
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react17.useState)(null);
15579
+ const attachVisibleViewport = (0, import_react17.useCallback)((node) => {
15162
15580
  visibleViewportRef.current = node;
15163
15581
  setDialogPortalContainer(node);
15164
15582
  if (node) applyVisibleViewport(node, parentScrollRef.current);
15165
15583
  }, []);
15166
- const toolbarElRef = (0, import_react16.useRef)(null);
15167
- const glowElRef = (0, import_react16.useRef)(null);
15168
- const hoveredImageRef = (0, import_react16.useRef)(null);
15169
- const hoveredImageHasTextOverlapRef = (0, import_react16.useRef)(false);
15170
- const dragOverElRef = (0, import_react16.useRef)(null);
15171
- const [mediaHover, setMediaHover] = (0, import_react16.useState)(null);
15172
- const [carouselHover, setCarouselHover] = (0, import_react16.useState)(null);
15173
- const [uploadingRects, setUploadingRects] = (0, import_react16.useState)({});
15174
- const hoveredGapRef = (0, import_react16.useRef)(null);
15175
- const imageUnhoverTimerRef = (0, import_react16.useRef)(null);
15176
- const imageShowTimerRef = (0, import_react16.useRef)(null);
15177
- const editStylesRef = (0, import_react16.useRef)(null);
15178
- const activateRef = (0, import_react16.useRef)(() => {
15584
+ const toolbarElRef = (0, import_react17.useRef)(null);
15585
+ const glowElRef = (0, import_react17.useRef)(null);
15586
+ const hoveredImageRef = (0, import_react17.useRef)(null);
15587
+ const hoveredImageHasTextOverlapRef = (0, import_react17.useRef)(false);
15588
+ const dragOverElRef = (0, import_react17.useRef)(null);
15589
+ const [mediaHover, setMediaHover] = (0, import_react17.useState)(null);
15590
+ const [carouselHover, setCarouselHover] = (0, import_react17.useState)(null);
15591
+ const [uploadingRects, setUploadingRects] = (0, import_react17.useState)({});
15592
+ const hoveredGapRef = (0, import_react17.useRef)(null);
15593
+ const imageUnhoverTimerRef = (0, import_react17.useRef)(null);
15594
+ const imageShowTimerRef = (0, import_react17.useRef)(null);
15595
+ const editStylesRef = (0, import_react17.useRef)(null);
15596
+ const activateRef = (0, import_react17.useRef)(() => {
15179
15597
  });
15180
- const deactivateRef = (0, import_react16.useRef)(() => {
15598
+ const deactivateRef = (0, import_react17.useRef)(() => {
15181
15599
  });
15182
- const selectRef = (0, import_react16.useRef)(() => {
15600
+ const selectRef = (0, import_react17.useRef)(() => {
15183
15601
  });
15184
- const selectFrameRef = (0, import_react16.useRef)(() => {
15602
+ const selectFrameRef = (0, import_react17.useRef)(() => {
15185
15603
  });
15186
- const selectLogoRef = (0, import_react16.useRef)(() => {
15604
+ const selectLogoRef = (0, import_react17.useRef)(() => {
15187
15605
  });
15188
- const openLogoSizePanelRef = (0, import_react16.useRef)(() => {
15606
+ const openLogoSizePanelRef = (0, import_react17.useRef)(() => {
15189
15607
  });
15190
- const deselectRef = (0, import_react16.useRef)(() => {
15608
+ const deselectRef = (0, import_react17.useRef)(() => {
15191
15609
  });
15192
- const closeFloatingPanelOnlyRef = (0, import_react16.useRef)(() => {
15610
+ const closeFloatingPanelOnlyRef = (0, import_react17.useRef)(() => {
15193
15611
  });
15194
- const reselectNavigationItemRef = (0, import_react16.useRef)(() => {
15612
+ const reselectNavigationItemRef = (0, import_react17.useRef)(() => {
15195
15613
  });
15196
- const commitNavigationTextEditRef = (0, import_react16.useRef)(() => {
15614
+ const commitNavigationTextEditRef = (0, import_react17.useRef)(() => {
15197
15615
  });
15198
- const handleDeleteSelectedRef = (0, import_react16.useRef)(() => false);
15199
- const runPendingDeleteUndoRef = (0, import_react16.useRef)(() => false);
15200
- const isFooterFrameSelectionRef = (0, import_react16.useRef)(false);
15201
- const refreshActiveCommandsRef = (0, import_react16.useRef)(() => {
15616
+ const handleDeleteSelectedRef = (0, import_react17.useRef)(() => false);
15617
+ const runPendingDeleteUndoRef = (0, import_react17.useRef)(() => false);
15618
+ const isFooterFrameSelectionRef = (0, import_react17.useRef)(false);
15619
+ const refreshActiveCommandsRef = (0, import_react17.useRef)(() => {
15202
15620
  });
15203
- const postToParentRef = (0, import_react16.useRef)(postToParent2);
15621
+ const postToParentRef = (0, import_react17.useRef)(postToParent2);
15204
15622
  postToParentRef.current = postToParent2;
15205
- const aiSectionApiRef = (0, import_react16.useRef)(null);
15206
- const sectionsLoadedRef = (0, import_react16.useRef)(false);
15207
- const pendingScheduleConfigRequests = (0, import_react16.useRef)([]);
15208
- const [toolbarRect, setToolbarRect] = (0, import_react16.useState)(null);
15209
- const [formPickRect, setFormPickRect] = (0, import_react16.useState)(null);
15210
- const formPickElRef = (0, import_react16.useRef)(null);
15211
- const [formViewState, setFormViewStateUi] = (0, import_react16.useState)("default");
15212
- const [formPickCount, setFormPickCount] = (0, import_react16.useState)(null);
15213
- const [formHoverRect, setFormHoverRect] = (0, import_react16.useState)(null);
15214
- const formHoverElRef = (0, import_react16.useRef)(null);
15215
- const [fieldPickRect, setFieldPickRect] = (0, import_react16.useState)(null);
15216
- const fieldPickElRef = (0, import_react16.useRef)(null);
15217
- const [fieldPickState, setFieldPickState] = (0, import_react16.useState)(null);
15218
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react16.useState)(false);
15219
- const clearFormPick = (0, import_react16.useCallback)(() => {
15623
+ const aiSectionApiRef = (0, import_react17.useRef)(null);
15624
+ const sectionsLoadedRef = (0, import_react17.useRef)(false);
15625
+ const pendingScheduleConfigRequests = (0, import_react17.useRef)([]);
15626
+ const [toolbarRect, setToolbarRect] = (0, import_react17.useState)(null);
15627
+ const [formPickRect, setFormPickRect] = (0, import_react17.useState)(null);
15628
+ const formPickElRef = (0, import_react17.useRef)(null);
15629
+ const [formViewState, setFormViewStateUi] = (0, import_react17.useState)("default");
15630
+ const [formPickCount, setFormPickCount] = (0, import_react17.useState)(null);
15631
+ const [formHoverRect, setFormHoverRect] = (0, import_react17.useState)(null);
15632
+ const formHoverElRef = (0, import_react17.useRef)(null);
15633
+ const [fieldPickRect, setFieldPickRect] = (0, import_react17.useState)(null);
15634
+ const fieldPickElRef = (0, import_react17.useRef)(null);
15635
+ const [fieldPickState, setFieldPickState] = (0, import_react17.useState)(null);
15636
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react17.useState)(false);
15637
+ const clearFormPick = (0, import_react17.useCallback)(() => {
15220
15638
  const form = formPickElRef.current;
15221
15639
  const editing = fieldPickElRef.current;
15222
15640
  if (commitPlaceholderEdit(editing) && editing) {
@@ -15236,7 +15654,7 @@ function OhhwellsBridge() {
15236
15654
  formPickElRef.current = null;
15237
15655
  setFormPickRect(null);
15238
15656
  }, []);
15239
- const clearFieldPick = (0, import_react16.useCallback)(() => {
15657
+ const clearFieldPick = (0, import_react17.useCallback)(() => {
15240
15658
  const wrapper = fieldPickElRef.current;
15241
15659
  if (commitPlaceholderEdit(wrapper) && wrapper) {
15242
15660
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -15246,9 +15664,9 @@ function OhhwellsBridge() {
15246
15664
  setFieldPickRect(null);
15247
15665
  setFieldPickState(null);
15248
15666
  }, []);
15249
- const persistFieldsRef = (0, import_react16.useRef)(() => {
15667
+ const persistFieldsRef = (0, import_react17.useRef)(() => {
15250
15668
  });
15251
- const persistFields = (0, import_react16.useCallback)(
15669
+ const persistFields = (0, import_react17.useCallback)(
15252
15670
  (form) => {
15253
15671
  const key = formKeyOf(form);
15254
15672
  if (!key) return;
@@ -15259,7 +15677,7 @@ function OhhwellsBridge() {
15259
15677
  []
15260
15678
  );
15261
15679
  persistFieldsRef.current = persistFields;
15262
- const selectField = (0, import_react16.useCallback)((wrapper) => {
15680
+ const selectField = (0, import_react17.useCallback)((wrapper) => {
15263
15681
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
15264
15682
  commitPlaceholderEdit(fieldPickElRef.current);
15265
15683
  }
@@ -15272,7 +15690,7 @@ function OhhwellsBridge() {
15272
15690
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
15273
15691
  setFieldTypePickerOpen(false);
15274
15692
  }, []);
15275
- const withSelectedField = (0, import_react16.useCallback)(
15693
+ const withSelectedField = (0, import_react17.useCallback)(
15276
15694
  (run) => {
15277
15695
  const wrapper = fieldPickElRef.current;
15278
15696
  const form = formPickElRef.current;
@@ -15285,28 +15703,28 @@ function OhhwellsBridge() {
15285
15703
  },
15286
15704
  [persistFields]
15287
15705
  );
15288
- const handleFieldTypeChange = (0, import_react16.useCallback)(
15706
+ const handleFieldTypeChange = (0, import_react17.useCallback)(
15289
15707
  (type) => withSelectedField((_form, wrapper) => {
15290
15708
  applyFieldType(wrapper, type);
15291
15709
  selectField(wrapper);
15292
15710
  }),
15293
15711
  [selectField, withSelectedField]
15294
15712
  );
15295
- const handleFieldRequiredToggle = (0, import_react16.useCallback)(
15713
+ const handleFieldRequiredToggle = (0, import_react17.useCallback)(
15296
15714
  () => withSelectedField((_form, wrapper) => {
15297
15715
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
15298
15716
  selectField(wrapper);
15299
15717
  }),
15300
15718
  [selectField, withSelectedField]
15301
15719
  );
15302
- const handleFieldDuplicate = (0, import_react16.useCallback)(
15720
+ const handleFieldDuplicate = (0, import_react17.useCallback)(
15303
15721
  () => withSelectedField((form, wrapper) => {
15304
15722
  const copy = duplicateField(form, wrapper);
15305
15723
  selectField(copy);
15306
15724
  }),
15307
15725
  [selectField, withSelectedField]
15308
15726
  );
15309
- const handleFieldDelete = (0, import_react16.useCallback)(
15727
+ const handleFieldDelete = (0, import_react17.useCallback)(
15310
15728
  () => withSelectedField((_form, wrapper) => {
15311
15729
  removeField(wrapper);
15312
15730
  clearFieldPick();
@@ -15314,7 +15732,7 @@ function OhhwellsBridge() {
15314
15732
  }),
15315
15733
  [clearFieldPick, withSelectedField]
15316
15734
  );
15317
- const handleAddField = (0, import_react16.useCallback)(
15735
+ const handleAddField = (0, import_react17.useCallback)(
15318
15736
  (type) => {
15319
15737
  const form = formPickElRef.current;
15320
15738
  if (!form) return;
@@ -15330,8 +15748,8 @@ function OhhwellsBridge() {
15330
15748
  },
15331
15749
  [persistFields, selectField]
15332
15750
  );
15333
- const fieldDragRef = (0, import_react16.useRef)(null);
15334
- const buildFieldDropSlots = (0, import_react16.useCallback)((form, draggedKey) => {
15751
+ const fieldDragRef = (0, import_react17.useRef)(null);
15752
+ const buildFieldDropSlots = (0, import_react17.useCallback)((form, draggedKey) => {
15335
15753
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
15336
15754
  const slots = others.map((el) => {
15337
15755
  const rect = el.getBoundingClientRect();
@@ -15344,7 +15762,7 @@ function OhhwellsBridge() {
15344
15762
  }
15345
15763
  return slots;
15346
15764
  }, []);
15347
- const handleFieldDragStart = (0, import_react16.useCallback)(() => {
15765
+ const handleFieldDragStart = (0, import_react17.useCallback)(() => {
15348
15766
  const wrapper = fieldPickElRef.current;
15349
15767
  const form = formPickElRef.current;
15350
15768
  if (!wrapper || !form) return;
@@ -15353,18 +15771,18 @@ function OhhwellsBridge() {
15353
15771
  setFieldDragging(true);
15354
15772
  setFieldDropSlots(buildFieldDropSlots(form, key));
15355
15773
  }, [buildFieldDropSlots]);
15356
- const handleFieldDragEnd = (0, import_react16.useCallback)(() => {
15774
+ const handleFieldDragEnd = (0, import_react17.useCallback)(() => {
15357
15775
  fieldDragRef.current = null;
15358
15776
  setFieldDropIndex(null);
15359
15777
  setFieldDropSlots([]);
15360
15778
  setFieldDragging(false);
15361
15779
  }, []);
15362
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react16.useState)(null);
15363
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react16.useState)([]);
15364
- const [fieldDragging, setFieldDragging] = (0, import_react16.useState)(false);
15365
- const clearFormPickRef = (0, import_react16.useRef)(clearFormPick);
15780
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react17.useState)(null);
15781
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react17.useState)([]);
15782
+ const [fieldDragging, setFieldDragging] = (0, import_react17.useState)(false);
15783
+ const clearFormPickRef = (0, import_react17.useRef)(clearFormPick);
15366
15784
  clearFormPickRef.current = clearFormPick;
15367
- (0, import_react16.useEffect)(() => {
15785
+ (0, import_react17.useEffect)(() => {
15368
15786
  const el = fieldPickElRef.current;
15369
15787
  if (!el || fieldPickRect === null) return;
15370
15788
  const observer = new ResizeObserver(() => {
@@ -15373,7 +15791,7 @@ function OhhwellsBridge() {
15373
15791
  observer.observe(el);
15374
15792
  return () => observer.disconnect();
15375
15793
  }, [fieldPickRect !== null, fieldPickState]);
15376
- (0, import_react16.useEffect)(() => {
15794
+ (0, import_react17.useEffect)(() => {
15377
15795
  const el = formPickElRef.current;
15378
15796
  if (!el || formPickRect === null) return;
15379
15797
  const observer = new ResizeObserver(() => {
@@ -15382,25 +15800,25 @@ function OhhwellsBridge() {
15382
15800
  observer.observe(el);
15383
15801
  return () => observer.disconnect();
15384
15802
  }, [formPickRect !== null, formViewState]);
15385
- const [toolbarVariant, setToolbarVariant] = (0, import_react16.useState)("none");
15386
- const toolbarVariantRef = (0, import_react16.useRef)("none");
15803
+ const [toolbarVariant, setToolbarVariant] = (0, import_react17.useState)("none");
15804
+ const toolbarVariantRef = (0, import_react17.useRef)("none");
15387
15805
  toolbarVariantRef.current = toolbarVariant;
15388
- const [selectedIsCta, setSelectedIsCta] = (0, import_react16.useState)(false);
15389
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react16.useState)(false);
15390
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react16.useState)(false);
15391
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react16.useState)(null);
15392
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react16.useState)(false);
15393
- const [toggleState, setToggleState] = (0, import_react16.useState)(null);
15394
- const [maxBadge, setMaxBadge] = (0, import_react16.useState)(null);
15395
- const [activeCommands, setActiveCommands] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
15396
- const [sectionGap, setSectionGap] = (0, import_react16.useState)(null);
15397
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react16.useState)(false);
15398
- const hoveredNavContainerRef = (0, import_react16.useRef)(null);
15399
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react16.useState)(null);
15400
- const hoveredItemElRef = (0, import_react16.useRef)(null);
15401
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react16.useState)(null);
15402
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react16.useState)(null);
15403
- (0, import_react16.useEffect)(() => {
15806
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react17.useState)(false);
15807
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react17.useState)(false);
15808
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react17.useState)(false);
15809
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react17.useState)(null);
15810
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react17.useState)(false);
15811
+ const [toggleState, setToggleState] = (0, import_react17.useState)(null);
15812
+ const [maxBadge, setMaxBadge] = (0, import_react17.useState)(null);
15813
+ const [activeCommands, setActiveCommands] = (0, import_react17.useState)(/* @__PURE__ */ new Set());
15814
+ const [sectionGap, setSectionGap] = (0, import_react17.useState)(null);
15815
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react17.useState)(false);
15816
+ const hoveredNavContainerRef = (0, import_react17.useRef)(null);
15817
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react17.useState)(null);
15818
+ const hoveredItemElRef = (0, import_react17.useRef)(null);
15819
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react17.useState)(null);
15820
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react17.useState)(null);
15821
+ (0, import_react17.useEffect)(() => {
15404
15822
  const sync = () => {
15405
15823
  const el = document.querySelector(
15406
15824
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -15421,48 +15839,48 @@ function OhhwellsBridge() {
15421
15839
  });
15422
15840
  return () => observer.disconnect();
15423
15841
  }, []);
15424
- const siblingHintElRef = (0, import_react16.useRef)(null);
15425
- const [siblingHintRect, setSiblingHintRect] = (0, import_react16.useState)(null);
15426
- const [siblingHintRects, setSiblingHintRects] = (0, import_react16.useState)([]);
15427
- const [isItemDragging, setIsItemDragging] = (0, import_react16.useState)(false);
15428
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react16.useState)(false);
15842
+ const siblingHintElRef = (0, import_react17.useRef)(null);
15843
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react17.useState)(null);
15844
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react17.useState)([]);
15845
+ const [isItemDragging, setIsItemDragging] = (0, import_react17.useState)(false);
15846
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react17.useState)(false);
15429
15847
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
15430
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react16.useState)(null);
15431
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react16.useState)(null);
15432
- const footerDragRef = (0, import_react16.useRef)(null);
15433
- const [footerDropSlots, setFooterDropSlots] = (0, import_react16.useState)([]);
15434
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react16.useState)(null);
15435
- const [draggedItemRect, setDraggedItemRect] = (0, import_react16.useState)(null);
15436
- const footerPointerDragRef = (0, import_react16.useRef)(null);
15437
- const suppressNextClickRef = (0, import_react16.useRef)(false);
15438
- const suppressClickUntilRef = (0, import_react16.useRef)(0);
15439
- const [linkPopover, setLinkPopover] = (0, import_react16.useState)(null);
15440
- const linkPopoverSessionRef = (0, import_react16.useRef)(null);
15441
- const addNavAfterAnchorRef = (0, import_react16.useRef)(null);
15442
- const editContentRef = (0, import_react16.useRef)({});
15443
- const aiSectionsRef = (0, import_react16.useRef)("");
15444
- const brandKitRef = (0, import_react16.useRef)("");
15445
- const stylesRef = (0, import_react16.useRef)("");
15446
- const pendingDeleteUndoRef = (0, import_react16.useRef)(null);
15447
- const [floatingPanel, setFloatingPanel] = (0, import_react16.useState)(null);
15448
- const floatingPanelOpenRef = (0, import_react16.useRef)(false);
15449
- const setFloatingPanelRef = (0, import_react16.useRef)(setFloatingPanel);
15450
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react16.useState)(null);
15451
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react16.useState)(null);
15452
- const [editorViewport, setEditorViewport] = (0, import_react16.useState)("desktop");
15453
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react16.useState)(null);
15454
- const [sitePages, setSitePages] = (0, import_react16.useState)([]);
15455
- const [sectionsByPath, setSectionsByPath] = (0, import_react16.useState)({});
15456
- const sectionsPrefetchGenRef = (0, import_react16.useRef)(0);
15457
- const setLinkPopoverRef = (0, import_react16.useRef)(setLinkPopover);
15458
- const linkPopoverPanelRef = (0, import_react16.useRef)(null);
15459
- const linkPopoverOpenRef = (0, import_react16.useRef)(false);
15460
- const linkPopoverGraceUntilRef = (0, import_react16.useRef)(0);
15848
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react17.useState)(null);
15849
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react17.useState)(null);
15850
+ const footerDragRef = (0, import_react17.useRef)(null);
15851
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react17.useState)([]);
15852
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react17.useState)(null);
15853
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react17.useState)(null);
15854
+ const footerPointerDragRef = (0, import_react17.useRef)(null);
15855
+ const suppressNextClickRef = (0, import_react17.useRef)(false);
15856
+ const suppressClickUntilRef = (0, import_react17.useRef)(0);
15857
+ const [linkPopover, setLinkPopover] = (0, import_react17.useState)(null);
15858
+ const linkPopoverSessionRef = (0, import_react17.useRef)(null);
15859
+ const addNavAfterAnchorRef = (0, import_react17.useRef)(null);
15860
+ const editContentRef = (0, import_react17.useRef)({});
15861
+ const aiSectionsRef = (0, import_react17.useRef)("");
15862
+ const brandKitRef = (0, import_react17.useRef)("");
15863
+ const stylesRef = (0, import_react17.useRef)("");
15864
+ const pendingDeleteUndoRef = (0, import_react17.useRef)(null);
15865
+ const [floatingPanel, setFloatingPanel] = (0, import_react17.useState)(null);
15866
+ const floatingPanelOpenRef = (0, import_react17.useRef)(false);
15867
+ const setFloatingPanelRef = (0, import_react17.useRef)(setFloatingPanel);
15868
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react17.useState)(null);
15869
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react17.useState)(null);
15870
+ const [editorViewport, setEditorViewport] = (0, import_react17.useState)("desktop");
15871
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react17.useState)(null);
15872
+ const [sitePages, setSitePages] = (0, import_react17.useState)([]);
15873
+ const [sectionsByPath, setSectionsByPath] = (0, import_react17.useState)({});
15874
+ const sectionsPrefetchGenRef = (0, import_react17.useRef)(0);
15875
+ const setLinkPopoverRef = (0, import_react17.useRef)(setLinkPopover);
15876
+ const linkPopoverPanelRef = (0, import_react17.useRef)(null);
15877
+ const linkPopoverOpenRef = (0, import_react17.useRef)(false);
15878
+ const linkPopoverGraceUntilRef = (0, import_react17.useRef)(0);
15461
15879
  setLinkPopoverRef.current = setLinkPopover;
15462
15880
  setFloatingPanelRef.current = setFloatingPanel;
15463
15881
  linkPopoverSessionRef.current = linkPopover;
15464
15882
  floatingPanelOpenRef.current = Boolean(floatingPanel);
15465
- (0, import_react16.useEffect)(() => {
15883
+ (0, import_react17.useEffect)(() => {
15466
15884
  const syncViewport = () => {
15467
15885
  const next = window.innerWidth <= 480 ? "mobile" : "desktop";
15468
15886
  setEditorViewport((prev) => prev === next ? prev : next);
@@ -15503,10 +15921,20 @@ function OhhwellsBridge() {
15503
15921
  getNavigationItemAnchor,
15504
15922
  isDragHandleDisabled
15505
15923
  });
15924
+ const { sectionDropSlots, activeSectionDropIndex, isSectionDragging } = useSectionDrag({
15925
+ isEditMode,
15926
+ editContentRef,
15927
+ postToParentRef,
15928
+ parentScrollRef,
15929
+ navDragRef,
15930
+ footerDragRef,
15931
+ suppressNextClickRef,
15932
+ suppressClickUntilRef
15933
+ });
15506
15934
  const bumpLinkPopoverGrace = () => {
15507
15935
  linkPopoverGraceUntilRef.current = Date.now() + 350;
15508
15936
  };
15509
- const runSectionsPrefetch = (0, import_react16.useCallback)((pages) => {
15937
+ const runSectionsPrefetch = (0, import_react17.useCallback)((pages) => {
15510
15938
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
15511
15939
  const gen = ++sectionsPrefetchGenRef.current;
15512
15940
  const paths = pages.map((p) => p.path);
@@ -15525,9 +15953,9 @@ function OhhwellsBridge() {
15525
15953
  );
15526
15954
  });
15527
15955
  }, [isEditMode, pathname]);
15528
- const runSectionsPrefetchRef = (0, import_react16.useRef)(runSectionsPrefetch);
15956
+ const runSectionsPrefetchRef = (0, import_react17.useRef)(runSectionsPrefetch);
15529
15957
  runSectionsPrefetchRef.current = runSectionsPrefetch;
15530
- (0, import_react16.useEffect)(() => {
15958
+ (0, import_react17.useEffect)(() => {
15531
15959
  if (!linkPopover) {
15532
15960
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
15533
15961
  return;
@@ -15555,7 +15983,7 @@ function OhhwellsBridge() {
15555
15983
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
15556
15984
  };
15557
15985
  }, [linkPopover, postToParent2]);
15558
- (0, import_react16.useEffect)(() => {
15986
+ (0, import_react17.useEffect)(() => {
15559
15987
  if (!isEditMode) return;
15560
15988
  const useFixtures = shouldUseDevFixtures();
15561
15989
  if (useFixtures) {
@@ -15579,14 +16007,14 @@ function OhhwellsBridge() {
15579
16007
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
15580
16008
  return () => window.removeEventListener("message", onSitePages);
15581
16009
  }, [isEditMode, postToParent2]);
15582
- (0, import_react16.useEffect)(() => {
16010
+ (0, import_react17.useEffect)(() => {
15583
16011
  if (!isEditMode || shouldUseDevFixtures()) return;
15584
16012
  void loadAllSectionsManifest().then((manifest) => {
15585
16013
  if (Object.keys(manifest).length === 0) return;
15586
16014
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
15587
16015
  });
15588
16016
  }, [isEditMode]);
15589
- (0, import_react16.useEffect)(() => {
16017
+ (0, import_react17.useEffect)(() => {
15590
16018
  const update = () => {
15591
16019
  const el = activeElRef.current ?? selectedElRef.current;
15592
16020
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -15610,10 +16038,10 @@ function OhhwellsBridge() {
15610
16038
  vvp.removeEventListener("resize", update);
15611
16039
  };
15612
16040
  }, []);
15613
- const refreshStateRules = (0, import_react16.useCallback)(() => {
16041
+ const refreshStateRules = (0, import_react17.useCallback)(() => {
15614
16042
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
15615
16043
  }, []);
15616
- const processConfigRequest = (0, import_react16.useCallback)((insertAfterVal) => {
16044
+ const processConfigRequest = (0, import_react17.useCallback)((insertAfterVal) => {
15617
16045
  const tracker = getSectionsTracker();
15618
16046
  let entries = [];
15619
16047
  try {
@@ -15636,7 +16064,7 @@ function OhhwellsBridge() {
15636
16064
  }
15637
16065
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
15638
16066
  }, [isEditMode]);
15639
- const deactivate = (0, import_react16.useCallback)(() => {
16067
+ const deactivate = (0, import_react17.useCallback)(() => {
15640
16068
  const el = activeElRef.current;
15641
16069
  if (!el) return;
15642
16070
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -15677,12 +16105,12 @@ function OhhwellsBridge() {
15677
16105
  setToolbarShowEditLink(false);
15678
16106
  postToParent2({ type: "ow:exit-edit" });
15679
16107
  }, [postToParent2]);
15680
- const clearSelectedAttr = (0, import_react16.useCallback)(() => {
16108
+ const clearSelectedAttr = (0, import_react17.useCallback)(() => {
15681
16109
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
15682
16110
  el.removeAttribute("data-ohw-selected");
15683
16111
  });
15684
16112
  }, []);
15685
- const deselect = (0, import_react16.useCallback)(() => {
16113
+ const deselect = (0, import_react17.useCallback)(() => {
15686
16114
  clearSelectedAttr();
15687
16115
  selectedElRef.current = null;
15688
16116
  selectedHrefKeyRef.current = null;
@@ -15711,11 +16139,11 @@ function OhhwellsBridge() {
15711
16139
  setToolbarVariant("none");
15712
16140
  }
15713
16141
  }, [clearSelectedAttr]);
15714
- const markSelected = (0, import_react16.useCallback)((el) => {
16142
+ const markSelected = (0, import_react17.useCallback)((el) => {
15715
16143
  clearSelectedAttr();
15716
16144
  el.setAttribute("data-ohw-selected", "");
15717
16145
  }, [clearSelectedAttr]);
15718
- const resolveHrefKeyElement = (0, import_react16.useCallback)((hrefKey) => {
16146
+ const resolveHrefKeyElement = (0, import_react17.useCallback)((hrefKey) => {
15719
16147
  if (isFooterHrefKey(hrefKey)) {
15720
16148
  return document.querySelector(
15721
16149
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -15730,7 +16158,7 @@ function OhhwellsBridge() {
15730
16158
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
15731
16159
  );
15732
16160
  }, []);
15733
- const resyncSelectedNavigationItem = (0, import_react16.useCallback)(() => {
16161
+ const resyncSelectedNavigationItem = (0, import_react17.useCallback)(() => {
15734
16162
  const hrefKey = selectedHrefKeyRef.current;
15735
16163
  if (hrefKey) {
15736
16164
  const link = resolveHrefKeyElement(hrefKey);
@@ -15768,7 +16196,7 @@ function OhhwellsBridge() {
15768
16196
  );
15769
16197
  }
15770
16198
  }, [resolveHrefKeyElement]);
15771
- const reselectNavigationItem = (0, import_react16.useCallback)((navAnchor) => {
16199
+ const reselectNavigationItem = (0, import_react17.useCallback)((navAnchor) => {
15772
16200
  selectedElRef.current = navAnchor;
15773
16201
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
15774
16202
  selectedFooterColAttrRef.current = null;
@@ -15799,7 +16227,7 @@ function OhhwellsBridge() {
15799
16227
  setToolbarShowEditLink(false);
15800
16228
  setActiveCommands(/* @__PURE__ */ new Set());
15801
16229
  }, [markSelected]);
15802
- const commitNavigationTextEdit = (0, import_react16.useCallback)((navAnchor) => {
16230
+ const commitNavigationTextEdit = (0, import_react17.useCallback)((navAnchor) => {
15803
16231
  const el = activeElRef.current;
15804
16232
  if (!el) return;
15805
16233
  const key = el.dataset.ohwKey;
@@ -15832,7 +16260,7 @@ function OhhwellsBridge() {
15832
16260
  postToParent2({ type: "ow:exit-edit" });
15833
16261
  reselectNavigationItem(navAnchor);
15834
16262
  }, [postToParent2, reselectNavigationItem]);
15835
- const handleAddTopLevelNavItem = (0, import_react16.useCallback)(() => {
16263
+ const handleAddTopLevelNavItem = (0, import_react17.useCallback)(() => {
15836
16264
  const items = listNavbarRootItems();
15837
16265
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
15838
16266
  deselectRef.current();
@@ -15844,7 +16272,7 @@ function OhhwellsBridge() {
15844
16272
  intent: "add-nav"
15845
16273
  });
15846
16274
  }, []);
15847
- const maybeWarnNavLinkDropdownConflict = (0, import_react16.useCallback)(
16275
+ const maybeWarnNavLinkDropdownConflict = (0, import_react17.useCallback)(
15848
16276
  (anchor) => {
15849
16277
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
15850
16278
  if (!navDropdownsOpenOnClick()) return;
@@ -15857,7 +16285,7 @@ function OhhwellsBridge() {
15857
16285
  },
15858
16286
  [postToParent2]
15859
16287
  );
15860
- const handleNavDropdownOpenChange = (0, import_react16.useCallback)((open) => {
16288
+ const handleNavDropdownOpenChange = (0, import_react17.useCallback)((open) => {
15861
16289
  const selected = selectedElRef.current;
15862
16290
  if (!selected || !isNavigationItem2(selected)) return;
15863
16291
  setNavGroupForceOpen(selected, open);
@@ -15869,7 +16297,7 @@ function OhhwellsBridge() {
15869
16297
  }
15870
16298
  });
15871
16299
  }, []);
15872
- const handleFooterHeadingVisibleChange = (0, import_react16.useCallback)(
16300
+ const handleFooterHeadingVisibleChange = (0, import_react17.useCallback)(
15873
16301
  (visible) => {
15874
16302
  const selected = selectedElRef.current;
15875
16303
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -15893,7 +16321,7 @@ function OhhwellsBridge() {
15893
16321
  },
15894
16322
  [postToParent2]
15895
16323
  );
15896
- const enterEditOnNewItem = (0, import_react16.useCallback)((anchor) => {
16324
+ const enterEditOnNewItem = (0, import_react17.useCallback)((anchor) => {
15897
16325
  const label = anchor.querySelector('[data-ohw-editable="text"]');
15898
16326
  if (!label) {
15899
16327
  selectRef.current(anchor);
@@ -15902,7 +16330,7 @@ function OhhwellsBridge() {
15902
16330
  setNavGroupForceOpen(anchor, true);
15903
16331
  activateRef.current(label);
15904
16332
  }, []);
15905
- const handleAddChildItem = (0, import_react16.useCallback)(() => {
16333
+ const handleAddChildItem = (0, import_react17.useCallback)(() => {
15906
16334
  const selected = selectedElRef.current;
15907
16335
  if (!selected) return;
15908
16336
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -16014,7 +16442,7 @@ function OhhwellsBridge() {
16014
16442
  enterEditOnNewItem(result.anchor);
16015
16443
  });
16016
16444
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
16017
- const handleAddFooterColumn = (0, import_react16.useCallback)(() => {
16445
+ const handleAddFooterColumn = (0, import_react17.useCallback)(() => {
16018
16446
  if (!canAddFooterColumn()) {
16019
16447
  postToParent2({
16020
16448
  type: "ow:toast",
@@ -16035,7 +16463,7 @@ function OhhwellsBridge() {
16035
16463
  selectRef.current(result.firstLink);
16036
16464
  });
16037
16465
  }, [postToParent2]);
16038
- const clearFooterDragVisuals = (0, import_react16.useCallback)(() => {
16466
+ const clearFooterDragVisuals = (0, import_react17.useCallback)(() => {
16039
16467
  footerDragRef.current = null;
16040
16468
  setSiblingHintRects([]);
16041
16469
  setFooterDropSlots([]);
@@ -16044,7 +16472,7 @@ function OhhwellsBridge() {
16044
16472
  setIsItemDragging(false);
16045
16473
  unlockFooterDragInteraction();
16046
16474
  }, []);
16047
- const refreshFooterDragVisuals = (0, import_react16.useCallback)((session, activeSlot, clientX, clientY) => {
16475
+ const refreshFooterDragVisuals = (0, import_react17.useCallback)((session, activeSlot, clientX, clientY) => {
16048
16476
  const dragged = session.draggedEl;
16049
16477
  setDraggedItemRect(dragged.getBoundingClientRect());
16050
16478
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -16076,13 +16504,13 @@ function OhhwellsBridge() {
16076
16504
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
16077
16505
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
16078
16506
  }, []);
16079
- const refreshFooterDragVisualsRef = (0, import_react16.useRef)(refreshFooterDragVisuals);
16507
+ const refreshFooterDragVisualsRef = (0, import_react17.useRef)(refreshFooterDragVisuals);
16080
16508
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
16081
- const commitFooterDragRef = (0, import_react16.useRef)(() => {
16509
+ const commitFooterDragRef = (0, import_react17.useRef)(() => {
16082
16510
  });
16083
- const beginFooterDragRef = (0, import_react16.useRef)(() => {
16511
+ const beginFooterDragRef = (0, import_react17.useRef)(() => {
16084
16512
  });
16085
- const beginFooterDrag = (0, import_react16.useCallback)(
16513
+ const beginFooterDrag = (0, import_react17.useCallback)(
16086
16514
  (session) => {
16087
16515
  const rect = session.draggedEl.getBoundingClientRect();
16088
16516
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -16102,7 +16530,7 @@ function OhhwellsBridge() {
16102
16530
  [refreshFooterDragVisuals]
16103
16531
  );
16104
16532
  beginFooterDragRef.current = beginFooterDrag;
16105
- const commitFooterDrag = (0, import_react16.useCallback)(
16533
+ const commitFooterDrag = (0, import_react17.useCallback)(
16106
16534
  (clientX, clientY) => {
16107
16535
  const session = footerDragRef.current;
16108
16536
  if (!session) {
@@ -16230,7 +16658,7 @@ function OhhwellsBridge() {
16230
16658
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
16231
16659
  );
16232
16660
  commitFooterDragRef.current = commitFooterDrag;
16233
- const startFooterLinkDrag = (0, import_react16.useCallback)(
16661
+ const startFooterLinkDrag = (0, import_react17.useCallback)(
16234
16662
  (anchor, clientX, clientY, wasSelected) => {
16235
16663
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
16236
16664
  if (!hrefKey) return false;
@@ -16266,7 +16694,7 @@ function OhhwellsBridge() {
16266
16694
  },
16267
16695
  [beginFooterDrag]
16268
16696
  );
16269
- const startFooterColumnDrag = (0, import_react16.useCallback)(
16697
+ const startFooterColumnDrag = (0, import_react17.useCallback)(
16270
16698
  (columnEl, clientX, clientY, wasSelected) => {
16271
16699
  const columns = listFooterColumns();
16272
16700
  const idx = columns.indexOf(columnEl);
@@ -16286,7 +16714,7 @@ function OhhwellsBridge() {
16286
16714
  },
16287
16715
  [beginFooterDrag]
16288
16716
  );
16289
- const handleItemDragStart = (0, import_react16.useCallback)(
16717
+ const handleItemDragStart = (0, import_react17.useCallback)(
16290
16718
  (e) => {
16291
16719
  const selected = selectedElRef.current;
16292
16720
  if (!selected) {
@@ -16306,7 +16734,7 @@ function OhhwellsBridge() {
16306
16734
  },
16307
16735
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
16308
16736
  );
16309
- const handleItemDragEnd = (0, import_react16.useCallback)(
16737
+ const handleItemDragEnd = (0, import_react17.useCallback)(
16310
16738
  (e) => {
16311
16739
  if (footerDragRef.current) {
16312
16740
  const x = e?.clientX;
@@ -16332,7 +16760,7 @@ function OhhwellsBridge() {
16332
16760
  },
16333
16761
  [commitFooterDrag, commitNavDrag, navDragRef]
16334
16762
  );
16335
- const handleItemChromePointerDown = (0, import_react16.useCallback)((e) => {
16763
+ const handleItemChromePointerDown = (0, import_react17.useCallback)((e) => {
16336
16764
  if (e.button !== 0) return;
16337
16765
  const selected = selectedElRef.current;
16338
16766
  if (!selected) return;
@@ -16363,7 +16791,7 @@ function OhhwellsBridge() {
16363
16791
  }
16364
16792
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
16365
16793
  }, [armNavPressFromChrome]);
16366
- const handleItemChromeClick = (0, import_react16.useCallback)((clientX, clientY) => {
16794
+ const handleItemChromeClick = (0, import_react17.useCallback)((clientX, clientY) => {
16367
16795
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
16368
16796
  suppressNextClickRef.current = false;
16369
16797
  return;
@@ -16376,7 +16804,7 @@ function OhhwellsBridge() {
16376
16804
  }, []);
16377
16805
  reselectNavigationItemRef.current = reselectNavigationItem;
16378
16806
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
16379
- const select = (0, import_react16.useCallback)((anchor) => {
16807
+ const select = (0, import_react17.useCallback)((anchor) => {
16380
16808
  if (!isNavigationItem2(anchor)) return;
16381
16809
  if (activeElRef.current) deactivate();
16382
16810
  aiSectionApiRef.current?.selectFromElement(anchor);
@@ -16419,7 +16847,7 @@ function OhhwellsBridge() {
16419
16847
  setFloatingPanel(null);
16420
16848
  setLogoSizeDraft(null);
16421
16849
  }, [deactivate, markSelected]);
16422
- const selectFrame = (0, import_react16.useCallback)((el) => {
16850
+ const selectFrame = (0, import_react17.useCallback)((el) => {
16423
16851
  if (!isNavigationContainer(el)) return;
16424
16852
  if (activeElRef.current) deactivate();
16425
16853
  aiSectionApiRef.current?.selectFromElement(el);
@@ -16470,7 +16898,7 @@ function OhhwellsBridge() {
16470
16898
  setFloatingPanel(null);
16471
16899
  setLogoSizeDraft(null);
16472
16900
  }, [deactivate, markSelected, postToParent2]);
16473
- const selectLogo = (0, import_react16.useCallback)(
16901
+ const selectLogo = (0, import_react17.useCallback)(
16474
16902
  (logoEl) => {
16475
16903
  if (activeElRef.current) deactivate();
16476
16904
  selectedElRef.current = logoEl;
@@ -16499,7 +16927,7 @@ function OhhwellsBridge() {
16499
16927
  },
16500
16928
  [deactivate, markSelected]
16501
16929
  );
16502
- const openLogoSizePanel = (0, import_react16.useCallback)((logoEl) => {
16930
+ const openLogoSizePanel = (0, import_react17.useCallback)((logoEl) => {
16503
16931
  const placement = getLogoPlacement(logoEl);
16504
16932
  const draft = readLogoSizeState(editContentRef.current, placement);
16505
16933
  setLogoSizeDraft(draft);
@@ -16512,7 +16940,7 @@ function OhhwellsBridge() {
16512
16940
  placement
16513
16941
  });
16514
16942
  }, []);
16515
- const openSocialsDisplayPanel = (0, import_react16.useCallback)((row) => {
16943
+ const openSocialsDisplayPanel = (0, import_react17.useCallback)((row) => {
16516
16944
  setParentScrollSnap(parentScrollRef.current);
16517
16945
  setFloatingPanel({
16518
16946
  key: "socials-display",
@@ -16522,7 +16950,7 @@ function OhhwellsBridge() {
16522
16950
  row
16523
16951
  });
16524
16952
  }, []);
16525
- const changeSocialsDisplay = (0, import_react16.useCallback)(
16953
+ const changeSocialsDisplay = (0, import_react17.useCallback)(
16526
16954
  (row, next) => {
16527
16955
  if (next.icon) {
16528
16956
  const missing = socialsMissingIcons(row);
@@ -16545,17 +16973,17 @@ function OhhwellsBridge() {
16545
16973
  },
16546
16974
  []
16547
16975
  );
16548
- const closeFloatingPanelOnly = (0, import_react16.useCallback)(() => {
16976
+ const closeFloatingPanelOnly = (0, import_react17.useCallback)(() => {
16549
16977
  setFloatingPanel(null);
16550
16978
  setLogoSizeDraft(null);
16551
16979
  }, []);
16552
16980
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
16553
- const closeFloatingPanelAndDeselect = (0, import_react16.useCallback)(() => {
16981
+ const closeFloatingPanelAndDeselect = (0, import_react17.useCallback)(() => {
16554
16982
  setFloatingPanel(null);
16555
16983
  setLogoSizeDraft(null);
16556
16984
  deselectRef.current();
16557
16985
  }, []);
16558
- const persistLogoSizeDraft = (0, import_react16.useCallback)(
16986
+ const persistLogoSizeDraft = (0, import_react17.useCallback)(
16559
16987
  (placement, draft) => {
16560
16988
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
16561
16989
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -16595,7 +17023,7 @@ function OhhwellsBridge() {
16595
17023
  },
16596
17024
  [postToParent2]
16597
17025
  );
16598
- const activate = (0, import_react16.useCallback)((el, options) => {
17026
+ const activate = (0, import_react17.useCallback)((el, options) => {
16599
17027
  if (activeElRef.current === el) return;
16600
17028
  if (isIconEditable(el)) return;
16601
17029
  if (el.hasAttribute("data-ohw-social-label")) return;
@@ -16679,8 +17107,8 @@ function OhhwellsBridge() {
16679
17107
  openLogoSizePanelRef.current = openLogoSizePanel;
16680
17108
  deselectRef.current = deselect;
16681
17109
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
16682
- const lastSiteWideScopeRef = (0, import_react16.useRef)(null);
16683
- (0, import_react16.useEffect)(() => {
17110
+ const lastSiteWideScopeRef = (0, import_react17.useRef)(null);
17111
+ (0, import_react17.useEffect)(() => {
16684
17112
  if (!isEditMode) {
16685
17113
  if (lastSiteWideScopeRef.current !== false) {
16686
17114
  lastSiteWideScopeRef.current = false;
@@ -16706,7 +17134,7 @@ function OhhwellsBridge() {
16706
17134
  isFooterFrameSelection,
16707
17135
  postToParent2
16708
17136
  ]);
16709
- (0, import_react16.useLayoutEffect)(() => {
17137
+ (0, import_react17.useLayoutEffect)(() => {
16710
17138
  if (!subdomain || isEditMode) {
16711
17139
  setFetchState("done");
16712
17140
  return;
@@ -16806,7 +17234,7 @@ function OhhwellsBridge() {
16806
17234
  cancelled = true;
16807
17235
  };
16808
17236
  }, [subdomain, isEditMode]);
16809
- (0, import_react16.useEffect)(() => {
17237
+ (0, import_react17.useEffect)(() => {
16810
17238
  if (!isEditMode) return;
16811
17239
  const resolveIndex = (form, clientY) => {
16812
17240
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -16847,7 +17275,7 @@ function OhhwellsBridge() {
16847
17275
  window.removeEventListener("drop", onDrop, true);
16848
17276
  };
16849
17277
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
16850
- (0, import_react16.useEffect)(() => {
17278
+ (0, import_react17.useEffect)(() => {
16851
17279
  if (!isEditMode) return;
16852
17280
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
16853
17281
  markFormFields(form);
@@ -16859,7 +17287,7 @@ function OhhwellsBridge() {
16859
17287
  });
16860
17288
  return () => observer.disconnect();
16861
17289
  }, [isEditMode, fetchState, pathname]);
16862
- (0, import_react16.useEffect)(() => {
17290
+ (0, import_react17.useEffect)(() => {
16863
17291
  if (!isEditMode) return;
16864
17292
  let saveTimer = null;
16865
17293
  const onInput = (e) => {
@@ -16881,14 +17309,14 @@ function OhhwellsBridge() {
16881
17309
  document.addEventListener("input", onInput, true);
16882
17310
  return () => document.removeEventListener("input", onInput, true);
16883
17311
  }, [isEditMode, persistFields]);
16884
- (0, import_react16.useEffect)(() => {
17312
+ (0, import_react17.useEffect)(() => {
16885
17313
  if (isEditMode || fetchState !== "done") return;
16886
17314
  const content = contentCache.get(subdomain) ?? {};
16887
17315
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
16888
17316
  reconcileFieldsFromContent(form, content);
16889
17317
  });
16890
17318
  }, [isEditMode, fetchState, subdomain]);
16891
- (0, import_react16.useEffect)(() => {
17319
+ (0, import_react17.useEffect)(() => {
16892
17320
  if (!isEditMode) return;
16893
17321
  const swallow = (e) => {
16894
17322
  const target = e.target;
@@ -16897,12 +17325,12 @@ function OhhwellsBridge() {
16897
17325
  document.addEventListener("submit", swallow, true);
16898
17326
  return () => document.removeEventListener("submit", swallow, true);
16899
17327
  }, [isEditMode]);
16900
- (0, import_react16.useEffect)(() => {
17328
+ (0, import_react17.useEffect)(() => {
16901
17329
  if (isEditMode || fetchState !== "done") return;
16902
17330
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
16903
17331
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
16904
17332
  }, [isEditMode, fetchState, subdomain]);
16905
- (0, import_react16.useEffect)(() => {
17333
+ (0, import_react17.useEffect)(() => {
16906
17334
  if (!subdomain || isEditMode) return;
16907
17335
  let debounceTimer = null;
16908
17336
  let observer = null;
@@ -16988,16 +17416,16 @@ function OhhwellsBridge() {
16988
17416
  if (debounceTimer) clearTimeout(debounceTimer);
16989
17417
  };
16990
17418
  }, [subdomain, isEditMode, pathname]);
16991
- (0, import_react16.useLayoutEffect)(() => {
17419
+ (0, import_react17.useLayoutEffect)(() => {
16992
17420
  const el = document.getElementById("ohw-loader");
16993
17421
  if (!el) return;
16994
17422
  const visible = Boolean(subdomain) && fetchState !== "done";
16995
17423
  el.style.display = visible ? "flex" : "none";
16996
17424
  }, [subdomain, fetchState]);
16997
- (0, import_react16.useEffect)(() => {
17425
+ (0, import_react17.useEffect)(() => {
16998
17426
  postToParent2({ type: "ow:navigation", path: pathname });
16999
17427
  }, [pathname, postToParent2]);
17000
- (0, import_react16.useEffect)(() => {
17428
+ (0, import_react17.useEffect)(() => {
17001
17429
  if (!isEditMode) return;
17002
17430
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
17003
17431
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -17005,7 +17433,7 @@ function OhhwellsBridge() {
17005
17433
  deselectRef.current();
17006
17434
  deactivateRef.current();
17007
17435
  }, [pathname, isEditMode]);
17008
- (0, import_react16.useEffect)(() => {
17436
+ (0, import_react17.useEffect)(() => {
17009
17437
  const contentForNav = () => {
17010
17438
  if (isEditMode) return editContentRef.current;
17011
17439
  if (!subdomain) return {};
@@ -17072,7 +17500,7 @@ function OhhwellsBridge() {
17072
17500
  observer?.disconnect();
17073
17501
  };
17074
17502
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
17075
- (0, import_react16.useEffect)(() => {
17503
+ (0, import_react17.useEffect)(() => {
17076
17504
  if (!isEditMode) return;
17077
17505
  let lastPosted = 0;
17078
17506
  const measure = () => {
@@ -17101,7 +17529,7 @@ function OhhwellsBridge() {
17101
17529
  ro.disconnect();
17102
17530
  };
17103
17531
  }, [pathname, isEditMode, postToParent2]);
17104
- (0, import_react16.useEffect)(() => {
17532
+ (0, import_react17.useEffect)(() => {
17105
17533
  if (!subdomainFromQuery || isEditMode) return;
17106
17534
  const handleClick = (e) => {
17107
17535
  const anchor = e.target.closest("a");
@@ -17117,7 +17545,7 @@ function OhhwellsBridge() {
17117
17545
  document.addEventListener("click", handleClick, true);
17118
17546
  return () => document.removeEventListener("click", handleClick, true);
17119
17547
  }, [subdomainFromQuery, isEditMode, router]);
17120
- (0, import_react16.useEffect)(() => {
17548
+ (0, import_react17.useEffect)(() => {
17121
17549
  if (!isEditMode) {
17122
17550
  editStylesRef.current?.base.remove();
17123
17551
  editStylesRef.current?.forceHover.remove();
@@ -18792,6 +19220,19 @@ function OhhwellsBridge() {
18792
19220
  postAiSectionsChanged();
18793
19221
  };
18794
19222
  window.addEventListener("message", handleAiSetSections);
19223
+ const handleMoveSection = (e) => {
19224
+ if (e.data?.type !== "ow:move-section") return;
19225
+ const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
19226
+ const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
19227
+ if (!instanceId || !direction) return;
19228
+ const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
19229
+ if (!entries) return;
19230
+ const orderJson = JSON.stringify(entries);
19231
+ editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
19232
+ postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
19233
+ window.dispatchEvent(new Event("resize"));
19234
+ };
19235
+ window.addEventListener("message", handleMoveSection);
18795
19236
  const handleAiSetBrand = (e) => {
18796
19237
  if (e.data?.type !== "ow:ai-set-brand") return;
18797
19238
  const value = typeof e.data.value === "string" ? e.data.value : "";
@@ -19496,6 +19937,7 @@ function OhhwellsBridge() {
19496
19937
  window.removeEventListener("message", handleAiApplyTree);
19497
19938
  window.removeEventListener("message", handleAiDeleteSection);
19498
19939
  window.removeEventListener("message", handleAiSetSections);
19940
+ window.removeEventListener("message", handleMoveSection);
19499
19941
  window.removeEventListener("message", handleAiSetBrand);
19500
19942
  window.removeEventListener("message", handleAiSetStyles);
19501
19943
  window.removeEventListener("message", handleGetBrand);
@@ -19509,7 +19951,7 @@ function OhhwellsBridge() {
19509
19951
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
19510
19952
  };
19511
19953
  }, [isEditMode, refreshStateRules]);
19512
- (0, import_react16.useEffect)(() => {
19954
+ (0, import_react17.useEffect)(() => {
19513
19955
  if (!isEditMode) return;
19514
19956
  const THRESHOLD = 10;
19515
19957
  const resolveWasSelected = (el) => {
@@ -19665,7 +20107,7 @@ function OhhwellsBridge() {
19665
20107
  unlockFooterDragInteraction();
19666
20108
  };
19667
20109
  }, [isEditMode]);
19668
- (0, import_react16.useEffect)(() => {
20110
+ (0, import_react17.useEffect)(() => {
19669
20111
  const handler = (e) => {
19670
20112
  if (e.data?.type !== "ow:request-schedule-config") return;
19671
20113
  const insertAfterVal = e.data.insertAfter;
@@ -19681,7 +20123,7 @@ function OhhwellsBridge() {
19681
20123
  window.addEventListener("message", handler);
19682
20124
  return () => window.removeEventListener("message", handler);
19683
20125
  }, [processConfigRequest]);
19684
- (0, import_react16.useEffect)(() => {
20126
+ (0, import_react17.useEffect)(() => {
19685
20127
  if (!isEditMode) return;
19686
20128
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
19687
20129
  el.removeAttribute("data-ohw-active-state");
@@ -19717,13 +20159,13 @@ function OhhwellsBridge() {
19717
20159
  clearTimeout(timer);
19718
20160
  };
19719
20161
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
19720
- (0, import_react16.useEffect)(() => {
20162
+ (0, import_react17.useEffect)(() => {
19721
20163
  scrollToHashSectionWhenReady();
19722
20164
  const onHashChange = () => scrollToHashSectionWhenReady();
19723
20165
  window.addEventListener("hashchange", onHashChange);
19724
20166
  return () => window.removeEventListener("hashchange", onHashChange);
19725
20167
  }, [pathname]);
19726
- const handleCommand = (0, import_react16.useCallback)((cmd) => {
20168
+ const handleCommand = (0, import_react17.useCallback)((cmd) => {
19727
20169
  const el = activeElRef.current;
19728
20170
  const selBefore = window.getSelection();
19729
20171
  let savedOffsets = null;
@@ -19759,7 +20201,7 @@ function OhhwellsBridge() {
19759
20201
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
19760
20202
  refreshActiveCommandsRef.current();
19761
20203
  }, []);
19762
- const handleStateChange = (0, import_react16.useCallback)((state) => {
20204
+ const handleStateChange = (0, import_react17.useCallback)((state) => {
19763
20205
  if (!activeStateElRef.current) return;
19764
20206
  const el = activeStateElRef.current;
19765
20207
  if (state === "Default") {
@@ -19772,7 +20214,7 @@ function OhhwellsBridge() {
19772
20214
  }
19773
20215
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
19774
20216
  }, [deactivate]);
19775
- const reselectAfterLinkPopover = (0, import_react16.useCallback)(
20217
+ const reselectAfterLinkPopover = (0, import_react17.useCallback)(
19776
20218
  (hrefKey) => {
19777
20219
  requestAnimationFrame(() => {
19778
20220
  const el = resolveHrefKeyElement(hrefKey);
@@ -19781,7 +20223,7 @@ function OhhwellsBridge() {
19781
20223
  },
19782
20224
  [resolveHrefKeyElement]
19783
20225
  );
19784
- const closeLinkPopover = (0, import_react16.useCallback)(() => {
20226
+ const closeLinkPopover = (0, import_react17.useCallback)(() => {
19785
20227
  const session = linkPopoverSessionRef.current;
19786
20228
  addNavAfterAnchorRef.current = null;
19787
20229
  setLinkPopover(null);
@@ -19789,9 +20231,9 @@ function OhhwellsBridge() {
19789
20231
  reselectAfterLinkPopover(session.key);
19790
20232
  }
19791
20233
  }, [reselectAfterLinkPopover]);
19792
- const closeLinkPopoverRef = (0, import_react16.useRef)(closeLinkPopover);
20234
+ const closeLinkPopoverRef = (0, import_react17.useRef)(closeLinkPopover);
19793
20235
  closeLinkPopoverRef.current = closeLinkPopover;
19794
- const openLinkPopoverForActive = (0, import_react16.useCallback)(() => {
20236
+ const openLinkPopoverForActive = (0, import_react17.useCallback)(() => {
19795
20237
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
19796
20238
  if (!hrefCtx) return;
19797
20239
  bumpLinkPopoverGrace();
@@ -19802,7 +20244,7 @@ function OhhwellsBridge() {
19802
20244
  });
19803
20245
  deactivate();
19804
20246
  }, [deactivate]);
19805
- const openLinkPopoverForSelected = (0, import_react16.useCallback)(() => {
20247
+ const openLinkPopoverForSelected = (0, import_react17.useCallback)(() => {
19806
20248
  const anchor = selectedElRef.current;
19807
20249
  if (!anchor) return;
19808
20250
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -19819,7 +20261,7 @@ function OhhwellsBridge() {
19819
20261
  });
19820
20262
  deselect();
19821
20263
  }, [deselect]);
19822
- const handleSelectParent = (0, import_react16.useCallback)(() => {
20264
+ const handleSelectParent = (0, import_react17.useCallback)(() => {
19823
20265
  const selected = selectedElRef.current;
19824
20266
  if (!selected) return;
19825
20267
  if (toolbarVariantRef.current === "select-frame") {
@@ -19846,7 +20288,7 @@ function OhhwellsBridge() {
19846
20288
  }
19847
20289
  deselectRef.current();
19848
20290
  }, []);
19849
- const handleDuplicateSelected = (0, import_react16.useCallback)(() => {
20291
+ const handleDuplicateSelected = (0, import_react17.useCallback)(() => {
19850
20292
  const selected = selectedElRef.current;
19851
20293
  if (!selected || !isNavigationItem2(selected)) return;
19852
20294
  const hrefKey = selected.getAttribute("data-ohw-href-key");
@@ -19962,7 +20404,7 @@ function OhhwellsBridge() {
19962
20404
  });
19963
20405
  }
19964
20406
  }, [postToParent2]);
19965
- const runPendingDeleteUndo = (0, import_react16.useCallback)(() => {
20407
+ const runPendingDeleteUndo = (0, import_react17.useCallback)(() => {
19966
20408
  const pending = pendingDeleteUndoRef.current;
19967
20409
  if (!pending) return false;
19968
20410
  pendingDeleteUndoRef.current = null;
@@ -19970,7 +20412,7 @@ function OhhwellsBridge() {
19970
20412
  enforceLinkHrefs();
19971
20413
  return true;
19972
20414
  }, []);
19973
- const handleDeleteSelected = (0, import_react16.useCallback)(() => {
20415
+ const handleDeleteSelected = (0, import_react17.useCallback)(() => {
19974
20416
  const selected = selectedElRef.current;
19975
20417
  if (!selected) return false;
19976
20418
  return deleteSelectedNavFooterItem({
@@ -19991,7 +20433,7 @@ function OhhwellsBridge() {
19991
20433
  }, [postToParent2]);
19992
20434
  handleDeleteSelectedRef.current = handleDeleteSelected;
19993
20435
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
19994
- const handleLinkPopoverSubmit = (0, import_react16.useCallback)(
20436
+ const handleLinkPopoverSubmit = (0, import_react17.useCallback)(
19995
20437
  (target) => {
19996
20438
  const session = linkPopoverSessionRef.current;
19997
20439
  if (!session) return;
@@ -20057,19 +20499,19 @@ function OhhwellsBridge() {
20057
20499
  const showEditLink = toolbarShowEditLink;
20058
20500
  const currentSections = sectionsByPath[pathname] ?? [];
20059
20501
  linkPopoverOpenRef.current = linkPopover !== null;
20060
- const handleMediaReplace = (0, import_react16.useCallback)(
20502
+ const handleMediaReplace = (0, import_react17.useCallback)(
20061
20503
  (key) => {
20062
20504
  postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
20063
20505
  },
20064
20506
  [postToParent2, mediaHover?.elementType]
20065
20507
  );
20066
- const handleEditCarousel = (0, import_react16.useCallback)(
20508
+ const handleEditCarousel = (0, import_react17.useCallback)(
20067
20509
  (key) => {
20068
20510
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
20069
20511
  },
20070
20512
  [postToParent2]
20071
20513
  );
20072
- const handleMediaFadeOutComplete = (0, import_react16.useCallback)((key) => {
20514
+ const handleMediaFadeOutComplete = (0, import_react17.useCallback)((key) => {
20073
20515
  setUploadingRects((prev) => {
20074
20516
  if (!(key in prev)) return prev;
20075
20517
  const next = { ...prev };
@@ -20077,7 +20519,7 @@ function OhhwellsBridge() {
20077
20519
  return next;
20078
20520
  });
20079
20521
  }, []);
20080
- const handleVideoSettingsChange = (0, import_react16.useCallback)(
20522
+ const handleVideoSettingsChange = (0, import_react17.useCallback)(
20081
20523
  (key, settings) => {
20082
20524
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
20083
20525
  const video = getVideoEl2(el);
@@ -20099,465 +20541,485 @@ function OhhwellsBridge() {
20099
20541
  },
20100
20542
  [postToParent2]
20101
20543
  );
20102
- return bridgeRoot ? (0, import_react_dom4.createPortal)(
20103
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
20104
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
20105
- isEditMode && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
20106
- Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20107
- MediaOverlay,
20108
- {
20109
- hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
20110
- isUploading: true,
20111
- fadingOut,
20112
- onFadeOutComplete: handleMediaFadeOutComplete,
20113
- onReplace: handleMediaReplace
20114
- },
20115
- `uploading-${key}`
20116
- )),
20117
- mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20118
- MediaOverlay,
20119
- {
20120
- hover: mediaHover,
20121
- isUploading: false,
20122
- onReplace: handleMediaReplace,
20123
- onVideoSettingsChange: handleVideoSettingsChange
20124
- }
20125
- ),
20126
- carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
20127
- siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
20128
- siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
20129
- isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
20130
- isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20131
- "div",
20132
- {
20133
- className: "pointer-events-none fixed z-2147483646",
20134
- style: {
20135
- left: slot.left,
20136
- top: slot.top,
20137
- width: slot.width,
20138
- height: slot.height
20544
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
20545
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { id: "ohw-loader", suppressHydrationWarning: true, style: { ...OHW_LOADER_STYLE, display: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OhwLoaderSpinner, {}) }),
20546
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("script", { suppressHydrationWarning: true, dangerouslySetInnerHTML: { __html: OHW_LOADER_PREHYDRATE_SCRIPT } }),
20547
+ bridgeRoot ? (0, import_react_dom4.createPortal)(
20548
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
20549
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
20550
+ isEditMode && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AiSectionOverlay, { postToParent: postToParent2, apiRef: aiSectionApiRef }),
20551
+ isSectionDragging && sectionDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20552
+ "div",
20553
+ {
20554
+ className: "pointer-events-none fixed z-2147483646",
20555
+ style: { left: slot.left, top: slot.y, width: slot.width, height: 3, transform: "translateY(-50%)" },
20556
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20557
+ DropIndicator,
20558
+ {
20559
+ direction: "horizontal",
20560
+ state: activeSectionDropIndex === i ? "dragActive" : "dragIdle",
20561
+ className: "!h-full !w-full"
20562
+ }
20563
+ )
20139
20564
  },
20140
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20141
- DropIndicator,
20142
- {
20143
- direction: slot.direction,
20144
- state: activeFooterDropIndex === i ? "dragActive" : "dragIdle",
20145
- className: "!h-full !w-full"
20146
- }
20147
- )
20148
- },
20149
- `footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
20150
- )),
20151
- isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20152
- "div",
20153
- {
20154
- className: "pointer-events-none fixed z-2147483646",
20155
- style: {
20156
- left: slot.left,
20157
- top: slot.top,
20158
- width: slot.width,
20159
- height: slot.height
20565
+ `section-drop-${slot.insertIndex}-${i}`
20566
+ )),
20567
+ Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20568
+ MediaOverlay,
20569
+ {
20570
+ hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
20571
+ isUploading: true,
20572
+ fadingOut,
20573
+ onFadeOutComplete: handleMediaFadeOutComplete,
20574
+ onReplace: handleMediaReplace
20160
20575
  },
20161
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20162
- DropIndicator,
20163
- {
20164
- direction: slot.direction,
20165
- state: activeNavDropIndex === i ? "dragActive" : "dragIdle",
20166
- className: "!h-full !w-full"
20167
- }
20168
- )
20169
- },
20170
- `nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
20171
- )),
20172
- hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
20173
- hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
20174
- hoveredTextRect && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredTextRect, state: "hover" }),
20175
- formPickRect && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20176
- ItemInteractionLayer,
20177
- {
20178
- rect: formPickRect,
20179
- state: "active-top",
20180
- itemDragSurface: false,
20181
- toolbarAlign: "left",
20182
- chromeGap: 24,
20183
- toolbar: fieldPickRect ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20184
- "div",
20185
- {
20186
- "data-ohw-form-toolbar": "",
20187
- className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
20188
- children: [
20189
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20190
- "button",
20191
- {
20192
- type: "button",
20193
- "aria-label": "Add field",
20194
- className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
20195
- onClick: () => setFieldTypePickerOpen((open) => !open),
20196
- "data-ohw-add-field": "",
20197
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Plus, { size: 15, "aria-hidden": true })
20198
- }
20199
- ),
20200
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20201
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20202
- "button",
20203
- {
20204
- type: "button",
20205
- className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-semibold text-foreground transition-colors hover:bg-muted/80",
20206
- onClick: () => {
20207
- const form = formPickElRef.current;
20208
- if (!form) return;
20209
- postToParent2({
20210
- type: "ow:form-pick",
20211
- formKey: formKeyOf(form),
20212
- hasLongText: formHasLongText(form)
20213
- });
20576
+ `uploading-${key}`
20577
+ )),
20578
+ mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20579
+ MediaOverlay,
20580
+ {
20581
+ hover: mediaHover,
20582
+ isUploading: false,
20583
+ onReplace: handleMediaReplace,
20584
+ onVideoSettingsChange: handleVideoSettingsChange
20585
+ }
20586
+ ),
20587
+ carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
20588
+ siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
20589
+ siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
20590
+ isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
20591
+ isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20592
+ "div",
20593
+ {
20594
+ className: "pointer-events-none fixed z-2147483646",
20595
+ style: {
20596
+ left: slot.left,
20597
+ top: slot.top,
20598
+ width: slot.width,
20599
+ height: slot.height
20600
+ },
20601
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20602
+ DropIndicator,
20603
+ {
20604
+ direction: slot.direction,
20605
+ state: activeFooterDropIndex === i ? "dragActive" : "dragIdle",
20606
+ className: "!h-full !w-full"
20607
+ }
20608
+ )
20609
+ },
20610
+ `footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
20611
+ )),
20612
+ isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20613
+ "div",
20614
+ {
20615
+ className: "pointer-events-none fixed z-2147483646",
20616
+ style: {
20617
+ left: slot.left,
20618
+ top: slot.top,
20619
+ width: slot.width,
20620
+ height: slot.height
20621
+ },
20622
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20623
+ DropIndicator,
20624
+ {
20625
+ direction: slot.direction,
20626
+ state: activeNavDropIndex === i ? "dragActive" : "dragIdle",
20627
+ className: "!h-full !w-full"
20628
+ }
20629
+ )
20630
+ },
20631
+ `nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
20632
+ )),
20633
+ hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
20634
+ hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
20635
+ hoveredTextRect && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ItemInteractionLayer, { rect: hoveredTextRect, state: "hover" }),
20636
+ formPickRect && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20637
+ ItemInteractionLayer,
20638
+ {
20639
+ rect: formPickRect,
20640
+ state: "active-top",
20641
+ itemDragSurface: false,
20642
+ toolbarAlign: "left",
20643
+ chromeGap: 24,
20644
+ toolbar: fieldPickRect ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20645
+ "div",
20646
+ {
20647
+ "data-ohw-form-toolbar": "",
20648
+ className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
20649
+ children: [
20650
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20651
+ "button",
20652
+ {
20653
+ type: "button",
20654
+ "aria-label": "Add field",
20655
+ className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
20656
+ onClick: () => setFieldTypePickerOpen((open) => !open),
20657
+ "data-ohw-add-field": "",
20658
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Plus, { size: 15, "aria-hidden": true })
20659
+ }
20660
+ ),
20661
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20662
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20663
+ "button",
20664
+ {
20665
+ type: "button",
20666
+ className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-semibold text-foreground transition-colors hover:bg-muted/80",
20667
+ onClick: () => {
20668
+ const form = formPickElRef.current;
20669
+ if (!form) return;
20670
+ postToParent2({
20671
+ type: "ow:form-pick",
20672
+ formKey: formKeyOf(form),
20673
+ hasLongText: formHasLongText(form)
20674
+ });
20675
+ },
20676
+ children: [
20677
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Settings, { size: 14, "aria-hidden": true }),
20678
+ "Form settings",
20679
+ formPickCount ? (
20680
+ // Counter pill, per the design — not a text suffix.
20681
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20682
+ "span",
20683
+ {
20684
+ "data-ohw-form-count": "",
20685
+ className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
20686
+ children: formPickCount
20687
+ }
20688
+ )
20689
+ ) : null
20690
+ ]
20691
+ }
20692
+ ),
20693
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20694
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center rounded-md bg-muted/70 p-0.5", children: ["default", "success"].map((state) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20695
+ "button",
20696
+ {
20697
+ type: "button",
20698
+ "aria-pressed": formViewState === state,
20699
+ className: "rounded-md px-2.5 py-1 text-[13px] font-semibold capitalize transition-colors " + (formViewState === state ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
20700
+ onClick: () => {
20701
+ const form = formPickElRef.current;
20702
+ const key = form ? formKeyOf(form) : null;
20703
+ if (!form || !key) return;
20704
+ const initial = successInitialFor(form, key, editContentRef.current);
20705
+ setFormViewState(form, key, state, initial);
20706
+ setFormViewStateUi(state);
20707
+ setFormPickRect(form.getBoundingClientRect());
20708
+ if (state === "success") {
20709
+ const successEl = form.querySelector(`[${SUCCESS_TEXT_ATTR}]`);
20710
+ if (successEl) requestAnimationFrame(() => activateRef.current(successEl));
20711
+ } else {
20712
+ deactivateRef.current();
20713
+ }
20714
+ },
20715
+ children: state
20214
20716
  },
20215
- children: [
20216
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react18.Settings, { size: 14, "aria-hidden": true }),
20217
- "Form settings",
20218
- formPickCount ? (
20219
- // Counter pill, per the design — not a text suffix.
20220
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20221
- "span",
20222
- {
20223
- "data-ohw-form-count": "",
20224
- className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
20225
- children: formPickCount
20226
- }
20227
- )
20228
- ) : null
20229
- ]
20230
- }
20717
+ state
20718
+ )) })
20719
+ ]
20720
+ }
20721
+ )
20722
+ }
20723
+ ),
20724
+ formHoverRect && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20725
+ ItemInteractionLayer,
20726
+ {
20727
+ rect: formHoverRect,
20728
+ state: "hover",
20729
+ chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
20730
+ }
20731
+ ),
20732
+ fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20733
+ ItemInteractionLayer,
20734
+ {
20735
+ rect: fieldPickRect,
20736
+ state: fieldDragging ? "dragging" : "active-top",
20737
+ itemDragSurface: false,
20738
+ toolbarAlign: "left",
20739
+ chromeGap: 10,
20740
+ showHandle: true,
20741
+ dragHandleLabel: "Reorder field",
20742
+ onDragHandleDragStart: handleFieldDragStart,
20743
+ onDragHandleDragEnd: handleFieldDragEnd,
20744
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20745
+ FormFieldToolbar,
20746
+ {
20747
+ type: fieldPickState.type,
20748
+ required: fieldPickState.required,
20749
+ onTypeChange: handleFieldTypeChange,
20750
+ onRequiredToggle: handleFieldRequiredToggle,
20751
+ onDuplicate: handleFieldDuplicate,
20752
+ onDelete: handleFieldDelete
20753
+ }
20754
+ )
20755
+ }
20756
+ ),
20757
+ fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20758
+ "div",
20759
+ {
20760
+ className: "pointer-events-none fixed z-[2147483644]",
20761
+ style: { top: slot.top, left: slot.left, width: slot.width },
20762
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20763
+ DropIndicator,
20764
+ {
20765
+ direction: "horizontal",
20766
+ state: fieldDropIndex === i ? "dragActive" : "dragIdle",
20767
+ className: "!w-full"
20768
+ }
20769
+ )
20770
+ },
20771
+ `field-drop-${i}`
20772
+ )) : null,
20773
+ fieldTypePickerOpen && formPickRect && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20774
+ "div",
20775
+ {
20776
+ className: "pointer-events-none fixed z-[2147483645]",
20777
+ style: { top: formPickRect.top + 16, left: formPickRect.left + 24 },
20778
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FieldTypePicker, { onPick: handleAddField })
20779
+ }
20780
+ ),
20781
+ toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
20782
+ toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20783
+ FooterContainerChrome,
20784
+ {
20785
+ rect: toolbarRect,
20786
+ onAdd: handleAddFooterColumn,
20787
+ addDisabled: !canAddFooterColumn()
20788
+ }
20789
+ ),
20790
+ toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame" || toolbarVariant === "logo") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20791
+ ItemInteractionLayer,
20792
+ {
20793
+ rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
20794
+ toolbarBelowRect: selectedElRef.current && isNavigationItem2(selectedElRef.current) ? getOpenNavDropdownPanelRect(selectedElRef.current) : null,
20795
+ elRef: glowElRef,
20796
+ state: isItemDragging ? "dragging" : selectedElRef.current && isNavigationItem2(selectedElRef.current) && getOpenNavDropdownPanelRect(selectedElRef.current) ? "active-bottom" : resolveItemInteractionState(toolbarRect, parentScrollRef.current),
20797
+ showHandle: toolbarVariant === "link-action" && Boolean(reorderHrefKey) || toolbarVariant === "select-frame" && isFooterFrameSelection,
20798
+ dragDisabled: reorderDragDisabled,
20799
+ dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item",
20800
+ onDragHandleDragStart: handleItemDragStart,
20801
+ onDragHandleDragEnd: handleItemDragEnd,
20802
+ onItemPointerDown: toolbarVariant === "logo" ? void 0 : handleItemChromePointerDown,
20803
+ onItemClick: toolbarVariant === "logo" ? void 0 : handleItemChromeClick,
20804
+ itemDragSurface: toolbarVariant !== "logo" && !isFooterFrameSelection,
20805
+ toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && (isFooterFrameSelection || selectedIsSocialsRow) && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20806
+ ItemActionToolbar,
20807
+ {
20808
+ onEditLink: openLinkPopoverForSelected,
20809
+ onStyle: () => {
20810
+ const row = selectedElRef.current;
20811
+ if (!row) return;
20812
+ if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
20813
+ else openSocialsDisplayPanel(row);
20814
+ },
20815
+ showStyle: selectedIsSocialsRow,
20816
+ styleActive: floatingPanel?.kind === "socials-display",
20817
+ onAddItem: handleAddChildItem,
20818
+ onSelectParent: handleSelectParent,
20819
+ onDuplicate: handleDuplicateSelected,
20820
+ onDelete: handleDeleteSelected,
20821
+ addItemDisabled: isFooterFrameSelection && isFooterAddItemDisabled(selectedElRef.current) || selectedElRef.current !== null && (() => {
20822
+ const row = isSocialsRow(selectedElRef.current) ? selectedElRef.current : findSocialsRow(selectedElRef.current);
20823
+ return row ? !canAddSocialItem(row) : false;
20824
+ })(),
20825
+ editLinkDisabled: false,
20826
+ moreDisabled: false,
20827
+ duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
20828
+ showEditLink: !isFooterFrameSelection && !selectedIsSocialsRow && navDropdownPreviewOpen === null,
20829
+ showAddItem: isFooterFrameSelection || selectedIsSocialsRow || !selectedIsCta && Boolean(
20830
+ selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
20231
20831
  ),
20232
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20233
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center rounded-md bg-muted/70 p-0.5", children: ["default", "success"].map((state) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20234
- "button",
20235
- {
20236
- type: "button",
20237
- "aria-pressed": formViewState === state,
20238
- className: "rounded-md px-2.5 py-1 text-[13px] font-semibold capitalize transition-colors " + (formViewState === state ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
20239
- onClick: () => {
20240
- const form = formPickElRef.current;
20241
- const key = form ? formKeyOf(form) : null;
20242
- if (!form || !key) return;
20243
- const initial = successInitialFor(form, key, editContentRef.current);
20244
- setFormViewState(form, key, state, initial);
20245
- setFormViewStateUi(state);
20246
- setFormPickRect(form.getBoundingClientRect());
20247
- if (state === "success") {
20248
- const successEl = form.querySelector(`[${SUCCESS_TEXT_ATTR}]`);
20249
- if (successEl) requestAnimationFrame(() => activateRef.current(successEl));
20250
- } else {
20251
- deactivateRef.current();
20252
- }
20253
- },
20254
- children: state
20255
- },
20256
- state
20257
- )) })
20258
- ]
20259
- }
20260
- )
20261
- }
20262
- ),
20263
- formHoverRect && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20264
- ItemInteractionLayer,
20265
- {
20266
- rect: formHoverRect,
20267
- state: "hover",
20268
- chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
20269
- }
20270
- ),
20271
- fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20272
- ItemInteractionLayer,
20273
- {
20274
- rect: fieldPickRect,
20275
- state: fieldDragging ? "dragging" : "active-top",
20276
- itemDragSurface: false,
20277
- toolbarAlign: "left",
20278
- chromeGap: 10,
20279
- showHandle: true,
20280
- dragHandleLabel: "Reorder field",
20281
- onDragHandleDragStart: handleFieldDragStart,
20282
- onDragHandleDragEnd: handleFieldDragEnd,
20283
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20284
- FormFieldToolbar,
20832
+ showMore: (!selectedIsCta || isFooterFrameSelection) && !selectedIsSocialsRow,
20833
+ dropdownOpen: navDropdownPreviewOpen,
20834
+ onDropdownOpenChange: handleNavDropdownOpenChange,
20835
+ headingVisible: footerHeadingVisible,
20836
+ onHeadingVisibleChange: handleFooterHeadingVisibleChange
20837
+ }
20838
+ ) : void 0
20839
+ }
20840
+ ),
20841
+ toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
20842
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20843
+ EditGlowChrome,
20285
20844
  {
20286
- type: fieldPickState.type,
20287
- required: fieldPickState.required,
20288
- onTypeChange: handleFieldTypeChange,
20289
- onRequiredToggle: handleFieldRequiredToggle,
20290
- onDuplicate: handleFieldDuplicate,
20291
- onDelete: handleFieldDelete
20845
+ rect: toolbarRect,
20846
+ elRef: glowElRef,
20847
+ reorderHrefKey,
20848
+ dragDisabled: reorderDragDisabled,
20849
+ hideHandle: isItemDragging
20292
20850
  }
20293
- )
20294
- }
20295
- ),
20296
- fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20297
- "div",
20298
- {
20299
- className: "pointer-events-none fixed z-[2147483644]",
20300
- style: { top: slot.top, left: slot.left, width: slot.width },
20301
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20302
- DropIndicator,
20851
+ ),
20852
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20853
+ FloatingToolbar,
20303
20854
  {
20304
- direction: "horizontal",
20305
- state: fieldDropIndex === i ? "dragActive" : "dragIdle",
20306
- className: "!w-full"
20855
+ rect: toolbarRect,
20856
+ parentScroll: parentScrollRef.current,
20857
+ elRef: toolbarElRef,
20858
+ onCommand: handleCommand,
20859
+ activeCommands,
20860
+ showEditLink,
20861
+ onEditLink: openLinkPopoverForActive
20307
20862
  }
20308
20863
  )
20309
- },
20310
- `field-drop-${i}`
20311
- )) : null,
20312
- fieldTypePickerOpen && formPickRect && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20313
- "div",
20314
- {
20315
- className: "pointer-events-none fixed z-[2147483645]",
20316
- style: { top: formPickRect.top + 16, left: formPickRect.left + 24 },
20317
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FieldTypePicker, { onPick: handleAddField })
20318
- }
20319
- ),
20320
- toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
20321
- toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20322
- FooterContainerChrome,
20323
- {
20324
- rect: toolbarRect,
20325
- onAdd: handleAddFooterColumn,
20326
- addDisabled: !canAddFooterColumn()
20327
- }
20328
- ),
20329
- toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame" || toolbarVariant === "logo") && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20330
- ItemInteractionLayer,
20331
- {
20332
- rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
20333
- toolbarBelowRect: selectedElRef.current && isNavigationItem2(selectedElRef.current) ? getOpenNavDropdownPanelRect(selectedElRef.current) : null,
20334
- elRef: glowElRef,
20335
- state: isItemDragging ? "dragging" : selectedElRef.current && isNavigationItem2(selectedElRef.current) && getOpenNavDropdownPanelRect(selectedElRef.current) ? "active-bottom" : resolveItemInteractionState(toolbarRect, parentScrollRef.current),
20336
- showHandle: toolbarVariant === "link-action" && Boolean(reorderHrefKey) || toolbarVariant === "select-frame" && isFooterFrameSelection,
20337
- dragDisabled: reorderDragDisabled,
20338
- dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item",
20339
- onDragHandleDragStart: handleItemDragStart,
20340
- onDragHandleDragEnd: handleItemDragEnd,
20341
- onItemPointerDown: toolbarVariant === "logo" ? void 0 : handleItemChromePointerDown,
20342
- onItemClick: toolbarVariant === "logo" ? void 0 : handleItemChromeClick,
20343
- itemDragSurface: toolbarVariant !== "logo" && !isFooterFrameSelection,
20344
- toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && (isFooterFrameSelection || selectedIsSocialsRow) && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20345
- ItemActionToolbar,
20346
- {
20347
- onEditLink: openLinkPopoverForSelected,
20348
- onStyle: () => {
20349
- const row = selectedElRef.current;
20350
- if (!row) return;
20351
- if (floatingPanel?.kind === "socials-display") closeFloatingPanelOnly();
20352
- else openSocialsDisplayPanel(row);
20353
- },
20354
- showStyle: selectedIsSocialsRow,
20355
- styleActive: floatingPanel?.kind === "socials-display",
20356
- onAddItem: handleAddChildItem,
20357
- onSelectParent: handleSelectParent,
20358
- onDuplicate: handleDuplicateSelected,
20359
- onDelete: handleDeleteSelected,
20360
- addItemDisabled: isFooterFrameSelection && isFooterAddItemDisabled(selectedElRef.current) || selectedElRef.current !== null && (() => {
20361
- const row = isSocialsRow(selectedElRef.current) ? selectedElRef.current : findSocialsRow(selectedElRef.current);
20362
- return row ? !canAddSocialItem(row) : false;
20363
- })(),
20364
- editLinkDisabled: false,
20365
- moreDisabled: false,
20366
- duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
20367
- showEditLink: !isFooterFrameSelection && !selectedIsSocialsRow && navDropdownPreviewOpen === null,
20368
- showAddItem: isFooterFrameSelection || selectedIsSocialsRow || !selectedIsCta && Boolean(
20369
- selectedElRef.current && isNavbarHrefKey(selectedElRef.current.getAttribute("data-ohw-href-key")) && !isNestedNavChild(selectedElRef.current)
20370
- ),
20371
- showMore: (!selectedIsCta || isFooterFrameSelection) && !selectedIsSocialsRow,
20372
- dropdownOpen: navDropdownPreviewOpen,
20373
- onDropdownOpenChange: handleNavDropdownOpenChange,
20374
- headingVisible: footerHeadingVisible,
20375
- onHeadingVisibleChange: handleFooterHeadingVisibleChange
20376
- }
20377
- ) : void 0
20378
- }
20379
- ),
20380
- toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
20381
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20382
- EditGlowChrome,
20864
+ ] }),
20865
+ maxBadge && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20866
+ "div",
20383
20867
  {
20384
- rect: toolbarRect,
20385
- elRef: glowElRef,
20386
- reorderHrefKey,
20387
- dragDisabled: reorderDragDisabled,
20388
- hideHandle: isItemDragging
20868
+ "data-ohw-max-badge": "",
20869
+ style: {
20870
+ position: "fixed",
20871
+ top: maxBadge.rect.bottom + 4,
20872
+ left: maxBadge.rect.right,
20873
+ transform: "translateX(-100%)",
20874
+ zIndex: 2147483647,
20875
+ background: maxBadge.current > maxBadge.max ? "#FEF2F2" : "#F5F5F4",
20876
+ color: maxBadge.current > maxBadge.max ? "#DC2626" : "#78716C",
20877
+ border: `1px solid ${maxBadge.current > maxBadge.max ? "#FECACA" : "#E7E5E4"}`,
20878
+ borderRadius: 4,
20879
+ padding: "2px 6px",
20880
+ fontSize: 11,
20881
+ fontWeight: 500,
20882
+ pointerEvents: "none"
20883
+ },
20884
+ children: [
20885
+ maxBadge.current,
20886
+ "/",
20887
+ maxBadge.max
20888
+ ]
20389
20889
  }
20390
20890
  ),
20391
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20392
- FloatingToolbar,
20891
+ toggleState && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20892
+ StateToggle,
20393
20893
  {
20394
- rect: toolbarRect,
20395
- parentScroll: parentScrollRef.current,
20396
- elRef: toolbarElRef,
20397
- onCommand: handleCommand,
20398
- activeCommands,
20399
- showEditLink,
20400
- onEditLink: openLinkPopoverForActive
20894
+ rect: toggleState.rect,
20895
+ activeState: toggleState.activeState,
20896
+ states: toggleState.states,
20897
+ onStateChange: handleStateChange
20401
20898
  }
20402
- )
20403
- ] }),
20404
- maxBadge && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20405
- "div",
20406
- {
20407
- "data-ohw-max-badge": "",
20408
- style: {
20409
- position: "fixed",
20410
- top: maxBadge.rect.bottom + 4,
20411
- left: maxBadge.rect.right,
20412
- transform: "translateX(-100%)",
20413
- zIndex: 2147483647,
20414
- background: maxBadge.current > maxBadge.max ? "#FEF2F2" : "#F5F5F4",
20415
- color: maxBadge.current > maxBadge.max ? "#DC2626" : "#78716C",
20416
- border: `1px solid ${maxBadge.current > maxBadge.max ? "#FECACA" : "#E7E5E4"}`,
20417
- borderRadius: 4,
20418
- padding: "2px 6px",
20419
- fontSize: 11,
20420
- fontWeight: 500,
20421
- pointerEvents: "none"
20899
+ ),
20900
+ sectionGap && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20901
+ "div",
20902
+ {
20903
+ "data-ohw-section-insert-line": "",
20904
+ className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
20905
+ style: { top: sectionGap.y, transform: "translateY(-50%)" },
20906
+ children: [
20907
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
20908
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20909
+ Badge,
20910
+ {
20911
+ className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
20912
+ onClick: () => {
20913
+ window.parent.postMessage(
20914
+ {
20915
+ type: "ow:add-section",
20916
+ insertAfter: sectionGap.insertAfter,
20917
+ insertBefore: sectionGap.insertBefore
20918
+ },
20919
+ "*"
20920
+ );
20921
+ },
20922
+ children: "Add Section"
20923
+ }
20924
+ ),
20925
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
20926
+ ]
20927
+ }
20928
+ ),
20929
+ linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20930
+ LinkPopover,
20931
+ {
20932
+ panelRef: linkPopoverPanelRef,
20933
+ portalContainer: dialogPortalContainer,
20934
+ open: true,
20935
+ mode: linkPopover.mode ?? "edit",
20936
+ pages: sitePages,
20937
+ sections: currentSections,
20938
+ sectionsByPath,
20939
+ initialTarget: linkPopover.target,
20940
+ existingTargets: linkPopover.intent === "add-nav" ? getNavbarExistingTargets() : [],
20941
+ onClose: closeLinkPopover,
20942
+ onSubmit: handleLinkPopoverSubmit
20422
20943
  },
20423
- children: [
20424
- maxBadge.current,
20425
- "/",
20426
- maxBadge.max
20427
- ]
20428
- }
20429
- ),
20430
- toggleState && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20431
- StateToggle,
20432
- {
20433
- rect: toggleState.rect,
20434
- activeState: toggleState.activeState,
20435
- states: toggleState.states,
20436
- onStateChange: handleStateChange
20437
- }
20438
- ),
20439
- sectionGap && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
20440
- "div",
20441
- {
20442
- "data-ohw-section-insert-line": "",
20443
- className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
20444
- style: { top: sectionGap.y, transform: "translateY(-50%)" },
20445
- children: [
20446
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
20447
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20448
- Badge,
20944
+ linkPopover.key
20945
+ ) : null,
20946
+ floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20947
+ FloatingPanel,
20948
+ {
20949
+ open: true,
20950
+ title: floatingPanel.title,
20951
+ context: floatingPanel.context,
20952
+ position: floatingPanelPos,
20953
+ onPositionChange: setFloatingPanelPos,
20954
+ parentScroll: parentScrollSnap ?? parentScrollRef.current,
20955
+ onClose: closeFloatingPanelOnly,
20956
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20957
+ SocialsDisplayPanel,
20449
20958
  {
20450
- className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
20451
- onClick: () => {
20452
- window.parent.postMessage(
20453
- {
20454
- type: "ow:add-section",
20455
- insertAfter: sectionGap.insertAfter,
20456
- insertBefore: sectionGap.insertBefore
20457
- },
20458
- "*"
20459
- );
20460
- },
20461
- children: "Add Section"
20462
- }
20463
- ),
20464
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
20465
- ]
20466
- }
20467
- ),
20468
- linkPopover && dialogPortalContainer ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20469
- LinkPopover,
20470
- {
20471
- panelRef: linkPopoverPanelRef,
20472
- portalContainer: dialogPortalContainer,
20473
- open: true,
20474
- mode: linkPopover.mode ?? "edit",
20475
- pages: sitePages,
20476
- sections: currentSections,
20477
- sectionsByPath,
20478
- initialTarget: linkPopover.target,
20479
- existingTargets: linkPopover.intent === "add-nav" ? getNavbarExistingTargets() : [],
20480
- onClose: closeLinkPopover,
20481
- onSubmit: handleLinkPopoverSubmit
20482
- },
20483
- linkPopover.key
20484
- ) : null,
20485
- floatingPanel && floatingPanel.kind === "socials-display" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20486
- FloatingPanel,
20487
- {
20488
- open: true,
20489
- title: floatingPanel.title,
20490
- context: floatingPanel.context,
20491
- position: floatingPanelPos,
20492
- onPositionChange: setFloatingPanelPos,
20493
- parentScroll: parentScrollSnap ?? parentScrollRef.current,
20494
- onClose: closeFloatingPanelOnly,
20495
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20496
- SocialsDisplayPanel,
20497
- {
20498
- display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
20499
- onChange: (next) => {
20500
- changeSocialsDisplay(floatingPanel.row, next);
20501
- setFloatingPanel({ ...floatingPanel });
20959
+ display: socialsDisplayFor(floatingPanel.row, editContentRef.current),
20960
+ onChange: (next) => {
20961
+ changeSocialsDisplay(floatingPanel.row, next);
20962
+ setFloatingPanel({ ...floatingPanel });
20963
+ }
20502
20964
  }
20503
- }
20504
- )
20505
- }
20506
- ) : null,
20507
- floatingPanel && floatingPanel.kind === "logo-size" && logoSizeDraft ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20508
- FloatingPanel,
20509
- {
20510
- open: true,
20511
- title: floatingPanel.title,
20512
- context: floatingPanel.context,
20513
- position: floatingPanelPos,
20514
- onPositionChange: setFloatingPanelPos,
20515
- parentScroll: parentScrollSnap ?? parentScrollRef.current,
20516
- onClose: closeFloatingPanelAndDeselect,
20517
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20518
- LogoSizePanel,
20519
- {
20520
- viewport: editorViewport,
20521
- sizePx: editorViewport === "mobile" && !logoSizeDraft.mobileFollowing ? logoSizeDraft.mobilePx : logoSizeDraft.desktopPx,
20522
- mobileFollowing: logoSizeDraft.mobileFollowing,
20523
- onSizeChange: (px) => {
20524
- const next = editorViewport === "mobile" ? { ...logoSizeDraft, mobilePx: px, mobileFollowing: false } : {
20525
- ...logoSizeDraft,
20526
- desktopPx: px,
20527
- mobilePx: logoSizeDraft.mobileFollowing ? px : logoSizeDraft.mobilePx
20528
- };
20529
- setLogoSizeDraft(next);
20530
- persistLogoSizeDraft(floatingPanel.placement, next);
20531
- },
20532
- onCustomizeMobile: () => {
20533
- const next = {
20534
- ...logoSizeDraft,
20535
- mobileFollowing: false,
20536
- mobilePx: logoSizeDraft.desktopPx
20537
- };
20538
- setLogoSizeDraft(next);
20539
- persistLogoSizeDraft(floatingPanel.placement, next);
20540
- },
20541
- onResetMobile: () => {
20542
- const next = {
20543
- ...logoSizeDraft,
20544
- mobileFollowing: true,
20545
- mobilePx: logoSizeDraft.desktopPx
20546
- };
20547
- setLogoSizeDraft(next);
20548
- persistLogoSizeDraft(floatingPanel.placement, next);
20549
- },
20550
- onUpdateEverywhere: () => {
20551
- const identity = readLogoIdentityFromDom();
20552
- postToParent2({ type: "ow:open-logo-settings", ...identity });
20965
+ )
20966
+ }
20967
+ ) : null,
20968
+ floatingPanel && floatingPanel.kind === "logo-size" && logoSizeDraft ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20969
+ FloatingPanel,
20970
+ {
20971
+ open: true,
20972
+ title: floatingPanel.title,
20973
+ context: floatingPanel.context,
20974
+ position: floatingPanelPos,
20975
+ onPositionChange: setFloatingPanelPos,
20976
+ parentScroll: parentScrollSnap ?? parentScrollRef.current,
20977
+ onClose: closeFloatingPanelAndDeselect,
20978
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
20979
+ LogoSizePanel,
20980
+ {
20981
+ viewport: editorViewport,
20982
+ sizePx: editorViewport === "mobile" && !logoSizeDraft.mobileFollowing ? logoSizeDraft.mobilePx : logoSizeDraft.desktopPx,
20983
+ mobileFollowing: logoSizeDraft.mobileFollowing,
20984
+ onSizeChange: (px) => {
20985
+ const next = editorViewport === "mobile" ? { ...logoSizeDraft, mobilePx: px, mobileFollowing: false } : {
20986
+ ...logoSizeDraft,
20987
+ desktopPx: px,
20988
+ mobilePx: logoSizeDraft.mobileFollowing ? px : logoSizeDraft.mobilePx
20989
+ };
20990
+ setLogoSizeDraft(next);
20991
+ persistLogoSizeDraft(floatingPanel.placement, next);
20992
+ },
20993
+ onCustomizeMobile: () => {
20994
+ const next = {
20995
+ ...logoSizeDraft,
20996
+ mobileFollowing: false,
20997
+ mobilePx: logoSizeDraft.desktopPx
20998
+ };
20999
+ setLogoSizeDraft(next);
21000
+ persistLogoSizeDraft(floatingPanel.placement, next);
21001
+ },
21002
+ onResetMobile: () => {
21003
+ const next = {
21004
+ ...logoSizeDraft,
21005
+ mobileFollowing: true,
21006
+ mobilePx: logoSizeDraft.desktopPx
21007
+ };
21008
+ setLogoSizeDraft(next);
21009
+ persistLogoSizeDraft(floatingPanel.placement, next);
21010
+ },
21011
+ onUpdateEverywhere: () => {
21012
+ const identity = readLogoIdentityFromDom();
21013
+ postToParent2({ type: "ow:open-logo-settings", ...identity });
21014
+ }
20553
21015
  }
20554
- }
20555
- )
20556
- }
20557
- ) : null
20558
- ] }),
20559
- bridgeRoot
20560
- ) : null;
21016
+ )
21017
+ }
21018
+ ) : null
21019
+ ] }),
21020
+ bridgeRoot
21021
+ ) : null
21022
+ ] });
20561
21023
  }
20562
21024
 
20563
21025
  // src/ui/EmptySection.tsx