@ohhwells/bridge 0.1.160 → 0.1.161

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
@@ -115,7 +115,7 @@ __export(index_exports, {
115
115
  module.exports = __toCommonJS(index_exports);
116
116
 
117
117
  // src/OhhwellsBridge.tsx
118
- var import_react21 = __toESM(require("react"), 1);
118
+ var import_react23 = __toESM(require("react"), 1);
119
119
  var import_client3 = require("react-dom/client");
120
120
  var import_react_dom5 = require("react-dom");
121
121
 
@@ -12107,11 +12107,139 @@ function useSavedLinkNavigation(isEditMode) {
12107
12107
  }, [isEditMode, router]);
12108
12108
  }
12109
12109
 
12110
- // src/ui/SchedulingWidget.tsx
12110
+ // src/useNavDropdownToggle.ts
12111
+ var import_react5 = require("react");
12112
+ var import_navigation2 = require("next/navigation");
12113
+ var OPEN_ATTR = "data-ohw-nav-force-open";
12114
+ function parentLinkWithDropdown(target) {
12115
+ const anchor = target?.closest?.("a");
12116
+ const group = anchor?.parentElement;
12117
+ if (!anchor || !group?.matches("[data-ohw-nav-group]:not([data-ohw-nav-dropdown-template])")) {
12118
+ return null;
12119
+ }
12120
+ const hasChildren = group.querySelector(":scope > [data-ohw-nav-children] > [data-ohw-href-key]");
12121
+ return hasChildren ? anchor : null;
12122
+ }
12123
+ function closeAll(except) {
12124
+ document.querySelectorAll(`[${OPEN_ATTR}]`).forEach((group) => {
12125
+ if (group === except) return;
12126
+ group.removeAttribute(OPEN_ATTR);
12127
+ group.querySelector(":scope > a")?.setAttribute("aria-expanded", "false");
12128
+ });
12129
+ }
12130
+ function useNavDropdownToggle(isEditMode) {
12131
+ const pathname = (0, import_navigation2.usePathname)();
12132
+ (0, import_react5.useEffect)(() => {
12133
+ if (isEditMode) return;
12134
+ const onClick = (e) => {
12135
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12136
+ const anchor = parentLinkWithDropdown(e.target);
12137
+ if (!anchor) {
12138
+ const insideOpen = e.target?.closest?.(`[${OPEN_ATTR}]`);
12139
+ const onChildLink = e.target?.closest?.("[data-ohw-nav-children] a");
12140
+ if (!insideOpen || onChildLink) closeAll();
12141
+ return;
12142
+ }
12143
+ e.preventDefault();
12144
+ e.stopPropagation();
12145
+ const group = anchor.parentElement;
12146
+ const open = !group.hasAttribute(OPEN_ATTR);
12147
+ closeAll(group);
12148
+ group.toggleAttribute(OPEN_ATTR, open);
12149
+ anchor.setAttribute("aria-expanded", String(open));
12150
+ };
12151
+ const onKeyDown = (e) => {
12152
+ if (e.key !== "Escape") return;
12153
+ const open = document.querySelector(`[${OPEN_ATTR}] > a`);
12154
+ closeAll();
12155
+ open?.focus();
12156
+ };
12157
+ window.addEventListener("click", onClick, true);
12158
+ window.addEventListener("keydown", onKeyDown);
12159
+ return () => {
12160
+ window.removeEventListener("click", onClick, true);
12161
+ window.removeEventListener("keydown", onKeyDown);
12162
+ };
12163
+ }, [isEditMode]);
12164
+ (0, import_react5.useEffect)(() => {
12165
+ if (!isEditMode) closeAll();
12166
+ }, [pathname, isEditMode]);
12167
+ }
12168
+
12169
+ // src/useHashLinkScroll.ts
12111
12170
  var import_react6 = require("react");
12112
12171
 
12172
+ // src/lib/scroll-to-section.ts
12173
+ var MAX_ATTEMPTS = 12;
12174
+ var RETRY_MS = 100;
12175
+ function getHashSectionId() {
12176
+ if (typeof window === "undefined") return null;
12177
+ const id = window.location.hash.replace(/^#/, "").trim();
12178
+ return id || null;
12179
+ }
12180
+ function scrollToOhwSection(sectionId, behavior = "smooth") {
12181
+ if (!sectionId || typeof document === "undefined") return false;
12182
+ const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
12183
+ if (!el) return false;
12184
+ el.scrollIntoView({ behavior, block: "start" });
12185
+ return true;
12186
+ }
12187
+ function scrollToHashSectionWhenReady(behavior = "smooth") {
12188
+ const id = getHashSectionId();
12189
+ if (!id) return;
12190
+ let attempt = 0;
12191
+ const tick = () => {
12192
+ if (scrollToOhwSection(id, behavior)) return;
12193
+ attempt += 1;
12194
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12195
+ };
12196
+ tick();
12197
+ }
12198
+ function scrollToOhwSectionAfterNavigation(sectionId, behavior = "smooth") {
12199
+ let attempt = 0;
12200
+ const tick = () => {
12201
+ if (getHashSectionId() === sectionId && scrollToOhwSection(sectionId, behavior)) return;
12202
+ attempt += 1;
12203
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12204
+ };
12205
+ window.setTimeout(tick, 0);
12206
+ }
12207
+
12208
+ // src/useHashLinkScroll.ts
12209
+ function samePageSectionId(anchor) {
12210
+ const href = anchor.getAttribute("href");
12211
+ if (!href || !href.includes("#")) return null;
12212
+ if (anchor.target !== "" && anchor.target !== "_self") return null;
12213
+ let url;
12214
+ try {
12215
+ url = new URL(href, window.location.href);
12216
+ } catch {
12217
+ return null;
12218
+ }
12219
+ if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) return null;
12220
+ const id = decodeURIComponent(url.hash.replace(/^#/, "")).trim();
12221
+ return id || null;
12222
+ }
12223
+ function useHashLinkScroll(isEditMode) {
12224
+ (0, import_react6.useEffect)(() => {
12225
+ if (isEditMode) return;
12226
+ const onClick = (e) => {
12227
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12228
+ const anchor = e.target?.closest?.("a");
12229
+ if (!anchor) return;
12230
+ const id = samePageSectionId(anchor);
12231
+ if (id) scrollToOhwSectionAfterNavigation(id);
12232
+ };
12233
+ window.addEventListener("click", onClick, true);
12234
+ return () => window.removeEventListener("click", onClick, true);
12235
+ }, [isEditMode]);
12236
+ }
12237
+
12238
+ // src/ui/SchedulingWidget.tsx
12239
+ var import_react8 = require("react");
12240
+
12113
12241
  // src/ui/EmailCaptureModal.tsx
12114
- var import_react5 = require("react");
12242
+ var import_react7 = require("react");
12115
12243
  var import_radix_ui = require("radix-ui");
12116
12244
  var import_jsx_runtime4 = require("react/jsx-runtime");
12117
12245
  var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
@@ -12141,11 +12269,11 @@ function Spinner() {
12141
12269
  );
12142
12270
  }
12143
12271
  function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
12144
- const [email, setEmail] = (0, import_react5.useState)("");
12145
- const [submittedEmail, setSubmittedEmail] = (0, import_react5.useState)("");
12146
- const [loading, setLoading] = (0, import_react5.useState)(false);
12147
- const [success, setSuccess] = (0, import_react5.useState)(false);
12148
- const [error, setError] = (0, import_react5.useState)(null);
12272
+ const [email, setEmail] = (0, import_react7.useState)("");
12273
+ const [submittedEmail, setSubmittedEmail] = (0, import_react7.useState)("");
12274
+ const [loading, setLoading] = (0, import_react7.useState)(false);
12275
+ const [success, setSuccess] = (0, import_react7.useState)(false);
12276
+ const [error, setError] = (0, import_react7.useState)(null);
12149
12277
  const isBook = title === "Confirm your spot";
12150
12278
  const handleSubmit = async () => {
12151
12279
  const trimmed = email.trim();
@@ -12412,21 +12540,21 @@ function LoadingSkeleton() {
12412
12540
  ] });
12413
12541
  }
12414
12542
  function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
