@ohhwells/bridge 0.1.163 → 0.1.164-next.438

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
@@ -86,6 +86,7 @@ __export(index_exports, {
86
86
  hasMountedContentNodes: () => hasMountedContentNodes,
87
87
  indexCollectionItems: () => indexCollectionItems,
88
88
  insertFooterHours: () => insertFooterHours,
89
+ isDeadPageHref: () => isDeadPageHref,
89
90
  isEditSessionActive: () => isEditSessionActive,
90
91
  isPlainLeftClick: () => isPlainLeftClick,
91
92
  isRenderableFooterTree: () => isRenderableFooterTree,
@@ -97,6 +98,7 @@ __export(index_exports, {
97
98
  parseAiFooterState: () => parseAiFooterState,
98
99
  parseAiSectionsState: () => parseAiSectionsState,
99
100
  parseTarget: () => parseTarget,
101
+ planBuildPageSync: () => planBuildPageSync,
100
102
  recordOverriddenPaths: () => recordOverriddenPaths,
101
103
  releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
102
104
  removeFooterBlock: () => removeFooterBlock,
@@ -115,7 +117,7 @@ __export(index_exports, {
115
117
  module.exports = __toCommonJS(index_exports);
116
118
 
117
119
  // src/OhhwellsBridge.tsx
118
- var import_react23 = __toESM(require("react"), 1);
120
+ var import_react24 = __toESM(require("react"), 1);
119
121
  var import_client3 = require("react-dom/client");
120
122
  var import_react_dom5 = require("react-dom");
121
123
 
@@ -954,6 +956,10 @@ function useOhwCarousel(key, initial) {
954
956
  if (Array.isArray(detail?.images)) setImages(detail.images);
955
957
  };
956
958
  el.addEventListener(CAROUSEL_EVENT, onChange);
959
+ const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
960
+ if (pending.length > 0) {
961
+ setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
962
+ }
957
963
  return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
958
964
  }, [key]);
959
965
  const bind = {
@@ -1208,21 +1214,21 @@ function chromeFrom(sample) {
1208
1214
  };
1209
1215
  }
1210
1216
  function filledPrimary(seed) {
1211
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1212
- const luminance = relativeLuminance(paint);
1217
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1218
+ const luminance = relativeLuminance(paint2);
1213
1219
  return {
1214
- background: toCss({ ...paint, a: 1 }),
1220
+ background: toCss({ ...paint2, a: 1 }),
1215
1221
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1216
1222
  borderColor: TRANSPARENT,
1217
1223
  borderWidth: "0px"
1218
1224
  };
1219
1225
  }
1220
1226
  function generatedSecondary(primary) {
1221
- const paint = accentColor(primary);
1227
+ const paint2 = accentColor(primary);
1222
1228
  return {
1223
1229
  background: TRANSPARENT,
1224
- color: paint,
1225
- borderColor: paint,
1230
+ color: paint2,
1231
+ borderColor: paint2,
1226
1232
  borderWidth: "1px"
1227
1233
  };
1228
1234
  }
@@ -1235,9 +1241,9 @@ function generatedGhost(primary) {
1235
1241
  };
1236
1242
  }
1237
1243
  function normalizeOutlineChrome(outline, primary) {
1238
- const paint = accentColor(primary);
1244
+ const paint2 = accentColor(primary);
1239
1245
  const text = parseColor(outline.color);
1240
- const paintRgb = parseColor(paint);
1246
+ const paintRgb = parseColor(paint2);
1241
1247
  const primaryLabel = parseColor(primary.color);
1242
1248
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1243
1249
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1246,8 +1252,8 @@ function normalizeOutlineChrome(outline, primary) {
1246
1252
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1247
1253
  return {
1248
1254
  ...outline,
1249
- color: paint,
1250
- borderColor: hasBorder ? paint : outline.borderColor
1255
+ color: paint2,
1256
+ borderColor: hasBorder ? paint2 : outline.borderColor
1251
1257
  };
1252
1258
  }
1253
1259
  function generateButtonVariants(samples) {
@@ -2638,6 +2644,14 @@ function socialHrefKey(item) {
2638
2644
  function socialIconKey(item) {
2639
2645
  return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
2640
2646
  }
2647
+ function pendingIconKey(item) {
2648
+ const existing = socialIconKey(item);
2649
+ if (existing) return existing;
2650
+ const base = socialHrefKey(item)?.replace(/-href$/, "");
2651
+ if (!base) return null;
2652
+ const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
2653
+ return taken && taken !== item ? `${base}-icon` : base;
2654
+ }
2641
2655
  var SOCIAL_PLATFORM_LABELS = {
2642
2656
  instagram: "Instagram",
2643
2657
  facebook: "Facebook",
@@ -2835,9 +2849,9 @@ function reconcileSocialsFromContent(content, root = document) {
2835
2849
  listSocialsRows(root).forEach((row) => {
2836
2850
  const rowDisplay = socialsDisplayFor(row, content);
2837
2851
  listSocialItems(row).forEach((item) => {
2838
- const key = socialIconKey(item) ?? socialHrefKey(item)?.replace(/-href$/, "");
2852
+ const key = pendingIconKey(item);
2839
2853
  const stored2 = key ? content[key] : void 0;
2840
- if (!stored2?.trim()) return;
2854
+ if (!stored2?.trim().startsWith("<")) return;
2841
2855
  const existing = item.querySelector(ICON_SELECTOR);
2842
2856
  if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
2843
2857
  ensureIconSlot(item);
@@ -3097,8 +3111,7 @@ function ensureIconSlot(item) {
3097
3111
  const adopted = adoptAsIconSlot(drawn, base);
3098
3112
  if (adopted) return adopted;
3099
3113
  }
3100
- const taken = document.querySelector(`[data-ohw-key="${base}"]`);
3101
- const iconKey = taken && taken !== item ? `${base}-icon` : base;
3114
+ const iconKey = pendingIconKey(item) ?? base;
3102
3115
  const slot = document.createElement("span");
3103
3116
  slot.setAttribute("data-ohw-key", iconKey);
3104
3117
  slot.setAttribute("data-ohw-editable", "icon");
@@ -3610,11 +3623,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
3610
3623
  container.appendChild(column);
3611
3624
  return { column, firstLink };
3612
3625
  }
3613
- function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3626
+ function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3614
3627
  if (!canAddFooterColumn()) {
3615
3628
  throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
3616
3629
  }
3617
- const resolvedHref = linkHref || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3630
+ const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3618
3631
  const colIndex = getNextFooterColumnIndex();
3619
3632
  const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
3620
3633
  if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
@@ -3993,8 +4006,8 @@ function duplicateFooterItem(sourceAnchor) {
3993
4006
  const column = findFooterColumnForLink(sourceAnchor);
3994
4007
  if (!column) return null;
3995
4008
  const href = getLinkHref(sourceAnchor);
3996
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3997
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4009
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4010
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
3998
4011
  return insertFooterItem(column, href || "/", label, sourceAnchor);
3999
4012
  }
4000
4013
  function footerLabelKeyFromHrefKey(hrefKey) {
@@ -4004,8 +4017,8 @@ function deleteFooterItem(sourceAnchor) {
4004
4017
  if (!isFooterLinkAnchor(sourceAnchor)) return null;
4005
4018
  const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
4006
4019
  if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
4007
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4008
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4020
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4021
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
4009
4022
  const labelKey = footerLabelKeyFromHrefKey(hrefKey);
4010
4023
  const previousOrder = getFooterOrderFromDom();
4011
4024
  const previousOrderJson = JSON.stringify(previousOrder);
@@ -4973,8 +4986,8 @@ function remapNavKeysInSubtree(root, keyMap) {
4973
4986
  const mapped = keyMap.get(oldHrefKey);
4974
4987
  if (!mapped) return;
4975
4988
  el.setAttribute("data-ohw-href-key", mapped.hrefKey);
4976
- const labelEl = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4977
- if (labelEl) labelEl.setAttribute("data-ohw-key", mapped.labelKey);
4989
+ const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4990
+ if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
4978
4991
  };
4979
4992
  if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
4980
4993
  root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
@@ -4982,10 +4995,10 @@ function remapNavKeysInSubtree(root, keyMap) {
4982
4995
  function readNavLinkSnapshot(hrefKey) {
4983
4996
  const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
4984
4997
  if (!el) return { href: "/", label: "Untitled" };
4985
- const labelEl = el.querySelector('[data-ohw-editable="text"]');
4998
+ const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
4986
4999
  return {
4987
5000
  href: getLinkHref2(el),
4988
- label: (labelEl?.textContent ?? "").trim() || "Untitled"
5001
+ label: (labelEl2?.textContent ?? "").trim() || "Untitled"
4989
5002
  };
4990
5003
  }
4991
5004
  function findClonedNavAnchor(unit, hrefKey) {
@@ -5159,8 +5172,8 @@ function deleteNavbarItem(sourceAnchor) {
5159
5172
  if (!isNavbarLinkItem(sourceAnchor)) return null;
5160
5173
  const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
5161
5174
  if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
5162
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5163
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
5175
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5176
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
5164
5177
  const previousForest = getNavForestFromDom();
5165
5178
  const previousOrderJson = serializeNavOrder(previousForest);
5166
5179
  const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
@@ -6763,6 +6776,21 @@ function pricingCardFeatureCount(tree, index) {
6763
6776
  const target = findPricingCollection(tree)?.children?.[index];
6764
6777
  return target ? pricingFeatureList(target).length : 0;
6765
6778
  }
6779
+ function prevailingFeatureIcon(features) {
6780
+ const counts = /* @__PURE__ */ new Map();
6781
+ for (const row of features) {
6782
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6783
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6784
+ entry.count += 1;
6785
+ counts.set(key, entry);
6786
+ }
6787
+ let best = null;
6788
+ for (const entry of counts.values()) {
6789
+ if (!best || entry.count > best.count) best = entry;
6790
+ }
6791
+ if (!best) return {};
6792
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6793
+ }
6766
6794
  function addPricingCardFeature(tree, index, text) {
6767
6795
  return withPricingCollection(tree, (collection) => {
6768
6796
  const children = collection.children;
@@ -6771,7 +6799,7 @@ function addPricingCardFeature(tree, index, text) {
6771
6799
  const features = pricingFeatureList(target);
6772
6800
  if (features.length >= PRICING_FEATURES_MAX) return false;
6773
6801
  target.slots = target.slots ?? {};
6774
- target.slots.features = [...features, { text }];
6802
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6775
6803
  return true;
6776
6804
  });
6777
6805
  }
@@ -7415,6 +7443,120 @@ function findSelectableNavContainer(doc = document) {
7415
7443
  );
7416
7444
  }
7417
7445
 
7446
+ // src/lib/youtube.ts
7447
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7448
+ function extractYouTubeId(input) {
7449
+ const trimmed = input.trim();
7450
+ if (!trimmed) return null;
7451
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7452
+ let url;
7453
+ try {
7454
+ url = new URL(trimmed);
7455
+ } catch {
7456
+ return null;
7457
+ }
7458
+ const host = url.hostname.replace(/^www\./, "");
7459
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7460
+ return null;
7461
+ }
7462
+ let candidate = null;
7463
+ if (host === "youtu.be") {
7464
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7465
+ } else if (url.pathname === "/watch") {
7466
+ candidate = url.searchParams.get("v");
7467
+ } else {
7468
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7469
+ candidate = match ? match[1] : null;
7470
+ }
7471
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7472
+ }
7473
+
7474
+ // src/lib/section-embed.ts
7475
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7476
+ function readStoredEmbed(value) {
7477
+ if (value.startsWith("start\n")) {
7478
+ return { raw: value.slice("start\n".length), at: "start" };
7479
+ }
7480
+ return { raw: value, at: "end" };
7481
+ }
7482
+ function embedFrameSrc(value) {
7483
+ const videoId = extractYouTubeId(value);
7484
+ if (videoId) {
7485
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7486
+ }
7487
+ let url;
7488
+ try {
7489
+ url = new URL(value);
7490
+ } catch {
7491
+ return null;
7492
+ }
7493
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7494
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7495
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7496
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7497
+ return { src, title: "Map" };
7498
+ }
7499
+ if (host === "maps.app.goo.gl") {
7500
+ return { src: value, title: "Map" };
7501
+ }
7502
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7503
+ return { src: value, title: "Calendar" };
7504
+ }
7505
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7506
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7507
+ }
7508
+ if (host === "forms.gle") {
7509
+ return { src: value, title: "Form" };
7510
+ }
7511
+ return null;
7512
+ }
7513
+ function place(section, box, at) {
7514
+ if (at === "start") {
7515
+ section.insertBefore(box, section.firstChild);
7516
+ return;
7517
+ }
7518
+ section.appendChild(box);
7519
+ }
7520
+ function paint(section, key, src, title, at) {
7521
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7522
+ const frame = existing?.querySelector("iframe");
7523
+ if (existing && frame) {
7524
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7525
+ frame.title = title;
7526
+ place(section, existing, at);
7527
+ return;
7528
+ }
7529
+ existing?.remove();
7530
+ const box = document.createElement("div");
7531
+ box.setAttribute("data-ohw-section-embed", key);
7532
+ box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
7533
+ const frameWrap = document.createElement("div");
7534
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7535
+ const iframe = document.createElement("iframe");
7536
+ iframe.src = src;
7537
+ iframe.title = title;
7538
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7539
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7540
+ iframe.setAttribute("allowfullscreen", "");
7541
+ frameWrap.appendChild(iframe);
7542
+ box.appendChild(frameWrap);
7543
+ place(section, box, at);
7544
+ }
7545
+ function applySectionEmbeds(content) {
7546
+ for (const [key, val] of Object.entries(content)) {
7547
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7548
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7549
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7550
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7551
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7552
+ if (!section || !stored || !frame) {
7553
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7554
+ continue;
7555
+ }
7556
+ paint(section, key, frame.src, frame.title, stored.at);
7557
+ }
7558
+ }
7559
+
7418
7560
  // src/ui/ai-tree/aiSectionsManager.tsx
7419
7561
  var import_react_dom = require("react-dom");
7420
7562
  var import_client = require("react-dom/client");
@@ -7988,7 +8130,7 @@ var AI_MOBILE_CSS = [
7988
8130
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
7989
8131
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
7990
8132
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
7991
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8133
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7992
8134
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
7993
8135
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
7994
8136
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8004,8 +8146,10 @@ var AI_MOBILE_CSS = [
8004
8146
  "[data-ai-section]{overflow-x:hidden}",
8005
8147
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8006
8148
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8007
- // still got a 20px band of section background down both sides on a phone.
8008
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8149
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8150
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8151
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8152
+ "[data-ai-container]{padding:0 20px !important}",
8009
8153
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8010
8154
  "[data-ai-cell]{width:100%;min-width:0}",
8011
8155
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8210,6 +8354,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8210
8354
  function textAttrs(ctx, path) {
8211
8355
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8212
8356
  }
8357
+ var AI_RESPONSIVE_CSS = [
8358
+ "@media (max-width: 960px) {",
8359
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8360
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8361
+ "}",
8362
+ "@media (max-width: 640px) {",
8363
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8364
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8365
+ // Group containers flatten to a column on phones; span placements come along for free.
8366
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8367
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8368
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8369
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8370
+ // layered text used to be.
8371
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8372
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8373
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8374
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8375
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8376
+ // other rule had already been taught to stand down.
8377
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8378
+ " [data-ai-responsive] { overflow-x: hidden; }",
8379
+ " [data-ai-responsive] img { max-width: 100%; }",
8380
+ "}"
8381
+ ].join("\n");
8213
8382
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8214
8383
  function MediaBox({
8215
8384
  refValue,
@@ -8264,7 +8433,7 @@ function MediaBox({
8264
8433
  position: fill ? "absolute" : void 0,
8265
8434
  inset: fill ? 0 : void 0,
8266
8435
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8267
- height: fill ? "100%" : void 0,
8436
+ height: fill ? "100%" : fixedSize ? height : void 0,
8268
8437
  aspectRatio: fill ? void 0 : aspectRatio,
8269
8438
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8270
8439
  borderRadius: radius,
@@ -9760,7 +9929,7 @@ function CollectionBlock({ node, ctx, path }) {
9760
9929
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9761
9930
  "div",
9762
9931
  {
9763
- "data-ai-grid": "",
9932
+ "data-ai-grid": String(itemsPerRow),
9764
9933
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9765
9934
  style: {
9766
9935
  display: "grid",
@@ -10062,7 +10231,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10062
10231
  },
10063
10232
  children: [
10064
10233
  i > 0 && ctx.heroOverlapFullBleed ? (
10065
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10234
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10066
10235
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10067
10236
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10068
10237
  // the full section width instead of reading at the usual content width.
@@ -10481,6 +10650,7 @@ function AiTreeRenderer({
10481
10650
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10482
10651
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10483
10652
  ...bgAttrs,
10653
+ "data-ai-responsive": "",
10484
10654
  style: {
10485
10655
  position: "relative",
10486
10656
  padding: `${padCss} 0`,
@@ -10494,12 +10664,13 @@ function AiTreeRenderer({
10494
10664
  ...fillHeight ? { display: "grid" } : {}
10495
10665
  },
10496
10666
  children: [
10497
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10667
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10498
10668
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10669
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10499
10670
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10500
10671
  "div",
10501
10672
  {
10502
- "data-ai-container": "",
10673
+ "data-ai-section-inner": "",
10503
10674
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10504
10675
  style: {
10505
10676
  position: "relative",
@@ -10516,7 +10687,7 @@ function AiTreeRenderer({
10516
10687
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10517
10688
  "div",
10518
10689
  {
10519
- "data-ai-row": "",
10690
+ "data-ai-columns": "",
10520
10691
  style: {
10521
10692
  display: "grid",
10522
10693
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11178,9 +11349,10 @@ function applyAiSectionsToDom(state, options) {
11178
11349
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11179
11350
  continue;
11180
11351
  }
11181
- const isNewMount = !existing || !existing.container.isConnected;
11182
11352
  let container = existing?.container;
11353
+ let isNewMount = false;
11183
11354
  if (!container || !container.isConnected) {
11355
+ isNewMount = true;
11184
11356
  existing?.root.unmount();
11185
11357
  container?.remove();
11186
11358
  container = document.createElement("div");
@@ -11518,6 +11690,34 @@ function minSpanForFooterBlock(type) {
11518
11690
  return 3;
11519
11691
  }
11520
11692
  }
11693
+ function readLiveSocialItems() {
11694
+ const root = getFooterRoot();
11695
+ const row = root?.querySelector("[data-ohw-socials-row]");
11696
+ if (!row) return [];
11697
+ const items = [];
11698
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11699
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11700
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11701
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11702
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11703
+ items.push({ platform, href });
11704
+ }
11705
+ return items;
11706
+ }
11707
+ function syncSocialRowsFromDom(tree) {
11708
+ const root = getFooterRoot();
11709
+ if (!root) return;
11710
+ const row = root.querySelector("[data-ohw-socials-row]");
11711
+ const live = readLiveSocialItems();
11712
+ if (row && live.length === 0) return;
11713
+ for (const col of tree.columns) {
11714
+ col.blocks = col.blocks.flatMap((block) => {
11715
+ if (block.type !== "social-row") return [block];
11716
+ if (!row) return [];
11717
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11718
+ });
11719
+ }
11720
+ }
11521
11721
  function collectBrandBlocks(tree) {
11522
11722
  const brand = [];
11523
11723
  for (const col of tree.columns) {
@@ -11763,12 +11963,13 @@ function textOf2(el) {
11763
11963
  }
11764
11964
  function syncFooterTreeLinksFromDom(tree) {
11765
11965
  const next = cloneTree(tree);
11966
+ syncSocialRowsFromDom(next);
11766
11967
  const domCols = listFooterColumns().map((col) => {
11767
11968
  const heading = getFooterColumnHeadingEl(col);
11768
11969
  const title = heading ? textOf2(heading) : void 0;
11769
11970
  const items = listFooterLinksInColumn(col).map((anchor) => {
11770
- const labelEl = anchor.querySelector('[data-ohw-editable="text"]');
11771
- const label = textOf2(labelEl) || textOf2(anchor);
11971
+ const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
11972
+ const label = textOf2(labelEl2) || textOf2(anchor);
11772
11973
  const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
11773
11974
  return label ? { label, href: href || "home" } : null;
11774
11975
  }).filter((x) => Boolean(x));
@@ -17467,7 +17668,7 @@ function apiBase() {
17467
17668
  function bridgeVersion() {
17468
17669
  try {
17469
17670
  if (true) {
17470
- return "0.1.163";
17671
+ return "0.1.164-next.438";
17471
17672
  }
17472
17673
  } catch {
17473
17674
  }
@@ -17481,7 +17682,7 @@ function stampBridgeVersionOnDocument() {
17481
17682
  return;
17482
17683
  }
17483
17684
  try {
17484
- const v = true ? "0.1.163" : "";
17685
+ const v = true ? "0.1.164-next.438" : "";
17485
17686
  if (v) {
17486
17687
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17487
17688
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18159,6 +18360,7 @@ function MediaOverlay({
18159
18360
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18160
18361
  );
18161
18362
  }, [isVideo]);
18363
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18162
18364
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18163
18365
  const box = {
18164
18366
  position: "fixed",
@@ -18257,11 +18459,10 @@ function MediaOverlay({
18257
18459
  className: "flex items-center justify-center cursor-pointer",
18258
18460
  style: {
18259
18461
  ...box,
18260
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18261
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18262
- // in-document, pointer-events does it natively. The button below opts back in, so
18263
- // Replace still works.
18264
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18462
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18463
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18464
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18465
+ pointerEvents: "none",
18265
18466
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18266
18467
  // than hovered. Hover keeps the existing tinted preview.
18267
18468
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18288,17 +18489,17 @@ function MediaOverlay({
18288
18489
  },
18289
18490
  children: [
18290
18491
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18291
- isVideo ? "Replace video" : "Replace image"
18492
+ replaceLabel
18292
18493
  ]
18293
18494
  }
18294
18495
  ),
18295
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18496
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18296
18497
  Button,
18297
18498
  {
18298
18499
  "data-ohw-media-overlay": "",
18299
18500
  variant: "outline",
18300
18501
  size: "sm",
18301
- "aria-label": isVideo ? "Replace video" : "Replace image",
18502
+ "aria-label": replaceLabel,
18302
18503
  className: "gap-1.5 cursor-pointer hover:bg-background",
18303
18504
  style: {
18304
18505
  ...OVERLAY_BUTTON_STYLE,
@@ -18321,7 +18522,7 @@ function MediaOverlay({
18321
18522
  },
18322
18523
  children: [
18323
18524
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18324
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18525
+ replaceMode === "full" ? replaceLabel : null
18325
18526
  ]
18326
18527
  }
18327
18528
  )
@@ -18915,7 +19116,7 @@ function AiSectionOverlay({
18915
19116
 
18916
19117
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18917
19118
  var import_react12 = require("react");
18918
- var import_lucide_react8 = require("lucide-react");
19119
+ var import_lucide_react9 = require("lucide-react");
18919
19120
 
18920
19121
  // src/lib/ai-media-strip-tree.ts
18921
19122
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19029,14 +19230,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19029
19230
  return true;
19030
19231
  });
19031
19232
  }
19032
- function setMediaStripItemAlt(tree, index, alt) {
19033
- return withMediaStrip(tree, (block) => {
19034
- const items = block.items;
19035
- if (index < 0 || index >= items.length) return false;
19036
- items[index] = { ...items[index], alt };
19037
- return true;
19038
- });
19039
- }
19040
19233
  function setMediaStripItemLink(tree, index, link) {
19041
19234
  return withMediaStrip(tree, (block) => {
19042
19235
  const items = block.items;
@@ -19054,11 +19247,117 @@ function setMediaStripItemLink(tree, index, link) {
19054
19247
  });
19055
19248
  }
19056
19249
 
19057
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19250
+ // src/ui/dialog.tsx
19251
+ var React9 = __toESM(require("react"), 1);
19252
+ var import_radix_ui6 = require("radix-ui");
19253
+ var import_lucide_react8 = require("lucide-react");
19058
19254
  var import_jsx_runtime20 = require("react/jsx-runtime");
19059
- var PRIMARY3 = "#0885FE";
19060
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19061
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19255
+ function Dialog2({
19256
+ ...props
19257
+ }) {
19258
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19259
+ }
19260
+ function DialogPortal({
19261
+ ...props
19262
+ }) {
19263
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19264
+ }
19265
+ function DialogOverlay({
19266
+ className,
19267
+ ...props
19268
+ }) {
19269
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19270
+ import_radix_ui6.Dialog.Overlay,
19271
+ {
19272
+ "data-slot": "dialog-overlay",
19273
+ "data-ohw-link-modal-root": "",
19274
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19275
+ ...props
19276
+ }
19277
+ );
19278
+ }
19279
+ var DialogContent = React9.forwardRef(
19280
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19281
+ const positionMode = container ? "absolute" : "fixed";
19282
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19283
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19284
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19285
+ import_radix_ui6.Dialog.Content,
19286
+ {
19287
+ ref,
19288
+ "data-slot": "dialog-content",
19289
+ className: cn(
19290
+ positionMode,
19291
+ "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
19292
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19293
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19294
+ className
19295
+ ),
19296
+ onMouseDown: (e) => e.stopPropagation(),
19297
+ ...props,
19298
+ children: [
19299
+ children,
19300
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19301
+ import_radix_ui6.Dialog.Close,
19302
+ {
19303
+ type: "button",
19304
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19305
+ "aria-label": "Close",
19306
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19307
+ }
19308
+ ) : null
19309
+ ]
19310
+ }
19311
+ )
19312
+ ] });
19313
+ }
19314
+ );
19315
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19316
+ function DialogHeader({
19317
+ className,
19318
+ ...props
19319
+ }) {
19320
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19321
+ }
19322
+ function DialogFooter({
19323
+ className,
19324
+ ...props
19325
+ }) {
19326
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19327
+ "div",
19328
+ {
19329
+ className: cn("flex items-center justify-end gap-2", className),
19330
+ ...props
19331
+ }
19332
+ );
19333
+ }
19334
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19335
+ import_radix_ui6.Dialog.Title,
19336
+ {
19337
+ ref,
19338
+ className: cn(
19339
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19340
+ className
19341
+ ),
19342
+ ...props
19343
+ }
19344
+ ));
19345
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19346
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19347
+ import_radix_ui6.Dialog.Description,
19348
+ {
19349
+ ref,
19350
+ className: cn("text-sm text-muted-foreground", className),
19351
+ ...props
19352
+ }
19353
+ ));
19354
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19355
+ var DialogClose = import_radix_ui6.Dialog.Close;
19356
+
19357
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19358
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19359
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19360
+ var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19062
19361
  function findMediaStripItemElement(sectionId, index) {
19063
19362
  const sectionEl = findByInstanceId(sectionId);
19064
19363
  if (!sectionEl) return null;
@@ -19068,14 +19367,35 @@ function findMediaStripItemElement(sectionId, index) {
19068
19367
  }
19069
19368
  return null;
19070
19369
  }
19071
- function readRect2(ref) {
19072
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19370
+ function itemRefFromTarget(target) {
19371
+ if (!(target instanceof Element)) return null;
19372
+ if (target.closest(CHROME_SELECTOR)) return null;
19373
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19374
+ if (!itemEl) return null;
19375
+ const sectionEl = itemEl.closest("[data-ohw-section]");
19376
+ const unit = sectionEl ? movableUnit(sectionEl) : null;
19377
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19378
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19379
+ if (!sectionId || Number.isNaN(index)) return null;
19380
+ return { sectionId, index };
19381
+ }
19382
+ function sameRef(a, b) {
19383
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19384
+ }
19385
+ function rectOf(el) {
19073
19386
  if (!el) return null;
19074
19387
  const r2 = el.getBoundingClientRect();
19075
19388
  if (r2.width <= 0 || r2.height <= 0) return null;
19076
19389
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19077
19390
  }
19078
- function useLiveItemRect(ref) {
19391
+ function readRect2(ref) {
19392
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19393
+ }
19394
+ function readStripRect(ref) {
19395
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19396
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19397
+ }
19398
+ function useLiveItemRect(ref, strip = false) {
19079
19399
  const [rect, setRect] = (0, import_react12.useState)(null);
19080
19400
  (0, import_react12.useEffect)(() => {
19081
19401
  if (!ref) {
@@ -19083,7 +19403,7 @@ function useLiveItemRect(ref) {
19083
19403
  return;
19084
19404
  }
19085
19405
  const update = () => {
19086
- const next = readRect2(ref);
19406
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19087
19407
  setRect(
19088
19408
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19089
19409
  );
@@ -19098,9 +19418,49 @@ function useLiveItemRect(ref) {
19098
19418
  window.removeEventListener("resize", update);
19099
19419
  clearInterval(interval);
19100
19420
  };
19101
- }, [ref?.sectionId, ref?.index]);
19421
+ }, [ref?.sectionId, ref?.index, strip]);
19102
19422
  return rect;
19103
19423
  }
19424
+ var TOOLBAR_STRIP_GAP = 52;
19425
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19426
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19427
+ function StripToolbarSlot({ stripRect, children }) {
19428
+ const slotRef = (0, import_react12.useRef)(null);
19429
+ const [shift, setShift] = (0, import_react12.useState)(0);
19430
+ const centerX = stripRect.left + stripRect.width / 2;
19431
+ (0, import_react12.useLayoutEffect)(() => {
19432
+ const slot = slotRef.current;
19433
+ if (!slot) return;
19434
+ const clamp = () => {
19435
+ const w = slot.offsetWidth;
19436
+ if (w <= 0) return;
19437
+ const half = w / 2;
19438
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19439
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19440
+ };
19441
+ clamp();
19442
+ const ro = new ResizeObserver(clamp);
19443
+ ro.observe(slot);
19444
+ return () => ro.disconnect();
19445
+ }, [centerX, children]);
19446
+ const mobile = window.innerWidth <= 480;
19447
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19448
+ "div",
19449
+ {
19450
+ ref: slotRef,
19451
+ "data-ohw-bridge": "",
19452
+ "data-ohw-item-interaction": "",
19453
+ className: "pointer-events-auto fixed",
19454
+ style: {
19455
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19456
+ left: centerX + shift,
19457
+ transform: "translate(-50%, -100%)",
19458
+ zIndex: 2147483645
19459
+ },
19460
+ children
19461
+ }
19462
+ );
19463
+ }
19104
19464
  function requestValidateTree(postToParent2, tree) {
19105
19465
  return new Promise((resolve) => {
19106
19466
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19137,116 +19497,72 @@ function requestAssetPick(postToParent2) {
19137
19497
  postToParent2({ type: "ow:asset-pick", id });
19138
19498
  });
19139
19499
  }
19140
- function Pill({
19500
+ function ToolbarAction({
19141
19501
  label,
19142
19502
  onClick,
19143
- disabled,
19144
- active
19503
+ disabled = false,
19504
+ active = false,
19505
+ children
19145
19506
  }) {
19146
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19147
- "button",
19148
- {
19149
- type: "button",
19150
- onClick,
19151
- disabled,
19152
- style: {
19153
- height: 28,
19154
- padding: "0 10px",
19155
- display: "inline-flex",
19156
- alignItems: "center",
19157
- gap: 4,
19158
- borderRadius: 999,
19159
- border: "none",
19160
- cursor: disabled ? "default" : "pointer",
19161
- background: active ? OHW_BLUE_DARK : "#ffffff",
19162
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19163
- opacity: disabled ? 0.4 : 1,
19164
- fontSize: 12,
19165
- lineHeight: "16px",
19166
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19167
- whiteSpace: "nowrap",
19168
- flex: "0 0 auto"
19169
- },
19170
- children: label
19171
- }
19172
- );
19507
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19508
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19509
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19510
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19511
+ ] });
19173
19512
  }
19174
- function AltInput({ value, onCommit }) {
19175
- const [draft, setDraft] = (0, import_react12.useState)(value);
19176
- (0, import_react12.useEffect)(() => setDraft(value), [value]);
19177
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19178
- "div",
19179
- {
19180
- style: {
19181
- display: "flex",
19182
- alignItems: "center",
19183
- gap: 6,
19184
- height: 28,
19185
- padding: "0 12px",
19186
- borderRadius: 999,
19187
- background: "#ffffff",
19188
- width: "100%",
19189
- maxWidth: 260,
19190
- boxSizing: "border-box"
19191
- },
19192
- children: [
19193
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19194
- "span",
19195
- {
19196
- style: {
19197
- flex: "0 0 auto",
19198
- color: OHW_BLUE_DARK,
19199
- fontSize: 10,
19200
- fontWeight: 700,
19201
- textTransform: "uppercase",
19202
- letterSpacing: 0.4
19203
- },
19204
- children: "Alt"
19205
- }
19206
- ),
19207
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19208
- "input",
19513
+ function ToolbarSeparator() {
19514
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19515
+ }
19516
+ function OptionMenu({
19517
+ label,
19518
+ value,
19519
+ options,
19520
+ onChange
19521
+ }) {
19522
+ const current = options.find((o) => o.value === value) ?? options[0];
19523
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19524
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
19525
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19526
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19527
+ "button",
19528
+ {
19529
+ type: "button",
19530
+ "aria-label": label,
19531
+ className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
19532
+ children: [
19533
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19534
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19535
+ ]
19536
+ }
19537
+ ) }),
19538
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19539
+ const selected = option.value === value;
19540
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19541
+ DropdownMenuItem,
19209
19542
  {
19210
- type: "text",
19211
- value: draft,
19212
- onChange: (e) => setDraft(e.target.value),
19213
- onBlur: () => {
19214
- if (draft !== value) onCommit(draft);
19215
- },
19216
- onKeyDown: (e) => {
19217
- if (e.key === "Enter") e.currentTarget.blur();
19218
- if (e.key === "Escape") {
19219
- setDraft(value);
19220
- e.currentTarget.blur();
19221
- }
19222
- },
19223
- placeholder: "Describe this image",
19224
- "aria-label": "Image alt text",
19225
- style: {
19226
- flex: 1,
19227
- minWidth: 0,
19228
- border: "none",
19229
- outline: "none",
19230
- background: "transparent",
19231
- fontSize: 12,
19232
- lineHeight: "16px",
19233
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19234
- color: "#1f2937"
19235
- }
19236
- }
19237
- )
19238
- ]
19239
- }
19240
- );
19543
+ role: "menuitemradio",
19544
+ "aria-checked": selected,
19545
+ onSelect: () => onChange(option.value),
19546
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19547
+ children: [
19548
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
19549
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
19550
+ ]
19551
+ },
19552
+ option.value
19553
+ );
19554
+ }) })
19555
+ ] })
19556
+ ] });
19241
19557
  }
19242
19558
  var VARIANTS = [
19243
19559
  { value: "logos", label: "Logos" },
19244
19560
  { value: "reel", label: "Reel" }
19245
19561
  ];
19246
19562
  var ALIGNS = [
19247
- { value: "left", label: "Left" },
19248
- { value: "center", label: "Center" },
19249
- { value: "right", label: "Right" }
19563
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
19564
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
19565
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19250
19566
  ];
19251
19567
  var HOVERS = [
19252
19568
  { value: "none", label: "None" },
@@ -19254,104 +19570,104 @@ var HOVERS = [
19254
19570
  { value: "zoom", label: "Zoom" },
19255
19571
  { value: "fade", label: "Fade" }
19256
19572
  ];
19257
- var TREATMENTS = [
19258
- { value: "color", label: "Color" },
19259
- { value: "grayscale", label: "Grayscale" }
19260
- ];
19261
19573
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19262
- function LinkInput({ value, onCommit }) {
19263
- const [draft, setDraft] = (0, import_react12.useState)(value);
19574
+ function LinkModal({
19575
+ href,
19576
+ linkTarget,
19577
+ onClose,
19578
+ onSave
19579
+ }) {
19580
+ const [draft, setDraft] = (0, import_react12.useState)(href);
19581
+ const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
19264
19582
  const [invalid, setInvalid] = (0, import_react12.useState)(false);
19265
- (0, import_react12.useEffect)(() => {
19266
- setDraft(value);
19267
- setInvalid(false);
19268
- }, [value]);
19269
- const commit2 = () => {
19583
+ const save = () => {
19270
19584
  const next = draft.trim();
19271
- if (next === value) return setInvalid(false);
19272
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19273
- setInvalid(false);
19274
- onCommit(next);
19275
- };
19276
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19277
- "div",
19278
- {
19279
- style: {
19280
- display: "flex",
19281
- alignItems: "center",
19282
- gap: 6,
19283
- height: 28,
19284
- padding: "0 12px",
19285
- borderRadius: 999,
19286
- background: "#ffffff",
19287
- width: "100%",
19288
- maxWidth: 260,
19289
- boxSizing: "border-box",
19290
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19291
- },
19292
- children: [
19293
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19294
- "span",
19295
- {
19296
- style: {
19297
- flex: "0 0 auto",
19298
- color: OHW_BLUE_DARK,
19299
- fontSize: 10,
19300
- fontWeight: 700,
19301
- textTransform: "uppercase",
19302
- letterSpacing: 0.4
19303
- },
19304
- children: "Link"
19305
- }
19306
- ),
19307
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19308
- "input",
19309
- {
19310
- type: "text",
19311
- inputMode: "url",
19312
- value: draft,
19313
- onChange: (e) => setDraft(e.target.value),
19314
- onBlur: commit2,
19315
- onKeyDown: (e) => {
19316
- if (e.key === "Enter") e.currentTarget.blur();
19317
- if (e.key === "Escape") {
19318
- setDraft(value);
19319
- setInvalid(false);
19320
- e.currentTarget.blur();
19321
- }
19322
- },
19323
- placeholder: "https://example.com",
19324
- "aria-label": "Image link URL",
19325
- "aria-invalid": invalid,
19326
- style: {
19327
- flex: 1,
19328
- minWidth: 0,
19329
- border: "none",
19330
- outline: "none",
19331
- background: "transparent",
19332
- fontSize: 12,
19333
- lineHeight: "16px",
19334
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19335
- color: "#1f2937"
19336
- }
19337
- }
19338
- )
19339
- ]
19585
+ if (next && !HTTP_URL_RE.test(next)) {
19586
+ setInvalid(true);
19587
+ return;
19340
19588
  }
19341
- );
19589
+ onSave(next, newTab ? "new-tab" : "same-tab");
19590
+ onClose();
19591
+ };
19592
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19593
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
19594
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
19595
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19596
+ "input",
19597
+ {
19598
+ autoFocus: true,
19599
+ type: "text",
19600
+ inputMode: "url",
19601
+ value: draft,
19602
+ onChange: (e) => {
19603
+ setDraft(e.target.value);
19604
+ setInvalid(false);
19605
+ },
19606
+ onKeyDown: (e) => {
19607
+ if (e.key === "Enter") save();
19608
+ },
19609
+ placeholder: "https://example.com",
19610
+ "aria-label": "Image link URL",
19611
+ "aria-invalid": invalid,
19612
+ className: cn(
19613
+ "h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
19614
+ invalid && "border-destructive focus:border-destructive"
19615
+ )
19616
+ }
19617
+ ),
19618
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19619
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19620
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19621
+ "Open in new tab"
19622
+ ] })
19623
+ ] }),
19624
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
19625
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19626
+ "button",
19627
+ {
19628
+ type: "button",
19629
+ onClick: () => {
19630
+ onSave("", "new-tab");
19631
+ onClose();
19632
+ },
19633
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19634
+ children: "Remove link"
19635
+ }
19636
+ ),
19637
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19638
+ "button",
19639
+ {
19640
+ type: "button",
19641
+ onClick: onClose,
19642
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19643
+ children: "Cancel"
19644
+ }
19645
+ ),
19646
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19647
+ "button",
19648
+ {
19649
+ type: "button",
19650
+ onClick: save,
19651
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19652
+ children: "Save"
19653
+ }
19654
+ )
19655
+ ] })
19656
+ ] }) });
19342
19657
  }
