@ohhwells/bridge 0.1.52-next.133 → 0.1.52-next.134

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
@@ -69,7 +69,7 @@ __export(index_exports, {
69
69
  module.exports = __toCommonJS(index_exports);
70
70
 
71
71
  // src/OhhwellsBridge.tsx
72
- var import_react13 = __toESM(require("react"), 1);
72
+ var import_react14 = __toESM(require("react"), 1);
73
73
  var import_client = require("react-dom/client");
74
74
  var import_react_dom2 = require("react-dom");
75
75
 
@@ -121,11 +121,43 @@ function useLinkHrefGuardian(...deps) {
121
121
  }, deps);
122
122
  }
123
123
 
124
+ // src/useSavedLinkNavigation.ts
125
+ var import_react2 = require("react");
126
+ var import_navigation = require("next/navigation");
127
+ function isRouterHref(href) {
128
+ return href.startsWith("/") || href.startsWith("#");
129
+ }
130
+ function shouldLetBrowserHandle(e, anchor) {
131
+ return e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || anchor.hasAttribute("download") || anchor.target !== "" && anchor.target !== "_self";
132
+ }
133
+ function useSavedLinkNavigation(isEditMode) {
134
+ const router = (0, import_navigation.useRouter)();
135
+ (0, import_react2.useEffect)(() => {
136
+ if (isEditMode) return;
137
+ const onClick = (e) => {
138
+ const anchor = e.target?.closest(
139
+ "a[data-ohw-href-key]"
140
+ );
141
+ if (!anchor || shouldLetBrowserHandle(e, anchor)) return;
142
+ const key = anchor.getAttribute("data-ohw-href-key");
143
+ if (!key || getStoredLinkHref(key) === void 0) return;
144
+ const href = anchor.getAttribute("href");
145
+ if (!href) return;
146
+ e.preventDefault();
147
+ e.stopPropagation();
148
+ if (isRouterHref(href)) router.push(href);
149
+ else window.location.assign(href);
150
+ };
151
+ document.addEventListener("click", onClick, true);
152
+ return () => document.removeEventListener("click", onClick, true);
153
+ }, [isEditMode, router]);
154
+ }
155
+
124
156
  // src/ui/SchedulingWidget.tsx
125
- var import_react3 = require("react");
157
+ var import_react4 = require("react");
126
158
 
127
159
  // src/ui/EmailCaptureModal.tsx
128
- var import_react2 = require("react");
160
+ var import_react3 = require("react");
129
161
  var import_radix_ui = require("radix-ui");
130
162
  var import_jsx_runtime = require("react/jsx-runtime");
131
163
  var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
@@ -155,11 +187,11 @@ function Spinner() {
155
187
  );
156
188
  }
157
189
  function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
158
- const [email, setEmail] = (0, import_react2.useState)("");
159
- const [submittedEmail, setSubmittedEmail] = (0, import_react2.useState)("");
160
- const [loading, setLoading] = (0, import_react2.useState)(false);
161
- const [success, setSuccess] = (0, import_react2.useState)(false);
162
- const [error, setError] = (0, import_react2.useState)(null);
190
+ const [email, setEmail] = (0, import_react3.useState)("");
191
+ const [submittedEmail, setSubmittedEmail] = (0, import_react3.useState)("");
192
+ const [loading, setLoading] = (0, import_react3.useState)(false);
193
+ const [success, setSuccess] = (0, import_react3.useState)(false);
194
+ const [error, setError] = (0, import_react3.useState)(null);
163
195
  const isBook = title === "Confirm your spot";
164
196
  const handleSubmit = async () => {
165
197
  const trimmed = email.trim();
@@ -423,21 +455,21 @@ function LoadingSkeleton() {
423
455
  ] });
424
456
  }
425
457
  function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