12415
- const todayMs = (0, import_react6.useMemo)(() => {
12543
+ const todayMs = (0, import_react8.useMemo)(() => {
12416
12544
  const d = /* @__PURE__ */ new Date();
12417
12545
  d.setHours(0, 0, 0, 0);
12418
12546
  return d.getTime();
12419
12547
  }, []);
12420
- const scrollRef = (0, import_react6.useRef)(null);
12421
- const [canScrollLeft, setCanScrollLeft] = (0, import_react6.useState)(false);
12422
- const [canScrollRight, setCanScrollRight] = (0, import_react6.useState)(false);
12548
+ const scrollRef = (0, import_react8.useRef)(null);
12549
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react8.useState)(false);
12550
+ const [canScrollRight, setCanScrollRight] = (0, import_react8.useState)(false);
12423
12551
  const updateScrollState = () => {
12424
12552
  const el = scrollRef.current;
12425
12553
  if (!el) return;
12426
12554
  setCanScrollLeft(el.scrollLeft > 0);
12427
12555
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
12428
12556
  };
12429
- (0, import_react6.useEffect)(() => {
12557
+ (0, import_react8.useEffect)(() => {
12430
12558
  const el = scrollRef.current;
12431
12559
  if (!el) return;
12432
12560
  updateScrollState();
@@ -12441,9 +12569,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12441
12569
  const scroll = (dir) => {
12442
12570
  scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
12443
12571
  };
12444
- const isDragging = (0, import_react6.useRef)(false);
12445
- const dragStartX = (0, import_react6.useRef)(0);
12446
- const dragStartScrollLeft = (0, import_react6.useRef)(0);
12572
+ const isDragging = (0, import_react8.useRef)(false);
12573
+ const dragStartX = (0, import_react8.useRef)(0);
12574
+ const dragStartScrollLeft = (0, import_react8.useRef)(0);
12447
12575
  const onDragStart = (e) => {
12448
12576
  if (!scrollRef.current) return;
12449
12577
  isDragging.current = true;
@@ -12463,14 +12591,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12463
12591
  scrollRef.current.style.cursor = "grab";
12464
12592
  scrollRef.current.style.userSelect = "";
12465
12593
  };
12466
- const datesWithClasses = (0, import_react6.useMemo)(
12594
+ const datesWithClasses = (0, import_react8.useMemo)(
12467
12595
  () => new Set(dates.map(
12468
12596
  (d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
12469
12597
  ).filter((i) => i >= 0)),
12470
12598
  [dates, schedule]
12471
12599
  );
12472
12600
  const selectedDate = dates[selectedIdx];
12473
- const selectedClasses = (0, import_react6.useMemo)(
12601
+ const selectedClasses = (0, import_react8.useMemo)(
12474
12602
  () => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
12475
12603
  [schedule, selectedDate]
12476
12604
  );
@@ -12655,16 +12783,16 @@ function CalendarFoldIcon() {
12655
12783
  );
12656
12784
  }
12657
12785
  function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
12658
- const autoId = (0, import_react6.useId)();
12786
+ const autoId = (0, import_react8.useId)();
12659
12787
  const insertAfter = insertAfterProp ?? autoId;
12660
- const [schedule, setSchedule] = (0, import_react6.useState)(null);
12661
- const [loading, setLoading] = (0, import_react6.useState)(initialScheduleId !== null);
12662
- const [inEditor, setInEditor] = (0, import_react6.useState)(false);
12663
- const [isHovered, setIsHovered] = (0, import_react6.useState)(false);
12664
- const [modalState, setModalState] = (0, import_react6.useState)(null);
12665
- const switchScheduleIdRef = (0, import_react6.useRef)(null);
12666
- const liveScheduleIdRef = (0, import_react6.useRef)(null);
12667
- const refetchLiveSchedule = (0, import_react6.useCallback)(async () => {
12788
+ const [schedule, setSchedule] = (0, import_react8.useState)(null);
12789
+ const [loading, setLoading] = (0, import_react8.useState)(initialScheduleId !== null);
12790
+ const [inEditor, setInEditor] = (0, import_react8.useState)(false);
12791
+ const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
12792
+ const [modalState, setModalState] = (0, import_react8.useState)(null);
12793
+ const switchScheduleIdRef = (0, import_react8.useRef)(null);
12794
+ const liveScheduleIdRef = (0, import_react8.useRef)(null);
12795
+ const refetchLiveSchedule = (0, import_react8.useCallback)(async () => {
12668
12796
  const id = liveScheduleIdRef.current;
12669
12797
  if (!id) return;
12670
12798
  try {
@@ -12674,7 +12802,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12674
12802
  } catch {
12675
12803
  }
12676
12804
  }, []);
12677
- const dates = (0, import_react6.useMemo)(() => {
12805
+ const dates = (0, import_react8.useMemo)(() => {
12678
12806
  const today = /* @__PURE__ */ new Date();
12679
12807
  today.setHours(0, 0, 0, 0);
12680
12808
  return Array.from({ length: 14 }, (_, i) => {
@@ -12683,8 +12811,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12683
12811
  return d;
12684
12812
  });
12685
12813
  }, []);
12686
- const [selectedIdx, setSelectedIdx] = (0, import_react6.useState)(0);
12687
- (0, import_react6.useEffect)(() => {
12814
+ const [selectedIdx, setSelectedIdx] = (0, import_react8.useState)(0);
12815
+ (0, import_react8.useEffect)(() => {
12688
12816
  if (!schedule?.classes) return;
12689
12817
  for (let i = 0; i < dates.length; i++) {
12690
12818
  if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
@@ -12693,7 +12821,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12693
12821
  }
12694
12822
  }
12695
12823
  }, [schedule, dates]);
12696
- (0, import_react6.useEffect)(() => {
12824
+ (0, import_react8.useEffect)(() => {
12697
12825
  if (typeof window === "undefined") return;
12698
12826
  const onVisible = () => {
12699
12827
  if (!document.hidden) void refetchLiveSchedule();
@@ -12705,7 +12833,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12705
12833
  document.removeEventListener("visibilitychange", onVisible);
12706
12834
  };
12707
12835
  }, [refetchLiveSchedule]);
12708
- (0, import_react6.useEffect)(() => {
12836
+ (0, import_react8.useEffect)(() => {
12709
12837
  if (typeof window === "undefined") return;
12710
12838
  const isInEditor = window.self !== window.top;
12711
12839
  setInEditor(isInEditor);
@@ -16460,7 +16588,7 @@ var CustomToolbarButton = React5.forwardRef(
16460
16588
  CustomToolbarButton.displayName = "CustomToolbarButton";
16461
16589
 
16462
16590
  // src/ui/item-action-toolbar.tsx
16463
- var import_react7 = require("react");
16591
+ var import_react9 = require("react");
16464
16592
  var import_lucide_react3 = require("lucide-react");
16465
16593
 
16466
16594
  // src/ui/dropdown-menu.tsx
@@ -16645,7 +16773,7 @@ function ItemActionToolbar({
16645
16773
  headingVisible = null,
16646
16774
  onHeadingVisibleChange
16647
16775
  }) {
16648
- const [moreOpen, setMoreOpen] = (0, import_react7.useState)(false);
16776
+ const [moreOpen, setMoreOpen] = (0, import_react9.useState)(false);
16649
16777
  const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
16650
16778
  const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
16651
16779
  const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
@@ -16853,7 +16981,7 @@ function ItemActionToolbar({
16853
16981
  }
16854
16982
 
16855
16983
  // src/ui/item-interaction-layer.tsx
16856
- var import_react8 = require("react");
16984
+ var import_react10 = require("react");
16857
16985
  var import_react_dom3 = require("react-dom");
16858
16986
  var import_jsx_runtime14 = require("react/jsx-runtime");
16859
16987
  var PRIMARY = "var(--ohw-primary, #0885FE)";
@@ -16910,8 +17038,8 @@ function ClampedToolbarSlot({
16910
17038
  align = "center",
16911
17039
  children
16912
17040
  }) {
16913
- const slotRef = (0, import_react8.useRef)(null);
16914
- (0, import_react8.useLayoutEffect)(() => {
17041
+ const slotRef = (0, import_react10.useRef)(null);
17042
+ (0, import_react10.useLayoutEffect)(() => {
16915
17043
  const slot = slotRef.current;
16916
17044
  if (!slot) return;
16917
17045
  const clamp = () => {
@@ -16974,15 +17102,15 @@ function DetachedBelowToolbarSlot({
16974
17102
  belowEl,
16975
17103
  children
16976
17104
  }) {
16977
- const slotRef = (0, import_react8.useRef)(null);
16978
- const [anchorBottom, setAnchorBottom] = (0, import_react8.useState)(belowRect.bottom);
16979
- const [portalTarget] = (0, import_react8.useState)(
17105
+ const slotRef = (0, import_react10.useRef)(null);
17106
+ const [anchorBottom, setAnchorBottom] = (0, import_react10.useState)(belowRect.bottom);
17107
+ const [portalTarget] = (0, import_react10.useState)(
16980
17108
  () => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
16981
17109
  );
16982
- (0, import_react8.useLayoutEffect)(() => {
17110
+ (0, import_react10.useLayoutEffect)(() => {
16983
17111
  setAnchorBottom(belowRect.bottom);
16984
17112
  }, [belowRect.bottom, belowRect.height, belowRect.top]);
16985
- (0, import_react8.useLayoutEffect)(() => {
17113
+ (0, import_react10.useLayoutEffect)(() => {
16986
17114
  const slot = slotRef.current;
16987
17115
  if (!slot) return;
16988
17116
  const sync = () => {
@@ -17063,8 +17191,8 @@ function ItemInteractionLayer({
17063
17191
  hidden = false,
17064
17192
  className
17065
17193
  }) {
17066
- const localRef = (0, import_react8.useRef)(null);
17067
- (0, import_react8.useLayoutEffect)(() => {
17194
+ const localRef = (0, import_react10.useRef)(null);
17195
+ (0, import_react10.useLayoutEffect)(() => {
17068
17196
  const node = localRef.current;
17069
17197
  if (!node) return;
17070
17198
  node.style.display = hidden ? "none" : "block";
@@ -17339,7 +17467,7 @@ function apiBase() {
17339
17467
  function bridgeVersion() {
17340
17468
  try {
17341
17469
  if (true) {
17342
- return "0.1.160";
17470
+ return "0.1.161";
17343
17471
  }
17344
17472
  } catch {
17345
17473
  }
@@ -17353,7 +17481,7 @@ function stampBridgeVersionOnDocument() {
17353
17481
  return;
17354
17482
  }
17355
17483
  try {
17356
- const v = true ? "0.1.160" : "";
17484
+ const v = true ? "0.1.161" : "";
17357
17485
  if (v) {
17358
17486
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17359
17487
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18260,7 +18388,7 @@ function CarouselOverlay({
18260
18388
  }
18261
18389
 
18262
18390
  // src/ui/ai-section/AiSectionOverlay.tsx
18263
- var import_react9 = require("react");
18391
+ var import_react11 = require("react");
18264
18392
  var import_lucide_react7 = require("lucide-react");
18265
18393
 
18266
18394
  // src/lib/ai-change-highlight.ts
@@ -18355,8 +18483,8 @@ function readRect(instanceId) {
18355
18483
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18356
18484
  }
18357
18485
  function useLiveSectionRect(sectionId) {
18358
- const [rect, setRect] = (0, import_react9.useState)(null);
18359
- (0, import_react9.useEffect)(() => {
18486
+ const [rect, setRect] = (0, import_react11.useState)(null);
18487
+ (0, import_react11.useEffect)(() => {
18360
18488
  if (!sectionId) {
18361
18489
  setRect(null);
18362
18490
  return;
@@ -18395,8 +18523,8 @@ function readNavToggleRect() {
18395
18523
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18396
18524
  }
18397
18525
  function useLiveNavToggleHole(active) {
18398
- const [rect, setRect] = (0, import_react9.useState)(null);
18399
- (0, import_react9.useEffect)(() => {
18526
+ const [rect, setRect] = (0, import_react11.useState)(null);
18527
+ (0, import_react11.useEffect)(() => {
18400
18528
  if (!active) {
18401
18529
  setRect(null);
18402
18530
  return;
@@ -18458,7 +18586,7 @@ function ReviewButton({
18458
18586
  background,
18459
18587
  color
18460
18588
  }) {
18461
- const [hover, setHover] = (0, import_react9.useState)(false);
18589
+ const [hover, setHover] = (0, import_react11.useState)(false);
18462
18590
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
18463
18591
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
18464
18592
  "button",
@@ -18513,17 +18641,17 @@ function AiSectionOverlay({
18513
18641
  apiRef,
18514
18642
  onSelectionChange
18515
18643
  }) {
18516
- const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
18517
- const [reviewId, setReviewId] = (0, import_react9.useState)(null);
18518
- const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react9.useState)(false);
18519
- const reviewIdRef = (0, import_react9.useRef)(null);
18644
+ const [selectedId, setSelectedId] = (0, import_react11.useState)(null);
18645
+ const [reviewId, setReviewId] = (0, import_react11.useState)(null);
18646
+ const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react11.useState)(false);
18647
+ const reviewIdRef = (0, import_react11.useRef)(null);
18520
18648
  reviewIdRef.current = reviewId;
18521
- const selectedIdRef = (0, import_react9.useRef)(null);
18649
+ const selectedIdRef = (0, import_react11.useRef)(null);
18522
18650
  selectedIdRef.current = selectedId;
18523
- (0, import_react9.useEffect)(() => {
18651
+ (0, import_react11.useEffect)(() => {
18524
18652
  onSelectionChange?.(selectedId);
18525
18653
  }, [selectedId, onSelectionChange]);
18526
- const report = (0, import_react9.useCallback)(
18654
+ const report = (0, import_react11.useCallback)(
18527
18655
  (el) => {
18528
18656
  const labelSrc = el ? sectionElementOf(el) : null;
18529
18657
  postToParent2({
@@ -18534,7 +18662,7 @@ function AiSectionOverlay({
18534
18662
  },
18535
18663
  [postToParent2]
18536
18664
  );
18537
- const selectFromElement = (0, import_react9.useCallback)(
18665
+ const selectFromElement = (0, import_react11.useCallback)(
18538
18666
  (el, options) => {
18539
18667
  const inner = el?.closest("[data-ohw-section]") ?? null;
18540
18668
  const sectionEl = inner ? movableUnit(inner) : null;
@@ -18546,7 +18674,7 @@ function AiSectionOverlay({
18546
18674
  },
18547
18675
  [report]
18548
18676
  );
18549
- (0, import_react9.useEffect)(() => {
18677
+ (0, import_react11.useEffect)(() => {
18550
18678
  apiRef.current = {
18551
18679
  selectFromElement,
18552
18680
  handleBackgroundClick: (target, clientX, clientY) => {
@@ -18571,7 +18699,7 @@ function AiSectionOverlay({
18571
18699
  apiRef.current = null;
18572
18700
  };
18573
18701
  }, [apiRef, selectFromElement, report]);
18574
- (0, import_react9.useEffect)(() => {
18702
+ (0, import_react11.useEffect)(() => {
18575
18703
  const onMessage = (e) => {
18576
18704
  if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
18577
18705
  selectedIdRef.current = null;
@@ -18596,9 +18724,9 @@ function AiSectionOverlay({
18596
18724
  window.addEventListener("message", onMessage);
18597
18725
  return () => window.removeEventListener("message", onMessage);
18598
18726
  }, [postToParent2]);
18599
- (0, import_react9.useEffect)(() => installAiChangeHighlight(), []);
18600
- const [hoveredId, setHoveredId] = (0, import_react9.useState)(null);
18601
- (0, import_react9.useEffect)(() => {
18727
+ (0, import_react11.useEffect)(() => installAiChangeHighlight(), []);
18728
+ const [hoveredId, setHoveredId] = (0, import_react11.useState)(null);
18729
+ (0, import_react11.useEffect)(() => {
18602
18730
  const onMove = (e) => {
18603
18731
  const t = e.target;
18604
18732
  if (!(t instanceof Element)) return;
@@ -18623,7 +18751,7 @@ function AiSectionOverlay({
18623
18751
  document.documentElement.removeEventListener("mouseleave", onLeave);
18624
18752
  };
18625
18753
  }, []);
18626
- (0, import_react9.useEffect)(() => {
18754
+ (0, import_react11.useEffect)(() => {
18627
18755
  const onKeyDown = (e) => {
18628
18756
  if (e.key !== "Escape") return;
18629
18757
  if (reviewIdRef.current) return;
@@ -18637,7 +18765,7 @@ function AiSectionOverlay({
18637
18765
  document.addEventListener("keydown", onKeyDown);
18638
18766
  return () => document.removeEventListener("keydown", onKeyDown);
18639
18767
  }, [report]);
18640
- const decide = (0, import_react9.useCallback)(
18768
+ const decide = (0, import_react11.useCallback)(
18641
18769
  (decision) => {
18642
18770
  const sectionId = reviewIdRef.current;
18643
18771
  if (!sectionId) return;
@@ -18646,8 +18774,8 @@ function AiSectionOverlay({
18646
18774
  },
18647
18775
  [postToParent2]
18648
18776
  );
18649
- const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react9.useState)(false);
18650
- (0, import_react9.useEffect)(() => {
18777
+ const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react11.useState)(false);
18778
+ (0, import_react11.useEffect)(() => {
18651
18779
  const update = () => {
18652
18780
  setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
18653
18781
  };
@@ -18666,7 +18794,7 @@ function AiSectionOverlay({
18666
18794
  const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
18667
18795
  const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
18668
18796
  const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
18669
- (0, import_react9.useEffect)(() => {
18797
+ (0, import_react11.useEffect)(() => {
18670
18798
  const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
18671
18799
  if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
18672
18800
  postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
@@ -18786,7 +18914,7 @@ function AiSectionOverlay({
18786
18914
  }
18787
18915
 
18788
18916
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18789
- var import_react10 = require("react");
18917
+ var import_react12 = require("react");
18790
18918
  var import_lucide_react8 = require("lucide-react");
18791
18919
 
18792
18920
  // src/lib/ai-media-strip-tree.ts
@@ -18948,8 +19076,8 @@ function readRect2(ref) {
18948
19076
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18949
19077
  }
18950
19078
  function useLiveItemRect(ref) {
18951
- const [rect, setRect] = (0, import_react10.useState)(null);
18952
- (0, import_react10.useEffect)(() => {
19079
+ const [rect, setRect] = (0, import_react12.useState)(null);
19080
+ (0, import_react12.useEffect)(() => {
18953
19081
  if (!ref) {
18954
19082
  setRect(null);
18955
19083
  return;
@@ -19044,8 +19172,8 @@ function Pill({
19044
19172
  );
19045
19173
  }
19046
19174
  function AltInput({ value, onCommit }) {
19047
- const [draft, setDraft] = (0, import_react10.useState)(value);
19048
- (0, import_react10.useEffect)(() => setDraft(value), [value]);
19175
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19176
+ (0, import_react12.useEffect)(() => setDraft(value), [value]);
19049
19177
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19050
19178
  "div",
19051
19179
  {
@@ -19132,9 +19260,9 @@ var TREATMENTS = [
19132
19260
  ];
19133
19261
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19134
19262
  function LinkInput({ value, onCommit }) {
19135
- const [draft, setDraft] = (0, import_react10.useState)(value);
19136
- const [invalid, setInvalid] = (0, import_react10.useState)(false);
19137
- (0, import_react10.useEffect)(() => {
19263
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19264
+ const [invalid, setInvalid] = (0, import_react12.useState)(false);
19265
+ (0, import_react12.useEffect)(() => {
19138
19266
  setDraft(value);
19139
19267
  setInvalid(false);
19140
19268
  }, [value]);
@@ -19323,13 +19451,13 @@ function AiMediaStripOverlay({
19323
19451
  applyTreeLocalRef,
19324
19452
  clearInteractionChromeRef
19325
19453
  }) {
19326
- const [hover, setHover] = (0, import_react10.useState)(null);
19327
- const [active, setActive] = (0, import_react10.useState)(null);
19328
- const [pending, setPending] = (0, import_react10.useState)(false);
19329
- const [error, setError] = (0, import_react10.useState)(null);
19330
- const activeRef = (0, import_react10.useRef)(null);
19454
+ const [hover, setHover] = (0, import_react12.useState)(null);
19455
+ const [active, setActive] = (0, import_react12.useState)(null);
19456
+ const [pending, setPending] = (0, import_react12.useState)(false);
19457
+ const [error, setError] = (0, import_react12.useState)(null);
19458
+ const activeRef = (0, import_react12.useRef)(null);
19331
19459
  activeRef.current = active;
19332
- (0, import_react10.useEffect)(() => {
19460
+ (0, import_react12.useEffect)(() => {
19333
19461
  const onMove = (e) => {
19334
19462
  const t = e.target;
19335
19463
  if (!(t instanceof HTMLElement)) return;
@@ -19359,7 +19487,7 @@ function AiMediaStripOverlay({
19359
19487
  document.documentElement.removeEventListener("mouseleave", onLeave);
19360
19488
  };
19361
19489
  }, []);
19362
- (0, import_react10.useEffect)(() => {
19490
+ (0, import_react12.useEffect)(() => {
19363
19491
  const onClick = (e) => {
19364
19492
  const current = activeRef.current;
19365
19493
  if (!current) return;
@@ -19374,7 +19502,7 @@ function AiMediaStripOverlay({
19374
19502
  document.addEventListener("click", onClick, true);
19375
19503
  return () => document.removeEventListener("click", onClick, true);
19376
19504
  }, []);
19377
- (0, import_react10.useEffect)(() => {
19505
+ (0, import_react12.useEffect)(() => {
19378
19506
  const onBlur = () => {
19379
19507
  if (!activeRef.current) return;
19380
19508
  setActive(null);
@@ -19383,7 +19511,7 @@ function AiMediaStripOverlay({
19383
19511
  window.addEventListener("blur", onBlur);
19384
19512
  return () => window.removeEventListener("blur", onBlur);
19385
19513
  }, []);
19386
- (0, import_react10.useEffect)(() => {
19514
+ (0, import_react12.useEffect)(() => {
19387
19515
  const onKeyDown = (e) => {
19388
19516
  if (e.key !== "Escape") return;
19389
19517
  if (!activeRef.current) return;
@@ -19393,14 +19521,14 @@ function AiMediaStripOverlay({
19393
19521
  document.addEventListener("keydown", onKeyDown);
19394
19522
  return () => document.removeEventListener("keydown", onKeyDown);
19395
19523
  }, []);
19396
- const findEntry = (0, import_react10.useCallback)(
19524
+ const findEntry = (0, import_react12.useCallback)(
19397
19525
  (sectionId) => {
19398
19526
  const state = parseAiSectionsState(aiSectionsRef.current);
19399
19527
  return state.sections.find((s) => s.id === sectionId) ?? null;
19400
19528
  },
19401
19529
  [aiSectionsRef]
19402
19530
  );
19403
- const runMutation = (0, import_react10.useCallback)(
19531
+ const runMutation = (0, import_react12.useCallback)(
19404
19532
  async (sectionId, mutate, extraMedia) => {
19405
19533
  const entry = findEntry(sectionId);
19406
19534
  if (!entry) return false;
@@ -19547,7 +19675,7 @@ function AiMediaStripOverlay({
19547
19675
  }
19548
19676
 
19549
19677
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19550
- var import_react11 = require("react");
19678
+ var import_react13 = require("react");
19551
19679
  var import_lucide_react9 = require("lucide-react");
19552
19680
  var import_jsx_runtime21 = require("react/jsx-runtime");
19553
19681
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
@@ -19590,8 +19718,8 @@ function readGridRect(ref) {
19590
19718
  return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
19591
19719
  }
19592
19720
  function useLiveCardRect(ref, grid = false) {
19593
- const [rect, setRect] = (0, import_react11.useState)(null);
19594
- (0, import_react11.useEffect)(() => {
19721
+ const [rect, setRect] = (0, import_react13.useState)(null);
19722
+ (0, import_react13.useEffect)(() => {
19595
19723
  if (!ref) {
19596
19724
  setRect(null);
19597
19725
  return;
@@ -19619,10 +19747,10 @@ var TOOLBAR_GRID_GAP = 52;
19619
19747
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19620
19748
  var TOOLBAR_EDGE_MARGIN2 = 4;
19621
19749
  function GridToolbarSlot({ gridRect, children }) {
19622
- const slotRef = (0, import_react11.useRef)(null);
19623
- const [shift, setShift] = (0, import_react11.useState)(0);
19750
+ const slotRef = (0, import_react13.useRef)(null);
19751
+ const [shift, setShift] = (0, import_react13.useState)(0);
19624
19752
  const centerX = gridRect.left + gridRect.width / 2;
19625
- (0, import_react11.useLayoutEffect)(() => {
19753
+ (0, import_react13.useLayoutEffect)(() => {
19626
19754
  const slot = slotRef.current;
19627
19755
  if (!slot) return;
19628
19756
  const clamp = () => {
@@ -19879,13 +20007,13 @@ function AiPricingCardOverlay({
19879
20007
  aiSectionsRef,
19880
20008
  applyTreeLocalRef
19881
20009
  }) {
19882
- const [hover, setHover] = (0, import_react11.useState)(null);
19883
- const [active, setActive] = (0, import_react11.useState)(null);
19884
- const [pending, setPending] = (0, import_react11.useState)(false);
19885
- const [error, setError] = (0, import_react11.useState)(null);
19886
- const activeRef = (0, import_react11.useRef)(null);
20010
+ const [hover, setHover] = (0, import_react13.useState)(null);
20011
+ const [active, setActive] = (0, import_react13.useState)(null);
20012
+ const [pending, setPending] = (0, import_react13.useState)(false);
20013
+ const [error, setError] = (0, import_react13.useState)(null);
20014
+ const activeRef = (0, import_react13.useRef)(null);
19887
20015
  activeRef.current = active;
19888
- (0, import_react11.useEffect)(() => {
20016
+ (0, import_react13.useEffect)(() => {
19889
20017
  const onMove = (e) => {
19890
20018
  const ref = cardRefFromTarget(e.target);
19891
20019
  const t = e.target;
@@ -19903,7 +20031,7 @@ function AiPricingCardOverlay({
19903
20031
  document.documentElement.removeEventListener("mouseleave", onLeave);
19904
20032
  };
19905
20033
  }, []);
19906
- (0, import_react11.useEffect)(() => {
20034
+ (0, import_react13.useEffect)(() => {
19907
20035
  const onClick = (e) => {
19908
20036
  const t = e.target;
19909
20037
  if (!(t instanceof Element)) return;
@@ -19915,7 +20043,7 @@ function AiPricingCardOverlay({
19915
20043
  document.addEventListener("click", onClick, true);
19916
20044
  return () => document.removeEventListener("click", onClick, true);
19917
20045
  }, []);
19918
- (0, import_react11.useEffect)(() => {
20046
+ (0, import_react13.useEffect)(() => {
19919
20047
  const onBlur = () => {
19920
20048
  if (!activeRef.current) return;
19921
20049
  setActive(null);
@@ -19924,7 +20052,7 @@ function AiPricingCardOverlay({
19924
20052
  window.addEventListener("blur", onBlur);
19925
20053
  return () => window.removeEventListener("blur", onBlur);
19926
20054
  }, []);
19927
- (0, import_react11.useEffect)(() => {
20055
+ (0, import_react13.useEffect)(() => {
19928
20056
  const onKeyDown = (e) => {
19929
20057
  if (e.key !== "Escape") return;
19930
20058
  if (!activeRef.current) return;
@@ -19935,14 +20063,14 @@ function AiPricingCardOverlay({
19935
20063
  document.addEventListener("keydown", onKeyDown);
19936
20064
  return () => document.removeEventListener("keydown", onKeyDown);
19937
20065
  }, []);
19938
- const findEntry = (0, import_react11.useCallback)(
20066
+ const findEntry = (0, import_react13.useCallback)(
19939
20067
  (sectionId) => {
19940
20068
  const state = parseAiSectionsState(aiSectionsRef.current);
19941
20069
  return state.sections.find((s) => s.id === sectionId) ?? null;
19942
20070
  },
19943
20071
  [aiSectionsRef]
19944
20072
  );
19945
- const runMutation = (0, import_react11.useCallback)(
20073
+ const runMutation = (0, import_react13.useCallback)(
19946
20074
  async (sectionId, mutate) => {
19947
20075
  const entry = findEntry(sectionId);
19948
20076
  if (!entry) return false;
@@ -20029,7 +20157,7 @@ function AiPricingCardOverlay({
20029
20157
  }
20030
20158
 
20031
20159
  // src/ui/ai-section/AiVideoOverlay.tsx
20032
- var import_react12 = require("react");
20160
+ var import_react14 = require("react");
20033
20161
  var import_lucide_react10 = require("lucide-react");
20034
20162
 
20035
20163
  // src/lib/ai-video-tree.ts
@@ -20122,8 +20250,8 @@ function readRect4(ref) {
20122
20250
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20123
20251
  }
20124
20252
  function useLiveBlockRect(ref) {
20125
- const [rect, setRect] = (0, import_react12.useState)(null);
20126
- (0, import_react12.useEffect)(() => {
20253
+ const [rect, setRect] = (0, import_react14.useState)(null);
20254
+ (0, import_react14.useEffect)(() => {
20127
20255
  if (!ref) {
20128
20256
  setRect(null);
20129
20257
  return;
@@ -20201,9 +20329,9 @@ function watchUrl(id) {
20201
20329
  return `https://www.youtube.com/watch?v=${id}`;
20202
20330
  }
20203
20331
  function VideoUrlInput({ value, onCommit }) {
20204
- const [draft, setDraft] = (0, import_react12.useState)(value ? watchUrl(value) : "");
20205
- const [invalid, setInvalid] = (0, import_react12.useState)(false);
20206
- (0, import_react12.useEffect)(() => {
20332
+ const [draft, setDraft] = (0, import_react14.useState)(value ? watchUrl(value) : "");
20333
+ const [invalid, setInvalid] = (0, import_react14.useState)(false);
20334
+ (0, import_react14.useEffect)(() => {
20207
20335
  setDraft(value ? watchUrl(value) : "");
20208
20336
  setInvalid(false);
20209
20337
  }, [value]);
@@ -20340,13 +20468,13 @@ function AiVideoOverlay({
20340
20468
  applyTreeLocalRef,
20341
20469
  clearInteractionChromeRef
20342
20470
  }) {
20343
- const [hover, setHover] = (0, import_react12.useState)(null);
20344
- const [active, setActive] = (0, import_react12.useState)(null);
20345
- const [pending, setPending] = (0, import_react12.useState)(false);
20346
- const [error, setError] = (0, import_react12.useState)(null);
20347
- const activeRef = (0, import_react12.useRef)(null);
20471
+ const [hover, setHover] = (0, import_react14.useState)(null);
20472
+ const [active, setActive] = (0, import_react14.useState)(null);
20473
+ const [pending, setPending] = (0, import_react14.useState)(false);
20474
+ const [error, setError] = (0, import_react14.useState)(null);
20475
+ const activeRef = (0, import_react14.useRef)(null);
20348
20476
  activeRef.current = active;
20349
- (0, import_react12.useEffect)(() => {
20477
+ (0, import_react14.useEffect)(() => {
20350
20478
  const onMove = (e) => {
20351
20479
  const t = e.target;
20352
20480
  if (!(t instanceof HTMLElement)) return;
@@ -20376,7 +20504,7 @@ function AiVideoOverlay({
20376
20504
  document.documentElement.removeEventListener("mouseleave", onLeave);
20377
20505
  };
20378
20506
  }, []);
20379
- (0, import_react12.useEffect)(() => {
20507
+ (0, import_react14.useEffect)(() => {
20380
20508
  const onClick = (e) => {
20381
20509
  const current = activeRef.current;
20382
20510
  if (!current) return;
@@ -20391,7 +20519,7 @@ function AiVideoOverlay({
20391
20519
  document.addEventListener("click", onClick, true);
20392
20520
  return () => document.removeEventListener("click", onClick, true);
20393
20521
  }, []);
20394
- (0, import_react12.useEffect)(() => {
20522
+ (0, import_react14.useEffect)(() => {
20395
20523
  const onBlur = () => {
20396
20524
  if (!activeRef.current) return;
20397
20525
  setActive(null);
@@ -20400,7 +20528,7 @@ function AiVideoOverlay({
20400
20528
  window.addEventListener("blur", onBlur);
20401
20529
  return () => window.removeEventListener("blur", onBlur);
20402
20530
  }, []);
20403
- (0, import_react12.useEffect)(() => {
20531
+ (0, import_react14.useEffect)(() => {
20404
20532
  const onKeyDown = (e) => {
20405
20533
  if (e.key !== "Escape") return;
20406
20534
  if (!activeRef.current) return;
@@ -20410,14 +20538,14 @@ function AiVideoOverlay({
20410
20538
  document.addEventListener("keydown", onKeyDown);
20411
20539
  return () => document.removeEventListener("keydown", onKeyDown);
20412
20540
  }, []);
20413
- const findEntry = (0, import_react12.useCallback)(
20541
+ const findEntry = (0, import_react14.useCallback)(
20414
20542
  (sectionId) => {
20415
20543
  const state = parseAiSectionsState(aiSectionsRef.current);
20416
20544
  return state.sections.find((s) => s.id === sectionId) ?? null;
20417
20545
  },
20418
20546
  [aiSectionsRef]
20419
20547
  );
20420
- const runMutation = (0, import_react12.useCallback)(
20548
+ const runMutation = (0, import_react14.useCallback)(
20421
20549
  async (sectionId, mutate) => {
20422
20550
  const entry = findEntry(sectionId);
20423
20551
  if (!entry) return false;
@@ -20509,7 +20637,7 @@ function AiVideoOverlay({
20509
20637
  }
20510
20638
 
20511
20639
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20512
- var import_react13 = require("react");
20640
+ var import_react15 = require("react");
20513
20641
  var import_lucide_react11 = require("lucide-react");
20514
20642
 
20515
20643
  // src/lib/ai-carousel-tree.ts
@@ -20582,8 +20710,8 @@ function readRect5(ref) {
20582
20710
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20583
20711
  }
20584
20712
  function useLiveItemRect2(ref) {
20585
- const [rect, setRect] = (0, import_react13.useState)(null);
20586
- (0, import_react13.useEffect)(() => {
20713
+ const [rect, setRect] = (0, import_react15.useState)(null);
20714
+ (0, import_react15.useEffect)(() => {
20587
20715
  if (!ref) {
20588
20716
  setRect(null);
20589
20717
  return;
@@ -20790,19 +20918,19 @@ function AiFadeCarouselOverlay({
20790
20918
  applyTreeLocalRef,
20791
20919
  clearInteractionChromeRef
20792
20920
  }) {
20793
- const [hover, setHover] = (0, import_react13.useState)(null);
20794
- const [active, setActive] = (0, import_react13.useState)(null);
20795
- const [pending, setPending] = (0, import_react13.useState)(false);
20796
- const [error, setError] = (0, import_react13.useState)(null);
20797
- const [autoplayOverride, setAutoplayOverride] = (0, import_react13.useState)(null);
20798
- const [swapping, setSwapping] = (0, import_react13.useState)(null);
20799
- const skeletonRef = (0, import_react13.useRef)(null);
20800
- const activeRef = (0, import_react13.useRef)(null);
20921
+ const [hover, setHover] = (0, import_react15.useState)(null);
20922
+ const [active, setActive] = (0, import_react15.useState)(null);
20923
+ const [pending, setPending] = (0, import_react15.useState)(false);
20924
+ const [error, setError] = (0, import_react15.useState)(null);
20925
+ const [autoplayOverride, setAutoplayOverride] = (0, import_react15.useState)(null);
20926
+ const [swapping, setSwapping] = (0, import_react15.useState)(null);
20927
+ const skeletonRef = (0, import_react15.useRef)(null);
20928
+ const activeRef = (0, import_react15.useRef)(null);
20801
20929
  activeRef.current = active;
20802
- (0, import_react13.useEffect)(() => {
20930
+ (0, import_react15.useEffect)(() => {
20803
20931
  setAutoplayOverride(null);
20804
20932
  }, [active?.sectionId, active?.index]);
20805
- (0, import_react13.useEffect)(() => {
20933
+ (0, import_react15.useEffect)(() => {
20806
20934
  if (!swapping?.fadingOut || !skeletonRef.current) return;
20807
20935
  const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
20808
20936
  duration: MEDIA_UPLOAD_FADE_MS,
@@ -20812,7 +20940,7 @@ function AiFadeCarouselOverlay({
20812
20940
  anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
20813
20941
  return () => anim.cancel();
20814
20942
  }, [swapping?.fadingOut]);
20815
- (0, import_react13.useEffect)(() => {
20943
+ (0, import_react15.useEffect)(() => {
20816
20944
  const onMove = (e) => {
20817
20945
  const t = e.target;
20818
20946
  if (!(t instanceof Element)) return;
@@ -20846,7 +20974,7 @@ function AiFadeCarouselOverlay({
20846
20974
  document.documentElement.removeEventListener("mouseleave", onLeave);
20847
20975
  };
20848
20976
  }, []);
20849
- (0, import_react13.useEffect)(() => {
20977
+ (0, import_react15.useEffect)(() => {
20850
20978
  const onClick = (e) => {
20851
20979
  const current = activeRef.current;
20852
20980
  if (!current) return;
@@ -20861,7 +20989,7 @@ function AiFadeCarouselOverlay({
20861
20989
  document.addEventListener("click", onClick, true);
20862
20990
  return () => document.removeEventListener("click", onClick, true);
20863
20991
  }, []);
20864
- (0, import_react13.useEffect)(() => {
20992
+ (0, import_react15.useEffect)(() => {
20865
20993
  const onBlur = () => {
20866
20994
  if (!activeRef.current) return;
20867
20995
  setActive(null);
@@ -20870,7 +20998,7 @@ function AiFadeCarouselOverlay({
20870
20998
  window.addEventListener("blur", onBlur);
20871
20999
  return () => window.removeEventListener("blur", onBlur);
20872
21000
  }, []);
20873
- (0, import_react13.useEffect)(() => {
21001
+ (0, import_react15.useEffect)(() => {
20874
21002
  const onKeyDown = (e) => {
20875
21003
  if (e.key !== "Escape") return;
20876
21004
  if (!activeRef.current) return;
@@ -20880,14 +21008,14 @@ function AiFadeCarouselOverlay({
20880
21008
  document.addEventListener("keydown", onKeyDown);
20881
21009
  return () => document.removeEventListener("keydown", onKeyDown);
20882
21010
  }, []);
20883
- const findEntry = (0, import_react13.useCallback)(
21011
+ const findEntry = (0, import_react15.useCallback)(
20884
21012
  (sectionId) => {
20885
21013
  const state = parseAiSectionsState(aiSectionsRef.current);
20886
21014
  return state.sections.find((s) => s.id === sectionId) ?? null;
20887
21015
  },
20888
21016
  [aiSectionsRef]
20889
21017
  );
20890
- const runMutation = (0, import_react13.useCallback)(
21018
+ const runMutation = (0, import_react15.useCallback)(
20891
21019
  async (sectionId, mutate, extraMedia) => {
20892
21020
  const entry = findEntry(sectionId);
20893
21021
  if (!entry) return false;
@@ -21024,7 +21152,7 @@ function AiFadeCarouselOverlay({
21024
21152
 
21025
21153
  // src/OhhwellsBridge.tsx
21026
21154
  var import_react_dom6 = require("react-dom");
21027
- var import_navigation3 = require("next/navigation");
21155
+ var import_navigation4 = require("next/navigation");
21028
21156
 
21029
21157
  // src/lib/media-overlay-guards.ts
21030
21158
  var BRIDGE_CHROME_SELECTOR = [
@@ -21166,35 +21294,8 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21166
21294
  return next;
21167
21295
  }
21168
21296
 
21169
- // src/lib/scroll-to-section.ts
21170
- var MAX_ATTEMPTS = 12;
21171
- var RETRY_MS = 100;
21172
- function getHashSectionId() {
21173
- if (typeof window === "undefined") return null;
21174
- const id = window.location.hash.replace(/^#/, "").trim();
21175
- return id || null;
21176
- }
21177
- function scrollToOhwSection(sectionId, behavior = "smooth") {
21178
- if (!sectionId || typeof document === "undefined") return false;
21179
- const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
21180
- if (!el) return false;
21181
- el.scrollIntoView({ behavior, block: "start" });
21182
- return true;
21183
- }
21184
- function scrollToHashSectionWhenReady(behavior = "smooth") {
21185
- const id = getHashSectionId();
21186
- if (!id) return;
21187
- let attempt = 0;
21188
- const tick = () => {
21189
- if (scrollToOhwSection(id, behavior)) return;
21190
- attempt += 1;
21191
- if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
21192
- };
21193
- tick();
21194
- }
21195
-
21196
21297
  // src/ui/link-modal/LinkPopover.tsx
21197
- var import_react17 = require("react");
21298
+ var import_react19 = require("react");
21198
21299
 
21199
21300
  // src/ui/dialog.tsx
21200
21301
  var React9 = __toESM(require("react"), 1);
@@ -21394,7 +21495,7 @@ function SectionTreeItem({
21394
21495
  }
21395
21496
 
21396
21497
  // src/ui/link-modal/UrlOrPageInput.tsx
21397
- var import_react14 = require("react");
21498
+ var import_react16 = require("react");
21398
21499
 
21399
21500
  // src/ui/input.tsx
21400
21501
  var React10 = __toESM(require("react"), 1);
@@ -21462,11 +21563,11 @@ function UrlOrPageInput({
21462
21563
  readOnly = false,
21463
21564
  urlError
21464
21565
  }) {
21465
- const inputId = (0, import_react14.useId)();
21466
- const inputRef = (0, import_react14.useRef)(null);
21467
- const rootRef = (0, import_react14.useRef)(null);
21468
- const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
21469
- (0, import_react14.useEffect)(() => {
21566
+ const inputId = (0, import_react16.useId)();
21567
+ const inputRef = (0, import_react16.useRef)(null);
21568
+ const rootRef = (0, import_react16.useRef)(null);
21569
+ const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
21570
+ (0, import_react16.useEffect)(() => {
21470
21571
  if (!dropdownOpen) return;
21471
21572
  const isOutside = (e) => {
21472
21573
  const root = rootRef.current;
@@ -21674,10 +21775,10 @@ function LinkEditorPanel({ state, onClose }) {
21674
21775
  }
21675
21776
 
21676
21777
  // src/ui/link-modal/SectionPickerOverlay.tsx
21677
- var import_react15 = require("react");
21778
+ var import_react17 = require("react");
21678
21779
  var import_react_dom4 = require("react-dom");
21679
21780
  var import_lucide_react17 = require("lucide-react");
21680
- var import_navigation2 = require("next/navigation");
21781
+ var import_navigation3 = require("next/navigation");
21681
21782
 
21682
21783
  // src/lib/parent-scroll.ts
21683
21784
  function visibleBand(parentScroll) {
@@ -21731,12 +21832,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
21731
21832
  return null;
21732
21833
  }
21733
21834
  function useSectionRects(sectionIdsKey, enabled) {
21734
- const [rects, setRects] = (0, import_react15.useState)(/* @__PURE__ */ new Map());
21735
- const sectionIds = (0, import_react15.useMemo)(
21835
+ const [rects, setRects] = (0, import_react17.useState)(/* @__PURE__ */ new Map());
21836
+ const sectionIds = (0, import_react17.useMemo)(
21736
21837
  () => sectionIdsKey ? sectionIdsKey.split("\0") : [],
21737
21838
  [sectionIdsKey]
21738
21839
  );
21739
- (0, import_react15.useEffect)(() => {
21840
+ (0, import_react17.useEffect)(() => {
21740
21841
  if (!enabled || sectionIds.length === 0) {
21741
21842
  setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
21742
21843
  return;
@@ -21775,15 +21876,15 @@ function SectionPickerOverlay({
21775
21876
  onBack,
21776
21877
  onSelect
21777
21878
  }) {
21778
- const router = (0, import_navigation2.useRouter)();
21779
- const pathname = (0, import_navigation2.usePathname)();
21780
- const [selectedId, setSelectedId] = (0, import_react15.useState)(null);
21781
- const [hoveredId, setHoveredId] = (0, import_react15.useState)(null);
21782
- const pointerRef = (0, import_react15.useRef)(null);
21783
- const pointerScreenRef = (0, import_react15.useRef)(null);
21784
- const iframeOffsetTopRef = (0, import_react15.useRef)(null);
21785
- const sectionIdsRef = (0, import_react15.useRef)([]);
21786
- const [chromeClip, setChromeClip] = (0, import_react15.useState)(
21879
+ const router = (0, import_navigation3.useRouter)();
21880
+ const pathname = (0, import_navigation3.usePathname)();
21881
+ const [selectedId, setSelectedId] = (0, import_react17.useState)(null);
21882
+ const [hoveredId, setHoveredId] = (0, import_react17.useState)(null);
21883
+ const pointerRef = (0, import_react17.useRef)(null);
21884
+ const pointerScreenRef = (0, import_react17.useRef)(null);
21885
+ const iframeOffsetTopRef = (0, import_react17.useRef)(null);
21886
+ const sectionIdsRef = (0, import_react17.useRef)([]);
21887
+ const [chromeClip, setChromeClip] = (0, import_react17.useState)(
21787
21888
  () => ({
21788
21889
  top: 0,
21789
21890
  bottom: typeof window !== "undefined" ? window.innerHeight : 0
@@ -21791,12 +21892,12 @@ function SectionPickerOverlay({
21791
21892
  );
21792
21893
  const normalizedTarget = normalizePath(pagePath);
21793
21894
  const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
21794
- (0, import_react15.useEffect)(() => {
21895
+ (0, import_react17.useEffect)(() => {
21795
21896
  if (isOnTargetPage) return;
21796
21897
  const search = readPreservedSearch();
21797
21898
  router.push(`${normalizedTarget}${search}`);
21798
21899
  }, [isOnTargetPage, normalizedTarget, router]);
21799
- (0, import_react15.useEffect)(() => {
21900
+ (0, import_react17.useEffect)(() => {
21800
21901
  document.documentElement.setAttribute("data-ohw-section-picking", "");
21801
21902
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
21802
21903
  el.removeAttribute("data-ohw-hovered");
@@ -21808,24 +21909,24 @@ function SectionPickerOverlay({
21808
21909
  document.documentElement.removeAttribute("data-ohw-section-picking");
21809
21910
  };
21810
21911
  }, []);
21811
- const liveSections = (0, import_react15.useMemo)(() => {
21912
+ const liveSections = (0, import_react17.useMemo)(() => {
21812
21913
  if (!isOnTargetPage) return sections;
21813
21914
  const live = collectSectionsFromDom();
21814
21915
  if (live.length === 0) return sections;
21815
21916
  const labels = new Map(sections.map((s) => [s.id, s.label]));
21816
21917
  return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
21817
21918
  }, [isOnTargetPage, sections, pathname]);
21818
- const sectionIdsKey = (0, import_react15.useMemo)(
21919
+ const sectionIdsKey = (0, import_react17.useMemo)(
21819
21920
  () => liveSections.map((s) => s.id).join("\0"),
21820
21921
  [liveSections]
21821
21922
  );
21822
- const sectionIds = (0, import_react15.useMemo)(
21923
+ const sectionIds = (0, import_react17.useMemo)(
21823
21924
  () => liveSections.map((s) => s.id),
21824
21925
  [liveSections]
21825
21926
  );
21826
21927
  sectionIdsRef.current = sectionIds;
21827
21928
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
21828
- const applyHoverAt = (0, import_react15.useCallback)(
21929
+ const applyHoverAt = (0, import_react17.useCallback)(
21829
21930
  (x, y, liveRects) => {
21830
21931
  const ids = sectionIdsRef.current;
21831
21932
  const map = liveRects ?? readSectionRects(ids);
@@ -21834,7 +21935,7 @@ function SectionPickerOverlay({
21834
21935
  },
21835
21936
  []
21836
21937
  );
21837
- (0, import_react15.useEffect)(() => {
21938
+ (0, import_react17.useEffect)(() => {
21838
21939
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
21839
21940
  const next = getIframeVisibleClip({
21840
21941
  iframeOffsetTop,
@@ -21878,12 +21979,12 @@ function SectionPickerOverlay({
21878
21979
  window.removeEventListener("resize", onResize);
21879
21980
  };
21880
21981
  }, [applyHoverAt]);
21881
- (0, import_react15.useEffect)(() => {
21982
+ (0, import_react17.useEffect)(() => {
21882
21983
  const ptr = pointerRef.current;
21883
21984
  if (!ptr) return;
21884
21985
  applyHoverAt(ptr.x, ptr.y, rects);
21885
21986
  }, [rects, applyHoverAt]);
21886
- (0, import_react15.useEffect)(() => {
21987
+ (0, import_react17.useEffect)(() => {
21887
21988
  const rememberPointer = (clientX, clientY) => {
21888
21989
  pointerRef.current = { x: clientX, y: clientY };
21889
21990
  const top = iframeOffsetTopRef.current;
@@ -21907,7 +22008,7 @@ function SectionPickerOverlay({
21907
22008
  window.removeEventListener("message", onPointerSync);
21908
22009
  };
21909
22010
  }, [rects, applyHoverAt]);
21910
- const handleSelect = (0, import_react15.useCallback)(
22011
+ const handleSelect = (0, import_react17.useCallback)(
21911
22012
  (section) => {
21912
22013
  if (selectedId) return;
21913
22014
  setSelectedId(section.id);
@@ -21915,7 +22016,7 @@ function SectionPickerOverlay({
21915
22016
  },
21916
22017
  [selectedId, onSelect]
21917
22018
  );
21918
- (0, import_react15.useEffect)(() => {
22019
+ (0, import_react17.useEffect)(() => {
21919
22020
  const onKeyDown = (e) => {
21920
22021
  if (e.key === "Escape") {
21921
22022
  e.preventDefault();
@@ -22038,7 +22139,7 @@ function SectionPickerOverlay({
22038
22139
  }
22039
22140
 
22040
22141
  // src/ui/link-modal/useLinkModalState.ts
22041
- var import_react16 = require("react");
22142
+ var import_react18 = require("react");
22042
22143
  function useLinkModalState({
22043
22144
  open,
22044
22145
  mode,
@@ -22050,14 +22151,14 @@ function useLinkModalState({
22050
22151
  onClose,
22051
22152
  onSubmit
22052
22153
  }) {
22053
- const availablePages = (0, import_react16.useMemo)(() => pages, [pages]);
22054
- const [searchValue, setSearchValue] = (0, import_react16.useState)("");
22055
- const [selectedPage, setSelectedPage] = (0, import_react16.useState)(null);
22056
- const [selectedSection, setSelectedSection] = (0, import_react16.useState)(null);
22057
- const [step, setStep] = (0, import_react16.useState)("input");
22058
- const [dropdownOpen, setDropdownOpen] = (0, import_react16.useState)(false);
22059
- const [urlError, setUrlError] = (0, import_react16.useState)("");
22060
- const reset = (0, import_react16.useCallback)(() => {
22154
+ const availablePages = (0, import_react18.useMemo)(() => pages, [pages]);
22155
+ const [searchValue, setSearchValue] = (0, import_react18.useState)("");
22156
+ const [selectedPage, setSelectedPage] = (0, import_react18.useState)(null);
22157
+ const [selectedSection, setSelectedSection] = (0, import_react18.useState)(null);
22158
+ const [step, setStep] = (0, import_react18.useState)("input");
22159
+ const [dropdownOpen, setDropdownOpen] = (0, import_react18.useState)(false);
22160
+ const [urlError, setUrlError] = (0, import_react18.useState)("");
22161
+ const reset = (0, import_react18.useCallback)(() => {
22061
22162
  setSearchValue("");
22062
22163
  setSelectedPage(null);
22063
22164
  setSelectedSection(null);
@@ -22065,7 +22166,7 @@ function useLinkModalState({
22065
22166
  setDropdownOpen(false);
22066
22167
  setUrlError("");
22067
22168
  }, []);
22068
- (0, import_react16.useEffect)(() => {
22169
+ (0, import_react18.useEffect)(() => {
22069
22170
  if (!open) return;
22070
22171
  if (mode === "edit" && initialTarget) {
22071
22172
  const { pageRoute } = parseTarget(initialTarget);
@@ -22081,11 +22182,11 @@ function useLinkModalState({
22081
22182
  setDropdownOpen(false);
22082
22183
  setUrlError("");
22083
22184
  }, [open, mode, initialTarget, reset]);
22084
- const filteredPages = (0, import_react16.useMemo)(() => {
22185
+ const filteredPages = (0, import_react18.useMemo)(() => {
22085
22186
  if (!searchValue.trim()) return availablePages;
22086
22187
  return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
22087
22188
  }, [availablePages, searchValue]);
22088
- const activeSections = (0, import_react16.useMemo)(() => {
22189
+ const activeSections = (0, import_react18.useMemo)(() => {
22089
22190
  if (!selectedPage) return [];
22090
22191
  return getSectionsForPath(sectionsByPath, selectedPage.path);
22091
22192
  }, [selectedPage, sectionsByPath]);
@@ -22134,7 +22235,7 @@ function useLinkModalState({
22134
22235
  reset();
22135
22236
  onClose();
22136
22237
  };
22137
- const isValid = (0, import_react16.useMemo)(() => {
22238
+ const isValid = (0, import_react18.useMemo)(() => {
22138
22239
  if (urlError) return false;
22139
22240
  if (showBreadcrumb) return true;
22140
22241
  if (selectedPage) return true;
@@ -22231,7 +22332,7 @@ function LinkPopover({
22231
22332
  onSubmit
22232
22333
  });
22233
22334
  const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
22234
- (0, import_react17.useEffect)(() => {
22335
+ (0, import_react19.useEffect)(() => {
22235
22336
  if (!open) return;
22236
22337
  if (sectionPickerActive) {
22237
22338
  postToParent({ type: "ui:unlock" });
@@ -22472,7 +22573,7 @@ function addFooterColumnWithPersist({
22472
22573
  }
22473
22574
 
22474
22575
  // src/ui/FloatingPanel.tsx
22475
- var import_react18 = require("react");
22576
+ var import_react20 = require("react");
22476
22577
  var import_lucide_react18 = require("lucide-react");
22477
22578
  var import_jsx_runtime33 = require("react/jsx-runtime");
22478
22579
  var PANEL_WIDTH = 256;
@@ -22534,10 +22635,10 @@ function FloatingPanel({
22534
22635
  className,
22535
22636
  bodyClassName
22536
22637
  }) {
22537
- const panelRef = (0, import_react18.useRef)(null);
22538
- const [measured, setMeasured] = (0, import_react18.useState)({ w: PANEL_WIDTH, h: 280 });
22539
- const dragRef = (0, import_react18.useRef)(null);
22540
- const homeRef = (0, import_react18.useRef)(null);
22638
+ const panelRef = (0, import_react20.useRef)(null);
22639
+ const [measured, setMeasured] = (0, import_react20.useState)({ w: PANEL_WIDTH, h: 280 });
22640
+ const dragRef = (0, import_react20.useRef)(null);
22641
+ const homeRef = (0, import_react20.useRef)(null);
22541
22642
  if (!open) {
22542
22643
  homeRef.current = null;
22543
22644
  } else if (position) {
@@ -22545,17 +22646,17 @@ function FloatingPanel({
22545
22646
  } else if (homeRef.current == null) {
22546
22647
  homeRef.current = defaultFloatingPanelPosition(parentScroll);
22547
22648
  }
22548
- const [liveScroll, setLiveScroll] = (0, import_react18.useState)(parentScroll);
22649
+ const [liveScroll, setLiveScroll] = (0, import_react20.useState)(parentScroll);
22549
22650
  const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
22550
22651
  const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
22551
22652
  const clamped = {
22552
22653
  x: clampX(home.x, measured.w),
22553
22654
  y: fittedY
22554
22655
  };
22555
- (0, import_react18.useEffect)(() => {
22656
+ (0, import_react20.useEffect)(() => {
22556
22657
  setLiveScroll(parentScroll);
22557
22658
  }, [parentScroll]);
22558
- (0, import_react18.useEffect)(() => {
22659
+ (0, import_react20.useEffect)(() => {
22559
22660
  if (!open) return;
22560
22661
  const onParentScroll = (e) => {
22561
22662
  if (e.data?.type !== "ow:parent-scroll") return;
@@ -22565,8 +22666,8 @@ function FloatingPanel({
22565
22666
  window.addEventListener("message", onParentScroll);
22566
22667
  return () => window.removeEventListener("message", onParentScroll);
22567
22668
  }, [open]);
22568
- const positionRef = (0, import_react18.useRef)(position);
22569
- (0, import_react18.useLayoutEffect)(() => {
22669
+ const positionRef = (0, import_react20.useRef)(position);
22670
+ (0, import_react20.useLayoutEffect)(() => {
22570
22671
  if (!open) {
22571
22672
  positionRef.current = position;
22572
22673
  return;
@@ -22576,7 +22677,7 @@ function FloatingPanel({
22576
22677
  }
22577
22678
  positionRef.current = position;
22578
22679
  }, [open, position, liveScroll, parentScroll]);
22579
- (0, import_react18.useLayoutEffect)(() => {
22680
+ (0, import_react20.useLayoutEffect)(() => {
22580
22681
  if (!open || !panelRef.current) return;
22581
22682
  const el = panelRef.current;
22582
22683
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -22585,7 +22686,7 @@ function FloatingPanel({
22585
22686
  const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
22586
22687
  setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
22587
22688
  }, [open, children, title, context]);
22588
- const onHeaderPointerDown = (0, import_react18.useCallback)(
22689
+ const onHeaderPointerDown = (0, import_react20.useCallback)(
22589
22690
  (e) => {
22590
22691
  if (e.button !== 0) return;
22591
22692
  if (e.target.closest("[data-ohw-floating-panel-close]")) return;
@@ -22604,7 +22705,7 @@ function FloatingPanel({
22604
22705
  },
22605
22706
  [clamped.x, clamped.y]
22606
22707
  );
22607
- const onHeaderPointerMove = (0, import_react18.useCallback)(
22708
+ const onHeaderPointerMove = (0, import_react20.useCallback)(
22608
22709
  (e) => {
22609
22710
  const drag = dragRef.current;
22610
22711
  if (!drag || drag.pointerId !== e.pointerId) return;
@@ -22630,7 +22731,7 @@ function FloatingPanel({
22630
22731
  },
22631
22732
  [measured.w, onPositionChange, liveScroll]
22632
22733
  );
22633
- const endDrag = (0, import_react18.useCallback)((e) => {
22734
+ const endDrag = (0, import_react20.useCallback)((e) => {
22634
22735
  const drag = dragRef.current;
22635
22736
  if (!drag || drag.pointerId !== e.pointerId) return;
22636
22737
  dragRef.current = null;
@@ -22640,11 +22741,11 @@ function FloatingPanel({
22640
22741
  } catch {
22641
22742
  }
22642
22743
  }, []);
22643
- (0, import_react18.useEffect)(() => {
22744
+ (0, import_react20.useEffect)(() => {
22644
22745
  if (open) return;
22645
22746
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
22646
22747
  }, [open]);
22647
- (0, import_react18.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22748
+ (0, import_react20.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22648
22749
  if (!open) return null;
22649
22750
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
22650
22751
  "div",
@@ -23164,7 +23265,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
23164
23265
  }
23165
23266
 
23166
23267
  // src/useNavItemDrag.ts
23167
- var import_react19 = require("react");
23268
+ var import_react21 = require("react");
23168
23269
  function useNavItemDrag({
23169
23270
  isEditMode,
23170
23271
  editContentRef,
@@ -23188,11 +23289,11 @@ function useNavItemDrag({
23188
23289
  getNavigationItemAnchor: getNavigationItemAnchor2,
23189
23290
  isDragHandleDisabled: isDragHandleDisabled2
23190
23291
  }) {
23191
- const navDragRef = (0, import_react19.useRef)(null);
23192
- const [navDropSlots, setNavDropSlots] = (0, import_react19.useState)([]);
23193
- const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react19.useState)(null);
23194
- const navPointerDragRef = (0, import_react19.useRef)(null);
23195
- const clearNavDragVisuals = (0, import_react19.useCallback)(() => {
23292
+ const navDragRef = (0, import_react21.useRef)(null);
23293
+ const [navDropSlots, setNavDropSlots] = (0, import_react21.useState)([]);
23294
+ const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react21.useState)(null);
23295
+ const navPointerDragRef = (0, import_react21.useRef)(null);
23296
+ const clearNavDragVisuals = (0, import_react21.useCallback)(() => {
23196
23297
  const session = navDragRef.current;
23197
23298
  const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
23198
23299
  navDragRef.current = null;
@@ -23225,7 +23326,7 @@ function useNavItemDrag({
23225
23326
  document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
23226
23327
  unlockItemDragInteraction();
23227
23328
  }, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
23228
- const refreshNavDragVisuals = (0, import_react19.useCallback)(
23329
+ const refreshNavDragVisuals = (0, import_react21.useCallback)(
23229
23330
  (session, activeSlot, clientX, clientY) => {
23230
23331
  setDraggedItemRect(session.draggedEl.getBoundingClientRect());
23231
23332
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -23243,13 +23344,13 @@ function useNavItemDrag({
23243
23344
  },
23244
23345
  [setDraggedItemRect, setSiblingHintRects]
23245
23346
  );
23246
- const refreshNavDragVisualsRef = (0, import_react19.useRef)(refreshNavDragVisuals);
23347
+ const refreshNavDragVisualsRef = (0, import_react21.useRef)(refreshNavDragVisuals);
23247
23348
  refreshNavDragVisualsRef.current = refreshNavDragVisuals;
23248
- const commitNavDragRef = (0, import_react19.useRef)(() => {
23349
+ const commitNavDragRef = (0, import_react21.useRef)(() => {
23249
23350
  });
23250
- const beginNavDragRef = (0, import_react19.useRef)(() => {
23351
+ const beginNavDragRef = (0, import_react21.useRef)(() => {
23251
23352
  });
23252
- const beginNavDrag = (0, import_react19.useCallback)(
23353
+ const beginNavDrag = (0, import_react21.useCallback)(
23253
23354
  (session) => {
23254
23355
  const rect = session.draggedEl.getBoundingClientRect();
23255
23356
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -23288,7 +23389,7 @@ function useNavItemDrag({
23288
23389
  ]
23289
23390
  );
23290
23391
  beginNavDragRef.current = beginNavDrag;
23291
- const commitNavDrag = (0, import_react19.useCallback)(
23392
+ const commitNavDrag = (0, import_react21.useCallback)(
23292
23393
  (clientX, clientY) => {
23293
23394
  const session = navDragRef.current;
23294
23395
  if (!session) {
@@ -23367,7 +23468,7 @@ function useNavItemDrag({
23367
23468
  [clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
23368
23469
  );
23369
23470
  commitNavDragRef.current = commitNavDrag;
23370
- const startNavLinkDrag = (0, import_react19.useCallback)(
23471
+ const startNavLinkDrag = (0, import_react21.useCallback)(
23371
23472
  (anchor, clientX, clientY, wasSelected) => {
23372
23473
  if (footerDragRef.current) return false;
23373
23474
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
@@ -23385,7 +23486,7 @@ function useNavItemDrag({
23385
23486
  },
23386
23487
  [beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
23387
23488
  );
23388
- const onNavDragOver = (0, import_react19.useCallback)(
23489
+ const onNavDragOver = (0, import_react21.useCallback)(
23389
23490
  (e) => {
23390
23491
  const session = navDragRef.current;
23391
23492
  if (!session) return false;
@@ -23397,7 +23498,7 @@ function useNavItemDrag({
23397
23498
  },
23398
23499
  []
23399
23500
  );
23400
- (0, import_react19.useEffect)(() => {
23501
+ (0, import_react21.useEffect)(() => {
23401
23502
  if (!isEditMode) return;
23402
23503
  const THRESHOLD = 10;
23403
23504
  const resolveWasSelected = (el) => {
@@ -23524,7 +23625,7 @@ function useNavItemDrag({
23524
23625
  setLinkPopover,
23525
23626
  suppressNextClickRef
23526
23627
  ]);
23527
- const armNavPressFromChrome = (0, import_react19.useCallback)(
23628
+ const armNavPressFromChrome = (0, import_react21.useCallback)(
23528
23629
  (selected, clientX, clientY, pointerId) => {
23529
23630
  const hrefKey = selected.getAttribute("data-ohw-href-key");
23530
23631
  if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
@@ -23556,7 +23657,7 @@ function useNavItemDrag({
23556
23657
  }
23557
23658
 
23558
23659
  // src/useSectionDrag.ts
23559
- var import_react20 = require("react");
23660
+ var import_react22 = require("react");
23560
23661
 
23561
23662
  // src/lib/section-dnd.ts
23562
23663
  function isFooterSection(el) {
@@ -23649,21 +23750,21 @@ function useSectionDrag({
23649
23750
  suppressNextClickRef,
23650
23751
  suppressClickUntilRef
23651
23752
  }) {
23652
- const sectionDragRef = (0, import_react20.useRef)(null);
23653
- const [sectionDropSlots, setSectionDropSlots] = (0, import_react20.useState)([]);
23654
- const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react20.useState)(null);
23655
- const [isSectionDragging, setIsSectionDragging] = (0, import_react20.useState)(false);
23656
- const sectionPointerDragRef = (0, import_react20.useRef)(null);
23657
- const autoScrollRafRef = (0, import_react20.useRef)(null);
23658
- const autoScrollDeltaRef = (0, import_react20.useRef)(0);
23659
- const stopAutoScroll = (0, import_react20.useCallback)(() => {
23753
+ const sectionDragRef = (0, import_react22.useRef)(null);
23754
+ const [sectionDropSlots, setSectionDropSlots] = (0, import_react22.useState)([]);
23755
+ const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react22.useState)(null);
23756
+ const [isSectionDragging, setIsSectionDragging] = (0, import_react22.useState)(false);
23757
+ const sectionPointerDragRef = (0, import_react22.useRef)(null);
23758
+ const autoScrollRafRef = (0, import_react22.useRef)(null);
23759
+ const autoScrollDeltaRef = (0, import_react22.useRef)(0);
23760
+ const stopAutoScroll = (0, import_react22.useCallback)(() => {
23660
23761
  if (autoScrollRafRef.current != null) {
23661
23762
  cancelAnimationFrame(autoScrollRafRef.current);
23662
23763
  autoScrollRafRef.current = null;
23663
23764
  }
23664
23765
  autoScrollDeltaRef.current = 0;
23665
23766
  }, []);
23666
- const tickAutoScroll = (0, import_react20.useCallback)(() => {
23767
+ const tickAutoScroll = (0, import_react22.useCallback)(() => {
23667
23768
  if (!sectionDragRef.current) {
23668
23769
  stopAutoScroll();
23669
23770
  return;
@@ -23673,7 +23774,7 @@ function useSectionDrag({
23673
23774
  }
23674
23775
  autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
23675
23776
  }, [postToParentRef, stopAutoScroll]);
23676
- const updateAutoScroll = (0, import_react20.useCallback)(
23777
+ const updateAutoScroll = (0, import_react22.useCallback)(
23677
23778
  (clientY) => {
23678
23779
  const clip = getIframeChromeClip(parentScrollRef.current);
23679
23780
  let delta = 0;
@@ -23695,7 +23796,7 @@ function useSectionDrag({
23695
23796
  },
23696
23797
  [parentScrollRef, stopAutoScroll, tickAutoScroll]
23697
23798
  );
23698
- const clearSectionDragVisuals = (0, import_react20.useCallback)(() => {
23799
+ const clearSectionDragVisuals = (0, import_react22.useCallback)(() => {
23699
23800
  sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
23700
23801
  sectionDragRef.current = null;
23701
23802
  setSectionDropSlots([]);
@@ -23705,7 +23806,7 @@ function useSectionDrag({
23705
23806
  document.documentElement.removeAttribute("data-ohw-section-dragging-root");
23706
23807
  unlockItemDragInteraction();
23707
23808
  }, [stopAutoScroll]);
23708
- const refreshSectionDragVisuals = (0, import_react20.useCallback)(
23809
+ const refreshSectionDragVisuals = (0, import_react22.useCallback)(
23709
23810
  (session, clientX, clientY) => {
23710
23811
  session.lastClientX = clientX;
23711
23812
  session.lastClientY = clientY;
@@ -23719,7 +23820,7 @@ function useSectionDrag({
23719
23820
  },
23720
23821
  [updateAutoScroll]
23721
23822
  );
23722
- const beginSectionDrag = (0, import_react20.useCallback)(
23823
+ const beginSectionDrag = (0, import_react22.useCallback)(
23723
23824
  (session) => {
23724
23825
  sectionDragRef.current = session;
23725
23826
  setIsSectionDragging(true);
@@ -23730,7 +23831,7 @@ function useSectionDrag({
23730
23831
  },
23731
23832
  [refreshSectionDragVisuals]
23732
23833
  );
23733
- const commitSectionDrag = (0, import_react20.useCallback)(() => {
23834
+ const commitSectionDrag = (0, import_react22.useCallback)(() => {
23734
23835
  const session = sectionDragRef.current;
23735
23836
  if (!session) {
23736
23837
  clearSectionDragVisuals();
@@ -23759,7 +23860,7 @@ function useSectionDrag({
23759
23860
  });
23760
23861
  });
23761
23862
  }, [clearSectionDragVisuals, editContentRef, postToParentRef]);
23762
- const startSectionPressDrag = (0, import_react20.useCallback)(
23863
+ const startSectionPressDrag = (0, import_react22.useCallback)(
23763
23864
  (el, clientX, clientY, pointerId) => {
23764
23865
  if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
23765
23866
  const instanceId = instanceIdOf(el);
@@ -23776,7 +23877,7 @@ function useSectionDrag({
23776
23877
  },
23777
23878
  [footerDragRef, navDragRef]
23778
23879
  );
23779
- (0, import_react20.useEffect)(() => {
23880
+ (0, import_react22.useEffect)(() => {
23780
23881
  if (!isEditMode) return;
23781
23882
  const onPointerDown = (e) => {
23782
23883
  if (e.button !== 0) return;
@@ -25459,9 +25560,9 @@ function FloatingToolbar({
25459
25560
  showEditLink,
25460
25561
  onEditLink
25461
25562
  }) {
25462
- const localRef = import_react21.default.useRef(null);
25463
- const [measuredW, setMeasuredW] = import_react21.default.useState(330);
25464
- const setRefs = import_react21.default.useCallback(
25563
+ const localRef = import_react23.default.useRef(null);
25564
+ const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25565
+ const setRefs = import_react23.default.useCallback(
25465
25566
  (node) => {
25466
25567
  localRef.current = node;
25467
25568
  if (typeof elRef === "function") elRef(node);
@@ -25473,7 +25574,7 @@ function FloatingToolbar({
25473
25574
  },
25474
25575
  [elRef]
25475
25576
  );
25476
- import_react21.default.useLayoutEffect(() => {
25577
+ import_react23.default.useLayoutEffect(() => {
25477
25578
  const node = localRef.current;
25478
25579
  if (!node) return;
25479
25580
  const update = () => {
@@ -25499,7 +25600,7 @@ function FloatingToolbar({
25499
25600
  pointerEvents: "auto"
25500
25601
  },
25501
25602
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25502
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react21.default.Fragment, { children: [
25603
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
25503
25604
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25504
25605
  btns.map((btn) => {
25505
25606
  const isActive = activeCommands.has(btn.cmd);
@@ -25704,12 +25805,12 @@ function resolveSubdomain(subdomainFromQuery) {
25704
25805
  return "";
25705
25806
  }
25706
25807
  function OhhwellsBridge() {
25707
- const pathname = (0, import_navigation3.usePathname)();
25708
- const router = (0, import_navigation3.useRouter)();
25709
- const searchParams = (0, import_navigation3.useSearchParams)();
25808
+ const pathname = (0, import_navigation4.usePathname)();
25809
+ const router = (0, import_navigation4.useRouter)();
25810
+ const searchParams = (0, import_navigation4.useSearchParams)();
25710
25811
  const isEditMode = isEditSessionActive();
25711
- const [bridgeRoot, setBridgeRoot] = (0, import_react21.useState)(null);
25712
- (0, import_react21.useEffect)(() => {
25812
+ const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
25813
+ (0, import_react23.useEffect)(() => {
25713
25814
  const figtreeFontId = "ohw-figtree-font";
25714
25815
  if (!document.getElementById(figtreeFontId)) {
25715
25816
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25735,8 +25836,8 @@ function OhhwellsBridge() {
25735
25836
  };
25736
25837
  }, []);
25737
25838
  const subdomainFromQuery = searchParams.get("subdomain");
25738
- const [subdomain, setSubdomain] = (0, import_react21.useState)(() => resolveSubdomain(subdomainFromQuery));
25739
- (0, import_react21.useLayoutEffect)(() => {
25839
+ const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
25840
+ (0, import_react23.useLayoutEffect)(() => {
25740
25841
  const next = resolveSubdomain(subdomainFromQuery);
25741
25842
  if (next !== subdomain) setSubdomain(next);
25742
25843
  if (next) return;
@@ -25748,7 +25849,7 @@ function OhhwellsBridge() {
25748
25849
  }, 0);
25749
25850
  return () => window.clearTimeout(t);
25750
25851
  }, [subdomainFromQuery, subdomain]);
25751
- (0, import_react21.useEffect)(() => {
25852
+ (0, import_react23.useEffect)(() => {
25752
25853
  if (!subdomainFromQuery || typeof window === "undefined") return;
25753
25854
  const url = new URL(window.location.href);
25754
25855
  if (!url.searchParams.has("subdomain")) return;
@@ -25758,22 +25859,24 @@ function OhhwellsBridge() {
25758
25859
  }, [subdomainFromQuery]);
25759
25860
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
25760
25861
  useSavedLinkNavigation(isEditMode);
25761
- const postToParent2 = (0, import_react21.useCallback)((data) => {
25862
+ useNavDropdownToggle(isEditMode);
25863
+ useHashLinkScroll(isEditMode);
25864
+ const postToParent2 = (0, import_react23.useCallback)((data) => {
25762
25865
  if (typeof window !== "undefined" && window.parent !== window) {
25763
25866
  window.parent.postMessage(data, "*");
25764
25867
  }
25765
25868
  }, []);
25766
- const [fetchState, setFetchState] = (0, import_react21.useState)("idle");
25767
- const [showBranding, setShowBranding] = (0, import_react21.useState)(false);
25768
- const autoSaveTimers = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25769
- (0, import_react21.useEffect)(() => {
25869
+ const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
25870
+ const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
25871
+ const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25872
+ (0, import_react23.useEffect)(() => {
25770
25873
  stampBridgeVersionOnDocument();
25771
25874
  }, []);
25772
- (0, import_react21.useEffect)(() => {
25875
+ (0, import_react23.useEffect)(() => {
25773
25876
  if (isEditMode) return;
25774
25877
  return armLoaderHangBeacon(subdomain, fetchState);
25775
25878
  }, [isEditMode, subdomain, fetchState]);
25776
- (0, import_react21.useEffect)(() => {
25879
+ (0, import_react23.useEffect)(() => {
25777
25880
  if (isEditMode || !subdomain) return;
25778
25881
  const onError = (event) => {
25779
25882
  reportOutageBeacon({
@@ -25794,40 +25897,40 @@ function OhhwellsBridge() {
25794
25897
  window.removeEventListener("unhandledrejection", onRejection);
25795
25898
  };
25796
25899
  }, [isEditMode, subdomain]);
25797
- const activeElRef = (0, import_react21.useRef)(null);
25798
- const pointerHeldRef = (0, import_react21.useRef)(false);
25799
- const selectedElRef = (0, import_react21.useRef)(null);
25800
- const selectedHrefKeyRef = (0, import_react21.useRef)(null);
25801
- const selectedFooterColAttrRef = (0, import_react21.useRef)(null);
25802
- const footerHeadingTitleCacheRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25803
- const originalContentRef = (0, import_react21.useRef)(null);
25804
- const activeStateElRef = (0, import_react21.useRef)(null);
25805
- const parentScrollRef = (0, import_react21.useRef)(null);
25806
- const visibleViewportRef = (0, import_react21.useRef)(null);
25807
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react21.useState)(null);
25808
- const attachVisibleViewport = (0, import_react21.useCallback)((node) => {
25900
+ const activeElRef = (0, import_react23.useRef)(null);
25901
+ const pointerHeldRef = (0, import_react23.useRef)(false);
25902
+ const selectedElRef = (0, import_react23.useRef)(null);
25903
+ const selectedHrefKeyRef = (0, import_react23.useRef)(null);
25904
+ const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
25905
+ const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25906
+ const originalContentRef = (0, import_react23.useRef)(null);
25907
+ const activeStateElRef = (0, import_react23.useRef)(null);
25908
+ const parentScrollRef = (0, import_react23.useRef)(null);
25909
+ const visibleViewportRef = (0, import_react23.useRef)(null);
25910
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
25911
+ const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
25809
25912
  visibleViewportRef.current = node;
25810
25913
  setDialogPortalContainer(node);
25811
25914
  if (node) applyVisibleViewport(node, parentScrollRef.current);
25812
25915
  }, []);
25813
- const toolbarElRef = (0, import_react21.useRef)(null);
25814
- const glowElRef = (0, import_react21.useRef)(null);
25815
- const hoveredImageRef = (0, import_react21.useRef)(null);
25816
- const hoveredImageHasTextOverlapRef = (0, import_react21.useRef)(false);
25817
- const dragOverElRef = (0, import_react21.useRef)(null);
25818
- const [mediaHover, setMediaHover] = (0, import_react21.useState)(null);
25819
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react21.useState)(null);
25820
- const selectedAiSectionIdRef = (0, import_react21.useRef)(null);
25821
- const handleAiSectionSelectionChange = (0, import_react21.useCallback)((id) => {
25916
+ const toolbarElRef = (0, import_react23.useRef)(null);
25917
+ const glowElRef = (0, import_react23.useRef)(null);
25918
+ const hoveredImageRef = (0, import_react23.useRef)(null);
25919
+ const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
25920
+ const dragOverElRef = (0, import_react23.useRef)(null);
25921
+ const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
25922
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
25923
+ const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
25924
+ const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
25822
25925
  selectedAiSectionIdRef.current = id;
25823
25926
  setSelectedAiSectionId(id);
25824
25927
  }, []);
25825
- const [selectedMedia, setSelectedMedia] = (0, import_react21.useState)(null);
25826
- const selectedMediaElRef = (0, import_react21.useRef)(null);
25827
- const mediaKeyDropTokenRef = (0, import_react21.useRef)(0);
25828
- const selectedIconElRef = (0, import_react21.useRef)(null);
25829
- const selectedSocialElRef = (0, import_react21.useRef)(null);
25830
- const queueSectionKeyDrop = (0, import_react21.useCallback)((prev) => {
25928
+ const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
25929
+ const selectedMediaElRef = (0, import_react23.useRef)(null);
25930
+ const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
25931
+ const selectedIconElRef = (0, import_react23.useRef)(null);
25932
+ const selectedSocialElRef = (0, import_react23.useRef)(null);
25933
+ const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
25831
25934
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
25832
25935
  if (!sectionEl) return;
25833
25936
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -25848,31 +25951,31 @@ function OhhwellsBridge() {
25848
25951
  window.addEventListener("message", onQueueDrained);
25849
25952
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
25850
25953
  }, []);
25851
- const clearMediaSelection = (0, import_react21.useCallback)(() => {
25954
+ const clearMediaSelection = (0, import_react23.useCallback)(() => {
25852
25955
  const prev = selectedMediaElRef.current;
25853
25956
  selectedMediaElRef.current = null;
25854
25957
  setSelectedMedia(null);
25855
25958
  queueSectionKeyDrop(prev);
25856
25959
  }, [queueSectionKeyDrop]);
25857
- const clearMediaSelectionRef = (0, import_react21.useRef)(clearMediaSelection);
25960
+ const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
25858
25961
  clearMediaSelectionRef.current = clearMediaSelection;
25859
- const clearIconSelection = (0, import_react21.useCallback)(() => {
25962
+ const clearIconSelection = (0, import_react23.useCallback)(() => {
25860
25963
  const prev = selectedIconElRef.current;
25861
25964
  if (!prev) return;
25862
25965
  selectedIconElRef.current = null;
25863
25966
  queueSectionKeyDrop(prev);
25864
25967
  }, [queueSectionKeyDrop]);
25865
- const clearIconSelectionRef = (0, import_react21.useRef)(clearIconSelection);
25968
+ const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
25866
25969
  clearIconSelectionRef.current = clearIconSelection;
25867
- const clearSocialSelection = (0, import_react21.useCallback)(() => {
25970
+ const clearSocialSelection = (0, import_react23.useCallback)(() => {
25868
25971
  const prev = selectedSocialElRef.current;
25869
25972
  if (!prev) return;
25870
25973
  selectedSocialElRef.current = null;
25871
25974
  queueSectionKeyDrop(prev);
25872
25975
  }, [queueSectionKeyDrop]);
25873
- const clearSocialSelectionRef = (0, import_react21.useRef)(clearSocialSelection);
25976
+ const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
25874
25977
  clearSocialSelectionRef.current = clearSocialSelection;
25875
- const selectIconElement = (0, import_react21.useCallback)((el) => {
25978
+ const selectIconElement = (0, import_react23.useCallback)((el) => {
25876
25979
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
25877
25980
  selectedIconElRef.current = el;
25878
25981
  const sectionEl = el.closest("[data-ohw-section]");
@@ -25885,9 +25988,9 @@ function OhhwellsBridge() {
25885
25988
  keyLabel: "Icon"
25886
25989
  });
25887
25990
  }, []);
25888
- const selectIconElementRef = (0, import_react21.useRef)(selectIconElement);
25991
+ const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
25889
25992
  selectIconElementRef.current = selectIconElement;
25890
- const selectMediaElement = (0, import_react21.useCallback)((el) => {
25993
+ const selectMediaElement = (0, import_react23.useCallback)((el) => {
25891
25994
  const r2 = el.getBoundingClientRect();
25892
25995
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
25893
25996
  selectedIconElRef.current = null;
@@ -25912,9 +26015,9 @@ function OhhwellsBridge() {
25912
26015
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
25913
26016
  });
25914
26017
  }, []);
25915
- const selectMediaElementRef = (0, import_react21.useRef)(selectMediaElement);
26018
+ const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
25916
26019
  selectMediaElementRef.current = selectMediaElement;
25917
- (0, import_react21.useEffect)(() => {
26020
+ (0, import_react23.useEffect)(() => {
25918
26021
  if (!selectedMedia) return;
25919
26022
  const update = () => {
25920
26023
  const el = selectedMediaElRef.current;
@@ -25934,54 +26037,54 @@ function OhhwellsBridge() {
25934
26037
  window.removeEventListener("resize", update);
25935
26038
  };
25936
26039
  }, [selectedMedia !== null]);
25937
- const [carouselHover, setCarouselHover] = (0, import_react21.useState)(null);
25938
- const [uploadingRects, setUploadingRects] = (0, import_react21.useState)({});
25939
- const hoveredGapRef = (0, import_react21.useRef)(null);
25940
- const imageUnhoverTimerRef = (0, import_react21.useRef)(null);
25941
- const imageShowTimerRef = (0, import_react21.useRef)(null);
25942
- const editStylesRef = (0, import_react21.useRef)(null);
25943
- const activateRef = (0, import_react21.useRef)(() => {
26040
+ const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
26041
+ const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
26042
+ const hoveredGapRef = (0, import_react23.useRef)(null);
26043
+ const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
26044
+ const imageShowTimerRef = (0, import_react23.useRef)(null);
26045
+ const editStylesRef = (0, import_react23.useRef)(null);
26046
+ const activateRef = (0, import_react23.useRef)(() => {
25944
26047
  });
25945
- const deactivateRef = (0, import_react21.useRef)(() => {
26048
+ const deactivateRef = (0, import_react23.useRef)(() => {
25946
26049
  });
25947
- const selectRef = (0, import_react21.useRef)(() => {
26050
+ const selectRef = (0, import_react23.useRef)(() => {
25948
26051
  });
25949
- const selectFrameRef = (0, import_react21.useRef)(() => {
26052
+ const selectFrameRef = (0, import_react23.useRef)(() => {
25950
26053
  });
25951
- const selectLogoRef = (0, import_react21.useRef)(() => {
26054
+ const selectLogoRef = (0, import_react23.useRef)(() => {
25952
26055
  });
25953
- const openLogoSizePanelRef = (0, import_react21.useRef)(() => {
26056
+ const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
25954
26057
  });
25955
- const deselectRef = (0, import_react21.useRef)(() => {
26058
+ const deselectRef = (0, import_react23.useRef)(() => {
25956
26059
  });
25957
- const closeFloatingPanelOnlyRef = (0, import_react21.useRef)(() => {
26060
+ const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
25958
26061
  });
25959
- const reselectNavigationItemRef = (0, import_react21.useRef)(() => {
26062
+ const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
25960
26063
  });
25961
- const commitNavigationTextEditRef = (0, import_react21.useRef)(() => {
26064
+ const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
25962
26065
  });
25963
- const handleDeleteSelectedRef = (0, import_react21.useRef)(() => false);
25964
- const runPendingDeleteUndoRef = (0, import_react21.useRef)(() => false);
25965
- const isFooterFrameSelectionRef = (0, import_react21.useRef)(false);
25966
- const refreshActiveCommandsRef = (0, import_react21.useRef)(() => {
26066
+ const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
26067
+ const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
26068
+ const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
26069
+ const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
25967
26070
  });
25968
- const postToParentRef = (0, import_react21.useRef)(postToParent2);
26071
+ const postToParentRef = (0, import_react23.useRef)(postToParent2);
25969
26072
  postToParentRef.current = postToParent2;
25970
- const aiSectionApiRef = (0, import_react21.useRef)(null);
25971
- const sectionsLoadedRef = (0, import_react21.useRef)(false);
25972
- const pendingScheduleConfigRequests = (0, import_react21.useRef)([]);
25973
- const [toolbarRect, setToolbarRect] = (0, import_react21.useState)(null);
25974
- const [formPickRect, setFormPickRect] = (0, import_react21.useState)(null);
25975
- const formPickElRef = (0, import_react21.useRef)(null);
25976
- const [formViewState, setFormViewStateUi] = (0, import_react21.useState)("default");
25977
- const [formPickCount, setFormPickCount] = (0, import_react21.useState)(null);
25978
- const [formHoverRect, setFormHoverRect] = (0, import_react21.useState)(null);
25979
- const formHoverElRef = (0, import_react21.useRef)(null);
25980
- const [fieldPickRect, setFieldPickRect] = (0, import_react21.useState)(null);
25981
- const fieldPickElRef = (0, import_react21.useRef)(null);
25982
- const [fieldPickState, setFieldPickState] = (0, import_react21.useState)(null);
25983
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react21.useState)(false);
25984
- const clearFormPick = (0, import_react21.useCallback)(() => {
26073
+ const aiSectionApiRef = (0, import_react23.useRef)(null);
26074
+ const sectionsLoadedRef = (0, import_react23.useRef)(false);
26075
+ const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
26076
+ const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
26077
+ const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
26078
+ const formPickElRef = (0, import_react23.useRef)(null);
26079
+ const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
26080
+ const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
26081
+ const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
26082
+ const formHoverElRef = (0, import_react23.useRef)(null);
26083
+ const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
26084
+ const fieldPickElRef = (0, import_react23.useRef)(null);
26085
+ const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
26086
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
26087
+ const clearFormPick = (0, import_react23.useCallback)(() => {
25985
26088
  const form = formPickElRef.current;
25986
26089
  const editing = fieldPickElRef.current;
25987
26090
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26001,7 +26104,7 @@ function OhhwellsBridge() {
26001
26104
  formPickElRef.current = null;
26002
26105
  setFormPickRect(null);
26003
26106
  }, []);
26004
- const clearFieldPick = (0, import_react21.useCallback)(() => {
26107
+ const clearFieldPick = (0, import_react23.useCallback)(() => {
26005
26108
  const wrapper = fieldPickElRef.current;
26006
26109
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26007
26110
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26011,9 +26114,9 @@ function OhhwellsBridge() {
26011
26114
  setFieldPickRect(null);
26012
26115
  setFieldPickState(null);
26013
26116
  }, []);
26014
- const persistFieldsRef = (0, import_react21.useRef)(() => {
26117
+ const persistFieldsRef = (0, import_react23.useRef)(() => {
26015
26118
  });
26016
- const persistFields = (0, import_react21.useCallback)(
26119
+ const persistFields = (0, import_react23.useCallback)(
26017
26120
  (form) => {
26018
26121
  const key = formKeyOf(form);
26019
26122
  if (!key) return;
@@ -26024,7 +26127,7 @@ function OhhwellsBridge() {
26024
26127
  []
26025
26128
  );
26026
26129
  persistFieldsRef.current = persistFields;
26027
- const selectField = (0, import_react21.useCallback)((wrapper) => {
26130
+ const selectField = (0, import_react23.useCallback)((wrapper) => {
26028
26131
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26029
26132
  commitPlaceholderEdit(fieldPickElRef.current);
26030
26133
  }
@@ -26037,7 +26140,7 @@ function OhhwellsBridge() {
26037
26140
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26038
26141
  setFieldTypePickerOpen(false);
26039
26142
  }, []);
26040
- const withSelectedField = (0, import_react21.useCallback)(
26143
+ const withSelectedField = (0, import_react23.useCallback)(
26041
26144
  (run) => {
26042
26145
  const wrapper = fieldPickElRef.current;
26043
26146
  const form = formPickElRef.current;
@@ -26050,28 +26153,28 @@ function OhhwellsBridge() {
26050
26153
  },
26051
26154
  [persistFields]
26052
26155
  );
26053
- const handleFieldTypeChange = (0, import_react21.useCallback)(
26156
+ const handleFieldTypeChange = (0, import_react23.useCallback)(
26054
26157
  (type) => withSelectedField((_form, wrapper) => {
26055
26158
  applyFieldType(wrapper, type);
26056
26159
  selectField(wrapper);
26057
26160
  }),
26058
26161
  [selectField, withSelectedField]
26059
26162
  );
26060
- const handleFieldRequiredToggle = (0, import_react21.useCallback)(
26163
+ const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26061
26164
  () => withSelectedField((_form, wrapper) => {
26062
26165
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26063
26166
  selectField(wrapper);
26064
26167
  }),
26065
26168
  [selectField, withSelectedField]
26066
26169
  );
26067
- const handleFieldDuplicate = (0, import_react21.useCallback)(
26170
+ const handleFieldDuplicate = (0, import_react23.useCallback)(
26068
26171
  () => withSelectedField((form, wrapper) => {
26069
26172
  const copy = duplicateField(form, wrapper);
26070
26173
  selectField(copy);
26071
26174
  }),
26072
26175
  [selectField, withSelectedField]
26073
26176
  );
26074
- const handleFieldDelete = (0, import_react21.useCallback)(
26177
+ const handleFieldDelete = (0, import_react23.useCallback)(
26075
26178
  () => withSelectedField((_form, wrapper) => {
26076
26179
  removeField(wrapper);
26077
26180
  clearFieldPick();
@@ -26079,7 +26182,7 @@ function OhhwellsBridge() {
26079
26182
  }),
26080
26183
  [clearFieldPick, withSelectedField]
26081
26184
  );
26082
- const handleAddField = (0, import_react21.useCallback)(
26185
+ const handleAddField = (0, import_react23.useCallback)(
26083
26186
  (type) => {
26084
26187
  const form = formPickElRef.current;
26085
26188
  if (!form) return;
@@ -26095,8 +26198,8 @@ function OhhwellsBridge() {
26095
26198
  },
26096
26199
  [persistFields, selectField]
26097
26200
  );
26098
- const fieldDragRef = (0, import_react21.useRef)(null);
26099
- const buildFieldDropSlots = (0, import_react21.useCallback)((form, draggedKey) => {
26201
+ const fieldDragRef = (0, import_react23.useRef)(null);
26202
+ const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26100
26203
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26101
26204
  const slots = others.map((el) => {
26102
26205
  const rect = el.getBoundingClientRect();
@@ -26109,7 +26212,7 @@ function OhhwellsBridge() {
26109
26212
  }
26110
26213
  return slots;
26111
26214
  }, []);
26112
- const handleFieldDragStart = (0, import_react21.useCallback)(() => {
26215
+ const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26113
26216
  const wrapper = fieldPickElRef.current;
26114
26217
  const form = formPickElRef.current;
26115
26218
  if (!wrapper || !form) return;
@@ -26118,18 +26221,18 @@ function OhhwellsBridge() {
26118
26221
  setFieldDragging(true);
26119
26222
  setFieldDropSlots(buildFieldDropSlots(form, key));
26120
26223
  }, [buildFieldDropSlots]);
26121
- const handleFieldDragEnd = (0, import_react21.useCallback)(() => {
26224
+ const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26122
26225
  fieldDragRef.current = null;
26123
26226
  setFieldDropIndex(null);
26124
26227
  setFieldDropSlots([]);
26125
26228
  setFieldDragging(false);
26126
26229
  }, []);
26127
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react21.useState)(null);
26128
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react21.useState)([]);
26129
- const [fieldDragging, setFieldDragging] = (0, import_react21.useState)(false);
26130
- const clearFormPickRef = (0, import_react21.useRef)(clearFormPick);
26230
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
26231
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
26232
+ const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
26233
+ const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
26131
26234
  clearFormPickRef.current = clearFormPick;
26132
- (0, import_react21.useEffect)(() => {
26235
+ (0, import_react23.useEffect)(() => {
26133
26236
  const el = fieldPickElRef.current;
26134
26237
  if (!el || fieldPickRect === null) return;
26135
26238
  const observer = new ResizeObserver(() => {
@@ -26138,7 +26241,7 @@ function OhhwellsBridge() {
26138
26241
  observer.observe(el);
26139
26242
  return () => observer.disconnect();
26140
26243
  }, [fieldPickRect !== null, fieldPickState]);
26141
- (0, import_react21.useEffect)(() => {
26244
+ (0, import_react23.useEffect)(() => {
26142
26245
  const el = formPickElRef.current;
26143
26246
  if (!el || formPickRect === null) return;
26144
26247
  const observer = new ResizeObserver(() => {
@@ -26147,25 +26250,25 @@ function OhhwellsBridge() {
26147
26250
  observer.observe(el);
26148
26251
  return () => observer.disconnect();
26149
26252
  }, [formPickRect !== null, formViewState]);
26150
- const [toolbarVariant, setToolbarVariant] = (0, import_react21.useState)("none");
26151
- const toolbarVariantRef = (0, import_react21.useRef)("none");
26253
+ const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26254
+ const toolbarVariantRef = (0, import_react23.useRef)("none");
26152
26255
  toolbarVariantRef.current = toolbarVariant;
26153
- const [selectedIsCta, setSelectedIsCta] = (0, import_react21.useState)(false);
26154
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react21.useState)(false);
26155
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react21.useState)(false);
26156
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react21.useState)(null);
26157
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react21.useState)(false);
26158
- const [toggleState, setToggleState] = (0, import_react21.useState)(null);
26159
- const [maxBadge, setMaxBadge] = (0, import_react21.useState)(null);
26160
- const [activeCommands, setActiveCommands] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
26161
- const [sectionGap, setSectionGap] = (0, import_react21.useState)(null);
26162
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react21.useState)(false);
26163
- const hoveredNavContainerRef = (0, import_react21.useRef)(null);
26164
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react21.useState)(null);
26165
- const hoveredItemElRef = (0, import_react21.useRef)(null);
26166
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react21.useState)(null);
26167
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react21.useState)(null);
26168
- (0, import_react21.useEffect)(() => {
26256
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
26257
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
26258
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
26259
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
26260
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
26261
+ const [toggleState, setToggleState] = (0, import_react23.useState)(null);
26262
+ const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
26263
+ const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
26264
+ const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
26265
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
26266
+ const hoveredNavContainerRef = (0, import_react23.useRef)(null);
26267
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
26268
+ const hoveredItemElRef = (0, import_react23.useRef)(null);
26269
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
26270
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
26271
+ (0, import_react23.useEffect)(() => {
26169
26272
  const sync = () => {
26170
26273
  const el = document.querySelector(
26171
26274
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26209,63 +26312,63 @@ function OhhwellsBridge() {
26209
26312
  });
26210
26313
  return () => observer.disconnect();
26211
26314
  }, []);
26212
- const siblingHintElRef = (0, import_react21.useRef)(null);
26213
- const [siblingHintRect, setSiblingHintRect] = (0, import_react21.useState)(null);
26214
- const [siblingHintRects, setSiblingHintRects] = (0, import_react21.useState)([]);
26215
- const [isItemDragging, setIsItemDragging] = (0, import_react21.useState)(false);
26216
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react21.useState)(false);
26315
+ const siblingHintElRef = (0, import_react23.useRef)(null);
26316
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
26317
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
26318
+ const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
26319
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
26217
26320
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26218
- const [floatingPanel, setFloatingPanel] = (0, import_react21.useState)(null);
26219
- const floatingPanelOpenRef = (0, import_react21.useRef)(false);
26321
+ const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26322
+ const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26220
26323
  floatingPanelOpenRef.current = floatingPanel !== null;
26221
- const floatingPanelRef = (0, import_react21.useRef)(null);
26324
+ const floatingPanelRef = (0, import_react23.useRef)(null);
26222
26325
  floatingPanelRef.current = floatingPanel;
26223
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react21.useState)(null);
26224
- const buttonCollectionDragRef = (0, import_react21.useRef)(null);
26225
- const buttonDropInsertIndexRef = (0, import_react21.useRef)(null);
26226
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react21.useState)([]);
26227
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react21.useState)(null);
26228
- const buttonPointerDragRef = (0, import_react21.useRef)(null);
26229
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react21.useState)(0);
26230
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react21.useState)(null);
26231
- const [editorViewport, setEditorViewport] = (0, import_react21.useState)("desktop");
26232
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react21.useState)(null);
26233
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react21.useState)(null);
26234
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react21.useState)(null);
26235
- const footerDragRef = (0, import_react21.useRef)(null);
26236
- const [footerDropSlots, setFooterDropSlots] = (0, import_react21.useState)([]);
26237
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react21.useState)(null);
26238
- const [draggedItemRect, setDraggedItemRect] = (0, import_react21.useState)(null);
26239
- const footerPointerDragRef = (0, import_react21.useRef)(null);
26240
- const suppressNextClickRef = (0, import_react21.useRef)(false);
26241
- const suppressClickUntilRef = (0, import_react21.useRef)(0);
26242
- const [linkPopover, setLinkPopover] = (0, import_react21.useState)(null);
26243
- const linkPopoverSessionRef = (0, import_react21.useRef)(null);
26244
- const addNavAfterAnchorRef = (0, import_react21.useRef)(null);
26245
- const editContentRef = (0, import_react21.useRef)({});
26246
- const aiSectionsRef = (0, import_react21.useRef)("");
26247
- const aiFooterRef = (0, import_react21.useRef)("");
26248
- const applyTreeLocalRef = (0, import_react21.useRef)(
26326
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
26327
+ const buttonCollectionDragRef = (0, import_react23.useRef)(null);
26328
+ const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
26329
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
26330
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
26331
+ const buttonPointerDragRef = (0, import_react23.useRef)(null);
26332
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
26333
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
26334
+ const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
26335
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
26336
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
26337
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
26338
+ const footerDragRef = (0, import_react23.useRef)(null);
26339
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
26340
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
26341
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
26342
+ const footerPointerDragRef = (0, import_react23.useRef)(null);
26343
+ const suppressNextClickRef = (0, import_react23.useRef)(false);
26344
+ const suppressClickUntilRef = (0, import_react23.useRef)(0);
26345
+ const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
26346
+ const linkPopoverSessionRef = (0, import_react23.useRef)(null);
26347
+ const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
26348
+ const editContentRef = (0, import_react23.useRef)({});
26349
+ const aiSectionsRef = (0, import_react23.useRef)("");
26350
+ const aiFooterRef = (0, import_react23.useRef)("");
26351
+ const applyTreeLocalRef = (0, import_react23.useRef)(
26249
26352
  null
26250
26353
  );
26251
- const applyFooterTreeLocalRef = (0, import_react21.useRef)(null);
26252
- const clearInteractionChromeRef = (0, import_react21.useRef)(() => {
26354
+ const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26355
+ const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26253
26356
  });
26254
- const brandKitRef = (0, import_react21.useRef)("");
26255
- const stylesRef = (0, import_react21.useRef)("");
26256
- const appliedDrawerRef = (0, import_react21.useRef)(null);
26257
- const pendingDeleteUndoRef = (0, import_react21.useRef)(null);
26258
- const [sitePages, setSitePages] = (0, import_react21.useState)([]);
26259
- const collectionItemsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
26260
- const [sectionsByPath, setSectionsByPath] = (0, import_react21.useState)({});
26261
- const sectionsPrefetchGenRef = (0, import_react21.useRef)(0);
26262
- const setLinkPopoverRef = (0, import_react21.useRef)(setLinkPopover);
26263
- const linkPopoverPanelRef = (0, import_react21.useRef)(null);
26264
- const linkPopoverOpenRef = (0, import_react21.useRef)(false);
26265
- const linkPopoverGraceUntilRef = (0, import_react21.useRef)(0);
26357
+ const brandKitRef = (0, import_react23.useRef)("");
26358
+ const stylesRef = (0, import_react23.useRef)("");
26359
+ const appliedDrawerRef = (0, import_react23.useRef)(null);
26360
+ const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
26361
+ const [sitePages, setSitePages] = (0, import_react23.useState)([]);
26362
+ const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26363
+ const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
26364
+ const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
26365
+ const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
26366
+ const linkPopoverPanelRef = (0, import_react23.useRef)(null);
26367
+ const linkPopoverOpenRef = (0, import_react23.useRef)(false);
26368
+ const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
26266
26369
  setLinkPopoverRef.current = setLinkPopover;
26267
26370
  linkPopoverSessionRef.current = linkPopover;
26268
- (0, import_react21.useEffect)(() => {
26371
+ (0, import_react23.useEffect)(() => {
26269
26372
  setSectionOrderPersistHandler((entries) => {
26270
26373
  const currentPath = window.location.pathname;
26271
26374
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26275,7 +26378,7 @@ function OhhwellsBridge() {
26275
26378
  });
26276
26379
  return () => setSectionOrderPersistHandler(null);
26277
26380
  }, []);
26278
- (0, import_react21.useEffect)(() => {
26381
+ (0, import_react23.useEffect)(() => {
26279
26382
  setAiFooterMountOptions({
26280
26383
  resolvePageHref: (pageOrAnchorId) => {
26281
26384
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26338,7 +26441,7 @@ function OhhwellsBridge() {
26338
26441
  const bumpLinkPopoverGrace = () => {
26339
26442
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26340
26443
  };
26341
- const runSectionsPrefetch = (0, import_react21.useCallback)((pages) => {
26444
+ const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26342
26445
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26343
26446
  const gen = ++sectionsPrefetchGenRef.current;
26344
26447
  const paths = pages.map((p) => p.path);
@@ -26357,9 +26460,9 @@ function OhhwellsBridge() {
26357
26460
  );
26358
26461
  });
26359
26462
  }, [isEditMode, pathname]);
26360
- const runSectionsPrefetchRef = (0, import_react21.useRef)(runSectionsPrefetch);
26463
+ const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26361
26464
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26362
- (0, import_react21.useEffect)(() => {
26465
+ (0, import_react23.useEffect)(() => {
26363
26466
  if (!linkPopover) {
26364
26467
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26365
26468
  return;
@@ -26387,7 +26490,7 @@ function OhhwellsBridge() {
26387
26490
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26388
26491
  };
26389
26492
  }, [linkPopover, postToParent2]);
26390
- (0, import_react21.useEffect)(() => {
26493
+ (0, import_react23.useEffect)(() => {
26391
26494
  if (!isEditMode) return;
26392
26495
  const useFixtures = shouldUseDevFixtures();
26393
26496
  if (useFixtures) {
@@ -26413,14 +26516,14 @@ function OhhwellsBridge() {
26413
26516
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26414
26517
  return () => window.removeEventListener("message", onSitePages);
26415
26518
  }, [isEditMode, postToParent2]);
26416
- (0, import_react21.useEffect)(() => {
26519
+ (0, import_react23.useEffect)(() => {
26417
26520
  if (!isEditMode || shouldUseDevFixtures()) return;
26418
26521
  void loadAllSectionsManifest().then((manifest) => {
26419
26522
  if (Object.keys(manifest).length === 0) return;
26420
26523
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26421
26524
  });
26422
26525
  }, [isEditMode]);
26423
- (0, import_react21.useEffect)(() => {
26526
+ (0, import_react23.useEffect)(() => {
26424
26527
  const update = () => {
26425
26528
  const el = activeElRef.current ?? selectedElRef.current;
26426
26529
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26444,10 +26547,10 @@ function OhhwellsBridge() {
26444
26547
  vvp.removeEventListener("resize", update);
26445
26548
  };
26446
26549
  }, []);
26447
- const refreshStateRules = (0, import_react21.useCallback)(() => {
26550
+ const refreshStateRules = (0, import_react23.useCallback)(() => {
26448
26551
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26449
26552
  }, []);
26450
- const processConfigRequest = (0, import_react21.useCallback)((insertAfterVal) => {
26553
+ const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
26451
26554
  const tracker = getSectionsTracker();
26452
26555
  let entries = [];
26453
26556
  try {
@@ -26470,7 +26573,7 @@ function OhhwellsBridge() {
26470
26573
  }
26471
26574
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26472
26575
  }, [isEditMode]);
26473
- const deactivate = (0, import_react21.useCallback)(() => {
26576
+ const deactivate = (0, import_react23.useCallback)(() => {
26474
26577
  const el = activeElRef.current;
26475
26578
  if (!el) return;
26476
26579
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26536,12 +26639,12 @@ function OhhwellsBridge() {
26536
26639
  setToolbarShowEditLink(false);
26537
26640
  postToParent2({ type: "ow:exit-edit" });
26538
26641
  }, [postToParent2]);
26539
- const clearSelectedAttr = (0, import_react21.useCallback)(() => {
26642
+ const clearSelectedAttr = (0, import_react23.useCallback)(() => {
26540
26643
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26541
26644
  el.removeAttribute("data-ohw-selected");
26542
26645
  });
26543
26646
  }, []);
26544
- const deselect = (0, import_react21.useCallback)(() => {
26647
+ const deselect = (0, import_react23.useCallback)(() => {
26545
26648
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26546
26649
  clearSelectedAttr();
26547
26650
  selectedElRef.current = null;
@@ -26577,20 +26680,20 @@ function OhhwellsBridge() {
26577
26680
  setToolbarVariant("none");
26578
26681
  }
26579
26682
  }, [clearSelectedAttr]);
26580
- const markSelected = (0, import_react21.useCallback)((el) => {
26683
+ const markSelected = (0, import_react23.useCallback)((el) => {
26581
26684
  clearSelectedAttr();
26582
26685
  el.removeAttribute("data-ohw-hovered");
26583
26686
  el.setAttribute("data-ohw-selected", "");
26584
26687
  }, [clearSelectedAttr]);
26585
- const isSelectedForHover = (0, import_react21.useCallback)((el) => {
26688
+ const isSelectedForHover = (0, import_react23.useCallback)((el) => {
26586
26689
  if (!el) return false;
26587
26690
  return [selectedElRef.current, activeElRef.current].some(
26588
26691
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26589
26692
  );
26590
26693
  }, []);
26591
- const isSelectedForHoverRef = (0, import_react21.useRef)(isSelectedForHover);
26694
+ const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
26592
26695
  isSelectedForHoverRef.current = isSelectedForHover;
26593
- const resolveHrefKeyElement = (0, import_react21.useCallback)((hrefKey) => {
26696
+ const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
26594
26697
  if (isFooterHrefKey(hrefKey)) {
26595
26698
  return document.querySelector(
26596
26699
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26605,7 +26708,7 @@ function OhhwellsBridge() {
26605
26708
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26606
26709
  );
26607
26710
  }, []);
26608
- const resyncSelectedNavigationItem = (0, import_react21.useCallback)(() => {
26711
+ const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
26609
26712
  const hrefKey = selectedHrefKeyRef.current;
26610
26713
  if (hrefKey) {
26611
26714
  const link = resolveHrefKeyElement(hrefKey);
@@ -26643,7 +26746,7 @@ function OhhwellsBridge() {
26643
26746
  );
26644
26747
  }
26645
26748
  }, [resolveHrefKeyElement]);
26646
- const reselectNavigationItem = (0, import_react21.useCallback)((navAnchor) => {
26749
+ const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
26647
26750
  selectedElRef.current = navAnchor;
26648
26751
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26649
26752
  selectedFooterColAttrRef.current = null;
@@ -26674,7 +26777,7 @@ function OhhwellsBridge() {
26674
26777
  setToolbarShowEditLink(false);
26675
26778
  setActiveCommands(/* @__PURE__ */ new Set());
26676
26779
  }, [markSelected]);
26677
- const commitNavigationTextEdit = (0, import_react21.useCallback)((navAnchor) => {
26780
+ const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
26678
26781
  const el = activeElRef.current;
26679
26782
  if (!el) return;
26680
26783
  const key = el.dataset.ohwKey;
@@ -26707,7 +26810,7 @@ function OhhwellsBridge() {
26707
26810
  postToParent2({ type: "ow:exit-edit" });
26708
26811
  reselectNavigationItem(navAnchor);
26709
26812
  }, [postToParent2, reselectNavigationItem]);
26710
- const handleAddTopLevelNavItem = (0, import_react21.useCallback)(() => {
26813
+ const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
26711
26814
  const items = listNavbarRootItems();
26712
26815
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26713
26816
  deselectRef.current();
@@ -26719,7 +26822,7 @@ function OhhwellsBridge() {
26719
26822
  intent: "add-nav"
26720
26823
  });
26721
26824
  }, []);
26722
- const maybeWarnNavLinkDropdownConflict = (0, import_react21.useCallback)(
26825
+ const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
26723
26826
  (anchor) => {
26724
26827
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26725
26828
  if (!navDropdownsOpenOnClick()) return;
@@ -26732,7 +26835,7 @@ function OhhwellsBridge() {
26732
26835
  },
26733
26836
  [postToParent2]
26734
26837
  );
26735
- const handleNavDropdownOpenChange = (0, import_react21.useCallback)((open) => {
26838
+ const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
26736
26839
  const selected = selectedElRef.current;
26737
26840
  if (!selected || !isNavigationItem2(selected)) return;
26738
26841
  if (isNestedNavChild(selected)) return;
@@ -26748,7 +26851,7 @@ function OhhwellsBridge() {
26748
26851
  }
26749
26852
  });
26750
26853
  }, []);
26751
- const handleFooterHeadingVisibleChange = (0, import_react21.useCallback)(
26854
+ const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
26752
26855
  (visible) => {
26753
26856
  const selected = selectedElRef.current;
26754
26857
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -26801,7 +26904,7 @@ function OhhwellsBridge() {
26801
26904
  },
26802
26905
  [postToParent2]
26803
26906
  );
26804
- const enterEditOnNewItem = (0, import_react21.useCallback)((anchor) => {
26907
+ const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
26805
26908
  const label = anchor.querySelector('[data-ohw-editable="text"]');
26806
26909
  if (!label) {
26807
26910
  selectRef.current(anchor);
@@ -26810,8 +26913,8 @@ function OhhwellsBridge() {
26810
26913
  setNavGroupForceOpen(anchor, true);
26811
26914
  activateRef.current(label);
26812
26915
  }, []);
26813
- const pendingSocialAddRef = (0, import_react21.useRef)(null);
26814
- const handleAddChildItem = (0, import_react21.useCallback)(() => {
26916
+ const pendingSocialAddRef = (0, import_react23.useRef)(null);
26917
+ const handleAddChildItem = (0, import_react23.useCallback)(() => {
26815
26918
  const selected = selectedElRef.current;
26816
26919
  if (!selected) return;
26817
26920
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -26938,7 +27041,7 @@ function OhhwellsBridge() {
26938
27041
  });
26939
27042
  });
26940
27043
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
26941
- const handleAddFooterColumn = (0, import_react21.useCallback)(() => {
27044
+ const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
26942
27045
  if (document.querySelector("[data-ai-footer]")) {
26943
27046
  const state = parseAiFooterState(aiFooterRef.current);
26944
27047
  if (!state?.tree) return;
@@ -26994,7 +27097,7 @@ function OhhwellsBridge() {
26994
27097
  selectRef.current(result.firstLink);
26995
27098
  });
26996
27099
  }, [postToParent2]);
26997
- const clearFooterDragVisuals = (0, import_react21.useCallback)(() => {
27100
+ const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
26998
27101
  footerDragRef.current = null;
26999
27102
  setSiblingHintRects([]);
27000
27103
  setFooterDropSlots([]);
@@ -27003,7 +27106,7 @@ function OhhwellsBridge() {
27003
27106
  setIsItemDragging(false);
27004
27107
  unlockFooterDragInteraction();
27005
27108
  }, []);
27006
- const refreshFooterDragVisuals = (0, import_react21.useCallback)((session, activeSlot, clientX, clientY) => {
27109
+ const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27007
27110
  const dragged = session.draggedEl;
27008
27111
  setDraggedItemRect(dragged.getBoundingClientRect());
27009
27112
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27035,13 +27138,13 @@ function OhhwellsBridge() {
27035
27138
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27036
27139
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27037
27140
  }, []);
27038
- const refreshFooterDragVisualsRef = (0, import_react21.useRef)(refreshFooterDragVisuals);
27141
+ const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27039
27142
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27040
- const commitFooterDragRef = (0, import_react21.useRef)(() => {
27143
+ const commitFooterDragRef = (0, import_react23.useRef)(() => {
27041
27144
  });
27042
- const beginFooterDragRef = (0, import_react21.useRef)(() => {
27145
+ const beginFooterDragRef = (0, import_react23.useRef)(() => {
27043
27146
  });
27044
- const beginFooterDrag = (0, import_react21.useCallback)(
27147
+ const beginFooterDrag = (0, import_react23.useCallback)(
27045
27148
  (session) => {
27046
27149
  const rect = session.draggedEl.getBoundingClientRect();
27047
27150
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27061,7 +27164,7 @@ function OhhwellsBridge() {
27061
27164
  [refreshFooterDragVisuals]
27062
27165
  );
27063
27166
  beginFooterDragRef.current = beginFooterDrag;
27064
- const commitFooterDrag = (0, import_react21.useCallback)(
27167
+ const commitFooterDrag = (0, import_react23.useCallback)(
27065
27168
  (clientX, clientY) => {
27066
27169
  const session = footerDragRef.current;
27067
27170
  if (!session) {
@@ -27233,7 +27336,7 @@ function OhhwellsBridge() {
27233
27336
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27234
27337
  );
27235
27338
  commitFooterDragRef.current = commitFooterDrag;
27236
- const startFooterLinkDrag = (0, import_react21.useCallback)(
27339
+ const startFooterLinkDrag = (0, import_react23.useCallback)(
27237
27340
  (anchor, clientX, clientY, wasSelected) => {
27238
27341
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27239
27342
  if (!hrefKey) return false;
@@ -27269,7 +27372,7 @@ function OhhwellsBridge() {
27269
27372
  },
27270
27373
  [beginFooterDrag]
27271
27374
  );
27272
- const startFooterColumnDrag = (0, import_react21.useCallback)(
27375
+ const startFooterColumnDrag = (0, import_react23.useCallback)(
27273
27376
  (columnEl, clientX, clientY, wasSelected) => {
27274
27377
  const columns = listFooterColumns(columnEl);
27275
27378
  const idx = columns.indexOf(columnEl);
@@ -27289,7 +27392,7 @@ function OhhwellsBridge() {
27289
27392
  },
27290
27393
  [beginFooterDrag]
27291
27394
  );
27292
- const persistButtonCollectionDrag = (0, import_react21.useCallback)(
27395
+ const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27293
27396
  (button, clientX) => {
27294
27397
  const insertIndex = buttonDropInsertIndexRef.current;
27295
27398
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27313,7 +27416,7 @@ function OhhwellsBridge() {
27313
27416
  },
27314
27417
  [postToParent2]
27315
27418
  );
27316
- const refreshButtonDragVisuals = (0, import_react21.useCallback)((button, clientX, clientY) => {
27419
+ const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27317
27420
  const collection = buttonCollectionOf(button);
27318
27421
  if (!collection) {
27319
27422
  setButtonDropSlots([]);
@@ -27330,7 +27433,7 @@ function OhhwellsBridge() {
27330
27433
  setDraggedItemRect(button.getBoundingClientRect());
27331
27434
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27332
27435
  }, []);
27333
- const handleItemDragStart = (0, import_react21.useCallback)(
27436
+ const handleItemDragStart = (0, import_react23.useCallback)(
27334
27437
  (e) => {
27335
27438
  const selected = selectedElRef.current;
27336
27439
  if (!selected) {
@@ -27361,7 +27464,7 @@ function OhhwellsBridge() {
27361
27464
  },
27362
27465
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27363
27466
  );
27364
- const handleItemDragEnd = (0, import_react21.useCallback)(
27467
+ const handleItemDragEnd = (0, import_react23.useCallback)(
27365
27468
  (e) => {
27366
27469
  const collectionButton = buttonCollectionDragRef.current;
27367
27470
  if (collectionButton) {
@@ -27392,7 +27495,7 @@ function OhhwellsBridge() {
27392
27495
  },
27393
27496
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27394
27497
  );
27395
- const handleItemChromePointerDown = (0, import_react21.useCallback)((e) => {
27498
+ const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27396
27499
  if (e.button !== 0) return;
27397
27500
  const selected = selectedElRef.current;
27398
27501
  if (!selected) return;
@@ -27433,7 +27536,7 @@ function OhhwellsBridge() {
27433
27536
  }
27434
27537
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27435
27538
  }, [armNavPressFromChrome]);
27436
- const handleItemChromeClick = (0, import_react21.useCallback)((clientX, clientY) => {
27539
+ const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
27437
27540
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27438
27541
  suppressNextClickRef.current = false;
27439
27542
  return;
@@ -27446,7 +27549,7 @@ function OhhwellsBridge() {
27446
27549
  }, []);
27447
27550
  reselectNavigationItemRef.current = reselectNavigationItem;
27448
27551
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27449
- const select = (0, import_react21.useCallback)((anchor) => {
27552
+ const select = (0, import_react23.useCallback)((anchor) => {
27450
27553
  if (!isNavigationItem2(anchor)) return;
27451
27554
  if (activeElRef.current) deactivate();
27452
27555
  clearSocialSelectionRef.current();
@@ -27523,7 +27626,7 @@ function OhhwellsBridge() {
27523
27626
  setLogoSizeDraft(null);
27524
27627
  }
27525
27628
  }, [deactivate, markSelected]);
27526
- const selectFrame = (0, import_react21.useCallback)((el) => {
27629
+ const selectFrame = (0, import_react23.useCallback)((el) => {
27527
27630
  if (!isNavigationContainer(el)) return;
27528
27631
  if (activeElRef.current) deactivate();
27529
27632
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27564,7 +27667,7 @@ function OhhwellsBridge() {
27564
27667
  setFloatingPanelPos(null);
27565
27668
  setLogoSizeDraft(null);
27566
27669
  }, [deactivate, markSelected, postToParent2]);
27567
- const selectLogo = (0, import_react21.useCallback)(
27670
+ const selectLogo = (0, import_react23.useCallback)(
27568
27671
  (logoEl) => {
27569
27672
  if (activeElRef.current) deactivate();
27570
27673
  selectedElRef.current = logoEl;
@@ -27593,7 +27696,7 @@ function OhhwellsBridge() {
27593
27696
  },
27594
27697
  [deactivate, markSelected]
27595
27698
  );
27596
- const openLogoSizePanel = (0, import_react21.useCallback)((logoEl) => {
27699
+ const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
27597
27700
  const placement = getLogoPlacement(logoEl);
27598
27701
  const draft = readLogoSizeState(editContentRef.current, placement);
27599
27702
  setLogoSizeDraft(draft);
@@ -27606,7 +27709,7 @@ function OhhwellsBridge() {
27606
27709
  placement
27607
27710
  });
27608
27711
  }, []);
27609
- const openSocialsDisplayPanel = (0, import_react21.useCallback)((row) => {
27712
+ const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
27610
27713
  setFloatingPanelPos(null);
27611
27714
  setParentScrollSnap(parentScrollRef.current);
27612
27715
  setFloatingPanel({
@@ -27617,7 +27720,7 @@ function OhhwellsBridge() {
27617
27720
  row
27618
27721
  });
27619
27722
  }, []);
27620
- const rememberButtonTokens = (0, import_react21.useCallback)(
27723
+ const rememberButtonTokens = (0, import_react23.useCallback)(
27621
27724
  (content, tokens, nodes) => {
27622
27725
  if (nodes.length === 0) return content;
27623
27726
  const next = { ...content };
@@ -27628,7 +27731,7 @@ function OhhwellsBridge() {
27628
27731
  },
27629
27732
  [postToParent2]
27630
27733
  );
27631
- const tokensForButton = (0, import_react21.useCallback)(
27734
+ const tokensForButton = (0, import_react23.useCallback)(
27632
27735
  (el, persistFallback = false) => {
27633
27736
  const stored = readStoredStyleTokens(editContentRef.current);
27634
27737
  if (stored) return stored;
@@ -27643,7 +27746,7 @@ function OhhwellsBridge() {
27643
27746
  },
27644
27747
  [rememberButtonTokens]
27645
27748
  );
27646
- const openButtonStylePanel = (0, import_react21.useCallback)(
27749
+ const openButtonStylePanel = (0, import_react23.useCallback)(
27647
27750
  (anchor) => {
27648
27751
  const id = buttonId(anchor);
27649
27752
  if (!id) return;
@@ -27661,7 +27764,7 @@ function OhhwellsBridge() {
27661
27764
  },
27662
27765
  [tokensForButton]
27663
27766
  );
27664
- const applySelectedButtonStyle = (0, import_react21.useCallback)(
27767
+ const applySelectedButtonStyle = (0, import_react23.useCallback)(
27665
27768
  (patch) => {
27666
27769
  const panel = floatingPanelRef.current;
27667
27770
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27679,7 +27782,7 @@ function OhhwellsBridge() {
27679
27782
  },
27680
27783
  [postToParent2]
27681
27784
  );
27682
- (0, import_react21.useEffect)(() => {
27785
+ (0, import_react23.useEffect)(() => {
27683
27786
  const onDragOver = (e) => {
27684
27787
  const dragged = buttonCollectionDragRef.current;
27685
27788
  if (!dragged) return;
@@ -27698,11 +27801,11 @@ function OhhwellsBridge() {
27698
27801
  document.removeEventListener("drop", onDrop);
27699
27802
  };
27700
27803
  }, [refreshButtonDragVisuals]);
27701
- const isEditModeRef = (0, import_react21.useRef)(false);
27702
- const requestMissingSocialIconsRef = (0, import_react21.useRef)(() => {
27804
+ const isEditModeRef = (0, import_react23.useRef)(false);
27805
+ const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
27703
27806
  });
27704
- const askedSocialIconsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
27705
- const requestMissingSocialIcons = (0, import_react21.useCallback)(() => {
27807
+ const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
27808
+ const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
27706
27809
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27707
27810
  const missing = socialsMissingIcons(row);
27708
27811
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27714,7 +27817,7 @@ function OhhwellsBridge() {
27714
27817
  }, []);
27715
27818
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27716
27819
  isEditModeRef.current = isEditMode;
27717
- const changeSocialsDisplay = (0, import_react21.useCallback)(
27820
+ const changeSocialsDisplay = (0, import_react23.useCallback)(
27718
27821
  (row, next) => {
27719
27822
  if (next.icon) {
27720
27823
  const missing = socialsMissingIcons(row);
@@ -27738,19 +27841,19 @@ function OhhwellsBridge() {
27738
27841
  },
27739
27842
  []
27740
27843
  );
27741
- const closeFloatingPanelOnly = (0, import_react21.useCallback)(() => {
27844
+ const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
27742
27845
  setFloatingPanel(null);
27743
27846
  setFloatingPanelPos(null);
27744
27847
  setLogoSizeDraft(null);
27745
27848
  }, []);
27746
27849
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27747
- const closeFloatingPanelAndDeselect = (0, import_react21.useCallback)(() => {
27850
+ const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
27748
27851
  setFloatingPanel(null);
27749
27852
  setFloatingPanelPos(null);
27750
27853
  setLogoSizeDraft(null);
27751
27854
  deselectRef.current();
27752
27855
  }, []);
27753
- (0, import_react21.useEffect)(() => {
27856
+ (0, import_react23.useEffect)(() => {
27754
27857
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27755
27858
  if (!session || !logoSizeDraft) {
27756
27859
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -27769,7 +27872,7 @@ function OhhwellsBridge() {
27769
27872
  max: LOGO_SIZE_MAX
27770
27873
  });
27771
27874
  }, [floatingPanel, logoSizeDraft, editorViewport]);
27772
- const persistLogoSizeDraft = (0, import_react21.useCallback)(
27875
+ const persistLogoSizeDraft = (0, import_react23.useCallback)(
27773
27876
  (placement, draft) => {
27774
27877
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
27775
27878
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -27809,7 +27912,7 @@ function OhhwellsBridge() {
27809
27912
  },
27810
27913
  [postToParent2]
27811
27914
  );
27812
- const activate = (0, import_react21.useCallback)((el, options) => {
27915
+ const activate = (0, import_react23.useCallback)((el, options) => {
27813
27916
  if (activeElRef.current === el) return;
27814
27917
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
27815
27918
  hovered.removeAttribute("data-ohw-hovered");
@@ -27907,8 +28010,8 @@ function OhhwellsBridge() {
27907
28010
  openLogoSizePanelRef.current = openLogoSizePanel;
27908
28011
  deselectRef.current = deselect;
27909
28012
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27910
- const lastSiteWideScopeRef = (0, import_react21.useRef)(null);
27911
- (0, import_react21.useEffect)(() => {
28013
+ const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28014
+ (0, import_react23.useEffect)(() => {
27912
28015
  if (!isEditMode) {
27913
28016
  if (lastSiteWideScopeRef.current !== false) {
27914
28017
  lastSiteWideScopeRef.current = false;
@@ -27934,7 +28037,7 @@ function OhhwellsBridge() {
27934
28037
  isFooterFrameSelection,
27935
28038
  postToParent2
27936
28039
  ]);
27937
- (0, import_react21.useLayoutEffect)(() => {
28040
+ (0, import_react23.useLayoutEffect)(() => {
27938
28041
  if (!subdomain || isEditMode) {
27939
28042
  setFetchState("done");
27940
28043
  return;
@@ -28085,7 +28188,7 @@ function OhhwellsBridge() {
28085
28188
  cancelled = true;
28086
28189
  };
28087
28190
  }, [subdomain, isEditMode]);
28088
- (0, import_react21.useEffect)(() => {
28191
+ (0, import_react23.useEffect)(() => {
28089
28192
  if (!isEditMode) return;
28090
28193
  const resolveIndex = (form, clientY) => {
28091
28194
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28126,7 +28229,7 @@ function OhhwellsBridge() {
28126
28229
  window.removeEventListener("drop", onDrop, true);
28127
28230
  };
28128
28231
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28129
- (0, import_react21.useEffect)(() => {
28232
+ (0, import_react23.useEffect)(() => {
28130
28233
  if (!isEditMode) return;
28131
28234
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28132
28235
  markFormFields(form);
@@ -28138,7 +28241,7 @@ function OhhwellsBridge() {
28138
28241
  });
28139
28242
  return () => observer.disconnect();
28140
28243
  }, [isEditMode, fetchState, pathname]);
28141
- (0, import_react21.useEffect)(() => {
28244
+ (0, import_react23.useEffect)(() => {
28142
28245
  if (!isEditMode) return;
28143
28246
  let saveTimer = null;
28144
28247
  const onInput = (e) => {
@@ -28160,14 +28263,14 @@ function OhhwellsBridge() {
28160
28263
  document.addEventListener("input", onInput, true);
28161
28264
  return () => document.removeEventListener("input", onInput, true);
28162
28265
  }, [isEditMode, persistFields]);
28163
- (0, import_react21.useEffect)(() => {
28266
+ (0, import_react23.useEffect)(() => {
28164
28267
  if (isEditMode || fetchState !== "done") return;
28165
28268
  const content = contentCache.get(subdomain) ?? {};
28166
28269
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28167
28270
  reconcileFieldsFromContent(form, content);
28168
28271
  });
28169
28272
  }, [isEditMode, fetchState, subdomain]);
28170
- (0, import_react21.useEffect)(() => {
28273
+ (0, import_react23.useEffect)(() => {
28171
28274
  if (!isEditMode) return;
28172
28275
  const swallow = (e) => {
28173
28276
  const target = e.target;
@@ -28176,14 +28279,14 @@ function OhhwellsBridge() {
28176
28279
  document.addEventListener("submit", swallow, true);
28177
28280
  return () => document.removeEventListener("submit", swallow, true);
28178
28281
  }, [isEditMode]);
28179
- (0, import_react21.useEffect)(() => {
28282
+ (0, import_react23.useEffect)(() => {
28180
28283
  if (isEditMode || fetchState !== "done") return;
28181
28284
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28182
28285
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28183
28286
  console.log({ apiUrl, subdomain });
28184
28287
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28185
28288
  }, [isEditMode, fetchState, subdomain]);
28186
- (0, import_react21.useEffect)(() => {
28289
+ (0, import_react23.useEffect)(() => {
28187
28290
  if (!subdomain || isEditMode) return;
28188
28291
  let debounceTimer = null;
28189
28292
  let observer = null;
@@ -28300,16 +28403,16 @@ function OhhwellsBridge() {
28300
28403
  if (debounceTimer) clearTimeout(debounceTimer);
28301
28404
  };
28302
28405
  }, [subdomain, isEditMode, pathname]);
28303
- (0, import_react21.useLayoutEffect)(() => {
28406
+ (0, import_react23.useLayoutEffect)(() => {
28304
28407
  const el = document.getElementById("ohw-loader");
28305
28408
  if (!el) return;
28306
28409
  const visible = Boolean(subdomain) && fetchState !== "done";
28307
28410
  el.style.display = visible ? "flex" : "none";
28308
28411
  }, [subdomain, fetchState]);
28309
- (0, import_react21.useEffect)(() => {
28412
+ (0, import_react23.useEffect)(() => {
28310
28413
  postToParent2({ type: "ow:navigation", path: pathname });
28311
28414
  }, [pathname, postToParent2]);
28312
- (0, import_react21.useEffect)(() => {
28415
+ (0, import_react23.useEffect)(() => {
28313
28416
  if (!subdomain || isEditMode) return;
28314
28417
  const content = contentCache.get(subdomain);
28315
28418
  if (!content) return;
@@ -28327,7 +28430,7 @@ function OhhwellsBridge() {
28327
28430
  }
28328
28431
  applyAiFooterFromContent(content);
28329
28432
  }, [pathname, subdomain, isEditMode]);
28330
- (0, import_react21.useEffect)(() => {
28433
+ (0, import_react23.useEffect)(() => {
28331
28434
  if (!isEditMode) return;
28332
28435
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28333
28436
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28335,12 +28438,12 @@ function OhhwellsBridge() {
28335
28438
  deselectRef.current();
28336
28439
  deactivateRef.current();
28337
28440
  }, [pathname, isEditMode]);
28338
- (0, import_react21.useEffect)(() => {
28441
+ (0, import_react23.useEffect)(() => {
28339
28442
  if (!isEditMode) return;
28340
28443
  initSectionInstancesFromContent(editContentRef.current, pathname);
28341
28444
  initItemInstancesFromContent(editContentRef.current);
28342
28445
  }, [pathname, isEditMode]);
28343
- (0, import_react21.useEffect)(() => {
28446
+ (0, import_react23.useEffect)(() => {
28344
28447
  if (!isEditMode) return;
28345
28448
  const observer = new MutationObserver(() => {
28346
28449
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28351,7 +28454,7 @@ function OhhwellsBridge() {
28351
28454
  observer.observe(document.body, { childList: true, subtree: true });
28352
28455
  return () => observer.disconnect();
28353
28456
  }, [isEditMode, pathname]);
28354
- (0, import_react21.useEffect)(() => {
28457
+ (0, import_react23.useEffect)(() => {
28355
28458
  const contentForNav = () => {
28356
28459
  if (isEditMode) return editContentRef.current;
28357
28460
  if (!subdomain) return {};
@@ -28424,7 +28527,7 @@ function OhhwellsBridge() {
28424
28527
  observer?.disconnect();
28425
28528
  };
28426
28529
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28427
- (0, import_react21.useEffect)(() => {
28530
+ (0, import_react23.useEffect)(() => {
28428
28531
  if (!isEditMode) return;
28429
28532
  let applying = false;
28430
28533
  let rafId = null;
@@ -28462,7 +28565,7 @@ function OhhwellsBridge() {
28462
28565
  observer.disconnect();
28463
28566
  };
28464
28567
  }, [isEditMode, pathname]);
28465
- (0, import_react21.useEffect)(() => {
28568
+ (0, import_react23.useEffect)(() => {
28466
28569
  if (!isEditMode) return;
28467
28570
  let lastPosted = 0;
28468
28571
  const measure = () => {
@@ -28506,7 +28609,7 @@ function OhhwellsBridge() {
28506
28609
  window.removeEventListener("resize", handleResize);
28507
28610
  };
28508
28611
  }, [pathname, isEditMode, postToParent2]);
28509
- (0, import_react21.useEffect)(() => {
28612
+ (0, import_react23.useEffect)(() => {
28510
28613
  if (isEditMode) return;
28511
28614
  const handleClick = (e) => {
28512
28615
  if (!isPlainLeftClick(e)) return;
@@ -28520,7 +28623,7 @@ function OhhwellsBridge() {
28520
28623
  document.addEventListener("click", handleClick, true);
28521
28624
  return () => document.removeEventListener("click", handleClick, true);
28522
28625
  }, [isEditMode, router, pathname]);
28523
- (0, import_react21.useEffect)(() => {
28626
+ (0, import_react23.useEffect)(() => {
28524
28627
  if (!isEditMode) {
28525
28628
  editStylesRef.current?.base.remove();
28526
28629
  editStylesRef.current?.forceHover.remove();
@@ -31975,7 +32078,7 @@ function OhhwellsBridge() {
31975
32078
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
31976
32079
  };
31977
32080
  }, [isEditMode, refreshStateRules]);
31978
- (0, import_react21.useEffect)(() => {
32081
+ (0, import_react23.useEffect)(() => {
31979
32082
  if (!isEditMode) return;
31980
32083
  const THRESHOLD = 10;
31981
32084
  const resolveWasSelected = (el) => {
@@ -32131,7 +32234,7 @@ function OhhwellsBridge() {
32131
32234
  unlockFooterDragInteraction();
32132
32235
  };
32133
32236
  }, [isEditMode]);
32134
- (0, import_react21.useEffect)(() => {
32237
+ (0, import_react23.useEffect)(() => {
32135
32238
  if (!isEditMode) return;
32136
32239
  const THRESHOLD = 10;
32137
32240
  const onPointerDown = (e) => {
@@ -32222,7 +32325,7 @@ function OhhwellsBridge() {
32222
32325
  document.removeEventListener("selectstart", blockSelectStart, true);
32223
32326
  };
32224
32327
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32225
- (0, import_react21.useEffect)(() => {
32328
+ (0, import_react23.useEffect)(() => {
32226
32329
  const handler = (e) => {
32227
32330
  if (e.data?.type !== "ow:request-schedule-config") return;
32228
32331
  const insertAfterVal = e.data.insertAfter;
@@ -32238,7 +32341,7 @@ function OhhwellsBridge() {
32238
32341
  window.addEventListener("message", handler);
32239
32342
  return () => window.removeEventListener("message", handler);
32240
32343
  }, [processConfigRequest]);
32241
- (0, import_react21.useEffect)(() => {
32344
+ (0, import_react23.useEffect)(() => {
32242
32345
  if (!isEditMode) return;
32243
32346
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32244
32347
  el.removeAttribute("data-ohw-active-state");
@@ -32262,7 +32365,7 @@ function OhhwellsBridge() {
32262
32365
  postToParent2({
32263
32366
  type: "ow:ready",
32264
32367
  version: "1",
32265
- bridgeVersion: "0.1.160",
32368
+ bridgeVersion: "0.1.161",
32266
32369
  path: pathname,
32267
32370
  nodes: collectEditableNodes(editContentRef.current),
32268
32371
  sections
@@ -32274,13 +32377,13 @@ function OhhwellsBridge() {
32274
32377
  clearTimeout(timer);
32275
32378
  };
32276
32379
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32277
- (0, import_react21.useEffect)(() => {
32380
+ (0, import_react23.useEffect)(() => {
32278
32381
  scrollToHashSectionWhenReady();
32279
32382
  const onHashChange = () => scrollToHashSectionWhenReady();
32280
32383
  window.addEventListener("hashchange", onHashChange);
32281
32384
  return () => window.removeEventListener("hashchange", onHashChange);
32282
32385
  }, [pathname]);
32283
- const handleCommand = (0, import_react21.useCallback)((cmd) => {
32386
+ const handleCommand = (0, import_react23.useCallback)((cmd) => {
32284
32387
  const el = activeElRef.current;
32285
32388
  const selBefore = window.getSelection();
32286
32389
  let savedOffsets = null;
@@ -32316,7 +32419,7 @@ function OhhwellsBridge() {
32316
32419
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32317
32420
  refreshActiveCommandsRef.current();
32318
32421
  }, []);
32319
- (0, import_react21.useEffect)(() => {
32422
+ (0, import_react23.useEffect)(() => {
32320
32423
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32321
32424
  if (!session || !logoSizeDraft) return;
32322
32425
  const onPanelAction = (e) => {
@@ -32354,7 +32457,7 @@ function OhhwellsBridge() {
32354
32457
  window.addEventListener("message", onPanelAction);
32355
32458
  return () => window.removeEventListener("message", onPanelAction);
32356
32459
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32357
- const handleStateChange = (0, import_react21.useCallback)((state) => {
32460
+ const handleStateChange = (0, import_react23.useCallback)((state) => {
32358
32461
  if (!activeStateElRef.current) return;
32359
32462
  const el = activeStateElRef.current;
32360
32463
  if (state === "Default") {
@@ -32367,7 +32470,7 @@ function OhhwellsBridge() {
32367
32470
  }
32368
32471
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32369
32472
  }, [deactivate]);
32370
- const reselectAfterLinkPopover = (0, import_react21.useCallback)(
32473
+ const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32371
32474
  (hrefKey) => {
32372
32475
  requestAnimationFrame(() => {
32373
32476
  const el = resolveHrefKeyElement(hrefKey);
@@ -32376,7 +32479,7 @@ function OhhwellsBridge() {
32376
32479
  },
32377
32480
  [resolveHrefKeyElement]
32378
32481
  );
32379
- const closeLinkPopover = (0, import_react21.useCallback)(() => {
32482
+ const closeLinkPopover = (0, import_react23.useCallback)(() => {
32380
32483
  const session = linkPopoverSessionRef.current;
32381
32484
  addNavAfterAnchorRef.current = null;
32382
32485
  setLinkPopover(null);
@@ -32384,9 +32487,9 @@ function OhhwellsBridge() {
32384
32487
  reselectAfterLinkPopover(session.key);
32385
32488
  }
32386
32489
  }, [reselectAfterLinkPopover]);
32387
- const closeLinkPopoverRef = (0, import_react21.useRef)(closeLinkPopover);
32490
+ const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32388
32491
  closeLinkPopoverRef.current = closeLinkPopover;
32389
- const openLinkPopoverForActive = (0, import_react21.useCallback)(() => {
32492
+ const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32390
32493
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32391
32494
  if (!hrefCtx) return;
32392
32495
  bumpLinkPopoverGrace();
@@ -32397,7 +32500,7 @@ function OhhwellsBridge() {
32397
32500
  });
32398
32501
  deactivate();
32399
32502
  }, [deactivate]);
32400
- const openLinkPopoverForSelected = (0, import_react21.useCallback)(() => {
32503
+ const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32401
32504
  const anchor = selectedElRef.current;
32402
32505
  if (!anchor) return;
32403
32506
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32414,7 +32517,7 @@ function OhhwellsBridge() {
32414
32517
  });
32415
32518
  deselect();
32416
32519
  }, [deselect]);
32417
- const handleSelectParent = (0, import_react21.useCallback)(() => {
32520
+ const handleSelectParent = (0, import_react23.useCallback)(() => {
32418
32521
  const selected = selectedElRef.current;
32419
32522
  if (!selected) return;
32420
32523
  if (toolbarVariantRef.current === "select-frame") {
@@ -32441,7 +32544,7 @@ function OhhwellsBridge() {
32441
32544
  }
32442
32545
  deselectRef.current();
32443
32546
  }, []);
32444
- const handleDuplicateSelected = (0, import_react21.useCallback)(() => {
32547
+ const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
32445
32548
  const selected = selectedElRef.current;
32446
32549
  if (!selected || !isNavigationItem2(selected)) return;
32447
32550
  if (isCtaButton(selected)) {
@@ -32610,7 +32713,7 @@ function OhhwellsBridge() {
32610
32713
  });
32611
32714
  }
32612
32715
  }, [postToParent2, tokensForButton]);
32613
- const runPendingDeleteUndo = (0, import_react21.useCallback)(() => {
32716
+ const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
32614
32717
  const pending = pendingDeleteUndoRef.current;
32615
32718
  if (!pending) return false;
32616
32719
  pendingDeleteUndoRef.current = null;
@@ -32618,7 +32721,7 @@ function OhhwellsBridge() {
32618
32721
  enforceLinkHrefs();
32619
32722
  return true;
32620
32723
  }, []);
32621
- const handleDeleteSelected = (0, import_react21.useCallback)(() => {
32724
+ const handleDeleteSelected = (0, import_react23.useCallback)(() => {
32622
32725
  const selected = selectedElRef.current;
32623
32726
  if (!selected) return false;
32624
32727
  if (isCtaButton(selected)) {
@@ -32680,7 +32783,7 @@ function OhhwellsBridge() {
32680
32783
  }, [postToParent2]);
32681
32784
  handleDeleteSelectedRef.current = handleDeleteSelected;
32682
32785
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32683
- const handleLinkPopoverSubmit = (0, import_react21.useCallback)(
32786
+ const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
32684
32787
  (target) => {
32685
32788
  const session = linkPopoverSessionRef.current;
32686
32789
  if (!session) return;
@@ -32746,14 +32849,14 @@ function OhhwellsBridge() {
32746
32849
  const showEditLink = toolbarShowEditLink;
32747
32850
  const currentSections = sectionsByPath[pathname] ?? [];
32748
32851
  linkPopoverOpenRef.current = linkPopover !== null;
32749
- const handleMediaSelect = (0, import_react21.useCallback)((key) => {
32852
+ const handleMediaSelect = (0, import_react23.useCallback)((key) => {
32750
32853
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32751
32854
  (m) => (m.dataset.ohwKey ?? "") === key
32752
32855
  ) ?? null;
32753
32856
  if (!el) return;
32754
32857
  selectMediaElementRef.current(el);
32755
32858
  }, []);
32756
- const handleMediaReplace = (0, import_react21.useCallback)(
32859
+ const handleMediaReplace = (0, import_react23.useCallback)(
32757
32860
  (key) => {
32758
32861
  postToParent2({
32759
32862
  type: "ow:image-pick",
@@ -32763,13 +32866,13 @@ function OhhwellsBridge() {
32763
32866
  },
32764
32867
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
32765
32868
  );
32766
- const handleEditCarousel = (0, import_react21.useCallback)(
32869
+ const handleEditCarousel = (0, import_react23.useCallback)(
32767
32870
  (key) => {
32768
32871
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
32769
32872
  },
32770
32873
  [postToParent2]
32771
32874
  );
32772
- const handleMediaFadeOutComplete = (0, import_react21.useCallback)((key) => {
32875
+ const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
32773
32876
  setUploadingRects((prev) => {
32774
32877
  if (!(key in prev)) return prev;
32775
32878
  const next = { ...prev };
@@ -32777,7 +32880,7 @@ function OhhwellsBridge() {
32777
32880
  return next;
32778
32881
  });
32779
32882
  }, []);
32780
- const handleVideoSettingsChange = (0, import_react21.useCallback)(
32883
+ const handleVideoSettingsChange = (0, import_react23.useCallback)(
32781
32884
  (key, settings) => {
32782
32885
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
32783
32886
  const video = getVideoEl2(el);