19343
19658
  function MediaStripToolbar({
19344
19659
  entry,
19345
19660
  index,
19346
19661
  pending,
19347
19662
  error,
19663
+ itemEditOn,
19664
+ onToggleItemEdit,
19348
19665
  onSetVariant,
19349
19666
  onSetAlign,
19350
19667
  onSetHover,
19351
19668
  onSetTreatment,
19352
19669
  onResize,
19353
- onSetAlt,
19354
- onSetLink,
19670
+ onOpenLink,
19355
19671
  onAddItem,
19356
19672
  onRemoveItem,
19357
19673
  onChangeImage,
@@ -19360,81 +19676,102 @@ function MediaStripToolbar({
19360
19676
  }) {
19361
19677
  const items = mediaStripItems(entry.tree);
19362
19678
  const itemCount = items.length;
19363
- const currentAlt = items[index]?.alt ?? "";
19364
- const currentHref2 = items[index]?.href ?? "";
19365
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19366
19679
  const slots = findMediaStripSlots(entry.tree);
19367
19680
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19368
19681
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19369
19682
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19370
19683
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19371
19684
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19372
- const isMobile = window.innerWidth <= 480;
19373
- const rowStyle = isMobile ? {
19374
- display: "flex",
19375
- gap: 6,
19376
- flexWrap: "nowrap",
19377
- justifyContent: "center",
19378
- overflowX: "auto",
19379
- WebkitOverflowScrolling: "touch",
19380
- width: "100%",
19381
- scrollbarWidth: "none"
19382
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19383
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19685
+ const mobile = window.innerWidth <= 480;
19686
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19687
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19384
19688
  "div",
19385
19689
  {
19386
19690
  "data-ohw-bridge": "",
19387
19691
  "data-ohw-toolbar": "",
19388
19692
  onMouseDown: (e) => e.stopPropagation(),
19389
- style: {
19390
- display: "flex",
19391
- flexDirection: "column",
19392
- gap: 6,
19393
- alignItems: "center",
19394
- background: OHW_BLUE,
19395
- padding: 8,
19396
- borderRadius: 12,
19397
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19398
- pointerEvents: pending ? "none" : "auto",
19399
- opacity: pending ? 0.6 : 1,
19400
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19401
- },
19693
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19694
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19402
19695
  children: [
19403
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19404
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19405
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19406
- ] }),
19407
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19408
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19409
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19410
- ] }),
19411
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19412
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19413
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19414
- sizeValue,
19415
- "px"
19416
- ] }),
19417
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19418
- ] }),
19419
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19420
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19421
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19422
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19423
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19424
- ] }),
19425
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19426
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19427
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19428
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19429
- ] }),
19430
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19431
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19432
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19433
- ] }),
19434
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19696
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19697
+ "div",
19698
+ {
19699
+ className: cn(
19700
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19701
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19702
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19703
+ ),
19704
+ children: [
19705
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19706
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19707
+ CustomToolbarButton,
19708
+ {
19709
+ type: "button",
19710
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19711
+ "aria-pressed": itemEditOn,
19712
+ onClick: onToggleItemEdit,
19713
+ className: "group size-8",
19714
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19715
+ import_lucide_react9.Star,
19716
+ {
19717
+ size: 16,
19718
+ fill: "currentColor",
19719
+ strokeWidth: 0,
19720
+ className: cn(
19721
+ "transition-colors",
19722
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19723
+ ),
19724
+ style: { pointerEvents: "none" }
19725
+ }
19726
+ )
19727
+ }
19728
+ ) }),
19729
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19730
+ ] }),
19731
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19732
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
19733
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
19734
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
19735
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19736
+ ToolbarAction,
19737
+ {
19738
+ label: gatedLabel("Move right"),
19739
+ onClick: onMoveRight,
19740
+ disabled: !itemEditOn || index >= itemCount - 1,
19741
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
19742
+ }
19743
+ ),
19744
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19745
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19746
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19747
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19748
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19749
+ ToolbarAction,
19750
+ {
19751
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19752
+ active: treatment === "grayscale",
19753
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19754
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
19755
+ }
19756
+ ),
19757
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19758
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19759
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19760
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19761
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19762
+ sizeValue,
19763
+ "px"
19764
+ ] }),
19765
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
19766
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19767
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19768
+ ]
19769
+ }
19770
+ ),
19771
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19435
19772
  ]