426
- const todayMs = (0, import_react3.useMemo)(() => {
458
+ const todayMs = (0, import_react4.useMemo)(() => {
427
459
  const d = /* @__PURE__ */ new Date();
428
460
  d.setHours(0, 0, 0, 0);
429
461
  return d.getTime();
430
462
  }, []);
431
- const scrollRef = (0, import_react3.useRef)(null);
432
- const [canScrollLeft, setCanScrollLeft] = (0, import_react3.useState)(false);
433
- const [canScrollRight, setCanScrollRight] = (0, import_react3.useState)(false);
463
+ const scrollRef = (0, import_react4.useRef)(null);
464
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react4.useState)(false);
465
+ const [canScrollRight, setCanScrollRight] = (0, import_react4.useState)(false);
434
466
  const updateScrollState = () => {
435
467
  const el = scrollRef.current;
436
468
  if (!el) return;
437
469
  setCanScrollLeft(el.scrollLeft > 0);
438
470
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
439
471
  };
440
- (0, import_react3.useEffect)(() => {
472
+ (0, import_react4.useEffect)(() => {
441
473
  const el = scrollRef.current;
442
474
  if (!el) return;
443
475
  updateScrollState();
@@ -452,9 +484,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
452
484
  const scroll = (dir) => {
453
485
  scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
454
486
  };
455
- const isDragging = (0, import_react3.useRef)(false);
456
- const dragStartX = (0, import_react3.useRef)(0);
457
- const dragStartScrollLeft = (0, import_react3.useRef)(0);
487
+ const isDragging = (0, import_react4.useRef)(false);
488
+ const dragStartX = (0, import_react4.useRef)(0);
489
+ const dragStartScrollLeft = (0, import_react4.useRef)(0);
458
490
  const onDragStart = (e) => {
459
491
  if (!scrollRef.current) return;
460
492
  isDragging.current = true;
@@ -474,14 +506,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
474
506
  scrollRef.current.style.cursor = "grab";
475
507
  scrollRef.current.style.userSelect = "";
476
508
  };
477
- const datesWithClasses = (0, import_react3.useMemo)(
509
+ const datesWithClasses = (0, import_react4.useMemo)(
478
510
  () => new Set(dates.map(
479
511
  (d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
480
512
  ).filter((i) => i >= 0)),
481
513
  [dates, schedule]
482
514
  );
483
515
  const selectedDate = dates[selectedIdx];
484
- const selectedClasses = (0, import_react3.useMemo)(
516
+ const selectedClasses = (0, import_react4.useMemo)(
485
517
  () => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
486
518
  [schedule, selectedDate]
487
519
  );
@@ -666,16 +698,16 @@ function CalendarFoldIcon() {
666
698
  );
667
699
  }
668
700
  function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
669
- const autoId = (0, import_react3.useId)();
701
+ const autoId = (0, import_react4.useId)();
670
702
  const insertAfter = insertAfterProp ?? autoId;
671
- const [schedule, setSchedule] = (0, import_react3.useState)(null);
672
- const [loading, setLoading] = (0, import_react3.useState)(true);
673
- const [inEditor, setInEditor] = (0, import_react3.useState)(false);
674
- const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
675
- const [modalState, setModalState] = (0, import_react3.useState)(null);
676
- const switchScheduleIdRef = (0, import_react3.useRef)(null);
677
- const liveScheduleIdRef = (0, import_react3.useRef)(null);
678
- const refetchLiveSchedule = (0, import_react3.useCallback)(async () => {
703
+ const [schedule, setSchedule] = (0, import_react4.useState)(null);
704
+ const [loading, setLoading] = (0, import_react4.useState)(true);
705
+ const [inEditor, setInEditor] = (0, import_react4.useState)(false);
706
+ const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
707
+ const [modalState, setModalState] = (0, import_react4.useState)(null);
708
+ const switchScheduleIdRef = (0, import_react4.useRef)(null);
709
+ const liveScheduleIdRef = (0, import_react4.useRef)(null);
710
+ const refetchLiveSchedule = (0, import_react4.useCallback)(async () => {
679
711
  const id = liveScheduleIdRef.current;
680
712
  if (!id) return;
681
713
  try {
@@ -685,7 +717,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
685
717
  } catch {
686
718
  }
687
719
  }, []);
688
- const dates = (0, import_react3.useMemo)(() => {
720
+ const dates = (0, import_react4.useMemo)(() => {
689
721
  const today = /* @__PURE__ */ new Date();
690
722
  today.setHours(0, 0, 0, 0);
691
723
  return Array.from({ length: 14 }, (_, i) => {
@@ -694,8 +726,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
694
726
  return d;
695
727
  });
696
728
  }, []);
697
- const [selectedIdx, setSelectedIdx] = (0, import_react3.useState)(0);
698
- (0, import_react3.useEffect)(() => {
729
+ const [selectedIdx, setSelectedIdx] = (0, import_react4.useState)(0);
730
+ (0, import_react4.useEffect)(() => {
699
731
  if (!schedule?.classes) return;
700
732
  for (let i = 0; i < dates.length; i++) {
701
733
  if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
@@ -704,7 +736,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
704
736
  }
705
737
  }
706
738
  }, [schedule, dates]);
707
- (0, import_react3.useEffect)(() => {
739
+ (0, import_react4.useEffect)(() => {
708
740
  if (typeof window === "undefined") return;
709
741
  const onVisible = () => {
710
742
  if (!document.hidden) void refetchLiveSchedule();
@@ -716,7 +748,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
716
748
  document.removeEventListener("visibilitychange", onVisible);
717
749
  };
718
750
  }, [refetchLiveSchedule]);
719
- (0, import_react3.useEffect)(() => {
751
+ (0, import_react4.useEffect)(() => {
720
752
  if (typeof window === "undefined") return;
721
753
  const isInEditor = window.self !== window.top;
722
754
  setInEditor(isInEditor);
@@ -4412,7 +4444,7 @@ var CustomToolbarButton = React4.forwardRef(
4412
4444
  CustomToolbarButton.displayName = "CustomToolbarButton";
4413
4445
 
4414
4446
  // src/ui/item-action-toolbar.tsx
4415
- var import_react4 = require("react");
4447
+ var import_react5 = require("react");
4416
4448
  var import_lucide_react2 = require("lucide-react");
4417
4449
 
4418
4450
  // src/ui/dropdown-menu.tsx
@@ -4596,7 +4628,7 @@ function ItemActionToolbar({
4596
4628
  headingVisible = null,
4597
4629
  onHeadingVisibleChange
4598
4630
  }) {
4599
- const [moreOpen, setMoreOpen] = (0, import_react4.useState)(false);
4631
+ const [moreOpen, setMoreOpen] = (0, import_react5.useState)(false);
4600
4632
  const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
4601
4633
  const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
4602
4634
  const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
@@ -4772,7 +4804,7 @@ function ItemActionToolbar({
4772
4804
  }
4773
4805
 
4774
4806
  // src/ui/item-interaction-layer.tsx
4775
- var import_react5 = require("react");
4807
+ var import_react6 = require("react");
4776
4808
  var import_jsx_runtime10 = require("react/jsx-runtime");
4777
4809
  var PRIMARY = "var(--ohw-primary, #0885FE)";
4778
4810
  var FOCUS_RING = `0 0 0 4px color-mix(in srgb, ${PRIMARY} 12%, transparent)`;
@@ -4824,8 +4856,8 @@ function ClampedToolbarSlot({
4824
4856
  placement,
4825
4857
  children
4826
4858
  }) {
4827
- const slotRef = (0, import_react5.useRef)(null);
4828
- (0, import_react5.useLayoutEffect)(() => {
4859
+ const slotRef = (0, import_react6.useRef)(null);
4860
+ (0, import_react6.useLayoutEffect)(() => {
4829
4861
  const slot = slotRef.current;
4830
4862
  if (!slot) return;
4831
4863
  const clamp = () => {
@@ -4878,8 +4910,8 @@ function DetachedBelowToolbarSlot({
4878
4910
  belowRect,
4879
4911
  children
4880
4912
  }) {
4881
- const slotRef = (0, import_react5.useRef)(null);
4882
- (0, import_react5.useLayoutEffect)(() => {
4913
+ const slotRef = (0, import_react6.useRef)(null);
4914
+ (0, import_react6.useLayoutEffect)(() => {
4883
4915
  const slot = slotRef.current;
4884
4916
  if (!slot) return;
4885
4917
  const clamp = () => {
@@ -5310,7 +5342,7 @@ function CarouselOverlay({
5310
5342
  }
5311
5343
 
5312
5344
  // src/ui/ai-section/AiSectionOverlay.tsx
5313
- var import_react6 = require("react");
5345
+ var import_react7 = require("react");
5314
5346
  var import_lucide_react5 = require("lucide-react");
5315
5347
 
5316
5348
  // src/lib/sections.ts
@@ -5350,8 +5382,8 @@ function readRect(sectionId) {
5350
5382
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
5351
5383
  }
5352
5384
  function useLiveSectionRect(sectionId) {
5353
- const [rect, setRect] = (0, import_react6.useState)(null);
5354
- (0, import_react6.useEffect)(() => {
5385
+ const [rect, setRect] = (0, import_react7.useState)(null);
5386
+ (0, import_react7.useEffect)(() => {
5355
5387
  if (!sectionId) {
5356
5388
  setRect(null);
5357
5389
  return;
@@ -5396,7 +5428,7 @@ function ReviewButton({
5396
5428
  background,
5397
5429
  color
5398
5430
  }) {
5399
- const [hover, setHover] = (0, import_react6.useState)(false);
5431
+ const [hover, setHover] = (0, import_react7.useState)(false);
5400
5432
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { position: "relative" }, children: [
5401
5433
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5402
5434
  "button",
@@ -5450,13 +5482,13 @@ function AiSectionOverlay({
5450
5482
  postToParent: postToParent2,
5451
5483
  apiRef
5452
5484
  }) {
5453
- const [selectedId, setSelectedId] = (0, import_react6.useState)(null);
5454
- const [reviewId, setReviewId] = (0, import_react6.useState)(null);
5455
- const reviewIdRef = (0, import_react6.useRef)(null);
5485
+ const [selectedId, setSelectedId] = (0, import_react7.useState)(null);
5486
+ const [reviewId, setReviewId] = (0, import_react7.useState)(null);
5487
+ const reviewIdRef = (0, import_react7.useRef)(null);
5456
5488
  reviewIdRef.current = reviewId;
5457
- const selectedIdRef = (0, import_react6.useRef)(null);
5489
+ const selectedIdRef = (0, import_react7.useRef)(null);
5458
5490
  selectedIdRef.current = selectedId;
5459
- const report = (0, import_react6.useCallback)(
5491
+ const report = (0, import_react7.useCallback)(
5460
5492
  (el) => {
5461
5493
  postToParent2({
5462
5494
  type: "ow:section-selected",
@@ -5466,7 +5498,7 @@ function AiSectionOverlay({
5466
5498
  },
5467
5499
  [postToParent2]
5468
5500
  );
5469
- const selectFromElement = (0, import_react6.useCallback)(
5501
+ const selectFromElement = (0, import_react7.useCallback)(
5470
5502
  (el, options) => {
5471
5503
  const sectionEl = el?.closest("[data-ohw-section]") ?? null;
5472
5504
  const id = sectionEl?.dataset.ohwSection ?? null;
@@ -5476,7 +5508,7 @@ function AiSectionOverlay({
5476
5508
  },
5477
5509
  [report]
5478
5510
  );
5479
- (0, import_react6.useEffect)(() => {
5511
+ (0, import_react7.useEffect)(() => {
5480
5512
  apiRef.current = {
5481
5513
  selectFromElement,
5482
5514
  handleBackgroundClick: (target, clientX, clientY) => {
@@ -5496,7 +5528,7 @@ function AiSectionOverlay({
5496
5528
  apiRef.current = null;
5497
5529
  };
5498
5530
  }, [apiRef, selectFromElement]);
5499
- (0, import_react6.useEffect)(() => {
5531
+ (0, import_react7.useEffect)(() => {
5500
5532
  const onMessage = (e) => {
5501
5533
  if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
5502
5534
  setSelectedId(null);
@@ -5519,8 +5551,8 @@ function AiSectionOverlay({
5519
5551
  window.addEventListener("message", onMessage);
5520
5552
  return () => window.removeEventListener("message", onMessage);
5521
5553
  }, [postToParent2]);
5522
- const [hoveredId, setHoveredId] = (0, import_react6.useState)(null);
5523
- (0, import_react6.useEffect)(() => {
5554
+ const [hoveredId, setHoveredId] = (0, import_react7.useState)(null);
5555
+ (0, import_react7.useEffect)(() => {
5524
5556
  const onMove = (e) => {
5525
5557
  const t = e.target;
5526
5558
  if (!(t instanceof HTMLElement)) return;
@@ -5541,7 +5573,7 @@ function AiSectionOverlay({
5541
5573
  document.documentElement.removeEventListener("mouseleave", onLeave);
5542
5574
  };
5543
5575
  }, []);
5544
- (0, import_react6.useEffect)(() => {
5576
+ (0, import_react7.useEffect)(() => {
5545
5577
  const onKeyDown = (e) => {
5546
5578
  if (e.key !== "Escape") return;
5547
5579
  if (reviewIdRef.current) return;
@@ -5554,7 +5586,7 @@ function AiSectionOverlay({
5554
5586
  document.addEventListener("keydown", onKeyDown);
5555
5587
  return () => document.removeEventListener("keydown", onKeyDown);
5556
5588
  }, [report]);
5557
- const decide = (0, import_react6.useCallback)(
5589
+ const decide = (0, import_react7.useCallback)(
5558
5590
  (decision) => {
5559
5591
  const sectionId = reviewIdRef.current;
5560
5592
  if (!sectionId) return;
@@ -5647,7 +5679,7 @@ function AiSectionOverlay({
5647
5679
 
5648
5680
  // src/OhhwellsBridge.tsx
5649
5681
  var import_react_dom3 = require("react-dom");
5650
- var import_navigation2 = require("next/navigation");
5682
+ var import_navigation3 = require("next/navigation");
5651
5683
 
5652
5684
  // src/lib/cta-button.ts
5653
5685
  function isCtaButton(el) {
@@ -5935,7 +5967,7 @@ function scrollToHashSectionWhenReady(behavior = "smooth") {
5935
5967
  }
5936
5968
 
5937
5969
  // src/ui/link-modal/LinkPopover.tsx
5938
- var import_react10 = require("react");
5970
+ var import_react11 = require("react");
5939
5971
 
5940
5972
  // src/ui/dialog.tsx
5941
5973
  var React7 = __toESM(require("react"), 1);
@@ -6135,7 +6167,7 @@ function SectionTreeItem({
6135
6167
  }
6136
6168
 
6137
6169
  // src/ui/link-modal/UrlOrPageInput.tsx
6138
- var import_react7 = require("react");
6170
+ var import_react8 = require("react");
6139
6171
 
6140
6172
  // src/ui/input.tsx
6141
6173
  var React8 = __toESM(require("react"), 1);
@@ -6203,11 +6235,11 @@ function UrlOrPageInput({
6203
6235
  readOnly = false,
6204
6236
  urlError
6205
6237
  }) {
6206
- const inputId = (0, import_react7.useId)();
6207
- const inputRef = (0, import_react7.useRef)(null);
6208
- const rootRef = (0, import_react7.useRef)(null);
6209
- const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
6210
- (0, import_react7.useEffect)(() => {
6238
+ const inputId = (0, import_react8.useId)();
6239
+ const inputRef = (0, import_react8.useRef)(null);
6240
+ const rootRef = (0, import_react8.useRef)(null);
6241
+ const [isFocused, setIsFocused] = (0, import_react8.useState)(false);
6242
+ (0, import_react8.useEffect)(() => {
6211
6243
  if (!dropdownOpen) return;
6212
6244
  const isOutside = (e) => {
6213
6245
  const root = rootRef.current;
@@ -6415,10 +6447,10 @@ function LinkEditorPanel({ state, onClose }) {
6415
6447
  }
6416
6448
 
6417
6449
  // src/ui/link-modal/SectionPickerOverlay.tsx
6418
- var import_react8 = require("react");
6450
+ var import_react9 = require("react");
6419
6451
  var import_react_dom = require("react-dom");
6420
6452
  var import_lucide_react11 = require("lucide-react");
6421
- var import_navigation = require("next/navigation");
6453
+ var import_navigation2 = require("next/navigation");
6422
6454
  var import_jsx_runtime22 = require("react/jsx-runtime");
6423
6455
  var DIM_OVERLAY = "rgba(0, 0, 0, 0.45)";
6424
6456
  function rectsEqual(a, b) {
@@ -6452,12 +6484,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
6452
6484
  return null;
6453
6485
  }
6454
6486
  function useSectionRects(sectionIdsKey, enabled) {
6455
- const [rects, setRects] = (0, import_react8.useState)(/* @__PURE__ */ new Map());
6456
- const sectionIds = (0, import_react8.useMemo)(
6487
+ const [rects, setRects] = (0, import_react9.useState)(/* @__PURE__ */ new Map());
6488
+ const sectionIds = (0, import_react9.useMemo)(
6457
6489
  () => sectionIdsKey ? sectionIdsKey.split("\0") : [],
6458
6490
  [sectionIdsKey]
6459
6491
  );
6460
- (0, import_react8.useEffect)(() => {
6492
+ (0, import_react9.useEffect)(() => {
6461
6493
  if (!enabled || sectionIds.length === 0) {
6462
6494
  setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
6463
6495
  return;
@@ -6496,15 +6528,15 @@ function SectionPickerOverlay({
6496
6528
  onBack,
6497
6529
  onSelect
6498
6530
  }) {
6499
- const router = (0, import_navigation.useRouter)();
6500
- const pathname = (0, import_navigation.usePathname)();
6501
- const [selectedId, setSelectedId] = (0, import_react8.useState)(null);
6502
- const [hoveredId, setHoveredId] = (0, import_react8.useState)(null);
6503
- const pointerRef = (0, import_react8.useRef)(null);
6504
- const pointerScreenRef = (0, import_react8.useRef)(null);
6505
- const iframeOffsetTopRef = (0, import_react8.useRef)(null);
6506
- const sectionIdsRef = (0, import_react8.useRef)([]);
6507
- const [chromeClip, setChromeClip] = (0, import_react8.useState)(
6531
+ const router = (0, import_navigation2.useRouter)();
6532
+ const pathname = (0, import_navigation2.usePathname)();
6533
+ const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
6534
+ const [hoveredId, setHoveredId] = (0, import_react9.useState)(null);
6535
+ const pointerRef = (0, import_react9.useRef)(null);
6536
+ const pointerScreenRef = (0, import_react9.useRef)(null);
6537
+ const iframeOffsetTopRef = (0, import_react9.useRef)(null);
6538
+ const sectionIdsRef = (0, import_react9.useRef)([]);
6539
+ const [chromeClip, setChromeClip] = (0, import_react9.useState)(
6508
6540
  () => ({
6509
6541
  top: 0,
6510
6542
  bottom: typeof window !== "undefined" ? window.innerHeight : 0
@@ -6512,12 +6544,12 @@ function SectionPickerOverlay({
6512
6544
  );
6513
6545
  const normalizedTarget = normalizePath(pagePath);
6514
6546
  const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
6515
- (0, import_react8.useEffect)(() => {
6547
+ (0, import_react9.useEffect)(() => {
6516
6548
  if (isOnTargetPage) return;
6517
6549
  const search = readPreservedSearch();
6518
6550
  router.push(`${normalizedTarget}${search}`);
6519
6551
  }, [isOnTargetPage, normalizedTarget, router]);
6520
- (0, import_react8.useEffect)(() => {
6552
+ (0, import_react9.useEffect)(() => {
6521
6553
  document.documentElement.setAttribute("data-ohw-section-picking", "");
6522
6554
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
6523
6555
  el.removeAttribute("data-ohw-hovered");
@@ -6529,24 +6561,24 @@ function SectionPickerOverlay({
6529
6561
  document.documentElement.removeAttribute("data-ohw-section-picking");
6530
6562
  };
6531
6563
  }, []);
6532
- const liveSections = (0, import_react8.useMemo)(() => {
6564
+ const liveSections = (0, import_react9.useMemo)(() => {
6533
6565
  if (!isOnTargetPage) return sections;
6534
6566
  const live = collectSectionsFromDom();
6535
6567
  if (live.length === 0) return sections;
6536
6568
  const labels = new Map(sections.map((s) => [s.id, s.label]));
6537
6569
  return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
6538
6570
  }, [isOnTargetPage, sections, pathname]);
6539
- const sectionIdsKey = (0, import_react8.useMemo)(
6571
+ const sectionIdsKey = (0, import_react9.useMemo)(
6540
6572
  () => liveSections.map((s) => s.id).join("\0"),
6541
6573
  [liveSections]
6542
6574
  );
6543
- const sectionIds = (0, import_react8.useMemo)(
6575
+ const sectionIds = (0, import_react9.useMemo)(
6544
6576
  () => liveSections.map((s) => s.id),
6545
6577
  [liveSections]
6546
6578
  );
6547
6579
  sectionIdsRef.current = sectionIds;
6548
6580
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
6549
- const applyHoverAt = (0, import_react8.useCallback)(
6581
+ const applyHoverAt = (0, import_react9.useCallback)(
6550
6582
  (x, y, liveRects) => {
6551
6583
  const ids = sectionIdsRef.current;
6552
6584
  const map = liveRects ?? readSectionRects(ids);
@@ -6555,7 +6587,7 @@ function SectionPickerOverlay({
6555
6587
  },
6556
6588
  []
6557
6589
  );
6558
- (0, import_react8.useEffect)(() => {
6590
+ (0, import_react9.useEffect)(() => {
6559
6591
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH) => {
6560
6592
  const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
6561
6593
  const bottom = Math.min(
@@ -6597,12 +6629,12 @@ function SectionPickerOverlay({
6597
6629
  window.removeEventListener("resize", onResize);
6598
6630
  };
6599
6631
  }, [applyHoverAt]);
6600
- (0, import_react8.useEffect)(() => {
6632
+ (0, import_react9.useEffect)(() => {
6601
6633
  const ptr = pointerRef.current;
6602
6634
  if (!ptr) return;
6603
6635
  applyHoverAt(ptr.x, ptr.y, rects);
6604
6636
  }, [rects, applyHoverAt]);
6605
- (0, import_react8.useEffect)(() => {
6637
+ (0, import_react9.useEffect)(() => {
6606
6638
  const rememberPointer = (clientX, clientY) => {
6607
6639
  pointerRef.current = { x: clientX, y: clientY };
6608
6640
  const top = iframeOffsetTopRef.current;
@@ -6626,7 +6658,7 @@ function SectionPickerOverlay({
6626
6658
  window.removeEventListener("message", onPointerSync);
6627
6659
  };
6628
6660
  }, [rects, applyHoverAt]);
6629
- const handleSelect = (0, import_react8.useCallback)(
6661
+ const handleSelect = (0, import_react9.useCallback)(
6630
6662
  (section) => {
6631
6663
  if (selectedId) return;
6632
6664
  setSelectedId(section.id);
@@ -6634,7 +6666,7 @@ function SectionPickerOverlay({
6634
6666
  },
6635
6667
  [selectedId, onSelect]
6636
6668
  );
6637
- (0, import_react8.useEffect)(() => {
6669
+ (0, import_react9.useEffect)(() => {
6638
6670
  const onKeyDown = (e) => {
6639
6671
  if (e.key === "Escape") {
6640
6672
  e.preventDefault();
@@ -6757,7 +6789,7 @@ function SectionPickerOverlay({
6757
6789
  }
6758
6790
 
6759
6791
  // src/ui/link-modal/useLinkModalState.ts
6760
- var import_react9 = require("react");
6792
+ var import_react10 = require("react");
6761
6793
  function useLinkModalState({
6762
6794
  open,
6763
6795
  mode,
@@ -6769,14 +6801,14 @@ function useLinkModalState({
6769
6801
  onClose,
6770
6802
  onSubmit
6771
6803
  }) {
6772
- const availablePages = (0, import_react9.useMemo)(() => pages, [pages]);
6773
- const [searchValue, setSearchValue] = (0, import_react9.useState)("");
6774
- const [selectedPage, setSelectedPage] = (0, import_react9.useState)(null);
6775
- const [selectedSection, setSelectedSection] = (0, import_react9.useState)(null);
6776
- const [step, setStep] = (0, import_react9.useState)("input");
6777
- const [dropdownOpen, setDropdownOpen] = (0, import_react9.useState)(false);
6778
- const [urlError, setUrlError] = (0, import_react9.useState)("");
6779
- const reset = (0, import_react9.useCallback)(() => {
6804
+ const availablePages = (0, import_react10.useMemo)(() => pages, [pages]);
6805
+ const [searchValue, setSearchValue] = (0, import_react10.useState)("");
6806
+ const [selectedPage, setSelectedPage] = (0, import_react10.useState)(null);
6807
+ const [selectedSection, setSelectedSection] = (0, import_react10.useState)(null);
6808
+ const [step, setStep] = (0, import_react10.useState)("input");
6809
+ const [dropdownOpen, setDropdownOpen] = (0, import_react10.useState)(false);
6810
+ const [urlError, setUrlError] = (0, import_react10.useState)("");
6811
+ const reset = (0, import_react10.useCallback)(() => {
6780
6812
  setSearchValue("");
6781
6813
  setSelectedPage(null);
6782
6814
  setSelectedSection(null);
@@ -6784,7 +6816,7 @@ function useLinkModalState({
6784
6816
  setDropdownOpen(false);
6785
6817
  setUrlError("");
6786
6818
  }, []);
6787
- (0, import_react9.useEffect)(() => {
6819
+ (0, import_react10.useEffect)(() => {
6788
6820
  if (!open) return;
6789
6821
  if (mode === "edit" && initialTarget) {
6790
6822
  const { pageRoute } = parseTarget(initialTarget);
@@ -6800,11 +6832,11 @@ function useLinkModalState({
6800
6832
  setDropdownOpen(false);
6801
6833
  setUrlError("");
6802
6834
  }, [open, mode, initialTarget, reset]);
6803
- const filteredPages = (0, import_react9.useMemo)(() => {
6835
+ const filteredPages = (0, import_react10.useMemo)(() => {
6804
6836
  if (!searchValue.trim()) return availablePages;
6805
6837
  return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
6806
6838
  }, [availablePages, searchValue]);
6807
- const activeSections = (0, import_react9.useMemo)(() => {
6839
+ const activeSections = (0, import_react10.useMemo)(() => {
6808
6840
  if (!selectedPage) return [];
6809
6841
  return getSectionsForPath(sectionsByPath, selectedPage.path);
6810
6842
  }, [selectedPage, sectionsByPath]);
@@ -6853,7 +6885,7 @@ function useLinkModalState({
6853
6885
  reset();
6854
6886
  onClose();
6855
6887
  };
6856
- const isValid = (0, import_react9.useMemo)(() => {
6888
+ const isValid = (0, import_react10.useMemo)(() => {
6857
6889
  if (urlError) return false;
6858
6890
  if (showBreadcrumb) return true;
6859
6891
  if (selectedPage) return true;
@@ -6950,7 +6982,7 @@ function LinkPopover({
6950
6982
  onSubmit
6951
6983
  });
6952
6984
  const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
6953
- (0, import_react10.useEffect)(() => {
6985
+ (0, import_react11.useEffect)(() => {
6954
6986
  if (!open) return;
6955
6987
  if (sectionPickerActive) {
6956
6988
  postToParent({ type: "ui:unlock" });
@@ -9330,7 +9362,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
9330
9362
  }
9331
9363
 
9332
9364
  // src/useNavItemDrag.ts
9333
- var import_react11 = require("react");
9365
+ var import_react12 = require("react");
9334
9366
  function useNavItemDrag({
9335
9367
  isEditMode,
9336
9368
  editContentRef,
@@ -9354,11 +9386,11 @@ function useNavItemDrag({
9354
9386
  getNavigationItemAnchor: getNavigationItemAnchor2,
9355
9387
  isDragHandleDisabled: isDragHandleDisabled2
9356
9388
  }) {
9357
- const navDragRef = (0, import_react11.useRef)(null);
9358
- const [navDropSlots, setNavDropSlots] = (0, import_react11.useState)([]);
9359
- const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react11.useState)(null);
9360
- const navPointerDragRef = (0, import_react11.useRef)(null);
9361
- const clearNavDragVisuals = (0, import_react11.useCallback)(() => {
9389
+ const navDragRef = (0, import_react12.useRef)(null);
9390
+ const [navDropSlots, setNavDropSlots] = (0, import_react12.useState)([]);
9391
+ const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react12.useState)(null);
9392
+ const navPointerDragRef = (0, import_react12.useRef)(null);
9393
+ const clearNavDragVisuals = (0, import_react12.useCallback)(() => {
9362
9394
  const session = navDragRef.current;
9363
9395
  const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
9364
9396
  navDragRef.current = null;
@@ -9375,7 +9407,7 @@ function useNavItemDrag({
9375
9407
  document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
9376
9408
  unlockItemDragInteraction();
9377
9409
  }, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
9378
- const refreshNavDragVisuals = (0, import_react11.useCallback)(
9410
+ const refreshNavDragVisuals = (0, import_react12.useCallback)(
9379
9411
  (session, activeSlot, clientX, clientY) => {
9380
9412
  setDraggedItemRect(session.draggedEl.getBoundingClientRect());
9381
9413
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -9393,13 +9425,13 @@ function useNavItemDrag({
9393
9425
  },
9394
9426
  [setDraggedItemRect, setSiblingHintRects]
9395
9427
  );
9396
- const refreshNavDragVisualsRef = (0, import_react11.useRef)(refreshNavDragVisuals);
9428
+ const refreshNavDragVisualsRef = (0, import_react12.useRef)(refreshNavDragVisuals);
9397
9429
  refreshNavDragVisualsRef.current = refreshNavDragVisuals;
9398
- const commitNavDragRef = (0, import_react11.useRef)(() => {
9430
+ const commitNavDragRef = (0, import_react12.useRef)(() => {
9399
9431
  });
9400
- const beginNavDragRef = (0, import_react11.useRef)(() => {
9432
+ const beginNavDragRef = (0, import_react12.useRef)(() => {
9401
9433
  });
9402
- const beginNavDrag = (0, import_react11.useCallback)(
9434
+ const beginNavDrag = (0, import_react12.useCallback)(
9403
9435
  (session) => {
9404
9436
  const rect = session.draggedEl.getBoundingClientRect();
9405
9437
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -9433,7 +9465,7 @@ function useNavItemDrag({
9433
9465
  ]
9434
9466
  );
9435
9467
  beginNavDragRef.current = beginNavDrag;
9436
- const commitNavDrag = (0, import_react11.useCallback)(
9468
+ const commitNavDrag = (0, import_react12.useCallback)(
9437
9469
  (clientX, clientY) => {
9438
9470
  const session = navDragRef.current;
9439
9471
  if (!session) {
@@ -9494,7 +9526,7 @@ function useNavItemDrag({
9494
9526
  [clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
9495
9527
  );
9496
9528
  commitNavDragRef.current = commitNavDrag;
9497
- const startNavLinkDrag = (0, import_react11.useCallback)(
9529
+ const startNavLinkDrag = (0, import_react12.useCallback)(
9498
9530
  (anchor, clientX, clientY, wasSelected) => {
9499
9531
  if (footerDragRef.current) return false;
9500
9532
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
@@ -9512,7 +9544,7 @@ function useNavItemDrag({
9512
9544
  },
9513
9545
  [beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
9514
9546
  );
9515
- const onNavDragOver = (0, import_react11.useCallback)(
9547
+ const onNavDragOver = (0, import_react12.useCallback)(
9516
9548
  (e) => {
9517
9549
  const session = navDragRef.current;
9518
9550
  if (!session) return false;
@@ -9524,7 +9556,7 @@ function useNavItemDrag({
9524
9556
  },
9525
9557
  []
9526
9558
  );
9527
- (0, import_react11.useEffect)(() => {
9559
+ (0, import_react12.useEffect)(() => {
9528
9560
  if (!isEditMode) return;
9529
9561
  const THRESHOLD = 10;
9530
9562
  const resolveWasSelected = (el) => {
@@ -9649,7 +9681,7 @@ function useNavItemDrag({
9649
9681
  setLinkPopover,
9650
9682
  suppressNextClickRef
9651
9683
  ]);
9652
- const armNavPressFromChrome = (0, import_react11.useCallback)(
9684
+ const armNavPressFromChrome = (0, import_react12.useCallback)(
9653
9685
  (selected, clientX, clientY, pointerId) => {
9654
9686
  const hrefKey = selected.getAttribute("data-ohw-href-key");
9655
9687
  if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
@@ -9731,7 +9763,7 @@ function FooterContainerChrome({
9731
9763
  }
9732
9764
 
9733
9765
  // src/lib/carousel.ts
9734
- var import_react12 = require("react");
9766
+ var import_react13 = require("react");
9735
9767
  var CAROUSEL_ATTR = "data-ohw-carousel";
9736
9768
  var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
9737
9769
  var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
@@ -9793,8 +9825,8 @@ function applyCarouselNode(key, val) {
9793
9825
  return true;
9794
9826
  }
9795
9827
  function useOhwCarousel(key, initial) {
9796
- const [images, setImages] = (0, import_react12.useState)(initial);
9797
- (0, import_react12.useEffect)(() => {
9828
+ const [images, setImages] = (0, import_react13.useState)(initial);
9829
+ (0, import_react13.useEffect)(() => {
9798
9830
  const el = document.querySelector(
9799
9831
  `[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
9800
9832
  );
@@ -11270,9 +11302,9 @@ function FloatingToolbar({
11270
11302
  showEditLink,
11271
11303
  onEditLink
11272
11304
  }) {
11273
- const localRef = import_react13.default.useRef(null);
11274
- const [measuredW, setMeasuredW] = import_react13.default.useState(330);
11275
- const setRefs = import_react13.default.useCallback(
11305
+ const localRef = import_react14.default.useRef(null);
11306
+ const [measuredW, setMeasuredW] = import_react14.default.useState(330);
11307
+ const setRefs = import_react14.default.useCallback(
11276
11308
  (node) => {
11277
11309
  localRef.current = node;
11278
11310
  if (typeof elRef === "function") elRef(node);
@@ -11284,7 +11316,7 @@ function FloatingToolbar({
11284
11316
  },
11285
11317
  [elRef]
11286
11318
  );
11287
- import_react13.default.useLayoutEffect(() => {
11319
+ import_react14.default.useLayoutEffect(() => {
11288
11320
  const node = localRef.current;
11289
11321
  if (!node) return;
11290
11322
  const update = () => {
@@ -11310,7 +11342,7 @@ function FloatingToolbar({
11310
11342
  pointerEvents: "auto"
11311
11343
  },
11312
11344
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(CustomToolbar, { children: [
11313
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react13.default.Fragment, { children: [
11345
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react14.default.Fragment, { children: [
11314
11346
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CustomToolbarDivider, {}),
11315
11347
  btns.map((btn) => {
11316
11348
  const isActive = activeCommands.has(btn.cmd);
@@ -11412,12 +11444,12 @@ function resolveSubdomain(subdomainFromQuery) {
11412
11444
  return "";
11413
11445
  }
11414
11446
  function OhhwellsBridge() {
11415
- const pathname = (0, import_navigation2.usePathname)();
11416
- const router = (0, import_navigation2.useRouter)();
11417
- const searchParams = (0, import_navigation2.useSearchParams)();
11447
+ const pathname = (0, import_navigation3.usePathname)();
11448
+ const router = (0, import_navigation3.useRouter)();
11449
+ const searchParams = (0, import_navigation3.useSearchParams)();
11418
11450
  const isEditMode = isEditSessionActive();
11419
- const [bridgeRoot, setBridgeRoot] = (0, import_react13.useState)(null);
11420
- (0, import_react13.useEffect)(() => {
11451
+ const [bridgeRoot, setBridgeRoot] = (0, import_react14.useState)(null);
11452
+ (0, import_react14.useEffect)(() => {
11421
11453
  const figtreeFontId = "ohw-figtree-font";
11422
11454
  if (!document.getElementById(figtreeFontId)) {
11423
11455
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -11445,107 +11477,108 @@ function OhhwellsBridge() {
11445
11477
  const subdomainFromQuery = searchParams.get("subdomain");
11446
11478
  const subdomain = resolveSubdomain(subdomainFromQuery);
11447
11479
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
11448
- const postToParent2 = (0, import_react13.useCallback)((data) => {
11480
+ useSavedLinkNavigation(isEditMode);
11481
+ const postToParent2 = (0, import_react14.useCallback)((data) => {
11449
11482
  if (typeof window !== "undefined" && window.parent !== window) {
11450
11483
  window.parent.postMessage(data, "*");
11451
11484
  }
11452
11485
  }, []);
11453
- const [fetchState, setFetchState] = (0, import_react13.useState)("idle");
11454
- const autoSaveTimers = (0, import_react13.useRef)(/* @__PURE__ */ new Map());
11455
- const activeElRef = (0, import_react13.useRef)(null);
11456
- const pointerHeldRef = (0, import_react13.useRef)(false);
11457
- const selectedElRef = (0, import_react13.useRef)(null);
11458
- const selectedHrefKeyRef = (0, import_react13.useRef)(null);
11459
- const selectedFooterColAttrRef = (0, import_react13.useRef)(null);
11460
- const originalContentRef = (0, import_react13.useRef)(null);
11461
- const activeStateElRef = (0, import_react13.useRef)(null);
11462
- const parentScrollRef = (0, import_react13.useRef)(null);
11463
- const visibleViewportRef = (0, import_react13.useRef)(null);
11464
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react13.useState)(null);
11465
- const attachVisibleViewport = (0, import_react13.useCallback)((node) => {
11486
+ const [fetchState, setFetchState] = (0, import_react14.useState)("idle");
11487
+ const autoSaveTimers = (0, import_react14.useRef)(/* @__PURE__ */ new Map());
11488
+ const activeElRef = (0, import_react14.useRef)(null);
11489
+ const pointerHeldRef = (0, import_react14.useRef)(false);
11490
+ const selectedElRef = (0, import_react14.useRef)(null);
11491
+ const selectedHrefKeyRef = (0, import_react14.useRef)(null);
11492
+ const selectedFooterColAttrRef = (0, import_react14.useRef)(null);
11493
+ const originalContentRef = (0, import_react14.useRef)(null);
11494
+ const activeStateElRef = (0, import_react14.useRef)(null);
11495
+ const parentScrollRef = (0, import_react14.useRef)(null);
11496
+ const visibleViewportRef = (0, import_react14.useRef)(null);
11497
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react14.useState)(null);
11498
+ const attachVisibleViewport = (0, import_react14.useCallback)((node) => {
11466
11499
  visibleViewportRef.current = node;
11467
11500
  setDialogPortalContainer(node);
11468
11501
  if (node) applyVisibleViewport(node, parentScrollRef.current);
11469
11502
  }, []);
11470
- const toolbarElRef = (0, import_react13.useRef)(null);
11471
- const glowElRef = (0, import_react13.useRef)(null);
11472
- const hoveredImageRef = (0, import_react13.useRef)(null);
11473
- const hoveredImageHasTextOverlapRef = (0, import_react13.useRef)(false);
11474
- const dragOverElRef = (0, import_react13.useRef)(null);
11475
- const [mediaHover, setMediaHover] = (0, import_react13.useState)(null);
11476
- const [carouselHover, setCarouselHover] = (0, import_react13.useState)(null);
11477
- const [uploadingRects, setUploadingRects] = (0, import_react13.useState)({});
11478
- const hoveredGapRef = (0, import_react13.useRef)(null);
11479
- const imageUnhoverTimerRef = (0, import_react13.useRef)(null);
11480
- const imageShowTimerRef = (0, import_react13.useRef)(null);
11481
- const editStylesRef = (0, import_react13.useRef)(null);
11482
- const activateRef = (0, import_react13.useRef)(() => {
11503
+ const toolbarElRef = (0, import_react14.useRef)(null);
11504
+ const glowElRef = (0, import_react14.useRef)(null);
11505
+ const hoveredImageRef = (0, import_react14.useRef)(null);
11506
+ const hoveredImageHasTextOverlapRef = (0, import_react14.useRef)(false);
11507
+ const dragOverElRef = (0, import_react14.useRef)(null);
11508
+ const [mediaHover, setMediaHover] = (0, import_react14.useState)(null);
11509
+ const [carouselHover, setCarouselHover] = (0, import_react14.useState)(null);
11510
+ const [uploadingRects, setUploadingRects] = (0, import_react14.useState)({});
11511
+ const hoveredGapRef = (0, import_react14.useRef)(null);
11512
+ const imageUnhoverTimerRef = (0, import_react14.useRef)(null);
11513
+ const imageShowTimerRef = (0, import_react14.useRef)(null);
11514
+ const editStylesRef = (0, import_react14.useRef)(null);
11515
+ const activateRef = (0, import_react14.useRef)(() => {
11483
11516
  });
11484
- const deactivateRef = (0, import_react13.useRef)(() => {
11517
+ const deactivateRef = (0, import_react14.useRef)(() => {
11485
11518
  });
11486
- const selectRef = (0, import_react13.useRef)(() => {
11519
+ const selectRef = (0, import_react14.useRef)(() => {
11487
11520
  });
11488
- const selectFrameRef = (0, import_react13.useRef)(() => {
11521
+ const selectFrameRef = (0, import_react14.useRef)(() => {
11489
11522
  });
11490
- const deselectRef = (0, import_react13.useRef)(() => {
11523
+ const deselectRef = (0, import_react14.useRef)(() => {
11491
11524
  });
11492
- const reselectNavigationItemRef = (0, import_react13.useRef)(() => {
11525
+ const reselectNavigationItemRef = (0, import_react14.useRef)(() => {
11493
11526
  });
11494
- const commitNavigationTextEditRef = (0, import_react13.useRef)(() => {
11527
+ const commitNavigationTextEditRef = (0, import_react14.useRef)(() => {
11495
11528
  });
11496
- const handleDeleteSelectedRef = (0, import_react13.useRef)(() => false);
11497
- const runPendingDeleteUndoRef = (0, import_react13.useRef)(() => false);
11498
- const isFooterFrameSelectionRef = (0, import_react13.useRef)(false);
11499
- const refreshActiveCommandsRef = (0, import_react13.useRef)(() => {
11529
+ const handleDeleteSelectedRef = (0, import_react14.useRef)(() => false);
11530
+ const runPendingDeleteUndoRef = (0, import_react14.useRef)(() => false);
11531
+ const isFooterFrameSelectionRef = (0, import_react14.useRef)(false);
11532
+ const refreshActiveCommandsRef = (0, import_react14.useRef)(() => {
11500
11533
  });
11501
- const postToParentRef = (0, import_react13.useRef)(postToParent2);
11534
+ const postToParentRef = (0, import_react14.useRef)(postToParent2);
11502
11535
  postToParentRef.current = postToParent2;
11503
- const aiSectionApiRef = (0, import_react13.useRef)(null);
11504
- const sectionsLoadedRef = (0, import_react13.useRef)(false);
11505
- const pendingScheduleConfigRequests = (0, import_react13.useRef)([]);
11506
- const [toolbarRect, setToolbarRect] = (0, import_react13.useState)(null);
11507
- const [toolbarVariant, setToolbarVariant] = (0, import_react13.useState)("none");
11508
- const toolbarVariantRef = (0, import_react13.useRef)("none");
11536
+ const aiSectionApiRef = (0, import_react14.useRef)(null);
11537
+ const sectionsLoadedRef = (0, import_react14.useRef)(false);
11538
+ const pendingScheduleConfigRequests = (0, import_react14.useRef)([]);
11539
+ const [toolbarRect, setToolbarRect] = (0, import_react14.useState)(null);
11540
+ const [toolbarVariant, setToolbarVariant] = (0, import_react14.useState)("none");
11541
+ const toolbarVariantRef = (0, import_react14.useRef)("none");
11509
11542
  toolbarVariantRef.current = toolbarVariant;
11510
- const [selectedIsCta, setSelectedIsCta] = (0, import_react13.useState)(false);
11511
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react13.useState)(null);
11512
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react13.useState)(false);
11513
- const [toggleState, setToggleState] = (0, import_react13.useState)(null);
11514
- const [maxBadge, setMaxBadge] = (0, import_react13.useState)(null);
11515
- const [activeCommands, setActiveCommands] = (0, import_react13.useState)(/* @__PURE__ */ new Set());
11516
- const [sectionGap, setSectionGap] = (0, import_react13.useState)(null);
11517
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react13.useState)(false);
11518
- const hoveredNavContainerRef = (0, import_react13.useRef)(null);
11519
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react13.useState)(null);
11520
- const hoveredItemElRef = (0, import_react13.useRef)(null);
11521
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react13.useState)(null);
11522
- const siblingHintElRef = (0, import_react13.useRef)(null);
11523
- const [siblingHintRect, setSiblingHintRect] = (0, import_react13.useState)(null);
11524
- const [siblingHintRects, setSiblingHintRects] = (0, import_react13.useState)([]);
11525
- const [isItemDragging, setIsItemDragging] = (0, import_react13.useState)(false);
11526
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react13.useState)(false);
11543
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react14.useState)(false);
11544
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react14.useState)(null);
11545
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react14.useState)(false);
11546
+ const [toggleState, setToggleState] = (0, import_react14.useState)(null);
11547
+ const [maxBadge, setMaxBadge] = (0, import_react14.useState)(null);
11548
+ const [activeCommands, setActiveCommands] = (0, import_react14.useState)(/* @__PURE__ */ new Set());
11549
+ const [sectionGap, setSectionGap] = (0, import_react14.useState)(null);
11550
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react14.useState)(false);
11551
+ const hoveredNavContainerRef = (0, import_react14.useRef)(null);
11552
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react14.useState)(null);
11553
+ const hoveredItemElRef = (0, import_react14.useRef)(null);
11554
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react14.useState)(null);
11555
+ const siblingHintElRef = (0, import_react14.useRef)(null);
11556
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react14.useState)(null);
11557
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react14.useState)([]);
11558
+ const [isItemDragging, setIsItemDragging] = (0, import_react14.useState)(false);
11559
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react14.useState)(false);
11527
11560
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
11528
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react13.useState)(null);
11529
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react13.useState)(null);
11530
- const footerDragRef = (0, import_react13.useRef)(null);
11531
- const [footerDropSlots, setFooterDropSlots] = (0, import_react13.useState)([]);
11532
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react13.useState)(null);
11533
- const [draggedItemRect, setDraggedItemRect] = (0, import_react13.useState)(null);
11534
- const footerPointerDragRef = (0, import_react13.useRef)(null);
11535
- const suppressNextClickRef = (0, import_react13.useRef)(false);
11536
- const suppressClickUntilRef = (0, import_react13.useRef)(0);
11537
- const [linkPopover, setLinkPopover] = (0, import_react13.useState)(null);
11538
- const linkPopoverSessionRef = (0, import_react13.useRef)(null);
11539
- const addNavAfterAnchorRef = (0, import_react13.useRef)(null);
11540
- const editContentRef = (0, import_react13.useRef)({});
11541
- const pendingDeleteUndoRef = (0, import_react13.useRef)(null);
11542
- const [sitePages, setSitePages] = (0, import_react13.useState)([]);
11543
- const [sectionsByPath, setSectionsByPath] = (0, import_react13.useState)({});
11544
- const sectionsPrefetchGenRef = (0, import_react13.useRef)(0);
11545
- const setLinkPopoverRef = (0, import_react13.useRef)(setLinkPopover);
11546
- const linkPopoverPanelRef = (0, import_react13.useRef)(null);
11547
- const linkPopoverOpenRef = (0, import_react13.useRef)(false);
11548
- const linkPopoverGraceUntilRef = (0, import_react13.useRef)(0);
11561
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react14.useState)(null);
11562
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react14.useState)(null);
11563
+ const footerDragRef = (0, import_react14.useRef)(null);
11564
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react14.useState)([]);
11565
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react14.useState)(null);
11566
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react14.useState)(null);
11567
+ const footerPointerDragRef = (0, import_react14.useRef)(null);
11568
+ const suppressNextClickRef = (0, import_react14.useRef)(false);
11569
+ const suppressClickUntilRef = (0, import_react14.useRef)(0);
11570
+ const [linkPopover, setLinkPopover] = (0, import_react14.useState)(null);
11571
+ const linkPopoverSessionRef = (0, import_react14.useRef)(null);
11572
+ const addNavAfterAnchorRef = (0, import_react14.useRef)(null);
11573
+ const editContentRef = (0, import_react14.useRef)({});
11574
+ const pendingDeleteUndoRef = (0, import_react14.useRef)(null);
11575
+ const [sitePages, setSitePages] = (0, import_react14.useState)([]);
11576
+ const [sectionsByPath, setSectionsByPath] = (0, import_react14.useState)({});
11577
+ const sectionsPrefetchGenRef = (0, import_react14.useRef)(0);
11578
+ const setLinkPopoverRef = (0, import_react14.useRef)(setLinkPopover);
11579
+ const linkPopoverPanelRef = (0, import_react14.useRef)(null);
11580
+ const linkPopoverOpenRef = (0, import_react14.useRef)(false);
11581
+ const linkPopoverGraceUntilRef = (0, import_react14.useRef)(0);
11549
11582
  setLinkPopoverRef.current = setLinkPopover;
11550
11583
  linkPopoverSessionRef.current = linkPopover;
11551
11584
  const {
@@ -11583,7 +11616,7 @@ function OhhwellsBridge() {
11583
11616
  const bumpLinkPopoverGrace = () => {
11584
11617
  linkPopoverGraceUntilRef.current = Date.now() + 350;
11585
11618
  };
11586
- const runSectionsPrefetch = (0, import_react13.useCallback)((pages) => {
11619
+ const runSectionsPrefetch = (0, import_react14.useCallback)((pages) => {
11587
11620
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
11588
11621
  const gen = ++sectionsPrefetchGenRef.current;
11589
11622
  const paths = pages.map((p) => p.path);
@@ -11602,9 +11635,9 @@ function OhhwellsBridge() {
11602
11635
  );
11603
11636
  });
11604
11637
  }, [isEditMode, pathname]);
11605
- const runSectionsPrefetchRef = (0, import_react13.useRef)(runSectionsPrefetch);
11638
+ const runSectionsPrefetchRef = (0, import_react14.useRef)(runSectionsPrefetch);
11606
11639
  runSectionsPrefetchRef.current = runSectionsPrefetch;
11607
- (0, import_react13.useEffect)(() => {
11640
+ (0, import_react14.useEffect)(() => {
11608
11641
  if (!linkPopover) {
11609
11642
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
11610
11643
  return;
@@ -11632,7 +11665,7 @@ function OhhwellsBridge() {
11632
11665
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
11633
11666
  };
11634
11667
  }, [linkPopover, postToParent2]);
11635
- (0, import_react13.useEffect)(() => {
11668
+ (0, import_react14.useEffect)(() => {
11636
11669
  if (!isEditMode) return;
11637
11670
  const useFixtures = shouldUseDevFixtures();
11638
11671
  if (useFixtures) {
@@ -11656,14 +11689,14 @@ function OhhwellsBridge() {
11656
11689
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
11657
11690
  return () => window.removeEventListener("message", onSitePages);
11658
11691
  }, [isEditMode, postToParent2]);
11659
- (0, import_react13.useEffect)(() => {
11692
+ (0, import_react14.useEffect)(() => {
11660
11693
  if (!isEditMode || shouldUseDevFixtures()) return;
11661
11694
  void loadAllSectionsManifest().then((manifest) => {
11662
11695
  if (Object.keys(manifest).length === 0) return;
11663
11696
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
11664
11697
  });
11665
11698
  }, [isEditMode]);
11666
- (0, import_react13.useEffect)(() => {
11699
+ (0, import_react14.useEffect)(() => {
11667
11700
  const update = () => {
11668
11701
  const el = activeElRef.current ?? selectedElRef.current;
11669
11702
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -11687,10 +11720,10 @@ function OhhwellsBridge() {
11687
11720
  vvp.removeEventListener("resize", update);
11688
11721
  };
11689
11722
  }, []);
11690
- const refreshStateRules = (0, import_react13.useCallback)(() => {
11723
+ const refreshStateRules = (0, import_react14.useCallback)(() => {
11691
11724
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
11692
11725
  }, []);
11693
- const processConfigRequest = (0, import_react13.useCallback)((insertAfterVal) => {
11726
+ const processConfigRequest = (0, import_react14.useCallback)((insertAfterVal) => {
11694
11727
  const tracker = getSectionsTracker();
11695
11728
  let entries = [];
11696
11729
  try {
@@ -11713,7 +11746,7 @@ function OhhwellsBridge() {
11713
11746
  }
11714
11747
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
11715
11748
  }, [isEditMode]);
11716
- const deactivate = (0, import_react13.useCallback)(() => {
11749
+ const deactivate = (0, import_react14.useCallback)(() => {
11717
11750
  const el = activeElRef.current;
11718
11751
  if (!el) return;
11719
11752
  const key = el.dataset.ohwKey;
@@ -11746,12 +11779,12 @@ function OhhwellsBridge() {
11746
11779
  setToolbarShowEditLink(false);
11747
11780
  postToParent2({ type: "ow:exit-edit" });
11748
11781
  }, [postToParent2]);
11749
- const clearSelectedAttr = (0, import_react13.useCallback)(() => {
11782
+ const clearSelectedAttr = (0, import_react14.useCallback)(() => {
11750
11783
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
11751
11784
  el.removeAttribute("data-ohw-selected");
11752
11785
  });
11753
11786
  }, []);
11754
- const deselect = (0, import_react13.useCallback)(() => {
11787
+ const deselect = (0, import_react14.useCallback)(() => {
11755
11788
  clearSelectedAttr();
11756
11789
  selectedElRef.current = null;
11757
11790
  selectedHrefKeyRef.current = null;
@@ -11776,11 +11809,11 @@ function OhhwellsBridge() {
11776
11809
  setToolbarVariant("none");
11777
11810
  }
11778
11811
  }, [clearSelectedAttr]);
11779
- const markSelected = (0, import_react13.useCallback)((el) => {
11812
+ const markSelected = (0, import_react14.useCallback)((el) => {
11780
11813
  clearSelectedAttr();
11781
11814
  el.setAttribute("data-ohw-selected", "");
11782
11815
  }, [clearSelectedAttr]);
11783
- const resolveHrefKeyElement = (0, import_react13.useCallback)((hrefKey) => {
11816
+ const resolveHrefKeyElement = (0, import_react14.useCallback)((hrefKey) => {
11784
11817
  if (isFooterHrefKey(hrefKey)) {
11785
11818
  return document.querySelector(
11786
11819
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -11795,7 +11828,7 @@ function OhhwellsBridge() {
11795
11828
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
11796
11829
  );
11797
11830
  }, []);
11798
- const resyncSelectedNavigationItem = (0, import_react13.useCallback)(() => {
11831
+ const resyncSelectedNavigationItem = (0, import_react14.useCallback)(() => {
11799
11832
  const hrefKey = selectedHrefKeyRef.current;
11800
11833
  if (hrefKey) {
11801
11834
  const link = resolveHrefKeyElement(hrefKey);
@@ -11833,7 +11866,7 @@ function OhhwellsBridge() {
11833
11866
  );
11834
11867
  }
11835
11868
  }, [resolveHrefKeyElement]);
11836
- const reselectNavigationItem = (0, import_react13.useCallback)((navAnchor) => {
11869
+ const reselectNavigationItem = (0, import_react14.useCallback)((navAnchor) => {
11837
11870
  selectedElRef.current = navAnchor;
11838
11871
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
11839
11872
  selectedFooterColAttrRef.current = null;
@@ -11862,7 +11895,7 @@ function OhhwellsBridge() {
11862
11895
  setToolbarShowEditLink(false);
11863
11896
  setActiveCommands(/* @__PURE__ */ new Set());
11864
11897
  }, [markSelected]);
11865
- const commitNavigationTextEdit = (0, import_react13.useCallback)((navAnchor) => {
11898
+ const commitNavigationTextEdit = (0, import_react14.useCallback)((navAnchor) => {
11866
11899
  const el = activeElRef.current;
11867
11900
  if (!el) return;
11868
11901
  const key = el.dataset.ohwKey;
@@ -11889,7 +11922,7 @@ function OhhwellsBridge() {
11889
11922
  postToParent2({ type: "ow:exit-edit" });
11890
11923
  reselectNavigationItem(navAnchor);
11891
11924
  }, [postToParent2, reselectNavigationItem]);
11892
- const handleAddTopLevelNavItem = (0, import_react13.useCallback)(() => {
11925
+ const handleAddTopLevelNavItem = (0, import_react14.useCallback)(() => {
11893
11926
  const items = listNavbarRootItems();
11894
11927
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
11895
11928
  deselectRef.current();
@@ -11901,7 +11934,7 @@ function OhhwellsBridge() {
11901
11934
  intent: "add-nav"
11902
11935
  });
11903
11936
  }, []);
11904
- const maybeWarnNavLinkDropdownConflict = (0, import_react13.useCallback)(
11937
+ const maybeWarnNavLinkDropdownConflict = (0, import_react14.useCallback)(
11905
11938
  (anchor) => {
11906
11939
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
11907
11940
  if (!navDropdownsOpenOnClick()) return;
@@ -11914,7 +11947,7 @@ function OhhwellsBridge() {
11914
11947
  },
11915
11948
  [postToParent2]
11916
11949
  );
11917
- const handleNavDropdownOpenChange = (0, import_react13.useCallback)((open) => {
11950
+ const handleNavDropdownOpenChange = (0, import_react14.useCallback)((open) => {
11918
11951
  const selected = selectedElRef.current;
11919
11952
  if (!selected || !isNavigationItem2(selected)) return;
11920
11953
  setNavGroupForceOpen(selected, open);
@@ -11926,7 +11959,7 @@ function OhhwellsBridge() {
11926
11959
  }
11927
11960
  });
11928
11961
  }, []);
11929
- const handleFooterHeadingVisibleChange = (0, import_react13.useCallback)(
11962
+ const handleFooterHeadingVisibleChange = (0, import_react14.useCallback)(
11930
11963
  (visible) => {
11931
11964
  const selected = selectedElRef.current;
11932
11965
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -11950,7 +11983,7 @@ function OhhwellsBridge() {
11950
11983
  },
11951
11984
  [postToParent2]
11952
11985
  );
11953
- const enterEditOnNewItem = (0, import_react13.useCallback)((anchor) => {
11986
+ const enterEditOnNewItem = (0, import_react14.useCallback)((anchor) => {
11954
11987
  const label = anchor.querySelector('[data-ohw-editable="text"]');
11955
11988
  if (!label) {
11956
11989
  selectRef.current(anchor);
@@ -11959,7 +11992,7 @@ function OhhwellsBridge() {
11959
11992
  setNavGroupForceOpen(anchor, true);
11960
11993
  activateRef.current(label);
11961
11994
  }, []);
11962
- const handleAddChildItem = (0, import_react13.useCallback)(() => {
11995
+ const handleAddChildItem = (0, import_react14.useCallback)(() => {
11963
11996
  const selected = selectedElRef.current;
11964
11997
  if (!selected) return;
11965
11998
  if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
@@ -12035,7 +12068,7 @@ function OhhwellsBridge() {
12035
12068
  enterEditOnNewItem(result.anchor);
12036
12069
  });
12037
12070
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
12038
- const handleAddFooterColumn = (0, import_react13.useCallback)(() => {
12071
+ const handleAddFooterColumn = (0, import_react14.useCallback)(() => {
12039
12072
  if (!canAddFooterColumn()) {
12040
12073
  postToParent2({
12041
12074
  type: "ow:toast",
@@ -12056,7 +12089,7 @@ function OhhwellsBridge() {
12056
12089
  selectRef.current(result.firstLink);
12057
12090
  });
12058
12091
  }, [postToParent2]);
12059
- const clearFooterDragVisuals = (0, import_react13.useCallback)(() => {
12092
+ const clearFooterDragVisuals = (0, import_react14.useCallback)(() => {
12060
12093
  footerDragRef.current = null;
12061
12094
  setSiblingHintRects([]);
12062
12095
  setFooterDropSlots([]);
@@ -12065,7 +12098,7 @@ function OhhwellsBridge() {
12065
12098
  setIsItemDragging(false);
12066
12099
  unlockFooterDragInteraction();
12067
12100
  }, []);
12068
- const refreshFooterDragVisuals = (0, import_react13.useCallback)((session, activeSlot, clientX, clientY) => {
12101
+ const refreshFooterDragVisuals = (0, import_react14.useCallback)((session, activeSlot, clientX, clientY) => {
12069
12102
  const dragged = session.draggedEl;
12070
12103
  setDraggedItemRect(dragged.getBoundingClientRect());
12071
12104
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -12090,13 +12123,13 @@ function OhhwellsBridge() {
12090
12123
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
12091
12124
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
12092
12125
  }, []);
12093
- const refreshFooterDragVisualsRef = (0, import_react13.useRef)(refreshFooterDragVisuals);
12126
+ const refreshFooterDragVisualsRef = (0, import_react14.useRef)(refreshFooterDragVisuals);
12094
12127
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
12095
- const commitFooterDragRef = (0, import_react13.useRef)(() => {
12128
+ const commitFooterDragRef = (0, import_react14.useRef)(() => {
12096
12129
  });
12097
- const beginFooterDragRef = (0, import_react13.useRef)(() => {
12130
+ const beginFooterDragRef = (0, import_react14.useRef)(() => {
12098
12131
  });
12099
- const beginFooterDrag = (0, import_react13.useCallback)(
12132
+ const beginFooterDrag = (0, import_react14.useCallback)(
12100
12133
  (session) => {
12101
12134
  const rect = session.draggedEl.getBoundingClientRect();
12102
12135
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -12116,7 +12149,7 @@ function OhhwellsBridge() {
12116
12149
  [refreshFooterDragVisuals]
12117
12150
  );
12118
12151
  beginFooterDragRef.current = beginFooterDrag;
12119
- const commitFooterDrag = (0, import_react13.useCallback)(
12152
+ const commitFooterDrag = (0, import_react14.useCallback)(
12120
12153
  (clientX, clientY) => {
12121
12154
  const session = footerDragRef.current;
12122
12155
  if (!session) {
@@ -12220,7 +12253,7 @@ function OhhwellsBridge() {
12220
12253
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
12221
12254
  );
12222
12255
  commitFooterDragRef.current = commitFooterDrag;
12223
- const startFooterLinkDrag = (0, import_react13.useCallback)(
12256
+ const startFooterLinkDrag = (0, import_react14.useCallback)(
12224
12257
  (anchor, clientX, clientY, wasSelected) => {
12225
12258
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
12226
12259
  if (!hrefKey || !isFooterHrefKey(hrefKey)) return false;
@@ -12241,7 +12274,7 @@ function OhhwellsBridge() {
12241
12274
  },
12242
12275
  [beginFooterDrag]
12243
12276
  );
12244
- const startFooterColumnDrag = (0, import_react13.useCallback)(
12277
+ const startFooterColumnDrag = (0, import_react14.useCallback)(
12245
12278
  (columnEl, clientX, clientY, wasSelected) => {
12246
12279
  const columns = listFooterColumns();
12247
12280
  const idx = columns.indexOf(columnEl);
@@ -12261,7 +12294,7 @@ function OhhwellsBridge() {
12261
12294
  },
12262
12295
  [beginFooterDrag]
12263
12296
  );
12264
- const handleItemDragStart = (0, import_react13.useCallback)(
12297
+ const handleItemDragStart = (0, import_react14.useCallback)(
12265
12298
  (e) => {
12266
12299
  const selected = selectedElRef.current;
12267
12300
  if (!selected) {
@@ -12281,7 +12314,7 @@ function OhhwellsBridge() {
12281
12314
  },
12282
12315
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
12283
12316
  );
12284
- const handleItemDragEnd = (0, import_react13.useCallback)(
12317
+ const handleItemDragEnd = (0, import_react14.useCallback)(
12285
12318
  (e) => {
12286
12319
  if (footerDragRef.current) {
12287
12320
  const x = e?.clientX;
@@ -12307,7 +12340,7 @@ function OhhwellsBridge() {
12307
12340
  },
12308
12341
  [commitFooterDrag, commitNavDrag, navDragRef]
12309
12342
  );
12310
- const handleItemChromePointerDown = (0, import_react13.useCallback)((e) => {
12343
+ const handleItemChromePointerDown = (0, import_react14.useCallback)((e) => {
12311
12344
  if (e.button !== 0) return;
12312
12345
  const selected = selectedElRef.current;
12313
12346
  if (!selected) return;
@@ -12338,7 +12371,7 @@ function OhhwellsBridge() {
12338
12371
  }
12339
12372
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
12340
12373
  }, [armNavPressFromChrome]);
12341
- const handleItemChromeClick = (0, import_react13.useCallback)((clientX, clientY) => {
12374
+ const handleItemChromeClick = (0, import_react14.useCallback)((clientX, clientY) => {
12342
12375
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
12343
12376
  suppressNextClickRef.current = false;
12344
12377
  return;
@@ -12351,7 +12384,7 @@ function OhhwellsBridge() {
12351
12384
  }, []);
12352
12385
  reselectNavigationItemRef.current = reselectNavigationItem;
12353
12386
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
12354
- const select = (0, import_react13.useCallback)((anchor) => {
12387
+ const select = (0, import_react14.useCallback)((anchor) => {
12355
12388
  if (!isNavigationItem2(anchor)) return;
12356
12389
  if (activeElRef.current) deactivate();
12357
12390
  aiSectionApiRef.current?.selectFromElement(anchor);
@@ -12390,7 +12423,7 @@ function OhhwellsBridge() {
12390
12423
  setToolbarShowEditLink(false);
12391
12424
  setActiveCommands(/* @__PURE__ */ new Set());
12392
12425
  }, [deactivate, markSelected]);
12393
- const selectFrame = (0, import_react13.useCallback)((el) => {
12426
+ const selectFrame = (0, import_react14.useCallback)((el) => {
12394
12427
  if (!isNavigationContainer(el)) return;
12395
12428
  if (activeElRef.current) deactivate();
12396
12429
  aiSectionApiRef.current?.selectFromElement(el);
@@ -12437,7 +12470,7 @@ function OhhwellsBridge() {
12437
12470
  setToolbarShowEditLink(false);
12438
12471
  setActiveCommands(/* @__PURE__ */ new Set());
12439
12472
  }, [deactivate, markSelected, postToParent2]);
12440
- const activate = (0, import_react13.useCallback)((el, options) => {
12473
+ const activate = (0, import_react14.useCallback)((el, options) => {
12441
12474
  if (activeElRef.current === el) return;
12442
12475
  clearSelectedAttr();
12443
12476
  selectedElRef.current = null;
@@ -12514,8 +12547,8 @@ function OhhwellsBridge() {
12514
12547
  selectRef.current = select;
12515
12548
  selectFrameRef.current = selectFrame;
12516
12549
  deselectRef.current = deselect;
12517
- const lastSiteWideScopeRef = (0, import_react13.useRef)(null);
12518
- (0, import_react13.useEffect)(() => {
12550
+ const lastSiteWideScopeRef = (0, import_react14.useRef)(null);
12551
+ (0, import_react14.useEffect)(() => {
12519
12552
  if (!isEditMode) {
12520
12553
  if (lastSiteWideScopeRef.current !== false) {
12521
12554
  lastSiteWideScopeRef.current = false;
@@ -12541,7 +12574,7 @@ function OhhwellsBridge() {
12541
12574
  isFooterFrameSelection,
12542
12575
  postToParent2
12543
12576
  ]);
12544
- (0, import_react13.useLayoutEffect)(() => {
12577
+ (0, import_react14.useLayoutEffect)(() => {
12545
12578
  if (!subdomain || isEditMode) {
12546
12579
  setFetchState("done");
12547
12580
  return;
@@ -12612,7 +12645,7 @@ function OhhwellsBridge() {
12612
12645
  cancelled = true;
12613
12646
  };
12614
12647
  }, [subdomain, isEditMode]);
12615
- (0, import_react13.useEffect)(() => {
12648
+ (0, import_react14.useEffect)(() => {
12616
12649
  if (!subdomain || isEditMode) return;
12617
12650
  let debounceTimer = null;
12618
12651
  let observer = null;
@@ -12663,16 +12696,16 @@ function OhhwellsBridge() {
12663
12696
  if (debounceTimer) clearTimeout(debounceTimer);
12664
12697
  };
12665
12698
  }, [subdomain, isEditMode, pathname]);
12666
- (0, import_react13.useLayoutEffect)(() => {
12699
+ (0, import_react14.useLayoutEffect)(() => {
12667
12700
  const el = document.getElementById("ohw-loader");
12668
12701
  if (!el) return;
12669
12702
  const visible = Boolean(subdomain) && fetchState !== "done";
12670
12703
  el.style.display = visible ? "flex" : "none";
12671
12704
  }, [subdomain, fetchState]);
12672
- (0, import_react13.useEffect)(() => {
12705
+ (0, import_react14.useEffect)(() => {
12673
12706
  postToParent2({ type: "ow:navigation", path: pathname });
12674
12707
  }, [pathname, postToParent2]);
12675
- (0, import_react13.useEffect)(() => {
12708
+ (0, import_react14.useEffect)(() => {
12676
12709
  if (!isEditMode) return;
12677
12710
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
12678
12711
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -12680,7 +12713,7 @@ function OhhwellsBridge() {
12680
12713
  deselectRef.current();
12681
12714
  deactivateRef.current();
12682
12715
  }, [pathname, isEditMode]);
12683
- (0, import_react13.useEffect)(() => {
12716
+ (0, import_react14.useEffect)(() => {
12684
12717
  const contentForNav = () => {
12685
12718
  if (isEditMode) return editContentRef.current;
12686
12719
  if (!subdomain) return {};
@@ -12745,7 +12778,7 @@ function OhhwellsBridge() {
12745
12778
  observer?.disconnect();
12746
12779
  };
12747
12780
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
12748
- (0, import_react13.useEffect)(() => {
12781
+ (0, import_react14.useEffect)(() => {
12749
12782
  if (!isEditMode) return;
12750
12783
  const measure = () => {
12751
12784
  const h = document.body.scrollHeight;
@@ -12769,7 +12802,7 @@ function OhhwellsBridge() {
12769
12802
  window.removeEventListener("resize", handleResize);
12770
12803
  };
12771
12804
  }, [pathname, isEditMode, postToParent2]);
12772
- (0, import_react13.useEffect)(() => {
12805
+ (0, import_react14.useEffect)(() => {
12773
12806
  if (!subdomainFromQuery || isEditMode) return;
12774
12807
  const handleClick = (e) => {
12775
12808
  const anchor = e.target.closest("a");
@@ -12785,7 +12818,7 @@ function OhhwellsBridge() {
12785
12818
  document.addEventListener("click", handleClick, true);
12786
12819
  return () => document.removeEventListener("click", handleClick, true);
12787
12820
  }, [subdomainFromQuery, isEditMode, router]);
12788
- (0, import_react13.useEffect)(() => {
12821
+ (0, import_react14.useEffect)(() => {
12789
12822
  if (!isEditMode) {
12790
12823
  editStylesRef.current?.base.remove();
12791
12824
  editStylesRef.current?.forceHover.remove();
@@ -14695,7 +14728,7 @@ function OhhwellsBridge() {
14695
14728
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
14696
14729
  };
14697
14730
  }, [isEditMode, refreshStateRules]);
14698
- (0, import_react13.useEffect)(() => {
14731
+ (0, import_react14.useEffect)(() => {
14699
14732
  if (!isEditMode) return;
14700
14733
  const THRESHOLD = 10;
14701
14734
  const resolveWasSelected = (el) => {
@@ -14849,7 +14882,7 @@ function OhhwellsBridge() {
14849
14882
  unlockFooterDragInteraction();
14850
14883
  };
14851
14884
  }, [isEditMode]);
14852
- (0, import_react13.useEffect)(() => {
14885
+ (0, import_react14.useEffect)(() => {
14853
14886
  const handler = (e) => {
14854
14887
  if (e.data?.type !== "ow:request-schedule-config") return;
14855
14888
  const insertAfterVal = e.data.insertAfter;
@@ -14865,7 +14898,7 @@ function OhhwellsBridge() {
14865
14898
  window.addEventListener("message", handler);
14866
14899
  return () => window.removeEventListener("message", handler);
14867
14900
  }, [processConfigRequest]);
14868
- (0, import_react13.useEffect)(() => {
14901
+ (0, import_react14.useEffect)(() => {
14869
14902
  if (!isEditMode) return;
14870
14903
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
14871
14904
  el.removeAttribute("data-ohw-active-state");
@@ -14901,13 +14934,13 @@ function OhhwellsBridge() {
14901
14934
  clearTimeout(timer);
14902
14935
  };
14903
14936
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
14904
- (0, import_react13.useEffect)(() => {
14937
+ (0, import_react14.useEffect)(() => {
14905
14938
  scrollToHashSectionWhenReady();
14906
14939
  const onHashChange = () => scrollToHashSectionWhenReady();
14907
14940
  window.addEventListener("hashchange", onHashChange);
14908
14941
  return () => window.removeEventListener("hashchange", onHashChange);
14909
14942
  }, [pathname]);
14910
- const handleCommand = (0, import_react13.useCallback)((cmd) => {
14943
+ const handleCommand = (0, import_react14.useCallback)((cmd) => {
14911
14944
  const el = activeElRef.current;
14912
14945
  const selBefore = window.getSelection();
14913
14946
  let savedOffsets = null;
@@ -14943,7 +14976,7 @@ function OhhwellsBridge() {
14943
14976
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
14944
14977
  refreshActiveCommandsRef.current();
14945
14978
  }, []);
14946
- const handleStateChange = (0, import_react13.useCallback)((state) => {
14979
+ const handleStateChange = (0, import_react14.useCallback)((state) => {
14947
14980
  if (!activeStateElRef.current) return;
14948
14981
  const el = activeStateElRef.current;
14949
14982
  if (state === "Default") {
@@ -14956,7 +14989,7 @@ function OhhwellsBridge() {
14956
14989
  }
14957
14990
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
14958
14991
  }, [deactivate]);
14959
- const reselectAfterLinkPopover = (0, import_react13.useCallback)(
14992
+ const reselectAfterLinkPopover = (0, import_react14.useCallback)(
14960
14993
  (hrefKey) => {
14961
14994
  requestAnimationFrame(() => {
14962
14995
  const el = resolveHrefKeyElement(hrefKey);
@@ -14965,7 +14998,7 @@ function OhhwellsBridge() {
14965
14998
  },
14966
14999
  [resolveHrefKeyElement]
14967
15000
  );
14968
- const closeLinkPopover = (0, import_react13.useCallback)(() => {
15001
+ const closeLinkPopover = (0, import_react14.useCallback)(() => {
14969
15002
  const session = linkPopoverSessionRef.current;
14970
15003
  addNavAfterAnchorRef.current = null;
14971
15004
  setLinkPopover(null);
@@ -14973,9 +15006,9 @@ function OhhwellsBridge() {
14973
15006
  reselectAfterLinkPopover(session.key);
14974
15007
  }
14975
15008
  }, [reselectAfterLinkPopover]);
14976
- const closeLinkPopoverRef = (0, import_react13.useRef)(closeLinkPopover);
15009
+ const closeLinkPopoverRef = (0, import_react14.useRef)(closeLinkPopover);
14977
15010
  closeLinkPopoverRef.current = closeLinkPopover;
14978
- const openLinkPopoverForActive = (0, import_react13.useCallback)(() => {
15011
+ const openLinkPopoverForActive = (0, import_react14.useCallback)(() => {
14979
15012
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
14980
15013
  if (!hrefCtx) return;
14981
15014
  bumpLinkPopoverGrace();
@@ -14986,7 +15019,7 @@ function OhhwellsBridge() {
14986
15019
  });
14987
15020
  deactivate();
14988
15021
  }, [deactivate]);
14989
- const openLinkPopoverForSelected = (0, import_react13.useCallback)(() => {
15022
+ const openLinkPopoverForSelected = (0, import_react14.useCallback)(() => {
14990
15023
  const anchor = selectedElRef.current;
14991
15024
  if (!anchor) return;
14992
15025
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -14999,7 +15032,7 @@ function OhhwellsBridge() {
14999
15032
  });
15000
15033
  deselect();
15001
15034
  }, [deselect]);
15002
- const handleSelectParent = (0, import_react13.useCallback)(() => {
15035
+ const handleSelectParent = (0, import_react14.useCallback)(() => {
15003
15036
  const selected = selectedElRef.current;
15004
15037
  if (!selected) return;
15005
15038
  if (toolbarVariantRef.current === "select-frame") {
@@ -15026,7 +15059,7 @@ function OhhwellsBridge() {
15026
15059
  }
15027
15060
  deselectRef.current();
15028
15061
  }, []);
15029
- const handleDuplicateSelected = (0, import_react13.useCallback)(() => {
15062
+ const handleDuplicateSelected = (0, import_react14.useCallback)(() => {
15030
15063
  const selected = selectedElRef.current;
15031
15064
  if (!selected || !isNavigationItem2(selected)) return;
15032
15065
  const hrefKey = selected.getAttribute("data-ohw-href-key");
@@ -15116,7 +15149,7 @@ function OhhwellsBridge() {
15116
15149
  });
15117
15150
  }
15118
15151
  }, [postToParent2]);
15119
- const runPendingDeleteUndo = (0, import_react13.useCallback)(() => {
15152
+ const runPendingDeleteUndo = (0, import_react14.useCallback)(() => {
15120
15153
  const pending = pendingDeleteUndoRef.current;
15121
15154
  if (!pending) return false;
15122
15155
  pendingDeleteUndoRef.current = null;
@@ -15124,7 +15157,7 @@ function OhhwellsBridge() {
15124
15157
  enforceLinkHrefs();
15125
15158
  return true;
15126
15159
  }, []);
15127
- const handleDeleteSelected = (0, import_react13.useCallback)(() => {
15160
+ const handleDeleteSelected = (0, import_react14.useCallback)(() => {
15128
15161
  const selected = selectedElRef.current;
15129
15162
  if (!selected) return false;
15130
15163
  return deleteSelectedNavFooterItem({
@@ -15145,7 +15178,7 @@ function OhhwellsBridge() {
15145
15178
  }, [postToParent2]);
15146
15179
  handleDeleteSelectedRef.current = handleDeleteSelected;
15147
15180
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
15148
- const handleLinkPopoverSubmit = (0, import_react13.useCallback)(
15181
+ const handleLinkPopoverSubmit = (0, import_react14.useCallback)(
15149
15182
  (target) => {
15150
15183
  const session = linkPopoverSessionRef.current;
15151
15184
  if (!session) return;
@@ -15211,19 +15244,19 @@ function OhhwellsBridge() {
15211
15244
  const showEditLink = toolbarShowEditLink;
15212
15245
  const currentSections = sectionsByPath[pathname] ?? [];
15213
15246
  linkPopoverOpenRef.current = linkPopover !== null;
15214
- const handleMediaReplace = (0, import_react13.useCallback)(
15247
+ const handleMediaReplace = (0, import_react14.useCallback)(
15215
15248
  (key) => {
15216
15249
  postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
15217
15250
  },
15218
15251
  [postToParent2, mediaHover?.elementType]
15219
15252
  );
15220
- const handleEditCarousel = (0, import_react13.useCallback)(
15253
+ const handleEditCarousel = (0, import_react14.useCallback)(
15221
15254
  (key) => {
15222
15255
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
15223
15256
  },
15224
15257
  [postToParent2]
15225
15258
  );
15226
- const handleMediaFadeOutComplete = (0, import_react13.useCallback)((key) => {
15259
+ const handleMediaFadeOutComplete = (0, import_react14.useCallback)((key) => {
15227
15260
  setUploadingRects((prev) => {
15228
15261
  if (!(key in prev)) return prev;
15229
15262
  const next = { ...prev };
@@ -15231,7 +15264,7 @@ function OhhwellsBridge() {
15231
15264
  return next;
15232
15265
  });
15233
15266
  }, []);
15234
- const handleVideoSettingsChange = (0, import_react13.useCallback)(
15267
+ const handleVideoSettingsChange = (0, import_react14.useCallback)(
15235
15268
  (key, settings) => {
15236
15269
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
15237
15270
  const video = getVideoEl2(el);