19436
19773
  }
19437
- );
19774
+ ) });
19438
19775
  }
19439
19776
  function findMediaStripSlots(tree) {
19440
19777
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19453,31 +19790,23 @@ function AiMediaStripOverlay({
19453
19790
  }) {
19454
19791
  const [hover, setHover] = (0, import_react12.useState)(null);
19455
19792
  const [active, setActive] = (0, import_react12.useState)(null);
19793
+ const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
19794
+ const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
19456
19795
  const [pending, setPending] = (0, import_react12.useState)(false);
19457
19796
  const [error, setError] = (0, import_react12.useState)(null);
19458
19797
  const activeRef = (0, import_react12.useRef)(null);
19459
19798
  activeRef.current = active;
19799
+ const linkOpenRef = (0, import_react12.useRef)(false);
19800
+ linkOpenRef.current = linkOpen;
19460
19801
  (0, import_react12.useEffect)(() => {
19461
19802
  const onMove = (e) => {
19803
+ const ref = itemRefFromTarget(e.target);
19462
19804
  const t = e.target;
19463
- if (!(t instanceof HTMLElement)) return;
19464
- if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
19465
- return;
19466
- }
19467
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19468
- if (!itemEl) {
19469
- setHover(null);
19470
- return;
19471
- }
19472
- const sectionEl = itemEl.closest("[data-ohw-section]");
19473
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19474
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19475
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19476
- if (!sectionId || Number.isNaN(index)) {
19477
- setHover(null);
19478
- return;
19479
- }
19480
- setHover({ sectionId, index });
19805
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19806
+ setHover((prev) => {
19807
+ const next = ref && !overEditable ? ref : null;
19808
+ return sameRef(prev, next) ? prev : next;
19809
+ });
19481
19810
  };
19482
19811
  const onLeave = () => setHover(null);
19483
19812
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19489,23 +19818,25 @@ function AiMediaStripOverlay({
19489
19818
  }, []);
19490
19819
  (0, import_react12.useEffect)(() => {
19491
19820
  const onClick = (e) => {
19492
- const current = activeRef.current;
19493
- if (!current) return;
19494
19821
  const t = e.target;
19495
- if (!(t instanceof HTMLElement)) return;
19496
- if (t.closest("[data-ohw-item-interaction]")) return;
19497
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19498
- if (itemEl && itemEl.contains(t)) return;
19499
- setActive(null);
19822
+ if (!(t instanceof Element)) return;
19823
+ if (t.closest(CHROME_SELECTOR)) return;
19824
+ const ref = itemRefFromTarget(t);
19825
+ if (sameRef(activeRef.current, ref)) return;
19826
+ if (ref) clearInteractionChromeRef.current();
19827
+ setItemEditOn(false);
19500
19828
  setError(null);
19829
+ setActive(ref);
19501
19830
  };
19502
19831
  document.addEventListener("click", onClick, true);
19503
19832
  return () => document.removeEventListener("click", onClick, true);
19504
- }, []);
19833
+ }, [clearInteractionChromeRef]);
19505
19834
  (0, import_react12.useEffect)(() => {
19506
19835
  const onBlur = () => {
19507
19836
  if (!activeRef.current) return;
19508
19837
  setActive(null);
19838
+ setItemEditOn(false);
19839
+ setLinkOpen(false);
19509
19840
  setError(null);
19510
19841
  };
19511
19842
  window.addEventListener("blur", onBlur);
@@ -19515,7 +19846,10 @@ function AiMediaStripOverlay({
19515
19846
  const onKeyDown = (e) => {
19516
19847
  if (e.key !== "Escape") return;
19517
19848
  if (!activeRef.current) return;
19849
+ if (linkOpenRef.current) return;
19850
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19518
19851
  setActive(null);
19852
+ setItemEditOn(false);
19519
19853
  setError(null);
19520
19854
  };
19521
19855
  document.addEventListener("keydown", onKeyDown);
@@ -19549,137 +19883,133 @@ function AiMediaStripOverlay({
19549
19883
  tree: nextTree,
19550
19884
  label: entry.label,
19551
19885
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19552
- ...entry.brand ? { brand: entry.brand } : {}
19886
+ ...entry.brand ? { brand: entry.brand } : {},
19887
+ // The user is already looking at the strip they just edited — recentering the viewport
19888
+ // on every edit reads as the section jumping around.
19889
+ skipScrollIntoView: true
19553
19890
  });
19554
19891
  return true;
19555
19892
  },
19556
19893
  [findEntry, postToParent2, applyTreeLocalRef]
19557
19894
  );
19558
19895
  const activeEntry = active ? findEntry(active.sectionId) : null;
19559
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19560
19896
  const activeItemRect = useLiveItemRect(active);
19561
- const TOOLBAR_APPROX_H = 170;
19562
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19563
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19564
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19565
- "button",
19566
- {
19567
- type: "button",
19568
- "data-ohw-toolbar": "",
19569
- onClick: () => {
19570
- clearInteractionChromeRef.current();
19571
- setActive(hover);
19572
- },
19573
- "aria-label": "Configure media item",
19574
- style: {
19575
- position: "fixed",
19576
- top: hoverHandleRect.top + 8,
19577
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19578
- width: 28,
19579
- height: 28,
19580
- borderRadius: 8,
19581
- border: `1.5px dashed ${PRIMARY3}`,
19582
- background: "#ffffff",
19583
- color: PRIMARY3,
19584
- display: "flex",
19585
- alignItems: "center",
19586
- justifyContent: "center",
19587
- cursor: "pointer",
19588
- zIndex: 2147483643,
19589
- fontSize: 14,
19590
- fontWeight: 700
19591
- },
19592
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19593
- }
19594
- ),
19595
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19596
- ItemInteractionLayer,
19597
- {
19598
- rect: activeItemRect,
19599
- state: toolbarState,
19600
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19601
- MediaStripToolbar,
19602
- {
19603
- entry: activeEntry,
19604
- index: active.index,
19605
- pending,
19606
- error,
19607
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19608
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19609
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19610
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19611
- onResize: (delta) => {
19612
- const slots = findMediaStripSlots(activeEntry.tree);
19613
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19614
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19615
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19616
- },
19617
- onSetAlt: (alt) => {
19618
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19619
- },
19620
- onSetLink: (href, linkTarget) => {
19897
+ const activeStripRect = useLiveItemRect(active, true);
19898
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19899
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19900
+ const activeItem = active ? activeItems[active.index] : void 0;
19901
+ const activeHref = activeItem?.href ?? "";
19902
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19903
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19904
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19905
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19906
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19907
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19908
+ MediaStripToolbar,
19909
+ {
19910
+ entry: activeEntry,
19911
+ index: active.index,
19912
+ pending,
19913
+ error,
19914
+ itemEditOn,
19915
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
19916
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19917
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19918
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19919
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19920
+ onResize: (delta) => {
19921
+ const slots = findMediaStripSlots(activeEntry.tree);
19922
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19923
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19924
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19925
+ },
19926
+ onOpenLink: () => setLinkOpen(true),
19927
+ onAddItem: () => {
19928
+ void requestAssetPick(postToParent2).then((picked) => {
19929
+ if (!picked) return;
19930
+ const item = { assetId: picked.assetId, alt: "Logo" };
19621
19931
  void runMutation(
19622
19932
  active.sectionId,
19623
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19624
- );
19625
- },
19626
- onAddItem: () => {
19627
- void requestAssetPick(postToParent2).then((picked) => {
19628
- if (!picked) return;
19629
- const item = { assetId: picked.assetId, alt: "Logo" };
19630
- void runMutation(
19631
- active.sectionId,
19632
- (tree) => addMediaStripItem(tree, item, active.index),
19633
- { [picked.assetId]: picked.url }
19634
- ).then((applied) => {
19635
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19636
- });
19933
+ (tree) => addMediaStripItem(tree, item, active.index),
19934
+ { [picked.assetId]: picked.url }
19935
+ ).then((applied) => {
19936
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19637
19937
  });
19638
- },
19639
- onChangeImage: () => {
19640
- void requestAssetPick(postToParent2).then((picked) => {
19641
- if (!picked) return;
19642
- void runMutation(
19643
- active.sectionId,
19644
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19645
- { [picked.assetId]: picked.url }
19646
- );
19647
- });
19648
- },
19649
- onRemoveItem: () => {
19650
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19651
- (applied) => {
19652
- if (applied) setActive(null);
19653
- }
19654
- );
19655
- },
19656
- onMoveLeft: () => {
19657
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19658
- (applied) => {
19659
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19660
- }
19661
- );
19662
- },
19663
- onMoveRight: () => {
19664
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19665
- (applied) => {
19666
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19667
- }
19938
+ });
19939
+ },
19940
+ onChangeImage: () => {
19941
+ void requestAssetPick(postToParent2).then((picked) => {
19942
+ if (!picked) return;
19943
+ void runMutation(
19944
+ active.sectionId,
19945
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19946
+ { [picked.assetId]: picked.url }
19668
19947
  );
19669
- }
19948
+ });
19949
+ },
19950
+ onRemoveItem: () => {
19951
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19952
+ (applied) => {
19953
+ if (applied) setActive(null);
19954
+ }
19955
+ );
19956
+ },
19957
+ onMoveLeft: () => {
19958
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19959
+ (applied) => {
19960
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19961
+ }
19962
+ );
19963
+ },
19964
+ onMoveRight: () => {
19965
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19966
+ (applied) => {
19967
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19968
+ }
19969
+ );
19670
19970
  }
19671
- )
19672
- }
19673
- )
19971
+ }
19972
+ ) }),
19973
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19974
+ "div",
19975
+ {
19976
+ "data-ohw-bridge": "",
19977
+ "data-ohw-item-interaction": "",
19978
+ "aria-hidden": true,
19979
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
19980
+ style: {
19981
+ top: activeItemRect.top + activeItemRect.height + 10,
19982
+ left: activeItemRect.left - 5,
19983
+ background: PRIMARY3,
19984
+ zIndex: 2147483644
19985
+ },
19986
+ children: "Media item"
19987
+ }
19988
+ ),
19989
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19990
+ LinkModal,
19991
+ {
19992
+ href: activeHref,
19993
+ linkTarget: activeTarget,
19994
+ onClose: () => setLinkOpen(false),
19995
+ onSave: (href, linkTarget) => {
19996
+ void runMutation(
19997
+ active.sectionId,
19998
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19999
+ );
20000
+ }
20001
+ }
20002
+ )
20003
+ ] })
19674
20004
  ] });
19675
20005
  }
19676
20006
 
19677
20007
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19678
20008
  var import_react13 = require("react");
19679
- var import_lucide_react9 = require("lucide-react");
19680
- var import_jsx_runtime21 = require("react/jsx-runtime");
20009
+ var import_lucide_react10 = require("lucide-react");
20010
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19681
20011
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19682
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
20012
+ var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19683
20013
  function findPricingCardElement(sectionId, index) {
19684
20014
  const sectionEl = findByInstanceId(sectionId);
19685
20015
  if (!sectionEl) return null;
@@ -19691,7 +20021,7 @@ function findPricingCardElement(sectionId, index) {
19691
20021
  }
19692
20022
  function cardRefFromTarget(target) {
19693
20023
  if (!(target instanceof Element)) return null;
19694
- if (target.closest(CHROME_SELECTOR)) return null;
20024
+ if (target.closest(CHROME_SELECTOR2)) return null;
19695
20025
  const cardEl = target.closest("[data-ohw-pricing-card]");
19696
20026
  if (!cardEl) return null;
19697
20027
  const sectionEl = cardEl.closest("[data-ohw-section]");
@@ -19701,21 +20031,21 @@ function cardRefFromTarget(target) {
19701
20031
  if (!sectionId || Number.isNaN(index)) return null;
19702
20032
  return { sectionId, index };
19703
20033
  }
19704
- function sameRef(a, b) {
20034
+ function sameRef2(a, b) {
19705
20035
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19706
20036
  }
19707
- function rectOf(el) {
20037
+ function rectOf2(el) {
19708
20038
  if (!el) return null;
19709
20039
  const r2 = el.getBoundingClientRect();
19710
20040
  if (r2.width <= 0 || r2.height <= 0) return null;
19711
20041
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19712
20042
  }
19713
20043
  function readRect3(ref) {
19714
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20044
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19715
20045
  }
19716
20046
  function readGridRect(ref) {
19717
20047
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19718
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20048
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19719
20049
  }
19720
20050
  function useLiveCardRect(ref, grid = false) {
19721
20051
  const [rect, setRect] = (0, import_react13.useState)(null);
@@ -19745,7 +20075,7 @@ function useLiveCardRect(ref, grid = false) {
19745
20075
  }
19746
20076
  var TOOLBAR_GRID_GAP = 52;
19747
20077
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19748
- var TOOLBAR_EDGE_MARGIN2 = 4;
20078
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19749
20079
  function GridToolbarSlot({ gridRect, children }) {
19750
20080
  const slotRef = (0, import_react13.useRef)(null);
19751
20081
  const [shift, setShift] = (0, import_react13.useState)(0);
@@ -19757,7 +20087,7 @@ function GridToolbarSlot({ gridRect, children }) {
19757
20087
  const w = slot.offsetWidth;
19758
20088
  if (w <= 0) return;
19759
20089
  const half = w / 2;
19760
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20090
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19761
20091
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19762
20092
  };
19763
20093
  clamp();
@@ -19766,7 +20096,7 @@ function GridToolbarSlot({ gridRect, children }) {
19766
20096
  return () => ro.disconnect();
19767
20097
  }, [centerX, children]);
19768
20098
  const mobile = window.innerWidth <= 480;
19769
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20099
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19770
20100
  "div",
19771
20101
  {
19772
20102
  ref: slotRef,
@@ -19801,7 +20131,7 @@ function requestValidateTree2(postToParent2, tree) {
19801
20131
  });
19802
20132
  }
19803
20133
  function StyleSwatch({ style }) {
19804
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20134
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19805
20135
  "span",
19806
20136
  {
19807
20137
  "aria-hidden": true,
@@ -19815,35 +20145,35 @@ function StyleSwatch({ style }) {
19815
20145
  );
19816
20146
  }
19817
20147
  function ButtonGlyph() {
19818
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19819
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19820
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20148
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20149
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20150
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19821
20151
  ] });
19822
20152
  }
19823
20153
  function FeatureGlyph({ mode }) {
19824
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19825
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19826
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19827
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19828
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19829
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19830
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20154
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20155
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20156
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20157
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20158
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20159
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20160
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19831
20161
  ] });
19832
20162
  }
19833
- function ToolbarAction({
20163
+ function ToolbarAction2({
19834
20164
  label,
19835
20165
  onClick,
19836
20166
  disabled = false,
19837
20167
  children
19838
20168
  }) {
19839
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19840
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19841
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19842
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20169
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20170
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20171
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20172
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19843
20173
  ] });
19844
20174
  }
19845
- function ToolbarSeparator() {
19846
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20175
+ function ToolbarSeparator2() {
20176
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19847
20177
  }
19848
20178
  function CardStyleMenu({
19849
20179
  value,
@@ -19851,7 +20181,7 @@ function CardStyleMenu({
19851
20181
  disabled = false
19852
20182
  }) {
19853
20183
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
19854
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20184
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19855
20185
  "button",
19856
20186
  {
19857
20187
  type: "button",
@@ -19862,28 +20192,28 @@ function CardStyleMenu({
19862
20192
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
19863
20193
  ),
19864
20194
  children: [
19865
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
19866
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19867
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20195
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20196
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20197
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19868
20198
  ]
19869
20199
  }
19870
20200
  );
19871
20201
  if (disabled) {
19872
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19873
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19874
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19875
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
19876
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20202
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20203
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20204
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20205
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20206
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19877
20207
  ] })
19878
20208
  ] });
19879
20209
  }
19880
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19881
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19882
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19883
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
19884
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20210
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20211
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20212
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20213
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20214
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19885
20215
  const selected = style.value === value;
19886
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20216
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19887
20217
  DropdownMenuItem,
19888
20218
  {
19889
20219
  role: "menuitemradio",
@@ -19891,9 +20221,9 @@ function CardStyleMenu({
19891
20221
  onSelect: () => onChange(style.value),
19892
20222
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19893
20223
  children: [
19894
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
19895
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
19896
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20224
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20225
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20226
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
19897
20227
  ]
19898
20228
  },
19899
20229
  style.value
@@ -19923,7 +20253,7 @@ function PricingCardToolbar({
19923
20253
  const style = pricingCardStyle(entry.tree, index);
19924
20254
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
19925
20255
  const mobile = window.innerWidth <= 480;
19926
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20256
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19927
20257
  "div",
19928
20258
  {
19929
20259
  "data-ohw-bridge": "",
@@ -19935,7 +20265,7 @@ function PricingCardToolbar({
19935
20265
  ),
19936
20266
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19937
20267
  children: [
19938
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20268
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19939
20269
  "div",
19940
20270
  {
19941
20271
  className: cn(
@@ -19944,8 +20274,8 @@ function PricingCardToolbar({
19944
20274
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
19945
20275
  ),
19946
20276
  children: [
19947
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19948
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20277
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20278
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19949
20279
  CustomToolbarButton,
19950
20280
  {
19951
20281
  type: "button",
@@ -19953,8 +20283,8 @@ function PricingCardToolbar({
19953
20283
  "aria-pressed": featuredTag,
19954
20284
  onClick: () => onSetFeaturedTag(!featuredTag),
19955
20285
  className: "group size-8",
19956
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19957
- import_lucide_react9.Star,
20286
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20287
+ import_lucide_react10.Star,
19958
20288
  {
19959
20289
  size: 16,
19960
20290
  fill: "currentColor",
@@ -19968,25 +20298,25 @@ function PricingCardToolbar({
19968
20298
  )
19969
20299
  }
19970
20300
  ) }),
19971
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20301
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
19972
20302
  ] }),
19973
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19974
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
19975
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19976
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
19977
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
19978
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
19979
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20303
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20304
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20305
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20306
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20307
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
20308
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20309
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
19980
20310
  ] }) }),
19981
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
19982
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
19983
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19984
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
19985
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20311
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
20312
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
20313
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20314
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20315
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
19986
20316
  ]
19987
20317
  }
19988
20318
  ),
19989
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20319
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19990
20320
  ]
19991
20321
  }
19992
20322
  ) });
@@ -20020,7 +20350,7 @@ function AiPricingCardOverlay({
20020
20350
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20021
20351
  setHover((prev) => {
20022
20352
  const next = ref && !overEditable ? ref : null;
20023
- return sameRef(prev, next) ? prev : next;
20353
+ return sameRef2(prev, next) ? prev : next;
20024
20354
  });
20025
20355
  };
20026
20356
  const onLeave = () => setHover(null);
@@ -20035,10 +20365,10 @@ function AiPricingCardOverlay({
20035
20365
  const onClick = (e) => {
20036
20366
  const t = e.target;
20037
20367
  if (!(t instanceof Element)) return;
20038
- if (t.closest(CHROME_SELECTOR)) return;
20368
+ if (t.closest(CHROME_SELECTOR2)) return;
20039
20369
  const ref = cardRefFromTarget(t);
20040
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20041
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20370
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20371
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20042
20372
  };
20043
20373
  document.addEventListener("click", onClick, true);
20044
20374
  return () => document.removeEventListener("click", onClick, true);
@@ -20103,12 +20433,12 @@ function AiPricingCardOverlay({
20103
20433
  const activeEntry = active ? findEntry(active.sectionId) : null;
20104
20434
  const activeCardRect = useLiveCardRect(active);
20105
20435
  const activeGridRect = useLiveCardRect(active, true);
20106
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20107
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20108
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20109
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20110
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20111
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20436
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20437
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20438
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20439
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20440
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20441
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20112
20442
  PricingCardToolbar,
20113
20443
  {
20114
20444
  entry: activeEntry,
@@ -20136,7 +20466,7 @@ function AiPricingCardOverlay({
20136
20466
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20137
20467
  }
20138
20468
  ) }),
20139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20469
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20140
20470
  "div",
20141
20471
  {
20142
20472
  "data-ohw-bridge": "",
@@ -20158,7 +20488,7 @@ function AiPricingCardOverlay({
20158
20488
 
20159
20489
  // src/ui/ai-section/AiVideoOverlay.tsx
20160
20490
  var import_react14 = require("react");
20161
- var import_lucide_react10 = require("lucide-react");
20491
+ var import_lucide_react11 = require("lucide-react");
20162
20492
 
20163
20493
  // src/lib/ai-video-tree.ts
20164
20494
  function resolveVideoBlock(tree, path) {
@@ -20200,39 +20530,11 @@ function clearVideo(tree, path) {
20200
20530
  });
20201
20531
  }
20202
20532
 
20203
- // src/lib/youtube.ts
20204
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20205
- function extractYouTubeId(input) {
20206
- const trimmed = input.trim();
20207
- if (!trimmed) return null;
20208
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20209
- let url;
20210
- try {
20211
- url = new URL(trimmed);
20212
- } catch {
20213
- return null;
20214
- }
20215
- const host = url.hostname.replace(/^www\./, "");
20216
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20217
- return null;
20218
- }
20219
- let candidate = null;
20220
- if (host === "youtu.be") {
20221
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20222
- } else if (url.pathname === "/watch") {
20223
- candidate = url.searchParams.get("v");
20224
- } else {
20225
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20226
- candidate = match ? match[1] : null;
20227
- }
20228
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20229
- }
20230
-
20231
20533
  // src/ui/ai-section/AiVideoOverlay.tsx
20232
- var import_jsx_runtime22 = require("react/jsx-runtime");
20534
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20233
20535
  var PRIMARY5 = "#0885FE";
20234
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20235
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20536
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20537
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20236
20538
  function findVideoBlockElement(sectionId, path) {
20237
20539
  const sectionEl = findByInstanceId(sectionId);
20238
20540
  if (!sectionEl) return null;
@@ -20292,12 +20594,12 @@ function requestValidateTree3(postToParent2, tree) {
20292
20594
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20293
20595
  });
20294
20596
  }
20295
- function Pill2({
20597
+ function Pill({
20296
20598
  label,
20297
20599
  onClick,
20298
20600
  disabled
20299
20601
  }) {
20300
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20602
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20301
20603
  "button",
20302
20604
  {
20303
20605
  type: "button",
@@ -20313,7 +20615,7 @@ function Pill2({
20313
20615
  border: "none",
20314
20616
  cursor: disabled ? "default" : "pointer",
20315
20617
  background: "#ffffff",
20316
- color: OHW_BLUE_DARK2,
20618
+ color: OHW_BLUE_DARK,
20317
20619
  opacity: disabled ? 0.4 : 1,
20318
20620
  fontSize: 12,
20319
20621
  lineHeight: "16px",
@@ -20356,8 +20658,8 @@ function VideoUrlInput({ value, onCommit }) {
20356
20658
  onCommit(id);
20357
20659
  }
20358
20660
  };
20359
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20360
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20661
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20662
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20361
20663
  "div",
20362
20664
  {
20363
20665
  style: {
@@ -20373,12 +20675,12 @@ function VideoUrlInput({ value, onCommit }) {
20373
20675
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20374
20676
  },
20375
20677
  children: [
20376
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20678
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20377
20679
  "span",
20378
20680
  {
20379
20681
  style: {
20380
20682
  flex: "0 0 auto",
20381
- color: OHW_BLUE_DARK2,
20683
+ color: OHW_BLUE_DARK,
20382
20684
  fontSize: 10,
20383
20685
  lineHeight: "16px",
20384
20686
  fontWeight: 700,
@@ -20388,7 +20690,7 @@ function VideoUrlInput({ value, onCommit }) {
20388
20690
  children: "Video"
20389
20691
  }
20390
20692
  ),
20391
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20693
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20392
20694
  "input",
20393
20695
  {
20394
20696
  type: "text",
@@ -20425,7 +20727,7 @@ function VideoUrlInput({ value, onCommit }) {
20425
20727
  ]
20426
20728
  }
20427
20729
  ),
20428
- invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20730
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20429
20731
  ] });
20430
20732
  }
20431
20733
  function VideoToolbar({
@@ -20435,7 +20737,7 @@ function VideoToolbar({
20435
20737
  onSetVideoId,
20436
20738
  onRemove
20437
20739
  }) {
20438
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20740
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20439
20741
  "div",
20440
20742
  {
20441
20743
  "data-ohw-bridge": "",
@@ -20447,7 +20749,7 @@ function VideoToolbar({
20447
20749
  gap: 6,
20448
20750
  alignItems: "center",
20449
20751
  width: 280,
20450
- background: OHW_BLUE2,
20752
+ background: OHW_BLUE,
20451
20753
  padding: 8,
20452
20754
  borderRadius: 12,
20453
20755
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20455,9 +20757,9 @@ function VideoToolbar({
20455
20757
  opacity: pending ? 0.6 : 1
20456
20758
  },
20457
20759
  children: [
20458
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20459
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20460
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20760
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20761
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20762
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20461
20763
  ]
20462
20764
  }
20463
20765
  );
@@ -20577,8 +20879,8 @@ function AiVideoOverlay({
20577
20879
  const activeBlockRect = useLiveBlockRect(active);
20578
20880
  const TOOLBAR_APPROX_H = 90;
20579
20881
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20580
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20581
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20882
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
20883
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20582
20884
  "button",
20583
20885
  {
20584
20886
  type: "button",
@@ -20606,15 +20908,15 @@ function AiVideoOverlay({
20606
20908
  fontSize: 14,
20607
20909
  fontWeight: 700
20608
20910
  },
20609
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
20911
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20610
20912
  }
20611
20913
  ),
20612
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20914
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20613
20915
  ItemInteractionLayer,
20614
20916
  {
20615
20917
  rect: activeBlockRect,
20616
20918
  state: toolbarState,
20617
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20919
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20618
20920
  VideoToolbar,
20619
20921
  {
20620
20922
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20638,7 +20940,7 @@ function AiVideoOverlay({
20638
20940
 
20639
20941
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20640
20942
  var import_react15 = require("react");
20641
- var import_lucide_react11 = require("lucide-react");
20943
+ var import_lucide_react12 = require("lucide-react");
20642
20944
 
20643
20945
  // src/lib/ai-carousel-tree.ts
20644
20946
  function isCarouselBlock(node) {
@@ -20689,10 +20991,10 @@ function setCarouselAutoplay(tree, on) {
20689
20991
  }
20690
20992
 
20691
20993
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20692
- var import_jsx_runtime23 = require("react/jsx-runtime");
20994
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20693
20995
  var PRIMARY6 = "#0885FE";
20694
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20695
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20996
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
20997
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20696
20998
  function findCarouselItemElement(sectionId, index) {
20697
20999
  const sectionEl = findByInstanceId(sectionId);
20698
21000
  if (!sectionEl) return null;
@@ -20771,8 +21073,8 @@ function requestAssetPick2(postToParent2) {
20771
21073
  postToParent2({ type: "ow:asset-pick", id });
20772
21074
  });
20773
21075
  }
20774
- function Pill3({ label, onClick, disabled }) {
20775
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21076
+ function Pill2({ label, onClick, disabled }) {
21077
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20776
21078
  "button",
20777
21079
  {
20778
21080
  type: "button",
@@ -20788,7 +21090,7 @@ function Pill3({ label, onClick, disabled }) {
20788
21090
  border: "none",
20789
21091
  cursor: disabled ? "default" : "pointer",
20790
21092
  background: "#ffffff",
20791
- color: OHW_BLUE_DARK3,
21093
+ color: OHW_BLUE_DARK2,
20792
21094
  opacity: disabled ? 0.4 : 1,
20793
21095
  fontSize: 12,
20794
21096
  lineHeight: "16px",
@@ -20806,7 +21108,7 @@ function TogglePill({
20806
21108
  onToggle,
20807
21109
  disabled
20808
21110
  }) {
20809
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21111
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20810
21112
  "button",
20811
21113
  {
20812
21114
  type: "button",
@@ -20825,7 +21127,7 @@ function TogglePill({
20825
21127
  border: "none",
20826
21128
  cursor: disabled ? "default" : "pointer",
20827
21129
  background: "#ffffff",
20828
- color: OHW_BLUE_DARK3,
21130
+ color: OHW_BLUE_DARK2,
20829
21131
  opacity: disabled ? 0.4 : 1,
20830
21132
  fontSize: 12,
20831
21133
  lineHeight: "16px",
@@ -20835,7 +21137,7 @@ function TogglePill({
20835
21137
  },
20836
21138
  children: [
20837
21139
  label,
20838
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21140
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20839
21141
  "span",
20840
21142
  {
20841
21143
  "aria-hidden": true,
@@ -20848,10 +21150,10 @@ function TogglePill({
20848
21150
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20849
21151
  // carries the brand colour in the text, and a pale blue track next to it read as
20850
21152
  // "disabled control" rather than "switch that is off".
20851
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21153
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20852
21154
  transition: "background 120ms ease"
20853
21155
  },
20854
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21156
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20855
21157
  "span",
20856
21158
  {
20857
21159
  style: {
@@ -20880,7 +21182,7 @@ function CarouselSlideToolbar({
20880
21182
  onChangeImage,
20881
21183
  onToggleAutoplay
20882
21184
  }) {
20883
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21185
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20884
21186
  "div",
20885
21187
  {
20886
21188
  "data-ohw-bridge": "",
@@ -20891,7 +21193,7 @@ function CarouselSlideToolbar({
20891
21193
  flexDirection: "column",
20892
21194
  gap: 6,
20893
21195
  alignItems: "center",
20894
- background: OHW_BLUE3,
21196
+ background: OHW_BLUE2,
20895
21197
  padding: 8,
20896
21198
  borderRadius: 12,
20897
21199
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20903,11 +21205,11 @@ function CarouselSlideToolbar({
20903
21205
  pointerEvents: pending ? "none" : "auto"
20904
21206
  },
20905
21207
  children: [
20906
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20907
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
20908
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21208
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21209
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21210
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20909
21211
  ] }),
20910
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21212
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20911
21213
  ]
20912
21214
  }
20913
21215
  );
@@ -21047,8 +21349,8 @@ function AiFadeCarouselOverlay({
21047
21349
  const activeItemRect = useLiveItemRect2(active);
21048
21350
  const TOOLBAR_APPROX_H = 90;
21049
21351
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21050
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21051
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21352
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21353
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21052
21354
  "button",
21053
21355
  {
21054
21356
  type: "button",
@@ -21077,10 +21379,10 @@ function AiFadeCarouselOverlay({
21077
21379
  fontSize: 14,
21078
21380
  fontWeight: 700
21079
21381
  },
21080
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21382
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21081
21383
  }
21082
21384
  ),
21083
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21385
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21084
21386
  "div",
21085
21387
  {
21086
21388
  ref: skeletonRef,
@@ -21098,15 +21400,15 @@ function AiFadeCarouselOverlay({
21098
21400
  zIndex: 2147483646,
21099
21401
  pointerEvents: "none"
21100
21402
  },
21101
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21403
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21102
21404
  }
21103
21405
  ),
21104
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21406
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21105
21407
  ItemInteractionLayer,
21106
21408
  {
21107
21409
  rect: activeItemRect,
21108
21410
  state: toolbarState,
21109
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21411
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21110
21412
  CarouselSlideToolbar,
21111
21413
  {
21112
21414
  pending,
@@ -21297,113 +21599,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21297
21599
  // src/ui/link-modal/LinkPopover.tsx
21298
21600
  var import_react19 = require("react");
21299
21601
 
21300
- // src/ui/dialog.tsx
21301
- var React9 = __toESM(require("react"), 1);
21302
- var import_radix_ui6 = require("radix-ui");
21303
- var import_lucide_react12 = require("lucide-react");
21304
- var import_jsx_runtime24 = require("react/jsx-runtime");
21305
- function Dialog2({
21306
- ...props
21307
- }) {
21308
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21309
- }
21310
- function DialogPortal({
21311
- ...props
21312
- }) {
21313
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21314
- }
21315
- function DialogOverlay({
21316
- className,
21317
- ...props
21318
- }) {
21319
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21320
- import_radix_ui6.Dialog.Overlay,
21321
- {
21322
- "data-slot": "dialog-overlay",
21323
- "data-ohw-link-modal-root": "",
21324
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21325
- ...props
21326
- }
21327
- );
21328
- }
21329
- var DialogContent = React9.forwardRef(
21330
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21331
- const positionMode = container ? "absolute" : "fixed";
21332
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21333
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21334
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21335
- import_radix_ui6.Dialog.Content,
21336
- {
21337
- ref,
21338
- "data-slot": "dialog-content",
21339
- className: cn(
21340
- positionMode,
21341
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21342
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21343
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21344
- className
21345
- ),
21346
- onMouseDown: (e) => e.stopPropagation(),
21347
- ...props,
21348
- children: [
21349
- children,
21350
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21351
- import_radix_ui6.Dialog.Close,
21352
- {
21353
- type: "button",
21354
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21355
- "aria-label": "Close",
21356
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21357
- }
21358
- ) : null
21359
- ]
21360
- }
21361
- )
21362
- ] });
21363
- }
21364
- );
21365
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21366
- function DialogHeader({
21367
- className,
21368
- ...props
21369
- }) {
21370
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21371
- }
21372
- function DialogFooter({
21373
- className,
21374
- ...props
21375
- }) {
21376
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21377
- "div",
21378
- {
21379
- className: cn("flex items-center justify-end gap-2", className),
21380
- ...props
21381
- }
21382
- );
21383
- }
21384
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21385
- import_radix_ui6.Dialog.Title,
21386
- {
21387
- ref,
21388
- className: cn(
21389
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21390
- className
21391
- ),
21392
- ...props
21393
- }
21394
- ));
21395
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21396
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21397
- import_radix_ui6.Dialog.Description,
21398
- {
21399
- ref,
21400
- className: cn("text-sm text-muted-foreground", className),
21401
- ...props
21402
- }
21403
- ));
21404
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21405
- var DialogClose = import_radix_ui6.Dialog.Close;
21406
-
21407
21602
  // src/ui/link-modal/LinkEditorPanel.tsx
21408
21603
  var import_lucide_react16 = require("lucide-react");
21409
21604
 
@@ -22507,6 +22702,7 @@ function shouldUseDevFixtures() {
22507
22702
  function getLogoElement(el) {
22508
22703
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22509
22704
  if (marked) return marked;
22705
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22510
22706
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22511
22707
  if (!root) return null;
22512
22708
  const anchor = el.closest("a");
@@ -24201,6 +24397,138 @@ function deleteSelectedNavFooterItem(deps) {
24201
24397
  return false;
24202
24398
  }
24203
24399
 
24400
+ // src/lib/build-page-sync.ts
24401
+ var import_react23 = require("react");
24402
+ var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
24403
+ function normalisePath(path) {
24404
+ const trimmed = path.trim().replace(/[?#].*$/u, "");
24405
+ if (!trimmed || trimmed === "/") return "/";
24406
+ return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
24407
+ }
24408
+ function isDeadPageHref(href, livePaths) {
24409
+ const value = href.trim();
24410
+ if (!value.startsWith("/") || value.startsWith("//")) return false;
24411
+ const path = normalisePath(value);
24412
+ if (path === "/") return false;
24413
+ return !livePaths.some((live) => {
24414
+ const p = normalisePath(live);
24415
+ return p === path || p !== "/" && path.startsWith(`${p}/`);
24416
+ });
24417
+ }
24418
+ var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
24419
+ function planBuildPageSync(links, msg) {
24420
+ const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
24421
+ const removed = new Set((msg.removed ?? []).map(normalisePath));
24422
+ const remove = [];
24423
+ const relabel = [];
24424
+ const retarget = [];
24425
+ const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
24426
+ for (const link of links) {
24427
+ const href = link.href.trim();
24428
+ const isPage = href.startsWith("/") && !href.startsWith("//");
24429
+ if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
24430
+ if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
24431
+ else remove.push(link.hrefKey);
24432
+ continue;
24433
+ }
24434
+ if (isPage) {
24435
+ const path = normalisePath(href);
24436
+ const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
24437
+ if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
24438
+ relabel.push({ hrefKey: link.hrefKey, label: rename.label });
24439
+ }
24440
+ continue;
24441
+ }
24442
+ if (href.startsWith("#") || href.startsWith("/#")) {
24443
+ const anchor = href.replace(/^\/?#/u, "").toLowerCase();
24444
+ const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
24445
+ if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
24446
+ relabel.push({ hrefKey: link.hrefKey, label: target.label });
24447
+ }
24448
+ }
24449
+ }
24450
+ return { remove, relabel, retarget };
24451
+ }
24452
+ function linkHref(el) {
24453
+ const key = el.getAttribute("data-ohw-href-key");
24454
+ const stored = key ? getStoredLinkHref(key) : void 0;
24455
+ return stored ?? el.getAttribute("href") ?? "";
24456
+ }
24457
+ function labelEl(anchor) {
24458
+ return anchor.querySelector('[data-ohw-editable="text"]');
24459
+ }
24460
+ function collectLinks() {
24461
+ const seen = /* @__PURE__ */ new Set();
24462
+ const links = [];
24463
+ document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
24464
+ const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
24465
+ if (seen.has(hrefKey)) return;
24466
+ const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
24467
+ if (!area) return;
24468
+ const label = labelEl(el);
24469
+ if (!label && area !== "chrome") return;
24470
+ seen.add(hrefKey);
24471
+ links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
24472
+ });
24473
+ return links;
24474
+ }
24475
+ function applyBuildPageSync(msg, deps) {
24476
+ const plan = planBuildPageSync(collectLinks(), msg);
24477
+ const nodes = /* @__PURE__ */ new Map();
24478
+ for (const hrefKey of plan.remove) {
24479
+ const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
24480
+ if (!anchor) continue;
24481
+ const nav = isNavbarHrefKey(hrefKey);
24482
+ const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
24483
+ if (!result) continue;
24484
+ for (const key of result.removedKeys) {
24485
+ nodes.set(key, "");
24486
+ clearStoredLinkHref(key);
24487
+ }
24488
+ nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
24489
+ }
24490
+ for (const { hrefKey, label } of plan.relabel) {
24491
+ const labelKey = hrefKey.replace(/-href$/u, "-label");
24492
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24493
+ const el = labelEl(anchor);
24494
+ if (el) el.textContent = label;
24495
+ });
24496
+ nodes.set(labelKey, label);
24497
+ }
24498
+ for (const { hrefKey, href } of plan.retarget) {
24499
+ setStoredLinkHref(hrefKey, href);
24500
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24501
+ if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
24502
+ });
24503
+ nodes.set(hrefKey, href);
24504
+ }
24505
+ if (nodes.size === 0) return 0;
24506
+ deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
24507
+ deps.postToParent({
24508
+ type: "ow:change",
24509
+ nodes: [...nodes].map(([key, text]) => ({ key, text }))
24510
+ });
24511
+ return plan.remove.length + plan.relabel.length + plan.retarget.length;
24512
+ }
24513
+ function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
24514
+ (0, import_react23.useEffect)(() => {
24515
+ if (!isEditMode) return;
24516
+ const onMessage = (e) => {
24517
+ if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
24518
+ const changed = applyBuildPageSync(e.data, {
24519
+ getEditContent: () => editContentRef.current,
24520
+ setEditContent: (next) => {
24521
+ editContentRef.current = next;
24522
+ },
24523
+ postToParent: postToParent2
24524
+ });
24525
+ postToParent2({ type: "ow:pages-synced", changed });
24526
+ };
24527
+ window.addEventListener("message", onMessage);
24528
+ return () => window.removeEventListener("message", onMessage);
24529
+ }, [isEditMode, editContentRef, postToParent2]);
24530
+ }
24531
+
24204
24532
  // src/lib/nav-page-sync.ts
24205
24533
  function labelKeyFor(hrefKey) {
24206
24534
  return hrefKey.replace(/-href$/, "-label");
@@ -25184,7 +25512,7 @@ function getNavigationSelectionParent(el) {
25184
25512
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25185
25513
  return resolveFooterLinksContainerFrom(el);
25186
25514
  }
25187
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25515
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
25188
25516
  return getNavigationRoot(el);
25189
25517
  }
25190
25518
  return null;
@@ -25406,7 +25734,6 @@ var ICONS = {
25406
25734
  insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
25407
25735
  insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
25408
25736
  };
25409
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25410
25737
  var SELECTION_CHROME_GAP2 = 4;
25411
25738
  var TOOLBAR_STROKE_GAP2 = 4;
25412
25739
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25504,7 +25831,7 @@ function applyVisibleViewport(el, parentScroll) {
25504
25831
  el.style.top = `${top}px`;
25505
25832
  el.style.height = `${height}px`;
25506
25833
  }
25507
- var TOOLBAR_EDGE_MARGIN3 = 4;
25834
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25508
25835
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25509
25836
  const isAbove = transform.includes("translateY(-100%)");
25510
25837
  let visualTop = isAbove ? top - approxH : top;
@@ -25531,8 +25858,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25531
25858
  function clampToolbarLeft(centerX, toolbarWidth) {
25532
25859
  const half = toolbarWidth / 2;
25533
25860
  return Math.max(
25534
- TOOLBAR_EDGE_MARGIN3 + half,
25535
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25861
+ TOOLBAR_EDGE_MARGIN4 + half,
25862
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25536
25863
  );
25537
25864
  }
25538
25865
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -25656,9 +25983,9 @@ function FloatingToolbar({
25656
25983
  showEditLink,
25657
25984
  onEditLink
25658
25985
  }) {
25659
- const localRef = import_react23.default.useRef(null);
25660
- const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25661
- const setRefs = import_react23.default.useCallback(
25986
+ const localRef = import_react24.default.useRef(null);
25987
+ const [measuredW, setMeasuredW] = import_react24.default.useState(330);
25988
+ const setRefs = import_react24.default.useCallback(
25662
25989
  (node) => {
25663
25990
  localRef.current = node;
25664
25991
  if (typeof elRef === "function") elRef(node);
@@ -25670,7 +25997,7 @@ function FloatingToolbar({
25670
25997
  },
25671
25998
  [elRef]
25672
25999
  );
25673
- import_react23.default.useLayoutEffect(() => {
26000
+ import_react24.default.useLayoutEffect(() => {
25674
26001
  const node = localRef.current;
25675
26002
  if (!node) return;
25676
26003
  const update = () => {
@@ -25696,7 +26023,7 @@ function FloatingToolbar({
25696
26023
  pointerEvents: "auto"
25697
26024
  },
25698
26025
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25699
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
26026
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
25700
26027
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25701
26028
  btns.map((btn) => {
25702
26029
  const isActive = activeCommands.has(btn.cmd);
@@ -25905,8 +26232,8 @@ function OhhwellsBridge() {
25905
26232
  const router = (0, import_navigation4.useRouter)();
25906
26233
  const searchParams = (0, import_navigation4.useSearchParams)();
25907
26234
  const isEditMode = isEditSessionActive();
25908
- const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
25909
- (0, import_react23.useEffect)(() => {
26235
+ const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
26236
+ (0, import_react24.useEffect)(() => {
25910
26237
  const figtreeFontId = "ohw-figtree-font";
25911
26238
  if (!document.getElementById(figtreeFontId)) {
25912
26239
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25932,8 +26259,8 @@ function OhhwellsBridge() {
25932
26259
  };
25933
26260
  }, []);
25934
26261
  const subdomainFromQuery = searchParams.get("subdomain");
25935
- const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
25936
- (0, import_react23.useLayoutEffect)(() => {
26262
+ const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
26263
+ (0, import_react24.useLayoutEffect)(() => {
25937
26264
  const next = resolveSubdomain(subdomainFromQuery);
25938
26265
  if (next !== subdomain) setSubdomain(next);
25939
26266
  if (next) return;
@@ -25945,7 +26272,7 @@ function OhhwellsBridge() {
25945
26272
  }, 0);
25946
26273
  return () => window.clearTimeout(t);
25947
26274
  }, [subdomainFromQuery, subdomain]);
25948
- (0, import_react23.useEffect)(() => {
26275
+ (0, import_react24.useEffect)(() => {
25949
26276
  if (!subdomainFromQuery || typeof window === "undefined") return;
25950
26277
  const url = new URL(window.location.href);
25951
26278
  if (!url.searchParams.has("subdomain")) return;
@@ -25957,22 +26284,22 @@ function OhhwellsBridge() {
25957
26284
  useSavedLinkNavigation(isEditMode);
25958
26285
  useNavDropdownToggle(isEditMode);
25959
26286
  useHashLinkScroll(isEditMode);
25960
- const postToParent2 = (0, import_react23.useCallback)((data) => {
26287
+ const postToParent2 = (0, import_react24.useCallback)((data) => {
25961
26288
  if (typeof window !== "undefined" && window.parent !== window) {
25962
26289
  window.parent.postMessage(data, "*");
25963
26290
  }
25964
26291
  }, []);
25965
- const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
25966
- const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
25967
- const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25968
- (0, import_react23.useEffect)(() => {
26292
+ const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
26293
+ const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
26294
+ const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26295
+ (0, import_react24.useEffect)(() => {
25969
26296
  stampBridgeVersionOnDocument();
25970
26297
  }, []);
25971
- (0, import_react23.useEffect)(() => {
26298
+ (0, import_react24.useEffect)(() => {
25972
26299
  if (isEditMode) return;
25973
26300
  return armLoaderHangBeacon(subdomain, fetchState);
25974
26301
  }, [isEditMode, subdomain, fetchState]);
25975
- (0, import_react23.useEffect)(() => {
26302
+ (0, import_react24.useEffect)(() => {
25976
26303
  if (isEditMode || !subdomain) return;
25977
26304
  const onError = (event) => {
25978
26305
  reportOutageBeacon({
@@ -25993,40 +26320,40 @@ function OhhwellsBridge() {
25993
26320
  window.removeEventListener("unhandledrejection", onRejection);
25994
26321
  };
25995
26322
  }, [isEditMode, subdomain]);
25996
- const activeElRef = (0, import_react23.useRef)(null);
25997
- const pointerHeldRef = (0, import_react23.useRef)(false);
25998
- const selectedElRef = (0, import_react23.useRef)(null);
25999
- const selectedHrefKeyRef = (0, import_react23.useRef)(null);
26000
- const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
26001
- const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26002
- const originalContentRef = (0, import_react23.useRef)(null);
26003
- const activeStateElRef = (0, import_react23.useRef)(null);
26004
- const parentScrollRef = (0, import_react23.useRef)(null);
26005
- const visibleViewportRef = (0, import_react23.useRef)(null);
26006
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
26007
- const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
26323
+ const activeElRef = (0, import_react24.useRef)(null);
26324
+ const pointerHeldRef = (0, import_react24.useRef)(false);
26325
+ const selectedElRef = (0, import_react24.useRef)(null);
26326
+ const selectedHrefKeyRef = (0, import_react24.useRef)(null);
26327
+ const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
26328
+ const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26329
+ const originalContentRef = (0, import_react24.useRef)(null);
26330
+ const activeStateElRef = (0, import_react24.useRef)(null);
26331
+ const parentScrollRef = (0, import_react24.useRef)(null);
26332
+ const visibleViewportRef = (0, import_react24.useRef)(null);
26333
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
26334
+ const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
26008
26335
  visibleViewportRef.current = node;
26009
26336
  setDialogPortalContainer(node);
26010
26337
  if (node) applyVisibleViewport(node, parentScrollRef.current);
26011
26338
  }, []);
26012
- const toolbarElRef = (0, import_react23.useRef)(null);
26013
- const glowElRef = (0, import_react23.useRef)(null);
26014
- const hoveredImageRef = (0, import_react23.useRef)(null);
26015
- const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
26016
- const dragOverElRef = (0, import_react23.useRef)(null);
26017
- const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
26018
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
26019
- const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
26020
- const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
26339
+ const toolbarElRef = (0, import_react24.useRef)(null);
26340
+ const glowElRef = (0, import_react24.useRef)(null);
26341
+ const hoveredImageRef = (0, import_react24.useRef)(null);
26342
+ const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
26343
+ const dragOverElRef = (0, import_react24.useRef)(null);
26344
+ const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
26345
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
26346
+ const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
26347
+ const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
26021
26348
  selectedAiSectionIdRef.current = id;
26022
26349
  setSelectedAiSectionId(id);
26023
26350
  }, []);
26024
- const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
26025
- const selectedMediaElRef = (0, import_react23.useRef)(null);
26026
- const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
26027
- const selectedIconElRef = (0, import_react23.useRef)(null);
26028
- const selectedSocialElRef = (0, import_react23.useRef)(null);
26029
- const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
26351
+ const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
26352
+ const selectedMediaElRef = (0, import_react24.useRef)(null);
26353
+ const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
26354
+ const selectedIconElRef = (0, import_react24.useRef)(null);
26355
+ const selectedSocialElRef = (0, import_react24.useRef)(null);
26356
+ const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
26030
26357
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
26031
26358
  if (!sectionEl) return;
26032
26359
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -26047,31 +26374,31 @@ function OhhwellsBridge() {
26047
26374
  window.addEventListener("message", onQueueDrained);
26048
26375
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
26049
26376
  }, []);
26050
- const clearMediaSelection = (0, import_react23.useCallback)(() => {
26377
+ const clearMediaSelection = (0, import_react24.useCallback)(() => {
26051
26378
  const prev = selectedMediaElRef.current;
26052
26379
  selectedMediaElRef.current = null;
26053
26380
  setSelectedMedia(null);
26054
26381
  queueSectionKeyDrop(prev);
26055
26382
  }, [queueSectionKeyDrop]);
26056
- const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
26383
+ const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
26057
26384
  clearMediaSelectionRef.current = clearMediaSelection;
26058
- const clearIconSelection = (0, import_react23.useCallback)(() => {
26385
+ const clearIconSelection = (0, import_react24.useCallback)(() => {
26059
26386
  const prev = selectedIconElRef.current;
26060
26387
  if (!prev) return;
26061
26388
  selectedIconElRef.current = null;
26062
26389
  queueSectionKeyDrop(prev);
26063
26390
  }, [queueSectionKeyDrop]);
26064
- const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
26391
+ const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
26065
26392
  clearIconSelectionRef.current = clearIconSelection;
26066
- const clearSocialSelection = (0, import_react23.useCallback)(() => {
26393
+ const clearSocialSelection = (0, import_react24.useCallback)(() => {
26067
26394
  const prev = selectedSocialElRef.current;
26068
26395
  if (!prev) return;
26069
26396
  selectedSocialElRef.current = null;
26070
26397
  queueSectionKeyDrop(prev);
26071
26398
  }, [queueSectionKeyDrop]);
26072
- const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
26399
+ const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
26073
26400
  clearSocialSelectionRef.current = clearSocialSelection;
26074
- const selectIconElement = (0, import_react23.useCallback)((el) => {
26401
+ const selectIconElement = (0, import_react24.useCallback)((el) => {
26075
26402
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26076
26403
  selectedIconElRef.current = el;
26077
26404
  const sectionEl = el.closest("[data-ohw-section]");
@@ -26084,9 +26411,9 @@ function OhhwellsBridge() {
26084
26411
  keyLabel: "Icon"
26085
26412
  });
26086
26413
  }, []);
26087
- const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
26414
+ const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
26088
26415
  selectIconElementRef.current = selectIconElement;
26089
- const selectMediaElement = (0, import_react23.useCallback)((el) => {
26416
+ const selectMediaElement = (0, import_react24.useCallback)((el) => {
26090
26417
  const r2 = el.getBoundingClientRect();
26091
26418
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
26092
26419
  selectedIconElRef.current = null;
@@ -26111,9 +26438,9 @@ function OhhwellsBridge() {
26111
26438
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
26112
26439
  });
26113
26440
  }, []);
26114
- const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
26441
+ const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
26115
26442
  selectMediaElementRef.current = selectMediaElement;
26116
- (0, import_react23.useEffect)(() => {
26443
+ (0, import_react24.useEffect)(() => {
26117
26444
  if (!selectedMedia) return;
26118
26445
  const update = () => {
26119
26446
  const el = selectedMediaElRef.current;
@@ -26133,54 +26460,54 @@ function OhhwellsBridge() {
26133
26460
  window.removeEventListener("resize", update);
26134
26461
  };
26135
26462
  }, [selectedMedia !== null]);
26136
- const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
26137
- const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
26138
- const hoveredGapRef = (0, import_react23.useRef)(null);
26139
- const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
26140
- const imageShowTimerRef = (0, import_react23.useRef)(null);
26141
- const editStylesRef = (0, import_react23.useRef)(null);
26142
- const activateRef = (0, import_react23.useRef)(() => {
26463
+ const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
26464
+ const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
26465
+ const hoveredGapRef = (0, import_react24.useRef)(null);
26466
+ const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
26467
+ const imageShowTimerRef = (0, import_react24.useRef)(null);
26468
+ const editStylesRef = (0, import_react24.useRef)(null);
26469
+ const activateRef = (0, import_react24.useRef)(() => {
26143
26470
  });
26144
- const deactivateRef = (0, import_react23.useRef)(() => {
26471
+ const deactivateRef = (0, import_react24.useRef)(() => {
26145
26472
  });
26146
- const selectRef = (0, import_react23.useRef)(() => {
26473
+ const selectRef = (0, import_react24.useRef)(() => {
26147
26474
  });
26148
- const selectFrameRef = (0, import_react23.useRef)(() => {
26475
+ const selectFrameRef = (0, import_react24.useRef)(() => {
26149
26476
  });
26150
- const selectLogoRef = (0, import_react23.useRef)(() => {
26477
+ const selectLogoRef = (0, import_react24.useRef)(() => {
26151
26478
  });
26152
- const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
26479
+ const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
26153
26480
  });
26154
- const deselectRef = (0, import_react23.useRef)(() => {
26481
+ const deselectRef = (0, import_react24.useRef)(() => {
26155
26482
  });
26156
- const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
26483
+ const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
26157
26484
  });
26158
- const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
26485
+ const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
26159
26486
  });
26160
- const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
26487
+ const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
26161
26488
  });
26162
- const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
26163
- const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
26164
- const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
26165
- const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
26489
+ const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
26490
+ const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
26491
+ const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
26492
+ const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
26166
26493
  });
26167
- const postToParentRef = (0, import_react23.useRef)(postToParent2);
26494
+ const postToParentRef = (0, import_react24.useRef)(postToParent2);
26168
26495
  postToParentRef.current = postToParent2;
26169
- const aiSectionApiRef = (0, import_react23.useRef)(null);
26170
- const sectionsLoadedRef = (0, import_react23.useRef)(false);
26171
- const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
26172
- const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
26173
- const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
26174
- const formPickElRef = (0, import_react23.useRef)(null);
26175
- const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
26176
- const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
26177
- const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
26178
- const formHoverElRef = (0, import_react23.useRef)(null);
26179
- const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
26180
- const fieldPickElRef = (0, import_react23.useRef)(null);
26181
- const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
26182
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
26183
- const clearFormPick = (0, import_react23.useCallback)(() => {
26496
+ const aiSectionApiRef = (0, import_react24.useRef)(null);
26497
+ const sectionsLoadedRef = (0, import_react24.useRef)(false);
26498
+ const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
26499
+ const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
26500
+ const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
26501
+ const formPickElRef = (0, import_react24.useRef)(null);
26502
+ const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
26503
+ const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
26504
+ const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
26505
+ const formHoverElRef = (0, import_react24.useRef)(null);
26506
+ const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
26507
+ const fieldPickElRef = (0, import_react24.useRef)(null);
26508
+ const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
26509
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
26510
+ const clearFormPick = (0, import_react24.useCallback)(() => {
26184
26511
  const form = formPickElRef.current;
26185
26512
  const editing = fieldPickElRef.current;
26186
26513
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26200,7 +26527,7 @@ function OhhwellsBridge() {
26200
26527
  formPickElRef.current = null;
26201
26528
  setFormPickRect(null);
26202
26529
  }, []);
26203
- const clearFieldPick = (0, import_react23.useCallback)(() => {
26530
+ const clearFieldPick = (0, import_react24.useCallback)(() => {
26204
26531
  const wrapper = fieldPickElRef.current;
26205
26532
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26206
26533
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26210,9 +26537,9 @@ function OhhwellsBridge() {
26210
26537
  setFieldPickRect(null);
26211
26538
  setFieldPickState(null);
26212
26539
  }, []);
26213
- const persistFieldsRef = (0, import_react23.useRef)(() => {
26540
+ const persistFieldsRef = (0, import_react24.useRef)(() => {
26214
26541
  });
26215
- const persistFields = (0, import_react23.useCallback)(
26542
+ const persistFields = (0, import_react24.useCallback)(
26216
26543
  (form) => {
26217
26544
  const key = formKeyOf(form);
26218
26545
  if (!key) return;
@@ -26223,7 +26550,7 @@ function OhhwellsBridge() {
26223
26550
  []
26224
26551
  );
26225
26552
  persistFieldsRef.current = persistFields;
26226
- const selectField = (0, import_react23.useCallback)((wrapper) => {
26553
+ const selectField = (0, import_react24.useCallback)((wrapper) => {
26227
26554
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26228
26555
  commitPlaceholderEdit(fieldPickElRef.current);
26229
26556
  }
@@ -26236,7 +26563,7 @@ function OhhwellsBridge() {
26236
26563
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26237
26564
  setFieldTypePickerOpen(false);
26238
26565
  }, []);
26239
- const withSelectedField = (0, import_react23.useCallback)(
26566
+ const withSelectedField = (0, import_react24.useCallback)(
26240
26567
  (run) => {
26241
26568
  const wrapper = fieldPickElRef.current;
26242
26569
  const form = formPickElRef.current;
@@ -26249,28 +26576,28 @@ function OhhwellsBridge() {
26249
26576
  },
26250
26577
  [persistFields]
26251
26578
  );
26252
- const handleFieldTypeChange = (0, import_react23.useCallback)(
26579
+ const handleFieldTypeChange = (0, import_react24.useCallback)(
26253
26580
  (type) => withSelectedField((_form, wrapper) => {
26254
26581
  applyFieldType(wrapper, type);
26255
26582
  selectField(wrapper);
26256
26583
  }),
26257
26584
  [selectField, withSelectedField]
26258
26585
  );
26259
- const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26586
+ const handleFieldRequiredToggle = (0, import_react24.useCallback)(
26260
26587
  () => withSelectedField((_form, wrapper) => {
26261
26588
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26262
26589
  selectField(wrapper);
26263
26590
  }),
26264
26591
  [selectField, withSelectedField]
26265
26592
  );
26266
- const handleFieldDuplicate = (0, import_react23.useCallback)(
26593
+ const handleFieldDuplicate = (0, import_react24.useCallback)(
26267
26594
  () => withSelectedField((form, wrapper) => {
26268
26595
  const copy = duplicateField(form, wrapper);
26269
26596
  selectField(copy);
26270
26597
  }),
26271
26598
  [selectField, withSelectedField]
26272
26599
  );
26273
- const handleFieldDelete = (0, import_react23.useCallback)(
26600
+ const handleFieldDelete = (0, import_react24.useCallback)(
26274
26601
  () => withSelectedField((_form, wrapper) => {
26275
26602
  removeField(wrapper);
26276
26603
  clearFieldPick();
@@ -26278,7 +26605,7 @@ function OhhwellsBridge() {
26278
26605
  }),
26279
26606
  [clearFieldPick, withSelectedField]
26280
26607
  );
26281
- const handleAddField = (0, import_react23.useCallback)(
26608
+ const handleAddField = (0, import_react24.useCallback)(
26282
26609
  (type) => {
26283
26610
  const form = formPickElRef.current;
26284
26611
  if (!form) return;
@@ -26294,8 +26621,8 @@ function OhhwellsBridge() {
26294
26621
  },
26295
26622
  [persistFields, selectField]
26296
26623
  );
26297
- const fieldDragRef = (0, import_react23.useRef)(null);
26298
- const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26624
+ const fieldDragRef = (0, import_react24.useRef)(null);
26625
+ const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
26299
26626
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26300
26627
  const slots = others.map((el) => {
26301
26628
  const rect = el.getBoundingClientRect();
@@ -26308,7 +26635,7 @@ function OhhwellsBridge() {
26308
26635
  }
26309
26636
  return slots;
26310
26637
  }, []);
26311
- const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26638
+ const handleFieldDragStart = (0, import_react24.useCallback)(() => {
26312
26639
  const wrapper = fieldPickElRef.current;
26313
26640
  const form = formPickElRef.current;
26314
26641
  if (!wrapper || !form) return;
@@ -26317,18 +26644,18 @@ function OhhwellsBridge() {
26317
26644
  setFieldDragging(true);
26318
26645
  setFieldDropSlots(buildFieldDropSlots(form, key));
26319
26646
  }, [buildFieldDropSlots]);
26320
- const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26647
+ const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
26321
26648
  fieldDragRef.current = null;
26322
26649
  setFieldDropIndex(null);
26323
26650
  setFieldDropSlots([]);
26324
26651
  setFieldDragging(false);
26325
26652
  }, []);
26326
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
26327
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
26328
- const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
26329
- const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
26653
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
26654
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
26655
+ const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
26656
+ const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
26330
26657
  clearFormPickRef.current = clearFormPick;
26331
- (0, import_react23.useEffect)(() => {
26658
+ (0, import_react24.useEffect)(() => {
26332
26659
  const el = fieldPickElRef.current;
26333
26660
  if (!el || fieldPickRect === null) return;
26334
26661
  const observer = new ResizeObserver(() => {
@@ -26337,7 +26664,7 @@ function OhhwellsBridge() {
26337
26664
  observer.observe(el);
26338
26665
  return () => observer.disconnect();
26339
26666
  }, [fieldPickRect !== null, fieldPickState]);
26340
- (0, import_react23.useEffect)(() => {
26667
+ (0, import_react24.useEffect)(() => {
26341
26668
  const el = formPickElRef.current;
26342
26669
  if (!el || formPickRect === null) return;
26343
26670
  const observer = new ResizeObserver(() => {
@@ -26346,25 +26673,25 @@ function OhhwellsBridge() {
26346
26673
  observer.observe(el);
26347
26674
  return () => observer.disconnect();
26348
26675
  }, [formPickRect !== null, formViewState]);
26349
- const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26350
- const toolbarVariantRef = (0, import_react23.useRef)("none");
26676
+ const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
26677
+ const toolbarVariantRef = (0, import_react24.useRef)("none");
26351
26678
  toolbarVariantRef.current = toolbarVariant;
26352
- const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
26353
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
26354
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
26355
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
26356
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
26357
- const [toggleState, setToggleState] = (0, import_react23.useState)(null);
26358
- const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
26359
- const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
26360
- const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
26361
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
26362
- const hoveredNavContainerRef = (0, import_react23.useRef)(null);
26363
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
26364
- const hoveredItemElRef = (0, import_react23.useRef)(null);
26365
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
26366
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
26367
- (0, import_react23.useEffect)(() => {
26679
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
26680
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
26681
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
26682
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
26683
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
26684
+ const [toggleState, setToggleState] = (0, import_react24.useState)(null);
26685
+ const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
26686
+ const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
26687
+ const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
26688
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
26689
+ const hoveredNavContainerRef = (0, import_react24.useRef)(null);
26690
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
26691
+ const hoveredItemElRef = (0, import_react24.useRef)(null);
26692
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
26693
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
26694
+ (0, import_react24.useEffect)(() => {
26368
26695
  const sync = () => {
26369
26696
  const el = document.querySelector(
26370
26697
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26408,63 +26735,75 @@ function OhhwellsBridge() {
26408
26735
  });
26409
26736
  return () => observer.disconnect();
26410
26737
  }, []);
26411
- const siblingHintElRef = (0, import_react23.useRef)(null);
26412
- const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
26413
- const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
26414
- const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
26415
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
26738
+ const siblingHintElRef = (0, import_react24.useRef)(null);
26739
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
26740
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
26741
+ const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
26742
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
26416
26743
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26417
- const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26418
- const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26419
- floatingPanelOpenRef.current = floatingPanel !== null;
26420
- const floatingPanelRef = (0, import_react23.useRef)(null);
26421
- floatingPanelRef.current = floatingPanel;
26422
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
26423
- const buttonCollectionDragRef = (0, import_react23.useRef)(null);
26424
- const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
26425
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
26426
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
26427
- const buttonPointerDragRef = (0, import_react23.useRef)(null);
26428
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
26429
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
26430
- const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
26431
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
26432
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
26433
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
26434
- const footerDragRef = (0, import_react23.useRef)(null);
26435
- const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
26436
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
26437
- const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
26438
- const footerPointerDragRef = (0, import_react23.useRef)(null);
26439
- const suppressNextClickRef = (0, import_react23.useRef)(false);
26440
- const suppressClickUntilRef = (0, import_react23.useRef)(0);
26441
- const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
26442
- const linkPopoverSessionRef = (0, import_react23.useRef)(null);
26443
- const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
26444
- const editContentRef = (0, import_react23.useRef)({});
26445
- const aiSectionsRef = (0, import_react23.useRef)("");
26446
- const aiFooterRef = (0, import_react23.useRef)("");
26447
- const applyTreeLocalRef = (0, import_react23.useRef)(
26744
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
26745
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
26746
+ const footerDragRef = (0, import_react24.useRef)(null);
26747
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
26748
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
26749
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
26750
+ const footerPointerDragRef = (0, import_react24.useRef)(null);
26751
+ const suppressNextClickRef = (0, import_react24.useRef)(false);
26752
+ const suppressClickUntilRef = (0, import_react24.useRef)(0);
26753
+ const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
26754
+ const linkPopoverSessionRef = (0, import_react24.useRef)(null);
26755
+ const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
26756
+ const editContentRef = (0, import_react24.useRef)({});
26757
+ useBuildPageSync(isEditMode, editContentRef, postToParent2);
26758
+ const aiSectionsRef = (0, import_react24.useRef)("");
26759
+ const aiFooterRef = (0, import_react24.useRef)("");
26760
+ const applyTreeLocalRef = (0, import_react24.useRef)(
26448
26761
  null
26449
26762
  );
26450
- const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26451
- const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26763
+ const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
26764
+ const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
26452
26765
  });
26453
- const brandKitRef = (0, import_react23.useRef)("");
26454
- const stylesRef = (0, import_react23.useRef)("");
26455
- const appliedDrawerRef = (0, import_react23.useRef)(null);
26456
- const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
26457
- const [sitePages, setSitePages] = (0, import_react23.useState)([]);
26458
- const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26459
- const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
26460
- const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
26461
- const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
26462
- const linkPopoverPanelRef = (0, import_react23.useRef)(null);
26463
- const linkPopoverOpenRef = (0, import_react23.useRef)(false);
26464
- const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
26766
+ const brandKitRef = (0, import_react24.useRef)("");
26767
+ const stylesRef = (0, import_react24.useRef)("");
26768
+ const appliedDrawerRef = (0, import_react24.useRef)(null);
26769
+ const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
26770
+ const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
26771
+ const floatingPanelOpenRef = (0, import_react24.useRef)(false);
26772
+ const floatingPanelRef = (0, import_react24.useRef)(null);
26773
+ floatingPanelRef.current = floatingPanel;
26774
+ const setFloatingPanelRef = (0, import_react24.useRef)(setFloatingPanel);
26775
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
26776
+ const buttonCollectionDragRef = (0, import_react24.useRef)(null);
26777
+ const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
26778
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
26779
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
26780
+ const buttonPointerDragRef = (0, import_react24.useRef)(null);
26781
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
26782
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
26783
+ const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
26784
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
26785
+ const [sitePages, setSitePages] = (0, import_react24.useState)([]);
26786
+ const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26787
+ const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
26788
+ const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
26789
+ const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
26790
+ const linkPopoverPanelRef = (0, import_react24.useRef)(null);
26791
+ const linkPopoverOpenRef = (0, import_react24.useRef)(false);
26792
+ const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
26465
26793
  setLinkPopoverRef.current = setLinkPopover;
26794
+ setFloatingPanelRef.current = setFloatingPanel;
26466
26795
  linkPopoverSessionRef.current = linkPopover;
26467
- (0, import_react23.useEffect)(() => {
26796
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
26797
+ (0, import_react24.useEffect)(() => {
26798
+ const syncViewport = () => {
26799
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26800
+ setEditorViewport((prev) => prev === next ? prev : next);
26801
+ };
26802
+ syncViewport();
26803
+ window.addEventListener("resize", syncViewport);
26804
+ return () => window.removeEventListener("resize", syncViewport);
26805
+ }, []);
26806
+ (0, import_react24.useEffect)(() => {
26468
26807
  setSectionOrderPersistHandler((entries) => {
26469
26808
  const currentPath = window.location.pathname;
26470
26809
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26474,7 +26813,7 @@ function OhhwellsBridge() {
26474
26813
  });
26475
26814
  return () => setSectionOrderPersistHandler(null);
26476
26815
  }, []);
26477
- (0, import_react23.useEffect)(() => {
26816
+ (0, import_react24.useEffect)(() => {
26478
26817
  setAiFooterMountOptions({
26479
26818
  resolvePageHref: (pageOrAnchorId) => {
26480
26819
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26537,7 +26876,7 @@ function OhhwellsBridge() {
26537
26876
  const bumpLinkPopoverGrace = () => {
26538
26877
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26539
26878
  };
26540
- const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26879
+ const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
26541
26880
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26542
26881
  const gen = ++sectionsPrefetchGenRef.current;
26543
26882
  const paths = pages.map((p) => p.path);
@@ -26556,9 +26895,9 @@ function OhhwellsBridge() {
26556
26895
  );
26557
26896
  });
26558
26897
  }, [isEditMode, pathname]);
26559
- const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26898
+ const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
26560
26899
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26561
- (0, import_react23.useEffect)(() => {
26900
+ (0, import_react24.useEffect)(() => {
26562
26901
  if (!linkPopover) {
26563
26902
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26564
26903
  return;
@@ -26586,7 +26925,7 @@ function OhhwellsBridge() {
26586
26925
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26587
26926
  };
26588
26927
  }, [linkPopover, postToParent2]);
26589
- (0, import_react23.useEffect)(() => {
26928
+ (0, import_react24.useEffect)(() => {
26590
26929
  if (!isEditMode) return;
26591
26930
  const useFixtures = shouldUseDevFixtures();
26592
26931
  if (useFixtures) {
@@ -26612,7 +26951,7 @@ function OhhwellsBridge() {
26612
26951
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26613
26952
  return () => window.removeEventListener("message", onSitePages);
26614
26953
  }, [isEditMode, postToParent2]);
26615
- (0, import_react23.useEffect)(() => {
26954
+ (0, import_react24.useEffect)(() => {
26616
26955
  if (!isEditMode) return;
26617
26956
  const deps = {
26618
26957
  getEditContent: () => editContentRef.current,
@@ -26649,14 +26988,14 @@ function OhhwellsBridge() {
26649
26988
  window.addEventListener("message", onPageMessage);
26650
26989
  return () => window.removeEventListener("message", onPageMessage);
26651
26990
  }, [isEditMode, postToParent2]);
26652
- (0, import_react23.useEffect)(() => {
26991
+ (0, import_react24.useEffect)(() => {
26653
26992
  if (!isEditMode || shouldUseDevFixtures()) return;
26654
26993
  void loadAllSectionsManifest().then((manifest) => {
26655
26994
  if (Object.keys(manifest).length === 0) return;
26656
26995
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26657
26996
  });
26658
26997
  }, [isEditMode]);
26659
- (0, import_react23.useEffect)(() => {
26998
+ (0, import_react24.useEffect)(() => {
26660
26999
  const update = () => {
26661
27000
  const el = activeElRef.current ?? selectedElRef.current;
26662
27001
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26680,10 +27019,10 @@ function OhhwellsBridge() {
26680
27019
  vvp.removeEventListener("resize", update);
26681
27020
  };
26682
27021
  }, []);
26683
- const refreshStateRules = (0, import_react23.useCallback)(() => {
27022
+ const refreshStateRules = (0, import_react24.useCallback)(() => {
26684
27023
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26685
27024
  }, []);
26686
- const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
27025
+ const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
26687
27026
  const tracker = getSectionsTracker();
26688
27027
  let entries = [];
26689
27028
  try {
@@ -26706,7 +27045,7 @@ function OhhwellsBridge() {
26706
27045
  }
26707
27046
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26708
27047
  }, [isEditMode]);
26709
- const deactivate = (0, import_react23.useCallback)(() => {
27048
+ const deactivate = (0, import_react24.useCallback)(() => {
26710
27049
  const el = activeElRef.current;
26711
27050
  if (!el) return;
26712
27051
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26772,12 +27111,12 @@ function OhhwellsBridge() {
26772
27111
  setToolbarShowEditLink(false);
26773
27112
  postToParent2({ type: "ow:exit-edit" });
26774
27113
  }, [postToParent2]);
26775
- const clearSelectedAttr = (0, import_react23.useCallback)(() => {
27114
+ const clearSelectedAttr = (0, import_react24.useCallback)(() => {
26776
27115
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26777
27116
  el.removeAttribute("data-ohw-selected");
26778
27117
  });
26779
27118
  }, []);
26780
- const deselect = (0, import_react23.useCallback)(() => {
27119
+ const deselect = (0, import_react24.useCallback)(() => {
26781
27120
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26782
27121
  clearSelectedAttr();
26783
27122
  selectedElRef.current = null;
@@ -26813,20 +27152,20 @@ function OhhwellsBridge() {
26813
27152
  setToolbarVariant("none");
26814
27153
  }
26815
27154
  }, [clearSelectedAttr]);
26816
- const markSelected = (0, import_react23.useCallback)((el) => {
27155
+ const markSelected = (0, import_react24.useCallback)((el) => {
26817
27156
  clearSelectedAttr();
26818
27157
  el.removeAttribute("data-ohw-hovered");
26819
27158
  el.setAttribute("data-ohw-selected", "");
26820
27159
  }, [clearSelectedAttr]);
26821
- const isSelectedForHover = (0, import_react23.useCallback)((el) => {
27160
+ const isSelectedForHover = (0, import_react24.useCallback)((el) => {
26822
27161
  if (!el) return false;
26823
27162
  return [selectedElRef.current, activeElRef.current].some(
26824
27163
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26825
27164
  );
26826
27165
  }, []);
26827
- const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
27166
+ const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
26828
27167
  isSelectedForHoverRef.current = isSelectedForHover;
26829
- const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
27168
+ const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
26830
27169
  if (isFooterHrefKey(hrefKey)) {
26831
27170
  return document.querySelector(
26832
27171
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26841,7 +27180,7 @@ function OhhwellsBridge() {
26841
27180
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26842
27181
  );
26843
27182
  }, []);
26844
- const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
27183
+ const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
26845
27184
  const hrefKey = selectedHrefKeyRef.current;
26846
27185
  if (hrefKey) {
26847
27186
  const link = resolveHrefKeyElement(hrefKey);
@@ -26879,7 +27218,7 @@ function OhhwellsBridge() {
26879
27218
  );
26880
27219
  }
26881
27220
  }, [resolveHrefKeyElement]);
26882
- const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
27221
+ const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
26883
27222
  selectedElRef.current = navAnchor;
26884
27223
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26885
27224
  selectedFooterColAttrRef.current = null;
@@ -26910,7 +27249,7 @@ function OhhwellsBridge() {
26910
27249
  setToolbarShowEditLink(false);
26911
27250
  setActiveCommands(/* @__PURE__ */ new Set());
26912
27251
  }, [markSelected]);
26913
- const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
27252
+ const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
26914
27253
  const el = activeElRef.current;
26915
27254
  if (!el) return;
26916
27255
  const key = el.dataset.ohwKey;
@@ -26943,7 +27282,7 @@ function OhhwellsBridge() {
26943
27282
  postToParent2({ type: "ow:exit-edit" });
26944
27283
  reselectNavigationItem(navAnchor);
26945
27284
  }, [postToParent2, reselectNavigationItem]);
26946
- const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
27285
+ const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
26947
27286
  const items = listNavbarRootItems();
26948
27287
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26949
27288
  deselectRef.current();
@@ -26955,7 +27294,7 @@ function OhhwellsBridge() {
26955
27294
  intent: "add-nav"
26956
27295
  });
26957
27296
  }, []);
26958
- const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
27297
+ const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
26959
27298
  (anchor) => {
26960
27299
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26961
27300
  if (!navDropdownsOpenOnClick()) return;
@@ -26968,7 +27307,7 @@ function OhhwellsBridge() {
26968
27307
  },
26969
27308
  [postToParent2]
26970
27309
  );
26971
- const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
27310
+ const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
26972
27311
  const selected = selectedElRef.current;
26973
27312
  if (!selected || !isNavigationItem2(selected)) return;
26974
27313
  if (isNestedNavChild(selected)) return;
@@ -26984,7 +27323,7 @@ function OhhwellsBridge() {
26984
27323
  }
26985
27324
  });
26986
27325
  }, []);
26987
- const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
27326
+ const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
26988
27327
  (visible) => {
26989
27328
  const selected = selectedElRef.current;
26990
27329
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -27037,7 +27376,7 @@ function OhhwellsBridge() {
27037
27376
  },
27038
27377
  [postToParent2]
27039
27378
  );
27040
- const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
27379
+ const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
27041
27380
  const label = anchor.querySelector('[data-ohw-editable="text"]');
27042
27381
  if (!label) {
27043
27382
  selectRef.current(anchor);
@@ -27046,8 +27385,8 @@ function OhhwellsBridge() {
27046
27385
  setNavGroupForceOpen(anchor, true);
27047
27386
  activateRef.current(label);
27048
27387
  }, []);
27049
- const pendingSocialAddRef = (0, import_react23.useRef)(null);
27050
- const handleAddChildItem = (0, import_react23.useCallback)(() => {
27388
+ const pendingSocialAddRef = (0, import_react24.useRef)(null);
27389
+ const handleAddChildItem = (0, import_react24.useCallback)(() => {
27051
27390
  const selected = selectedElRef.current;
27052
27391
  if (!selected) return;
27053
27392
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -27174,7 +27513,7 @@ function OhhwellsBridge() {
27174
27513
  });
27175
27514
  });
27176
27515
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
27177
- const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
27516
+ const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
27178
27517
  if (document.querySelector("[data-ai-footer]")) {
27179
27518
  const state = parseAiFooterState(aiFooterRef.current);
27180
27519
  if (!state?.tree) return;
@@ -27230,7 +27569,7 @@ function OhhwellsBridge() {
27230
27569
  selectRef.current(result.firstLink);
27231
27570
  });
27232
27571
  }, [postToParent2]);
27233
- const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
27572
+ const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
27234
27573
  footerDragRef.current = null;
27235
27574
  setSiblingHintRects([]);
27236
27575
  setFooterDropSlots([]);
@@ -27239,7 +27578,7 @@ function OhhwellsBridge() {
27239
27578
  setIsItemDragging(false);
27240
27579
  unlockFooterDragInteraction();
27241
27580
  }, []);
27242
- const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27581
+ const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
27243
27582
  const dragged = session.draggedEl;
27244
27583
  setDraggedItemRect(dragged.getBoundingClientRect());
27245
27584
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27271,13 +27610,13 @@ function OhhwellsBridge() {
27271
27610
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27272
27611
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27273
27612
  }, []);
27274
- const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27613
+ const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
27275
27614
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27276
- const commitFooterDragRef = (0, import_react23.useRef)(() => {
27615
+ const commitFooterDragRef = (0, import_react24.useRef)(() => {
27277
27616
  });
27278
- const beginFooterDragRef = (0, import_react23.useRef)(() => {
27617
+ const beginFooterDragRef = (0, import_react24.useRef)(() => {
27279
27618
  });
27280
- const beginFooterDrag = (0, import_react23.useCallback)(
27619
+ const beginFooterDrag = (0, import_react24.useCallback)(
27281
27620
  (session) => {
27282
27621
  const rect = session.draggedEl.getBoundingClientRect();
27283
27622
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27297,7 +27636,7 @@ function OhhwellsBridge() {
27297
27636
  [refreshFooterDragVisuals]
27298
27637
  );
27299
27638
  beginFooterDragRef.current = beginFooterDrag;
27300
- const commitFooterDrag = (0, import_react23.useCallback)(
27639
+ const commitFooterDrag = (0, import_react24.useCallback)(
27301
27640
  (clientX, clientY) => {
27302
27641
  const session = footerDragRef.current;
27303
27642
  if (!session) {
@@ -27469,7 +27808,7 @@ function OhhwellsBridge() {
27469
27808
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27470
27809
  );
27471
27810
  commitFooterDragRef.current = commitFooterDrag;
27472
- const startFooterLinkDrag = (0, import_react23.useCallback)(
27811
+ const startFooterLinkDrag = (0, import_react24.useCallback)(
27473
27812
  (anchor, clientX, clientY, wasSelected) => {
27474
27813
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27475
27814
  if (!hrefKey) return false;
@@ -27505,7 +27844,7 @@ function OhhwellsBridge() {
27505
27844
  },
27506
27845
  [beginFooterDrag]
27507
27846
  );
27508
- const startFooterColumnDrag = (0, import_react23.useCallback)(
27847
+ const startFooterColumnDrag = (0, import_react24.useCallback)(
27509
27848
  (columnEl, clientX, clientY, wasSelected) => {
27510
27849
  const columns = listFooterColumns(columnEl);
27511
27850
  const idx = columns.indexOf(columnEl);
@@ -27525,7 +27864,7 @@ function OhhwellsBridge() {
27525
27864
  },
27526
27865
  [beginFooterDrag]
27527
27866
  );
27528
- const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27867
+ const persistButtonCollectionDrag = (0, import_react24.useCallback)(
27529
27868
  (button, clientX) => {
27530
27869
  const insertIndex = buttonDropInsertIndexRef.current;
27531
27870
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27549,7 +27888,7 @@ function OhhwellsBridge() {
27549
27888
  },
27550
27889
  [postToParent2]
27551
27890
  );
27552
- const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27891
+ const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
27553
27892
  const collection = buttonCollectionOf(button);
27554
27893
  if (!collection) {
27555
27894
  setButtonDropSlots([]);
@@ -27566,7 +27905,7 @@ function OhhwellsBridge() {
27566
27905
  setDraggedItemRect(button.getBoundingClientRect());
27567
27906
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27568
27907
  }, []);
27569
- const handleItemDragStart = (0, import_react23.useCallback)(
27908
+ const handleItemDragStart = (0, import_react24.useCallback)(
27570
27909
  (e) => {
27571
27910
  const selected = selectedElRef.current;
27572
27911
  if (!selected) {
@@ -27597,7 +27936,7 @@ function OhhwellsBridge() {
27597
27936
  },
27598
27937
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27599
27938
  );
27600
- const handleItemDragEnd = (0, import_react23.useCallback)(
27939
+ const handleItemDragEnd = (0, import_react24.useCallback)(
27601
27940
  (e) => {
27602
27941
  const collectionButton = buttonCollectionDragRef.current;
27603
27942
  if (collectionButton) {
@@ -27628,7 +27967,7 @@ function OhhwellsBridge() {
27628
27967
  },
27629
27968
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27630
27969
  );
27631
- const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27970
+ const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
27632
27971
  if (e.button !== 0) return;
27633
27972
  const selected = selectedElRef.current;
27634
27973
  if (!selected) return;
@@ -27669,7 +28008,7 @@ function OhhwellsBridge() {
27669
28008
  }
27670
28009
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27671
28010
  }, [armNavPressFromChrome]);
27672
- const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
28011
+ const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
27673
28012
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27674
28013
  suppressNextClickRef.current = false;
27675
28014
  return;
@@ -27682,7 +28021,7 @@ function OhhwellsBridge() {
27682
28021
  }, []);
27683
28022
  reselectNavigationItemRef.current = reselectNavigationItem;
27684
28023
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27685
- const select = (0, import_react23.useCallback)((anchor) => {
28024
+ const select = (0, import_react24.useCallback)((anchor) => {
27686
28025
  if (!isNavigationItem2(anchor)) return;
27687
28026
  if (activeElRef.current) deactivate();
27688
28027
  clearSocialSelectionRef.current();
@@ -27759,7 +28098,7 @@ function OhhwellsBridge() {
27759
28098
  setLogoSizeDraft(null);
27760
28099
  }
27761
28100
  }, [deactivate, markSelected]);
27762
- const selectFrame = (0, import_react23.useCallback)((el) => {
28101
+ const selectFrame = (0, import_react24.useCallback)((el) => {
27763
28102
  if (!isNavigationContainer(el)) return;
27764
28103
  if (activeElRef.current) deactivate();
27765
28104
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27800,7 +28139,7 @@ function OhhwellsBridge() {
27800
28139
  setFloatingPanelPos(null);
27801
28140
  setLogoSizeDraft(null);
27802
28141
  }, [deactivate, markSelected, postToParent2]);
27803
- const selectLogo = (0, import_react23.useCallback)(
28142
+ const selectLogo = (0, import_react24.useCallback)(
27804
28143
  (logoEl) => {
27805
28144
  if (activeElRef.current) deactivate();
27806
28145
  selectedElRef.current = logoEl;
@@ -27829,7 +28168,7 @@ function OhhwellsBridge() {
27829
28168
  },
27830
28169
  [deactivate, markSelected]
27831
28170
  );
27832
- const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
28171
+ const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
27833
28172
  const placement = getLogoPlacement(logoEl);
27834
28173
  const draft = readLogoSizeState(editContentRef.current, placement);
27835
28174
  setLogoSizeDraft(draft);
@@ -27842,7 +28181,7 @@ function OhhwellsBridge() {
27842
28181
  placement
27843
28182
  });
27844
28183
  }, []);
27845
- const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
28184
+ const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
27846
28185
  setFloatingPanelPos(null);
27847
28186
  setParentScrollSnap(parentScrollRef.current);
27848
28187
  setFloatingPanel({
@@ -27853,7 +28192,7 @@ function OhhwellsBridge() {
27853
28192
  row
27854
28193
  });
27855
28194
  }, []);
27856
- const rememberButtonTokens = (0, import_react23.useCallback)(
28195
+ const rememberButtonTokens = (0, import_react24.useCallback)(
27857
28196
  (content, tokens, nodes) => {
27858
28197
  if (nodes.length === 0) return content;
27859
28198
  const next = { ...content };
@@ -27864,7 +28203,7 @@ function OhhwellsBridge() {
27864
28203
  },
27865
28204
  [postToParent2]
27866
28205
  );
27867
- const tokensForButton = (0, import_react23.useCallback)(
28206
+ const tokensForButton = (0, import_react24.useCallback)(
27868
28207
  (el, persistFallback = false) => {
27869
28208
  const stored = readStoredStyleTokens(editContentRef.current);
27870
28209
  if (stored) return stored;
@@ -27879,7 +28218,7 @@ function OhhwellsBridge() {
27879
28218
  },
27880
28219
  [rememberButtonTokens]
27881
28220
  );
27882
- const openButtonStylePanel = (0, import_react23.useCallback)(
28221
+ const openButtonStylePanel = (0, import_react24.useCallback)(
27883
28222
  (anchor) => {
27884
28223
  const id = buttonId(anchor);
27885
28224
  if (!id) return;
@@ -27897,7 +28236,7 @@ function OhhwellsBridge() {
27897
28236
  },
27898
28237
  [tokensForButton]
27899
28238
  );
27900
- const applySelectedButtonStyle = (0, import_react23.useCallback)(
28239
+ const applySelectedButtonStyle = (0, import_react24.useCallback)(
27901
28240
  (patch) => {
27902
28241
  const panel = floatingPanelRef.current;
27903
28242
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27915,7 +28254,7 @@ function OhhwellsBridge() {
27915
28254
  },
27916
28255
  [postToParent2]
27917
28256
  );
27918
- (0, import_react23.useEffect)(() => {
28257
+ (0, import_react24.useEffect)(() => {
27919
28258
  const onDragOver = (e) => {
27920
28259
  const dragged = buttonCollectionDragRef.current;
27921
28260
  if (!dragged) return;
@@ -27934,11 +28273,11 @@ function OhhwellsBridge() {
27934
28273
  document.removeEventListener("drop", onDrop);
27935
28274
  };
27936
28275
  }, [refreshButtonDragVisuals]);
27937
- const isEditModeRef = (0, import_react23.useRef)(false);
27938
- const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
28276
+ const isEditModeRef = (0, import_react24.useRef)(false);
28277
+ const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
27939
28278
  });
27940
- const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
27941
- const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
28279
+ const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
28280
+ const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
27942
28281
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27943
28282
  const missing = socialsMissingIcons(row);
27944
28283
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27950,7 +28289,7 @@ function OhhwellsBridge() {
27950
28289
  }, []);
27951
28290
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27952
28291
  isEditModeRef.current = isEditMode;
27953
- const changeSocialsDisplay = (0, import_react23.useCallback)(
28292
+ const changeSocialsDisplay = (0, import_react24.useCallback)(
27954
28293
  (row, next) => {
27955
28294
  if (next.icon) {
27956
28295
  const missing = socialsMissingIcons(row);
@@ -27974,19 +28313,19 @@ function OhhwellsBridge() {
27974
28313
  },
27975
28314
  []
27976
28315
  );
27977
- const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
28316
+ const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
27978
28317
  setFloatingPanel(null);
27979
28318
  setFloatingPanelPos(null);
27980
28319
  setLogoSizeDraft(null);
27981
28320
  }, []);
27982
28321
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27983
- const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
28322
+ const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
27984
28323
  setFloatingPanel(null);
27985
28324
  setFloatingPanelPos(null);
27986
28325
  setLogoSizeDraft(null);
27987
28326
  deselectRef.current();
27988
28327
  }, []);
27989
- (0, import_react23.useEffect)(() => {
28328
+ (0, import_react24.useEffect)(() => {
27990
28329
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27991
28330
  if (!session || !logoSizeDraft) {
27992
28331
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -28005,7 +28344,7 @@ function OhhwellsBridge() {
28005
28344
  max: LOGO_SIZE_MAX
28006
28345
  });
28007
28346
  }, [floatingPanel, logoSizeDraft, editorViewport]);
28008
- const persistLogoSizeDraft = (0, import_react23.useCallback)(
28347
+ const persistLogoSizeDraft = (0, import_react24.useCallback)(
28009
28348
  (placement, draft) => {
28010
28349
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
28011
28350
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -28045,7 +28384,7 @@ function OhhwellsBridge() {
28045
28384
  },
28046
28385
  [postToParent2]
28047
28386
  );
28048
- const activate = (0, import_react23.useCallback)((el, options) => {
28387
+ const activate = (0, import_react24.useCallback)((el, options) => {
28049
28388
  if (activeElRef.current === el) return;
28050
28389
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
28051
28390
  hovered.removeAttribute("data-ohw-hovered");
@@ -28143,8 +28482,8 @@ function OhhwellsBridge() {
28143
28482
  openLogoSizePanelRef.current = openLogoSizePanel;
28144
28483
  deselectRef.current = deselect;
28145
28484
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28146
- const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28147
- (0, import_react23.useEffect)(() => {
28485
+ const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
28486
+ (0, import_react24.useEffect)(() => {
28148
28487
  if (!isEditMode) {
28149
28488
  if (lastSiteWideScopeRef.current !== false) {
28150
28489
  lastSiteWideScopeRef.current = false;
@@ -28170,7 +28509,7 @@ function OhhwellsBridge() {
28170
28509
  isFooterFrameSelection,
28171
28510
  postToParent2
28172
28511
  ]);
28173
- (0, import_react23.useLayoutEffect)(() => {
28512
+ (0, import_react24.useLayoutEffect)(() => {
28174
28513
  if (!subdomain || isEditMode) {
28175
28514
  setFetchState("done");
28176
28515
  return;
@@ -28197,6 +28536,7 @@ function OhhwellsBridge() {
28197
28536
  applyAiFooterFromContent(content);
28198
28537
  if (typeof content[STYLE_STORE_KEY] === "string") {
28199
28538
  stylesRef.current = content[STYLE_STORE_KEY];
28539
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28200
28540
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28201
28541
  }
28202
28542
  applyBrandChrome(content);
@@ -28207,15 +28547,16 @@ function OhhwellsBridge() {
28207
28547
  if (key === "__ohw_sections") continue;
28208
28548
  if (key === AI_SECTIONS_KEY) continue;
28209
28549
  if (key === AI_FOOTER_KEY) continue;
28550
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28551
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28210
28552
  if (key === BRAND_KIT_KEY) continue;
28211
28553
  if (key === STYLE_STORE_KEY) continue;
28212
28554
  if (BRAND_CHROME_KEYS.has(key)) continue;
28213
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28214
28555
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28215
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28216
28556
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28217
28557
  continue;
28218
28558
  }
28559
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28219
28560
  if (applyVideoSettingNode(key, val)) continue;
28220
28561
  if (applyCarouselNode(key, val)) continue;
28221
28562
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28255,6 +28596,7 @@ function OhhwellsBridge() {
28255
28596
  });
28256
28597
  applyLinkByKey(key, val);
28257
28598
  }
28599
+ applySectionEmbeds(content);
28258
28600
  applyLogoFromContent(content);
28259
28601
  applyLogoSizes(content);
28260
28602
  reconcileNavbarItemsFromContent(content);
@@ -28321,7 +28663,7 @@ function OhhwellsBridge() {
28321
28663
  cancelled = true;
28322
28664
  };
28323
28665
  }, [subdomain, isEditMode]);
28324
- (0, import_react23.useEffect)(() => {
28666
+ (0, import_react24.useEffect)(() => {
28325
28667
  if (!isEditMode) return;
28326
28668
  const resolveIndex = (form, clientY) => {
28327
28669
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28362,7 +28704,7 @@ function OhhwellsBridge() {
28362
28704
  window.removeEventListener("drop", onDrop, true);
28363
28705
  };
28364
28706
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28365
- (0, import_react23.useEffect)(() => {
28707
+ (0, import_react24.useEffect)(() => {
28366
28708
  if (!isEditMode) return;
28367
28709
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28368
28710
  markFormFields(form);
@@ -28374,7 +28716,7 @@ function OhhwellsBridge() {
28374
28716
  });
28375
28717
  return () => observer.disconnect();
28376
28718
  }, [isEditMode, fetchState, pathname]);
28377
- (0, import_react23.useEffect)(() => {
28719
+ (0, import_react24.useEffect)(() => {
28378
28720
  if (!isEditMode) return;
28379
28721
  let saveTimer = null;
28380
28722
  const onInput = (e) => {
@@ -28396,14 +28738,14 @@ function OhhwellsBridge() {
28396
28738
  document.addEventListener("input", onInput, true);
28397
28739
  return () => document.removeEventListener("input", onInput, true);
28398
28740
  }, [isEditMode, persistFields]);
28399
- (0, import_react23.useEffect)(() => {
28741
+ (0, import_react24.useEffect)(() => {
28400
28742
  if (isEditMode || fetchState !== "done") return;
28401
28743
  const content = contentCache.get(subdomain) ?? {};
28402
28744
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28403
28745
  reconcileFieldsFromContent(form, content);
28404
28746
  });
28405
28747
  }, [isEditMode, fetchState, subdomain]);
28406
- (0, import_react23.useEffect)(() => {
28748
+ (0, import_react24.useEffect)(() => {
28407
28749
  if (!isEditMode) return;
28408
28750
  const swallow = (e) => {
28409
28751
  const target = e.target;
@@ -28412,14 +28754,14 @@ function OhhwellsBridge() {
28412
28754
  document.addEventListener("submit", swallow, true);
28413
28755
  return () => document.removeEventListener("submit", swallow, true);
28414
28756
  }, [isEditMode]);
28415
- (0, import_react23.useEffect)(() => {
28757
+ (0, import_react24.useEffect)(() => {
28416
28758
  if (isEditMode || fetchState !== "done") return;
28417
28759
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28418
28760
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28419
28761
  console.log({ apiUrl, subdomain });
28420
28762
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28421
28763
  }, [isEditMode, fetchState, subdomain]);
28422
- (0, import_react23.useEffect)(() => {
28764
+ (0, import_react24.useEffect)(() => {
28423
28765
  if (!subdomain || isEditMode) return;
28424
28766
  let debounceTimer = null;
28425
28767
  let observer = null;
@@ -28443,20 +28785,22 @@ function OhhwellsBridge() {
28443
28785
  }
28444
28786
  applyAiFooterFromContent(content);
28445
28787
  if (typeof content[STYLE_STORE_KEY] === "string") {
28788
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28446
28789
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28447
28790
  }
28448
28791
  for (const [key, val] of Object.entries(content)) {
28449
28792
  if (key === "__ohw_sections") continue;
28450
28793
  if (key === AI_SECTIONS_KEY) continue;
28451
28794
  if (key === AI_FOOTER_KEY) continue;
28795
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28796
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28452
28797
  if (key === BRAND_KIT_KEY) continue;
28453
28798
  if (key === STYLE_STORE_KEY) continue;
28454
28799
  if (BRAND_CHROME_KEYS.has(key)) continue;
28455
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28456
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28457
28800
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28458
28801
  continue;
28459
28802
  }
28803
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28460
28804
  if (applyVideoSettingNode(key, val)) continue;
28461
28805
  if (applyCarouselNode(key, val)) continue;
28462
28806
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28481,6 +28825,7 @@ function OhhwellsBridge() {
28481
28825
  });
28482
28826
  applyLinkByKey(key, val);
28483
28827
  }
28828
+ applySectionEmbeds(content);
28484
28829
  applyLogoFromContent(content);
28485
28830
  reconcileNavbarItemsFromContent(content);
28486
28831
  reconcileFooterOrderFromContent(content);
@@ -28536,16 +28881,16 @@ function OhhwellsBridge() {
28536
28881
  if (debounceTimer) clearTimeout(debounceTimer);
28537
28882
  };
28538
28883
  }, [subdomain, isEditMode, pathname]);
28539
- (0, import_react23.useLayoutEffect)(() => {
28884
+ (0, import_react24.useLayoutEffect)(() => {
28540
28885
  const el = document.getElementById("ohw-loader");
28541
28886
  if (!el) return;
28542
28887
  const visible = Boolean(subdomain) && fetchState !== "done";
28543
28888
  el.style.display = visible ? "flex" : "none";
28544
28889
  }, [subdomain, fetchState]);
28545
- (0, import_react23.useEffect)(() => {
28890
+ (0, import_react24.useEffect)(() => {
28546
28891
  postToParent2({ type: "ow:navigation", path: pathname });
28547
28892
  }, [pathname, postToParent2]);
28548
- (0, import_react23.useEffect)(() => {
28893
+ (0, import_react24.useEffect)(() => {
28549
28894
  if (!subdomain || isEditMode) return;
28550
28895
  const content = contentCache.get(subdomain);
28551
28896
  if (!content) return;
@@ -28563,7 +28908,7 @@ function OhhwellsBridge() {
28563
28908
  }
28564
28909
  applyAiFooterFromContent(content);
28565
28910
  }, [pathname, subdomain, isEditMode]);
28566
- (0, import_react23.useEffect)(() => {
28911
+ (0, import_react24.useEffect)(() => {
28567
28912
  if (!isEditMode) return;
28568
28913
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28569
28914
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28571,12 +28916,12 @@ function OhhwellsBridge() {
28571
28916
  deselectRef.current();
28572
28917
  deactivateRef.current();
28573
28918
  }, [pathname, isEditMode]);
28574
- (0, import_react23.useEffect)(() => {
28919
+ (0, import_react24.useEffect)(() => {
28575
28920
  if (!isEditMode) return;
28576
28921
  initSectionInstancesFromContent(editContentRef.current, pathname);
28577
28922
  initItemInstancesFromContent(editContentRef.current);
28578
28923
  }, [pathname, isEditMode]);
28579
- (0, import_react23.useEffect)(() => {
28924
+ (0, import_react24.useEffect)(() => {
28580
28925
  if (!isEditMode) return;
28581
28926
  const observer = new MutationObserver(() => {
28582
28927
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28587,7 +28932,7 @@ function OhhwellsBridge() {
28587
28932
  observer.observe(document.body, { childList: true, subtree: true });
28588
28933
  return () => observer.disconnect();
28589
28934
  }, [isEditMode, pathname]);
28590
- (0, import_react23.useEffect)(() => {
28935
+ (0, import_react24.useEffect)(() => {
28591
28936
  const contentForNav = () => {
28592
28937
  if (isEditMode) return editContentRef.current;
28593
28938
  if (!subdomain) return {};
@@ -28660,7 +29005,7 @@ function OhhwellsBridge() {
28660
29005
  observer?.disconnect();
28661
29006
  };
28662
29007
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28663
- (0, import_react23.useEffect)(() => {
29008
+ (0, import_react24.useEffect)(() => {
28664
29009
  if (!isEditMode) return;
28665
29010
  let applying = false;
28666
29011
  let rafId = null;
@@ -28698,7 +29043,7 @@ function OhhwellsBridge() {
28698
29043
  observer.disconnect();
28699
29044
  };
28700
29045
  }, [isEditMode, pathname]);
28701
- (0, import_react23.useEffect)(() => {
29046
+ (0, import_react24.useEffect)(() => {
28702
29047
  if (!isEditMode) return;
28703
29048
  let lastPosted = 0;
28704
29049
  const measure = () => {
@@ -28720,29 +29065,14 @@ function OhhwellsBridge() {
28720
29065
  const t2 = setTimeout(measure, 500);
28721
29066
  const ro = new ResizeObserver(schedule);
28722
29067
  ro.observe(document.body);
28723
- let lastWidth = window.innerWidth;
28724
- let resizeTimers = [];
28725
- const clearResizeTimers = () => {
28726
- resizeTimers.forEach(clearTimeout);
28727
- resizeTimers = [];
28728
- };
28729
- const handleResize = () => {
28730
- if (window.innerWidth === lastWidth) return;
28731
- lastWidth = window.innerWidth;
28732
- clearResizeTimers();
28733
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28734
- };
28735
- window.addEventListener("resize", handleResize);
28736
29068
  return () => {
28737
29069
  clearTimeout(t1);
28738
29070
  clearTimeout(t2);
28739
29071
  if (raf != null) cancelAnimationFrame(raf);
28740
29072
  ro.disconnect();
28741
- clearResizeTimers();
28742
- window.removeEventListener("resize", handleResize);
28743
29073
  };
28744
29074
  }, [pathname, isEditMode, postToParent2]);
28745
- (0, import_react23.useEffect)(() => {
29075
+ (0, import_react24.useEffect)(() => {
28746
29076
  if (isEditMode) return;
28747
29077
  const handleClick = (e) => {
28748
29078
  if (!isPlainLeftClick(e)) return;
@@ -28756,7 +29086,7 @@ function OhhwellsBridge() {
28756
29086
  document.addEventListener("click", handleClick, true);
28757
29087
  return () => document.removeEventListener("click", handleClick, true);
28758
29088
  }, [isEditMode, router, pathname]);
28759
- (0, import_react23.useEffect)(() => {
29089
+ (0, import_react24.useEffect)(() => {
28760
29090
  if (!isEditMode) {
28761
29091
  editStylesRef.current?.base.remove();
28762
29092
  editStylesRef.current?.forceHover.remove();
@@ -29036,6 +29366,13 @@ function OhhwellsBridge() {
29036
29366
  if (target.closest("[data-ohw-state-toggle]")) return;
29037
29367
  if (target.closest("[data-ohw-max-badge]")) return;
29038
29368
  if (isInsideLinkEditor(target)) return;
29369
+ if (isInsideFloatingPanel(target)) return;
29370
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29371
+ if (target.closest(
29372
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29373
+ )) {
29374
+ return;
29375
+ }
29039
29376
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29040
29377
  clearMediaSelectionRef.current();
29041
29378
  }
@@ -29059,8 +29396,6 @@ function OhhwellsBridge() {
29059
29396
  return;
29060
29397
  }
29061
29398
  }
29062
- if (isInsideFloatingPanel(target)) return;
29063
- if (target.closest("[data-ohw-form-toolbar]")) return;
29064
29399
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29065
29400
  if (collectionItem) {
29066
29401
  e.preventDefault();
@@ -29072,11 +29407,6 @@ function OhhwellsBridge() {
29072
29407
  });
29073
29408
  return;
29074
29409
  }
29075
- if (target.closest(
29076
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29077
- )) {
29078
- return;
29079
- }
29080
29410
  {
29081
29411
  const formEl = getFormElement(target);
29082
29412
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29230,9 +29560,13 @@ function OhhwellsBridge() {
29230
29560
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29231
29561
  e.preventDefault();
29232
29562
  e.stopPropagation();
29233
- selectIconElementRef.current(editable);
29234
29563
  const aiIcon = editable.hasAttribute("data-ai-icon");
29235
29564
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29565
+ if (aiIcon) {
29566
+ aiSectionApiRef.current?.selectFromElement(editable);
29567
+ } else {
29568
+ selectIconElementRef.current(editable);
29569
+ }
29236
29570
  postToParentRef.current({
29237
29571
  type: "ow:icon-pick",
29238
29572
  key: editable.dataset.ohwKey ?? "",
@@ -29460,6 +29794,9 @@ function OhhwellsBridge() {
29460
29794
  setHoveredItemRect(null);
29461
29795
  hoveredNavContainerRef.current = null;
29462
29796
  setHoveredNavContainerRect(null);
29797
+ siblingHintElRef.current = null;
29798
+ setSiblingHintRect(null);
29799
+ setSiblingHintRects([]);
29463
29800
  return;
29464
29801
  }
29465
29802
  {
@@ -29580,7 +29917,6 @@ function OhhwellsBridge() {
29580
29917
  hoveredNavContainerRef.current = null;
29581
29918
  setHoveredNavContainerRect(null);
29582
29919
  hoveredItemElRef.current = editable;
29583
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29584
29920
  }
29585
29921
  }
29586
29922
  }
@@ -30290,7 +30626,11 @@ function OhhwellsBridge() {
30290
30626
  };
30291
30627
  const handleMouseMove = (e) => {
30292
30628
  const { clientX, clientY } = e;
30293
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30629
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30630
+ dismissImageHover();
30631
+ clearImageHover();
30632
+ return;
30633
+ }
30294
30634
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30295
30635
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30296
30636
  formHoverElRef.current = null;
@@ -30319,7 +30659,12 @@ function OhhwellsBridge() {
30319
30659
  setHoveredItemRect(null);
30320
30660
  hoveredNavContainerRef.current = null;
30321
30661
  setHoveredNavContainerRect(null);
30662
+ siblingHintElRef.current = null;
30663
+ setSiblingHintRect(null);
30664
+ setSiblingHintRects([]);
30322
30665
  dismissImageHover();
30666
+ clearImageHover();
30667
+ setSectionGap(null);
30323
30668
  return;
30324
30669
  }
30325
30670
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30331,7 +30676,11 @@ function OhhwellsBridge() {
30331
30676
  if (e.data?.type !== "ow:pointer-sync") return;
30332
30677
  const { clientX, clientY } = e.data;
30333
30678
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30334
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30679
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30680
+ dismissImageHover();
30681
+ clearImageHover();
30682
+ return;
30683
+ }
30335
30684
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30336
30685
  if (probeSocialsRowAt(clientX, clientY)) return;
30337
30686
  probeSectionGapAt(clientX, clientY);
@@ -30711,6 +31060,7 @@ function OhhwellsBridge() {
30711
31060
  applyAiFooterFromContent(content);
30712
31061
  if (typeof content[STYLE_STORE_KEY] === "string") {
30713
31062
  stylesRef.current = content[STYLE_STORE_KEY];
31063
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30714
31064
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30715
31065
  }
30716
31066
  applyBrandChrome(content);
@@ -30725,15 +31075,16 @@ function OhhwellsBridge() {
30725
31075
  }
30726
31076
  if (key === AI_SECTIONS_KEY) continue;
30727
31077
  if (key === AI_FOOTER_KEY) continue;
31078
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31079
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30728
31080
  if (key === BRAND_KIT_KEY) continue;
30729
31081
  if (key === STYLE_STORE_KEY) continue;
30730
31082
  if (BRAND_CHROME_KEYS.has(key)) continue;
30731
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30732
31083
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30733
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30734
31084
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30735
31085
  continue;
30736
31086
  }
31087
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
30737
31088
  if (applyVideoSettingNode(key, val)) continue;
30738
31089
  if (applyCarouselNode(key, val)) continue;
30739
31090
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -30759,6 +31110,7 @@ function OhhwellsBridge() {
30759
31110
  });
30760
31111
  applyLinkByKey(key, val);
30761
31112
  }
31113
+ applySectionEmbeds(content);
30762
31114
  applyLogoFromContent(content);
30763
31115
  applyLogoSizes(content);
30764
31116
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31366,6 +31718,12 @@ function OhhwellsBridge() {
31366
31718
  closeLinkPopoverRef.current();
31367
31719
  return;
31368
31720
  }
31721
+ if (floatingPanelOpenRef.current) {
31722
+ setFloatingPanelRef.current(null);
31723
+ deselectRef.current();
31724
+ deactivateRef.current();
31725
+ return;
31726
+ }
31369
31727
  deselectRef.current();
31370
31728
  deactivateRef.current();
31371
31729
  clearMediaSelectionRef.current();
@@ -32201,17 +32559,17 @@ function OhhwellsBridge() {
32201
32559
  window.removeEventListener("message", handleDuplicateSection);
32202
32560
  window.removeEventListener("message", handleDeactivate);
32203
32561
  window.removeEventListener("message", handleSelectNav);
32204
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32205
32562
  window.removeEventListener("message", handleToastAction);
32206
32563
  window.removeEventListener("message", handleFormCount);
32207
32564
  window.removeEventListener("message", handleUiEscape);
32565
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32208
32566
  autoSaveTimers.current.forEach(clearTimeout);
32209
32567
  autoSaveTimers.current.clear();
32210
32568
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
32211
32569
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
32212
32570
  };
32213
32571
  }, [isEditMode, refreshStateRules]);
32214
- (0, import_react23.useEffect)(() => {
32572
+ (0, import_react24.useEffect)(() => {
32215
32573
  if (!isEditMode) return;
32216
32574
  const THRESHOLD = 10;
32217
32575
  const resolveWasSelected = (el) => {
@@ -32367,7 +32725,7 @@ function OhhwellsBridge() {
32367
32725
  unlockFooterDragInteraction();
32368
32726
  };
32369
32727
  }, [isEditMode]);
32370
- (0, import_react23.useEffect)(() => {
32728
+ (0, import_react24.useEffect)(() => {
32371
32729
  if (!isEditMode) return;
32372
32730
  const THRESHOLD = 10;
32373
32731
  const onPointerDown = (e) => {
@@ -32458,7 +32816,7 @@ function OhhwellsBridge() {
32458
32816
  document.removeEventListener("selectstart", blockSelectStart, true);
32459
32817
  };
32460
32818
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32461
- (0, import_react23.useEffect)(() => {
32819
+ (0, import_react24.useEffect)(() => {
32462
32820
  const handler = (e) => {
32463
32821
  if (e.data?.type !== "ow:request-schedule-config") return;
32464
32822
  const insertAfterVal = e.data.insertAfter;
@@ -32474,7 +32832,7 @@ function OhhwellsBridge() {
32474
32832
  window.addEventListener("message", handler);
32475
32833
  return () => window.removeEventListener("message", handler);
32476
32834
  }, [processConfigRequest]);
32477
- (0, import_react23.useEffect)(() => {
32835
+ (0, import_react24.useEffect)(() => {
32478
32836
  if (!isEditMode) return;
32479
32837
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32480
32838
  el.removeAttribute("data-ohw-active-state");
@@ -32498,7 +32856,7 @@ function OhhwellsBridge() {
32498
32856
  postToParent2({
32499
32857
  type: "ow:ready",
32500
32858
  version: "1",
32501
- bridgeVersion: "0.1.163",
32859
+ bridgeVersion: "0.1.164-next.438",
32502
32860
  path: pathname,
32503
32861
  nodes: collectEditableNodes(editContentRef.current),
32504
32862
  sections
@@ -32510,13 +32868,13 @@ function OhhwellsBridge() {
32510
32868
  clearTimeout(timer);
32511
32869
  };
32512
32870
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32513
- (0, import_react23.useEffect)(() => {
32871
+ (0, import_react24.useEffect)(() => {
32514
32872
  scrollToHashSectionWhenReady();
32515
32873
  const onHashChange = () => scrollToHashSectionWhenReady();
32516
32874
  window.addEventListener("hashchange", onHashChange);
32517
32875
  return () => window.removeEventListener("hashchange", onHashChange);
32518
32876
  }, [pathname]);
32519
- const handleCommand = (0, import_react23.useCallback)((cmd) => {
32877
+ const handleCommand = (0, import_react24.useCallback)((cmd) => {
32520
32878
  const el = activeElRef.current;
32521
32879
  const selBefore = window.getSelection();
32522
32880
  let savedOffsets = null;
@@ -32552,7 +32910,7 @@ function OhhwellsBridge() {
32552
32910
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32553
32911
  refreshActiveCommandsRef.current();
32554
32912
  }, []);
32555
- (0, import_react23.useEffect)(() => {
32913
+ (0, import_react24.useEffect)(() => {
32556
32914
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32557
32915
  if (!session || !logoSizeDraft) return;
32558
32916
  const onPanelAction = (e) => {
@@ -32590,7 +32948,7 @@ function OhhwellsBridge() {
32590
32948
  window.addEventListener("message", onPanelAction);
32591
32949
  return () => window.removeEventListener("message", onPanelAction);
32592
32950
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32593
- const handleStateChange = (0, import_react23.useCallback)((state) => {
32951
+ const handleStateChange = (0, import_react24.useCallback)((state) => {
32594
32952
  if (!activeStateElRef.current) return;
32595
32953
  const el = activeStateElRef.current;
32596
32954
  if (state === "Default") {
@@ -32603,7 +32961,7 @@ function OhhwellsBridge() {
32603
32961
  }
32604
32962
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32605
32963
  }, [deactivate]);
32606
- const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32964
+ const reselectAfterLinkPopover = (0, import_react24.useCallback)(
32607
32965
  (hrefKey) => {
32608
32966
  requestAnimationFrame(() => {
32609
32967
  const el = resolveHrefKeyElement(hrefKey);
@@ -32612,7 +32970,7 @@ function OhhwellsBridge() {
32612
32970
  },
32613
32971
  [resolveHrefKeyElement]
32614
32972
  );
32615
- const closeLinkPopover = (0, import_react23.useCallback)(() => {
32973
+ const closeLinkPopover = (0, import_react24.useCallback)(() => {
32616
32974
  const session = linkPopoverSessionRef.current;
32617
32975
  addNavAfterAnchorRef.current = null;
32618
32976
  setLinkPopover(null);
@@ -32620,9 +32978,9 @@ function OhhwellsBridge() {
32620
32978
  reselectAfterLinkPopover(session.key);
32621
32979
  }
32622
32980
  }, [reselectAfterLinkPopover]);
32623
- const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32981
+ const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
32624
32982
  closeLinkPopoverRef.current = closeLinkPopover;
32625
- const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32983
+ const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
32626
32984
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32627
32985
  if (!hrefCtx) return;
32628
32986
  bumpLinkPopoverGrace();
@@ -32633,7 +32991,7 @@ function OhhwellsBridge() {
32633
32991
  });
32634
32992
  deactivate();
32635
32993
  }, [deactivate]);
32636
- const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32994
+ const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
32637
32995
  const anchor = selectedElRef.current;
32638
32996
  if (!anchor) return;
32639
32997
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32650,7 +33008,7 @@ function OhhwellsBridge() {
32650
33008
  });
32651
33009
  deselect();
32652
33010
  }, [deselect]);
32653
- const handleSelectParent = (0, import_react23.useCallback)(() => {
33011
+ const handleSelectParent = (0, import_react24.useCallback)(() => {
32654
33012
  const selected = selectedElRef.current;
32655
33013
  if (!selected) return;
32656
33014
  if (toolbarVariantRef.current === "select-frame") {
@@ -32677,7 +33035,7 @@ function OhhwellsBridge() {
32677
33035
  }
32678
33036
  deselectRef.current();
32679
33037
  }, []);
32680
- const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
33038
+ const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
32681
33039
  const selected = selectedElRef.current;
32682
33040
  if (!selected || !isNavigationItem2(selected)) return;
32683
33041
  if (isCtaButton(selected)) {
@@ -32846,7 +33204,7 @@ function OhhwellsBridge() {
32846
33204
  });
32847
33205
  }
32848
33206
  }, [postToParent2, tokensForButton]);
32849
- const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
33207
+ const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
32850
33208
  const pending = pendingDeleteUndoRef.current;
32851
33209
  if (!pending) return false;
32852
33210
  pendingDeleteUndoRef.current = null;
@@ -32854,7 +33212,7 @@ function OhhwellsBridge() {
32854
33212
  enforceLinkHrefs();
32855
33213
  return true;
32856
33214
  }, []);
32857
- const handleDeleteSelected = (0, import_react23.useCallback)(() => {
33215
+ const handleDeleteSelected = (0, import_react24.useCallback)(() => {
32858
33216
  const selected = selectedElRef.current;
32859
33217
  if (!selected) return false;
32860
33218
  if (isCtaButton(selected)) {
@@ -32916,7 +33274,7 @@ function OhhwellsBridge() {
32916
33274
  }, [postToParent2]);
32917
33275
  handleDeleteSelectedRef.current = handleDeleteSelected;
32918
33276
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32919
- const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
33277
+ const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
32920
33278
  (target) => {
32921
33279
  const session = linkPopoverSessionRef.current;
32922
33280
  if (!session) return;
@@ -32982,14 +33340,14 @@ function OhhwellsBridge() {
32982
33340
  const showEditLink = toolbarShowEditLink;
32983
33341
  const currentSections = sectionsByPath[pathname] ?? [];
32984
33342
  linkPopoverOpenRef.current = linkPopover !== null;
32985
- const handleMediaSelect = (0, import_react23.useCallback)((key) => {
33343
+ const handleMediaSelect = (0, import_react24.useCallback)((key) => {
32986
33344
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32987
33345
  (m) => (m.dataset.ohwKey ?? "") === key
32988
33346
  ) ?? null;
32989
33347
  if (!el) return;
32990
33348
  selectMediaElementRef.current(el);
32991
33349
  }, []);
32992
- const handleMediaReplace = (0, import_react23.useCallback)(
33350
+ const handleMediaReplace = (0, import_react24.useCallback)(
32993
33351
  (key) => {
32994
33352
  postToParent2({
32995
33353
  type: "ow:image-pick",
@@ -32999,13 +33357,13 @@ function OhhwellsBridge() {
32999
33357
  },
33000
33358
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
33001
33359
  );
33002
- const handleEditCarousel = (0, import_react23.useCallback)(
33360
+ const handleEditCarousel = (0, import_react24.useCallback)(
33003
33361
  (key) => {
33004
33362
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
33005
33363
  },
33006
33364
  [postToParent2]
33007
33365
  );
33008
- const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
33366
+ const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
33009
33367
  setUploadingRects((prev) => {
33010
33368
  if (!(key in prev)) return prev;
33011
33369
  const next = { ...prev };
@@ -33013,7 +33371,7 @@ function OhhwellsBridge() {
33013
33371
  return next;
33014
33372
  });
33015
33373
  }, []);
33016
- const handleVideoSettingsChange = (0, import_react23.useCallback)(
33374
+ const handleVideoSettingsChange = (0, import_react24.useCallback)(
33017
33375
  (key, settings) => {
33018
33376
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
33019
33377
  const video = getVideoEl2(el);
@@ -33727,6 +34085,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33727
34085
  hasMountedContentNodes,
33728
34086
  indexCollectionItems,
33729
34087
  insertFooterHours,
34088
+ isDeadPageHref,
33730
34089
  isEditSessionActive,
33731
34090
  isPlainLeftClick,
33732
34091
  isRenderableFooterTree,
@@ -33738,6 +34097,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33738
34097
  parseAiFooterState,
33739
34098
  parseAiSectionsState,
33740
34099
  parseTarget,
34100
+ planBuildPageSync,
33741
34101
  recordOverriddenPaths,
33742
34102
  releaseTemplateLogoIfReplaced,
33743
34103
  removeFooterBlock,